{{{SINGLE-QUOTE}}} "
+ || " AND CV3FixedScheduleDefinition.Active = 1 " };
+
+ if( NowOrder.Value = true AND StopAfter.option = "Times") Then
+ if((StopAfter.NUMBER) is not null AND (StopAfter.NUMBER) <> "" AND (StopAfter.NUMBER As number) >= 1) Then
+ Value1 := (StopAfter.NUMBER As number) + 1;
+ WarningResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Selecting Start Now with " || FrequencyCode.Frequencysummary || " and Stop After " || (StopAfter.NUMBER As number) || " Times will result in " || Value1 || " doses being administered.","Alert","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" As {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ endif;
+ endif;
+
+ if( StatOrder.Value = true AND StopAfter.option = "Times") Then
+ if((StopAfter.NUMBER) is not null AND (StopAfter.NUMBER) <> "" AND (StopAfter.NUMBER As number) >= 1) Then
+ Value1 := (StopAfter.NUMBER As number) + 1;
+ WarningResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Selecting Stat and Then with " || FrequencyCode.Frequencysummary || " and Stop After " || (StopAfter.NUMBER As number) || " Times will result in " || Value1 || " doses being administered.","Alert","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" As {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ endif;
+ endif;
+
+ if( NowOrder.Value = true AND StopAfter.option = "Days") Then
+ if((StopAfter.NUMBER) is not null AND (StopAfter.NUMBER) <> "" AND (StopAfter.NUMBER As number) >= 1) Then
+ Value3 := (((Value2 as number) * (StopAfter.NUMBER)) + 1);
+ WarningResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Selecting Start Now with " || FrequencyCode.frequencysummary || " and Stop After " || (StopAfter.NUMBER As number) || " Days will result in " || (Value3 as number) || " doses being administered.","Alert","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" As {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ endif;
+ endif;
+
+ if( StatOrder.Value = true AND StopAfter.option = "Days") Then
+ if((StopAfter.NUMBER) is not null AND (StopAfter.NUMBER) <> "" AND (StopAfter.NUMBER As number) >= 1) Then
+ Value3 := (((Value2 as number) * (StopAfter.NUMBER)) + 1);
+ WarningResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Selecting Stat and Then with " || FrequencyCode.frequencysummary || " and Stop After " || (StopAfter.NUMBER As number) || " Days will result in " || (Value3 as number) || " doses being administered.","Alert","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" As {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ endif;
+ endif;
+
+ endif; //if proctype = "A"
+
+ endif; //if ((this_communication.CallingFieldName = "PRX_Dosing Now and Then" ) or
+ // (this_communication.CallingFieldName = "PRX_Dosing Stat and Then" ) or
+ // (this_communication.CallingFieldName = "StopAfter" ))
+ // and (StopAfter.option = "Days" OR StopAfter.option = "Times") and (NowOrder.Value = true)
+*/
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_NPO_DIET_STARTSTOP.mlm b/MLMStripper/bin/Debug/FORM/FORM_NPO_DIET_STARTSTOP.mlm
new file mode 100644
index 0000000..cd34a2f
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_NPO_DIET_STARTSTOP.mlm
@@ -0,0 +1,104 @@
+maintenance:
+
+ title: FORM_NPO_Diet_StartStop;;
+ mlmname: FORM_NPO_Diet_StartStop;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair;;
+ author: Shawn Head, Allscripts;;
+ specialist: ;;
+ date: 2013-11-09;;
+ validation: testing;;
+
+library:
+ purpose: Manage Date fields
+ ;;
+
+ explanation: This MLM is called from the NPO for Bloodwork order form. The end date will be the start date + 1 on form open and close.
+ Also this MLM will create the start time and end time based on location ICU and CVSU will be start 19:00 stop 04:00.
+ All other locations will be start 21:00 stop 06:00.
+
+ Change history
+
+ 11.8.13 STH Created - CSR#: 31694
+
+ ;;
+
+ keywords: Called MLMs, Form fields, NPO, Diet
+ ;;
+
+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:="";
+
+ //execute on FormOpen and FormClose.
+ if this_communication.CallingEvent in ("FormOpen","FormClose") then
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingField :=this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGuid;
+ requesteddate:= last of (field_list where field_list.DataItemName = "RequestedDate" );
+ stopdate:= last of (field_list where field_list.DataItemName = "StopDate" );
+ requestedtime:= last of (field_list where field_list.DataItemName = "RequestedTime" );
+ stoptime := last of (field_list where field_list.DataItemName = "StopTime" );
+ rq_time := requestedtime.value;
+ userguid := this_communication.userguid;
+
+ //Get the selected patients current location.
+ CurrentLocation := read last
+ {"Select CurrentLocation "
+ ||" From cv3Clientvisit with (nolock)"
+ ||" Where ClientGuid = " || SQL(ClientGuid)
+ ||" and chartguid = " || SQL(ChartGuid)
+ ||" and Guid = " || SQL(ClientVisitGuid)
+ ||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" };
+
+ //if location starts with CVSU or ICU set start time to 19:00 and stop time to 04:00.
+ if (currentLocation matches pattern "CVSU%" OR currentLocation matches pattern "ICU%") then
+ stoptime.value := "04:00";
+ rq_time.ReqTimeCode := "Scheduled Time";
+ rq_time.ReqTimeValue := "19:00";
+ //for any other locations set the start time to 21:00 and stop time to 06:00
+ else
+ stoptime.value := "06:00";
+ rq_time.ReqTimeCode := "Scheduled Time";
+ rq_time.ReqTimeValue := "21:00";
+ endif;
+
+ //always set the stop date to the start date + 1 day.
+ stopdate.value := (RequestedDate.Value) + 86400 seconds;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_NULL_INFO_BOX.mlm b/MLMStripper/bin/Debug/FORM/FORM_NULL_INFO_BOX.mlm
new file mode 100644
index 0000000..c7fe4a6
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_NULL_INFO_BOX.mlm
@@ -0,0 +1,94 @@
+maintenance:
+
+ title:Clear Informational Text Box;;
+ mlmname:FORM_NULL_INFO_BOX;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair ;;
+ author: Teresa Spicuzza, Eclipsys Corp;;
+ specialist: ;;
+ date: 2007-01-26;;
+ validation: testing;;
+
+library:
+ purpose: This MLM sets the field PRX_TempOrderInfo to Null upon form close.
+ ;;
+ explanation: This MLM is launched on form close
+ ;;
+ keywords: Called MLMs, Form fields, Order Info
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+// CallingField :=this_communication.CallingFieldName;
+// CallingEvent := this_communication.CallingEvent;
+// FormType := this_communication.FormType;
+
+
+ // This removes any text in the field before submitting order
+ TempInfo_field := last of (field_list
+ where field_list.DataItemName = "PRX_TempOrderInfo" );
+ PermInfo_field := last of (field_list
+ where field_list.DataItemName = "PRX_PermOrderInfo" );
+ // RouteCode_field := last of (field_list
+ // where field_list.DataItemName = "OrderRouteCode" );
+
+
+
+
+ If PermInfo_field.Value = "Info "
+ then
+ TempInfo_field.Value := NULL;
+ else
+ TempInfo_field.Value := NULL;
+ endif;
+
+
+ // this_communication.DisplayForm := "Yes";
+ // this_communication.Message := "MLM Field :" || CallingField || "\n" ||
+ // "MLM Event :" || CallingEvent || "\n" ||
+ // "Form type :" || FormType;
+ // this_communication.MessageType := "Informational";
+
+
+
+
+
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_NURSE_INSTRUCTION_ALERT.mlm b/MLMStripper/bin/Debug/FORM/FORM_NURSE_INSTRUCTION_ALERT.mlm
new file mode 100644
index 0000000..dae7a9c
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_NURSE_INSTRUCTION_ALERT.mlm
@@ -0,0 +1,127 @@
+maintenance:
+
+ title: ;;
+ mlmname: FORM_Nurse_Instruction_Alert;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St.Clair;;
+ author: vikas Yadav;;
+ specialist: ;;
+ date: 2015-05-07;;
+ validation: testing;;
+library:
+ purpose:
+ ALERT FOR NURSE_INSTRUCTION
+
+
+ ;;
+explanation:
+
+ change history
+ 06.04.2015 TMS CSR-33506 Updated Message to Include instructions for Non Formulary Medication Entry.
+ 10/07.2015 TMS Removed from production per PRISM recommendation September meeting. CSR 33794
+ 04.27.2016 TMS Reactivated per request from PRISM and Risk Management. CSR 34486
+ ;;
+
+keywords:
+
+
+ ;;
+
+knowledge:
+
+ type: data-driven;;
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+
+ event_OrderInit := event{OrderInit User Order: WHERE Name in ( "Nurse Instruction:")};
+
+
+
+
+ //Added by Vishal Motwani on 2014-12-01
+ Harddest_var := DESTINATION {Alert} WITH
+ [alert_type := "Warning",
+ short_message := "PATIENT SAFETY RISK",
+ Priority := "Medium",
+ Scope := "Chart",
+ rule_number:= 1015,
+ render_as := "HTML",
+ send_with_order := send_alert,
+ alert_dialog_settings := sync_alert_dialog,
+ async_alert_dialog_settings := async_alert_dialog,
+ document_name := alert_override_document_name,
+ document_conditional_text:= document_conditional_text_list,
+
+
+ ];
+
+
+
+
+ eventName := EvokingEventType;
+
+
+
+ if called_by_editor then
+ if eventName = "OrderInit" then
+ order_obj:= read last {Order: This };
+ EvokingObject:= order_obj;
+
+ EndIf;
+ endif;
+
+/*
+ MSG := " ***PATIENT SAFETY RISK***
DO NOT USE Nurse Instructions for medication, diagnostic, diet or consult orders.
+If you are unable to enter an order, please ask for assistance or call support @ 8600.
" ;
+
+*/
+ header := " " || "***PATIENT SAFETY RISK***
";
+ infomsg := " "|| " DO NOT USE Nurse Instructions for medication, diagnostic, diet or consult orders. "||
+ " " || " If unable to locate a medication order, please enter using Non Formulary Medication. " || " ";
+ helpmsg := " " ||" If you are unable to enter an order, please ask for assistance or call support @ 8600. "|| "
";
+
+ MSG := header || infomsg || helpmsg;
+
+
+ //break;
+
+ ;;
+
+ evoke:
+ event_OrderInit;
+
+
+ ;;
+
+ logic:
+
+ Conclude True;
+ ;;
+
+ action:
+
+ //Write "msgNoVacNoInfoOrder" as Softdest_var;
+
+ If EventName = "OrderInit" and EVOKINGOBJECT.OrderSetName is null //and TypeCode_Trim = "Inpatient"
+ then
+ if EXISTS MSG then
+ Write MSG at Harddest_var ;
+
+
+ endif;
+
+ EndIf;
+
+
+
+
+ ;;
+
+Urgency: 70;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_NURSING_INSTRUCTIONS.mlm b/MLMStripper/bin/Debug/FORM/FORM_NURSING_INSTRUCTIONS.mlm
new file mode 100644
index 0000000..6c58cec
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_NURSING_INSTRUCTIONS.mlm
@@ -0,0 +1,69 @@
+maintenance:
+
+ title: FORM_NURSING_INSTRUCTIONS;;
+ mlmname: FORM_NURSING_INSTRUCTIONS;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Hospital;;
+ author: Janet Nordin;;
+ specialist: Don Warnick ;;
+ date: 2018-04-26;;
+ validation: testing;;
+
+library:
+ purpose: Nursing Instructions Form Logic
+ ;;
+
+ explanation: This MLM is called from the Nursing Instructions Form
+
+
+ Change history
+
+ 05.18.2018 DW CSR# 36411 Created
+
+ ;;
+ keywords: Called MLMs
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+ error_message:="";
+
+ field_list := this_form.fields;
+ CallingEvent:= this_communication.CallingEvent;
+ Visit_Guid := this_communication.ClientVisitGuid;
+ Chart_Guid := this_communication.ChartGuid;
+ Client_Guid := this_communication.ClientGuid;
+
+ Communication_obj:= this_communication.primaryobj;
+ Order_set_name := Communication_obj.OrderSetName;
+ Order_set_heading:= Communication_obj.OrderSetHeading;
+
+ Order_Field := last of (field_list where field_list.DataItemName = "NUR_GenAdditionalTxt" );
+ Order_Field_Value := Order_Field.Value;
+
+ // If the form is called from these order sets make the order field "read only"
+
+ If Order_set_name = "Admission Orders - Acute Ischemic Stroke/TIA" and Order_set_heading = "DirectAdmit or IP w/New Stroke"
+
+ then
+
+ Order_Field.Control_Read_Only := true;
+
+ endif;
+
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+ return this_communication, this_form;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_NUR_CONSULTS.mlm b/MLMStripper/bin/Debug/FORM/FORM_NUR_CONSULTS.mlm
new file mode 100644
index 0000000..dab3090
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_NUR_CONSULTS.mlm
@@ -0,0 +1,137 @@
+maintenance:
+
+ title: Consult Doctors, pick one;;
+ mlmname: FORM_NUR_Consults;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Consult Docs MLM;;
+ author: Robert Spence, Eclipsys Corp;;
+ specialist: ;;
+ date: 2006-09-18;;
+ validation: testing;;
+
+library:
+ purpose: This MLM restricts the doctor list, based on the type of consult selected
+
+ ;;
+ explanation: This MLM restricts the doctor list, based on the type of consult selected
+
+
+ ;;
+ keywords: Called MLMs, Form fields, Consults
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingField :=this_communication.CallingFieldName;
+ CallingEvent := this_communication.CallingEvent;
+ FormType := this_communication.FormType;
+
+ Info_field := last of (field_list
+ where field_list.DataItemName = "MD_Consult_ Choosing a Physician" );
+
+ //Starts with:
+ StartString:= "Please select the correct checkbox for the order: " ||
+ "Physician Consult, Anesthesia Consult, or Rehabilitation Consult.";
+
+ PhysCheck_field := last of (field_list
+ where field_list.DataItemName = "MD_Consult_PhysicianCB" );
+
+ AnesCheck_field := last of (field_list
+ where field_list.DataItemName = "Anesthesia Consult");
+
+ RehabCheck_field := last of (field_list
+ where field_list.DataItemName = "Rehabilitation Consult");
+
+ Doctor_field := last of (field_list
+ where field_list.DataItemName = "Obj_Plus_Consult");
+
+
+ // this_communication.DisplayForm := "Yes";
+ // this_communication.Message := "MLM Field :" || CallingField || "\n" ||
+ // "MLM Event :" || CallingEvent || "\n" ||
+ // "Form type :" || FormType;
+ // this_communication.MessageType := "Informational";
+
+ If CallingEvent ="FieldChange"
+ then
+ If CallingField = "MD_Consult_PhysicianCB"
+ then
+ If PhysCheck_Field.Value = True
+ then
+ AnesCheck_field.Control_Read_Only := True;
+ RehabCheck_Field.Control_Read_Only := True;
+ Doctor_Field.Value :="";
+ Info_field.Value :="Please Choose a Physician From the Physician List";
+ else
+ AnesCheck_field.Control_Read_Only := False;
+ RehabCheck_Field.Control_Read_Only := False;
+ Doctor_Field.Value :="";
+ Info_field.Value := StartString;
+ endif;
+ elseif CallingField = "Anesthesia Consult"
+ then
+ If AnesCheck_field.Value = True
+ then
+ PhysCheck_Field.Control_Read_Only := True;
+ RehabCheck_Field.Control_Read_Only := True;
+ Doctor_Field.Value :="Keystone Anesthesia Consultants, LTD (KACL)";
+ Info_field.Value :="Physician Group Has Been Filled In For This Anesthesia Consult";
+ else
+ PhysCheck_Field.Control_Read_Only := False;
+ RehabCheck_Field.Control_Read_Only := False;
+ Doctor_Field.Value :="";
+ Info_field.Value := StartString;
+ endif;
+ elseif CallingField = "Rehabilitation Consult"
+ then
+ If RehabCheck_field.Value = True
+ then
+ PhysCheck_Field.Control_Read_Only := True;
+ AnesCheck_Field.Control_Read_Only := True;
+ Doctor_Field.Value :="Medical Rehabilitation, Inc. (MRI)";
+ Info_field.Value :="Physician Group Has Been Filled In For This Rehabilitation Consult";
+ else
+ PhysCheck_Field.Control_Read_Only := False;
+ AnesCheck_Field.Control_Read_Only := False;
+ Doctor_Field.Value :="";
+ Info_field.Value := StartString;
+ endif;
+ endif; //Calling fields endif
+ endif; //Events 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_NUR_CONSULT_MD_PREVENT_DUPLICATE.mlm b/MLMStripper/bin/Debug/FORM/FORM_NUR_CONSULT_MD_PREVENT_DUPLICATE.mlm
new file mode 100644
index 0000000..3ea2e76
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_NUR_CONSULT_MD_PREVENT_DUPLICATE.mlm
@@ -0,0 +1,163 @@
+maintenance:
+
+ title: Ordering: Prevents entry of consult if one already exists for this doctor;;
+ mlmname: FORM_Nur_Consult_MD_Prevent_Duplicate;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Hospital;;
+ author: Don Warnick Allscripts Corp;;
+ specialist: Don Warnick Allscripts Corp ;;
+ date: 2011-03-14;;
+ validation: testing;;
+
+library:
+ purpose: Prevent duplicate consult for a doctor
+
+ ;;
+
+ explanation: This MLM is called from forms where Consulting MD{{{SINGLE-QUOTE}}}s are ordered.
+
+
+ Change history
+
+ 03.14.2010 DW Initial build
+ 05.08.2010 DW Altered code to stop the code from firing when editing from submit ItemEvent <> "UserEditUnsubmitted"
+
+ ;;
+ keywords: Called MLMs, Form open, heparin
+ ;;
+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;
+
+
+
+
+// Initialize error message
+
+ error_message:="";
+
+// Assigns fields passed in the Form object to the Field object
+
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ Visit_Guid := this_communication.ClientVisitGuid;
+ Chart_Guid := this_communication.ChartGuid;
+ Client_Guid := this_communication.ClientGuid;
+ ItemEvent := this_communication.ItemEvent;
+
+ local_session := cds_session.local;
+
+ ConsultantNotDuplicate := last of (field_list where field_list.DataItemName = "MLM_Generic_Must_Fill_Text" );
+
+ ConsultingDoctor := last of (field_list where field_list.DataItemName = "Obj_Plus_Consult" );
+ If ConsultingDoctor is null then ConsultingDoctor := last of (field_list where field_list.DataItemName = "MD_Consult Anesth Msg" ); endif;
+ If ConsultingDoctor is null then ConsultingDoctor := last of (field_list where field_list.DataItemName = "MD_Consult_ Choosing a Physician" ); endif;
+
+ ConsultingDoctorValue := ConsultingDoctor.value;
+
+
+
+
+// If not a modify order, search patient{{{SINGLE-QUOTE}}}s record and session object for this consultant
+
+
+ if ItemEvent <> "UserModify" and ItemEvent <> "UserEditUnsubmitted"
+
+ then
+
+ SessionConsult.value := local_session.SessionConsultingMD;
+
+ // Find the doctor number entered by the user by removing the parenthesis
+
+ substring_mlm := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_BETWEEN{{{SINGLE-QUOTE}}};
+ EnteredNumber :=CALL substring_mlm with (ConsultingDoctorValue,"(",")");
+
+ // Truncate the doctor name entered by the user
+
+ EndOfName := find " " in string ConsultingDoctorValue;
+ EnteredName := SUBSTRING (EndOfName-1) CHARACTERS FROM ConsultingDoctorValue;
+
+
+ // Search the patients record for the entered doctor number
+
+ removeprovvisitrole_guid :=
+ read last { " select cpvr.guid from cv3careproviderid as cpi with (nolock) "
+ ||" join cv3careprovidervisitrole as cpvr with (nolock) "
+ ||" on cpvr.clientguid = " || sql(client_GUID)
+ ||" and cpvr.clientvisitguid = " ||sql(Visit_Guid)
+ ||" and cpvr.providerguid = cpi.providerguid "
+ ||" and cpvr.active = 1 "
+ ||" and cpvr.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ ||" and cpvr.fromdtm <= getdate() "
+ ||" and (cpvr.todtm is null or cpvr.todtm >= getdate()) "
+ ||" and cpvr.rolecode = {{{SINGLE-QUOTE}}}Consulting{{{SINGLE-QUOTE}}} "
+ ||" where cpi.IDCode = " ||sql(EnteredNumber)
+ ||" and cpi.ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}} "
+ };
+
+ // Search the session object for the entered doctor number
+
+ FoundInSessionObjectString := find EnteredNumber in string local_session.SessionConsultingMD;
+
+ // If found in the patien{{{SINGLE-QUOTE}}}t record, return an error
+
+
+ If Exists removeprovvisitrole_guid then
+
+ ConsultantNotDuplicate.control_mandatory := True;
+ this_communication.Message := "\n\n A consult for " || EnteredName || " already exists. Duplicate entries are not allowed. "; this_communication.MessageType := "Error";
+
+ // If found in the session object, return an error
+
+ ElseIf FoundInSessionObjectString > 0 then
+
+ ConsultantNotDuplicate.control_mandatory := True;
+ this_communication.Message := "\n\n A consult for " || EnteredName || " has already been selected. Duplicate entries are not allowed. "; this_communication.MessageType := "Error";
+
+
+ // If not in patient{{{SINGLE-QUOTE}}}s record or session object, proceed
+
+ else
+
+ ConsultantNotDuplicate.control_mandatory := False;
+
+ if local_session.SessionConsultingMD is null
+ then local_session.SessionConsultingMD := EnteredNumber ;
+ else local_session.SessionConsultingMD := local_session.SessionConsultingMD || "," || EnteredNumber ;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_NUR_DISCHARGE.mlm b/MLMStripper/bin/Debug/FORM/FORM_NUR_DISCHARGE.mlm
new file mode 100644
index 0000000..824e7ff
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_NUR_DISCHARGE.mlm
@@ -0,0 +1,290 @@
+maintenance:
+
+ title: Ordering: Check for complete registration when entering a discharge or expire order;;
+ mlmname: FORM_Nur_Discharge;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Discharge Order MLM;;
+ author: Don Warnick Eclipsys Corp;;
+ specialist: ;;
+ date: 2008-02-25;;
+ validation: testing;;
+
+library:
+ purpose: Prevent a discharge order from being entered if the patient visit is not complete or if the registration date is in the future
+
+ ;;
+
+ explanation: This MLM is called from the Discharge form.
+ Upon form open the patient comments are interrogated for the presence of a print location comment
+ and the registration date is compared to the present date
+
+
+ Change history
+
+ 05.20.2009 DW Added code for compare of registration date to the current date
+ 10.27.2009 RS Changed the comment to look for from print location to reg initials
+ 06.03.2014 DW CSR# 31688 Changes for MU2
+ 08.26.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 HI Dynamic Creation with all details Like ICD10 Code, Snowmed Code etc.
+ 10.01.2015 JML CSR # 23359 - Copied to Production
+ 10.06.2015 JML WO #1895816: Modified code to dissect the Health Issue Name in the event it contains an apostrophe; replace apostrophe
+ with 2 single quotes so SQL can handle search.
+ 10.07.2015 JML WO #1895816: Moved to Production - CC #2699.
+ 08.22.2017 DW CSR# 36214 - SCM AM Registration - Changed criteria for determining incomplete registration to "iscompleteregistration" flag
+
+
+ ;;
+ keywords: Called MLMs, Form fields, discharge, complete visit
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ print_location := "Reg Initials";
+
+ error_message:="";
+
+
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ Visit_Guid := this_communication.ClientVisitGuid;
+ Chart_Guid := this_communication.ChartGuid;
+ Client_Guid := this_communication.ClientGuid;
+ order_name := this_communication.primaryobj.name;
+
+
+ if order_name matches pattern "discharge%" then order_name_message := "discharge"; endif;
+ if order_name matches pattern "expire%" then order_name_message := "expire"; endif;
+
+
+ // 08/22/17 DW changed criterai to utilize the "iscompleteregistration" flag
+
+/*
+ reg_complete := read last {"select typecode from cv3commentdeclaration where typecode = " || SQL(print_location)
+ || " and ClientGUID = " || SQL(client_guid)
+ || " and ChartGUID = " || SQL(chart_guid)
+ || " and ClientVisitGUID= " || SQL(visit_guid)
+ || " and active = 1 "
+ };
+*/
+
+ reg_complete := read last {"
+ select vr.IsCompleteRegistration
+ from SXAAMVisitRegistration vr with (nolock)
+ where vr.IsCompleteRegistration = 1 and vr.ClientVisitGUID = " || visit_guid || " "
+ };
+
+
+ futuredate := read last {"select convert(char(17),admitdtm) from cv3clientvisit where admitdtm > getdate() "
+ || " and ClientGUID = " || SQL(client_guid)
+ || " and ChartGUID = " || SQL(chart_guid)
+ || " and Guid = " || SQL(visit_guid)
+ || " and active = 1 "
+ };
+
+ // Check for an incomplete registration (quick reg that has not been addressed)
+
+ if not exist reg_complete then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message :=
+ "The registration for this account is incomplete."
+ ||"\n\nDo not enter the "|| order_name_message ||" order at this time."
+ ||"\n\nPlease notify the registrar of the incomplete registration for this account. "
+ ||"\n\nUpon notification by the registrar that the registration is complete,"
+ ||"\n\nyou may proceed with the "|| order_name_message ||" process in SCM.\n\n";
+ this_communication.MessageType := "Informational";
+ endif;
+
+
+ // Check for future registration date(reg clerk mistake that will prevent the patient from being discharged)
+
+
+ if exist futuredate then
+ this_communication.Message :=
+ "This patient{{{SINGLE-QUOTE}}}s registration date, "|| futuredate || ", is in the future."
+ ||"\n\nDo not enter the "|| order_name_message ||" order at this time."
+ ||"\n\nPlease notify the registrar of the improper registration date for this account. "
+ ||"\n\nUpon notification by the registrar that the date has been corrected,"
+ ||"\n\nyou may proceed with the "|| order_name_message ||" process in SCM.\n\n";
+ this_communication.MessageType := "Informational";
+ endif;
+
+
+
+ (DischargeDiagnosisHIOnFile) := read
+ {
+ " select distinct hi.shortname "
+ || " from cv3healthissuedeclaration hi with (nolock) "
+ || " join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
+ || " where hi.clientguid = " || client_guid || " and hi.chartguid = " || chart_guid || " and hi.clientvisitguid = " || visit_guid || " "
+ || " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} And hi.ICD10Code is not null " // Added By Shivprasad on 29 Sept 2015 for ICD9-10 Changes
+ || " and hi.typecode = {{{SINGLE-QUOTE}}}Discharge Diag{{{SINGLE-QUOTE}}} "
+ };
+
+
+ // Search for Admit or Discharge Problems
+
+ ProblemListADM := last of (field_list where field_list.DataItemName = "Obj_Plus_Problem List Builder ADM");
+ ProblemListDIS := last of (field_list where field_list.DataItemName = "Obj_Plus_Problem List Builder DISC");
+
+ If ProblemListADM is not null
+ then
+ ProblemListValue := ProblemListADM.Value;
+ NewHealthIssueHIType:= "Admit Diag";
+
+ Elseif ProblemListDIS is not null
+ then
+ ProblemListValue := ProblemListDIS.Value;
+ NewHealthIssueHIType:= "Discharge Diag";
+
+ Endif;
+
+
+ // Proceed with creating a Problem (HI), if information is found in one of the fields
+
+ If ProblemListValue is not null
+
+ then
+
+ NewHealthIssueListBox := last of (field_list where field_list.DataItemName = "NUR_Comment 3");
+ NewHealthIssueList := " ";
+
+ formlist := call str_parse with ProblemListValue, "|"; // Parse the value into a string of Name/Number pairs
+
+ index_list := 1 seqto (count formlist) ;
+
+ for J in index_list do
+ singledate := formlist[J];
+ hinumberstart := find "..." in string singledate;
+ NewHealthIssuName := Trim(SUBSTRING (hinumberstart -1) CHARACTERS STARTING AT (1) from singledate);
+ NewHealthIssueHICode:= Trim(SUBSTRING (10) CHARACTERS STARTING AT (hinumberstart + 4) from singledate);
+
+ //JML: WO# 1895816 Code change Start
+ if ( NewHealthIssuName matches pattern "%{{{SINGLE-QUOTE}}}%" ) then
+ hiFirstPart := SUBSTRING ((FIND "{{{SINGLE-QUOTE}}}" IN STRING NewHealthIssuName) - 1) CHARACTERS STARTING AT 1 FROM NewHealthIssuName; //Zenker
+ hiSecondPart := SUBSTRING ( (LENGTH NewHealthIssuName) - (FIND "{{{SINGLE-QUOTE}}}" IN STRING NewHealthIssuName)) CHARACTERS STARTING AT ( (FIND "{{{SINGLE-QUOTE}}}" IN STRING NewHealthIssuName) + 1) FROM NewHealthIssuName;
+ HealthIssueSearchName := hiFirstPart || "{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}" || hiSecondPart;
+ else
+ HealthIssueSearchName := NewHealthIssuName;
+ endif;
+ //JML Code change end
+
+ If j = 1 then
+ NewHealthIssueList := NewHealthIssuName;
+ else
+ NewHealthIssueList := NewHealthIssueList || ", " || NewHealthIssuName;
+ endif;
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((Visit_Guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ endtry;
+
+ catch Exception ex
+ error_occurred:= true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" ||ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+ endcatch;
+
+
+ try
+
+ NewHealthIssueHIScheme := "ICD10";
+ // Added By Shivprasad for [CSR#23359- ICD9-10 MLM change] for Duplicate HI identification
+ HI_Present := read {" select distinct hi.shortname "
+ || "from cv3healthissuedeclaration hi with (nolock) "
+ || "join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
+ || "where hi.clientguid = " || SQL(Client_Guid) || " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ //|| "and hi.typecode not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}) "
+ || " And hi.ICD10Code is not null " // Added By Shivprasad on 29 Sept 2015 for ICD9-10 Changes
+ || " and ( "
+ || "hi.text like {{{SINGLE-QUOTE}}}%"|| HealthIssueSearchName || "%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%"|| HealthIssueSearchName || "%{{{SINGLE-QUOTE}}} or "
+ || " "
+ || "(Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}"|| NewHealthIssueHICode ||"{{{SINGLE-QUOTE}}}) "
+ || " ) "
+ || " AND ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} AND ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} OR ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} AND hi.ChartGUID = " || SQL(Chart_Guid) || " ) OR hi.ClientVisitGUID = " || SQL(Visit_Guid) || " ) ) "
+ || " AND hi.TypeCode = {{{SINGLE-QUOTE}}}Discharge Diag{{{SINGLE-QUOTE}}}"
+ };
+
+ If Not Exist HI_Present Then
+
+//--Start: CSR 23359-ICD9-ICD10 HI Change Added By shivprasad
+ Terms := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindIMOTerms with (NewHealthIssueHIScheme,NewHealthIssueHICode);
+ FOR i IN 1 SEQTO (Terms.Count as Number ) DO
+ HI_obj := Terms[i];
+ HI_Name := HI_obj.TermName as string;
+ If HI_Name = NewHealthIssuName then
+ HI_NO := i ;
+ Endif;
+ ENDDO;
+ If HI_NO is Null Then
+ HI_NO :=1 ;
+ Endif;
+ New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, Terms[HI_NO]);
+
+//--End Added by Shivprasad
+
+ //New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, NewHealthIssueHIScheme, NewHealthIssueHICode );
+
+
+ New_HealthIssue_obj.Text := "Created from Discharge Order . " ;
+ New_HealthIssue_obj.Name := NewHealthIssuName;
+
+ if ( New_HealthIssue_obj is NOT NULL )
+ then
+ void := call New_HealthIssue_obj.Save;
+ void := call New_HealthIssue_obj.Dispose;
+ endif;
+
+ if ( client_visit_obj is NOT NULL )
+ then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+ Endif; // End of HI_Present
+
+ endtry;
+
+ catch exception ex
+ error_occurred := true;
+ if ( New_HealthIssue_obj is NOT NULL )
+ then
+ void:= call New_HealthIssue_obj.Dispose;
+ New_HealthIssue_obj:= null;
+ endif;
+ endcatch;
+
+ enddo;
+
+ NewHealthIssueListBox.value := NewHealthIssueList;
+
+
+ endif; // ProblemList Value is not null
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_NUR_LASTDOSEGIVEN.mlm b/MLMStripper/bin/Debug/FORM/FORM_NUR_LASTDOSEGIVEN.mlm
new file mode 100644
index 0000000..7d3ada4
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_NUR_LASTDOSEGIVEN.mlm
@@ -0,0 +1,85 @@
+maintenance:
+
+ title: Nursing Last Dose Given;;
+ mlmname: FORM_Nur_LastDoseGiven;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Hospital;;
+ author: Don Warnick;;
+ specialist: ;;
+ date: 2007-08-14;;
+ validation: testing;;
+
+library:
+ purpose: Grey out the unknown last dose given field if a date is entered and vice versa.
+
+ ;;
+
+ explanation: This MLM is called from the Nursing Pre-Admit Meds form.
+ If the Last dose given date or time is entered the last dose unknown field is greyed (and vice versa).
+
+
+ ;;
+ keywords: Called MLMs, Form fields, last dose given
+ ;;
+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;
+
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingField :=this_communication.CallingFieldName;
+
+ orderroletype:= this_communication.primaryobj.enterrole;
+
+
+ lastdosedate := last of (field_list where field_list.DataItemName = "Nur_HM_LastDoseGivenDate" );
+ lastdosetime := last of (field_list where field_list.DataItemName = "Nur_HM_LastDoseGivenTime" );
+ lastdoseunknown := last of (field_list where field_list.DataItemName = "Nur_HM_LastDoseUnknownCB" );
+
+ If CallingField = "Nur_HM_LastDoseUnknownCB" then
+ if lastdoseunknown.value = true then
+ lastdosedate.control_read_only:= true;
+ lastdosedate.control_mandatory:= false;
+ lastdosedate.value := " ";
+ lastdosetime.control_read_only:= true;
+ lastdosetime.control_mandatory:= false;
+ lastdosetime.value := " ";
+ else lastdosedate.control_read_only:= false;
+ lastdosedate.control_mandatory:= true;
+ lastdosetime.control_read_only:= false;
+ lastdosetime.control_mandatory:= true;
+ endif;
+ elseif CallingField = "Nur_HM_LastDoseGivenDate" then
+ if lastdosedate.value is not null then
+ lastdoseunknown.control_read_only:=true;
+ else lastdoseunknown.control_read_only:=false;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_NUR_RESTRAINT.mlm b/MLMStripper/bin/Debug/FORM/FORM_NUR_RESTRAINT.mlm
new file mode 100644
index 0000000..8f68a71
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_NUR_RESTRAINT.mlm
@@ -0,0 +1,127 @@
+maintenance:
+
+ title: Ordering: Prevent the selection of conflicting Isolation Types and require at least one type be selected;;
+ mlmname: FORM_Nur_Restraint;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Isolation Set MLM;;
+ author: Don Warnick and Kathy Kennedy, Eclipsys Corp;;
+ specialist: ;;
+ date: 2006-11-07;;
+ validation: testing;;
+
+library:
+ purpose: Prevent the simultaneous slection of two conflicting Restraint Types and increments the Due at field value to 1 hr post initiated time
+ ;;
+
+ explanation: This MLM is called from the NUR_RestraintBehvMgt and NUR_RestraintMed Mgt restraint forms .
+ If Restraint Type, "Physical" is selected, then the "Chemical" selection becomes unavailable and vice versa
+ The Due At field value is 1 hr after the Initated Time
+
+
+ ;;
+ keywords: Called MLMs, Form fields, Restraint
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ // 1. Hide the Chemical Restraint selection if a Physical Restraint is entered and vice versa
+ // 2. Set the Due at time to 1 hour after the Initiated Time
+
+ physical := last of (field_list where field_list.DataItemName = "NUR_RestraintPhysicalType" );
+ chemical := last of (field_list where field_list.DataItemName = "NUR_RestraintChemicalType" );
+ initiated_date := last of (field_list where field_list.DataItemName = "NUR_Intiated Date" );
+ initiated_time := last of (field_list where field_list.DataItemName = "NUR_Time" );
+ due := last of (field_list where field_list.DataItemName = "NUR_Time2" );
+ continuation_date := last of (field_list where field_list.DataItemName = "NUR_Requested Date" );
+ continuation_time := last of (field_list where field_list.DataItemName = "NUR_Time3" );
+ requested_date := last of (field_list where field_list.DataItemName = "RequestedDate");
+
+ If this_communication.CALLINGEVENT = "FormOpen" then
+ if exists initiated_date.value then
+ initiated_date.control_read_only := true;
+ initiated_time.control_read_only := true;
+ continuation_date.Value := requested_date.value;
+ continuation_time.Value := "";
+ continuation_date.control_read_only := false;
+ continuation_time.control_read_only := false;
+ continuation_date.control_mandatory := True;
+ continuation_time.control_mandatory := True;
+ due.control_read_only := true;
+ physical.control_read_only := true;
+ chemical.control_read_only := true;
+ physical.control_mandatory := false;
+ chemical.control_mandatory := false;
+ else
+ initiated_date.value := requested_date.value;
+ continuation_date.control_mandatory := false;
+ continuation_time.control_mandatory := false;
+ continuation_date.control_read_only := true;
+ continuation_time.control_read_only := true;
+ endif;
+ else
+
+ If initiated_time.value is null
+ then
+ due.value := "";
+ else
+ initiated_plus_1:=(initiated_time.value as time) + 1 hour;
+ due.Value:= Hour of initiated_plus_1|| ":" || Minute of initiated_plus_1;
+ endif;
+
+ If physical.value is not null
+ then
+ chemical.control_read_only := True;
+ chemical.control_mandatory := False;
+ else
+ chemical.control_read_only := False;
+ chemical.control_mandatory := True;
+ endif;
+
+ If chemical.value is not null
+ then
+ physical.control_read_only := True;
+ physical.control_mandatory := False;
+ else
+ physical.control_read_only := False;
+ physical.control_mandatory := True;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_OBSERVATION_ADT.mlm b/MLMStripper/bin/Debug/FORM/FORM_OBSERVATION_ADT.mlm
new file mode 100644
index 0000000..12a9b14
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_OBSERVATION_ADT.mlm
@@ -0,0 +1,483 @@
+maintenance:
+
+ title: Observation Admit/Discharge;;
+ mlmname: FORM_Observation_ADT;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair;;
+ author: Don Warnick, Eclipsys Corp;;
+ specialist: ;;
+ date: 2010-07-15;;
+ validation: testing;;
+
+library:
+ purpose: Manage Date fields
+ ;;
+
+ explanation: This MLM is called from the Observation forms and Order sets
+
+ Change history
+
+ 07.15.2010 DW Created
+ 07.12.2011 DW Introduced logic to support mandatory MD HI entry found in Form_Health_Issue_Entered_From_Order_Form
+ 08.09.2013 DW HD#159598 Altered date field from "requesteddate" to "CM_Patient_Change_Date"
+ 11.5.2013 SH CSR#: 31898 Altered to include PA, PA-C, and CRNP for required HI and Admit date/time to auto populate.
+ Also added 5 minutes to the start time to prevent nuisance alert from occuring.
+ 02.25.2014 JML CSR# 31744: Modified for Discharge order ONLY; if patient is "emergency", then remove the mandatory
+ field property on Discharge Diagnosis.
+ 06.03.2014 DW CSR# 31688 Changes for MU2
+ 08.07.2014 DW HD#167318 - Exclude all Infusion Department users from the Discharge Dx requirement.
+
+ ;;
+
+ keywords: Called MLMs, Form fields, Observation ADT Date fields
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ visit_guid := this_communication.ClientVisitGUID;
+ client_guid := this_communication.ClientGUID;
+ chart_guid := this_communication.ChartGUID;
+ orderroletype:= this_communication.primaryobj.enterrole;
+ orderForm := this_communication.PrimaryObj.Name;
+ userguid := this_communication.userguid;
+
+
+ if (orderroletype matches pattern "%Physician%") or orderroletype in ("PA","PA-C","CRNP","Nurse (RN)") then
+ orderrole := true;
+ else
+ orderrole := false;
+ endif;
+
+ orgunit := read last {" select ou.Name "
+ || " from cv3user u with (nolock) "
+ || " join CV3OrganizationalUnit ou with (nolock) on ou.guid = u.OrgUnitGUID "
+ || " where u.guid = " || SQL(userguid)
+ };
+
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ field_list:= this_form.fields;
+ CallingField :=this_communication.CallingFieldName;
+ CallingEvent := this_communication.CallingEvent;
+
+
+ // On some of the forms the "system" date field is not used. This permits either to work.
+
+ requesteddate:= last of (field_list where field_list.DataItemName = "RequestedDate" );
+
+ if not exist requesteddate
+ then
+ requesteddate:= last of (field_list where field_list.DataItemName = "CM_Patient_Change_Date" );
+ endif;
+
+ requestedtime:= last of (field_list where field_list.DataItemName = "RequestedTime" );
+
+ Obs_field := last of (field_list where field_list.DataItemName = "NUR_ADTObsvStatusCBx");
+ SSop_field := last of (field_list where field_list.DataItemName = "NUR_ADTSsopStatusCBx");
+ Inp_field := last of (field_list where field_list.DataItemName = "NUR_ADTInptStatusCBx");
+ Surgery_field := last of (field_list where field_list.DataItemName= "NUR_ADTsdcstatusCBx");
+ Denied_field := last of (field_list where field_list.DataItemName = "NUR_ADTAdmDeniedCBx");
+
+ Dis_Time_Testing_field := last of (field_list where field_list.DataItemName= "NUR_CB Testing" );
+ Dis_Time_AM_field := last of (field_list where field_list.DataItemName = "NUR_CB AM");
+ Dis_Time_PM_field := last of (field_list where field_list.DataItemName = "NUR_CB PM");
+ Dis_Time_Today_field:= last of (field_list where field_list.DataItemName = "NUR_CB Today");
+ Dis_Time_Tomorrow_field:= last of (field_list where field_list.DataItemName= "NUR_CB Tomorrow");
+ Dis_Time_Now_field:= last of (field_list where field_list.DataItemName = "NUR_CB Now");
+
+ AttendingPhysician:= last of (field_list where field_list.DataItemName = "Obj_Plus_Consult");
+ Two_Midnight_field:= last of (field_list where field_list.DataItemName = "CPOE_Adm_TwoMidnight");
+
+ Dis_Diagnosis_field:= last of (field_list where field_list.DataItemName = "Obj_Plus_Problem List Builder DISC");
+ Dis_Current_Diagnosis_field:= last of (field_list where field_list.DataItemName = "NUR_ADT Discharge Dx");
+
+ Dis_Goals_field:= last of (field_list where field_list.DataItemName = "NUR_DC_Goals");
+
+ //**** CSR 31744 Change ****
+ Dis_ED_Diagnosis_field := last of (field_list WHERE field_list.DataItemName = "DISC_Discharge Diagnosis");
+
+ MD_Box := last of (field_list where field_list.DataItemName = "MLM_Physician_Mandatory_HI");
+
+ // extract components of current time and create fields which can be compared with requested time
+
+ hr := extract hour now; if hr < 10 then hr := "0" || hr; endif;
+ mi := extract minute now; if mi < 10 then mi := "0" || mi; endif;
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+
+ calc_currtime := ((hr ||":"|| mi) as time) + 300 seconds; //changed to add 5 minutes to time to prevent nuisance alerts
+ currdate := yr || "-" || mn || "-" || dd ;
+ currtime := extract hour calc_currtime || ":" || extract minute calc_currtime;
+
+// Populate the Requested Time Code with "start time"
+
+ requestedtime.value.ReqTimeCode := "Start Time";
+
+
+
+// Only called upon open from the Admit, Observation, Discharge forms
+
+ //**** CSR 31744 Change Begin ****
+ visitType := read last {"SELECT cv.TypeCode"
+ || " FROM CV3Client c WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
+ || " ON c.GUID = cv.ClientGUID"
+ || " WHERE c.GUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)};
+
+ if ( ( visitType <> "Emergency" ) and ( visitType <> "Clinic" ) )
+
+ then
+ Dis_ED_Diagnosis_field.control_read_only := true;
+
+ endif;
+ //**** CSR 31744 Change End ****
+
+
+ (DischargeDiagnosisHIOnFile) := read
+ {
+ " select distinct hi.shortname "
+ || " from cv3healthissuedeclaration hi with (nolock) "
+ || " join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
+ || " where hi.clientguid = " || client_guid || " and hi.chartguid = " || chart_guid || " and hi.clientvisitguid = " || visit_guid || " "
+ || " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ || " and hi.typecode = {{{SINGLE-QUOTE}}}Discharge Diag{{{SINGLE-QUOTE}}} "
+ };
+
+
+ (NursingOrdersList) := read last
+ {
+ " SET CONCAT_NULL_YIELDS_NULL off select {{{SINGLE-QUOTE}}}\n{{{SINGLE-QUOTE}}} + o.name + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + REPLACE(REPLACE(REPLACE(o.SummaryLine, CHAR(10), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), CHAR(13), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), CHAR(9), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) "
+ || " from cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " and o.ClientGUID = " || client_guid || " and o.ChartGUID = " || chart_guid || " and o.ClientVisitGUID= " || visit_guid || " "
+ || " and o.InitialSessionTypeCode = {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} and o.name <> {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} "
+ || " and o.name not like {{{SINGLE-QUOTE}}}Lab Test%{{{SINGLE-QUOTE}}} and o.name not like {{{SINGLE-QUOTE}}}Medical Imaging%{{{SINGLE-QUOTE}}} "
+ || " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
+ };
+
+
+
+ // FORM CLOSE
+
+
+ If CallingEvent = "FormClose" Then
+
+ AttendingPhysicianNameEdstan := AttendingPhysician.value;
+ AttendingPhysicianName:= Substring (Find "(" in string AttendingPhysicianNameEdstan) -1 characters from AttendingPhysicianNameEdstan;
+
+ EdstanStart := (Find "(" in string AttendingPhysicianNameEdstan) +1;
+ Edstanlength := ((Find ")" in string AttendingPhysicianNameEdstan) -1) - (Find "(" in string AttendingPhysicianNameEdstan);
+ Edstan := Substring Edstanlength characters starting at EdstanStart from AttendingPhysicianNameEdstan ;
+
+ RequestingUserGUID := read first
+ { " select cp.guid "
+ || " from cv3careproviderid cpid with (nolock) "
+ || " join cv3careprovider cp on cp.guid = cpid.providerguid "
+ || " where cpid.ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}} "
+ || " and cpid.idcode = " || Sql(Edstan) };
+
+ (CurrentOrder) := read last
+ { " select o.name "
+ || " from cv3order o with (nolock) "
+ || " where o.name = {{{SINGLE-QUOTE}}}Two Midnight Rule (Admit to Inpatient){{{SINGLE-QUOTE}}} "
+ || " and o.ClientGUID = " || client_guid || " and o.ChartGUID = " || chart_guid || " and o.ClientVisitGUID= " || visit_guid || " "
+ || " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) " };
+
+
+ If exists RequestingUserGUID and not exists CurrentOrder and Two_Midnight_field.value = true
+
+ then
+
+ try
+
+ orderItemName := "Two Midnight Rule (Admit to Inpatient)";
+ SessionType := "Standard";
+ SessionReason := "";
+ RequestingSource := "Verbal Order";
+ user_IDType := "Edstan Number (physician)";
+ order_Creation_Reason := "From Test MLM";
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ user_IDCode := read last {"SELECT IDCode FROM CV3CareProviderID " || " where ProviderGUID = {{{SINGLE-QUOTE}}}" || RequestingUserGUID || "{{{SINGLE-QUOTE}}} and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}" || user_IDType || "{{{SINGLE-QUOTE}}}"};
+ RequestingCareProvider_obj:= call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
+ location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit with (nolock) where ClientGUID = " || client_guid};
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with orderItemName;
+
+ GeneralOrder_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ general_catalog_item, // CatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // CreateReason
+ RequestingCareProvider_obj, // RequestingProvider ObjectsPlus object
+ RequestingSource, // string requestingSource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj, // Location ReleaseLocGrpID
+ "Never" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
+ GeneralOrder_obj.RequestedDate := "T";
+
+ void := call GeneralOrder_obj.Save;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred:= true;
+ debugFlag := TRUE;
+ messageText := messageText || "New general order:\n" || ex.Message || "\n\n";
+ if ( general_catalog_item is NOT NULL ) then void:= call general_catalog_item.Dispose; general_catalog_item:= null; endif;
+ if ( GeneralOrder_obj is NOT NULL ) then void:= call GeneralOrder_obj.Dispose; GeneralOrder_obj:= null; endif;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
+ if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
+
+ endif; // Place Order Decision
+
+ endif; // Close
+
+
+
+ // FORM OPEN
+
+
+
+ If CallingEvent= "FormOpen"
+
+ then
+
+ If orderrole = true
+ then
+ MD_Box.control_mandatory := true;
+ requesteddate.value:= currdate;
+ requestedtime.value.reqtimevalue:= currtime;
+ endif;
+
+
+
+ If exists DischargeDiagnosisHIOnFile
+ then
+
+ for i in 1 seqto count DischargeDiagnosisHIOnFile do
+ if i = 1
+ then DischargeDiagnosisHIOnFile_Out := DischargeDiagnosisHIOnFile [i];
+ else DischargeDiagnosisHIOnFile_Out := DischargeDiagnosisHIOnFile_Out || " , " || DischargeDiagnosisHIOnFile [i];
+ endif;
+ enddo;
+
+ Dis_Diagnosis_field.Control_Mandatory := false;
+
+ else
+ DischargeDiagnosisHIOnFile_Out := " ";
+
+ If orderrole = true and orgunit not in ("Emergency Department","Infusion Center")
+ then
+ Dis_Diagnosis_field.Control_Mandatory := true;
+ else
+ Dis_Diagnosis_field.Control_Mandatory := false;
+ endif;
+
+ endif; // exists DischargeDiagnosisHIOnFile
+
+ Dis_Current_Diagnosis_field.Value := DischargeDiagnosisHIOnFile_Out ;
+
+ endif; // orderrole = true
+
+
+
+
+ // FIELD CHANGE
+
+
+
+ If CallingEvent = "FieldChange"
+
+ then
+
+
+ // Called from this field on the Change (in house) form
+
+ If callingField = "NUR_ADTObsvStatusCBx"
+
+ then
+
+ If Obs_field.value = true
+
+ then
+ SSop_field.control_read_only := True;
+ Inp_field.control_read_only := True;
+ Surgery_field.control_read_only := True;
+ Denied_field.control_read_only := True;
+
+ else
+ SSop_field.control_read_only := False;
+ Inp_field.control_read_only := False;
+ Surgery_field.control_read_only := False;
+ Denied_field.control_read_only := False;
+ requesteddate.value:= " ";
+ requestedtime.value.reqtimevalue:= " ";
+
+ endif;
+
+
+ // Called from one of these fields on the Discharge - Observation form
+
+ ElseIf (callingField = "NUR_CB Now") // Now is selected
+
+ then
+
+ If (Dis_Time_Now_field.value = true)
+
+ then // NOW is True
+
+ Dis_Time_Today_field.value:= false;
+ Dis_Time_Tomorrow_field.value:= false;
+ requesteddate.value:= currdate;
+ requestedtime.value.reqtimevalue:= currtime;
+
+ else // NOW is False
+
+ requesteddate.value := " ";
+ requestedtime.value.ReqTimeCode := " ";
+
+ endif;
+
+
+ ElseIf (callingField = "NUR_CB Testing" or callingField = "NUR_CB AM" or
+ callingField = "NUR_CB PM" or callingField = "NUR_CB Today" or
+ callingField = "NUR_CB Tomorrow") // Pending Results or AM or PM or Today or Tomorrow is selected
+
+ then
+
+ If (Dis_Time_Testing_field.value = true or Dis_Time_AM_field.value = true or Dis_Time_PM_field.value = true or
+ Dis_Time_Today_field.value = true or Dis_Time_Tomorrow_field.value = true)
+
+ then // Any are True
+
+ requesteddate.Control_Mandatory:= false;
+ requestedtime.Control_Mandatory:= false;
+
+
+ else // All are False
+
+ requesteddate.Control_Mandatory:= true;
+ requestedtime.Control_Mandatory:= true;
+ endif;
+
+
+ ElseIf (CallingField = "CPOE_ADM Dx Override")
+
+ then
+
+ HardCodedProblem:= last of (field_list where field_list.DataItemName = "HI List 1");
+ ProblemListADM := last of (field_list where field_list.DataItemName = "Obj_Plus_Problem List Builder ADM");
+ Override := last of (field_list where field_list.DataItemName = "CPOE_ADM Dx Override");
+
+ If Override.Value = true
+ then
+
+ HardCodedProblem.Value := "";
+ HardCodedProblem.Control_Mandatory:= false;
+ ProblemListADM.Control_Mandatory := true;
+ endif;
+
+ endif;
+
+
+ If callingField = "NUR_CB Tomorrow"
+ then
+ If Dis_Time_Tomorrow_field.value = true
+ then
+ Dis_Time_Now_field.value:= false;
+ Dis_Time_Today_field.value:= false;
+ requesteddate.value:= Now + 1 day;
+ else
+ requesteddate.value:= " ";
+ endif;
+ endif;
+
+
+ If callingField = "NUR_CB Today"
+ then
+ If Dis_Time_Today_field.value = true
+ then
+ Dis_Time_Now_field.value:= false;
+ Dis_Time_Tomorrow_field.value:= false;
+ requesteddate.value:= Now;
+ else
+ requesteddate.value:= " ";
+ endif;
+ endif;
+
+
+ If callingField = "NUR_CB AM"
+ then
+ If Dis_Time_AM_field.value = true
+ then
+ Dis_Time_PM_field.value:= false;
+ endif;
+ endif;
+
+
+
+ If callingField = "NUR_CB PM"
+ then
+ If Dis_Time_PM_field.value = true
+ then
+ Dis_Time_AM_field.value:= false;
+ endif;
+ endif;
+
+
+ If callingField = "Obj_Plus_Problem List Builder DISC"
+ then
+
+ If Dis_Diagnosis_field.value matches pattern "%...%"
+ or
+ Dis_Diagnosis_field.Value is null
+ then
+
+ xxx:= "xxx";
+ else
+
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n\nType-in{{{SINGLE-QUOTE}}}s are not permitted. Click the search button (on the right) to enter the Health Issue " ||
+ "\n\n\n","Type-in Information Not Permitted", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Error" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Dis_Diagnosis_field.Value := " ";
+
+ endif;
+
+ endif;
+
+ endif; // Calling Event Field Change
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_OPIATE_WITHDRAWAL_OS.mlm b/MLMStripper/bin/Debug/FORM/FORM_OPIATE_WITHDRAWAL_OS.mlm
new file mode 100644
index 0000000..2073077
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_OPIATE_WITHDRAWAL_OS.mlm
@@ -0,0 +1,113 @@
+maintenance:
+
+ title: FORM_OPIATE_WITHDRAWAL_OS;;
+ mlmname: FORM_OPIATE_WITHDRAWAL_OS;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav Allscripts Corporation;;
+ date: 2015-03-11;;
+ validation: testing;;
+
+library:
+ purpose:
+
+ ;;
+
+ explanation:
+
+ Change History
+ -----------------
+ 12.10.2014 JML CSR# 33059: Created
+ Look back the current visit on a patient in Emergeny room for the lab orders with the Status as "Specimen Recieved by performing Department"
+ and if order is not there then preselect the same.
+ 1)CBC (Includes Diff)
+ 2)Comprehensive Basic Metabolic Panel
+ 3)RPR-Rapid Plasma Reagin Serum
+ 4)Rotine/Microscopic Urinalysis
+
+
+ ;;
+ keywords: Called MLMs
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Retrieve relevant form fields
+ Labs_NotDoneED := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Labs_NotDoneED_Val := Labs_NotDoneED.Value;
+
+ /*****************************Call to Base form MLM******************************************/
+ Mdecical_Imaging_MLM:= MLM {{{SINGLE-QUOTE}}}FORM_Medical_Imaging_Indications_for_OS{{{SINGLE-QUOTE}}};
+ this_communication,this_form := call Mdecical_Imaging_MLM with this_communication,this_form,client_info_obj ;
+
+ /*****************************Call to Base form MLM******************************************/
+
+
+ //Check to see if patient had these labs drawn in current visit till date
+ ( lab_name ) := read {"SELECT o.Name "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK) "
+ || " ON cv.GUID = o.ClientVisitGUID "
+ || " AND cv.ClientGUID = o.ClientGUID "
+ || " AND cv.ChartGUID = o.ChartGUID "
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND o.NAME IN ({{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Routine/Microscopic Urinalysis{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}RPR-Rapid Plasma Reagin Serum{{{SINGLE-QUOTE}}}) "
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
+
+
+ if ( exists lab_name ) then
+ for lab in 1 seqto ( count Labs_NotDoneED_Val ) do
+ if ( Labs_NotDoneED_Val[lab].Name Not IN lab_name ) then
+ Labs_NotDoneED_Val[lab].IsSelected := true;
+ else
+ Labs_NotDoneED_Val[lab].IsSelected := false;
+ endif;
+ enddo;
+ else
+ //No labs exist for this patient, select all labs
+ Labs_NotDoneED_Val.IsSelected := ( true, true, true, true );
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_ORDER_MANAGEMENT_EXAMPLE_MLM.mlm b/MLMStripper/bin/Debug/FORM/FORM_ORDER_MANAGEMENT_EXAMPLE_MLM.mlm
new file mode 100644
index 0000000..10ec4b5
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_ORDER_MANAGEMENT_EXAMPLE_MLM.mlm
@@ -0,0 +1,60 @@
+maintenance:
+
+ title: FORM_ORDER_MANAGEMENT_EXAMPLE_MLM;;
+ mlmname: FORM_ORDER_MANAGEMENT_EXAMPLE_MLM;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Memorial Hospital;;
+ author: Don Warnick;;
+ specialist: Don Warnick;;
+ date: 2016-04-22;;
+ validation: testing;;
+
+library:
+ purpose: This MLM calls the launch MLM that launches the Order Management DLL
+
+
+
+ THIS MLM IS FOR DEMONSTRATION PURPOSES. IT IS ONLY IN DEV AND IS NOT IN PRODUCTION STATUS
+
+
+ ;;
+ explanation:
+
+ Change history
+
+ 04.22.2016 DW Created
+ ;;
+ keywords: Example MLM
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (this_communication, this_form, client_info_obj) := argument;
+ log_execution_info := FALSE;
+
+
+ // Pass these fields to the launching MLM This Order Name | Form Type | Conflicting Order GUIDS | Order Source | Requesting Provider GUID | Order Type |
+
+ Launch_Order_Management_MLM := mlm {{{SINGLE-QUOTE}}}SCH_LAUNCH_ORDER_MANAGEMENT{{{SINGLE-QUOTE}}};
+ OrderInformation := "Codeine 30mg Tab|Q|{{{SINGLE-QUOTE}}}9001415601100680{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}9001415601100680{{{SINGLE-QUOTE}}}|Per Written Order|9000001090119001|Pharmacy|";
+ returndata := call Launch_Order_Management_MLM with (OrderInformation);
+
+ // A 2 character combination will be retuned Character#1 = Was at least one prior order deleted? (Y or N) Character#2 = Was the new order abandoned? (Y or N)
+
+
+ this_communication.Message := "This information was returned from the Order Management application"
+ || "\n\n " || returndata
+ || "\n\n Note : A combination of Y and N is normal."; this_communication.MessageType := "Informational";
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PEDIATRIC_IV_RATE.mlm b/MLMStripper/bin/Debug/FORM/FORM_PEDIATRIC_IV_RATE.mlm
new file mode 100644
index 0000000..5f5cf9b
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PEDIATRIC_IV_RATE.mlm
@@ -0,0 +1,74 @@
+maintenance:
+
+ title: FORM_PEDIATRIC_IV_RATE;;
+ mlmname: FORM_PEDIATRIC_IV_RATE;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Don Warnick, Allscripts ;;
+ specialist: Bryan Berkeybile, Allscripts;;
+ date: 2013-07-29;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+
+ explanation: This MLM is called from the IV Fluid Order Set, Pediatric IV Bolus grid. The MLM updates
+ the rate field on the IV Infusion Orders form with 20x the most recent patient weight in kg.
+ We needed to add the MLM_From Order Set field to the OS and form to make the value visible
+ in the grid.
+
+ Change history
+ 2013.07.29 DJW CSR 13570 Created
+
+ ;;
+ keywords: Called MLMs
+ ;;
+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";
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ log_execution_info := FALSE;
+
+ error_message:="";
+
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ChartGuid := this_communication.ChartGUID;
+ FormName := this_form.Name;
+
+ CombinedMeasurements := first of (field_list WHERE field_list.DataItemName = "CombinedMeasurements");
+ CombinedMeasurements_fld := CombinedMeasurements.Value;
+ patient_weight := CombinedMeasurements_fld.Weight;
+
+ Rate_fld := first of (field_list WHERE field_list.DataItemName = "OrderIVRate");
+ Order_IV_Rate := Rate_fld.Value;
+
+ itemguid := this_communication.ItemID;
+ itemname := read last {"select name from CV3OrderCatalogMasterItem (nolock) where GUID = " || itemguid || " "};
+
+ CalculatedRate := round ((patient_weight as number) * 20);
+ Order_IV_Rate.Amount := CalculatedRate;
+
+
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PEDIATRIC_MORPHINE_CALC.mlm b/MLMStripper/bin/Debug/FORM/FORM_PEDIATRIC_MORPHINE_CALC.mlm
new file mode 100644
index 0000000..59b4e44
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PEDIATRIC_MORPHINE_CALC.mlm
@@ -0,0 +1,91 @@
+maintenance:
+
+ title: Pediatric Morphine Conversion;;
+ mlmname: Form_Pediatric_Morphine_calc;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St. Clair Hospital;;
+ author: Teresa M. Spicuzza ;;
+ specialist: Eclipsys Corporation;;
+ date: 2006-11-28;;
+ validation: testing;;
+
+library:
+ purpose: Caculate Morphine solution to mg when ordered in ml and to ml when ordered in ml.
+ ;;
+ explanation:
+
+ ;;
+ keywords:
+ Pediatric, Morphine, Conversion;
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+/********************Make Changes To Spelling And Flags In This Section*********************/
+
+
+/*************************************************************************************************/
+
+ // 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;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+
+OrderedDose := first of (field_list where field_list.DataItemName = "DosageLow");
+OrderedUnits := first of (field_list where field_list.DataItemName = "UOM");
+Instructions := first of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+//Instructions := first of (field_list where field_list.DataItemName = "AdminInstructions");
+
+If exists OrderedDose then OrderedDoseValue := OrderedDose.Value; endif;
+
+If exists OrderedUnits then OrderedUnitsValue := OrderedUnits.Value; endif;
+
+ If OrderedUnitsValue = "ml" then
+ ConversionUnits := "mg";
+ ConversionDose := (OrderedDoseValue as number) * 0.4;
+
+
+ Endif;
+
+ If orderedUnitsValue = "mg" then
+ ConversionUnits := "ml";
+ ConversionDoseRaw := ((OrderedDoseValue as number) / 0.4) ;
+ ConversionDose := ((int((ConversiondoseRaw + 0.0051) * 100)) /100) ;
+ Endif;
+
+
+If OrderedDoseValue is not null and OrderedUnitsValue is not null then
+ Instructions.value := "\n\n " || OrderedDoseValue || OrderedUnitsValue ||
+ " = " || ConversionDose || ConversionUnits;
+else Instructions.value := " ";
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PERICARDITIS_PAIN_ORDER.mlm b/MLMStripper/bin/Debug/FORM/FORM_PERICARDITIS_PAIN_ORDER.mlm
new file mode 100644
index 0000000..cf208be
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PERICARDITIS_PAIN_ORDER.mlm
@@ -0,0 +1,87 @@
+maintenance:
+
+ title: FORM_PERICARDITIS_PAIN_ORDER;;
+ mlmname: FORM_PERICARDITIS_PAIN_ORDER;;
+ arden: version 2.5;;
+ version: 15.10;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts;;
+ specialist: Janet Nordin, Allscripts;;
+ date: 2016-02-25;;
+ validation: testing;;
+
+library:
+ purpose: This MLM triggers on orders contained in the Pericarditis Pain Order Set.
+
+ ;;
+ explanation: Makes all relevant medication ordering fields read-only on all medication orders contained in the
+ Pericarditis Pain order set.
+
+ Change History
+ ----------------
+ 02.25.2016 JML CSR# 32396 - Created
+ 03.08.2016 JML Moved to Production
+
+ ;;
+ keywords: Called MLMs, Form fields, pericarditis, ibuprophen
+ ;;
+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_occurred := false;
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGuid;
+ chart_guid := this_communication.ChartGUID;
+
+ CallingField :=this_communication.CallingFieldName;
+ CallingEvent := this_communication.CallingEvent;
+
+ FormType := this_communication.FormType;
+ OrderSetName := this_communication.PrimaryObj.OrderSetName;
+
+ doseFld := first of ( field_list WHERE field_list.DataItemName = "DosageLow" );
+ routeFld := first of ( field_list WHERE field_list.DataItemName = "OrderRouteCode" );
+ freqFld := first of ( field_list WHERE field_list.DataItemName = "FrequencyCode" );
+ stopFld := first of ( field_list WHERE field_list.DataItemName = "StopAfter" );
+
+ if ( OrderSetName = "Pericarditis Pain Order Set" ) then
+ doseFld.control_read_only := true;
+ routeFld.control_read_only := true;
+ freqFld.control_read_only := true;
+
+ stopFld.control_read_only := true;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PHYSICIAN_CLOSTRIDIUM_DIFFICILE_ORDER.mlm b/MLMStripper/bin/Debug/FORM/FORM_PHYSICIAN_CLOSTRIDIUM_DIFFICILE_ORDER.mlm
new file mode 100644
index 0000000..83e85f7
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PHYSICIAN_CLOSTRIDIUM_DIFFICILE_ORDER.mlm
@@ -0,0 +1,284 @@
+maintenance:
+
+ title: FORM_Physician_Clostridium_Difficile_Order ;;
+ mlmname: FORM_Physician_Clostridium_Difficile_Order;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad jadhav, Allscripts Corporation;;
+ date: 2016-12-19;;
+ validation: testing;;
+
+library:
+ purpose: Preselect the "Clostridium Difficile Toxin by PCR" Order IF:
+ Four indicators will be on the order set. One of first 3 the indicators must be selected to be able to select the C Diff order.
+ If {{{SINGLE-QUOTE}}}Does not meet above criteria{{{SINGLE-QUOTE}}} is selected then the C Diff order remains unselectable.
+ If the indicator is appropriate but there is a C Diff order in the past 4 days do not allow the order to be selectable.
+ There is a current MLM on the {{{SINGLE-QUOTE}}}Standing C Diff{{{SINGLE-QUOTE}}} order set. FORM_CLOSTRIDIUM_DIFFICILE_TOXIN_ORDER
+
+ ;;
+
+ explanation:
+ Change History
+ -----------------
+ 19.12.2015 SSJ CSR# 35278: Created
+ #1 12/08/2017 SHAMI CSR#36182
+ 07/10/2019 JML CSR# 38386: Modified logic to auto-check lab test based on ED vs. Inpatient location.
+
+
+ ;;
+ keywords: Called MLMs
+ ;;
+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;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+ USER_guid := this_communication.USERGUID;
+
+ //pObj := this_communication.PrimaryObj;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ item_event := this_communication.itemevent;
+ form_type := this_communication.formtype;
+
+ //Retrieve relevant form fields
+ C_Diff := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox" and field_list.Control_MultiFieldOccNum = 2);
+ C_Diff_In := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox" AND field_list.Control_MultiFieldOccNum = 4 );
+ C_Comment := last of ( field_list WHERE field_list.DataItemName = "NUR_ Comment 1 line" );
+ NurseInstructionsGrid := first of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 1);
+ SpeciCollInst := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ ContactPrecn := first of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 3);
+ NotifyInfe := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+
+ Indicator_1 := NurseInstructionsGrid.Value[1].IsSelected ;
+ Indicator_2 := NurseInstructionsGrid.Value[2].IsSelected ;
+ Indicator_3 := NurseInstructionsGrid.Value[3].IsSelected ;
+ Indicator_4 := NurseInstructionsGrid.Value[4].IsSelected ;
+ C_Diff_Val := C_Diff.Value;
+ C_Diff_In_Val := C_Diff_In.Value;
+ NurseInst := SpeciCollInst[1].Value ;
+ ContactSel := ContactPrecn.Value[1].IsSelected ;
+ NurseInve := NotifyInfe[1].Value ;
+
+ //Get patient{{{SINGLE-QUOTE}}}s current location
+ curr_loc := read last { "SELECT CurrentLocation FROM CV3ClientVisit cv WITH (NOLOCK) WHERE cv.GUID = " || visit_guid };
+
+ //Check to see if patient is on C Diff lab
+ C_Diff_Order := read {"SELECT o.Name"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " And cv.Guid =" || Sql(visit_guid)
+ || " AND o.NAME IN ( {{{SINGLE-QUOTE}}}Clostridium Difficile Toxin Gene Testing by PCR{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Clostridium Difficile Screening{{{SINGLE-QUOTE}}} ) "
+ || " AND DATEDIFF(HH, o.SignificantDtm, GetDate()) <= 96 " //96
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PCOL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}COLL{{{SINGLE-QUOTE}}})"};
+ If exist C_Diff_Order Then
+ C_Comment.Control_Visible := True ;
+ Else
+ C_Comment.Control_Visible := False ;
+ EndIf;
+
+
+ // for Form Open Event
+ if ( CallingEvent = "FormOpen" ) then
+
+ C_Diff_Val[1].IsSelected := False ;
+ C_Diff_Val[1].IsReadonly := True ;
+ C_Diff_In_Val[1].IsSelected := false;
+ C_Diff_In_Val[1].IsReadOnly := true;
+
+ NurseInst.IsReadOnly := TRUE ;
+ ContactPrecn.Value[1].IsReadOnly := True ;
+ NurseInve.IsReadOnly := True ;
+ EndIf ;//End FormOpen Event
+/*************************************************************************************************************************************/
+ // for Field Change Event
+ if ( CallingEvent = "FieldChange" ) then
+
+ // When any of First Three Indicators are Selected
+ If ((Indicator_1 = True) or (Indicator_2 = True) or (Indicator_3 = True )) Then
+
+ NurseInstructionsGrid.Value[4].IsSelected := False ;
+ NurseInstructionsGrid.Value[4].IsReadOnly := True ;
+
+ if ( Not exists C_Diff_Order ) then
+
+ if ( curr_loc = "ER Major" ) then
+ C_Diff_Val[1].IsSelected := true ;
+ C_Diff_Val.IsReadonly := False ;
+ else
+ C_Diff_In_Val.IsSelected := true;
+ C_Diff_In_Val.IsReadonly := false;
+ endif;
+
+ NurseInst.IsSelected := True ;NurseInst.IsReadOnly := False ;
+ ContactPrecn.Value[1].IsSelected := True ;ContactPrecn.Value[1].IsReadOnly := False ;
+ NurseInve.IsSelected := True ;NurseInve.IsReadOnly := False ;
+
+ else
+
+ C_Diff_Val.IsSelected := (false);
+ C_Diff_Val.IsReadonly := (true );
+ C_Diff_In_Val.IsSelected := false;
+ C_Diff_In_Val.IsReadOnly := true;
+ C_Comment.Control_Visible:= True ;
+ endif;
+
+ // When any of First Three Indicators are Un-Selected
+ ElseIf (Indicator_1 = False And Indicator_2 = False And Indicator_3 = False ) And NurseInstructionsGrid.Value[4].IsReadOnly = True Then
+ NurseInstructionsGrid.Value[4].IsSelected := False;
+ NurseInstructionsGrid.Value[4].IsReadOnly := False;
+
+ if ( curr_loc = "ER Major" ) then
+ C_Diff_Val[1].IsSelected := False ;
+ C_Diff_Val[1].IsReadonly := True ;
+ else
+ C_Diff_In_Val.IsSelected := false;
+ C_Diff_In_Val.IsReadonly := true;
+ endif;
+
+ NurseInst.IsSelected := False ;NurseInst.IsReadOnly := True ;
+ ContactPrecn.Value[1].IsSelected := False ;ContactPrecn.Value[1].IsReadOnly := True ;
+ NurseInve.IsSelected := False ;NurseInve.IsReadOnly := True ;
+
+ EndIf;
+
+ // When Last Indicators are Selected
+ If Indicator_4 = true and (Indicator_1 = False And Indicator_2 = False And Indicator_3 = False ) Then
+ C_Diff_Val[1].IsSelected := False ;
+ C_Diff_Val[1].IsReadonly := True ;
+ C_Diff_In_Val.IsSelected := false;
+ C_Diff_In_Val.IsReadOnly := true;
+
+ NurseInst.IsSelected := False ;NurseInst.IsReadOnly := TRUE ;
+ ContactPrecn.Value[1].IsSelected := False ;ContactPrecn.Value[1].IsReadOnly := True ;
+ NurseInve.IsSelected := False ;NurseInve.IsReadOnly := True ;
+ EndIf;
+ endif; //End FieldChange Event
+
+/*************************************************************************************************************************************/
+
+/*If (Indicator_1 = True And Indicator_2 = True And Indicator_3 = True ) And NurseInstructionsGrid.Value[4].IsReadOnly = True And C_Diff_Val[1].IsSelected = true Then
+
+ /* NurseInstructionsGrid.Value[4].IsSelected := False;
+ NurseInstructionsGrid.Value[4].IsReadOnly := False;
+ C_Diff_Val[1].IsSelected := False ;
+ C_Diff_Val[1].IsReadonly := True ;*/
+ /*NurseInst.IsReadOnly := False ;
+ ContactPrecn.Value[1].IsReadOnly := False ;
+ NurseInve.IsReadOnly := False ;
+
+
+Endif; */
+
+
+/************************************************************************************************************************************/
+
+ //#1 : Start
+ /*if ( CallingEvent = "FormOpen" ) then
+ IF(this_form.name="NUR_Cdiff PhysOrder") Then
+ DOC := read last { " select count(1) from CV3User U (NOLOCK) "
+ ||" INNER JOIN SXAAMCareProviderSpecialtyXREF s (nolock) ON s.CareProviderGUID=u.GUID "
+ ||" INNER JOIN CV3Discipline d (nolock) on d.GUID=s.DisciplineGUID "
+ ||" WHERE CODE = {{{SINGLE-QUOTE}}}Infectious Diseases{{{SINGLE-QUOTE}}} AND U.GUID = " || SQL(USER_guid)
+ };
+
+ IF DOC =0 THEN
+
+ Result := read last { " SELECT TOP 1 O.Name "
+ ||" FROM Cv3Order (NOLOCK) O "
+ ||" WHERE CreatedWhen >= DATEADD(HOUR, -48, GETDATE())"
+ ||" AND O.Status= {{{SINGLE-QUOTE}}}ACTIVE{{{SINGLE-QUOTE}}} AND O.ActivateStatus={{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} "
+ ||" AND Name IN ({{{SINGLE-QUOTE}}}Bisacodyl 5mg EC Tab{{{SINGLE-QUOTE}}} , "
+ ||" {{{SINGLE-QUOTE}}}Bisacodyl 10mg Rectal Supp{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Chondrus/Mineral Oil{{{SINGLE-QUOTE}}} , "
+ ||" {{{SINGLE-QUOTE}}}Docusate Calcium 240mg Cap{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Docusate Sodium 50mg Cap{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Docusate Sodium 100mg Cap{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Docusate Sodium Syrup{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Docusate Sodium Syrup/Mineral Oil{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Glycerin Adult Supp{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Glycerin Pediatric Supp{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Lo-So Prep - Magnesium Citrate Powder{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Magnesium Citrate 300ml Soln{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Magnesium Hydroxide Susp{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Mineral Oil{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Mineral Oil Enema{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Polycarbophil 500mg Tab{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Senna Tab{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Senna Syrup{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Senna/Docusate Sodium Tab{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Sodium Phosphate Enema{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Sodium Phosphate Pediatric Enema{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Polyethylene Glycol - Electrolytes Prep{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Polyethylene Glycol - Electrolytes Prep{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Polyethylene Glycol 17gm Powder{{{SINGLE-QUOTE}}}) "
+
+
+ ||" AND O.ClientGUID = " || SQL(client_guid)
+ ||" AND O.ChartGUID = " || SQL(Chart_guid)
+ ||" AND O.ClientVisitGUID = " || SQL(Visit_guid)
+ };
+ IF(EXISTS Result ) THEN
+ Flag := True;
+ Indicator_1 := NurseInstructionsGrid.Value[1] ;
+ Indicator_2 := NurseInstructionsGrid.Value[2];
+ Indicator_3 := NurseInstructionsGrid.Value[3] ;
+ Indicator_4 := NurseInstructionsGrid.Value[4];
+ Indicator_1.IsReadonly := True ;
+ Indicator_2.IsReadonly := True ;
+ Indicator_3.IsReadonly := True ;
+ Indicator_4.IsReadonly := True ;
+ //MSG := "This patient has an active order for laxatives. C.diff testing is not recommended in this setting. If you{{{SINGLE-QUOTE}}}d still like to order, please contact Infectious Prevention";
+ if Flag = True then
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n This patient has an active order for laxatives. C.diff testing is not recommended in this setting. If you{{{SINGLE-QUOTE}}}d still like to order, please contact Infectious Prevention "|| " "
+ ,"C Diff Ordering Information ", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Endif;// Flag
+ ENDIF;//Result exist
+ ENDIF;//form exist
+ ENDIF; // Doc Exist
+ ENDIF;// Calling EVNET*/
+
+ //#1 : END
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PLASTIC_SERGERY_POST_OP.mlm b/MLMStripper/bin/Debug/FORM/FORM_PLASTIC_SERGERY_POST_OP.mlm
new file mode 100644
index 0000000..fb0ee03
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PLASTIC_SERGERY_POST_OP.mlm
@@ -0,0 +1,68 @@
+maintenance:
+
+ title: FORM_PLASTIC_SERGERY_POST_OP;;
+ mlmname: FORM_PLASTIC_SERGERY_POST_OP;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-02-23;;
+ validation: testing;;
+
+library:
+ purpose: Scenario 1 : when user select any order of "Famotidine",then othere order i.e "Famotidine 20mg IV PUSH -12hours should be grayed out..
+
+ Scenario 2 : when user select any order of "Famotidine",then othere order i.e "Famotidine 20mg,PO for (BID (9-21) should be grayed out.;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ ( this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ Medication := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 49 );
+ Medication_Value := Medication.Value ;
+
+// *********** Objects for first flow *************
+
+
+ Famotidine1 := first of (Medication_Value where Medication_Value.Name = "Famotidine 20mg Tab");
+ Famotidine2 := first of (Medication_Value where Medication_Value.Name = "Famotidine Inj"); //PCA - Morphine Order Set
+
+ If Famotidine1.IsSelected = True Then
+ Famotidine2.IsReadonly := True;
+ Endif;
+ If Famotidine2.IsSelected = True Then
+ Famotidine1.IsReadonly := True;
+ Endif;
+
+
+ If Famotidine1.IsSelected = False And Famotidine2.IsSelected = False Then
+ Famotidine1.IsReadonly := False;
+ Famotidine2.IsReadonly := False;
+
+ EndIf;
+
+
+
+;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POPULATE_WORXROUTE_WITH_ORDERROUTECODE.mlm b/MLMStripper/bin/Debug/FORM/FORM_POPULATE_WORXROUTE_WITH_ORDERROUTECODE.mlm
new file mode 100644
index 0000000..05b3547
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POPULATE_WORXROUTE_WITH_ORDERROUTECODE.mlm
@@ -0,0 +1,136 @@
+maintenance:
+
+ title: Copy Route to WORx Route;;
+ filename: FORM_populate_WORxroute_with_OrderRouteCode;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: Eclipsys, System MLM;;
+ author: Teresa Spicuzza, Eclipsys;;
+ specialist: ;;
+ date: 2006-06-10;;
+ validation: testing;;
+library:
+purpose: This MLM copies the value of the WORx route with the value of the OrderRouteCode
+on injectable medications with multiple injectable selections.
+
+ ;;
+ explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
+ Communications objects and copies it to another field within the form.
+
+ The MLM is not run from a trigger event, but rather is called by the application.
+ It should be configured to run on Field change.
+
+ History:
+ 05.30.2018 TMS CSR 36460 Add alert box for route of IM when platelet count < 50.
+
+ ;;
+ keywords: Called MLMs, WORx, Route ;;
+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";
+
+ // 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;
+
+
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ // This sets the value of the WORx route to the value entered for the route.
+ Route_field := first of (field_list where field_list.DataItemName = "OrderRouteCode" );
+ WORxRoute_field := first of (field_list where field_list.DataItemName = "PRX_WORx_Route");
+
+ If Route_field.value ="SQ"
+ then
+ WORxRoute_field.value := "SQ";
+ elseif Route_field.value = "IM"
+ then
+ WORxRoute_field.value := "IM";
+ LabName, LabValue, LabUom, LabDone, LabAbn := read last
+ {"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= (DATEADD(hour, -72, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Platelet Count{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+
+ If (LabValue as number) < 50.0 or LabAbn = "LL" then Lo_Platelet := true; else Lo_Platelet := false; endif;
+ If Lo_Platelet = true then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n AVOID IM INJECTIONS. \n\n " || LabName || " is " || LabValue || " " || LabUom || " Drawn: " || LabDone ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+
+ elseif Route_field.value = "IV PUSH"
+ then
+ WORxRoute_field.value := "IV";
+ elseif Route_field.value = "IVPB"
+ then
+ WORxRoute_field.value := "IV";
+ elseif Route_field.value = "Intradermally"
+ then
+ WORxRoute_field.value := "ID";
+ elseif Route_field.value = "Intrathecally"
+ then
+ WORxRoute_field.value := "IT";
+ elseif Route_field.value = "Intra-articular"
+ then
+ WORxRoute_field.value := "IA";
+
+ // else
+ // WORxRoute_field.value := "IJ";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POSTOPEN_HEART_ATRIAL_FIBRILLATION.mlm b/MLMStripper/bin/Debug/FORM/FORM_POSTOPEN_HEART_ATRIAL_FIBRILLATION.mlm
new file mode 100644
index 0000000..7e8de05
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POSTOPEN_HEART_ATRIAL_FIBRILLATION.mlm
@@ -0,0 +1,125 @@
+maintenance:
+
+ title: FORM_PostOpen_Heart_Atrial_Fibrillation;;
+ mlmname: FORM_PostOpen_Heart_Atrial_Fibrillation;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad jadhav, Allscripts Corporation;;
+ date: 2015-01-14;;
+ validation: testing;;
+
+library:
+ purpose: 1) Search the results for " Potassium Plasma/Serum" and "Magnesium Plasma/Serum" on a patient for Past 24 hours
+ and if no result is found then precheck these lab order items.
+
+ ;;
+
+ explanation:
+
+ Change History
+ -----------------
+ 13.01.2015 JML CSR# 32945: Created
+ 01.21.2016 SSJ Calling base MLM {{{SINGLE-QUOTE}}}FORM_Set_Total_Hip_Post_Op{{{SINGLE-QUOTE}}}. Earlier current MLM was get called from it.
+ ;;
+ keywords: Called MLMs
+ ;;
+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;
+
+ /***************************************************************************************/
+/*-----------------MLM Call By Shivprasad ----*/
+
+ PreCardiac_Base_MLM := MLM {{{SINGLE-QUOTE}}}FORM_Set_Total_Hip_Post_Op{{{SINGLE-QUOTE}}};
+ this_communication,this_form := call PreCardiac_Base_MLM with this_communication,this_form,client_info_obj ;
+
+
+/* --------------MLM Cal End By Shivprasad--------*/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+
+ //pObj := this_communication.PrimaryObj;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ item_event := this_communication.itemevent;
+ form_type := this_communication.formtype;
+
+
+ //Retrieve relevant form fields
+ Labs_96Hr := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox" and field_list.Label = "Labs-Today" );
+ Labs_96Hr_Val := Labs_96Hr.Value;
+
+ //Check to see if patient had these labs drawn in last 96 hours
+ ( lab_name ) := read {" SELECT Case o.Name When {{{SINGLE-QUOTE}}}Magnesium Plasma/Serum{{{SINGLE-QUOTE}}} Then {{{SINGLE-QUOTE}}}Magnesium Plasma/Serum{{{SINGLE-QUOTE}}} "
+ || " Else {{{SINGLE-QUOTE}}}Potassium Plasma/Serum{{{SINGLE-QUOTE}}} End "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND o.NAME IN ({{{SINGLE-QUOTE}}}Potassium Plasma/Serum{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Magnesium Plasma/Serum{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chem 12{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Chem 12 Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chem 13{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chem 13 Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chem 14 Fasting{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Chem 14.{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chem 7{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chem 7 Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chem 8 Fasting{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Chem 8.{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Electrolytes{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Profile Fasting{{{SINGLE-QUOTE}}} ) "
+ || " AND DATEDIFF(HH, o.ARRIVALDTM, GetDate()) <= 24 " //1400"
+ //|| " AND DATEDIFF(DD, o.ARRIVALDTM, GetDate()) <= 14 " //1400"
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
+
+
+
+
+ if ( exists lab_name ) then
+
+ for lab in 1 seqto ( count Labs_96Hr_Val ) do
+ if ( Labs_96Hr_Val[lab].Name NOT IN lab_name ) then
+ Labs_96Hr_Val[lab].IsSelected := true;
+ else
+ Labs_96Hr_Val[lab].IsSelected := false;
+ endif;
+ enddo;
+ else
+ //No labs exist for this patient, select all labs
+
+ Labs_96Hr_Val.IsSelected := ( true, true);
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POST_INITIATION_CATHETER_DIR_THROMBOLYTIC.mlm b/MLMStripper/bin/Debug/FORM/FORM_POST_INITIATION_CATHETER_DIR_THROMBOLYTIC.mlm
new file mode 100644
index 0000000..43f2578
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POST_INITIATION_CATHETER_DIR_THROMBOLYTIC.mlm
@@ -0,0 +1,627 @@
+maintenance:
+
+ title: FORM_POST_INITIATION_CATHETER_DIR_THROMBOLYTIC ;;
+ mlmname: FORM_POST_INITIATION_CATHETER_DIR_THROMBOLYTIC ;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-03-31;;
+ validation: testing;;
+
+library:
+ purpose: 1) On Selection of Via and Vessel Value we are autopopulating it in respective Grids Orders [Special Insttuction] column.
+ 2) On selection of Q4 and Q8 [Lab While on Lytic Theorpy Orders every 4 and 8 Hours ] Orders we are auto-selecting the [DailyOrder] grid{{{SINGLE-QUOTE}}}s Same order along with base order.
+ ;;
+ explanation:
+
+ Change History
+ ============================================
+ 30-03-2015 CSR-32710 : Created MLM
+ 12.29.2015 STH CSR#: 33758 - Adding logic to address the proper scheduling of the labs based on the selected schedules {GO Live: 3/7/2016}
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ ( this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+ local_session := cds_session.local;
+ ImgaingMLM := MLM {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING_INDICATIONS_FOR_OS{{{SINGLE-QUOTE}}};
+ this_communication,this_form := Call ImgaingMLM With this_communication,this_form,client_info_obj ;
+ //Retrieve relevant form fields
+ Pharmacy_Altephase1 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 49 );
+ Pharmacy_Altephase2 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 61 );
+ Pharmacy_Heparin1 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 57 );
+ Pharmacy_Heparin2 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 62 );
+
+ Daily_Order := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 60 );
+ Pharmacy_Altephase1_Val := Pharmacy_Altephase1.Value ;
+ Pharmacy_Altephase2_Val := Pharmacy_Altephase2.Value ;
+ Pharmacy_Heparin1_Val := Pharmacy_Heparin1.Value ;
+ Pharmacy_Heparin2_Val := Pharmacy_Heparin2.Value ;
+
+ Prm_Via1A := last of (field_list where field_list.DataItemName = "CPOE_posticd VIA" and field_list.Control_MultiFieldOccNum = 1 );
+ Prm_Vessel1A := last of (field_list where field_list.DataItemName = "IR_ICD left" and field_list.Control_MultiFieldOccNum = 1 );
+ Prm_Via2A := last of (field_list where field_list.DataItemName = "CPOE_posticd VIA" and field_list.Control_MultiFieldOccNum = 3 );
+ Prm_Vessel2A := last of (field_list where field_list.DataItemName = "IR_ICD left" and field_list.Control_MultiFieldOccNum = 3 );
+ Prm_Via1H := last of (field_list where field_list.DataItemName = "CPOE_posticd VIA" and field_list.Control_MultiFieldOccNum = 2 );
+ Prm_Vessel1H := last of (field_list where field_list.DataItemName = "IR_ICD left" and field_list.Control_MultiFieldOccNum = 2 );
+ Prm_Via2H := last of (field_list where field_list.DataItemName = "CPOE_posticd VIA" and field_list.Control_MultiFieldOccNum = 4 );
+ Prm_Vessel2H := last of (field_list where field_list.DataItemName = "IR_ICD left" and field_list.Control_MultiFieldOccNum = 4 );
+
+ Prm_Admin_instr1A := last of (field_list where field_list.DataItemName = "admininstructions" and field_list.Control_MultiFieldOccNum = 1 );
+ Prm_Admin_instr2A := last of (field_list where field_list.DataItemName = "admininstructions" and field_list.Control_MultiFieldOccNum = 2 );
+ Prm_Admin_instr1H := last of (field_list where field_list.DataItemName = "admininstructions" and field_list.Control_MultiFieldOccNum = 3 );
+ Prm_Admin_instr2H := last of (field_list where field_list.DataItemName = "admininstructions" and field_list.Control_MultiFieldOccNum = 4 );
+
+
+ Labs_ReqDate_PostProc_Every2hr_x2 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_list.Control_MultiFieldOccNum = 1 );
+ Labs_Priority_PostProc_Every2hr_x2 := last of (field_list where field_list.DataItemName = "LAB_Order Priorities" and field_list.Control_MultiFieldOccNum = 1 );
+ Labs_Time_PostProc_Every2hr_x2 := last of (field_list where field_list.DataItemName = "LAB_Phleb Draw Sched Time" and field_list.Control_MultiFieldOccNum = 1 );
+
+ Labs_ReqDate_LyticTherapy_Every4hr := last of (field_list where field_list.DataItemName = "RequestedDate" and field_list.Control_MultiFieldOccNum = 2 );
+ Labs_Priority_LyticTherapy_Every4hr := last of (field_list where field_list.DataItemName = "LAB_Order Priorities" and field_list.Control_MultiFieldOccNum = 2 );
+ Labs_Time_LyticTherapy_Every4hr := last of (field_list where field_list.DataItemName = "LAB_Phleb Draw Sched Time" and field_list.Control_MultiFieldOccNum = 2 );
+
+ Labs_ReqDate_LyticTherapy_Every8hr := last of (field_list where field_list.DataItemName = "RequestedDate" and field_list.Control_MultiFieldOccNum = 3 );
+ Labs_Priority_LyticTherapy_Ever82hr := last of (field_list where field_list.DataItemName = "LAB_Order Priorities" and field_list.Control_MultiFieldOccNum = 3 );
+ Labs_Time_LyticTherapy_Every8hr := last of (field_list where field_list.DataItemName = "LAB_Phleb Draw Sched Time" and field_list.Control_MultiFieldOccNum = 3 );
+
+ // Multi Order Check Boxex Functions
+ Prm_CheckBox2HR := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_list.Control_MultiFieldOccNum = 1 );
+ Prm_CheckBox4HR := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_list.Control_MultiFieldOccNum = 2 );
+ Prm_CheckBox8HR := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_list.Control_MultiFieldOccNum = 3 );
+ // Daily Order Grid Orders (row By Row)
+ //Daily_Order
+
+ DO_Fib_4HR :=Daily_Order.Value[1] ; DO_APPT_4HR :=Daily_Order.Value[2] ;
+ DO_CBC_8HR :=Daily_Order.Value[3] ; DO_Pro_8HR :=Daily_Order.Value[4] ;
+ // Hidden Parameter Value
+ Prm_AdmInst_Fib_Post := last of (field_list where field_list.DataItemName = "NUR_DailySchedule" and field_list.Control_MultiFieldOccNum = 1 );
+ Prm_AdmInst_APTT_Post := last of (field_list where field_list.DataItemName = "NUR_DailySchedule" and field_list.Control_MultiFieldOccNum = 2 );
+ Prm_AdmInst_Fib_While := last of (field_list where field_list.DataItemName = "NUR_DailySchedule" and field_list.Control_MultiFieldOccNum = 3 );
+ Prm_AdmInst_APTT_While := last of (field_list where field_list.DataItemName = "NUR_DailySchedule" and field_list.Control_MultiFieldOccNum = 4 );
+ Prm_AdmInst_CBC := last of (field_list where field_list.DataItemName = "NUR_DailySchedule" and field_list.Control_MultiFieldOccNum = 5 );
+ Prm_AdmInst_ProINR := last of (field_list where field_list.DataItemName = "NUR_DailySchedule" and field_list.Control_MultiFieldOccNum = 6 );
+
+ RptLabs_OrderName := last of (field_list where field_list.DataItemName = "Repeat_Labs 3" and field_list.Control_MultiFieldOccNum = 1 );
+ RptLabs_Freq := last of (field_list where field_list.DataItemName = "CPOE_Rpt_Freq_LyticTherapy" and field_list.Control_MultiFieldOccNum = 1 );
+ RptLabs_Occ := last of (field_list where field_list.DataItemName = "CPOE_Repeat_Lab_Occur" and field_list.Control_MultiFieldOccNum = 1 );
+ RptLabs_Start := last of (field_list where field_list.DataItemName = "CPOE_Repeat Lab Start" and field_list.Control_MultiFieldOccNum = 1 );
+ RptLabs_Time := last of (field_list where field_list.DataItemName = "CPOE_Rpt_Time_LyticTherapy" and field_list.Control_MultiFieldOccNum = 1 );
+
+ DO_APTT_ToDate := last of (field_list where field_list.DataItemName = "NUR_ToDate" and field_list.Control_MultiFieldOccNum = 1 );
+ DO_Fibrinogen_ToDate := last of (field_list where field_list.DataItemName = "NUR_ToDate" and field_list.Control_MultiFieldOccNum = 2 );
+ DO_IRN_ToDate := last of (field_list where field_list.DataItemName = "NUR_ToDate" and field_list.Control_MultiFieldOccNum = 3 );
+ DO_CBC_ToDate := last of (field_list where field_list.DataItemName = "NUR_ToDate" and field_list.Control_MultiFieldOccNum = 4 );
+
+ RPTLabs_APTT_Auto_FromDate := last of (field_list where field_list.DataItemName = "NUR_Comment 6" and field_list.Control_MultiFieldOccNum = 1 );
+ RPTLabs_Fibrinogen_Auto_FromDate := last of (field_list where field_list.DataItemName = "NUR_Comment 6" and field_list.Control_MultiFieldOccNum = 2 );
+ RPTLabs_IRN_Auto_FromDate := last of (field_list where field_list.DataItemName = "NUR_Comment 6" and field_list.Control_MultiFieldOccNum = 3 );
+ RPTLabs_CBC_Auto_FromDate := last of (field_list where field_list.DataItemName = "NUR_Comment 6" and field_list.Control_MultiFieldOccNum = 4 );
+
+ RPTLabs_Ordered_Test_TextBox := last of (field_list where field_list.DataItemName = "CPOE Repeat Lab Accumulator" and field_list.Control_MultiFieldOccNum = 1 );
+
+ DO_APTT_FromDate := last of (field_list where field_list.DataItemName = "NUR_DateField" and field_list.Control_MultiFieldOccNum = 1 );
+ DO_Fibrinogen_FromDate := last of (field_list where field_list.DataItemName = "NUR_DateField" and field_list.Control_MultiFieldOccNum = 2 );
+ DO_IRN_FromDate := last of (field_list where field_list.DataItemName = "NUR_DateField" and field_list.Control_MultiFieldOccNum = 3 );
+ DO_CBC_FromDate := last of (field_list where field_list.DataItemName = "NUR_DateField" and field_list.Control_MultiFieldOccNum = 4 );
+
+
+ //This section should only be called from MLM "FORM_Set_Repeat_Lab_Orders" when the occurances is "5 Times" otherwise this section should never called
+ if (((this_communication.CallingFieldName = "CPOE Repeat Lab Submit Button|1" and this_communication.CallingEvent = "ButtonClick"))
+ or (this_communication.CallingFieldName = "CPOE_Rpt_Freq_LyticTherapy|1") or (this_communication.CallingFieldName = "Repeat_Labs 3|1")) then
+
+
+ if (RptLabs_Freq.Value = "Q2H") then
+ RPTFreqChange := "Q2 HR";
+ AddHRsForToDate := 2;
+ elseif (RptLabs_Freq.Value = "Q4H") then
+ RPTFreqChange := "Q4 HR";
+ AddHRsForToDate := 4;
+ elseif (RptLabs_Freq.Value = "Q6H") then
+ RPTFreqChange := "Q6 HR";
+ AddHRsForToDate := 6;
+ elseif (RptLabs_Freq.Value = "Q8H") then
+ RPTFreqChange := "Q8 HR";
+ AddHRsForToDate := 8;
+ elseif (RptLabs_Freq.Value = "Q12H") Then
+ RPTFreqChange := "Q12 HR";
+ AddHRsForToDate := 12;
+ elseif (RptLabs_Freq.Value = "Daily") then
+ RPTFreqChange := "Daily";
+ AddHRsForToDate := 24;
+ else
+ RPTFreqChange := null;
+ endif;
+
+ if (RptLabs_Occ.Value = "2 Times") then
+ RptLabs_Ct := 1;
+ elseif (RptLabs_Occ.Value = "3 Times") then
+ RptLabs_Ct := 2;
+ elseif (RptLabs_Occ.Value = "4 Times") then
+ RptLabs_Ct := 3;
+ elseif (RptLabs_Occ.Value = "5 Times") then
+ RptLabs_Ct := 4;
+ else
+ RptLabs_Ct := 1;
+ endif;
+
+ RPTLabs_Selected_Time := (RptLabs_Time.Value as time);
+ if (RptLabs_Start.Value = "Today") then
+ FromDate := RPTLabs_Selected_Time;
+ elseif (RptLabs_Start.Value = "Tomorrow") then
+ FromDate := (RPTLabs_Selected_Time + 1 day);
+ else
+ FromDate := null;
+ endif;
+
+ if (RptLabs_OrderName.Value matches pattern "%APTT%") then
+
+ if ((this_communication.CallingFieldName = "CPOE_Rpt_Freq_LyticTherapy|1") or (this_communication.CallingFieldName = "Repeat_Labs 3|1")) then
+ FromDate := (RPTLabs_APTT_Auto_FromDate.Value as time);
+ endif;
+ if ((RptLabs_Ct as number) = 4) then
+ DO_APPT_4HR.IsSelected := True;
+ DO_APTT_FromDate.Value := FromDate;
+ endif;
+ if (RPTFreqChange is not null) then
+ Prm_AdmInst_APTT_While.Value := RPTFreqChange;
+ endif;
+
+
+ if ((AddHRsForToDate is not null) and (FromDate is not null)) then
+ APTTHRsToAdd := AddHRsForToDate * (RptLabs_Ct as number);
+ DO_APTT_ToDate.Value := ((FromDate as time) + APTTHRsToAdd hours);
+ endif;
+ if (((RPTLabs_APTT_Auto_FromDate.Value is null) or (RPTLabs_APTT_Auto_FromDate.Value = "")) and ((DO_APTT_ToDate.Value is not null)and (this_communication.CallingFieldName = "CPOE Repeat Lab Submit Button|1" and this_communication.CallingEvent = "ButtonClick")))then
+ RPTLabs_APTT_Auto_FromDate.Value := (DO_APTT_ToDate.Value as string);
+ elseif ((RPTLabs_Ordered_Test_TextBox.Value matches pattern "%APTT%") and (RPTLabs_APTT_Auto_FromDate.Value is not null) and (DO_APTT_ToDate.Value is not null)) then
+ chk_curdate_4RPTLabs := ((extract month now) formatted with "%2.2d") || "-" || ((extract day now) formatted with "%2.2d") || "-" || (extract year now) || " 00:00:00";
+ chk_curdate_PlusDay_4RPTLabs := ((chk_curdate_4RPTLabs as time) + 1 day);
+ tstRPTLabs_APTT_Auto_FromDate := (((RPTLabs_APTT_Auto_FromDate.Value as time) + (AddHRsForToDate hours)) as string);
+ RPTLab_Date := ((extract month (tstRPTLabs_APTT_Auto_FromDate as time)) formatted with "%2.2d") || "-" || ((extract day (tstRPTLabs_APTT_Auto_FromDate as time)) formatted with "%2.2d") || "-" || (extract year (tstRPTLabs_APTT_Auto_FromDate as time)) || " 00:00:00";
+ RPTLab_Time := ((extract hour (tstRPTLabs_APTT_Auto_FromDate as time)) formatted with "%2.2d") || ":" || ((extract minute (tstRPTLabs_APTT_Auto_FromDate as time)) formatted with "%2.2d");
+ if ((RPTLab_Date as time) = (chk_curdate_4RPTLabs as time)) then
+ RptLabs_Start.Value := "Today";
+ RptLabs_Time.Value := RPTLab_Time;
+
+ elseif ((RPTLab_Date as time) = (chk_curdate_PlusDay_4RPTLabs as time)) then
+ RptLabs_Start.Value := "Tomorrow";
+ RptLabs_Time.Value := RPTLab_Time;
+ endif;
+ if (((tstRPTLabs_APTT_Auto_FromDate as time) < DO_APTT_ToDate.Value) and (this_communication.CallingFieldName = "CPOE Repeat Lab Submit Button|1" and this_communication.CallingEvent = "ButtonClick")) then
+ RPTLabs_APTT_Auto_FromDate.Value := (DO_APTT_ToDate.Value as string);
+ endif;
+ else
+ RptLabs_Start.Value := null;
+ RptLabs_Time.Value := null;
+ endif;
+ endif;
+
+ if (RptLabs_OrderName.Value matches pattern "%Fibrinogen%") then
+ if ((this_communication.CallingFieldName = "CPOE_Rpt_Freq_LyticTherapy|1") or (this_communication.CallingFieldName = "Repeat_Labs 3|1")) then
+ FromDate := (RPTLabs_Fibrinogen_Auto_FromDate.Value as time);
+ endif;
+ if ((RptLabs_Ct as number) = 4) then
+ DO_Fib_4HR.IsSelected := True;
+ DO_Fibrinogen_FromDate.Value := FromDate;
+ endif;
+ if (RPTFreqChange is not null) then
+ Prm_AdmInst_Fib_While.Value := RPTFreqChange;
+ endif;
+
+ if ((AddHRsForToDate is not null) and (FromDate is not null)) then
+ FibHRsToAdd := AddHRsForToDate * (RptLabs_Ct as number);
+ DO_Fibrinogen_ToDate.Value := (FromDate + FibHRsToAdd hours);
+ endif;
+
+ if (((RPTLabs_Fibrinogen_Auto_FromDate.Value is null) or (RPTLabs_Fibrinogen_Auto_FromDate.Value = "")) and ((DO_Fibrinogen_ToDate.Value is not null)and (this_communication.CallingFieldName = "CPOE Repeat Lab Submit Button|1" and this_communication.CallingEvent = "ButtonClick")) )then
+ RPTLabs_Fibrinogen_Auto_FromDate.Value := (DO_Fibrinogen_ToDate.Value as string);
+ elseif ((RPTLabs_Ordered_Test_TextBox.Value matches pattern "%Fibrinogen%") and (RPTLabs_Fibrinogen_Auto_FromDate.Value is not null) and (DO_Fibrinogen_ToDate.Value is not null)) then
+ chk_curdate_4RPTLabs := ((extract month now) formatted with "%2.2d") || "-" || ((extract day now) formatted with "%2.2d") || "-" || (extract year now) || " 00:00:00";
+ chk_curdate_PlusDay_4RPTLabs := ((chk_curdate_4RPTLabs as time) + 1 day);
+ tmp_RPTLabs_Fibrinogen_Auto_FromDate := (((RPTLabs_Fibrinogen_Auto_FromDate.Value as time ) + (AddHRsForToDate hours)) as string);
+ RPTLab_Date := ((extract month (tmp_RPTLabs_Fibrinogen_Auto_FromDate as time)) formatted with "%2.2d") || "-" || ((extract day (tmp_RPTLabs_Fibrinogen_Auto_FromDate as time)) formatted with "%2.2d") || "-" || (extract year (tmp_RPTLabs_Fibrinogen_Auto_FromDate as time)) || " 00:00:00";
+ RPTLab_Time := ((extract hour (tmp_RPTLabs_Fibrinogen_Auto_FromDate as time)) formatted with "%2.2d") || ":" || ((extract minute (tmp_RPTLabs_Fibrinogen_Auto_FromDate as time)) formatted with "%2.2d");
+ if ((RPTLab_Date as time) = (chk_curdate_4RPTLabs as time)) then
+ RptLabs_Start.Value := "Today";
+ RptLabs_Time.Value := RPTLab_Time;
+ elseif ((RPTLab_Date as time) = (chk_curdate_PlusDay_4RPTLabs as time)) then
+ RptLabs_Start.Value := "Tomorrow";
+ RptLabs_Time.Value := RPTLab_Time;
+ endif;
+ if (((tmp_RPTLabs_Fibrinogen_Auto_FromDate as time) < DO_Fibrinogen_ToDate.Value) and (this_communication.CallingFieldName = "CPOE Repeat Lab Submit Button|1" and this_communication.CallingEvent = "ButtonClick")) then
+ RPTLabs_Fibrinogen_Auto_FromDate.Value := (DO_Fibrinogen_ToDate.Value as string);
+ endif;
+ else
+ RptLabs_Start.Value := null;
+ RptLabs_Time.Value := null;
+ endif;
+ endif;
+
+
+
+
+
+ if (RptLabs_OrderName.Value matches pattern "%Prothrombin/INR%") then
+
+ if ((this_communication.CallingFieldName = "CPOE_Rpt_Freq_LyticTherapy|1") or (this_communication.CallingFieldName = "Repeat_Labs 3|1")) then
+ FromDate := (RPTLabs_IRN_Auto_FromDate.Value as time);
+ abc123 := "callingfieldname called MLM";
+ endif;
+
+ if ((RptLabs_Ct as number) = 4) then
+ DO_Pro_8HR.IsSelected := True;
+ DO_IRN_FromDate.Value := FromDate;
+
+ endif;
+ if (RPTFreqChange is not null) then
+ Prm_AdmInst_ProINR.Value := RPTFreqChange;
+ endif;
+
+ if ((AddHRsForToDate is not null) and (FromDate is not null)) then
+ INRHRsToAdd := AddHRsForToDate * (RptLabs_Ct as number);
+ DO_IRN_ToDate.Value := (FromDate + INRHRsToAdd hours);
+ endif;
+
+ if (((RPTLabs_IRN_Auto_FromDate.Value is null) or (RPTLabs_IRN_Auto_FromDate.Value = "")) and ((DO_IRN_ToDate.Value is not null) and (this_communication.CallingFieldName = "CPOE Repeat Lab Submit Button|1" and this_communication.CallingEvent = "ButtonClick")))then
+ RPTLabs_IRN_Auto_FromDate.Value := (DO_IRN_ToDate.Value as string);
+ elseif ((RPTLabs_Ordered_Test_TextBox.Value matches pattern "%Fibrinogen%") and (RPTLabs_IRN_Auto_FromDate.Value is not null) and (DO_IRN_ToDate.Value is not null)) then
+ chk_curdate_4RPTLabs := ((extract month now) formatted with "%2.2d") || "-" || ((extract day now) formatted with "%2.2d") || "-" || (extract year now) || " 00:00:00";
+ chk_curdate_PlusDay_4RPTLabs := ((chk_curdate_4RPTLabs as time) + 1 day);
+ tmp_RPTLabs_IRN_Auto_FromDate := (((RPTLabs_IRN_Auto_FromDate.Value as time) + (AddHRsForToDate hours)) as string);
+ RPTLab_Date := ((extract month (tmp_RPTLabs_IRN_Auto_FromDate as time)) formatted with "%2.2d") || "-" || ((extract day (tmp_RPTLabs_IRN_Auto_FromDate as time)) formatted with "%2.2d") || "-" || (extract year (tmp_RPTLabs_IRN_Auto_FromDate as time)) || " 00:00:00";
+ RPTLab_Time := ((extract hour (tmp_RPTLabs_IRN_Auto_FromDate as time)) formatted with "%2.2d") || ":" || ((extract minute (tmp_RPTLabs_IRN_Auto_FromDate as time)) formatted with "%2.2d");
+ if ((RPTLab_Date as time) = (chk_curdate_4RPTLabs as time)) then
+ RptLabs_Start.Value := "Today";
+ RptLabs_Time.Value := RPTLab_Time;
+ elseif ((RPTLab_Date as time) = (chk_curdate_PlusDay_4RPTLabs as time)) then
+ RptLabs_Start.Value := "Tomorrow";
+ RptLabs_Time.Value := RPTLab_Time;
+ endif;
+ if (((tmp_RPTLabs_IRN_Auto_FromDate as time) < DO_IRN_ToDate.Value) and (this_communication.CallingFieldName = "CPOE Repeat Lab Submit Button|1" and this_communication.CallingEvent = "ButtonClick")) then
+ RPTLabs_IRN_Auto_FromDate.Value := (DO_IRN_ToDate.Value as string);
+ endif;
+ else
+ RptLabs_Start.Value := null;
+ RptLabs_Time.Value := null;
+ endif;
+
+ endif;
+
+
+
+ if (RptLabs_OrderName.Value matches pattern "%CBC No Diff (Hemogram Only)%") then
+ if ((this_communication.CallingFieldName = "CPOE_Rpt_Freq_LyticTherapy|1") or (this_communication.CallingFieldName = "Repeat_Labs 3|1")) then
+ FromDate := (RPTLabs_CBC_Auto_FromDate.Value as time);
+ abc123 := "callingfieldname called MLM";
+ endif;
+ if ((RptLabs_Ct as number) = 4) then
+ DO_CBC_8HR.IsSelected := True;
+ DO_CBC_FromDate.Value := FromDate;
+ endif;
+ if (RPTFreqChange is not null) then
+ Prm_AdmInst_CBC.Value := RPTFreqChange;
+ endif;
+
+ if ((AddHRsForToDate is not null) and (FromDate is not null)) then
+ CBCHRsToAdd := AddHRsForToDate * (RptLabs_Ct as number);
+ DO_CBC_ToDate.Value := (FromDate + CBCHRsToAdd hours);
+ endif;
+
+ if (((RPTLabs_CBC_Auto_FromDate.Value is null) or (RPTLabs_CBC_Auto_FromDate.Value = "")) and ((DO_CBC_ToDate.Value is not null)and (this_communication.CallingFieldName = "CPOE Repeat Lab Submit Button|1" and this_communication.CallingEvent = "ButtonClick")) )then
+ RPTLabs_CBC_Auto_FromDate.Value := (DO_CBC_ToDate.Value as string);
+ elseif ((RPTLabs_Ordered_Test_TextBox.Value matches pattern "%Fibrinogen%") and (RPTLabs_CBC_Auto_FromDate.Value is not null) and (DO_CBC_ToDate.Value is not null)) then
+ chk_curdate_4RPTLabs := ((extract month now) formatted with "%2.2d") || "-" || ((extract day now) formatted with "%2.2d") || "-" || (extract year now) || " 00:00:00";
+ chk_curdate_PlusDay_4RPTLabs := ((chk_curdate_4RPTLabs as time) + 1 day);
+ tmp_RPTLabs_CBC_Auto_FromDate := (((RPTLabs_CBC_Auto_FromDate.Value as time) + (AddHRsForToDate hours)) as string);
+ RPTLab_Date := ((extract month (tmp_RPTLabs_CBC_Auto_FromDate as time)) formatted with "%2.2d") || "-" || ((extract day (tmp_RPTLabs_CBC_Auto_FromDate as time)) formatted with "%2.2d") || "-" || (extract year (tmp_RPTLabs_CBC_Auto_FromDate as time)) || " 00:00:00";
+ RPTLab_Time := ((extract hour (tmp_RPTLabs_CBC_Auto_FromDate as time)) formatted with "%2.2d") || ":" || ((extract minute (tmp_RPTLabs_CBC_Auto_FromDate as time)) formatted with "%2.2d");
+ if ((RPTLab_Date as time) = (chk_curdate_4RPTLabs as time)) then
+ RptLabs_Start.Value := "Today";
+ RptLabs_Time.Value := RPTLab_Time;
+ elseif ((RPTLab_Date as time) = (chk_curdate_PlusDay_4RPTLabs as time)) then
+ RptLabs_Start.Value := "Tomorrow";
+ RptLabs_Time.Value := RPTLab_Time;
+ endif;
+ if (((tmp_RPTLabs_CBC_Auto_FromDate as time) < DO_CBC_ToDate.Value) and (this_communication.CallingFieldName = "CPOE Repeat Lab Submit Button|1" and this_communication.CallingEvent = "ButtonClick")) then
+ RPTLabs_CBC_Auto_FromDate.Value := (DO_CBC_ToDate.Value as string);
+ endif;
+ else
+ RptLabs_Start.Value := null;
+ RptLabs_Time.Value := null;
+ endif;
+ endif;
+ if(RptLabs_OrderName.Value = "" or RptLabs_OrderName.Value is null) then
+ RptLabs_Start.Value := null;
+ RptLabs_Time.Value := null;
+ endif;
+ endif;
+
+
+
+
+
+
+ If this_communication.CallingEvent = "FormOpen" Then
+ Labs_ReqDate_PostProc_Every2hr_x2.Control_Read_Only := true;
+ Labs_Priority_PostProc_Every2hr_x2.Control_Read_Only := true;
+ Labs_Time_PostProc_Every2hr_x2.Control_Visible := false;
+
+ Labs_ReqDate_LyticTherapy_Every4hr.Control_Read_Only := true;
+ Labs_Priority_LyticTherapy_Every4hr.Control_Read_Only := true;
+ Labs_Time_LyticTherapy_Every4hr.Control_Visible := false;
+
+ Labs_ReqDate_LyticTherapy_Every8hr.Control_Read_Only := true;
+ Labs_Priority_LyticTherapy_Ever82hr.Control_Read_Only := true;
+ Labs_Time_LyticTherapy_Every8hr.Control_Visible := false;
+
+
+ LabNames := local_session.SessionMaxRepeatLabNames;
+ LabTimes := local_session.SessionMaxRepeatLabTimes;
+ ctlabname := count(LabNames);
+ IF (ctlabname>0) then
+ for x in (1 seqto(ctlabname)) do
+ if (trim(LabNames[x]) = "APTT") then
+ abc123 := "labnames = " || LabNames[x] || " and LabTimes =" || LabTimes[x];
+ RPTLabs_APTT_Auto_FromDate.Value := (LabTimes[x] as string);
+ endif;
+ if (trim(LabNames[x]) = "Fibrinogen") then
+ RPTLabs_Fibrinogen_Auto_FromDate.Value := (LabTimes[x] as string);
+ endif;
+ if (trim(LabNames[x]) = "CBC No Diff (Hemogram Only)") then
+ RPTLabs_CBC_Auto_FromDate.Value := (LabTimes[x] as string);
+ endif;
+ if (trim(LabNames[x]) = "Prothrombin/INR") then
+ RPTLabs_IRN_Auto_FromDate.Value := (LabTimes[x] as string);
+ endif;
+ enddo;
+ abc123 := (local_session.UnsubmittedRepeatLabDetails as string);
+ ctunsubmitted := count(local_session.UnsubmittedRepeatLabDetails);
+ RPTLabDetails := "";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ for x in (1 seqto(ctunsubmitted)) do
+ if (RPTLabDetails = "") then
+ RPTLabDetails := (local_session.UnsubmittedRepeatLabDetails[x] as string);
+ else
+ RPTLabDetails := RPTLabDetails || CRLF || (local_session.UnsubmittedRepeatLabDetails[x] as string);
+ endif;
+ enddo;
+ RPTLabs_Ordered_Test_TextBox.Value := RPTLabDetails;
+ endif;
+
+
+ endif;
+
+ If this_communication.CallingEvent = "FieldChange" Then
+
+ if (this_communication.CallingFieldName = "MultiOrderCheckbox|1") then
+ if (true in Prm_CheckBox2HR.Value.IsSelected) then
+ Labs_ReqDate_PostProc_Every2hr_x2.Control_Read_Only := false;
+ Labs_ReqDate_PostProc_Every2hr_x2.Control_Mandatory := true;
+ Labs_Priority_PostProc_Every2hr_x2.Control_Read_Only := false;
+ Labs_Priority_PostProc_Every2hr_x2.Control_Mandatory := true;
+ Labs_Priority_PostProc_Every2hr_x2.Value := "Scheduled Time";
+ Labs_Time_PostProc_Every2hr_x2.Control_Visible := true;
+ Labs_Time_PostProc_Every2hr_x2.Control_Read_Only := false;
+ Labs_Time_PostProc_Every2hr_x2.Control_Mandatory := true;
+ else
+ Labs_ReqDate_PostProc_Every2hr_x2.Value := null;
+ Labs_ReqDate_PostProc_Every2hr_x2.Control_Mandatory := false;
+ Labs_ReqDate_PostProc_Every2hr_x2.Control_Read_Only := true;
+ Labs_Priority_PostProc_Every2hr_x2.Control_Read_Only := true;
+ Labs_Priority_PostProc_Every2hr_x2.Control_Mandatory := false;
+ Labs_Priority_PostProc_Every2hr_x2.Value := null;
+ Labs_Time_PostProc_Every2hr_x2.Control_Visible := false;
+ Labs_Time_PostProc_Every2hr_x2.Control_Read_Only := true;
+ Labs_Time_PostProc_Every2hr_x2.Control_Mandatory := false;
+
+ endif;
+ endif;
+
+ if (this_communication.CallingFieldName = "MultiOrderCheckbox|2") then
+
+ if (true in Prm_CheckBox4HR.Value.IsSelected) then
+ Labs_ReqDate_LyticTherapy_Every4hr.Control_Read_Only := false;
+ Labs_ReqDate_LyticTherapy_Every4hr.Control_Mandatory := true;
+ Labs_Priority_LyticTherapy_Every4hr.Control_Read_Only := false;
+ Labs_Priority_LyticTherapy_Every4hr.Control_Mandatory := true;
+ Labs_Priority_LyticTherapy_Every4hr.Value := "Scheduled Time";
+ Labs_Time_LyticTherapy_Every4hr.Control_Visible := true;
+ Labs_Time_LyticTherapy_Every4hr.Control_Read_Only := false;
+ Labs_Time_LyticTherapy_Every4hr.Control_Mandatory := true;
+ else
+ Labs_ReqDate_LyticTherapy_Every4hr.Value := null;
+ Labs_ReqDate_LyticTherapy_Every4hr.Control_Mandatory := false;
+ Labs_ReqDate_LyticTherapy_Every4hr.Control_Read_Only := true;
+
+ Labs_Priority_LyticTherapy_Every4hr.Control_Read_Only := true;
+ Labs_Priority_LyticTherapy_Every4hr.Control_Mandatory := false;
+ Labs_Priority_LyticTherapy_Every4hr.Value := null;
+ Labs_Time_LyticTherapy_Every4hr.Control_Visible := false;
+ Labs_Time_LyticTherapy_Every4hr.Control_Read_Only := true;
+ Labs_Time_LyticTherapy_Every4hr.Control_Mandatory := false;
+ Labs_Time_LyticTherapy_Every4hr.Value := null;
+ endif;
+
+
+
+
+ For i in 1 SEQTO COUNT OF Prm_CheckBox4HR.Value Do
+ If Prm_CheckBox4HR.Value[i].NAME = "Fibrinogen" Then
+ ab := Prm_CheckBox4HR.Value[i].NAME ; abc :=Prm_AdmInst_Fib_While.Value; abcd:= Prm_CheckBox4HR.Value[i].IsSelected ;
+
+ If (Prm_AdmInst_Fib_While.Value Is Null ) And (Prm_CheckBox4HR.Value[i].IsSelected = True) Then
+ Prm_AdmInst_Fib_While.Value := "Q4 HR" ;
+ DO_Fib_4HR.IsSelected := True ;
+ Elseif (Prm_AdmInst_Fib_While.Value Is Not Null ) And (Prm_CheckBox4HR.Value[i].IsSelected = False) Then
+ Prm_AdmInst_Fib_While.Value := "" ;
+ DO_Fib_4HR.IsSelected := False ;
+ Endif;
+
+ Elseif Prm_CheckBox4HR.Value[i].NAME = "APTT" Then
+ If (Prm_AdmInst_APTT_While.Value Is Null ) And (Prm_CheckBox4HR.Value[i].IsSelected = True) Then
+ Prm_AdmInst_APTT_While.Value := "Q4 HR" ;
+ DO_APPT_4HR.IsSelected := True ;
+ Elseif (Prm_AdmInst_APTT_While.Value Is Not Null ) And (Prm_CheckBox4HR.Value[i].IsSelected = False) Then
+ Prm_AdmInst_APTT_While.Value := "" ;
+ DO_APPT_4HR.IsSelected := False ;
+ Endif;
+ Endif;
+ ENDDO;
+ endif;
+
+ if (this_communication.CallingFieldName in ("RequestedDate|1","RequestedDate|2","LAB_Phleb Draw Sched Time|1","LAB_Phleb Draw Sched Time|2","MultiOrderCheckbox|2")) then
+ if ((Labs_ReqDate_PostProc_Every2hr_x2.Value is not null) and (Labs_Time_PostProc_Every2hr_x2.Value is not null)) then
+ extractProcDate := (Labs_ReqDate_PostProc_Every2hr_x2.Value as time);
+ extractProcTime := (extract hour (Labs_Time_PostProc_Every2hr_x2.Value as time));
+ Lyticdatetime := ((extractProcDate + ((extractProcTime as number) hours)) + 6 hours);
+ else
+ extractProcDate := (Labs_ReqDate_LyticTherapy_Every4hr.Value as time);
+ extractProcTime := (extract hour (Labs_Time_LyticTherapy_Every4hr.Value as time));
+ Lyticdatetime := (extractProcDate + ((extractProcTime as number) hours));
+
+ endif;
+ if ((extractProcDate is not null) and (extractProcTime is not null)) then
+ Lytic_4hr_End_DTTM := (Lyticdatetime + 20 hours);
+ Lytic_4hr_End_Date := ((extract month Lytic_4hr_End_DTTM) formatted with "%2.2d") || "-" || ((extract day Lytic_4hr_End_DTTM) formatted with "%2.2d") || "-" || (extract year Lytic_4hr_End_DTTM) || " 00:00:00";
+ DO_APTT_ToDate.Value := Lytic_4hr_End_Date;
+ DO_Fibrinogen_ToDate.Value := Lytic_4hr_End_Date;
+ LyticDate := ((extract month Lyticdatetime) formatted with "%2.2d") || "-" || ((extract day Lyticdatetime) formatted with "%2.2d") || "-" || (extract year Lyticdatetime) || " 00:00:00";
+ LyticTime := ((extract hour Lyticdatetime) formatted with "%2.2d") || ":" || ((extract minute Lyticdatetime) formatted with "%2.2d") ;
+ Labs_Time_LyticTherapy_Every4hr.Value := LyticTime;//"23:00";
+ Labs_ReqDate_LyticTherapy_Every4hr.Value := LyticDate;//"01-10-2016 00:00:00";
+ endif;
+ if (Labs_ReqDate_LyticTherapy_Every4hr.Value is not null) then
+ DO_APTT_FromDate.Value := Labs_ReqDate_LyticTherapy_Every4hr.Value;
+ DO_Fibrinogen_FromDate.Value := Labs_ReqDate_LyticTherapy_Every4hr.Value;
+ else
+ DO_APTT_FromDate.Value := null;
+ DO_Fibrinogen_FromDate.Value := null;
+ endif;
+ endif;
+
+ if (this_communication.CallingFieldName = "MultiOrderCheckbox|3") then
+ if (true in Prm_CheckBox8HR.Value.IsSelected) then
+ Labs_ReqDate_LyticTherapy_Every8hr.Control_Read_Only := false;
+ Labs_ReqDate_LyticTherapy_Every8hr.Control_Mandatory := true;
+ Labs_Priority_LyticTherapy_Ever82hr.Control_Read_Only := false;
+ Labs_Priority_LyticTherapy_Ever82hr.Control_Mandatory := true;
+ Labs_Priority_LyticTherapy_Ever82hr.Value := "Scheduled Time";
+ Labs_Time_LyticTherapy_Every8hr.Control_Visible := true;
+ Labs_Time_LyticTherapy_Every8hr.Control_Read_Only := false;
+ Labs_Time_LyticTherapy_Every8hr.Control_Mandatory := true;
+ else
+ Labs_ReqDate_LyticTherapy_Every8hr.Value := null;
+ Labs_ReqDate_LyticTherapy_Every8hr.Control_Mandatory := false;
+ Labs_ReqDate_LyticTherapy_Every8hr.Control_Read_Only := true;
+
+ Labs_Priority_LyticTherapy_Ever82hr.Control_Read_Only := true;
+ Labs_Priority_LyticTherapy_Ever82hr.Control_Mandatory := false;
+ Labs_Priority_LyticTherapy_Ever82hr.Value := null;
+ Labs_Time_LyticTherapy_Every8hr.Control_Visible := false;
+ Labs_Time_LyticTherapy_Every8hr.Control_Read_Only := true;
+ Labs_Time_LyticTherapy_Every8hr.Control_Mandatory := false;
+ endif;
+
+ // for 3rd Multi-CheckBox Order Selection
+ For i in 1 SEQTO COUNT OF Prm_CheckBox8HR.Value Do
+ If Prm_CheckBox8HR.Value[i].NAME = "CBC No Diff (Hemogram Only)" Then
+ If (Prm_AdmInst_CBC.Value Is Null ) And (Prm_CheckBox8HR.Value[i].IsSelected = True) Then
+ Prm_AdmInst_CBC.Value := "Q8 HR" ;
+ DO_CBC_8HR.IsSelected := True ;
+ Elseif (Prm_AdmInst_CBC.Value Is Not Null ) And (Prm_CheckBox8HR.Value[i].IsSelected = False) Then
+ Prm_AdmInst_CBC.Value := "" ;
+ DO_CBC_8HR.IsSelected := False ;
+ Endif;
+ Elseif Prm_CheckBox8HR.Value[i].NAME = "Prothrombin/INR" Then
+ If (Prm_AdmInst_ProINR.Value Is Null ) And (Prm_CheckBox8HR.Value[i].IsSelected = True) Then
+ Prm_AdmInst_ProINR.Value := "Q8 HR" ;
+ DO_Pro_8HR.IsSelected := True ;
+ Elseif (Prm_AdmInst_ProINR.Value Is Not Null ) And (Prm_CheckBox8HR.Value[i].IsSelected = False) Then
+ Prm_AdmInst_ProINR.Value := "" ;
+ DO_Pro_8HR.IsSelected := False ;
+ Endif;
+ Endif;
+ ENDDO;
+ endif;
+
+ if (this_communication.CallingFieldName = "LAB_Phleb Draw Sched Time|3") then
+ extractProcDate := (Labs_ReqDate_LyticTherapy_Every8hr.Value as time);
+ extractProcTime := (extract hour (Labs_Time_LyticTherapy_Every8hr.Value as time));
+ Lyticdatetime := (extractProcDate + ((extractProcTime as number) hours));
+ Lytic_8hr_End_DTTM := (Lyticdatetime + 24 hours);
+ Lytic_8hr_End_Date := ((extract month Lytic_8hr_End_DTTM) formatted with "%2.2d") || "-" || ((extract day Lytic_8hr_End_DTTM) formatted with "%2.2d") || "-" || (extract year Lytic_8hr_End_DTTM) || " 00:00:00";
+ DO_IRN_ToDate.Value := Lytic_8hr_End_Date;
+ DO_IRN_FromDate.Value := Labs_ReqDate_LyticTherapy_Every8hr.Value;
+
+ DO_CBC_ToDate.Value := Lytic_8hr_End_Date;
+ DO_CBC_FromDate.Value := Labs_ReqDate_LyticTherapy_Every8hr.Value;
+ endif;
+
+
+
+
+
+// Third flow ****** To Apply Via and Vessel Values to Respective Grid Orders-Special Instruction ***********************************************************
+ // For AltephaseGrid 1 and 2
+ Admin_Instr1A :="";Admin_Instr2A :="";Admin_Instr1H :="";Admin_Instr2H :="";
+ If Prm_Via1A.Value is not Null Then
+ Admin_Instr1A := Prm_Via1A.Value ;
+ EndIf;
+ If Prm_Vessel1A.Value is not Null Then
+ Admin_Instr1A := Admin_Instr1A || " , " || Prm_Vessel1A.Value ;
+ EndIf;
+
+ Prm_Admin_instr1A.Value := Admin_Instr1A;
+
+ If Prm_Via2A.Value is not Null Then
+ Admin_Instr2A := Prm_Via2A.Value ;
+ EndIf;
+ If Prm_Vessel2A.Value is not Null Then
+ Admin_Instr2A := Admin_Instr2A || " , " || Prm_Vessel2A.Value ;
+ EndIf;
+ Prm_Admin_instr2A.Value := Admin_Instr2A;
+
+ // For Heparin Grid 1 and 2
+ If Prm_Via1H.Value is not Null Then
+ Admin_Instr1H := Prm_Via1H.Value ;
+ EndIf;
+ If Prm_Vessel1H.Value is not Null Then
+ Admin_Instr1H := Admin_Instr1H || " , " || Prm_Vessel1H.Value ;
+ EndIf;
+ Prm_Admin_instr1H.Value := Admin_Instr1H;
+
+ If Prm_Via2H.Value is not Null Then
+ Admin_Instr2H := Prm_Via2H.Value ;
+ EndIf;
+ If Prm_Vessel2H.Value is not Null Then
+ Admin_Instr2H := Admin_Instr2H || " , " || Prm_Vessel2H.Value ;
+ EndIf;
+ Prm_Admin_instr2H.Value := Admin_Instr2H;
+
+
+ Endif;
+
+;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POST_OPEN_HEART_PROG_CARE_AMIODARONE.mlm b/MLMStripper/bin/Debug/FORM/FORM_POST_OPEN_HEART_PROG_CARE_AMIODARONE.mlm
new file mode 100644
index 0000000..f4579e2
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POST_OPEN_HEART_PROG_CARE_AMIODARONE.mlm
@@ -0,0 +1,248 @@
+maintenance:
+
+ title: FORM_POST_OPEN_HEART_PROG_CARE_AMIODARONE;;
+ mlmname: FORM_POST_OPEN_HEART_PROG_CARE_AMIODARONE;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-01-21;;
+ validation: testing;;
+
+library:
+ purpose: Ø Both Amiodarone order get selected if any one Amiodarone order is selecting. ;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ field_list := this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ CallingItem := CallingField.Records_;
+
+ Medication := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 49 );
+ Medication_Val := Medication.Value;
+
+ PharmacyDi := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 70 );
+ PharmacyDi_Val := PharmacyDi.Value;
+
+ PharmacyFuro := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 74 );
+ PharmacyFuro_Val := PharmacyFuro.Value;
+
+ /* PharmacyCarvidol := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 73 );
+ PharmacyCarvidol_Val := PharmacyCarvidol.Value; */
+
+ Daily := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
+ and field_list.Control_MultiFieldOccNum = 8 );
+ Daily_Val := Daily.Value;
+
+ DailyPTINR := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 69 );
+ DailyPTINR_Val := DailyPTINR.Value;
+
+
+
+
+// *********** Objects for first flow *************
+ item1 := Medication_Val[3];
+ item2 := Medication_Val[4];
+// first flow ***************************************************************************************************
+ if (item1.IsSelected = FALSE And item2.IsReadonly= TRUE ) Then
+ A:=111;
+
+ Endif;
+
+
+ if ( CallingEvent = "FieldChange" ) then
+ if ( CallingField = "MultiOrderGrid|49") then
+ if ( true IN Medication_Val[3].IsSelected Or true IN Medication_Val[4].IsSelected ) then
+ Medication_Val[3].IsSelected := true;
+ Medication_Val[4].IsSelected := true ;
+ Medication_Val[4].IsReadonly := TRUE ;
+
+
+ endif;
+ endif;
+ endif;
+
+
+ if A= 111 Then
+ item1.IsSelected := FALSE;
+ item2.IsSelected := FALSE;
+ item1.IsReadonly := FALSE ;
+ item2.IsReadonly := FALSE ;
+
+ Endif;
+
+
+//********* objects for Second Flow **********
+ //Item_Furosemide1:= first of (Medication_Val where Medication_Val.Name = "Furosemide Inj");//
+ item11 := PharmacyDi_Val[3];
+ Item_Furosemide2:= first of (PharmacyDi_Val where PharmacyDi_Val.Name = "Furosemide 20mg Tab");//
+ Item_Furosemide3:= first of (PharmacyDi_Val where PharmacyDi_Val.Name = "Furosemide 40mg Tab");//
+ Item_Furosemide4:= first of (PharmacyDi_Val where PharmacyDi_Val.Name = "Furosemide 80mg Tab");//
+
+// Second flow ******************************************************************************
+ If item11.IsSelected = True Then
+ Item_Furosemide2.IsReadonly := True;
+ Item_Furosemide3.IsReadonly := True;
+ Item_Furosemide4.IsReadonly := True;
+ //Code for Second Scope
+
+ /* item_Furo_inj1.IsSelected := True ;
+ RequestedTime1.Value := now + 1 day ;
+
+ item_Furo_inj1.IsReadOnly := True ; */
+
+ EndIf;
+
+ If Item_Furosemide2.IsSelected = True Then
+ Item_Furosemide3.IsReadonly := True;
+ Item_Furosemide4.IsReadonly := True;
+ item11.IsReadonly := True;
+ EndIf;
+
+
+
+ If Item_Furosemide3.IsSelected = True Then
+ Item_Furosemide2.IsReadonly := True;
+ Item_Furosemide4.IsReadonly := True;
+ item11.IsReadonly := True;
+ EndIf;
+
+ If Item_Furosemide4.IsSelected = True Then
+ Item_Furosemide2.IsReadonly := True;
+ Item_Furosemide3.IsReadonly := True;
+ item11.IsReadonly := True;
+ EndIf;
+
+ If (item11.IsSelected = False And Item_Furosemide2.IsSelected = False And Item_Furosemide3.IsSelected = False And Item_Furosemide4.IsSelected = False) Then
+
+ Item_Furosemide2.IsReadonly := False;
+ Item_Furosemide3.IsReadonly := False;
+ Item_Furosemide4.IsReadonly := False;
+ item11.IsReadonly := False;
+ EndIf;
+
+// Third Flow *******************************************************************************
+// *********** object for third flow ******************
+ item_Furo_inj1 := PharmacyFuro_Val[1];//Furosemide Inj
+ item_Furo_inj2 := PharmacyFuro_Val[2];//88
+
+
+ RequestedTime1 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+
+ If item_Furo_inj1.IsSelected = True Then
+ item_Furo_inj2.IsSelected := True ;
+ item_Furo_inj2.IsReadonly := True ;
+ RequestedTime1.Value := now + 1 day ;
+
+ EndIf;
+
+ If (item_Furo_inj1.IsSelected = False And item_Furo_inj2.IsSelected = True And item_Furo_inj2.IsReadonly = True ) Then
+ item_Furo_inj2.IsSelected := False ;
+ item_Furo_inj2.IsReadonly := False ;
+ RequestedTime1.Value := now ;
+
+ EndIf;
+
+
+
+
+
+
+
+// Fourth Flow *******************************************************************************
+
+
+Prothrombin:= first of (Daily_Val where Daily_Val.Name = "Prothrombin/INR");//
+DailyOrder:= first of (DailyPTINR_Val where DailyPTINR_Val.Name = "Daily Orders:");//
+
+
+
+ If Prothrombin.IsSelected = True Then
+ DailyOrder.IsSelected :=True;
+ DailyOrder.IsReadOnly :=True;
+ EndIf;
+
+ If Prothrombin.IsSelected = False And DailyOrder.IsReadOnly =True And DailyOrder.IsSelected =True Then
+ DailyOrder.IsSelected := False;
+ DailyOrder.IsReadOnly := False;
+ EndIf;
+
+
+ If DailyOrder.IsSelected = True Then
+
+ Prothrombin.IsSelected :=True;
+ DailyOrder.IsReadOnly :=True;
+ EndIf;
+
+//=====Carvodol: Select Only One Order ================================================================================
+
+
+ /* Carvidol1:= first of (PharmacyCarvidol_Val where PharmacyCarvidol_Val.Name = "Carvedilol 3.125mg Tab");//
+ Carvidol2:= first of (PharmacyCarvidol_Val where PharmacyCarvidol_Val.Name = "Carvedilol 6.25mg Tab");//
+ Carvidol3:= first of (PharmacyCarvidol_Val where PharmacyCarvidol_Val.Name = "Carvedilol 12.5mg Tab");//
+ Carvidol4:= first of (PharmacyCarvidol_Val where PharmacyCarvidol_Val.Name = "Carvedilol 25mg Tab");//
+
+
+ If Carvidol1.IsSelected = True Then
+ Carvidol2.IsReadonly := True;
+ Carvidol3.IsReadonly := True;
+ Carvidol4.IsReadonly := True;
+ EndIf;
+
+ If Carvidol2.IsSelected = True Then
+ Carvidol1.IsReadonly := True;
+ Carvidol3.IsReadonly := True;
+ Carvidol4.IsReadonly := True;
+ EndIf;
+
+ If Carvidol3.IsSelected = True Then
+ Carvidol1.IsReadonly := True;
+ Carvidol2.IsReadonly := True;
+ Carvidol4.IsReadonly := True;
+ EndIf;
+
+ If Carvidol4.IsSelected = True Then
+ Carvidol1.IsReadonly := True;
+ Carvidol2.IsReadonly := True;
+ Carvidol3.IsReadonly := True;
+ EndIf;
+
+ If (Carvidol1.IsSelected = False And Carvidol2.IsSelected = False And Carvidol3.IsSelected = False And Carvidol4.IsSelected = False) Then
+ Carvidol1.IsReadonly := False;
+ Carvidol2.IsReadonly := False;
+ Carvidol3.IsReadonly := False;
+ Carvidol4.IsReadonly := False;
+ EndIf; */
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POST_OP_APPENDECTOMY.mlm b/MLMStripper/bin/Debug/FORM/FORM_POST_OP_APPENDECTOMY.mlm
new file mode 100644
index 0000000..2d82b43
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POST_OP_APPENDECTOMY.mlm
@@ -0,0 +1,82 @@
+maintenance:
+
+ title: FORM_POST_OP_APPENDECTOMY ;;
+ mlmname: FORM_POST_OP_APPENDECTOMY ;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav;;
+ date: 2015-01-22;;
+ validation: testing;;
+
+library:
+ purpose:
+
+ ;;
+
+ explanation:
+
+ Change History
+ -----------------
+ 12.10.2014 JML CSR# 33051: Created
+ ;;
+ keywords: Called MLMs
+ ;;
+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;
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Medication := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 49);
+ Medication_Val := Medication.Value;
+
+
+ Item_OnDan:= first of (Medication_Val where Medication_Val.Name = "Ondansetron Inj");//
+ Item_Prometh:= first of (Medication_Val where Medication_Val.Name = "Promethazine Inj");//
+
+
+
+ // Code for Ondansetron Inj & Promethazine Inj
+
+
+ If Item_OnDan.IsSelected = True Then
+ Item_Prometh.IsReadOnly := "TRUE";
+ EndIf;
+ If Item_Prometh.IsSelected = True Then
+ Item_OnDan.IsReadOnly := "TRUE";
+ EndIf;
+ If Item_OnDan.IsSelected = False And Item_Prometh.IsSelected = false Then
+ Item_Prometh.Isreadonly := "FALSE";
+ Item_OnDan.Isreadonly := "FALSE";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POST_OP_APPENDECTOMY_MORPHINE.mlm b/MLMStripper/bin/Debug/FORM/FORM_POST_OP_APPENDECTOMY_MORPHINE.mlm
new file mode 100644
index 0000000..74d41ba
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POST_OP_APPENDECTOMY_MORPHINE.mlm
@@ -0,0 +1,157 @@
+maintenance:
+
+ title: FORM_POST_OP_APPENDECTOMY_MORPHINE ;;
+ mlmname: FORM_POST_OP_APPENDECTOMY_MORPHINE ;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav;;
+ date: 2015-02-16;;
+ validation: testing;;
+
+library:
+ purpose:
+
+ ;;
+
+ explanation:
+
+ Change History
+ -----------------
+ 12.10.2014 JML CSR# 33051: Created
+ ;;
+ keywords: Called MLMs
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Retrieve relevant form fields
+ Medication1 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 59);
+ Medication1_Val := Medication1.Value;
+
+ Medication2 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 60);
+ Medication2_Val := Medication2.Value;
+
+
+ Item_1 := Medication1_Val[1]; //Hydromorphone Inj
+ Item_2 := Medication1_Val[2];//Morphine Inj
+ Item_3 := Medication2_Val[1]; //PCA - Morphine Order Set
+ Item_4 := Medication2_Val[2]; //PCA - Hydromorphone Order Set
+ /*Item_5 := Medication_Val[5]; //Ondansetron Inj
+ Item_6 := Medication_Val[6]; //Promethazine Inj
+ Item_7 := Medication_Val[7];
+ Item_8 := Medication_Val[8];
+ Item_9 := Medication_Val[9]; */
+
+
+ MedVal1:=NULL;
+ MedVal2 :=NULL;
+ for i in 1 seqto 2 do
+ If Medication1_Val[i].IsSelected = True Then
+ MedVal1 := i;
+
+ EndIf;
+ If Medication2_Val[i].IsSelected = True Then
+ MedVal2 := i;
+
+ Endif;
+ EndDo;
+
+
+
+
+
+
+
+ If ( Item_1.IsSelected= true or Item_2.IsSelected= true or Item_3.IsSelected= true or Item_4.IsSelected= true )Then
+ Item_1.IsReadOnly := true;
+ Item_2.IsReadOnly := true;
+ Item_3.IsReadOnly := true;
+ Item_4.IsReadOnly := true;
+ endif;
+
+
+
+
+
+ If (MedVal1 is NULL) And ( MedVal2 Is Null ) Then
+ Medication1_Val[1].IsReadOnly := false;
+ Medication1_Val[2].IsReadOnly := false;
+ Medication2_Val[1].IsReadOnly := false;
+ Medication2_Val[2].IsReadOnly := false;
+
+ EndIf;
+
+ for i in 1 seqto 2 do
+
+ If Medication1_Val[i].IsSelected = True Then
+ Val1 := i;
+ EndIf;
+ If Medication2_Val[i].IsSelected = True Then
+ Val2 := i;
+ EndIf;
+ Enddo;
+
+ If Val1 is not NULL Then
+ Medication1_Val[Val1].IsReadOnly := false ;
+
+ /*If Val1=1 Then
+ Item_1.IsReadOnly := False ;
+ ElseIf Val2 Then
+ Item_2.IsReadOnly := False ;
+ Endif;*/
+
+
+ EndIf;
+ If Val2 Is not Null Then
+ Medication2_Val[Val2].IsReadOnly := false ;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POST_OP_LAP_CHOLE.mlm b/MLMStripper/bin/Debug/FORM/FORM_POST_OP_LAP_CHOLE.mlm
new file mode 100644
index 0000000..a381224
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POST_OP_LAP_CHOLE.mlm
@@ -0,0 +1,237 @@
+maintenance:
+
+ title: FORM_POST_OP_LAP_CHOLE ;;
+ mlmname: FORM_POST_OP_LAP_CHOLE ;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-03-14 ;;
+ validation: testing;;
+
+library:
+ purpose: 1st scenario: When the user select Morphine Inj, then, user should not be able to select Hydromorphone Inj,
+ PCA Morphine Order set , PCA -Hydromorphone Order set ,oxycodone and hydrocodone
+ 2nd scenario :When the user select Hydromorphone Inj, then, user should not be able to select Morphine Inj, PCA Morphine Order set , PCA -Hydromorphone Order set
+ ,oxycodone and hydrocodone
+ 3rd scenario : When the user select PCA Morphine Order set, then, user should not be able to select Morphine Inj, Hydromorphone Inj ,
+ PCA -Hydromorphone Order set,oxycodone and hydrocodone
+ 4th scenario : When the user select PCA -Hydromorphone Order set, then, user should not be able to select Morphine Inj, Hydromorphone Inj ,
+ PCA Morphine Order set,oxycodone and hydrocodone
+ 5th scenario : When the user select oxycodone, then user should not be able to select Morphine Inj, Hydromorphone Inj , PCA Morphine Order set,
+ PCA -Hydromorphone Order set and hydrocodone.
+ 6th scenario : When user selects hydrocodone then user should not be able to select Morphine Inj, Hydromorphone Inj , PCA Morphine Order set,
+ PCA -Hydromorphone Order set and oxycodone.
+Change History
+=====================================================================================
+03/14/2016 SSJ CSR :33079 MLM Created
+02/21/2017 TMS CSR: 35186 Updated search for "Hydrocodone 5mg/Acetaminophen 325mg name change
+
+
+
+;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ ( this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ // Assigns fields passed in the Form object to the Field object
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+
+
+ Medication_Morphine := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 64 );
+ Medication_HydroMorphine := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 65 );
+ Medication_Pharmacy := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 49 );
+ Heparin_Grid := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 66 );
+
+
+ Morphine_Value := Medication_Morphine.Value ;
+ HydroMorphine_Value := Medication_HydroMorphine.Value;
+ Pharmacy_Value := Medication_Pharmacy.Value;
+ Heparin_Grid_Value := Heparin_Grid.Value;
+
+
+
+// *********** Objects for first flow *************
+
+
+ Morphine1 := first of (Morphine_Value where Morphine_Value.Name = "Morphine Inj");
+ //Morphine2 := first of (Morphine_Value where Morphine_Value.Name = "PCA - Morphine Order Set"); //PCA - Morphine Order Set
+ Morphine2 := Morphine_Value[2];
+ HydroMorphine1 := first of (HydroMorphine_Value where HydroMorphine_Value.Name = "Hydromorphone Inj"); // D5W 1000ml
+ //HydroMorphine2 := first of (HydroMorphine_Value where HydroMorphine_Value.Name = "PCA - Hydromorphone Order Set");
+ HydroMorphine2 := HydroMorphine_Value[2];
+ //OxyCodon := first of (Pharmacy_Value where Pharmacy_Value.Name = "OxyCODONE 5mg/Acetaminophen 325mg Tab");
+
+ If Morphine1.IsSelected = True Then
+
+ Morphine2.IsReadonly := True;
+ HydroMorphine1.IsReadonly := True ;
+ HydroMorphine2.IsReadonly := True;
+ //OxyCodon.IsReadonly := True ;
+
+ Endif;
+ If Morphine2.IsSelected = True Then
+
+ Morphine1.IsReadonly := True;
+ HydroMorphine1.IsReadonly := True ;
+ HydroMorphine2.IsReadonly := True;
+ //OxyCodon.IsReadonly := True ;
+
+ Endif;
+ If HydroMorphine1.IsSelected = True Then
+ Morphine1.IsReadonly := True;
+ Morphine2.IsReadonly := True;
+ HydroMorphine2.IsReadonly := True;
+ //OxyCodon.IsReadonly := True ;
+
+ Endif;
+ If HydroMorphine2.IsSelected = True Then
+
+ Morphine1.IsReadonly := True;
+ Morphine2.IsReadonly := True;
+ HydroMorphine1.IsReadonly := True ;
+ //OxyCodon.IsReadonly := True ;
+
+ Endif;
+ /*If OxyCodon.IsSelected = True Then
+ Morphine1.IsReadonly := True;
+ Morphine2.IsReadonly := True;
+ HydroMorphine1.IsReadonly := True ;
+ HydroMorphine2.IsReadonly := True;
+
+ Endif;*/
+ If HydroMorphine2.IsSelected = False And HydroMorphine1.IsSelected = False And Morphine2.IsSelected = False And Morphine1.IsSelected = False Then
+
+ Morphine1.IsReadonly := False;
+ Morphine2.IsReadonly := False;
+ HydroMorphine1.IsReadonly := False ;
+ HydroMorphine2.IsReadonly := False;
+ //OxyCodon.IsReadonly := False ;
+
+ EndIf;
+
+
+// Second flow ******************************************************************************
+ //Second Scope in MLM
+
+ Ondansetron := first of (Pharmacy_Value where Pharmacy_Value.Name = "Ondansetron Inj");
+ Promethazine := first of (Pharmacy_Value where Pharmacy_Value.Name = "Promethazine Inj");
+
+
+ If Ondansetron.IsSelected = True Then
+ Promethazine.IsReadonly := True;
+
+ Endif;
+ If Promethazine.IsSelected = True Then
+ Ondansetron.IsReadonly := True;
+
+ Endif;
+ If Promethazine.IsSelected = False And Ondansetron.IsSelected = False Then
+
+ Promethazine.IsReadonly := False;
+ Ondansetron.IsReadonly := False;
+
+ EndIf;
+
+// Third flow ******************************************************************************
+ Hydrocodone := first of (Pharmacy_Value where Pharmacy_Value.Name matches pattern "Hydrocodone 5mg/Acetaminophen 325mg%");
+ OxyCODONE := first of (Pharmacy_Value where Pharmacy_Value.Name = "OxyCODONE 5mg/Acetaminophen 325mg Tab");
+ If Hydrocodone.IsSelected = True Then
+ OxyCODONE.IsReadonly := True;
+
+ Endif;
+ If OxyCODONE.IsSelected = True Then
+ Hydrocodone.IsReadonly := True;
+
+ Endif;
+ If Hydrocodone.IsSelected = False And OxyCODONE.IsSelected = False Then
+
+ Hydrocodone.IsReadonly := False;
+ OxyCODONE.IsReadonly := False;
+
+ EndIf;
+// fourth Flow *******************************************************************************
+
+ /* Daily_Orders := first of (Heparin_Grid_Value where Heparin_Grid_Value.Name = "Daily Orders:");
+ CBC := first of (Heparin_Grid_Value where Heparin_Grid_Value.Name = "CBC (Includes Diff)");
+
+ //Check to see if patient is on continuous heparin
+ /*Heparin := read {"SELECT o.Name"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND o.Name LIKE {{{SINGLE-QUOTE}}}%Heparin%{{{SINGLE-QUOTE}}}"
+ || " And o.OrderStatusCode in ({{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}}) " }; */
+ /* Order List for Prod Environment
+ || "{{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.45% NaCl 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 250ml{{{SINGLE-QUOTE}}}, "
+ || "{{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 250ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units +0.9% NaCl 500ml{{{SINGLE-QUOTE}}}, "
+ || "{{{SINGLE-QUOTE}}}Heparin 25,000 Units +D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units+ 0.9% NaCl {{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units+ D5W 500ml{{{SINGLE-QUOTE}}}, "
+ || "{{{SINGLE-QUOTE}}}Heparin Inj{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin Inj -{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin Inj {{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin Inj-{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin Inj.{{{SINGLE-QUOTE}}}, "
+ || "{{{SINGLE-QUOTE}}}Heparin Prisma 5000 Units+0.9% NaCl 20ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin-{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Enoxaparin Inj{{{SINGLE-QUOTE}}} "
+
+ Heparin := read {"SELECT o.Name"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND o.Name In ( {{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 500ml{{{SINGLE-QUOTE}}}, "
+ || "{{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units +0.9% NaCl 500ml{{{SINGLE-QUOTE}}}, "
+ || "{{{SINGLE-QUOTE}}}Heparin 25,000 Units +D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units+ 0.9% NaCl 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units+ D5W 500ml{{{SINGLE-QUOTE}}}, "
+ || "{{{SINGLE-QUOTE}}}Heparin 25,000 Units+0.9% NaCl 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units+D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin Infusion 10,000 units/10ml{{{SINGLE-QUOTE}}}, "
+ || "{{{SINGLE-QUOTE}}}Heparin Inj{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin Inj -{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin Inj -{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin Inj-{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin Inj.{{{SINGLE-QUOTE}}}, "
+ || "{{{SINGLE-QUOTE}}}Heparin Prisma 5000 Units+0.9% NaCl 20ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin Protocol{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin-{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Enoxaparin Inj{{{SINGLE-QUOTE}}} ) "
+ || " And o.OrderStatusCode in ({{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}}) " };
+
+
+ If Not exist Heparin Then
+ Daily_Orders.IsSelected := False ;
+ CBC.IsSelected := False ;
+ Daily_Orders.IsReadonly := True ;
+ CBC.IsReadonly := True ;
+
+ Else
+ Daily_Orders.IsSelected := True ;
+ CBC.IsSelected := True ;
+ Daily_Orders.IsReadonly := True ;
+ CBC.IsReadonly := True ;
+ Endif; */
+
+
+
+
+
+
+;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POST_PERMANENT_PACEMAKER_ACTIVITY.mlm b/MLMStripper/bin/Debug/FORM/FORM_POST_PERMANENT_PACEMAKER_ACTIVITY.mlm
new file mode 100644
index 0000000..19bd1b3
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POST_PERMANENT_PACEMAKER_ACTIVITY.mlm
@@ -0,0 +1,81 @@
+maintenance:
+
+ title: Form_Post_Permanent_Pacemaker_Activity;;
+ mlmname: Form_Post_Permanent_Pacemaker_Activity;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: SCH ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shubha Rai;;
+ date: 2015-01-07;;
+ validation: testing;;
+
+library:
+ purpose: If one of the DME: Arm Sling Order Selected then restrict the User to select Another Arm sling Order on Post Permanent Pacemaker or ICD Insertion Orderset;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ //field_list := this_form.fields;
+ field_list2 := this_form.fields;
+ //field_list3 := this_form.fields;
+
+ Client_GUID := this_communication.ClientGUID;
+ ClientVisit_GUID := this_communication.ClientVisitGUID;
+ Chart_GUID := this_communication.ChartGUID;
+ form_name := this_form.Name;
+
+ //if form_name = "Pacemaker_ICD_PostOp" AND this_communication.FormType = "OrderSet" THEN
+
+
+ /* If any item is selected then select all grid items */
+
+ Selected_Flag := False;
+ Multi_Grid := First of ( field_list2 where field_list.DataItemName = "MultiOrderGrid" and field_list.Label = "DME: Arm Sling") ;
+ Multi_Grid_fields := Multi_Grid.Value;
+ item1 := Multi_Grid_fields[1];
+ item2 := Multi_Grid_fields[2];
+
+ item3 := Multi_Grid_fields[3];
+ item4 := Multi_Grid_fields[4];
+
+
+ if item1.IsSelected = TRUE Then
+ item2.IsReadonly := TRUE ;
+ EndIF;
+ if item1.IsSelected = FALSE Then
+ item2.IsReadonly := FALSE ;
+ EndIF;
+
+
+ if item2.IsSelected = TRUE Then
+ item1.IsReadonly := TRUE ;
+ EndIF;
+ if item2.IsSelected = FALSE Then
+ item1.IsReadonly := FALSE ;
+ EndIF;
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POST_PERMANENT_PACEMAKER_DRESSING.mlm b/MLMStripper/bin/Debug/FORM/FORM_POST_PERMANENT_PACEMAKER_DRESSING.mlm
new file mode 100644
index 0000000..21d1255
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POST_PERMANENT_PACEMAKER_DRESSING.mlm
@@ -0,0 +1,98 @@
+maintenance:
+
+ title: Form_Post_Permanent_Pacemaker_Dressing;;
+ mlmname: Form_Post_Permanent_Pacemaker_Dressing;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: SCH ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shubha Rai;;
+ date: 2014-12-30;;
+ validation: testing;;
+
+library:
+ purpose: If upper Dressing Item Get selected then auto select Lower Dressing Item. If Upper dressing Get deselected then it remain as is on Post Permanent Pacemaker or ICD Insertion Orderset form ;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ //field_list := this_form.fields;
+ field_list2 := this_form.fields;
+
+ Client_GUID := this_communication.ClientGUID;
+ ClientVisit_GUID := this_communication.ClientVisitGUID;
+ Chart_GUID := this_communication.ChartGUID;
+ form_name := this_form.Name;
+
+
+
+
+ /* If any item is selected then select all grid items */
+
+ Selected_Flag := False;
+ Multi_Grid := First of ( field_list2 where field_list.DataItemName = "MultiOrderGrid" and field_list.Label = "Dressing") ;
+ Multi_Grid_fields := Multi_Grid.Value;
+ item1 := Multi_Grid_fields[1];
+ item2 := Multi_Grid_fields[2];
+
+ item3 := Multi_Grid_fields[3];
+ item4 := Multi_Grid_fields[4];
+
+ A:=0;
+ if item2.IsSelected = TRUE Then
+ A:=11;
+ //item3.IsSelected := TRUE ;
+ EndIF;
+
+ if item3.IsSelected = FALSE Then
+ A:=33;
+ EndIf;
+
+
+ if item2.IsSelected = FALSE Then
+ A:=22;
+ EndIF;
+
+
+ if item2.IsSelected = FALSE And item3.IsSelected = TRUE Then
+ A:=1;
+ EndIF;
+
+ If A=11 Then
+ item3.IsSelected := TRUE ;
+ ENDIF;
+ If A=22 Then
+ item3.IsSelected := FALSE ;
+ item3.IsReadonly :=FALSE;
+ EndIf;
+ If A=33 Then
+ item3.IsSelected := TRUE ;
+ EndIF;
+ If A=1 Then
+ item3.IsSelected := FALSE ;
+ item3.IsReadonly :=FALSE;
+ EndIf;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POST_PERMANENT_PACEMAKER_PHARMACYGRID.mlm b/MLMStripper/bin/Debug/FORM/FORM_POST_PERMANENT_PACEMAKER_PHARMACYGRID.mlm
new file mode 100644
index 0000000..80dd95e
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POST_PERMANENT_PACEMAKER_PHARMACYGRID.mlm
@@ -0,0 +1,79 @@
+maintenance:
+
+ title: Form_Post_Permanent_Pacemaker_PharmacyGrid;;
+ mlmname: Form_Post_Permanent_Pacemaker_PharmacyGrid;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: SCH ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shubha Rai;;
+ date: 2014-12-30;;
+ validation: testing;;
+
+library:
+ purpose: If one of the Cephalexin order is checked then the other Cephalexin order should be inactivated on Post Permanent Pacemaker or ICD Insertion Orderset ;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ //field_list := this_form.fields;
+ field_list2 := this_form.fields;
+ //field_list3 := this_form.fields;
+
+ Client_GUID := this_communication.ClientGUID;
+ ClientVisit_GUID := this_communication.ClientVisitGUID;
+ Chart_GUID := this_communication.ChartGUID;
+ form_name := this_form.Name;
+
+
+
+ /* If any item is selected then select all grid items */
+
+ Selected_Flag := False;
+ Multi_Grid := First of ( field_list2 where field_list.DataItemName = "MultiOrderGrid" and field_list.Label = "Pharmacy - Medications") ;
+ Multi_Grid_fields := Multi_Grid.Value;
+ item1 := Multi_Grid_fields[1];
+ item2 := Multi_Grid_fields[2];
+
+
+ if item1.IsSelected = TRUE Then
+ item2.IsReadonly := TRUE ;
+ EndIF;
+ if item1.IsSelected = FALSE Then
+ item2.IsReadonly := FALSE ;
+ EndIF;
+
+
+ if item2.IsSelected = TRUE Then
+ item1.IsReadonly := TRUE ;
+ EndIF;
+ if item2.IsSelected = FALSE Then
+ item1.IsReadonly := FALSE ;
+ EndIF;
+
+
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POST_UTERINE_FIBEM_OS.mlm b/MLMStripper/bin/Debug/FORM/FORM_POST_UTERINE_FIBEM_OS.mlm
new file mode 100644
index 0000000..7c67cf0
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POST_UTERINE_FIBEM_OS.mlm
@@ -0,0 +1,91 @@
+maintenance:
+
+ title: ;;
+ mlmname: FORM_POST_UTERINE_FIBEM_OS;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St. Clair Hospital;;
+ author: Shawn Head x7468;;
+ specialist: Michelle Palmer;;
+ date: 2018-12-07;;
+ validation: testing;;
+
+library:
+ purpose:
+ This MLM will be called from the form{{{SINGLE-QUOTE}}}s CPOE_IVPCAManagement when triggered from the Order Set Post Uterine Fibroid Embolization
+ ;;
+ explanation:
+ 12-7-2018 - STH - CSR#: 37085 - Created {Go-Live 1/8/2018}
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+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;
+
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingForm := this_form.name;
+ CallingEvent := this_communication.CallingEvent;
+ ItemEvent := this_communication.ItemEvent;
+ CallingField := this_communication.CallingFieldName;
+ OCS_GUID := this_communication.CatalogOrderSetGUID;
+ OCS_Name := read last {"select name from cv3ordercatalogset with (Nolock)
+ where guid = " || sql(OCS_GUID)};
+
+ if(OCS_Name = "Post Uterine Fibroid Embolization") then
+ if(this_communication.ItemTable = "CV3OrderCatalogMasterItem") then
+
+ OC_GUID := this_communication.ItemID;
+ OC_Name := read last {"select name from CV3OrderCatalogMasterItem
+ where guid = " || sql(OC_GUID)};
+
+ if(OC_Name in ("IV Management","Discontinue Foley Catheter")) then
+
+ if(CallingForm = "CPOE_IVPCAManagement") then
+ tstfldlst := field_list.DataItemName;
+ IVMgt_StopDate_Field := first of
+ (field_list where field_list.DataItemName = "StopDate");
+ DCPCA_field := first of
+ (field_list where field_list.DataItemName = "NUR_IVPCADC");
+ DCPCA_Value := DCPCA_field.Value;
+ if(DCPCA_Value matches pattern "%discontinue%") then
+ IVMgt_StopDate_Field.Control_Mandatory := true;
+ //StopTime_Field.Control_Mandatory := true;
+ endif;
+ endif;
+
+ if(CallingForm = "CPOE_DC_Foley") then
+ Foley_StopDate_Field := first of
+ (field_list where field_list.DataItemName = "RequestedDate");
+ Foley_StopDate_Field.Control_Mandatory := true;
+ endif;
+ endif;
+ endif;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_POST_UTERINE_OS.mlm b/MLMStripper/bin/Debug/FORM/FORM_POST_UTERINE_OS.mlm
new file mode 100644
index 0000000..48f697e
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_POST_UTERINE_OS.mlm
@@ -0,0 +1,309 @@
+maintenance:
+
+ title: FORM_Post_Uterine_OS;;
+ mlmname: FORM_Post_Uterine_OS;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-03-30;;
+ validation: testing;;
+
+library:
+ purpose: Change History
+ ============================================
+ 30-03-2015 CSR-32728 : Created
+
+ ;;
+ explanation: Change Date Format of Stop After
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ ( this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+
+
+ /* freqOccNum := sort Data freqOccNum;
+ RequestedDateOccNum := sort data RequestedDateOccNum;
+ RequestedTimeOccNum := sort data RequestedTimeOccNum;
+
+ FrequencyCode_Toradol := first of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = freqOccNum[1]);
+ StartDate_Toradol := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = RequestedDateOccNum[1]);
+ StartTime_Toradol := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = RequestedTimeOccNum[1]);
+ StartDate_IBU := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = RequestedDateOccNum[2]);
+ StartTime_IBU := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = RequestedTimeOccNum[2]);
+ FreqCodeValue_Toradol := FrequencyCode_Toradol.value.FrequencySummary;
+ StDateValue_Toradol := StartDate_Toradol.value;
+ StTimeValue_Tordol := StartTime_Toradol.value;
+ StTimeValue_IBU := StartTime_IBU.value;
+*/
+//Retrieve relevant form fields
+ //Prm_StopAfter := last of (field_list where field_list.DataItemName = "StopAfter");
+
+
+
+ GD_Serum_Creatinine := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 74 );
+ GD_Serum_Creatinine_Val := GD_Serum_Creatinine.Value ;
+
+ Ketorolac_Inj := GD_Serum_Creatinine_Val[1] ;
+ Ketorolac_Tab := GD_Serum_Creatinine_Val[2] ;
+
+
+ Prm_RequestedDate := first of (field_list where field_list.DataItemName = "RequestedDate" And field_list.Control_MultiFieldOccNum =1);
+ Prm_RequestedTime := first of (field_list where field_list.DataItemName = "RequestedTime" And field_list.Control_MultiFieldOccNum =1);
+ Prm_StopAfter := first of (field_list where field_list.DataItemName = "StopAfter" And field_list.Control_MultiFieldOccNum = 1);
+ Prm_FrequencyCode := first of (field_list where field_list.DataItemName = "FrequencyCode" And field_list.Control_MultiFieldOccNum = 1);
+
+ StartDate_IBU := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ StartTime_IBU := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2);
+
+ RequeStedDate_Val := Prm_RequestedDate.Value ;
+ RequestedTime_Val := Prm_RequestedTime.Value.ReqTimeValue ;
+ RequestedTime_Code := Prm_RequestedTime.Value.ReqTimeCode ;
+ StopAfter_Number := Prm_StopAfter.Value.NUMBER ;
+ StopAfter_Option := Prm_StopAfter.Value.Option ;
+ Frequency_val := Prm_FrequencyCode.Value.FrequencySummary ;
+
+ StTimeValue_IBU := StartTime_IBU.value;
+
+
+ // If User Select Any keterolac row then This value are get Pre-populated
+ If ( Prm_RequestedTime.Value.ReqTimeCode is null And Prm_StopAfter.Value.Option is null ) Then //and Prm_StopAfter.Value.Option = "" Then
+
+ If Ketorolac_Inj.IsSelected = True //or Ketorolac_Tab.IsSelected =True
+ Then
+
+ Prm_RequestedTime.Value.ReqTimeCode := "Scheduled/Start Time" ;
+ Prm_StopAfter.Value.Option := "Hours" ;
+
+
+ EndIf;
+
+ Endif;
+ If ( Ketorolac_Inj.IsSelected = False And Ketorolac_Tab.IsSelected = False ) Then
+ Prm_RequestedTime.Value.ReqTimeCode := "" ;
+ Prm_StopAfter.Value.Option := "" ;
+ Endif;
+
+
+ If Ketorolac_Inj.IsSelected = True And Ketorolac_Tab.IsSelected =True Then
+
+
+
+ THR := Extract Hour NOW;
+ TMN := Extract Minute NOW;
+
+ if THR < 10 then
+ THR := "0" || THR;
+ endif;
+
+ if TMN < 10 then
+ TMN := "0" || TMN;
+ endif;
+
+ PlusLocation := FIND "+" IN STRING RequeStedDate_Val ;
+ TLocation := FIND "T" IN STRING RequeStedDate_Val ;
+
+ If TLocation = 1 and PlusLocation = 0 then
+ RequeStedDate_Val := (now as time);
+ RequeStedDate_Val.ReqTimeCode := "Scheduled/Start Time";
+ RequeStedDate_Val.ReqTimeValue := THR || ":" || TMN;
+ endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF RequeStedDate_Val FROM RequeStedDate_Val ;
+ RequeStedDate_Val := (now as time) + (PlusDays as number) day;
+ Prm_RequestedTime.ReqTimeCode := "Scheduled/Start Time";
+ Prm_RequestedTime.ReqTimeValue := THR || ":" || TMN;
+ endif;
+
+ //RequestedTime_Code := RequestedTime_Val.ReqTimeCode;
+
+
+ SchHour_Val := substring 2 characters from RequestedTime_Val as number;
+ SchMin_Val := substring 2 characters starting at 4 from RequestedTime_Val;
+
+ if (RequestedTime_Code = "Scheduled/Start Time") then
+ HR := SchHour_Val;
+ MN := SchMin_Val;
+ else
+ HR := Extract Hour NOW;
+ MN := Extract Minute Now;
+ endif;
+
+ if HR < 10 then
+ HR := "0" || HR;
+ endif;
+
+ if MN < 10 then
+ MN := "0" || MN;
+ endif;
+
+ HR_seconds := (60 * (HR as number)) * 60;
+ MN_Seconds := (MN as number) * 60;
+ Calc_starttime := ((RequeStedDate_Val + (HR_seconds seconds)) + (MN_Seconds seconds));
+ Freq_length := length of Frequency_val as number;
+ freq_endposition := freq_length;
+ begin_freq := substring 1 characters from Frequency_val as string;
+ end_freq := substring 1 characters starting at freq_endposition from Frequency_val as string;
+
+ if begin_freq = "Q" then
+ Freqnum := Freq_length - 2;
+ Schnum := substring Freqnum characters starting at 2 from Frequency_val;
+ endif;
+
+ schnum := schnum as number;
+
+ If StopAfter_Option In ("Times","Doses","Units") Then
+ StopAfter_Option:= "Times";
+ Endif;
+
+
+
+ If StopAfter_Option ="Times" Then
+
+
+ if (end_freq = "M") then
+ //calc_schnum_seconds := (((86400 / (60 * schnum)) - 1) * (60 * schnum)); //take the minutes times 60 to get the seconds, divide that
+ calc_schnum_seconds := schnum * 60 ;
+ elseif (end_freq = "H") then
+ //calc_schnum_seconds := ((((24 / schnum)-1) * schnum) * 60) * 60;
+ calc_schnum_seconds := schnum * 60 * 60 ;
+ endif;
+
+ sched_time := read { "select ScheduledTime from CV3FixedScheduleDefinition fs "
+ || " inner join CV3CodedFreqTranslation ft on fs.ParentGUID = ft.GUID "
+ || " where ft.FrequencyCode = " || sql(Frequency_val)
+ || " and ft.FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} "};
+
+ sched_time := sort data sched_time;
+ sched_starttime := "";
+ sched_endtime := "";
+ if (count(sched_time) = 0) or (RequestedTime_Code = "Scheduled/Start Time") then
+ calc_startDTTM_IBU := (Calc_starttime + (calc_schnum_seconds * StopAfter_Number ) seconds ) + 21600 seconds;
+
+ else
+ tmp_starthhmn := HR || MN;
+ for s in (1 seqto count(sched_time)) do
+ if ((sched_time[s] as number) > (tmp_starthhmn as number)) and sched_starttime = "" then
+ sched_starttime := sched_time[s];
+ endif;
+ if ((sched_time[s] as number) < (tmp_starthhmn as number)) then
+ sched_endtime := sched_time[s];
+ endif;
+ enddo;
+
+ If (count(sched_time) = 1) And sched_endtime = "" Then
+ sched_endtime := sched_time[1] ;
+ Endif;
+ If sched_endtime =0 Then
+ sched_endtime:="0000" ;
+
+ Endif;
+
+ length_sched_endtime := length (sched_endtime as string); // Problem In This Statement when user select Q24H, Q48H Frequency
+
+ sched_minPOS := ((length_sched_endtime as number) - 2) as number;
+
+ calc_schMIN := (substring 2 characters starting at (sched_minPOS + 1) from (sched_endtime as string)) as number;
+
+ calc_schHR := (substring (sched_minPOS as number) characters from (sched_endtime as string)) as number;
+
+ calc_schMIN_Seconds := calc_schMIN * 60;
+ calc_schHR_Seconds := (calc_schHR * 60) * 60;
+
+ //calc_startDTTM_IBU := (((RequeStedDate_Val + 86400 seconds) + calc_schMIN_Seconds seconds) + calc_schHR_seconds seconds) + 21600 seconds;
+ calc_startDTTM_IBU := (Calc_starttime + ( calc_schnum_seconds * StopAfter_Number ) seconds ) + 21600 seconds + calc_schMIN_Seconds seconds + calc_schHR_seconds seconds ;
+
+ endif;
+ Else
+ If StopAfter_Number Is Not Null And StopAfter_Option is Not Null Then
+ If StopAfter_Option In ("Times","Doses","Units") Then
+ StopAfter_Option:= "Times";
+ Endif;
+ If StopAfter_Option ="Days" Then MultiPly := 86400 ;// seconds ;
+ Elseif StopAfter_Option ="Hours" Then MultiPly := 3600 ;// seconds;
+ ElseIf StopAfter_Option ="Minutes" Then MultiPly := 60 ;//seconds;
+ //ElseIf StopAfter_Option ="Times" Then MultiPly := calc_schnum_seconds ;// seconds;
+ Endif;
+ Endif;
+ Total_Additional_Sec := (StopAfter_Number as Number ) * (MultiPly as Number) ;
+
+
+
+ calc_startDTTM_IBU := Calc_starttime + Total_Additional_Sec Seconds + 6 Hours ;
+
+
+ EndIf;
+
+
+
+
+
+
+// for Adding Stop After Time to existing Time
+/* If StopAfter_Number Is Not Null And StopAfter_Option is Not Null Then
+ If StopAfter_Option In ("Times","Doses","Units") Then
+ StopAfter_Option:= "Times";
+ Endif;
+ If StopAfter_Option ="Days" Then MultiPly := 86400 ;// seconds ;
+ Elseif StopAfter_Option ="Hours" Then MultiPly := 3600 ;// seconds;
+ ElseIf StopAfter_Option ="Minutes" Then MultiPly := 60 ;//seconds;
+ ElseIf StopAfter_Option ="Times" Then MultiPly := calc_schnum_seconds ;// seconds;
+ Endif;
+ Endif;
+
+ Total_Additional_Sec := (StopAfter_Number as Number ) * (MultiPly as Number) ;
+
+ calc_startDTTM_IBU := calc_startDTTM_IBU + Total_Additional_Sec Seconds + 6 Hours ; // Adding 6 Hr for Next order of Ketorolac
+ abc := calc_startDTTM_IBU ;
+ calc_startDTTM_IBU := calc_startDTTM_IBU + 6 Hours ; */
+
+
+
+
+ format_hr := extract hour calc_startDTTM_IBU;
+ if format_hr < 10 then
+ format_hr := "0" || format_hr;
+ endif;
+
+ format_min := extract minute calc_startDTTM_IBU;
+ if format_min < 10 then
+ format_min := "0" || format_min;
+ endif;
+
+ IBU_date_extract := (extract month calc_startDTTM_IBU) || "-" || (extract day calc_startDTTM_IBU) || "-" || (extract year calc_startDTTM_IBU);
+ IBU_time_extract := format_hr || ":" || format_min;
+
+
+ If Ketorolac_Inj.IsSelected = True And Ketorolac_Tab.IsSelected =True Then
+
+ StTimeValue_IBU.ReqTimeCode := "Scheduled/Start Time";
+ StTimeValue_IBU.ReqTimeValue := IBU_time_extract;
+ StartDate_IBU.Value := calc_startDTTM_IBU;
+
+ Endif ;
+
+ Endif;
+
+
+;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PRESET_MULTIDOSE_RX.mlm b/MLMStripper/bin/Debug/FORM/FORM_PRESET_MULTIDOSE_RX.mlm
new file mode 100644
index 0000000..e8f4600
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PRESET_MULTIDOSE_RX.mlm
@@ -0,0 +1,555 @@
+maintenance:
+
+ title: Called MLM for updating the RX Instruction UDDI;;
+ filename: FORM_Preset_MultiDose_RX;;
+ arden: version 2;;
+ version: 5.50;; //FP1 Order Reconciliation Manager
+ institution: Allscripts, Sample MLM;;
+ author: Phil Thomas, Allscripts Knowledge Management;;
+ specialist: ;;
+ date: 2011-11-09;;
+ validation: testing;;
+library:
+ purpose: This Called MLM is to be assigned to FORM CLOSE on any order form and Medication Catalog item combination that allows for a Complex Dose or Multiple Frequency.
+ It will update the RX Comments UDDI which will transfer to any prescriptions if continued after discharge.
+
+ ;;
+ explanation: This Called MLM, upon FORM CLOSE, will read the following complex dosing fields and format the cell rows into the RX Instruction UDDI on the form.
+ System UDDIs examined: CalculatedDose, DosageLow and FrequencyCode
+ UDDI Updated: "RX Comments" (Must be on the form to execute).
+
+ Note: The legnth of the RX Instruction should be configured to 2000 characters but the RX WRiter Sig Line can only handle 140 characters.
+ If this occurs the field value for RX Comments will be truncated to 140 chracters but the MLM will look for the "RX COmments" UDDI.
+ This can handle the full 2000 characters from the "RX Comments" UDDI and will appear on the RX Comments Tab along with Multum data.
+
+ To transfer the RX Instruction UDDI to the RX Sig Line of a Home Medication or Prescription the following Environemental Profile must be configured:
+ Orders > PrescriptionToOrderFieldMaping > Instructions > Value " RX Instructions"
+
+ To transfer the RX Coments UDDI to the RX Comments of a Home Medication or Prescription the following Environemental Profile must be configured:
+ Orders > PrescriptionToOrderFieldMaping > Comments > Value " RX Comments"
+
+ Note: If your institution uses a different Order Form UDDI for this purpose then you will need to alter this MLM and replace "RX Comments"
+ and "RX Instructions" with your UDDI values.
+
+ Complex Dosing options must be enabled under the Pharamcy configuration section of the Order Catalog Item.
+
+ Tips: - Form Close will run even if the form is configured to not display and the MLM can update the UDDIS even if protected or hidden.
+ - This MLM will also work with the Frequency option and perfomrm the same behavior as above if discovered.
+ - If you already have an MLM on Form Close you may sub-call this MLM from the existing MLM to avoid reconfiguration of the forms.
+
+*** Allscripts Disclaimer:
+ Client is responsible for all decisions, acts, and omissions of any persons in connection with the delivery of medical care or other services to any patients.
+ Before any Licensed Materials are placed into a live production environment, it is Client’s responsibility to review and test all Licensed Materials and associated
+ workflows and other content, as implemented, make independent decisions about system settings and configuration based upon Client’s needs, practices, standards and
+ environment, and reach its own independent determination that they are appropriate for such live production use. Any such use by Client (or its Authorized Users)
+ will constitute Client’s representation that it has complied with the foregoing. Client shall ensure that all Authorized Users are appropriately trained in use of
+ the then-deployed release of the Software prior to their use of the Software in a live production environment. Clinical Materials are tools to assist Authorized
+ Users in the delivery of medical care, but should not be viewed as prescriptive or authoritative. Clinical Materials are not a substitute for, and Client shall
+ ensure that each Authorized User applies in conjunction with the use thereof, independent professional medical judgment. Clinical Materials are not designed for use,
+ and Client shall not use them, in any system that provides medical care without the participation of properly trained personnel. Any live production use of Clinical
+ Materials by Client (or its Authorized Users) will constitute Client’s acceptance of clinical responsibility for the use of such materials.
+
+ History:
+ 02.04.2013 TMS Modified to calculate start date of subsequent order rows from first row value.
+ Changed size of Instructions, and added then stop comment for end of taper.
+ 04.15.2013 TMS Modified to calculate start date for decreasing (taper) or increasing dose
+ to allow for non-daily frequencies.
+ 07.23.2019 TMS CSR 37676 - Change log_execution_info to false per upgrade analysis.
+
+ ;;
+ keywords: Called MLMs, Form fields, RX Instructions, Orders Reconciliation Manager, RX Comments;
+ ;;
+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;
+
+ /* Null field variables */
+ RX_Summary := Null;
+ RX_Comments_User := "";
+
+ //Formatting Characters
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+ xxcounter := 0;
+
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ //Capture the RX Comments Data Item and test if present, Do not proceeed with MLM if not found on order form
+ RX_Comments_field := first of (field_list where field_list.DataItemName = "Rx Comments");
+ If exists RX_Comments_field then
+ //Save any data already enetered by the user
+ If RX_Comments_field.Value is not NULL then
+ RX_Comments_User := RX_Comments_field.Value;
+ Endif;
+
+ //Capture the Calculated Dose Data Item and all componenets
+ CalculatedDose_field := first of (field_list where field_list.DataItemName = "CalculatedDose");
+ If exists CalculatedDose_field then
+ CalcDoseValue:= CalculatedDose_field.Value;
+ // Statements used to read the Complex Dosing Grid.
+ // If DosingOption field is NULL, we expect the structure
+ // stored in Value is regular CalculatedDose compound value
+ // structure.
+ If exists CalcDoseValue.DosingOption AND
+ CalcDoseValue.DosingOption is NOT NULL then
+ // access the dosing options grid
+ CalcGridDosingOption := CalcDoseValue.DosingOption;
+ CalcGridRows := CalcDoseValue.Rows;
+ CalcGridCols := CalcDoseValue.Cols;
+ CalcGridDefAllowAddRemove := CalcDoseValue.ConfigAllowRowAddRemove;
+ CalcGridAllowAddRemove := CalcDoseValue.AllowRowAddRemove;
+ Else
+ // access as regular CalcDose fields
+ CalculatedDose_obj := OBJECT [DosageLow, CalcActualDose,
+ CalcOverrideReason, CalcRequestedDose, CalcTotalDailyDose,
+ CalcDoseUOM, CalcUOMPer];
+ CalculatedDoseValue := CalculatedDose_field.Value;
+ // Statements used to read calculateddose sub-fields
+ Found_CalcDosageLow := CalculatedDoseValue.DosageLow;
+ Found_CalcActualDose := CalculatedDoseValue.CalcActualDose;
+ Found_CalcOverrideReason :=
+ CalculatedDoseValue.CalcOverrideReason;
+ Found_CalcRequestedDose :=
+ CalculatedDoseValue.CalcRequestedDose;
+ Found_CalcTotalDailyDose :=
+ CalculatedDoseValue.CalcTotalDailyDose;
+ Found_CalcUom := CalculatedDoseValue.CalcUOM;
+ Found_CalcUomPER := CalculatedDoseValue.CalcUOMPer;
+ Found_CalcReadONly := CalculatedDose_field.control_read_only;
+ Endif;
+
+ //Explode the Complex Dosing Option if found and update the RX Comments field for conversion to a prescription
+ If Exist CalcGridRows then
+ // Build a list of found rows and columns of the dosing option grid
+ index_list := 0 seqto ( count CalcGridRows );
+ Total_Rows := count CalcGridRows;
+
+ for M in index_list do
+
+
+ //Sequentially go thru each of the dosing option rows to get the data item values assigned
+ temp_Cell_Row:=Last(First M from CalcGridRows.Cells);
+
+ //Look for the Calculated Dose Data item and read the value
+ temp_Cell_DosageLow := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "CalculatedDose");
+ temp_Cell_ItemValue:=temp_Cell_DosageLow.ItemValue;
+ temp_Cell_DosageLow_Value:=temp_Cell_ItemValue.DosageLow;
+
+ //Check to see if a Dose is present to proceed
+ If temp_Cell_DosageLow_Value Is Not NULL then
+ //If the last row then indicate the last like the application does
+ If M = Total_Rows Then
+ RX_Summary := RX_Summary || CRLF || "Last: " || temp_Cell_DosageLow_Value || SP;
+ ElseIf RX_Summary Is Null then
+ RX_Summary := "Start: " || temp_Cell_DosageLow_Value || SP;
+ Else
+ RX_Summary := RX_Summary || CRLF || "Then: " || temp_Cell_DosageLow_Value || SP;
+ Endif;
+
+ //Capture the Unit of Measure and add to the RX Summary if found
+ temp_Cell_UOM := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "Uom");
+ temp_Cell_UOM_Value:=temp_Cell_UOM.ItemValue;
+ //Update the RX Summary if a value was found
+ If temp_Cell_UOM_Value Is Not NULL then
+ RX_Summary := RX_Summary || temp_Cell_UOM_Value|| SP;
+ Endif;
+
+ //Capture the Frequency value and add to the RX Summary if found
+ temp_Cell_Frequency := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "FrequencyCode");
+ temp_Cell_ItemValue:=temp_Cell_Frequency.ItemValue;
+ temp_Cell_Frequency_Value:=temp_Cell_ItemValue.FrequencySummary;
+ //Update the RX Summary if a value was found
+ If temp_Cell_Frequency_Value Is Not NULL Then
+ RX_Summary := RX_Summary || temp_Cell_Frequency_Value|| SP;
+ Endif;
+
+ //Capture the Route value and add to the RX Summary if found
+ temp_Cell_Route := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "OrderRouteCode");
+ temp_Cell_Route_Value:=temp_Cell_Route.ItemValue;
+ //Update the RX Summary if a value was found
+ If temp_Cell_Route_Value Is Not NULL then
+ RX_Summary := RX_Summary || ", " || temp_Cell_Route_Value;
+ Endif;
+
+ //Capture the Stop After value and add to the RX Summary if found
+ temp_Cell_StopAfter := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "StopAfter");
+ temp_Cell_ItemValue:=temp_Cell_StopAfter.ItemValue;
+ temp_Cell_NUMBER_Value:=temp_Cell_ItemValue.NUMBER;
+ temp_Cell_Option_Value:=temp_Cell_ItemValue.Option;
+ //Update the RX Summary if a value was found
+ If temp_Cell_Option_Value Is Not NULL Then
+ RX_Summary := RX_Summary || ", for " || temp_Cell_NUMBER_Value || SP || temp_Cell_Option_Value;
+ Endif;
+
+ Endif; //A Row has a Dose
+ enddo; //End of Row List Loop
+ Endif; //tapering Dose was found
+ Endif; //End of CalculatedDose Examination
+
+
+
+ // This looks for the presence of the field dataitem - dosagelow - and stores it incase a checkbox is removed.
+ DosageLow_field := first of (field_list where field_list.DataItemName = "DosageLow");
+
+ If exists DosageLow_field then
+ DoseLowValue := DosageLow_field.Value;
+
+ // DosageLow value can either be a numeric value or a
+ //complex dosing grid value.
+ If exists DoseLowValue And DoseLowValue is not NUMBER then
+ // access the dosing options grid
+ DosingOption := DoseLowValue.DosingOption;
+ DoseLowGrid_ColList := DoseLowValue.Cols;
+ DoseLowGrid_RowList := DoseLowValue.Rows;
+ AllowAddRemove := DoseLowValue.AllowRowAddRemove;
+ ConfigAllowRowAddRemove := DoseLowValue.ConfigAllowRowAddRemove;
+ Else
+ // access as regular DosageLow field
+ Is_Calc_Field := FALSE;
+ Endif; //DoseageLow was a complex dose option
+
+ If Exist DoseLowGrid_RowList then
+
+ // Build a list of found rows and columns of the dosing option grid
+ index_list_dl := 0 seqto ( count DoseLowGrid_RowList );
+ Total_Rows_dl := count DoseLowGrid_RowList;
+
+ //Build a loop to go thru the list of Rows found
+ for M in index_list_dl do
+
+
+
+ //Sequentially go thru each of the dosing option rows to get the data item values assigned
+ // and obtain prior row info if available for frequency, durationa and start date
+ temp_Cell_Row:=Last(First M from DoseLowGrid_RowList.Cells);
+ If M > 1 then
+ P := (M as number)-1;
+ prior_cell_row :=Last(First P from DoseLowGrid_RowList.Cells);
+ endif;
+ //Look for the Dose Data item and read the value
+ temp_Cell_DosageLow := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "DosageLow");
+ temp_Cell_DosageLow_Value:=temp_Cell_DosageLow.ItemValue;
+
+ //Check to see if a Dose is present to proceed
+ If temp_Cell_DosageLow_Value Is Not NULL then
+ //If the last row then indicate the last like the application does
+ If M = Total_Rows_dl Then
+ // RX_Summary := RX_Summary || CRLF || "Last: " || temp_Cell_DosageLow_Value || SP;
+ RX_Summary := RX_Summary || CRLF || "THEN: " || temp_Cell_DosageLow_Value || SP;
+ FirstEntry := "No";
+ EndMessage := "THEN STOP";
+ ElseIf RX_Summary Is Null then
+ RX_Summary := "START: " || temp_Cell_DosageLow_Value || SP;
+ EndMessage := " ";
+ FirstEntry := "Yes";
+ Else
+ // RX_Summary := RX_Summary || CRLF || "Then: " || temp_Cell_DosageLow_Value || SP;
+ RX_Summary := RX_Summary || CRLF || " THEN: " || temp_Cell_DosageLow_Value || SP;
+ EndMessage := " ";
+ FirstEntry := "No";
+ Endif;
+
+ //Capture the Unit of Measure and add to the RX Summary if found
+ temp_Cell_UOM := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "Uom");
+ temp_Cell_UOM_Value:=temp_Cell_UOM.ItemValue;
+
+ //Update the RX Summary if a value was found
+ If temp_Cell_UOM_Value Is Not NULL then
+ RX_Summary := RX_Summary || temp_Cell_UOM_Value|| SP;
+ Endif;
+
+ //Capture the Frequency value and add to the RX Summary if found
+ temp_Cell_Frequency := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "FrequencyCode");
+ temp_Cell_ItemValue:=temp_Cell_Frequency.ItemValue;
+ temp_Cell_Frequency_Value:=temp_Cell_ItemValue.FrequencySummary;
+
+ prior_cell_Frequency := first of (prior_Cell_Row where prior_Cell_Row.DataItemCode = "FrequencyCode");
+ prior_Cell_ItemValue:=prior_Cell_Frequency.ItemValue;
+ prior_Cell_Frequency_Value:=prior_Cell_ItemValue.FrequencySummary;
+
+ If prior_Cell_Frequency_Value Is Not NULL Then
+
+ (PriorFreqType, PriorFreqSpan, PriorFreqUom) := read last
+ {"Select DefinitionType, TimeFromValue, TimeUom "
+ ||" From cv3Frequency "
+ ||" Where Code = " || SQL(Prior_Cell_Frequency_Value) };
+ Endif;
+
+ //Update the RX Summary if a value was found
+ If temp_Cell_Frequency_Value Is Not NULL Then
+ RX_Summary := RX_Summary || temp_Cell_Frequency_Value|| SP;
+
+ (FreqType, FreqSpan, FreqUom) := read last
+ {"Select DefinitionType, TimeFromValue, TimeUom "
+ ||" From cv3Frequency "
+ ||" Where Code = " || SQL(temp_Cell_Frequency_Value) };
+ Endif;
+
+ // compare prior row frequency with current row frequency to determine if
+ // frequency is increasing, decreasing, or staying the same.
+ If priorfreqtype = 2 and freqtype = 1 then
+ dosingtype := "increasing";
+ freqspan := freqtype;
+ elseif priorfreqtype = 1 and freqtype = 2 then
+ dosingtype := "decreasing";
+ priorfreqspan := priorfreqtype;
+ elseif priorfreqtype = 2 and freqtype = 2 then
+ if priorfreqspan > freqspan then
+ dosingtype := "increasing";
+ elseif priorfreqspan < freqspan then
+ dosingtype := "decreasing";
+ else dosingtype := "same";
+ endif;
+ elseif priorfreqtype = 1 and freqtype = 1 then
+ dosingtype := "same";
+ priorfreqspan := priorfreqtype;
+ freqspan := freqtype;
+ endif;
+
+ //Capture the Route value and add to the RX Summary if found
+ temp_Cell_Route := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "OrderRouteCode");
+ temp_Cell_Route_Value:=temp_Cell_Route.ItemValue;
+
+ //Update the RX Summary if a value was found
+ If temp_Cell_Route_Value Is Not NULL then
+ RX_Summary := RX_Summary || ", " || temp_Cell_Route_Value;
+ Endif;
+
+ //Capture the Stop After value and add to the RX Summary if found
+ temp_Cell_StopAfter := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "StopAfter");
+ temp_Cell_ItemValue:=temp_Cell_StopAfter.ItemValue;
+ temp_Cell_NUMBER_Value:=temp_Cell_ItemValue.NUMBER;
+ temp_Cell_Option_Value:=temp_Cell_ItemValue.Option;
+
+
+ prior_Cell_StopAfter := first of (prior_Cell_Row where prior_Cell_Row.DataItemCode = "StopAfter");
+ prior_Cell_ItemValue:=prior_Cell_StopAfter.ItemValue;
+ prior_Cell_NUMBER_Value:=prior_Cell_ItemValue.NUMBER;
+ prior_Cell_Option_Value:=prior_Cell_ItemValue.Option;
+
+
+ //Update the RX Summary if a value was found
+ If temp_Cell_Option_Value Is Not NULL Then
+ RX_Summary := RX_Summary || " for " || temp_Cell_NUMBER_Value || SP || temp_Cell_Option_Value || SP ;
+ endif;
+
+
+ temp_Cell_Start := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "RequestedDate");
+ temp_Cell_Start_Value:=temp_Cell_Start.ItemValue;
+
+ prior_Cell_Start := first of (prior_Cell_Row where prior_Cell_Row.DataItemCode = "RequestedDate");
+ prior_Cell_Start_Value:=prior_Cell_Start.ItemValue;
+ If prior_Cell_Start_Value Is Not NULL and FirstEntry = "No" and prior_Cell_Option_Value = "Days" Then
+ PriorNumdays := prior_Cell_ItemValue.NUMBER;
+ // determine start date of current row dependent upon frequency and duration of current and
+ // prior row. (Increasing, decreasing or same)
+ If dosingtype = "decreasing" or dosingtype = "same" then
+ Calc_duration := (Priornumdays as number) - 1;
+ Offsetdays := Calc_duration - (PriorFreqSpan *(Int(Calc_duration /PriorFreqSpan)));
+ Addtodate := Calc_duration + FreqSpan - offsetdays;
+ temp_Cell_Start.ItemValue := prior_Cell_Start_Value + addtodate day ;
+ yr := extract year temp_Cell_Start.ItemValue ;
+ mn := extract month temp_Cell_Start.ItemValue ; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day temp_Cell_Start.ItemValue ; if dd < 10 then dd := "0" || dd; endif;
+ DisplayDate := mn || "-" || dd || "-" || yr ;
+ elseif dosingtype = "increasing" then
+ Calc_duration := (Priornumdays as number) - 1;
+ Offsetdays := Calc_duration - (PriorFreqSpan *(Int(Calc_duration /PriorFreqSpan)));
+ Addtodate := Calc_duration + PriorFreqSpan - offsetdays;
+ temp_Cell_Start.ItemValue := prior_Cell_Start_Value + addtodate day ;
+ yr := extract year temp_Cell_Start.ItemValue ;
+ mn := extract month temp_Cell_Start.ItemValue ; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day temp_Cell_Start.ItemValue ; if dd < 10 then dd := "0" || dd; endif;
+ DisplayDate := mn || "-" || dd || "-" || yr ;
+ endif;
+
+ RX_Summary := RX_Summary || CRLF || " Begin: " || DisplayDate || SP || EndMessage|| CRLF;
+
+ elseIf prior_Cell_Start_Value Is NULL and FirstEntry = "Yes" and temp_Cell_Option_Value = "Days" Then
+ yr := extract year temp_Cell_Start.ItemValue ;
+ mn := extract month temp_Cell_Start.ItemValue ; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day temp_Cell_Start.ItemValue ; if dd < 10 then dd := "0" || dd; endif;
+ DisplayDate := mn || "-" || dd || "-" || yr ;
+ RX_Summary := RX_Summary || CRLF || " Begin: " || DisplayDate || SP || EndMessage || CRLF;
+ endif;
+
+
+ Endif; //A Row has a Dose
+ enddo; //End of Row List Loop
+ Endif; //DosageLow was found with a value
+ Endif; //DosageLow was found
+
+ //Look for a Complex Frequency and Update th RX Comments accordingly
+ Freq_field := first of (field_list where field_list.DataItemName = "FrequencyCode");
+ If exists Freq_field then FreqValue:= Freq_field.Value;
+ // If DosingOption sub-field exists, this is a Frequency Grid
+ If exists FreqValue.DosingOption and FreqValue.DosingOption is NOT NULL then
+ // Get Grid information
+ AllowRowAddRemove := FreqValue.AllowRowAddRemove;
+ ConfigAllowRowAddRemove := FreqValue.ConfigAllowRowAddRemove;
+ // Get Row information
+ GridRows:= FreqValue.Rows;
+
+ //Explode the Complex Dosing Option Freq if found and update the RX Comments field for conversion to a prescription
+ If Exist GridRows then
+ // Build a list of found rows and columns of the dosing option grid
+ index_list_fq := 0 seqto ( count GridRows );
+ Total_Rows_fq := count GridRows;
+
+ for M in index_list_fq do
+
+ //Get the Frequency Code
+ temp_FreqSummary :=Last(First M from GridRows.FrequencySummary);
+ //Update the RX Summary if a value was found
+ If temp_FreqSummary Is Not NULL Then
+ //If the last row then indicate the last like the application does
+ If M = Total_Rows_fq Then
+ RX_Summary := RX_Summary || CRLF || "Last: " || temp_FreqSummary || SP;
+ ElseIf RX_Summary Is Null then
+ RX_Summary := "Start: " || temp_FreqSummary || SP;
+ Else
+ RX_Summary := RX_Summary || CRLF || "Then: " || temp_FreqSummary || SP;
+ Endif;
+ Endif;
+
+ //Get the Frequency From Time
+ temp_FreqFromTime :=Last(First M from GridRows.FreqFromTime);
+ //Update the RX Summary if a value was found
+ If temp_FreqFromTime > 0 Then
+ RX_Summary := RX_Summary || "From: " || temp_FreqFromTime || SP;
+ Endif;
+
+ //Get the Frequency To Time
+ temp_FreqToTime :=Last(First M from GridRows.FreqToTime);
+ //Update the RX Summary if a value was found
+ If temp_FreqToTime > 0 Then
+ RX_Summary := RX_Summary || "To: " || temp_FreqToTime || SP;
+ Endif;
+
+ //Get the Frequency FreqEventModifier
+ temp_FreqEventModifier :=Last(First M from GridRows.FreqEventModifier);
+ //Update the RX Summary if a value was found
+ If temp_FreqEventModifier Is Not NULL Then
+ RX_Summary := RX_Summary || temp_FreqEventModifier || SP;
+ Endif;
+
+ //Get the Frequency FreqEventCode
+ temp_FreqEventCode :=Last(First M from GridRows.FreqEventCode);
+ //Update the RX Summary if a value was found
+ If temp_FreqEventCode Is Not NULL Then
+ RX_Summary := RX_Summary || temp_FreqEventCode || SP;
+ Endif;
+
+ //Get the Frequency Stop After Value
+ temp_StopAfterNumber :=Last(First M from GridRows.StopAfterNumber);
+ //Update the RX Summary if a value was found
+ If temp_StopAfterNumber Is Not NULL Then
+ RX_Summary := RX_Summary || "Stop After: " || temp_StopAfterNumber || SP;
+ Endif;
+ temp_StopAfterOption :=Last(First M from GridRows.StopAfterOption);
+ //Update the RX Summary if a value was found
+ If temp_StopAfterOption Is Not NULL Then
+ RX_Summary := RX_Summary || temp_StopAfterOption || SP;
+ Endif;
+
+ //Reserve for Future Use
+ //Found_DataItemCode1:= Found_Freq.DataItemCode1;
+ //Found_DataItemValue1:= Found_Freq.DataItemValue1;
+ //Found_DataItemCode2:= Found_Freq.DataItemCode2;
+ //Found_DataItemValue2:= Found_Freq.DataItemValue2;
+ //Found_DataItemCode3:= Found_Freq.DataItemCode3;
+ //Found_DataItemValue3:= Found_Freq.DataItemValue3;
+ //Found_DataItemCode4:= Found_Freq.DataItemCode4;
+ //Found_DataItemValue4:= Found_Freq.DataItemValue4;
+ //Found_DataItemCode5:= Found_Freq.DataItemCode5;
+ //Found_DataItemValue5:= Found_Freq.DataItemValue5;
+
+ Enddo; //End of Grid Row Loop
+ Endif; //Grid Row exists
+ ENDIF; //The Frequency is a dosing option type
+ ENDIF; //FrequencyCode was found
+
+ //Update the RX Comments UDDI with the Variable DOse or Multiple Frequency option.
+ If RX_Summary Is not NULL then
+ //The RX WRiter Sig Comment UDDI can only handle 2000 characters so trip to fit on form
+ if (length RX_Summary) > 2000 then
+ RX_Summary_Truncate := (substring 1997 characters starting at 1 from RX_Summary) || "...";
+ // if (length RX_Summary) > 2500 then
+ // RX_Summary_Truncate := (substring 2497 characters starting at 1 from RX_Summary) || "...";
+ RX_Comments_field.Value := RX_Summary_Truncate;
+ Else
+ RX_Comments_field.Value := RX_Summary;
+ Endif; //Update RX Comments
+
+ //Add a note to the RX Instructions field (if exists) which displays when converting to a Home Medication.
+ //Note - This field can only accomodate 140 chracters at this time so it will be truncated.
+ //Check for the RX Instructions:
+ RX_Instructions_field := first of (field_list where field_list.DataItemName = "Rx Instructions");
+ If exists RX_Instructions_field then
+ // If (length RX_Summary) > 140 then
+ // RX_Instructions_Truncate := (substring 137 characters starting at 1 from RX_Summary) || "...";
+ If (length RX_Summary) > 500 then
+ RX_Instructions_Truncate := (substring 497 characters starting at 1 from RX_Summary) || "...";
+ RX_Instructions_field.Value := RX_Instructions_Truncate;
+ Else
+ RX_Instructions_field.Value := RX_Summary;
+ Endif;
+ Endif;
+ Endif; //An RX Summary was found
+
+ //The Field was not on the Order Form
+ Elseif RX_Summary Is not NULL Then
+
+ error_message := "The RX Comment Data Item was not found on the form and a Complex Dose was entered.";
+
+ Endif; //The RX Comments UDDI was found on the form
+
+
+ //Error Messaging
+ // populate the fields that can be modified on the communication object
+ // DisplayForm can be "Yes", "No", or "No Change"
+ // Message is free text
+ // MessageType can be Informational, Error, or Banner
+ If error_message <> "" Then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "error_message";
+ this_communication.MessageType := "Informational";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PREVENT_DUP_CODE_STATUS.mlm b/MLMStripper/bin/Debug/FORM/FORM_PREVENT_DUP_CODE_STATUS.mlm
new file mode 100644
index 0000000..72f68e6
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PREVENT_DUP_CODE_STATUS.mlm
@@ -0,0 +1,166 @@
+maintenance:
+
+ title: code status order stop;;
+ mlmname: FORM_prevent_dup_code_status;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Hospital;;
+ author: Deborah Eiler, Debbie.Eiler@stclair.org, 866-248-4500 ext. 1318;;
+ specialist: Eclipsys Corporation;;
+ date: 2006-10-19;;
+ validation: testing;;
+
+library:
+ purpose:
+ If the patient has an existing code status I would like for an MLM to fire an
+ alert to stop the order entry. If the comment type of an existing Code Status
+ is active, fire an alert to Stop the order.
+ ;;
+ explanation:
+
+ IMPORTANT NOTE: Each time this MLM is updated, SCH_DUP_CODE_STATUS_STOP may also need to be updated
+
+ Change history
+
+ 11.09.2012 DJW CSR# 26830 - Simplification of Code Status classifications. Reduced from 7 to 3 choices
+ 07.30.2012 - DJW CSR# 30963 - Altered logic to prevent duplicate status order even if in Discharge Session
+ 10.05.2012 - DJW CSR# 30963 - Revert to prior logic - allow duplicate status order even if in Discharge Session
+ 12.18.2012 - DJW CSR# 31242 - Change "...Full Treatment" to "...Full Code". Remove CPR/DNR codes
+ 01.24.2013 - DJW CSR# 31242 - Altered code again {{{SINGLE-QUOTE}}}Code Status: DNR/Limited Interventions{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Code Status: DNR/Comfort Measures Only (CMO){{{SINGLE-QUOTE}}}
+ 02.09.2016 - DJW CSR# 33949 - Change to wording of Code Status and CPR orders
+
+ (D Eiler, 10-2-06): Code Status order is currently configured to display in the
+ Patient Header as a comment. I have added duplicate checking alerts. If the user
+ keeps the new order and discontinues the current order from the duplicate check
+ alert, the new order will overlay what is displayed in the Patient Header. This
+ is what we want to happen. But… if the user ignores the duplicate checking alert
+ and proceeds with the order entry, the new code status will overlay in the Patient
+ Header but there will be two code status orders on the order tab. If the user
+ discontinues one of these code status orders the code status in the Patient
+ Header is removed. This is a problem. We must be able to rely on the display of
+ the code status in the Patient Header. I have a warning message at the onset of
+ code status order entry but it does not stop the process.
+
+ THIS MLM:
+ - TRIGGERS ON FORMOPEN
+ - LOOKS UP ANY ACTIVE EXISTING CODE STATUS ORDERS
+ - PRESENTS AN ERROR MESSAGE (I.E. HARD STOP) IF EXISTTING ORDERS ARE FOUND.
+
+ THIS MLM WORKS IN CONJUNCTION WITH THE ORDER-TRIGGERED MLM: SCH_dup_code_status_stop.
+
+
+
+
+
+ ;;
+ keywords: hard stop, duplicate code status;
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+/***********************Make Changes To Spelling And Flags In This Section*********************/
+
+
+/***********************************************************************************JAB********/
+
+ // 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;
+
+ // Declare the MLM that can be called by this MLM
+ //FORM_NUR_CodeStatus := MLM {{{SINGLE-QUOTE}}}FORM_NUR_CodeStatus{{{SINGLE-QUOTE}}};
+
+ // Call original field processing MLM
+// (this_communication, this_form) := call FORM_NUR_CodeStatus
+// with this_communication, this_form, client_info_obj;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingForm := this_form.name;
+ CallingEvent := this_communication.CallingEvent;
+ ItemEvent := this_communication.ItemEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+
+ // 11/30/2011 - Don Warnick - ok to have duplicate for discharge order reconcilliation
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+ if worksheetinfo.sessiontype = "Discharge" then sessiontype := "Discharge"; else sessiontype := "Other"; endif;
+
+ ordername := read last {" select name from cv3ordercatalogmasteritem where guid = " || sql(this_communication.ItemID)};
+
+ ordername_substring := SUBSTRING 12 CHARACTERS STARTING AT 1 FROM ordername;
+
+ if ordername_substring = "Code Status:"
+
+then dup_lookup_items := " name like {{{SINGLE-QUOTE}}}Code Status: %{{{SINGLE-QUOTE}}} ";
+else dup_lookup_items := " ( name in ({{{SINGLE-QUOTE}}}Code Status: Full Code{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: DNR/Limited Interventions{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: DNR/Comfort Measures Only (CMO){{{SINGLE-QUOTE}}}) or name like {{{SINGLE-QUOTE}}}cpr%{{{SINGLE-QUOTE}}} or name like {{{SINGLE-QUOTE}}}dnr%{{{SINGLE-QUOTE}}}) ";
+
+ endif;
+
+
+
+ // 11/07/06 - Kathy Kennedy updated to look only at the individual visit
+ // 11/09/11 - Don Warnick added 3 "go-forward" statuses, all on the last line of the SQL (old 7 may be removed after the transition)
+ // 02/09/16 - Don Warnick replaced this lookup with one customized by order name, separating code status from cpr order values
+/*
+ ||" and name in ("
+ ||" {{{SINGLE-QUOTE}}}Code Status: DNR/Limited Interventions{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Code Status: DNR/Comfort Measures Only (CMO){{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Code Status: Full Treatment{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Code Status: Full Code{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Code Status: Limited Interventions{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Code Status: Comfort Measures Only (CMO){{{SINGLE-QUOTE}}} "
+ ||") "
+*/
+
+ (old_cs_lst, old_cs_summ_lst, old_status_lst, old_ln_lst, old_cs_ord_guid_lst, old_cs_ocmi_guid_lst, old_sig_t_lst) := read
+ {" select name, summaryline, status, orderstatuslevelnum, "
+ ||" GUID, OrderCatalogMasterItemGUID, significantdtm "
+ ||" from cv3order "
+ ||" where clientguid = " || sql(client_info_obj.guid)
+ ||" and chartguid = " || sql(this_communication.chartguid)
+ ||" and clientvisitguid = " || sql(this_communication.clientvisitguid)
+ ||" and " || dup_lookup_items
+ ||" and typecode like {{{SINGLE-QUOTE}}}other{{{SINGLE-QUOTE}}} "
+ ||" and status like {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} "
+ ||" and orderstatuslevelnum <= 50 "
+ ||" and active = 1 "
+ , primarytime = significandtm};
+
+
+// 11/30/2011 - Don Warnick - ok to have duplicate for discharge order reconcilliation
+// 07/30/2012 - Don Warnick - reversed the logic....now not ok to have a duplicate
+// 10/05/2012 - Don Warnick - reversed the reversal...now ok to have a duplicate in discharge session
+
+// if exists old_cs_lst then
+ if exists old_cs_lst and sessiontype <> "Discharge" then
+
+
+ //display a message to the user
+ this_communication.Message :=
+ "You cannot proceed with this order until the other active Code Status "
+ || "order(s) has been discontinued!!";
+ this_communication.MessageType := "Error";
+ // if CallingEvent="FormOpen" then
+ this_communication.DisplayForm := "NO";
+ // endif;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PRE_CARDIAC_PERIPHERAL_PROC.mlm b/MLMStripper/bin/Debug/FORM/FORM_PRE_CARDIAC_PERIPHERAL_PROC.mlm
new file mode 100644
index 0000000..9147a75
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PRE_CARDIAC_PERIPHERAL_PROC.mlm
@@ -0,0 +1,288 @@
+maintenance:
+
+ title: FORM_PRE_CARDIAC_PERIPHERAL_PROC;;
+ mlmname: FORM_PRE_CARDIAC_PERIPHERAL_PROC;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad jadhav, Allscripts Corporation;;
+ date: 2015-02-10;;
+ validation: testing;;
+
+library:
+ purpose: 1) Check for the EKG 12 lead order for past 14 days on the patient visit and if no order found then preselect EKG 12 lead order
+ 2) Check for the below order status of “940” in last 96 hours and if order found with this status then preselect the respective order.
+ - CBC (Includes Diff)
+ - BUN
+ - Potassium Plasma/ Serum
+ - Prothrombin/INR
+ - Creatinine
+
+ ;;
+
+ explanation:
+
+ Change History
+ -----------------
+ 13.01.2015 JML CSR# 32940: Created
+ ;;
+ keywords: Called MLMs
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+
+ //pObj := this_communication.PrimaryObj;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ item_event := this_communication.itemevent;
+ form_type := this_communication.formtype;
+
+
+ //-----------BEGIN COPY SECTION-------------------
+ DisplayNewScheduled := first of (field_list.Value
+ where field_list.DataItemName = "LAB_CB_Alternate Priorities");
+
+ if (DisplayNewScheduled) then
+ Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
+ (this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
+ endif;
+ //-----------END COPY SECTION-------------------
+
+
+ //Retrieve relevant form fields
+ Labs_96Hr := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox" and field_list.Label = "Labs within 96 hrs of procedure");
+ //and field_list.Control_MultiFieldOccNum = 5);
+ Labs_96Hr_Val := Labs_96Hr.Value;
+
+
+ if ( CallingEvent = "FormOpen" ) then
+
+ //Check to see if patient is on continuous heparin
+ EKG_12_Check := read {"SELECT o.Name"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND o.NAME IN ( {{{SINGLE-QUOTE}}}EKG 12 Lead{{{SINGLE-QUOTE}}} ) "
+ || " AND DATEDIFF(DD, o.ARRIVALDTM, GetDate()) <= 14"
+ || " AND o.OrderStatusCode NOT IN ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}})"};
+ //|| " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
+
+ If Length(EKG_12_Check) is NULL Then
+ EKG :=1;
+ Else
+ EKG :=2;
+ EndIf;
+
+
+
+ //EKG Grid And Its Order Value
+ Multi_Grid := First of ( field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Label = "Diagnostic Test") ;
+ Multi_Grid_fields := Multi_Grid.Value;
+ item1 := Multi_Grid_fields[1];
+
+ If EKG =1 Then
+
+ Item1.IsSelected := TRUE ;
+ //item1.IsReadonly := TRUE ;
+ Else
+ Item1.IsSelected := FALSE;
+ //item1.IsReadonly := FALSE ;
+ EndIF;
+
+ lab_name :="abc";
+
+ ( lab_name_Potassium ) := read {"SELECT o.Name "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid) || " "
+ || " AND (o.NAME IN (Select Distinct OCMI.Name "
+ || " from CV3ResultComponent RC (NoLock) "
+ || " INNER JOIN CV3ResultCatalogItem RCI1 (NoLock) "
+ || " ON RC.ItemChildGUID = RCI1.GUID "
+ || " INNER JOIN CV3ResultCatalogItem RCI2 (NoLock) "
+ || " ON RC.ItemParentGUID = RCI2.GUID "
+ || " INNER JOIN CV3OrderCatalogMasterItem OCMI (NoLock) "
+ || " ON RCI2.OrderMasterItemGUID = OCMI.GUID "
+ || " Where RCI1.ItemName Like {{{SINGLE-QUOTE}}}%Potassium Plasma/Serum%{{{SINGLE-QUOTE}}} ) or o.NAME ={{{SINGLE-QUOTE}}}Potassium Plasma/Serum{{{SINGLE-QUOTE}}}) "
+ || " AND DATEDIFF(HH, o.ARRIVALDTM, GetDate()) <= 96 "
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
+
+
+
+ ( lab_name_BUN ) := read {"SELECT o.Name "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND (o.NAME IN (Select Distinct OCMI.Name "
+ || " from CV3ResultComponent RC (NoLock) "
+ || " INNER JOIN CV3ResultCatalogItem RCI1 (NoLock) "
+ || " ON RC.ItemChildGUID = RCI1.GUID "
+ || " INNER JOIN CV3ResultCatalogItem RCI2 (NoLock) "
+ || " ON RC.ItemParentGUID = RCI2.GUID "
+ || " INNER JOIN CV3OrderCatalogMasterItem OCMI (NoLock) "
+ || " ON RCI2.OrderMasterItemGUID = OCMI.GUID "
+ || " Where RCI1.ItemName like {{{SINGLE-QUOTE}}}%BUN%{{{SINGLE-QUOTE}}} ) or o.NAME ={{{SINGLE-QUOTE}}}BUN{{{SINGLE-QUOTE}}} ) "
+ || " AND DATEDIFF(HH, o.ARRIVALDTM, GetDate()) <= 96 " //1400
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
+
+ ( lab_name_Creatinine ) := read {"SELECT o.Name "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND (o.NAME IN (Select Distinct OCMI.Name "
+ || " from CV3ResultComponent RC (NoLock) "
+ || " INNER JOIN CV3ResultCatalogItem RCI1 (NoLock) "
+ || " ON RC.ItemChildGUID = RCI1.GUID "
+ || " INNER JOIN CV3ResultCatalogItem RCI2 (NoLock) "
+ || " ON RC.ItemParentGUID = RCI2.GUID "
+ || " INNER JOIN CV3OrderCatalogMasterItem OCMI (NoLock) "
+ || " ON RCI2.OrderMasterItemGUID = OCMI.GUID "
+ || " Where RCI1.ItemName Like {{{SINGLE-QUOTE}}}%Creatinine%{{{SINGLE-QUOTE}}} ) or o.NAME ={{{SINGLE-QUOTE}}}Creatinine{{{SINGLE-QUOTE}}} ) "
+ || " AND DATEDIFF(HH, o.ARRIVALDTM, GetDate()) <= 96 " //1400
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
+
+
+ //Check to see if patient had these labs drawn in last 96 hours
+ ( lab_name_CBC ) := read {"SELECT o.Name "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID "
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND o.NAME IN ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}}) "
+ || " AND DATEDIFF(HH, o.ARRIVALDTM, GetDate()) <= 96 " //96 " //1400"
+ //|| " AND DATEDIFF(DD, o.ARRIVALDTM, GetDate()) <= 60 " //1400"
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}) "};
+
+ ( lab_name_Prothrombin ) := read {"SELECT o.Name "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID "
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND o.NAME IN ( {{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}} ) "
+ || " AND DATEDIFF(HH, o.ARRIVALDTM, GetDate()) <= 96 " //96 " //1400"
+ //|| " AND DATEDIFF(DD, o.ARRIVALDTM, GetDate()) <= 14 " //1400"
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}) "};
+
+
+
+
+
+ //Len1 :=Length(lab_name_Potassium);
+
+ If (Not Exist lab_name_Potassium ) Then
+ lab_name := lab_name || ",Potassium Plasma/Serum";
+ EndIf;
+
+ //Len2 :=Length( lab_name_BUN ) ;
+ if (Not Exist lab_name_BUN ) Then
+ lab_name := lab_name || ",BUN";
+ EndIf;
+
+ //Len3 :=Length ( lab_name_Creatinine );
+ if ( Not Exist lab_name_Creatinine) Then
+ lab_name := lab_name || ",Creatinine" ;
+ EndIf;
+
+ // Len4 :=Length ( lab_name_CBC );
+
+ if not exists lab_name_CBC Then
+ lab_name := lab_name || ",CBC (Includes Diff)" ;
+
+ EndIf;
+
+ //Len5 :=Length ( lab_name_Prothrombin );
+ if ( Not Exist lab_name_Prothrombin) Then
+ lab_name := lab_name || ",Prothrombin/INR" ;
+ EndIf;
+
+
+
+ (New_lab_name) := Read { " IF OBJECT_ID({{{SINGLE-QUOTE}}}tempdb..#TempTab{{{SINGLE-QUOTE}}}) IS NOT NULL DROP TABLE #TempTab "
+ || " create table #TempTab(Data varchar(50)) "
+ || " declare @InStr varchar(100) = " || Sql(lab_name)
+ || " SET @InStr = REPLACE(@InStr + {{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}},,{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}) "
+ || " DECLARE @SP INT "
+ || " DECLARE @VALUE VARCHAR(1000) "
+ || " WHILE PATINDEX({{{SINGLE-QUOTE}}}%,%{{{SINGLE-QUOTE}}}, @INSTR ) <> 0 "
+ || " BEGIN "
+ || " SELECT @SP = PATINDEX({{{SINGLE-QUOTE}}}%,%{{{SINGLE-QUOTE}}},@INSTR) "
+ || " SELECT @VALUE = LEFT(@INSTR , @SP - 1) "
+ || " SELECT @INSTR = STUFF(@INSTR, 1, @SP, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) "
+ || " INSERT INTO #TempTab(Data) VALUES (@VALUE) "
+ || " END "
+ || " SELECT * FROM #TempTab " };
+
+
+
+
+ if ( exists lab_name ) then
+
+ for lab in 1 seqto ( count Labs_96Hr_Val ) do
+
+
+ if ( Labs_96Hr_Val[lab].Name IN New_lab_name ) then
+ Labs_96Hr_Val[lab].IsSelected := true;
+
+ else
+ Labs_96Hr_Val[lab].IsSelected := false;
+ endif;
+ enddo;
+ else
+ //No labs exist for this patient, select all labs
+
+ Labs_96Hr_Val.IsSelected := ( true, true, true, true, True );
+
+ endif;
+
+ endif; //End FormOpen Event
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PRE_PACEMAKER_ICDINSERTION_ANESTHESIA.mlm b/MLMStripper/bin/Debug/FORM/FORM_PRE_PACEMAKER_ICDINSERTION_ANESTHESIA.mlm
new file mode 100644
index 0000000..6cbfb17
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PRE_PACEMAKER_ICDINSERTION_ANESTHESIA.mlm
@@ -0,0 +1,67 @@
+maintenance:
+
+ title: FORM_PRE_PACEMAKER_ICDINSERTION_ANESTHESIA;;
+ mlmname: FORM_PRE_PACEMAKER_ICDINSERTION_ANESTHESIA;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-01-21;;
+ validation: testing;;
+
+library:
+ purpose: If any Anesthesia Consult is ordered then precheck the ‘Nursing Instructions:Call OR Scheduling’. ;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ field_list := this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ Anesthesia_Consult := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 57 );
+ Anesthesia_Consult_Val := Anesthesia_Consult.Value;
+
+ Nursing_Instr := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 48 );
+ Nursing_Instr_Val := Nursing_Instr.Value;
+
+
+ if ( CallingEvent = "FieldChange" ) then
+ if ( CallingField = "MultiOrderGrid|57") then
+ if ( true IN Anesthesia_Consult_Val.IsSelected ) then
+ Nursing_Instr_Val[1].IsSelected := true;
+ Nursing_Instr_Val[1].IsReadonly := true ;
+ else
+ Nursing_Instr_Val[1].IsSelected := false;
+ Nursing_Instr_Val[1].IsReadonly := false ;
+ endif;
+ endif;
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PRN_REASON.mlm b/MLMStripper/bin/Debug/FORM/FORM_PRN_REASON.mlm
new file mode 100644
index 0000000..d84bc05
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PRN_REASON.mlm
@@ -0,0 +1,152 @@
+maintenance:
+
+ title: If PRN then PRN Reason text is mandatory;;
+ filename: FORM_PRN_reason;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: Eclipsys, System MLM;;
+ author: Rob Warner, UYS,Inc;;
+ specialist: ;;
+ date: 2004-07-16;;
+ validation: testing;;
+library:
+ purpose: This MLM sets the field PRN Reason text to visible and mandatory if IsPRN true.
+
+ ;;
+ explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
+ Communications objects and compares it to Client Information to determine whether to display
+ certain fields and make them mandatory.
+
+ A Banner message is presented to the user to remind them that these fields must be
+ completed.
+
+ History:
+ 01.30.2013 TMS MLM not currently requiring a PRN reason. Logic added to make start now checkbox not selectable
+ If the the ISPRN checkbox is true, order is being entered in a hold session, or frequency is a one
+ time frequency.
+ 08.09.2013 TMS Added logic to retrieve location and if equal to a behavioral health unit make the PRN Reason
+ mandatory. Field being used to document indication for medications. CSR 31639
+ 08.15.2013 TMS Removed mandatory conrol for prn reason field for behav. health unitl department ensures
+ reasons are noted by physician. CSR 31639
+ 02.21.2014 TMS Added functionality for STAT and Then orders, modified to allow use of PRN with Stat/Now and then orders.
+ Updated to use Total doses UDDI to populate the stop after field with appropriate value. CSR 31883
+ 04.26.2017 TMS Make PRN indication mandatory if IsPRN is true. CSR 35622
+ 05.16.2018 TMS Add "With Dialysis Treatment" to Frequency retrievals that contain As Ordered. CSR 33940
+
+ ;;
+ keywords: Called MLMs, Form fields, PRN, PRN Reason text
+ ;;
+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;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ comm_obj := this_communication.primaryobj;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
+ start_now_value := start_now.value;
+ stat_then := last of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then" );
+ stat_then_value := stat_then.value;
+ TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses");
+ TotalDosing_value := TotalDosing.value;
+ order_freq := first of (field_list where field_list.DataItemName = "FrequencyCode");
+ order_freq_value := order_freq.value;
+ order_freq_summary := order_freq_value.FrequencySummary;
+ RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments");
+ RX_Comments_value := RX_Comments_field.value;
+ RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions");
+ BehavHealth := ("PSYE", "PSYW");
+ session_type := comm_obj.internalprocessingtype;
+ OneTimeFreq := ("As Ordered", "As-Directed", "Between Blood", "Given in Delivery Room",
+ "Given in Infusion Center", "Given in NSY", "Load", "Now", "Once",
+ "One Time", "Per-Protocol", "POST OP", "Post-Procedure", "Post-Transfusion",
+ "PRE OP", "Pre-Procedure", "Pre-Transfusion", "With Dialysis Treatment");
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+
+
+ CurrentLocationGuid := read last
+ {"Select CurrentLocationGuid "
+ ||" From cv3Clientvisit "
+ ||" Where ClientGuid = " || SQL(Client_Guid)
+ ||" and Guid = " || SQL(Visit_Guid)
+ ||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" };
+
+ CurrentLocation := read last
+ {"Select Name from cv3location "
+ ||" Where Guid = " || SQL(CurrentLocationGuid) };
+
+
+
+
+
+ // This sets the visible control on the field dataitem - PRX_PRN_Reason
+ IsPRN_field := last of (field_list
+ where field_list.DataItemName = "IsPRN" );
+ PRX_PRN_Reason_field := first of (field_list
+ where field_list.DataItemName = "PRX_PRNCONDITION");
+ PRX_PRN_Reason_field_value := PRX_PRN_Reason_field.value;
+
+ // If CurrentLocation in BehavHealth then
+ // PRX_PRN_Reason_field.control_mandatory := FALSE;
+ // endif;
+
+ If IsPRN_field.Value = True then
+
+ PRX_PRN_Reason_field.control_mandatory := True;
+ elseif IsPRN_field.Value = False then
+ PRX_PRN_Reason_field.control_mandatory := False;
+ endif;
+
+ If exists start_now and session_type <> "Hold" and order_freq_summary not in OneTimeFreq then
+ start_now.control_read_only := false;
+ stat_then.control_read_only := false;
+ endif;
+
+
+// If exists Rx_comments_field and CallingEvent = "FormClose" and PRX_PRN_Reason_field is not NULL then
+
+// If RX_Comments_value is NULL then
+
+// RX_Comments_field.value := PRX_PRN_Reason_field.value;
+// else
+
+// RX_Comments_field.value := RX_Comments_value || " for " || PRX_PRN_Reason_field_value;
+// 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PRX_AUTOFILL_BASE.mlm b/MLMStripper/bin/Debug/FORM/FORM_PRX_AUTOFILL_BASE.mlm
new file mode 100644
index 0000000..196311b
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PRX_AUTOFILL_BASE.mlm
@@ -0,0 +1,125 @@
+maintenance:
+
+ title: Test Base Solution Auto Fill;;
+ mlmname: FORM_PRX_AutoFill_Base;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Base Solution;;
+ author: Robert Spence, Eclipsys Corp;;
+ specialist: ;;
+ date: 2006-09-05;;
+ validation: testing;;
+
+library:
+ purpose: This MLM sets the field PRN Base solution volume and units
+
+ ;;
+ explanation: This MLM takes the data sent to CDS from Med order form fields in the Forms and
+ Communications objects and compares it to Client Information to determine whether to display
+ certain fields and make them mandatory.
+
+ A Banner message is presented to the user to remind them that these fields must be
+ completed.
+
+ If the patient data does not meet the above conditions the fields are not visible on
+ the form.
+
+ The MLM is not run from a trigger event, but rather is called by the application.
+ It should be configured to run on Form Open.
+
+ ;;
+ keywords: Called MLMs, Form fields, PRN, PRN Reason text
+ ;;
+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:="";
+
+
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingField :=this_communication.CallingFieldName;
+ CallingEvent :=this_communication.CallingEvent;
+
+ BaseSolution_obj := OBJECT [Name, ItemID, Dose, UOM, OrderCatalogMasterItemGUID];
+
+ BaseSolution_field := first of (field_list where field_list.DataItemName = "BaseSolution");
+ BaseSolution_Value := BaseSolution_field.Value;
+
+ ResetBase_field :=first of (field_list where field_list.DataItemName = "PRX_ResetDiluent");
+
+
+ If CallingField ="PRX_ResetDiluent"
+ then
+ If ResetBase_Field.Value = True
+ then
+ BaseSolution_field.control_read_only := False;
+ BaseSolution_Value.Name:="";
+ ResetBase_Field.Value := False;
+ ResetBase_Field.Control_Visible := False;
+ endif;
+ elseif CallingField = "BaseSolution"
+ then
+ If exists BaseSolution_field
+ then
+ If BaseSolution_Value.Name = "0.9% NaCl 500ml ."
+ then
+ BaseSolution_Value.Dose :=500;
+ BaseSolution_Value.UOM :="ML";
+ BaseSolution_field.control_read_only := True;
+ ResetBase_Field.Control_Visible := True;
+ elseif BaseSolution_Value.Name = "D5 0.45% NaCl 500ml ."
+ then
+ BaseSolution_Value.Dose :=500;
+ BaseSolution_Value.UOM :="ML";
+ BaseSolution_field.control_read_only := True;
+ ResetBase_Field.Control_Visible := True;
+ elseif BaseSolution_Value.Name = "D5W 100ml ."
+ then
+ BaseSolution_Value.Dose :=100;
+ BaseSolution_Value.UOM :="ML";
+ BaseSolution_field.control_read_only := True;
+ ResetBase_Field.Control_Visible := True; endif;
+ endif;
+
+ // this_communication.DisplayForm := "Yes";
+ // this_communication.Message := "Base Solution Field Is: " || BaseSolution_field || "\n" ||
+ // "Value of Same is : "|| BaseSolution_Value.Name;
+ // this_communication.MessageType := "Error";
+
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PRX_LEVOTHYROXINE.mlm b/MLMStripper/bin/Debug/FORM/FORM_PRX_LEVOTHYROXINE.mlm
new file mode 100644
index 0000000..fbc0a53
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PRX_LEVOTHYROXINE.mlm
@@ -0,0 +1,111 @@
+maintenance:
+
+ title: Levothyroxine Dose Check;;
+ mlmname: FORM_PRX_Levothyroxine;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza-Allscripts;;
+ specialist: Teresa Spicuzza;;
+ date: 2018-10-04;;
+ validation: testing;;
+
+library:
+ purpose: MLM that alerts user if they are ordering in Mg instead of mcg
+
+ ;;
+
+ explanation: This MLM is called from the medication form(s) PRX_Po_Levothyroxine.
+
+
+ Change History
+
+ 2018.10.04 - TMS CSR#: 34033 - Placed into production to reduce incorrect dosing of Levothyroxine.
+
+
+
+ ;;
+ keywords: Called MLMs, Form fields, schedule
+ ;;
+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*******************/
+
+ /* These variables must containt he same wording as the options in the drop down list */
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // References the LOCAL SESSION object
+ // local_session := cds_session.local;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+
+ // Obtain common fields passed in the Form object to the Field object
+ //commented out ones are just not being used; however left incase you need them.
+ field_list:= this_form.fields;
+ dose := last of (field_list where field_list.DataItemName = "DosageLow" );
+ dose_value := dose.value;
+ uom := last of (field_list where field_list.DataItemName = "UOM" );
+ UOM_value := Uom.value ;
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+
+ if (this_communication.CallingFieldName = "DosageLow") then
+
+ if ((Dose.value as number) < 1 and UOM.Value = "mcg" )then
+
+ If dose_value = 0.025 then newdose := 25;
+ elseIf dose_value = 0.05 then newdose := 50;
+ elseIf dose_value = 0.075 then newdose := 75;
+ elseIf dose_value = 0.088 then newdose := 88;
+ elseIf dose_value = 0.1 then newdose := 100;
+ elseIf dose_value = 0.112 then newdose := 112;
+ elseIf dose_value = 0.125 then newdose := 125;
+ elseIf dose_value = 0.137 then newdose := 137;
+ elseIf dose_value = 0.15 then newdose := 150;
+ elseIf dose_value = 0.175 then newdose := 175;
+ elseIf dose_value = 0.2 then newdose := 200;
+ else newdose := null;
+ endif;
+
+ If newdose is not null then
+ error_msg := "You are attempting to order in mg." || CRLF || CRLF || "Dose will be corrected to " || newdose || "mcg." ;
+ dose.value := newdose as number;
+ else
+ error_msg := "You are attempting to order in mg." || CRLF || CRLF || "Please correct dose to mcg." ;
+ dose.value := null;
+ endif;
+ this_communication.Message := error_msg;
+ this_communication.MessageType := "Error";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PRX_SCHED_LOGIC.mlm b/MLMStripper/bin/Debug/FORM/FORM_PRX_SCHED_LOGIC.mlm
new file mode 100644
index 0000000..52abc76
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PRX_SCHED_LOGIC.mlm
@@ -0,0 +1,138 @@
+maintenance:
+
+ title: Medical Schedule Logic and Rules;;
+ mlmname: FORM_PRX_SCHED_LOGIC;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Isolation Set MLM;;
+ author: Eclipsys Corp;;
+ specialist: Shawn Head;;
+ date: 2013-12-03;;
+ validation: testing;;
+
+library:
+ purpose: MLM that can be used for any schedule related logic moving forward.
+
+ ;;
+
+ explanation: This MLM is called from the medication form(s) where assigned. Design should drive
+ schedule decision/logic/rules related to medication scheduling, alerts, ect...
+ Originally created to handle orders Scheduled date/time not being set to STAT unless the frequency is STAT also.
+
+
+ Change History
+
+ 2013.12.03 - STH CSR#: 31706 - Created MLM
+ 2014.03.21 - STH HDT#: 1478552 Logic commented out due to issues with Stat and Then Dosing.
+ 2016.09.28 TMS HDT#: 1478552 Restored MLM to original version, added check for {{{SINGLE-QUOTE}}}PRX_Dosing Addl Dose{{{SINGLE-QUOTE}}} field to ignore
+ logic if value is true, meaning order was generated as a STAT/Now and then order.
+ 2018.03.13 TMS CSR#: 34822 Add logic to protect frequency, start date and start time on Zosyn Piperacillin/Tazobactam
+ orders when entered as an extended infusion
+
+
+ ;;
+ keywords: Called MLMs, Form fields, schedule
+ ;;
+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;
+
+ comm_obj := this_communication.primaryobj;
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* These variables must containt he same wording as the options in the drop down list */
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // References the LOCAL SESSION object
+ local_session := cds_session.local;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+
+ // Obtain common fields passed in the Form object to the Field object
+ //commented out ones are just not being used; however left incase you need them.
+ field_list:= this_form.fields;
+ requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
+ requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
+ //stop_after:= last of (field_list where field_list.DataItemName = "StopAfter" );
+ //stop_after_Value := stop_after.value;
+ //stop_date := last of (field_list where field_list.DataItemName = "StopDate" );
+ //stop_time := last of (field_list where field_list.DataItemName = "StopTime" );
+ //stop_time_value := stop_time.value ;
+ //is_prn := last of (field_list where field_list.DataItemName = "IsPRN" );
+ regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode");
+ requested_time_value := requested_time.value;
+ regular_freq_value := regular_freq.value;
+ start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
+ start_now_value := start_now.value;
+ stat_and_then := last of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then" );
+ stat_and_then_value := stat_and_then.value;
+ AddlDose := last of (field_list where field_list.DataItemName = "PRX_Dosing Addl Dose" );
+ AddlDose_value := AddlDose.value;
+ //RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments");
+ //RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions");
+ //FreqText := " ";
+
+
+ //REQUESTEDTIME-BEGIN field logic. Use this section to
+ if (this_communication.CallingFieldName = "RequestedTime") then
+
+ if AddlDose_value = false then
+
+ //Check to see if selected time code is STAT. If yes also verify the frequency is STAT
+ //This forces the order to have both a frequency and start time of STAT to prevent users from
+ //"scheduling" a STAT order which should never occur.
+ if (requested_time_value.ReqTimeCode = "STAT") and
+ (regular_freq_value.FrequencySummary <> "STAT") then
+ error_msg := "You cannot enter a Start Time of STAT with a frequency of " || regular_freq_value.FrequencySummary || ". Please select the Give a STAT Dose checkbox to begin the medication immediately, or change the frequency to STAT.";
+ this_communication.Message := error_msg;
+ this_communication.MessageType := "Error";
+ requested_time_value.ReqTimeCode := "";
+ elseif ((requested_time_value.ReqTimeCode <> "STAT") and
+ (regular_freq_value.FrequencySummary = "STAT")) then
+ requested_time_value.ReqTimeCode := "STAT";
+ endif;
+
+ //REQUESTEDTIME-END field logic. End of section.
+
+ endif;
+
+ endif;
+
+ If ((this_communication.CallingEvent = "FormOpen")
+ or (this_communication.CallingEvent = "Fieldchange" and this_communication.CallingFieldName = "MLM_From Order Set")
+ or (this_communication.CallingEvent = "Fieldchange" and this_communication.CallingFieldName = "RequestedTime") )
+ and ((comm_obj.OrderSetName in ("Piperacillin/Tazobactam Orders", "Pneumonia Antibiotic", "IntraAbdominal Antibiotic", "Sepsis Unknown Source Antibiotic", "Skin Antibiotic Inpatient", "Urology (CPOE OS)",
+ "Pulmonary (CPOE OS)", "CCM Admission Orders", "Piperacillin/Tazobactam Orders" )
+ or (comm_obj.OrderSetName matches pattern "Transition Orders%")
+ and comm_obj.Name = "Piperacillin/Tazobactam:")) then
+
+ regular_freq.Control_Read_Only := true;
+ requested_time.Control_Read_Only := true;
+ requested_date.Control_Read_Only := true;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_PSYCHIATRY_ADMISSION_ORDERSET.mlm b/MLMStripper/bin/Debug/FORM/FORM_PSYCHIATRY_ADMISSION_ORDERSET.mlm
new file mode 100644
index 0000000..83e7e3c
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_PSYCHIATRY_ADMISSION_ORDERSET.mlm
@@ -0,0 +1,114 @@
+maintenance:
+
+ title: FORM_Psychiatry_Admission_Orderset;;
+ mlmname: FORM_Psychiatry_Admission_Orderset;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav Allscripts Corporation;;
+ date: 2014-12-10;;
+ validation: testing;;
+
+library:
+ purpose:
+
+ ;;
+
+ explanation:
+
+ Change History
+ -----------------
+ 12.10.2014 JML CSR# 33053: Created
+ Look back the current visit on a patient in Emergeny room for the lab orders with the Status as "Specimen Recieved by performing Department"
+ of the level "60" and if order is not there then preselect the same.
+ 1)TSH - 3rd Gen
+ 2)Comprehensive Basic Metabolic Panel
+ 3)Drug Screen Urine-Medical Purpose Only
+ 4)CBC (Includes Diff)
+ 5) Rotine/Microscopic Urinalysis
+ 6) B-hCG Quantitative Plasma/Serum
+ ;;
+ keywords: Called MLMs, Newborn, Admission, Hepatitis B
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Retrieve relevant form fields
+ Labs_NotDoneED := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 6);
+ Labs_NotDoneED_Val := Labs_NotDoneED.Value;
+
+ /*****************************Call to Base form MLM******************************************/
+ Mdecical_Imaging_MLM:= MLM {{{SINGLE-QUOTE}}}FORM_Medical_Imaging_Indications_for_OS{{{SINGLE-QUOTE}}};
+ this_communication,this_form := call Mdecical_Imaging_MLM with this_communication,this_form,client_info_obj ;
+
+ /*****************************Call to Base form MLM******************************************/
+
+
+ //Check to see if patient had these labs drawn in current visit till date
+ ( lab_name ) := read {"SELECT o.Name "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK) "
+ || " ON cv.GUID = o.ClientVisitGUID "
+ || " AND cv.ClientGUID = o.ClientGUID "
+ || " AND cv.ChartGUID = o.ChartGUID "
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " And cv.GUID = " || Sql(visit_guid)
+ || " AND o.NAME IN ({{{SINGLE-QUOTE}}}TSH-3rd Gen{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Drug Screen Urine-Medical Purpose Only{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Routine/Microscopic Urinalysis{{{SINGLE-QUOTE}}})"
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
+ Bhg := "B-hCG Quantitative Plasma/Serum" ;
+ lab_name := (lab_name , Bhg );
+ if ( exists lab_name ) then
+ for lab in 1 seqto ( count Labs_NotDoneED_Val ) do
+ if ( Labs_NotDoneED_Val[lab].Name Not IN lab_name ) then
+ Labs_NotDoneED_Val[lab].IsSelected := true;
+ else
+ Labs_NotDoneED_Val[lab].IsSelected := false;
+ endif;
+ enddo;
+ else
+ //No labs exist for this patient, select all labs
+ Labs_NotDoneED_Val.IsSelected := ( true, true, true, true, true, true );
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RESP_MEDICATIONS.mlm b/MLMStripper/bin/Debug/FORM/FORM_RESP_MEDICATIONS.mlm
new file mode 100644
index 0000000..ffa5e62
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RESP_MEDICATIONS.mlm
@@ -0,0 +1,177 @@
+maintenance:
+
+ title: St.Clair: Respiratory Medications;;
+ mlmname: FORM_Resp_Medications;;
+ arden: version 2;;
+ version: 3.50;;
+ institution: St Clair;;
+ author: Don Warnick, Eclipsys Corp;;
+ specialist: ;;
+ date: 2006-09-11;;
+ validation: testing;;
+
+library:
+ purpose: To add selected meds to the Comments field
+
+ ;;
+
+ explanation: This MLM is called from form, RESP SA IPPB
+
+ 1. Add selected meds to the Special Instructions field
+ 2. If PRN box is checked, make the PRN Reason field available
+ 3. Depending upon the value of Xopenex, make other fields visible or read/write
+ Change History
+ AnkitM 07.26.2017 - Change word from Xopenex to Levalbuterol except data items
+
+ ;;
+ keywords: Called MLMs, Form fields, Respiratory Meds
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ // 1. Add selected meds to the Special Instructions field
+ // 2. If PRN box is checked, make the PRN Reason field available
+ // 3. Depending upon the value of Xopenex, make other fields visible or read/write
+
+ comment:= last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0" );
+ nss_lbl:= last of (field_list where field_list.DataItemName = "RESP Normal Saline Label" );
+ nss_amt:= last of (field_list where field_list.DataItemName = "RESP NSS amount" );
+ albuterol_125:= last of (field_list where field_list.DataItemName = "RESP_Albuterol 1.25mg/3ml NSS" );
+ albuterol_25:= last of (field_list where field_list.DataItemName = "RESP_Albuterol 2.5mg/3ml NSS" );
+ albuterol_dose:= last of (field_list where field_list.DataItemName = "RESP_Albuterol Dose" );
+ alupent_02:= last of (field_list where field_list.DataItemName = "RESP_Alupent 0.2mg/2.5ml NSS" );
+ alupent_03:= last of (field_list where field_list.DataItemName = "RESP_Alupent 0.3mg/2.5ml NSS" );
+ atrovent_05:= last of (field_list where field_list.DataItemName = "RESP_Atrovent 0.5mg/3ml NSS" );
+ atrovent_dose:= last of (field_list where field_list.DataItemName = "RESP_Atrovent Dose" );
+ lidocaine_vol:= last of (field_list where field_list.DataItemName = "RESP_Lidocaine Volume" );
+ mucomyst_vol:= last of (field_list where field_list.DataItemName = "RESP_Mucomyst volume" );
+ nss_25:= last of (field_list where field_list.DataItemName = "RESP_NSS 2.5cc" );
+ nss_3:= last of (field_list where field_list.DataItemName = "RESP_NSS 3cc" );
+ pentamidine_600:= last of (field_list where field_list.DataItemName = "RESP_Pentamidine 600mg" );
+ pentamidine_dose:= last of (field_list where field_list.DataItemName = "RESP_Pentamidine Dose" );
+ prn:= last of (field_list where field_list.DataItemName = "IsPRN" );
+ prn_reason:= last of (field_list where field_list.DataItemName = "RESP_PRN Reasons" );
+ pulmicort_025:= last of (field_list where field_list.DataItemName = "RESP_Pulmicort 0.25mg" );
+ pulmicort_05:= last of (field_list where field_list.DataItemName = "RESP_Pulmicort 0.5mg" );
+ racepinephrine_05:= last of (field_list where field_list.DataItemName = "RESP_Racepinephrine 0.5ml (Vaponephrine)" );
+ Levalbuterol:= last of (field_list where field_list.DataItemName = "RESP_Xopenex" );
+ Levalbuterol_063:= last of (field_list where field_list.DataItemName = "RESP_Xopenex 0.63mg/3ml NSS" );
+ Levalbuterol_125:= last of (field_list where field_list.DataItemName = "RESP_Xopenex 1.25mg/3ml NSS" );
+ Levalbuterol_sub_lbl2:= last of (field_list where field_list.DataItemName = "RESP_Xopenex Substitute Label 2" );
+ Levalbuterol_sub_lbl:= last of (field_list where field_list.DataItemName = "RESP_Xopenex Substitutes Label" );
+ waking:= last of (field_list where field_list.DataItemName = "UseWakingHourOnly" );
+
+ If CallingEvent="FormOpen"
+ then
+ prn_reason.control_read_only := true;
+ Levalbuterol_sub_lbl.control_visible := false;
+ Levalbuterol_sub_lbl2.control_visible := false;
+ Levalbuterol_063.control_read_only := true;
+ Levalbuterol_125.control_read_only := true;
+ endif;
+
+ If CallingEvent = "FieldChange"
+ then
+ If CallingField = "IsPRN"
+ then
+ If prn.value = true
+ then
+ prn_reason.control_read_only := false;
+ else
+ prn_reason.control_read_only := true;
+ prn_reason.value := "";
+ endif;
+ endif;
+ If CallingField = "RESP_Xopenex"
+ then
+ if Levalbuterol.value = "Use Therapeutic Substitute"
+ then
+ Levalbuterol_sub_lbl.control_visible := true;
+ Levalbuterol_sub_lbl2.control_visible := true;
+ else
+ Levalbuterol_sub_lbl.control_visible := false;
+ Levalbuterol_sub_lbl2.control_visible := false;
+ endif;
+ if Levalbuterol.value = "Per Physician Order: Do NOT Substitute"
+ then
+ Levalbuterol_063.control_read_only := false;
+ Levalbuterol_125.control_read_only := false;
+ else
+ Levalbuterol_063.control_read_only := true;
+ Levalbuterol_125.control_read_only := true;
+ Levalbuterol_063.value := "";
+ Levalbuterol_125.value := "";
+ endif;
+ endif;
+ endif;
+
+ If CallingEvent="FormClose"
+ then
+ comment.value:= " ";
+ If albuterol_25.value = true then comment.value:= comment.value || albuterol_25.label || " : "; endif;
+ If albuterol_125.value = true then comment.value:= comment.value || albuterol_125.label || " : "; endif;
+ If nss_amt.value <> "" then comment.value:= comment.value || nss_amt.label || " " || nss_amt.value || " : "; endif;
+ If albuterol_dose.value <> "" then comment.value:= comment.value || albuterol_dose.label || " " || albuterol_dose.value || " : "; endif;
+ If alupent_02.value = true then comment.value:= comment.value || alupent_02.label || " : "; endif;
+ If alupent_03.value = true then comment.value:= comment.value || alupent_03.label || " : "; endif;
+ If atrovent_05.value = true then comment.value:= comment.value || atrovent_05.label || " : "; endif;
+ If atrovent_dose.value <> "" then comment.value:= comment.value || atrovent_dose.label || " " || atrovent_dose.value || " : "; endif;
+ If lidocaine_vol.value <> "" then comment.value:= comment.value || lidocaine_vol.label || " " || lidocaine_vol.value || " : "; endif;
+ If mucomyst_vol.value <> "" then comment.value:= comment.value || mucomyst_vol.label || " " || mucomyst_vol.value || " : "; endif;
+ If nss_25.value = true then comment.value:= comment.value || nss_25.label || " : "; endif;
+ If nss_3.value = true then comment.value:= comment.value || nss_3.label || " : "; endif;
+ If pentamidine_600.value = true then comment.value:= comment.value || pentamidine_600.label || " : "; endif;
+ If pentamidine_dose.value <> "" then comment.value:= comment.value || pentamidine_dose.label || " " || pentamidine_dose.value || " : "; endif;
+ If pulmicort_025.value = true then comment.value:= comment.value || pulmicort_025.label || " : "; endif;
+ If pulmicort_05.value = true then comment.value:= comment.value || pulmicort_05.label || " : "; endif;
+ If racepinephrine_05.value = true then comment.value:= comment.value || racepinephrine_05.label || " : "; endif;
+ If Levalbuterol.value <> "" then comment.value:= comment.value || Levalbuterol.label || " " || Levalbuterol.value || " : "; endif;
+ If Levalbuterol_063.value = true then comment.value:= comment.value || Levalbuterol_063.label || " : "; endif;
+ If Levalbuterol_125.value = true then comment.value:= comment.value || Levalbuterol_125.label || " : "; endif;
+ If prn.value = true then comment.value:= comment.value || prn.label || " : "; endif;
+ If prn_reason.value <> "" then comment.value:= comment.value || prn_reason.label || " - " || prn_reason.value || " : "; endif;
+ If waking.value = true then comment.value:= comment.value || waking.label || " : "; 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RESP_VENT_MODE_CPAP.mlm b/MLMStripper/bin/Debug/FORM/FORM_RESP_VENT_MODE_CPAP.mlm
new file mode 100644
index 0000000..02dfd84
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RESP_VENT_MODE_CPAP.mlm
@@ -0,0 +1,84 @@
+maintenance:
+
+ title: Zero out Volume and BPM if Ventilator ordered CPAP;;
+ mlmname: FORM_Resp_Vent_Mode_CPAP;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Ventilator MLM;;
+ author: Robert spence, Eclipsys Corp;;
+ specialist: ;;
+ date: 2008-12-04;;
+ validation: testing;;
+
+library:
+ purpose: Zero out Tital Volume and Vent Rate (BPM) if Venitalor ordered CPAP
+
+ ;;
+
+ explanation: This MLM is called from the Ventilator order form (Resp Vent Adult Vol)
+
+ ;;
+ keywords: Called MLMs, Form fields, Respiratory, Ventilator, CPAP
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ // get the 3 fields in question
+
+ mode_field := last of (field_list
+ where field_list.DataItemName = "Resp Vent Mode" );
+
+ vt_field := last of (field_list
+ where field_list.DataItemName = "Resp Vent VT (Tidal Volume)" );
+
+ rate_field := last of (field_list
+ where field_list.DataItemName = "Resp Vent Rate (BPM)" );
+
+ If mode_field.value = "CPAP" then
+
+ vt_field.value := 0;
+ rate_field.value := 0;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RITUXIN.mlm b/MLMStripper/bin/Debug/FORM/FORM_RITUXIN.mlm
new file mode 100644
index 0000000..ab02cde
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RITUXIN.mlm
@@ -0,0 +1,123 @@
+maintenance:
+
+ title: Form_Rituxin;;
+ mlmname: Form_Rituxin ;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: SCH ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2016-02-02;;
+ validation: testing;;
+
+library:
+ purpose: Ø While opening of the Order items if the weight or height is not charted on the patient then pre -populate the message that weight / height needs to entered.
+ Calucate the Dose for the patient on the basis of the value in the calculation field* BSA And round off to multiple of 5.
+ Instruction/Comments whould change the value of 375 as per the dose value.
+
+ ;;
+ explanation:
+ Change history
+ 04.11.2017 TMS Changed MLM to be called from "Form_HoldOrder_RequestedTime" to keep calls on FormOpen
+ from one {{{SINGLE-QUOTE}}}master{{{SINGLE-QUOTE}}} MLM, being done in preparation for using hidden default dosing CSR 35364.
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ Client_GUID := this_communication.ClientGUID;
+ ClientVisit_GUID := this_communication.ClientVisitGUID;
+ Chart_GUID := this_communication.ChartGUID;
+ form_name := this_form.Name;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ HtWtBSA := First of ( field_list where field_list.DataItemName = "CombinedMeasurements" And field_list.Control_MultiFieldOccNum = 1 ) ;
+ Calculation := First of ( field_list where field_list.DataItemName = "PRX_Rituximab calcuation" And field_list.Control_MultiFieldOccNum = 1 ) ;
+ Dose := First of ( field_list where field_list.DataItemName = "DosageLow" And field_list.Control_MultiFieldOccNum = 1 ) ;
+ Instruction := First of ( field_list where field_list.DataItemName = "AdminInstructions" and field_list.Control_MultiFieldOccNum = 1 ) ;
+
+ HtWtBSA_Val := HtWtBSA.Value.BSA ;
+ Calc_Val :=Calculation.Value ;
+
+
+ // check weight Value for Patient and Give warning message
+ Wt := Read first {"Select text from CV3PhysicalNoteDeclaration With (Nolock) Where Typecode= {{{SINGLE-QUOTE}}}WEIGHT{{{SINGLE-QUOTE}}} "
+ || " And ClientVisitGUID = " ||SQL(ClientVisit_GUID) || " " };
+ Ht := Read first {"Select text from CV3PhysicalNoteDeclaration With (Nolock) Where Typecode= {{{SINGLE-QUOTE}}}HEIGHT{{{SINGLE-QUOTE}}} "
+ || " And ClientVisitGUID = " ||SQL(ClientVisit_GUID) || " " };
+
+ if ( CallingEvent = "FormOpen" ) then
+ // Generic_MLM:= MLM {{{SINGLE-QUOTE}}}FORM_HOLDORDER_REQUESTEDTIME{{{SINGLE-QUOTE}}};
+ // this_communication,this_form := call Generic_MLM with this_communication,this_form,client_info_obj ;
+ // To Pass Message fir Height weight
+ If Wt is Null or Ht is Null or HtWtBSA_Val = 0 Then
+ Void := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please enter a current weight/height for this patient" ,"Sunrise Clinical Manager", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ EndIf;
+ // Autopopulating Value in dose
+ If (Wt is Not Null And Ht is not Null ) And HtWtBSA_Val Is Not 0 Then
+ DoseVal := (HtWtBSA_Val As Number ) * ( Calc_Val As Number) ;
+ DoseVal1 := Read Last {"Select Convert( Int, Round( "|| DoseVal || ", 0)) "};
+ RoundedDose := Read Last {" Select Convert(Int,(( "||DoseVal1 || " + 2.5)/5)) * 5 "}; //Read Last {" Select "|| DoseVal1 ||" + (5 - ( "|| DoseVal1 ||" % 5)) "};
+ Dose.Value := RoundedDose ;
+ Instruction.Value := " Dose: "|| HtWtBSA_Val || " m2 x 375 mg/m2 " ;
+ ElseIf HtWtBSA_Val = 0 Then
+ Instruction.Value := "";
+ Endif ;
+ Endif;
+
+
+ if ( CallingEvent = "FieldChange" ) then
+ //if this_communication.CallingFieldName in ("PRX_Rituximab calcuation","CombinedMeasurements") Then
+ If (HtWtBSA_Val Is Not 0 ) And (Calc_Val is Not Null ) Then
+ If CallingField = "DosageLow" Then
+ DoseVal := (HtWtBSA_Val As Number) * ( Calc_Val As Number);
+ DoseVal1 := Read Last {"Select Convert( Int, Round( "|| DoseVal || ", 0)) "}; //Dose.Value := DoseVal1 ;
+ RoundedDose := Read Last {" Select Convert(Int,(( "||DoseVal1 || " + 2.5)/5)) * 5 "};
+ If Dose.Value = RoundedDose Then
+ Dose.Value := (HtWtBSA_Val As Number) * ( Calc_Val As Number) ;
+ Dose.Value := RoundedDose; //DoseVal1 ;
+ Instruction.Value := " Dose: "|| HtWtBSA_Val || " m2 x 375 mg/m2 " ;
+ Else
+ Instruction.Value := "";
+ Endif;
+ Else
+ DoseVal := (HtWtBSA_Val As Number) * ( Calc_Val As Number) ;
+ DoseVal1 := Read Last {"Select Convert( Int, Round( "|| DoseVal || ", 0)) "};
+ RoundedDose := Read Last {" Select Convert(Int,(( "||DoseVal1 || " + 2.5)/5)) * 5 "};
+ Dose.Value := RoundedDose ;
+ Instruction.Value := " Dose: "|| HtWtBSA_Val || " m2 x 375 mg/m2 " ;
+ Endif;
+ ElseIf HtWtBSA_Val = 0 or Calc_Val is Null Then
+ Instruction.Value := "";
+ Endif;
+ EndIf; /// Form Onening Event End
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_DEFAULT_MEDICATION_VALUES.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_DEFAULT_MEDICATION_VALUES.mlm
new file mode 100644
index 0000000..c6ee35b
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_DEFAULT_MEDICATION_VALUES.mlm
@@ -0,0 +1,122 @@
+maintenance:
+
+ title:Pharmacy SCM Route Code to WORx code mapping;;
+ mlmname:FORM_RX_Default_Medication_Values;;
+ arden: version 2;;
+ version: 16.3;;
+ institution: St Clair ;;
+ author: Teresa Spicuzza, Allscripts;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2016-12-16;;
+ validation: testing;;
+
+library:
+ purpose: This MLM sets the field OrderRouteCode and DosageLow, UOM and/or FrequencyCode.
+
+ ;;
+ explanation: This MLM is launched on form open and defaults values to DosageLow, UOM, OrderRouteCode, and FrequencyCode
+ when ordered outside of Orders Reconciliation and default values are available and values are not preconfigured.
+
+
+ Change History
+ 04.11.2017 TMS CSR 35364: Placed into production
+
+ ;;
+ keywords: Called MLMs, Form fields, Rx Route, Worx Route, Mapping
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingField :=this_communication.CallingFieldName;
+ CallingEvent := this_communication.CallingEvent;
+ FormType := this_communication.FormType;
+ DisplayForm := this_communication.displayform;
+
+
+
+ // This sets the visible control on the field dataitem - CHG_OVERRIDE_WITH
+ Route_field := last of (field_list
+ where field_list.DataItemName = "OrderRouteCode" );
+
+ Dosage_field := last of (field_list
+ where field_list.DataItemName = "DosageLow" );
+ UOM_field := last of (field_list
+ where field_list.DataItemName = "UOM" );
+ Frequency_field := last of (field_list
+ where field_list.DataItemName = "FrequencyCode" );
+ Default_Route_field := last of (field_list
+ where field_list.DataItemName = "Prx_Default_Route" );
+
+ Default_Dosage_field := last of (field_list
+ where field_list.DataItemName = "PRX_Default_Dose" );
+ Default_UOM_field := last of (field_list
+ where field_list.DataItemName = "PRX_Default_UOM" );
+ Default_Frequency_field := last of (field_list
+ where field_list.DataItemName = "PRX_Default_Frequency" );
+
+ Frequency_value := Frequency_field.value ;
+
+ Stat_Now_Order := last of (field_list
+ where field_list.DataItemName = "PRX_Dosing Addl Dose");
+ No_Defaults := first of (field_list
+ where field_list.DataItemName = "PRX_NoDefaultValues");
+
+ If CallingEvent ="FormOpen" and DisplayForm = "Yes" and this_communication.OrderSet = "NO" and Stat_Now_Order.value = False and No_Defaults.value = false then
+
+ If Dosage_field.value is null and Default_Dosage_field.value is not Null then
+ Dosage_field.value := Default_Dosage_field.value;
+ endif;
+ If UOM_field.value is null and Default_UOM_field.value is not Null then
+ UOM_field.value := Default_UOM_field.value;
+ endif;
+ If Route_field.value is null and Default_Route_field.value is not Null then
+ Route_field.value := Default_Route_field.value;
+ endif;
+ If Frequency_value.FrequencySummary is null and Default_Frequency_field.value is not Null then
+ Frequency_value.FrequencySummary := Default_Frequency_field.value;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_DUPLICATE_FROM_ORDER_SET.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_DUPLICATE_FROM_ORDER_SET.mlm
new file mode 100644
index 0000000..79d17cb
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_DUPLICATE_FROM_ORDER_SET.mlm
@@ -0,0 +1,101 @@
+maintenance:
+
+maintenance:
+ title: Therapeutic Duplicate Handling Info from Order Set;;
+ filename: FORM_Rx_Duplicate_From_Order_Set;;
+ arden: version 2.5;;
+ version: 16.30;;
+ institution: Eclipsys, System MLM;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2017-04-10;;
+ validation: testing;;
+library:
+ purpose: This MLM parses information recorded from orders management processing on order sets to update actions taken
+ on the individual orders.
+
+ ;;
+ explanation: This MLM parses information recorded from orders management processing on order sets to update actions taken
+ on the individual orders.
+
+ History:
+ 04.10.2017 TMS CSR 33465 Created to parse through information recorded on the actions taken upon orders through the
+ custom orders management processing and present it on the order item.
+
+ ;;
+ keywords: Called MLMs, Form fields, Therapeutic Duplication
+ ;;
+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;
+
+
+ /**************************************************************************************/
+
+
+ CallingEvent := this_communication.CallingEvent;
+ comm_obj := this_communication.primaryobj;
+ field_list:= this_form.fields;
+
+ /***************************************************************************************/
+
+ // Call to utility MLM
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Assigns fields passed in the Form object to the Field object
+
+ Dup_Order_Guids := last of (field_list where field_list.DataItemName = "PRX_Order_Guids" );
+ Dup_Order_Action := last of (field_list where field_list.DataItemName = "PRX_Duplicate_Order_Action_Text");
+ InfoBox := last of (field_list where field_list.DataItemName = "PRX_OrderSet_Duplicate_Info");
+ OrderName := comm_obj.Name;
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := false;
+
+
+ /***************************************************************************************/
+ If CallingEvent = "FieldChange" then
+ DupGuidsFromOrderSet := call str_parse with infobox.value ,"^";
+ medsalerted := count (DupGuidsFromOrderSet);
+ for r in 1 seqto medsalerted do
+ Lineinfo := call str_parse with DupGuidsFromOrderSet [r], "|";
+ linedata := count (lineinfo);
+ for s in 1 seqto linedata do
+ alertingorder := lineinfo [1];
+ alertguids := lineinfo [2];
+ alertaction := lineinfo [3];
+
+ if ordername = alertingorder then
+
+ If alertaction = "NCI" then
+ Dup_Order_Action.value := "Possible Duplicate Orders Reviewed - No Changes Indicated";
+ elseif alertaction = "AT" then
+ Dup_Order_Action.value := "Possible Duplicate Orders Reviewed - Actions Taken";
+ elseif alertaction = "NA" then
+ Dup_Order_Action.value := "Possible Duplicate Orders Not Addressed";
+ endif;
+ Dup_Order_Guids.value := alertguids;
+
+ endif;
+ enddo;
+ enddo;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_HAZWASTE_DISPINSTRUCT.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_HAZWASTE_DISPINSTRUCT.mlm
new file mode 100644
index 0000000..f288174
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_HAZWASTE_DISPINSTRUCT.mlm
@@ -0,0 +1,101 @@
+maintenance:
+
+ title: RX Haz Waste Disposal Instructions;;
+ filename: FORM_Rx_HazWaste_DispInstruct;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts;;
+ specialist: ;;
+ date: 2014-08-05;;
+ validation: testing;;
+
+library:
+purpose: This MLM copies waste disposal instructions into the info box.
+
+ ;;
+ explanation: This MLM takes the waste disposal code from the class type and copies the appropriate instructions
+ to the instruction field of the order.
+
+ Change History
+ 08/05/2014 TMS Created MLM to populate Hazardous Waste disposal info to hidden field
+ on form. This will only display with the task and on the special notes
+ tab on veriscan to provide user administering medication with instructions
+ for Stericycle disposal method. Called from Form_Now_and_Then mlm
+ Go live Date of 12/9/2014 CSR 31995
+
+ ;;
+ keywords: Called MLMs, Waste Disposal Code, Stericycle ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ OrderCatalogItemGUID := this_Communication.ItemID;
+
+ Instructions_field := last of (field_list where field_list.DataItemName = "PRX_HazDisposalMessage");
+ Instructions_value := Instructions_field.value;
+
+ Waste_Code:= Read Last
+ {" SELECT CV3CatalogClassTypeValue.Value FROM
+ CV3CatalogClassTypeValue INNER JOIN"
+ || " CV3ClassType ON CV3CatalogClassTypeValue.ClassTypeGUID =
+ CV3ClassType.GUID"
+ || " WHERE CV3ClassType.Code = {{{SINGLE-QUOTE}}}PRX_Haz-Waste-Disp-Sort-Code{{{SINGLE-QUOTE}}} AND
+ CV3CatalogClassTypeValue.CatalogMasterGUID = " || SQL(OrderCatalogItemGUID)};
+
+ If exists Instructions_field and waste_code is not null then
+ If waste_code = "BKC" then
+ Waste_info := "If any medication remains dispose of container in LARGE BLACK Waste Bin - NO Empty Containers";
+ Instructions_field.value := waste_info;
+ elseif waste_code = "BKSC" then
+ Waste_info := "If any medication remains dispose of container in BLACK SHARPS Bin - NO Empty Containers";
+ Instructions_field.value := waste_info;
+ elseif waste_code = "SPPM" then
+ Waste_info := "Place Partial or Empty Container/Wrapper in baggie and in ORANGE return to Pharmacy bin.";
+ Instructions_field.value := waste_info;
+ elseif waste_code = "SP" then
+ Waste_info := "If any medication remains place container in baggie and in ORANGE return to Pharmacy bin - NO Empty Containers";
+ Instructions_field.value := waste_info;
+ elseif waste_code = "SPNP" then
+ Waste_info := "Place Nicotine Patch adhesive backing in baggie and in ORANGE return to Pharmacy bin.";
+ Instructions_field.value := waste_info;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_MEDICATION_RETRIEVAL.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_MEDICATION_RETRIEVAL.mlm
new file mode 100644
index 0000000..7c67279
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_MEDICATION_RETRIEVAL.mlm
@@ -0,0 +1,556 @@
+maintenance:
+
+maintenance:
+ title: Order Retrieval for Pharmacy Obj Plus Discontinue Function;;
+ filename: FORM_Rx_Medication_Retrieval;;
+ arden: version 2.5;;
+ version: 15.10;;
+ institution: Eclipsys, System MLM;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2015-10-05;;
+ validation: testing;;
+library:
+ purpose: This MLM retrieves medication by therapeutic class for deletion from within the order form.
+
+ ;;
+ explanation: This MLM retrieves medication by therapeutic class for deletion from within the order form.
+
+ History:
+ 04.27.2016 TMS CSR 33465 Created to present duplicate therapeutic medication alerts in an interactive
+ window allowing users to discontinue existing orders or abandon the order they are
+ trying to enter in a user friendly presentation. This MLM uses the duplicate checking
+ stored procedures that are used by the STD_Duplicate_Medication_Therapy MLM and the Multum
+ Data Configuration in Decision Support. This MLM is called from order forms on Form Open.
+ Medications on an order set are checked using FORM_SET_Rx_Medication_Order_Mgt on Form Open.
+ 12.05.2016 TMS Change name of stored procedure used to gather duplicate order guids from
+ SCMTherapeuticDuplicateMedsCheckingPR to SCHTherapeuticDuplicateMedsCheckingPR. This is
+ a copy of the 15.1 version of the stored procedure. This will be used instead of the
+ 16.3 version of SCMTherapeuticDuplicateMedsCheckingPR to eliminate modifying MLM to send
+ additional fields for community medication orders - a new feature not needed for this MLM
+ CSR 35130
+ 04.11.2017 TMS Modified format of order guids in hidden field to save without encasing values in single quotes
+ for use by SCH_ALERT_ON_DUPLICATE_ORDERS. CSR 33465
+ 05.09.2017 TMS Modified to supress duplicate alerts from between Vancomycin PO and Vancomycin IV.
+ CSR 34904
+
+ ;;
+ keywords: Called MLMs, Form fields, Therapeutic Duplication
+;;
+ citations:
+{{+B}}Development{{-B}}: Drug information provided by Cerner Multum, Inc. Drug information can be customized and configured by local facility.
+{{+B}}Funding{{-B}}: Cerner Multum, Inc.
+{{+B}}Citations{{-B}}: None supplied by Cerner Multum, Inc.
+
+{{+B}}Release{{-B}}: VantageRx Multum Database
+
+ ;;
+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;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ comm_obj := this_communication.primaryobj;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+ error_occurred := false;
+ info_message := "";
+
+ continue_checking_meds := TRUE;
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ OrderSource := comm_obj.SourceCode;
+ ProviderGuid := this_communication.CareProviderGUID;
+
+ MedOrderBox := last of (field_list where field_list.DataItemName = "OBJ_Plus_Med" );
+ DupFlag := last of (field_list where field_list.DataItemName = "PRX_Dup_Action_Flag");
+ // InfoBox := last of (field_list where field_list.DataItemName = "PRX_Notecomment0");
+ IV_additive := last of (field_list where field_list.DataItemName = "IVAdditive" );
+ Obj_Plus_Launch := last of (field_list where field_list.DataItemName = "PRX_Alert_from_Order_Form");
+ session_type := comm_obj.internalprocessingtype;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ User_GUID := this_communication.UserGUID;
+ Order_Mgt_MLM := mlm {{{SINGLE-QUOTE}}}SCH_LAUNCH_ORDER_MANAGEMENT{{{SINGLE-QUOTE}}};
+ Dup_Order_Guids := last of (field_list where field_list.DataItemName = "PRX_Order_Guids" );
+ OrderSetName := comm_obj.OrderSetName;
+ CalledfromSet := last of (field_list where field_list.DataItemName = "MLM_From Order Set");
+ // PreSelectedonSet := last of (field_list where field_list.DataItemName = "PRX_PreSelectedOrder");
+ Addl_Order := last of (field_list where field_list.DataItemName = "PRX_Dosing Addl Dose");
+ FrequencyField:= last of (field_list where field_list.DataItemName = "FrequencyCode");
+ FrequencyCode := FrequencyField.value;
+ Frequency := FrequencyCode.FrequencySummary;
+ Dup_Order_Action := last of (field_list where field_list.DataItemName = "PRX_Duplicate_Order_Action_Text");
+
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ // Using assembly and namespace
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := false;
+
+ /* Set to false if not need to display Order Form dialog.
+ If it{{{SINGLE-QUOTE}}}s set to true, order form will be displayed and the order will be
+ saved to order entry worksheet when OK is clicked from the order form. */
+ display_order_form := true;
+
+ /* Set to false if not to cancel the current order */
+ cancel_current_order := true;
+
+ /***************************************************************************************/
+
+
+
+
+ // Set to a different Order Status Level
+ // if fewer order statuses should be included
+ lowest_status_level_for_meds:= 0;
+
+ // Normally orders with a StopDTM will have 3 times their half-life added to
+ // their stopDTM when figuring what drugs are still active in the patient{{{SINGLE-QUOTE}}}s system.
+ // This value indicates that if a completed drug has a half
+ // life less than this then not to bother adding on the 3 x the half-life
+ Past_HalfLife_Grace_Period := 10000; // value in hours
+
+ // Normally if the drug being ordered has a StopDTM then we add 3 times the
+ // half-life to the StopDTM when figuring what drugs in the database with
+ // start times in the future to include in the checking.
+ // This value indicates that if the drug being ordered has a half
+ // life less than this then not to bother adding on the 3 x the half-life
+ Future_HalfLife_Grace_Period := 10000; //value in hours
+
+ // Set the variable to indicate timeframe in minutes between the stopdtm
+ // and startdtm of identical orders that would make them be considered
+ // a reorder and thus not included in the duplicate checking.
+ Reorder_Grace_Period := 0; // value in minutes
+ at_in_house_session_list:= ("Inhouse");
+ // setting for "Suppress Duplicate Checking for Items in This Set"
+ use_catalog_setting_to_suppress_duplicate_checking_in_sets:= TRUE;
+
+
+
+ main_order_name := comm_obj.Name;
+ evoking_order_object_guid := comm_obj.GUID;
+ order_status_code := comm_obj.itemstatus;
+ Order_summary_line := "Summary Line Info";
+ main_item_catalog_guid := this_communication.ItemID;
+ chart_guid := this_communication.chartguid;
+ client_guid := this_communication.clientguid;
+ client_visit_guid := this_communication.clientvisitguid;
+ significant_date := comm_obj.significantdtm;
+ stop_date := comm_obj.stopdtm;
+ order_is_conditional := comm_obj.isconditional;
+ order_exists := false;
+ parent_conditional_order_guid := null;
+ order_component_obj := null;
+ complex_order := comm_obj.complexordertype;
+ order_is_for_discharge := comm_obj.isformdischarge;
+ order_alternate_order_type := null;
+ evoking_med_source := null;
+ order_session_type_bit_flags := 1;
+ unsubmitted_session_type_bit_flags := 1;
+ db_session_type_bit_flags := 1;
+ back_up_obj := null;
+
+ // Executes only when this MLM is called by the editor
+ if called_by_editor then
+
+ main_order_name := "Codeine 30mg Tab";
+ evoking_order_object_guid := comm_obj.GUID;
+ order_status_code := comm_obj.itemstatus;
+ Order_summary_line := "Summary Line Info";
+ main_item_catalog_guid := 8000001351073001;
+ chart_guid := this_communication.chartguid;
+ client_guid := this_communication.clientguid;
+ client_visit_guid := this_communication.clientvisitguid;
+ significant_date := comm_obj.significantdtm;
+ stop_date := "25-Feb-2016 0:00:00.000";
+ order_is_conditional := comm_obj.isconditional;
+ order_exists := false;
+ parent_conditional_order_guid := null;
+ order_component_obj := null;
+ complex_order := comm_obj.complexordertype;
+ order_is_for_discharge := comm_obj.isformdischarge;
+ order_alternate_order_type := null;
+ evoking_med_source := null;
+ client_guid := 9000002166800200;
+ client_visit_guid := 9000003935500270;
+ user_guid := 4000001117119000;
+ db_session_type_bit_flags := 1;
+ avoid_parent_orderset_guid := "";
+ evoking_order_object_guid := 9001132042600680;
+ back_up_obj := null;
+ endif;
+
+
+ func_dup_suppress_checking := MLM {{{SINGLE-QUOTE}}}STD_FUNC_Dup_Suppress_Checking{{{SINGLE-QUOTE}}};
+ // Initialize input XML parameter
+ evoking_order_parameter_xml := "";
+ // evoking_rx_parameter_xml := "";
+ unsubmitted_order_parameter_xml := "";
+
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+
+ OrderSetName := comm_obj.OrderSetName;
+
+ If Addl_Order.value = True and (Frequency = "Stat" or Frequency = "Now") then
+
+ Stat_Now_Then_Order := "True";
+ else
+ Stat_Now_Then_Order := "False";
+ endif;
+
+ If (CallingEvent = "FormOpen" and CalledFromSet.value = false and Stat_Now_Then_Order = "False")
+ or (CallingEvent = "FieldChange" and CallingField = "IVAdditive")
+ or (CallingEvent = "FormOpen" and CalledfromSet is null and Stat_Now_Then_Order = "False")
+ then
+
+
+// ****** Check for IV additives
+ if exists IV_additive then
+
+ additives_list := ();
+ evoking_additive_cat_GUID_List := ();
+ evoking_additive_name_List := ();
+ additives_list := IV_additive.value;
+ evoking_additive_cat_GUID_List := additives_list.OrderCatalogMasterItemGUID;
+ evoking_additive_name_List := additives_list.Name;
+ start_date := significant_date;
+
+ if (start_date is NULL)
+ then
+ start_date := (day floor of now);
+ endif;
+
+ IF count evoking_additive_cat_GUID > 0 then
+ listedname := "";
+ separator := "";
+ for p in 1 seqto (count evoking_additive_cat_GUID_List ) do
+ evoking_additive_cat_GUID := evoking_additive_cat_guid_list [p];
+ evoking_additive_name := evoking_additive_name_list[p];
+
+ IsAdditive := "1";
+ evoking_is_selected := 1;
+ if (evoking_additive_cat_GUID is not null) then
+ evoking_additive_xml :=
+ " \n";
+
+ evoking_order_parameter_xml := evoking_order_parameter_xml ||
+ evoking_additive_xml;
+ listedname := listedname || separator || evoking_additive_name;
+ separator := ", ";
+
+ endif;
+ enddo;
+
+ listedname := listedname || " in " || main_order_name;
+ endif;
+ endif; // If exists IV_additive then
+
+ /* Initialize variable to empty string */
+ avoid_parent_orderset_guid := "";
+ avoid_child_orderset_guid := "";
+
+ cont1 := continue_checking_meds; //marker RS
+ mainorder := main_order_name; //marker RS
+ evoking_item_name := main_order_name;
+
+ continue_checking_meds := TRUE;
+ start_date := (day floor of now);
+ db_session_type_bit_flags := order_session_type_bit_flags;
+ unsubmitted_session_type_bit_flags := order_session_type_bit_flags;
+
+ // Check medications from significant date for non-alert checking triggers
+ start_date := significant_date;
+
+ if (start_date is NULL)
+ then
+ start_date := (day floor of now);
+ endif;
+
+ evoking_is_selected := 1;
+
+
+ if continue_checking_meds then
+ // Add evoking object information in the input XML parameter
+ If IsAdditive <> "1" or IsAdditive is Null
+ then
+ listedname := main_order_name;
+ evoking_order_parameter_xml :=
+ " \n";
+ endif;
+ input_parameter_xml := "\n\n" ||
+ evoking_order_parameter_xml ||
+ "\n";
+
+ // Convert the boolean values to binary flag
+ ignore_discontinued_prescriptons_flag := ignore_discontinued_prescriptons as number;
+ display_lowest_category_exceeded_flag := display_lowest_category_exceeded as number;
+ check_parent_conditionarl_order := 0;
+
+ // Call stored proc to check duplicate medication therapy
+ (ComponentDrugKey_list,
+ ParentDrugKey_list,
+ EnteredDrugComponent_list,
+ EnteredDrugName_list,
+ EnteredIsAdditive_list,
+ DuplicateOrderName_list,
+ DuplicateAdditiveName_list,
+ DupIngredientName_list,
+ DupIsAdditive_list,
+ DupOrderGUID_list,
+ OrderCatlogMasterItem_list,
+ DupCategoryName_list,
+ MaxDupThreshold_list,
+ DupSummaryLine_list,
+ DupStartDTM_list,
+ DupStopDTM_list,
+ DupOrderStatusNum_list,
+ DupOrderStatus_list,
+ CategoryLevel_list,
+ IsMapped_list,
+ DupIsOrder_list):= read{" SCHTherapeuticDuplicateMedsCheckingPR "
+ || SQL(input_parameter_xml) || ", "
+ || client_guid || ", "
+ || user_guid || ", "
+ || SQL(Past_HalfLife_Grace_Period) || ", "
+ || SQL(Future_HalfLife_Grace_Period) || ", "
+ || SQL(Reorder_Grace_Period) || ", "
+ || SQL(lowest_status_level_for_meds) || ", "
+ || db_session_type_bit_flags || ","
+ || SQL(avoid_parent_orderset_guid) || ","
+ || SQL(avoid_child_orderset_guid) || ", "
+ || SQL(ignore_discontinued_prescriptons_flag) || ", "
+ || SQL(display_lowest_category_exceeded_flag) || ", "
+ || SQL(check_parent_conditionarl_order) || ", "
+ || SQL(parent_conditional_order_guid)
+ };
+
+
+ sqlextract := "";
+ countnosub := 0;
+ Dup_Order_Guids.value := "";
+
+ if exist EnteredDrugName_list
+ then
+ if main_order_name = "Vancomycin:" then
+ noalertname := "Vancomycin Soln";
+
+ elseif main_order_name = "Vancomycin Soln" then
+ noalertname := "Vancomycin:";
+ else noalertname := " ";
+ endif;
+
+ spool_list := 1 seqto count (EnteredDrugName_list);
+ for countorder in spool_list do
+ singorder := DupOrderGUID_list[countorder];
+ singstat := DupOrderStatus_list[countorder];
+ singsum := DupSummaryLine_list[countorder];
+ singname := DuplicateOrderName_list[countorder];
+
+ if (singstat <> "Unapproved" and (singname is not null) and (singname <> noalertname)) // no need to check different accoutn if = unsubmitted
+ then
+
+ cvguid := read last
+ {" select o.ClientVisitGUID from cv3order o "
+ || " where o.guid = " || singorder };
+
+ if cvguid = visit_guid then
+ countnosub := countnosub + 1;
+ if countnosub = 1 then
+ sqlextract := "{{{SINGLE-QUOTE}}}" || singorder || "{{{SINGLE-QUOTE}}}";
+ Dup_Order_Guids.value := singorder ;
+ else
+ sqlextract := sqlextract || ",{{{SINGLE-QUOTE}}}" || singorder || "{{{SINGLE-QUOTE}}}";
+ Dup_Order_Guids.value := Dup_Order_Guids.value || "," || singorder ;
+ endif;
+ endif;
+ endif;
+ enddo;
+ endif;
+ endif; // if continue checking meds
+
+ objplusmsg := "";
+ If (countnosub > 0) then
+ If OrderSource is null then OrderSource := " "; endif;
+ If this_communication.DisplayForm = "No" and this_communication.OrderSet = "No" then
+
+ objplusmsg := listedname|| "|Q|" || sqlextract || "|" || OrderSource || "|" || ProviderGuid || "|" || "Pharmacy|";
+
+ alerttype := "Q";
+ alerttype2 := "Q";
+ continuecheck := "y";
+ elseif this_communication.DisplayForm = "Yes" and this_communication.OrderSet = "No" then
+
+ objplusmsg := listedname|| "|Q|" || sqlextract|| "|" || OrderSource || "|" || ProviderGuid || "|" || "Pharmacy|";
+ alerttype := "Q";
+ alerttype2 := "F";
+ continuecheck := "y";
+ else
+ continuecheck := "n";
+ endif;
+
+ If continuecheck = "y" then
+ Dupflag := call Order_Mgt_MLM with (objplusmsg);
+
+ // If exists Dupflag and dupflag is not null then
+ If exists Dupflag then
+
+ If exist Dup_Order_Action then
+ If dupflag matches pattern "N%" then
+ Dup_Order_Action.value := "Possible Duplicate Orders Reviewed - No Changes Indicated";
+ elseif dupflag matches pattern "Y%" then
+ Dup_Order_Action.value := "Possible Duplicate Orders Reviewed - Actions Taken";
+ else
+ Dup_Order_Action.value := "Possible Duplicate Orders Not Addressed";
+ endif;
+ endif;
+ endif;
+ endif; //continuecheck = "y"
+ endif; //If (countnosub > 0)
+ endif; // If CallingEvent...
+
+ // Get the last revision date of the Multum database, strip out time portion
+ revision_date := read last { "select change_date from SXAMTdatabase_infoSYN" };
+ revision_date := revision_date formatted with "%.2t";
+ revision_date_string := "\n{{+B}}Revision Date{{-B}}: " || revision_date;
+
+ if error_occurred = true then
+ this_communication.MessageType := "Error"; // Informational, Error, Banner
+ this_communication.Message := info_message || "\n" || "Error: " || error_message;
+ endif;
+ ;;
+ evoke: // No evoke statement
+ ;;
+ logic:
+
+ if alerttype = "Q" and this_communication.DisplayForm = "No" and OrdersetName is null and (dupflag = "NY" or dupflag = "YY")
+ then
+
+ try
+ //-----------------------------------------------------------
+ // Retrieve current order entry batch.
+ // The new order can be added only if the parent order
+ // belongs to the order entry batch
+ // object owned by the OrderEntryWorksheet.
+ //-----------------------------------------------------------
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+
+ if worksheetInfo is NULL OR
+ "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String)
+ then
+ // If current order entry batch is not OrderEntryWorksheet,
+ // do not continue with the order replacement.
+ // Still conclude true to return communication and form objects.
+ conclude true;
+ endif;
+
+ this_communication.PrimaryObj.CancelOrder := cancel_current_order;
+ if cancel_current_order = true
+ then
+ info_message := "The order is canceled by MLM.";
+ endif;
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := ex.Message;
+ endcatch;
+ endif;
+
+ if alerttype = "Q" and this_communication.DisplayForm = "Yes" and OrdersetName is null and (dupflag = "NY" or dupflag = "YY")
+ then
+ this_communication.DisplayForm := "No" ;
+ try
+ //-----------------------------------------------------------
+ // Retrieve current order entry batch.
+ // The new order can be added only if the parent order
+ // belongs to the order entry batch
+ // object owned by the OrderEntryWorksheet.
+ //-----------------------------------------------------------
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+
+ if worksheetInfo is NULL OR
+ "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String)
+ then
+ // If current order entry batch is not OrderEntryWorksheet,
+ // do not continue with the order replacement.
+ // Still conclude true to return communication and form objects.
+ conclude true;
+ endif;
+
+ this_communication.PrimaryObj.CancelOrder := cancel_current_order;
+ if cancel_current_order = true
+ then
+ info_message := "The order is canceled by MLM.";
+ endif;
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := ex.Message;
+ endcatch;
+ endif;
+
+
+ if error_occurred = true then
+ this_communication.MessageType := "Error"; // Informational, Error, Banner
+ this_communication.Message := info_message || "\n" || "Error: " || error_message;
+ endif;
+
+ conclude true;
+ ;;
+ action:
+ // This MLM returns two parameters, of types communication_type and form_type respectively.
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_NEONATAL_MORPHINE_LABEL.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_NEONATAL_MORPHINE_LABEL.mlm
new file mode 100644
index 0000000..f6376a8
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_NEONATAL_MORPHINE_LABEL.mlm
@@ -0,0 +1,108 @@
+maintenance:
+
+ title: FORM_RX_NEONATAL_MORPHINE_LABEL ;;
+ mlmname: FORM_RX_NEONATAL_MORPHINE_LABEL;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: St.Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: Sandy Zhang ;;
+ date: 2017-07-31;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation: Takes the calculated dose/volume of neonatal morphine and inserts it into the instructions field, thereby printing on pharmacy label. Typically the pharmacist needs to manipulate
+ the label text at order verification for the calculated dose/volume to be included.
+
+
+ Change History
+
+ 07.31.2017 SZ CSR #31162 - Neonatal Morphine Dose/Volume Label
+
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+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";
+
+ // 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;
+
+
+
+ // the calculated dose/volume is stored in the Note Comment
+ note_comment := first(this_form.Fields where this_form.Fields.DataItemName = "PRX_NOTECOMMENT0");
+ calculated_dose_volume := note_comment.Value;
+
+ instruction_field := first(this_form.Fields where this_form.Fields.DataItemName = "AdminInstructions");
+ instruction_value := instruction_field.value;
+
+
+ // appends the calculated dose/volume onto end of instructions text when “ok” button is clicked
+ // if dose is edited, then new dose is inserted into instructions field and removes old dose
+ if (this_communication.CallingEvent = "FormClose") then
+ // if text was entered in instructions field then use the formating below
+ if (exist instruction_value) then
+
+ colon_match := instruction_value MATCHES PATTERN "%::%";
+ mg_match := instruction_value MATCHES PATTERN "%mg =%";
+
+ if (colon_match = true) then
+ // instruction_field.value := "";
+
+ string_count_before_colon := find " :: " in string instruction_value;
+ text_before_colon := substring string_count_before_colon characters starting at 1 from (instruction_value);
+
+ label_instruction := text_before_colon || ":: " || calculated_dose_volume;
+ instruction_field.value := label_instruction;
+ elseif (mg_match = true) and (colon_match = false) then
+ label_instruction := calculated_dose_volume;
+ instruction_field.value := label_instruction;
+ else
+
+ label_instruction := instruction_value || " :: " || calculated_dose_volume;
+ instruction_field.value := label_instruction;
+
+ endif;
+
+ endif;
+
+ // if NO text was entered in instructions field then use the formating below
+ if (not exist instruction_value) then
+
+ label_instruction := calculated_dose_volume;
+ instruction_field.value := label_instruction;
+
+ endif;
+
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: //return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_ORM_INSTRUCT.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_ORM_INSTRUCT.mlm
new file mode 100644
index 0000000..7eb04f8
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_ORM_INSTRUCT.mlm
@@ -0,0 +1,827 @@
+maintenance:
+
+ title: Called MLM for updating the RX Instruction UDDI;;
+ filename: FORM_RX_ORM_Instruct;;
+ arden: version 2;;
+ version: 5.50;; //FP1 Order Reconciliation Manager
+ institution: St. Clair;;
+ author: Teresa Spicuzza - adapted from MLM by Phil Thomas, Allscripts Knowledge Management;;
+ specialist: ;;
+ date: 2013-08-09;;
+ validation: testing;;
+library:
+ purpose: This Called MLM is to be assigned to FORM CLOSE on any order form and Medication Catalog item combination that allows for a Complex Dose or Multiple Frequency.
+ It will update the RX Comments UDDI which will transfer to any prescriptions if continued after discharge.
+
+ ;;
+ explanation: This Called MLM, upon FORM CLOSE, will read the following complex dosing fields and format the cell rows into the RX Instruction UDDI on the form.
+ System UDDIs examined: CalculatedDose, DosageLow and FrequencyCode
+ UDDI Updated: "RX Comments" (Must be on the form to execute).
+
+ Note: The legnth of the RX Instruction should be configured to 2000 characters but the RX WRiter Sig Line can only handle 140 characters.
+ If this occurs the field value for RX Comments will be truncated to 140 chracters but the MLM will look for the "RX COmments" UDDI.
+ This can handle the full 2000 characters from the "RX Comments" UDDI and will appear on the RX Comments Tab along with Multum data.
+
+ To transfer the RX Instruction UDDI to the RX Sig Line of a Home Medication or Prescription the following Environemental Profile must be configured:
+ Orders > PrescriptionToOrderFieldMaping > Instructions > Value " RX Instructions"
+
+ To transfer the RX Coments UDDI to the RX Comments of a Home Medication or Prescription the following Environemental Profile must be configured:
+ Orders > PrescriptionToOrderFieldMaping > Comments > Value " RX Comments"
+
+ Note: If your institution uses a different Order Form UDDI for this purpose then you will need to alter this MLM and replace "RX Comments"
+ and "RX Instructions" with your UDDI values.
+
+ Complex Dosing options must be enabled under the Pharamcy configuration section of the Order Catalog Item.
+
+ Tips: - Form Close will run even if the form is configured to not display and the MLM can update the UDDIS even if protected or hidden.
+ - This MLM will also work with the Frequency option and perfomrm the same behavior as above if discovered.
+ - If you already have an MLM on Form Close you may sub-call this MLM from the existing MLM to avoid reconfiguration of the forms.
+
+*** Allscripts Disclaimer:
+ Client is responsible for all decisions, acts, and omissions of any persons in connection with the delivery of medical care or other services to any patients.
+ Before any Licensed Materials are placed into a live production environment, it is Client’s responsibility to review and test all Licensed Materials and associated
+ workflows and other content, as implemented, make independent decisions about system settings and configuration based upon Client’s needs, practices, standards and
+ environment, and reach its own independent determination that they are appropriate for such live production use. Any such use by Client (or its Authorized Users)
+ will constitute Client’s representation that it has complied with the foregoing. Client shall ensure that all Authorized Users are appropriately trained in use of
+ the then-deployed release of the Software prior to their use of the Software in a live production environment. Clinical Materials are tools to assist Authorized
+ Users in the delivery of medical care, but should not be viewed as prescriptive or authoritative. Clinical Materials are not a substitute for, and Client shall
+ ensure that each Authorized User applies in conjunction with the use thereof, independent professional medical judgment. Clinical Materials are not designed for use,
+ and Client shall not use them, in any system that provides medical care without the participation of properly trained personnel. Any live production use of Clinical
+ Materials by Client (or its Authorized Users) will constitute Client’s acceptance of clinical responsibility for the use of such materials.
+
+ History:
+
+ 08.12.2013 TMS Adapted from MLM (FORM_Preset_MultiDose_RX) by Phil Thomas, Allscripts Knowledge Management with modifications
+ to calculate start dates of subsequent order rows from first row value for for decreasing (taper) or increasing
+ dose. Changed size of Instructions, and added then stop comment for end of taper. Logic added for user schedule
+ translation to patient friendly instructions, order route to be added when specific (i.e., right eye, via tube);
+ include synonym for Aspart Insulin, add PRN Reason when populated to Rx Comments. Called from FORM_Now_and_Then.
+ CSR 31639
+ 11.04.2014 TMS Added logic to write medrol dose pak instructions to comment field when orders entered with Medrol Dosing dose option
+ for inclusion in discharge reconciliation. CSR 31407
+
+ 11.05.2015 TMS Added insulin brand names "Lantus" for Insulin Glargine and "Levemir" for Insulin Detemir to populate the RX comments
+ for inclusion in discharge reconciliation. CSR 33859
+ 07.23.2019 TMS CSR 37676 - Change log_execution_info to false per upgrade analysis.
+
+
+ ;;
+ keywords: Called MLMs, Form fields, RX Instructions, Orders Reconciliation Manager, RX Comments;
+ ;;
+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;
+
+ PrimaryObjdetail:=this_communication.PrimaryObj;
+ OrderName := PrimaryObjdetail.name;
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := FALSE;
+
+ /* Null field variables */
+ RX_Summary := Null;
+ RX_Comments_User := "";
+
+ //Formatting Characters
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+ xxcounter := 0;
+
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ //
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ //Capture the RX Comments Data Item and test if present, Do not proceeed with MLM if not found on order form
+ RX_Comments_field := first of (field_list where field_list.DataItemName = "Rx Comments");
+ RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions");
+ FreqText := " ";
+
+ requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
+ requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
+ stop_after:= last of (field_list where field_list.DataItemName = "StopAfter" );
+ stop_after_Value := stop_after.value;
+ stop_date := last of (field_list where field_list.DataItemName = "StopDate" );
+ stop_time := last of (field_list where field_list.DataItemName = "StopTime" );
+ stop_time_value := stop_time.value ;
+ is_prn := last of (field_list where field_list.DataItemName = "IsPRN" );
+ regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode");
+ requested_time_value := requested_time.value;
+ regular_freq_value := regular_freq.value;
+ start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
+ start_now_value := start_now.value;
+ PRX_PRN_Reason_field := first of (field_list
+ where field_list.DataItemName = "PRX_PRNCONDITION");
+ PRX_PRN_Reason_field_value := PRX_PRN_Reason_field.value;
+ Route_Code := last of (field_list where field_list.DataItemName = "OrderRouteCode" );
+ SpecifyRoute := ("Right Eye", "Left Eye", "Both Eyes", "Right Ear", "Left Ear", "Both Ears",
+ "Alternating Nostrils", "Left Nostril", "Right Nostril", "Each Nostril", "Via Tube");
+ FreqText := " ";
+
+ If PRX_PRN_Reason_field.value is NULL then
+ ReasonText := " ";
+ else
+ ReasonText := "for " || PRX_PRN_Reason_field_value;
+ endif;
+
+
+ If Route_Code.value in SpecifyRoute then
+ RouteText := " to " || Route_Code.value;
+ else
+ RouteText := " ";
+ endif;
+
+ RX_Comments_field_value := RX_Comments_field.value;
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ FreqTranslate := ();
+ FreqTranslate := read { "select value from cv3userdictionaryvalue v with (nolock)"
+ || " where userdictionarycode = {{{SINGLE-QUOTE}}}PRX_ORM Frequency Translation{{{SINGLE-QUOTE}}} "
+ || " and active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
+ };
+
+
+
+
+
+ If exists RX_Comments_field then
+ //Save any data already enetered by the user
+ If RX_Comments_field.Value is not NULL then
+ RX_Comments_User := RX_Comments_field.Value;
+ Endif;
+
+ If OrderName matches pattern "Insulin Aspart%" then
+ InsulinNote := "(Humalog or NovoLog)";
+ elseif Ordername matches pattern "Insulin Glargine%" then
+ InsulinNote := "(Lantus)";
+ elseif Ordername matches pattern "Insulin Detemir%" then
+ InsulinNote := "(Levemir)";
+ else
+ InsulinNote := " ";
+ endif;
+
+ If regular_freq_value.FrequencySummary <> "" then
+
+ NumMembs:= count FreqTranslate;
+ for k in (1 seqto (NumMembs)) do
+ listings := call str_parse with FreqTranslate[k],"|";
+ tempstr:=first of (listings);
+ if tempstr = regular_freq_value.FrequencySummary then
+ if exists(listings[2]) then
+ FreqText := listings [2];
+ else
+ FreqText := " ";
+ endif;
+ endif;
+ enddo;
+
+ RX_Comments_field.value := FreqText || " " || RouteText || " " || ReasonText || " " || insulinnote;
+ RX_Instructions_field.value := FreqText || " " || RouteText || " " || ReasonText || " " || insulinnote;
+ endif;
+
+ If regular_freq_value.FrequencySummary = "" AND regular_freq_value.FreqUOM = "irregular" then
+ RX_Comments_field.value := "";
+ RX_Instructions_field.value := "";
+
+ // obtain a list of the scheduled dates and times
+ freq_schedules := regular_freq_value.FreqIrregularDtm;
+
+ // find the earliest scheduled time
+ earliest_time := minimum of freq_schedules;
+
+ // extract the time from the date_time
+ sched_hour := EXTRACT HOUR(earliest_time);
+ sched_minute := EXTRACT MINUTE(earliest_time);
+ sched_time := sched_hour || ":" || sched_minute;
+
+ // create patient friendly Rx instructions and Rx comments for ORM for user schedule frequencies
+ adminat := "";
+ freq_schedules_sort := sort (regular_freq_value.FreqIrregularDtm as time);
+ Irregtimes := count freq_schedules;
+
+
+ for n in (1 seqto Irregtimes ) do
+ schedtime := freq_schedules_sort [n];
+ schedmin := EXTRACT Minute(schedtime as time);
+ if (schedmin as number) < 10 then
+ schedmin := "0" || schedmin ;
+ endif;
+
+ schedhour := EXTRACT HOUR(schedtime as time);
+
+ if (schedhour as number) >= 12 then
+ timeofday := "PM";
+ if (schedhour as number) >= 13 then
+ schedhour := schedhour - 12;
+ endif;
+ else
+ timeofday := "AM";
+ if (schedhour as number) = 0 then
+ schedhour := 12;
+ endif;
+ endif;
+
+ schedmm := EXTRACT Month(schedtime as time);
+ scheddd := EXTRACT Day(schedtime as time);
+ schedyy := EXTRACT Year(schedtime as time);
+
+ adminat := adminat || schedmm ||"/" ||scheddd || "/" || schedyy || " at " || schedhour || ":" || schedmin || timeofday || "; ";
+
+ enddo;
+
+ // populate rxinstructions and rx comments with user schedule translation for irregular
+ rxinstruct := "on " || adminat ;
+
+ RX_Comments_field.value := rxinstruct || " " || RouteText || " " || ReasonText || " " || InsulinNote;
+ RX_Instructions_field.value := rxinstruct || " " || RouteText || " " || ReasonText || " " || InsulinNote;
+
+ endif; //if user schedule and irregular
+
+ //Update Rx Instructions and Rx Comments with patient friendly definitions for User Schedule
+ If regular_freq_value.FrequencySummary = ""
+ AND (regular_freq_value.FreqUOM = "day" OR regular_freq_value.FreqUOM = "week") then
+ if regular_freq_value.FreqUOM = "day" then
+ If (regular_freq_value.FreqFromTime as number) = 1 then
+ weeklydays := "day";
+
+ elseif (regular_freq_value.FreqFromTime as number) > 1 then
+ weeklydays := regular_freq_value.FreqFromTime || " days";
+ endif;
+ endif;
+
+
+ If regular_freq_value.FreqUOM = "week" then
+
+ If "Monday" in regular_freq_value.FreqWeeklyDays then
+ If weeklydays is not Null then weeklydays := weeklydays || ", Monday";
+ else weeklydays := "Monday";
+ endif;
+ endif;
+
+ If "Tuesday" in regular_freq_value.FreqWeeklyDays then
+ If weeklydays is not Null then weeklydays := weeklydays || ", Tuesday";
+ else weeklydays := "Tuesday";
+ endif;
+ endif;
+
+ If "Wednesday" in regular_freq_value.FreqWeeklyDays then
+ If weeklydays is not Null then weeklydays := weeklydays || ", Wednesday";
+ else weeklydays := "Wednesday";
+ endif;
+ endif;
+
+ If "Thursday" in regular_freq_value.FreqWeeklyDays then
+ If weeklydays is not Null then weeklydays := weeklydays || ", Thursday";
+ else weeklydays := "Thursday";
+ endif;
+ endif;
+
+ If "Friday" in regular_freq_value.FreqWeeklyDays then
+ If weeklydays is not Null then weeklydays := weeklydays || ", Friday";
+ else weeklydays := "Friday";
+ endif;
+ endif;
+
+ If "Saturday" in regular_freq_value.FreqWeeklyDays then
+ If weeklydays is not Null then weeklydays := weeklydays || ", Saturday";
+ else weeklydays := "Saturday";
+ endif;
+ endif;
+
+ If "Sunday" in regular_freq_value.FreqWeeklyDays then
+ If weeklydays is not Null then weeklydays := weeklydays || ", Sunday";
+ else weeklydays := "Sunday";
+ endif;
+ endif;
+ endif;
+
+ Numtimes := count regular_freq_value.FreqTimes;
+ if Numtimes > 1 then
+ septime := ", "; adminat := "";
+ else
+ septime := "";adminat := "";
+ endif;
+
+ for k in (1 seqto NumTimes) do
+ schedtime := regular_freq_value.FreqTimes [k];
+ schedmin := EXTRACT Minute(schedtime as time);
+ if (schedmin as number) < 10 then
+ schedmin := "0" || schedmin ;
+ endif;
+ schedhour := EXTRACT HOUR(schedtime as time);
+ if (schedhour as number) >= 12 then
+ timeofday := "PM";
+ if (schedhour as number) >= 13 then
+ schedhour := schedhour - 12;
+ endif;
+ else timeofday := "AM";
+ if (schedhour as number) = 0 then
+ schedhour := 12;
+ endif;
+ endif;
+
+ admintime := schedhour ||":" || schedmin || timeofday;
+ if numtimes = k then
+ Adminat := adminat || admintime;
+ else
+ adminat := adminat || admintime || septime;
+ endif;
+ enddo;
+
+
+
+ // populate rxinstructions and rx comments with user schedule translation for weekly and daily
+
+ rxinstruct := "every " || WeeklyDays || " at " || adminat;
+
+ RX_Comments_field.value := rxinstruct || " " || RouteText || " " || ReasonText || " " || InsulinNote;
+ RX_Instructions_field.value := rxinstruct || " " || RouteText || " " || ReasonText || " " || InsulinNote;
+
+
+ endif;
+
+
+// this section is for calculated dosing - not used
+/*
+ //Capture the Calculated Dose Data Item and all componenets
+ CalculatedDose_field := first of (field_list where field_list.DataItemName = "CalculatedDose");
+ If exists CalculatedDose_field then
+ CalcDoseValue:= CalculatedDose_field.Value;
+ // Statements used to read the Complex Dosing Grid.
+ // If DosingOption field is NULL, we expect the structure
+ // stored in Value is regular CalculatedDose compound value
+ // structure.
+ If exists CalcDoseValue.DosingOption AND
+ CalcDoseValue.DosingOption is NOT NULL then
+ // access the dosing options grid
+ CalcGridDosingOption := CalcDoseValue.DosingOption;
+ CalcGridRows := CalcDoseValue.Rows;
+ CalcGridCols := CalcDoseValue.Cols;
+ CalcGridDefAllowAddRemove := CalcDoseValue.ConfigAllowRowAddRemove;
+ CalcGridAllowAddRemove := CalcDoseValue.AllowRowAddRemove;
+ Else
+ // access as regular CalcDose fields
+ CalculatedDose_obj := OBJECT [DosageLow, CalcActualDose,
+ CalcOverrideReason, CalcRequestedDose, CalcTotalDailyDose,
+ CalcDoseUOM, CalcUOMPer];
+ CalculatedDoseValue := CalculatedDose_field.Value;
+ // Statements used to read calculateddose sub-fields
+ Found_CalcDosageLow := CalculatedDoseValue.DosageLow;
+ Found_CalcActualDose := CalculatedDoseValue.CalcActualDose;
+ Found_CalcOverrideReason :=
+ CalculatedDoseValue.CalcOverrideReason;
+ Found_CalcRequestedDose :=
+ CalculatedDoseValue.CalcRequestedDose;
+ Found_CalcTotalDailyDose :=
+ CalculatedDoseValue.CalcTotalDailyDose;
+ Found_CalcUom := CalculatedDoseValue.CalcUOM;
+ Found_CalcUomPER := CalculatedDoseValue.CalcUOMPer;
+ Found_CalcReadONly := CalculatedDose_field.control_read_only;
+ Endif;
+
+ //Explode the Complex Dosing Option if found and update the RX Comments field for conversion to a prescription
+ If Exist CalcGridRows then
+ // Build a list of found rows and columns of the dosing option grid
+ index_list := 0 seqto ( count CalcGridRows );
+ Total_Rows := count CalcGridRows;
+
+ for M in index_list do
+
+
+ //Sequentially go thru each of the dosing option rows to get the data item values assigned
+ temp_Cell_Row:=Last(First M from CalcGridRows.Cells);
+
+ //Look for the Calculated Dose Data item and read the value
+ temp_Cell_DosageLow := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "CalculatedDose");
+ temp_Cell_ItemValue:=temp_Cell_DosageLow.ItemValue;
+ temp_Cell_DosageLow_Value:=temp_Cell_ItemValue.DosageLow;
+
+ //Check to see if a Dose is present to proceed
+ If temp_Cell_DosageLow_Value Is Not NULL then
+ //If the last row then indicate the last like the application does
+ If M = Total_Rows Then
+ RX_Summary := RX_Summary || CRLF || "Last: " || temp_Cell_DosageLow_Value || SP;
+ ElseIf RX_Summary Is Null then
+ RX_Summary := "Start: " || temp_Cell_DosageLow_Value || SP;
+ Else
+ RX_Summary := RX_Summary || CRLF || "Then: " || temp_Cell_DosageLow_Value || SP;
+ Endif;
+
+ //Capture the Unit of Measure and add to the RX Summary if found
+ temp_Cell_UOM := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "Uom");
+ temp_Cell_UOM_Value:=temp_Cell_UOM.ItemValue;
+ //Update the RX Summary if a value was found
+ If temp_Cell_UOM_Value Is Not NULL then
+ RX_Summary := RX_Summary || temp_Cell_UOM_Value|| SP;
+ Endif;
+
+ //Capture the Frequency value and add to the RX Summary if found
+ temp_Cell_Frequency := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "FrequencyCode");
+ temp_Cell_ItemValue:=temp_Cell_Frequency.ItemValue;
+ temp_Cell_Frequency_Value:=temp_Cell_ItemValue.FrequencySummary;
+ //Update the RX Summary if a value was found
+ If temp_Cell_Frequency_Value Is Not NULL Then
+ RX_Summary := RX_Summary || temp_Cell_Frequency_Value|| SP;
+ Endif;
+
+ //Capture the Route value and add to the RX Summary if found
+ temp_Cell_Route := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "OrderRouteCode");
+ temp_Cell_Route_Value:=temp_Cell_Route.ItemValue;
+ //Update the RX Summary if a value was found
+ If temp_Cell_Route_Value Is Not NULL then
+ RX_Summary := RX_Summary || ", " || temp_Cell_Route_Value;
+ Endif;
+
+ //Capture the Stop After value and add to the RX Summary if found
+ temp_Cell_StopAfter := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "StopAfter");
+ temp_Cell_ItemValue:=temp_Cell_StopAfter.ItemValue;
+ temp_Cell_NUMBER_Value:=temp_Cell_ItemValue.NUMBER;
+ temp_Cell_Option_Value:=temp_Cell_ItemValue.Option;
+ //Update the RX Summary if a value was found
+ If temp_Cell_Option_Value Is Not NULL Then
+ RX_Summary := RX_Summary || ", for " || temp_Cell_NUMBER_Value || SP || temp_Cell_Option_Value;
+ Endif;
+
+ Endif; //A Row has a Dose
+ enddo; //End of Row List Loop
+ Endif; //tapering Dose was found
+ Endif; //End of CalculatedDose Examination
+
+*/
+
+ // This looks for the presence of the field dataitem - dosagelow - and stores it incase a checkbox is removed.
+ DosageLow_field := first of (field_list where field_list.DataItemName = "DosageLow");
+
+ If exists DosageLow_field then
+ DoseLowValue := DosageLow_field.Value;
+
+ // DosageLow value can either be a numeric value or a
+ //complex dosing grid value.
+ If exists DoseLowValue And DoseLowValue is not NUMBER then
+ // access the dosing options grid
+ DosingOption := DoseLowValue.DosingOption;
+ DoseLowGrid_ColList := DoseLowValue.Cols;
+ DoseLowGrid_RowList := DoseLowValue.Rows;
+ AllowAddRemove := DoseLowValue.AllowRowAddRemove;
+ ConfigAllowRowAddRemove := DoseLowValue.ConfigAllowRowAddRemove;
+ Else
+ // access as regular DosageLow field
+ Is_Calc_Field := FALSE;
+ Endif; //DoseageLow was a complex dose option
+
+
+
+ If Exist DoseLowGrid_RowList then
+ If DosingOption = "Medrol Dose Pak" then
+ dosingtype := "DosePak";
+ endif;
+
+ // Build a list of found rows and columns of the dosing option grid
+ index_list_dl := 0 seqto ( count DoseLowGrid_RowList );
+ Total_Rows_dl := count DoseLowGrid_RowList;
+
+ //Build a loop to go thru the list of Rows found
+ for M in index_list_dl do
+
+
+
+ //Sequentially go thru each of the dosing option rows to get the data item values assigned
+ // and obtain prior row info if available for frequency, durationa and start date
+ temp_Cell_Row:=Last(First M from DoseLowGrid_RowList.Cells);
+ If M > 1 then
+ P := (M as number)-1;
+ prior_cell_row :=Last(First P from DoseLowGrid_RowList.Cells);
+ endif;
+ //Look for the Dose Data item and read the value
+ temp_Cell_DosageLow := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "DosageLow");
+ temp_Cell_DosageLow_Value:=temp_Cell_DosageLow.ItemValue;
+
+ //Check to see if a Dose is present to proceed
+ If temp_Cell_DosageLow_Value Is Not NULL then
+ //If the last row then indicate the last like the application does
+ If M = Total_Rows_dl Then
+ // RX_Summary := RX_Summary || CRLF || "Last: " || temp_Cell_DosageLow_Value || SP;
+ RX_Summary := RX_Summary || CRLF || "THEN: " || temp_Cell_DosageLow_Value || SP;
+ FirstEntry := "No";
+ EndMessage := "THEN STOP" || " " || RouteText || " " || ReasonText;
+ ElseIf RX_Summary Is Null then
+ RX_Summary := "START: " || temp_Cell_DosageLow_Value || SP;
+ EndMessage := " ";
+ FirstEntry := "Yes";
+ Else
+ // RX_Summary := RX_Summary || CRLF || "Then: " || temp_Cell_DosageLow_Value || SP;
+ RX_Summary := RX_Summary || CRLF || " THEN: " || temp_Cell_DosageLow_Value || SP;
+ EndMessage := " ";
+ FirstEntry := "No";
+ Endif;
+
+ //Capture the Unit of Measure and add to the RX Summary if found
+ temp_Cell_UOM := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "Uom");
+ temp_Cell_UOM_Value:=temp_Cell_UOM.ItemValue;
+
+ //Update the RX Summary if a value was found
+ If temp_Cell_UOM_Value Is Not NULL then
+ RX_Summary := RX_Summary || temp_Cell_UOM_Value|| SP;
+ Endif;
+
+ //Capture the Frequency value and add to the RX Summary if found
+ temp_Cell_Frequency := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "FrequencyCode");
+ temp_Cell_ItemValue:=temp_Cell_Frequency.ItemValue;
+ temp_Cell_Frequency_Value:=temp_Cell_ItemValue.FrequencySummary;
+
+ prior_cell_Frequency := first of (prior_Cell_Row where prior_Cell_Row.DataItemCode = "FrequencyCode");
+ prior_Cell_ItemValue:=prior_Cell_Frequency.ItemValue;
+ prior_Cell_Frequency_Value:=prior_Cell_ItemValue.FrequencySummary;
+
+ If prior_Cell_Frequency_Value Is Not NULL and dosingtype <> "DosePak" Then
+
+ (PriorFreqType, PriorFreqSpan, PriorFreqUom) := read last
+ {"Select DefinitionType, TimeFromValue, TimeUom "
+ ||" From cv3Frequency "
+ ||" Where Code = " || SQL(Prior_Cell_Frequency_Value) };
+ Endif;
+
+ //Update the RX Summary if a value was found
+ If temp_Cell_Frequency_Value Is Not NULL and dosingtype <> "DosePak" Then
+ RX_Summary := RX_Summary || temp_Cell_Frequency_Value|| SP;
+
+ (FreqType, FreqSpan, FreqUom) := read last
+ {"Select DefinitionType, TimeFromValue, TimeUom "
+ ||" From cv3Frequency "
+ ||" Where Code = " || SQL(temp_Cell_Frequency_Value) };
+ Endif;
+
+ // compare prior row frequency with current row frequency to determine if
+ // frequency is increasing, decreasing, or staying the same.
+ If dosingtype <> "DosePak" Then
+ If priorfreqtype = 2 and freqtype = 1 then
+ dosingtype := "increasing";
+ freqspan := freqtype;
+ elseif priorfreqtype = 1 and freqtype = 2 then
+ dosingtype := "decreasing";
+ priorfreqspan := priorfreqtype;
+ elseif priorfreqtype = 2 and freqtype = 2 then
+ if priorfreqspan > freqspan then
+ dosingtype := "increasing";
+ elseif priorfreqspan < freqspan then
+ dosingtype := "decreasing";
+ else dosingtype := "same";
+ endif;
+ elseif priorfreqtype = 1 and freqtype = 1 then
+ dosingtype := "same";
+ priorfreqspan := priorfreqtype;
+ freqspan := freqtype;
+ endif;
+ endif;
+
+ //Capture the Route value and add to the RX Summary if found
+ temp_Cell_Route := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "OrderRouteCode");
+ temp_Cell_Route_Value:=temp_Cell_Route.ItemValue;
+
+ //Update the RX Summary if a value was found
+ If temp_Cell_Route_Value Is Not NULL and dosingtype <> "DosePak" Then
+ RX_Summary := RX_Summary || ", " || temp_Cell_Route_Value;
+ Endif;
+
+ //Capture the Stop After value and add to the RX Summary if found
+ temp_Cell_StopAfter := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "StopAfter");
+ temp_Cell_ItemValue:=temp_Cell_StopAfter.ItemValue;
+ temp_Cell_NUMBER_Value:=temp_Cell_ItemValue.NUMBER;
+ temp_Cell_Option_Value:=temp_Cell_ItemValue.Option;
+
+
+ prior_Cell_StopAfter := first of (prior_Cell_Row where prior_Cell_Row.DataItemCode = "StopAfter");
+ prior_Cell_ItemValue:=prior_Cell_StopAfter.ItemValue;
+ prior_Cell_NUMBER_Value:=prior_Cell_ItemValue.NUMBER;
+ prior_Cell_Option_Value:=prior_Cell_ItemValue.Option;
+
+
+ //Update the RX Summary if a value was found
+ If temp_Cell_Option_Value Is Not NULL and dosingtype <> "DosePak" Then
+ RX_Summary := RX_Summary || " for " || temp_Cell_NUMBER_Value || SP || temp_Cell_Option_Value || SP ;
+ endif;
+
+
+ temp_Cell_Start := first of (temp_Cell_Row where temp_Cell_Row.DataItemCode = "RequestedDate");
+ temp_Cell_Start_Value:=temp_Cell_Start.ItemValue;
+
+ prior_Cell_Start := first of (prior_Cell_Row where prior_Cell_Row.DataItemCode = "RequestedDate");
+ prior_Cell_Start_Value:=prior_Cell_Start.ItemValue;
+
+ If prior_Cell_Start_Value Is Not NULL and FirstEntry = "No" and prior_Cell_Option_Value = "Days" and dosingtype <> "DosePak" Then
+ PriorNumdays := prior_Cell_ItemValue.NUMBER;
+ // determine start date of current row dependent upon frequency and duration of current and
+ // prior row. (Increasing, decreasing or same)
+ If dosingtype = "decreasing" or dosingtype = "same" then
+ Calc_duration := (Priornumdays as number) - 1;
+ Offsetdays := Calc_duration - (PriorFreqSpan *(Int(Calc_duration /PriorFreqSpan)));
+ Addtodate := Calc_duration + FreqSpan - offsetdays;
+ temp_Cell_Start.ItemValue := prior_Cell_Start_Value + addtodate day ;
+ yr := extract year temp_Cell_Start.ItemValue ;
+ mn := extract month temp_Cell_Start.ItemValue ; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day temp_Cell_Start.ItemValue ; if dd < 10 then dd := "0" || dd; endif;
+ DisplayDate := mn || "-" || dd || "-" || yr ;
+ elseif dosingtype = "increasing" then
+ Calc_duration := (Priornumdays as number) - 1;
+ Offsetdays := Calc_duration - (PriorFreqSpan *(Int(Calc_duration /PriorFreqSpan)));
+ Addtodate := Calc_duration + PriorFreqSpan - offsetdays;
+ temp_Cell_Start.ItemValue := prior_Cell_Start_Value + addtodate day ;
+ yr := extract year temp_Cell_Start.ItemValue ;
+ mn := extract month temp_Cell_Start.ItemValue ; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day temp_Cell_Start.ItemValue ; if dd < 10 then dd := "0" || dd; endif;
+ DisplayDate := mn || "-" || dd || "-" || yr ;
+ endif;
+
+ RX_Summary := RX_Summary || CRLF || " Begin: " || DisplayDate || SP || EndMessage|| CRLF;
+
+ elseIf prior_Cell_Start_Value Is NULL and FirstEntry = "Yes" and temp_Cell_Option_Value = "Days" and dosingtype <> "DosePak" Then
+ yr := extract year temp_Cell_Start.ItemValue ;
+ mn := extract month temp_Cell_Start.ItemValue ; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day temp_Cell_Start.ItemValue ; if dd < 10 then dd := "0" || dd; endif;
+ DisplayDate := mn || "-" || dd || "-" || yr ;
+ RX_Summary := RX_Summary || CRLF || " Begin: " || DisplayDate || SP || EndMessage || CRLF;
+
+ elseIf prior_Cell_Start_Value Is NULL and dosingtype = "DosePak" Then
+ yr := extract year temp_Cell_Start.ItemValue ;
+ mn := extract month temp_Cell_Start.ItemValue ; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day temp_Cell_Start.ItemValue ; if dd < 10 then dd := "0" || dd; endif;
+ StartingDisplayDate := mn || "-" || dd || "-" || yr ;
+ elseIf prior_Cell_Start_Value Is Not NULL and dosingtype = "DosePak" Then
+ RX_Summary := "Start on " || StartingDisplayDate || CRLF ||
+ "Day 1: 2 tabs before breakfast, 1 tab after lunch, 1 tab after dinner, 2 tabs at bedtime" || CRLF ||
+ "Day 2: 1 tab before breakfast, 1 tab after lunch, 1 tab after dinner, 2 tabs at bedtime" || CRLF ||
+ "Day 3: 1 tab before breakfast, 1 tab after lunch, 1 tab after dinner, 1 tab at bedtime" || CRLF ||
+ "Day 4: 1 tab before breakfast, 1 tab after lunch, 1 tab at bedtime" || CRLF ||
+ "Day 5: 1 tab before breakfast, 1 tab at bedtime" || CRLF ||
+ "Day 6: 1 tab before breakfast";
+ endif;
+
+
+ Endif; //A Row has a Dose
+ enddo; //End of Row List Loop
+ Endif; //DosageLow was found with a value
+ Endif; //DosageLow was found
+
+// this section is for complex frequency dosing
+/*
+ //Look for a Complex Frequency and Update th RX Comments accordingly
+ Freq_field := first of (field_list where field_list.DataItemName = "FrequencyCode");
+ If exists Freq_field then FreqValue:= Freq_field.Value;
+ // If DosingOption sub-field exists, this is a Frequency Grid
+ If exists FreqValue.DosingOption and FreqValue.DosingOption is NOT NULL then
+ // Get Grid information
+ AllowRowAddRemove := FreqValue.AllowRowAddRemove;
+ ConfigAllowRowAddRemove := FreqValue.ConfigAllowRowAddRemove;
+ // Get Row information
+ GridRows:= FreqValue.Rows;
+
+ //Explode the Complex Dosing Option Freq if found and update the RX Comments field for conversion to a prescription
+ If Exist GridRows then
+ // Build a list of found rows and columns of the dosing option grid
+ index_list_fq := 0 seqto ( count GridRows );
+ Total_Rows_fq := count GridRows;
+
+ for M in index_list_fq do
+
+ //Get the Frequency Code
+ temp_FreqSummary :=Last(First M from GridRows.FrequencySummary);
+ //Update the RX Summary if a value was found
+ If temp_FreqSummary Is Not NULL Then
+ //If the last row then indicate the last like the application does
+ If M = Total_Rows_fq Then
+ RX_Summary := RX_Summary || CRLF || "Last: " || temp_FreqSummary || SP;
+ ElseIf RX_Summary Is Null then
+ RX_Summary := "Start: " || temp_FreqSummary || SP;
+ Else
+ RX_Summary := RX_Summary || CRLF || "Then: " || temp_FreqSummary || SP;
+ Endif;
+ Endif;
+
+ //Get the Frequency From Time
+ temp_FreqFromTime :=Last(First M from GridRows.FreqFromTime);
+ //Update the RX Summary if a value was found
+ If temp_FreqFromTime > 0 Then
+ RX_Summary := RX_Summary || "From: " || temp_FreqFromTime || SP;
+ Endif;
+
+ //Get the Frequency To Time
+ temp_FreqToTime :=Last(First M from GridRows.FreqToTime);
+ //Update the RX Summary if a value was found
+ If temp_FreqToTime > 0 Then
+ RX_Summary := RX_Summary || "To: " || temp_FreqToTime || SP;
+ Endif;
+
+ //Get the Frequency FreqEventModifier
+ temp_FreqEventModifier :=Last(First M from GridRows.FreqEventModifier);
+ //Update the RX Summary if a value was found
+ If temp_FreqEventModifier Is Not NULL Then
+ RX_Summary := RX_Summary || temp_FreqEventModifier || SP;
+ Endif;
+
+ //Get the Frequency FreqEventCode
+ temp_FreqEventCode :=Last(First M from GridRows.FreqEventCode);
+ //Update the RX Summary if a value was found
+ If temp_FreqEventCode Is Not NULL Then
+ RX_Summary := RX_Summary || temp_FreqEventCode || SP;
+ Endif;
+
+ //Get the Frequency Stop After Value
+ temp_StopAfterNumber :=Last(First M from GridRows.StopAfterNumber);
+ //Update the RX Summary if a value was found
+ If temp_StopAfterNumber Is Not NULL Then
+ RX_Summary := RX_Summary || "Stop After: " || temp_StopAfterNumber || SP;
+ Endif;
+ temp_StopAfterOption :=Last(First M from GridRows.StopAfterOption);
+ //Update the RX Summary if a value was found
+ If temp_StopAfterOption Is Not NULL Then
+ RX_Summary := RX_Summary || temp_StopAfterOption || SP;
+ Endif;
+
+ //Reserve for Future Use
+ //Found_DataItemCode1:= Found_Freq.DataItemCode1;
+ //Found_DataItemValue1:= Found_Freq.DataItemValue1;
+ //Found_DataItemCode2:= Found_Freq.DataItemCode2;
+ //Found_DataItemValue2:= Found_Freq.DataItemValue2;
+ //Found_DataItemCode3:= Found_Freq.DataItemCode3;
+ //Found_DataItemValue3:= Found_Freq.DataItemValue3;
+ //Found_DataItemCode4:= Found_Freq.DataItemCode4;
+ //Found_DataItemValue4:= Found_Freq.DataItemValue4;
+ //Found_DataItemCode5:= Found_Freq.DataItemCode5;
+ //Found_DataItemValue5:= Found_Freq.DataItemValue5;
+
+ Enddo; //End of Grid Row Loop
+ Endif; //Grid Row exists
+ ENDIF; //The Frequency is a dosing option type
+ ENDIF; //FrequencyCode was found
+*/
+ //Update the RX Comments UDDI with the Variable DOse or Multiple Frequency option.
+ If RX_Summary Is not NULL then
+ //The RX WRiter Sig Comment UDDI can only handle 2000 characters so trim to fit on form
+ if (length RX_Summary) > 2000 then
+ RX_Summary_Truncate := (substring 1997 characters starting at 1 from RX_Summary) || "...";
+ RX_Comments_field.Value := RX_Summary_Truncate;
+ Else
+ RX_Comments_field.Value := RX_Summary;
+ Endif; //Update RX Comments
+
+ //Add a note to the RX Instructions field (if exists) which displays when converting to a Home Medication.
+ //Note - This field can only accomodate 140 chracters at this time so it will be truncated.
+ //Check for the RX Instructions:
+ RX_Instructions_field := first of (field_list where field_list.DataItemName = "Rx Instructions");
+ If exists RX_Instructions_field then
+ // If (length RX_Summary) > 140 then
+ // RX_Instructions_Truncate := (substring 137 characters starting at 1 from RX_Summary) || "...";
+ If (length RX_Summary) > 500 then
+ RX_Instructions_Truncate := (substring 497 characters starting at 1 from RX_Summary) || "...";
+ RX_Instructions_field.Value := RX_Instructions_Truncate;
+ Else
+ RX_Instructions_field.Value := RX_Summary;
+ Endif;
+ Endif;
+ Endif; //An RX Summary was found
+
+ //The Field was not on the Order Form
+ Elseif RX_Summary Is not NULL Then
+
+ error_message := "The RX Comment Data Item was not found on the form and a Complex Dose was entered.";
+
+ Endif; //The RX Comments UDDI was found on the form
+
+
+ If error_message <> "" Then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "error_message";
+ this_communication.MessageType := "Informational";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_PCA_FIELD_EDITS.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_PCA_FIELD_EDITS.mlm
new file mode 100644
index 0000000..b8e9c28
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_PCA_FIELD_EDITS.mlm
@@ -0,0 +1,412 @@
+maintenance:
+
+ title: Ordering: PCA ordering ;;
+ mlmname: FORM_Rx_PCA_Field_Edits;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Isolation Set MLM;;
+ author: Don Warnick, Eclipsys Corp;;
+ specialist: ;;
+ date: 2006-04-06;;
+ validation: testing;;
+
+library:
+ purpose: Change the status of fields based upon the infusion selected
+
+ ;;
+
+ explanation: This MLM is called from the PRX_ljPCA form. It ensures that the correct fields are populated and the correct
+ frequency is attached to PCA orders based upon the method of delivery.
+
+ change history
+ 12.13.2007 DJW Added additional code for new "No Lockout" and "Standard Lockout" check boxes.
+ 02.15.2013 TMS Added logic to allow a "No Lockout" or "Other Lockout" to the hydromorphone 6mg/30ml concentration
+ when ordered by or on behalf of Dr. Rivero for pain management orders. If Dr. Rivero is not the
+ ordering care provider the user cannot see the checkboxes for no lockout or other lockout. CSR 31172
+ 12.03.2015 GOS CSR :33435 & 33436 - on selection other PCA Alone, Cont Insulation, Cont Infusion we display, Hide and Make Madatory PCA reason 1 and PCA Reason 2
+ 11.14.2018 TMS CSR 37423 Add logic to auto select Standard Lockout when switching between continuous and patient controlled. Physician no longer at St. Clair
+ leaving logic in case new pain med doctors ever want to choose between other and no lockout.
+
+
+ ;;
+ keywords: Called MLMs, Form fields, PCA
+ ;;
+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;
+ /***************************************************************************************/
+ comm_obj := this_communication.primaryobj;
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ OrderingPhysician := this_communication.CareProviderDisplayName;
+
+
+ pca := last of (field_list where field_list.DataItemName = "PRX_Pca" );
+ pcacontinuous:= last of (field_list where field_list.DataItemName = "PRX_PcaContinuous" );
+ pcaplus := last of (field_list where field_list.DataItemName = "PRX_PcaPlus" );
+ stdlockout := last of (field_list where field_list.DataItemName = "PRX_SP08" );
+ nolockout := last of (field_list where field_list.DataItemName = "PRX_SP09" );
+ otherlockout := last of (field_list where field_list.DataItemName = "PRX_SP10" );
+ stdlockoutval:= last of (field_list where field_list.DataItemName = "PRX_PcaLockoutStdValue" );
+ rnadmdose := last of (field_list where field_list.DataItemName = "PRX_ZXO01" );
+ rnadmunits := last of (field_list where field_list.DataItemName = "PRX_ZXO02" );
+ maxdose := last of (field_list where field_list.DataItemName = "PRX_ZXO03" );
+ unitsmg2 := last of (field_list where field_list.DataItemName = "PRX_ZXO04" );
+ patadmindose := last of (field_list where field_list.DataItemName = "PRX_ZXO05" );
+ unitsmg1 := last of (field_list where field_list.DataItemName = "PRX_ZXO06" );
+ everyfreq := last of (field_list where field_list.DataItemName = "PRX_ZXO07" );
+ unitsminutes := last of (field_list where field_list.DataItemName = "PRX_ZXO08" );
+ continrate := last of (field_list where field_list.DataItemName = "PRX_ZXO09" );
+ unitsmghr := last of (field_list where field_list.DataItemName = "PRX_ZXO10" );
+ bolusprn := last of (field_list where field_list.DataItemName = "PRX_ZXO11" );
+ bolusprnunits:= last of (field_list where field_list.DataItemName = "PRX_ZXO12" );
+ bolusint := last of (field_list where field_list.DataItemName = "PRX_ZXO15" );
+ bolusintunits:= last of (field_list where field_list.DataItemName = "PRX_ZXO16" );
+
+ frequency := last of (field_list where field_list.DataItemName = "FrequencyCode" );
+ freq_Val := frequency.Value;
+ prn := last of (field_list where field_list.DataItemName = "IsPRN" );
+ perminfo := last of (field_list where field_list.DataItemName = "PRX_PermOrderInfo" );
+ tempinfo := last of (field_list where field_list.DataItemName = "PRX_TempOrderInfo" );
+ // Added By Shivprasad
+ PCA_Reason1 := last of ( field_list WHERE field_list.DataItemName = "PRX_PCA Reason1" );
+ PCA_Reason2 := last of ( field_list WHERE field_list.DataItemName = "PRX_PCA Reason2" );
+ PCA_Condition := last of ( field_list WHERE field_list.DataItemName = "PRX_PRNCONDITION" ) ;
+
+ If CallingEvent = "FormOpen" and (this_communication.CareProviderDisplayName = "Spicuzza, Teresa" or
+ this_communication.CareProviderDisplayName = "Rivero-Becerra, Jorge R") then
+ painmgtorder := true;
+ nolockout.control_read_only := False;
+ nolockout.control_visible := True;
+ otherlockout.control_read_only := False;
+ otherlockout.control_visible := True;
+ else
+ painmgtorder := false;
+ endif;
+
+ If CallingEvent = "FormOpen" and (this_communication.CareProviderDisplayName = "Spicuzzatest, Teresa" or
+ this_communication.CareProviderDisplayName = "Rivero-Becerra, Jorge R") then
+ painmgtorder := true;
+ nolockout.control_read_only := False;
+ nolockout.control_visible := True;
+ otherlockout.control_read_only := False;
+ otherlockout.control_visible := True;
+ else
+ painmgtorder := false;
+ endif;
+
+
+ // Start : Added By Shivprasad Jadhav for CSR #
+ If comm_obj.Name ="Hydromorphone PCA (30mg/30ml)" Then
+ pcaconcentrated := "True" ;
+ Elseif comm_obj.Name ="Hydromorphone PCA (6mg/30ml)" Then
+ pcaconcentrated := "False" ;
+ stdlockout.Value := true ;
+ Elseif comm_obj.Name ="Morphine PCA" Then
+ pcaconcentrated := "False" ;
+ Endif;
+
+ If CallingEvent="FormClose"
+ then
+
+ tempinfo.value := "";
+
+ If (pca.value = False) and
+ (pcacontinuous.value = False) and
+ (pcaplus .value = False)
+ then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "No PCA mode of delivery was selected" || "\n" || "\n" || "Please check at least one of the boxes";
+ this_communication.MessageType := "Error";
+
+ elseif (stdlockout.value = False) and
+ (nolockout.value = False) and
+ (otherlockout .value = False) and
+ (pcacontinuous.value = False)
+ then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "No lockout value was selected" || "\n" || "\n" || "Please check at least one of the boxes";
+ this_communication.MessageType := "Error";
+ endif;
+ endif;
+
+ If (CallingField = "Prx_PCA" and pca.value = True) or (CallingEvent = "FormOpen" and pca.value = True)
+ then
+ pcacontinuous.value := False;
+ pcaplus.value := False;
+ patadmindose.control_mandatory := True;
+ patadmindose.control_read_only := False;
+ unitsmg1.value := "mg";
+ unitsmg1.control_mandatory := True;
+ unitsmg1.control_read_only := True;
+ everyfreq.control_mandatory := True;
+ everyfreq.control_read_only := False;
+ unitsminutes.value := "minutes";
+ unitsminutes.control_mandatory := True;
+ unitsminutes.control_read_only := True;
+ freq_Val.FrequencySummary := "As Ordered";
+ frequency.Value := freq_Val;
+ prn.value := True;
+ prn.control_read_only := True;
+ continrate.value := "";
+ continrate.control_mandatory := False;
+ continrate.control_read_only := True;
+ unitsmghr.value := "";
+ unitsmghr.control_mandatory := False;
+ unitsmghr.control_read_only := True;
+
+ nolockout.control_read_only := False;
+ stdlockout.control_read_only := False;
+ otherlockout.control_read_only := False;
+
+ If pcaconcentrated = "True" Then
+ PCA_Reason1.Control_Visible := False ;
+ PCA_Reason2.Control_Visible := True ;
+ PCA_Reason2.Control_Read_Only:=False ;
+ PCA_Reason2.Control_Mandatory := True ;
+ Elseif pcaconcentrated = "False" Then
+ PCA_Reason1.Control_Visible := True ;
+ PCA_Reason2.Control_Visible := False ;
+ PCA_Reason1.Control_Read_Only:= True ;
+ PCA_Reason1.Control_Mandatory := False ;
+ Endif;
+
+ If stdlockout.Value = true then
+ maxdose.value := stdlockoutval.value;
+ unitsmg2.value := "mg";
+ endif;
+
+
+
+
+
+ elseif (CallingField = "Prx_PcaPlus" and pcaplus.value = True) or (CallingEvent = "FormOpen" and pcaplus.value = True)
+ then
+ pca.value := False;
+ pcacontinuous.value := False;
+ patadmindose.control_mandatory := True;
+ patadmindose.control_read_only := False;
+ unitsmg1.value := "mg";
+ unitsmg1.control_mandatory := True;
+ unitsmg1.control_read_only := True;
+ everyfreq.control_mandatory := True;
+ everyfreq.control_read_only := False;
+ unitsminutes.value := "minutes";
+ unitsminutes.control_mandatory := True;
+ unitsminutes.control_read_only := True;
+ freq_Val.FrequencySummary := "";
+ frequency.Value := freq_Val;
+ prn.value := False;
+ prn.control_read_only := True;
+ continrate.control_mandatory := True;
+ continrate.control_read_only := False;
+ unitsmghr.value := "mg/hr";
+
+ nolockout.control_read_only := False;
+ stdlockout.control_read_only := False;
+ otherlockout.control_read_only := False;
+
+ If pcaconcentrated = "True" Then
+ PCA_Reason1.Control_Visible := False ;
+ PCA_Reason2.Control_Visible := True ;
+ PCA_Reason2.Control_Read_Only:=False ;
+ PCA_Reason2.Control_Mandatory := True ;
+ Elseif pcaconcentrated = "False" Then
+ PCA_Reason1.Control_Visible := True ;
+ PCA_Reason2.Control_Visible := False ;
+ PCA_Reason1.Control_Read_Only:= False ;
+ PCA_Reason1.Control_Mandatory := True ;
+ Endif;
+
+ If stdlockout.value = true then
+ maxdose.value := stdlockoutval.value;
+ unitsmg2.value := "mg";
+ endif;
+
+
+ elseif (CallingField = "PRX_PcaContinuous" and pcacontinuous.value = True) or (CallingEvent = "FormOpen" and pcacontinuous.value = True)
+ then
+ pca.value := False;
+ pcaplus.value := False;
+ patadmindose.value := "";
+ patadmindose.control_mandatory := False;
+ patadmindose.control_read_only := True;
+ unitsmg1.value := "";
+ unitsmg1.control_mandatory := False;
+ unitsmg1.control_read_only := True;
+ everyfreq.value := "";
+ everyfreq.control_mandatory := False;
+ everyfreq.control_read_only := True;
+ unitsminutes.value := "";
+ unitsminutes.control_mandatory := False;
+ unitsminutes.control_read_only := True;
+ maxdose.value := "";
+ maxdose.control_mandatory := False;
+ maxdose.control_read_only := True;
+ unitsmg2.value := "";
+ unitsmg2.control_mandatory := False;
+ unitsmg2.control_read_only := True;
+ freq_Val.FrequencySummary := "";
+ frequency.Value := freq_Val;
+ prn.value := False;
+ prn.control_read_only := True;
+ continrate.control_mandatory := True;
+ continrate.control_read_only := False;
+ unitsmghr.value := "mg/hr";
+
+ nolockout.value := False;
+ nolockout.control_read_only := True;
+ stdlockout.value := False;
+ stdlockout.control_read_only := True;
+ otherlockout.value := False;
+ otherlockout.control_read_only := True;
+
+ If pcaconcentrated = "True" Then
+ PCA_Reason1.Control_Visible := False ;
+
+ PCA_Reason2.Control_Visible := True ;
+ PCA_Reason2.Control_Read_Only:=False ;
+ PCA_Reason2.Control_Mandatory := True ;
+ Elseif pcaconcentrated = "False" Then
+ PCA_Reason1.Control_Visible := True ;
+ PCA_Reason2.Control_Visible := False ;
+ PCA_Reason1.Control_Read_Only:= False ;
+ PCA_Reason1.Control_Mandatory := True ;
+ Endif;
+ endif;
+
+ If (CallingField = "PRX_SP08" and stdlockout.value = True) or (CallingEvent = "FormOpen" and stdlockout.value = True)
+ then
+ maxdose.control_mandatory := False;
+ maxdose.control_read_only := True;
+ maxdose.value := stdlockoutval.value;
+ unitsmg2.value := "mg";
+ unitsmg2.control_mandatory := True;
+ unitsmg2.control_read_only := True;
+ nolockout.value := False;
+ otherlockout.value := False;
+
+
+ elseif (CallingField = "PRX_SP09" and nolockout.value = True) or (CallingEvent = "FormOpen" and nolockout.value = True)
+ then
+ maxdose.control_mandatory := False;
+ maxdose.control_read_only := True;
+ maxdose.value := " ";
+ unitsmg2.value := " ";
+ unitsmg2.control_mandatory := False;
+ unitsmg2.control_read_only := True;
+ stdlockout.value := False;
+ otherlockout.value := False;
+
+ elseif (CallingField = "PRX_SP10" and otherlockout.value = True) or (CallingEvent = "FormOpen" and otherlockout.value = True)
+ then
+ maxdose.control_mandatory := True;
+ maxdose.control_read_only := False;
+ maxdose.value := " ";
+ unitsmg2.value := "mg";
+ unitsmg2.control_mandatory := False;
+ unitsmg2.control_read_only := True;
+ stdlockout.value := False;
+ nolockout.value := False;
+
+
+ endif;
+
+ If CallingField = "PRX_ZXO01" then
+ If rnadmdose.value <> " " then rnadmunits.value := "mg";
+ elseif rnadmdose.value is null then rnadmunits.value := " ";
+ endif;
+ endif;
+
+
+ If CallingField = "PRX_ZXO11" then
+ If bolusprn.value <> " " then bolusprnunits.value := "mg";
+ elseif bolusprn.value is null then bolusprnunits.value := " ";
+ endif;
+ endif;
+
+
+ If CallingField = "PRX_ZXO15" then
+ If bolusint.value <> " " then bolusintunits.value := "hours";
+ elseif bolusint.value is null then bolusintunits.value := " ";
+ endif;
+ endif;
+
+ // Added By Shivprasad Jadhav
+ If (CallingField = "PRX_PCA Reason1" and PCA_Reason1.Value Is Not Null ) or (CallingEvent = "FormOpen" And PCA_Reason1.Value Is Not Null )
+ or (CallingField = "PRX_PCA Reason2" and PCA_Reason2.Value Is Not Null ) or (CallingEvent = "FormOpen" And PCA_Reason2.Value Is Not Null )
+ Then
+
+ If PCA_Reason1.Value Is Not Null Then
+ If PCA_Reason1.Value ="Recommended by Pain Management Consultant" Then
+ SelectionVal1 := "Pain Mgt Consult" ;
+ Elseif PCA_Reason1.Value ="End of Life" Then
+ SelectionVal1 := "End of Life" ;
+ Elseif PCA_Reason1.Value ="Inadequate Pain Response to IV Narcotics over a 24 hour period" Then
+ SelectionVal1 := "Inadequate pain response over 24hrs" ;
+ Elseif PCA_Reason1.Value ="Chronic narcotic use prior to admission" Then
+ SelectionVal1 := "Chronic narcotic use" ;
+ Else
+ SelectionVal1 := "" ;
+ Endif;
+
+ ElseIf PCA_Reason2.Value Is Not Null Then
+ If PCA_Reason2.Value ="Recommended by Pain Management Consultant" Then
+ SelectionVal1 := "Pain Mgt Consult" ;
+ Elseif PCA_Reason2.Value ="End of Life" Then
+ SelectionVal1 := "End of Life" ;
+ Elseif PCA_Reason2.Value ="Oncology patient receiving escalating doses of IV hydromorphone with inadequate pain relief" Then
+ SelectionVal1 := "Onc. Pt with inadequate pain relief" ;
+ Else
+ SelectionVal1 := "" ;
+ Endif;
+ Elseif ((PCA_Reason1.Value = Null) And (PCA_Reason2.Value = Null) ) Then
+ SelectionVal1 := "" ;
+ Endif;
+
+ PCA_Condition.Value := SelectionVal1 ;
+ PCA_Condition.Control_Visible := True;
+
+ Endif;
+
+
+
+
+/* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "MLM Field :" || CallingField || "\n" ||
+ "MLM Event :" || CallingEvent || "\n" ||
+ "Freq Val:" || freq_Val || "\n" ||
+ "Freq Summary: " || freq_Val.FrequencySummary;
+ this_communication.MessageType := "Informational"; */
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_PEDIATRIC_ACETAMINOPHEN.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_PEDIATRIC_ACETAMINOPHEN.mlm
new file mode 100644
index 0000000..7b22825
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_PEDIATRIC_ACETAMINOPHEN.mlm
@@ -0,0 +1,145 @@
+maintenance:
+
+ title: Pediatric Acetaminophen Dosing Message;;
+ mlmname: FORM_Rx_Pediatric_Acetaminophen;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-11-18;;
+ validation: testing;;
+
+library:
+ purpose: Used for displaying correct recommended daily dosage of acetaminophen
+ ;;
+
+ explanation: This MLM is called from PRX forms that are attached to orders containing acetaminophen.
+
+ Change history
+ 04.03.2012 TMS Change informational message for maximum dose for pediatric patients based upon
+ patient weight and age. Created for CSR 26905
+ 01.30.2013 TMS Changed call to "Form_HoldOrder_RequestedTime" MLM to be on FormOpen only. That MLM
+ has been updated with additional logic for Now and Then dosing that must be initiated
+ even if the order is not in a hold session. CSR 26926
+ 07.23.2013 TMS Change informational message for maximum dose for non pediatric patients to 3gms for
+ all orders except IV acetaminophen which remains at 4gms. CSR 30976
+ 10.09.2013 TMS Change informational message for maximum dose for pediatric patients from 90mg/kg/day to
+ 75mg/kg/day. HD Ticket 161277
+ 04.11.2017 TMS Changed MLM to be called from "Form_HoldOrder_RequestedTime" to keep calls on FormOpen
+ from one {{{SINGLE-QUOTE}}}master{{{SINGLE-QUOTE}}} MLM, being done in preparation for using hidden default dosing CSR 35364.
+
+ ;;
+ keywords: Called MLMs, Acetaminophen, pediatric 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";
+
+ // 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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ // CallingEvent := this_communication.CallingEvent;
+ // CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ChartGuid := this_Communication.ChartGUID;
+ Order_Name := this_communication.PrimaryObj.Name;
+ comm_obj := this_communication.primaryobj;
+ called_by := this_communication.CallingEvent;
+ call_field := this_communication.CallingFieldName;
+ session_type := comm_obj.internalprocessingtype;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+
+ Note_fld := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+ Ped_message := "Do not exceed maximum pediatric Acetaminophen dose of 75mg/kg/24 hours from all sources.";
+ Std_message := "Do not exceed 3gm of Acetaminophen daily from oral/rectal sources." || CRLF ||
+ "As of July 2013, total daily acetaminophen dose is now 3gm/day per Med Exec.";
+ nomessage := " ";
+
+ // if hold session set requested time to scheduled/start time with no time specified
+ // if not hold session call MLM for other "start now logic"
+// if called_by ="FormOpen" and session_type = "Hold" then
+// if called_by ="FormOpen" then
+// 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 Order_name matches pattern "%Acetaminophen%" then
+ Ped_message := "Do not exceed maximum pediatric Acetaminophen dose of 75mg/kg/24 hours from all sources.";
+
+ If Order_name matches pattern "% Inj" then
+ Std_message := "Do not exceed 4gm of Acetaminophen daily from all sources.";
+ else
+ Std_message := "Do not exceed 3gm of Acetaminophen daily from oral/rectal sources." || CRLF ||
+ "As of July 2013, total daily acetaminophen dose is now 3gm/day per Med Exec.";
+ endif;
+
+ WeightValue, obsname := read last {"Select o.ValueText, oci.name from CV3ClientDocumentcur cd "
+ || " join CV3ClientDocDetailcur cdd on (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || SQL(ClientGuid) || ") "
+ || " join CV3ObservationDocumentcur od on cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
+ || " join CV3ObsCatalogMasterItem on od.ObsMasterItemGUID = CV3ObsCatalogMasterItem.GUID "
+ || " join CV3Observationcur o on o.GUID = od.ObservationGUID "
+ || " LEFT OUTER JOIN CV3User u ON o.UserGUID = u.GUID "
+ || " join cv3obscatalogitem oci on oci.guid = o.obsitemguid and oci.name in ({{{SINGLE-QUOTE}}}Weight in kg - Peds{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}})"
+ || " where cd.clientguid = " || SQL(ClientGuid) || " and cd.chartguid = " || SQL(ChartGuid)
+ || " and o.ValueText is not null "
+ || " order by cd.authoreddtm asc " };
+
+
+ if exists (client_info_obj) then
+ (birthdate,dobM,dobD,dobY) := read last {ClientInfo: BirthDate, BirthMonthNum, BirthDayNum, BirthYearNum
+ REFERENCING client_info_obj};
+ endif;
+
+ patientAge := (NOW - birthdate) / (1 year);
+
+
+ if (patientAge < 18.00) and (((weightvalue as number) <= 43.2) or (weightvalue is null)) then
+ Note_fld.value := Ped_message;
+ else
+ Note_fld.value := Std_message;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_PT_CONTROLLED_EPIDURAL_ANALGESIA.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_PT_CONTROLLED_EPIDURAL_ANALGESIA.mlm
new file mode 100644
index 0000000..390f150
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_PT_CONTROLLED_EPIDURAL_ANALGESIA.mlm
@@ -0,0 +1,200 @@
+maintenance:
+
+ title: Ordering: PCEA ordering ;;
+ mlmname: FORM_Rx_Pt_Controlled_Epidural_Analgesia;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St Clair;;
+ author: Teresa Spicuzza;;
+ specialist: ;;
+ date: 2019-01-08;;
+ validation: testing;;
+
+library:
+ purpose: Change the status of fields based upon the mode of delivery selected
+
+ ;;
+
+ explanation:
+
+ change history
+ 12.11.2018 TMS CSR 37375 Created similar to PCA order and MLM
+
+
+ ;;
+ keywords: Called MLMs, Form fields, PCEA
+ ;;
+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;
+ /***************************************************************************************/
+
+ comm_obj := this_communication.primaryobj;
+ // Initialize error message
+ error_message:="";
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ // OrderingPhysician := this_communication.CareProviderDisplayName;
+
+
+ pcacontinuous := last of (field_list where field_list.DataItemName = "PRX_PcaContinuous" );
+ pcaplus := last of (field_list where field_list.DataItemName = "PRX_PcaPlus" );
+ CRNAAdminDose := last of (field_list where field_list.DataItemName = "PRX_ZXO01" );
+ CRNADoseUnits := last of (field_list where field_list.DataItemName = "PRX_ZXO02" );
+ PtAdminDose := last of (field_list where field_list.DataItemName = "PRX_ZXO05" );
+ PtAdminUnits := last of (field_list where field_list.DataItemName = "PRX_ZXO06" );
+ PtAdminFreq := last of (field_list where field_list.DataItemName = "PRX_ZXO07" );
+ PtAdminFreqUnits:= last of (field_list where field_list.DataItemName = "PRX_ZXO08" );
+ BasalRate := last of (field_list where field_list.DataItemName = "PRX_ZXO09" );
+ BasalRateUom := last of (field_list where field_list.DataItemName = "PRX_ZXO10" );
+
+ frequency := last of (field_list where field_list.DataItemName = "FrequencyCode" );
+ freq_Val := frequency.Value;
+ prn := last of (field_list where field_list.DataItemName = "IsPRN" );
+
+ If CallingEvent = "FormClose" then
+
+ If (pca.value = False) and
+ (pcacontinuous.value = False) and
+ (pcaplus .value = False)
+ then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "No PCA mode of delivery was selected" || "\n" || "\n" || "Please check at least one of the boxes";
+ this_communication.MessageType := "Error";
+
+ elseif (stdlockout.value = False) and
+ (nolockout.value = False) and
+ (otherlockout .value = False) and
+ (pcacontinuous.value = False)
+ then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "No lockout value was selected" || "\n" || "\n" || "Please check at least one of the boxes";
+ this_communication.MessageType := "Error";
+ endif;
+ endif;
+
+
+
+ If (CallingField = "Prx_PcaPlus" and pcaplus.value = True) or (CallingEvent = "FormOpen" and pcaplus.value = True)
+ then
+ pca.value := False;
+ pcacontinuous.value := False;
+ PtAdminDose.control_mandatory := True;
+ PtAdminDose.control_read_only := False;
+ PtAdminUnits.value := "ml";
+ PtAdminUnits.control_mandatory := True;
+ PtAdminUnits.control_read_only := True;
+ PtAdminFreq.control_mandatory := True;
+ PtAdminFreq.control_read_only := False;
+ PtAdminFreqUnits.value := "minutes";
+ PtAdminFreqUnits.control_mandatory := True;
+ PtAdminFreqUnits.control_read_only := True;
+ freq_Val.FrequencySummary := "";
+ frequency.Value := freq_Val;
+ prn.value := False;
+ prn.control_read_only := True;
+ BasalRate.control_mandatory := True;
+ BasalRate.control_read_only := False;
+ BasalRateUom.value := "ml/hr";
+
+
+ elseif (CallingField = "PRX_PcaContinuous" and pcacontinuous.value = True) or (CallingEvent = "FormOpen" and pcacontinuous.value = True)
+ then
+ pcaplus.value := False;
+ PtAdminDose.value := "";
+ PtAdminDose.control_mandatory := False;
+ PtAdminDose.control_read_only := True;
+ PtAdminUnits.value := "";
+ PtAdminUnits.control_mandatory := False;
+ PtAdminUnits.control_read_only := True;
+ PtAdminFreq.value := "";
+ PtAdminFreq.control_mandatory := False;
+ PtAdminFreq.control_read_only := True;
+ PtAdminFreqUnits.value := "";
+ PtAdminFreqUnits.control_mandatory := False;
+ PtAdminFreqUnits.control_read_only := True;
+ freq_Val.FrequencySummary := "";
+ frequency.Value := freq_Val;
+ prn.value := False;
+ prn.control_read_only := True;
+ BasalRate.control_mandatory := True;
+ BasalRate.control_read_only := False;
+ BasalRateUom.value := "ml/hr";
+
+ endif;
+
+
+
+
+ If (CallingField = "PRX_ZXO01" and CRNAAdminDose.value is not null) then
+ CRNADoseUnits.value := "mL";
+ elseif (CallingField = "PRX_ZXO01" and CRNAAdminDose.value is null) then
+ CRNADoseUnits.value := "";
+ endif;
+
+ If (CallingField = "PRX_ZXO09" and (BasalRate.value as number) >14) and this_communication.DisplayForm = "Yes" then
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Maximum Rate for Continuous Infusion is 14 mL/hr."
+ ||" \n\n Please adjust rate." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ BasalRate.value := null;
+
+ endif;
+
+ If (CallingField = "PRX_ZXO05" and (PtAdminDose.value as number) >8) and this_communication.DisplayForm = "Yes" then
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Maximum Rate for Patient Administered Dose is 8 mL every 15 minutes."
+ ||" \n\n Please adjust dose." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ PtAdminDose.value := null;
+
+ endif;
+
+ If (CallingField = "PRX_ZXO01" and (CRNAAdminDose.value as number) >10) and this_communication.DisplayForm = "Yes" then
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Loading Dose Administered from Epidural Bag should not exceed 10 mL."
+ ||" \n\n Please adjust dose." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ CRNAAdminDose.value := null;
+
+ endif;
+
+ If (CallingField = "PRX_ZXO07" and (PtAdminFreq.value as number) <15) and this_communication.DisplayForm = "Yes" then
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Frequency of Patient Administered Dose must be a minimum of 15 minutes apart."
+ ||" \n\n Please adjust frequency." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ PtAdminFreq.value := null;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_ROUTE_MAPPING.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_ROUTE_MAPPING.mlm
new file mode 100644
index 0000000..2a1b86c
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_ROUTE_MAPPING.mlm
@@ -0,0 +1,126 @@
+maintenance:
+
+ title:Pharmacy SCM Route Code to WORx code mapping;;
+ mlmname:FORM_RX_ROUTE_MAPPING;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Rx Route Mapping MLM;;
+ author: Robert Spence, Eclipsys Corp;;
+ specialist: ;;
+ date: 2007-01-26;;
+ validation: testing;;
+
+library:
+ purpose: This MLM sets the field WORX_Route to a mapped value dependant on the SCM Route.
+
+ ;;
+ explanation: This MLM is launched on the change of the Route field on the PRX forms
+ The mappings where supplied by Teresa Spicuzza 01/26/2007
+
+ change history
+ 10.24.2007 TMS Added additional routes for mapping to MM, PO and NS to eliminate Veriscan errors.
+ 05.27.2015 TMS Added additional for interventional radiology orders. CSR 32710
+
+ ;;
+ keywords: Called MLMs, Form fields, Rx Route, Worx Route, Mapping
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingField :=this_communication.CallingFieldName;
+ CallingEvent := this_communication.CallingEvent;
+ FormType := this_communication.FormType;
+
+
+ // This sets the visible control on the field dataitem - CHG_OVERRIDE_WITH
+ Route_field := last of (field_list
+ where field_list.DataItemName = "OrderRouteCode" );
+
+ WORx_Route_field := last of (field_list
+ where field_list.DataItemName = "PRX_WORx_Route" );
+
+ If CallingField ="OrderRouteCode" then
+
+ If Route_Field.Value in ("IV PUSH","IVPB", "IV") then
+ WORx_Route_Field.Value :="IV";
+ elseif Route_Field.Value in ("Left Ear","Right Ear","Both Ears") then
+ WORx_Route_Field.Value := "OT";
+ elseif Route_Field.Value in ("Left Eye","Right Eye","Both Eyes") then
+ WORx_Route_Field.Value := "OP";
+ elseif Route_Field.Value in ("Left Nostril","Right Nostril","Each Nostril","Alternating Nostrils") then
+ WORx_Route_Field.Value := "NS";
+ elseif Route_Field.Value in ("PO","VIA TUBE","CHEW","Swish and Swallow") then
+ WORx_Route_Field.Value :="PO";
+ elseif Route_Field.Value in ("SL") then
+ WORx_Route_Field.Value :="SL";
+ elseif Route_Field.Value in ("Topical","Topically","Apply","Cleanse incision") then
+ WORx_Route_Field.Value :="TP";
+ elseif Route_Field.Value in ("Inhaled") then
+ WORx_Route_Field.Value := "IH";
+ elseif Route_Field.Value in ("Dissolve in Mouth","Swish and Spit","Swish","Gargle") then
+ WORx_Route_Field.Value := "MM";
+ elseif Route_Field.Value in ("Apply Topically") then
+ WORx_Route_Field.Value := "TD";
+ elseif Route_Field.Value in ("IM") then
+ WORx_Route_Field.Value := "IM";
+ elseif Route_Field.Value in ("Rectally", "Per Colostomy") then
+ WORx_Route_Field.Value := "RC";
+ elseif Route_Field.Value in ("Vaginally") then
+ WORx_Route_Field.Value := "VG";
+ elseif Route_Field.Value in ("Sheath") then
+ WORx_Route_Field.Value := "SH";
+ elseif Route_Field.Value in ("Epidural") then
+ WORx_Route_Field.Value := "EP";
+ elseif Route_Field.Value in ("Intracatheter") then
+ WORx_Route_Field.Value := "IC";
+ endif;
+ endif;
+
+ // this_communication.DisplayForm := "Yes";
+ // this_communication.Message := "MLM Field :" || CallingField || "\n" ||
+ // "MLM Event :" || CallingEvent || "\n" ||
+ // "Form type :" || FormType;
+ // this_communication.MessageType := "Informational";
+
+
+
+
+
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_SEDATIVE_DOSE_CHECK.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_SEDATIVE_DOSE_CHECK.mlm
new file mode 100644
index 0000000..a551acc
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_SEDATIVE_DOSE_CHECK.mlm
@@ -0,0 +1,133 @@
+maintenance:
+
+ title: Sedative Orders with Dose Range;;
+ mlmname: FORM_Rx_Sedative_Dose_Check;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-11-18;;
+ validation: testing;;
+
+library:
+ purpose: Used for Dose Reduction of Sedative Orders in patients over 65 years of age
+ ;;
+
+ explanation: This MLM is called from form PRX_PoTabBnDrPrDs.
+
+ Change history
+ 11.30.2011 TMS Moved to production Ticket # 143461 (original CSR 26335)
+
+
+ ;;
+ keywords: Called MLMs, Sedatives
+ ;;
+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";
+
+ // 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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ Order_Name := this_communication.PrimaryObj.Name;
+
+
+ HiDose_fld := last of (field_list where field_list.DataItemName = "DosageHigh");
+ LoDose_fld := last of (field_list where field_list.DataItemName = "DosageLow");
+ Override_fld := last of (field_list where field_list.DataItemName = "PRX_DosageOverride");
+ //Substitute_fld := last of (field_list where field_list.DataItemName = "PRX_NoteComment2";
+ message65 := "Lower dose substituted by approval of Medical Executive Committee; patient is 65 years or older";
+ messageDNS := "\n\n You must have a {{{SINGLE-QUOTE}}}Do Not Substitute{{{SINGLE-QUOTE}}} physician order to override lower dose.";
+ nomessage := " ";
+
+ if exists (client_info_obj) then
+ (birthdate,dobM,dobD,dobY) := read last {ClientInfo: BirthDate, BirthMonthNum, BirthDayNum, BirthYearNum
+ REFERENCING client_info_obj};
+ endif;
+
+ patientAge := (NOW - birthdate) / (1 year);
+
+ if (patientAge > 64.99) then
+ if (Order_name = "Eszopiclone 2mg Tab") then
+ If Override_fld.value = false then
+ HiDose_fld.control_read_only := true;
+ HiDose_fld.value := " ";
+ endif;
+ If Override_fld.value = true then
+ HiDose_fld.control_read_only := false;
+ endif;
+ endif;
+ if (Order_name = "Eszopiclone 1mg Tab") then
+ HiDose_fld.control_read_only := false;
+ if HiDose_fld.value > 2 and Override_fld.value = false then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with message65 || messageDNS ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ HiDose_fld.value := " ";
+ endif;
+ endif;
+
+ if (Order_name = "Zolpidem 10mg Tab") then
+ If Override_fld.value = false then
+ HiDose_fld.control_read_only := true;
+ HiDose_fld.value := " ";
+ endif;
+ If Override_fld.value = true then
+ HiDose_fld.control_read_only := false;
+ endif;
+ endif;
+ if (Order_name = "Zolpidem 5mg Tab") then
+ HiDose_fld.control_read_only := false;
+ if HiDose_fld.value > 5 and Override_fld.value = false then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with message65 || messageDNS ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ HiDose_fld.value := " ";
+ endif;
+ if LoDose_fld.value > 5 and Override_fld.value = false then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with message65 || messageDNS ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ LoDose_fld.value := "5";
+ endif;
+ endif;
+
+
+
+ endif; //patientAge > 64.99
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_SPECIALRATE_TO_RATEMAN.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_SPECIALRATE_TO_RATEMAN.mlm
new file mode 100644
index 0000000..ca413b4
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_SPECIALRATE_TO_RATEMAN.mlm
@@ -0,0 +1,205 @@
+maintenance:
+
+ title: IV Special Rates to Rate Mandatory;;
+ mlmname: FORM_Rx_SpecialRate_To_RateMan;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair IV Special Rate MLM;;
+ author: Robert Spence, Eclipsys Corp;;
+ specialist: ;;
+ date: 2007-04-27;;
+ validation: testing;;
+
+library:
+ purpose: Make Rate mandatory per the selection of Special rates.
+
+ ;;
+
+ explanation: This MLM is called from the PRX_IV forms.
+ If Special Rates are TiTrate Rate is not Mandatory
+ Wide Open Rate is not mandatory - changed to mandatory 5/2/15
+ KVO Rate is Mandatory
+ Blank (Null) Rate is Madatory
+ Special considerations:
+ Special rate is a FrequencyCode type
+ Rate is a OrderIVRate type
+ Initial testing performed on PRX_IvW/Add form
+ History:
+ 05.24.2016 TMS CSR 34387 Updated to make Wide Open Rate mandatory and default to 999 ml/hr for
+ patient in an ICU location.
+ 05.22.2017 JML CSR 35272 Added logic to calculate IV rate based on weight - used for (ED) Sepsis Work Up Orders
+ 06.30.2018 TMS CSR 36870 Added Lactated Ringers to logic to calculate IV rate based on weight - used for (ED) Sepsis Work Up Orders
+ 10.29.2018 TMS HD 3481625 Added logic to make IV Rate for Fentanyl 200mcg + Bupiv125mg+NS 46ml on FBC Epidural Orders mandatory upon form open.
+
+ ;;
+ keywords: Called MLMs, Form fields, IV, Special Rates, Rate Mandatory
+ ;;
+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;
+
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ comm_primary_obj := this_communication.PrimaryObj;
+ order_set_name := comm_primary_obj.OrderSetName;
+ order_name := comm_primary_obj.Name;
+ order_mod := comm_primary_obj.Modifier;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+
+ SpecialRate := last of (field_list where field_list.DataItemName = "FrequencyCode" );
+ SpecialRate_Val := SpecialRate.Value;
+ Freq_Sum := SpecialRate_Val.FrequencySummary;
+ Rate := last of (field_list where field_list.DataItemName = "OrderIVRate" );
+ Rate_Val := Rate.Value;
+ Instr := last of ( field_list WHERE field_list.DataItemName = "AdminInstructions" );
+ MLM_From_OrderSet := last of ( field_list WHERE fiel_list.DataItemName = "MLM_From Order Set" );
+
+ LocName:= read last
+ {"SELECT currentlocation "
+ || " FROM cv3clientvisit "
+ || " WHERE ClientGUID = " || SQL(client_guid )
+ || " And GUID = " || SQL(visit_guid)};
+
+ /******* JML: BEGIN CSR 35272 CHANGE ***********************/
+ if ( CallingEvent = "FieldChange" AND CallingField = "MLM_From Order Set" ) then
+ if ( order_set_name = "Septic Work Up Orders" AND (order_name = "Lactated Ringers 1000ml" or order_name = "0.9% NaCl 1000ml")) then
+ if ( order_mod = "Weight based dosing" ) then
+
+ //Retrieve 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;
+
+ 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}}};
+
+ else
+ calc_rate := round ( weightvalue * 30 );
+ calc_hundreds := SUBSTRING 3 CHARACTERS STARTING AT ( LENGTH ( calc_rate AS STRING ) - 2 ) FROM ( calc_rate AS STRING );
+
+ if ( ( ( calc_hundreds AS NUMBER ) >= 750 ) ) OR ( ( ( calc_hundreds AS NUMBER ) >= 250 ) AND ( ( calc_hundreds AS NUMBER ) <= 500 ) ) then
+ calc_rate := CEILING ( ( calc_rate as number ) / 500 ) * 500;
+ elseif ( ( ( calc_hundreds AS NUMBER ) >= 501 ) AND ( ( calc_hundreds AS NUMBER ) < 750 ) ) OR ( ( calc_hundreds AS NUMBER ) < 250 ) then
+ calc_rate := FLOOR ( ( calc_rate AS NUMBER ) / 500 ) * 500;
+ endif;
+
+ Instr.Value := "Volume to be administered is " || calc_rate || " mL";
+ SpecialRate_Val.FrequencySummary := "Wide Open";
+ endif;
+
+ endif;
+ endif;
+
+ if ( order_set_name = "FBC Epidural Orders" AND order_name = "Fentanyl 200mcg + Bupiv125mg+NS 46ml" ) then
+
+ If Freq_Sum is Null then
+
+ Rate_Val.Amount := null;
+ Rate.Control_mandatory := True;
+ Rate.Value := Rate_Val;
+ endif;
+ endif;
+
+ endif;
+
+ If (CallingField = "FrequencyCode") then
+
+
+ If (Freq_Sum = "Titrate")// or (Freq_Sum = "Wide Open")
+ then
+ Rate.Control_mandatory := False;
+ Rate_Val.Amount := "";
+ Rate.Value := Rate_Val;
+ elseif (Freq_Sum = "Wide Open")
+ then
+ Rate_Val.UOM := "ml/hr";
+ If LocName matches pattern "ICU-%" then
+ Rate_Val.Amount := "999";
+ endif;
+ Rate.Value := Rate_Val;
+
+ elseif (Freq_Sum = "KVO") or (Freq_Sum is Null)
+ then
+ Rate_Val.Amount := null;
+ Rate.Control_mandatory := True;
+ Rate.Value := Rate_Val;
+
+ endif; //Freq Sum Checking
+
+ Elseif (CallingField = "OrderIVRate") then
+
+ If (Rate_Val.UOM Is Null) or (Rate_Val.UOM ="")
+ then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please select a unit of measure for the Rate Field";
+ this_communication.MessageType := "Error";
+ Rate_Val.UOM := "";
+ Rate.Value := Rate_Val;
+ Endif; // Rate check
+
+ endif; //calling field or event
+
+ If CallingEvent = "FormClose"
+ then
+ If (Freq_Sum is Null)
+ then
+ Rate.Control_mandatory := True;
+ endif;
+ endif;
+
+
+
+ /* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "MLM Field :" || CallingField || "\n" ||
+ "MLM Event :" || CallingEvent || "\n" ||
+ "Special rate Value:" || SpecialRate_Val || "\n" ||
+ "Special Rate Freq Summary:" || Freq_Sum || "\n" ||
+ "Rate Amount: " || Rate_Val.Amount;
+ this_communication.MessageType := "Informational";
+ */
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_STOP_DATE.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_STOP_DATE.mlm
new file mode 100644
index 0000000..a08fae8
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_STOP_DATE.mlm
@@ -0,0 +1,95 @@
+maintenance:
+
+ title:Preop frequency stop date;;
+ mlmname:FORM_RX_Stop_Date;;
+ arden: version 2;;
+ version: 6.10;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts;;
+ specialist: ;;
+ date: 2014-12-30;;
+ validation: testing;;
+
+
+library:
+ purpose: This MLM sets the field stop date for preop frequencies.
+ ;;
+
+ explanation: This MLM adds a stop date to orders with a frequency of preop. This along with a change
+ on WORx will allow preop meds to be removed from Accudose all day on the day of surgery.
+
+ change history
+ 05.11.2015 TMS Created for CSR 30589.
+
+ ;;
+ keywords: Called MLMs, Form fields, Rx Route, Worx Route, Mapping
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingField :=this_communication.CallingFieldName;
+ CallingEvent := this_communication.CallingEvent;
+ FormType := this_communication.FormType;
+
+
+ // This sets the visible control on the field dataitem - CHG_OVERRIDE_WITH
+ Frequency:= last of (field_list
+ where field_list.DataItemName = "FrequencyCode" );
+
+ StartDate:= last of (field_list
+ where field_list.DataItemName = "RequestedDate" );
+
+ EndDate:= last of (field_list
+ where field_list.DataItemName = "StopDate" );
+ FrequencyValue := Frequency.value;
+ FrequencySummary := FrequencyValue.FrequencySummary;
+ StopAfter := first of (field_list.Value WHERE field_list.DataItemName="StopAfter" AND field_list.Label= "Stop After");
+
+
+ If CallingEvent = "FormClose" then
+ If FrequencySummary = "PRE OP" then
+ stopAfter.Number := 1;
+ stopAfter.Option := "Days";
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_TITRATION_VALUES.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_TITRATION_VALUES.mlm
new file mode 100644
index 0000000..b996e65
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_TITRATION_VALUES.mlm
@@ -0,0 +1,526 @@
+maintenance:
+
+ title: Titration Guidelines for IV Drips;;
+ mlmname: FORM_Rx_Titration_values;;
+ arden: version 2;;
+ version: 15.10;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza;;
+ specialist: ;;
+ date: 2016-08-10;;
+ validation: testing;;
+
+library:
+ purpose: Change the status of fields based upon the infusion selected
+
+ ;;
+
+ explanation: This MLM is called from the PRX_lvDripTitrate form.
+
+ Change History
+ 08.18.2016 TMS Created. CSR 34238
+
+
+
+ ;;
+ keywords: Called MLMs, Form fields, Titrate
+ ;;
+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;
+ /***************************************************************************************/
+ comm_obj := this_communication.primaryobj;
+
+ // Initialize error message
+ error_message:="";
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+
+
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ OrderCatalogItemGUID := this_Communication.ItemID;
+
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+
+ OrderManagement := MLM {{{SINGLE-QUOTE}}}FORM_Rx_Medication_Retrieval{{{SINGLE-QUOTE}}};
+
+ UseSuggestedValues := last of (field_list where field_list.DataItemName = "PRX_IVTitrateValues" );
+ IVTitrate := last of (field_list where field_list.DataItemName = "PRX_IVTitrate" );
+ TitrateGoal := last of (field_list where field_list.DataItemName = "PRX_IVTitrationGoal" );
+ TitrateIncr := last of (field_list where field_list.DataItemName = "PRX_IVTitrationIncrement" );
+ MaxDose := last of (field_list where field_list.DataItemName = "PRX_IVMaxDose" );
+ MaxDoseUom := last of (field_list where field_list.DataItemName = "PRX_IVMaxDoseUOM" );
+ StartDose := last of (field_list where field_list.DataItemName = "PRX_IVStartDose" );
+ StartDoseUOM := last of (field_list where field_list.DataItemName = "PRX_IVStartDoseUOM" );
+ OrderIVRate := last of (field_list where field_list.DataItemName = "OrderIvRate" );
+ OrderIvRate_val := OrderIvRate.Value;
+
+ OrderInfo := last of (field_list where field_list.DataItemName = "PRX_NoteComment0" );
+ frequency := last of (field_list where field_list.DataItemName = "FrequencyCode" );
+ freq_Val := frequency.Value;
+
+ Guidelines := last of (field_list where field_list.DataItemName = "PRX_PermOrderInfo" );
+
+
+ If CallingEvent = "FormOpen" then
+
+ If freq_val.frequencysummary = "Titrate" and IVTitrate.Value = False then
+
+ IvTitrate.value := True;
+ endif;
+
+ (this_communication, this_form) := call OrderManagement
+ with (this_communication, this_form, client_info_obj);
+
+
+ endif;
+
+ If (CallingEvent = "FormOpen") or (CallingEvent = "FormClose") or (CallingEvent = "FieldChange" and (callingfield = "FrequencyCode" or callingfield = "PRX_IVTitrate" or callingfield = "PRX_IVTitrateValues")) then
+ Drug_Code:= Read Last
+ {" SELECT CV3CatalogClassTypeValue.Value FROM CV3CatalogClassTypeValue INNER JOIN"
+ || " CV3ClassType ON CV3CatalogClassTypeValue.ClassTypeGUID = CV3ClassType.GUID"
+ || " WHERE CV3ClassType.Code = {{{SINGLE-QUOTE}}}PRX_Titration Guidelines{{{SINGLE-QUOTE}}} AND CV3CatalogClassTypeValue.CatalogMasterGUID = "
+ || SQL(OrderCatalogItemGUID)
+ };
+ endif;
+
+ If Drug_Code is not null then
+
+ GuidelineInfo:= Read Last
+ {" SELECT Value FROM CV3UserDictionaryValue "
+ || " WHERE UserDictionaryCode = {{{SINGLE-QUOTE}}}PRX_Titration Info{{{SINGLE-QUOTE}}} and value like {{{SINGLE-QUOTE}}}" || Drug_Code || "%{{{SINGLE-QUOTE}}}"
+ };
+
+
+ TitrateInfo := call str_parse with GuidelineInfo,"|";
+
+ DrugNameInfo := TitrateInfo[1];
+ StartingDoseInfo := TitrateInfo[2];
+ StartTitrateInfo := TitrateInfo[3];
+ MaxDoseInfo := TitrateInfo[4];
+ UOMInfo := TitrateInfo[5];
+ IncrementInfo := TitrateInfo[6];
+ GoalInfo := TitrateInfo[7];
+ GuidelineMsg := "Starting Dose: " || StartingDoseInfo || " " || UOMInfo || CRLF
+ || "Maximum Dose: " || MaxDoseInfo || " " || UOMInfo || CRLF
+ || "Titration & Increment: " || IncrementInfo || CRLF
+ || "Goals: " || GoalInfo ;
+
+ If Callingfield = "FrequencyCode" and freq_val.frequencysummary = "Titrate" then
+ IvTitrate.value := True;
+ else
+ IvTitrate.value := false;
+ endif;
+
+ If (CallingEvent = "Fieldchange" or CallingEvent = "FormOpen") then
+
+ Guidelines.value := Guidelinemsg;
+
+ If IvTitrate.value = True or freq_val.frequencysummary = "Titrate" then
+
+ OrderIvRate_val.Amount := null ;
+ OrderIvRate_val.UOM := null;
+ OrderIvRate.control_mandatory := False;
+ OrderIvRate.control_read_only := True;
+
+ freq_Val.frequencysummary := "Titrate";
+
+ StartDose.control_read_only := False;
+ StartDose.control_mandatory := True;
+
+ StartDoseUOM.control_mandatory := True;
+ StartDoseUOM.control_read_only := True;
+ StartDoseUOM.value := UOMInfo;
+
+ MaxDose.control_read_only := False;
+ MaxDose.control_mandatory := True;
+
+ MaxDoseUOM.control_read_only := True;
+ MaxDoseUOM.control_mandatory := True;
+ MaxDoseUOM.value := UOMInfo;
+
+ TitrateIncr.control_read_only := False;
+ TitrateIncr.control_mandatory := True;
+
+ TitrateGoal.control_read_only := False;
+ TitrateGoal.control_mandatory := True;
+
+
+ elseif IvTitrate.value = false or freq_val.frequencysummary <> "Titrate" then
+
+ IvTitrate.value := false;
+
+ If callingevent = "fieldchange" then
+ OrderIvRate_val.Amount := null ;
+ OrderIvRate_val.UOM := UOMInfo;
+ endif;
+
+ OrderIvRate.control_read_only := False;
+ OrderIvRate.control_mandatory := True;
+
+ freq_Val.frequencysummary := Null;
+
+ StartDose.value := " ";
+ StartDose.control_mandatory := False;
+ StartDose.control_read_only := True;
+
+ StartDoseUOM.value := " ";
+ StartDoseUOM.control_mandatory := False;
+
+
+ MaxDose.value := " ";
+ MaxDose.control_mandatory := False;
+ MaxDose.control_read_only := True;
+
+ MaxDoseUOM.value := " ";
+ MaxDoseUOM.control_mandatory := False;
+
+ TitrateIncr.value := " ";
+ TitrateIncr.control_mandatory := False;
+ TitrateIncr.control_read_only := True;
+
+ TitrateGoal.value := " ";
+ TitrateGoal.control_mandatory := False;
+ TitrateGoal.control_read_only := True;
+
+
+ freq_Val.frequencysummary := Null;
+
+ endif; //IvTitrate.value = True or freq_val.frequencysummary = "Titrate"
+ endif; //If (CallingEvent = "Fieldchange" or CallingEvent = "FormOpen")
+
+ If (CallingEvent = "Fieldchange" and callingfield = "PRX_IVTitrateValues")
+ or (CallingEvent = "FormOpen" and UseSuggestedValues = True) then
+
+ If IvTitrate.value = True or freq_val.frequencysummary = "Titrate" then
+ Guidelines.value := Guidelinemsg;
+ MSG3 := "";
+ MSG4 := "";
+ If StartDose.value is not null then
+ TempStartDose := StartDose.value;
+ If MSG3 = "" and MSG4 = "" then
+ MSG3 := " Starting Dose";
+ MSG4 := " Starting Dose: " || StartDose.value ||UOMInfo;
+ else
+ MSG3 := MSG4 ||", Starting Dose";
+ MSG3 := MSG4 || CRLF || " Starting Dose: " || StartDose.value ||UOMInfo;
+ endif;
+ else
+ TempStartDose := StartTitrateInfo;
+
+ Endif;
+
+ If MaxDose.value is not null then
+ TempMaxDose := MaxDose.value;
+ If MSG3 = "" and MSG4 = "" then
+ MSG3 := " Maximum Dose";
+ MSG4 := " Maximum Dose: " || MaxDose.value || UOMInfo;
+ else
+ MSG3 := MSG3 ||", Maximum Dose";
+ MSG4 := MSG4 ||CRLF || " Maximum Dose: " || MaxDose.value || UOMInfo;
+ endif;
+ else
+ TempMaxDose := MaxDoseInfo;
+ endif;
+
+
+ If TitrateIncr.value is not null then
+ TempIncrement := TitrateIncr.value;
+ If MSG3 = "" and MSG4 = "" then
+ MSG3 := " Titration & Increment";
+ MSG4 := " Titration & Increment: " || TitrateIncr.value;
+ else
+ MSG3 := MSG3 ||", Titration & Increment";
+ MSG4 := MSG4 || CRLF || " Titration & Increment: " || TitrateIncr.value;
+ endif;
+ else
+ TempIncrement := IncrementInfo;
+ Endif;
+
+ If TitrateGoal.value is not null then
+ TempTitrateGoal := TitrateGoal.value;
+ If MSG3 = "" and MSG4 = "" then
+ MSG3 := " Titration Goals";
+ MSG4 := " Titration Goals: " || TitrateGoal.value;
+ else
+ MSG3 := MSG3 ||", Titrate Goal";
+ MSG4 := MSG4 ||CRLF || " Titrate Goal: " || TitrateGoal.value;
+ endif;
+ else
+ TempTitrateGoal := GoalInfo;
+ Endif;
+
+ OrderIvRate_val.Amount := null ;
+ OrderIvRate_val.UOM := null;
+ OrderIvRate.control_mandatory := False;
+ OrderIvRate.control_read_only := True;
+ freq_Val.frequencysummary := "Titrate";
+ IVTitrate.Value := True;
+
+
+ If Msg3 <> "" then
+ dialogResult2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You have already entered values for: "||CRLF || Msg3
+ ||" \n\n Choose YES to OVERWRITE all values with the recommended dosing. "
+ ||" \n\n Choose NO to KEEP the entered values:" || CRLF || Msg4 ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult2 as string) = "Yes") then
+
+ TitrateGoal.value := GoalInfo;
+ TitrateIncr.value := IncrementInfo;
+
+ MaxDose.value := MaxDoseInfo;
+ MaxDoseUOM.value := UOMInfo;
+
+ OrderIvRate_val.Amount := null ;
+ OrderIvRate_val.UOM := null;
+ OrderIvRate.control_mandatory := False;
+ OrderIvRate.control_read_only := True;
+
+ StartDose.value := StartTitrateInfo;
+ StartDoseUOM.value := UOMInfo;
+
+ IvTitrate.value := True;
+ freq_val.frequencysummary := "Titrate" ;
+
+ UsesuggestedValues.value := false;
+
+ else
+ TitrateGoal.value := TempTitrateGoal;
+ TitrateIncr.value := TempIncrement;
+
+ MaxDose.value := TempMaxDose;
+ MaxDoseUOM.value := UOMInfo;
+
+ OrderIvRate_val.Amount := null ;
+ OrderIvRate_val.UOM := null;
+ OrderIvRate.control_mandatory := False;
+ OrderIvRate.control_read_only := True;
+
+ StartDose.value := TempStartDose;
+ StartDoseUOM.value := UOMInfo;
+
+ IvTitrate.value := True;
+ freq_val.frequencysummary := "Titrate" ;
+
+ UsesuggestedValues.value := false;
+
+ endif;
+
+ else
+
+ TitrateGoal.value := GoalInfo;
+ TitrateIncr.value := IncrementInfo;
+
+ MaxDose.value := MaxDoseInfo;
+ MaxDoseUOM.value := UOMInfo;
+
+ OrderIvRate_val.Amount := null ;
+ OrderIvRate_val.UOM := null;
+ OrderIvRate.control_mandatory := False;
+ OrderIvRate.control_read_only := True;
+
+ StartDose.value := StartTitrateInfo;
+ StartDoseUOM.value := UOMInfo;
+
+ IvTitrate.value := True;
+ freq_val.frequencysummary := "Titrate" ;
+
+ UsesuggestedValues.value := false;
+
+ endif;
+
+ else
+
+ IvTitrate.value := True;
+
+ TitrateGoal.value := GoalInfo;
+ TitrateIncr.value := IncrementInfo;
+
+ MaxDose.value := MaxDoseInfo;
+ MaxDoseUOM.value := UOMInfo;
+
+ OrderIvRate_val.Amount := null ;
+ OrderIvRate_val.UOM := null;
+ OrderIvRate.control_mandatory := False;
+ OrderIvRate.control_read_only := True;
+
+ StartDose.value := StartTitrateInfo;
+ StartDoseUOM.value := UOMInfo;
+
+ Guidelines.value := Guidelinemsg;
+
+ freq_Val.frequencysummary := "Titrate";
+
+ StartDose.control_read_only := False;
+ StartDose.control_mandatory := True;
+
+ StartDoseUOM.control_mandatory := True;
+ StartDoseUOM.control_read_only := True;
+ StartDoseUOM.value := UOMInfo;
+
+ MaxDose.control_read_only := False;
+ MaxDose.control_mandatory := True;
+
+ MaxDoseUOM.control_read_only := True;
+ MaxDoseUOM.control_mandatory := True;
+ MaxDoseUOM.value := UOMInfo;
+
+ TitrateIncr.control_read_only := False;
+ TitrateIncr.control_mandatory := True;
+
+ TitrateGoal.control_read_only := False;
+ TitrateGoal.control_mandatory := True;
+
+ UsesuggestedValues.value := false;
+
+ endif;
+ endif;
+
+ If CallingEvent = "FormClose" and (freq_val.frequencysummary = "Titrate" or IVTitrate.Value = True) then
+ MSG1 := "";
+ MSG2 := "";
+ If StartDose.value is null then
+ If MSG1 = "" and MSG2 = "" then
+ MSG1 := " Starting Dose";
+ MSG2 := " Starting Dose: " || StartTitrateInfo ||UOMInfo;
+ else
+ MSG1 := MSG1 ||", Starting Dose";
+ MSG2 := MSG2 || CRLF || "Starting Dose: " || StartTitrateInfo ||UOMInfo;
+ endif;
+ Endif;
+
+ If MaxDose.value is null then
+ If MSG1 = "" and MSG2 = "" then
+ MSG1 := " Maximum Dose";
+ MSG2 := " Maximum Dose: " || MaxDoseInfo || UOMInfo;
+ else
+ MSG1 := MSG1 ||", Maximum Dose";
+ MSG2 := MSG2 ||CRLF || " Maximum Dose: " || MaxDoseInfo || UOMInfo;
+ endif;
+ endif;
+
+ If TitrateIncr.value is null then
+ If MSG1 = "" and MSG2 = "" then
+ MSG1 := " Titration & Increment";
+ MSG2 := " Titration & Increment: " || IncrementInfo;
+ else
+ MSG1 := MSG1 ||", Titration & Increment";
+ MSG2 := MSG2 || CRLF || " Titration & Increment: " || IncrementInfo;
+ endif;
+ Endif;
+
+ If TitrateGoal.value is null then
+ If MSG1 = "" and MSG2 = "" then
+ MSG1 := " Titrate Goal";
+ MSG2 := " Titrate Goal: " || GoalInfo;
+ else
+ MSG1 := MSG1 ||", Titrate Goal";
+ MSG2 := MSG2 ||CRLF || " Titrate Goal: " || GoalInfo;
+ endif;
+ Endif;
+
+
+ OrderIvRate_val.Amount := null ;
+ OrderIvRate_val.UOM := null;
+ OrderIvRate.control_mandatory := False;
+ OrderIvRate.control_read_only := True;
+ freq_Val.frequencysummary := "Titrate";
+ IVTitrate.Value := True;
+
+ If Msg1 <> "" then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You have not entered values for: "|| CRLF ||Msg1
+ ||" \n\n Choose YES to use recommended dosing: " || CRLF || Msg2
+ ||" \n\n Choose NO to enter your own values. " ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+
+ if((dialogResult as string) = "Yes") then
+
+
+ If TitrateGoal.value is null then
+ TitrateGoal.value := GoalInfo;
+ Endif;
+
+ If TitrateIncr.value is null then
+ TitrateIncr.value := IncrementInfo;
+ Endif;
+
+ If MaxDose.value is null then
+ MaxDose.value := MaxDoseInfo;
+ MaxDoseUOM.value := UOMInfo;
+ endif;
+
+ OrderIvRate_val.Amount := null ;
+ OrderIvRate_val.UOM := null;
+ OrderIvRate.control_mandatory := False;
+ OrderIvRate.control_read_only := True;
+ freq_Val.frequencysummary := "Titrate";
+ IVTitrate.Value := True;
+
+ If StartDose.value is null then
+ StartDose.value := StartTitrateInfo;
+ StartDoseUOM.value := UOMInfo;
+ endif;
+ else
+
+ TitrateGoal.control_mandatory := True;
+ TitrateIncr.control_mandatory := True;
+ MaxDose.control_mandatory := True;
+ StartDose.control_mandatory := True;
+
+ endif;
+ endif;
+ If TitrateGoal.value is not null
+ and TitrateIncr.value is not null
+ and MaxDose.value is not null
+ and MaxDoseUOM.value is not null
+ and StartDose.value is not null
+ and StartDoseUOM.value is not null then
+
+ Instructions := "Starting Dose: " || StartDose.value || " " || StartDoseUOM.value || CRLF
+ ||"Maximum Dose: " || MaxDose.value || " " || MaxDoseUOM.value || CRLF
+ ||"Titration & Increment: " || TitrateIncr.value || CRLF
+ ||"Goals: " || TitrateGoal.value;
+ OrderInfo.value := Instructions;
+ endif;
+
+ endif; //CallingEvent = "FormClose" and (freq_val.frequencysummary = "Titrate" or IVTitrate.Value = True
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_TPN_RATE_CALC.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_TPN_RATE_CALC.mlm
new file mode 100644
index 0000000..a3a1f23
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_TPN_RATE_CALC.mlm
@@ -0,0 +1,156 @@
+maintenance:
+
+ title: Form_RX_TPN_Rate_calc;;
+ mlmname: Form_Rx_TPN_RATE_calc;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St. Clair Hospital;;
+ author: Teresa M. Spicuzza ;;
+ specialist: Eclipsys Corporation;;
+ date: 2007-06-27;;
+ validation: testing;;
+
+library:
+ purpose: Calculate TPN rate based upon ordered volume
+ ;;
+ explanation:
+ Ordered Volume /24 =
+ Infusion rate (rounded to nearest whole number)
+ History:
+ 03.03.2014 TMS Created to calculate TPN and Cyclic TPN rates
+ and to allow charting on veriscan. CSR{{{SINGLE-QUOTE}}}s: 30737 and 32895
+ 08.17.2015 TMS For cyclic TPN, add total volume to be infused for each cycle
+ to the informational message for use with infusion pump settings.
+ CSR 33645.
+ ;;
+ keywords:
+ TPN, Rate, Volume, Cyclic;
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+/********************Make Changes To Spelling And Flags In This Section*********************/
+
+
+/*************************************************************************************************/
+
+ // 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;
+
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CyclicTPN := first of (field_list where field_list.DataItemName = "PRX_Cyclic_TPN_Order");
+ CyclicTPN_On := first of (field_list where field_list.DataItemName = "PRX_Cyclic_TPN_On_Hours");
+ CyclicTPN_Off := first of (field_list where field_list.DataItemName = "PRX_Cyclic_TPN_Off_Hours");
+ Instruct := first of (field_list where field_list.DataItemName = "AdminInstructions");
+ rate := first of (field_list where field_list.DataItemName = "OrderIVRate");
+ vol := first of (field_list where field_list.DataItemName = "DosageLow");
+ IVduration := first of (field_list where field_list.DataItemName = "stopafter");
+ IVduration_val := IVduration.value;
+ ratevalue := rate.value;
+ Freq := first of (field_list where field_list.DataItemName = "FrequencyCode");
+ Freq_value := Freq.value;
+
+ // If order is for cyclic TPN, make the rate not mandatory calculate the 3 rates and populate them into
+ // the instructions, make the frequency variable
+ If exist CyclicTPN and CyclicTPN.value = true then
+
+ CyclicTPN_On.Control_Mandatory := true;
+ CyclicTPN_On.control_read_only := false;
+
+ CyclicTPN_Off.Control_Mandatory := true;
+ CyclicTPN_Off.control_read_only := false;
+ rate.control_mandatory := false;
+ RateValue.Amount := Null;
+ RateValue.UOM := Null;
+ Rate.control_read_only := True;
+
+ if exists vol and vol.value is not null and CyclicTPN_On.value is not null then
+ IvDuration_Val.Number := 1;
+ Freq.value.frequencysummary := "Variable";
+ IvDuration_Val.Option := "Times";
+ vol_val := vol.value;
+ CyclicTPN_On_val := CyclicTPN_On.value as number;
+ CyclicTPN_Off.value := (24 - CyclicTPN_On_val);
+ Cycle2 := CyclicTPN_On_Val - 1;
+ Cycle2hours := CyclicTPN_On_Val - 2;
+ Cycle2Rate := (vol_val / Cycle2) as number;
+ Cycle2Rateround := int(cycle2rate + 0.5);
+ Cycle1Rate := (Cycle2Rate / 2) as number;
+ Cycle1Rateround := int(cycle1rate + 0.5);
+ TotalVolume := ((Cycle1rateround * 2) + (Cycle2rateround * Cycle2hours)) as number;
+ Cycle2Volume := (Cycle2rateround * Cycle2hours) as number;
+ Cycle1Volume := Cycle1rateround as number;
+ If TotalVolume >= vol.value then
+ TotalVolume := vol.value;
+ Total_vol_msg := " ml.";
+ else
+ Total_vol_msg := " ml, which is approximately the volume ordered. Because the rate has been rounded the volume is slightly different.";
+ endif;
+
+
+ Msg := "Start the TPN at " || cycle1rateround || " ml/hr for (1) hour (Volume: " || Cycle1Volume || " ml), then run the TPN at "
+ || cycle2rateround || " ml/hr for (" || Cycle2hours ||") hours (Volume: " || Cycle2Volume || " ml); finally run the TPN at "
+ ||cycle1rateround || " ml/hr for (1) hour (Volume: " || Cycle1Volume || " ml), then stop."
+ || CRLF || "The total volume that will be infused is " || totalvolume || Total_vol_msg;
+ Instruct.value := msg;
+ Endif;
+ Else
+ // If order is not for cyclic TPN calculate the rate based upon the volume ordered over 24 hours
+ If exist CyclicTPN and CyclicTPN.value = false then
+ CyclicTPN_On.value := Null;
+ CyclicTPN_On.Control_Mandatory := false;
+ CyclicTPN_On.control_read_only := true;
+ CyclicTPN_Off.value := Null;
+ CyclicTPN_Off.Control_Mandatory := false;
+ CyclicTPN_Off.control_read_only := True;
+ Rate.control_mandatory := true;
+ Rate.control_read_only := False;
+ Freq.value.frequencysummary := "";
+
+ if exists vol and vol.value is not null then
+ vol_val := vol.value;
+ dose_rate := vol_val / 24;
+
+ IvDuration_Val.Number := 1;
+
+ IvDuration_Val.Option := "Times";
+
+ RateValue := Rate.Value;
+ RateValue.Amount := dose_rate formatted with "%.0f";
+ RateValue.UOM := "ml/hr";
+ OrderIVRateValue.KVODisplayed := false;
+ OrderIVRateValue.IsKVO := false;
+ msg := " ";
+ Instruct.value := msg;
+
+ Endif;
+ Endif;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_USER_SCHED_PRIORITY.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_USER_SCHED_PRIORITY.mlm
new file mode 100644
index 0000000..8a3a3ed
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_USER_SCHED_PRIORITY.mlm
@@ -0,0 +1,173 @@
+maintenance:
+
+ title: Med With User Schedule;;
+ mlmname: FORM_Rx_User_Sched_Priority;;
+ arden: version 2;;
+ version: 15.10;;
+ institution: St Clair ;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2016-01-07;;
+ validation: testing;;
+
+library:
+ purpose: Used with parkinson medication orders to take information mapped from order set and create a user schedule
+ ;;
+
+ explanation: This MLM uses information mapped from order set dictionaries to create a user schedule for medication orders.
+
+
+
+ Change History
+
+ 10/05/2016 TMS New MLM to create a User Schedule based upon selections from an order set
+
+
+ ;;
+ keywords: Called MLMs, Form fields, User Schedule
+ ;;
+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;
+
+ PrimaryObjdetail:=this_communication.PrimaryObj;
+ session_type := PrimaryObjdetail.internalprocessingtype;
+
+
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // References the LOCAL SESSION object
+ local_session := cds_session.local;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+
+ // Obtain fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
+ requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
+ is_prn := last of (field_list where field_list.DataItemName = "IsPRN" );
+ regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode");
+ requested_time_value := requested_time.value;
+ regular_freq_value := regular_freq.value;
+ start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
+ stat_then := first of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then");
+ TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses");
+ TotalDosing_value := TotalDosing.value;
+ RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments");
+ RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions");
+ AltDaysDose1 := last of (field_list where field_list.DataItemName = "PRX_SchedDays1" and field_List.Control_MultiFieldOccNum = 1);
+ AltDaysDose1_list := AltDaysDose1.value;
+ AltTimesDose1 := last of (field_list where field_list.DataItemName = "PRX_SchedTimes" and field_List.Control_MultiFieldOccNum = 1);
+ AltTimesDose1_list := AltTimesDose1.value;
+ DailyFreq := last of (field_list where field_list.DataItemName = "PRX_Std_Schedule");
+ DailyFreq_value := DailyFreq.value;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ RX_Comments_field_value := RX_Comments_field.value;
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ AutoMedScheduling := MLM {{{SINGLE-QUOTE}}}FORM_Antibiotic_Scheduling{{{SINGLE-QUOTE}}};
+
+
+ // build user schedule from days and times selected mapped to order form from order set
+
+ If exists AltDaysDose1 and (AltDaysDose1_list <> "None") then
+
+ If exists AltTimesDose1 and (AltTimesDose1_list <> "None") then
+
+ If AltDaysDose1.value = "AllDays" then
+ regular_freq_value.FrequencySummary := "";
+ regular_freq_value.FreqFromTime := 1;
+ regular_freq_value.FreqToTime := 0;
+ regular_freq_value.FreqUOM := "day";
+ else
+ regular_freq_value.FrequencySummary := "";
+ regular_freq_value.FreqFromTime := 1;
+ regular_freq_value.FreqToTime := 0;
+ regular_freq_value.FreqUOM := "week";
+
+
+ Dayslist := call str_parse with ((AltDaysDose1_list),",");
+ regular_freq_value.FreqWeeklyDays := dayslist;
+ endif;
+ Timeslist := call str_parse with ((AltTimesDose1_list),",");
+ regular_freq_value.FreqTimes := timeslist;
+
+ endif;
+
+ endif;
+
+ If exists AltDaysDose1 and AltDaysDose1_list = "None" then
+
+ If exists Dailyfreq and Dailyfreq_value <> "None" then
+ regular_freq_value.FrequencySummary := Dailyfreq_value;
+
+
+ If Dailyfreq_value = "Now" then
+
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := "Routine";
+
+ elseif Dailyfreq_value = "Stat" then
+
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := "STAT";
+ else;
+
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := "Routine";
+ endif;
+
+ endif;
+ endif;
+
+
+
+ // if the frequency is {{{SINGLE-QUOTE}}}User Schedule{{{SINGLE-QUOTE}}} then PRN, stat/then, now/then is not available
+ // since all frequencies for methotrexate are one time or user schedule no need to make stat/now then fields available
+ If regular_freq_value.FrequencySummary = "" then
+ is_prn.control_visible := FALSE;
+ start_now.control_read_only := True;
+ start_now.value := False;
+ stat_then.value := False;
+ stat_then.control_read_only := True;
+ TotalDosing.value := NULL;
+ TotalDosing.control_read_only := True;
+
+ else
+
+ is_prn.control_visible := TRUE;
+
+ endif;
+ // do not allow a stat priority if frequency is not stat
+ If (regular_freq_value.FrequencySummary <> "STAT")and (requested_time_value.ReqTimeCode = "STAT")
+ then
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := NULL;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_WARFARIN_PRIORITY.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_WARFARIN_PRIORITY.mlm
new file mode 100644
index 0000000..9e104a8
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_WARFARIN_PRIORITY.mlm
@@ -0,0 +1,178 @@
+maintenance:
+
+ title: Priority for Warfarin Orders;;
+ mlmname: FORM_Rx_Warfarin_Priority;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St Clair ;;
+ author: Eclipsys Corp;;
+ specialist: Teresa Spicuzza;;
+ date: 2014-08-05;;
+ validation: testing;;
+
+library:
+ purpose: If {{{SINGLE-QUOTE}}}Irregular Schedule{{{SINGLE-QUOTE}}} is selected then populate {{{SINGLE-QUOTE}}}RequestedDTM{{{SINGLE-QUOTE}}}
+ with Date and time of earliest date/time in the Schedule
+
+ ;;
+
+ explanation: This MLM is called from the medication form selects the frequency {{{SINGLE-QUOTE}}}Irregular Schedule{{{SINGLE-QUOTE}}}
+
+ The Schedule will be reviewed and the earliest date/time identified.
+ This date/time will be put in to the RequestedDTM field using the {{{SINGLE-QUOTE}}}Scheduled/Start Time{{{SINGLE-QUOTE}}} option.
+
+ Change History
+
+ 08/05/2014 TMS New MLM to set the priority of Warfarin Orders, copied from Form Med Irreg Schedule CSR 32392
+
+
+ ;;
+ keywords: Called MLMs, Form fields, Irregular Schedule, Warfarin
+ ;;
+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;
+
+ PrimaryObjdetail:=this_communication.PrimaryObj;
+ session_type := PrimaryObjdetail.internalprocessingtype;
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* These variables must containt he same wording as the options in the drop down list */
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // References the LOCAL SESSION object
+ local_session := cds_session.local;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+
+ // Obtain fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
+ requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
+ //stop_after:= last of (field_list where field_list.DataItemName = "StopAfter" );
+ //stop_after_Value := stop_after.value;
+ //stop_date := last of (field_list where field_list.DataItemName = "StopDate" );
+ // stop_time := last of (field_list where field_list.DataItemName = "StopTime" );
+ //stop_time_value := stop_time.value ;
+ is_prn := last of (field_list where field_list.DataItemName = "IsPRN" );
+ regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode");
+ requested_time_value := requested_time.value;
+ regular_freq_value := regular_freq.value;
+ start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
+ start_now_value := start_now.value;
+ stat_then := first of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then");
+ stat_then_value := stat_then.value;
+ TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses");
+ TotalDosing_value := TotalDosing.value;
+ RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments");
+ RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions");
+ //FreqText := " ";
+ AltDaysDose1 := last of (field_list where field_list.DataItemName = "PRX_SchedDays1" and field_List.Control_MultiFieldOccNum = 1);
+ AltDaysDose1_list := AltDaysDose1.value;
+ //SP := " ";
+ //DQ := 34 formatted with "%c";
+ DailyFreq := last of (field_list where field_list.DataItemName = "PRX_Std_Schedule");
+ DailyFreq_value := DailyFreq.value;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ PrimaryObjdetail:=this_communication.PrimaryObj;
+ OrderName := PrimaryObjdetail.name;
+
+ RX_Comments_field_value := RX_Comments_field.value;
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ FreqTranslate := ();
+ FreqTranslate := read { "select value from cv3userdictionaryvalue v with (nolock)"
+ || " where userdictionarycode = {{{SINGLE-QUOTE}}}PRX_ORM Frequency Translation{{{SINGLE-QUOTE}}} "
+ || " and active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
+ };
+
+
+
+
+ If exists AltDaysDose1 and (AltDaysDose1_list <> "None") then
+ regular_freq_value.FrequencySummary := "";
+ regular_freq_value.FreqFromTime := 1;
+ regular_freq_value.FreqToTime := 0;
+ regular_freq_value.FreqUOM := "week";
+ regular_freq_value.FreqTimes := "21:00";
+
+
+ Dayslist := call str_parse with ((AltDaysDose1_list),",");
+ regular_freq_value.FreqWeeklyDays := dayslist;
+
+ endif;
+ If exists AltDaysDose1 and AltDaysDose1_list = "None" then
+
+ If exists Dailyfreq and Dailyfreq_value <> "None" then
+ regular_freq_value.FrequencySummary := Dailyfreq_value;
+
+
+ If Dailyfreq_value = "Now" then
+
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := "Routine";
+
+ elseif Dailyfreq_value = "Stat" then
+
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := "STAT";
+ else;
+
+ requested_time_value.ReqTimeValue := "21:00";
+ requested_time_value.ReqTimeCode := "Scheduled/Start Time";
+
+ endif;
+
+ endif;
+ endif;
+
+
+
+ // if the frequency is {{{SINGLE-QUOTE}}}User Schedule{{{SINGLE-QUOTE}}} then PRN, stat/then, now/then is not available
+ If regular_freq_value.FrequencySummary = "" then
+ is_prn.control_visible := FALSE;
+ start_now.control_read_only := True;
+ start_now.value := False;
+ stat_then.value := False;
+ stat_then.control_read_only := True;
+ TotalDosing.value := NULL;
+ TotalDosing.control_read_only := True;
+
+ else
+
+ is_prn.control_visible := TRUE;
+
+ endif;
+
+ If (regular_freq_value.FrequencySummary <> "STAT")and (requested_time_value.ReqTimeCode = "STAT")
+ then
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := NULL;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_RX_WEEKLY_SCHED_PRIORITY.mlm b/MLMStripper/bin/Debug/FORM/FORM_RX_WEEKLY_SCHED_PRIORITY.mlm
new file mode 100644
index 0000000..606a407
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_RX_WEEKLY_SCHED_PRIORITY.mlm
@@ -0,0 +1,168 @@
+maintenance:
+
+ title: Med With Weekly Schedule;;
+ mlmname: FORM_Rx_Weekly_Sched_Priority;;
+ arden: version 2;;
+ version: 15.10;;
+ institution: St Clair ;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2016-01-07;;
+ validation: testing;;
+
+library:
+ purpose: Used with methotrexate orders to take information mapped from order set and create a user schedule for weekly orders
+
+ ;;
+
+ explanation: This MLM uses information mapped from order set dictionaries to create a user schedule for weekly orders.
+
+
+
+ Change History
+
+ 01/26/2016 TMS New MLM to set the priority of Weekly Orders CSR 33699
+
+
+ ;;
+ keywords: Called MLMs, Form fields, User Schedule
+ ;;
+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;
+
+ PrimaryObjdetail:=this_communication.PrimaryObj;
+ session_type := PrimaryObjdetail.internalprocessingtype;
+
+
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // References the LOCAL SESSION object
+ local_session := cds_session.local;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+
+ // Obtain fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
+ requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
+ is_prn := last of (field_list where field_list.DataItemName = "IsPRN" );
+ regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode");
+ requested_time_value := requested_time.value;
+ regular_freq_value := regular_freq.value;
+ start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
+ stat_then := first of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then");
+ TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses");
+ TotalDosing_value := TotalDosing.value;
+ RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments");
+ RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions");
+ AltDaysDose1 := last of (field_list where field_list.DataItemName = "PRX_SchedDays1" and field_List.Control_MultiFieldOccNum = 1);
+ AltDaysDose1_list := AltDaysDose1.value;
+ AltTimesDose1 := last of (field_list where field_list.DataItemName = "PRX_SchedTimes" and field_List.Control_MultiFieldOccNum = 1);
+ AltTimesDose1_list := AltTimesDose1.value;
+ DailyFreq := last of (field_list where field_list.DataItemName = "PRX_Std_Schedule");
+ DailyFreq_value := DailyFreq.value;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ RX_Comments_field_value := RX_Comments_field.value;
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ AutoMedScheduling := MLM {{{SINGLE-QUOTE}}}FORM_Antibiotic_Scheduling{{{SINGLE-QUOTE}}};
+
+
+ // build user schedule from days and times selected mapped to order form from order set
+
+ If exists AltDaysDose1 and (AltDaysDose1_list <> "None") then
+
+ If exists AltTimesDose1 and (AltTimesDose1_list <> "None") then
+
+ regular_freq_value.FrequencySummary := "";
+ regular_freq_value.FreqFromTime := 1;
+ regular_freq_value.FreqToTime := 0;
+ regular_freq_value.FreqUOM := "week";
+
+
+ Dayslist := call str_parse with ((AltDaysDose1_list),",");
+ regular_freq_value.FreqWeeklyDays := dayslist;
+
+ Timeslist := call str_parse with ((AltTimesDose1_list),",");
+ regular_freq_value.FreqTimes := timeslist;
+
+ endif;
+
+ endif;
+
+ If exists AltDaysDose1 and AltDaysDose1_list = "None" then
+
+ If exists Dailyfreq and Dailyfreq_value <> "None" then
+ regular_freq_value.FrequencySummary := Dailyfreq_value;
+
+
+ If Dailyfreq_value = "Now" then
+
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := "Routine";
+
+ elseif Dailyfreq_value = "Stat" then
+
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := "STAT";
+ else;
+
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := "Routine";
+ endif;
+
+ endif;
+ endif;
+
+
+
+ // if the frequency is {{{SINGLE-QUOTE}}}User Schedule{{{SINGLE-QUOTE}}} then PRN, stat/then, now/then is not available
+ // since all frequencies for methotrexate are one time or user schedule no need to make stat/now then fields available
+ If regular_freq_value.FrequencySummary = "" then
+ is_prn.control_visible := FALSE;
+ start_now.control_read_only := True;
+ start_now.value := False;
+ stat_then.value := False;
+ stat_then.control_read_only := True;
+ TotalDosing.value := NULL;
+ TotalDosing.control_read_only := True;
+
+ else
+
+ is_prn.control_visible := TRUE;
+
+ endif;
+ // do not allow a stat priority if frequency is not stat
+ If (regular_freq_value.FrequencySummary <> "STAT")and (requested_time_value.ReqTimeCode = "STAT")
+ then
+ requested_time_value.ReqTimeValue := NULL;
+ requested_time_value.ReqTimeCode := NULL;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_S2V_ORM_FORMOPEN.mlm b/MLMStripper/bin/Debug/FORM/FORM_S2V_ORM_FORMOPEN.mlm
new file mode 100644
index 0000000..b51feaa
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_S2V_ORM_FORMOPEN.mlm
@@ -0,0 +1,425 @@
+maintenance:
+
+ title: Called MLM to support ORM from Form Open;;
+ filename: FORM_S2V_ORM_FormOpen;;
+ arden: version 2.5;;
+ version: 1.11;; //5.5 FP1 - MLM Version 11
+ institution: Allscripts, Speed to Value MLM;;
+ author: Allscripts, Phil Thomas;;
+ specialist: ;;
+ date: 2012-10-23;;
+ validation: testing;;
+library:
+ purpose:
+
+ Modification History
+ 02-01-2012 - Phil Thomas - New MLM to support 5.5 FP1 ORM by hiding or un-hiding the MultumDrugName UDDI based upon discharge session type used.
+
+ 02-09-2012 - Jeff Moore - Modified to exclude non-formulary forms from having the MultumDrugName UDDI controlled by this MLM
+
+ 06-09-2012 - Phil Thomas - Added a check for the required medication form fields and if NULL or required then display the form
+
+ 07-27-2012 - Phil Thomas - Added a check to the required fields update to only evaluate and display the form if the
+ triggering call was FormOpen
+
+ 08-10-2012 - Phil Thomas - Added logic to display the home medication instructions as a banner alert, if the inpatient order entry form
+ is displayed to the end user. If an inpatient order is being created from a home medication that has multiple entries
+ in the OMP, the system will display the banner alert with *Duplicate* at the beginning of the message and display
+ the information from the last entry in the OMP.
+
+ 08-13-2012 - Phil Thomas - Added additional funtionality to warn a clinician if the matching home medication to an admission converted inpatient order was
+ not reviewed or entered in the current visit.
+
+ 10-23-2012 - Jeff Moore - Fixed a logic issue where the non-reviewed medication message might not have appeared consistently
+
+ ;;
+ explanation: This MLM is designed to run from FORM OPEN and will modify the field properties for "MultumDrugName", "RxQuantityAmount_SCM" and "RxDurationAmount_SCM" fields
+ based upon if the session type is a discharge or not. In the S2V build this is a sub-called MLM from the "Form_FormOpen_Coord" MLM.
+
+ Change History
+ 04.11.2017 TMS CSR 35364: Added logic to set a checkbox on the form if opened from ORM and to value SCH indication fields for medications that can be used
+ as chemical restraints to {{{SINGLE-QUOTE}}}home medication regimen{{{SINGLE-QUOTE}}}
+ 07.23.2019 TMS CSR 37676: Change log_execution_info to false per upgrade analysis.
+
+*** Allscripts Disclaimer:
+ Client is responsible for all decisions, acts, and omissions of any persons in connection with the delivery of medical care or other services to any patients.
+ Before any Licensed Materials are placed into a live production environment, it is Client’s responsibility to review and test all Licensed Materials and associated
+ workflows and other content, as implemented, make independent decisions about system settings and configuration based upon Client’s needs, practices, standards and
+ environment, and reach its own independent determination that they are appropriate for such live production use. Any such use by Client (or its Authorized Users)
+ will constitute Client’s representation that it has complied with the foregoing. Client shall ensure that all Authorized Users are appropriately trained in use of
+ the then-deployed release of the Software prior to their use of the Software in a live production environment. Clinical Materials are tools to assist Authorized
+ Users in the delivery of medical care, but should not be viewed as prescriptive or authoritative. Clinical Materials are not a substitute for, and Client shall
+ ensure that each Authorized User applies in conjunction with the use thereof, independent professional medical judgment. Clinical Materials are not designed for use,
+ and Client shall not use them, in any system that provides medical care without the participation of properly trained personnel. Any live production use of Clinical
+ Materials by Client (or its Authorized Users) will constitute Client’s acceptance of clinical responsibility for the use of such materials.
+ ;;
+ keywords: Called MLMs, Form fields, Form Open, Orders Reconciliaition, MultumDrugName;
+ ;;
+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; //Set to FALSE for Production
+
+ //Indicate the PRN Reason UDDI Name used on your Medication order forms
+ // (tms) PRN_Reason_UDDI := "PRNReasonText"; //PRNReasonText is the system supplied value
+ PRN_Reason_UDDI := "PRX_PRNCONDITION"; //PRNReasonText is the system supplied value
+
+ //Should the Home Medication Instructions appear in the banner of the order entry form if it is forced to display due to a required field missing?
+ Enable_Hx_Instructions_in_Banner := TRUE;
+
+ //Should the clinician be warned whenever a home medication being converted to an admission inpatient medication was not reviewed or entered in the current visit?
+ //Note: The Banner rule above will be overridden by this rule if this warning message appears
+ // (tms) Enable_Non_Review_Notify := TRUE;
+ Enable_Non_Review_Notify := FALSE;
+
+ /******************Do Not Make Changes Below this Line!**********************************/
+
+
+ Order_GUID := this_communication.ItemID;
+ Order_Form := this_communication.FormType;
+ Order_Type := this_communication.OrderType;
+ Order_Name := this_communication.OrderName;
+ Display_Form_Init:= this_communication.DisplayForm;
+ OrderCatalogItemGUID := this_Communication.ItemID;
+ ClientGUID := this_Communication.ClientGUID;
+ ClientVisitGUID := this_Communication.ClientVisitGUID;
+
+ //capture the Order Session type used found in the primary object
+ Primary_Obj := this_communication.PrimaryObj;
+ Session_Type := Primary_Obj.InitialSessionTypeCode;
+ Internal_Session_Type := Primary_Obj.InternalProcessingType;
+ order_source := primary_Obj.SourceCode;
+ DC_Session_Type:= primary_Obj.IsForDischarge;
+ Display_Form_Init:= this_communication.DisplayForm;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+
+
+ //Capture the Calling Event
+ Calling_Event := this_communication.CallingEvent;
+
+
+ AdmitDateTime := read last
+ { "Select AdmitDtm From CV3ClientVisit"
+ || " Where GUID = " || SQL(ClientVisitGUID) };
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+ Form_Displayed := FALSE;
+ RX_DrugName := NULL;
+ Dup_Home_Med := FALSE;
+ Reviewed_This_Visit := FALSE;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ NoDefaults := first of (field_list
+ where field_list.DataItemName = "PRX_NoDefaultValues");
+ ChemRestraintInd := last of (field_list
+ where field_list.DataItemName = "NUR_Nonchemical Restraint Ind" );
+ MedMgtCB := last of (field_list
+ where field_list.DataItemName = "NUR_Not Chemical Restraint" );
+
+ //***Sample Code to add to determine if the form is being opened in ORM during admission reconciliation
+ //If this is not a Discharge Session and the form was set to not display then
+ // confirm this in the configuration of the Catalog Item Class Type Entry and
+ // if the Multum Drug Name UDDI was valued (generally by ORM itself).
+ If Not DC_Session_Type and Display_Form_Init = "No" and this_communication.OrderSet = "No" Then
+ //Assumes the MulumDrugName field is present
+ // MultumDrugName_field := first of (field_list where field_list.DataItemName =
+ // "MultumDrugName");
+ // If Exist MultumDrugName_field and MultumDrugName_field.Value Is Not NULL then
+ // MultumDrugName_field_Value := MultumDrugName_field.Value;
+ //Query to see if this item was configured for Do Not Display Form Option
+ //(ORM sets the above property based upon this)
+ Item_Guid := Read Last
+ {" SELECT CV3CatalogClassTypeValue.CatalogMasterGUID FROM
+ CV3CatalogClassTypeValue INNER JOIN"
+ || " CV3ClassType ON CV3CatalogClassTypeValue.ClassTypeGUID =
+ CV3ClassType.GUID"
+ || " WHERE CV3ClassType.Code = {{{SINGLE-QUOTE}}}SYS-ORM-OpenFormAtConversion{{{SINGLE-QUOTE}}} AND
+ CV3CatalogClassTypeValue.CatalogMasterGUID = " || SQL(OrderCatalogItemGUID)
+ || " AND CV3CatalogClassTypeValue.Value = {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} "};
+
+ //Set a flag that this order form is opening due to an admission orders reconciliation action
+ If Item_Guid Is Not NULL then
+ Is_From_ORM_Admit := TRUE;
+ NoDefaults.value := "True";
+ If( exists ChemRestraintInd and ChemRestraintInd.value is null) and ( exists MedMgtCB and MedMgtCb.value = false) then
+
+ ChemRestraintInd.value := "Home Medication Regimen";
+ MedMgtCb.value := true;
+ endif;
+
+ Endif;
+ // Endif;
+ Endif;
+
+ //Section to Hide the ORM fields when the Session Type is not a Discharge Session
+ //This is the query to determine if the item is configured as a Non-Formulary to be used within ORM
+ //This is determine by checking if the item has the use this item for unmapped prescriptions checkbox checked
+ (Unmapped_Rx) := read last
+ {" select Name"
+ ||" from CV3OrderCatalogMasterItem "
+ ||" where CV3OrderCatalogMasterItem.GUID = "|| sql (Order_GUID)
+ ||" and CV3OrderCatalogMasterItem.IsUnmappedPrescriptionItem = 1 "
+ , primarytime = significantdtm};
+
+
+ // Capture the RxDurationAmount_SCM and RxQuantityAmount_SCM fields and MultumDrugName
+ Rx_Duration := first of (field_list where field_list.DataItemName = "RxDurationAmount_SCM");
+ Rx_Quantity := first of (field_list where field_list.DataItemName = "RxQuantityAmount_SCM");
+ Drug_Name := first of (field_list where field_list.DataItemName = "MultumDrugName");
+
+
+ //Capture required Dosing Fields and check if NULL to override ORM from not displaying the form and prevent
+ // The user from getting the standard order entry mandatory field pop-up message
+ CalculatedDose_field := first of (field_list where field_list.DataItemName = "CalculatedDose");
+ If exists CalculatedDose_field then
+ CalculatedDose_obj := OBJECT [DosageLow, CalcActualDose,
+ CalcOverrideReason, CalcRequestedDose, CalcTotalDailyDose,
+ CalcDoseUOM, CalcUOMPer];
+ CalculatedDoseValue := CalculatedDose_field.Value;
+ //If the Dose is empty and the calling event was Form Open the display the form to avoid the pop-up message
+ If CalculatedDoseValue.DosageLow Is NULL and Calling_Event = "FormOpen" then
+ this_communication.DisplayForm := "Yes";
+ Form_Displayed := TRUE;
+ Endif;
+ Endif;
+
+ //DoseageLow Check for NULL from ORM
+ DosageLow_field := first of (field_list where field_list.DataItemName = "DosageLow");
+ //If the Dose is empty and the calling event was Form Open the display the form to avoid the pop-up message
+ If exists DosageLow_field and DosageLow_field.Value Is NULL and Calling_Event = "FormOpen" then
+ this_communication.DisplayForm := "Yes";
+ Form_Displayed := TRUE;
+ Endif;
+
+ //Frequency Check for NULL from ORM
+ Freq_field := first of (field_list where field_list.DataItemName = "FrequencyCode");
+ If exists Freq_field and Freq_field.control_mandatory then Freq_field_Value := Freq_field.Value;
+ Freq_field_FrequencySummary := Freq_field_value.FrequencySummary;
+ //If the Freq is empty and the calling event was Form Open the display the form to avoid the pop-up message
+ If Freq_field_FrequencySummary Is NULL and Calling_Event = "FormOpen" then
+ this_communication.DisplayForm := "Yes";
+ Form_Displayed := TRUE;
+ Endif;
+ Endif;
+
+ //PRN Check for value if set to mandatory
+ PRN_Reason_field := first of (field_list where field_list.DataItemName = PRN_Reason_UDDI);
+ If exists PRN_Reason_field and PRN_Reason_field.Value Is NULL then
+ //If the PRN Reason is empty + mandatory and the calling event was Form Open the display the form to avoid the pop-up message
+ If PRN_Reason_field.control_mandatory and Calling_Event = "FormOpen" then
+ this_communication.DisplayForm := "Yes";
+ Form_Displayed := TRUE;
+ Endif;
+ Endif;
+
+ //Route Code Check for value if set to mandatory
+ Route_field := first of (field_list where field_list.DataItemName = "OrderRouteCode");
+ //If the Route field is empty + mandatory and the calling event was Form Open the display the form to avoid the pop-up message
+ If exists Route_field and Route_field.Value Is NULL then
+ If Route_field.control_mandatory and Calling_Event = "FormOpen" then
+ this_communication.DisplayForm := "Yes";
+ Form_Displayed := TRUE;
+ Endif;
+ Endif;
+
+
+ //*****UN-Hide Section for Discharge Sessions******//
+
+ //Unhide the form fields if the Discharge Session Type is used
+ //This code uses the Session Type Name configured (use if only one)
+ //If exist Drug_Name AND Session_Type = "Discharge Orders" then //Name must match config
+
+ //Use this code to use the Internal Session Type (use if more than one)
+ If exist Drug_Name AND Internal_Session_Type = "Discharge" and Unmapped_Rx is null then
+
+ // Un-Hide each field if it exists
+ If exists Rx_Duration then Rx_Duration.control_visible := TRUE;
+ Rx_Duration.CONTROL_READ_ONLY := FALSE;
+ Endif;
+
+ If exists Rx_Quantity then Rx_Quantity.control_visible := TRUE;
+ Rx_Quantity.CONTROL_READ_ONLY := FALSE;
+ Endif;
+
+ If exists Drug_Name then
+ Drug_Name.control_visible := TRUE;
+ Drug_Name.control_mandatory := TRUE;
+ Drug_Name.CONTROL_READ_ONLY := FALSE;
+ Endif;
+ Endif; //End of new Discharge Session Type Field Control Logic
+
+
+ //*****Hide Section for non-Discharge Sessions******//
+
+ //Now hide the form fields if the Session Type other than Discharge is used
+
+ //This code uses the Session Type Name configured (use if only one)
+ //If exist Drug_Name AND Session_Type <> "Discharge Orders" then //Name must match config
+
+ //Use this code to use the Internal Session Type (use if more than one)
+ If exist Drug_Name AND Internal_Session_Type <> "Discharge" AND Unmapped_Rx is null then
+
+ // Hide each field if it exists
+ If exists Rx_Duration then Rx_Duration.control_visible := FALSE;
+ Rx_Duration.CONTROL_READ_ONLY := TRUE;
+ Endif;
+
+ If exists Rx_Quantity then Rx_Quantity.control_visible := FALSE;
+ Rx_Quantity.CONTROL_READ_ONLY := TRUE;
+ Endif;
+
+ If exists Drug_Name then
+ Drug_Name.control_visible := FALSE;
+ Drug_Name.control_mandatory := FALSE;
+ Drug_Name.CONTROL_READ_ONLY := TRUE;
+ Endif;
+ Endif; //End of new Discharge Session Type Field Control Logic
+
+
+ //New Logic to attempt to pull the Home Medication instructions and display on the Order Entry Form Banner if the form is formed to open like for a mandatory PRN Reason
+ //If Not Form_Displayed AND Is_From_ORM_Admit Then
+ If Is_From_ORM_Admit Then
+
+ //Query to figure out what home medication was selected based upon the catalog item mapping configruation
+ (RX_DrugName, RX_DoseAmt, RX_Route, RX_Instructions, RX_Comments, RX_Memo, RX_PharmMemo, RX_PRNReason, RX_GenericID, RX_Type, RX_Status, OMR_LastDose, OMR_RXFreq_ID, ORD_OCMI, RX_IsPRN, RX_TouchedWhen) := READ
+ {"SELECT cp.DrugName, cp.DoseAmount, cp.Route, cp.Instructions, cp.Comments, cp.Memo, cp.PharmacyMemo, cp.PrnReason, cp.GenericItemID, "
+ || "cp.PrescriptionType, cp.StatusType, SXAAMBOrderMedRecReviewDetail.LastDoseTaken, cp.ScriptFrequencyID, dm.CatalogItemGUID, cp.IsPrn, cp.TouchedWhen "
+ || "FROM SXAAMBOrderMedRecReviewDetail INNER JOIN SXAAMBOrderMedRecReview ON SXAAMBOrderMedRecReviewDetail.MedRecReviewID = SXAAMBOrderMedRecReview.MedRecReviewID "
+ || "INNER JOIN SXAAMBClientPrescription AS cp INNER JOIN SXARxGenericName AS gn ON gn.GenericNameID = cp.GenericNameID "
+ || "INNER JOIN CV3DrugMapping AS dm ON dm.DrugKey = gn.DrugCatalogKey ON SXAAMBOrderMedRecReviewDetail.PrescriptionID = cp.PrescriptionID "
+ || "AND SXAAMBOrderMedRecReview.ClientGUID = cp.ClientGUID AND SXAAMBOrderMedRecReview.ClientGUID = cp.ClientGUID "
+ || "WHERE (cp.ClientGUID = " || SQL(ClientGUID) || ") AND (cp.Instructions IS NOT NULL) AND (dm.CatalogItemGUID = " || SQL(OrderCatalogItemGUID) || ") "
+ || "AND (SXAAMBOrderMedRecReview.VisitGUID = " || SQL(ClientVisitGUID) || ") AND StatusType = 1 "
+ //|| "AND (SXAAMBOrderMedRecReview.ReviewDtm >= CONVERT(DATETIME, " || SQL(AdmitDateTime) || ", 102)) "
+ //|| "AND (cp.DrugName = " || SQL(MultumDrugName_field_Value) || ") " <-Use only if looking at dnum only
+ || "ORDER BY cp.TouchedWhen"};
+
+
+
+
+ Total_RX_DrugName := Count of (RX_DrugName);
+/*
+ //Flag if more than one matching home medication was found in the reverse query
+ If Total_RX_DrugName > 1 then
+ Dup_Home_Med_Warning := "*Duplicate Home Med Found!* ";
+ Else
+ Dup_Home_Med_Warning := "";
+ Endif;
+*/
+
+//new teresa
+ If Total_RX_DrugName > 1 then
+ If Total_RX_DrugName < 5 then
+ homelist := "";
+ For i in (1 seqto (Total_RX_DrugName)) do
+ Homelist := Homelist || "[" || (RX_DrugName)[i] || ": " || (RX_Instructions)[i] || "] ";
+ Enddo;
+ Else Homelist := " This patient has more than 4 orders for the same medication. Please review all entries." ;
+ Endif;
+
+ Else
+ Dup_Home_Med_Warning := "";
+ Endif;
+
+// endnew teresa
+
+
+ //Banner Instructions section
+ If Enable_Hx_Instructions_in_Banner Then
+ If last of (RX_DrugName) Is Not NULL and Total_RX_DrugName < 2 Then
+ //this_communication.DisplayForm := "Yes";
+// this_communication.Message := Dup_Home_Med_Warning || "Instructions from last Home Med: " || first of (RX_DrugName) || " (" || first of (RX_Route) || ") with instructions: " || first of (RX_Instructions);
+ this_communication.Message := "Home Order: [" ||first of (RX_DrugName) || ": " ||first of (RX_Instructions) || "] ";
+ this_communication.MessageType := "Banner";
+ Else
+ // If last of (RX_DrugName) Is Not NULL and Total_RX_DrugName > 1 Then
+ this_communication.Message := "There are {{{SINGLE-QUOTE}}}"|| Total_RX_DrugName
+ || "{{{SINGLE-QUOTE}}} home orders for this drug. " || Homelist ;
+ this_communication.MessageType := "Banner";
+ // dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "There are {{{SINGLE-QUOTE}}}"|| Total_RX_DrugName
+ // || "{{{SINGLE-QUOTE}}} home orders for this drug. " || CRLF || Homelist ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Endif;
+ Endif;
+
+ If Enable_Non_Review_Notify then
+
+ //Query to find the last Review Date for the matching Home edication found
+ (RX_DrugName_HX, RX_DoseAmt_HX, RX_Route_HX, RX_Instructions_HX, RX_Comments_HX, RX_Memo_HX, RX_PharmMemo_HX, RX_PRNReason_HX, RX_GenericID_HX, RX_Type_HX, RX_Status_HX, OMR_LastDose_HX,
+ OMR_RXFreq_ID_HX, ORD_OCMI_HX, Visit_ID_HX, Visit_Type_HX, Visit_CL_HX, VisitGUID_HX, ReviewDTM_HX) := READ LAST
+ {"SELECT cp.DrugName, cp.DoseAmount, cp.Route, cp.Instructions, cp.Comments, cp.Memo, cp.PharmacyMemo, cp.PrnReason, cp.GenericItemID, "
+ || "cp.PrescriptionType, cp.StatusType, SXAAMBOrderMedRecReviewDetail.LastDoseTaken, cp.ScriptFrequencyID, dm.CatalogItemGUID, "
+ || "CV3ClientVisit.VisitIDCode, CV3ClientVisit.TypeCode, CV3ClientVisit.CareLevelCode, SXAAMBOrderMedRecReview.VisitGUID, SXAAMBOrderMedRecReview.ReviewDtm "
+ || "FROM SXAAMBOrderMedRecReviewDetail INNER JOIN SXAAMBOrderMedRecReview ON SXAAMBOrderMedRecReviewDetail.MedRecReviewID = SXAAMBOrderMedRecReview.MedRecReviewID "
+ || "INNER JOIN SXAAMBClientPrescription AS cp INNER JOIN SXARxGenericName AS gn ON gn.GenericNameID = cp.GenericNameID "
+ || "INNER JOIN CV3DrugMapping AS dm ON dm.DrugKey = gn.DrugCatalogKey ON SXAAMBOrderMedRecReviewDetail.PrescriptionID = cp.PrescriptionID "
+ || "AND SXAAMBOrderMedRecReview.ClientGUID = cp.ClientGUID AND SXAAMBOrderMedRecReview.ClientGUID = cp.ClientGUID "
+ || "INNER JOIN CV3ClientVisit ON SXAAMBOrderMedRecReview.VisitGUID = CV3ClientVisit.GUID "
+ || "WHERE (cp.ClientGUID = " || SQL(ClientGUID) || ") AND (dm.CatalogItemGUID = " || SQL(OrderCatalogItemGUID) || ") "
+ || "AND StatusType = 1 "
+ || "ORDER BY SXAAMBOrderMedRecReview.TouchedWhenUTC"};
+
+ If RX_DrugName_HX Is Not NULL then
+
+ //Compare the Visit GUID of the last reviewed visit for the selected medication and compare to the current Visit Guid
+ If VisitGUID_HX = ClientVisitGUID then
+ Reviewed_This_Visit := TRUE;
+ Else
+ Reviewed_This_Visit := FALSE;
+
+ If OMR_LastDose_HX Is Not NULL then
+
+ //Notify the user that the home medication being converted was not reviewed or entered on the current visit
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "WARNING: The Home Medication that matches this formulary item was not reviewed/confirmed for this visit."
+ || " This home medication was last reviewed on:" || CRLF || OMR_LastDose_HX || " on Visit ID: " || Visit_ID_HX;
+ this_communication.MessageType := "Informational"; //Change to "error" if you wish to stop the inpatient medication entry.
+ Else
+ //Notify the user that the home medication being converted was not reviewed or entered on the current visit
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "WARNING: The Home Medication that matches this formulary item was not reviewed/confirmed for this visit." ;
+ this_communication.MessageType := "Informational"; //Change to "error" if you wish to stop the inpatient medication entry.
+ Endif;
+ Endif; //Review Visit Check
+ Endif; //Home Medication was found
+
+ Endif; //Enable Non-Review Warning
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SAVE_ADMITTOINPATIENT_PLACEINOBS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SAVE_ADMITTOINPATIENT_PLACEINOBS.mlm
new file mode 100644
index 0000000..59e137b
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SAVE_ADMITTOINPATIENT_PLACEINOBS.mlm
@@ -0,0 +1,246 @@
+maintenance:
+
+ title: Form_Save_AdmitToInPatient_PlaceInObs ;;
+ mlmname: Form_Save_AdmitToInPatient_PlaceInObs ;;
+ arden: version 2.5;;
+ version: 6.00;;
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-01-16;;
+ validation: testing;;
+
+library:
+ purpose: Explanation to Change
+ -----------------------------------------
+ 14-05-2015 - GMS - Created New
+ 22-01-2019 - JML - CSR 37770 - Modified to create Admission Order Confirmation order when Admit to Inpatient or Place in Observation order is entered
+ that allows the attending physician to sign / co-sign
+ ;;
+ explanation: Create the Request Bed order wwhile populating the information in the free text box, when the Admit to inpatient or Place in observation order item is placed in ED.
+ The order will use the ED physician as the requestor verify if PA or CRNP
+ Will NOT be in a HOLD session
+ Will only be used in the ED location
+ If No ED ohysician is slected then by default it should place the order on the name of "Jasson, Biggs"
+ Information to Display in the Request Bed Comments sections (see screen shot)
+
+ INP or OBS
+ Bushman(Attending)
+ Resistant Organism=V (Comments)
+ Telemetry
+ CCU or ICU
+ Pneumonia (Diagnosis)
+ Risk Score=4 (score)
+ Isolation
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // This MLM is passed three arguments, of types
+ // communication_type, form_type and client info object respectively.
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+
+ log_execution_info := FALSE;
+ error_message:="";
+//-----------------------------------------------------------------------------------------------------------------
+ SaveMLM := MLM {{{SINGLE-QUOTE}}}FORM_HEALTH_ISSUE_ENTERED_FROM_ORDER_FORM{{{SINGLE-QUOTE}}};
+ this_communication,this_form := Call SaveMLM With this_communication,this_form,client_info_obj ;
+//-----------------------------------------------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------------
+ // References the LOCAL SESSION object
+ local_session := cds_session.local; // for local_session.SessionRequestBed
+
+//-------------------------------------------------------------------------------
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ clientGuid := this_communication.ClientGUID;
+ visitGuid := this_communication.ClientVisitGUID;
+ chartGuid := this_communication.ChartGUID;
+ UserGuid := this_communication.UserGUID;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ item_event := this_communication.itemevent;
+ form_type := this_communication.formtype;
+
+
+ local_session.SessionRequestedGUID := this_communication.CareProviderGUID ;
+
+
+ // Form Order Name
+ If this_form.Name= "CPOE_Admit Obs HI" Then
+ Order_Name := "OBS" ;
+ AdmissionOrderName := "OBS";
+ Else
+ Order_Name := "Adm" ;
+ AdmissionOrderName := "INPT";
+ EndIf;
+
+ StrFinal := StrFinal || Order_Name || ", " ;
+
+ Attn_Provider := last of ( field_list WHERE field_list.DataItemName = "Obj_Plus_Consult" and field_list.Control_MultiFieldOccNum = 1); HI_Attn_Provider := Attn_Provider.Value;
+ If exists HI_Attn_Provider Then
+ HI_Attn_Provider:= HI_Attn_Provider ;
+ Endif ;
+ StrFinal := StrFinal || HI_Attn_Provider || ", " ;
+
+ Admit_Diagnosis := last of ( field_list WHERE field_list.DataItemName = "OBJ_PLUS_ADM_Health Issue" );
+
+ Eff_Date := last of ( field_list WHERE field_list.DataItemName = "CM_Patient_Change_Date" );
+ Eff_Date_Month := SUBSTRING 2 CHARACTERS From ( Eff_Date.Value as string );
+ Eff_Date_Day := Substring 2 Characters starting at 4 from ( Eff_Date.Value as string );
+ Eff_Date_Year := substring 4 characters starting at 7 from ( Eff_Date.Value as string );
+ Eff_Date_Converted := Eff_Date_Year || "-" || Eff_Date_Month || "-" || Eff_Date_Day;
+
+ Eff_Time := last of ( field_list WHERE field_list.DataItemName = "RequestedTime" );
+ Eff_Time_Val := Eff_Time.Value;
+ Eff_Time_Value := Eff_Time_Val.ReqTimeValue;
+
+ /*Qualify := last of ( field_list WHERE field_list.DataItemName = "CPOE_Adm_TwoMidnight" and field_list.Control_MultiFieldOccNum = 1); HI_Qualify := Qualify.Value;
+ If exists HI_Qualify And HI_Qualify= True Then
+ HI_Qualify := "Qualifies for Two Midnight ";
+ Endif ;
+ StrFinal := StrFinal || HI_Qualify || ", " ; */
+
+ HealthIssue := last of ( field_list WHERE field_list.DataItemName = "HealthIssues" and field_list.Control_MultiFieldOccNum = 1); HI_HealthIssue := HealthIssue.Value;
+ If exists HI_HealthIssue And HI_HealthIssue = True Then
+ HI_HealthIssue := "Launch Health issues :";
+ Endif ;
+ StrFinal := StrFinal || HI_HealthIssue || ", " ;
+
+ HI_General := last of ( field_list WHERE field_list.DataItemName = "HI Check 1" and field_list.Control_MultiFieldOccNum = 1); HHI_General := HI_General.Value;
+ HI_Cardio := last of ( field_list WHERE field_list.DataItemName = "HI Check 2" and field_list.Control_MultiFieldOccNum = 1); HHI_Cardio := HI_Cardio.Value;
+ HI_Resp := last of ( field_list WHERE field_list.DataItemName = "HI Check 3" and field_list.Control_MultiFieldOccNum = 1); HHI_Resp := HI_Resp.Value;
+ HI_Infection := last of ( field_list WHERE field_list.DataItemName = "HI Check 4" and field_list.Control_MultiFieldOccNum = 1); HHI_Infection := HI_Infection.Value;
+ HI_Genito := last of ( field_list WHERE field_list.DataItemName = "HI Check 5" and field_list.Control_MultiFieldOccNum = 1); HHI_Genito := HI_Genito.Value;
+ HI_Nuero := last of ( field_list WHERE field_list.DataItemName = "HI Check 6" and field_list.Control_MultiFieldOccNum = 1); HHI_Nuero := HI_Nuero.Value;
+ HI_Neoplasm := last of ( field_list WHERE field_list.DataItemName = "HI Check 7" and field_list.Control_MultiFieldOccNum = 1); HHI_Neoplasm := HI_Neoplasm.Value;
+ HI_Ortho := last of ( field_list WHERE field_list.DataItemName = "HI Check 8" and field_list.Control_MultiFieldOccNum = 1); HHI_Ortho := HI_Ortho.Value;
+ HI_Behavior := last of ( field_list WHERE field_list.DataItemName = "HI Check 9" and field_list.Control_MultiFieldOccNum = 1); HHI_Behavior := HI_Behavior.Value;
+ HI_Gastro := last of ( field_list WHERE field_list.DataItemName = "HI Check 10" and field_list.Control_MultiFieldOccNum = 1); HHI_Gastro := HI_Gastro.Value;
+ HI_Pedia := last of ( field_list WHERE field_list.DataItemName = "HI Check 11" and field_list.Control_MultiFieldOccNum = 1); HHI_Pedia := HI_Pedia.Value;
+
+ LI_General := last of ( field_list WHERE field_list.DataItemName = "HI List 1" and field_list.Control_MultiFieldOccNum = 1); LLI_General := LI_General.Value;
+ LI_Cardio := last of ( field_list WHERE field_list.DataItemName = "HI List 2" and field_list.Control_MultiFieldOccNum = 1); LLI_Cardio := LI_Cardio.Value;
+ LI_Resp := last of ( field_list WHERE field_list.DataItemName = "HI List 3" and field_list.Control_MultiFieldOccNum = 1); LLI_Resp := LI_Resp.Value;
+ LI_Infection := last of ( field_list WHERE field_list.DataItemName = "HI List 4" and field_list.Control_MultiFieldOccNum = 1); LLI_Infection := LI_Infection.Value;
+ LI_Genito := last of ( field_list WHERE field_list.DataItemName = "HI List 5" and field_list.Control_MultiFieldOccNum = 1); LLI_Genito := LI_Genito.Value;
+ LI_Nuero := last of ( field_list WHERE field_list.DataItemName = "HI List 6" and field_list.Control_MultiFieldOccNum = 1); LLI_Nuero := LI_Nuero.Value;
+ LI_Neoplasm := last of ( field_list WHERE field_list.DataItemName = "HI List 7" and field_list.Control_MultiFieldOccNum = 1); LLI_Neoplasm := LI_Neoplasm.Value;
+ LI_Ortho := last of ( field_list WHERE field_list.DataItemName = "HI List 8" and field_list.Control_MultiFieldOccNum = 1); LLI_Ortho := LI_Ortho.Value;
+ LI_Behavior := last of ( field_list WHERE field_list.DataItemName = "HI List 9" and field_list.Control_MultiFieldOccNum = 1); LLI_Behavior := LI_Behavior.Value;
+ Ll_Gastro := last of ( field_list WHERE field_list.DataItemName = "HI List 10" and field_list.Control_MultiFieldOccNum = 1); LLI_Gastro := Ll_Gastro.Value;
+ LI_Pedia := last of ( field_list WHERE field_list.DataItemName = "HI List 11" and field_list.Control_MultiFieldOccNum = 1); LLI_Pedia := LI_Pedia.Value;
+
+
+
+ //Hi_List := last of ( field_list WHERE (field_list.DataItemName MATCHES PATTERN "%HI Check%") );
+ /* If HHI_General=True Then sel := "General :"; Elseif HHI_Cardio =True Then sel := "CardioVascular :"; Elseif HHI_Resp =True Then sel := "Respiratory :"; Elseif HHI_Infection =True Then sel := "Infrction :";
+ Elseif HHI_Genito =True Then sel := "Genitourinary :"; Elseif HHI_Nuero =True Then sel := "Neurology :"; Elseif HHI_Neoplasm =True Then sel := "NeoPlasm :"; Elseif HHI_Ortho =True Then sel := "Orthopedic :";
+ Elseif HHI_Behavior =True Then sel := "Behavioral :"; Elseif HHI_Gastro =True Then sel := "GastroIntestinal :"; Elseif HHI_Pedia =True Then sel := "Pediatric :"; Endif;
+ */
+
+
+ //StrFinal := StrFinal || "Dignosis :" ;
+ //If HHI_General=True or HHI_Cardio =True or HHI_Resp =True or HHI_Infection =True or HHI_Genito =True or HHI_Nuero =True or HHI_Neoplasm =True or HHI_Ortho =True
+ // or HHI_Behavior =True or HHI_Gastro =True or HHI_Pedia =True Then
+ Str1 := LLI_General ||", "|| LLI_Cardio ||", "|| LLI_Resp ||", "|| LLI_Infection ||", "|| LLI_Genito ||", "|| LLI_Nuero ||", "|| LLI_Neoplasm ||", "|| LLI_Ortho ||", "|| LLI_Behavior ||", "|| LLI_Gastro ||", "|| LLI_Pedia ;
+ StrFinal1 := Call (Str1 as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with ", null" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, "" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
+ // EndIf;
+ StrFinal := StrFinal || StrFinal1 ;
+
+ C_Diagnosis := last of ( field_list WHERE field_list.DataItemName = "ED_Diagnosis" and field_list.Control_MultiFieldOccNum = 1); CC_Diagnosis := C_Diagnosis.Value;
+ C_HealthIssue := last of ( field_list WHERE field_list.DataItemName = "MLM_Physician_Mandatory_HI" and field_list.Control_MultiFieldOccNum = 1); CC_HealthIssue := C_HealthIssue.Value;
+ If Exists CC_Diagnosis Then
+ StrFinal := StrFinal || ", " || CC_Diagnosis ; Endif;
+ If Exists CC_HealthIssue Then
+ StrFinal := StrFinal || ", " || CC_HealthIssue ; Endif;
+
+
+ C_Telemetry := last of ( field_list WHERE field_list.DataItemName = "NUR_ADTTelemetryCBx" and field_list.Control_MultiFieldOccNum = 1); CC_Telemetry := C_Telemetry.Value;
+ C_CCU := last of ( field_list WHERE field_list.DataItemName = "ED_Unit CCU" and field_list.Control_MultiFieldOccNum = 1); CC_CCU := C_CCU.Value;
+ C_Moni_Bed := last of ( field_list WHERE field_list.DataItemName = "NUR_ADTMonitoredBedCBx" and field_list.Control_MultiFieldOccNum = 1); CC_Moni_Bed := C_Moni_Bed.Value;
+ C_ICU := last of ( field_list WHERE field_list.DataItemName = "ED_Unit ICU" and field_list.Control_MultiFieldOccNum = 1); CC_ICU := C_ICU.Value;
+ C_Unit := last of ( field_list WHERE field_list.DataItemName = "NUR_Unit" and field_list.Control_MultiFieldOccNum = 1); CC_Unit := C_Unit.Value;
+ C_Isolation := last of ( field_list WHERE field_list.DataItemName = "Admit_Isolation" and field_list.Control_MultiFieldOccNum = 1); CC_Isolation := C_Isolation.Value;
+ C_Condition := last of ( field_list WHERE field_list.DataItemName = "NUR_ADTCondition" and field_list.Control_MultiFieldOccNum = 1); CC_Condition := C_Condition.Value;
+ C_Sp_Instr := last of ( field_list WHERE field_list.DataItemName = "SpecialInstructions" and field_list.Control_MultiFieldOccNum = 1); CC_Sp_Instr := C_Sp_Instr.Value;
+ C_Notify := last of ( field_list WHERE field_list.DataItemName = "NUR_NotifyType" and field_list.Control_MultiFieldOccNum = 1); CC_Notify := C_Notify.Value;
+ C_NotifyCrit := last of ( field_list WHERE field_list.DataItemName = "NUR_NotifyFreeText" and field_list.Control_MultiFieldOccNum = 1); CC_NotifyCrit := C_NotifyCrit.Value;
+ C_MROHarmRisk := last of ( field_list WHERE field_list.DataItemName = "Admit_free text" and field_list.Control_MultiFieldOccNum = 1); CC_MROHarmRisk := C_MROHarmRisk.Value;
+
+
+ If Exists CC_Telemetry And CC_Telemetry = True Then
+ StrFinal := StrFinal || ", Telemetry "; Endif;
+ If Exists CC_CCU And CC_CCU = True Then
+ StrFinal := StrFinal || ", CCU "; Endif;
+ If Exists CC_Moni_Bed And CC_Moni_Bed = True Then
+ StrFinal := StrFinal || ", Monitored Bed "; Endif;
+ If Exists CC_ICU And CC_ICU = True Then
+ StrFinal := StrFinal || ", ICU " ; Endif;
+ If Exists CC_Isolation And CC_Isolation = True Then
+ StrFinal := StrFinal || ", Isolation "; Endif;
+ If Exists CC_Unit Then
+ StrFinal := StrFinal || ", " || CC_Unit ; Endif;
+ If Exists CC_Condition Then
+ StrFinal := StrFinal || ", " || CC_Condition ; Endif;
+ /*If Exists CC_Diagnosis Then
+ StrFinal := StrFinal || ", Diagnosis :" || CC_Diagnosis ; Endif;*/
+ If Exists CC_Sp_Instr Then
+ StrFinal := StrFinal || ", Special Instructions :" || CC_Sp_Instr ; Endif;
+ /*If Exists CC_Notify Then
+ StrFinal := StrFinal || ", Notify :" || CC_Notify ; Endif;
+ If Exists CC_NotifyCrit Then
+ StrFinal := StrFinal || ", " || CC_NotifyCrit ; Endif; */
+ //If Exists CC_HealthIssue Then
+ // StrFinal := StrFinal || ", Mandatory Health Issue :" || CC_HealthIssue ; Endif;
+ If Exists CC_MROHarmRisk Then
+ StrFinal := StrFinal || ", " || CC_MROHarmRisk ; Endif;
+
+ // To Remove all Null Values
+
+ StrFinal := Call (StrFinal as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with "null" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, "" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
+
+ local_session.SessionRequestBed := StrFinal ;
+
+ local_session.SessionAdmissionOrderConfirmation := "Admission Type: " || AdmissionOrderName || " Admit Diagnosis: " || Admit_Diagnosis.Value;
+ local_session.SessionAdmissionOrderAttendingPhysician := HI_Attn_Provider;
+ local_session.SessionAdmissionOrderEffectiveDate := Eff_Date_Converted || " " || Eff_Time_Value;
+
+//=============================================
+
+
+//idest:= destination{IntermediateMessage: Warning, "ColValue",high, chart, "RuleGroupHere1", 1001, "", "" };
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action:
+
+// write "d" at idest;
+
+return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SCH_CHECK_MRO_SELECTION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SCH_CHECK_MRO_SELECTION.mlm
new file mode 100644
index 0000000..7accd2b
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SCH_CHECK_MRO_SELECTION.mlm
@@ -0,0 +1,58 @@
+maintenance:
+
+ title: FORM_SCH_CHECK_MRO_SELECTION;;
+ mlmname: FORM_SCH_CHECK_MRO_SELECTION;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: Allscripts;;
+ author: Ankit Mistry;;
+ specialist: Allscripts;;
+ date: 2018-02-14;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+ ;;
+ keywords: Called MLMs, Form fields
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+
+ log_execution_info := false;
+
+ field_list:= this_form.fields;
+ CallingField := this_communication.CallingFieldName;
+
+ MRO_Field_Obj := FIRST OF (field_list WHERE field_list.DataItemName = CallingField);
+ MRO_Value := MRO_Field_Obj.Value;
+
+ IF MRO_Value matches pattern "%No Flag%" THEN
+ IF MRO_Value matches pattern "No Flag" THEN
+ A := "";
+ ELSE
+ NEW_MRO_VALUE := READ FIRST { " SELECT CASE WHEN RIGHT(RTRIM(REPLACE(" || SQL(MRO_Value) || ",{{{SINGLE-QUOTE}}}No Flag{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})),1) = {{{SINGLE-QUOTE}}};{{{SINGLE-QUOTE}}} THEN SUBSTRING(RTRIM(REPLACE(" || SQL(MRO_Value) || ",{{{SINGLE-QUOTE}}}No Flag{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})),1,LEN(RTRIM(REPLACE(" || SQL(MRO_Value) || ",{{{SINGLE-QUOTE}}}No Flag{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})))-1) ELSE RTRIM(REPLACE(" || SQL(MRO_Value) || ",{{{SINGLE-QUOTE}}}No Flag{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})) END " };
+ MRO_Field_Obj.Value := NEW_MRO_VALUE;
+ ENDIF;
+ ENDIF;
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SCIP_ABX_DOSING.mlm b/MLMStripper/bin/Debug/FORM/FORM_SCIP_ABX_DOSING.mlm
new file mode 100644
index 0000000..06f6fa9
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SCIP_ABX_DOSING.mlm
@@ -0,0 +1,316 @@
+maintenance:
+
+ title: SCIP Surgical Antibiotic Prophylaxis Orders;;
+ mlmname: FORM_SCIP_Abx_Dosing;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-04-01;;
+ validation: testing;;
+
+library:
+ purpose: Used for Surgical Antibiotic Prophylaxis Weight Based Dosing
+ ;;
+
+ explanation: This MLM is called from antibiotics on the SCIP Antibiotic Order Sets
+
+ Change history
+ 04.8.2013 TMS Moved to Prod as part of Mini-syringe to Mini-bag project
+ MLM supplies the correct WORx Code, Dose and UOM for an order
+ based upon the patient{{{SINGLE-QUOTE}}}s current weight. CSR 31359
+ 11.12.2015 TMS Updated with OPSU Preop changes for Cefazolin dose and weight ranges.
+ CSR 33885
+ 02.08.2018 JML CSR 35885 - Updated MLM to include diliuent change for Amikacin dosing
+ 09.05.2018 TMS CSR #37176, 37177, 37178, 37062 Added query for OldOrtho to use the
+ old Cefazolin Dosing for Ortho order sets not yet updated by review.
+ 11.20.2018 TMS CSR{{{SINGLE-QUOTE}}}s 37583 (Abdominoplasty Post Op), 37556 (Post Op Lap Chole) and
+ 37557 (Wound Debridement Post Op Orders): Changed to use new cefazolin dosing.
+ 11.20.2018 TMS CSR{{{SINGLE-QUOTE}}}s 37583 (Abdominoplasty Post Op), 37556 (Post Op Lap Chole) and
+ 37557 (Wound Debridement Post Op Orders): Changed to use new cefazolin dosing.
+ 12.03.2018 TMS CSR{{{SINGLE-QUOTE}}}s 37585 (Gastric Bypass Post Op)and 37533 (Post Op Vascular Surgery):
+ Changed to use new cefazolin dosing.
+ 12.17.2018 TMS CSR 37346 (Fractured Hip Post Op Orders), 37345 (Total Hip Replacement Post Op Orders),
+ 37344 (Total Knee Replacement Post Op Orders): Changed to use new cefazolin dosing.
+ 02.20.2019 TMS 37530 (Post Op Open Chole) Changed to use new cefazolin dosing.
+ 01.15.2020 TMS 38595 (Post Op Foot and Ankle) Changed to use new cefazolin dosing.
+ 01.15.2020 TMS 37873 (Free Flap Post Op) Added to use static dosing for Cefazolin and Clindamycin.
+
+
+
+ ;;
+ keywords: Called MLMs, Antibiotic Prophylaxis, 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";
+
+ // 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;
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ AltSCIPDosingParentSet := read {"select GUID from CV3OrderCatalogSet where name = {{{SINGLE-QUOTE}}}Free Flap Post Op Orders{{{SINGLE-QUOTE}}}"};
+ AltSCIPDosingSet := read {"select GUID from CV3OrderCatalogSet where name = {{{SINGLE-QUOTE}}}SCIP Antibiotics: Free Flap Surgery{{{SINGLE-QUOTE}}}"};
+
+
+
+
+// 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);
+ 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 = " || ClientGuid || " "
+ };
+//
+If patientage < 12 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;
+//
+
+// Define other fields
+ StartNow := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
+ Prebuilt := last of (field_list where field_list.DataItemName = "PRX_PrebuiltOrder");
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+
+ Dose := last of (field_list where field_list.DataItemName = "DosageLow");
+ Diluent := last of (field_list where field_list.DataItemName = "BaseSolution");
+ DoseUnit := last of (field_list where field_list.DataItemName = "Uom");
+
+ DoseValue := Dose.Value;
+ DiluentValue := Diluent.Value;
+ DoseUnitValue := DoseUnit.Value;
+ NS50ml := "0.9% NaCl 50ml .";
+ NS100ml := "0.9% NaCl 100ml .";
+ D5W100ml := "D5W 100ml .";
+ D5W250ml := "D5W 250ml .";
+ AbxName := last of (field_list where field_list.DataItemName = "PRX_AntibioticNameForMLM");
+ AbxNameValue := AbxName.Value;
+ WorxCode := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode");
+ WorxCodeValue :=WorxCode.Value;
+ OPSU_Preop_Order := last of (field_list where field_list.DataItemName = "PRX_SCIP_PREOP");
+
+
+ If CallingEvent in ("FormOpen", "FieldChange") and AbxNameValue is not null then
+
+ If this_communication.CatalogParentOrderSetGUID in AltSCIPDosingParentSet or this_communication.CatalogOrderSetGUID in AltSCIPDosingSet then
+
+ If patientage >= 12 then
+ If AbxNameValue = "Cefazolin" then
+
+ Dose.Value := 1;
+ DoseUnit.Value := "gm";
+ DiluentValue.Name := NS50ml;
+ DiluentValue.Dose := 50;
+ DiluentValue.Uom := "ml";
+ WorxCode.Value := "08498P";
+ Prebuilt.Value := True;
+ Endif;
+
+ If AbxNameValue = "Clindamycin" then
+
+ Dose.Value := 600;
+ DoseUnit.Value := "mg";
+ DiluentValue.Name := NS50ml;
+ DiluentValue.Dose := 50;
+ DiluentValue.Uom := "ml";
+ WorxCode.Value := "08508P";
+ Prebuilt.Value := True;
+ Endif;
+ Endif;
+
+ elseif this_communication.CatalogParentOrderSetGUID not in AltSCIPDosingParentSet and this_communication.CatalogOrderSetGUID not in AltSCIPDosingSet then
+
+ If (weightvalue > 0 and weightvalue < 80) and patientage >= 12 then
+ If AbxNameValue = "Cefoxitin" then
+
+ Dose.Value := 1;
+ DoseUnit.Value := "gm";
+ DiluentValue.Name := NS50ml;
+ DiluentValue.Dose := 50;
+ DiluentValue.Uom := "ml";
+ WorxCode.Value := "08515P";
+ Prebuilt.Value := True;
+ Endif;
+
+ If AbxNameValue = "Clindamycin" then
+
+ Dose.Value := 600;
+ DoseUnit.Value := "mg";
+ DiluentValue.Name := NS50ml;
+ DiluentValue.Dose := 50;
+ DiluentValue.Uom := "ml";
+ WorxCode.Value := "08508P";
+ Prebuilt.Value := True;
+ Endif;
+
+ endif; //(weightvalue > 0 and weightvalue < 80) and patientage >= 12
+
+ If weightvalue >= 80 then
+
+ If AbxNameValue = "Cefoxitin" then
+
+ Dose.Value := 2;
+ DoseUnit.Value := "gm";
+ DiluentValue.Name := NS100ml;
+ DiluentValue.Dose := 100;
+ DiluentValue.Uom := "ml";
+ WorxCode.Value := "08516P";
+ Prebuilt.Value := True;
+ Endif;
+
+ If AbxNameValue = "Clindamycin" then
+
+ Dose.Value := 900;
+ DoseUnit.Value := "mg";
+ DiluentValue.Name := NS100ml;
+ DiluentValue.Dose := 100;
+ DiluentValue.Uom := "ml";
+ WorxCode.Value := "08509P";
+ Prebuilt.Value := True;
+ Endif;
+ endif; //weightvalue >= 80
+
+ If (weightvalue > 0 and weightvalue < 120) and patientage >= 12 then
+
+ If AbxNameValue = "Cefazolin" then
+
+ Dose.Value := 2;
+ DoseUnit.Value := "gm";
+ DiluentValue.Name := NS100ml;
+ DiluentValue.Dose := 100;
+ DiluentValue.Uom := "ml";
+ WorxCode.Value := "08499P";
+ Prebuilt.Value := True;
+ Endif;
+
+ endif;
+
+ If weightvalue >= 120 and patientage >= 12 then
+ If AbxNameValue = "Cefazolin" then
+
+ Dose.Value := 3;
+ DoseUnit.Value := "gm";
+ DiluentValue.Name := NS100ml;
+ DiluentValue.Dose := 100;
+ DiluentValue.Uom := "ml";
+ WorxCode.Value := "00467P";
+ Prebuilt.Value := True;
+ Endif;
+
+ endif;
+
+
+ If weightvalue = 0 then
+ Dose.Value := Null;
+ WORxCode.Value := "";
+
+ endif;
+
+ endif;
+
+
+ endif; //CallingEvent in ("FormOpen", "FieldChange") and AbxNameValue is not null
+
+// Calc Gent Dose
+ If AbxNameValue = "Gentamicin" then
+ DiluentValue.Name := NS50ml;
+ DiluentValue.Dose := 50;
+ DiluentValue.Uom := "ml";
+
+ rawdose := weightvalue * 1.5;
+
+ If patientage >= 12 then
+ gentdose := INT((rawdose + 5)/10)*10;
+ else
+ gentdose := INT((rawdose + 2.5)/5)*5;
+ endif;
+
+ if gentdose >0 and gentdose <= 250 then
+ Dose.Value := gentdose; WorxCode.Value := "00062";
+ Prebuilt.value := False;
+ endif;
+
+ if gentdose = 80 then Dose.Value := gentdose; WorxCode.Value := "08390P"; Prebuilt.value := True; endif;
+ if gentdose = 100 then Dose.Value := gentdose; WorxCode.Value := "08392P"; Prebuilt.value := True; endif;
+ if gentdose = 120 then Dose.Value := gentdose; WorxCode.Value := "00191P"; Prebuilt.value := True; endif;
+ if gentdose = 240 then Dose.Value := gentdose; WorxCode.Value := "00313P"; Prebuilt.value := True; endif;
+ endif;
+
+//Calc Amikacin Dose
+ if AbxNameValue = "Amikacin" then
+
+ amikadose := Dose.Value;
+
+ if ( amikadose <= 500 ) then
+ DiluentValue.Name := D5W100ml;
+ DiluentValue.Dose := 100;
+ DiluentValue.Uom := "ml";
+ elseif ( amikadose > 500 ) then
+ DiluentValue.Name := D5W250ml;
+ DiluentValue.Dose := 250;
+ DiluentValue.UOM := "ml";
+ endif;
+
+ WorxCode.Value := "08075";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SELECT_OBSLIST_VALUES.mlm b/MLMStripper/bin/Debug/FORM/FORM_SELECT_OBSLIST_VALUES.mlm
new file mode 100644
index 0000000..191fd1e
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SELECT_OBSLIST_VALUES.mlm
@@ -0,0 +1,94 @@
+maintenance:
+
+ title: Select ObsList Values;;
+ mlmname: FORM_SELECT_OBSLIST_VALUES;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St. Clair Hospital;;
+ author: Shawn Head x7468;;
+ specialist: Sasa Miskovic;;
+ date: 2018-12-27;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will auto populate fields on a form based on the observation name selecting all values in the list
+ ;;
+ explanation: This MLM will populate fields on the order form based on the observations added
+ ;;
+ keywords: Home Health CHF Discharge Orders
+ ;;
+ citations:
+ 12-20-2018 - STH - CSR#: 37672 - Created {Go-Live 1/8/2018}
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ //start here
+
+ // 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;
+
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField :=this_communication.CallingFieldName;
+ ClientVisitGuid := this_communication.ClientVisitGuid;
+ comm_obj := this_communication.primaryobj;
+ //Initialize MLM pointers:
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ ObsNameList := ();
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ ObsNameList := ("DC_CHF_HH_General Orders","DISC_CHF_Exc Protocol Item","DISC_CHF_HH_Tx Phase 1","DISC_CHF_HH_Tx Phase 2","DISC_CHF_HH_Tx Phase 3 Item");
+
+
+ /***************************************************************************************/
+
+
+ for x in (1 seqto(count(OBsNameList))) do
+ ObsName := ObsNameList[x];
+ ObsListValues := read last {"select replace(REPLACE(REPLACE(STUFF(
+ (select {{{SINGLE-QUOTE}}}; {{{SINGLE-QUOTE}}} + udv.Value
+ from CV3UserDictionaryValue udv with (Nolock)
+ where udv.UserDictionaryCode = ud.Code
+ and udv.Active = 1
+ ORDER BY udv.SortSeqNum
+ FOR XML PATH({{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})),1, 1, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}
+ ),{{{SINGLE-QUOTE}}}<{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}<{{{SINGLE-QUOTE}}}),{{{SINGLE-QUOTE}}}>{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}>{{{SINGLE-QUOTE}}}),{{{SINGLE-QUOTE}}}&{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}&{{{SINGLE-QUOTE}}})
+ from CV3DataItem di with (Nolock)
+ inner join CV3UserDictionary ud with (Nolock)
+ on di.DictionaryName = ud.Code
+ and ud.Active = 1
+ where di.Code = " || sql(ObsName) };
+
+
+ UpdateObsList := first of (field_list where field_list.DataItemName = ObsName);
+ //UpdateObsList.Control_read_only := true;
+ UpdateObsList.Value := ObsListValues;
+ enddo;
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_2ND_GEN_ANTIPSYC.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_2ND_GEN_ANTIPSYC.mlm
new file mode 100644
index 0000000..cc6b25e
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_2ND_GEN_ANTIPSYC.mlm
@@ -0,0 +1,338 @@
+maintenance:
+
+ title: FORM_SET_2ND_GEN_ANTIPSYC;;
+ mlmname: FORM_SET_2ND_GEN_ANTIPSYC;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Shawn Head, Allscripts ;;
+ specialist: Kathe Niznik, St Clair Hospital;;
+ date: 2014-12-22;;
+ validation: testing;;
+
+library:
+ purpose: Enforce Nursing protocol for 2nd generation antipsychotic medications.
+ ;;
+
+ explanation: Called from the second generation antipsychotic order set.
+
+ Change history
+ 2014.12.22 STH CSR 32013: Created {go-live 3/15/2016}
+ 2016.04.26 TMS Add call on Form Close to Medication Order Management MLM CSR 33465
+ 2016.04.27 STH CSR#: 34405 - Updated dietitian consult to be disabled regardless if the order is selected or not.
+
+ ;;
+ keywords: Called MLMs, antipsychotic, 2nd, second, generation
+ ;;
+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";
+
+ // 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;
+
+ stop := false;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+
+ //commented out to make available to all users
+ bypass_HW_users := ("MD","DO","DDS","DPM","PA","PA-C","CRNP");
+
+ // Get the current user{{{SINGLE-QUOTE}}}s occupation
+ userguid := this_communication.UserGUID;
+ UserCode := read last
+ {"Select occupationcode "
+ ||" From cv3user with (nolock) "
+ ||" Where Guid = " || SQL(userguid) };
+
+ //Retrieve fields
+
+ LabOrder_Date := last of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ LabOrder_Time := last of (field_list WHERE field_list.DataItemName = "RequestedTime"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ FastingOrder_StartDate := last of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ AND field_list.Control_MultiFieldOccNum = 2);
+
+ FastingOrder_EndDate := last of (field_list WHERE field_list.DataItemName = "StopDate"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ labordersitems := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ Nurse_Instructions := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 12);
+
+ Diet_Consult := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+
+ SecondGen_MedGrids := (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum is in (7,9,1,10,11,6,4,5,3,8));
+
+ Lab_itemlist := labordersitems.Value;
+ Lab_itemname := Lab_itemlist.name;
+
+ 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;
+ wt_type := comb_ht_wt_val.weighttype;
+ bsa := comb_ht_wt_val.bsa;
+ bmi := comb_ht_wt_val.bmi;
+ endif;
+
+
+ currenthour := extract hour(now);
+ currentminute := extract minute(now);
+
+ if currenthour >= 20 then
+ LabOrder_Date.Value := "T+2";
+ FastingOrder_StartDate.Value := "T+1";
+ FastingOrder_EndDate.Value := "T+2";
+ else
+ LabOrder_Date.Value := "T+1";
+ FastingOrder_StartDate.Value := "T";
+ FastingOrder_EndDate.Value := "T+1";
+ endif;
+
+ LabOrder_Time.Value.ReqTimeCode := "AM Rounds";
+
+ if this_communication.CallingEvent = "FormOpen" then
+ databaseorders := read { "select distinct o.name from cv3clientvisit cv with (nolock) "
+ || " inner join cv3order o with (nolock) on cv.ClientGUID = o.ClientGUID and cv.ChartGUID = o.ChartGUID and cv.guid = o.ClientVisitGUID "
+ || " where o.name in ({{{SINGLE-QUOTE}}}Glucose Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}lipid panel{{{SINGLE-QUOTE}}}) "
+ || " and o.OrderStatusCode not like {{{SINGLE-QUOTE}}}can%{{{SINGLE-QUOTE}}} and o.OrderStatusCode not like {{{SINGLE-QUOTE}}}disc%{{{SINGLE-QUOTE}}} "
+ || " and cv.ClientGUID = " || sql(ClientGuid)
+ || " and cv.ChartGUID = " || sql(ChartGuid)
+ || " and cv.GUID = " || sql(ClientVisitGuid)
+ || " union "
+ || " select distinct o.name from cv3clientvisit cv with (nolock) "
+ || " inner join cv3order o with (nolock) on cv.ClientGUID = o.ClientGUID and cv.ChartGUID = o.ChartGUID and cv.guid = o.ClientVisitGUID "
+ || " where o.name = {{{SINGLE-QUOTE}}}Dietitian Consult{{{SINGLE-QUOTE}}} "
+ || " and o.SummaryLine like {{{SINGLE-QUOTE}}}%antipsychotic%{{{SINGLE-QUOTE}}} "
+ || " and o.OrderStatusCode not like {{{SINGLE-QUOTE}}}can%{{{SINGLE-QUOTE}}} and o.OrderStatusCode not like {{{SINGLE-QUOTE}}}disc%{{{SINGLE-QUOTE}}} "
+ || " and cv.ClientGUID = " || sql(ClientGuid)
+ || " and cv.ChartGUID = " || sql(ChartGuid)
+ || " and cv.GUID = " || sql(ClientVisitGuid)
+ || " union "
+ || " select distinct o.name + {{{SINGLE-QUOTE}}}-WC{{{SINGLE-QUOTE}}} from cv3clientvisit cv with (nolock) "
+ || " inner join cv3order o with (nolock) on cv.ClientGUID = o.ClientGUID and cv.ChartGUID = o.ChartGUID and cv.guid = o.ClientVisitGUID "
+ || " where o.name = {{{SINGLE-QUOTE}}}Nurse Instruction:{{{SINGLE-QUOTE}}} "
+ || " and o.SummaryLine like {{{SINGLE-QUOTE}}}%waist%{{{SINGLE-QUOTE}}} "
+ || " and o.SummaryLine like {{{SINGLE-QUOTE}}}%circumference%{{{SINGLE-QUOTE}}} "
+ || " and o.OrderStatusCode not like {{{SINGLE-QUOTE}}}can%{{{SINGLE-QUOTE}}} and o.OrderStatusCode not like {{{SINGLE-QUOTE}}}disc%{{{SINGLE-QUOTE}}} "
+ || " and cv.ClientGUID = " || sql(ClientGuid)
+ || " and cv.ChartGUID = " || sql(ChartGuid)
+ || " and cv.GUID = " || sql(ClientVisitGuid)
+ || " select distinct o.name + {{{SINGLE-QUOTE}}}-HW{{{SINGLE-QUOTE}}} from cv3clientvisit cv with (nolock) "
+ || " inner join cv3order o with (nolock) on cv.ClientGUID = o.ClientGUID and cv.ChartGUID = o.ChartGUID and cv.guid = o.ClientVisitGUID "
+ || " where o.name = {{{SINGLE-QUOTE}}}Nurse Instruction:{{{SINGLE-QUOTE}}} "
+ || " and o.SummaryLine like {{{SINGLE-QUOTE}}}%height%{{{SINGLE-QUOTE}}} "
+ || " and o.SummaryLine like {{{SINGLE-QUOTE}}}%weight%{{{SINGLE-QUOTE}}} "
+ || " and o.OrderStatusCode not like {{{SINGLE-QUOTE}}}can%{{{SINGLE-QUOTE}}} and o.OrderStatusCode not like {{{SINGLE-QUOTE}}}disc%{{{SINGLE-QUOTE}}} "
+ || " and cv.ClientGUID = " || sql(ClientGuid)
+ || " and cv.ChartGUID = " || sql(ChartGuid)
+ || " and cv.GUID = " || sql(ClientVisitGuid)
+ || " union "
+ || " select distinct o.name from cv3clientvisit cv with (nolock) "
+ || " inner join cv3order o with (nolock) on cv.ClientGUID = o.ClientGUID and cv.ChartGUID = o.ChartGUID and cv.guid = o.ClientVisitGUID "
+ || " where o.name = {{{SINGLE-QUOTE}}}Dietitian Consult{{{SINGLE-QUOTE}}} "
+ || " and o.SummaryLine like {{{SINGLE-QUOTE}}}%BMI >30%{{{SINGLE-QUOTE}}} "
+ || " and o.OrderStatusCode not like {{{SINGLE-QUOTE}}}can%{{{SINGLE-QUOTE}}} and o.OrderStatusCode not like {{{SINGLE-QUOTE}}}disc%{{{SINGLE-QUOTE}}} "
+ || " and cv.ClientGUID = " || sql(ClientGuid)
+ || " and cv.ChartGUID = " || sql(ChartGuid)
+ || " and cv.GUID = " || sql(ClientVisitGuid)};
+
+
+ foundglucose := false;
+ foundlipid := false;
+ foundwaist := false;
+ foundheight := false;
+ foundconsult := false;
+ if "Glucose Fasting" in databaseorders then
+ foundglucose := true;
+ endif;
+
+ if "lipid panel" in databaseorders then
+ foundlipid := true;
+ endif;
+
+ find_fs_waist_value := read last {" Select TOP 1 o.ValueText from CV3ClientDocumentcur cd with (nolock) "
+ || " join CV3ClientDocDetailcur cdd with (nolock)"
+ || " on (cdd.ClientDocumentGUID = cd.GUID "
+ || " and cdd.ClientGUID = " || SQL(ClientGuid) || ") "
+ || " join CV3ObservationDocumentcur od with (nolock) "
+ || " on cdd.CLientDocumentGUID = od.OwnerGUID "
+ || " and od.active = 1 "
+ || " join CV3ObsCatalogMasterItem with (nolock)"
+ || " on od.ObsMasterItemGUID = CV3ObsCatalogMasterItem.GUID "
+ || " join CV3Observationcur o with (nolock)"
+ || " on o.GUID = od.ObservationGUID "
+ || " LEFT OUTER JOIN CV3User u with (nolock) "
+ || " ON o.UserGUID = u.GUID "
+ || " join cv3obscatalogitem oci with (nolock) "
+ || " on oci.guid = o.obsitemguid "
+ || " and oci.name = {{{SINGLE-QUOTE}}}sch_VS_WaistCircum{{{SINGLE-QUOTE}}} "
+ || " where cd.clientguid = " || SQL(ClientGuid)
+ || " and cd.chartguid = " || SQL(ChartGuid)
+ || " and o.ValueText is not null "
+ || " order by cd.authoreddtm desc " };
+
+
+
+ if "Nurse Instruction:-WC" in databaseorders or find_fs_waist_value[1] is not null then
+ foundwaist := true;
+ Nurse_Instructions.Value[1].IsSelected := false;
+ Nurse_Instructions.Value[1].IsReadOnly := false;
+ else
+ Nurse_Instructions.Value[1].IsSelected := true;
+ Nurse_Instructions.Value[1].IsReadOnly := true;
+ endif;
+
+
+ if "Nurse Instruction:-HW" in databaseorders or (comb_ht_wt_val.BMI <> 0 and comb_ht_wt_val.BSA <> 0 and comb_ht_wt_val.Weight <> 0 and comb_ht_wt_val.Height <> 0)
+ or (usercode not in bypass_HW_users) then
+ foundheight := true;
+ Nurse_Instructions.Value[2].IsSelected := false;
+ Nurse_Instructions.Value[2].IsReadOnly := true;
+ else
+ Nurse_Instructions.Value[2].IsSelected := true;
+ Nurse_Instructions.Value[2].IsReadOnly := true;
+ endif;
+
+
+ for x in (1 seqto count(Lab_itemname)) do
+ if Lab_itemname[x] matches pattern "%glucose%" then
+ if not(foundglucose) then
+ labordersitems.Value[x].IsSelected := true;
+ labordersitems.Value[x].IsReadOnly := true;
+ else
+ labordersitems.Value[x].IsSelected := false;
+ labordersitems.Value[x].IsReadOnly := false;
+ endif;
+ endif;
+
+ if Lab_itemname[x] matches pattern "%lipid%" then
+ if not(foundlipid) then
+ labordersitems.Value[x].IsSelected := true;
+ labordersitems.Value[x].IsReadOnly := true;
+ else
+ labordersitems.Value[x].IsSelected := false;
+ labordersitems.Value[x].IsReadOnly := false;
+ endif;
+ endif;
+
+ if Lab_itemname[x] matches pattern "%NPO%" then
+ if not(foundlipid) or not(foundglucose) then
+ labordersitems.Value[x].IsSelected := true;
+ labordersitems.Value[x].IsReadOnly := true;
+ else
+ labordersitems.Value[x].IsSelected := false;
+ labordersitems.Value[x].IsReadOnly := false;
+ endif;
+ endif;
+
+ enddo;
+
+ endif;
+
+ if (this_communication.CallingEvent = "FormOpen" or CallingField = "CombinedMeasurements|1") then
+ if (((bmi as number) > 30) and "Dietitian Consult" not in databaseorders) then
+ foundconsult := true;
+ Diet_Consult.Value.IsSelected := true;
+ Diet_Consult.Value.IsReadOnly := true;
+ else
+ Diet_Consult.Value.IsSelected := false;
+ Diet_Consult.Value.IsReadOnly := true;
+ endif;
+
+ if ((comb_ht_wt_val.BMI <> 0 and comb_ht_wt_val.BSA <> 0 and comb_ht_wt_val.Weight <> 0 and comb_ht_wt_val.Height <> 0)
+ or (usercode in bypass_HW_users)) and this_communication.CallingEvent = "FormOpen" then
+ comb_ht_wt_field.Control_Read_Only := true;
+ else
+ comb_ht_wt_field.Control_Read_Only := false;
+ endif;
+ endif;
+
+ if (this_communication.CallingEvent = "FormClose") then
+
+ IsPRN := (field_list WHERE field_list.DataItemName = "IsPRN");
+ isPRN_Checked := IsPRN.Value;
+ PRNSelectedct := 0;
+ for y in (1 seqto count(isPRN_Checked)) do
+ if isPRN_Checked[y] = true then
+ PRNSelectedct := PRNSelectedct + 1;
+ endif;
+ enddo;
+ MedsOrderedct := 0;
+ for n in (1 seqto count(SecondGen_MedGrids)) do
+ if (true is in SecondGen_MedGrids[n].Value.IsSelected) then
+ MedsOrderedct := MedsOrderedct + 1;
+ endif;
+
+ enddo;
+ prnct := (PRNSelectedct as number);
+ mdoct := (MedsOrderedct as number);
+ if ((PRNSelectedct as number) = (MedsOrderedct as number)) then
+ Diet_Consult.Value.IsSelected := false;
+ Diet_Consult.Value.IsReadOnly := true;
+ labordersitems.Value.IsSelected := false;
+ Nurse_Instructions.Value.IsSelected := false;
+ endif;
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ACETADOTE_ACETYLCYSTEINE.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ACETADOTE_ACETYLCYSTEINE.mlm
new file mode 100644
index 0000000..7b7dd64
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ACETADOTE_ACETYLCYSTEINE.mlm
@@ -0,0 +1,299 @@
+maintenance:
+
+ title: FORM_SET_ACETADOTE_ACETYLCYSTEINE;;
+ mlmname: FORM_SET_ACETADOTE_ACETYLCYSTEINE;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Bryan Berkeybile, Allscripts;;
+ date: 2013-01-21;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+
+ explanation: This MLM is called from ...
+
+ Change history
+ 2013.01.21 JML CSR 30931: Created
+
+
+
+ ;;
+ keywords: Called MLMs
+ ;;
+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";
+
+ // 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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ChartGuid := this_communication.ChartGUID;
+ FormName := this_form.Name;
+ PrimaryObjDetail := this_communication.PrimaryObj;
+ OrderSetName := PrimaryObjDetail.OrderSetName;
+
+ //Retrieve Fields
+ Dosage_One := first of (field_list WHERE field_list.DataItemName = "DosageLow"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Dosage_Two := first of (field_list WHERE field_list.DataItemName = "DosageLow"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Dosage_Three := first of (field_list WHERE field_list.DataItemName = "DosageLow"
+ and field_list.Control_MultiFieldOccNum = 3);
+
+ Acetyl_Date_One := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Acetyl_Time_One := first of (field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Acetyl_Time_Value := Acetyl_Time_One.Value;
+
+ Acetyl_Date_Two := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Acetyl_Time_Two := first of (field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Acetyl_Time2_Value := Acetyl_Time_Two.Value;
+
+ Acetyl_Date_Three := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Acetyl_Time_Three := first of (field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Acetyl_Time3_Value := Acetyl_Time_Three.Value;
+ OrderInfo := first of (field_list WHERE field_list.DataItemName = "PRX_Info"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ CombinedMeasurements := first of (field_list WHERE field_list.DataItemName = "CombinedMeasurements");
+
+ if (CallingEvent = "FormOpen") then
+
+ if (exists OrderInfo) then
+ OrderInfo.Control_Read_Only := true;
+ endif;
+ if (exists CombinedMeasurements) then
+ CombinedMeasurements_fld := CombinedMeasurements.Value;
+
+ patient_weight := CombinedMeasurements_fld.Weight;
+
+ if (patient_weight > 0) then
+
+ doseOneVal := (150 * patient_weight);
+ rndDoseOneVal := int( ( doseOneVal + 50 ) / 100 ) * 100;
+ Dosage_One.Value := rndDoseOneVal;
+
+ doseTwoVal := (50 * patient_weight);
+ rndDoseTwoVal := int( ( doseTwoVal + 50 ) / 100 ) * 100;
+ Dosage_Two.Value := rndDoseTwoVal;
+
+ doseThreeVal := (100 * patient_weight);
+ rndDoseThreeVal := int( ( doseThreeVal + 50 ) / 100 ) * 100;
+ Dosage_Three.Value := rndDoseThreeVal;
+ else
+ msg := "Please enter a calculation weight for this patient";
+ this_communication.MessageType := "Error";
+ this_communication.Message := msg;
+ this_communication.DisplayMessage := true;
+ endif;
+
+ if ( NOT ( OrderSetName matches pattern "%Extended Therapy%" ) ) then
+
+ currentDateTime := now;
+ //currentDateTime := "2013-08-27 23:10:00" as time;
+ currMinute := ( extract minute currentDateTime ) as number;
+ currHour := ( extract hour currentDateTime ) as number;
+
+ Acetyl_Time_Value.ReqTimeCode := "Scheduled/Start Time";
+ Acetyl_Time2_Value.ReqTimeCode := "Scheduled/Start Time";
+ Acetyl_Time3_Value.ReqTimeCode := "Scheduled/Start Time";
+
+ if (currMinute >= 1 AND currMinute < 30) then
+ b := "30";
+ else
+ currHour := currHour + 1;
+ b := "00";
+ endif;
+
+ if (( currHour ) >= 24 ) then
+ Acetyl_Date_One.Value := "T+1";
+ Acetyl_Date_Two.Value := "T+1";
+ Acetyl_Date_Three.Value := "T+1";
+ elseif (( currHour + 1 ) >= 24 ) then
+ Acetyl_Date_One.Value := currentDateTime;
+ //Need to increment Date2 to T + 1
+ Acetyl_Date_Two.Value := "T+1";
+ Acetyl_Date_Three.value := "T+1";
+ elseif (( currHour + 5) >= 24 ) then
+ Acetyl_Date_One.Value := currentDateTime;
+ Acetyl_Date_Two.Value := currentDateTime;
+ Acetyl_Date_Three.Value := "T+1";
+ else
+ Acetyl_Date_One.Value := currentDateTime;
+ Acetyl_Date_Two.Value := currentDateTime;
+ Acetyl_Date_Three.Value := currentDateTime;
+ endif;
+
+ a := currHour;
+ if ( (length (a as string)) = 1) then
+ a := "0" || a;
+ elseif (a = 24) then
+ a := "00";
+ endif;
+
+ a2 := currHour + 1;
+ if (a2 = 24) then
+ a2 := "00";
+ elseif (a2 > 24) then
+ a2 := (a2 - 24);
+ endif;
+ if ( (length (a2 as string)) = 1) then
+ a2 := "0" || a2;
+ endif;
+
+ a3 := currHour + 5;
+ if (a3 = 24) then
+ a3 := "00";
+ elseif (a3 > 24) then
+ a3 := (a3 - 24);
+ endif;
+ if ( (length (a3 as string)) = 1) then
+ a3 := "0" || a3;
+ endif;
+
+ Acetyl_Time_Value.ReqTimeValue := a || ":" || b;
+ Acetyl_Time2_Value.ReqTimeValue := a2 || ":" || b;
+ Acetyl_Time3_Value.ReqTimeValue := a3 || ":" || b;
+
+ endif;
+ endif;
+
+ elseif (CallingEvent = "FieldChange") then
+ if (CallingField = "CombinedMeasurements|1") then
+ CombinedMeasurements_fld2 := CombinedMeasurements.Value;
+
+ new_patient_weight := CombinedMeasurements_fld2.Weight;
+
+ doseOneVal := (150 * new_patient_weight);
+ rndDoseOneVal := int( ( doseOneVal + 50 ) / 100 ) * 100;
+ Dosage_One.Value := rndDoseOneVal;
+
+ doseTwoVal := (50 * new_patient_weight);
+ rndDoseTwoVal := int( ( doseTwoVal + 50 ) / 100 ) * 100;
+ Dosage_Two.Value := rndDoseTwoVal;
+
+ doseThreeVal := (100 * new_patient_weight);
+ rndDoseThreeVal := int( ( doseThreeVal + 50 ) / 100 ) * 100;
+ Dosage_Three.Value := rndDoseThreeVal;
+
+ elseif ( ( CallingField = "RequestedDate|1" OR CallingField = "RequestedTime|1" )
+ AND ( NOT ( OrderSetName matches pattern "%Extended Therapy%" ) ) ) then
+
+ NewDateVal := Acetyl_Date_One.Value;
+ NewTimeVal := Acetyl_Time_Value.ReqTimeValue as Time;
+
+ newTimeHour := ( extract hour NewTimeVal ) as number;
+ newTimeMin := ( extract minute NewTimeVal ) as number;
+
+ Acetyl_Time_Value.ReqTimeCode := "Scheduled/Start Time";
+ Acetyl_Time2_Value.ReqTimeCode := "Scheduled/Start Time";
+ Acetyl_Time3_Value.ReqTimeCode := "Scheduled/Start Time";
+
+ if (newTimeMin >= 1 AND newTimeMin < 30) then
+ newB := "30";
+ else
+ newTimeHour := newTimeHour + 1;
+ newB := "00";
+ endif;
+
+ if (newTimeHour >= 24) then
+ Acetyl_Date_One.Value := NewDateVal + 1 day;
+ Acetyl_Date_Two.Value := NewDateVal + 1 day;
+ Acetyl_Date_Three.Value := NewDateVal + 1 day;
+ elseif (( newTimeHour + 1 ) >= 24 ) then
+ Acetyl_Date_One.Value := NewDateVal;
+ Acetyl_Date_Two.Value := NewDateVal + 1 day;
+ Acetyl_Date_Three.Value := NewDateVal + 1 day;
+ elseif (( newTimeHour + 5 ) >= 24 ) then
+ Acetyl_Date_One.Value := NewDateVal;
+ Acetyl_Date_Two.Value := NewDateVal;
+ Acetyl_Date_Three.Value := NewDateVal + 1 day;
+ else
+ Acetyl_Date_One.Value := NewDateVal;
+ Acetyl_Date_Two.Value := NewDateVal;
+ Acetyl_Date_Three.Value := NewDateVal;
+ endif;
+
+ newA := newTimeHour;
+ if (( length ( newA as string ) ) = 1 ) then
+ newA := "0" || newA;
+ elseif ( newA = 24 ) then
+ newA := "00";
+ endif;
+
+ newA2 := newTimeHour + 1;
+ if ( newA2 = 24 ) then
+ newA2 := "00";
+ elseif ( newA2 > 24 ) then
+ newA2 := ( newA2 - 25 );
+ endif;
+ if (( length( newA2 as string ) ) = 1 ) then
+ newA2 := "0" || newA2;
+ endif;
+
+ newA3 := newTimeHour + 5;
+ if ( newA3 = 24 ) then
+ newA3 := "00";
+ elseif ( newA3 > 24 ) then
+ newA3 := ( newA3 - 24 );
+ endif;
+ if (( length ( newA3 as string ) ) = 1 ) then
+ newA3 := "0" || newA3;
+ endif;
+
+ Acetyl_Time_Value.ReqTimeValue := newA || ":" || newB;
+ Acetyl_Time2_Value.ReqTimeValue := newA2 || ":" || newB;
+ Acetyl_Time3_Value.ReqTimeValue := newA3 || ":" || newB;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ACETAMINOPHENINJ_WITH_ACETAMINOPHENCAPLET.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ACETAMINOPHENINJ_WITH_ACETAMINOPHENCAPLET.mlm
new file mode 100644
index 0000000..d1d5422
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ACETAMINOPHENINJ_WITH_ACETAMINOPHENCAPLET.mlm
@@ -0,0 +1,249 @@
+maintenance:
+
+ title: FORM_Set_AcetaminophenInj_with_AcetaminophenCaplet;;
+ mlmname: FORM_Set_AcetaminophenInj_with_AcetaminophenCaplet;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Allscripts ;;
+ specialist: Allscripts;;
+ date: 2013-11-29;;
+ validation: testing;;
+
+library:
+ purpose: schedule AcetaminophenCaplet for 6 hours after last dose of AcetaminophenInj
+ ;;
+
+ explanation: This MLM is called from the Total Hip Replacement Post op Set and Total knee Replacement Post op Set
+
+ 02.03.2014 STH Trackit Ticket #: 163421 correct issue with Hold session
+ 2016.04.26 TMS CSR 33465: Add call on Form Close to Medication Order Management MLM
+ 2017-04-12 STH CSR #35293: Correct issues with timing of ordering when the hours or minutes are in the 0# format (e.g. 04 hour or 04 minute).
+ Also had to change the formatting of the oral Acetaminophen as someone changed the spacing of the drug name causing this MLM not to work.
+ 2014-09-28 TMS CSR #35222 Upadated MLM to include Acetaminophen Extra Strength Tab 500mg to allow use of MLM on Post Op Colon Resection order set. Changed all variable names
+ with reference to ibuprofen and toradol to tylenol and ofirmev to reduce confusion within logic.
+ ;;
+ keywords: Called MLMs, Total Hip Replacement Post op Set , AcetaminophenInj,Total knee Replacement Post op Set
+ Called from : Foot and Ankle Post Op Orders; Fractured Hip Post Op Orders; Total Hip Replacement Post Op Orders; Total Knee Replacement Post Op Orders and Post Op Colon Resection
+ ;;
+knowledge:
+ type: data-driven;;
+data:
+
+ // Communication object Form object Arden ClientInfo object
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+ userguid := this_communication.userguid;
+
+ field_list := this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ itemnames := field_list.value.name;
+
+ ofirmev_selected:= false;
+ Tylenol_selected := false;
+ freqOccNum := ();
+ RequestedDateOccNum := ();
+ RequestedTimeOccNum := ();
+ for x in (1 seqto count(field_list)) do
+ fielditem_values := field_list[x].value;
+ itemnames := fielditem_values.name;
+ selected := fielditem_values.isselected;
+ if ("Acetaminophen Inj" in itemnames) or ("Acetaminophen Caplet 325mg" in itemnames) or ("Acetaminophen Extra Strength Tab 500mg" in itemnames) then
+ for j in (1 seqto count(itemnames)) do
+ if itemnames[j] = "Acetaminophen Inj" and selected[j] = true then
+ ofirmev_selected:= true;
+ endif;
+ if (itemnames[j] = "Acetaminophen Caplet 325mg" and selected[j] = true) or (itemnames[j] = "Acetaminophen Extra Strength Tab 500mg" and selected[j] = true) then
+ Tylenol_selected := true;
+ endif;
+ enddo;
+ endif;
+
+ if trim(field_list[x].DataItemName) = "FrequencyCode" then
+ freqOccNum := freqOccNum, field_list[x].Control_MultiFieldOccNum;
+ endif;
+
+ if trim(field_list[x].DataItemName) = "RequestedDate" then
+ RequestedDateOccNum := RequestedDateOccNum, field_list[x].Control_MultiFieldOccNum;
+ endif;
+
+ if trim(field_list[x].DataItemName) = "RequestedTime" then
+ RequestedTimeOccNum := RequestedTimeOccNum, field_list[x].Control_MultiFieldOccNum;
+ endif;
+
+ enddo;
+
+
+// FORM CLOSE EVENT SECTION
+
+ If CallingEvent = "FormClose" and ofirmev_selected = true and Tylenol_selected = true Then
+
+
+ freqOccNum := sort Data freqOccNum;
+ RequestedDateOccNum := sort data RequestedDateOccNum;
+ RequestedTimeOccNum := sort data RequestedTimeOccNum;
+
+ FrequencyCode_Ofirmev := first of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = freqOccNum[1]);
+ StartDate_Ofirmev := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = RequestedDateOccNum[2]); //jp , was 1
+ StartTime_Ofirmev := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = RequestedTimeOccNum[1]);
+
+ StartDate_Tylenol := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = RequestedDateOccNum[3]); //jp, was 2
+ StartTime_Tylenol := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = RequestedTimeOccNum[2]);
+ FreqCodeValue_Ofirmev := FrequencyCode_Ofirmev.value.FrequencySummary;
+ StDateValue_Ofirmev := StartDate_Ofirmev.value;
+ StTimeValue_Ofirmev := StartTime_Ofirmev.value;
+ StTimeValue_Tylenol := StartTime_Tylenol.value;
+
+ z := StartDate_Ofirmev.Records__;
+//
+
+
+ //begin-section added by STH for hold session issue 1-29-2014
+ THR := Extract Hour NOW;
+ TMN := Extract Minute NOW;
+
+ if THR < 10 then
+ THR := "0" || THR;
+ endif;
+
+ if TMN < 10 then
+ TMN := "0" || TMN;
+ endif;
+
+ PlusLocation := FIND "+" IN STRING StDateValue_Ofirmev ;
+ TLocation := FIND "T" IN STRING StDateValue_Ofirmev ;
+
+ If TLocation = 1 and PlusLocation = 0 then
+ StDateValue_Ofirmev := (now as time);
+ StTimeValue_Ofirmev.ReqTimeCode := "Scheduled/Start Time";
+ StTimeValue_Ofirmev.ReqTimeValue := THR || ":" || TMN;
+ endif;
+
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF StDateValue_Ofirmev FROM StDateValue_Ofirmev ;
+ StDateValue_Ofirmev := (now as time) + (PlusDays as number) day;
+ StTimeValue_Ofirmev.ReqTimeCode := "Scheduled/Start Time";
+ StTimeValue_Ofirmev.ReqTimeValue := THR || ":" || TMN;
+ endif;
+ //end-section added by STH for hold session issue 1-29-2014
+
+ ReqTimeCode_Ofirmev := StTimeValue_Ofirmev.ReqTimeCode;
+
+ SchHour_Ofirmev:= substring 2 characters from StTimeValue_Ofirmev.ReqTimeValue as number;
+ SchMin_Ofirmev := substring 2 characters starting at 4 from StTimeValue_Ofirmev.ReqTimeValue;
+
+ if (ReqTimeCode_Ofirmev = "Scheduled/Start Time") then
+ HR := SchHour_Ofirmev;
+ MN := SchMin_Ofirmev;
+ else
+ HR := Extract Hour NOW;
+ MN := Extract Minute Now;
+ endif;
+
+ if HR < 10 then
+ HR := "0" || HR;
+ //HR := HR as number;
+ endif;
+
+ if MN < 10 then
+ MN := "0" || MN;
+ //MN := MN as number;
+ endif;
+
+
+ HR_seconds := (60 * (HR as number)) * 60;
+ MN_Seconds := (MN as number) * 60;
+ Calc_starttime_Ofirmev := ((StDateValue_Ofirmev + (HR_seconds seconds)) + (MN_Seconds seconds));
+ Freq_length := length of FreqCodeValue_Ofirmev as number;
+ freq_endposition := freq_length;
+ begin_freq := substring 1 characters from FreqCodeValue_Ofirmev as string;
+ end_freq := substring 1 characters starting at freq_endposition from FreqCodeValue_Ofirmev as string;
+
+ if begin_freq = "Q" then
+ Freqnum_Ofirmev := Freq_length - 2;
+ Schnum_Ofirmev := substring Freqnum_Ofirmev characters starting at 2 from FreqCodeValue_Ofirmev;
+ endif;
+
+ schnum_Ofirmev := schnum_Ofirmev as number;
+
+ if (end_freq = "M") then
+ calc_schnum_seconds := (((86400 / (60 * schnum_Ofirmev)) - 1) * (60 * schnum_Ofirmev)); //take the minutes times 60 to get the seconds, divide that
+ elseif (end_freq = "H") then
+ calc_schnum_seconds := ((((24 / schnum_Ofirmev)-1) * schnum_Ofirmev) * 60) * 60;
+ endif;
+
+ sched_time := read { "select ScheduledTime from CV3FixedScheduleDefinition fs "
+ || " inner join CV3CodedFreqTranslation ft on fs.ParentGUID = ft.GUID "
+ || " where ft.FrequencyCode = " || sql(FreqCodeValue_Ofirmev)
+ || " and ft.FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} "};
+
+ sched_time := sort data sched_time;
+ sched_starttime := "";
+ sched_endtime := "";
+
+ if (count(sched_time) = 0) or (ReqTimeCode_Ofirmev = "Scheduled/Start Time") then
+ calc_startDTTM_Tylenol := (Calc_starttime_Ofirmev + calc_schnum_seconds seconds) + 21600 seconds;
+ else
+ tmp_starthhmn := HR || MN;
+ for s in (1 seqto count(sched_time)) do
+ if ((sched_time[s] as number) > (tmp_starthhmn as number)) and sched_starttime = "" then
+ sched_starttime := sched_time[s];
+ endif;
+ if ((sched_time[s] as number) < (tmp_starthhmn as number)) then
+ sched_endtime := sched_time[s];
+ endif;
+ enddo;
+
+ length_sched_endtime := length (sched_endtime as string);
+ sched_minPOS := ((length_sched_endtime as number) - 2) as number;
+ calc_schMIN := (substring 2 characters starting at (sched_minPOS + 1) from (sched_endtime as string)) as number;
+ calc_schHR := (substring (sched_minPOS as number) characters from (sched_endtime as string)) as number;
+ calc_schMIN_Seconds := calc_schMIN * 60;
+ calc_schHR_Seconds := (calc_schHR * 60) * 60;
+ calc_startDTTM_Tylenol := (((StDateValue_Ofirmev + 86400 seconds) + calc_schMIN_Seconds seconds) + calc_schHR_seconds seconds) + 21600 seconds;
+ endif;
+
+ format_hr := extract hour calc_startDTTM_Tylenol;
+ if format_hr < 10 then
+ format_hr := "0" || format_hr;
+ endif;
+
+ format_min := extract minute calc_startDTTM_Tylenol;
+ if format_min < 10 then
+ format_min := "0" || format_min;
+ endif;
+ Tylenol_date_extract := (extract month calc_startDTTM_Tylenol) || "-" || (extract day calc_startDTTM_Tylenol) || "-" || (extract year calc_startDTTM_Tylenol);
+ Tylenol_time_extract := format_hr || ":" || format_min;
+
+ StTimeValue_Tylenol.ReqTimeCode := "Scheduled/Start Time";
+ StTimeValue_Tylenol.ReqTimeValue := Tylenol_time_extract;
+ StartDate_Tylenol.Value := calc_startDTTM_Tylenol;
+
+
+ endif; // Close Section
+ If CallingEvent = "FormClose" then
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ADMISSION_ORDERS_CHF.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ADMISSION_ORDERS_CHF.mlm
new file mode 100644
index 0000000..f3099cf
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ADMISSION_ORDERS_CHF.mlm
@@ -0,0 +1,153 @@
+maintenance:
+
+ title: FORM_SET_ADMISSION_ORDERS_CHF;;
+ mlmname: FORM_SET_ADMISSION_ORDERS_CHF;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Dean Miklavic, Allscripts;;
+ date: 2013-12-02;;
+ validation: testing;;
+
+library:
+ purpose: Forces user to select beta blocker or decline beta blocker order.
+ ;;
+
+ explanation: Called from the Admission Orders - CHF order set.
+
+ Forces user to select an ACEI/ARB or the Decline ACEI/ARB order from the appropriate grids.
+
+ Change history
+ 2013.12.02 JML CSR 31709: Created
+ 2016.04.26 TMS CSR 33465: Add call on Form Close to Medication Order Management MLM
+ 2019.10.02 TMS CSR 38755: Updated to alert user that they must select a (Beta Blocker or Decline Beta Blocker)
+ and an (ACEI or ARB or Decline ACEI/ARB order) before procedding to submit the order set.
+
+
+
+ ;;
+ keywords: Called MLMs, Cardiac, Outpatient
+ ;;
+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";
+
+ // 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;
+
+ stop := false;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+
+ //Retrieve fields
+ //Ace / Arb Grid
+ Beta_Blocker_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 67);
+ Beta_Block_List := Beta_Blocker_fld.Value; // Added By Shivprasad Jadhav On 10-Jun-2015 for CSR-33352
+
+ Ace_Arb_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 68);
+ Ace_Arb_List := Ace_Arb_fld.Value;
+
+ //No Ace / Arb Grid
+ // No_Ace_Arb_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ // AND field_list.Control_MultiFieldOccNum = 69);
+ // No_Ace_Arb_List := No_Ace_Arb_fld.Value;
+
+ if (CallingEvent = "FormClose") then
+
+/* if ((not (true IN Ace_Arb_List.IsSelected)) AND (not (true IN No_Ace_Arb_List.IsSelected))
+ AND (not (true IN Beta_Block_List.IsSelected)) // Added By Shivprasad Jadhav On 10-Jun-2015 for CSR-33352
+ )
+ then
+ //No_Ace_Arb_List.IsSelected := (true);
+
+ //Display mandatory message
+ //StopMsg := "You have not selected any ACEI or ARB medications for this patient. Therefore, you must"
+ // || " select the {{{SINGLE-QUOTE}}}Decline ACEI or ARB{{{SINGLE-QUOTE}}} order with a mandatory {{{SINGLE-QUOTE}}}Reason{{{SINGLE-QUOTE}}}.";
+ StopMsg := "You have not selected any Beta Blocker or ACEI or ARB medications for this patient. Therefore, you must"
+ || " select the {{{SINGLE-QUOTE}}}Decline ACEI or ARB or Decline Beta Blocker{{{SINGLE-QUOTE}}} order with a mandatory {{{SINGLE-QUOTE}}}Reason{{{SINGLE-QUOTE}}}."; // Added By Shivprasad Jadhav On 10-Jun-2015 for CSR-33352
+ this_communication.DispayForm := "Yes";
+ this_communication.MessageType := "Error";
+ this_communication.Message := StopMsg;
+ endif;
+*/
+ if ((not (true IN Ace_Arb_List.IsSelected))
+ AND (not (true IN Beta_Block_List.IsSelected))
+ )
+ then
+ StopMsg := "You have not selected any Beta Blocker or ACEI or ARB medications for this patient. Therefore, you must"
+ || " select the {{{SINGLE-QUOTE}}}Decline ACEI or ARB or Decline Beta Blocker{{{SINGLE-QUOTE}}} order with a mandatory {{{SINGLE-QUOTE}}}Reason{{{SINGLE-QUOTE}}}."; // Added By Shivprasad Jadhav On 10-Jun-2015 for CSR-33352
+ this_communication.DispayForm := "Yes";
+ this_communication.MessageType := "Error";
+ this_communication.Message := StopMsg;
+
+ elseif ((not (true IN Ace_Arb_List.IsSelected))
+ AND (true IN Beta_Block_List.IsSelected)
+ )
+
+ then
+ StopMsg := "You have not selected any ACEI or ARB medications for this patient. Therefore, you must"
+ || " select the {{{SINGLE-QUOTE}}}Decline ACEI or ARB order with a mandatory {{{SINGLE-QUOTE}}}Reason{{{SINGLE-QUOTE}}}.";
+ this_communication.DispayForm := "Yes";
+ this_communication.MessageType := "Error";
+ this_communication.Message := StopMsg;
+
+ elseif ((true IN Ace_Arb_List.IsSelected)
+ AND (not (true IN Beta_Block_List.IsSelected))
+ )
+ then
+ StopMsg := "You have not selected any Beta Blocker medications for this patient. Therefore, you must"
+ || " select the {{{SINGLE-QUOTE}}}Decline Beta Blocker{{{SINGLE-QUOTE}}} order with a mandatory {{{SINGLE-QUOTE}}}Reason{{{SINGLE-QUOTE}}}.";
+ this_communication.DispayForm := "Yes";
+ this_communication.MessageType := "Error";
+ this_communication.Message := StopMsg;
+ endif;
+
+ MedicalImaging_Indications_MLM := mlm {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING_INDICATIONS_FOR_OS{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call MedicalImaging_Indications_MLM WITH
+ this_communication, this_form, client_info_obj;
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ADMITTOINPATIENT_PLACEINOBS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ADMITTOINPATIENT_PLACEINOBS.mlm
new file mode 100644
index 0000000..612d491
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ADMITTOINPATIENT_PLACEINOBS.mlm
@@ -0,0 +1,153 @@
+maintenance:
+
+ title: Form_Set_AdmitToInPatient_PlaceInObs ;;
+ mlmname: Form_Set_AdmitToInPatient_PlaceInObs ;;
+ arden: version 2.5;;
+ version: 6.00;;
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shubha Rai;;
+ date: 2015-01-16;;
+ validation: testing;;
+
+library:
+ purpose: Explanation to Change
+ -----------------------------------------
+ 14-05-2015 - GMS - Created New
+
+ ;;
+ explanation: This will have an MLM that will pull the data as per the below format.
+ Fall Risk Score = "4" (ED Triage Note) and
+ Resistant Organism= "V" (Patient Info- Comments) (N= No Flag, V = VRE, M=MRSA, O= Other)
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+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*******************/
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ BaseMLM := MLM {{{SINGLE-QUOTE}}}FORM_OBSERVATION_ADT{{{SINGLE-QUOTE}}};
+ this_communication,this_form := Call BaseMLM With this_communication,this_form,client_info_obj ;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ clientGuid := this_communication.ClientGUID;
+ visitGuid := this_communication.ClientVisitGUID;
+ chartGuid := this_communication.ChartGUID;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ item_event := this_communication.itemevent;
+ form_type := this_communication.formtype;
+
+ MRO_Risk_Status := last of ( field_list WHERE field_list.DataItemName = "Admit_free text"
+ and field_list.Control_MultiFieldOccNum = 1);
+ MRO_Risk_Status_Val := MRO_Risk_Status.Value;
+
+
+
+
+ Ord_Doc := OBJECT [Obs_name, Obs_val , Obs_Doc ] ;
+ Ord_vals1 := read as Ord_Doc { " select ocmi.Description, o.ValueText, cd.DocumentName "
+ || " from CV3ClientDocument cd with (nolock) "
+ || " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
+ || " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
+ || " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
+ || " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
+ || " AND ocmi.Name in ({{{SINGLE-QUOTE}}}sch_edtriage_fallriskscore{{{SINGLE-QUOTE}}}) "
+ || " where cd.chartguid = " || chartGuid
+ || " and cd.clientguid = " || clientGuid
+ || " and cd.clientvisitguid = " || visitGuid
+ || " And cd.iscanceled = 0 "
+ || " and cd.DocumentName ={{{SINGLE-QUOTE}}}ED Triage Note{{{SINGLE-QUOTE}}} " };
+
+ /*Ord_Comment := OBJECT [Obs_name1, Obs_val1 , Obs_Doc1 ] ;
+ Ord_vals2 := read as Ord_Comment { " Select cd.TypeCode, cd.Text, {{{SINGLE-QUOTE}}}Patient Info- Comments{{{SINGLE-QUOTE}}} As Doc "
+ || " from CV3CommentDeclaration cd With (Nolock) join cv3ClientVisit cv With (Nolock) "
+ || " On cd.ClientVisitGUID =cv.GUID And cd.ClientGUID=cv.ClientGUID And cd.ChartGUID=cv.ChartGUID And cd.TypeCode ={{{SINGLE-QUOTE}}}Resist Organism{{{SINGLE-QUOTE}}} "
+ || " where cv.chartguid = " || chartGuid
+ || " and cv.clientguid = " || clientGuid
+ || " and cv.GUID = " || SQL(visitGuid) || " " }; */
+
+
+ Ord_Comment := OBJECT [Obs_name1, Obs_val1 , Obs_Doc1 ] ;
+ Ord_vals2 := read as Ord_Comment { " Select cd.TypeCode, cd.Text, {{{SINGLE-QUOTE}}}Patient Info- Comments{{{SINGLE-QUOTE}}} As Doc "
+ || " from CV3CommentDeclaration cd "
+ || " where cd.clientguid = " || clientGuid
+ || " and cd.TypeCode = {{{SINGLE-QUOTE}}}Resist Organism{{{SINGLE-QUOTE}}} "
+ || " And cd.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " };
+
+
+
+ Ord_Orient := OBJECT [Obs_O_name, Obs_Conc_Val ] ;
+ Ord_OrientVal := read as Ord_Orient { " SELECT Top 1 omi.name, Stuff(( Select {{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}+ oflv1.value "
+ || " from SCMObsFSListValues oflv1 Where oflv1.ClientGUID = oflv.ClientGUID And oflv1.ParentGUID= oflv.ParentGUID "
+ || " FOR XML PATH({{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}), TYPE).value({{{SINGLE-QUOTE}}}.{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}varchar(max){{{SINGLE-QUOTE}}}), 1, 1, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}Value{{{SINGLE-QUOTE}}} "
+ || " FROM CV3ClientDocument cd WITH (NOLOCK) "
+ || " INNER JOIN cv3ClientVisit cv With (Nolock) ON cv.GUID = cd.ClientVisitGUID AND cv.chartguid = cd.ChartGUID And cv.clientguid = cd.ClientGUID And cd.iscanceled = 0 And cd.Active = 1 "
+ || " AND cd.DocumentName = {{{SINGLE-QUOTE}}}ED Triage Note{{{SINGLE-QUOTE}}} "
+ || " INNER JOIN SXACDObservationParameter OP WITH(NOLOCK) ON OP.ClientGUID = cd.ClientGUID AND OP.ChartGUID = cd.ChartGUID And op.OwnerGUID=cd.guid "
+ || " AND OP.PatCareDocGUID = cd.PatCareDocGUID AND OP.RecordedDtm = cd.AuthoredDtm "
+ || " INNER JOIN CV3ObsCatalogMasterItem omi WITH(NOLOCK) ON omi.GUID = op.ObsMasterItemGUID And omi.name in ({{{SINGLE-QUOTE}}}AS Orientation{{{SINGLE-QUOTE}}}) "
+ || " LEFT JOIN SCMObsFSListValues oflv WITH(NOLOCK) ON oflv.ParentGUID = op.ObservationDocumentGUID AND oflv.Active = 1 "
+ || " AND cd.ClientGUID = oflv.ClientGUID "
+ || " Where cv.GUID = " || SQL(visitGuid) || " And cv.clientguid = " || clientGuid || " And cv.chartguid = " || chartGuid
+ || " Group by cv.VisitIDCode, op.OwnerGUID, omi.name, oflv.GUID,oflv.value, oflv.ClientGUID , oflv.ParentGUID,cd.TouchedBy, cd.TouchedWhen "
+ || " ORDER BY cd.TouchedWhen Desc " };
+
+ TextString := "";
+
+ If Exists Ord_vals1 Then
+ FOR a IN 1 SEQTO COUNT OF Ord_vals1 DO
+ TextString := TextString || Ord_vals1.Obs_name[a] || "= " || Ord_vals1.Obs_val[a] ; //( " || Ord_vals1.Obs_Doc[a] || " ) ,\n" ;
+ EndDo;
+ If Exists Ord_vals2 Then TextString := TextString || " " ; EndIf;//TextString := TextString || " ,\n" ; EndIf;
+
+ Endif;
+
+ If Exists Ord_vals2 Then
+ FOR a IN 1 SEQTO COUNT OF Ord_vals2 DO
+ TextString := TextString || "MRO" || "= " || Ord_vals2.Obs_val1[a] ; // || " ( " || Ord_vals2.Obs_Doc1[a] || " ) " ;
+ Enddo;
+ If Exists Ord_OrientVal Then TextString := TextString || " " ; EndIf; //TextString := TextString || " ,\n" ; EndIf;
+ Endif;
+
+ If Exists Ord_OrientVal Then
+ FOR a IN 1 SEQTO COUNT OF Ord_OrientVal DO
+ TextString := TextString || Ord_OrientVal.Obs_Conc_Val[a] ; // || " ( " || Ord_vals2.Obs_Doc1[a] || " ) " ;
+ Enddo;
+ Endif;
+
+
+
+
+ MRO_Risk_Status.Value := TextString ;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ADULT_PROFILE_ADMISSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ADULT_PROFILE_ADMISSION.mlm
new file mode 100644
index 0000000..f25ac33
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ADULT_PROFILE_ADMISSION.mlm
@@ -0,0 +1,327 @@
+maintenance:
+
+ title: Adult Profile Admission Order Set;;
+ mlmname: FORM_Set_Adult_Profile_Admission;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Peggy Karish, Eclipsys Corp ext 7441;;
+ date: 2008-04-10;;
+ validation: testing;;
+
+library:
+ purpose: Used for grids that perform all true or no risk
+
+ ;;
+
+ explanation: This MLM is called from the Patient Profile- Adult Admission Orders
+
+ Change history
+
+ 10.29.2008 DW Adjust for Catheter selection changes
+ 09.04.2009 DM Change "No Pediatric Smoking Risk" to "No Pharmacy Risk Criteria" for Grid 10
+
+ ;;
+ keywords: Called MLMs, Respiratory ORder Set, Adult Admission
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ If CallingField = "MultiOrderCheckBox|1" then
+ NoRisk := "No Diagnosis Risk Criteria";
+ OccNumber := 1;
+ Elseif CallingField = "MultiOrderCheckBox|2" then
+ NoRisk := "No Discharge Risk Criteria";
+ OccNumber := 2;
+ Elseif CallingField = "MultiOrderCheckBox|3" then
+ NoRisk := "No Functional Risk Criteria";
+ OccNumber :=3;
+ Elseif CallingField = "MultiOrderCheckBox|4" then
+ NoRisk := "No Nutritional Risk Criteria";
+ OccNumber := 4;
+ Elseif CallingField = "MultiOrderCheckBox|7" then
+ NoRisk := "No Smoking Risk";
+ OccNumber := 7;
+// Elseif CallingField = "MultiOrderCheckBox|9" then
+// NoRisk := "No Pediatric Nutritional Risk";
+// OccNumber := 9;
+ Elseif CallingField = "MultiOrderCheckBox|9" then
+ NoRisk := "No Devices Present";
+ OccNumber := 9;
+ Elseif CallingField = "MultiOrderCheckBox|10" then
+ NoRisk := "No Pharmacy Risk Criteria";
+ OccNumber := 10;
+ endif;
+
+ // Now do True and false logic for EVERY grid on this form
+
+ //Get the multi order grid check box value
+ Grid_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = OccNumber);
+ Grid_list :=Grid_fld.Value;
+ Grid_SelList := Grid_List.IsSelected;
+
+ Found_NoRisk:= First of (Grid_list where Grid_list.Name = NoRisk );
+
+ ListMembs:= count Grid_SelList;
+ AllButNo:= ();
+ FalseList := ();
+ TrueList := ();
+ for k in (1 seqto (ListMembs-1)) do
+ AllButNo:= AllButNo, Grid_SelList[k];
+ FalseList := FalseList,False;
+ TrueList := TrueList ,True;
+ enddo;
+
+ OneOfRest := true in AllButNo;
+
+ If Found_NoRisk.IsSelected = True then
+ Grid_List.IsSelected:= FalseList , True;
+ Grid_List.IsReadOnly:= TrueList , False;
+ endif;
+
+ If (Found_NoRisk.IsSelected = False) and (OneOfRest = False) then // deselected No Risk
+ Grid_List.IsSelected := FalseList , False;
+ Grid_List.IsReadOnly := FalseList , False;
+ Endif;
+
+ If (OneOfRest = True) and (Found_NoRisk.IsSelected = False) then
+ Found_NoRisk.IsSelected := False;
+ Found_NoRisk.IsReadOnly := True;
+ endif;
+
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Now for the extras per grid //
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ If CallingField = "MultiOrderCheckBox|1" then
+ // Set the Order Set fields, comment and mapped to Dietitian Consult Reason
+ Set_Comment := last of (field_list where field_list.DataItemName = "NUR_ Comment 1 line");
+ Set_ConReason := last of (field_list where field_list.DataItemName = "NUTR_Consult Reasons");
+
+ If Found_NoRisk.IsSelected = True then
+ Set_Comment.Value := "";
+ Endif;
+
+ //Get the order set value
+ PrevCon_Fld := last of (field_list where field_list.DataItemName = "NUR_CheckBox");
+ PrevCon_Value := PrevCon_Fld.Value;
+
+ Grid_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = OccNumber);
+ Grid_list :=Grid_fld.Value;
+ Found_NODOrder:= first of (Grid_list where Grid_list.Name = "New Onset Diabetes");
+ NOD_Selected:= Found_NODOrder.IsSelected;
+
+ //If they are the same, this grid check box did not change, hence do nothing
+ If PrevCon_Value = NOD_Selected
+ then
+ Tester:="Dont Do anything";
+ else
+ // Set the fields we are about to change as the New Onset Diabeters Box Changed
+ // First get the entire field components for the MultiOrdercheckBox
+ Consult_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Consult_list :=Consult_fld.Value;
+
+ // Pull out the Dietitian Data from the MultiOrder
+ Found_DietConOrder:= first of (Consult_list where Consult_list.Name = "Dietitian Consult");
+
+ // Peform logic based on the value of the New Order Diabetes
+ If NOD_Selected = True then
+ Found_DietConOrder.IsSelected := True;
+ Found_DietConOrder.IsReadOnly := True;
+ Set_Comment.Value := "By selecting New Onset Diabetes- an order for a Dietitian Consult (New Onset Diabetes) has automatically been created";
+ Set_ConReason.Value := "New Onset Diabetes";
+ else
+ Found_DietConOrder.IsSelected := False;
+ Found_DietConOrder.IsReadOnly := False;
+ Set_Comment.Value := "By deselecting New Onset Diabetes- the order for Dietitian Consult (New Onset Diabetes) has automatically been removed";
+ Set_ConReason.Value := "";
+ endif;
+
+ // Set set from field to record the new value of New Order Diabetes (can tell if it changes again)
+ PrevCon_Fld.Value:= NOD_Selected;
+ endif;
+
+ ElseIf CallingField = "MultiOrderCheckBox|4" then
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 8);
+ Labs_list :=Labs_fld.Value;
+ Found_LabPreal:= first of (Labs_list where Labs_list.Name = "Prealbumin");
+ Found_LabDaily:= first of (Labs_list where Labs_list.Name = "Daily Orders:");
+ Nutrit_Comment := last of (field_list where field_list.DataItemName = "NUR_Comment 4");
+
+
+ Consult_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 5);
+ Consult_list :=Consult_fld.Value;
+
+
+ If Found_NoRisk.IsSelected = True then
+ Nutrit_Comment.Value := "";
+ endif;
+
+ If (OneOfRest = True) then
+ Found_LabPreal.IsReadOnly := True;
+ Found_LabPreal.IsSelected := True;
+ Found_LabDaily.IsReadonly := True;
+ Found_LabDaily.IsSelected := True;
+ Nutrit_Comment.Value := "By selecting a Nutritional Risk, the Prealbumin labs have automatically been created";
+ endif;
+
+ If (OneOfRest = False) And (Found_LabPreal.IsReadOnly = True) And (Found_NoRisk.IsSelected = False) then
+ Found_LabPreal.IsReadOnly := False;
+ Found_LabPreal.IsSelected := False;
+ Found_LabDaily.IsReadonly := False;
+ Found_LabDaily.IsSelected := False;
+ Nutrit_Comment.Value := "By deselecting all Nutritional Risks, the Prealbumin labs have automatically been removed";
+ endif;
+ ElseIf CallingField = "MultiOrderCheckBox|7" then
+ SmokeCon_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 5);
+ SmokeCon_list :=SmokeCon_fld.Value;
+ Found_SmokeConOrder:= first of (SmokeCon_list where SmokeCon_list.Name = "Pulmonary Health Education Consult");
+ Smoke_Comment := last of (field_list where field_list.DataItemName = "NUR_Comment 3");
+ Smoke_ConReason := last of (field_list where field_list.DataItemName = "RESP Pulmonary Health Education");
+
+ PrevUseToB_Fld := last of (field_list where field_list.DataItemName = "NUR_CheckBox 2");
+ PrevUseToB_Value := PrevUseToB_Fld.Value;
+
+ PrevLess12_Fld := last of (field_list where field_list.DataItemName = "NUR_CheckBox 3");
+ PrevLess12_Value:= PrevLess12_Fld.Value;
+
+
+ If Found_NoRisk.IsSelected = True then
+ Smoke_Comment.Value := "";
+ Smoke_ConReason := " ";
+ Smoke_ConReason := "";
+ endif;
+
+ Found_UTBOrder:= first of (Grid_list where Grid_list .Name = "Patient Uses Tobacco");
+ UTB_Selected:= Found_UTBOrder.IsSelected;
+ Found_Less12Order := first of (Grid_list where Grid_list .Name = "Quit tobacco use in the last 12 months");
+ Less12_Selected := Found_Less12Order.IsSelected;
+
+ If Less12_Selected = PrevLess12_Value then
+ Robert:="KEWL";
+ Else
+ If Less12_Selected = True then
+ Found_UTBOrder.IsReadOnly := True;
+ Found_SmokeConOrder.IsSelected := True;
+ Found_SmokeConOrder.IsReadOnly := True;
+ Smoke_Comment.Value := "By selecting Smoking Risk Order- an order for a Pulmonary Health Education Consult (Quit Smoking in Last 12 Months) has automatically been created";
+ Smoke_ConReason.Value := "Quit Smoking in Last 12 Months";
+ Else
+ Found_UTBOrder.IsReadOnly := False;
+ Found_SmokeConOrder.IsSelected := False;
+ Found_SmokeConOrder.IsReadOnly := False;
+ Smoke_Comment.Value := "By deselecting Smoking Risk Order- an order for a Pulmonary Health Education Consult (Quit Smoking in Last 12 Months) has automatically been removed";
+ Smoke_ConReason.Value := "";
+ Endif;
+ PrevLess12_Fld.Value:= Less12_Selected;
+ endif;
+
+ If UTB_Selected = PrevUseToB_Value then
+ Robert := "Still KEWL";
+ Else
+ If UTB_Selected = True then
+ Found_Less12Order.IsReadOnly := True;
+ Found_SmokeConOrder.IsSelected := True;
+ Found_SmokeConOrder.IsReadOnly := True;
+ Smoke_Comment.Value := "By selecting Smoking Risk Order- an order for a Pulmonary Health Education Consult (Smoking Cessation) has automatically been created";
+ Smoke_ConReason.Value := "Smoking Cessation";
+ Else
+ Found_Less12Order.IsReadonly := False;
+ Found_SmokeConOrder.IsSelected := False;
+ Found_SmokeConOrder.IsReadOnly := False;
+ Smoke_Comment.Value := "By deselecting Smoking Risk Order- an order for a Pulmonary Health Education Consult (Smoking Cessation) has automatically been removed";
+ Smoke_ConReason.Value := "";
+ Endif;
+ PrevUseToB_Fld.Value := UTB_Selected;
+ endif;
+
+ ElseIf CallingField = "MultiOrderCheckBox|9" then
+ Infection_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 9);
+ Infection_list :=Infection_fld.Value;
+ Found_CentralLine:= first of (Infection_list where Infection_list.Name = "Catheter: Central Line");
+ Found_PICCLine:= first of (Infection_list where Infection_list.Name = "Catheter: PICC Line");
+ Found_PortLine:= first of (Infection_list where Infection_list.Name = "Catheter: Port");
+ InfusCons_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"and field_List.Control_MultiFieldOccNum = 5);
+ InfusCons_list :=InfusCons_fld.Value;
+ Found_InfusConsOrder:= first of (InfusCons_list where InfusCons_list.Name = "Infusion Center Consult");
+
+ Inf_ConReason := last of (field_list where field_list.DataItemName = "INF_Consult Reason");
+ DevicesOnAdmission_Comment := last of (field_list where field_list.DataItemName = "NUR_Comment 6");
+ Catheter_Flag := last of (field_list where field_list.DataItemName = "NUR_Catheter");
+
+ If (Found_CentralLine.IsSelected = True) or (Found_PICCLine.IsSelected = True) or (Found_PortLine.IsSelected = True) and Catheter_Flag.value = False then
+ Found_InfusConsOrder.IsSelected := True;
+ Found_InfusConsOrder.IsReadOnly := True;
+ DevicesOnAdmission_Comment.Value := "By selecting a Port, Central Line or PICC Line, an Infusion Center Consult has been automatically been created";
+ Inf_ConReason.Value := "Device(s) present on admission, ED, OR";
+ Catheter_Flag.Value := True;
+ endif;
+
+ If (Found_CentralLine.IsSelected = False) and (Found_PICCLine.IsSelected = False) and (Found_PortLine.IsSelected = False) and Catheter_Flag.value = True then
+ Found_InfusConsOrder.IsSelected := False;
+ Found_InfusConsOrder.IsReadOnly := False;
+ DevicesOnAdmission_Comment.Value := "By deselecting a Port, Central Line or PICC Line, an Infusion Center Consult has been automatically been created ";
+ Inf_ConReason.Value := "";
+ Catheter_Flag.Value := False;
+ endif;
+
+ If Found_NoRisk.IsSelected = True then
+ DevicesOnAdmission_Comment.Value := " ";
+ Inf_ConReason := " ";
+ endif;
+
+ endif;
+
+
+ /* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "One Of Rest Selection is " || OneOfRest|| "\n\n" ||
+ "NoRisk Select" || Found_NoRisk.IsSelected || "\n\n" ||
+ "NoRisk Value " || Found_NoRisk.Value;
+ this_communication.MessageType := "Informational";
+*/
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ANTICOAG_WITH_BASELINE_ONLY.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ANTICOAG_WITH_BASELINE_ONLY.mlm
new file mode 100644
index 0000000..b110208
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ANTICOAG_WITH_BASELINE_ONLY.mlm
@@ -0,0 +1,202 @@
+maintenance:
+
+ title: Anticoag Order Sets with Baseline Labs Only;;
+ mlmname: FORM_Set_Anticoag_With_Baseline_Only;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair Admissions;;
+ author: Teresa Spicuzza, Eclipsys Corp Ext 7448;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2011-09-22;;
+ validation: testing;;
+
+library:
+ purpose: Used for auto ordering of baseline labs - anticoag meds
+ ;;
+
+ explanation: This MLM is called from the dabagatrin and Rivaroxaban order set, form: PRX_OSAnticoBaseOnly, PRX_OS_Rivaroxaban
+
+
+ Change history
+
+ 07.18.2011 TMS Initial build - derived from FORM_SET_HEPARIN_WEIGHT_BASED_INIT
+ 08.10.2011 TMS Added to production - change made for baseline lab to be drawn today until 8PM and then
+ change schedule to AM draw in the morning. Not needed STAT.
+ 01.12.2012 TMS Added logic for occurrence of grid 2. CSR 26904
+ 02.03.2015 TMS Changed title of MLM from to "Anticoag Order Sets with Baseline Labs Only". Dabigatran was misspelled, and MLM
+ is for any anticoagulant medication that only requires a baseline lab value. Ticket 1628100
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ 10.31.2017 SZ CSR #35039 - Modified code to allow creatinine auto-ordering when submitting orders for Rivaroxaban
+
+ ;;
+
+ keywords: Called MLMs,
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Find the baseline order checkbox that may need to be ordered with this protocol
+
+ Labs_Baseline_field := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 1);
+ Labs_Baseline_List := Labs_Baseline_field.Value;
+ Baseline_Cr:= first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Creatinine");
+
+ //Find if any of the med boxes are checked...if so, set Med_Was_Selected to "yes"
+
+ Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Med_List :=Med_Grid.Value;
+ Med_SelList := Med_List.IsSelected;
+ Med_Selected := true in Med_SelList;
+
+ Med_Grid2 := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Med_List2 :=Med_Grid2.Value;
+ Med_SelList2 := Med_List2.IsSelected;
+ Med_Selected2 := true in Med_SelList2;
+
+ // CSR #35039 - SZ added 10/31/2017
+ Med_Grid3 := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Med_List3 := Med_Grid3.Value;
+ Med_SelList3 := Med_List3.IsSelected;
+ Med_Selected3 := true in Med_SelList3;
+
+
+ If (Med_Selected = True or Med_Selected2 = True or Med_Selected3 = True) then Med_Was_Selected := "yes"; else Med_Was_Selected := "no" ; endif;
+
+
+
+ If CallingEvent = "FieldChange" Then
+
+
+ If Med_Was_Selected = "no"
+ then
+ Baseline_Cr.ISSelected :=False;
+ endif;
+
+ elseif CallingEvent = "FormOpen" then
+
+
+// Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ elseif CallingEvent = "FormClose" then
+
+
+// Check for cutoff time and change priorty of Baseline order to Today if before. Leave as Stat if after
+
+ modifiedstarttime := last of (field_list where field_list.DataItemName = "requestedtime" and field_List.Control_MultiFieldOccNum = 1);
+ modifiedstarttimevalue :=modifiedstarttime.Value;
+ modifiedstartdate := last of (field_list where field_list.DataItemName = "requesteddate" and field_List.Control_MultiFieldOccNum = 1);
+ modifiedstartdatevalue :=modifiedstartdate.Value;
+
+ hr := extract hour now; if hr < 10 then hr := "0" || hr; endif;
+ mi := extract minute now; if mi < 10 then mi := "0" || mi; endif;
+
+ currtime := hr || mi;
+ cutofftime := "1800";
+
+ if (currtime as number) > (cutofftime as number)
+ then modifiedstarttimevalue.ReqTimeCode := "AM Rounds"; /* it is after the cutoff time */
+ modifiedstartdate.value:= (now as time) +1 day; /* it is after the cutoff time */
+ else modifiedstarttimevalue.ReqTimeCode := "Today"; /* it is before the cutoff time */
+ endif;
+ // End of new code
+
+
+ If Med_Was_Selected = "yes" then
+
+ // Find if there is a baseline Cr in the past 24 hours and if one is not found, check the baseline box
+
+ If Baseline_Cr.IsSelected = false then
+
+ Cr_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Creatinine{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Renal Panel{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Renal Panel Fasting{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If not(exists(Cr_Val)) then Baseline_Cr.ISSelected :=True; endif;
+
+ endif;
+
+
+
+ endif; //If med is selected
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please enter an Order.\n\n" ;
+ this_communication.MessageType := "Error";
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_AWP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_AWP.mlm
new file mode 100644
index 0000000..bfa1464
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_AWP.mlm
@@ -0,0 +1,374 @@
+maintenance:
+
+ title: Alcohol Withdrawal Protocol Orders;;
+ mlmname: FORM_Set_AWP;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-09-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for - Alcohol Withdrawal Protocol
+ ;;
+
+ explanation: This MLM is called from ... Alcohol Withdrawal Protocol Orderset
+
+ Change history
+ 09.20.2011 TMS Copy of ED Admit AWP with coding added to schedule Ativan orders when ordered on Nurse Unit.
+ 01.20.2012 TMS Added logic to schedule correct day when start time between 18:00 and 22:00 HD Ticket 146364
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+
+
+ ;;
+ keywords: Called MLMs, Lab Grids on Order Sets, Alcohol Withdrawal Protocol
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ // 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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+RequestedTime_obj := OBJECT [ReqTimeCode, RegTimeValue, ReqTimeUOM,
+ReqTimeEventModifier, ReqTimeEventCode];
+
+ //Get the multi order grid check box value
+ Checkbox_fld := last of (field_list where field_list.DataItemName = "PRX_Checkbox1");
+// and field_List.Control_MultiFieldOccNum = 1);
+
+ Ativan_grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 64);
+ Ativan_list :=Ativan_grid.Value;
+ Ativan_SelList := Ativan_List.IsSelected;
+
+ Other_Med_Grid:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 66);
+
+ Other_Med_list := Other_Med_Grid.Value;
+ Nurse_Inst_Grid:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 48);
+
+ Nurse_Inst_List := Nurse_Inst_Grid.Value;
+
+ Day1reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Day2reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Day3reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 3);
+ Day4reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Day5reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Day6reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 6);
+ Day1reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Day2reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Day3reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 3);
+ Day4reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Day5reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Day6reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 6);
+
+ If exists Day1reqtime then ReqTimeValue := Day1reqtime.Value;
+
+// Found_DeSelect:= First of (Grid_list where Grid_list.Name = DeSelect );
+ If CallingEvent = "FieldChange" Then
+ If Callingfield = "PRX_Checkbox1|1" then
+
+
+ If Checkbox_fld.Value = False then
+ ListMembs:= count Ativan_SelList;
+ FalseList := ();
+ for k in (1 seqto ListMembs) do
+ FalseList := FalseList,False;
+ enddo;
+
+ Ativan_List.IsSelected:= FalseList;
+ ReqTimeValue.ReqTimeCode := NULL;
+ Day6reqtimeValue.ReqTimeCode := NULL;
+ endif;
+//
+ If Checkbox_fld.Value = False then
+ InstMembs:= count Nurse_Inst_List;
+ schedlist:= (True, False, False);
+ p:=4;
+ for p in (4 seqto InstMembs) do
+ schedlist := schedlist, Nurse_Inst_List.isselected [p];
+ enddo;
+
+ Nurse_Inst_List.IsSelected := schedlist;
+ endif;
+//
+
+If Checkbox_fld.Value = True then
+ ListMembs:= count Ativan_SelList;
+ TrueList := ();
+ for k in (1 seqto ListMembs) do
+ TrueList := TrueList,True;
+ enddo;
+
+ Ativan_List.IsSelected:= TrueList;
+ endif;
+//
+ If Checkbox_fld.Value = True then
+ InstMembs:= count Nurse_Inst_List;
+ schedlist:= (True, True, True);
+ p:=4;
+ for p in (4 seqto InstMembs) do
+ schedlist := schedlist, Nurse_Inst_List.isselected [p];
+ enddo;
+
+ Nurse_Inst_List.IsSelected := schedlist;
+ endif;
+//
+ If Checkbox_fld.Value = True then
+// If exists Day1reqtime then
+// ReqTimeValue := Day1reqtime.Value;
+ ReqTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ endif;
+ endif;
+//
+
+ endif;
+endif;
+
+
+ If CallingField = "RequestedTime|1" or CallingField = "RequestedDate|1" then
+
+ StartDate := day1reqdate.value;
+ StartTime := Day1reqtime.value;
+
+ StartTime_code := starttime.reqtimecode;
+ StartTime_value := starttime.reqtimevalue;
+
+ ParseTime_list := call str_parse with StartTime_value, ":";
+ hourvalue := first(ParseTime_list);
+ minvalue := last(ParseTime_list);
+
+ q6hour := StartTime_Value;
+ q8hour := (hourvalue as number) + 2;
+ if q8hour >= 24 then q8hour := q8hour - 24; endif;
+ if q8hour < 10 then q8hour := "0" || q8hour; endif;
+ q8hour := q8hour || ":" || minvalue;
+
+ q12hour := (hourvalue as number) + 6;
+ if q12hour >= 24 then q12hour := q12hour - 24; endif;
+ if q12hour < 10 then q12hour := "0" || q12hour; endif;
+ q12hour := q12hour || ":" || minvalue;
+
+
+/* //changed to logic below to address issue with start times between 18:00 and 21:00
+ If starttime_value >= "22:00" then skipday := "true";
+ day2reqdate.value := startdate + 1 day;
+ day3reqdate.value := startdate + 2 day;
+ day4reqdate.value := startdate + 3 day;
+ day5reqdate.value := startdate + 5 day;
+ day6reqdate.value := startdate + 6 day;
+ else skipday := false;
+ day2reqdate.value := startdate + 1 day;
+ day3reqdate.value := startdate + 2 day;
+ day4reqdate.value := startdate + 3 day;
+ day5reqdate.value := startdate + 4 day;
+ day6reqdate.value := startdate + 5 day;
+ endif;
+
+*/
+
+ If starttime_value >= "18:00" then
+ If starttime_value < "22:00" then
+ day2reqdate.value := startdate + 1 day;
+ day3reqdate.value := startdate + 2 day;
+ day4reqdate.value := startdate + 3 day;
+ day5reqdate.value := startdate + 4 day;
+ day6reqdate.value := startdate + 6 day;
+ else
+ day2reqdate.value := startdate + 1 day;
+ day3reqdate.value := startdate + 2 day;
+ day4reqdate.value := startdate + 3 day;
+ day5reqdate.value := startdate + 5 day;
+ day6reqdate.value := startdate + 6 day;
+ endif;
+ else
+ day2reqdate.value := startdate + 1 day;
+ day3reqdate.value := startdate + 2 day;
+ day4reqdate.value := startdate + 3 day;
+ day5reqdate.value := startdate + 4 day;
+ day6reqdate.value := startdate + 5 day;
+ endif;
+
+
+
+
+ Day2reqtimeValue := Day2reqtime.Value;
+ Day2reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ Day2reqtimeValue.ReqTimeValue := q6hour;
+ Day3reqtimeValue := Day3reqtime.Value;
+ Day3reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ Day3reqtimeValue.ReqTimeValue := q6hour;
+ Day4reqtimeValue := Day4reqtime.Value;
+ Day4reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ Day4reqtimeValue.ReqTimeValue := q6hour;
+ Day5reqtimeValue := Day5reqtime.Value;
+ Day5reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ Day5reqtimeValue.ReqTimeValue := q8hour;
+ Day6reqtimeValue := Day6reqtime.Value;
+ Day6reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ Day6reqtimeValue.ReqTimeValue := q12hour;
+endif;
+
+/*
+// Found_DeSelect:= First of (Grid_list where Grid_list.Name = DeSelect );
+ If CallingEvent = "FieldChange" Then
+ If Callingfield = "PRX_Checkbox1|1" then
+
+
+ If Checkbox_fld.Value = False then
+ ListMembs:= count Ativan_SelList;
+ FalseList := ();
+ for k in (1 seqto ListMembs) do
+ FalseList := FalseList,False;
+ enddo;
+
+ Ativan_List.IsSelected:= FalseList;
+ endif;
+//
+ If Checkbox_fld.Value = False then
+ InstMembs:= count Nurse_Inst_List;
+ schedlist:= (True, False, False);
+ p:=4;
+ for p in (4 seqto InstMembs) do
+ schedlist := schedlist, Nurse_Inst_List.isselected [p];
+ enddo;
+
+ Nurse_Inst_List.IsSelected := schedlist;
+ endif;
+//
+
+If Checkbox_fld.Value = True then
+ ListMembs:= count Ativan_SelList;
+ TrueList := ();
+ for k in (1 seqto ListMembs) do
+ TrueList := TrueList,True;
+ enddo;
+
+ Ativan_List.IsSelected:= TrueList;
+ endif;
+//
+ If Checkbox_fld.Value = True then
+ InstMembs:= count Nurse_Inst_List;
+ schedlist:= (True, True, True);
+ p:=4;
+ for p in (4 seqto InstMembs) do
+ schedlist := schedlist, Nurse_Inst_List.isselected [p];
+ enddo;
+
+ Nurse_Inst_List.IsSelected := schedlist;
+ If exists Day1reqtime then
+ Day1reqtimeValue := Day1reqtime.Value;
+ Day1reqtimeValue.ReqTimeCode := "Scheduled/Start Time"; endif;
+ endif;
+//
+
+ endif;
+endif; */
+If CallingField = "MultiOrderGrid|66" and CallingEvent = "FieldChange" Then
+ blocklist2 := (False, False, False);
+ blocklist3 := (False, False);
+ truelist2 := (False, False, False);
+ truelist3 := (False, False);
+If Other_Med_list.IsSelected [1] = true
+then truelist2 := (True, False, False);
+ blocklist2 := (False, True, True);
+
+endif;
+If
+ Other_Med_list.IsSelected [2] = true
+then truelist2 := (False, True, False);
+ blocklist2 := (True, False, True);
+endif;
+If
+ Other_Med_list.IsSelected [3] = true
+then truelist2 := (False, False, True);
+ blocklist2 := (True, True, False);
+endif;
+
+If Other_Med_list.IsSelected [4] = true
+then truelist3 := (True, False);
+ blocklist3 := (False, True);
+endif;
+
+If Other_Med_list.IsSelected [5] = true
+then truelist3 := (False, True);
+ blocklist3 := (True, False);
+endif;
+ blocklistA:= blocklist2, blocklist3;
+ truelistA:= truelist2, truelist3;
+ r:=6;
+ listother := count Other_Med_list;
+ for r in (6 seqto listother) do
+ truelistA := truelistA, other_med_list.isselected [r];
+ blocklistA := blocklistA, false;
+ enddo;
+
+ Other_Med_list.IsSelected := truelistA;
+ Other_Med_list.IsReadOnly := blocklistA;
+
+If CallingEvent = "FormClose" then
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+endif;
+//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Other_med_list: "||Other_Med_list.IsSelected ||"\n truelist2: "|| truelist2 ||"\n Value of r: "|| r ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ 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:', N'8a189793-bc89-48b9-8d3f-670bc7bedebc', 2, N'Alcohol Withdrawal Protocol Orders', N'2.5', N'5.50', CAST(N'2011-09-20T00:00:00.000' AS DateTime), NULL)
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_AWP_SCHED_PROTOCOL.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_AWP_SCHED_PROTOCOL.mlm
new file mode 100644
index 0000000..5a357d9
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_AWP_SCHED_PROTOCOL.mlm
@@ -0,0 +1,306 @@
+maintenance:
+
+ title: Alcohol Withdrawal Protocol Orders;;
+ mlmname: FORM_Set_AWP_Sched_Protocol;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2017-03-17;;
+ validation: testing;;
+
+library:
+ purpose: Used for autoscheduling start times for Scheduled Alcohol Withdrawal Protocol
+ ;;
+
+ explanation: This MLM is called from Alcohol Withdrawal Scheduled Lorazepam (Ativan) Orders
+
+ Change history
+ 09.21.2017 TMS CSR 35319 Created to auto-schedule scheduled lorazepam protocol of Alcohol withdrawal orders, based upon last administration time of PRN protocol.
+
+
+ ;;
+ keywords: Called MLMs, Lab Grids on Order Sets, Alcohol Withdrawal Protocol
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+
+
+ // 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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ RequestedTime_obj := OBJECT [ReqTimeCode, RegTimeValue, ReqTimeUOM,
+ ReqTimeEventModifier, ReqTimeEventCode];
+
+ //Get the multi order grid check box value
+ Checkbox_fld := last of (field_list where field_list.DataItemName = "PRX_Checkbox1");
+
+ Ativan_grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 64);
+ Ativan_list :=Ativan_grid.Value;
+ Ativan_SelList := Ativan_List.IsSelected;
+
+ Day1reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Day2reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Day3reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 3);
+ Day4reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Day5reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Day6reqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 6);
+ Day1reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Day2reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Day3reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 3);
+ Day4reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Day5reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Day6reqtime:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 6);
+
+
+ if (CallingEvent = "FormOpen") THEN
+ Checkbox_fld.value := true;
+ clientGUID := this_communication.ClientGUID;
+ ChartGUID := this_communication.ChartGUID;
+ VisitGUID := this_communication.ClientVisitGUID;
+
+ MedGuids := read {" select guid from cv3ordercatalogmasteritem where description like {{{SINGLE-QUOTE}}}%(awp)%{{{SINGLE-QUOTE}}} and expirydate is null"};
+
+ //find last administration time of lorazepam from alcohol withdrawal prn orders
+
+ Last_given, Frequency := read first {" select oto.significantdtm, ot.orderfrequency from cv3ordertask ot
+ join CV3OrderTaskOccurrence oto on oto.ordertaskguid = ot.guid
+ where OrderCatalogMasterItemGUID in (" || sql(medguids) || ")
+ and ot.clientguid = " ||sql(clientguid)||
+ "and oto.TaskStatusCode = {{{SINGLE-QUOTE}}}performed{{{SINGLE-QUOTE}}}
+ order by oto.SignificantDtm desc" };
+
+ DefType, IntervalTime, IntervalUOM := read last {" select definitiontype, timefromvalue, timeuom from CV3Frequency where code = " || SQL(Frequency)};
+
+ If DefType = 2 and IntervalUOM = "hr(s)" then
+ TimeSpan := IntervalTime;
+ else
+ TimeSpan := 2;
+ endif;
+
+ CurrentMinute:= extract minute NOW;
+ CurrentHour := extract hour NOW;
+ newtime := last_given as time;
+ duetime := newtime + (TimeSpan as number) hours;
+
+ If (duetime < now or duetime is null) then duetime := now as time; endif;
+ DueMinute:= extract minute duetime;
+
+ if dueminute > 10 then
+ duetime := duetime + 1 hours;
+ endif;
+
+ DueYear := extract year duetime;
+ DueDay := extract day duetime;
+ DueMon := extract month duetime;
+
+
+ DueHour := extract hour duetime;
+ If CurrentHour > DueHour then
+ DueHour := CurrentHour;
+ endif;
+
+ DueYear := extract year duetime;
+ DueDay := extract day duetime;
+ DueMon := extract month duetime;
+
+
+ newstarttime := duehour formatted with "%2.2d" || ":00";
+ newstartdate := duemon ||"-" ||dueday ||"-" ||dueyear ;
+
+ Day1reqtimeValue := Day1reqtime.Value;
+ Day1reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ day1reqtimevalue.reqtimevalue := newstarttime ;
+ day1reqdate.value := newstartdate as time;
+
+
+ ENDIF;
+ If exists Day1reqtime then
+ ReqTimeValue := Day1reqtime.Value;
+
+ // Found_DeSelect:= First of (Grid_list where Grid_list.Name = DeSelect );
+ If CallingEvent = "FieldChange" Then
+ If Callingfield = "PRX_Checkbox1|1" then
+
+ If Checkbox_fld.Value = False then
+ ListMembs:= count Ativan_SelList;
+ FalseList := ();
+ for k in (1 seqto ListMembs) do
+ FalseList := FalseList,False;
+ enddo;
+
+ Ativan_List.IsSelected:= FalseList;
+ ReqTimeValue.ReqTimeCode := NULL;
+ Day6reqtimeValue.ReqTimeCode := NULL;
+ endif;
+ //
+ If Checkbox_fld.Value = False then
+ InstMembs:= count Nurse_Inst_List;
+ schedlist:= (True, False, False);
+ p:=4;
+ for p in (4 seqto InstMembs) do
+ schedlist := schedlist, Nurse_Inst_List.isselected [p];
+ enddo;
+
+ Nurse_Inst_List.IsSelected := schedlist;
+ endif;
+//
+
+ If Checkbox_fld.Value = True then
+ ListMembs:= count Ativan_SelList;
+ TrueList := ();
+ for k in (1 seqto ListMembs) do
+ TrueList := TrueList,True;
+ enddo;
+
+ Ativan_List.IsSelected:= TrueList;
+ endif;
+//
+ If Checkbox_fld.Value = True then
+ InstMembs:= count Nurse_Inst_List;
+ schedlist:= (True, True, True);
+ p:=4;
+ for p in (4 seqto InstMembs) do
+ schedlist := schedlist, Nurse_Inst_List.isselected [p];
+ enddo;
+
+ Nurse_Inst_List.IsSelected := schedlist;
+ endif;
+//
+ If Checkbox_fld.Value = True then
+ ReqTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ endif;
+ endif;
+//
+ endif;
+ endif;
+
+
+ If ((CallingEvent = "FieldChange") and (CallingField = "RequestedTime|1" or CallingField = "RequestedDate|1")) or CallingEvent = "FormOpen" then
+
+ StartDate := day1reqdate.value;
+ StartTime := Day1reqtime.value;
+
+ StartTime_code := starttime.reqtimecode;
+ StartTime_value := starttime.reqtimevalue;
+
+ ParseTime_list := call str_parse with StartTime_value, ":";
+ hourvalue := first(ParseTime_list);
+ minvalue := last(ParseTime_list);
+
+ q6hour := StartTime_Value;
+ q8hour := (hourvalue as number) + 2;
+ if q8hour >= 24 then q8hour := q8hour - 24; endif;
+ if q8hour < 10 then q8hour := "0" || q8hour; endif;
+ q8hour := q8hour || ":" || minvalue;
+
+ q12hour := (hourvalue as number) + 6;
+ if q12hour >= 24 then q12hour := q12hour - 24; endif;
+ if q12hour < 10 then q12hour := "0" || q12hour; endif;
+ q12hour := q12hour || ":" || minvalue;
+
+
+
+ If starttime_value >= "18:00" then
+ If starttime_value < "22:00" then
+ day2reqdate.value := startdate + 1 day;
+ day3reqdate.value := startdate + 2 day;
+ day4reqdate.value := startdate + 3 day;
+ day5reqdate.value := startdate + 4 day;
+ day6reqdate.value := startdate + 6 day;
+ else
+ day2reqdate.value := startdate + 1 day;
+ day3reqdate.value := startdate + 2 day;
+ day4reqdate.value := startdate + 3 day;
+ day5reqdate.value := startdate + 5 day;
+ day6reqdate.value := startdate + 6 day;
+ endif;
+ else
+ day2reqdate.value := startdate + 1 day;
+ day3reqdate.value := startdate + 2 day;
+ day4reqdate.value := startdate + 3 day;
+ day5reqdate.value := startdate + 4 day;
+ day6reqdate.value := startdate + 5 day;
+ endif;
+
+
+
+
+ Day2reqtimeValue := Day2reqtime.Value;
+ Day2reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ Day2reqtimeValue.ReqTimeValue := q6hour;
+ Day3reqtimeValue := Day3reqtime.Value;
+ Day3reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ Day3reqtimeValue.ReqTimeValue := q6hour;
+ Day4reqtimeValue := Day4reqtime.Value;
+ Day4reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ Day4reqtimeValue.ReqTimeValue := q6hour;
+ Day5reqtimeValue := Day5reqtime.Value;
+ Day5reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ Day5reqtimeValue.ReqTimeValue := q8hour;
+ Day6reqtimeValue := Day6reqtime.Value;
+ Day6reqtimeValue.ReqTimeCode := "Scheduled/Start Time";
+ Day6reqtimeValue.ReqTimeValue := q12hour;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_BETA_BLOCKER_POST_OP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_BETA_BLOCKER_POST_OP.mlm
new file mode 100644
index 0000000..a4d4eaa
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_BETA_BLOCKER_POST_OP.mlm
@@ -0,0 +1,157 @@
+maintenance:
+
+ title: FORM_SET_BETA_BLOCKER_POST_OP;;
+ mlmname: FORM_SET_BETA_BLOCKER_POST_OP;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Maria Pest, Allscripts;;
+ date: 2013-02-01;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+
+ explanation: This MLM is called from ...
+
+ Change history
+ 2013.02.01 JML CSR 31156: Created
+
+
+
+ ;;
+ keywords: Called MLMs
+ ;;
+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";
+
+ // 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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ VisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+ FormName := this_form.Name;
+
+ ompExists := false;
+ betaBlockerExists := false;
+ declineOrderExists := false;
+
+ //Retrieve fields on form
+ BetaBlockers := first of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 32);
+ BetaBlockers_Fld := BetaBlockers.Value;
+ BetaBlockers_Order := first of (BetaBlockers_Fld where BetaBlockers_Fld.Name = "Beta Blockers");
+ DeclineBeta_Order := first of (BetaBlockers_Fld where BetaBlockers_Fld.Name = "Decline Beta Blocker Order");
+
+ //Retrieve OMP beta blockers
+ (ompName) := read {"SELECT p.DrugName "
+ || " FROM SXAAMBClientPrescription p with (nolock) JOIN SXAAMBDrugCategoryXRef xr with (nolock)"
+ || " ON p.GenericNameID = xr.GenericNameID"
+ || " JOIN SXAAMBDrugCategory dc with (nolock)"
+ || " ON xr.DrugCategoryID = dc.DrugCategoryID"
+ || " WHERE p.ClientGUID = " || Sql(ClientGuid)
+ || " AND dc.CategoryName LIKE {{{SINGLE-QUOTE}}}%Beta Blockers{{{SINGLE-QUOTE}}}"};
+
+ if (exists ompName) then
+ ompExists := true;
+
+ //Retrieve inpatient orders for beta blockers
+ (betaBlockerName) := read {"SELECT o.Name "
+ || "FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK) "
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " JOIN CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " WHERE cv.ClientGUID = " || Sql(ClientGuid)
+ || " AND cv.GUID = " || Sql(VisitGuid)
+ || " AND cv.ChartGUID = " || Sql(ChartGuid)
+ || " AND ocmi.TherapeuticCategory LIKE {{{SINGLE-QUOTE}}}%beta-adrenergic blocking%{{{SINGLE-QUOTE}}}"
+ || " AND((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
+
+ if (not exists betaBlockerName) then
+ //Retrieve inpatient order for decline beta blocker order
+ (declineOrd) := read {"SELECT o.Name "
+ || "FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " JOIN CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID "
+ || "WHERE cv.ClientGUID = " || Sql(ClientGuid)
+ || " AND cv.GUID = " || Sql(VisitGuid)
+ || " AND cv.ChartGUID = " || Sql(ChartGuid)
+ || " AND o.Name = {{{SINGLE-QUOTE}}}Decline Beta Blocker Order{{{SINGLE-QUOTE}}}"};
+
+ if (exists declineOrd) then
+ declineOrderExists := true;
+ endif;
+ else
+ betaBlockerExists := true;
+ endif;
+ endif;
+
+ if (CallingEvent = "FormOpen") then
+ if (ompExists = true) then
+ if (betaBlockerExists = false) then
+ if (declineOrderExists = false) then
+ //Check the beta blocker order
+ BetaBlockers_Order.IsSelected := true;
+ BetaBlockers_Order.IsRequired := true;
+ DeclineBeta_Order.IsSelected := false;
+ else
+ BetaBlockers_Order.IsSelected := false;
+ DeclineBeta_Order.IsSelected := false;
+ endif;
+ else
+ BetaBlockers_Order.IsSelected := false;
+ DeclineBeta_Order.IsSelected := false;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_BLOOD_CULTURE_X2_SCHEDULING.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_BLOOD_CULTURE_X2_SCHEDULING.mlm
new file mode 100644
index 0000000..1669a07
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_BLOOD_CULTURE_X2_SCHEDULING.mlm
@@ -0,0 +1,108 @@
+maintenance:
+
+ title: Form_Set_Blood_Culture_X2_Scheduling;;
+ mlmname: Form_Set_Blood_Culture_X2_Scheduling;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Maria Pest, Allscripts ;;
+ specialist: Don Warnick, Allscripts;;
+ date: 2015-03-02;;
+ validation: testing;;
+
+library:
+ purpose: Calculate the time of the follow-up to a STAT Blood Culture. The time delay of the second Blood Culture is 30 minutes from now
+ ;;
+
+ explanation: This MLM is called from the Blood Culture x2 OS
+
+ Change history
+ 01.18.2016 DJW CSR# 32412/33445 Schedule a follow-up Blood Culture
+
+ ;;
+ keywords: Called MLMs, Blood Bank
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ StartDate1 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ StartTime1 := first of (field_list where field_list.DataItemName = "Lab_Phleb Draw Sched Time" and field_List.Control_MultiFieldOccNum = 2);
+ StartTime2 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1);
+ StartTime2Value := StartTime2.value;
+
+ HR := Extract Hour NOW;
+ MN := Extract Minute NOW;
+ DT := NOW;
+
+
+ If (HR = 23 and MN > 29) // 23:29 - 23:59 - set date to tomorrow and hour = 00
+ then
+ DT2 := DT + 1 day;
+ HR2 := 0;
+ MN2 := MN - 30;
+
+ else
+ DT2 := DT;
+
+ if MN > 29 // xx:29 - xx:59 - set hour to next hour
+ then
+ HR2 := HR +1;
+ MN2 := MN - 30;
+ else
+ HR2 := HR;
+ MN2 := MN + 30;
+ endif;
+ endif;
+
+ If HR2 < 10 then HR2:= "0" || HR2; endif;
+ If MN2 < 10 then MN2:= "0" || MN2; endif;
+
+ StartDate1.Value:= DT2;
+ StartTime1.Value:= HR2 || ":" || MN2;
+
+ // Update a hiddent time field related to the Lab Priority MLM called below
+
+ StartTime2Value.ReqTimeCode := "Scheduled Time";
+ StartTime2Value.ReqTimeValue:= HR2 || ":" || MN2;
+
+
+ // Call the Lab Priority MLM
+
+ DisplayNewScheduled := first of (field_list.Value where field_list.DataItemName = "LAB_CB_Alternate Priorities");
+ if (DisplayNewScheduled) then
+ Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
+ (this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
+ endif;
+
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_CALCITONIN_NASAL.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_CALCITONIN_NASAL.mlm
new file mode 100644
index 0000000..0c41188
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_CALCITONIN_NASAL.mlm
@@ -0,0 +1,156 @@
+maintenance:
+
+ title: Set Calcitonin Nasal Spray;;
+ mlmname: FORM_Set_Calcitonin_Nasal;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for Calcitonin Nasal Spray order set to gray out left or right nostril orders per pharmacy
+ ;;
+
+ explanation: This MLM is called from the Calcitonin Nasal Spray order set on field change of one of 3 grids.
+ ;;
+ keywords: Called MLMs, Calcitonin Nasal Spray, order set
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ ////////////////
+ Grid1_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Grid1_List := Grid1_fld.Value;
+
+ Grid1Pos1 := first of(Grid1_List);
+ Grid1Pos2 := last of(Grid1_List);
+
+ ///////////////
+ Grid2_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Grid2_List := Grid2_fld.Value;
+
+ Grid2Pos1 := first of(Grid2_List);
+ Grid2Pos2 := last of(Grid2_List);
+ ///////////////
+ Grid3_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 3);
+ Grid3_List := Grid3_fld.Value;
+
+ Grid3Pos1 := first of(Grid3_List);
+ Grid3Pos2 := last of(Grid3_List);
+ ///////////////
+
+
+
+ If CallingField = "MultiOrderGrid|1" then
+
+ If Grid1Pos1.IsSelected = True
+ then
+ Grid1_List.IsReadOnly := (False, True);
+ Grid2_List.IsSelected := (False, True);
+ Grid2_List.IsReadOnly := (True, True);
+ Grid3_List.IsSelected := (True, False);
+ Grid3_List.IsReadOnly := (True,True);
+
+
+ elseif ((Grid1Pos1.IsSelected = False) and (Grid1Pos2.IsSelected = False))
+ then
+ Grid1_List.IsReadOnly := (False,False);
+ Grid2_List.IsReadOnly := (False,False);
+ Grid2_List.IsSelected := (False, False);
+ Grid3_List.IsSelected := (False, False);
+ Grid3_List.IsReadOnly := (False,False);
+
+ elseif Grid1Pos2.IsSelected = True then
+ Grid1_List.IsReadOnly := (True, False);
+ Grid2_List.IsSelected := (True, False);
+ Grid2_List.IsReadOnly := (True, True);
+ Grid3_List.IsSelected := (False, True);
+ Grid3_List.IsReadOnly := (True,True);
+ endif;
+
+ elseif CallingField ="MultiOrderGrid|2" then
+ If Grid2Pos1.IsSelected = True
+ then
+ Grid2_List.IsReadOnly := (False, True);
+ Grid3_List.IsSelected := (False, True);
+ Grid3_List.IsReadOnly := (True,True);
+
+
+ elseif ((Grid1Pos2.IsSelected = False) and (Grid2Pos2.IsSelected = False))
+ then
+ Grid2_List.IsReadOnly := (False,False);
+ Grid3_List.IsSelected := (False, False);
+ Grid3_List.IsReadOnly := (False,False);
+
+ elseif Grid2Pos2.IsSelected = True then
+ Grid2_List.IsReadOnly := (True, False);
+ Grid3_List.IsSelected := (True, False);
+ Grid3_List.IsReadOnly := (True,True);
+ endif;
+ elseif CallingField ="MultiOrderGrid|3" then
+ If Grid3Pos1.IsSelected = True
+ then
+ Grid3_List.IsReadOnly := (False, True);
+
+
+ elseif ((Grid3Pos2.IsSelected = False) and (Grid3Pos2.IsSelected = False))
+ then
+
+ Grid3_List.IsReadOnly := (False,False);
+
+ elseif Grid3Pos2.IsSelected = True then
+ Grid3_List.IsReadOnly := (True, False);
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_CARDIAC_REHAB_OUTPATIENT_REFERRAL.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_CARDIAC_REHAB_OUTPATIENT_REFERRAL.mlm
new file mode 100644
index 0000000..694f8ac
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_CARDIAC_REHAB_OUTPATIENT_REFERRAL.mlm
@@ -0,0 +1,126 @@
+maintenance:
+
+ title: FORM_SET_CARDIAC_REHAB_OUTPATIENT_REFERRAL;;
+ mlmname: FORM_SET_CARDIAC_REHAB_OUTPATIENT_REFERRAL;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Maria Pest, Allscripts;;
+ date: 2013-01-04;;
+ validation: testing;;
+
+library:
+ purpose: Enforce ordering on the On the Post Cardiac Peripheral Intervention order set
+ ;;
+
+ explanation: Requires user to enter either an ACE/ARB order OR Decline ACE/ARB order; does not allow user to enter order if neither
+ selected.
+ Requires user to select either Cardiac Rehabilitation Phase II OR Decline Outpatient Cardiac Rehab order; does not allow
+ user to enter order if neither is selected.
+
+ Change history
+ 2013.01.04 JML CSR 30694: Created
+ 2016.04.26 TMS CSR 33465: Add call on Form Close to Medication Order Management MLM
+
+
+ ;;
+ keywords: Called MLMs, Cardiac, Outpatient
+ ;;
+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";
+
+ // 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;
+
+ stop := false;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+
+ //Retrieve fields
+ //Ace / Arb Grid
+ Ace_Arb_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 8);
+ Ace_Arb_List := Ace_Arb_fld.Value;
+
+ //No Ace / Arb Grid
+ No_Ace_Arb_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 13);
+ No_Ace_Arb_List := No_Ace_Arb_fld.Value;
+
+ //Rehab Consults Grid
+ Rehab_Consults_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 11);
+ Rehab_Consults_List := Rehab_Consults_fld.Value;
+
+ Decline_Rehab_Consults_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 14);
+ Decline_Rehab_Consults_List := Decline_Rehab_Consults_fld.Value;
+
+ if (CallingEvent = "FormClose") then
+ if ((not (true IN Ace_Arb_List.IsSelected)) AND (not (true IN No_Ace_Arb_List.IsSelected))) then
+ //No_Ace_Arb_List.IsSelected := (true);
+
+ //Display mandatory message
+ StopMsg := "You have not selected any ACEI or ARB medications for this patient. Therefore, you must"
+ || " select the {{{SINGLE-QUOTE}}}Decline ACEI or ARB{{{SINGLE-QUOTE}}} order with a mandatory {{{SINGLE-QUOTE}}}Reason{{{SINGLE-QUOTE}}}.";
+ this_communication.DispayForm := "Yes";
+ this_communication.MessageType := "Error";
+ this_communication.Message := StopMsg;
+ endif;
+
+ Rehab_Phase_II_fld := first of (Rehab_Consults_List WHERE Rehab_Consults_List.Name = "Cardiac Rehabilitation -Phase II");
+ Decline_Rehab_Order_fld := first of (Decline_Rehab_Consults_List WHERE Decline_Rehab_Consults_List.Name = "Decline Outpatient Cardiac Rehab Order");
+
+ if ((Rehab_Phase_II_fld.IsSelected = false) AND (Decline_Rehab_Order_fld.IsSelected = false)) then
+ StopMsg := "You have not selected the {{{SINGLE-QUOTE}}}Cardiac Rehabilitation - Phase II{{{SINGLE-QUOTE}}} order for this patient. Therefore, you must"
+ || " select the {{{SINGLE-QUOTE}}}Decline Outpatient Cardiac Rehab Order{{{SINGLE-QUOTE}}} with a mandatory {{{SINGLE-QUOTE}}}Reason{{{SINGLE-QUOTE}}}.";
+ this_communication.DispayForm := "Yes";
+ this_communication.MessageType := "Error";
+ this_communication.Message := StopMsg;
+ endif;
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_CCM_ADMISSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_CCM_ADMISSION.mlm
new file mode 100644
index 0000000..6252f03
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_CCM_ADMISSION.mlm
@@ -0,0 +1,415 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_CCM_Admission;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Dean Miklavic, Eclipsys Corp ext 7448;;
+ specialist: Don Warnick, Eclipsys Corp Ext 7461;;
+ date: 2009-05-21;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in Cardiac heparin protocol order set
+ ;;
+
+ explanation: This MLM is called from the heparin in Cardiac heparin protocol order set, form: CCM_Admission_OS (spelling may change)
+
+
+ Change history
+
+ 05.21.2009 DW Change hidden fields to protected fields (control_visible := false --- control_read_only :=true)
+ 06.14.2009 RS Added logic to see if CBC on Stat Admit order was checked, if so no need to order baseline
+ Logic to assign CBC value and added to close event to check for it.
+ All code marked with date 06/14/2009
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 03.28.2012 JML Added call to functional MLM that will perform a check for existing or unsubmitted
+ anticoagulant orders and whether they conflict with the current anticoagulant selection.
+ 05.16.2012 JML Changed Heparin duplicate medication alert to soft stop.
+ 03.26.2013 JML CSR #31451: Modifications to CCM Admission order set to display warning message to physicians
+ if they try to submit the order set without selecting heparin.
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+
+ ;;
+ keywords: Called MLMs, Cardiac hep protocol
+ ;;
+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;
+
+
+ //Include standard .Net libraries
+ 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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Anticoagulant Conflict Check MLM
+ anticoagulant_conflict := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ user_guid := this_communication.UserGUID;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+//////////////
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Labs_List := Labs_fld.Value;
+
+ //Find the three checkboxes that may need to be ordered with this protocol
+ Found_Base_CBC:= first of (Labs_list where Labs_list.Name = "CBC No Diff (Hemogram Only)");
+
+ CheckCBC:=False;
+
+///////////////////////// 06/14/2009 RS ADDED CODE TO CHECK STAT ADMIT ORDERS /////////////////
+ StatAdm_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 2);
+ StatAdm_List := StatAdm_fld.Value;
+
+ StatCBC := first of (StatAdm_list where StatAdm_list.Name = "CBC (Includes Diff)");
+//////////////////////// END OF RS ADDED CODE 06/14/2009, more on form close event ////////////////
+
+
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 3);
+ Lab_Daily_List := Lab_Daily.Value;
+
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+//////////////
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+
+ Lab_Rem_List := Lab_Rem.Value;
+
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+///////////////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Inj:= first of (Heps_List where Heps_List.Name = "Heparin Inj");
+/////////////
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+////////////
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|1" then
+
+ If (Fnd_Hep_Inj.IsSelected = True) then
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Fnd_Hep_Inj.Name);
+
+ if (stop = true) then
+ if (severity = "high") then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := stop_message;
+ this_communication.MessageType := "Informational";
+
+ Fnd_Hep_Inj.IsSelected := False;
+ Lab_Daily_List.IsReadOnly := (True, True, True, True, True);
+ Lab_Daily_List.IsSelected := (False, False, False, False, False);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := False;
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ((dialogRes as String) = "No") then
+ Fnd_Hep_Inj.IsSelected := False;
+ Lab_Daily_List.IsReadOnly := (True, True, True, True, True);
+ Lab_Daily_List.IsSelected := (False, False, False, False, False);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := False;
+ else
+ Lab_Daily_List.IsReadOnly := (True, True, True, True, True);
+ Lab_Daily_List.IsSelected := (True, True, True, True, True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ endif;
+ endif;
+ else
+ Lab_Daily_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+ endif;
+
+ else
+ //Check to see if logged in user is a Physician
+ (userOcc) := read last {
+ " SELECT OccupationCode, touchedWhen "
+ || " FROM CV3User with (nolock)"
+ || " WHERE GUID = " || Sql(user_guid)
+ || " AND Active = 1 "
+ , primarytime = touchedWhen
+ };
+
+
+ if (userOcc = "MD" or userOcc = "Physician" or userOcc = "Non-staff Physician") then
+ stopMsg := "You are NOT ordering Heparin for DVT Prophylaxis.\n\nPlease document reason in Progress Note.";
+ this_communication.DisplayForm := true;
+ this_communication.Message := stopMsg;
+ this_communication.MessageType := "Informational";
+ endif;
+ Lab_Daily_List.IsSelected := (False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")"
+ ;
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+ endif; //Calling Field
+
+ elseif CallingEvent = "FormOpen" then
+
+ if (Fnd_Hep_Inj.IsSelected) then
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Fnd_Hep_Inj.Name);
+
+ if (stop = true) then
+ if (severity = "high") then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := stop_message;
+ this_communication.MessageType := "Informational";
+ Fnd_Hep_Inj.IsSelected := false;
+ Lab_Daily_List.IsSelected := (False, False, False, False, False);
+ Fnd_Daily.IsSelected := False;
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ((dialogRes as String) = "No") then
+ Fnd_Hep_Inj.IsSelected := false;
+ Lab_Daily_List.IsSelected := (False, False, False, False, False);
+ Fnd_Daily.IsSelected := False;
+ else
+ Lab_Daily_List.IsSelected := (True, True, True, True, True);
+
+ Fnd_Daily.IsSelected := True;
+ endif;
+ endif;
+ else
+ Lab_Daily_List.IsSelected := (True, True, True, True, True);
+ Fnd_Daily.IsSelected := True;
+ endif;
+ else
+ Lab_Daily_List.IsSelected := (False, False, False, False, False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+
+ Lab_Daily_List.IsReadOnly := (True,True,True,True,True);
+ Fnd_Daily.IsReadOnly := True;
+
+ // Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Fnd_Hep_Inj.IsSelected = True) then
+
+
+ If ((Found_Base_CBC.IsSelected =false) and (StatCBC.IsSelected = false)) then // 06/14/2009 RS Added check to stop dups
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists CBC_Val then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_Base_CBC.ISSelected :=True;
+ endif;
+
+ endif;
+
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+
+ singledate := formlist[J];
+
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+
+
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Reset_CBC_Grid);
+
+
+ endif; //If exist
+
+
+ // else
+
+ // this_communication.DisplayForm := "Yes";
+ // this_communication.Message := "Please Select a Heparin Order.";
+ // this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_CCM_THORACENTESIS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_CCM_THORACENTESIS.mlm
new file mode 100644
index 0000000..81f8ad9
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_CCM_THORACENTESIS.mlm
@@ -0,0 +1,137 @@
+maintenance:
+
+ title: CCM Thoracentesis Orderset;;
+ mlmname: FORM_Set_CCM_Thoracentesis ;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: ;;
+ date: 2009-09-22;;
+ validation: testing;;
+
+library:
+ purpose: Used to select labs per left / right or both Thoracentesis
+
+ ;;
+
+ explanation: This MLM is called from the CCM Thoracentesis Orderset
+
+
+ ;;
+ keywords: Called MLMs,CCM Thoracentesis Orderset
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ fldleft := last of (field_list where field_list.DataItemName = "CCM Left Thoracentesis");
+ fldright := last of (field_list where field_list.DataItemName = "CCM Right Thoracentesis");
+ fldleftright := last of (field_list where field_list.DataItemName = "CCM L/R Thoracentesis");
+
+ listcbs:= ();
+ allvalue := false;
+
+
+
+ if Callingfield = "CCM Left Thoracentesis|1" then
+ allvalue := fldleft.Value;
+ listcbs:=(2);
+
+ if fldleft.Value = True then
+ fldright.control_read_only := True;
+ fldleftright.control_read_only := True;
+ else
+ fldright.control_read_only := False;
+ fldleftright.control_read_only := False;
+ endif;
+ elseif Callingfield = "CCM Right Thoracentesis|1" then
+ allvalue := fldright.Value;
+ listcbs:=(3);
+ if fldright.Value = True then
+ fldleft.control_read_only := True;
+ fldleftright.control_read_only := True;
+
+ // set grid here, name of grid to change or list and to change to.
+
+ else
+ fldleft.control_read_only := False;
+ fldleftright.control_read_only := False;
+
+ // set grid here, name of grid to change or list and to change to.
+ endif;
+ elseif Callingfield = "CCM L/R Thoracentesis|1" then
+ allvalue := fldleftright.Value;
+ listcbs:=(2,3);
+ if fldleftright.Value = True then
+ fldleft.control_read_only := True;
+ fldright.control_read_only := True;
+
+ // set grid here, name of grid to change or list and to change to.
+
+ else
+ fldleft.control_read_only := False;
+ fldright.control_read_only := False;
+
+ // set grid here, name of grid to change or list and to change to.
+ endif;
+ endif;
+
+ listcbsproc:= count listcbs;
+
+
+ for k in (1 seqto listcbsproc) do
+ gridwork := listcbs[k];
+ Grid_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = gridwork);
+ Grid_list :=Grid_fld.Value;
+ Grid_SelList := Grid_List.IsSelected;
+
+ ListMembs:= count Grid_SelList;
+ setlist := ();
+ for j in (1 seqto ListMembs) do
+ setlist := setlist, allvalue;
+ enddo;
+ Grid_List.IsSelected:= setlist;
+
+ enddo;
+
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_CDIFF_ANTIBIOTICS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_CDIFF_ANTIBIOTICS.mlm
new file mode 100644
index 0000000..601d5de
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_CDIFF_ANTIBIOTICS.mlm
@@ -0,0 +1,204 @@
+maintenance:
+
+ title: FORM_SET_CDIFF_ANTIBIOTICS;;
+ mlmname: FORM_SET_CDIFF_ANTIBIOTICS;;
+ 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 Intra-CDIFF Antibiotics order set
+ ;;
+
+ explanation: This MLM is called from CDIFF Antibiotics Order Set
+
+ Change history
+ 05.09.2016 JML CSR 34091: Created for CDIFF Antibiotic Order Set
+
+ ;;
+ keywords: Called MLMs, Antibiotic CDIFF, 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";
+
+ // 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}}};
+ antibiotic_guideline_mlm := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_DISPLAY_ANTIBIOTIC_GUIDELINES{{{SINGLE-QUOTE}}};
+ crcl_mlm := mlm {{{SINGLE-QUOTE}}}FORM_MLM_Creatinine_Clearance_OS{{{SINGLE-QUOTE}}};
+
+ exceptFld := ();
+
+ // 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
+ Flagyl_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 12 );
+ Vancomycin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 13 );
+ Vanco_Flagyl_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 14 );
+ Vanco_Enema_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 15 );
+
+ Antibiotics_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 1 );
+ Antibiotics_Grid_Value := Antibiotics_Grid.Value;
+
+ Flagyl_Oral := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Metronidazole 500mg Tab" );
+ Flagyl_IV := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Metronidazole:" );
+ Vancomycin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Vancomycin Soln" );
+ Vancomycin_Enema := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Vancomycin Enema" );
+
+ Vancomycin_Dose := first of ( field_list WHERE field_list.DataItemName = "DosageLow" AND field_list.Control_MultiFieldOccNum = 2 );
+ Vancomycin_Code := first of ( field_list WHERE field_list.DataItemName = "PRX_DrugIDCode" AND field_list.Control_MultiFieldOccNum = 1 );
+
+ CrCl_MgDl := first of ( field_list WHERE field_list.DataItemName = "PRX_CrCl_mg_dl" AND field_list.Control_MultiFieldOccNum = 1 );
+
+ // 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 Antibiotics_Grid_Value do
+ item.IsReadonly := true;
+ enddo;
+ endif;
+
+ if ( CallingEvent = "FieldChange" ) then
+
+ //************ FLAGYL ********************
+ if ( CallingField = "PRX_Checkbox1|12" ) then
+ fieldValue := Flagyl_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Flagyl_Oral.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Flagyl_Oral.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //********** VANCOMYCIN ********************
+ if ( CallingField = "PRX_Checkbox1|13" ) then
+ fieldValue := Vancomycin_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Vancomycin.IsSelected := true;
+ Vancomycin_Dose.Value := (125 as number);
+ Vancomycin_Code.Value := "03346";
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Vancomycin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************** VANCOMYCIN + FLAGYL **************
+ if ( CallingField = "PRX_Checkbox1|14" ) then
+ fieldValue := Vanco_Flagyl_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Vancomycin.IsSelected := true;
+ Flagyl_IV.IsSelected := true;
+
+ Vancomycin_Dose.Value := ( 500 as number );
+ Vancomycin_Code.Value := "03272";
+
+ exceptFld := exceptFld, Vanco_Enema_Chk.DataItemname || "|" || Vanco_Enema_Chk.Control_MultiFieldOccNum;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Vancomycin.IsSelected := false;
+ Flagyl_IV.IsSelected := false;
+
+ if ( Vanco_Enema_Chk.Value = false ) then
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+ endif;
+
+ //************** VANCOMYCIN ENEMA ********************
+ if ( CallingField = "PRX_Checkbox1|15" ) then
+ fieldValue := Vanco_Enema_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Vancomycin_Enema.IsSelected := true;
+
+ exceptFld := exceptFld, Vanco_Flagyl_Chk.DataItemName || "|" || Vanco_Flagyl_Chk.Control_MultiFieldOccNum;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Vancomycin_Enema.IsSelected := false;
+ if ( Vanco_Flagyl_Chk.Value = false ) then
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+ endif;
+ endif; //End 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_CODE_STATUS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_CODE_STATUS.mlm
new file mode 100644
index 0000000..d88e79f
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_CODE_STATUS.mlm
@@ -0,0 +1,530 @@
+maintenance:
+
+ title: FORM_Set_Code_Status;;
+ mlmname: FORM_Set_Code_Status;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Dean Miklavic;;
+ specialist: Don Warnick;;
+ date: 2016-02-11;;
+ validation: testing;;
+
+library:
+ purpose: Prevent the user from leaving the Code Status order set w/o selecting a code status order and a cpr order
+ ;;
+
+ explanation: This MLM is called from the Code Status Order Set
+
+
+ Change history
+
+ 02.09.2016 - DJW CSR# 33949 - Change to wording of Code Status and CPR orders
+ 09.14.2017 - JML CSR# 26413 - Modify order set to allow physician to enter a "temporary" code status, "Ethically unable to determine....".
+ 02.16.2018 JML CSR# 26413 - Changed historical code status SQL to only pull from most recent previous visit; fix reorder historical
+ selection to ensure the last historical code status is always selected.
+ 05.23.2018 JML CSR# 36342 - Modified MLM to allow for historical Code Status values to be reorder since verbiage change.
+
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ dc_order := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_DISCONTINUE_ORDER{{{SINGLE-QUOTE}}};
+
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ user_guid := this_communication.UserGUID;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ falseCPRList := ();
+ falseCSList := ();
+
+ CodeStatusLabel := "";
+
+ // VISIBLE FIELDS
+
+ PriorOrders := first of (field_list where field_list.DataItemName = "NUR_Code Status" and field_List.Control_MultiFieldOccNum = 1);
+ CPRGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ CodeStatusGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ ReorderInstruct:= last of ( field_list where field_list.DataItemName = "NUR_CodeStatus_Instructions" and field_list.Control_MultiFieldOccNum = 4);
+ Reorder := last of ( field_list where field_list.DataItemName = "NUR_Code Status CB1" and field_list.Control_MultiFieldOccNum = 1);
+ EthicalOrders := last of ( field_list WHERE field_list.DataItemname = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 4 );
+ ConsultOrders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 5 );
+
+ DC_CodeStatuses_CK := last of ( field_list WHERE field_list.DataItemName = "NUR_Code Status CB2 DC" AND field_list.Control_MultiFieldOccNum = 1 );
+// DC_EthicalOrder_CK := last of ( field_list WHERE field_list.DataItemName = "NUR_Code Status CB3 DC1" AND field_list.Control_MultiFieldOccNum = 1 );
+
+ // HIDDEN FIELDS
+
+ // Current Summary Line information for compare to prior order summary line. If then name & summary match the prior order, the grid row number will be saved
+
+ CodeStatus_CMO_Summary:= first of (field_list where field_list.DataItemName = "NUR_NewCMO_Summary" and field_List.Control_MultiFieldOccNum = 1);
+ CodeStatus_LI_Summary := first of (field_list where field_list.DataItemName = "NUR_NewLI_Summary" and field_List.Control_MultiFieldOccNum = 1);
+ CodeStatus_FT_Summary := first of (field_list where field_list.DataItemName = "NUR_NewFT_Summary" and field_List.Control_MultiFieldOccNum = 1);
+ CPR_Summary := first of (field_list where field_list.DataItemName = "NUR_NewCPR_Summary" and field_List.Control_MultiFieldOccNum = 1);
+ DNR_Summary := first of (field_list where field_list.DataItemName = "NUR_NewDNR_Summary" and field_List.Control_MultiFieldOccNum = 1);
+
+ // These hidden fields store grid row number of the order that matches the prior order (if no match, 999 is stored in the field)
+
+ Code_Status_Grid_Value_Match:= first of (field_list where field_list.DataItemName = "NUR_CodeSt Order Match" and field_List.Control_MultiFieldOccNum = 1);
+ CPR_Grid_Value_Match := first of (field_list where field_list.DataItemName = "NUR_CodeSt CPR Order Match" and field_List.Control_MultiFieldOccNum = 1);
+
+ MissingOrderBox:= first of (field_list where field_list.DataItemName = "Nur_CPR_MI_Orders" and field_List.Control_MultiFieldOccNum = 1);
+
+
+ CPRGridValue := CPRGrid.value;
+ CodeStatusGridValue := CodeStatusGrid.value;
+ EthicalOrdersValue := EthicalOrders.Value;
+ ConsultOrdersValue := ConsultOrders.Value;
+
+ CPR := CPRGrid.Value[1];
+ DNR := CPRGrid.Value[2];
+ CMO := CodeStatusGrid.Value[3];
+ LI := CodeStatusGrid.Value[2];
+ FT := CodeStatusGrid.Value[1];
+ EUD := EthicalOrders.Value[1];
+
+ for i IN 1 seqto ( count CPRGridValue.IsSelected ) do
+ falseCPRList := falseCPRList, false;
+ enddo;
+ for j IN 1 seqto ( count CodeStatusGridValue.IsSelected ) do
+ falseCSList := falseCSList, false;
+ enddo;
+ // Form Open
+
+
+ If CallingEvent = "FormOpen" then
+
+ (clientVisitStatus, codestatusorder, cprorder, discussionorder, codestatusordername,
+ codestatussummary, cprordername, cprsummary,
+ ethicalorder, ethicalorderonly, ethicalsummaryonly) := read last
+ {"CREATE TABLE #tmp_aaa (ID int IDENTITY(1, 1), ordername varchar(300), clientvisitguid varchar (16), clientVisitStatus varchar(6), summaryline varchar(500), enteredtime datetime, ordertype varchar(1), "
+ || " CPRorder varchar(300), EthicalOrder varchar(300), Discussionorder varchar(300), CPRorderOnly varchar(300), CPRSummaryOnly varchar(300), EthicalOrderOnly varchar(300), EthicalSummaryOnly varchar(300))"
+ || " SET CONCAT_NULL_YIELDS_NULL off"
+ || " INSERT INTO #tmp_aaa (ordername,clientvisitguid, clientVisitStatus, summaryline , enteredtime, ordertype) "
+ || " select o.Name,o.ClientVisitGUID as varchar, cv.VisitStatus, isnull (substring( o.SummaryLine, 3, 498), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) , o.createdwhen,"
+ || " case when ocmi.name like {{{SINGLE-QUOTE}}}code status:%{{{SINGLE-QUOTE}}} and ocmi.name not like {{{SINGLE-QUOTE}}}code status: ethical%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
+ || " when ocmi.name like {{{SINGLE-QUOTE}}}cpr%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} "
+ || " when ocmi.name like {{{SINGLE-QUOTE}}}dnr%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} "
+ || " when ocmi.name like {{{SINGLE-QUOTE}}}code status discussion%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}} "
+ || " when ocmi.name like {{{SINGLE-QUOTE}}}code status: Ethical%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}4{{{SINGLE-QUOTE}}}"
+ || " else {{{SINGLE-QUOTE}}}5{{{SINGLE-QUOTE}}}"
+ || " end {{{SINGLE-QUOTE}}}ordertype{{{SINGLE-QUOTE}}}"
+ || " from CV3OrderCatalogMasterItem ocmi with (nolock) join CV3Order o with (nolock) on o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " JOIN CV3ClientVisit cv WITH (NOLOCK) on o.ClientVisitGUID = cv.GUID"
+ || " AND o.ClientGuid = cv.ClientGuid and o.ChartGuid = cv.ChartGuid"
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and ( ocmi.name like {{{SINGLE-QUOTE}}}Code Status%{{{SINGLE-QUOTE}}}"
+ || " or ocmi.name like {{{SINGLE-QUOTE}}}cpr%{{{SINGLE-QUOTE}}} "
+ || " or ocmi.name like {{{SINGLE-QUOTE}}}dnr%{{{SINGLE-QUOTE}}}) "
+ || " and o.OrderStatusLevelNum >= 15 "
+ || " and o.OrderStatusCode not in ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}})"
+ || " and cv.VisitStatus = {{{SINGLE-QUOTE}}}DSC{{{SINGLE-QUOTE}}}"
+ || " and o.InitialSessionTypeCode = {{{SINGLE-QUOTE}}}Standard{{{SINGLE-QUOTE}}}"
+ || " order by o.clientvisitguid, ordertype, cast( convert(char(16), o.CreatedWhen,120) as varchar)"
+ || " update t1 "
+ || " set t1.CPRorder = cast( convert(char(10), t2.enteredtime,110) as varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast( convert(char(5), t2.enteredtime,114) as varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + t2.ordername + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + t2.summaryline ,"
+ || " t1.discussionorder =cast( convert(char(10), t3.enteredtime,110) as varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast( convert(char(5), t3.enteredtime,114) as varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + t3.ordername + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + t3.summaryline, "
+ || " t1.CPRorderOnly = t2.ordername, t1.CPRSummaryOnly = t2.summaryline"
+ || " from #tmp_aaa t1 inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.clientvisitguid = t2.clientvisitguid and t1.ordertype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} and t2.ordertype = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}}"
+ || " inner join #tmp_aaa t3 on t3.id = t1.id +2 and t1.clientvisitguid = t3.clientvisitguid and t1.ordertype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} and t3.ordertype = {{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}}"
+ || " UPDATE T1"
+ || " SET t1.EthicalOrder = cast( convert(char(10), t4.enteredtime,110) as varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast( convert(char(5), t4.enteredtime,114) as varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + t4.ordername + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + t4.summaryline,"
+ || " t1.EthicalOrderOnly = t4.ordername, t1.EthicalSummaryOnly = t4.summaryline"
+ || " FROM #tmp_aaa t1 INNER JOIN #tmp_aaa t4 ON t4.ID = t1.ID + 3 AND t1.clientvisitguid = t4.clientvisitguid AND t1.ordertype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} AND t4.ordertype = {{{SINGLE-QUOTE}}}4{{{SINGLE-QUOTE}}}"
+ || " delete from #tmp_aaa where ordertype <> {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}"
+ || " delete from #tmp_aaa where enteredtime < GETDATE () -730"
+ || " select clientVisitStatus, cast( convert(char(10), enteredtime,110) as varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast( convert(char(5), enteredtime,114) as varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + ordername + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + summaryline ,"
+ || " CPRorder, Discussionorder, ordername, summaryline, CPRorderOnly , CPRSummaryOnly, EthicalOrder, EthicalOrderOnly, EthicalSummaryOnly"
+ || " from #tmp_aaa "
+ || " order by enteredtime"
+ || " drop table #tmp_aaa"
+ } ;
+
+ //Retrieve Current Code Status order
+ ( curr_order,
+ curr_orderSequence ) := read { "SELECT CONVERT(varchar(26), o.CreatedWhen, 120 ) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + o.Name + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + ISNULL ( SUBSTRING( o.SummaryLine, 3, 498), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) , "
+ || " CASE WHEN ocmi.Name LIKE {{{SINGLE-QUOTE}}}code status:%{{{SINGLE-QUOTE}}} AND ocmi.Name NOT LIKE {{{SINGLE-QUOTE}}}code status: ethical%{{{SINGLE-QUOTE}}} THEN {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} "
+ || " WHEN ocmi.Name LIKE {{{SINGLE-QUOTE}}}cpr%{{{SINGLE-QUOTE}}} THEN {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
+ || " WHEN ocmi.Name LIKE {{{SINGLE-QUOTE}}}dnr%{{{SINGLE-QUOTE}}} THEN {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
+ || " WHEN ocmi.Name LIKE {{{SINGLE-QUOTE}}}code status discussion%{{{SINGLE-QUOTE}}} THEN {{{SINGLE-QUOTE}}}4{{{SINGLE-QUOTE}}} "
+ || " WHEN ocmi.Name LIKE {{{SINGLE-QUOTE}}}code status: Ethical%{{{SINGLE-QUOTE}}} THEN {{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}}"
+ || " ELSE {{{SINGLE-QUOTE}}}5{{{SINGLE-QUOTE}}}"
+ || " END {{{SINGLE-QUOTE}}}OrderType{{{SINGLE-QUOTE}}}"
+ || " FROM CV3OrderCatalogMasterItem ocmi WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " JOIN CV3ClientVisit cv WITH (NOLOCK) "
+ || " ON o.ClientVisitGUID = cv.GUID"
+ || " AND o.ClientGuid = cv.ClientGuid AND o.ChartGuid = cv.ChartGuid"
+ || " WHERE o.ClientGUID = " || SQL(client_guid)
+ || " AND ( ocmi.Name LIKE {{{SINGLE-QUOTE}}}Code Status%{{{SINGLE-QUOTE}}}"
+ || " OR ocmi.Name LIKE {{{SINGLE-QUOTE}}}cpr%{{{SINGLE-QUOTE}}} "
+ || " OR ocmi.Name LIKE {{{SINGLE-QUOTE}}}dnr%{{{SINGLE-QUOTE}}}) "
+ || " AND o.OrderStatusLevelNum >= 15 "
+ || " AND o.OrderStatusCode NOT IN ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}})"
+ || " AND cv.VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}"
+ || " AND o.InitialSessionTypeCode = {{{SINGLE-QUOTE}}}Standard{{{SINGLE-QUOTE}}}"
+ || " ORDER BY o.ClientVisitGUID, OrderType, CAST( CONVERT( char(16), o.CreatedWhen, 120 ) AS VARCHAR )" };
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+
+ PriorOrders.Value := "";
+
+ //If current orders exist, add them to display box at top of order set
+ if exists ( curr_order ) then
+ CodeStatusLabel := "Current" || CRLF || "-----------" || CRLF;
+
+ PriorOrders.Value := PriorOrders.Value || CodeStatusLabel;
+
+ for i IN ( 1 seqto count curr_order ) DO
+ PriorOrders.Value := PriorOrders.Value || curr_order[i] || CRLF;
+ enddo;
+
+ PriorOrders.Value := PriorOrders.Value || CRLF || CRLF;
+ else
+ DC_CodeStatuses_CK.Control_Read_Only := true;
+
+ endif;
+
+
+ // If there is no order, change the null value to a blank (required for formatting in the prior order text box)
+ if not exist codestatusorder then codestatusorder := " "; endif;
+ if not exist cprorder then cprorder := " "; endif;
+ if not exist discussionorder then discussionorder := " "; endif;
+ if not exist ethicalorder then ethicalorder := " "; endif;
+
+ // If past orders are found display them in the visible "Prior Orders" box and write the components to hidden fields for later compare
+ If codestatusorder || cprorder || discussionorder || ethicalorder = " " then
+ PriorOrders.value := PriorOrders.Value || "No historical orders to display";
+
+ Reorder.Control_Read_Only := True;
+
+ ReorderInstruct.Value := "There were NO Code Status orders found within the last 2 years. Please select new Code Status orders";
+
+ else
+ CodeStatusLabel := "Historical (previous visit)" || CRLF || "--------------------------------------" || CRLF;
+
+ PriorOrders.Value := PriorOrders.Value || CodeStatusLabel || cprorder || CRLF || codestatusorder || CRLF;
+ if ( ethicalorder <> " " ) then
+ PriorOrders.Value := PriorOrders.Value || ethicalorder || CRLF;
+ endif;
+ PriorOrders.Value := PriorOrders.Value || discussionorder;
+
+ endif;
+
+ // Set the "SummaryLine Compare Value" for the CPR & CS order to the matching value stored in the Summary value at the bottom of the form (these are the "current" summary line values)
+ If codestatusordername = "Code Status: Comfort Measures Only" then SummaryCompare_CS := CodeStatus_CMO_Summary.Value; endif;
+ if codestatusordername = "Code Status: Limited Interventions" then SummaryCompare_CS := CodeStatus_LI_Summary.Value; endif;
+ if codestatusordername = "Code Status: Full Treatment" then SummaryCompare_CS := CodeStatus_FT_Summary.Value; endif;
+
+ if cprordername = "CPR/Attempt Resuscitation" then
+ SummaryCompare_CPR := CPR_Summary.Value;
+ SummaryCompare_OldCPR := "If patient is PULSELESS AND APNEIC"; //JML CSR 36342: old verbiage
+ endif;
+ if cprordername = "DNR/Do Not Attempt Resuscitation" then
+ SummaryCompare_CPR := DNR_Summary.Value;
+ SummaryCompare_OldCPR := "Allow natural death if patient is PULSELESS AND APNEIC"; //JML CSR 36342: old verbiage
+ endif;
+
+ // Compare the Prior Code Status Name to each name in the Grid. If a match is found, compare the Prior Summary line to the "current" summary line
+ Code_Status_Grid_Value_Match.Value := 999;
+
+ index_list := 1 seqto (count CodeStatusGrid.Value);
+ for I in index_list do
+
+ // Name match
+ if codestatusordername = CodeStatusGrid.Value[I].Name then
+
+ // SummaryLine match
+ if codestatussummary = SummaryCompare_CS then
+ Code_Status_Grid_Value_Match.Value := I;
+ endif;
+ endif;
+ enddo;
+ // Compare the Prior CPR Name to each name in the Grid. If a match is found, compare the Prior Summary line to the "current" summary line
+ CPR_Grid_Value_Match.value := 999;
+
+ index_list := 1 seqto (count CPRGrid.Value);
+ for J in index_list do
+
+ // Name match
+ if cprordername = CPRGrid.Value[J].Name then
+
+ // SummaryLine match
+ if cprsummary = SummaryCompare_CPR OR cprsummary = SummaryCompare_OldCPR then //JML CSR 36342: test for old verbiage as well as new
+ CPR_Grid_Value_Match.value := J;
+ endif;
+ endif;
+ enddo;
+
+ // If a partial or full match is found, then enable the "re-order button"
+ if Code_Status_Grid_Value_Match.Value <> 999 or CPR_Grid_Value_Match.value <> 999 and PriorOrders.value <> "No orders to display" then
+ Reorder.Control_Read_Only := False;
+ ReorderInstruct.Value := "Click on the checkbox below to acknowledge the previous Code Status Order(s) and to reorder for this visit. Must be an exact match.";
+ endif;
+
+ // If neither the Code Status nor the CPR orders on file match the new format, then disable the "re-order button"
+ if Code_Status_Grid_Value_Match.Value = 999 and CPR_Grid_Value_Match.value = 999 and PriorOrders.value <> "No orders to display" then
+ Reorder.Control_Read_Only := True;
+ ReorderInstruct.Value := "Previous Code Status orders found that do not match current format. Please select new Code Status orders.";
+ endif;
+
+ endif; // Form Open
+
+
+ // Field Change
+ If this_communication.CallingEvent ="FieldChange" Then
+
+ // CPR Order was selected
+ If this_communication.CallingFieldName = "MultiOrderGrid|1" Then
+
+ Reorder.Value := False;
+ CPRGridValue.IsReadonly := falseCPRList;
+
+ if NOT ( true IN CodeStatusGridValue.IsSelected ) then
+ EthicalOrdersValue.IsReadonly := false;
+ endif;
+
+ if EUD.IsSelected = true then
+ EthicalOrdersValue.IsSelected := false;
+ endif;
+ if CPR.IsSelected = True then
+ CPRGridValue.IsReadonly := (false,true);
+ EthicalOrdersValue.IsReadonly := true;
+ endif;
+ if DNR.IsSelected = True then
+ CPRGridValue.IsReadonly := (true,false);
+ EthicalOrdersValue.IsReadonly := true;
+ endif;
+
+ endif;
+
+ // Code Status Order was selected
+ If this_communication.CallingFieldName = "MultiOrderGrid|2" Then
+
+ Reorder.Value := False;
+ CodeStatusGridValue.IsReadonly := falseCSList;
+
+ if ( NOT ( true IN CPRGridValue.IsSelected ) ) then
+ EthicalOrdersValue.IsReadonly := false;
+ endif;
+
+ if EUD.IsSelected = True then
+ EthicalOrdersValue.IsSelected := false;
+ endif;
+ if CMO.IsSelected = True then
+ CodeStatusGridValue.IsReadonly := (true,true,false);
+ EthicalOrdersValue.IsReadonly := true;
+ endif;
+ if LI.IsSelected = True then
+ CodeStatusGridValue.IsReadonly := (true,false,true);
+ EthicalOrdersValue.IsReadonly := true;
+ endif;
+ if FT.IsSelected = True then
+ CodeStatusGridValue.IsReadonly := (false,true,true);
+ EthicalOrdersValue.IsReadonly := true;
+ endif;
+
+ endif;
+
+ // Reorder Checkbox was selected
+ if this_communication.CallingFieldName ="NUR_Code Status CB1|1" then
+
+ // "Reorder" checkbox is deselected - enable the order buttons
+ If Reorder.Value = False Then
+
+ CPR.IsSelected := false; CPR.IsReadOnly := False;
+ DNR.IsSelected := false; DNR.IsReadOnly := False;
+ CMO.IsSelected := false; CMO.IsReadOnly := False;
+ LI.IsSelected := false; LI.IsReadOnly := False;
+ FT.IsSelected := false; FT.IsReadOnly := False;
+
+ DC_CodeStatuses_CK.Value := false;
+
+ Else // "Reorder" checkbox is selected
+
+ // If a Code Status or CPR match was found, disable the order buttons and select the order grid item stored in the hidden fields
+ if Code_Status_Grid_Value_Match.Value <> "999" then
+
+ CMO.IsSelected := false; CMO.IsReadOnly := True;
+ LI.IsSelected := false; LI.IsReadOnly := True;
+ FT.IsSelected := false; FT.IsReadOnly := True;
+ CodeStatusGrid.Value[Code_Status_Grid_Value_Match.Value as number].IsSelected := True;
+ CodeStatusGrid.Value[Code_Status_Grid_Value_Match.Value as number].IsReadOnly := False;
+ endif;
+
+ if CPR_Grid_Value_Match.Value <> "999" then
+
+ CPR.IsSelected := false; CPR.IsReadOnly := True;
+ DNR.IsSelected := false; DNR.IsReadOnly := True;
+ CPRGrid.Value[CPR_Grid_Value_Match.Value as number].IsSelected := True;
+ CPRGrid.Value[CPR_Grid_Value_Match.Value as number].IsReadOnly := False;
+ endif;
+
+ //Auto-check "DC: Ethically unable to determine"
+ DC_CodeStatuses_CK.Value := true;
+
+ endif; // Reorder checkbox slected or deselected
+ endif; // Reorder checkbox changed
+
+ // Ethical Order
+ if this_communication.CallingFieldName = "MultiOrderGrid|4" then
+ if ( EUD.IsSelected = true ) then
+ if ( true IN CPRGridValue.IsSelected ) then
+ CPRGridValue.IsSelected := falseCPRList;
+ endif;
+
+ CPR.IsSelected := true;
+ CPRGridValue.IsReadOnly := ( false, true );
+
+ if ( true IN CodeStatusGridValue.IsSelected ) then
+ CodeStatusGridValue.IsSelected := falseCSList;
+ endif;
+
+ FT.IsSelected := true;
+ CodeStatusGridValue.IsReadOnly := ( false, true, true );
+ else
+
+ CodeStatusGridValue.IsSelected := falseCSList;
+ CodeStatusGridValue.IsReadOnly := falseCSList;
+
+ CPRGridValue.IsSelected := falseCPRList;
+ CPRGridValue.IsReadOnly := falseCPRList;
+
+ endif;
+ endif;
+
+ //Consult Orders
+ if this_communication.CallingFieldName = "MultiOrderGrid|5" then
+ if ( true IN ConsultOrdersValue.IsSelected ) then
+
+ if ( ( NOT ( true IN CPRGridValue.IsSelected ) ) AND ( NOT ( true IN CodeStatusGridValue.IsSelected ) ) ) then
+ EUD.IsSelected := true;
+
+ CPR.IsSelected := true;
+ CPRGridValue.IsReadOnly := ( false, true );
+
+ FT.IsSelected := true;
+ CodeStatusGridValue.IsReadOnly := ( false, true, true );
+ endif;
+
+ else
+ if ( EUD.IsSelected = true ) then
+ EUD.IsSelected := false;
+
+ CPRGridValue.IsSelected := falseCPRList;
+ CPRGridValue.IsReadOnly := falseCPRList;
+
+ CodeStatusGridValue.IsSelected := falseCSList;
+ CodeStatusGridValue.IsReadOnly := falseCSList;
+ endif;
+ endif;
+
+ endif;
+
+ //DC_CodeStatuses_CK & DC_EthicalOrder_CK
+ if ( this_communication.CallingFieldName = "NUR_Code Status CB2 DC|1" ) then
+ if DC_CodeStatuses_CK.Value = true then
+ DC_EthicalOrder_CK.Value := false;
+ endif;
+ endif;
+ if ( this_communication.CallingFieldName = "NUR_Code Status CB3 DC1|1" ) then
+ if ( DC_EthicalOrder_CK.Value = true ) then
+ DC_CodeStatuses_CK.Value := false;
+ endif;
+ endif;
+
+ endif; // Field Change
+
+ // Form Close
+ If CallingEvent = "FormClose" then
+
+ if true in CPRGridValue.IsSelected then
+ cpr_was_selected := "true";
+ else
+ cpr_was_selected := "false";
+ endif;
+
+ If true in CodeStatusGridValue.IsSelected then
+ codestatus_was_selected := "true";
+ else
+ codestatus_was_selected := "false";
+ endif;
+
+ If codestatus_was_selected = "true" and cpr_was_selected = "true" then
+ MissingOrderBox.Value := "CPR and Code Status Order were entered";
+ endif;
+
+ // Handle DC_CodeStatuses_CK and DC_EthicalOrder_CK discontinue logic
+ if ( DC_CodeStatuses_CK.Value = true OR DC_EthicalOrder_CK.Value = true ) then
+
+ if ( DC_CodeStatuses_CK.value = true ) then
+ order_names_to_filter := "{{{SINGLE-QUOTE}}}Code Status Discussion{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Comfort Measures Only{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Limited Interventions{{{SINGLE-QUOTE}}},"
+ || "{{{SINGLE-QUOTE}}}Code Status: Full Treatment{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CPR/Attempt Resuscitation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DNR/Do Not Attempt Resuscitation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Ethically unable to determine{{{SINGLE-QUOTE}}}";
+ endif;
+ if ( DC_EthicalOrder_CK.Value = true ) then
+ order_names_to_filter := "{{{SINGLE-QUOTE}}}Code Status Discussion{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Ethically unable to determine{{{SINGLE-QUOTE}}}";
+ endif;
+
+ //Need to grab Order GUIDs of previous orders
+ ( orderGUID, orderName ) := read {"SELECT o.GUID, o.Name"
+ || " FROM CV3ClientVisit cv JOIN CV3ORDER o"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || SQL(client_guid)
+ || " AND cv.GUID = " || SQL(visit_guid)
+ || " AND cv.ChartGUID = " || SQL(chart_guid)
+ || " AND o.Name IN (" || order_names_to_filter || ")"
+ || " AND o.OrderStatusLevelNum >= 15"
+ || " AND o.OrderStatusCode not in ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}})"};
+
+
+ if ( exists orderGUID ) then
+
+ MissingOrderBox.Value := "CPR and CodeStatus Order were entered.";
+
+ for i IN 1 seqto ( count orderGUID ) do
+ a := orderName[i];
+ rtnValue := call dc_order WITH visit_guid, user_guid, orderGUID[i], "Code Status Order Discontinue";
+ enddo;
+
+ endif;
+
+ endif;
+
+ endif; // Form Close
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_CPOE_PAIN_MEDICATION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_CPOE_PAIN_MEDICATION.mlm
new file mode 100644
index 0000000..6806706
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_CPOE_PAIN_MEDICATION.mlm
@@ -0,0 +1,112 @@
+maintenance:
+
+maintenance:
+ title: Current Order Retrieval for CPOE Pain Medication Order Set;;
+ filename: FORM_SET_CPOE_Pain_Medication;;
+ arden: version 2.5;;
+ version: 15.10;;
+ institution: Eclipsys, System MLM;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2015-10-05;;
+ validation: testing;;
+library:
+ purpose: This MLM retrieves medication by therapeutic class display on order set.
+
+ ;;
+ explanation: This MLM retrieves medication by therapeutic class for display on order set..
+
+ History:
+ 04.27.2016 TMS CSR 33484: Created to retrieve all current analgesic medications into a text box for
+ review within the order set.
+
+
+ ;;
+ keywords: Called MLMs, Form fields, Therapeutic Duplication
+;;
+
+
+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;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ comm_obj := this_communication.primaryobj;
+
+ /***************************************************************************************/
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ Grid_Med1 := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Grid_Med1_List :=Grid_Med1.value ;
+ InfoBox := last of (field_list where field_list.DataItemName = "PRX_CurrentOrders" and field_List.Control_MultiFieldOccNum = 1);
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+
+
+
+ If (CallingEvent = "FormOpen") then
+ therapeuticID := 58;
+
+ ordername := ();
+ ordersummary := ();
+ If therapeuticID is not null then
+ (ordername, ordersummary) := read
+ { " select o.name, Replace (o.summaryline, CHAR(13) + CHAR(10), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})"
+ || " from CV3Order o with (nolock) "
+ || " join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGuid "
+ || " where ocmi.TherapeuticCategoryID = " || TherapeuticID
+ || " and o.clientvisitguid = " || SQL(Visit_guid)
+ || " and o.clientguid = " || SQL(Client_guid)
+ || " and o.OrderStatusLevelNum < 69 " ||
+ };
+
+ endif;
+ druglist := "";
+ countdrugs := count ordername;
+
+ if countdrugs > 0 then
+ for ss in (1 seqto countdrugs) do
+ if ss = 1 then
+ druglist := ordername [ss] || " " || ordersummary [ss];
+ else
+ druglist := druglist || CRLF || ordername [ss] || " " || ordersummary [ss];
+ endif;
+ enddo;
+ Infobox.value := druglist;
+ endif;
+
+ endif; // callingevent = "FormOpen"
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_CPOE_PED_COMMONDX_CHAIN.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_CPOE_PED_COMMONDX_CHAIN.mlm
new file mode 100644
index 0000000..c8ac49f
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_CPOE_PED_COMMONDX_CHAIN.mlm
@@ -0,0 +1,104 @@
+maintenance:
+
+ title: CPOE_Ped_CommonDx Orderset to have 2 MLMs on open and 2 on close events;;
+ mlmname: FORM_Set_CPOE_Ped_CommonDx_Chain;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Isolation Set MLM;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Lisa Hancher, Eclipsys Corp Ext 7468;;
+ date: 2010-04-14;;
+ validation: testing;;
+
+library:
+ purpose: Daisy chain for 2 MLMs on form open and 2 on form close
+ ;;
+
+ explanation: This MLM is called from the CPOE_Ped_CommonDx Orderset
+
+ ;;
+ keywords: Called MLMs, Daisy Chain, Form Open, Form Close
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid:=this_communication.ClientGUID;
+ ClientChartGUID:=this_communication.ChartGUID;
+
+ // Lab Priority Section As Per Deevya Gaikwad{{{SINGLE-QUOTE}}}s Suggestion
+ //-----------BEGIN COPY SECTION-------------------
+ DisplayNewScheduled := first of (field_list.Value
+ where field_list.DataItemName = "LAB_CB_Alternate Priorities");
+
+ if (DisplayNewScheduled) then
+ Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
+ (this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
+ endif;
+ //-----------END COPY SECTION-------------------
+
+// Associate All MLMs
+
+ MedImageInd := MLM {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING_INDICATIONS_FOR_OS{{{SINGLE-QUOTE}}};
+ StoolShiga := MLM {{{SINGLE-QUOTE}}}FORM_SET_ED_STOOL_SHIGA_TOX{{{SINGLE-QUOTE}}};
+ LabsAnemia := MLM {{{SINGLE-QUOTE}}}FORM_SET_LABS_ANEMIA{{{SINGLE-QUOTE}}};
+
+ If CallingEvent = "FormOpen" then
+ Open1 := call MedImageInd with (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) ;
+
+ Open2 := call StoolShiga with (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) ;
+ elseif CallingEvent = "FormClose" then
+ Close1 :=call MedImageInd with (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) ;
+ Close2 := call LabsAnemia with (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) ;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_DELIRIUM_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_DELIRIUM_ORDERS.mlm
new file mode 100644
index 0000000..b4acd2e
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_DELIRIUM_ORDERS.mlm
@@ -0,0 +1,283 @@
+maintenance:
+
+ title: FORM_SET_DELIRIUM_ORDERS;;
+ mlmname: FORM_SET_DELIRIUM_ORDERS;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Robert Stewart, Allscripts;;
+ date: 2015-02-04;;
+ validation: testing;;
+
+library:
+ purpose: Require EKG ordered when Haliperidol IV is ordered based on date of last test.
+ ;;
+
+ explanation: This MLM is called from Delirium order set. If patient has not had an EKG in the last 10 days, require it be ordered
+ with Haliperidol IV order.
+
+ Change history
+ 2015.02.04 JML CSR 32828: Created
+ 2014.04.28 JML Copied to Production
+ 2018.05.15 DW CSR# 36322 Delerium OS changes
+
+ ;;
+ keywords: Called MLMs, Haliperidol, EKG
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ //Includes and Called MLMs
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ generic_mlm := MLM {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}};
+ // ordrmgt_mlm := MLM {{{SINGLE-QUOTE}}}FORM_SET_RX_MEDICATION_ORDER_MGT{{{SINGLE-QUOTE}}};
+
+ (this_communication,this_form,client_info_obj) := argument;
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+ FormName := this_form.Name;
+ PrimaryObjDetail := this_communication.PrimaryObj;
+ OrderSetName := PrimaryObjDetail.OrderSetName;
+
+ // Form Fields
+
+ ScheduledMeds := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 17); // Pharmacy Scheduled Medications
+ ScheduledMeds_List := ScheduledMeds.Value;
+
+ HaldolIVMed := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 11); // Pharmacy PRN IV Medication - Haloperidol
+ HaldolIVMed_List := HaldolIVMed.Value;
+
+ HaldolPRNMed := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 8); // Pharmacy PRN Medication - Haloperidol
+ HaldolPRNMed_List := HaldolPRNMed.Value;
+
+ NonHaldolPRNMed := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 14); // Pharmacy PRN Medication - Non-Haloperidol
+ NonHaldolPRNMed_List:= NonHaldolPRNMed.Value;
+
+ EKGLab := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 4); // Cardiology
+ EKGLab_List := EKGLab.Value;
+
+ Nur_Instr2 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline" AND field_list.Control_MultiFieldOccNum = 1); // Nurse Instructions
+ Nur_Instr2_List := Nur_Instr2.Value;
+
+ isHaldolIVSelected := last of (HaldolIVMed_List.IsSelected);
+ isHaldolPRNSelected := last of (HaldolPRNMed_List.IsSelected);
+ isNoNHaldolPRNSelected:= last of (NonHaldolPRNMed_List.IsSelected);
+ isEKGSelected := last of (EKGLab_List.IsSelected);
+
+
+
+ // Field Change Event
+
+
+
+ if CallingEvent = "FieldChange"
+
+ then
+
+ // Cardiology
+
+ if CallingField = "MultiOrderGrid|4"
+
+ then
+
+ // If EKG Daily order has been selected, select the Daily Nursing Order
+
+ for i IN 1 seqto count EKGLab.Value do
+ GridItem := EKGLab.Value[i];
+ if i = 2
+ then
+ If GridItem.IsSelected = true
+ then
+ EKGLab.Value[3].IsSelected := true; // Daily Orders
+ else
+ EKGLab.Value[3].IsSelected := false; // Daily Orders
+ endif;
+ endif;
+ enddo;
+
+
+ // Determine if Haldol IV Push Scheduled has been selected
+
+ isHaldolSchMedSelected := false;
+
+ for i IN 1 seqto count ScheduledMeds.Value do
+ SchedMedOrder := ScheduledMeds.Value[i];
+ if SchedMedOrder.Name = "Haloperidol Inj" and SchedMedOrder.IsSelected = true then isHaldolSchMedSelected := true; endif;
+ enddo;
+
+
+ if isHaldolIVSelected = true or isHaldolSchMedSelected = true
+ then
+ EKGLab_List.IsSelected := true;
+ endif;
+
+
+
+ // Pharmacy Secheduled Medication
+
+
+ elseif CallingField = "MultiOrderGrid|17"
+
+ then
+
+
+ //Call Generic MLM
+ (this_communication, this_form) := CALL generic_mlm WITH this_communication, this_form, client_info_obj;
+
+ // Determine if the Haldol IV Scheduled Med is selected
+
+ isHaldolSchMedSelected := false;
+
+ for i IN 1 seqto count ScheduledMeds.Value do
+ SchedMedOrder := ScheduledMeds.Value[i];
+ if SchedMedOrder.Name = "Haloperidol Inj" and SchedMedOrder.IsSelected = true then isHaldolSchMedSelected := true; endif;
+ enddo;
+
+ // If no Haldol IV (prn or sched) is selected de-select the Nurse Instructions order, EKG Daily Order ann Nursing Daily Orders
+
+ if isHaldolIVSelected = false and isHaldolSchMedSelected = false
+ then
+ Nur_Instr2_List.IsSelected := false; // Nursing Instructions
+ EKGLab.Value[2].IsSelected := false; // EKG Daily
+ EKGLab.Value[3].IsSelected := false; // Daily Orders
+ else
+ Nur_Instr2_List.IsSelected := true; // Nursing Instructions
+ EKGLab.Value[2].IsSelected := true; // EKG Daily
+ EKGLab.Value[3].IsSelected := true; // Daily Orders
+ endif;
+
+
+ // Pharmacy PRN Medication - Non-Haloperidol
+
+
+ elseif CallingField = "MultiOrderGrid|14"
+
+ then
+
+ SomethingIsSelected := false;
+
+ // Determine if Something has been selected
+
+ for i IN 1 seqto count NonHaldolPRNMed.Value do
+ GridItem := NonHaldolPRNMed.Value[i];
+ if GridItem.IsSelected = true then SomethingIsSelected:= true; SelectedGridNumber := i; endif;
+ enddo;
+
+ // Make the other orders in this grid read-only
+
+ for i IN 1 seqto count NonHaldolPRNMed.Value do
+ if i <> SelectedGridNumber then NonHaldolPRNMed.Value[i].IsReadonly := true; endif;
+ enddo;
+
+ if SomethingIsSelected = true
+ then
+ HaldolPRNMed_List.IsSelected := false;
+ HaldolPRNMed_List.IsReadonly := true;
+ HaldolIVMed_List.IsSelected := false;
+ HaldolIVMed_List.IsReadonly := true;
+ else
+ HaldolPRNMed_List.IsReadonly := false;
+ HaldolIVMed_List.IsReadonly := false;
+ NonHaldolPRNMed_List.IsReadonly := false;
+ endif;
+
+
+ // Pharmacy PRN Medication
+
+
+ elseif CallingField = "MultiOrderGrid|8"
+
+
+ then
+
+ SomethingIsSelected := false;
+
+ for i IN 1 seqto count HaldolPRNMed.Value do
+ GridItem := HaldolPRNMed.Value[i];
+ if GridItem.IsSelected = true then SomethingIsSelected:= true; endif;
+ enddo;
+
+ if SomethingIsSelected = false and isHaldolIVSelected = false
+ then
+ NonHaldolPRNMed_List.IsReadonly := false;
+ else
+ NonHaldolPRNMed_List.IsReadonly := true;
+ endif;
+
+
+ // Pharmacy PRN IV Medication
+
+
+ elseif CallingField = "MultiOrderGrid|11"
+
+ then
+
+ SomethingIsSelected := false;
+
+ for i IN 1 seqto count HaldolIVMed.Value do
+ GridItem := HaldolIVMed.Value[i];
+ if GridItem.IsSelected = true then SomethingIsSelected:= true; endif;
+ enddo;
+
+ if SomethingIsSelected = false and isHaldolPRNSelected = false
+ then
+ NonHaldolPRNMed_List.IsReadonly := false;
+ else
+ NonHaldolPRNMed_List.IsReadonly := true;
+ endif;
+
+
+ // Determine if the Haldol IV Scheduled Med is selected
+
+ isHaldolSchMedSelected := false;
+
+ for i IN 1 seqto count ScheduledMeds.Value do
+ SchedMedOrder := ScheduledMeds.Value[i];
+ if SchedMedOrder.Name = "Haloperidol Inj" and SchedMedOrder.IsSelected = true then isHaldolSchMedSelected := true; endif;
+ enddo;
+
+ // If no Haldol IV (prn or sched) is selected de-select the Nurse Instructions order, EKG Daily Order ann Nursing Daily Orders
+
+ if isHaldolIVSelected = false and isHaldolSchMedSelected = false
+ then
+ Nur_Instr2_List.IsSelected := false; // Nursing Instructions
+ EKGLab.Value[2].IsSelected := false; // EKG Daily
+ EKGLab.Value[3].IsSelected := false; // Daily Orders
+ else
+ Nur_Instr2_List.IsSelected := true; // Nursing Instructions
+ EKGLab.Value[2].IsSelected := true; // EKG Daily
+ EKGLab.Value[3].IsSelected := true; // Daily Orders
+ endif;
+
+
+ endif;
+
+
+ endif;
+
+
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_DESELECT_ALL.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_DESELECT_ALL.mlm
new file mode 100644
index 0000000..3d240be
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_DESELECT_ALL.mlm
@@ -0,0 +1,81 @@
+maintenance:
+
+ title: FORM_SET_DESELECT_ALL;;
+ mlmname: FORM_SET_DESELECT_ALL;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Shawn Head, Allscripts ;;
+ specialist: Peggy Karish/David Kish, St Clair Hospital;;
+ date: 2016-06-21;;
+ validation: testing;;
+
+library:
+ purpose: De-Select all items in Order set if the "de-select all" checkbox is checked.
+ ;;
+
+ explanation: Called from the transition orders order set
+
+ Change history
+ 2016062.21 STH CSR 34745: Created {go-live 6/23/2016} ;;
+
+
+ keywords: Called MLMs, Transition Orders
+ ;;
+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";
+
+ // 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;
+
+ stop := false;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+
+ Deselect_cb := first of (field_list WHERE field_list.DataItemName = "ED_Deselect CB") ;
+
+
+ field_list.Value.IsSelected := false;
+ Deselect_cb.Value := 0;
+
+;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_DIABETIC_MGT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_DIABETIC_MGT.mlm
new file mode 100644
index 0000000..cebdfff
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_DIABETIC_MGT.mlm
@@ -0,0 +1,1095 @@
+maintenance:
+
+ title: FORM_SET_Diabetic_Mgt;;
+ mlmname: FORM_SET_Diabetic_Mgt;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: St Clair Hospital;;
+ date: 2017-10-31;;
+ validation: testing;;
+
+library:
+ purpose: Support best practice for diabetic management including standardized weight based calculation long and short acting insulin.
+ ;;
+
+ explanation:
+
+ Change history
+ 10.31.2017 TMS CSR 35723: Created to calculate interim insulin orders and/or enter other orders to manage patients with Diabetes
+ until a full review of home medications and hospital treatment is reviewed by the physician managing the patient.
+ 11.13.2017 TMS CSR 35723: Updated to check blood glucose and present user with an alert box allowing them to enter
+ a dose to be given now based upon the sliding scale ordered from the algorithm.
+ 07.24.2018 TMS CSR 36815: Updated to to increase the Insulin Total Daily Dose (TDD) for patients on IV corticosteroids to
+ 0.5 units/kg (previously was 0.4) as well as increase the Total Daily Dose (TDD) for patients without steroids
+ and without GFR issues to 0.4 units/kg (previously was 0.3).
+ ;;
+ keywords: Insulin, weight based, diabetic
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ local_session := CDS_SESSION.local;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ // 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;
+
+ comm_obj := this_communication.primaryobj;
+
+ /*******************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:="";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 FORMATTED WITH "%C" ;
+ TAB2 := TAB || TAB ;
+ TAB3 := TAB || TAB || TAB;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+ UserGuid := this_communication.UserGuid;
+
+
+ //Form fields
+ Endo_Consult:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 5 );
+ Physician_Consult:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 6 );
+ InsulinLowDose := last of (field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 1);
+ InsulinModDose := last of (field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 2);
+ InsulinHighDose := last of (field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 3);
+ BasalInsulin:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ CurrWeight := last of ( field_list WHERE field_list.DataItemName = "CombinedMeasurements"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ OrderInfo := last of ( field_list WHERE field_list.DataItemName = "PRX_NOTECOMMENT0"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ BGMFrequencyCode := last of ( field_list WHERE field_list.DataItemName = "FrequencyCode"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ BGMFrequency := BGMFrequencyCode.value;
+
+
+ SingleOral_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_SingleOralHomeMed"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ MultipleOralOrInsulin_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_MultipleOralOrInsulin"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ Diabetic_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_PatientIsDiabetic"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ InsulinPump_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_PatientOnInsulinPump"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ DietControlled_CB:= last of ( field_list WHERE field_list.DataItemName = "PRX_DM_PatientDietControlled"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ GFR_CB:= last of ( field_list WHERE field_list.DataItemName = "PRX_DM_GFR_LT_30"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ IvSteroid_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_PtOnIvSteroids"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Override_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_Generic_CB"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ CurrentLoc := read last
+ {" select currentlocation from cv3clientvisit "
+ || " where ClientGUID = " || SQL(clientguid)
+ || " and GUID = " || SQL(clientvisitguid)};
+
+
+
+ InsulinLowDoseList := InsulinLowDose.value;
+ InsulinModDoseList := InsulinModDose.value;
+ InsulinHighDoseList := InsulinHighDose.value;
+ BasalInsulinList := BasalInsulin.value;
+ Physician_ConsultList := Physician_Consult.value;
+ Endo_ConsultList := Endo_Consult.value;
+
+ CalcDose := last of (field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ if exists CurrWeight then
+ CurrWeight_val := CurrWeight.Value;
+ wt := CurrWeight_val.weight;
+ fmtwt := wt formatted with "%.1f";
+ else
+ wtgm := read last
+ { " Select Text from CV3PhysicalNoteDeclaration "
+ || " where ClientGUID = " || SQL(clientguid)
+ || " and ClientVisitGUID = " || SQL(clientvisitguid)
+ || " and TypeCode = {{{SINGLE-QUOTE}}}weight{{{SINGLE-QUOTE}}} "
+ || " order by Entered asc " };
+ wt := (wtgm as number) / 1000;
+ fmtwt := wt formatted with "%.1f";
+ endif;
+
+ If CallingEvent = "FormOpen" or (CallingEvent = "FieldChange" and CallingField = "CombinedMeasurements|1" and Override_CB.Value = False)
+ or (CallingEvent = "FieldChange" and CallingField = "PRX_Generic_CB|1" and Override_CB.Value = False) then
+
+ /*********************************BEGIN HEALTH ISSUE SECTION**********************************************/
+
+ HealthIssue := read last {" select distinct hi.ShortName
+ from cv3healthissuedeclaration hi with (nolock)
+ inner join cv3codedhealthissue chi with (nolock) on hi.CodedHealthIssueGUID = chi.guid and chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})
+ where Clientguid = " || SQL (clientguid)
+ || " and hi.active = 1
+ and Status in ({{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chronic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Retired Code{{{SINGLE-QUOTE}}})
+ and (((ICD10Code like {{{SINGLE-QUOTE}}}E10%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}}))
+ or ((ICD9Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
+ or ((ICD9Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
+ or ((chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})) and ((chi.Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}}))
+ or ((chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}}) and ((chi.Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}})))"};
+
+ if exist HealthIssue then Patient_is_Diabetic := "Yes"; else Patient_is_Diabetic := "No"; endif;
+
+ If Patient_is_Diabetic = "Yes" then
+ Diabetic_CB.value := True;
+ Diabetic_CB.Control_Read_Only := True;
+ else
+ If Diabetic_CB.value = False then
+ dialogResult1 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unable to retrieve health issues for Diabetes. \n Does this patient have Diabetes? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogResult1 as string) = "Yes") then
+ Diabetic_CB.value := True;
+ Diabetic_CB.Control_Read_Only := True;
+ else
+ Diabetic_CB.Control_Read_Only := False;
+ endif;
+ endif;
+ endif;
+ /***********************BEGIN INSULIN PUMP DOCUMENTATION SEARCH ********************************/
+
+ (InsulinPump) := read last {"select fsl.value "
+ || " from CV3ClientDocument cd with (nolock) "
+ || " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || SQL(clientguid) || " and cdd.active = 1) "
+ || " left join CV3ObservationDocument od with (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
+ || " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID and ocmi.name in ({{{SINGLE-QUOTE}}}SCHCK type of insulin{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCHCK insulin pump type{{{SINGLE-QUOTE}}}) "
+ || " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL(clientguid) || ") "
+ || " where cd.clientguid = " || SQL(clientguid) || " and cd.clientvisitguid = " || SQL(clientvisitguid)
+ || " and cd.documentname in ({{{SINGLE-QUOTE}}}ED Triage Note{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}adult patient profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}OB Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pediatric Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Test{{{SINGLE-QUOTE}}}) " };
+
+ if exist insulinPump then
+ Patient_on_Insulin_Pump := "Yes";
+ else
+
+ PumpHealthIssue := read last {" select distinct hi.ShortName
+ from cv3healthissuedeclaration hi with (nolock)
+ inner join cv3codedhealthissue chi with (nolock) on hi.CodedHealthIssueGUID = chi.guid and chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})
+ where Clientguid = " || SQL (clientguid)
+ || " and hi.active = 1
+ and Status in ({{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chronic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Retired Code{{{SINGLE-QUOTE}}})
+ and ((ICD10Code = {{{SINGLE-QUOTE}}}Z96.41{{{SINGLE-QUOTE}}})
+ or (ICD9Code = {{{SINGLE-QUOTE}}}V45.85{{{SINGLE-QUOTE}}} and ICD10Code is null)
+ or ((chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}}) and (chi.Code = {{{SINGLE-QUOTE}}}Z96.41{{{SINGLE-QUOTE}}})))"};
+
+ if exist pumpHealthIssue then Patient_on_Insulin_Pump := "Yes"; else Patient_on_Insulin_Pump := "No"; endif;
+ endif;
+
+
+
+ /***********************BEGIN HOME MEDICATION ORAL DIABETIC AGENT SEARCH********************************/
+ (OralHomeMed,rxid) := read { "select distinct cp.DrugName, cp.prescriptionid
+ from SXAAMBClientPrescription cp
+ inner join SXAMTDrugNameMapVW dnm on dnm.drug_synonym_id = cp.FormularyBrandKey
+ join SXAMTCategoryDrugXREFVW cdx on cdx.drug_id = dnm.drug_id
+ join SXAMTDrugCategoriesVW cat on cat.multum_category_id = cdx.multum_category_id
+ where cp.ClientGUID = " || SQL(ClientGuid) || " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ and cat.category_name in ({{{SINGLE-QUOTE}}}dipeptidyl peptidase 4 inhibitors{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}antidiabetic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}sulfonylureas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}biguanides{{{SINGLE-QUOTE}}})"};
+
+ if exist OralHomeMed then Patient_on_Oral_Home_Agent := "Yes"; else Patient_on_Oral_Home_Agent := "No"; endif;
+
+ HomeMedCount := count (OralHomeMed);
+
+ If Patient_on_Oral_Home_Agent = "Yes" then
+ If HomeMedCount = 1 then
+ SingleOralAgent := "Yes";
+ MultiOralAgent := "No";
+ else
+ SingleOralAgent := "No";
+ MultiOralAgent := "Yes";
+ endif;
+ endif;
+
+
+ /*********************************BEGIN HOME INSULIN SEARCH********************************************/
+ InsulinHomeMed := read last { "select distinct cp.DrugName
+ from SXAAMBClientPrescription cp
+ inner join SXAMTDrugNameMapVW dnm on dnm.drug_synonym_id = cp.FormularyBrandKey
+ join SXAMTCategoryDrugXREFVW cdx on cdx.drug_id = dnm.drug_id
+ join SXAMTDrugCategoriesVW cat on cat.multum_category_id = cdx.multum_category_id
+ where cp.ClientGUID = " || SQL(ClientGuid) || " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ and cat.category_name = {{{SINGLE-QUOTE}}}insulin{{{SINGLE-QUOTE}}}
+ and cp.EndDate is null "};
+ if exist InsulinHomeMed then Patient_on_Home_Insulin := "Yes"; else Patient_on_Home_Insulin := "No"; endif;
+
+ /********************************* BEGIN DIET ORDER SEARCH********************************************/
+ NPO := read last { "select o.guid from cv3order o
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGUID
+ where clientvisitguid = " || SQL (clientvisitguid) || " and o.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Other{{{SINGLE-QUOTE}}}
+ and ocmi.Name = {{{SINGLE-QUOTE}}}NPO{{{SINGLE-QUOTE}}}"};
+
+ Diet := read last { "select o.guid from cv3order o
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGUID
+ where clientvisitguid = " || SQL (clientvisitguid) || " and o.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Other{{{SINGLE-QUOTE}}}
+ and ocmi.Name = {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}}"};
+ //Unsubmitted Active NPO order determined by local session variable
+ if (local_session.SessionUnsubNPOOrder = true) then
+ UnsubNPOOrderExists := true;
+ endif;
+
+ //Unsubmitted Active Diet order determined by local session variable
+ if (local_session.SessionUnsubDietOrder = true) then
+ UnsubDietOrderExists := true;
+ endif;
+
+
+ /***********************BEGIN IV STEROID SEARCH ********************************/
+
+ IvAddSteroid := read last { "select o.guid from cv3order o
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGUID
+ join CV3MedicationExtension me on me.guid = o.guid
+ left join CV3OrderComponent oc on oc.OrderGUID = o.guid
+ where clientvisitguid = " || SQL (clientvisitguid) || " and o.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
+ and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}hormones/hormone modifiers | adrenal cortical steroids{{{SINGLE-QUOTE}}}
+ and me.OrderRouteCode in ({{{SINGLE-QUOTE}}}IV{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IV Push{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IVPB{{{SINGLE-QUOTE}}})"};
+
+ IvSteroid := read last { " select o.guid from cv3order o
+ join CV3MedicationExtension me on me.guid = o.guid
+ left join CV3OrderComponent oc on oc.OrderGUID = o.guid
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = oc.OrderCatalogMasterItemGUID
+ where clientvisitguid = " || SQL (clientvisitguid) || " and o.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
+ and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}hormones/hormone modifiers | adrenal cortical steroids{{{SINGLE-QUOTE}}}
+ and me.OrderRouteCode in ({{{SINGLE-QUOTE}}}IV{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IV Push{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IVPB{{{SINGLE-QUOTE}}})"};
+
+ IvSteroidTask := read {" select TaskStatusCode from CV3OrderTaskOccurrence oto
+ join cv3order o on o.guid = oto.OrderGUID
+ join CV3OrderCatalogMasterItem ocmi on ocmi.GUID = o.OrderCatalogMasterItemGUID
+ join CV3MedicationExtension me on me.guid = o.guid
+ where clientvisitguid = " || SQL (clientvisitguid) || " and oto.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
+ and oto.TaskStatusCode <> ({{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}})
+ and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}hormones/hormone modifiers | adrenal cortical steroids{{{SINGLE-QUOTE}}}
+ and me.OrderRouteCode in ({{{SINGLE-QUOTE}}}IV{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IV Push{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}IVPB{{{SINGLE-QUOTE}}})"};
+
+ IvAddSteroidTask := read {" select TaskStatusCode from CV3OrderTaskOccurrence oto
+ join cv3order o on o.guid = oto.OrderGUID
+ join CV3MedicationExtension me on me.guid = o.guid
+ left join CV3OrderComponent oc on oc.OrderGUID = o.guid
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = oc.OrderCatalogMasterItemGUID
+ where clientvisitguid = " || SQL (clientvisitguid) || " and oto.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
+ and oto.TaskStatusCode <> ({{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}})
+ and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}hormones/hormone modifiers | adrenal cortical steroids{{{SINGLE-QUOTE}}}
+ and me.OrderRouteCode in ({{{SINGLE-QUOTE}}}IV{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IV Push{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}IVPB{{{SINGLE-QUOTE}}})"};
+
+ if (local_session.SessionUnsubIVSteroidOrder = true) then
+ UnsubSteroidOrderExists := true;
+ endif;
+
+ if exist IvSteroid then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ elseif exist IvSteroidTask then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ elseif exist IvAddSteroid then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ elseif exist IvAddSteroidTask then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ elseif
+ UnsubSteroidOrderExists = True then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ else
+ Patient_on_IV_Steroid := "No";
+ IvSteroid_CB.value := False;
+ IvSteroid_CB.Control_Read_only := True;
+ endif;
+
+ /**************************GFR LAB VALUE SEARCH ***********************************/
+
+ Race := read last
+ {" Select RaceCode from cv3client where RaceCode like {{{SINGLE-QUOTE}}}%African%{{{SINGLE-QUOTE}}} and Guid = " ||SQL (clientguid)};
+
+ If Race is not null then
+
+ GFR, GFRName, GFRUom, AbnCode := read last
+ {"Select top 1 bo.value, bo.itemname, bo.UnitofMeasure, bo.AbnormalityCode "
+ || " 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(clientguid)
+ || " and o.performeddtm >= (DATEADD(hour, -240, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}GFR (African American){{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ else
+
+ GFR, GFRName, GFRUom, AbnCode := read last
+ {"Select top 1 bo.value, bo.itemname, bo.UnitofMeasure, bo.AbnormalityCode "
+ || " 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(clientguid)
+ || " and o.performeddtm >= (DATEADD(hour, -240, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}GFR (Caucasian/Other){{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ endif;
+
+ If ABNCode = "L" and (GFR as number ) < 30 then
+ Low_GFR := "Yes";
+ GFR_CB.value := True;
+ GFR_CB.Control_Read_Only := True;
+ elseif GFR is Null then
+ No_GFR := "Yes";
+ GFR_CB.value := False;
+ GFR_CB.Control_Read_Only := True;
+ else
+ Low_GFR := "No";
+ GFR_CB.value := False;
+ GFR_CB.Control_Read_Only := True;
+ endif;
+
+
+
+ If Patient_is_Diabetic = "Yes" and Patient_on_Insulin_Pump = "Yes" then
+
+ Endo_ConsultList.IsSelected := (True, True);
+ Physician_ConsultList.IsSelected := (True);
+ ThisMsg := "Patient on an Insulin Pump." || CRLF
+ || "Place a STAT Endocrinology Consult.";
+ OrderInfo.value := ThisMsg;
+ InsulinPump_CB.value := True;
+ Diabetic_CB.value := True;
+ DietControlled_CB.value:= False;
+ MultipleOralOrInsulin_CB.value := False;
+ SingleOral_CB.value := False;
+ DietControlled_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+
+ ElseIf Patient_on_Insulin_Pump = "No" and Patient_on_Oral_Home_Agent = "No" and Patient_on_Home_Insulin = "No" then
+
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unable to retrieve any home insulin or home oral diabetic agents. \n\n Please select {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} to confirm that this patient does not take oral diabetic agents or insulin. ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult as string) = "Yes") then
+ Patient_is_Diet_Controlled := "Yes";
+ DietControlled_CB.value := True;
+ MultipleOralOrInsulin_CB.value := False;
+ MultipleOralOrInsulin_CB.Control_Read_Only := True;
+ SingleOral_CB.value := False;
+ SingleOral_CB.Control_Read_Only := True;
+ InsulinPump_CB.value := False;
+ InsulinPump_CB.Control_Read_Only := True;
+
+ if Diet is not null or UnsubDietOrderExists then
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ elseif NPO is not null or UnsubNPOOrderExists then
+ BGMFrequency.FrequencySummary := "Q6H";
+ else
+ dialogResult3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unable to retrieve any diet orders. \n Is this patient NPO? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogResult3 as string) = "Yes") then
+ BGMFrequency.FrequencySummary := "Q6H";
+ else
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ endif;
+ endif;
+ else
+ If this_communication.CatalogParentOrderSetGUID is not null then
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n You will need to re-open the Diabetic Management Protocol Order Set from the Review Screen before submitting orders to make any Parameter Selections." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+ Patient_is_Diet_Controlled := "No";
+ DietControlled_CB.value := False;
+ Override_CB.value := True;
+ GFR_CB.Control_Read_Only := False;
+ IvSteroid_CB.Control_Read_only := False;
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ InsulinPump_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+
+ endif;
+ endif;
+
+ if Patient_is_Diabetic = "Yes" and Patient_on_Insulin_Pump = "No" and (Patient_is_Diet_Controlled = "No" or Patient_is_Diet_Controlled is Null) then
+ If Patient_on_IV_Steroid = "No" and this_communication.CatalogParentOrderSetGUID is not null and (MultiOralAgent = "Yes" or Patient_on_Home_Insulin = "Yes") then
+ dialogResult6 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Will you be placing this patient on IV Steroids?" ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogResult6 as string) = "Yes") then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ else
+ Patient_on_IV_Steroid := "No";
+ endif;
+ endif;
+ // Get patient weight
+
+ if exists CurrWeight then
+ CurrWeight_val := CurrWeight.Value;
+ wt := CurrWeight_val.weight;
+ fmtwt := wt formatted with "%.1f";
+ else
+ wtgm := read last
+ { " Select Text from CV3PhysicalNoteDeclaration "
+ || " where ClientGUID = " || SQL(clientguid)
+ || " and ClientVisitGUID = " || SQL(clientvisitguid)
+ || " and TypeCode = {{{SINGLE-QUOTE}}}weight{{{SINGLE-QUOTE}}} "
+ || " order by Entered asc " };
+ wt := (wtgm as number) / 1000;
+ fmtwt := wt formatted with "%.1f";
+ endif;
+
+ If wt = 0 or wt is null then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please enter a patient weight to continue. ","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ CurrWeight.Control_Mandatory := True;
+
+ endif;
+
+ If Patient_on_Oral_Home_Agent = "Yes" and SingleOralAgent = "Yes" and MultiOralAgent = "No" and Patient_on_Home_Insulin = "No" then
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDose.Value := TDD_halfrnd;
+ BasalInsulinList.IsSelected := (True);
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ SingleOral_CB.value := True;
+ MultipleOralOrInsulin_CB.value := False;
+ InsulinPump_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+
+ If (TDD_calc as number) > 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (True);
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (True);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ InsulinLowDoseList.IsSelected := (True);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ ThisMsg := "Patient on single oral agent at home." || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD|| " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ elseif ((Patient_on_Oral_Home_Agent = "Yes" and SingleOralAgent = "No" and MultiOralAgent = "Yes") or Patient_on_Home_Insulin = "Yes") and Patient_on_IV_Steroid = "Yes" then
+
+ TDD_calc := (wt as number) * 0.5;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDose.Value := TDD_halfrnd;
+ InsulinModDoseList.IsSelected := (True);
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (False);
+ BasalInsulinList.IsSelected := (True);
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ SingleOral_CB.value := False;
+ MultipleOralOrInsulin_CB.value := True;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+
+ Slidescale := "Use Moderate Dose Correctional Sliding Scale";
+
+ ThisMsg := "Patient on IV Steroids." || CRLF
+ || "Total Daily Dose = 0.5 units/kg || (" || fmtwt || " kg * 0.5 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ elseif ((Patient_on_Oral_Home_Agent = "Yes" and SingleOralAgent = "No" and MultiOralAgent = "Yes") or Patient_on_Home_Insulin = "Yes") and Patient_on_IV_Steroid = "No" and Low_GFR = "Yes" then
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDose.Value := TDD_halfrnd;
+ BasalInsulinList.IsSelected := (True);
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ GFR_CB.value := True;
+ GFR_CB.Control_Read_Only := True;
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ SingleOral_CB.value := False;
+ MultipleOralOrInsulin_CB.value := True;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+
+
+ If (TDD_calc as number) > 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (True);
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (True);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ InsulinLowDoseList.IsSelected := (True);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+
+ ThisMsg := GFRName ||" " || GFR || " " || GFRUom || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD|| " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ elseif ((Patient_on_Oral_Home_Agent = "Yes" and SingleOralAgent = "No" and MultiOralAgent = "Yes") or Patient_on_Home_Insulin = "Yes") and Patient_on_IV_Steroid = "No" and Low_GFR = "No" then
+ TDD_calc := (wt as number) * 0.4;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDose.Value := TDD_halfrnd;
+ BasalInsulinList.IsSelected := (True);
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ GFR_CB.value := False ;
+ SingleOral_CB.value := False;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.value := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+ DietControlled_CB.value := False;
+ DietControlled_CB.control_read_only := True;
+
+ If Patient_on_Home_Insulin = "No" then
+ InsulinPump_CB.Control_Read_Only := True;
+ else
+ InsulinPump_CB.Control_Read_Only := False;
+ endif;
+
+
+ If (TDD_calc as number) > 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (True);
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (True);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ InsulinLowDoseList.IsSelected := (True);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+ ThisMsg := GFRName ||" " || GFR || " " || GFRUom || CRLF
+ || "Total Daily Dose = 0.4 units/kg || (" || fmtwt || " kg * 0.4 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ elseif ((Patient_on_Oral_Home_Agent = "Yes" and SingleOralAgent = "No" and MultiOralAgent = "Yes") or Patient_on_Home_Insulin = "Yes") and Patient_on_IV_Steroid = "No" and No_GFR = "Yes" then
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDose.Value := TDD_halfrnd;
+ BasalInsulinList.IsSelected := (True);
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ GFR_CB.value := False ;
+ SingleOral_CB.value := False;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.value := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+ DietControlled_CB.value := False;
+ DietControlled_CB.control_read_only := True;
+ If Patient_on_Home_Insulin = "No" then
+ InsulinPump_CB.Control_Read_Only := True;
+ else
+ InsulinPump_CB.Control_Read_Only := False;
+ endif;
+
+ If (TDD_calc as number) > 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (True);
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (True);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ InsulinLowDoseList.IsSelected := (True);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ ThisMsg := " No GFR Value Found" || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+ else
+ ThisMsg := " " ;
+ OrderInfo.value := ThisMsg;
+ endif;
+ endif;
+ endif;
+
+ If callingEvent = "FieldChange" or callingEvent = "FormClose" then
+
+ If callingEvent = "FormClose" and (MultipleOralOrInsulin_CB.value = True or SingleOral_CB.value = True) and (wt = 0 or wt is null) then
+
+ this_communication.DisplayForm := "yes";
+ this_communication.Message := "\n You must enter a patient weight to continue. ";
+ this_communication.MessageType := "Error";
+ endif;
+
+ If CallingField = "PRX_Generic_CB|1" and Override_CB.Value = True then
+ InsulinPump_CB.Control_Read_Only := False;
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+ GFR_CB.Control_Read_Only := False;
+ IvSteroid_CB.Control_Read_only := False;
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ BasalInsulinList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ endif;
+ If CallingField = "PRX_DM_PatientOnInsulinPump|1" then
+ If InsulinPump_CB.value = False then
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+ Elseif InsulinPump_CB.value = True then
+
+ Endo_ConsultList.IsSelected := (True, True);
+ Physician_ConsultList.IsSelected := (True);
+ BasalInsulinList.IsSelected := (False);
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ ThisMsg := "Patient on an Insulin Pump." || CRLF
+ || "Place a STAT Endocrinology Consult.";
+ OrderInfo.value := ThisMsg;
+ Diabetic_CB.value := True;
+ DietControlled_CB.value:= False;
+ MultipleOralOrInsulin_CB.value := False;
+ SingleOral_CB.value := False;
+ DietControlled_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ endif;
+ endif;
+
+ If (CallingField = "PRX_DM_SingleOralHomeMed|1" and (SingleOral_CB.value = True or SingleOral_CB.value = False))or (CallingField = "CombinedMeasurements|1" and SingleOral_CB.value = true) then
+ If SingleOral_CB.value = False then
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+ InsulinPump_CB.control_read_only := False;
+ Elseif SingleOral_CB.value = True then
+
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDose.Value := TDD_halfrnd;
+ BasalInsulinList.IsSelected := (True);
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ MultipleOralOrInsulin_CB.value := False;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+
+ If (TDD_calc as number) > 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (True);
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (True);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ InsulinLowDoseList.IsSelected := (True);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ ThisMsg := "Patient on single oral agent at home." || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD|| " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+ endif;
+ endif;
+
+ If (CallingField = "PRX_DM_MultipleOralOrInsulin|1" or CallingField = "PRX_DM_PtOnIvSteroids|1" or CallingField = "PRX_DM_GFR_LT_30|1")
+ or (CallingField = "CombinedMeasurements|1" and MultipleOralOrInsulin_CB.value = true) then
+
+ If MultipleOralOrInsulin_CB.value = False then
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+ InsulinPump_CB.control_read_only := False;
+
+ ElseIf MultipleOralOrInsulin_CB.value = True then
+ If IvSteroid_CB.value = True then
+
+ TDD_calc := (wt as number) * 0.5;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDose.Value := TDD_halfrnd;
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (True);
+ InsulinHighDoseList.IsSelected := (False);
+ BasalInsulinList.IsSelected := (True);
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ SingleOral_CB.value := False;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+
+ Slidescale := "Use Moderate Dose Correctional Sliding Scale";
+
+ ThisMsg := "Patient on IV Steroids." || CRLF
+ || "Total Daily Dose = 0.5 units/kg || (" || fmtwt || " kg * 0.5 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ ElseIf GFR_CB.value = True and IvSteroid_CB.value = False then
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDose.Value := TDD_halfrnd;
+ BasalInsulinList.IsSelected := (True);
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ SingleOral_CB.value := False;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+
+ If (TDD_calc as number) > 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (True);
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (True);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ InsulinLowDoseList.IsSelected := (True);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ ThisMsg := "This patient has a GFR < 30ml/min" || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD|| " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ ElseIf GFR_CB.value = False and IvSteroid_CB.value = False then
+ TDD_calc := (wt as number) * 0.4;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDose.Value := TDD_halfrnd;
+ BasalInsulinList.IsSelected := (True);
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ SingleOral_CB.value := False;
+ SingleOral_CB.control_read_only := True;
+ DietControlled_CB.value := False;
+ DietControlled_CB.control_read_only := True;
+
+ If (TDD_calc as number) > 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (True);
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (True);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ InsulinLowDoseList.IsSelected := (True);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (False);
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ If GFRName is not null then
+ ThisMsg := GFRName ||" " || GFR || " " || GFRUom || CRLF
+ || "Total Daily Dose = 0.4 units/kg || (" || fmtwt || " kg * 0.4 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ Else
+ ThisMsg := " " || CRLF
+ || "Total Daily Dose = 0.4 units/kg || (" || fmtwt || " kg * 0.4 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ Endif;
+ OrderInfo.value := ThisMsg;
+ endif;
+
+ endif;
+
+ endif;
+
+ If CallingField = "PRX_DM_PatientDietControlled|1" then
+
+ If DietControlled_CB.value = False then
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+ InsulinPump_CB.control_read_only := False;
+ ElseIf DietControlled_CB.value = True then
+
+ BasalInsulinList.IsSelected := (False);
+ Endo_ConsultList.IsSelected := (False, True);
+ Physician_ConsultList.IsSelected := (False);
+ InsulinLowDoseList.IsSelected := (False);
+ InsulinModDoseList.IsSelected := (False);
+ InsulinHighDoseList.IsSelected := (False);
+ MultipleOralOrInsulin_CB.value := False;
+ MultipleOralOrInsulin_CB.Control_Read_Only := True;
+ SingleOral_CB.value := False;
+ SingleOral_CB.Control_Read_Only := True;
+ InsulinPump_CB.value := False;
+ InsulinPump_CB.Control_Read_Only := True;
+ ThisMsg := " " || CRLF;
+ OrderInfo.value := ThisMsg;
+ if Diet is not null or UnsubDietOrderExists then
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ elseif NPO is not null or UnsubNPOOrderExists then
+ BGMFrequency.FrequencySummary := "Q6H";
+ else
+ dialogResult3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unable to retrieve any diet orders. \n Is this patient NPO? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogResult3 as string) = "Yes") then
+ BGMFrequency.FrequencySummary := "Q6H";
+ else
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ endif;
+ endif;
+ endif;
+ endif;
+
+ endif;
+
+
+ If callingEvent = "FormClose" and (CurrentLoc = "ER Major" or CurrentLoc matches pattern "ER-%" )then
+ GlucoseName, GlucoseValue, GlucoseUom, GlucoseDone, GlucoseAbn := read last
+ {"Select top 1 bo.ItemName, bo.value , bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode
+ 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(clientguid) || "
+ and o.performeddtm >= (DATEADD(hour, -12, getdate()))
+ and bo.itemname in ({{{SINGLE-QUOTE}}}Glucose Non-Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Bedside{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Bedside.{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Fasting from Blood Gas{{{SINGLE-QUOTE}}}
+ ,{{{SINGLE-QUOTE}}}Glucose from Blood Gas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose, ABG, POC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose, VBG, POC{{{SINGLE-QUOTE}}})
+ and bo.AbnormalityCode in ({{{SINGLE-QUOTE}}}H{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}HH{{{SINGLE-QUOTE}}})
+ and bo.value > {{{SINGLE-QUOTE}}}300{{{SINGLE-QUOTE}}}
+ order by o.performeddtm desc "
+ };
+
+
+ If GlucoseValue is not null then
+ DiabeticMedTask, DiabeticMedName, MedGiven, DoseGiven, UomGiven, OrderDate := read last
+ {" select oto.TaskStatusCode, ocmi.Name, oto.PerformedFromDtm, oto.TaskDose, oto.TaskUom, o.RequestedDtm from CV3OrderTaskOccurrence oto
+ join cv3order o on o.guid = oto.OrderGUID
+ join CV3MedicationExtension me on me.guid = o.guid
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGUID
+ where clientvisitguid = " || SQL(ClientVisitGuid) || " and oto.clientguid = " || SQL(ClientGuid) || "
+ and o.typecode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
+ and oto.TaskStatusCode not in ({{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Not Performed{{{SINGLE-QUOTE}}})
+ and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}metabolic agents | antidiabetic agents{{{SINGLE-QUOTE}}}
+ and oto.ScheduledDtm > DATEadd (HH, -12, getdate())
+ order by oto.TaskStatusCode "
+ };
+
+ If DiabeticMedTask is not null then
+ If DiabeticMedTask = "Performed" then
+ InfoMsg := "Patient received " || DiabeticMedName || " " || DoseGiven || " " || UOMGiven || " at " || MedGiven;
+ else
+ InfoMsg := "Patient has been ordered " || DiabeticMedName || " at " || OrderDate;
+ endif;
+ else
+ InfoMsg := " ";
+ endif;
+
+ Create_STAT_Order := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_MED_ORDER{{{SINGLE-QUOTE}}};
+ SessionType := "Standard";
+ OrderSource := "Protocol Order";
+ OrderFrequency := "STAT";
+ numgrids := 3;
+ k := 1;
+ grid_count := 1 seqto numgrids;
+
+ for k in grid_count do
+
+ Currentgrid := last of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = k);
+ gridval := currentgrid.value;
+ index_list := 1 seqto (count gridval) ;
+ if exist currentgrid then
+ for M in index_list do
+ selorders := gridval.IsSelected [M];
+ if selorders = true then
+ main_order_name := Gridval.Name [M] ;
+
+ If main_order_name = "Insulin Aspart Inj" then
+ OrderName := main_order_name;
+ If k = 1 then ItemModifier := "Low Dose - ED Coverage";
+ elseif k = 2 then ItemModifier := "Moderate Dose - ED Coverage";
+ elseif k = 3 then ItemModifier := "High Dose - ED Coverage";
+ endif;
+ dialogResult4 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Patient has a " ||GlucoseName || " of " || GlucoseValue || " " || GlucoseUom || " on " ||GlucoseDone ||
+ "\n\n " || infomsg ||
+ "\n Do you wish to order a dose to be administered now? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogResult4 as string) = "Yes") then
+
+ Coverage := Call Create_STAT_Order with (ClientVisitGuid,UserGuid,ClientGUID,SessionType,OrderSource,OrderName,ItemModifier,"Medication",this_communication.CareProviderGUID) ;
+
+ endif;
+ endif;
+ endif;
+
+ enddo;
+ endif;
+ enddo;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_DIABETIC_MGT_CHECK.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_DIABETIC_MGT_CHECK.mlm
new file mode 100644
index 0000000..2f75fb5
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_DIABETIC_MGT_CHECK.mlm
@@ -0,0 +1,225 @@
+maintenance:
+
+ title: FORM_SET_Diabetic_Mgt_Check;;
+ mlmname: FORM_SET_Diabetic_Mgt_Check;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: St Clair Hospital;;
+ date: 2017-11-02;;
+ validation: testing;;
+library:
+ purpose:
+ ;;
+ explanation:
+ Change history
+ 11.13.2017 TMS CSR 35723: Created to alert user when patient is a diabetic and the diabetic management protocol has not
+ been selected from the reference order sets in the transition order sets.
+ 01.17.2017 TMS CSR 35723: Updated grid count from 6 to 99. Was not selecting protocol from alert if protocol in grid occurrence
+ greater than 6. Changed from 99 to 6 during testing with break to eliminate looping with break message 99 times.
+ ;;
+ keywords: Insulin, weight based, diabetic, referenced order set
+ ;;
+ citations:
+ ;;
+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";
+ //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;
+
+ comm_obj := this_communication.primaryobj;
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+
+
+ DiabeticProtocolOrdersEntered := "No";
+ HealthIssue := read last {" select distinct hi.ShortName
+ from cv3healthissuedeclaration hi with (nolock)
+ inner join cv3codedhealthissue chi with (nolock) on hi.CodedHealthIssueGUID = chi.guid and chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})
+ where Clientguid = " || SQL (clientguid)
+ || " and hi.active = 1
+ and Status in ({{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chronic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Retired Code{{{SINGLE-QUOTE}}})
+ and (((ICD10Code like {{{SINGLE-QUOTE}}}E10%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}}))
+ or ((ICD9Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
+ or ((ICD9Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
+ or ((chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})) and ((chi.Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}}))
+ or ((chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}}) and ((chi.Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}})))"};
+
+ if exist HealthIssue then
+ Patient_is_Diabetic := "Yes";
+ else Patient_is_Diabetic := "No";
+ endif;
+
+ If Patient_is_Diabetic = "No" then
+ DiabeticHomeMed := read last { "select distinct cp.DrugName
+ from SXAAMBClientPrescription cp
+ inner join SXAMTDrugNameMapVW dnm on dnm.drug_synonym_id = cp.FormularyBrandKey
+ join SXAMTCategoryDrugXREFVW cdx on cdx.drug_id = dnm.drug_id
+ join SXAMTDrugCategoriesVW cat on cat.multum_category_id = cdx.multum_category_id
+ where cp.ClientGUID = " || SQL(ClientGuid) || " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ and cat.category_name in ({{{SINGLE-QUOTE}}}insulin{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}dipeptidyl peptidase 4 inhibitors{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}antidiabetic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}sulfonylureas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}biguanides{{{SINGLE-QUOTE}}})
+ and cp.EndDate is null "};
+ if exist DiabeticHomeMed then
+ Patient_on_Home_Med := "Yes";
+ else Patient_on_Home_Med := "No";
+ endif;
+ endif;
+
+
+
+ GlucoseName, GlucoseValue, GlucoseUom, GlucoseDone, GlucoseAbn := read last
+ {"Select top 1 bo.ItemName, bo.value , bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode
+ 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(clientguid) || "
+ and o.performeddtm >= (DATEADD(hour, -12, getdate()))
+ and bo.itemname in ({{{SINGLE-QUOTE}}}Glucose Non-Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Bedside{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Bedside.{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Fasting from Blood Gas{{{SINGLE-QUOTE}}}
+ ,{{{SINGLE-QUOTE}}}Glucose from Blood Gas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose, ABG, POC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose, VBG, POC{{{SINGLE-QUOTE}}})
+ and bo.AbnormalityCode in ({{{SINGLE-QUOTE}}}H{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}HH{{{SINGLE-QUOTE}}})
+ and bo.value > {{{SINGLE-QUOTE}}}300{{{SINGLE-QUOTE}}}
+ order by o.performeddtm desc "
+ };
+
+
+ If Patient_is_Diabetic = "Yes" or Patient_on_Home_Med = "Yes" or GlucoseValue is not null then
+
+ If CallingEvent = "FormClose" then //and this_communication.ParentOrderSetGUID is null then
+ Selected_Order_Box.value := "None";
+
+ checkorders := "";
+ Cat_Guid_List :=();
+ Cat_Name_List := ();
+ Evoke_Guid_List := ();
+ numgrids := 99;
+ r := 1;
+ grid_count := 1 seqto numgrids;
+
+
+ for r in grid_count do
+ Currentgrid := last of (field_list where field_list.DataItemName = "MultiOrderReferencedSet"
+ and field_List.Control_MultiFieldOccNum = r);
+ gridval := currentgrid.value;
+ allvalues := ();
+ index_list := 1 seqto (count gridval) ;
+ if exist currentgrid then
+ for S in index_list do
+ selorders1 := gridval.IsSelected [S];
+ if selorders1 = true then
+
+ main_order_name1 := Gridval.Name [S] ;
+ main_item_catalog_guid1 := Gridval.OrderCatalogMasterItemGUID [S];
+ If main_order_name1 = "Diabetic Management Protocol" then
+ DiabeticProtocolOrdersEntered := "Yes";
+ endif;
+
+
+ endif;
+ enddo;
+ endif;
+ enddo;
+ endif;
+
+ If DiabeticProtocolOrdersEntered = "No" then
+
+ If GlucoseValue is not null then
+ If Patient_is_Diabetic = "No" and Patient_on_Home_Insulin = "No" then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Patient has a " || GlucoseName || " of " || GlucoseValue || " "|| GlucoseUom || " with no Diabetic Health Issues or Diabetic Home Medications documented. \n \n You have not entered any orders from the Diabetic Management Protocol. \n Do you wish to select this order set? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ else
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Patient is a Diabetic with a " || GlucoseName || " of " || GlucoseValue || " "|| GlucoseUom || " \n\n You have not entered any orders from the Diabetic Management Protocol. \n Do you wish to select this order set? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+ else
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n You have not entered any orders from the Diabetic Management Protocol. \n\n Do you wish to select this order set? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+ if((dialogResult as string) = "Yes") then
+
+ rCat_Guid_List :=();
+ rCat_Name_List := ();
+ rEvoke_Guid_List := ();
+ numgrids := 99;
+ k := 1;
+ rgrid_count := 1 seqto numgrids;
+
+ for k in rgrid_count do
+ thisgridvalue := ();
+ rCurrentgrid := last of (field_list where field_list.DataItemName = "MultiOrderReferencedSet"
+ and field_List.Control_MultiFieldOccNum = k);
+ rgridval := rcurrentgrid.value;
+ rallvalues := ();
+ index_list := 1 seqto (count rgridval) ;
+ if exist rcurrentgrid then
+ for M in index_list do
+
+ rselorders1 := gridval.IsSelected [M];
+ if rgridval.IsSelected [M] = true then
+ thisgridvalue := thisgridvalue, true;
+ else
+
+ rmain_order_name1 := rGridval.Name [M] ;
+ rmain_item_catalog_guid1 := rGridval.OrderCatalogMasterItemGUID [M];
+
+ If rmain_order_name1 = "Diabetic Management Protocol" then
+ rcurrentgrid.IsSelected := true;
+ rgridval.IsSelected [M] := true;
+ thisgridvalue := thisgridvalue, true;
+ else
+ thisgridvalue := thisgridvalue, false;
+
+ endif;
+ endif;
+
+ enddo;
+ endif;
+
+ rgridval.IsSelected := thisgridvalue;
+
+ enddo;
+ endif;
+ endif;
+ endif;
+;;
+ priority: 50
+ ;;
+ 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;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_DISCHARGE_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_DISCHARGE_ORDERS.mlm
new file mode 100644
index 0000000..644267b
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_DISCHARGE_ORDERS.mlm
@@ -0,0 +1,155 @@
+maintenance:
+
+ title: Set Discharge Orders;;
+ mlmname: FORM_Set_Discharge_Orders;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair ;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Peggy Karish, Eclipsys Corp Ext 7441;;
+ date: 2010-05-11;;
+ validation: testing;;
+
+library:
+ purpose: Used for Discharge Order Set
+ ;;
+
+ explanation: This MLM will deselect and protect Admit to Dr, Vital Signs, Rehab, and Isolation orders when a patient is discharged to home.
+
+ Change history
+
+ 07.31.2015 DW HD# 1820549 - During 15.1 release testing we found that the form configuration change broke the MLM. Vital signs orders were not being protected.
+ ;;
+ keywords: Called MLMs, Order Set, Discharge Order Set
+ ;;
+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*******************/
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ Grid_Discharge := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 46);
+ Grid_Discharge_List :=Grid_Discharge.value ;
+
+ Grid_Code_Status:= last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 24);
+ Grid_Code_Status_List :=Grid_Code_Status.value ;
+
+
+ Grid_Isolation:= last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 20);
+ Grid_Isolation_List:=Grid_Isolation.value ;
+
+ Grid_AdmitTo:= last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 61);
+ Grid_AdmitTo_List:=Grid_AdmitTo.value ;
+
+ Grid_Vitals:= last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 42);
+ Grid_Vitals_List:=Grid_Vitals.value ;
+
+ Grid_Rehab:= last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 28);
+ Grid_Rehab_List:=Grid_Rehab.value ;
+
+ Grid_Activity := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 6);
+ Grid_Activity_List := Grid_Activity.Value;
+
+ Grid_Diet := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 29);
+ Grid_Diet_List := Grid_Diet.Value;
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := false;
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+
+ if CallingEvent = "FieldChange" then
+ If (CallingField = "MultiOrderGrid|46")then
+
+ if true in Grid_Discharge_List.IsSelected// need to read only others in this grid
+ then
+ newreadonly:=();
+ firstisselected := false;
+ for changepermod in (1 seqto (count Grid_Discharge_List.IsSelected )) do
+ if Grid_Discharge_List.IsSelected[changepermod] = true
+ then
+ if changepermod = 1 then firstisselected := true; endif;
+ newreadonly:= newreadonly,false;
+ else
+ newreadonly:= newreadonly,true;
+ endif;
+ enddo;
+
+ Grid_Discharge_List.IsReadOnly:= newreadonly;
+
+ if firstisselected = true then
+ Grid_Code_Status_List.IsSelected := false,false,false;
+ Grid_Code_Status_List.IsReadOnly := true, true, true;
+ //Grid_Code_Status_List.IsSelected := false,false,false,false,false,false,false;
+ //Grid_Code_Status_List.IsReadOnly := true, true, true, true, true, true, true;
+ Grid_Isolation_List.IsSelected := false;
+ Grid_Isolation_List.IsReadOnly := true;
+ Grid_AdmitTo_List.IsSelected := false;
+ Grid_AdmitTo_List.IsReadOnly := true;
+ Grid_Vitals_List.IsSelected := false,false,false,false,false,false;
+ Grid_Vitals_List.IsReadOnly := true, true, true, true, true, true;
+ Grid_Rehab_List.IsSelected := false,false,false;
+ Grid_Rehab_List.IsReadOnly := true, true, true;
+ endif;
+ else
+ Grid_Discharge_List.IsReadOnly:= false,false,false,false;
+ Grid_Code_Status_List.IsReadOnly := false,false,false;
+ //Grid_Code_Status_List.IsReadOnly :=false,false,false,false,false,false,false;
+ Grid_Isolation_List.IsReadOnly := false;
+ Grid_AdmitTo_List.IsReadOnly := false;
+ Grid_Vitals_List.IsReadOnly := false,false,false,false,false;
+ Grid_Rehab_List.IsReadOnly :=false,false,false;
+ endif;
+
+
+ endif; // calling field
+
+
+ endif; // calling event
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_DISCHARGE_ORDERS_HOME.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_DISCHARGE_ORDERS_HOME.mlm
new file mode 100644
index 0000000..927286b
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_DISCHARGE_ORDERS_HOME.mlm
@@ -0,0 +1,135 @@
+maintenance:
+
+ title: FORM_SET_DISCHARGE_ORDERS_HOME;;
+ mlmname: FORM_SET_DISCHARGE_ORDERS_HOME;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair ;;
+ author: Juliet M. Law, Allscripts Ext x7461;;
+ specialist: Dean Miklavic, Allscripts Ext x7466;;
+ date: 2013-05-24;;
+ validation: testing;;
+
+library:
+ purpose: Used for Discharge-Home Order Set
+ ;;
+
+ explanation: Used for Discharge-Home Order Set
+
+ Change History
+ 02.25.2014 JML CSR 31744: Added mapped Discharge Diagnosis field to order set; added logic
+ to make field NOT MANDATORY for emergency patients
+ ;;
+ keywords: Called MLMs, Order Set, Discharge-Home Order Set
+ ;;
+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
+ value ) := argument;
+
+ callForm := mlm {{{SINGLE-QUOTE}}}FORM_OBSERVATION_ADT{{{SINGLE-QUOTE}}};
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := false;
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Local session object
+ local_session := cds_session.local;
+
+ //Retrieve necessary fields
+ Labs_list := last of (field_list WHERE field_list.DataItemName = "NUR_NurInstructionFreeText"
+ AND field_list.Control_MultiFieldOccNum = 3);
+
+ Labs_Check := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ AND field_list.Control_MultiFieldOccNum = 2);
+ Labs_Check_Value := Labs_Check.Value;
+
+ Submit_Btn := last of (field_list WHERE field_list.DataItemName = "CPOE Repeat Lab Submit Button"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ //**** CSR 31744 Change
+ Discharge_grid := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 46);
+ Discharge_field := Discharge_grid.Value;
+
+ Discharge_Diagnosis := last of (field_list WHERE field_list.DataItemName = "DISC_Discharge Diagnosis"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ linebreakme:= read last
+ {" SELECT "
+ || " {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} +char(13) + char(10) "
+ };
+
+
+ //**** CSR 31744 Change Begin ****
+ visitType := read last {"SELECT cv.TypeCode"
+ || " FROM CV3Client c WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
+ || " ON c.GUID = cv.ClientGUID"
+ || " WHERE c.GUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)};
+
+
+ if ( ( visitType = "Emergency" ) OR ( visitType = "Clinc" ) ) then
+ Discharge_Diagnosis.Control_Mandatory := false;
+ Discharge_Diagnosis.Value := " ";
+ endif;
+ //**** CSR 31744 Change End ****
+
+ if ((CallingEvent = "ButtonClick") AND (CallingField = "CPOE Repeat Lab Submit Button|1")) then
+
+ a := local_session.SessionDischargeLabOrders;
+ if ((a <> "") AND (a is not null)) then
+ Labs_list.Value := a;
+ endif;
+
+ aa := local_session.SessionDischargeMIOrders;
+ if ((aa <> "") AND (aa is not null)) then
+ if ((Labs_list.Value is not null) AND (Labs_list.Value <> "")) then
+ Labs_list.Value := Labs_list.Value || linebreakme || aa;
+ else
+ Labs_list.Value := aa;
+ endif;
+ endif;
+
+ elseif (CallingEvent = "FormClose") then
+ local_session.SessionDischargeLabOrders := "";
+ local_session.SessionDischargeMIOrders := "";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_DVT_ANTICOAGULANT_ORTHO_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_DVT_ANTICOAGULANT_ORTHO_ORDERS.mlm
new file mode 100644
index 0000000..eea43fc
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_DVT_ANTICOAGULANT_ORTHO_ORDERS.mlm
@@ -0,0 +1,381 @@
+maintenance:
+
+ title: FORM_SET_DVT_ANTICOAGULANT_ORTHO_ORDERS;;
+ mlmname: FORM_SET_DVT_ANTICOAGULANT_ORTHO_ORDERS;;
+ arden: version 2.50;;
+ version: 16.3;;
+ institution: St Clair Admissions;;
+ author: Juliet M. Law, Allscripts Ext 7461;;
+ specialist: Peggy Leschak, Allscripts Ext 7441;;
+ date: 2018-11-20;;
+ validation: testing;;
+
+library:
+ purpose: Used on DVT Anticoagulant - Ortho Procedures order set that is found on most Ortho Post OP order sets
+ ;;
+
+ explanation: Used on DVT Anticoagulant - Ortho Procedures order set that is found on most Ortho Post OP order sets
+
+ Change history
+
+ 11.20.2018 JML CSR #37344 / 37345 / 37346: Created
+
+ ;;
+ keywords: Called MLMs, DVT, Ortho
+ ;;
+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*******************/
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ PrimaryObj := this_communication.PrimaryObj;
+ OrderSetName := PrimaryObj.OrderSetName;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ //Include MLMs
+ lovenox_inj := MLM {{{SINGLE-QUOTE}}}FORM_Set_Lovenox_Orders_Inj{{{SINGLE-QUOTE}}};
+ anticoagulant_conflict := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{SINGLE-QUOTE}}};
+
+ //field list
+ Aspirin_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 8 );
+ Aspirin_Values := Aspirin_Grid.Value;
+
+ Enox_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 1 );
+ Enox_Values := Enox_Grid.Value;
+ Enox_Edu_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 5 );
+ Enox_Edu_Value := Enox_Edu_Grid.Value;
+ Xarelto_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 6 );
+ Xarelto_Values := Xarelto_Grid.Value;
+ Eliquis_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 7 );
+ Eliquis_Values := Eliquis_Grid.Value;
+
+ Baseline_Labs := first of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox" AND field_list.Control_MultiFieldOccNum = 1 );
+ Baseline_Lab_Values := Baseline_Labs.Value;
+ Baseline_CBC := first of ( Baseline_Lab_Values WHERE Baseline_Lab_Values.Name = "CBC No Diff (Hemogram Only)" );
+ Baseline_Creatinine := first of ( Baseline_Lab_Values WHERE Baseline_Lab_Values.Name = "Creatinine" );
+
+
+ if ( CallingEvent = "FieldChange" ) then
+
+ //Lovenox Grid
+ if ( CallingField = "MultiOrderGrid|1" ) then
+
+ if ( true IN Enox_Values.IsSelected ) then
+
+ Enox_Selected := first of ( Enox_Values WHERE Enox_Values.IsSelected = true );
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Enox_Selected.Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Enox_Selected.IsSelected := false;
+ Enox_Edu_Value.IsSelected := false;
+
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+
+ Enox_Selected.IsSelected := false;
+ Enox_Edu_Value.IsSelected := false;
+
+ else
+
+ for i IN 1 seqto ( count Enox_Values ) do
+ if ( Enox_Values[i].IsSelected = false ) then
+ Enox_Values[i].IsReadOnly := true;
+ else
+ Enox_Values[i].IsReadOnly := false;
+ endif;
+ enddo;
+ Enox_Edu_Value.IsSelected := true;
+
+ endif;
+ endif;
+ else
+
+ ( this_communication, this_form ) := call lovenox_inj WITH this_communication, this_form, client_info_obj;
+
+ for i IN 1 seqto ( count Enox_Values ) do
+ if ( Enox_Values[i].IsSelected = false ) then
+ Enox_Values[i].IsReadOnly := true;
+ else
+ Enox_Values[i].IsReadOnly := false;
+ endif;
+ enddo;
+ Enox_Edu_Value.IsSelected := true;
+
+ endif;
+ else
+ ( this_communication, this_form ) := call lovenox_inj WITH this_communication, this_form, client_info_obj;
+ Enox_Edu_Value.IsSelected := false;
+ endif;
+ endif; // End CallingField = Lovenox Grid
+
+ //Xarelto Grid
+ if ( CallingField = "MultiOrderGrid|6" ) then
+ if ( true IN Xarelto_Values.IsSelected ) then
+
+ Xarelto_Selected := first of ( Xarelto_Values WHERE Xarelto_Values.IsSelected = true );
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Xarelto_Selected.Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Xarelto_Selected.IsSelected := false;
+
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+ Xarelto_Selected.IsSelected := false;
+ endif;
+ endif;
+ endif;
+ endif;
+ endif; // End CallingField = Xarelto Grid
+
+ //Eliquis Grid
+ if ( CallingField = "MultiOrderGrid|7" ) then
+
+ if ( true IN Eliquis_Values.IsSelected ) then
+
+ Eliquis_Selected := first of ( Eliquis_Values WHERE Eliquis_Values.IsSelected = true );
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Eliquis_Selected.Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Eliquis_Selected.IsSelected := false;
+
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+ Eliquis_Selected.IsSelected := false;
+ endif;
+ endif;
+ endif;
+ endif;
+ endif; //End CallingField = Eliquis Grid
+
+ //Aspirin Grid
+ if ( CallingField = "MultiOrderGrid|8" ) then
+
+ Combo_Aspirin := ( Aspirin_Values.IsSelected[3], Aspirin_Values.IsSelected[4] );
+
+ ComboAspirinTrueCount := count ( Combo_Aspirin WHERE Combo_Aspirin = true );
+
+ NewReadOnly := ();
+ NewSelected := ();
+
+ for m IN 1 seqto ( count Aspirin_Values.IsSelected ) do
+
+ if ( ComboAspirinTrueCount = 1 AND Aspirin_Values[1].IsReadOnly = false ) then
+ if ( m >=1 AND m < 3 ) then
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ else
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ endif;
+
+ elseif ( ComboAspirinTrueCount = 1 AND Aspirin_Values[1].IsReadOnly = true ) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, false;
+
+ elseif ( ComboAspirinTrueCount = 0 ) then
+ if ( Aspirin_Values[1].IsSelected = true AND m = 1 ) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ elseif ( Aspirin_Values[2].IsSelected = true AND m = 2 ) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ endif;
+ else
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, false;
+ endif;
+ enddo;
+
+ Aspirin_Values.IsSelected := NewSelected;
+ Aspirin_Values.IsReadOnly := NewReadOnly;
+
+ endif; //End CallingField = Aspirin Grid
+
+
+ if ( true IN Enox_Values.IsSelected ) then
+
+ for i IN 1 seqto ( count Xarelto_Values ) do
+ Xarelto_Values[i].IsReadOnly := true;
+ enddo;
+
+ for j IN 1 seqto ( count Eliquis_Values ) do
+ Eliquis_Values[j].IsReadOnly := true;
+ enddo;
+
+ for k IN 1 seqto ( count Aspirin_Values ) do
+ Aspirin_Values[k].IsReadOnly := true;
+ enddo;
+
+ elseif ( true IN Xarelto_Values.IsSelected ) then
+
+ for i IN 1 seqto ( count Enox_Values ) do
+ Enox_Values[i].IsReadOnly := true;
+ enddo;
+
+ for j IN 1 seqto ( count Eliquis_Values ) do
+ Eliquis_Values[j].IsReadOnly := true;
+ enddo;
+
+ for k IN 1 seqto ( count Aspirin_Values ) do
+ Aspirin_Values[k].IsReadOnly := true;
+ enddo;
+
+ elseif ( true IN Eliquis_Values.IsSelected ) then
+
+ for i IN 1 seqto ( count Enox_Values ) do
+ Enox_Values[i].IsReadOnly := true;
+ enddo;
+
+ for j IN 1 seqto ( count Xarelto_Values ) do
+ Xarelto_Values[j].IsReadOnly := true;
+ enddo;
+
+ for k IN 1 seqto ( count Aspirin_Values ) do
+ Aspirin_Values[k].IsReadOnly := true;
+ enddo;
+
+ elseif ( true IN Aspirin_Values.IsSelected ) then
+
+ for i IN 1 seqto ( count Enox_Values ) do
+ Enox_Values[i].IsReadOnly := true;
+ enddo;
+
+ for j IN 1 seqto ( count Xarelto_Values ) do
+ Xarelto_Values[j].IsReadOnly := true;
+ enddo;
+
+ for k IN 1 seqto ( count Eliquis_Values ) do
+ Eliquis_Values[k].IsReadOnly := true;
+ enddo;
+
+ else
+
+ for l IN 1 seqto ( count Enox_Values ) do
+ Enox_Values[l].IsReadOnly := false;
+ enddo;
+
+ for i IN 1 seqto ( count Xarelto_Values ) do
+ Xarelto_Values[i].IsReadOnly := false;
+ enddo;
+
+ for j IN 1 seqto ( count Eliquis_Values ) do
+ Eliquis_Values[j].IsReadOnly := false;
+ enddo;
+
+ for k IN 1 seqto ( count Aspirin_Values ) do
+ Aspirin_Values[k].IsReadOnly := false;
+ enddo;
+
+ endif;
+
+ if ( CallingField = "RequestedDate|1" ) then
+ ( this_communication, this_form ) := call lovenox_inj WITH this_communication, this_form, client_info_obj;
+ endif;
+ endif; //End FieldChange
+
+ if ( CallingEvent = "FormOpen" ) then
+ ( this_communication, this_form ) := call lovenox_inj WITH this_communication, this_form, client_info_obj;
+ endif;
+
+ if ( CallingEvent = "FormClose" ) then
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ EnoxOrdered := ( True IN Enox_Values.IsSelected );
+ XareltoOrdered := ( True IN Xarelto_Values.IsSelected );
+ EliquisOrdered := ( True IN Eliquis_Values.IsSelected );
+
+ if ( EnoxOrdered = true ) then
+ ( this_communication, this_form ) := call lovenox_inj WITH this_communication, this_form, client_info_obj;
+
+ elseif ( XareltoOrdered = true OR EliquisOrdered = true ) then
+
+ //Ensure Baseline CBC is unchecked since it is not needed
+ Baseline_CBC.IsSelected := false;
+
+ if ( Baseline_Creatinine.IsSelected = false ) then
+
+ Creatinine_Val := read last
+ {" Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Creatinine{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel Fasting{{{SINGLE-QUOTE}}})"
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ if ( not exists Creatinine_Val ) then
+ Baseline_Creatinine.IsSelected := true;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_DVT_PE_TREATMENT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_DVT_PE_TREATMENT.mlm
new file mode 100644
index 0000000..d242767
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_DVT_PE_TREATMENT.mlm
@@ -0,0 +1,1454 @@
+maintenance:
+
+ title: FORM_SET_DVT_PE_TREATMENT ;;
+ mlmname: FORM_SET_DVT_PE_TREATMENT;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: St.Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: Amy Georgolis ;;
+ date: 2017-09-22;;
+ validation: testing;;
+
+library:
+ purpose: Requested by pharmacy: Box checking algorithm for DVT/PE Treatment options (Rivaroxaban and Apixaban).
+ 1) If Rivaroxaban 15mg (Apixaban 10mg) is selected then check 20mg (apixaban 5mg) option as well.
+ 2) If Rivaroxaban 20mg only is selected then change start date to today using hidden field.
+ 3) Allow users to select stop after date from field above order grid, map to maintenance therapy stop after date.
+
+ Attached to {{{SINGLE-QUOTE}}}Called MLMs{{{SINGLE-QUOTE}}} for Forms: PRX_OS_Rivaroxaban and PRX_OS_Apixaban
+
+ ;;
+ explanation:
+
+ Change history
+
+ 09.22.2017 SZ CSR #35039 - Add DVT/PE dose options for rivaroxaban and apixaban Initial build - derived from FORM_Set_Tikosyn_Electrolyte as a model
+ 02.01.2018 SZ added code to fix stop after date requirements by Amy
+ 03.19.2018 SZ CSR #36412 - Apixaban occurrence-Enhance order set. Has several safety enhancements and does a much better job with auto-schedule
+ 03.22.2018 SZ CSR #36414 - Apply apixaban ordering corrections to xarelto
+ 07.03.2019 SZ Help Desk ticket #3797703 - System change caused issues with __ x times(doses)logic for stat and now ordering. Issue corrected on both apixaban and rivaroxaban order sets.
+
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+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";
+
+
+ // 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;
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ user_guid := this_communication.UserGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Stop_After_field := last of (field_list where field_list.DataItemName = "StopAfter" and field_List.Control_MultiFieldOccNum = 1);
+ Stop_After_field_value := Stop_After_field.Value;
+ Stop_After_field_value_number := Stop_After_field_value.Number;
+ Stop_After_field_value_option := Stop_After_field_value.Option;
+ Stop_After_field_2 := last of (field_list where field_list.DataItemName = "StopAfter" and field_List.Control_MultiFieldOccNum = 2);
+ Stop_After_field_2_value := Stop_After_field_2.Value;
+ Stop_After_field_2_value_number := Stop_After_field_2_value.Number;
+
+ Stop_Date_field := last of (field_list where field_list.DataItemName = "StopDate");
+
+ primary_obj := this_communication.PrimaryObj[1];
+ tomorrow := Now + 1 day;
+ current_hour := (extract hour NOW);
+
+/****************************************** start Rivaroxaban part ***********************************************/
+if (Primary_Obj.OrderSetName = "Rivaroxaban") then
+
+ prompt_answer_no := last of (field_list where field_list.DataItemName = "Checkbox" and field_List.Control_MultiFieldOccNum = 6);
+ prompt_answer_yes := last of (field_list where field_list.DataItemName = "Checkbox" and field_List.Control_MultiFieldOccNum = 7);
+
+ stat_dose_15mg := last of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then"); //Rivaroxaban OS = 15mg
+ now_dose_15mg := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now"); //Rivaroxaban OS = 15mg
+
+ Rivaroxaban_DVTPE_order_grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Rivaroxaban_DVTPE_order_options := Rivaroxaban_DVTPE_order_grid.Value;
+
+ Rivaroxaban_15mg_tab := Rivaroxaban_DVTPE_order_options[1];
+ Rivaroxaban_20mg_tab := Rivaroxaban_DVTPE_order_options[2];
+
+ req_date_field_15mg := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+ req_date_field_20mg := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+
+ req_time_field_15mg := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3);
+ req_time_field_20mg := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2);
+ req_time_field_15mg_value := req_time_field_15mg.Value;
+ req_time_field_20mg_value := req_time_field_20mg.Value;
+
+ if (CallingEvent = "FieldChange") and (CallingField = "MultiOrderGrid|3") then
+
+ Stop_After_field_value.Number := 42;
+ Stop_After_field_value.Option := "Doses";
+
+ Stop_After_field_2_value.Number := 42;
+ Stop_After_field_2_value.Option := "Doses";
+
+ // if user is ordering after 9pm, but before 9am (with even doses) then default the start/scheduled times to 09:00
+ if (current_hour < 9) or (current_hour >= 21) then
+ if (current_hour >= 21) then
+ req_date_field_15mg.Value := NOW + 1 day;
+ endif;
+ req_time_field_15mg_value.ReqTimeCode := "Scheduled/Start Time";
+ req_time_field_20mg_value.ReqTimeCode := "Scheduled/Start Time";
+ req_time_field_15mg_value.ReqTimeValue := "09:00";
+ req_time_field_20mg_value.ReqTimeValue := "17:00";
+ else
+ req_time_field_15mg_value.ReqTimeCode := "Scheduled/Start Time";
+ req_time_field_20mg_value.ReqTimeCode := "Scheduled/Start Time";
+ req_time_field_15mg_value.ReqTimeValue := "21:00";
+ req_time_field_20mg_value.ReqTimeValue := "17:00";
+ endif;
+
+ // defaults start time of 15mg to 22 days
+ // true/false
+ if (Rivaroxaban_15mg_tab.IsSelected = true) and (Rivaroxaban_20mg_tab.IsSelected = false) and (not exist req_date_field_20mg.Value) then
+
+ Rivaroxaban_20mg_tab.IsSelected := true;
+ if (current_hour >= 9 and current_hour < 21) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + 22 day;
+ endif;
+
+ if (current_hour >= 21) or (current_hour < 9) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + 21 day;
+ endif;
+
+ endif;
+
+ // false/true
+ if (Rivaroxaban_15mg_tab.IsSelected = false) and (Rivaroxaban_20mg_tab.IsSelected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value;
+ req_time_field_20mg_value.ReqTimeValue := "17:00";
+
+ endif;
+
+ // true/true
+ if (Rivaroxaban_15mg_tab.IsSelected = true) and (Rivaroxaban_20mg_tab.IsSelected = true) then
+ if current_hour >= 9 and current_hour < 21 then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + 22 day;
+ endif;
+
+ if (current_hour >= 21) or (current_hour < 9) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + 21 day;
+ endif;
+ endif;
+
+ // code for unchecking of 5mg
+ // true/false
+ if (Rivaroxaban_15mg_tab.IsSelected = true) and (Rivaroxaban_20mg_tab.IsSelected = false) and (exist req_date_field_20mg.Value) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value;
+ endif;
+
+ // code for unchecking of 5mg and requires MD to select a stop after date
+ if (Rivaroxaban_15mg_tab.IsSelected = true) and (Rivaroxaban_20mg_tab.IsSelected = false) then
+ if current_hour >= 9 and current_hour < 21 then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + 22 day;
+ endif;
+
+ if (current_hour >= 21) or (current_hour < 9) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + 21 day;
+ endif;
+ Stop_After_field.Control_Mandatory := true;
+ endif;
+
+ // false/false
+ if (Rivaroxaban_15mg_tab.IsSelected = false) and (Rivaroxaban_20mg_tab.IsSelected = false) then
+ req_date_field_20mg.Value := null;
+ endif;
+
+ if (Rivaroxaban_15mg_tab.IsSelected = true) then
+ Stop_After_field.Control_Mandatory := true;
+ endif;
+
+ endif; //if (CallingEvent = "FieldChange") and (CallingField = "MultiOrderGrid|3") then
+
+
+
+/************************************************* Rivaroxaban - stop after dosing changes - Rivaroxaban **************************************/
+ fifteen_mg_time_field_string := req_time_field_15mg_value.ReqTimeValue as string;
+ twenty_mg_time_field_string := req_time_field_20mg_value.ReqTimeValue as string;
+
+
+ // code for modifying stop after date of Rivaroxaban
+ if (Rivaroxaban_15mg_tab.IsSelected = true) and (Rivaroxaban_20mg_tab.IsSelected = true) and (CallingEvent = "FieldChange") and (CallingField = "StopAfter|1") then
+
+ if (stat_dose_15mg.Value = true) or (now_dose_15mg.Value = true) then
+
+ //calculated_days := (Stop_After_field_value_number)/2;
+ calculated_days := (Stop_After_field_value.Number/2);
+
+ if ((calculated_days as string) matches pattern "%.5%") then
+ odd_dose_detected := true;
+ else
+ even_dose_detected := true;
+ endif;
+
+ if (current_hour >= 9) and (current_hour < 21) and (even_dose_detected = true) then
+ if (prompt_answer_no.Value = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days + 1) day;
+ endif;
+
+ if (prompt_answer_yes.Value = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days) day;
+ endif;
+ endif;
+
+ if (current_hour >= 9) and (current_hour < 21) and (odd_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days + 1) day;
+ endif;
+
+ // logic for {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}} answer to prompt and STAT/NOW dose already selected during stop after changes
+ if (prompt_answer_no.Value = true) then
+ if (current_hour >= 21 or current_hour < 9) and (even_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days) day;
+ endif;
+
+ if (current_hour >= 21 or current_hour < 9) and (odd_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days + 1) day;
+ endif;
+ endif;
+
+ // logic for {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} answer to prompt and STAT/NOW dose already selected during stop after changes
+ if (prompt_answer_yes.Value = true) then
+ if (current_hour >= 21 or current_hour < 9) and (even_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days + 1) day;
+ endif;
+
+ if (current_hour >= 21 or current_hour < 9) and (odd_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days + 1) day;
+ endif;
+ endif;
+
+ else // neither STAT/NOW are selected, so both are unselected //if (stat_dose_15mg.Value = true) or (now_dose_15mg.Value = true) then
+
+ calculated_days := (Stop_After_field_value.Number/2);
+
+ if ((calculated_days as string) matches pattern "%.5%") then
+ odd_dose_detected := true;
+ else
+ even_dose_detected := true;
+ endif;
+
+
+ if (current_hour >= 9) and (current_hour < 21) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days + 1) day;
+ endif;
+
+ if (current_hour >= 21 or current_hour < 9) and (odd_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days +1) day;
+ endif;
+ if (current_hour >= 21 or current_hour < 9) and (even_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days) day;
+ endif;
+
+
+ endif; // if (stat_dose_15mg.Value = true) or (now_dose_15mg.Value = true) then
+
+
+ // takes # of doses and inserts into hidden stopafter field
+ // done this way due to glitch where "units", "minutes", or "hours" would get inserted into order despite code that reinserts "Doses" into field to correct it
+ Stop_After_field_2_value.Number := Stop_After_field_value_number;
+ Stop_After_field_2_value.Option := Stop_After_field_value_option;
+
+
+ // prevents ordering of 5mg dose if user presses "Clear". Or else it would order 10mg and 5mg with same start date.
+ if (Stop_After_field_value.Option = "Doses") and (Stop_After_field_value.Number = 0) then
+ Rivaroxaban_20mg_tab.IsSelected := false;
+
+ Stop_After_field_value.Number := 42;
+ Stop_After_field_2_value.Number := 42;
+ Stop_After_field_value.Option := "Doses";
+ Stop_After_field_2_value.Option := "Doses";
+
+ clear_button_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Clearing the stop after date has removed the Rivaroxaban 20mg dose" ,"Alert","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+ endif; // if (Rivaroxaban_15mg_tab.IsSelected = true) and (Rivaroxaban_20mg_tab.IsSelected = true) and (CallingEvent = "FieldChange") and (CallingField = "StopAfter|1") then
+
+ if (Rivaroxaban_15mg_tab.IsSelected = true) or (Rivaroxaban_20mg_tab.IsSelected = true) then
+ // added to prevent selection of anything other than "Doses" in the stop after field
+ if (Stop_After_field_value.Option <> "Doses") and (Stop_After_field_value.Option <> "Times") then
+
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\nOnly {{{SINGLE-QUOTE}}}Doses{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}Times{{{SINGLE-QUOTE}}} can be selected as the stop after option" ||
+ "\n "
+ ,"DVT/PE Treatment ", "ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Stop_After_field_value.Option := "Doses";
+ Stop_After_field_2_value.Option := "Doses";
+ endif;
+ endif; //if (Rivaroxaban_15mg_tab.IsSelected = true) or (Rivaroxaban_20mg_tab.IsSelected = true) then
+
+
+/*************************** Rivaroxaban - STAT ORDERING - Rivaroxaban ****************************/
+ Rivaroxaban_DVTPE_STAT_NOW_order_grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 4);
+ Rivaroxaban_DVTPE_STAT_NOW_order_options := Rivaroxaban_DVTPE_STAT_NOW_order_grid.Value;
+ Rivaroxaban_DVTPE_STAT_NOW_order_grid.Control_Visible := false;
+
+ Rivaroxaban_15mg_STAT_tab := Rivaroxaban_DVTPE_STAT_NOW_order_options[1];
+ Rivaroxaban_15mg_NOW_tab := Rivaroxaban_DVTPE_STAT_NOW_order_options[2];
+
+ // if user selected to give a STAT dose of 15mg then push back doses for rivaroxaban 20mg
+ if (CallingEvent = "FieldChange") and (CallingField = "PRX_Dosing Stat and Then|1") then
+ if (stat_dose_15mg.Value = true) and (now_dose_15mg.Value = true) then
+ stat_dose_15mg.Value := false;
+ else
+ continue_processing_stat := true;
+ endif;
+ if ((Rivaroxaban_15mg_tab.IsSelected = true) or (Rivaroxaban_20mg_tab.IsSelected = true)) and (continue_processing_stat = true) then
+
+ if (stat_dose_15mg.Value = true) then
+
+ if (Stop_After_field_value.Number > 1) and (Stop_After_field_value_number > 1) then
+ // reduce dose count by 1 because the NOW order will count as the first dose
+ Stop_After_field_value.Number := Stop_After_field_value_number - 1;
+ Stop_After_field_2_value.Number := Stop_After_field_2_value_number - 1; //change on 7/1
+ endif;
+ // selects the stat order in order grid at bottom of the order set
+ Rivaroxaban_15mg_STAT_tab.IsSelected := true;
+ Rivaroxaban_15mg_STAT_tab.IsReadOnly := true;
+
+
+ next_dose_15mg := req_time_field_15mg_value.ReqTimeValue;
+
+ if (next_dose_15mg = "21:00") then
+ next_dose_text := "9:00PM";
+ after_next_dose_text := "9:00AM";
+ endif;
+
+ if (next_dose_15mg = "09:00") then
+ next_dose_text := "9:00AM";
+ after_next_dose_text := "9:00PM";
+ endif;
+
+ // this formats the date in the dialogue based on current hour
+ //if (current_hour < 9) or (current_hour >= 21) then
+ if (current_hour < 9) then
+ start_date_stat_now_formatted := (extract month Now) formatted with "%02d"
+ || "-" || (extract day Now) formatted with "%02d" || "-"
+ || (extract year Now) formatted with "%04d" ;
+
+
+ else
+
+
+ start_date_stat_now_formatted := (extract month tomorrow) formatted with "%02d"
+ || "-" || (extract day tomorrow) formatted with "%02d" || "-"
+ || (extract year tomorrow) formatted with "%04d" ;
+ endif;
+
+ //ask user (via message dialogue box) if they would like to move the start time back for rivaroxaban 15mg
+ move_start_of_15mg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}} dose to replace the " || next_dose_text || " dose?"
+ ||" .\n\n Choose YES to give a stat dose and then start at " || after_next_dose_text || " on " || start_date_stat_now_formatted
+ ||" .\n\n Choose NO to give a stat dose and then start at " || next_dose_text ,"Rivaroxaban 15mg Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ // yes indiates stat dose = replacing upcoming 10mg so push back all future doses by 1
+ if ((move_start_of_15mg as string) = "Yes") then
+
+ prompt_answer_yes.Value := true;
+
+ // if the requestedtime (for 15mg) is set to 2100 then +1 day to requestedate and set new requestedtime to 0900
+ if (fifteen_mg_time_field_string = "21:00") then
+
+ req_date_field_15mg.Value := req_date_field_15mg.Value + 1 day;
+ req_time_field_15mg_value.ReqTimeValue := "09:00";
+
+ else // (fifteen_mg_time_field_string = "09:00")
+ req_time_field_15mg_value.ReqTimeValue := "21:00";
+ endif;
+
+
+ if (Stop_After_field_value.Number = 1) and (Stop_After_field_value_number = 1) then
+ if (req_date_field_20mg.Value = req_date_field_15mg.Value) then
+
+ req_date_field_20mg.Value := req_date_field_15mg.Value + 1 day;
+
+ endif;
+ endif;
+
+ endif; // if (move_start_of_15mg as string) = "Yes") then
+
+
+ //edits on 3/19/18
+ // no indicates not replacing stat dose = pushing forward all doses by 1
+ // no need to push forward if stop after of 1 dose
+ if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // no indicates not replacing stat dose = pushing forward all doses by 1
+ if ((move_start_of_15mg as string) = "No") then
+
+ prompt_answer_no.Value := true;
+ req_time_field_20mg_value.ReqTimeValue := "17:00";
+
+ calculated_days := (Stop_After_field_value.Number/2);
+
+ // detect if number of doses is odd
+ if ((calculated_days as string) matches pattern "%.5%") then
+ odd_dose_detected := true;
+ else
+ even_dose_detected := true;
+ endif;
+
+ if (current_hour >= 9) and (current_hour < 21) and (odd_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_20mg.Value - 1 day;
+ endif;
+
+ if (current_hour >= 21) and (odd_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days +1) day;
+
+ endif;
+
+ if (current_hour >= 21) and (even_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days ) day;
+ endif;
+
+ if (current_hour < 9) and (even_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_20mg.Value - 1 day;
+ endif;
+
+ endif;
+ endif; //if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // end changes
+
+
+ else // uncheck of 10mg STAT checkbox //if (stat_dose_15mg.Value = true) then
+ Rivaroxaban_15mg_STAT_tab.IsSelected := false;
+ Rivaroxaban_15mg_STAT_tab.IsReadOnly := false;
+
+
+ if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ Stop_After_field_value.Number := Stop_After_field_value_number + 1;
+ Stop_After_field_2_value.Number := Stop_After_field_2_value_number + 1; //change on 7/1
+ endif;
+
+
+ // used to undo forward shift in date(+1) due to {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} on prompt
+ if (prompt_answer_yes.Value = true) and (Stop_After_field_value.Number = 1) then
+ req_date_field_20mg.Value := req_date_field_20mg.Value - 1 day;
+ prompt_answer_yes.Value := false;
+ endif;
+
+ if (prompt_answer_yes.Value = true) and (Stop_After_field_value.Number > 1) then
+ prompt_answer_yes.Value := false;
+
+ endif;
+
+ fifteen_mg_start_day_extract := extract day req_date_field_15mg.Value;
+ today_day_extract := extract day Now;
+
+ // if start date was shifted due to dialogue prompt, then reverse changes
+ if (today_day_extract <> fifteen_mg_start_day_extract) and (current_hour < 21) then
+
+ req_date_field_15mg.Value := req_date_field_15mg.Value - 1 day;
+ req_time_field_15mg_value.ReqTimeValue := "21:00";
+
+ endif;
+
+ if (current_hour < 9) or (current_hour >= 21) and (fifteen_mg_time_field_string = "21:00") then
+ req_time_field_15mg_value.ReqTimeValue := "09:00";
+ //req_time_field_20mg_value.ReqTimeValue := "09:00";
+ endif; // if (today_day_extract <> fifteen_mg_start_day_extract) then
+
+ // 3/19/18 changes
+ // revert date/time changes when STAT dose is unselected and Prompt answer of {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}} was selected
+ if (prompt_answer_no.Value = true) and (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+
+ calculated_days := Stop_After_field_value.Number/2;
+
+ if ((calculated_days as string) matches pattern "%.5%") then
+ odd_dose_detected := true;
+ else
+ even_dose_detected := true;
+ endif;
+
+
+ if (even_dose_detected = true) then
+ if (current_hour >= 9) and (current_hour < 21) then
+ req_date_field_20mg.Value := req_date_field_20mg.Value + 1 day;
+ endif;
+
+ prompt_answer_no.Value := false;
+
+ endif;
+
+ if (odd_dose_detected = true) then
+ prompt_answer_no.Value := false;
+
+ if (current_hour >= 21) or (current_hour < 9)then
+ req_date_field_20mg.Value := req_date_field_20mg.Value + 1 day;
+ endif;
+
+
+ endif;
+ endif; // if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // end 3/19/18 changes
+
+ endif; // if (stat_dose_15mg.Value = true) then
+
+ else // if ((Rivaroxaban_15mg_tab.IsSelected = true) or (Rivaroxaban_20mg_tab.IsSelected = true)) and (continue_processing_stat = true) then
+ stat_dose_15mg.Value := false;
+ Rivaroxaban_15mg_STAT_tab.IsSelected := false;
+ endif; // if ((Rivaroxaban_15mg_tab.IsSelected = true) or (Rivaroxaban_20mg_tab.IsSelected = true)) and (continue_processing_stat = true) then
+
+ if (Rivaroxaban_15mg_tab.IsSelected = false) then
+ stat_dose_15mg.Value := false;
+ Rivaroxaban_15mg_STAT_tab.IsSelected := false;
+ endif;
+
+ endif; // if (Primary_Obj.OrderSetName = "Apixaban") and (CallingEvent = "FieldChange") and (CallingField = "PRX_Dosing Stat and Then|1") then
+
+
+
+
+
+
+/*************************** Rivaroxaban - NOW ORDERING - Rivaroxaban ****************************/
+ if (CallingEvent = "FieldChange") and (CallingField = "PRX_Dosing Start Now|1") then
+ if (stat_dose_15mg.Value = true) and (now_dose_15mg.Value = true) then
+ now_dose_15mg.Value := false;
+ else
+ continue_processing_now := true;
+ endif;
+ if ((Rivaroxaban_15mg_tab.IsSelected = true) or (Rivaroxaban_20mg_tab.IsSelected = true)) and (continue_processing_now = true) then
+
+ if (now_dose_15mg.Value = true) then
+
+ if (Stop_After_field_value.Number > 1) and (Stop_After_field_value_number > 1) then
+ // reduce dose count by 1 because the NOW order will count as the first dose
+ Stop_After_field_value.Number := Stop_After_field_value_number - 1;
+ Stop_After_field_2_value.Number := Stop_After_field_2_value_number - 1; //change on 7/1
+ endif;
+
+ Rivaroxaban_15mg_NOW_tab.IsSelected := true;
+ Rivaroxaban_15mg_NOW_tab.IsReadOnly := true;
+
+ next_dose_15mg := req_time_field_15mg_value.ReqTimeValue;
+
+ if (next_dose_15mg = "21:00") then
+ next_dose_text := "9:00PM";
+ after_next_dose_text := "9:00AM";
+ endif;
+
+ if (next_dose_15mg = "09:00") then
+ next_dose_text := "9:00AM";
+ after_next_dose_text := "9:00PM";
+ endif;
+
+ // this formats the date in the dialogue based on current hour
+ if (current_hour < 9) then
+
+ start_date_stat_now_formatted := (extract month Now) formatted with "%02d"
+ || "-" || (extract day Now) formatted with "%02d" || "-"
+ || (extract year Now) formatted with "%04d" ;
+ else
+
+ start_date_stat_now_formatted := (extract month tomorrow) formatted with "%02d"
+ || "-" || (extract day tomorrow) formatted with "%02d" || "-"
+ || (extract year tomorrow) formatted with "%04d" ;
+ endif;
+
+ //ask user (via message dialogue box) if they would like to move the start time back for apixaban 10mg
+ move_start_of_15mg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}NOW{{{SINGLE-QUOTE}}} dose to replace the " || next_dose_text || " dose?"
+ ||" .\n\n Choose YES to give a stat dose and then start at " || after_next_dose_text || " on " || start_date_stat_now_formatted
+ ||" .\n\n Choose NO to give a stat dose and then start at " || next_dose_text ,"Rivaroxaban 15mg Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ // yes indiates NOW dose = replacing upcoming 10mg so push back all future doses by 1
+ if ((move_start_of_15mg as string) = "Yes") then
+
+ prompt_answer_yes.Value := true;
+
+ // if the requestedtime (for 15mg) is set to 2100 then +1 day to requestedate and set new requestedtime to 0900
+ if (fifteen_mg_time_field_string = "21:00") then
+
+ req_date_field_15mg.Value := req_date_field_15mg.Value + 1 day;
+ req_time_field_15mg_value.ReqTimeValue := "09:00";
+
+ else // (fifteen_mg_time_field_string = "09:00")
+ req_time_field_15mg_value.ReqTimeValue := "21:00";
+ endif;
+
+
+ if (Stop_After_field_value.Number = 1) and (Stop_After_field_value_number = 1) then
+ if (req_date_field_20mg.Value = req_date_field_15mg.Value) then
+
+ req_date_field_20mg.Value := req_date_field_15mg.Value + 1 day;
+
+ endif;
+ endif;
+
+ endif; // if (move_start_of_15mg as string) = "Yes") then
+
+
+ //edits on 3/19/18
+ // no indicates not replacing stat dose = pushing forward all doses by 1
+ // no need to push forward if stop after of 1 dose
+ if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // no indicates not replacing stat dose = pushing forward all doses by 1
+ if ((move_start_of_15mg as string) = "No") then
+
+ prompt_answer_no.Value := true;
+ req_time_field_20mg_value.ReqTimeValue := "17:00";
+
+ calculated_days := (Stop_After_field_value.Number/2);
+
+ // detect if number of doses is odd
+ if ((calculated_days as string) matches pattern "%.5%") then
+ odd_dose_detected := true;
+ else
+ even_dose_detected := true;
+ endif;
+
+ if (current_hour >= 9) and (current_hour < 21) and (odd_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_20mg.Value - 1 day;
+ endif;
+
+ if (current_hour >= 21) and (odd_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days +1) day;
+
+ endif;
+
+ if (current_hour >= 21) and (even_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_15mg.Value + (calculated_days ) day;
+ endif;
+
+ if (current_hour < 9) and (even_dose_detected = true) then
+ req_date_field_20mg.Value := req_date_field_20mg.Value - 1 day;
+ endif;
+
+ endif;
+ endif; // if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // end changes
+
+ else // deselect of 10mg NOW checkbox
+ Rivaroxaban_15mg_NOW_tab.IsSelected := false;
+ Rivaroxaban_15mg_NOW_tab.IsReadOnly := false;
+
+ if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ Stop_After_field_value.Number := Stop_After_field_value_number + 1;
+ Stop_After_field_2_value.Number := Stop_After_field_2_value_number + 1; //change on 7/1
+ endif;
+
+
+ // used to undo forward shift in date(+1) due to {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} on prompt
+ if (prompt_answer_yes.Value = true) and (Stop_After_field_value.Number = 1) then
+ req_date_field_20mg.Value := req_date_field_20mg.Value - 1 day;
+ prompt_answer_yes.Value := false;
+ endif;
+
+ if (prompt_answer_yes.Value = true) and (Stop_After_field_value.Number > 1) then
+ prompt_answer_yes.Value := false;
+ endif;
+
+
+ fifteen_mg_start_day_extract := extract day req_date_field_15mg.Value;
+ today_day_extract := extract day Now;
+
+ // if start date was shifted due to dialogue prompt, then reverse changes
+ if (today_day_extract <> fifteen_mg_start_day_extract) and (current_hour < 21) then
+
+ req_date_field_15mg.Value := req_date_field_15mg.Value - 1 day;
+ req_time_field_15mg_value.ReqTimeValue := "21:00";
+
+ endif;
+
+ if (current_hour < 9) or (current_hour >= 21) and (fifteen_mg_time_field_string = "21:00") then
+ req_time_field_15mg_value.ReqTimeValue := "09:00";
+ //req_time_field_20mg_value.ReqTimeValue := "09:00";
+ endif; // if (today_day_extract <> fifteen_mg_start_day_extract) then
+
+ // 3/19/18 changes
+ // revert date/time changes when STAT dose is unselected and Prompt answer of {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}} was selected
+ if (prompt_answer_no.Value = true) and (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+
+ calculated_days := Stop_After_field_value.Number/2;
+
+ if ((calculated_days as string) matches pattern "%.5%") then
+ odd_dose_detected := true;
+ else
+ even_dose_detected := true;
+ endif;
+
+
+ if (even_dose_detected = true) then
+ if (current_hour >= 9) and (current_hour < 21) then
+ req_date_field_20mg.Value := req_date_field_20mg.Value + 1 day;
+ endif;
+
+ prompt_answer_no.Value := false;
+
+ endif;
+
+ if (odd_dose_detected = true) then
+ prompt_answer_no.Value := false;
+
+ if (current_hour >= 21) or (current_hour < 9)then
+ req_date_field_20mg.Value := req_date_field_20mg.Value + 1 day;
+ endif;
+ endif;
+ endif; // if (prompt_answer_no.Value = true) and (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // end 3/19/18 changes
+
+ endif; // if (now_dose_15mg.Value = true) then
+
+ else // unselect STAT dose checkbox
+ now_dose_15mg.Value := false;
+ Rivaroxaban_15mg_NOW_tab.IsSelected := false;
+ endif; // if (Rivaroxaban_15mg_tab.IsSelected = true) or (Rivaroxaban_20mg_tab.IsSelected = true) then
+
+ if (Rivaroxaban_15mg_tab.IsSelected = false) then
+ now_dose_15mg.Value := false;
+ Rivaroxaban_15mg_NOW_tab.IsSelected := false;
+ endif;
+ endif; // if (CallingEvent = "FieldChange") and (CallingField = "PRX_Dosing Stat and Then|1") then
+
+
+//************ stop here ********************************************************/
+
+ // sets second stop after field to match first stop after field on FormClose
+ if (Rivaroxaban_15mg_tab.IsSelected = true) and (CallingEvent = "FormClose") then
+ Stop_After_field_2_value.Number := Stop_After_field_value.Number;
+ endif;
+
+endif; // if (Primary_Obj.OrderSetName = "Rivaroxaban") then
+
+
+
+
+
+
+
+
+
+
+
+
+
+/****************************************** start apixaban part *******************************************************************************************************************************/
+/****************************************** start apixaban part *******************************************************************************************************************************/
+/****************************************** start apixaban part *******************************************************************************************************************************/
+/****************************************** start apixaban part *******************************************************************************************************************************/
+/****************************************** start apixaban part *******************************************************************************************************************************/
+/****************************************** start apixaban part *******************************************************************************************************************************/
+/****************************************** start apixaban part *******************************************************************************************************************************/
+/****************************************** start apixaban part *******************************************************************************************************************************/
+if (Primary_Obj.OrderSetName = "Apixaban") then
+
+ prompt_answer_no := last of (field_list where field_list.DataItemName = "Checkbox" and field_List.Control_MultiFieldOccNum = 2);
+ prompt_answer_yes := last of (field_list where field_list.DataItemName = "Checkbox" and field_List.Control_MultiFieldOccNum = 3);
+
+ stat_dose_10mg := last of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then"); //Apixaban OS = 10mg
+ now_dose_10mg := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now"); //Apixaban OS = 10mg
+
+ Apixaban_DVTPE_order_grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Apixaban_DVTPE_order_options := Apixaban_DVTPE_order_grid.Value;
+
+
+ Apixaban_10mg_tab := Apixaban_DVTPE_order_options[1];
+ Apixaban_5mg_tab := Apixaban_DVTPE_order_options[2];
+
+ DVT_PE_req_date_field := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ DVT_PE_req_date_field_10mg := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+
+ // new code additions 2/28/18
+ DVT_PE_req_time_field_5mg := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2);
+ DVT_PE_req_time_field_10mg := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3);
+ DVT_PE_req_time_field_5mg_value := DVT_PE_req_time_field_5mg.Value;
+ DVT_PE_req_time_field_10mg_value := DVT_PE_req_time_field_10mg.Value;
+
+
+ // selection of DVT/PE treatment defaults
+ if (CallingEvent = "FieldChange") and (CallingField = "MultiOrderGrid|2") then
+
+ Stop_After_field_value.Number := 14;
+ Stop_After_field_value.Option := "Doses";
+
+ Stop_After_field_2_value.Number := 14;
+ Stop_After_field_2_value.Option := "Doses";
+
+
+ // if user is ordering after 9pm, but before 9am (with even doses) then default the start/scheduled times to 09:00
+ if (current_hour < 9) or (current_hour >= 21) then
+ if (current_hour >= 21) then
+ DVT_PE_req_date_field_10mg.Value := NOW + 1 day;
+ endif;
+ DVT_PE_req_time_field_10mg_value.ReqTimeCode := "Scheduled/Start Time";
+ DVT_PE_req_time_field_5mg_value.ReqTimeCode := "Scheduled/Start Time";
+ DVT_PE_req_time_field_10mg_value.ReqTimeValue := "09:00";
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ else
+ DVT_PE_req_time_field_10mg_value.ReqTimeCode := "Scheduled/Start Time";
+ DVT_PE_req_time_field_5mg_value.ReqTimeCode := "Scheduled/Start Time";
+ DVT_PE_req_time_field_10mg_value.ReqTimeValue := "21:00";
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+
+
+
+
+ // defaults start time of 5mg to 7 days
+ if (Apixaban_10mg_tab.IsSelected = true) and (Apixaban_5mg_tab.IsSelected = false) and (not exist DVT_PE_req_date_field.Value) then
+ Apixaban_5mg_tab.IsSelected := true;
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value + 7 day;
+ endif;
+
+ // sz new code 2/1/18 - to fix stop after date requirements
+ if (Apixaban_10mg_tab.IsSelected = false) and (Apixaban_5mg_tab.IsSelected = true) then
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value;
+
+ Stop_After_field.Control_Mandatory := false;
+ if (current_hour >= 9) and (current_hour < 21) then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+
+ if (current_hour < 9) and (current_hour >= 21) then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif;
+
+ endif;
+
+ // sz new code 2/1/18 - to fix stop after date requirements
+ if (Apixaban_10mg_tab.IsSelected = true) and (Apixaban_5mg_tab.IsSelected = true) then
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value + 7 day;
+ // Stop_After_field.Control_Mandatory := true;
+ endif;
+
+
+ // code for unchecking of 5mg
+ if (Apixaban_10mg_tab.IsSelected = true) and (Apixaban_5mg_tab.IsSelected = false) and (exist DVT_PE_req_date_field.Value) then
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value;
+ endif;
+
+
+ // sz new code 2/1/18 - to fix stop after date requirements
+ // code for unchecking of 5mg and requires MD to select a stop after date
+ if (Apixaban_10mg_tab.IsSelected = true) and (Apixaban_5mg_tab.IsSelected = false) then
+ DVT_PE_req_date_field.Value := NOW + 7 day;
+ Stop_After_field.Control_Mandatory := true;
+ endif;
+
+
+ if (Apixaban_10mg_tab.IsSelected = false) and (Apixaban_5mg_tab.IsSelected = false) then
+ DVT_PE_req_date_field.Value := null;
+ endif;
+
+
+ if (Apixaban_10mg_tab.IsSelected = true) then
+ Stop_After_field.Control_Mandatory := true;
+ endif;
+
+ endif; // if (Primary_Obj.OrderSetName = "Apixaban") and (CallingEvent = "FieldChange") and (CallingField = "MultiOrderGrid|2") then
+
+
+
+
+/************************************************* Apixaban - stop after dosing changes **************************************/
+
+ ten_mg_time_field_string := DVT_PE_req_time_field_10mg_value.ReqTimeValue as string;
+ five_mg_time_field_string := DVT_PE_req_time_field_5mg_value.ReqTimeValue as string;
+
+ // code for modifying stop after date of Apixaban
+ // no need to change stop after date if either 10mg or 5mg are not selected
+ if (Apixaban_10mg_tab.IsSelected = true) and (Apixaban_5mg_tab.IsSelected = true) and (CallingEvent = "FieldChange") and (CallingField = "StopAfter|1") then
+
+ if (stat_dose_10mg.Value = true) or (now_dose_10mg.Value = true) then
+
+ calculated_days := (Stop_After_field_value_number)/2;
+
+ if ((calculated_days as string) matches pattern "%.5%") then
+ odd_dose_detected := true;
+ else
+ even_dose_detected := true;
+ endif;
+
+ if (even_dose_detected = true) then
+
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value + calculated_days day;
+
+ if (ten_mg_time_field_string = "21:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+
+ if (ten_mg_time_field_string = "09:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif;
+
+ endif;
+
+
+ if (odd_dose_detected = true) then
+
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value + calculated_days day;
+
+ if (ten_mg_time_field_string = "21:00") then
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field.Value + 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif;
+
+ if (ten_mg_time_field_string = "09:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+
+ endif;
+ else // if (stat_dose_10mg.Value = true) or (now_dose_10mg.Value = true) then
+ calculated_days := Stop_After_field_value_number/2;
+
+ // detect if number of doses is odd
+ if ((calculated_days as string) matches pattern "%.5%") then
+ odd_dose_detected := true;
+ else
+ even_dose_detected := true;
+ endif;
+
+
+ if (even_dose_detected = true) then
+ // start date of 5mg is equal to doses/2
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value + calculated_days day;
+ // DVT_PE_req_date_field (is start date for 5mg)
+ // DVT_PE_req_date_field_10mg (is start date for 10mg)
+
+ if (ten_mg_time_field_string = "21:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+
+ if (ten_mg_time_field_string = "09:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif;
+ endif; // if (even_dose_detected = true) and (not exist stat_now_order_active) then
+
+
+ if (odd_dose_detected = true) then
+ if (current_hour >= 9) and (current_hour < 21) then
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value + (calculated_days + 1) day;
+ else
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value + calculated_days day;
+ endif;
+ // DVT_PE_req_date_field (is start date for 5mg)
+ // DVT_PE_req_date_field_10mg (is start date for 10mg)
+
+ if (ten_mg_time_field_string = "21:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif; // if (ten_mg_time_field_string = "21:00") then
+
+ if (ten_mg_time_field_string = "09:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif; // if (ten_mg_time_field_string = "21:00") then
+ endif; // if (odd_dose_detected = true) and (not exist stat_now_order_active) then
+
+ endif; //if (stat_dose_10mg.Value = true) or (now_dose_10mg.Value = true) then
+
+
+ // takes # of doses and inserts into hidden stopafter field
+ // done this way due to glitch where "units", "minutes", or "hours" would get inserted into order despite code that reinserts "Doses" into field to correct it
+ Stop_After_field_2_value.Number := Stop_After_field_value_number;
+ Stop_After_field_2_value.Option := Stop_After_field_value_option;
+
+
+ // prevents ordering of 5mg dose if user presses "Clear". Or else it would order 10mg and 5mg with same start date.
+ if (Stop_After_field_value.Option = "Doses") and (Stop_After_field_value.Number = 0) then
+ Apixaban_5mg_tab.IsSelected := false;
+ //july_2019_spot_fix := true;
+ Stop_After_field_value.Number := 14;
+ Stop_After_field_2_value.Number := 14;
+ Stop_After_field_value.Option := "Doses";
+ Stop_After_field_2_value.Option := "Doses";
+ //Stop_After_field_value.Option := null;
+ //Stop_After_field_value.Number := null;
+
+ clear_button_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Clearing the stop after date has removed the Apixaban 5mg dose" ,"Alert","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+ endif; //if (Apixaban_10mg_tab.IsSelected = true) and (Apixaban_5mg_tab.IsSelected = true) and (CallingEvent = "FieldChange") and (CallingField = "StopAfter|1") then
+
+
+ if (Apixaban_10mg_tab.IsSelected = true) or (Apixaban_5mg_tab.IsSelected = true) then
+ // added to prevent selection of anything other than "Doses" in the stop after field
+ if (Stop_After_field_value.Option <> "Doses") and (Stop_After_field_value.Option <> "Times") then
+
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\nOnly {{{SINGLE-QUOTE}}}Doses{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}Times{{{SINGLE-QUOTE}}} can be selected as the stop after option" ||
+ "\n "
+ ,"DVT/PE Treatment ", "ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Stop_After_field_value.Option := "Doses";
+ Stop_After_field_2_value.Option := "Doses";
+ endif;
+ endif; //if (Apixaban_10mg_tab.IsSelected = true) or (Apixaban_5mg_tab.IsSelected = true) then
+
+
+/*************************** Apixaban - STAT ORDERING****************************/
+
+ Apixaban_DVTPE_STAT_NOW_order_grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Apixaban_DVTPE_STAT_NOW_order_options := Apixaban_DVTPE_STAT_NOW_order_grid.Value;
+ Apixaban_DVTPE_STAT_NOW_order_grid.Control_Visible := false;
+
+ Apixaban_10mg_STAT_tab := Apixaban_DVTPE_STAT_NOW_order_options[1];
+ Apixaban_10mg_NOW_tab := Apixaban_DVTPE_STAT_NOW_order_options[2];
+
+ // if user selected to give a STAT dose of 10mg then push back doses for apixaban 5mg
+ if (CallingEvent = "FieldChange") and (CallingField = "PRX_Dosing Stat and Then|1") then
+ if (stat_dose_10mg.Value = true) and (now_dose_10mg.Value = true) then
+ stat_dose_10mg.Value := false;
+ else
+ continue_processing_stat := true;
+ endif;
+ if ((Apixaban_10mg_tab.IsSelected = true) or (Apixaban_5mg_tab.IsSelected = true)) and (continue_processing_stat = true) then
+
+ if (stat_dose_10mg.Value = true) then
+ if (Stop_After_field_value.Number > 1) and (Stop_After_field_value_number > 1) then
+ // reduce dose count by 1 because the NOW order will count as the first dose
+ Stop_After_field_value.Number := Stop_After_field_value_number - 1;
+ Stop_After_field_2_value.Number := Stop_After_field_2_value_number - 1; //change on 7/1
+ endif;
+ // selects the stat order in order grid at bottom of the order set
+ Apixaban_10mg_STAT_tab.IsSelected := true;
+ Apixaban_10mg_STAT_tab.IsReadOnly := true;
+
+
+ next_dose_10mg := DVT_PE_req_time_field_10mg_value.ReqTimeValue;
+
+ if (next_dose_10mg = "21:00") then
+ next_dose_text := "9:00PM";
+ after_next_dose_text := "9:00AM";
+ endif;
+
+ if (next_dose_10mg = "09:00") then
+ next_dose_text := "9:00AM";
+ after_next_dose_text := "9:00PM";
+ endif;
+
+ // this formats the date in the dialogue based on current hour
+ //if (current_hour < 9) or (current_hour >= 21) then
+ if (current_hour < 9) then
+ start_date_stat_now_formatted := (extract month Now) formatted with "%02d"
+ || "-" || (extract day Now) formatted with "%02d" || "-"
+ || (extract year Now) formatted with "%04d" ;
+
+
+ else
+
+
+ start_date_stat_now_formatted := (extract month tomorrow) formatted with "%02d"
+ || "-" || (extract day tomorrow) formatted with "%02d" || "-"
+ || (extract year tomorrow) formatted with "%04d" ;
+ endif;
+
+ //ask user (via message dialogue box) if they would like to move the start time back for apixaban 10mg
+ move_start_of_10mg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}} dose to replace the " || next_dose_text || " dose?"
+ ||" .\n\n Choose YES to give a stat dose and then start at " || after_next_dose_text || " on " || start_date_stat_now_formatted
+ ||" .\n\n Choose NO to give a stat dose and then start at " || next_dose_text ,"Apixaban 10mg Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ // yes indiates stat dose = replacing upcoming 10mg so push back all future doses by 1
+ if ((move_start_of_10mg as string) = "Yes") then
+
+ // if the requestedtime (for 5mg) is set to 2100 then +1 day to requestedate and set new requestedtime to 0900
+ if (ten_mg_time_field_string = "21:00") then
+
+ stat_order_moved_date_time := true;
+ DVT_PE_req_date_field_10mg.Value := DVT_PE_req_date_field_10mg.Value + 1 day;
+ DVT_PE_req_time_field_10mg_value.ReqTimeValue := "09:00";
+
+ else // (ten_mg_time_field_string = "09:00")
+ DVT_PE_req_time_field_10mg_value.ReqTimeValue := "21:00";
+ endif;
+
+
+ if (Stop_After_field_value.Number = 1) and (Stop_After_field_value_number = 1) then
+ if (five_mg_time_field_string = "21:00") then
+
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value + 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+
+ else // (ten_mg_time_field_string = "09:00")
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+ endif;
+
+ endif; // if (move_start_of_10mg as string) = "Yes") then
+
+
+ //edits on 3/19/18
+ // no indicates not replacing stat dose = pushing forward all doses by 1
+ // no need to push forward if stop after of 1 dose
+ if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // no indicates not replacing stat dose = pushing forward all doses by 1
+ if ((move_start_of_10mg as string) = "No") then
+
+ prompt_answer_no.Value := true;
+
+ //if (current_hour >= 9) and (current_hour < 21) then
+ if (five_mg_time_field_string = "21:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ else
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field.Value - 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+ //endif;
+ endif;
+ endif; //if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // end changes
+
+
+ else // deselect of 10mg STAT checkbox //if (stat_dose_10mg.Value = true) then
+ Apixaban_10mg_STAT_tab.IsSelected := false;
+ Apixaban_10mg_STAT_tab.IsReadOnly := false;
+
+ //Stop_After_field_value.Number := Stop_After_field_value_number + 1; //change on 7/1
+
+ //Stop_After_field_2_value.Number := Stop_After_field_2_value_number + 1; //change on 7/1
+
+
+ if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ Stop_After_field_value.Number := Stop_After_field_value_number + 1;
+ Stop_After_field_2_value.Number := Stop_After_field_2_value_number + 1; //change on 7/1
+ endif;
+
+
+
+ // code to prevent issues if stop after = 1 dose and "STAT" or "NOW" dose is selected with "yes" to prompt
+ if (Stop_After_field_value.Number = 1) and (Stop_After_field_2_value.Number = 1) and (DVT_PE_req_date_field.Value = DVT_PE_req_date_field_10mg.Value) then
+ if (five_mg_time_field_string = "21:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ else // (ten_mg_time_field_string = "09:00")
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value - 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+ endif;
+
+
+ ten_mg_start_day_extract := extract day DVT_PE_req_date_field_10mg.Value;
+ today_day_extract := extract day Now;
+
+ // if start date was shifted due to dialogue prompt, then reverse changes
+ if (today_day_extract <> ten_mg_start_day_extract) and (current_hour < 21) then
+
+ DVT_PE_req_date_field_10mg.Value := DVT_PE_req_date_field_10mg.Value - 1 day;
+ DVT_PE_req_time_field_10mg_value.ReqTimeValue := "21:00";
+
+ endif;
+
+ if (current_hour < 9) or (current_hour >= 21) and (ten_mg_time_field_string = "21:00") then
+ DVT_PE_req_time_field_10mg_value.ReqTimeValue := "09:00";
+ //DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif; // if (today_day_extract <> ten_mg_start_day_extract) then
+
+ // 3/19/18 changes
+ // revert time changes when STAT dose is unselected and Prompt answer of {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}} was selected
+ if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ calculated_days := Stop_After_field_value.Number/2;
+
+ if ((calculated_days as string) matches pattern "%.5%") then
+ odd_dose_detected := true;
+ else
+ even_dose_detected := true;
+ endif;
+
+
+ if (prompt_answer_no.Value = true) and (even_dose_detected = true) then
+ // even doses should have same start times, if not then {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}} was selected for prompt to move dose. Correct the offset for 5mg dose.
+ if (ten_mg_time_field_string <> five_mg_time_field_string) then
+
+ if (ten_mg_time_field_string = "21:00") and (five_mg_time_field_string = "09:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+
+ if (ten_mg_time_field_string = "09:00") and (five_mg_time_field_string = "21:00") then
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field.Value + 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif;
+
+ prompt_answer_no.Value := false;
+ endif;
+ endif;
+
+ if (prompt_answer_no.Value = true) and (odd_dose_detected = true) then
+
+ if (ten_mg_time_field_string = "21:00") and (five_mg_time_field_string = "21:00") then
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field.Value + 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif;
+
+ if (ten_mg_time_field_string = "09:00") and (five_mg_time_field_string = "09:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+
+ prompt_answer_no.Value := false;
+ endif;
+ endif; // if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // end 3/19/18 changes
+
+ endif; // if (stat_dose_10mg.Value = true) then
+
+ else // if ((Apixaban_10mg_tab.IsSelected = true) or (Apixaban_5mg_tab.IsSelected = true)) and (continue_processing_stat = true) then
+ stat_dose_10mg.Value := false;
+ Apixaban_10mg_STAT_tab.IsSelected := false;
+ endif; // if ((Apixaban_10mg_tab.IsSelected = true) or (Apixaban_5mg_tab.IsSelected = true)) and (continue_processing_stat = true) then
+
+ if (Apixaban_10mg_tab.IsSelected = false) then
+ stat_dose_10mg.Value := false;
+ Apixaban_10mg_STAT_tab.IsSelected := false;
+ endif;
+
+ endif; // if (Primary_Obj.OrderSetName = "Apixaban") and (CallingEvent = "FieldChange") and (CallingField = "PRX_Dosing Stat and Then|1") then
+
+
+
+/*************************** Apixaban - NOW ORDERING****************************/
+
+
+ if (CallingEvent = "FieldChange") and (CallingField = "PRX_Dosing Start Now|1") then
+ if (stat_dose_10mg.Value = true) and (now_dose_10mg.Value = true) then
+ now_dose_10mg.Value := false;
+ else
+ continue_processing_now := true;
+ endif;
+ if ((Apixaban_10mg_tab.IsSelected = true) or (Apixaban_5mg_tab.IsSelected = true)) and (continue_processing_now = true) then
+
+ if (now_dose_10mg.Value = true) then
+
+ if (Stop_After_field_value.Number > 1) and (Stop_After_field_value_number > 1) then
+ // reduce dose count by 1 because the NOW order will count as the first dose
+ Stop_After_field_value.Number := Stop_After_field_value_number - 1;
+ Stop_After_field_2_value.Number := Stop_After_field_2_value_number - 1; //change on 7/1
+ endif;
+
+ Apixaban_10mg_NOW_tab.IsSelected := true;
+ Apixaban_10mg_NOW_tab.IsReadOnly := true;
+
+ next_dose_10mg := DVT_PE_req_time_field_10mg_value.ReqTimeValue;
+
+ if (next_dose_10mg = "21:00") then
+ next_dose_text := "9:00PM";
+ after_next_dose_text := "9:00AM";
+ endif;
+
+ if (next_dose_10mg = "09:00") then
+ next_dose_text := "9:00AM";
+ after_next_dose_text := "9:00PM";
+ endif;
+
+ // this formats the date in the dialogue based on current hour
+ if (current_hour < 9) then
+
+ start_date_stat_now_formatted := (extract month Now) formatted with "%02d"
+ || "-" || (extract day Now) formatted with "%02d" || "-"
+ || (extract year Now) formatted with "%04d" ;
+ else
+
+ start_date_stat_now_formatted := (extract month tomorrow) formatted with "%02d"
+ || "-" || (extract day tomorrow) formatted with "%02d" || "-"
+ || (extract year tomorrow) formatted with "%04d" ;
+ endif;
+
+ //ask user (via message dialogue box) if they would like to move the start time back for apixaban 10mg
+ move_start_of_10mg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}NOW{{{SINGLE-QUOTE}}} dose to replace the " || next_dose_text || " dose?"
+ ||" .\n\n Choose YES to give a stat dose and then start at " || after_next_dose_text || " on " || start_date_stat_now_formatted
+ ||" .\n\n Choose NO to give a stat dose and then start at " || next_dose_text ,"Apixaban 10mg Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ // yes indiates NOW dose = replacing upcoming 10mg so push back all future doses by 1
+ if ((move_start_of_10mg as string) = "Yes") then
+
+ // if the requestedtime (for 5mg) is set to 2100 then +1 day to requestedate and set new requestedtime to 0900
+ if (ten_mg_time_field_string = "21:00") then
+
+ DVT_PE_req_date_field_10mg.Value := DVT_PE_req_date_field_10mg.Value + 1 day;
+ DVT_PE_req_time_field_10mg_value.ReqTimeValue := "09:00";
+
+ else // (ten_mg_time_field_string = "09:00")
+ DVT_PE_req_time_field_10mg_value.ReqTimeValue := "21:00";
+ endif;
+
+ if (Stop_After_field_value.Number = 1) and (Stop_After_field_value_number = 1) then
+ if (five_mg_time_field_string = "21:00") then
+
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value + 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+
+ else // (ten_mg_time_field_string = "09:00")
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+ endif;
+
+ endif; // if (move_start_of_10mg as string) = "Yes") then
+
+
+ //edits on 3/19/18
+ // no indicates not replacing stat dose = pushing forward all doses by 1
+ // no need to push forward if stop after of 1 dose
+ if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // no indicates not replacing stat dose = pushing forward all doses by 1
+ if ((move_start_of_10mg as string) = "No") then
+
+ prompt_answer_no.Value := true;
+
+ //if (current_hour >= 9) and (current_hour < 21) then
+ if (five_mg_time_field_string = "21:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ else
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field.Value - 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+ //endif;
+ endif;
+ endif; // if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // end changes
+
+ else // deselect of 10mg NOW checkbox
+ Apixaban_10mg_NOW_tab.IsSelected := false;
+ Apixaban_10mg_NOW_tab.IsReadOnly := false;
+
+ // Stop_After_field_value.Number := Stop_After_field_value_number + 1; //change on 7/1
+ // Stop_After_field_2_value.Number := Stop_After_field_2_value_number + 1; //change on 7/1
+
+
+ if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ Stop_After_field_value.Number := Stop_After_field_value_number + 1;
+ Stop_After_field_2_value.Number := Stop_After_field_2_value_number + 1; //change on 7/1
+ endif;
+
+ // code to prevent issues if stop after = 1 dose and "STAT" or "NOW" dose is selected with "yes" to prompt
+ if (Stop_After_field_value.Number = 1) and (Stop_After_field_2_value.Number = 1) and (DVT_PE_req_date_field.Value = DVT_PE_req_date_field_10mg.Value) then
+ if (five_mg_time_field_string = "21:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ else // (ten_mg_time_field_string = "09:00")
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field_10mg.Value - 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+ stop_after_issue := true;
+ endif;
+
+ ten_mg_start_day_extract := extract day DVT_PE_req_date_field_10mg.Value;
+ today_day_extract := extract day Now;
+
+ // if start date was shifted due to dialogue prompt, then reverse changes
+ if (today_day_extract <> ten_mg_start_day_extract) and (current_hour < 21) then
+
+ DVT_PE_req_date_field_10mg.Value := DVT_PE_req_date_field_10mg.Value - 1 day;
+ DVT_PE_req_time_field_10mg_value.ReqTimeValue := "21:00";
+
+ endif;
+
+ if (current_hour < 9) or (current_hour >= 21) and (ten_mg_time_field_string = "21:00") then
+ DVT_PE_req_time_field_10mg_value.ReqTimeValue := "09:00";
+ //DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif; // if (today_day_extract <> ten_mg_start_day_extract) then
+
+ // 3/19/18 changes
+ // revert time changes when STAT dose is unselected and Prompt answer of {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}} was selected
+ if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ calculated_days := Stop_After_field_value.Number/2;
+
+ if ((calculated_days as string) matches pattern "%.5%") then
+ odd_dose_detected := true;
+ else
+ even_dose_detected := true;
+ endif;
+
+
+ if (prompt_answer_no.Value = true) and (even_dose_detected = true) then
+ // even doses should have same start times, if not then {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}} was selected for prompt to move dose. Correct the offset for 5mg dose.
+ if (ten_mg_time_field_string <> five_mg_time_field_string) then
+
+ if (ten_mg_time_field_string = "21:00") and (five_mg_time_field_string = "09:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+
+ if (ten_mg_time_field_string = "09:00") and (five_mg_time_field_string = "21:00") then
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field.Value + 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif;
+
+ prompt_answer_no.Value := false;
+ endif;
+ endif;
+
+ if (prompt_answer_no.Value = true) and (odd_dose_detected = true) then
+
+ if (ten_mg_time_field_string = "21:00") and (five_mg_time_field_string = "21:00") then
+ DVT_PE_req_date_field.Value := DVT_PE_req_date_field.Value + 1 day;
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "09:00";
+ endif;
+
+ if (ten_mg_time_field_string = "09:00") and (five_mg_time_field_string = "09:00") then
+ DVT_PE_req_time_field_5mg_value.ReqTimeValue := "21:00";
+ endif;
+
+ prompt_answer_no.Value := false;
+ endif;
+ endif; // if (Stop_After_field_value.Number >= 1) and (Stop_After_field_2_value.Number > 1) then
+ // end 3/19/18 changes
+
+ endif; // if (now_dose_10mg.Value = true) then
+
+ else // unselect STAT dose checkbox
+ now_dose_10mg.Value := false;
+ Apixaban_10mg_NOW_tab.IsSelected := false;
+ endif; // if (Apixaban_10mg_tab.IsSelected = true) or (Apixaban_5mg_tab.IsSelected = true) then
+
+ if (Apixaban_10mg_tab.IsSelected = false) then
+ now_dose_10mg.Value := false;
+ Apixaban_10mg_NOW_tab.IsSelected := false;
+ endif;
+ endif; // if (CallingEvent = "FieldChange") and (CallingField = "PRX_Dosing Stat and Then|1") then
+
+ // sets second stop after field to match first stop after field on FormClose
+ if (Apixaban_10mg_tab.IsSelected = true) and (CallingEvent = "FormClose") then
+ Stop_After_field_2_value.Number := Stop_After_field_value.Number;
+ endif;
+
+endif; //if (Primary_Obj.OrderSetName = "Apixaban")
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: // No evoke statement
+ // evoked from
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_ADMIT_AWP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_ADMIT_AWP.mlm
new file mode 100644
index 0000000..093f7f4
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_ADMIT_AWP.mlm
@@ -0,0 +1,187 @@
+maintenance:
+
+ title: Admission Orders - alcohol Withdrawal Protocol;;
+ mlmname: FORM_Set_ED_Admit_AWP;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-04-01;;
+ validation: testing;;
+
+library:
+ purpose: Used for Admission Orders - Alcohol Withdrawal Protocol
+ ;;
+
+ explanation: This MLM is called from ...Admission Alcohol Withdrawal Protocol Orderset
+
+ Change history
+ 08.04.2011 TMS Put into production
+
+
+
+ ;;
+ keywords: Called MLMs, Lab Grids on Order Sets, Inital ED
+ ;;
+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";
+
+ // 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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ //Get the multi order grid check box value
+ Checkbox_fld := last of (field_list where field_list.DataItemName = "PRX_Checkbox1");
+// and field_List.Control_MultiFieldOccNum = 1);
+
+ Ativan_grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 64);
+ Ativan_list :=Ativan_grid.Value;
+ Ativan_SelList := Ativan_List.IsSelected;
+
+ Other_Med_Grid:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 66);
+
+ Other_Med_list := Other_Med_Grid.Value;
+ Nurse_Inst_Grid:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 48);
+
+ Nurse_Inst_List := Nurse_Inst_Grid.Value;
+
+// Found_DeSelect:= First of (Grid_list where Grid_list.Name = DeSelect );
+ If CallingEvent = "FieldChange" Then
+ If Callingfield = "PRX_Checkbox1|1" then
+
+
+ If Checkbox_fld.Value = False then
+ ListMembs:= count Ativan_SelList;
+ FalseList := ();
+ for k in (1 seqto ListMembs) do
+ FalseList := FalseList,False;
+ enddo;
+
+ Ativan_List.IsSelected:= FalseList;
+ endif;
+//
+ If Checkbox_fld.Value = False then
+ InstMembs:= count Nurse_Inst_List;
+ schedlist:= (True, False, False);
+ p:=4;
+ for p in (4 seqto InstMembs) do
+ schedlist := schedlist, Nurse_Inst_List.isselected [p];
+ enddo;
+
+ Nurse_Inst_List.IsSelected := schedlist;
+ endif;
+//
+
+If Checkbox_fld.Value = True then
+ ListMembs:= count Ativan_SelList;
+ TrueList := ();
+ for k in (1 seqto ListMembs) do
+ TrueList := TrueList,True;
+ enddo;
+
+ Ativan_List.IsSelected:= TrueList;
+ endif;
+//
+ If Checkbox_fld.Value = True then
+ InstMembs:= count Nurse_Inst_List;
+ schedlist:= (True, True, True);
+ p:=4;
+ for p in (4 seqto InstMembs) do
+ schedlist := schedlist, Nurse_Inst_List.isselected [p];
+ enddo;
+
+ Nurse_Inst_List.IsSelected := schedlist;
+ endif;
+//
+
+ endif;
+endif;
+If CallingField = "MultiOrderGrid|66" and CallingEvent = "FieldChange" Then
+ blocklist2 := (False, False, False);
+ blocklist3 := (False, False);
+ truelist2 := (False, False, False);
+ truelist3 := (False, False);
+If Other_Med_list.IsSelected [1] = true
+then truelist2 := (True, False, False);
+ blocklist2 := (False, True, True);
+
+endif;
+If
+ Other_Med_list.IsSelected [2] = true
+then truelist2 := (False, True, False);
+ blocklist2 := (True, False, True);
+endif;
+If
+ Other_Med_list.IsSelected [3] = true
+then truelist2 := (False, False, True);
+ blocklist2 := (True, True, False);
+endif;
+
+If Other_Med_list.IsSelected [4] = true
+then truelist3 := (True, False);
+ blocklist3 := (False, True);
+endif;
+
+If Other_Med_list.IsSelected [5] = true
+then truelist3 := (False, True);
+ blocklist3 := (True, False);
+endif;
+ blocklistA:= blocklist2, blocklist3;
+ truelistA:= truelist2, truelist3;
+ r:=6;
+ listother := count Other_Med_list;
+ for r in (6 seqto listother) do
+ truelistA := truelistA, other_med_list.isselected [r];
+ blocklistA := blocklistA, false;
+ enddo;
+
+ Other_Med_list.IsSelected := truelistA;
+ Other_Med_list.IsReadOnly := blocklistA;
+
+//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Other_med_list: "||Other_Med_list.IsSelected ||"\n truelist2: "|| truelist2 ||"\n Value of r: "|| r ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_ADMIT_LABS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_ADMIT_LABS.mlm
new file mode 100644
index 0000000..6af0267
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_ADMIT_LABS.mlm
@@ -0,0 +1,190 @@
+maintenance:
+
+ title: Admission order set Labs and Notifications;;
+ mlmname: FORM_Set_ED_Admit_Labs;;
+ arden: version 2.5;;
+ version: 5.00;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Eclipsys Corp Ext 7448;;
+ specialist: Peggy Karish, Eclipsys Corp ext 7441;;
+ date: 2010-08-09;;
+ validation: testing;;
+
+library:
+ purpose: Used for ED admission Order set to auto select
+ additional orders when other orders are selected.
+ ;;
+
+ explanation: This MLM is called from the ED Admission OS
+
+ Change history
+
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ Notify_Order_Grid:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 55);
+
+ Instruct_Order_Grid:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 48);
+
+ StatLab_Order_CBox:= first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 2);
+
+ AmLab_Order_CBox:= first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 3);
+
+ HourlyLab_Order_CBox:= first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 5);
+
+ RepeatLab_Order_CBox:= first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 4);
+
+
+ NotifyGridList := Notify_Order_Grid.IsSelected;
+ Notify_Grid := Notify_Order_Grid.Value;
+ Instruct_Grid := Instruct_Order_Grid.Value;
+ AmLab_List := AmLab_Order_CBox.Value;
+ HourlyLab_List := HourlyLab_Order_CBox.Value;
+ RepeatLab_List := RepeatLab_Order_CBox.Value;
+ StatLab_List := StatLab_Order_CBox.Value;
+
+ CheckedLabs := ("CBC (Includes Diff)", "Hemoglobin and Hematocrit", "CBC No Diff (Hemogram Only)","CBC with Manual Diff");
+ Found_Lab_Order2:= (StatLab_List where StatLab_List.IsSelected) ;
+ Found_Lab_Order3:= (AmLab_List where AmLab_List.IsSelected) ;
+ Found_Lab_Order4:= (RepeatLab_List where RepeatLab_List.IsSelected) ;
+ Found_Lab_Order5:= (HourlyLab_List where HourlyLab_List.IsSelected) ;
+ Found_Lab_Order2Amy:= first of (StatLab_List where StatLab_List.Name = ("Amylase Plasma/Serum")) ;
+ Found_Lab_Order2Lip:= first of (StatLab_List where StatLab_List.Name = ("Lipase")) ;
+ Found_Lab_Order3Amy:= first of (AmLab_List where AmLab_List.Name = ("Amylase Plasma/Serum")) ;
+ Found_Lab_Order3Lip:= first of (AmLab_List where AmLab_List.Name = ("Lipase")) ;
+ labsordered := Found_Lab_Order2.name, Found_Lab_Order3.name, Found_Lab_Order4.name,Found_Lab_Order5.name;
+ foundhemo := labsordered is in checkedlabs;
+ foundit := (true);
+ checkthebox := foundit is in foundhemo;
+ NotifyGridListValue := ();
+
+If CallingField = "MultiOrderCheckbox|2" or CallingField = "MultiOrderCheckbox|3" or
+ CallingField = "MultiOrderCheckbox|4" or CallingField = "MultiOrderCheckbox|5" then
+ if (checkthebox = (true)) then
+ NotifyGridListValue := (True); else
+ NotifyGridListValue := (False);
+ endif;
+ for k in (1 seqto (count Notify_grid)) do
+
+ if k <> 1 then
+ if Notify_Grid.IsSelected [k] = True then
+ NotifyGridListValue := NotifyGridListValue, True;
+ else NotifyGridListValue := NotifyGridListValue, False;
+ endif;
+ else NotifyGridListValue := NotifyGridListValue;
+ endif;
+ enddo;
+
+ Notify_Grid.IsSelected := NotifyGridListValue;
+ NotifyGridList := NotifyGridListValue;
+endif;
+If CallingField = "MultiOrderCheckbox|2" or CallingField = "MultiOrderCheckbox|3" then
+
+ If (Found_Lab_Order2amy.IsSelected = True) and (Found_Lab_Order2amy.IsReadOnly = False) and
+ (Found_Lab_Order2lip.IsReadOnly = False) and
+ (Found_Lab_Order2lip.IsSelected = False) then
+
+ Found_Lab_Order2lip.IsSelected := True;
+ Found_Lab_Order2lip.IsReadOnly := True;
+ endif;
+
+
+ If (Found_Lab_Order2amy.IsSelected = False) and (Found_Lab_Order2amy.IsReadOnly = False) and
+ (Found_Lab_Order2lip.IsReadOnly = True)
+ and (Found_Lab_Order2lip.IsSelected = True) then
+
+ Found_Lab_Order2lip.IsSelected := False;
+ Found_Lab_Order2lip.IsReadOnly := False;
+ endif;
+
+ If (Found_Lab_Order2lip.IsSelected = True) and (Found_Lab_Order2lip.IsReadOnly = False) and
+ (Found_Lab_Order2amy.IsReadOnly = False)
+ and (Found_Lab_Order2amy.IsSelected = False) then
+
+ Found_Lab_Order2amy.IsSelected := True;
+ Found_Lab_Order2amy.IsReadOnly := True;
+ endif;
+
+ If (Found_Lab_Order2lip.IsSelected = False) and (Found_Lab_Order2lip.IsReadOnly = False) and
+ (Found_Lab_Order2amy.IsReadOnly = True)
+ and (Found_Lab_Order2amy.IsSelected = True) then
+
+ Found_Lab_Order2amy.IsSelected := False;
+ Found_Lab_Order2amy.IsReadOnly := False;
+ endif;
+
+ If (Found_Lab_Order3amy.IsSelected = True) and (Found_Lab_Order3amy.IsReadOnly = False) and
+ (Found_Lab_Order3lip.IsReadOnly = False) and
+ (Found_Lab_Order3lip.IsSelected = False) then
+
+ Found_Lab_Order3lip.IsSelected := True;
+ Found_Lab_Order3lip.IsReadOnly := True;
+ endif;
+
+ If (Found_Lab_Order3amy.IsSelected = False) and (Found_Lab_Order3amy.IsReadOnly = False) and
+ (Found_Lab_Order3lip.IsReadOnly = True)
+ and (Found_Lab_Order3lip.IsSelected = True) then
+
+ Found_Lab_Order3lip.IsSelected := False;
+ Found_Lab_Order3lip.IsReadOnly := False;
+ endif;
+
+ If (Found_Lab_Order3lip.IsSelected = True) and (Found_Lab_Order3lip.IsReadOnly = False) and
+ (Found_Lab_Order3amy.IsReadOnly = False)
+ and (Found_Lab_Order3amy.IsSelected = False) then
+
+ Found_Lab_Order3amy.IsSelected := True;
+ Found_Lab_Order3amy.IsReadOnly := True;
+ endif;
+
+ If (Found_Lab_Order3lip.IsSelected = False) and (Found_Lab_Order3lip.IsReadOnly = False) and
+ (Found_Lab_Order3amy.IsReadOnly = True)
+ and (Found_Lab_Order3amy.IsSelected = True) then
+
+ Found_Lab_Order3amy.IsSelected := False;
+ Found_Lab_Order3amy.IsReadOnly := False;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_ADMIT_PNEUMONIA.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_ADMIT_PNEUMONIA.mlm
new file mode 100644
index 0000000..2f0b9b3
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_ADMIT_PNEUMONIA.mlm
@@ -0,0 +1,209 @@
+maintenance:
+
+ title: Admission Orders - Pneumonia;;
+ mlmname: FORM_Set_ED_Admit_Pneumonia;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-04-01;;
+ validation: testing;;
+
+library:
+ purpose: Used for Admission Orders - Pneumonia
+ ;;
+
+ explanation: This MLM is called from Admission Orders - Pneumonia
+
+ Change history
+ 06.20.2012 TMS Added call to FORM_MEDICAL_IMAGING_INDICATIONS_FOR_OS{{{SINGLE-QUOTE}}} under form open to retrieve diabetic health issues
+ and iodine allergies to autopopulate questions on order set form when found. CSR 22904
+
+
+ ;;
+ keywords: Called MLMs, Lab Grids on Order Sets, Inital ED
+ ;;
+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";
+
+ // 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;
+
+
+ /***************************************************************************************/
+ MedImageInd := MLM {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING_INDICATIONS_FOR_OS{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ AdmitOrders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 46);
+ AdmitOrders_List := AdmitOrders.Value;
+
+ Found_Admit_Gen := first of (AdmitOrders_List where AdmitOrders_List.Name = "Admit to Inpatient");
+ Found_Admit_CC := last of (AdmitOrders_List where AdmitOrders_List.Name = "Admit to Inpatient");
+
+ GenMedOrders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 66);
+ GenMedOrders_List := GenMedOrders.Value;
+
+ CCMedOrders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 67);
+ CCMedOrders_List := CCMedOrders.Value;
+
+ Guidelines := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 1);
+ Guidelines_List := Guidelines.Value;
+
+
+
+
+ If CallingEvent = "FormOpen" then
+ Guidelines_List.IsReadOnly := (True);
+ IndMLM := call MedImageInd with (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) ;
+ endif;
+// Make eligible orders available for General or Critical Care depending upon admit order
+If CallingField = "MultiOrderGrid|46" then
+ If (Found_Admit_Gen.IsSelected = True) then AdmitOrders_List.IsReadOnly := (False,True,True);
+ CCMedOrders_List.IsReadOnly := (True,True,True,True,True,True);
+ elseIf (Found_Admit_CC.IsSelected = True) then AdmitOrders_List.IsReadOnly := (True,False,True);
+ GenMedOrders_List.IsReadOnly := (True,True,True,True,True);
+ else AdmitOrders_List.IsReadOnly := (False,False,False);
+ GenMedOrders_List.IsReadOnly := (False,False,False,False,False);
+ CCMedOrders_List.IsReadOnly := (False,False,False,False,False,False);
+ endif;
+ endif; // multiordergrid 46
+
+
+// Mark meds to be ordered in combo when first med is selected (gen orders)
+If CallingField = "MultiOrderGrid|66" and CallingEvent = "FieldChange" Then
+
+ If true in GenMedOrders_List.IsSelected
+ Then
+
+//gen combo 1-2(selected)
+ If GenMedOrders_List.IsSelected [1] = true
+ Then
+ GenMedOrders_List.IsSelected := (True,True,False,False,False);
+ GenMedOrders_List.IsReadOnly := (False,True,True,True,True);
+ Endif;
+//gen combo 1-2( (unselected)
+ If (GenMedOrders_List.IsSelected [1] = False and GenMedOrders_List.IsSelected [2] = True)
+ Then
+ GenMedOrders_List.IsSelected := (False,False,False,False,False);
+ GenMedOrders_List.IsReadOnly := (False,False,False,False,False);
+
+ Endif;
+//gen combo 3-4(selected)
+ If GenMedOrders_List.IsSelected [3] = true
+ Then
+ GenMedOrders_List.IsSelected := (False,False,True,True,False);
+ GenMedOrders_List.IsReadOnly := (True,True,False,True,True);
+ Endif;
+// gen combo 3-4((unselected)
+ If (GenMedOrders_List.IsSelected [3] = False and GenMedOrders_List.IsSelected [4] = True)
+ Then
+ GenMedOrders_List.IsSelected := (False,False,False,False,False);
+ GenMedOrders_List.IsReadOnly := (False,False,False,False,False);
+
+ Endif;
+//item 5 (selected)
+ If GenMedOrders_List.IsSelected [5] = true
+ Then
+ GenMedOrders_List.IsSelected := (False,False,False,False,True);
+ GenMedOrders_List.IsReadOnly := (True,True,True,True,False);
+ Endif;
+// (unselected)
+
+ else
+ GenMedOrders_List.IsReadOnly := (False,False,False,False,False);
+ endif; // If true in GenMedOrders_List.IsSelected
+endif; //If CallingField = "MultiOrderGrid|66" and CallingEvent = "FieldChange" Then
+
+
+// Mark meds to be ordered in combo when first med is selected (gen orders)
+If CallingField = "MultiOrderGrid|67" and CallingEvent = "FieldChange" Then
+
+ If true in CCMedOrders_List.IsSelected
+ Then
+
+//CC combo 1-2(selected)
+ If CCMedOrders_List.IsSelected [1] = true
+ Then
+ CCMedOrders_List.IsSelected := (True,True,False,False,False,False);
+ CCMedOrders_List.IsReadOnly := (False,True,True,True,True,True);
+ Endif;
+//CC combo 1-2( (unselected)
+ If (CCMedOrders_List.IsSelected [1] = False and CCMedOrders_List.IsSelected [2] = True)
+ Then
+ CCMedOrders_List.IsSelected := (False,False,False,False,False,False);
+ CCMedOrders_List.IsReadOnly := (False,False,False,False,False,False);
+
+ Endif;
+//CC combo 3-4(selected)
+ If CCMedOrders_List.IsSelected [3] = true
+ Then
+ CCMedOrders_List.IsSelected := (False,False,True,True,False,False);
+ CCMedOrders_List.IsReadOnly := (True,True,False,True,True,True);
+ Endif;
+// CC combo 3-4((unselected)
+ If (CCMedOrders_List.IsSelected [3] = False and CCMedOrders_List.IsSelected [4] = True)
+ Then
+ CCMedOrders_List.IsSelected := (False,False,False,False,False,False);
+ CCMedOrders_List.IsReadOnly := (False,False,False,False,False,False);
+ Endif;
+// CC combo 5-6 (selected)
+ If CCMedOrders_List.IsSelected [5] = true
+ Then
+ CCMedOrders_List.IsSelected := (False,False,False,False,True,True);
+ CCMedOrders_List.IsReadOnly := (True,True,True,True,False,True);
+ Endif;
+// CC combo 5-6((unselected)
+ If (CCMedOrders_List.IsSelected [5] = False and CCMedOrders_List.IsSelected [6] = True)
+ Then
+ CCMedOrders_List.IsSelected := (False,False,False,False,False,False);
+ CCMedOrders_List.IsReadOnly := (False,False,False,False,False,False);
+ Endif;
+
+
+ else
+ CCMedOrders_List.IsReadOnly := (False,False,False,False,False,False);
+ endif; //If true in CCMedOrders_List.IsSelected
+endif; //If CallingField = "MultiOrderGrid|67" and CallingEvent = "FieldChange" Then
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_COMMON_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_COMMON_ORDERS.mlm
new file mode 100644
index 0000000..aa0af88
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_COMMON_ORDERS.mlm
@@ -0,0 +1,660 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_SET_ED_Common_Orders;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in Blood Formation Coagulation Order Set
+ ;;
+
+ explanation: This MLM is called from the Blood Formation Coagulation With heparin order set
+
+
+
+ Change history
+
+ 03.25.2009 DW Added session object code to recall the answer to the pregnancy questions and populate them on other forms during the session
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 11.24.2010 DW Altered to enter escort order if MI item with the escort class has been selected
+ 07.20.2011 TMS Added handling for additional instruction in orderset
+ 06.20.2012 TMS Added additional call to FORM_MEDICAL_IMAGING_INDICATIONS_FOR_OS{{{SINGLE-QUOTE}}} on form open to retrieve diabetic health issues and
+ iodine allergies to autopopulate questions on order set form when found. CSR 22904
+ 02.09.2015 TMS Commented out references to Spontaneous Aerosol paging to support new process using transmission policies. CSR 33099
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+ ;;
+ keywords: Called MLMs, Blood Formation , ED
+ ;;
+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:="";
+
+
+ // Use String parse
+ 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;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+//--------------------------------------------------------------------------
+ local_session := cds_session.local;
+//--------------------------------------------------------------------------
+
+Pregnancy_History := last of (field_list where field_list.DataItemName = "MI_LV_MI Yes No Pregnacy" and field_List.Control_MultiFieldOccNum = 1);
+indications1 := last of (field_list where field_list.DataItemName = "ED_MI_ClinInd1" and field_List.Control_MultiFieldOccNum = 1 );
+indications2 := last of (field_list where field_list.DataItemName = "ED_MI_ClinInd2" and field_List.Control_MultiFieldOccNum = 1 );
+
+ comb_ht_wt_fld := first of (field_list
+ where field_list.DataItemName = "CombinedMeasurements");
+
+///////////////// Lab base lines
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 14);
+ Labs_List := Labs_fld.Value;
+
+ //Find the three checkboxes that may need to be ordered with this protocol
+ Found_Base_CBC:= first of (Labs_list where Labs_list.Name = "CBC (Includes Diff)");
+ Found_Base_INR:= first of (Labs_list where Labs_list.Name = "Prothrombin/INR");
+ Found_Base_APTT:= first of (Labs_list where Labs_list.Name = "APTT");
+
+
+ CheckAPTT:=False;
+ CheckCBC:=False;
+ CheckINR:=False;
+//////////////////////////////// Nursing notes
+ Mlt_Order_Line:= first of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Mlt_List := Mlt_Order_Line.Value;
+
+/////////////////////////// Protocol quick select check boxes, only one enables at a time.
+ Card_Prot_W_Bolus := first of (field_list where field_list.DataItemName = "PRX_Heparin_CCM_withBolus");
+ Card_Prot_N_Bolus := first of (field_list where field_list.DataItemName = "PRX_Heparin_CCM_w-oBolus");
+ Weight_Prot_W_Bolus := first of (field_list where field_list.DataItemName = "PRX_Heparin_WB_withBolus");
+ Weight_Prot_N_Bolus := first of (field_list where field_list.DataItemName = "PRX_Heparin_WB_w-oBolus");
+
+
+
+///////////////// Cardiac Protocol With Bolus Grid
+ CP_WB_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 7);
+ CP_WB_List :=CP_WB_Grid.Value;
+ Fnd_CP_WB := first of (CP_WB_List where CP_WB_List.Name = "Heparin Inj.");
+ Fnd_CP_WB.IsReadOnly := True;
+
+///////////// Cardiac Protocol With No Bolus Grid
+ CP_NB_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 8);
+ CP_NB_List :=CP_NB_Grid.Value;
+ Fnd_CP_NB := first of (CP_NB_List where CP_NB_List.Name = "Heparin 25,000 Units+ D5W 500ml");
+ Fnd_CP_NB.IsReadOnly := True;
+
+/////////////Weight based protocol with bolus Grid
+ WP_WB_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 9);
+ WP_WB_List :=WP_WB_Grid.Value;
+ Fnd_WP_WB := first of (WP_WB_List where WP_WB_List.Name = "Heparin Inj -");
+ Fnd_WP_WB.IsReadOnly := True;
+
+///////////// Weight based protocol with no bolus Grid
+ WP_NB_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 10);
+ WP_NB_List :=WP_NB_Grid.Value;
+ Fnd_WP_NB := first of (WP_NB_List where WP_NB_List.Name = "Heparin 25,000 Units + D5W 500ml");
+ Fnd_WP_NB.IsReadOnly := True;
+
+/////////////////////////Lab daily orders
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 11);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+////////////// Lab daily reminder orders
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 12);
+
+ Lab_Rem_List := Lab_Rem.Value;
+
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+/////////////////////// Comment section to hold list of CBC per associated to the grid
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+
+//////////// Order from and two summary, mapped to daily order reminders
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+// 2.9.2015 removed logic for respiratory page - replaced with new process - TMS
+/////////////// Respiratory Page Fields
+ //Associate Mapped Fields
+/*
+ SpecInst_fld := last of (field_list where field_list.DataItemName = "SpecialInstructions");
+
+ //*** Get values from First grid
+ //*** SA (Albuterol/Atrovent/Xopenex)
+
+ SAAAX_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ SAAAX_list :=SAAAX_fld.Value;
+ SAAAX_Sel :=SAAAX_list.IsSelected;
+
+ ED_Resp_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 5);
+ ED_Resp_List := ED_Resp_fld.Value;
+
+ ED_Resp_Ord := first of (ED_Resp_List where ED_Resp_List .Name = "ED Respiratory Page");
+
+*/
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "PRX_Heparin_CCM_withBolus|1" then
+
+ If Card_Prot_W_Bolus.Value = True
+ then
+ Card_Prot_N_Bolus.control_read_only := True;
+ Weight_Prot_W_Bolus.control_read_only := True;
+ Weight_Prot_N_Bolus.control_read_only := True;
+ Fnd_CP_WB.IsSelected := True;
+ Fnd_CP_NB.IsSelected := True;
+ Mlt_List.IsSelected := (True,False,True,True,True,True,True,True,True);
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+ Fnd_Daily.IsSelected := True;
+
+
+ else
+ Card_Prot_N_Bolus.control_read_only := False;
+ Weight_Prot_W_Bolus.control_read_only := False;
+ Weight_Prot_N_Bolus.control_read_only := False;
+ Fnd_CP_WB.IsSelected := False;
+ Fnd_CP_NB.IsSelected := False;
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False,False);
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+
+
+ endif;
+ elseif CallingField = "PRX_Heparin_CCM_w-oBolus|1" then
+ If Card_Prot_N_Bolus.Value = True
+ then
+ Card_Prot_W_Bolus.control_read_only := True;
+ Weight_Prot_W_Bolus.control_read_only := True;
+ Weight_Prot_N_Bolus.control_read_only := True;
+ Fnd_CP_NB.IsSelected := True;
+ Mlt_List.IsSelected := (True,False,True,True,True,True,True,True,True);
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+ Fnd_Daily.IsSelected := True;
+
+ else
+ Card_Prot_W_Bolus.control_read_only := False;
+ Weight_Prot_W_Bolus.control_read_only := False;
+ Weight_Prot_N_Bolus.control_read_only := False;
+ Fnd_CP_NB.IsSelected := False;
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False,False);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+ elseif CallingField = "PRX_Heparin_WB_withBolus|1" then
+ If Weight_Prot_W_Bolus.Value = True
+ then
+ Card_Prot_W_Bolus.control_read_only := True;
+ Card_Prot_N_Bolus.control_read_only := True;
+ Weight_Prot_N_Bolus.control_read_only := True;
+ Fnd_WP_WB.IsSelected:=True;
+ Fnd_WP_NB.IsSelected:=True;
+ Mlt_List.IsSelected := (False,True,True,True,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+ Fnd_Daily.IsSelected := True;
+ else
+ Card_Prot_W_Bolus.control_read_only := False;
+ Card_Prot_N_Bolus.control_read_only := False;
+ Weight_Prot_N_Bolus.control_read_only := False;
+ Fnd_WP_WB.IsSelected:=False;
+ Fnd_WP_NB.IsSelected:=False;
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False,False);
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+ elseif CallingField = "PRX_Heparin_WB_w-oBolus|1" then
+ If Weight_Prot_N_Bolus.Value = True
+ then
+ Card_Prot_W_Bolus.control_read_only := True;
+ Card_Prot_N_Bolus.control_read_only := True;
+ Weight_Prot_W_Bolus.control_read_only := True;
+ Fnd_WP_NB.IsSelected:=True;
+ Mlt_List.IsSelected := (False,True,True,True,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+ Fnd_Daily.IsSelected := True;
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You have selected {{{SINGLE-QUOTE}}}Weight Based Protocol - No Bolus Dose{{{SINGLE-QUOTE}}}\n\n" ||
+ "If you do not wish to order a bolus dose – Select OK and continue,\n" ||
+ "If you intended to order the bolus dose:\n" ||
+ " - Select OK and “Weight Based Protocol – With Bolus Dose’";
+
+ this_communication.MessageType := "Error";
+
+ else
+ Card_Prot_W_Bolus.control_read_only := False;
+ Card_Prot_N_Bolus.control_read_only := False;
+ Weight_Prot_W_Bolus.control_read_only := False;
+ Fnd_WP_NB.IsSelected:=False;
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False,False);
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")"
+ ;
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+// Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+// 2.9.2015 removed logic for respiratory page - replaced with new process - TMS
+/*
+ elseif CallingField = "MultiOrderGrid|4" then
+
+
+
+ If (true in SAAAX_list.IsSelected) then
+
+ Albuterol_1 := Last(First 1 from SAAAX_Sel);
+ Albuterol_2 := Last(First 2 from SAAAX_Sel);
+ Albuterol_Atrovent_1 := Last(First 3 from SAAAX_Sel);
+ Atrovent_1 := Last(First 4 from SAAAX_Sel);
+ Atrovent_2 := Last(First 5 from SAAAX_Sel);
+ Xopenex_1 := Last(First 6 from SAAAX_Sel);
+ Xopenex_2 := Last(First 7 from SAAAX_Sel);
+
+ ListSA_text := "";
+
+ If (Albuterol_1 = True) or (Albuterol_2 = True) or (Albuterol_3 = True) then
+ ListSA_Text := ListSA_Text || "Albuterol, ";
+ endif;
+
+ If (Albuterol_Atrovent_1) = True then
+ ListSA_Text := ListSa_Text || "Albuterol /Atrovent, ";
+ endif;
+
+ IF (Atrovent_1 =True) or (Atrovent_2 = True) or (Atrovent_3=True) then
+ ListSA_Text := ListSA_Text || "Atrovent, ";
+ endif;
+
+ If (Xopenex_1 = True) or (Xopenex_2 = True) then
+ ListSA_Text := ListSA_Text || "Xopenex, ";
+ endif;
+
+ SpecInst_fld.Value := "SPONTANEOUS AEROSOL: " || ListSA_Text;
+ ED_Resp_Ord.IsSelected := True;
+ else
+ ED_Resp_Ord.IsSelected := False;
+ endif; //Respiratory page
+*/
+ endif;
+
+
+ elseif CallingEvent = "FormOpen" then
+
+ If local_session.has_received_order_worksheet_message <> FALSE then
+ Pregnancy_History.value := local_session.SessionPregnancyValue;
+ indications1.value := local_session.SessionIndications1;
+ indications2.value := local_session.SessionIndications2;
+
+// SessionIndications1Value
+
+
+ creatinine_calculator := mlm {{{SINGLE-QUOTE}}}FORM_Medical_Imaging_Indications_for_OS{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call creatinine_calculator with this_communication, this_form, client_info_obj;
+ endif;
+
+ Mlt_List.IsReadOnly := (True,True,True,True,True,True,True,True);
+ // Mlt_List.IsSelected := (True,True,True,True,True,True,True);
+
+ If primreqdate.value = "T+1" then primreqdate.value := (now as time) +1 day; endif;
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ Lab_Daily_List.IsReadOnly:= (False,True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+
+// Add call to Indications MLM
+ MedImageInd := MLM {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING_INDICATIONS_FOR_OS{{{SINGLE-QUOTE}}};
+ IndMLM := call MedImageInd with (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) ;
+
+
+
+ elseif CallingEvent = "FormClose" then
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ Escort_MLM := mlm {{{SINGLE-QUOTE}}}Form_Func_Escort_Order{{{SINGLE-QUOTE}}};
+ EscortQuestion := call Escort_MLM with this_form,this_communication;
+
+
+ local_session.SessionIndications1:= indications1.value;
+ local_session.SessionIndications2:= indications2.value;
+ local_session.SessionPregnancyValue := Pregnancy_History.value;
+
+
+if Pregnancy_History.value is null then Pregnancy_History.value := local_session.SessionPregnancyValue; endif; // carry forward from form to os
+
+if local_session.has_received_order_worksheet_message = FALSE then local_session.has_received_order_worksheet_message := TRUE; else; endif;
+
+
+ If (Card_Prot_W_Bolus.Value = True) or (Card_Prot_N_Bolus.Value = True) or
+ (Weight_Prot_W_Bolus.Value = True) or (Weight_Prot_N_Bolus.Value = True) then
+
+ comb_ht_wt_val := comb_ht_wt_fld.Value;
+
+ wt := comb_ht_wt_val.weight;
+
+
+ if (wt is null) or (wt = 0) then
+
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "To Complete The Heparin Protocol:\n\n Please Enter A Weight For This Patient";
+ this_communication.MessageType := "Error";
+ else
+
+ If (Found_Base_CBC.IsSelected =false) or (Found_Base_INR.IsSelected = false) or (Found_Base_APTT.IsSelected= false) then
+
+ If Found_Base_CBC.ISSelected = False then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists CBC_Val then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_Base_CBC.ISSelected :=True;
+ endif;
+
+ endif;
+
+// Now for INR
+
+ If Found_Base_INR.ISSelected = False then
+
+ INR_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists INR_Val then
+ CheckINR:=False;
+ else
+ Found_Base_INR.ISSelected :=True;
+ CheckINR:=True;
+ endif;
+
+ endif;
+
+// Now for APTT
+
+ If Found_Base_APTT.ISSelected = False then
+
+ APTT_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists APTT_Val then
+ CheckAPTT:=False;
+ else
+ Found_Base_APTT.ISSelected :=True;
+ CheckAPTT:=True;
+ endif;
+
+ endif;
+
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+
+ singledate := formlist[J];
+
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+
+
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
+
+
+ endif; //If exist
+
+
+ endif; // one of four values = true
+
+// 2.9.2015 removed logic for respiratory page - replaced with new process - TMS
+ //marker for ed respiratory page data note, grid needs at least one true to do this logic
+/*
+ If (true in SAAAX_list.IsSelected) then
+
+ Albuterol_1 := Last(First 1 from SAAAX_Sel);
+ Albuterol_2 := Last(First 2 from SAAAX_Sel);
+ Albuterol_Atrovent_1 := Last(First 3 from SAAAX_Sel);
+ Atrovent_1 := Last(First 4 from SAAAX_Sel);
+ Atrovent_2 := Last(First 5 from SAAAX_Sel);
+ Xopenex_1 := Last(First 6 from SAAAX_Sel);
+ Xopenex_2 := Last(First 7 from SAAAX_Sel);
+
+ ListSA_text := "";
+
+ If (Albuterol_1 = True) or (Albuterol_2 = True) or (Albuterol_3 = True) then
+ Spontaneous:=True;
+ ListSA_Text := ListSA_Text || "Albuterol, ";
+ endif;
+
+ If (Albuterol_Atrovent_1) = True then
+ Spontaneous := True;
+ ListSA_Text := ListSa_Text || "Albuterol /Atrovent, ";
+ endif;
+
+ IF (Atrovent_1 =True) or (Atrovent_2 = True) or (Atrovent_3=True) then
+ Spontaneous:=True;
+ ListSA_Text := ListSA_Text || "Atrovent, ";
+ endif;
+
+ If (Xopenex_1 = True) or (Xopenex_2 = True) then
+ Spontaneous := True;
+ ListSA_Text := ListSA_Text || "Xopenex, ";
+ endif;
+
+ SpecInst_fld.Value := "SPONTANEOUS AEROSOL: " || ListSA_Text;
+
+ endif; //Respiratory page
+*/
+ endif; // If checked
+ endif; // wt is null
+ endif; // calling event
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_DYSPNEA_RESPIRATORY.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_DYSPNEA_RESPIRATORY.mlm
new file mode 100644
index 0000000..c924874
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_DYSPNEA_RESPIRATORY.mlm
@@ -0,0 +1,146 @@
+maintenance:
+
+ title: ED Dyspnea Respiratory Page Mapping;;
+ mlmname: FORM_Set_ED_Dyspnea_Respiratory;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair ED Respiratory;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Lisa Hancher, Eclipsys Corp ext PINT;;
+ date: 2008-03-17;;
+ validation: testing;;
+
+library:
+ purpose: When user selects items on an order set, fill in a summary line (special instructions)
+ This field is to be mapped to one on the pager form.
+ This MLM will then fill in the data based on the selected checkboxes, having the interface only need to
+ look at the data within the pager form (not every order in the set)
+
+ ;;
+
+ explanation: This MLM is called from the ED Dyspnea Order Set (ED_Rx Dyspnea) on form close
+
+ ;;
+ keywords: Called MLMs, Respiratory ORder Set, ED
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid:=this_communication.ClientGUID;
+ ClientChartGUID:=this_communication.ChartGUID;
+
+ //Associate Mapped Fields
+ SponAer_fld := last of (field_list where field_list.DataItemName = "Spontaneous Aerosol");
+ SponAerAtro_fld := last of (field_list where field_list.DataItemName ="Spontaneous Aerosol Atrovent");
+ SponAerAtr_fld := last of (field_list where field_list.DataItemName = "Spontaneous Aerosol DuoNeb");
+ SponAerRac_fld := last of (field_list where field_list.DataItemName = "Spontaneous Aerosol Racepinephrine");
+ Bronch10_Fld := last of (field_list where field_list.DataItemName = "Cont. Bronchodilator Albuterol 10mg/hr");
+ Bronch15_Fld := last of (field_list where field_list.DataItemName = "Cont. Bronchodilator Albuterol 15mg/hr");
+
+ //*** Get the ED Page Values from Grid
+ // Note: If ED Page has not been selected, blank out all order set mapped check boxes
+ // This way the child form of ED Page does not have data within it.
+
+ RespPage_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 7);
+ RespPage_list :=RespPage_fld.Value;
+ RespPage_Sel :=RespPage_list.IsSelected;
+
+ //*** Get the Respiratory Values From Grid
+ RespPage_Val := Last (First 1 From RespPage_Sel);
+
+ If RespPage_Val=False Then
+ SponAer_fld.Value := False;
+ SponAerAtro_fld .Value := False;
+ SponAerAtr_fld.Value := False;
+ SponAerRac_Fld.Value :=False;
+ Bronch10_Fld.Value := False;
+ Bronch15_Fld.Value := False;
+ Else
+
+
+ RespGrid_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 5);
+ RespGrid_list :=RespGrid_fld.Value;
+ RespGrid_Sel :=RespGrid_list.IsSelected;
+
+
+ Albuterol:= Last (First 1 from RespGrid_Sel);
+ Atrovent:= Last (First 2 from RespGrid_Sel);
+ AlbuterolAtrovent:= Last (First 3 from RespGrid_Sel);
+ RacePine:= Last (First 4 from RespGrid_Sel);
+ Bron10 := Last (First 5 From RespGrid_Sel);
+ Bron15 := Last (First 6 From RespGrid_Sel);
+
+ //*** Now set the mapped fields
+ SponAer_fld.Value := Albuterol;
+ SponAerAtro_fld .Value := Atrovent;
+ SponAerAtr_fld.Value := AlbuterolAtrovent;
+ SponAerRac_Fld.Value :=RacePine;
+ Bronch10_Fld.Value := Bron10;
+ Bronch15_Fld.Value := Bron15;
+ Endif;
+
+
+
+
+/* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "RespValue Is " || RespPage_Val || "n" ||
+ "Aerosol Selected is " || Aerosols_Sel || "\n" ||
+ " Albuterol is set to " || Albuterol || "\n" ||
+ " Albuterol Atrovent is set to " || AlbuterolAtrovent || "\n" ||
+ " RacePine is set to " || RacePine || "\n" || "\n" ||
+ "Broncho Selected is " || Broncho_Sel || "\n" ||
+ " Bronch 10 is set to " || Bron10 || "\n" ||
+ " Bronch 15 is set to " || Bron15 || "\n" || "\n" ||
+ "Educate Selects is " || EDucate_Sel || "\n" ||
+ " Educate MDI is set to " || EducateMDI || "\n" ||
+ " Educate Incentive is " || EducateINC || "\n" || "\n" ||
+ "Mapped Field Values Are " || "\n" ||
+ " SponAer is " || SponAer_fld.value || "\n" ||
+ " SponAerAtr is " || SponAerAtr_fld.Value || "\n" ||
+ " SponAerRac is " || SponAerRac_Fld.Value || "\n" ||
+ " Bronch10 is " || Bronch10_Fld.Value || "\n" ||
+ " Bronch15 is " || Bronch15_Fld.Value || "\n" ||
+ " MDI is " || MDI_fld.Value || "\n" ||
+ " Incent is " || Incent_fld.Value;
+ this_communication.MessageType := "Informational";
+*/
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESPIRATORY.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESPIRATORY.mlm
new file mode 100644
index 0000000..320048b
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESPIRATORY.mlm
@@ -0,0 +1,149 @@
+maintenance:
+
+ title: Lab Stool Culture on Order Set Must Order Shiga Toxin 1 and 2;;
+ mlmname: FORM_Set_ED_Respiratory;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair ED Respiratory;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Lisa Hancher, Eclipsys Corp ext PINT;;
+ date: 2008-03-17;;
+ validation: testing;;
+
+library:
+ purpose: When user selects items on an order set, fill in a summary line (special instructions)
+ This field is to be mapped to one on the pager form.
+ This MLM will then fill in the data based on the selected checkboxes, having the interface only need to
+ look at the data within the pager form (not every order in the set)
+
+ ;;
+
+ explanation: This MLM is called from the ED Respiratory Order Set (ED_Respiratory)
+
+ ;;
+ keywords: Called MLMs, Respiratory ORder Sert, ED
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid:=this_communication.ClientGUID;
+ ClientChartGUID:=this_communication.ChartGUID;
+
+ //Associate Mapped Fields
+ SponAer_fld := last of (field_list where field_list.DataItemName = "Spontaneous Aerosol");
+ SponAerAtro_fld := last of (field_list where field_list.DataItemName ="Spontaneous Aerosol Atrovent");
+ SponAerAtr_fld := last of (field_list where field_list.DataItemName = "Spontaneous Aerosol DuoNeb");
+ SponAerRac_fld := last of (field_list where field_list.DataItemName = "Spontaneous Aerosol Racepinephrine");
+ Bronch10_Fld := last of (field_list where field_list.DataItemName = "Cont. Bronchodilator Albuterol 10mg/hr");
+ Bronch15_Fld := last of (field_list where field_list.DataItemName = "Cont. Bronchodilator Albuterol 15mg/hr");
+ MDI_fld := last of (field_list where field_list.DataItemName = "MDI Instruction");
+ Incent_fld := last of (field_list where field_list.DataItemName = "Incentive Spirometry Instruction");
+
+ //*** Get the Aerosols Values From Grid
+
+ Aerosols_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Aerosols_list :=Aerosols_fld.Value;
+ Aerosols_Sel :=Aerosols_list.IsSelected;
+
+
+ Albuterol:= Last (First 1 from Aerosols_Sel);
+ Atrovent:= Last (First 2 from Aerosols_Sel);
+ AlbuterolAtrovent:= Last (First 3 from Aerosols_Sel);
+ RacePine:= Last (First 4 from Aerosols_Sel);
+
+
+ //*** Get the Bronchodilator Values from Grid
+ Broncho_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 6);
+ Broncho_list :=Broncho_fld.Value;
+ Broncho_Sel :=Broncho_list.IsSelected;
+
+ Bron10 := Last (First 1 From Broncho_Sel);
+ Bron15 := Last (First 2 From Broncho_Sel);
+
+
+ //*** Get the Education Values from Grid
+ Educate_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Educate_list :=Educate_fld.Value;
+ Educate_Sel :=Educate_list.IsSelected;
+
+ EducateMDI := Last (First 1 From Educate_Sel);
+ EducateInc:= Last (First 2 From Educate_Sel);
+
+ //*** Now set the mapped fields
+ SponAer_fld.Value := Albuterol;
+ SponAerAtro_fld .Value := Atrovent;
+ SponAerAtr_fld.Value := AlbuterolAtrovent;
+ SponAerRac_Fld.Value :=RacePine;
+ Bronch10_Fld.Value := Bron10;
+ Bronch15_Fld.Value := Bron15;
+ MDI_fld.Value := EducateMDI;
+ Incent_fld.Value := EducateInc;
+
+
+
+
+/* Debugging Messages
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Aerosol Selected is " || Aerosols_Sel || "\n" ||
+ " Albuterol is set to " || Albuterol || "\n" ||
+ " Albuterol Atrovent is set to " || AlbuterolAtrovent || "\n" ||
+ " RacePine is set to " || RacePine || "\n" || "\n" ||
+ "Broncho Selected is " || Broncho_Sel || "\n" ||
+ " Bronch 10 is set to " || Bron10 || "\n" ||
+ " Bronch 15 is set to " || Bron15 || "\n" || "\n" ||
+ "Educate Selects is " || EDucate_Sel || "\n" ||
+ " Educate MDI is set to " || EducateMDI || "\n" ||
+ " Educate Incentive is " || EducateINC || "\n" || "\n" ||
+ "Mapped Field Values Are " || "\n" ||
+ " SponAer is " || SponAer_fld.value || "\n" ||
+ " SponAerAtr is " || SponAerAtr_fld.Value || "\n" ||
+ " SponAerRac is " || SponAerRac_Fld.Value || "\n" ||
+ " Bronch10 is " || Bronch10_Fld.Value || "\n" ||
+ " Bronch15 is " || Bronch15_Fld.Value || "\n" ||
+ " MDI is " || MDI_fld.Value || "\n" ||
+ " Incent is " || Incent_fld.Value;
+
+ this_communication.MessageType := "Informational";
+*/
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESPIRATORY_DYSP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESPIRATORY_DYSP.mlm
new file mode 100644
index 0000000..2a5e578
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESPIRATORY_DYSP.mlm
@@ -0,0 +1,266 @@
+maintenance:
+
+ title: ED Respiratory Page Mapping Dyspnea Grids;;
+ mlmname: FORM_Set_ED_Respiratory_Dysp;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair ED Respiratory;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Lisa Hancher, Eclipsys Corp ext PINT;;
+ date: 2008-03-17;;
+ validation: testing;;
+
+library:
+ purpose: When user selects items on an order set, fill in a summary line (special instructions)
+ This field is to be mapped to one on the pager form.
+ This MLM will then fill in the data based on the selected checkboxes, having the interface only need to
+ look at the data within the pager form (not every order in the set)
+
+ ;;
+
+ explanation: This MLM is called from the ED Dyspnea Order Set (ED_Dyspnea), on change and close
+
+ Change history
+
+ 06.24.2010 DW Added code for 2 new orderset items
+ 07.26.2017 AnkitM CSR 33723: Changed all wording from {{{SINGLE-QUOTE}}}Xopenex{{{SINGLE-QUOTE}}} to {{{SINGLE-QUOTE}}}Levalbuterol{{{SINGLE-QUOTE}}}
+ 07.26.2017 AnkitM CSR 33723: Changed "Levalbuterol 10 mg/hr" to "Levalbuterol 5 mg/hr" and "Levalbuterol 15 mg/hr" to "Levalbuterol 7.5 mg/hr" as per asked by Robert.
+ ;;
+ keywords: Called MLMs, Dyspnea Order Set, ED
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid:=this_communication.ClientGUID;
+ ClientChartGUID:=this_communication.ChartGUID;
+
+ //Associate Mapped Fields
+ SpecInst_fld := last of (field_list where field_list.DataItemName = "SpecialInstructions");
+
+
+
+
+
+
+ //*** Get values from First grid
+ //*** SA (Albuterol/Atrovent/Xopenex)
+
+ SAAAX_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 11);
+ SAAAX_list :=SAAAX_fld.Value;
+ SAAAX_Sel :=SAAAX_list.IsSelected;
+
+ Albuterol_1 := Last(First 1 from SAAAX_Sel);
+ Albuterol_2 := Last(First 2 from SAAAX_Sel);
+ Albuterol_Atrovent_1 := Last(First 3 from SAAAX_Sel);
+ Atrovent_1 := Last(First 4 from SAAAX_Sel);
+ Atrovent_2 := Last(First 5 from SAAAX_Sel);
+ Levalbuterol_1 := Last(First 6 from SAAAX_Sel);
+ Levalbuterol_2 := Last(First 7 from SAAAX_Sel);
+
+
+ //*** Get values from 2nd grid
+ //*** SA (Racepinephrine/Pulmicort)
+
+ SARP_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 13);
+ SARP_list :=SARP_fld.Value;
+ SARP_Sel :=SARP_list.IsSelected;
+
+ Race_1 := Last(First 1 from SARP_Sel);
+ Pulm_1 := Last(First 2 from SARP_Sel);
+ Pulm_2 := Last(First 3 from SARP_Sel);
+
+ //*** Get values from 3rd grid
+ //*** Spontaneous Aerosol Unspecified Dose
+
+ SAUD_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 12);
+ SAUD_list :=SAUD_fld.Value;
+ SAUD_Sel :=SAUD_list.IsSelected;
+
+ Albuterol_3 := Last(First 1 From SAUD_Sel);
+ Atrovent_3 := Last(First 2 From SAUD_Sel);
+ Lidocaine_1 := Last(First 3 From SAUD_Sel);
+ Mucomyst_1 := Last(First 4 From SAUD_Sel);
+
+
+ //*** Get values from 4th grid
+ //*** Continuous Bronchodilators
+
+ CB_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 22);
+ CB_list :=CB_fld.Value;
+ CB_Sel :=CB_list.IsSelected;
+
+ CB_Alb_10mg := Last(First 1 From CB_Sel);
+ CB_Alb_15mg := Last(First 2 From CB_Sel);
+ CB_Atr_1mg := Last(First 3 From CB_Sel);
+ CB_Xop_10mg := Last(First 4 From CB_Sel);
+ CB_Xop_15mg := Last(First 5 From CB_Sel);
+ CB_AlbAt_10mg := Last(First 6 From CB_Sel);
+ CB_AlbAt_15mg := Last(First 7 From CB_Sel);
+
+ ListSA_Text:="";
+ ListCB_Text:="";
+
+ Spec_All_Text :="";
+
+ // Now make the special instructions used for the beeper.
+
+ // SPONTANEOUS AEROSOLS
+
+ If (Albuterol_1 = True) or (Albuterol_2 = True) or (Albuterol_3 = True) then
+ Spontaneous:=True;
+ ListSA_Text := ListSA_Text || "Albuterol, ";
+ endif;
+
+ If (Albuterol_Atrovent_1) = True then
+ Spontaneous := True;
+ ListSA_Text := ListSa_Text || "Albuterol /Atrovent, ";
+ endif;
+
+ IF (Atrovent_1 =True) or (Atrovent_2 = True) or (Atrovent_3=True) then
+ Spontaneous:=True;
+ ListSA_Text := ListSA_Text || "Atrovent, ";
+ endif;
+
+ If (Levalbuterol_1 = True) or (Levalbuterol_2 = True) then
+ Spontaneous := True;
+ ListSA_Text := ListSA_Text || "Levalbuterol, ";
+ endif;
+
+ IF (Race_1 = True) then
+ Spontaneous := True;
+ ListSA_Text := ListSA_Text || "Racepinephrine, ";
+ endif;
+
+ IF (Pulm_1 = True) or (Pulm_2 =True) then
+ SPontaneous := True;
+ ListSA_Text := ListSA_Text || "Pulmicort, ";
+ endif;
+
+ If (Lidocaine_1 = True) then
+ SPontaneous := True;
+ ListSA_Text := ListSA_Text || "Lidocaine, ";
+ endif;
+
+ If (Mucomyst_1 = True) then
+ SPontaneous := True;
+ ListSA_Text := ListSA_Text || "Mucomyst, ";
+ endif;
+
+ // CONTINUOUS BRONCHODILATORS
+
+ If (CB_Alb_10mg) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Albuterol 10 mg/hr, ";
+ endif;
+
+ If (CB_Alb_15mg ) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Albuterol 15 mg/hr, ";
+ endif;
+
+ If (CB_Atr_1mg) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Atrovent 1 mg/hr, ";
+ endif;
+
+ If (CB_Xop_10mg ) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Levalbuterol 5 mg/hr, ";
+ endif;
+
+ If (CB_Xop_15mg ) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Levalbuterol 7.5 mg/hr, ";
+ endif;
+
+ If (CB_AlbAt_10mg ) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Albuterol 10 mg / Atrovent 1mg/hr, ";
+ endif;
+
+ If (CB_AlbAt_15mg ) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Albuterol 15 mg / Atrovent 1mg/hr, ";
+ endif;
+
+
+ If Spontaneous = True then
+ Spec_All_Text := Spec_All_Text || "SPONTANEOUS AEROSOL: " || ListSA_Text;
+ endif;
+
+ If ContBronc = True then
+ Spec_All_Text := Spec_All_Text || "CONT. BRONCHODILATOR: " || ListCB_Text;
+ endif;
+
+ SpecInst_fld.Value := Spec_All_Text;
+
+ //Now set the ed respiratory page, changed 06/17 to deselect if spont and cont. not selected
+
+ EDResp_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 7);
+
+ EDResp_list :=EDResp_fld.Value;
+
+ If (Spontaneous = True) or (ContBronc=True) then
+
+ EDResp_list.IsSelected := True;
+ Else
+ EDResp_List.IsSelected := False;
+ endif;
+
+
+
+/* Debugging Messages
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Grid one is " || Albuterol_1 || ", " ||
+ Albuterol_2 || ", " ||
+ Albuterol_Atrovent_1|| ", " ||
+ Atrovent_1|| ", " ||
+ Atrovent_2|| ", " ||
+ Xopenex_1 || ", " ||
+ Xopenex_2 ;
+ this_communication.MessageType := "Informational";
+
+*/
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESPIRATORY_MANY.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESPIRATORY_MANY.mlm
new file mode 100644
index 0000000..6a37022
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESPIRATORY_MANY.mlm
@@ -0,0 +1,270 @@
+maintenance:
+
+ title: ED Respiratory Page Mapping Many Grids;;
+ mlmname: FORM_Set_ED_Respiratory_Many;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair ED Respiratory;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Lisa Hancher, Eclipsys Corp ext PINT;;
+ date: 2008-03-17;;
+ validation: testing;;
+
+library:
+ purpose: When user selects items on an order set, fill in a summary line (special instructions)
+ This field is to be mapped to one on the pager form.
+ This MLM will then fill in the data based on the selected checkboxes, having the interface only need to
+ look at the data within the pager form (not every order in the set)
+
+ ;;
+
+ explanation: This MLM is called from the ED Respiratory Order Set (ED_Respiratory)
+
+ Change history
+
+ 06.24.2010 DW Added code for 2 new orderset items
+ 07.26.2017 AnkitM CSR 33723: Changed wording from {{{SINGLE-QUOTE}}}Xopenex{{{SINGLE-QUOTE}}} to {{{SINGLE-QUOTE}}}Levalbuterol{{{SINGLE-QUOTE}}}
+ 07.26.2017 AnkitM CSR 33723: Changed "Levalbuterol 10 mg/hr" to "Levalbuterol 5 mg/hr" and "Levalbuterol 15 mg/hr" to "Levalbuterol 7.5 mg/hr" as per asked by Robert.
+ ;;
+ keywords: Called MLMs, Respiratory ORder Sert, ED
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid:=this_communication.ClientGUID;
+ ClientChartGUID:=this_communication.ChartGUID;
+
+ //Associate Mapped Fields
+ SpecInst_fld := last of (field_list where field_list.DataItemName = "SpecialInstructions");
+
+
+
+
+
+
+ //*** Get values from First grid
+ //*** SA (Albuterol/Atrovent/Xopenex)
+
+ SAAAX_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ SAAAX_list :=SAAAX_fld.Value;
+ SAAAX_Sel :=SAAAX_list.IsSelected;
+
+ Albuterol_1 := Last(First 1 from SAAAX_Sel);
+ Albuterol_2 := Last(First 2 from SAAAX_Sel);
+ Albuterol_Atrovent_1 := Last(First 3 from SAAAX_Sel);
+ Atrovent_1 := Last(First 4 from SAAAX_Sel);
+ Atrovent_2 := Last(First 5 from SAAAX_Sel);
+ Levalbuterol_1 := Last(First 6 from SAAAX_Sel);
+ Levalbuterol_2 := Last(First 7 from SAAAX_Sel);
+
+
+ //*** Get values from 2nd grid
+ //*** SA (Racepinephrine/Pulmicort)
+
+ SARP_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 12);
+ SARP_list :=SARP_fld.Value;
+ SARP_Sel :=SARP_list.IsSelected;
+
+ Race_1 := Last(First 1 from SARP_Sel);
+ Pulm_1 := Last(First 2 from SARP_Sel);
+ Pulm_2 := Last(First 3 from SARP_Sel);
+
+ //*** Get values from 3rd grid
+ //*** Spontaneous Aerosol Unspecified Dose
+
+ SAUD_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 8);
+ SAUD_list :=SAUD_fld.Value;
+ SAUD_Sel :=SAUD_list.IsSelected;
+
+ Albuterol_3 := Last(First 1 From SAUD_Sel);
+ Atrovent_3 := Last(First 2 From SAUD_Sel);
+ Lidocaine_1 := Last(First 3 From SAUD_Sel);
+ Mucomyst_1 := Last(First 4 From SAUD_Sel);
+
+
+ //*** Get values from 4th grid
+ //*** Continuous Bronchodilators
+
+ CB_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 6);
+ CB_list :=CB_fld.Value;
+ CB_Sel :=CB_list.IsSelected;
+
+ CB_Alb_10mg := Last(First 1 From CB_Sel);
+ CB_Alb_15mg := Last(First 2 From CB_Sel);
+ CB_Atr_1mg := Last(First 3 From CB_Sel);
+ CB_Xop_10mg := Last(First 4 From CB_Sel);
+ CB_Xop_15mg := Last(First 5 From CB_Sel);
+ CB_AlbAt_10mg := Last(First 6 From CB_Sel);
+ CB_AlbAt_15mg := Last(First 7 From CB_Sel);
+
+ //*** Get values from 5th grid
+ //*** Edumecation / Instruction
+
+ Edumecate_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Edumecate_list :=Edumecate_fld.Value;
+ Edumecate_Sel :=Edumecate_list.IsSelected;
+
+
+ Ed_Inst_1 := Last(First 1 from Edumecate_Sel);
+ Ed_Inst_2 := Last(First 2 from Edumecate_Sel);
+
+ ListSA_Text:="";
+ ListCB_Text:="";
+
+ Spec_All_Text :="";
+
+ // Now make the special instructions used for the beeper.
+
+ // SPONTANEOUS AEROSOLS
+
+ If (Albuterol_1 = True) or (Albuterol_2 = True) or (Albuterol_3 = True) then
+ Spontaneous:=True;
+ ListSA_Text := ListSA_Text || "Albuterol, ";
+ endif;
+
+ If (Albuterol_Atrovent_1) = True then
+ Spontaneous := True;
+ ListSA_Text := ListSa_Text || "Albuterol /Atrovent, ";
+ endif;
+
+ IF (Atrovent_1 =True) or (Atrovent_2 = True) or (Atrovent_3=True) then
+ Spontaneous:=True;
+ ListSA_Text := ListSA_Text || "Atrovent, ";
+ endif;
+
+ If (Levalbuterol_1 = True) or (Levalbuterol_2 = True) then
+ Spontaneous := True;
+ ListSA_Text := ListSA_Text || "Levalbuterol, ";
+ endif;
+
+ IF (Race_1 = True) then
+ Spontaneous := True;
+ ListSA_Text := ListSA_Text || "Racepinephrine, ";
+ endif;
+
+ IF (Pulm_1 = True) or (Pulm_2 =True) then
+ SPontaneous := True;
+ ListSA_Text := ListSA_Text || "Pulmicort, ";
+ endif;
+
+ If (Lidocaine_1 = True) then
+ SPontaneous := True;
+ ListSA_Text := ListSA_Text || "Lidocaine, ";
+ endif;
+
+ If (Mucomyst_1 = True) then
+ SPontaneous := True;
+ ListSA_Text := ListSA_Text || "Mucomyst, ";
+ endif;
+
+ // CONTINUOUS BRONCHODILATORS
+
+ If (CB_Alb_10mg) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Albuterol 10 mg/hr, ";
+ endif;
+
+ If (CB_Alb_15mg ) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Albuterol 15 mg/hr, ";
+ endif;
+
+ If (CB_Atr_1mg) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Atrovent 1 mg/hr, ";
+ endif;
+
+ If (CB_Xop_10mg ) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Levalbuterol 5 mg/hr, ";
+ endif;
+
+ If (CB_Xop_15mg ) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Levalbuterol 7.5 mg/hr, ";
+ endif;
+
+
+ If (CB_AlbAt_10mg ) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Albuterol 10 mg / Atrovent 1mg/hr, ";
+ endif;
+
+ If (CB_AlbAt_15mg ) = True then
+ ContBronc :=True;
+ ListCB_Text := ListCB_Text || "Albuterol 15 mg / Atrovent 1mg/hr, ";
+ endif;
+
+
+ If Spontaneous = True then
+ Spec_All_Text := Spec_All_Text || "SPONTANEOUS AEROSOL: " || ListSA_Text;
+ endif;
+
+ If ContBronc = True then
+ Spec_All_Text := Spec_All_Text || "CONT. BRONCHODILATOR: " || ListCB_Text;
+ endif;
+
+ // Add EDUmeCATION INSTRUCTIONS
+
+ If (Ed_Inst_1 = True) or (Ed_Inst_2=True) then
+ Spec_All_Text := Spec_All_Text || "EDUCATION";
+ endif;
+
+ SpecInst_fld.Value := Spec_All_Text;
+
+
+/* Debugging Messages
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Grid one is " || Albuterol_1 || ", " ||
+ Albuterol_2 || ", " ||
+ Albuterol_Atrovent_1|| ", " ||
+ Atrovent_1|| ", " ||
+ Atrovent_2|| ", " ||
+ Xopenex_1 || ", " ||
+ Xopenex_2 ;
+ this_communication.MessageType := "Informational";
+
+*/
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESP_HYPERKALEMIA.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESP_HYPERKALEMIA.mlm
new file mode 100644
index 0000000..3303c2f
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_RESP_HYPERKALEMIA.mlm
@@ -0,0 +1,109 @@
+maintenance:
+
+ title: ED Respiratory Page Mapping Hyperkalemia Grids;;
+ mlmname: FORM_Set_ED_Resp_Hyperkalemia;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair ED Respiratory;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Lisa Hancher, Eclipsys Corp ext PINT;;
+ date: 2008-06-16;;
+ validation: testing;;
+
+library:
+ purpose: When user selects items on an order set, fill in a summary line (special instructions)
+ This field is to be mapped to one on the pager form.
+ This MLM will then fill in the data based on the selected checkboxes, having the interface only need to
+ look at the data within the pager form (not every order in the set)
+
+ ;;
+
+ explanation: This MLM is called from the ED Hyperkalemia Order Set (ED_Hyperkalemia), on change and close
+ History
+ 2016.04.26 TMS CSR 33465: Add call on Form Close to Medication Order Management MLM
+
+ ;;
+ keywords: Called MLMs, Hyperkalemia Order Set, ED
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid:=this_communication.ClientGUID;
+ ClientChartGUID:=this_communication.ChartGUID;
+
+ //Associate Mapped Fields
+ SpecInst_fld := last of (field_list where field_list.DataItemName = "SpecialInstructions");
+ CodeM_fld := last of (field_list where field_list.DataItemName = "MLM_CM 1");
+
+ Prev_Val := CodeM_fld.Value;
+
+
+
+
+ //*** Get values from First grid
+ //*** SA (Albuterol/Atrovent/Xopenex)
+
+ Resp_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 7);
+ Resp_list :=Resp_fld.Value;
+ Resp_Sel :=Resp_list.IsSelected;
+
+ Albuterol := Last(First 1 from Resp_Sel);
+ Resp_Ord := Last(First 2 from Resp_Sel);
+
+ If Albuterol = True then
+ Resp_list.IsSelected := True,True;
+ SpecInst_fld.Value := "Albuterol";
+ Else
+ SpecInst_Fld.Value := "";
+ If Prev_Val = True then // it was this field that changed to false
+ Resp_list.IsSelected := False,False;
+ endif;
+ endif;
+
+ CodeM_fld.Value := Albuterol;
+
+ If CallingEvent = "FormClose" then
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_SEPSIS_WORK_UP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_SEPSIS_WORK_UP.mlm
new file mode 100644
index 0000000..3536ce9
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_SEPSIS_WORK_UP.mlm
@@ -0,0 +1,122 @@
+maintenance:
+
+ title: FORM_SET_ED_SEPSIS_WORK_UP;;
+ mlmname: FORM_SET_ED_SEPSIS_WORK_UP;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Peggy Leschak, Allscripts;;
+ date: 2017-05-01;;
+ validation: testing;;
+
+library:
+ purpose: Used for Sepsis Unknown Source Antibiotics order set
+ ;;
+
+ explanation: This MLM is called from Sepsis Unknown Source Antibiotics Order Set
+
+ Change history
+ 05.01.2017 JML CSR 35272: Created for ED Sepsis Work Up Order Set
+ 06.30.2018 TMS CSR 36870 Changed calculated IV Fluid to from 0.9% NaCl to Lactated Ringers.
+ ;;
+ keywords: Called MLMs, Antibiotic Sepsis, 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";
+
+ // 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;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ /*******************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:="";
+
+ //Retrieve Form Fields
+
+ Calc_IV_Fluids_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 11 );
+ Calc_IV_Fluids_Grid_Value := Calc_IV_Fluids_Grid.Value;
+
+ Calc_IV_Fluid := last of ( Calc_IV_Fluids_Grid_Value WHERE Calc_IV_Fluids_Grid_Value.Name = "Lactated Ringers 1000ml" );
+
+ //Retrieve 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;
+
+ if ( CallingEvent = "FieldChange" ) then
+
+ if ( CallingField = "MultiOrderGrid|11" ) then
+ if ( weightvalue = 0 OR weightvalue IS NULL OR ht = 0 OR ht IS NULL ) then
+ Calc_IV_Fluid.IsSelected := false;
+ else
+ if ( Calc_IV_Fluid.IsSelected = true ) then
+
+ calc_rate := round ( weightvalue * 30 );
+ calc_hundreds := SUBSTRING 3 CHARACTERS STARTING AT ( LENGTH ( calc_rate AS STRING ) - 2 ) FROM ( calc_rate AS STRING );
+
+ if ( ( ( calc_hundreds AS NUMBER ) >= 750 ) ) OR ( ( ( calc_hundreds AS NUMBER ) >= 250 ) AND ( ( calc_hundreds AS NUMBER ) <= 500 ) ) then
+ calc_rate := CEILING ( ( calc_rate as number ) / 500 ) * 500;
+ elseif ( ( ( calc_hundreds AS NUMBER ) >= 501 ) AND ( ( calc_hundreds AS NUMBER ) < 750 ) ) OR ( ( calc_hundreds AS NUMBER ) < 250 ) then
+ calc_rate := FLOOR ( ( calc_rate AS NUMBER ) / 500 ) * 500;
+ endif;
+
+ alert_msg := "You have selected a WEIGHT-BASED calculated rate for Lactated Ringers.";
+ alert_msg := alert_msg || "\n\nCalculated volume to be given is " || calc_rate || " mL.";
+ alert_msg := alert_msg || "\n\nAre you sure you wish to proceed?";
+
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with alert_msg, "Calculated IV Fluid", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( dialogRes as string ) = "No" then
+ Calc_IV_Fluid.IsSelected := false;
+ endif;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ED_STOOL_SHIGA_TOX.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_STOOL_SHIGA_TOX.mlm
new file mode 100644
index 0000000..c3a9182
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ED_STOOL_SHIGA_TOX.mlm
@@ -0,0 +1,104 @@
+maintenance:
+
+ title: Lab Stool Culture on Order Set Must Order Shiga Toxin 1 and 2;;
+ mlmname: FORM_Set_ED_Stool_Shiga_Tox;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Isolation Set MLM;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Bryan Berkeybile, Eclipsys Corp ext 7469;;
+ date: 2007-11-21;;
+ validation: testing;;
+
+library:
+ purpose: When selecting Stool Culture on the Order Set, Make Shiga Toxin Mandatory (check it for the user)
+ Deselecting Stool Culture will deselect Shiga Toxin
+ Selecting Shiga Toxin when Stool Culture is not selected, pop up message and select Stool Culture
+ Note: Stool Culture cannot be false at this time
+ Deselecting Shiga Toxin when Stool Culture is true will pop up message and deselect Stool
+ Note: Stool Culture cannot be true at this time
+
+ ;;
+
+ explanation: This MLM is called from the Stool Order set (Lab Stool Order Set)
+
+ Change history
+
+ 05-17-2010 RS Altered for Observation OS
+
+ ;;
+ keywords: Called MLMs, Stool order set, Lab
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid:=this_communication.ClientGUID;
+ ClientChartGUID:=this_communication.ChartGUID;
+
+ // Use String parse
+
+
+ locateShiga := first of (field_list where field_list.DataItemName = "MLM_ShigaID1");
+
+
+ OccNumber:= locateShiga.value As Number;
+
+ Multi_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = OccNumber);
+
+ Multi_list :=Multi_fld.Value;
+ Stool_Order:= first of (Multi_list where Multi_list.Name = "Stool Culture");
+ Shiga_Order := first of (Multi_list where Multi_list.Name = "Shiga Toxin 1 and 2");
+
+
+ If CallingEvent = "FormOpen" then
+ Shiga_Order.IsReadOnly:=True;
+
+
+ elseif ((callingevent = "FieldChange")) then
+ If Stool_Order.IsSelected = True then
+ Shiga_Order.IsSelected:=True;
+ else
+ Shiga_Order.IsSelected:=False;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ERAS_PREOP_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ERAS_PREOP_ORDERS.mlm
new file mode 100644
index 0000000..ad4be6d
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ERAS_PREOP_ORDERS.mlm
@@ -0,0 +1,239 @@
+maintenance:
+
+ title: FORM_SET_ERAS_PREOP_ORDERS;;
+ mlmname: FORM_SET_ERAS_PREOP_ORDERS;;
+ arden: version 2.5;;
+ version: 18.4;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Maria Pest, Allscripts ;;
+ date: 2019-11-14;;
+ validation: testing;;
+
+library:
+ purpose: Support pre op order set for Enhanced Recovery After Surgery (ERAS) ;;
+
+ explanation:
+
+ Change history
+ 12.04.2019 TMS CSR 38333 Created to only select diet order when patient is an inpatient or observation
+ to eliminate sending NPO for suergery orders on SDC and outpatients.
+
+ ;;
+ keywords: Insulin, weight based, diabetic
+ ;;
+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";
+
+ // 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;
+
+ comm_obj := this_communication.primaryobj;
+ /*******************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:="";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ // TAB := 9 FORMATTED WITH "%C" ;
+ // TAB2 := TAB || TAB ;
+ // TAB3 := TAB || TAB || TAB;
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+
+
+
+ //Form fields
+ NPO_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ NPOAfterMidnight:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ NPOAfterMidnight_List := NPOAfterMidnight.value;
+
+ NPO4or2Hours:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 4 );
+ NPO4or2Hours_List := NPO4or2Hours.value;
+
+ NPOOther:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 5 );
+ NPOOther_List := NPOOther.value;
+
+ PharmacyConsultOrders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 3 );
+ PharmacyConsultOrders_List := PharmacyConsultOrders.value;
+
+ DietOrders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ DietOrders_List := DietOrders.value;
+
+ CurrMeasurements := last of ( field_list WHERE field_list.DataItemName = "CombinedMeasurements"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Inpatient := last of ( field_list WHERE field_list.DataItemName = "Generic Check Box"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+
+ If CallingEvent = "FormOpen" then
+
+ PharmacyConsultOrders_List.IsReadOnly := (true, true);
+ DietOrders_List.IsReadOnly := (true, true,true);
+
+ PatientType, VisitStatus, CurrLocn := read last {" select typecode, visitStatus, currentlocation
+ from cv3clientvisit with (nolock)
+ where guid = " || SQL (clientvisitguid) };
+
+ If PatientType in ("Inpatient", "Observation") and VisitStatus = "ADM" then
+ Inpatient.value := "True";
+ else
+ Inpatient.value := "False";
+ endif;
+
+ If Inpatient.value = "True" then
+
+ ColoRectalSurgery := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n\n Is this a Colo/Rectal Surgery?" || CRLF || CRLF
+ ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ If (ColoRectalSurgery as string) = "Yes" then
+ PharmacyConsultOrders_List.IsSelected := (true, true);
+ endif;
+ endif;
+
+ endif;
+
+ If CallingEvent = "FieldChange" then
+
+ If CallingField = "MultiOrderInline|2" then
+
+ If True in NPOAfterMidnight_List.IsSelected then
+
+ NPO4or2Hours_List.IsReadOnly:= (true, true);
+ NPOOther_List.IsReadOnly := (true, true);
+ BoxControl := ();
+ For r in 1 seqto (count NPOAfterMidnight_List) do
+ If NPOAfterMidnight_List.IsSelected [r] = true then
+ BoxControl := BoxControl, "false";
+ else
+ BoxControl := BoxControl, "true";
+ endif;
+ enddo;
+
+ NPOAfterMidnight_List.IsReadOnly:= BoxControl;
+
+ If Inpatient.value = True then
+ DietOrders_List.IsSelected := (true, false, false);
+ else
+ DietOrders_List.IsSelected := (false, false, false);
+ endif;
+ else
+ NPO4or2Hours_List.IsReadOnly := (false,false);
+ NPOOther_List.IsReadOnly := (false, false);
+ NPOAfterMidnight_List.IsReadOnly := (false, false, false, false);
+ DietOrders_List.IsSelected := (false, false, false);
+
+ endif; //If True in NPOAfterMidnight
+ endif; //If CallingField = "MultiOrderInline|2"
+
+ If CallingField = "MultiOrderInline|4" then
+
+ If True in NPO4or2Hours_List.IsSelected then
+
+ NPOAfterMidnight_List.IsReadOnly:= (true, true, true, true);
+ NPOOther_List.IsReadOnly := (true, true);
+ BoxControl := ();
+ For r in 1 seqto (count NPO4or2Hours_List) do
+ If NPO4or2Hours_List.IsSelected [r] = true then
+ BoxControl := BoxControl, "false";
+ If r= 1 and Inpatient.value = True then
+ DietOrders_List.IsSelected := (false, true, false);
+ elseif r= 2 and Inpatient.value = true then
+ DietOrders_List.IsSelected := (false, false, true);
+ endif;
+ else
+ BoxControl := BoxControl, "true";
+ endif;
+ enddo;
+
+ NPO4or2Hours_List.IsReadOnly:= BoxControl;
+
+ else
+ NPOAfterMidnight_List.IsReadOnly := (false,false, false, false);
+ NPOOther_List.IsReadOnly := (false, false);
+ NPO4or2Hours_List.IsReadOnly := (false, false);
+ DietOrders_List.IsSelected := (false, false, false);
+
+ endif; //If True in NPO4or2Hours_List
+ endif; //If CallingField = "MultiOrderInline|4"
+
+
+ If CallingField = "MultiOrderInline|5" then
+
+ If True in NPOOther_List.IsSelected then
+
+ NPOAfterMidnight_List.IsReadOnly:= (true, true, true, true);
+ NPO4or2Hours_List.IsReadOnly := (true, true);
+ BoxControl := ();
+ For r in 1 seqto (count NPOOther_List) do
+ If NPOOther_List.IsSelected [r] = true then
+ BoxControl := BoxControl, "false";
+ If r= 1 and Inpatient.value = True then
+ DietOrders_List.IsSelected := (false, false, false);
+ elseif r= 2 and Inpatient.value = true then
+ DietOrders_List.IsSelected := (true, false, false);
+ endif;
+ else
+ BoxControl := BoxControl, "true";
+ endif;
+ enddo;
+
+ NPOOther_List.IsReadOnly:= BoxControl;
+
+ else
+
+ NPOAfterMidnight_List.IsReadOnly := (false,false, false, false);
+ NPOOther_List.IsReadOnly := (false, false);
+ NPO4or2Hours_List.IsReadOnly := (false, false);
+ DietOrders_List.IsSelected := (false, false, false);
+
+ endif; //If True in NPOOther_List
+ endif; //If CallingField = "MultiOrderInline|5"
+ endif; // CallingEvent = "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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ET_STANDING_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ET_STANDING_ORDERS.mlm
new file mode 100644
index 0000000..36697de
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ET_STANDING_ORDERS.mlm
@@ -0,0 +1,125 @@
+maintenance:
+
+ title: FORM_SET_ET_STANDING_ORDERS;;
+ mlmname: FORM_SET_ET_STANDING_ORDERS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Courtney Carr;;
+ specialist: Don Warnick;;
+ date: 2016-08-04;;
+ validation: testing;;
+
+library:
+ purpose: Select the appropriate ET treatment and medications for the selected wound type checkbox.
+ ;;
+
+ explanation: This MLM is called from the ET Standing Orders Order Set
+
+
+ Change history
+
+ 08.04.2016 - DJW CSR# 34898 - Created
+
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ // Define the checkbox that was selected
+
+ checkboxnumber:= substring 2 characters starting at 14 from this_communication.CallingFieldName;
+ selectedcheckbox := first of (field_list where field_list.DataItemName = "NUR_Checkbox" and field_List.Control_MultiFieldOccNum = (checkboxnumber as number));
+
+ // Define the 2 grids
+
+ ETOrderGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ MedOrderGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+
+ // Map the row number(s) in the grid(s) related to each of the checkboxes
+
+ et_griditem := 999;
+ rx_griditem := 999;
+
+ if checkboxnumber = "1" then et_griditem := 1; // Diabetic foot ulcer
+ elseif checkboxnumber = "2" then et_griditem := 2; rx_griditem := 1; // Diabetic foot ulcer - gangrenous
+ elseif checkboxnumber = "3" then et_griditem := 3; // Dechiced surgical wound
+ elseif checkboxnumber = "4" then et_griditem := 4; rx_griditem := 2; // Leg wounds
+ elseif checkboxnumber = "5" then et_griditem := 5; // Heavy exudating wounds
+ elseif checkboxnumber = "6" then et_griditem := 6; // Ischemic wounds
+ elseif checkboxnumber = "7" then et_griditem := 7; // Fissures on heels of feet
+ elseif checkboxnumber = "8" then et_griditem := 8; rx_griditem := 3; // Auto immune wounds
+ elseif checkboxnumber = "9" then et_griditem := 9; rx_griditem := 2; // Radiation burns
+ elseif checkboxnumber = "10" then et_griditem := 11; // Blisters
+ elseif checkboxnumber = "11" then et_griditem := 12; // Herpes shingles
+ elseif checkboxnumber = "12" then et_griditem := 13; // Fungating lesions - brest
+ elseif checkboxnumber = "13" then et_griditem := 14; // Fistula wounds
+ elseif checkboxnumber = "14" then et_griditem := 15; rx_griditem := 4; // Partial full thickness wound
+ elseif checkboxnumber = "15" then et_griditem := 16; rx_griditem := 5; // Full thickness wound
+ elseif checkboxnumber = "16" then et_griditem := 17; rx_griditem := 6; // Stasis dermatitis
+ elseif checkboxnumber = "17" then et_griditem := 18; // Venous stasis ulcers
+ elseif checkboxnumber = "18" then et_griditem := 10; // Hematoms to lower extremities
+ endif;
+
+
+ // Set the trufalse value to determine if the grid item is to be checked or unchecked
+
+ if selectedcheckbox.Value = true
+ then truefalse := true;
+ else truefalse := false;
+ endif;
+
+
+ // Update the ET Grid
+
+ index_list := 1 seqto (count ETOrderGrid.Value);
+ for I in index_list do
+ if et_griditem = I
+ then ETOrderGrid.Value[et_griditem].IsSelected := truefalse;
+ endif;
+ enddo;
+
+ // Update the Medications Grid
+
+ index_list := 1 seqto (count MedOrderGrid.Value);
+ for I in index_list do
+ if rx_griditem = I
+ then MedOrderGrid.Value[rx_griditem].IsSelected := truefalse;
+ endif;
+ enddo;
+
+
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_ADMISSION_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_ADMISSION_ORDERS.mlm
new file mode 100644
index 0000000..065c7d3
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_ADMISSION_ORDERS.mlm
@@ -0,0 +1,309 @@
+maintenance:
+
+ title: FORM_SET_FBC_ADMISSION_ORDERS;;
+ mlmname: FORM_SET_FBC_ADMISSION_ORDERS;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp ext 7461;;
+ specialist: Dean Miklavic, Allscripts Corp Ext 7466;;
+ date: 2012-03-01;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids to disable dosing instruction checkbox in Family Birth Center Admission Order Set
+ ;;
+
+ explanation: This MLM is called from the Family Birth Center Admission Order Set
+
+
+Change history
+
+ 03.01.2012 JML Copied from FORM_SET_SUBCUTANEOUS_INSULIN MLM
+ 07.26.2016 BB CSR#33588 - Adding Antibiotic scheduling to FBC Admission Orderset
+
+ ;;
+ keywords: Called MLMs, Family, Birth
+ ;;
+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;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message := "";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ //Retrieve Calling Event and Field information
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Retrieve list and values of Pharmacy Medication Guidelines Field
+ Pharm_Med_Guidelines := last of (field_list where field_list.DataItemName = "MultiOrderInline"
+ AND field_List.Control_MultiFieldOccNum = 1);
+ Pharm_Med_Guidelines_List := Pharm_Med_Guidelines.Value;
+
+ //Retrieve list and values of Group B Strep Medications Grid
+ GroupB_Strep := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 45);
+ GroupB_Strep_List := GroupB_Strep.Value;
+
+ //BB
+ //Retrieve values for Requested Date/Time hidden fields [BB]
+ GroupB_Strep_Pen_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 1);
+ GroupB_Strep_Pen_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Pen_ReqDate_Val := GroupB_Strep_Pen_ReqDate.Value;
+ Pen_ReqTime_Val := GroupB_Strep_Pen_ReqTime.Value;
+
+ GroupB_Strep_Cef_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 2);
+ GroupB_Strep_Cef_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Cef_ReqDate_Val := GroupB_Strep_Cef_ReqDate.Value;
+ Cef_ReqTime_Val := GroupB_Strep_Cef_ReqTime.Value;
+
+ GroupB_Strep_Van_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 3);
+ GroupB_Strep_Van_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Van_ReqDate_Val := GroupB_Strep_Van_ReqDate.Value;
+ Van_ReqTime_Val := GroupB_Strep_Van_ReqTime.Value;
+
+ //Set date/time for current, +4hours, +8hours, +12hours and parse each section for later manipulation [BB]
+ TimeTest := "00:00";
+ MinuteTime := Minute of Now;
+
+ DateTimeNow := now;
+ DateTimePlusFour := DateTimeNow + 4 hour;
+ DateTimePlusFourPlus := DateTimeNow + 5 hour;
+ DateTimePlusEight := DateTimeNow + 8 hour;
+ DateTimePlusEightPlus := DateTimeNow + 9 hour;
+ DateTimePlusTwelve := DateTimeNow + 12 hour;
+ DateTimePlusTwelvePlus := DateTimeNow + 13 hour;
+
+ // Current Date/Time
+ DateMonth := month of DateTimeNow ;
+ if ( length ( DateMonth as string ) = 1 ) then DateMonth := "0" || DateMonth; endif;
+ DateDay := day of DateTimeNow;
+ if ( length ( DateDay as string ) = 1 ) then DateDay := "0" || DateDay; endif;
+ DateYear := year of DateTimeNow;
+ DateSplit := DateMonth ||"-"|| DateDay ||"-"|| DateYear;
+
+ TimeHour := hour of DateTimeNow;
+ if ( length ( TimeHour as string ) = 1 ) then TimeHour := "0" || TimeHour; endif;
+ TimeMinute := minute of DateTimeNow;
+ if ( length ( TimeMinute as string ) = 1 ) then TimeMinute := "0" || TimeMinute; endif;
+ TimeSplit := TimeHour ||":"|| TimeMinute;
+
+ // Date/Time plus 4 hours
+ DateMonth4 := month of DateTimePlusFour ;
+ if ( length ( DateMonth4 as string ) = 1 ) then DateMonth4 := "0" || DateMonth4; endif;
+ DateDay4 := day of DateTimePlusFour;
+ if ( length ( DateDay4 as string ) = 1 ) then DateDay4 := "0" || DateDay4; endif;
+ DateYear4 := year of DateTimePlusFour;
+ DateSplit4 := DateMonth4 ||"-"|| DateDay4 ||"-"|| DateYear4; // || " 00:00") as time; //7/19/16
+
+ TimeHour4 := hour of DateTimePlusFour;
+ if ( length ( TimeHour4 as string ) = 1 ) then TimeHour4 := "0" || TimeHour4; endif;
+ TimeHour4Plus := hour of DateTimePlusFourPlus;
+ if ( length ( TimeHour4Plus as string ) = 1 ) then TimeHour4Plus := "0" || TimeHour4Plus; endif;
+ TimeMinute4 := minute of DateTimePlusFour;
+ if ( length ( TimeMinute4 as string ) = 1 ) then TimeMinute4 := "0" || TimeMinute4; endif;
+ TimeSplit4 := TimeHour4 ||":"|| TimeMinute4;
+
+ // Date/Time plus 8 hours
+ DateMonth8 := month of DateTimePlusEight ;
+ if ( length ( DateMonth8 as string ) = 1 ) then DateMonth8 := "0" || DateMonth8; endif;
+ DateDay8 := day of DateTimePlusEight;
+ if ( length ( DateDay8 as string ) = 1 ) then DateDay8 := "0" || DateDay8; endif;
+ DateYear8 := year of DateTimePlusEight;
+ DateSplit8 := DateMonth8 ||"-"|| DateDay8 ||"-"|| DateYear8;
+
+ TimeHour8 := hour of DateTimePlusEight;
+ if ( length ( TimeHour8 as string ) = 1 ) then TimeHour8 := "0" || TimeHour8; endif;
+ TimeHour8Plus := hour of DateTimePlusEightPlus;
+ if ( length ( TimeHour8Plus as string ) = 1 ) then TimeHour8Plus := "0" || TimeHour8Plus; endif;
+ TimeMinute8 := minute of DateTimePlusEight;
+ if ( length ( TimeMinute8 as string ) = 1 ) then TimeMinute8 := "0" || TimeMinute8; endif;
+ TimeSplit8 := TimeHour8 ||":"|| TimeMinute8;
+
+ // Date/Time plus 12 hours
+ DateMonth12 := month of DateTimePlusTwelve ;
+ if ( length ( DateMonth12 as string ) = 1 ) then DateMonth12 := "0" || DateMonth12; endif;
+ DateDay12 := day of DateTimePlusTwelve;
+ if ( length ( DateDay12 as string ) = 1 ) then DateDay12 := "0" || DateDay12; endif;
+ DateYear12 := year of DateTimePlusTwelve;
+ DateSplit12 := DateMonth12 ||"-"|| DateDay12 ||"-"|| DateYear12;
+
+ TimeHour12 := hour of DateTimePlusTwelve;
+ if ( length ( TimeHour12 as string ) = 1 ) then TimeHour12 := "0" || TimeHour12; endif;
+ TimeHour12Plus := hour of DateTimePlusTwelvePlus;
+ if ( length ( TimeHour12Plus as string ) = 1 ) then TimeHour12Plus := "0" || TimeHour12Plus; endif;
+ TimeMinute12 := minute of DateTimePlusTwelve;
+ if ( length ( TimeMinute12 as string ) = 1 ) then TimeMinute12 := "0" || TimeMinute12; endif;
+ TimeSplit12 := TimeHour12 ||":"|| TimeMinute12;
+ //bb
+
+ //On Form Open Event, disable the checkbox contained in the Pharmacy Medication Guidelines Field
+ if (CallingEvent = "FormOpen") then
+ Pharm_Med_Guidelines_List.IsReadOnly := (True);
+ endif;
+
+ //On Field Change event, control the ability to select group of medications contained in the
+ //Group B Strep Medications Grid
+ if (CallingEvent = "FieldChange") then
+
+ if (CallingField = "MultiOrderGrid|45") then
+ //List of Penicillin medications selected
+ FirstThree := (GroupB_Strep_List.IsSelected[1],
+ GroupB_Strep_list.IsSelected[2],
+ GroupB_Strep_List.IsSelected[3]);
+ //List of Cefazolin medications selected
+ NextTwo := (GroupB_Strep_List.IsSelected[4],
+ GroupB_Strep_List.IsSelected[5]);
+
+ LastTwo := (GroupB_Strep_List.IsSelected[6],
+ GroupB_Strep_List.IsSelected[7]);
+
+ //Determines the number of penicillin medications selected based on list defined above
+ FirstThreeTrueCount := count (FirstThree WHERE FirstThree = true);
+ //Determines the number of cefazolin medications selected based on list defined above
+ NextTwoTrueCount := count (NextTwo WHERE NextTwo = true);
+ //Determines if the vancomycin medication is selected
+ LastTwoTrueCount := count (LastTwo WHERE LastTwo = true);
+ //Count of medications in the Group B Strep Medications Grid that are set to Read Only
+ ReadOnlyTrueCount := count (GroupB_Strep_List.IsReadOnly WHERE GroupB_Strep_List.IsReadOnly = true);
+
+ //Initialize variables used to set the IsReadOnly and IsSelected property on medications in the grid
+ NewReadOnly := ();
+ NewSelected := ();
+ //Begin loop through Group B Strep Medications grid
+ for k in 1 seqto (count GroupB_Strep_List.IsSelected) do
+
+ //If 1 penicillin medication is selected, then select all 3 penicillins and set all other medications in grid
+ //to Read Only
+ if (FirstThreeTrueCount = 1) then
+ if (k <= 3) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+
+ //BB
+ //when Penicillin is selected add 4 hours to additional scheduled Penicillin order admin time [BB]
+ //Adjust for Administration time calculated for < 45 minutes is initiating hour, >= 45 minutes is next hour [BB]
+ GroupB_Strep_Pen_ReqDate.value := DateSplit4 ;
+ Pen_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
+ If MinuteTime >= 45 then
+ Pen_ReqTime_Val.ReqTimeValue := TimeHour4Plus ||":00";
+ else
+ Pen_ReqTime_Val.ReqTimeValue := TimeHour4 ||":00";
+ endif;
+ //bb
+ endif;
+
+ //If 2 pencillin medications are selected, we can safely assume user is attempting to unselect the penicillins
+ //UnSelect all penicillin medications and reset the other medications in grid to NOT Read Only
+ elseif (FirstThreeTrueCount = 2) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, false;
+ //If 1 cefazolin medication is selected and no other medications in the grid are set to Read Only,
+ //we can safely assume user is attempting to select cefazolin
+ //Select both cefazolin medications and set all other medications in the grid to Read Only
+ elseif (NextTwoTrueCount = 1 AND ReadOnlyTrueCount = 0) then
+ if (k >= 4 AND k < 6) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+
+ //BB
+ //when Cefazolin is selected add 8 hours to additional scheduled Cefazolin order admin time [BB]
+ //Adjust for Administration time calculated for < 45 minutes is initiating hour, >= 45 minutes is next hour [BB]
+ GroupB_Strep_Cef_ReqDate.value := DateSplit8;
+ Cef_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
+ If MinuteTime >= 45 then
+ Cef_ReqTime_Val.ReqTimeValue := TimeHour8Plus ||":00";
+ else
+ Cef_ReqTime_Val.ReqTimeValue := TimeHour8 ||":00";
+ endif;
+ //bb
+ endif;
+ //If 1 cefazolin medication is selected and other medications in the grid are set to Read Only,
+ //we can safely assume user is attempting to unselect cefazolin
+ //Unselect both cefazolin medications and reset all other medications in the grid to NOT Read Only
+ elseif (NextTwoTrueCount = 1 AND ReadOnlyTrueCount > 0) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, false;
+ //If vancomycin is selected, then set all other medications in the grid to Read Only
+ elseif (LastTwoTrueCount = 1 AND ReadOnlyTrueCount = 0) then
+ if (k = 6 OR k = 7) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+
+ //BB
+ //when Vancomycin is selected add 12 hours to additional scheduled Vancomycin order admin time [BB]
+ //Adjust for Administration time calculated for < 45 minutes is initiating hour, >= 45 minutes is next hour [BB]
+ GroupB_Strep_Van_ReqDate.value := DateSplit12;
+ Van_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
+ If MinuteTime >= 45 then
+ Van_ReqTime_Val.ReqTimeValue := TimeHour12Plus ||":00";
+ else
+ Van_ReqTime_Val.ReqTimeValue := TimeHour12 ||":00";
+ endif;
+ //bb
+
+ endif;
+ //If vancomycin is unselected, then reset all other medications in grid to NOT Read Only
+ elseif (LastTwoTrueCount = 1 AND ReadOnlyTrueCount > 0) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, false;
+ endif;
+ enddo;
+ //Update Group B Strep List grid fields with the appropriate IsReadOnly and IsSelected properties.
+ GroupB_Strep_List.IsReadOnly := NewReadOnly;
+ GroupB_Strep_List.IsSelected := NewSelected;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_CHARGES.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_CHARGES.mlm
new file mode 100644
index 0000000..fc00a8d
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_CHARGES.mlm
@@ -0,0 +1,180 @@
+maintenance:
+
+ title: Selected/de-select chaars & item supply orders on Order Sets;;
+ mlmname: FORM_Set_FBC_Charges;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair FBC;;
+ author: Maria Pest, Allscripts ext 7443;;
+ specialist: Shawn Head, Allscripts ext 7468;;
+ date: 2012-03-16;;
+ validation: testing;;
+
+library:
+ purpose: Used to auto select/de-select charges and/or Item supply orders
+ when the opposite is checked/unchecked. used on the FBC Charges (mother) order set
+ ;;
+
+ explanation: This MLM is called from the FBC Charges (Mother) Order set
+
+ Change history
+
+ 03.15.2012 STH Copied FORM_Set_Labs_Deselected to create this MLM as a net-new MLM on 3.15.2012
+
+
+ ;;
+ keywords: Called MLMs, FBC, FBC charges, FBC charges (mother)
+ ;;
+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 ONLY******************************************************/
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := FALSE;
+
+ //identifies the SCM form item that will need to trigger the MLM. e.g. items using MultiOrderCheckBox(3) will be MultiOrderCheckBox|3
+ //callingformitem[1] (in this MLM its MultiOrderCheckBox|3) will match up to items listed in itemsgrp1
+ //callingformitem[2] (in this MLM its MultiOrderCheckBox|4) will match up with itemsgrp2
+ callingformitem := ("MultiOrderCheckBox|3","MultiOrderCheckBox|4"); //DO NOT add more than 2 MultiOrder items in this section as this will cause unexpected results.
+
+ //if an item from itemsgrp1 is selected it will auto select/deselect the item associated with the cooresponding item in itemsgrp2.
+ //e.g. if Chg 0015 Straight Catheter Insertion is selected/deselected then Chg 4000 Straight Cath Urine 15Fr will be selected/deselected automatically
+ itemsgrp1 := ("Chg 4000 Straight Cath Urine 15Fr" //item1
+ ,"Chg 4001 Indwelling Cath Urine 16Fr"); //item2
+ //,""); //item4
+ //,""); //item5
+ //,""); //item6
+ //,""); //item7
+ //,""); //item8
+ //,""); //item9
+ //,""); //item10
+
+
+ itemsgrp2 := ("Chg 0015 Straight Catheter Insertion" //item1
+ ,"Chg 0026 Foley Insertion"); //item2
+ //,""); //item4
+ //,""); //item5
+ //,""); //item6
+ //,""); //item7
+ //,""); //item8
+ //,""); //item9
+ //,""); //item10
+
+
+ /**********************END of Make Changes To Spelling And Flags In This Section ONLY*******************************************/
+
+ // Initialize error message
+ error_message:="";
+/*****************************below is all the code pulled from FORM_Set_Labs_Deselected******************/
+
+ // 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 item lists that will be used in this MLM
+ Grid_itemlist := ();
+ Grid_itemcheck := ();
+ update_itemlist := ();
+ update_itemcheck := ();
+
+
+ //Get the multi order grid check box value
+ //check to make sure the calling item from the form is configured to trigger this MLM
+ if CallingField is in callingformitem then
+
+ //identify the "Control_MultiFieldOccNum" associated with the multiorder grid calling the MLM. e.g (MultiOrderGrid(3) will return 3 in mfon
+ callfieldlgth := length of CallingField;
+ findpipe := FIND "|" IN STRING CallingField;
+ itemctlenght := callfieldlgth - findpipe;
+ itemstartpos := findpipe + 1;
+ mfon := substring itemctlenght characters starting at itemstartpos from CallingField;
+
+ //get the list of items in the MultiOrder field that called the MLM
+ Grid_itemflds := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = (mfon as number));
+ Grid_itemlist := Grid_itemflds.Value;
+ Grid_itemcheck := Grid_itemlist.IsSelected;
+
+ //identify the "Control_MultiFieldOccNum" associated with the multiorder grid needing updated. e.g. (MultiOrderGrid(4) will return 4 in mfonupdate
+ updateitemname := last of (callingformitem where callingformitem <> CallingField);
+ updatefieldlgth := length of updateitemname;
+ updatepipe := find "|" in string updateitemname;
+ updatectlength := updatefieldlgth - updatepipe;
+ updatestartpos := updatepipe + 1;
+ mfonupdate := substring updatectlength characters starting at updatestartpos from updateitemname;
+
+ //get the list of items in the MultiOrder field that will need updated based on item selection
+ update_itemflds := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_list.Control_MultiFieldOccNum = (mfonupdate as number));
+ update_itemlist := update_itemflds.Value;
+ update_itemcheck := update_itemflds.IsSelected;
+
+
+ //set the callingitems and udpateitems equal to the proper itemsgrp defined in the edit sections based on the calling field.
+ //Currently this MLM is only configured to handle 2 objects a calling field and an update field which is why you will find a note
+ //in the edit section that states "DO NOT add more than 2 MultiOrder items in this section as this will cause unexpected results."
+ if CallingField = callingformitem[1] then
+ callingitems := itemsgrp1;
+ updateitems := itemsgrp2;
+ else
+ callingitems := itemsgrp2;
+ updateitems := itemsgrp1;
+ endif;
+
+
+
+ //big old for loop. Basically looping through all items in the calling field (MultiOrderCheckBox in this MLM)
+ //this for loop will check the each item in the calling field against the items configured in edit sections to verify
+ //if the item(s) selected in the calling field need to update a field in the update field section. If it finds that
+ //an item in the calling event is configured in the edit section to "trigger" an update to the update field section
+ //then the MLM will "update" the update item that cooresponds to the calling item name(s) to match the "IsSelected" value
+ //of the calling item. In sort. If you check callingitems[1] this MLM will check updateitems[1], if you check callingitems[2]
+ //this MLM will check updateitem[2]. If you uncheck callingitems[1] updateimtes[1] will uncheck, ect...
+ for j in 1 seqto (count Grid_itemlist) do
+
+ if Grid_itemlist[j].name is in callingitems then
+
+ for x in 1 seqto (count callingitems) do
+ if callingitems[x] = Grid_itemlist[j].name then
+ callitemnum := x;
+ endif;
+ enddo;
+
+ for x in 1 seqto (count update_itemlist) do
+ if update_itemlist[x].name = updateitems[callitemnum] then
+ isitemcheck := Grid_itemcheck[j];
+ update_itemlist[x].IsSelected := isitemcheck;
+ endif;
+ enddo;
+
+ endif;
+ enddo;
+
+
+ endif;
+
+/**************************************end of original code pulled from FORM_Set_Labs_Deselected************************/
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_EPIDURAL_ORDER.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_EPIDURAL_ORDER.mlm
new file mode 100644
index 0000000..c1b8fc2
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_EPIDURAL_ORDER.mlm
@@ -0,0 +1,487 @@
+maintenance:
+
+ title: FORM_Set_FBC_Epidural_Order ;;
+ mlmname: FORM_Set_FBC_Epidural_Order;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad jadhav, Allscripts Corporation;;
+ date: 2015-05-14;;
+ validation: testing;;
+
+library:
+ purpose: MLM to check IUFD [Intra uterine fetal death] health issue and PT and APTT result within last 8 hours , if not present then autocheck PT, APTT Lab STAT order
+ MLM which will check for last 2 hours Platelet count result when patient has pre ecmplasia and if not present then will order respective lab stat ,
+ if patient has IUFD as health issue then MLM will check within last 8 hours PT,APTT result and if not present then it will autocheck the respective lab orders.
+ if patient doesn{{{SINGLE-QUOTE}}}t have any of these two health issue then MLM will check CBC and platelet count last 8 hours result ,
+ if not present then will autocheck Lab stat cbc order.
+ Note : 1. MLM will only autocheck the respective lab order
+ 2. MLM will allow user to deselect /select the lab order as when required
+ 3. MLM will consider both , the battery lab item and its components
+ ;;
+
+ explanation:
+
+ Change History
+ -----------------
+ 11.05.2015 JML CSR# 33390: Created
+ 06/28/2018 DW CSR# 36956 FBC Order Set Review - do not pre-check the CBC
+ 01/11/2019 TMS CSR# 37271 and 37375 Updated for changes to FBC Epidural orders
+ and to accommodate new patient controlled epidural analgesia.
+
+
+ PT :="Prothrombin/INR" ;
+ ;;
+ keywords: Called MLMs
+ ;;
+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:="";
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ clientGuid := this_communication.ClientGUID;
+ visitGuid := this_communication.ClientVisitGUID;
+ chartGuid := this_communication.ChartGUID;
+
+ //pObj := this_communication.PrimaryObj;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ item_event := this_communication.itemevent;
+ form_type := this_communication.formtype;
+
+ Labs_Stat := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
+ and field_list.Control_MultiFieldOccNum = 4);
+ Labs_Stat_Val := Labs_Stat.Value;
+ Preeclampsia := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
+ and field_list.Control_MultiFieldOccNum = 5);
+ Preeclampsia_Val := Preeclampsia.Value;
+
+ EpiduralOrders:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
+ and field_list.Control_MultiFieldOccNum = 7);
+ EpiduralOrders_Val := EpiduralOrders.value;
+ Fentanyl_Bupiv := first of (EpiduralOrders_Val where EpiduralOrders_Val.Name matches pattern "Fentanyl 200 mcg + BUPIv%");
+ Fentanyl_Ropiv := first of (EpiduralOrders_Val where EpiduralOrders_Val.Name matches pattern "Fentanyl 200 mcg + ROPIv%");
+
+ pcacontinuous:= last of (field_list where field_list.DataItemName = "PRX_PcaContinuous"
+ and field_list.Control_MultiFieldOccNum = 1);
+ pcacontinuous_val := pcacontinuous.value;
+ pcaplus := last of (field_list where field_list.DataItemName = "PRX_PcaPlus"
+ and field_list.Control_MultiFieldOccNum = 1);
+ pcaplus_val := pcaplus.value;
+ CRNAAdminDose := last of (field_list where field_list.DataItemName = "PRX_ZXO01"
+ and field_list.Control_MultiFieldOccNum = 1);
+ CRNADoseUnits := last of (field_list where field_list.DataItemName = "PRX_ZXO02"
+ and field_list.Control_MultiFieldOccNum = 1);
+ PtAdminDose := last of (field_list where field_list.DataItemName = "PRX_ZXO05"
+ and field_list.Control_MultiFieldOccNum = 1);
+ PtAdminUnits := last of (field_list where field_list.DataItemName = "PRX_ZXO06"
+ and field_list.Control_MultiFieldOccNum = 1);
+ PtAdminFreq := last of (field_list where field_list.DataItemName = "PRX_ZXO07"
+ and field_list.Control_MultiFieldOccNum = 1);
+ PtAdminFreqUnits := last of (field_list where field_list.DataItemName = "PRX_ZXO08"
+ and field_list.Control_MultiFieldOccNum = 1);
+ basalrate := last of (field_list where field_list.DataItemName = "PRX_ZXO09"
+ and field_list.Control_MultiFieldOccNum = 1);
+ BasalRateUom := last of (field_list where field_list.DataItemName = "PRX_ZXO10"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+
+// remove this form open logic when ropivacaine product becomes available.
+ If CallingEvent = "FormOpen" then
+ Fentanyl_Ropiv.IsReadOnly:= true;
+ Endif;
+
+ If callingfield = "MultiOrderCheckBox|7" then
+
+// Add this commented out code back when ropivacaine product becomes available.
+/*
+ If Fentanyl_Bupiv.isSelected = true then
+ EpiduralOrders_val.isReadOnly := (false, true);
+ Elseif Fentanyl_Ropiv.isSelected = true then
+ EpiduralOrders_val.isReadOnly := (true, false);
+ Elseif (Fentanyl_Ropiv.isSelected = false and Fentanyl_Ropiv.isSelected = false) then
+ EpiduralOrders_val.isReadOnly := (false, false);
+ endif;
+*/
+ If (Fentanyl_Bupiv.IsSelected = true or Fentanyl_Ropiv.IsSelected = true) then
+ If (pcacontinuous.value = false and pcaplus.value = false) then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Please select mode of Delivery for Epidural Infusion."
+ ||" \n\n Continuous Epidural Infusion or PCEA and Continuous Epidural Infusion"
+ ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+ endif;
+ endif;
+
+ If (CallingField = "Prx_PcaPlus|1" and pcaplus.value = True) then
+
+ PtAdminDose.control_mandatory := True;
+ PtAdminDose.control_read_only := False;
+ PtAdminUnits.value := "mL";
+ PtAdminUnits.control_mandatory := True;
+ PtAdminUnits.control_read_only := True;
+ PtAdminFreq.control_mandatory := True;
+ PtAdminFreq.control_read_only := False;
+ PtAdminFreqUnits.value := "minutes";
+ PtAdminFreqUnits.control_mandatory := True;
+ PtAdminFreqUnits.control_read_only := True;
+ basalrate.control_mandatory := True;
+ basalrate.control_read_only := False;
+ BasalRateUom.value := "mL/hr";
+ pcacontinuous.value := False;
+
+ elseif (CallingField = "PRX_PcaContinuous|1" and pcacontinuous.value = True) then
+
+
+ pcaplus.value := False;
+ PtAdminDose.value := "";
+ PtAdminDose.control_mandatory := False;
+ PtAdminDose.control_read_only := True;
+ PtAdminUnits.value := "";
+ PtAdminUnits.control_mandatory := False;
+ PtAdminUnits.control_read_only := True;
+ PtAdminFreq.value := "";
+ PtAdminFreq.control_mandatory := False;
+ PtAdminFreq.control_read_only := True;
+ PtAdminFreqUnits.value := "";
+ PtAdminFreqUnits.control_mandatory := False;
+ PtAdminFreqUnits.control_read_only := True;
+ basalrate.control_mandatory := True;
+ basalrate.control_read_only := False;
+ BasalRateUom.value := "mL/hr";
+ pcaplus.value := false;
+
+ endif;
+
+ If (CallingField = "PRX_ZXO01|1" and CRNAAdminDose.value is not null) then
+ CRNADoseUnits.value := "mL";
+ elseif (CallingField = "PRX_ZXO01|1" and CRNAAdminDose.value is null) then
+ CRNADoseUnits.value := "";
+ endif;
+
+ If (CallingField = "PRX_ZXO09|1" and (BasalRate.value as number) >14) then
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Maximum Rate for Continuous Infusion is 14 mL/hr."
+ ||" \n\n Please adjust rate." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ BasalRate.value := null;
+
+ endif;
+
+ If (CallingField = "PRX_ZXO05|1" and (PtAdminDose.value as number) >8) then
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Maximum Rate for Patient Administered Dose is 8 mL every 15 minutes."
+ ||" \n\n Please adjust dose." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ PtAdminDose.value := null;
+
+ endif;
+
+ If (CallingField = "PRX_ZXO01|1" and (CRNAAdminDose.value as number) >10) then
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Loading Dose Administered from Epidural Bag should not exceed 10 mL."
+ ||" \n\n Please adjust dose." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ CRNAAdminDose.value := null;
+
+ endif;
+
+ If (CallingField = "PRX_ZXO07|1" and (PtAdminFreq.value as number) <15) then
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Frequency of Patient Administered Dose must be a minimum of 15 minutes apart."
+ ||" \n\n Please adjust frequency." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ PtAdminFreq.value := null;
+
+ endif;
+
+
+
+
+
+
+ PreeclampsiaHI := read First {" select distinct hi.shortname "
+ || "from cv3healthissuedeclaration hi with (nolock) "
+ || "join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
+ || "where hi.clientguid = " || clientGuid || " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ || "and hi.typecode not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}) "
+ || "and ( "
+ || "hi.text like {{{SINGLE-QUOTE}}}%Preeclampsia%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Preeclampsia%{{{SINGLE-QUOTE}}} or "
+ || " "
+ || "(Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}642.40{{{SINGLE-QUOTE}}}) "
+ || " ) "
+ || " AND ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} AND ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} OR ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} "
+ || " AND hi.ChartGUID = " || SQL(chartGuid) || " ) OR hi.ClientVisitGUID = " || SQL(visitGuid) || " ) ) "
+ };
+
+
+ IUFDHI := read First {" select distinct hi.shortname "
+ || "from cv3healthissuedeclaration hi with (nolock) "
+ || "join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
+ || "where hi.clientguid = " || clientGuid || " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ || "and hi.typecode not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}) "
+ || "and ( "
+ || "hi.text like {{{SINGLE-QUOTE}}}%IUFD%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%IUFD%{{{SINGLE-QUOTE}}} or "
+ || " "
+ || "(Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}779.9{{{SINGLE-QUOTE}}}) "
+ || " ) "
+ || " AND ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} AND ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} OR ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} "
+ || " AND hi.ChartGUID = " || SQL(chartGuid) || " ) OR hi.ClientVisitGUID = " || SQL(visitGuid) || " ) ) "
+ };
+
+
+ Ord_CBC := OBJECT [Obs_Name, Obs_EnteredDtm] ;
+ Ord_CBC_Vals := read as Ord_CBC{" SELECT o.Name, osh.CreatedWhen "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " Inner Join CV3OrderStatusHistory osh With (nolock) on o.guid =osh.OrderGUID And osh.ClientGUID=o.ClientGUID "
+ || " WHERE cv.ClientGUID = " || Sql(clientGuid)
+ || " And cv.guid = " || Sql(visitGuid)
+ || " AND o.NAME in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}} ) "
+ || " AND osh.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}) Order by osh.CreatedWhen Desc "};
+
+
+ Ord_Platelet := OBJECT [Obs_Name, Obs_EnteredDtm] ;
+ Ord_Platelet_Vals := read as Ord_Platelet{"SELECT o.Name, osh.CreatedWhen "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " Inner Join CV3OrderStatusHistory osh With (nolock) on o.guid =osh.OrderGUID And osh.ClientGUID=o.ClientGUID "
+ || " WHERE cv.ClientGUID = " || Sql(clientGuid)
+ || " And cv.guid = " || Sql(visitGuid)
+ || " AND o.NAME in ( {{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Count{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Cnt{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Count.{{{SINGLE-QUOTE}}}) "
+ || " AND osh.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}) Order by osh.CreatedWhen Desc "};
+
+
+ Ord_APTT := OBJECT [Obs_Name, Obs_EnteredDtm] ;
+ Ord_APTT_Vals := read as Ord_APTT{"SELECT o.Name, osh.CreatedWhen "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " Inner Join CV3OrderStatusHistory osh With (nolock) on o.guid =osh.OrderGUID And osh.ClientGUID=o.ClientGUID "
+ || " WHERE cv.ClientGUID = " || Sql(clientGuid)
+ || " And cv.guid = " || Sql(visitGuid)
+ || " AND o.NAME in ({{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}}) "
+ || " AND osh.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}) Order by osh.CreatedWhen Desc "};
+
+
+ Ord_INR := OBJECT [Obs_Name, Obs_EnteredDtm] ;
+ Ord_INR_Vals := read as Ord_INR{"SELECT o.Name, osh.CreatedWhen "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " Inner Join CV3OrderStatusHistory osh With (nolock) on o.guid =osh.OrderGUID And osh.ClientGUID=o.ClientGUID "
+ || " WHERE cv.ClientGUID = " || Sql(clientGuid)
+ || " And cv.guid = " || Sql(visitGuid)
+ || " AND o.NAME in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}} ) "
+ || " AND osh.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}) Order by osh.CreatedWhen Desc "};
+
+
+
+ Time_2hr_Before := Read First {" Select Dateadd(Minute, -120, Getdate()) "};
+ Time_8hr_Before := Read First {" Select Dateadd(Minute, -480, Getdate()) "};
+
+ //Time_2hr_Before := Read First {" Select Dateadd(Hour, -262, Getdate()) "};
+ //Time_8hr_Before := Read First {" Select Dateadd(Minute, -1140, Getdate()) "};
+
+ C_Plate_Dt := First of(Ord_Platelet_Vals.Obs_EnteredDtm where Ord_Platelet_Vals.Obs_Name in ( "CBC No Diff (Hemogram Only)","Platelet Count","CBC (Includes Diff)","CBC with Manual Diff","Platelet Cnt","Platelet Count.") );
+ If C_Plate_Dt is Null Then C_Plate_Dt := Read First {" Select Dateadd(Minute, -500, Getdate()) "}; Endif;
+ //If C_Plate_Dt is Null Then C_Plate_Dt := ("01-07-2019 11:37:55" as time) ; Endif;
+ O_CBC_Dt := First of(Ord_CBC_Vals.Obs_EnteredDtm where Ord_CBC_Vals.Obs_Name in ( "CBC (Includes Diff)" ,"CBC No Diff (Hemogram Only)","CBC with Manual Diff" ) );
+ If O_CBC_Dt is Null Then O_CBC_Dt := Read First {" Select Dateadd(Minute, -500, Getdate()) "}; Endif;
+ // If O_CBC_Dt is Null Then O_CBC_Dt := ("01-07-2019 11:37:55" as time) ; Endif;
+ C_PT_Dt := First of(Ord_INR_Vals.Obs_EnteredDtm where Ord_INR_Vals.Obs_Name= "Prothrombin/INR" And Ord_INR_Vals.Obs_EnteredDtm Is Not Null );
+ If C_PT_Dt is Null Then C_PT_Dt := Read First {" Select Dateadd(Minute, -500, Getdate()) "}; Endif;
+ C_PTT_Dt := First of(Ord_APTT_Vals.Obs_EnteredDtm where Ord_APTT_Vals.Obs_Name= "APTT" And Ord_APTT_Vals.Obs_EnteredDtm Is Not Null );
+ If C_PTT_Dt is Null Then C_PTT_Dt := Read First {" Select Dateadd(Minute, -500, Getdate()) "}; Endif;
+
+ FinalStr :="" ;
+ // CBC := "CBC No Diff (Hemogram Only)" ; //"CBC (Includes Diff)"; changes as per new specs // 06/28/2018 DW CSR# 36956 FBC Order Set Review - do not pre-check the CBC
+ PT :="Prothrombin/INR" ;
+ APTT:="APTT";
+ Platelet := "Platelet Count" ;
+
+
+
+ If PreeclampsiaHI Is Not Null Then
+ If IUFDHI Is Not Null Then
+ // For CBC
+ If C_Plate_Dt > Time_2hr_Before And O_CBC_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ ElseIf (C_Plate_Dt < Time_2hr_Before And O_CBC_Dt < Time_8hr_Before) or (C_Plate_Dt > Time_2hr_Before And O_CBC_Dt < Time_8hr_Before) Then
+ FinalStr := FinalStr, CBC;
+ ElseIf C_Plate_Dt < Time_2hr_Before And O_CBC_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr, Platelet ;
+ EndIf;
+ // For PT
+ If C_PT_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ Else
+ FinalStr := FinalStr, PT ;
+ EndIf;
+ // For APTT
+ If C_PTT_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ Else
+ FinalStr := FinalStr, APTT ;
+ EndIf;
+
+ EndIf;
+ If IUFDHI Is Null Then
+
+ // For CBC
+ If C_Plate_Dt > Time_2hr_Before And O_CBC_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ ElseIf (C_Plate_Dt < Time_2hr_Before And O_CBC_Dt < Time_8hr_Before) or (C_Plate_Dt > Time_2hr_Before And O_CBC_Dt < Time_8hr_Before) Then
+ FinalStr := FinalStr, CBC;
+ ElseIf C_Plate_Dt < Time_2hr_Before And O_CBC_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr, Platelet ;
+ EndIf;
+
+ // For PT
+ /*If C_PT_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ Else
+ FinalStr := FinalStr, PT;
+ EndIf;
+ // For APTT
+ If C_PTT_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ Else
+ FinalStr := FinalStr, APTT ;
+ EndIf; */
+ //FinalStr := FinalStr, PT, APTT ;
+
+ EndIf;
+
+ ElseIf PreeclampsiaHI Is Null Then
+ If IUFDHI Is Not Null Then
+ // For CBC
+ If C_Plate_Dt > Time_8hr_Before And O_CBC_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ Else
+ FinalStr := FinalStr, CBC ;
+ EndIf;
+ // For PT
+ If C_PT_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ Else
+ FinalStr := FinalStr, PT ;
+ EndIf;
+ // For APTT
+ If C_PTT_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ Else
+ FinalStr := FinalStr, APTT ;
+ EndIf;
+ EndIf;
+ If IUFDHI Is Null Then
+ // For CBC
+ If C_Plate_Dt > Time_8hr_Before And O_CBC_Dt > Time_8hr_Before Then
+ //If O_CBC_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+
+ Else
+ FinalStr := FinalStr, CBC ;
+
+ EndIf;
+
+ // For PT
+ /*If C_PT_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ Else
+ FinalStr := FinalStr, PT;
+ EndIf;
+ // For APTT
+ If C_PTT_Dt > Time_8hr_Before Then
+ FinalStr := FinalStr ;
+ Else
+ FinalStr := FinalStr, APTT ;
+ EndIf; */
+ //FinalStr := FinalStr, PT, APTT ;
+ EndIf;
+ Endif;
+
+
+
+
+
+ if ( exists FinalStr ) then
+
+ // for First Checkbox
+ for lab in 1 seqto ( count Labs_Stat_Val ) do
+ if ( Labs_Stat_Val[lab].Name IN FinalStr ) then
+ Labs_Stat_Val[lab].IsSelected := true;
+ else
+ Labs_Stat_Val[lab].IsSelected := false;
+ endif;
+ enddo;
+ // for Second Checkbox
+ for a in 1 seqto ( count Preeclampsia_Val ) do
+ if ( Preeclampsia_Val[a].Name IN FinalStr ) then
+ Preeclampsia_Val[a].IsSelected := true;
+ else
+ Preeclampsia_Val[a].IsSelected := false;
+ endif;
+ enddo;
+ else
+ //No labs exist for this patient, select all labs
+
+ Labs_Stat_Val.IsSelected := ( False, False, False);
+ Preeclampsia_Val.IsSelected := ( False);
+
+ endif;
+
+ If (pcaplus.value = true or pcacontinuous.value = true) and (Fentanyl_Bupiv.IsSelected = false and Fentanyl_Ropiv.IsSelected = false) then
+ hardstop := "yes";
+ else hardstop := "no";
+ endif;
+
+ ReasonMessage := "You have selected parameters for an Epicural Infusion, please select either Fentanyl and BUPIvacaine or Fentanyl and ROPIvacaine to continue.";
+ If CallingEvent = "FormClose" then
+
+ If hardstop = "yes" then //Present user with message box and stop order set from being submitted.
+ this_communication.DisplayForm := "yes";
+ this_communication.Message := ReasonMessage;
+ this_communication.MessageType := "Error";
+ else
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_POSTPARTUM_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_POSTPARTUM_ORDERS.mlm
new file mode 100644
index 0000000..18b1266
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_FBC_POSTPARTUM_ORDERS.mlm
@@ -0,0 +1,111 @@
+maintenance:
+
+ title: FORM_SET_FBC_POSTPARTUM_ORDERS;;
+ mlmname: FORM_SET_FBC_POSTPARTUM_ORDERS;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M Law, Allscripts x7461;;
+ specialist: Peggy Karish, Allscripts ext 7441;;
+ date: 2014-10-09;;
+ validation: testing;;
+
+library:
+ purpose: Automatically select nursing instruction order based on prescence of lab result on mother.
+
+ ;;
+
+ explanation: This MLM is called from the FBC Postpartum Order Set. On Form open, based on the existence and result of
+ the Type and Screen lab RH Negative result on the mother, the appropriate nursing isntruction will be selected.
+ ;;
+ keywords: Called MLMs, FBC, Postpartum, RH Negative
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+
+ pObj := this_communication.PrimaryObj;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Retrieve relevant form fields
+ Nurse_Instr := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 15 );
+ Nurse_Instr_Val := Nurse_Instr.Value;
+
+ RH_Nurse_Instr := Nurse_Instr_Val[3];
+
+ //Fire on Form Open event
+ if ( CallingEvent = "FormOpen" ) then
+
+ //Retrieve RH Negative result from Type and Screen lab
+ rh_result := read last {"SELECT IsNull(tol.Text,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})"
+ || " 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 CV3BasicObservation bo WITH (NOLOCK) ON o.GUID = bo.OrderGUID"
+ || " and o.ClientGUID = bo.ClientGUID "
+ || " and o.ClientVisitGUID = bo.ClientVisitGUID"
+ || " and o.ChartGUID = bo.ChartGUID"
+ || " LEFT JOIN CV3TextualObservationLine tol WITH (NOLOCK) ON bo.GUID = tol.ObservationGUID"
+ || " AND bo.ClientGUID = tol.ClientGUID"
+ || " JOIN CV3OrderCatalogMasterItem om WITH (NOLOCK) ON o.OrderCatalogMasterItemGUID = om.GUID"
+ || " JOIN CV3OrganizationalUnit org WITH (NOLOCK) ON om.OrgUnitGUID = org.GUID"
+ || " AND org.Name = {{{SINGLE-QUOTE}}}Blood Bank{{{SINGLE-QUOTE}}}"
+ || " JOIN CV3OrderStatusHistory oshentr WITH (NOLOCK) ON o.GUID = oshentr.OrderGUID"
+ || " AND o.ClientGUID = oshentr.ClientGUID"
+ || " AND oshentr.OrderStatusCode = {{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}}"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)
+ || " AND cv.ChartGUID = " || Sql(chart_guid)
+ || " AND ( o.name = {{{SINGLE-QUOTE}}}Type and Screen{{{SINGLE-QUOTE}}} OR o.Name = {{{SINGLE-QUOTE}}}Blood Type{{{SINGLE-QUOTE}}} )"
+ || " AND bo.ItemName = {{{SINGLE-QUOTE}}}Blood Type (ABO/RH){{{SINGLE-QUOTE}}}"};
+
+ //If Blood Type is NEGATIVE, then automatically check nursing instruction
+ if ( rh_result matches pattern "%NEGATIVE" ) then
+ RH_Nurse_Instr.IsSelected := true;
+ else
+ RH_Nurse_Instr.IsSelected := false;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_GRID_ITEM_SELECT_MANDATORY.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_GRID_ITEM_SELECT_MANDATORY.mlm
new file mode 100644
index 0000000..098eead
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_GRID_ITEM_SELECT_MANDATORY.mlm
@@ -0,0 +1,84 @@
+maintenance:
+
+ title: FORM_SET_GENERIC_GRID_ITEM_SELECT_MANDATORY;;
+ mlmname: FORM_SET_GENERIC_GRID_ITEM_SELECT_MANDATORY;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Michelle Palmer;;
+ specialist: Don Warnick;;
+ date: 2018-07-05;;
+ validation: testing;;
+
+library:
+ purpose: Prevent the user from leaving the order set w/o selecting something from the grid that calls the MLM
+ ;;
+
+ explanation: This MLM may be called from any Order Set
+
+
+ Change history
+
+ 07.05.2018 - DJW CSR# 36350 - Created for Powerscribe, but may be used for other order sets
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ // Call the Generic MLM (will be used if needed)
+
+ CalledMLM := MLM {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}};
+ this_communication,this_form := Call CalledMLM With this_communication,this_form,client_info_obj ;
+
+
+ CallingFiledName := this_communication.CallingFieldName;
+ CallingGridNumber:= (SUBSTRING 1 CHARACTERS STARTING AT 16 FROM CallingFiledName) as number;
+
+ CallingGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = CallingGridNumber);
+ CallingGridValue := CallingGrid.value;
+
+ CallingGridLabel := CallingGrid.Label;
+ CallingGridLabel := CallingGridLabel || " Section";
+
+ ReguiredOrderBox := first of (field_list where field_list.DataItemName = "MLM_Required_Order" and field_List.label = CallingGridLabel);
+ ReguiredOrderBoxValue := ReguiredOrderBox.Value;
+
+
+ if true IN CallingGridValue.IsSelected
+ then
+ ReguiredOrderBox.Value := "Item Selected";
+ else
+ ReguiredOrderBox.Value := "";
+ endif;
+
+ ;;
+ evoke: // No evoke statement
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_ITEM_CONTROL.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_ITEM_CONTROL.mlm
new file mode 100644
index 0000000..005830a
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_ITEM_CONTROL.mlm
@@ -0,0 +1,336 @@
+maintenance:
+
+ title: Generic Form Control for Order Sets;;
+ mlmname: FORM_Set_Generic_Item_Control;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair;;
+ author: Shawn Head, Eclipsys Corp ext 7468;;
+ specialist: Shawn Head, Eclipsys Corp ext 7468;;
+ date: 2012-05-22;;
+ validation: testing;;
+
+library:
+ purpose: Used to control grid items on order set forms.
+ ;;
+
+ explanation: This MLM was developed to be used by the analysts to disable, enable, auto-select items on an order set
+ This will be accomplished by adding this generic MLM to the form field they want to trigger the MLM and then
+ using the Generic MLM configuration tool to develope the logic that needs added to the MLMGenericItemControl
+ item added to the end of the order set.
+
+Change history
+
+ 5-22-2012 STH - Copied Robert Spences MLM "FORM_Set_Generic_ReadOnly" to use as template.
+ 8-28-2012 STH - CSR 30659 - Updated to add additional functionality and removed unnecessary code
+ 1-23-2013 STH - CSR 31231 - Updated to add additional functionality for auto selecting "same name" items in the same grid
+ Also standarized the logic and configuration.
+ 3-5-2013 STH - CSR 31231 - Updated to correct conflicting logic. Now MLM will process all "selected items" and then
+ circle back around to verify which items are still active and "de-selected" and then process
+ any required logic for the de-selected item configuration.
+ 4-11-2013 STH - CSR 31297 - Update and validate the de-select logic section in the code to verify accuracy of functionality.
+ ;;
+ keywords: Generic, FormOpen, Read Only, update items, CPOE, CPOE updates, CPOE items
+ ;;
+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;
+
+ LegendIn := ();
+ LegendOut := ();
+ LegendIn := ("MOI","MOC","MOG","FO");
+ LegendOut := ("MultiOrderInline","MultiOrderCheckbox","MultiOrderGrid","FormOpen");
+
+
+
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; //used to parse string data into a list
+
+ call_mlm_logic := mlm {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_LOGIC{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // get the list of configured items to be updates based on the form item MLMGenericItemControl
+ field_list:= this_form.fields;
+ //build the variable "workfield" to have the datavalue from alldataitem(s) MLMGenericItemControl added to form
+ //this variable will be used to identify how to handle items on this form based on the configuration added.
+ // workfield will be in format aaa^b^xxx,xxx,xxx^y|aaa^b^xxx,xxx,xxx^y
+ // where aaa is one of MOI, MOC, MOG (MultiOrderInLine, MultiOrderCheckBox, or MultiOrderGrid)
+ // b is the occurrence number of the Inline, Check Box or Grid that has been added to the form.
+ //xxx,xxx,xxx is the list of "orderitems" from the orderitem catalog that will be added to the grid that need to trigger the MLM
+ //y will either be YES or NO depending on if the configuration should be single item select or not.
+ workfield2 := (field_list where field_list.DataItemName = "MLMGenericItemControl" );
+ ctusrcfgitems := count workfield2;
+ workfield := "";
+ for x in (1 seqto (ctusrcfgitems)) do
+ if workfield = "" then
+ if workfield2[x].value <> "" and workfield2[x].value is not null then
+ workfield := workfield2[x].value;
+ endif;
+ else
+ if workfield2[x].value <> "" and workfield2[x].value is not null then
+ workfield := workfield || workfield2[x].value;
+ endif;
+ endif;
+ enddo;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //create a list to be used to store ALL items assigned to the calling form item (MOG, MOI, MOC)
+ calling_itemlist := ();
+ calling_itemcheck := ();
+ cfgcallorders := ();
+ cfgupdateorders := ();
+
+ //identify the "Control_MultiFieldOccNum" associated with the MultiOrder### (Grid, Item, Checkbox)
+ //based on the field calling the MLM. e.g (MultiOrderGrid(3) will return 3 in mfon and MultiOrderGrid for mfname
+ callfieldlgth := length of CallingField;
+ findpipe := FIND "|" IN STRING CallingField;
+ itemctlenght := callfieldlgth - findpipe;
+ itemstartpos := findpipe + 1;
+ mfon := substring itemctlenght characters starting at itemstartpos from CallingField;
+ mfname := substring callfieldlgth-itemctlenght-1 characters starting at 1 from CallingField;
+
+ //get the list of items in the MultiOrder field that called the MLM
+ calling_itemflds := last of (field_list where field_list.DataItemName = mfname
+ and field_List.Control_MultiFieldOccNum = (mfon as number));
+ calling_itemlist := calling_itemflds.Value;
+ calling_itemcheck := calling_itemlist.IsSelected;
+ calling_itemname1 := calling_itemlist.name;
+
+ //The Form only opens once so set the mfon to 1 for anytime the calling action is formopen
+ if (CallingEvent = "FormOpen") then
+ mfname := "FormOpen";
+ mfon := 1;
+ endif;
+
+
+ mlmconfigselecteditems := "";
+ mlmconfigdeselecteditems := "";
+ //------------------------------BEGIN SECTION 1---------------------------------------------
+ //search through the configuration added to the MLMGenericItemControl dataitem on the form and find the configuration matching
+ //the item that called the MLM. If you add this MLM to a MultiOrderGrid(30) this logic will search through the configuration
+ //added to the Data Value of the MLMGenericItemControl(s) dataitmes and find the entry for the correct configuration for the item that
+ //called the MLM. Once found it will set the variable for the calling items details and the update item details based on the configuration
+ for x in (1 seqto count LegendOut) do
+
+ //-----------------------------BEGIN SECTION 2--------------------------------------------
+ //This will verify that the calling form fields is one of the valid configured fields that can be used with this MLM
+ if mfname = LegendOut[x] then
+ matchconfig := LegendIn[x];
+ ListFields:=();
+ ListFields:= call str_parse with workfield,"|";
+
+
+ //---------------------BEGIN SECTION 3--------------------------------------------------
+ //loop through all configuration items added to MLMGenericItemControl and update form/grid/items based on configured logic.
+ //Each configuration section will be everything between the | is considered 1 configuration element/item.
+ for z in (1 seqto count ListFields) do
+
+ findconfigitem:= call str_parse with ListFields[z],"_";
+ cfgcallitemdtl := call str_parse with findconfigitem[1],"^";
+
+ //------------------BEGIN SECTION 4--------------------------------
+ //set these variables equal to the specific item/segment of the configuration
+ if ((cfgcallitemdtl[1] = matchconfig) and ((cfgcallitemdtl[2] = mfon) or ((cfgcallitemdtl[2] as number) = (mfon as number)))) then
+ cfgupdateitemdtl := call str_parse with findconfigitem[2],"^";
+ cfgcallitemtype := cfgcallitemdtl[1];
+ cfgcallitemnum := cfgcallitemdtl[2];
+ cfgcallorders := call str_parse with cfgcallitemdtl[3],",";
+ cfgcallsingleonly := cfgcallitemdtl[4];
+
+ else
+ cfgcallitemtype := null;
+ cfgcallitemnum := null;
+ cfgcallorders := null;
+ cfgcallsingleonly := null;
+
+ endif;
+
+ //------------------END SECTION 4--------------------------------
+
+
+ //--------------------BEGIN SETCTION 5-----------------------------------
+ //if there is at least 1 calling order item then set the list "call_itemlist2" equal to the value specific to that order item
+ //name in the grid
+ call_itemlist2 := ();
+ if (cfgcallorders[1] <> "") then
+
+ if (cfgcallsingleonly = "YES") then
+ call_itemlist2 := calling_itemflds.Value where calling_itemflds.Value.name is in cfgcallorders;
+
+ else
+ call_itemlist2 := calling_itemflds.Value where calling_itemflds.Value.name is in cfgcallorders and calling_itemflds.Value.IsReadOnly = false;
+ endif;
+
+ elseif cfgcallitemtype <> "" and cfgcallitemnum <> "" then
+ //if there are no order items defined in the configuration
+ // and there is a calling itemtype and number defined
+ //in the MLMGenericItemControl assume the calling item
+ //list is inclusive of all items added to the grid item that called this MLM
+ call_itemlist2 := calling_itemflds.Value;
+ endif;
+
+ //--------------------END SETCTION 5-----------------------------------
+
+ //build a list of item names and readonly values for those items
+ //so the MLM can verify at least 1 of the calling items are enabled.
+ //This allows for the MLM to only act on configuration and items
+ //that are enabled in the grid. This helps prevent contradicting
+ //configurations from overwritting as the MLM loops through all
+ //the configurations in MLMGenericItemControl
+ call_itemselected2 := ();
+ call_itemname2 := call_itemlist2.name;
+ call_itemenabled2 := call_itemlist2.Isreadonly;
+ callitemsreadonly := call_itemenabled2 where call_itemenabled2 = true;
+
+ itemct := count(call_itemname2);
+ roct := count(callitemsreadonly);
+
+
+ //-----------------BEGIN SECTION 6---------------------------------------
+ //Now we verify that there is at least 1 item in the call_itemname2 list
+ //and also verify that at least 1 item is enabled by comparing the
+ //number of items in the call_itemname2 list against the number of items
+ //in the callitemsreadonly list. If both lists are equals then this means
+ //that all items added to call_itemname2 are disabled so they could not have
+ //called the MLM so dont continue with any more logic in this section.
+ if itemct > 0 and (count(call_itemname2) > count(callitemsreadonly)) then
+
+ //Create a new list for the selection status of the calling item(s)
+ callitemselectedyn := false;
+ call_itemselected2 := call_itemlist2.IsSelected;
+
+ //cycles through all the items that were added to the list "call_itemselected2" and verifies if ANY of them are selected. if so this MLM
+ //will assume that the calling item was selected and act on it further down in the logic.
+ singleonlyselected := true where call_itemselected2 = true;
+ selectedenableditems := true where call_itemenabled2 = false and call_itemselected2 = true;
+ ctselecteditems := count(singleonlyselected);
+ ctselectedenableditems := count(selectedenableditems);
+ if cfgcallsingleonly = "YES" and ctselecteditems > 0 then
+ callitemselectedyn := true;
+ elseif ctselectedenableditems > 0 then
+ callitemselectedyn := true;
+ endif;
+
+
+ if callitemselectedyn = true or cfgcallitemtype = "FO" then
+ mlmconfigselecteditems := mlmconfigselecteditems || listfields[z] || "|";
+ elseif callitemselectedyn = false then
+ mlmconfigdeselecteditems := mlmconfigdeselecteditems || listfields[z] || "|";
+ endif;
+
+
+ endif;
+ enddo;
+
+ //This section is the section executed for any "selected" items in the calling field that match the
+ //MLM logic added to the order set form
+ if mlmconfigselecteditems[1] <> "" then
+ //testcallselected := "callingselected";
+ //break;
+ (this_communication, this_form) := call call_mlm_logic with (this_communication, this_form,client_info_obj,mlmconfigselecteditems,true,matchconfig, mfon);
+ endif;
+
+
+
+ //This section will parse through the MLM configuration for the "deselected items" and verify if there are
+ //any items that are still "enabled" and "de-selected". If so then the MLM will process the logic for
+ //how to handle the items in the calling form field based on the fact that the item is deselcted.
+ deselectedfields := call str_parse with mlmconfigdeselecteditems,"|";
+
+ //get the list of items in the MultiOrder field that called the MLM
+ deselected_itemflds := last of (field_list where field_list.DataItemName = mfname
+ and field_List.Control_MultiFieldOccNum = (mfon as number));
+
+ findconfigitem := "";
+ cfgcallitemdtl := "";
+
+ updatedeselecteditems := "";
+
+
+ for w in (1 seqto count(deselectedfields)) do
+ //msginfo := "entered forw loop";
+ //break;
+ if deselectedfields[w] <> "" then
+ //msginfo := "entered if deselectedfields[w] logic";
+ //break;
+ findconfigitem:= call str_parse with deselectedfields[w],"_";
+ cfgcallitemdtl := call str_parse with findconfigitem[1],"^";
+
+ //set these variables equal to the specific item/segment of the configuration
+ if ((cfgcallitemdtl[1] = matchconfig) and ((cfgcallitemdtl[2] = mfon) or ((cfgcallitemdtl[2] as number) = (mfon as number)))) then
+ cfgupdateitemdtl := call str_parse with findconfigitem[2],"^";
+ cfgcallitemtype := cfgcallitemdtl[1];
+ cfgcallitemnum := cfgcallitemdtl[2];
+ cfgcallorders := call str_parse with cfgcallitemdtl[3],",";
+ cfgcallsingleonly := cfgcallitemdtl[4];
+ else
+ cfgupdateitemdtl := null;
+ cfgcallitemtype := null;
+ cfgcallitemnum := null;
+ cfgcallorders := null;
+ cfgcallsingleonly := null;
+ endif;
+
+
+
+ if (cfgcallorders[1] <> "") then
+ deselectedvalues := deselected_itemflds.Value where deselected_itemflds.Value.name is in cfgcallorders;
+ deselectednames := deselectedvalues.name where deselectedvalues.IsSelected = false and deselectedvalues.IsReadOnly = false;
+ elseif cfgcallitemtype <> "" and cfgcallitemnum <> "" then
+ deselectednames := deselected_itemflds.Value where deselected_itemflds.Value.IsSelected = false and deselected_itemflds.Value.IsReadOnly = false;
+ endif;
+
+
+ if count(deselectednames) > 0 then
+ updatedeselecteditems := updatedeselecteditems || deselectedfields[w] || "|";
+ endif;
+
+
+ endif;
+ enddo;
+
+
+
+ //if there are items in the calling form filed that are de-selected AND these items
+ //match the MLM configuration then we will call the process to update the items based on the
+ //MLM configuration logic and the fact that the item is deselected.
+ if count(updatedeselecteditems) > 0 and count(deselected_itemlist) > 0 and updatedeselecteditems[1] <> "" then
+ //testcalldeselected := "call deselected";
+ //break;
+ (this_communication, this_form) := call call_mlm_logic with (this_communication, this_form,client_info_obj,updatedeselecteditems,false,matchconfig,mfon);
+ endif;
+
+ endif;
+ enddo;
+
+;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_ITEM_LOGIC.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_ITEM_LOGIC.mlm
new file mode 100644
index 0000000..afe92e7
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_ITEM_LOGIC.mlm
@@ -0,0 +1,283 @@
+maintenance:
+
+ title: ;;
+ mlmname: FORM_SET_GENERIC_ITEM_LOGIC;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: ;;
+ author: ;;
+ specialist: ;;
+ date: 2013-03-04;;
+ validation: testing;;
+
+library:
+ purpose: Process the configuration for the generic MLM based on the MLMGenericItemControl value
+ ;;
+ explanation:
+
+ change history
+ 4-11-2013 STH - CSR 31297 - Update and validate the de-select logic section in the code to verify accuracy of functionality.
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj, //Arden ClientInfo object
+ mlmlogic, //mlm logic passed by g
+ itemselected, //if this is for item selected or not
+ matchconfig,
+ mfon
+ ) := argument;
+
+
+ LegendIn := ();
+ LegendOut := ();
+ LegendIn := ("MOI","MOC","MOG","FO");
+ LegendOut := ("MultiOrderInline","MultiOrderCheckbox","MultiOrderGrid","FormOpen");
+
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; //used to parse string data into a list
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ field_list:= this_form.fields;
+ selectedfields:=();
+ //parse the MLM Logic into a list for each configuration section that needs processed
+ selectedfields:= call str_parse with mlmlogic,"|";
+
+ //cycle through each configuration logic section and act on the items based on the current calling
+ //item configuration status that matches the item(s) in the logic passed into the MLM
+ for j in (1 seqto count(selectedfields)) do
+ findconfigitem:= call str_parse with selectedfields[j],"_";
+ cfgcallitemdtl := call str_parse with findconfigitem[1],"^";
+
+ //set these variables equal to the specific item/segment of the configuration
+ if ((cfgcallitemdtl[1] = matchconfig) and ((cfgcallitemdtl[2] = mfon) or ((cfgcallitemdtl[2] as number) = (mfon as number)))) then
+ cfgupdateitemdtl := call str_parse with findconfigitem[2],"^";
+ cfgcallitemtype := cfgcallitemdtl[1];
+ cfgcallitemnum := cfgcallitemdtl[2];
+ cfgcallorders := call str_parse with cfgcallitemdtl[3],",";
+ cfgcallsingleonly := cfgcallitemdtl[4];
+ cfgupdateitemtype := cfgupdateitemdtl[1];
+ cfgupdateitemnum := cfgupdateitemdtl[2];
+ cfgupdateorders := call str_parse with cfgupdateitemdtl[3],",";
+ cfgupdateitemselect := cfgupdateitemdtl[4];
+ cfgupdateitemenable := cfgupdateitemdtl[5];
+ else
+ cfgupdateitemdtl := null;
+ cfgcallitemtype := null;
+ cfgcallitemnum := null;
+ cfgcallorders := null;
+ cfgcallsingleonly := null;
+ cfgupdateitemtype := null;
+ cfgupdateitemnum := null;
+ cfgupdateorders := null;
+ cfgupdateitemselect := null;
+ cfgupdateitemenable := null;
+ endif;
+
+ //this section will cycle through the LegendIn variable and attempt to match the configuration to one of the 3 options of MOG, MOC, MOI.
+ NumLegend:= count LegendIn;
+ update_itemlist := ();
+ tempupdate_itemslist := ();
+ for l in (1 seqto (NumLegend)) do
+ if LegendIn[l] = cfgupdateitemtype then
+ name:= LegendOut[l];
+ endif;
+ if LegendIn[l] = matchconfig then
+ callname := LegendOut[l];
+ endif;
+ enddo;
+
+ //if there is a valid configuration with MOG, MOI, or MOC then this section will build the update order items list that will need udpated
+ //based on the configuration that was added to MLMGenericItemControl data item on the order set form
+ if (name <> "") then
+ update_itemflds := last of (field_list where field_list.DataItemName = name
+ and field_List.Control_MultiFieldOccNum = (cfgupdateitemnum as number));
+
+ if cfgupdateorders[1] <> "" then
+ update_itemlist := update_itemflds.Value where update_itemflds.Value.Name in cfgupdateorders;
+ elseif cfgcallitemtype <> "" and cfgcallitemnum <> "" then
+ update_itemlist := update_itemflds.Value;
+ endif;
+
+ //build 3 lists for the update item(s) details that need updated
+ update_itemname := ();
+ update_itemcheck := ();
+ update_itemdisabled := ();
+ update_itemname := update_itemlist.name;
+ update_itemcheck := update_itemlist.IsSelected;
+ update_itemdisabled := update_itemlist.Isreadonly;
+ endif;
+
+
+ //This will set the selection status to NOSEL if the configuration in
+ //MLMGenericItemControl does not have a value in this position.
+ //if cfgupdateitemselect = "" then
+ // cfgupdateitemselect := "NOSEL";
+ //endif;
+
+ //check to make sure there are valid values in the MLMGenericItemControl that matches
+ //the logic in this if statement. This is the main update section for this MLM
+ if (cfgupdateitemselect in ("SEL","NOSEL","")) and cfgupdateitemenable in ("true","false","") then
+
+
+ callsamenamefound := false;
+ updatesamenamefound := false;
+
+ //check to see if the same order item name exists in both the
+ //configuration update section and the configuration call section
+ //indicating that this item is probably a "duplicate" same/name item
+ checkforsamenamecu := ();
+ checkforsamenamecu := true where cfgupdateorders is in cfgcallorders;
+ if (count(checkforsamenamecu) > 0) and cfgupdateitemenable <> "" then
+ callsamenamefound := true;
+ endif;
+
+ //check to see if the the items in the grid that are flagged as update items
+ //match the configuration update orders
+ checkforsamenameu := ();
+ checkforsamenameu := true where update_itemname is in cfgupdateorders;
+ if count(checkforsamenameu) > 1 then
+ updatesamenamefound := true;
+ endif;
+
+ //this sets the the 2 variables = true since FO (FormOpen) is an action
+ //and there is not selection value for FormOpen. Always assume if the
+ //configuration item is FO (FormOpen) that the values is selected to trigger MLM properly.
+ if (cfgcallitemtype = "FO") then
+ itemselected := true;
+ //updateitemselectedyn := true;
+ endif;
+
+ //This section will set a variable to the opposite boolean value
+ //of the calling item selection status. this allows for logic
+ //of opposite control (when selected de-select other items ect...
+ if itemselected = true then
+ opositeitemselected := false;
+ elseif itemselected = false then
+ opositeitemselected := true;
+ endif;
+
+
+ //autoselect/deselect item(s) without disabling when calling item selected/deselected
+
+ if cfgupdateitemselect = "SEL" and cfgupdateitemenable = "" then
+ update_itemlist.IsSelected := itemselected where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
+ //SELnull := "test";
+ //break;
+
+ //autoselect/deselect and disable/enable items when calling item selected/deselected
+ elseif cfgupdateitemselect = "SEL" and cfgupdateitemenable = "false" then
+ if updatesamenamefound = false and callsamenamefound = false then
+ update_itemlist.IsSelected := itemselected where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
+ update_itemlist.IsReadOnly := itemselected where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
+ //SELfalsesingle := "test";
+ //break;
+ elseif updatesamenamefound = true or callsamenamefound = true then
+ for j in (1 seqto count(update_itemlist)) do
+ if ((update_itemlist[j].IsSelected = false and update_itemlist[j].IsReadOnly = false)
+ or (update_itemlist[j].IsSelected = true and update_itemlist[j].IsReadOnly = true)) then
+ update_itemlist[j].IsSelected := itemselected;
+ update_itemlist[j].IsReadOnly := itemselected;
+ endif;
+ enddo;
+ endif;
+
+ //autoselect/deselect items and enable/disable item(s) when calling item selected/de-selected
+ elseif cfgupdateitemselect = "SEL" and cfgupdateitemenable = "true" then
+ update_itemlist.IsSelected := itemselected where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
+ update_itemlist.IsReadOnly := opositeitemselected where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
+ //SELtrue := "test";
+ //break;
+
+ //autenable/disable item when calling item selected/de-selected without selecting the item
+ //when unchecking the calling item all items will be de-selected before disabling again
+ elseif cfgupdateitemselect = "NOSEL" and cfgupdateitemenable = "" then
+ update_itemlist.IsSelected := opositeitemselected where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
+
+ elseif cfgupdateitemselect = "NOSEL" and cfgupdateitemenable = "true" then
+ update_itemlist.IsReadOnly := opositeitemselected where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
+ update_itemlist.IsSelected := opositeitemselected where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
+
+ elseif cfgupdateitemselect = "" and cfgupdateitemenable = "true" then
+ update_itemlist.IsReadOnly := opositeitemselected where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
+ //check to see if opositieitemselected is true meaning the selected calling item is not selected. Since the logic
+ //says to "enable" this field when the calling item is selected the expecatation would be to disable and uncheck the itme
+ //if the calling item is de-selected
+ if opositeitemselected = true then
+ update_itemlist.IsSelected := false where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
+ endif;
+
+ //autodisable and des-select item without selecting it preventing the user from selecting the item.
+ elseif (cfgupdateitemselect = "NOSEL" or cfgupdateitemselect = "") and cfgupdateitemenable = "false" then
+
+ if updatesamenamefound = false and callsamenamefound = false then
+ if itemselected = false then
+ update_itemlist.IsSelected := false where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
+ endif;
+ update_itemlist.IsReadOnly := itemselected where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
+ elseif updatesamenamefound = true or callsamenamefound = true then
+ for j in (1 seqto count(update_itemlist)) do
+ if ((update_itemlist[j].IsSelected = false and update_itemlist[j].IsReadOnly = false)
+ or (update_itemlist[j].IsSelected = false and update_itemlist[j].IsReadOnly = true)) then
+ update_itemlist[j].IsReadOnly := itemselected;
+ endif;
+ enddo;
+
+ endif;
+ endif;
+
+
+ endif;
+
+ //if the calling item is configured to restrict the item(s) in the list to be single item select only then this section
+ //will update all items defined in "call_itemlist2" to the opposite of the calling item(s) selections status.
+ //if you "select" or "check" any of the item(s) in the calling event then this section will disable all other items.
+ //if you "deselect" or "uncheck" any of the item(s) in the calling even then this section will enable all other items for available selection.
+
+ if (cfgcallitemtype <> "" and cfgcallitemnum <> "" and cfgcallsingleonly = "YES") then
+ update_itemlist := last of (field_list where field_list.DataItemName = callname
+ and field_List.Control_MultiFieldOccNum = (mfon as number));
+ update2_itemvalue := ();
+ update_itemvalue := ();
+ if cfgcallorders[1] = "" then
+ update_itemvalue := update_itemlist.Value;
+ else
+ for c in (1 seqto count(update_itemlist.Value)) do
+ for p in (1 seqto count(cfgcallorders)) do
+ if trim(cfgcallorders[p]) = trim(update_itemlist.Value[c].Name) then
+ update2_itemvalue := update2_itemvalue, update_itemlist.Value[c];
+ endif;
+ enddo;
+ enddo;
+ update_itemvalue := update2_itemvalue;
+ endif;
+ for h in (1 seqto count(update_itemvalue.IsReadOnly)) do
+ if itemselected = true and update_itemvalue[h].IsSelected = false and update_itemvalue[h].IsReadOnly = false then
+ update_itemvalue[h].IsReadOnly := true;
+ elseif itemselected = false and update_itemvalue[h].IsSelected = false and update_itemvalue[h].IsReadOnly = true then
+ update_itemvalue[h].IsReadOnly := false;
+ endif;
+ enddo;
+ endif;
+
+ enddo;
+
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_READONLY.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_READONLY.mlm
new file mode 100644
index 0000000..ab7b5bf
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_READONLY.mlm
@@ -0,0 +1,113 @@
+maintenance:
+
+ title: Generic Read Only On Order Set Open;;
+ mlmname: FORM_Set_Generic_ReadOnly;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair;;
+ author: Robert Spence, Eclipsys Corp ext 7461;;
+ specialist: Robert Spence, Eclipsys Corp ext 7461;;
+ date: 2010-02-11;;
+ validation: testing;;
+
+library:
+ purpose: Used to gray our any orderset field on form open.
+ ;;
+
+ explanation: Following this strategy to improve CPOE turnaround
+
+Change history
+
+ ;;
+ keywords: Generic, FormOpen, Read Only
+ ;;
+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;
+
+
+ LegendIn := ();
+ LegendOut := ();
+ LegendIn := ("MOI","MOC","MOG");
+ LegendOut := ("MultiOrderInline","MultiOrderCheckbox","MultiOrderGrid");
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ genfieldcall := mlm {{{SINGLE-QUOTE}}}FORM_Set_Generic_ReadOnly_FieldCall{{{SINGLE-QUOTE}}};
+
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ workfield2 := last of (field_list where field_list.DataItemName = "MLMOnOpenReadOnly_A" );
+ workfield := workfield2.value;
+
+ // workfield will be in format xxx-y|xxx-y
+ // where xxx is one of MOI, MOC, MOG
+ // y is the occurrence number of the Inline, Check Box or Grid.
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ ListFields:=();
+ ListFields:= call str_parse with workfield,"|";
+
+ NumMembs:= count ListFields;
+ NumLegend:= count LegendIn;
+
+ for k in (1 seqto (NumMembs)) do
+ intypelist := call str_parse with ListFields[k],"-";
+ intype:= first of (intypelist);
+ intypeocc:= last of (intypelist);
+
+ intypenum := intypeocc as number;
+ name:="";
+
+ for l in (1 seqto (NumLegend)) do
+ if LegendIn[l] = intype then
+ name:= LegendOut[l];
+ endif;
+ enddo;
+
+ if (name <> "") then
+
+ (this_communication, this_form) := call genfieldcall
+ with this_communication, this_form, client_info_obj,name,intypenum;
+
+ endif;
+
+ enddo;
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_READONLY_FIELDCALL.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_READONLY_FIELDCALL.mlm
new file mode 100644
index 0000000..58668cd
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_READONLY_FIELDCALL.mlm
@@ -0,0 +1,66 @@
+maintenance:
+
+ title: Generic Read Only Per Field;;
+ mlmname: FORM_Set_Generic_ReadOnly_FieldCall;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair;;
+ author: Robert Spence, Eclipsys Corp ext 7461;;
+ specialist: Robert Spence, Eclipsys Corp ext 7461;;
+ date: 2010-02-11;;
+ validation: testing;;
+
+library:
+ purpose: Used to gray our any orderset field on form open.
+ ;;
+
+ explanation: Following this strategy to improve CPOE turnaround
+
+Change history
+
+ ;;
+ keywords: Generic, FormOpen, Read Only
+ ;;
+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
+ fieldname,
+ fieldnumber
+ ) := argument;
+
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := FALSE;
+
+
+ field_list:= this_form.fields;
+
+ list_false_true := mlm {{{SINGLE-QUOTE}}}UTIL_LIST_FALSE_TRUE{{{SINGLE-QUOTE}}};
+
+ Generic1 := last of (field_list where field_list.DataItemName = fieldname and field_List.Control_MultiFieldOccNum = fieldnumber);
+ Generic1_List := Generic1.Value;
+
+ test := call list_false_true with Generic1_List.IsSelected ,true;
+ Generic1_List.IsReadOnly := test;
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_GU_ANTIBIOTICS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_GU_ANTIBIOTICS.mlm
new file mode 100644
index 0000000..8386202
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_GU_ANTIBIOTICS.mlm
@@ -0,0 +1,443 @@
+maintenance:
+
+ title: FORM_SET_GU_ANTIBIOTICS;;
+ mlmname: FORM_SET_GU_ANTIBIOTICS;;
+ 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 GU Antibiotics order set
+ ;;
+
+ explanation: This MLM is called from GU Antibiotics Order Set
+
+ Change history
+ 05.09.2016 JML CSR 34091: Created for GU Antibiotic Order Set
+ 08.18.2016 JML Adding Ceftazidime / removing Cefepime due to shortage.
+ 02.13.2018 JML CSR 35885 / 36163: Replaced gentamicin with amikacin; replaced ceftriaxone with mini-syringes due to drug shortage
+ ;;
+ keywords: Called MLMs, Antibiotic GU, 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";
+
+ // 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:="";
+
+ display_field_mlm := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_DISPLAY_FORM_FIELD{{{SINGLE-QUOTE}}};
+ 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}}};
+ antibiotic_guideline_mlm := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_DISPLAY_ANTIBIOTIC_GUIDELINES{{{SINGLE-QUOTE}}};
+
+ exceptFld := ();
+ ceftriaxone_logic_run := false;
+ gentamicin_logic_run := false;
+ amikacin_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
+ Bactrim_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 1 );
+ Nitofurantoin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 2 );
+ Ceftriaxone_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 3 );
+ Cefuroxime_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 5 );
+ Ceftriaxone2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 10 );
+// Cefepime_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 12 );
+ Ceftriaxone3_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 11 );
+// Cefepime2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 13 );
+// Gentamicin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 14 );
+ Amikacin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 21 );
+ Bactrim2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 15 );
+ Ciprofloxacin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 16 );
+ Meropenem_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 17 );
+// Gentamicin2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 18 );
+ Amikacin2_Chk := first of ( field_list WHERE field_list.DataItemname = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 22 );
+ Ceftazidime_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 20 );
+ Ceftazidime2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 19 );
+
+ Antibiotics_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 1 );
+ Antibiotics_Grid_Value := Antibiotics_Grid.Value;
+
+ Bactrim := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Sulfamethox 800mg/Trimeth 160mg DS Tab");
+ Nitofurantoin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Nitrofurantoin Macro/Mono 100mg Cap");
+ Ceftriaxone := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Ceftriaxone:" OR Antibiotics_Grid_Value.Name = "Ceftriaxone Mini-Syringe" );
+ Cefuroxime := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Cefuroxime 250mg Tab");
+// Cefepime := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Cefepime:");
+// Gentamicin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Gentamicin:");
+ Amikacin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Amikacin:");
+ Ciprofloxacin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Ciprofloxacin 500mg Tab");
+ Meropenem := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Meropenem:" );
+ Ceftazidime := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Ceftazidime:" );
+
+ Ceftriaxone_Dose := first of ( field_list WHERE field_list.DataItemName = "DosageLow" AND field_list.Control_MultiFieldOccNum = 1 );
+ Ceftriaxone_WORX_Code := first of ( field_list WHERE field_list.DataItemName = "PRX_DRUGIDCODE" AND field_list.Control_MultiFieldOccNum = 1 );
+// Gentamicin_Dose := first of ( field_list WHERE field_list.DataItemName = "DosageLow" AND field_list.Control_MultiFieldOccNum = 2 );
+ Amikacin_Dose := first of ( field_list WHERE field_list.DataItemName = "DosageLow" AND field_list.Control_MultiFieldOccNum = 3 );
+
+ ABW_Val := first of (field_list WHERE field_list.DataItemName = "PRX_ADJBodyWeight" AND field_list.Control_MultiFieldOccNum = 1 );
+
+ // 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
+ ( this_communication, this_form ) := call antibiotic_guideline_mlm WITH this_communication, this_form, client_info_obj;
+
+ for item IN Antibiotics_Grid_Value do
+ item.IsReadonly := true;
+ enddo;
+ endif;
+
+ if ( CallingEvent = "FieldChange" ) then
+
+ //********* Height / Weight Measurements *******
+ if ( CallingField = "CombinedMeasurements|1" ) then
+ if ( Ceftriaxone_Chk.Value = true OR Ceftriaxone2_Chk.Value = true OR Ceftriaxone3_Chk.Value = true ) then
+ ceftriaxone_logic_run := true;
+ endif;
+
+ if ( Amikacin_Chk.Value = true OR Amikacin2_Chk.Value = true ) then
+ amikacin_logic_run := true;
+ endif;
+/*
+ if ( Gentamicin_Chk.Value = true OR Gentamicin2_Chk.Value = true ) then
+ gentamicin_logic_run := true;
+ endif;
+*/
+ endif;
+
+ //************ BACTRIM *******************
+ if ( CallingField = "PRX_Checkbox1|1" OR CallingField = "PRX_Checkbox1|15" ) then
+ if ( CallingField = "PRX_Checkbox1|1" ) then
+ fieldValue := Bactrim_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|15" ) then
+ fieldValue := Bactrim2_Chk.Value;
+ endif;
+
+ if ( fieldValue = true ) then
+ Bactrim.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Bactrim.IsSelected := false;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //********* NITOFURANTOIN *****************
+ if ( CallingField = "PRX_Checkbox1|2" ) then
+ fieldValue := Nitofurantoin_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Nitofurantoin.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Nitofurantoin.IsSelected := false;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //****************** CEFTRIAXONE **********************
+ if ( CallingField = "PRX_Checkbox1|3" OR CallingField = "PRX_Checkbox1|10" OR CallingField = "PRX_Checkbox1|11" ) then
+
+ if ( CallingField = "PRX_Checkbox1|3" ) then
+ fieldValue := Ceftriaxone_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|10" ) then
+ fieldValue := Ceftriaxone2_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|11" ) then
+ fieldValue := Ceftriaxone3_Chk.Value;
+// exceptFld := exceptFld, Gentamicin_Chk.DataItemName || "|" || Gentamicin_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Amikacin_Chk.DataItemName || "|" || Amikacin_Chk.Control_MultiFieldOccNum;
+ endif;
+
+ if ( fieldValue = true ) then
+ Ceftriaxone.IsSelected := true;
+
+ ceftriaxone_logic_run := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ ceftriaxone_logic_run := false;
+ Ceftriaxone.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //*********** CEFUROXIME ********************
+ if ( CallingField = "PRX_Checkbox1|5" ) then
+ fieldValue := Cefuroxime_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Cefuroxime.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Cefuroxime.IsSelected := false;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //******************* CEFEPIME **********************
+/*
+ if ( CallingField = "PRX_Checkbox1|12" OR CallingField = "PRX_Checkbox1|13" ) then
+ if ( CallingField = "PRX_Checkbox1|12" ) then
+ fieldValue := Cefepime_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|13" ) then
+ fieldValue := Cefepime2_Chk.Value;
+ exceptFld := exceptFld, Gentamicin_Chk.DataItemName || "|" || Gentamicin_Chk.Control_MultiFieldOccNum;
+ endif;
+
+ if ( fieldValue = true ) then
+ Cefepime.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Cefepime.IsSelected := false;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+*/
+ //*********** CEFTAZIDIME *******************
+ if ( CallingField = "PRX_Checkbox1|19" OR CallingField = "PRX_Checkbox1|20" ) then
+ if ( CallingField = "PRX_Checkbox1|19" ) then
+ fieldValue := Ceftazidime2_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|20" ) then
+ fieldValue := Ceftazidime_Chk.Value;
+// exceptFld := exceptFld, Gentamicin_Chk.DataItemName || "|" || Gentamicin_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Amikacin_Chk.DataItemName || "|" || Amikacin_Chk.Control_MultiFieldOccNum;
+ endif;
+
+ if ( fieldValue = true ) then
+ Ceftazidime.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Ceftazidime.IsSelected := false;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //*********** GENTAMICIN **********************
+/*
+ if ( CallingField = "PRX_Checkbox1|14" OR CallingField = "PRX_Checkbox1|18" ) then
+ if ( CallingField = "PRX_Checkbox1|14" ) then
+ fieldValue := Gentamicin_Chk.Value;
+
+ exceptFld := exceptFld, Ceftriaxone3_Chk.DataItemName || "|" || Ceftriaxone3_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Ceftazidime_Chk.DataItemName || "|" || Ceftazidime_Chk.Control_MultiFieldOccNum;
+ elseif ( CallingField = "PRX_Checkbox1|18" ) then
+ fieldValue := Gentamicin2_Chk.Value;
+
+ exceptFld := exceptFld, Meropenem_Chk.DataItemName || "|" || Meropenem_Chk.Control_MultiFieldOccNum;
+ endif;
+
+ if ( fieldValue = true ) then
+ Gentamicin.IsSelected := true;
+
+ gentamicin_logic_run := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Gentamicin.IsSelected := false;
+
+ gentamicin_logic_run := false;
+ endif;
+ endif;
+*/
+
+ //*********** AMIKACIN *********************************
+ if ( CallingField = "PRX_Checkbox1|21" OR CallingField = "PRX_Checkbox1|22" ) then
+ if ( CallingField = "PRX_Checkbox1|21" ) then
+ fieldValue := Amikacin_Chk.Value;
+
+ exceptFld := exceptFld, Ceftriaxone3_Chk.DataItemName || "|" || Ceftriaxone3_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Ceftazidime_Chk.DataItemName || "|" || Ceftazidime_Chk.Control_MultiFieldOccNum;
+ elseif ( CallingField = "PRX_Checkbox1|22" ) then
+ fieldValue := Amikacin2_Chk.Value;
+
+ exceptFld := exceptFld, Meropenem_Chk.DataItemName || "|" || Meropenem_Chk.Control_MultiFieldOccNum;
+ endif;
+
+ if ( fieldValue = true ) then
+ Amikacin.IsSelected := true;
+
+ amikacin_logic_run := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Amikacin.IsSelected := false;
+
+ amikacin_logic_run := false;
+
+ if ( CallingField = "PRX_Checkbox1|21" AND Ceftriaxone3_Chk.Value = false AND Ceftazidime_Chk.Value = false ) then
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+
+ if ( CallingField = "PRX_Checkbox1|22" AND Meropenem_Chk.Value = false ) then
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+
+ endif;
+ endif;
+
+ //*********** CIPROFLOXACIN ******************
+ if ( CallingField = "PRX_Checkbox1|16" ) then
+ fieldValue := Ciprofloxacin_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Ciprofloxacin.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Ciprofloxacin.IsSelected := false;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //********** MEROPENEM ***********************
+ if ( CallingField = "PRX_Checkbox1|17" ) then
+ fieldValue := Meropenem_Chk.Value;
+// exceptFld := exceptFld, Gentamicin2_Chk.DataItemName || "|" || Gentamicin2_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Amikacin2_Chk.DataItemName || "|" || Amikacin2_Chk.Control_MultiFieldOccNum;
+
+ if ( fieldValue = true ) then
+ Meropenem.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Meropenem.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ endif; //End FieldChange
+
+ if ( ceftriaxone_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
+ Ceftriaxone_Dose.Value := ( 1 as number );
+ if ( Ceftriaxone.Name = "Ceftriaxone:" ) then
+ Ceftriaxone_WORX_Code.Value := "08561P";
+ elseif ( Ceftriaxone.Name = "Ceftriaxone Mini-Syringe" ) then
+ Ceftriaxone_WORX_Code.Value := "08561";
+ endif;
+
+ elseif ( weightvalue >= 80 ) then
+ Ceftriaxone_Dose.Value := ( 2 as number );
+
+ if ( Ceftriaxone.Name = "Ceftriaxone:" ) then
+ Ceftriaxone_WORX_Code.Value := "08555P";
+ elseif ( Ceftriaxone.Name = "Ceftriaxone Mini-Syringe" ) then
+ Ceftriaxone_WORX_Code.Value := "08555";
+ endif;
+
+ endif;
+ endif;
+ endif;
+
+/*
+ if ( gentamicin_logic_run = true ) then
+ //Calculate Gentamicin dosing
+ //Get ABW
+ if ( weightvalue = 0 OR weightvalue IS NULL OR ht = 0 OR ht IS NULL ) then
+ dialogResult := 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}}};
+ else
+ this_communication, this_form, ABW := call calc_abw_mlm WITH this_communication, this_form, client_info_obj;
+ ABW_Val.Value := ( ABW as number );
+
+ rawGentDose := ( ( ABW as number ) * 5);
+ roundingFactor := 20;
+ halfRoundingFactor := 10;
+
+ rounded_dose := int((rawGentDose + halfRoundingFactor)/roundingFactor) * roundingFactor;
+
+ Gentamicin_Dose.Value := rounded_dose;
+ endif;
+ endif;
+*/
+ if ( amikacin_logic_run = true ) then
+ //Calculate Amikacin dosing
+ //Get ABW
+ if ( weightvalue = 0 OR weightvalue IS NULL OR ht = 0 OR ht IS NULL ) then
+ dialogResult := 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}}};
+ else
+ this_communication, this_form, ABW := call calc_abw_mlm WITH this_communication, this_form, client_info_obj;
+ ABW_Val.Value := ( ABW as number );
+
+ rawAmikDose := ( ( ABW as number ) * 7.5);
+ roundingFactor := 25;
+ halfRoundingFactor := 12.5;
+
+ rounded_dose := int((rawAmikDose + halfRoundingFactor)/roundingFactor) * roundingFactor;
+
+ Amikacin_Dose.Value := rounded_dose;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEMODIALYSIS_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEMODIALYSIS_ORDERS.mlm
new file mode 100644
index 0000000..75b8fbc
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEMODIALYSIS_ORDERS.mlm
@@ -0,0 +1,169 @@
+maintenance:
+
+ title: FORM_SET_HEMODIALYSIS_ORDERS;;
+ mlmname: FORM_SET_HEMODIALYSIS_ORDERS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Maya Poojari;;
+ specialist: Don Warnick;;
+ date: 2016-08-17;;
+ validation: testing;;
+
+library:
+ purpose: Select a pharmacy order from a grid and other orders will be unselectable.
+ ;;
+
+ explanation: This MLM is called from the Hemodialysis Orders Order Set
+
+
+ Change history
+
+ 08.17.2016 - DJW CSR# 34858 - Created
+ 03.10.2017 - DJW CSR# 34858 - Altered the MLM for changes made to the OS after the MLM was deployed to Production.
+
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ // Define the grid
+
+ MedOrderGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 6);
+
+ MedOrderGrid.Value[08].IsReadOnly := false;
+ MedOrderGrid.Value[09].IsReadOnly := false;
+ MedOrderGrid.Value[10].IsReadOnly := false;
+ MedOrderGrid.Value[11].IsReadOnly := false;
+
+/*
+
+ if MedOrderGrid.Value[11].IsSelected = true // Ferric Gluconate Complex
+ then
+
+ MedOrderGrid.Value[12].IsSelected := false;
+ MedOrderGrid.Value[13].IsSelected := false;
+ MedOrderGrid.Value[14].IsSelected := false;
+ MedOrderGrid.Value[12].IsReadOnly := true;
+ MedOrderGrid.Value[13].IsReadOnly := true;
+ MedOrderGrid.Value[14].IsReadOnly := true;
+
+
+ elseif MedOrderGrid.Value[12].IsSelected = true // Iron Sucrose Complex
+ then
+
+ MedOrderGrid.Value[11].IsSelected := false;
+ MedOrderGrid.Value[13].IsSelected := false;
+ MedOrderGrid.Value[14].IsSelected := false;
+ MedOrderGrid.Value[11].IsReadOnly := true;
+ MedOrderGrid.Value[13].IsReadOnly := true;
+ MedOrderGrid.Value[14].IsReadOnly := true;
+
+
+ elseif MedOrderGrid.Value[13].IsSelected = true // Ferric Gluconate Complex Weekly
+ then
+
+ MedOrderGrid.Value[11].IsSelected := false;
+ MedOrderGrid.Value[12].IsSelected := false;
+ MedOrderGrid.Value[14].IsSelected := false;
+ MedOrderGrid.Value[11].IsReadOnly := true;
+ MedOrderGrid.Value[12].IsReadOnly := true;
+ MedOrderGrid.Value[14].IsReadOnly := true;
+
+ elseif MedOrderGrid.Value[14].IsSelected = true // Iron Sucrose Complex Weekly
+ then
+
+ MedOrderGrid.Value[11].IsSelected := false;
+ MedOrderGrid.Value[12].IsSelected := false;
+ MedOrderGrid.Value[13].IsSelected := false;
+ MedOrderGrid.Value[11].IsReadOnly := true;
+ MedOrderGrid.Value[12].IsReadOnly := true;
+ MedOrderGrid.Value[13].IsReadOnly := true;
+ endif;
+*/
+
+ if MedOrderGrid.Value[8].IsSelected = true // Ferric Gluconate Complex
+ then
+
+ MedOrderGrid.Value[09].IsSelected := false;
+ MedOrderGrid.Value[10].IsSelected := false;
+ MedOrderGrid.Value[11].IsSelected := false;
+
+ MedOrderGrid.Value[09].IsReadOnly := true;
+ MedOrderGrid.Value[10].IsReadOnly := true;
+ MedOrderGrid.Value[11].IsReadOnly := true;
+
+
+ elseif MedOrderGrid.Value[09].IsSelected = true // Iron Sucrose Complex
+ then
+
+ MedOrderGrid.Value[08].IsSelected := false;
+ MedOrderGrid.Value[10].IsSelected := false;
+ MedOrderGrid.Value[11].IsSelected := false;
+
+ MedOrderGrid.Value[08].IsReadOnly := true;
+ MedOrderGrid.Value[10].IsReadOnly := true;
+ MedOrderGrid.Value[11].IsReadOnly := true;
+
+
+ elseif MedOrderGrid.Value[10].IsSelected = true // Ferric Gluconate Complex Weekly
+ then
+
+ MedOrderGrid.Value[08].IsSelected := false;
+ MedOrderGrid.Value[09].IsSelected := false;
+ MedOrderGrid.Value[11].IsSelected := false;
+
+ MedOrderGrid.Value[08].IsReadOnly := true;
+ MedOrderGrid.Value[09].IsReadOnly := true;
+ MedOrderGrid.Value[11].IsReadOnly := true;
+
+ elseif MedOrderGrid.Value[11].IsSelected = true // Iron Sucrose Complex Weekly
+ then
+
+ MedOrderGrid.Value[08].IsSelected := false;
+ MedOrderGrid.Value[09].IsSelected := false;
+ MedOrderGrid.Value[10].IsSelected := false;
+
+ MedOrderGrid.Value[08].IsReadOnly := true;
+ MedOrderGrid.Value[09].IsReadOnly := true;
+ MedOrderGrid.Value[10].IsReadOnly := true;
+ endif;
+
+
+
+
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEMORRHAGIC_STROKE_OS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEMORRHAGIC_STROKE_OS.mlm
new file mode 100644
index 0000000..ab5319c
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEMORRHAGIC_STROKE_OS.mlm
@@ -0,0 +1,327 @@
+maintenance:
+
+ title: FORM_SET_HEMORRHAGIC_STROKE_OS;;
+ mlmname: FORM_SET_HEMORRHAGIC_STROKE_OS;;
+ arden: version 2.5;;
+ version: 15.10;;
+ institution: St Clair Hospital;;
+ author: Shivprasad Jadhav, Allscripts ;;
+ specialist: Dr. Janardhan Chavan, Allscripts;;
+ date: 2016-05-09;;
+ validation: testing;;
+
+library:
+ purpose: When user selects any UDDI or gets checked from user, then respective item should get selected from below grid,
+ and there are some orders which should be grayed out for this details please refer to Details Tab and Screen Shot tab
+ ;;
+
+ explanation: This MLM is called from Hemorrhagic Stroke Order Set
+
+ Change history
+ ------------------------------------------------------------------------------------
+ 06.01.2017 SSJ CSR 35323: Created for Hemorrhagic Stroke Order Set
+ 06.21.2018 TMS CSR 36420: Add copy of Hemorrhagic Stroke Order Set to allow prechecking of
+ Warfarin Reversal or NOAC Reversal to enable correct logic on called order
+ set depending upon option selected on Parent Order Set.
+
+ ;;
+ keywords: Called MLMs, Hemorrhagic Stroke
+ ;;
+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";
+
+ // 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:="";
+ BaseMLM := MLM {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING_INDICATIONS_FOR_OS{{{SINGLE-QUOTE}}} ;
+ enable_chkbx_mlm := mlm {{{SINGLE-QUOTE}}}FORM_Func_Disable_OS_Checkboxes{{{SINGLE-QUOTE}}};
+
+ exceptFld := ();
+ FFPSel := 0 ;
+
+ // 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
+ Chk_Phyto := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 1 );
+ Chk_KCentra1 := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 2 );
+ Chk_FFP1 := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 3 );
+
+ Chk_KCentra2 := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 4 );
+ Chk_FFP2 := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 5 );
+
+ Chk_Idaruci := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 6 );
+ Chk_FFP3 := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 7 );
+
+ Chk_Prota := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 8 );
+ Chk_FFP4 := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 9 );
+
+ Order_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 62 );
+ Order2_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 68 );
+ FFP_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 69 );
+ Order_Grid_Value := Order_Grid.Value;
+ Order2_Grid_Value := Order2_Grid.Value;
+ FFP_Grid_Value := FFP_Grid.Value;
+
+ G_Phyto := first of ( Order_Grid_Value WHERE Order_Grid_Value.Name = "Phytonadione:" );
+ G_Prota := first of ( Order_Grid_Value WHERE Order_Grid_Value.Name Matches Pattern "Protamine%" );
+ G_Prothro := Order2_Grid_Value[1] ; //Name = "Prothrombin Complex Concentrate for Emergent Warfarin Reversal" For Warfarin Reversal
+ G_Prothro2 := Order2_Grid_Value[2] ; //Name = "Prothrombin Complex Concentrate for Emergent Warfarin Reversal" For NOAC Reversal
+ G_Idaruci := Order2_Grid_Value[3] ; //Name = "Idarucizumab 5gm"
+ G_FFP := FFP_Grid_Value[1] ; // Name = "FFP Orders"
+
+
+
+ if ( CallingEvent = "FormOpen" ) then
+ //To Call Base MLM
+ (this_communication, this_form) := call BaseMLM WITH this_communication, this_form, client_info_obj;
+
+ for item IN Order_Grid_Value do
+ item.IsReadonly := true;
+ enddo;
+ for item IN Order2_Grid_Value do
+ item.IsReadonly := true;
+ enddo;
+ for item IN FFP_Grid_Value do
+ item.IsReadonly := False;
+ enddo;
+ endif;
+
+ if ( CallingEvent = "FieldChange" ) then
+
+
+ //********** Phytonadione ********************
+ if ( CallingField = "PRX_Checkbox1|1" ) then
+ fieldValue := Chk_Phyto.Value;
+
+ exceptFld := exceptFld, CHK_Prota.DataItemName || "|" || CHK_Prota.Control_MultiFieldOccNum,
+ Chk_FFP4.DataItemName || "|" || Chk_FFP4.Control_MultiFieldOccNum ;
+ If Chk_FFP1.Value = True Then exceptFld := exceptFld,Chk_FFP1.DataItemName || "|" || Chk_FFP1.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If Chk_FFP2.Value = True Then exceptFld := exceptFld,Chk_FFP2.DataItemName || "|" || Chk_FFP2.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If Chk_FFP3.Value = True Then exceptFld := exceptFld,Chk_FFP3.DataItemName || "|" || Chk_FFP3.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If FFPSel = 0 Then exceptFld := exceptFld,Chk_FFP1.DataItemName || "|" || Chk_FFP1.Control_MultiFieldOccNum; EndIf;
+
+ if ( fieldValue = true ) then
+
+ G_Phyto.IsSelected := true ;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ G_Phyto.IsSelected := False;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+ endif;
+ endif;
+
+ //************** KCentra Order **************
+ if ( CallingField = "PRX_Checkbox1|2" ) then
+ fieldValue := CHK_KCentra1.Value;
+ exceptFld := exceptFld, CHK_Prota.DataItemName || "|" || CHK_Prota.Control_MultiFieldOccNum,
+ Chk_FFP4.DataItemName || "|" || Chk_FFP4.Control_MultiFieldOccNum ;
+ If Chk_FFP1.Value = True Then exceptFld := exceptFld,Chk_FFP1.DataItemName || "|" || Chk_FFP1.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If Chk_FFP2.Value = True Then exceptFld := exceptFld,Chk_FFP2.DataItemName || "|" || Chk_FFP2.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If Chk_FFP3.Value = True Then exceptFld := exceptFld,Chk_FFP3.DataItemName || "|" || Chk_FFP3.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If FFPSel = 0 Then exceptFld := exceptFld,Chk_FFP1.DataItemName || "|" || Chk_FFP1.Control_MultiFieldOccNum; EndIf;
+
+ if ( fieldValue = true ) then
+ G_Prothro.IsSelected := True;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ G_Prothro.IsSelected := False;
+
+ if ( CHK_KCentra2.Value = false ) then
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+ endif;
+ endif;
+ endif;
+
+
+ if ( CallingField = "PRX_Checkbox1|4" ) then
+ fieldValue := CHK_KCentra2.Value;
+ exceptFld := exceptFld, CHK_Prota.DataItemName || "|" || CHK_Prota.Control_MultiFieldOccNum,
+ Chk_FFP4.DataItemName || "|" || Chk_FFP4.Control_MultiFieldOccNum ;
+ If Chk_FFP1.Value = True Then exceptFld := exceptFld,Chk_FFP1.DataItemName || "|" || Chk_FFP1.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If Chk_FFP2.Value = True Then exceptFld := exceptFld,Chk_FFP2.DataItemName || "|" || Chk_FFP2.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If Chk_FFP3.Value = True Then exceptFld := exceptFld,Chk_FFP3.DataItemName || "|" || Chk_FFP3.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If FFPSel = 0 Then exceptFld := exceptFld,Chk_FFP2.DataItemName || "|" || Chk_FFP2.Control_MultiFieldOccNum; EndIf;
+
+ if ( fieldValue = true ) then
+ G_Prothro2.IsSelected := True;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ G_Prothro2.IsSelected := False;
+
+ if ( CHK_KCentra1.Value = false ) then
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+ endif;
+ endif;
+ endif;
+
+ //************** Idarucizumab 2.5 Grams ********************
+ if ( CallingField = "PRX_Checkbox1|6" ) then
+ fieldValue := Chk_Idaruci.Value;
+
+ exceptFld := exceptFld, CHK_Prota.DataItemName || "|" || CHK_Prota.Control_MultiFieldOccNum,
+ Chk_FFP4.DataItemName || "|" || Chk_FFP4.Control_MultiFieldOccNum;
+ If Chk_FFP1.Value = True Then exceptFld := exceptFld,Chk_FFP1.DataItemName || "|" || Chk_FFP1.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If Chk_FFP2.Value = True Then exceptFld := exceptFld,Chk_FFP2.DataItemName || "|" || Chk_FFP2.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If Chk_FFP3.Value = True Then exceptFld := exceptFld,Chk_FFP3.DataItemName || "|" || Chk_FFP3.Control_MultiFieldOccNum; FFPSel :=1 ; EndIf;
+ If FFPSel = 0 Then exceptFld := exceptFld,Chk_FFP3.DataItemName || "|" || Chk_FFP3.Control_MultiFieldOccNum; EndIf;
+
+ if ( fieldValue = true ) then
+ G_Idaruci.IsSelected := true;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ G_Idaruci.IsSelected := false;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+ endif;
+ endif;
+
+ //************** Fresh Frozen Plasma ********************
+ if ( CallingField = "PRX_Checkbox1|3" ) then
+ fieldValue := Chk_FFP1.Value;
+ exceptFld := exceptFld, CHK_Phyto.DataItemName || "|" || CHK_Phyto.Control_MultiFieldOccNum,
+ CHK_KCentra1.DataItemName || "|" || CHK_KCentra1.Control_MultiFieldOccNum,
+ CHK_KCentra2.DataItemName || "|" || CHK_KCentra2.Control_MultiFieldOccNum,
+ CHK_Idaruci.DataItemName || "|" || CHK_Idaruci.Control_MultiFieldOccNum,
+ CHK_Prota.DataItemName || "|" || CHK_Prota.Control_MultiFieldOccNum,
+ CHK_FFP4.DataItemName || "|" || CHK_FFP4.Control_MultiFieldOccNum ;
+
+ if ( fieldValue = true ) then
+ G_FFP.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ if ( Chk_FFP2.Value = false And Chk_FFP3.Value = false and Chk_FFP4.Value = false ) then
+ G_FFP.IsSelected := False;
+ endif;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld ;
+
+ endif;
+ endif;
+ if ( CallingField = "PRX_Checkbox1|5" ) then
+ fieldValue := Chk_FFP2.Value;
+ exceptFld := exceptFld, CHK_Phyto.DataItemName || "|" || CHK_Phyto.Control_MultiFieldOccNum,
+ CHK_KCentra1.DataItemName || "|" || CHK_KCentra1.Control_MultiFieldOccNum,
+ CHK_KCentra2.DataItemName || "|" || CHK_KCentra2.Control_MultiFieldOccNum,
+ CHK_Idaruci.DataItemName || "|" || CHK_Idaruci.Control_MultiFieldOccNum,
+ CHK_Prota.DataItemName || "|" || CHK_Prota.Control_MultiFieldOccNum,
+ CHK_FFP4.DataItemName || "|" || CHK_FFP4.Control_MultiFieldOccNum ;
+
+ if ( fieldValue = true ) then
+ G_FFP.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ if ( Chk_FFP1.Value = false And Chk_FFP3.Value = false and Chk_FFP4.Value = false ) then
+ G_FFP.IsSelected := False;
+ endif;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld ;
+
+ endif;
+ endif;
+
+ if ( CallingField = "PRX_Checkbox1|7" ) then
+ fieldValue := Chk_FFP3.Value;
+ exceptFld := exceptFld, CHK_Phyto.DataItemName || "|" || CHK_Phyto.Control_MultiFieldOccNum,
+ CHK_KCentra1.DataItemName || "|" || CHK_KCentra1.Control_MultiFieldOccNum,
+ CHK_KCentra2.DataItemName || "|" || CHK_KCentra2.Control_MultiFieldOccNum,
+ CHK_Idaruci.DataItemName || "|" || CHK_Idaruci.Control_MultiFieldOccNum,
+ CHK_Prota.DataItemName || "|" || CHK_Prota.Control_MultiFieldOccNum,
+ CHK_FFP4.DataItemName || "|" || CHK_FFP4.Control_MultiFieldOccNum ;
+
+ if ( fieldValue = true ) then
+ G_FFP.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ if ( Chk_FFP1.Value = false And Chk_FFP2.Value = false and Chk_FFP4.Value = false ) then
+ G_FFP.IsSelected := False;
+ endif;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+ endif;
+ endif;
+
+ if ( CallingField = "PRX_Checkbox1|9" ) then
+ fieldValue := Chk_FFP4.Value;
+ exceptFld := exceptFld, CHK_Phyto.DataItemName || "|" || CHK_Phyto.Control_MultiFieldOccNum,
+ CHK_KCentra1.DataItemName || "|" || CHK_KCentra1.Control_MultiFieldOccNum,
+ CHK_KCentra2.DataItemName || "|" || CHK_KCentra2.Control_MultiFieldOccNum,
+ CHK_Idaruci.DataItemName || "|" || CHK_Idaruci.Control_MultiFieldOccNum,
+ CHK_Prota.DataItemName || "|" || CHK_Prota.Control_MultiFieldOccNum,
+ CHK_FFP4.DataItemName || "|" || CHK_FFP4.Control_MultiFieldOccNum ;
+ If Chk_FFP1.Value = True Then exceptFld := exceptFld,Chk_FFP1.DataItemName || "|" || Chk_FFP1.Control_MultiFieldOccNum; EndIf;
+ If Chk_FFP2.Value = True Then exceptFld := exceptFld,Chk_FFP2.DataItemName || "|" || Chk_FFP2.Control_MultiFieldOccNum; EndIf;
+ If Chk_FFP3.Value = True Then exceptFld := exceptFld,Chk_FFP3.DataItemName || "|" || Chk_FFP3.Control_MultiFieldOccNum; EndIf;
+
+ if ( fieldValue = true ) then
+ G_FFP.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+
+ if ( Chk_FFP1.Value = false And Chk_FFP2.Value = false and Chk_FFP3.Value = false ) then
+ G_FFP.IsSelected := False;
+ endif;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+
+ endif;
+ endif;
+
+ //********** Protamine ********************
+ if ( CallingField = "PRX_Checkbox1|8" ) then
+ fieldValue := Chk_Prota.Value;
+
+ if ( fieldValue = true ) then
+ G_Prota.IsSelected := true ;
+ //rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ G_Prota.IsSelected := False;
+
+ //rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+ endif;
+ endif;
+
+ endif; //End 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_ACS_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_ACS_ORDERS.mlm
new file mode 100644
index 0000000..75a0464
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_ACS_ORDERS.mlm
@@ -0,0 +1,427 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_ACS_Orders;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in ACS order set
+ ;;
+
+ explanation: This MLM is called from the ACS With heparin order set
+ Change History
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 07.20.2011 TMS Added handling for additional instruction in orderset
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+ ;;
+ keywords: Called MLMs, ACS, ED
+ ;;
+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;
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ //-----------BEGIN COPY SECTION-------------------added By shivprasad
+ DisplayNewScheduled := first of (field_list.Value
+ where field_list.DataItemName = "LAB_CB_Alternate Priorities");
+
+ if (DisplayNewScheduled) then
+ Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
+ (this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
+ endif;
+ //-----------END COPY SECTION-------------------
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+
+ comb_ht_wt_fld := first of (field_list
+ where field_list.DataItemName = "CombinedMeasurements");
+
+
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Labs_List := Labs_fld.Value;
+
+ //Find the three checkboxes that may need to be ordered with this protocol
+ Found_CBC:= first of (Labs_list where Labs_list.Name = "CBC (Includes Diff)");
+ Found_INR:= first of (Labs_list where Labs_list.Name = "Prothrombin/INR");
+ Found_APTT:= first of (Labs_list where Labs_list.Name = "APTT");
+
+
+/*
+ // Peform logic based on the value of the New Order Diabetes
+ If NOD_Selected = True then
+ Found_DietConOrder.IsSelected := True;
+ Found_DietConOrder.IsReadOnly := True;
+*/
+
+ CheckAPTT:=False;
+ CheckCBC:=False;
+ CheckINR:=False;
+
+ Mlt_Order_Line:= first of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Mlt_List := Mlt_Order_Line.Value;
+
+ Meds_fld7 := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 7);
+ Meds_list7 :=Meds_fld7.Value;
+
+
+ Meds_fld8 := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 8);
+ Meds_list8 :=Meds_fld8.Value;
+
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 9);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+//////////////
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 10);
+
+ Lab_Rem_List := Lab_Rem.Value;
+
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+///////////////////////
+
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+////////////
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+
+
+ If CallingEvent = "FormOpen" then
+ Mlt_List.IsReadOnly := (True,True,True,True,True,True,True,True);
+ // Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+
+ // Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ Lab_Daily_List.IsReadOnly:= (False,True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+
+
+ elseif CallingEvent = "FieldChange" then
+ If (CallingField = "MultiOrderGrid|7") or (CallingField= "MultiOrderGrid|8") then
+
+ If (first(Meds_list7.IsSelected) = True) or (first(Meds_list8.IsSelected) = True) then
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+ Fnd_Daily.IsSelected := True;
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+
+ else
+
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False);
+ endif;
+
+ elseif callingfield = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")"
+ ;
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ endif; // fieldchange calling field
+
+
+
+
+
+ elseif CallingEvent = "FormClose" then
+ If (first(Meds_list7.IsSelected) = True) or (first(Meds_list8.IsSelected) = True) then
+
+ comb_ht_wt_val := comb_ht_wt_fld.Value;
+
+ wt := comb_ht_wt_val.weight;
+
+
+ if (wt is null) then
+
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "To Complete The Heparin Protocol:\n\n Please Enter A Weight For This Patient";
+ this_communication.MessageType := "Error";
+ else
+
+ If (Found_CBC.IsSelected =false) or (Found_INR.IsSelected = false) or (Found_APTT.IsSelected= false) then
+
+ If Found_CBC.ISSelected = False then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists CBC_Val then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_CBC.ISSelected :=True;
+ endif;
+
+ endif;
+
+// Now for INR
+
+ If Found_INR.ISSelected = False then
+
+ INR_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists INR_Val then
+ CheckINR:=False;
+ else
+ Found_INR.ISSelected :=True;
+ CheckINR:=True;
+ endif;
+
+ endif;
+
+// Now for APTT
+
+ If Found_APTT.ISSelected = False then
+
+ APTT_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists APTT_Val then
+ CheckAPTT:=False;
+ else
+ Found_APTT.ISSelected :=True;
+ CheckAPTT:=True;
+ endif;
+
+ endif; // found APTT
+
+ endif; // checkbox checked or not
+
+ // here for CBC Deselected
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+
+ singledate := formlist[J];
+
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+
+
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
+
+
+
+
+ endif; //If exist
+
+
+ endif; // wt is null
+ endif; // either heparin checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ endif; // calling event
+
+
+/* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Creating CBC :" || CheckCBC || "\n" ||
+ "Creating INR :" || CheckINR || "\n" ||
+ "Creating APTT:" || CheckAPTT ;
+ this_communication.MessageType := "Informational";
+
+*/
+
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_BLOOD_COAG_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_BLOOD_COAG_ORDERS.mlm
new file mode 100644
index 0000000..15b3e0c
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_BLOOD_COAG_ORDERS.mlm
@@ -0,0 +1,507 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_Blood_Coag_Orders;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in Blood Formation Coagulation Order Set
+ ;;
+
+ explanation: This MLM is called from the Blood Formation Coagulation With heparin order set
+ Change History
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 07.20.2011 TMS Added handling for additional instruction in orderset
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ ;;
+ keywords: Called MLMs, Blood Formation , ED
+ ;;
+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:="";
+
+
+ // Use String parse
+ 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;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //
+
+ comb_ht_wt_fld := first of (field_list
+ where field_list.DataItemName = "CombinedMeasurements");
+
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Labs_List := Labs_fld.Value;
+
+ //Find the three checkboxes that may need to be ordered with this protocol
+ Found_CBC:= first of (Labs_list where Labs_list.Name = "CBC (Includes Diff)");
+ Found_INR:= first of (Labs_list where Labs_list.Name = "Prothrombin/INR");
+ Found_APTT:= first of (Labs_list where Labs_list.Name = "APTT");
+
+
+ CheckAPTT:=False;
+ CheckCBC:=False;
+ CheckINR:=False;
+
+ Mlt_Order_Line:= first of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Mlt_List := Mlt_Order_Line.Value;
+
+
+ Card_Prot_W_Bolus := first of (field_list where field_list.DataItemName = "PRX_Heparin_CCM_withBolus");
+ Card_Prot_N_Bolus := first of (field_list where field_list.DataItemName = "PRX_Heparin_CCM_w-oBolus");
+ Weight_Prot_W_Bolus := first of (field_list where field_list.DataItemName = "PRX_Heparin_WB_withBolus");
+ Weight_Prot_N_Bolus := first of (field_list where field_list.DataItemName = "PRX_Heparin_WB_w-oBolus");
+
+
+
+/////////////////
+ CP_WB_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 7);
+ CP_WB_List :=CP_WB_Grid.Value;
+ Fnd_CP_WB := first of (CP_WB_List where CP_WB_List.Name = "Heparin Inj.");
+ Fnd_CP_WB.IsReadOnly := True;
+
+/////////////
+ CP_NB_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 8);
+ CP_NB_List :=CP_NB_Grid.Value;
+ Fnd_CP_NB := first of (CP_NB_List where CP_NB_List.Name = "Heparin 25,000 Units+ D5W 500ml");
+ Fnd_CP_NB.IsReadOnly := True;
+/////////////
+ WP_WB_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 10);
+ WP_WB_List :=WP_WB_Grid.Value;
+ Fnd_WP_WB := first of (WP_WB_List where WP_WB_List.Name = "Heparin Inj -");
+ Fnd_WP_WB.IsReadOnly := True;
+/////////////
+
+ WP_NB_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 11);
+ WP_NB_List :=WP_NB_Grid.Value;
+ Fnd_WP_NB := first of (WP_NB_List where WP_NB_List.Name = "Heparin 25,000 Units + D5W 500ml");
+ Fnd_WP_NB.IsReadOnly := True;
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 12);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+//////////////
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 13);
+
+ Lab_Rem_List := Lab_Rem.Value;
+
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+///////////////////////
+
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+////////////
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "PRX_Heparin_CCM_withBolus|1" then
+
+ If Card_Prot_W_Bolus.Value = True
+ then
+ Card_Prot_N_Bolus.control_read_only := True;
+ Weight_Prot_W_Bolus.control_read_only := True;
+ Weight_Prot_N_Bolus.control_read_only := True;
+ Fnd_CP_WB.IsSelected := True;
+ Fnd_CP_NB.IsSelected := True;
+ Mlt_List.IsSelected := (True,False,True,True,True,True,True,True,True);
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+ Fnd_Daily.IsSelected := True;
+
+
+ else
+ Card_Prot_N_Bolus.control_read_only := False;
+ Weight_Prot_W_Bolus.control_read_only := False;
+ Weight_Prot_N_Bolus.control_read_only := False;
+ Fnd_CP_WB.IsSelected := False;
+ Fnd_CP_NB.IsSelected := False;
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False,False);
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+
+
+ endif;
+ elseif CallingField = "PRX_Heparin_CCM_w-oBolus|1" then
+ If Card_Prot_N_Bolus.Value = True
+ then
+ Card_Prot_W_Bolus.control_read_only := True;
+ Weight_Prot_W_Bolus.control_read_only := True;
+ Weight_Prot_N_Bolus.control_read_only := True;
+ Fnd_CP_NB.IsSelected := True;
+ Mlt_List.IsSelected := (True,False,True,True,True,True,True,True,True);
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+ Fnd_Daily.IsSelected := True;
+ else
+ Card_Prot_W_Bolus.control_read_only := False;
+ Weight_Prot_W_Bolus.control_read_only := False;
+ Weight_Prot_N_Bolus.control_read_only := False;
+ Fnd_CP_NB.IsSelected := False;
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False,False);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+ elseif CallingField = "PRX_Heparin_WB_withBolus|1" then
+ If Weight_Prot_W_Bolus.Value = True
+ then
+ Card_Prot_W_Bolus.control_read_only := True;
+ Card_Prot_N_Bolus.control_read_only := True;
+ Weight_Prot_N_Bolus.control_read_only := True;
+ Fnd_WP_WB.IsSelected:=True;
+ Fnd_WP_NB.IsSelected:=True;
+ Mlt_List.IsSelected := (False,True,True,True,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+ Fnd_Daily.IsSelected := True;
+ else
+ Card_Prot_W_Bolus.control_read_only := False;
+ Card_Prot_N_Bolus.control_read_only := False;
+ Weight_Prot_N_Bolus.control_read_only := False;
+ Fnd_WP_WB.IsSelected:=False;
+ Fnd_WP_NB.IsSelected:=False;
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False,False);
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+ elseif CallingField = "PRX_Heparin_WB_w-oBolus|1" then
+ If Weight_Prot_N_Bolus.Value = True
+ then
+ Card_Prot_W_Bolus.control_read_only := True;
+ Card_Prot_N_Bolus.control_read_only := True;
+ Weight_Prot_W_Bolus.control_read_only := True;
+ Fnd_WP_NB.IsSelected:=True;
+ Mlt_List.IsSelected := (False,True,True,True,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+ Fnd_Daily.IsSelected := True;
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You have selected {{{SINGLE-QUOTE}}}Weight Based Protocol - No Bolus Dose{{{SINGLE-QUOTE}}}\n\n" ||
+ "If you do not wish to order a bolus dose – Select OK and continue,\n" ||
+ "If you intended to order the bolus dose:\n" ||
+ " - Select OK and “Weight Based Protocol – With Bolus Dose’";
+
+ this_communication.MessageType := "Error";
+
+
+
+ else
+ Card_Prot_W_Bolus.control_read_only := False;
+ Card_Prot_N_Bolus.control_read_only := False;
+ Weight_Prot_W_Bolus.control_read_only := False;
+ Fnd_WP_NB.IsSelected:=False;
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False,False);
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")"
+ ;
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+ endif;
+
+
+
+ elseif CallingEvent = "FormOpen" then
+ Mlt_List.IsReadOnly := (True,True,True,True,True,True,True,True,True);
+ // Mlt_List.IsSelected := (True,True,True,True,True,True,True);
+
+ // Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ Lab_Daily_List.IsReadOnly:= (False,True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Card_Prot_W_Bolus.Value = True) or (Card_Prot_N_Bolus.Value = True) or
+ (Weight_Prot_W_Bolus.Value = True) or (Weight_Prot_N_Bolus.Value = True) then
+
+ comb_ht_wt_val := comb_ht_wt_fld.Value;
+
+ wt := comb_ht_wt_val.weight;
+
+
+ if (wt is null) then
+
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "To Complete The Heparin Protocol:\n\n Please Enter A Weight For This Patient";
+ this_communication.MessageType := "Error";
+ else
+
+
+ If (Found_CBC.IsSelected =false) or (Found_INR.IsSelected = false) or (Found_APTT.IsSelected= false) then
+
+ If Found_CBC.ISSelected = False then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists CBC_Val then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_CBC.ISSelected :=True;
+ endif;
+
+ endif;
+
+// Now for INR
+
+ If Found_INR.ISSelected = False then
+
+ INR_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists INR_Val then
+ CheckINR:=False;
+ else
+ Found_INR.ISSelected :=True;
+ CheckINR:=True;
+ endif;
+
+ endif;
+
+// Now for APTT
+
+ If Found_APTT.ISSelected = False then
+
+ APTT_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists APTT_Val then
+ CheckAPTT:=False;
+ else
+ Found_APTT.ISSelected :=True;
+ CheckAPTT:=True;
+ endif;
+
+ endif;
+
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+
+ singledate := formlist[J];
+
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+
+
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
+ endif; //If exist
+
+
+
+
+
+
+ endif; // Base Line checkboxes
+ endif; //weight null
+ endif; // One of four values = true
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ endif; // calling event
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_INDUCED_HYPOTHERMIA.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_INDUCED_HYPOTHERMIA.mlm
new file mode 100644
index 0000000..b244329
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_INDUCED_HYPOTHERMIA.mlm
@@ -0,0 +1,480 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_Cardiac_Induced_Hypothermia;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in Post Cardiac Arrest Induced Hypothermia order set
+ ;;
+
+ explanation: This MLM is called from the heparin in Post Cardiac Arrest Induced Hypothermia order set, form: Card Arrest RI Hypo
+
+ Change History
+ 03.18.13 JML CSR 30682: Added logic that calculates Q4,Q8,and Q12 requested date/times
+ based on date of original heparin order
+ 10.13.2015 JML CSR 33801: Added logic & included MLM to perform conflicting anticoagulant check
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ ;;
+ keywords: Called MLMs, Cardiac hep protocol
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Use Generic MLM
+ generic_mlm := mlm {{{SINGLE-QUOTE}}}FORM_Set_Generic_Item_Control{{{SINGLE-QUOTE}}};
+ anticoagulant_conflict := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+/////////////////////// Custom code for this form - find Stat CBC and later uncheck baseline if this is checked
+
+ Stat_Grid := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 1);
+ Stat_List :=Stat_Grid.Value;
+ Fnd_Stat_CBC:= first of (Stat_List where Stat_List.Name = "CBC (Includes Diff)");
+
+/////////////
+
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Labs_List := Labs_fld.Value;
+
+ //Find the three checkboxes that may need to be ordered with this protocol
+ Found_Base_CBC:= first of (Labs_list where Labs_list.Name = "CBC No Diff (Hemogram Only)");
+
+ CheckCBC:=False;
+
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Lab_Daily_List := Lab_Daily.Value;
+
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+//////////////
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 6);
+
+ Lab_Rem_List := Lab_Rem.Value;
+
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+///////////////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Inj:= first of (Heps_List where Heps_List.Name = "Heparin Inj");
+ Fnd_Hep_Inj2 := (Heps_List where Heps_List.Name matches pattern "Heparin Inj");
+
+ Fnd_Famotidine_Inj := first of (Heps_List WHERE Heps_List.Name = "Famotidine Inj");
+ Fnd_Famotidine_Inj2 := (Heps_List WHERE Heps_List.Name matches pattern "Famotidine Inj");
+/////////////
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+////////////
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+//CSR 30682 addition
+//Get the additional mapped RequestedDate and RequestedTime hidden fields
+Q4RequestedDate := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ AND field_list.Control_MultiFieldOccNum = 6);
+Q4RequestedTime := first of (field_list WHERE field_list.DataItemName = "RequestedTime"
+ AND field_list.Control_MultiFieldOccNum = 2);
+Q8RequestedDate := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ AND field_list.Control_MultiFieldOccNum = 7);
+Q8RequestedTime := first of (field_list WHERE field_list.DataItemName = "RequestedTime"
+ AND field_list.Control_MultiFieldOccNum = 3);
+Q12RequestedDate := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ AND field_list.Control_MultiFieldOccNum = 8);
+Q12RequestedTime := first of (field_list WHERE field_list.DataItemName = "RequestedTime"
+ AND field_list.Control_MultiFieldOccNum = 4);
+
+Combined_Ht_Wt_Measurements := first of (field_list WHERE field_list.DataItemName = "CombinedMeasurements");
+ patient_weight := 0;
+ if (exists Combined_Ht_Wt_Measurements) then
+ Combined_Ht_Wt_Value := Combined_Ht_Wt_Measurements.Value;
+
+ patient_weight := Combined_Ht_Wt_Value.Weight;
+ endif;
+
+ execute_generic_mlm := call generic_mlm with this_communication, this_form, client_info_obj;
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|2" then
+
+ If (Fnd_Hep_Inj.IsSelected = True) then
+
+ //CSR 33801 JML: Perform Anticoagulant check
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Fnd_Hep_Inj.Name);
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ Fnd_Hep_Inj2.IsSelected := (false, false, false);
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ if ( ( dialogRes as String ) = "No" ) then
+ Fnd_Hep_Inj2.IsSelected := (false, false, false);
+ endif;
+ endif;
+ else
+ if (patient_weight <> 0) then
+ if (patient_weight <= 70) then
+ Fnd_Hep_Inj2.IsSelected := (true, true, false);
+ else
+ Fnd_Hep_Inj2.IsSelected := (true, false, true);
+ endif;
+ endif;
+
+ Lab_Daily_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+ endif;
+
+ else
+ Fnd_Hep_Inj2.IsSelected := (false, false, false);
+ Lab_Daily_List.IsSelected := (False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+
+ if (Fnd_Famotidine_Inj.IsSelected = true) then
+ Fnd_Famotidine_Inj2.IsSelected := (true, true);
+ else
+ Fnd_Famotidine_Inj2.IsSelected := (false, false);
+ endif;
+
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")"
+ ;
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ endif; //Calling Field
+
+ elseif CallingEvent = "FormOpen" then
+
+ Lab_Daily_List.IsReadOnly := (True,True,True,True,True);
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ //CSR 30682: Additional logic added per spec
+ timeDiff12 := (now + 12 hours);
+
+ Q12RequestedTimeValue := Q12RequestedTime.Value;
+
+ Q12RequestedDate.Value := timeDiff12;
+ Q12RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ if ((extract minute timeDiff12) >= 30) then
+ aa12 := (extract hour timeDiff12) + 1;
+
+ if (aa12 = 24) then
+ Q12RequestedDate.Value := "T+1";
+ aa12 := "00";
+ endif;
+ else
+ aa12 := extract hour timeDiff12;
+ endif;
+
+ if ((length (aa12 as string)) = 1) then
+ aa12 := "0" || aa12;
+ endif;
+
+ bb12 := "00";
+
+ Q12RequestedTimeValue.ReqTimeValue := aa12 || ":" || bb12;
+ timeDiff8 := (now + 8 hours);
+
+ Q8RequestedTimeValue := Q8RequestedTime.Value;
+
+ Q8RequestedDate.Value := timeDiff8;
+ Q8RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ if ((extract minute timeDiff8) >= 30) then
+ aa8 := (extract hour timeDiff8) + 1;
+ if (aa8 = 24) then
+ Q8RequestedDate.Value := "T+1";
+ aa8 := "00";
+ endif;
+ else
+ aa8 := extract hour timeDiff8;
+ endif;
+ if ((length (aa8 as string)) = 1) then
+ aa8 := "0" || aa8;
+ endif;
+ bb8 := "00";
+
+ Q8RequestedTimeValue.ReqTimeValue := aa8 || ":" || bb8;
+
+ timeDiff4 := (now + 4 hours);
+
+ Q4RequestedTimeValue := Q4RequestedTime.Value;
+
+ Q4RequestedDate.Value := timeDiff4;
+ Q4RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ if ((extract minute timeDiff4) >= 30) then
+ aa4 := (extract hour timeDiff4) + 1;
+ if (aa4 = 24) then
+ Q4RequestedDate.Value := "T+1";
+ aa4 := "00";
+ endif;
+ else
+ aa4 := extract hour timeDiff4;
+ endif;
+ if ((length (aa4 as string)) = 1) then
+ aa4 := "0" || aa4;
+ endif;
+ bb4 := "00";
+
+ Q4RequestedTimeValue.ReqTimeValue := aa4 || ":" || bb4;
+
+ //Auto select the Heparin Q12 or Heparin Q8 based on patient{{{SINGLE-QUOTE}}}s weight
+ //CSR 33801: JML Change - need to check for conflicting anticoagulant first
+ if (patient_weight <> 0) then
+ //Call functional MLM to check for anticoag conflict
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Fnd_Hep_Inj.Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ Fnd_Hep_Inj2.IsSelected := (false, false, false);
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+ Fnd_Hep_Inj2.IsSelected := (false, false, false);
+ endif;
+ endif;
+ else
+ if (patient_weight <= 70) then
+ Fnd_Hep_Inj2.IsSelected := (true, true, false);
+ else
+ Fnd_Hep_Inj2.IsSelected := (true, false, true);
+ endif;
+ endif;
+ else
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Fnd_Hep_Inj.Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Fnd_Hep_Inj2.IsSelected := (false, false, false);
+
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String) = "No" ) then
+ Fnd_Hep_Inj2.IsSelected := (false, false, false);
+ endif;
+ endif;
+ endif;
+ endif;
+ //END CSR 33801 change
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Fnd_Hep_Inj.IsSelected = True) then
+
+
+ If (Found_Base_CBC.IsSelected =false) then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+
+// If a Base CBC is found or (custom code for this form) if the CBC Stat is checked above, don{{{SINGLE-QUOTE}}}t check this
+
+ If exists CBC_Val or Fnd_Stat_CBC.IsSelected = True then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_Base_CBC.ISSelected :=True;
+ endif;
+
+ endif;
+
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+
+ singledate := formlist[J];
+
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+
+
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Reset_CBC_Grid);
+
+
+ endif; //If exist
+
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please Select a Heparin Order.";
+ this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_INIT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_INIT.mlm
new file mode 100644
index 0000000..0c8ad12
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_INIT.mlm
@@ -0,0 +1,432 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_Cardiac_Init;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in Cardiac heparin protocol order set
+ ;;
+
+ explanation: This MLM is called from the heparin in Cardiac heparin protocol order set, form: OS_CardiacCCMHeparin
+ Change History
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+ ;;
+ keywords: Called MLMs, Cardiac hep protocol
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+//////////////
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Labs_List := Labs_fld.Value;
+
+ //Find the three checkboxes that may need to be ordered with this protocol
+ Found_CBC:= first of (Labs_list where Labs_list.Name = "CBC No Diff (Hemogram Only)");
+ Found_INR:= first of (Labs_list where Labs_list.Name = "Prothrombin/INR");
+ Found_APTT:= first of (Labs_list where Labs_list.Name = "APTT");
+
+
+ CheckAPTT:=False;
+ CheckCBC:=False;
+ CheckINR:=False;
+
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+//////////////
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ Lab_Rem_List := Lab_Rem.Value;
+
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+///////////////////////
+ Mlt_Order_Line:= first of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Mlt_List := Mlt_Order_Line.Value;
+
+/////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Con:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units+ D5W 500ml");
+ Fnd_Hep_Inf:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units+ 0.9% NaCl 500ml");
+
+/////////////
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+////////////
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|4" then
+
+ If Fnd_Hep_Con.IsSelected = True
+ then
+ Fnd_Hep_Inf.IsReadOnly := True;
+
+ Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
+ endif;
+ else
+ Fnd_Hep_Inf.IsReadOnly := False;
+ endif;
+
+ If Fnd_Hep_Inf.IsSelected = True
+ then
+ Fnd_Hep_Con.IsReadOnly := True;
+
+ Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
+ endif;
+ else
+ Fnd_Hep_Con.IsReadOnly := False;
+ endif;
+
+ If (Fnd_Hep_Con.IsSelected = False) and (Fnd_Hep_Inf.IsSelected = False)
+ then
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False);
+ endif;
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")"
+ ;
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ endif; //Calling Field
+
+ elseif CallingEvent = "FormOpen" then
+
+ //Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
+ LocName:= read last
+ {"SELECT currentlocation "
+ || " FROM cv3clientvisit "
+ || " WHERE ClientGUID = " || SQL(client_guid )
+ || " And GUID = " || SQL(visit_guid)};
+ Ed_Loc.Value := LocName;
+
+ Mlt_List.IsReadOnly := (True,True,True,True,True,True,True,True);
+
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
+ endif;
+
+ Fnd_Hep_Inf.IsReadOnly := True;
+ Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ // Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Fnd_Hep_Con.IsSelected = True) or (Fnd_Hep_Inf.IsSelected = True) then
+
+
+ If (Found_CBC.IsSelected =false) or (Found_INR.IsSelected = false) or (Found_APTT.IsSelected= false) then
+
+ If Found_CBC.ISSelected = False then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists CBC_Val then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_CBC.ISSelected :=True;
+ endif;
+
+ endif;
+
+// Now for INR
+
+ If Found_INR.ISSelected = False then
+
+ INR_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists INR_Val then
+ CheckINR:=False;
+ else
+ Found_INR.ISSelected :=True;
+ CheckINR:=True;
+ endif;
+
+ endif;
+
+// Now for APTT
+
+ If Found_APTT.ISSelected = False then
+
+ APTT_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists APTT_Val then
+ CheckAPTT:=False;
+ else
+ Found_APTT.ISSelected :=True;
+ CheckAPTT:=True;
+ endif;
+
+ endif;
+ endif;
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+
+ singledate := formlist[J];
+
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+
+
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
+
+
+
+
+ endif; //If exist
+
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please Select a Heparin Infusion Order.\n\n" ||
+ " 500ml D5W (Standard Concentration)\n" ||
+ " or \n" ||
+ " 500ml 0.9% NaCl (If Specifically Requested By Physician)";
+ this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_MAINT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_MAINT.mlm
new file mode 100644
index 0000000..533162b
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_MAINT.mlm
@@ -0,0 +1,231 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_Cardiac_Maint;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in Cardiac heparin maintenance protocol order set
+ ;;
+
+ explanation: This MLM is called from the heparin in Cardiac heparin maintenance protocol order set, form: OS_CardiacHeparinAdj
+
+ Change History:
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+ ;;
+ keywords: Called MLMs, Cardiac hep protocol maintenance
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
+ Fnd_CBC := first of (Lab_Daily_List where Lab_Daily_List.Name = "CBC No Diff (Hemogram Only)");
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate");
+ primreqtime:= last of (field_list where field_list.DataItemName = "RequestedTime");
+ primreqtime_value := primreqtime.value;
+
+/////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Con:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units+ D5W 500ml");
+ Fnd_Hep_Inf:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units+ 0.9% NaCl 500ml");
+
+
+
+
+
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|4" then
+
+ If Fnd_Hep_Con.IsSelected = True
+ then
+ Fnd_Hep_Inf.IsReadOnly := True;
+ else
+ Fnd_Hep_Inf.IsReadOnly := False;
+ endif;
+
+ If Fnd_Hep_Inf.IsSelected = True
+ then
+ Fnd_Hep_Con.IsReadOnly := True;
+ else
+ Fnd_Hep_Con.IsReadOnly := False;
+ endif;
+
+ If (Fnd_Hep_Con.IsSelected = False) and (Fnd_Hep_Inf.IsSelected = False)
+ then
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False);
+
+ endif;
+ endif; // Callingfield = multiorder grid 4
+
+ elseif CallingEvent = "FormOpen" then
+
+ Fnd_Hep_Inf.IsReadOnly := True;
+ Lab_Daily_List.IsReadOnly := (False,True);
+
+
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Fnd_Hep_Con.IsSelected = True) or (Fnd_Hep_Inf.IsSelected = True) then
+
+
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered today to 2 days from now.
+ // Set the check box as needed
+
+ // Only need if:
+// Today Today + 1 Day Today + 2 Days Order for
+// None None None Today + 1 day
+// None None Order Today
+// Order None None Today + 2 days
+// primreqdate;
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+
+ tempday := call str_parse with (today as time), " ";
+ today0 := first(tempday);
+ tempday := call str_parse with ((today as time) + 1 day), " ";
+ today1 := first(tempday);
+ tempday := call str_parse with ((today as time) + 2 day), " ";
+ today2 := first(tempday);
+
+ end_date := (today as time) + 3 days;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20)"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(today)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If (today0 not in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 not in CBC_daily_dates) then
+ primreqdate.value := (today as time) + 1 day;
+
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True);
+
+ Message_Date := "GRID CBC order should be set with date: " ||(today as time) + 1 day;
+
+ elseif (today0 not in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 in CBC_daily_dates) then
+ primreqdate.value := (today as time) ;
+ primreqtime_value.ReqTimeCode := "Today";
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True);
+ Message_Date := "GRID CBC order should be set with date: " || (today as time) || "\n with time " || "Today";
+
+
+ elseif (today0 in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 not in CBC_daily_dates) then
+ primreqdate.value := (today as time) + 2 days;
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
+ Message_Date := "GRID CBC order should be set with date: " || (today as time) + 2 days;
+
+ else
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False);
+ Message_Date := "GRID CBC order should not be checked";
+ endif;
+
+
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please Select a Heparin Infusion Order.\n\n" ||
+ " 500ml D5W (Standard Concentration)\n" ||
+ " or \n" ||
+ " 500ml 0.9% NaCl (If Specifically Requested By Physician)";
+ this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_POV_INIT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_POV_INIT.mlm
new file mode 100644
index 0000000..880b902
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_CARDIAC_POV_INIT.mlm
@@ -0,0 +1,561 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_Cardiac_POV_Init;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in post vascular Cardiac heparin initial protocol order set
+ ;;
+
+ explanation: This MLM is called from the heparin in post vascular Cardiac heparin initial protocol order set Cardiac heparin protocol order set, form: OS_VascularHeparin
+ Change History
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ 08.01.2017 AMistry Auto Populate Date Time for PTT as per 6,12,18 and 24 Hours. CSR# 35668
+ ;;
+ keywords: Called MLMs, post vascular Cardiac heparin initial protocol order set
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+//////////////
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Labs_List := Labs_fld.Value;
+
+ //Find the three checkboxes that may need to be ordered with this protocol
+ Found_CBC:= first of (Labs_list where Labs_list.Name = "CBC No Diff (Hemogram Only)");
+ Found_INR:= first of (Labs_list where Labs_list.Name = "Prothrombin/INR");
+ Found_APTT:= first of (Labs_list where Labs_list.Name = "APTT");
+
+
+ CheckAPTT:=False;
+ CheckCBC:=False;
+ CheckINR:=False;
+
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Lab_Daily_ApttSel:= First 4 from Lab_Daily_List.IsSelected;
+ Lab_False4:= (false,false,false,false);
+
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 6);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 7);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 8);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 9);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+//////////////
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ Lab_Rem_List := Lab_Rem.Value;
+
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+///////////////////////
+ Mlt_Order_Line:= first of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Mlt_List := Mlt_Order_Line.Value;
+
+/////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Con:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units +D5W 500ml");
+ Fnd_Hep_Inf:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units +0.9% NaCl 500ml");
+
+/////////////
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+////////////
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+//// PTT Fields for Auto Populate
+ PTT6H_Date:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 10);
+ PTT6H_Time:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 2);
+ PTT12H_Date:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 11);
+ PTT12H_Time:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 3);
+ PTT18H_Date:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 12);
+ PTT18H_Time:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 4);
+ PTT24H_Date:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 13);
+ PTT24H_Time:= last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Heparin_Start_Time := last of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 6);
+ Heparin_Start_Date := last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 14);
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|4" then
+
+ If Fnd_Hep_Con.IsSelected = True
+ then
+ Fnd_Hep_Inf.IsReadOnly := True;
+
+ Lab_Daily_List.IsReadOnly := (Lab_False4,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Lab_Daily_ApttSel,True,True,True,True,True);
+
+
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True,False);
+ endif;
+ else
+ Fnd_Hep_Inf.IsReadOnly := False;
+ endif;
+
+ If Fnd_Hep_Inf.IsSelected = True
+ then
+ Fnd_Hep_Con.IsReadOnly := True;
+
+ Lab_Daily_List.IsReadOnly := (Lab_False4,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Lab_Daily_ApttSel,True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True,False);
+ endif;
+ else
+ Fnd_Hep_Con.IsReadOnly := False;
+ endif;
+
+ If (Fnd_Hep_Con.IsSelected = False) and (Fnd_Hep_Inf.IsSelected = False)
+ then
+ Lab_Daily_List.IsSelected := (Lab_Daily_ApttSel,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False,False);
+ endif;
+ ElseIf CallingField = "RequestedDate|5" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")"
+ ;
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ ElseIf CallingField = "RequestedTime|6" then
+ zz := Heparin_Start_Time.Value.Records__;
+ zzz := Heparin_Start_Date.Value.Records__;
+ HeparinStartDate := Heparin_Start_Date.Value;
+ HeparinStartTime := Heparin_Start_Time.Value.ReqTimeValue;
+ HeparinStartTime_Code := Heparin_Start_Time.Value.ReqTimeCode;
+
+ If HeparinStartTime_Code = "Routine" then
+ Current_Time := now;
+ (PTT6_DATE,PTT6_TIME,
+ PTT12_DATE,PTT12_TIME,
+ PTT18_DATE,PTT18_TIME,
+ PTT24_DATE,PTT24_TIME) := READ FIRST { " SELECT CONVERT(VARCHAR(10),DATEADD(HH,6,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),110) AS PTT6DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,6,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),108) AS PTT6TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,12,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),110) AS PTT12DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,12,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),108) AS PTT12TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,18,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),110) AS PTT18DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,18,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),108) AS PTT18TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,24,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),110) AS PTT24DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,24,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),108) AS PTT24TIME " };
+ PTT6H_Date.value := PTT6_DATE;
+ PTT6H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT6H_Time.Value.ReqTimeValue := PTT6_TIME;
+
+ PTT12H_Date.value := PTT12_DATE;
+ PTT12H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT12H_Time.Value.ReqTimeValue := PTT12_TIME;
+
+ PTT18H_Date.value := PTT18_DATE;
+ PTT18H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT18H_Time.Value.ReqTimeValue := PTT18_TIME;
+
+ PTT24H_Date.value := PTT24_DATE;
+ PTT24H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT24H_Time.Value.ReqTimeValue := PTT24_TIME;
+ ElseIf HeparinStartTime_Code = "Scheduled/Start Time" then
+ If EXISTS HeparinStartTime then
+ HeparinStartDateTime := READ FIRST { " SELECT CAST(" || SQL(HeparinStartDate) || " AS DATETIME) + CAST(" || SQL(HeparinStartTime) || " AS DATETIME)" };
+
+ (PTT6_DATE,PTT6_TIME,
+ PTT12_DATE,PTT12_TIME,
+ PTT18_DATE,PTT18_TIME,
+ PTT24_DATE,PTT24_TIME) := READ FIRST { " SELECT CONVERT(VARCHAR(10),DATEADD(HH,6,(CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME))),110) AS PTT6DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,6,(CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME))),108)AS PTT6TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,12,(CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME))),110) AS PTT12DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,12,(CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME))),108)AS PTT12TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,18,(CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME))),110) AS PTT18DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,18,(CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME))),108)AS PTT18TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,24,(CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME))),110) AS PTT24DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,24,(CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME))),108)AS PTT24TIME " };
+ /* WITH ADDING 1 HOUR
+ (PTT6_DATE,PTT6_TIME,
+ PTT12_DATE,PTT12_TIME,
+ PTT18_DATE,PTT18_TIME,
+ PTT24_DATE,PTT24_TIME) := READ FIRST { " SELECT CONVERT(VARCHAR(10),DATEADD(HH,6,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME)), 0)))),110) AS PTT6DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,6,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME)), 0)))),108) AS PTT6TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,12,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME)), 0)))),110) AS PTT12DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,12,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME)), 0)))),108) AS PTT12TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,18,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME)), 0)))),110) AS PTT18DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,18,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME)), 0)))),108) AS PTT18TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,24,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME)), 0)))),110) AS PTT24DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,24,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(HeparinStartDateTime) || " AS DATETIME)), 0)))),108) AS PTT24TIME " };*/
+ PTT6H_Date.value := PTT6_DATE;
+ PTT6H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT6H_Time.Value.ReqTimeValue := PTT6_TIME;
+
+ PTT12H_Date.value := PTT12_DATE;
+ PTT12H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT12H_Time.Value.ReqTimeValue := PTT12_TIME;
+
+ PTT18H_Date.value := PTT18_DATE;
+ PTT18H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT18H_Time.Value.ReqTimeValue := PTT18_TIME;
+
+ PTT24H_Date.value := PTT24_DATE;
+ PTT24H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT24H_Time.Value.ReqTimeValue := PTT24_TIME;
+ EndIf;
+ EndIf;
+ endif; //Calling Field
+
+ elseif CallingEvent = "FormOpen" then
+
+ //Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
+ LocName:= read last
+ {"SELECT currentlocation "
+ || " FROM cv3clientvisit "
+ || " WHERE ClientGUID = " || SQL(client_guid )
+ || " And GUID = " || SQL(visit_guid)};
+ Ed_Loc.Value := LocName;
+
+ Mlt_List.IsReadOnly := (True,True,True,True,True,True,True,True,True);
+
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True,False);
+ endif;
+
+ Fnd_Hep_Inf.IsReadOnly := True;
+ Lab_Daily_List.IsReadOnly := (Lab_False4,True,True,True,True,True);
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ // Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ Current_Time := now;
+ (PTT6_DATE,PTT6_TIME,
+ PTT12_DATE,PTT12_TIME,
+ PTT18_DATE,PTT18_TIME,
+ PTT24_DATE,PTT24_TIME) := READ FIRST { " SELECT CONVERT(VARCHAR(10),DATEADD(HH,6,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),110) AS PTT6DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,6,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),108) AS PTT6TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,12,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),110) AS PTT12DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,12,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),108) AS PTT12TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,18,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),110) AS PTT18DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,18,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),108) AS PTT18TIME, "
+ || " CONVERT(VARCHAR(10),DATEADD(HH,24,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),110) AS PTT24DATE, "
+ || " CONVERT(VARCHAR(5),DATEADD(HH,24,(DATEADD(HH,1,DATEADD(HH, DATEDIFF(HH, 0, CAST(" || SQL(Current_Time) || " AS DATETIME)), 0)))),108) AS PTT24TIME " };
+ PTT6H_Date.value := PTT6_DATE;
+ PTT6H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT6H_Time.Value.ReqTimeValue := PTT6_TIME;
+
+ PTT12H_Date.value := PTT12_DATE;
+ PTT12H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT12H_Time.Value.ReqTimeValue := PTT12_TIME;
+
+ PTT18H_Date.value := PTT18_DATE;
+ PTT18H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT18H_Time.Value.ReqTimeValue := PTT18_TIME;
+
+ PTT24H_Date.value := PTT24_DATE;
+ PTT24H_Time.Value.ReqTimeCode := "Scheduled Time";
+ PTT24H_Time.Value.ReqTimeValue := PTT24_TIME;
+
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Fnd_Hep_Con.IsSelected = True) or (Fnd_Hep_Inf.IsSelected = True) then
+
+
+ If (Found_CBC.IsSelected =false) or (Found_INR.IsSelected = false) or (Found_APTT.IsSelected= false) then
+
+ If Found_CBC.ISSelected = False then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists CBC_Val then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_CBC.ISSelected :=True;
+ endif;
+
+ endif;
+
+// Now for INR
+
+ If Found_INR.ISSelected = False then
+
+ INR_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists INR_Val then
+ CheckINR:=False;
+ else
+ Found_INR.ISSelected :=True;
+ CheckINR:=True;
+ endif;
+
+ endif;
+
+// Now for APTT
+
+ If Found_APTT.ISSelected = False then
+
+ APTT_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists APTT_Val then
+ CheckAPTT:=False;
+ else
+ Found_APTT.ISSelected :=True;
+ CheckAPTT:=True;
+ endif;
+
+ endif;
+ endif;
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+
+ singledate := formlist[J];
+
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+
+
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Lab_Daily_ApttSel,Reset_CBC_Grid);
+
+
+
+
+
+ endif; //If exist
+
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please Select a Heparin Infusion Order.\n\n" ||
+ " 500ml D5W (Standard Concentration)\n" ||
+ " or \n" ||
+ " 500ml 0.9% NaCl (If Specifically Requested By Physician)";
+ this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_LOW_INTENSITY_INIT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_LOW_INTENSITY_INIT.mlm
new file mode 100644
index 0000000..7f8ee70
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_LOW_INTENSITY_INIT.mlm
@@ -0,0 +1,436 @@
+maintenance:
+
+ title: Set Heparin Orders;;
+ mlmname: FORM_Set_Heparin_Low_Intensity_Init;;
+ arden: version 2;;
+ version: 4.5;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2015-08-21;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in Low Intesity heparin protocol order set
+ ;;
+
+ explanation: This MLM is called from the heparin in Low Intensity heparin protocol order set, form: OS_LowIntenHeparin
+
+ 10.21.2015 TMS Created (from copy of Cardiac Heparin Protocol)with changes to support
+ Low Intensity Procotol, CSR 33670
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ 10.19.2018 TMS Updated to allow switching of Heparin Order infusion selection after order set update. CSR 37270
+ ;;
+
+ keywords: Called MLMs, Low Intensity Heparin Protocol
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+//////////////
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Labs_List := Labs_fld.Value;
+
+ //Find the three checkboxes that may need to be ordered with this protocol
+ Found_CBC:= first of (Labs_list where Labs_list.Name = "CBC No Diff (Hemogram Only)");
+ Found_INR:= first of (Labs_list where Labs_list.Name = "Prothrombin/INR");
+ Found_APTT:= first of (Labs_list where Labs_list.Name = "APTT");
+
+
+ CheckAPTT:=False;
+ CheckCBC:=False;
+ CheckINR:=False;
+
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+//////////////
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ Lab_Rem_List := Lab_Rem.Value;
+
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+///////////////////////
+ Mlt_Order_Line:= first of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Mlt_List := Mlt_Order_Line.Value;
+
+/////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Con:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units + 0.9% NaCl 500ml");
+ Fnd_Hep_Inf:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units + D5W 500ml");
+
+/////////////
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+////////////
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|4" then
+
+ If Fnd_Hep_Con.IsSelected = True
+ then
+ Fnd_Hep_Inf.IsReadOnly := True;
+ Fnd_Hep_Inf.IsSelected := False;
+
+ Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
+ endif;
+ else
+ Fnd_Hep_Inf.IsReadOnly := False;
+ endif;
+
+ If Fnd_Hep_Inf.IsSelected = True
+ then
+ Fnd_Hep_Con.IsReadOnly := True;
+ Fnd_Hep_Con.IsSelected := False;
+
+ Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
+ endif;
+ else
+ Fnd_Hep_Con.IsReadOnly := False;
+ endif;
+
+ If (Fnd_Hep_Con.IsSelected = False) and (Fnd_Hep_Inf.IsSelected = False)
+ then
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False);
+ endif;
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")"
+ ;
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ endif; //Calling Field
+
+ elseif CallingEvent = "FormOpen" then
+
+ //Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
+ LocName:= read last
+ {"SELECT currentlocation "
+ || " FROM cv3clientvisit "
+ || " WHERE ClientGUID = " || SQL(client_guid )
+ || " And GUID = " || SQL(visit_guid)};
+ Ed_Loc.Value := LocName;
+
+ Mlt_List.IsReadOnly := (True,True,True,True,True,True,True,True);
+
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
+ endif;
+
+ Fnd_Hep_Inf.IsReadOnly := True;
+ Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ // Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Fnd_Hep_Con.IsSelected = True) or (Fnd_Hep_Inf.IsSelected = True) then
+
+
+ If (Found_CBC.IsSelected =false) or (Found_INR.IsSelected = false) or (Found_APTT.IsSelected= false) then
+
+ If Found_CBC.ISSelected = False then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists CBC_Val then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_CBC.ISSelected :=True;
+ endif;
+
+ endif;
+
+// Now for INR
+
+ If Found_INR.ISSelected = False then
+
+ INR_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists INR_Val then
+ CheckINR:=False;
+ else
+ Found_INR.ISSelected :=True;
+ CheckINR:=True;
+ endif;
+
+ endif;
+
+// Now for APTT
+
+ If Found_APTT.ISSelected = False then
+
+ APTT_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists APTT_Val then
+ CheckAPTT:=False;
+ else
+ Found_APTT.ISSelected :=True;
+ CheckAPTT:=True;
+ endif;
+
+ endif;
+ endif;
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+
+ singledate := formlist[J];
+
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+
+
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
+
+
+
+
+ endif; //If exist
+
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please Select a Heparin Infusion Order.\n\n" ||
+ " 500ml D5W \n" ||
+ " or \n" ||
+ " 500ml 0.9% NaCl (If Specifically Requested By Physician)";
+ this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_LOW_INTENSITY_MAINT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_LOW_INTENSITY_MAINT.mlm
new file mode 100644
index 0000000..e14e514
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_LOW_INTENSITY_MAINT.mlm
@@ -0,0 +1,235 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_SET_HEPARIN_LOW_INTENSITY_MAINT;;
+ arden: version 2.5;;
+ version: 15.1;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2015-08-21;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in Low Intensity heparin maintenance protocol order set
+ ;;
+
+ explanation: This MLM is called from the heparin in Low Intensity heparin maintenance protocol order set, form: OS_LowIntenHepAdj
+
+ Change History
+ 10.21.2015 TMS Created (from copy of Cardiac Heparin Protocol)with changes to support
+ Low Intensity Procotol, CSR 33670
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ 10.19.2018 TMS Updated to allow switching of Heparin Order infusion selection. CSR 37270
+ ;;
+ keywords: Called MLMs, Low Intensity Heparin protocol maintenance
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
+ Fnd_CBC := first of (Lab_Daily_List where Lab_Daily_List.Name = "CBC No Diff (Hemogram Only)");
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate");
+ primreqtime:= last of (field_list where field_list.DataItemName = "RequestedTime");
+ primreqtime_value := primreqtime.value;
+
+/////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Con:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units + 0.9% NaCl 500ml");
+ Fnd_Hep_Inf:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units + D5W 500ml");
+
+
+
+
+
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|4" then
+
+ If Fnd_Hep_Con.IsSelected = True
+ then
+ Fnd_Hep_Inf.IsReadOnly := True;
+ Fnd_Hep_Inf.IsSelected := False;
+ else
+ Fnd_Hep_Inf.IsReadOnly := False;
+ endif;
+
+ If Fnd_Hep_Inf.IsSelected = True
+ then
+ Fnd_Hep_Con.IsReadOnly := True;
+ Fnd_Hep_Con.IsSelected := False;
+ else
+ Fnd_Hep_Con.IsReadOnly := False;
+ endif;
+
+ If (Fnd_Hep_Con.IsSelected = False) and (Fnd_Hep_Inf.IsSelected = False)
+ then
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False);
+
+ endif;
+ endif; // Callingfield = multiorder grid 4
+
+ elseif CallingEvent = "FormOpen" then
+
+ Fnd_Hep_Inf.IsReadOnly := True;
+ Lab_Daily_List.IsReadOnly := (False,True);
+
+
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Fnd_Hep_Con.IsSelected = True) or (Fnd_Hep_Inf.IsSelected = True) then
+
+
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered today to 2 days from now.
+ // Set the check box as needed
+
+ // Only need if:
+// Today Today + 1 Day Today + 2 Days Order for
+// None None None Today + 1 day
+// None None Order Today
+// Order None None Today + 2 days
+// primreqdate;
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+
+ tempday := call str_parse with (today as time), " ";
+ today0 := first(tempday);
+ tempday := call str_parse with ((today as time) + 1 day), " ";
+ today1 := first(tempday);
+ tempday := call str_parse with ((today as time) + 2 day), " ";
+ today2 := first(tempday);
+
+ end_date := (today as time) + 3 days;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20)"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(today)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If (today0 not in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 not in CBC_daily_dates) then
+ primreqdate.value := (today as time) + 1 day;
+
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True);
+
+ Message_Date := "GRID CBC order should be set with date: " ||(today as time) + 1 day;
+
+ elseif (today0 not in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 in CBC_daily_dates) then
+ primreqdate.value := (today as time) ;
+ primreqtime_value.ReqTimeCode := "Today";
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True);
+ Message_Date := "GRID CBC order should be set with date: " || (today as time) || "\n with time " || "Today";
+
+
+ elseif (today0 in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 not in CBC_daily_dates) then
+ primreqdate.value := (today as time) + 2 days;
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
+ Message_Date := "GRID CBC order should be set with date: " || (today as time) + 2 days;
+
+ else
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False);
+ Message_Date := "GRID CBC order should not be checked";
+ endif;
+
+
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please Select a Heparin Infusion Order.\n\n" ||
+ " 500ml D5W\n" ||
+ " or \n" ||
+ " 500ml 0.9% NaCl (If Specifically Requested By Physician)";
+ this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_ORDERS.mlm
new file mode 100644
index 0000000..49ade5e
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_ORDERS.mlm
@@ -0,0 +1,183 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_Orders;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Lisa Hancher, Eclipsys Corp ext SHOT;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin
+ Scope
+ 3 Heparin orderables in the Medication order grid
+ Inj
+ 1000 units / hr
+ 1200 units / hr
+ 2 ‘dud’ check boxes (A+B) added to order set form, set to false, displayed for testing,
+ not displayed when activating
+ Check box A will hold previous value of 1000 units / hr selected value
+ Check box B will hold previous value of 1200 units / hr selected value
+ 4 nursing instruction orderables in the Heparin Protocol Instrucitons, set to false
+
+ On open: MLM will disable 4 nursing instructions.
+
+ On Medication Grid change, MLM:
+ Will check to see if
+ A matches 1000 units, If it does, this field has not changed
+ If it does not match,
+ begin
+ If it is true
+ begin
+ 1200 units gets disabled
+ 4 nursing orders listed get checked.
+ end
+ If it is false
+ begin
+ 1200 units gets enabled
+ 4 nursing orders get unchecked
+ end
+ Set A to 1000 units value after change
+ end
+ Else if B matches 1200 units, it does has not changed, do nothing
+ If it does not match,
+ begin
+ If it is true
+ begin
+ 1000 units gets disabled
+ 4 nursing orders listed get checked.
+ end
+ If it is false
+ begin
+ 1000 units gets enabled
+ 4 nursing orders get unchecked
+ end
+ Set B to 1200 unit value after change
+ end
+ Allowed grouping of 3 fields
+ Heparin inj 1000 units 12000 units
+ False False False
+ False False True
+ False True False
+ True False False
+ True False True
+ True True False
+
+
+ ;;
+
+ explanation: This MLM is called from the Patient Profile- Adult Admission Orders
+ ;;
+ keywords: Called MLMs, Respiratory ORder Set, Adult Admission
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Mlt_Order_Line:= first of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ Mlt_List := Mlt_Order_Line.Value;
+// Mlt_List.IsReadOnly := (True,True,True,True);
+// Mlt_SelList := Mlt_List.IsSelected;
+
+ If CallingEvent = "FormOpen" then
+ Mlt_List.IsReadOnly := (True,True,True,True);
+ else
+
+ PrevHep1000_Fld := last of (field_list where field_list.DataItemName = "MLM_CM 1");
+ PrevHep1000_Value := PrevHep1000_Fld.Value;
+
+ PrevHep1200_Fld := last of (field_list where field_list.DataItemName = "MLM_CM 2");
+ PrevHep1200_Value := PrevHep1200_Fld.Value;
+
+ Meds_fld := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 6);
+ Meds_list :=Meds_fld.Value;
+ Meds_Sel :=Meds_list.IsSelected;
+
+ ListMembs:= count Meds_Sel;
+ Meds_Read_1000 := ();
+ Meds_Read_1200 := ();
+ Meds_Read_None := ();
+ for k in (1 seqto (ListMembs -2)) do
+ Meds_Read_1000 := Meds_Read_1000 ,False;
+ Meds_Read_1200 := Meds_Read_1200 ,False;
+ Meds_Read_None := Meds_Read_None , False;
+ enddo;
+
+ Meds_Read_1000 := Meds_Read_1000 ,False,True;
+ Meds_Read_1200 := Meds_Read_1200 ,True,False;
+ Meds_Read_None := Meds_Read_None,False,False;
+
+ Cur1000 := Last(First (ListMembs-1) from Meds_Sel);
+ Cur1200 := Last(First (ListMembs) from Meds_Sel);
+
+ If Cur1000 = PrevHep1000_Value then
+ NoHarmNoFoul := True;
+ Else
+ If Cur1000 = True Then
+ Meds_List.IsReadOnly := Meds_Read_1000;
+ Mlt_List.IsSelected := (True,True,True,True);
+ Else
+ Meds_List.IsReadOnly := Meds_Read_None;
+ Mlt_List.IsSelected := (False,False,False,False);
+ endif;
+ PrevHep1000_Fld.Value := Cur1000;
+ endif;
+
+ If Cur1200 = PrevHep1200_Value then
+ NoHarmNoFoul := True;
+ Else
+ If Cur1200 = True Then
+ Meds_List.ISReadOnly := Meds_Read_1200;
+ Mlt_List.IsSelected := (True,True,True,True);
+ Else
+ Meds_List.IsReadOnly := Meds_Read_None;
+ Mlt_List.IsSelected := (False,False,False,False);
+ endif;
+ PrevHep1200_Fld.Value := Cur1200;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_POV_MAINT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_POV_MAINT.mlm
new file mode 100644
index 0000000..92d951a
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_POV_MAINT.mlm
@@ -0,0 +1,231 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_POV_Maint;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in POV heparin maintenance protocol order set
+ ;;
+
+ explanation: This MLM is called from the heparin in POV heparin maintenance protocol order set, form: OS_VascularHeparinAd
+
+ Change History
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+ ;;
+ keywords: Called MLMs, POV hep protocol maintenance
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
+ Fnd_CBC := first of (Lab_Daily_List where Lab_Daily_List.Name = "CBC No Diff (Hemogram Only)");
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate");
+ primreqtime:= last of (field_list where field_list.DataItemName = "RequestedTime");
+ primreqtime_value := primreqtime.value;
+
+/////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Con:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units +D5W 500ml");
+ Fnd_Hep_Inf:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units +0.9% NaCl 500ml");
+
+
+
+
+
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|4" then
+
+ If Fnd_Hep_Con.IsSelected = True
+ then
+ Fnd_Hep_Inf.IsReadOnly := True;
+ else
+ Fnd_Hep_Inf.IsReadOnly := False;
+ endif;
+
+ If Fnd_Hep_Inf.IsSelected = True
+ then
+ Fnd_Hep_Con.IsReadOnly := True;
+ else
+ Fnd_Hep_Con.IsReadOnly := False;
+ endif;
+
+ If (Fnd_Hep_Con.IsSelected = False) and (Fnd_Hep_Inf.IsSelected = False)
+ then
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False);
+
+ endif;
+ endif; // Callingfield = multiorder grid 4
+
+ elseif CallingEvent = "FormOpen" then
+
+
+
+ Fnd_Hep_Inf.IsReadOnly := True;
+ Lab_Daily_List.IsReadOnly := (False,True);
+
+
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Fnd_Hep_Con.IsSelected = True) or (Fnd_Hep_Inf.IsSelected = True) then
+
+
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered today to 2 days from now.
+ // Set the check box as needed
+
+ // Only need if:
+// Today Today + 1 Day Today + 2 Days Order for
+// None None None Today + 1 day
+// None None Order Today
+// Order None None Today + 2 days
+// primreqdate;
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+
+ tempday := call str_parse with (today as time), " ";
+ today0 := first(tempday);
+ tempday := call str_parse with ((today as time) + 1 day), " ";
+ today1 := first(tempday);
+ tempday := call str_parse with ((today as time) + 2 day), " ";
+ today2 := first(tempday);
+
+ end_date := (today as time) + 3 days;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20)"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(today)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If (today0 not in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 not in CBC_daily_dates) then
+ primreqdate.value := (today as time) + 1 day;
+
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True);
+
+ Message_Date := "GRID CBC order should be set with date: " ||(today as time) + 1 day;
+
+ elseif (today0 not in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 in CBC_daily_dates) then
+ primreqdate.value := (today as time) ;
+ primreqtime_value.ReqTimeCode := "Today";
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True);
+ Message_Date := "GRID CBC order should be set with date: " || (today as time) || "\n with time " || "Today";
+
+
+ elseif (today0 in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 not in CBC_daily_dates) then
+ primreqdate.value := (today as time) + 2 days;
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
+ Message_Date := "GRID CBC order should be set with date: " || (today as time) + 2 days;
+
+ else
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False);
+ Message_Date := "GRID CBC order should not be checked";
+ endif;
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please Select a Heparin Infusion Order.\n\n" ||
+ " 500ml D5W (Standard Concentration)\n" ||
+ " or \n" ||
+ " 500ml 0.9% NaCl (If Specifically Requested By Physician)";
+ this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_SQ.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_SQ.mlm
new file mode 100644
index 0000000..fb16d15
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_SQ.mlm
@@ -0,0 +1,297 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_SQ;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in Cardiac heparin protocol order set
+ ;;
+
+ explanation: This MLM is called from the heparin in Cardiac heparin protocol order set, form: OS_CardiacCCMHeparin
+
+ Change History
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+ ;;
+ keywords: Called MLMs, Cardiac hep protocol
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+//////////////
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Labs_List := Labs_fld.Value;
+
+ //Find the three checkboxes that may need to be ordered with this protocol
+ Found_Base_CBC:= first of (Labs_list where Labs_list.Name = "CBC No Diff (Hemogram Only)");
+
+ CheckCBC:=False;
+
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_List := Lab_Daily.Value;
+
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+//////////////
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 3);
+
+ Lab_Rem_List := Lab_Rem.Value;
+
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+///////////////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Inj:= first of (Heps_List where Heps_List.Name = "Heparin Inj");
+/////////////
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+////////////
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+
+ If CallingEvent = "FieldChange" Then
+
+
+
+ If CallingField = "MultiOrderGrid|1" then
+
+ If (Fnd_Hep_Inj.IsSelected = True) then
+ Lab_Daily_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ else
+ Lab_Daily_List.IsSelected := (False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ endif; //Calling Field
+
+ elseif CallingEvent = "FormOpen" then
+
+ // Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ Lab_Daily_List.IsReadOnly := (True,True,True,True,True);
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+
+
+ elseif CallingEvent = "FormClose" then
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ If (Fnd_Hep_Inj.IsSelected = True) then
+
+
+ If (Found_Base_CBC.IsSelected =false) then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists CBC_Val then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_Base_CBC.ISSelected :=True;
+ endif;
+
+ endif;
+
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+
+ singledate := formlist[J];
+
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+
+
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Reset_CBC_Grid);
+
+
+ endif; //If exist
+
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please Select a Heparin Order.";
+ this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_WEIGHT_BASED_INIT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_WEIGHT_BASED_INIT.mlm
new file mode 100644
index 0000000..4714160
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_WEIGHT_BASED_INIT.mlm
@@ -0,0 +1,538 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_Weight_Based_Init;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in weight based heparin protocol order set
+ ;;
+
+ explanation: This MLM is called from the heparin in weight based heparin protocol order set, form: OS_WtBasedHeparin
+
+ Change History
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ 08.20.2018 TMS CSR 36317 - Add logic to deselect bolus heparin dose on form open when ordered from the
+ tPA (Alteplase) for the Treatment of Pulmonary Embolism (PE) Order Set.
+
+ ;;
+ keywords: Called MLMs, Blood Formation , ED
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ Primary_object := this_communication.PrimaryObj;
+ ParentOrderSet := this_communication.ParentOrderSetGUID;
+ OrderSetName := Primary_Object.OrderSetName;
+//////////////
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Labs_List := Labs_fld.Value;
+
+ //Find the three checkboxes that may need to be ordered with this protocol
+ Found_CBC:= first of (Labs_list where Labs_list.Name = "CBC No Diff (Hemogram Only)");
+ Found_INR:= first of (Labs_list where Labs_list.Name = "Prothrombin/INR");
+ Found_APTT:= first of (Labs_list where Labs_list.Name = "APTT");
+
+
+ CheckAPTT:=False;
+ CheckCBC:=False;
+ CheckINR:=False;
+ BaseLineMsg1 := "Baselines have been auto entered for you: \n ";
+ BaseLineMsg2 := "";
+ BaseLineMsg3 := " Please page Lab (dial 2222 enter pager 435) and enter your extension";
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 5);
+
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 6);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 7);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 8);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 9);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+//////////////
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ Lab_Rem_List := Lab_Rem.Value;
+
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+///////////////////////
+ Mlt_Order_Line:= first of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Mlt_List := Mlt_Order_Line.Value;
+
+/////////////////
+ Bolus_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 6);
+ Bolus_List :=Bolus_Grid.Value;
+ Fnd_Bolus := first of (Bolus_List where Bolus_List.Name = "Heparin Inj -");
+
+/////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Con:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units + D5W 500ml");
+ Fnd_Hep_Inf:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units + 0.9% NaCl 500ml");
+
+/////////////
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+////////////
+ fromorderset := last of (field_list where field_list.DataItemName = "MLM_From Order Set");
+////////////
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+////////////
+ Order_Per_Protocol := last of (field_list where field_list.DataItemName = "PRX_Generic_CB"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ Override_Protocol := last of (field_list where field_list.DataItemName = "PRX_Generic_CB"
+ and field_list.Control_MultiFieldOccNum = 2);
+
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|4" then
+
+ If Fnd_Hep_Con.IsSelected = True
+ then
+ Fnd_Hep_Inf.IsReadOnly := True;
+
+ Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ // Fnd_Bolus.IsSelected := True;
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
+ endif;
+ else
+ Fnd_Hep_Inf.IsReadOnly := False;
+ endif;
+
+ If Fnd_Hep_Inf.IsSelected = True
+ then
+ Fnd_Hep_Con.IsReadOnly := True;
+
+ Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True,True,True,True,True);
+
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ // Fnd_Bolus.IsSelected := True;
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
+ endif;
+ else
+ Fnd_Hep_Con.IsReadOnly := False;
+ endif;
+
+ If (Fnd_Hep_Con.IsSelected = False) and (Fnd_Hep_Inf.IsSelected = False)
+ then
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+
+ // Fnd_Bolus.IsSelected := False;
+ Mlt_List.IsSelected := (False,False,False,False,False,False,False,False);
+ endif;
+
+ ElseIf CallingField = "MultiOrderGrid|6" then
+ If Fnd_Bolus.IsSelected = False then
+
+ Order_Per_Protocol.control_Visible:=True;
+ Override_Protocol.control_Visible:=True;
+
+ Order_Per_Protocol.Value:=False;
+ Override_Protocol.Value:=False;
+ Override_Protocol.control_read_only := False;
+ Order_Per_Protocol.control_read_only := False;
+
+ this_communication.Message := "Protocol recommends the 80 units/kg Bolus" || "\n" ||
+ "On the form please select either: " || "\n" ||
+ " Order Bolus Per Protocol (or) " || "\n" ||
+ " Override Recommended Bolus Dosing"
+ ;
+ this_communication.MessageType := "Error";
+ else
+ Order_Per_Protocol.control_Visible:=False;
+ Override_Protocol.control_Visible:=False;
+
+ endif;
+
+ Elseif Callingfield = "PRX_Generic_CB|1" then
+ If Order_Per_Protocol.Value = true then
+ Fnd_Bolus.IsSelected := True;
+ Override_Protocol.control_read_only := True;
+ else
+ Fnd_Bolus.IsSelected := False;
+ Override_Protocol.control_read_only := False;
+ endif;
+ Elseif Callingfield = "PRX_Generic_CB|2" then
+ If Override_Protocol.Value = true then
+ Order_Per_Protocol.control_read_only := True;
+ else
+ Order_Per_Protocol.control_read_only := False;
+ endif;
+
+
+ ElseIf CallingField = "RequestedDate|5" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")"
+ ;
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ endif; //Calling Field
+
+ elseif CallingEvent = "FormOpen" then
+
+ //Retrieve Patient{{{SINGLE-QUOTE}}}s Current Location
+ LocName:= read last
+ {"SELECT currentlocation "
+ || " FROM cv3clientvisit "
+ || " WHERE ClientGUID = " || SQL(client_guid )
+ || " And GUID = " || SQL(visit_guid)};
+ Ed_Loc.Value := LocName;
+
+ Mlt_List.IsReadOnly := (True,True,True,True,True,True,True,True);
+
+ If Ed_Loc.Value matches pattern "ER%" then
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,True);
+ else
+ Mlt_List.IsSelected := (True,True,True,True,True,True,True,False);
+ endif;
+
+ Fnd_Hep_Inf.IsReadOnly := True;
+ // Fnd_Bolus.IsReadOnly := True;
+ Lab_Daily_List.IsReadOnly := (False,True,True,True,True,True);
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+
+ // Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ //TMS - 08-20-18 If ordered from tPA for PE order set no bolus given
+
+ BolusExcludeOrderSet := read last {"Select guid from CV3OrderCatalogSet where name = {{{SINGLE-QUOTE}}}tPA (Alteplase) for the Treatment of Pulmonary Embolism (PE){{{SINGLE-QUOTE}}}"};
+
+ If this_communication.CatalogParentOrderSetGUID = BolusExcludeOrderSet then
+
+ Fnd_Bolus.IsSelected := False;
+ Override_Protocol.control_read_only := False;
+ Override_Protocol.Value := true;
+ Endif;
+
+
+
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Fnd_Hep_Con.IsSelected = True) or (Fnd_Hep_Inf.IsSelected = True) then
+
+ If (Order_Per_Protocol.control_Visible =True) and (Order_Per_Protocol.Value = False) and (Override_Protocol.Value= False) then
+
+ this_communication.Message := "Protocol recommends the 80 units/kg Bolus" || "\n" ||
+ "On the form please select either: " || "\n" ||
+ " Order Bolus Per Protocol (or) " || "\n" ||
+ " Override Recommended Bolus Dosing"
+ ;
+ this_communication.MessageType := "Error";
+ else
+
+ If (Found_CBC.IsSelected =false) or (Found_INR.IsSelected = false) or (Found_APTT.IsSelected= false) then
+
+ If Found_CBC.ISSelected = False then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists CBC_Val then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_CBC.ISSelected :=True;
+ BaseLineMsg2:= BaseLineMsg2 || "CBC \n";
+ endif;
+
+ endif;
+
+// Now for INR
+
+ If Found_INR.ISSelected = False then
+
+ INR_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists INR_Val then
+ CheckINR:=False;
+ else
+ Found_INR.ISSelected :=True;
+ CheckINR:=True;
+ BaseLineMsg2:= BaseLineMsg2 || "Prothrombin/INR \n";
+ endif;
+
+ endif;
+
+// Now for APTT
+
+ If Found_APTT.ISSelected = False then
+
+ APTT_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If exists APTT_Val then
+ CheckAPTT:=False;
+ else
+ Found_APTT.ISSelected :=True;
+ CheckAPTT:=True;
+ BaseLineMsg2:= BaseLineMsg2 || "APTT \n";
+ endif;
+
+ endif;
+
+ /* Reactivate this section for BaseLine Messages To Beep the Lab
+
+ If Not(ED_Loc.Value Matches Pattern "ER%") and Not(ED_Loc.Value Matches Pattern "ICU%") then
+ If (CheckCBC=True) or (CheckINR = True) or (CheckAPTT=True) then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := BaseLineMsg1 || BaseLineMsg2 || BaseLineMsg3;
+ this_communication.MessageType := "Informational";
+ endif;
+
+ endif;
+ */
+
+
+ endif; // Base lines
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+
+ singledate := formlist[J];
+
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+
+
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
+
+
+
+ endif; //If exist
+
+ endif; // order override.
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please Select a Heparin Infusion Order.\n\n" ||
+ " 500ml D5W (Standard Concentration)\n" ||
+ " or \n" ||
+ " 500ml 0.9% NaCl (If Specifically Requested By Physician)";
+ this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_WEIGHT_BASED_MAINT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_WEIGHT_BASED_MAINT.mlm
new file mode 100644
index 0000000..a32d7b6
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HEPARIN_WEIGHT_BASED_MAINT.mlm
@@ -0,0 +1,370 @@
+maintenance:
+
+ title: Set Heparin NurseOrders;;
+ mlmname: FORM_Set_Heparin_Weight_Based_Maint;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-05-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin in weight based heparin maintenance protocol order set
+ ;;
+
+ explanation: This MLM is called from the heparin in weight based heparin maintenance protocol order set, form: OS_WtBasedHeparin
+ Change History
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+ ;;
+ keywords: Called MLMs, weight based heparin maintenance
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // References the LOCAL SESSION object
+ local_session := cds_session.local;
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+/////////////////////////
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ Fnd_APTT := first of (Lab_Daily_List where Lab_Daily_List.Name = "APTT");
+ Fnd_CBC := first of (Lab_Daily_List where Lab_Daily_List.Name = "CBC No Diff (Hemogram Only)");
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate");
+ primreqtime:= last of (field_list where field_list.DataItemName = "RequestedTime");
+ primreqtime_value := primreqtime.value;
+
+/////////////////
+ Bolus_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 6);
+ Bolus_List :=Bolus_Grid.Value;
+ Bolus_40 := first of (Bolus_List where Bolus_List.Name = "Heparin Inj -");
+ Bolus_80:= Last of (Bolus_List where Bolus_List.Name = "Heparin Inj -");
+
+/////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Con:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units + D5W 500ml");
+ Fnd_Hep_Inf:= first of (Heps_List where Heps_List.Name = "Heparin 25,000 Units + 0.9% NaCl 500ml");
+
+///////////// Check boxes to follow or not follow protocol
+
+ Prot_Act := last of (field_list where field_list.DataItemName = "PRX_Generic_CB"
+ and field_List.Control_MultiFieldOccNum = 1);
+ No_Prot_Act := last of (field_list where field_list.DataItemName = "PRX_Generic_CB"
+ and field_List.Control_MultiFieldOccNum = 2);
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|4" then
+
+ If Fnd_Hep_Con.IsSelected = True
+ then
+ Fnd_Hep_Inf.IsReadOnly := True;
+ else
+ Fnd_Hep_Inf.IsReadOnly := False;
+ endif;
+
+ If Fnd_Hep_Inf.IsSelected = True
+ then
+ Fnd_Hep_Con.IsReadOnly := True;
+ else
+ Fnd_Hep_Con.IsReadOnly := False;
+ endif;
+
+ If (Fnd_Hep_Con.IsSelected = False) and (Fnd_Hep_Inf.IsSelected = False)
+ then
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False);
+
+ endif;
+
+ ElseIf CallingField = "MultiOrderGrid|6" then
+
+ If Bolus_40.IsSelected = True then
+ Bolus_80.IsReadOnly := True;
+ else
+ Bolus_80.IsReadOnly := False;
+ endif;
+
+ If Bolus_80.IsSelected = True then
+ Bolus_40.IsReadOnly := True;
+ else
+ Bolus_40.IsReadOnly := False;
+ endif;
+
+
+ elseif Callingfield = "PRX_Generic_CB|1" then
+
+
+ If Prot_Act.Value = True then
+
+ If (Fnd_Hep_Con.IsSelected = False) and (Fnd_Hep_Inf.IsSelected = False) then
+ this_communication.Message := "No Heparin order has been selected to base the Bolus on Per Protocol";
+ this_communication.MessageType := "Error";
+ Else
+ If (local_session.Sess_APTTValue = null) then
+ this_communication.Message := "No APTT value has been set in the Heparin order to base the Bolus on";
+ this_communication.MessageType := "Error";
+ Else
+ No_Prot_Act.control_read_only :=true;
+ // Now for the protocol
+
+
+ If (local_session.Sess_APTTValue < 66) then
+ Bolus_40.IsSelected := False;
+ Bolus_40.IsReadOnly := True;
+ Bolus_80.IsSelected := True;
+ Bolus_80.IsReadOnly := False;
+ elseif (local_session.Sess_APTTValue >= 66) and (local_session.Sess_APTTValue <= 76) then
+ Bolus_40.IsSelected := True;
+ Bolus_40.IsReadOnly := False;
+ Bolus_80.IsSelected := False;
+ Bolus_80.IsReadOnly := True;
+ elseif (local_session.Sess_APTTValue > 76) then
+ Bolus_40.IsSelected := False;
+ Bolus_40.IsReadOnly := False;
+ Bolus_80.IsSelected := False;
+ Bolus_80.IsReadOnly := False;
+ endif;
+ endif;
+ endif; // Heparins True / False
+ else
+ No_Prot_Act.control_read_only :=false;
+ Endif; //Prot Act Value = True
+
+ elseif Callingfield = "PRX_Generic_CB|2" then
+
+ If No_Prot_Act.Value = True then
+
+ Prot_Act.control_read_only :=true;
+ else
+ Prot_Act.control_read_only :=false;
+ Endif; //Prot Act Value = True
+
+
+ endif; //Calling Field
+
+ elseif CallingEvent = "FormOpen" then
+ local_session.Sess_APTTValue :=null;
+
+
+ Fnd_Hep_Inf.IsReadOnly := True;
+ Lab_Daily_List.IsReadOnly := (False,True);
+
+
+
+ elseif CallingEvent = "FormClose" then
+
+ If (Fnd_Hep_Con.IsSelected = True) or (Fnd_Hep_Inf.IsSelected = True) then
+
+ bolus_error := false;
+
+ // check the bolus protocol, using the APTT Session Object.
+
+ If No_Prot_Act.Value = False then
+
+ If (local_session.Sess_APTTValue <66) then
+ if (Bolus_40.IsSelected = True) or ((Bolus_40.IsSelected = False) and (Bolus_80.IsSelected = False)) then
+
+ Prot_Act.control_Visible:=True;
+ No_Prot_Act.control_Visible:=True;
+
+ bolus_error := true;
+
+ this_communication.Message := "The patients APTT value is " || local_session.Sess_APTTValue || "\n" ||
+ " Protocol recommends the 80 units/kg Bolus" || "\n" ||
+ "On the form please select either: " || "\n" ||
+ " Order Bolus Per Protocol (or) " || "\n" ||
+ " Override Recommended Bolus Dosing"
+ ;
+ this_communication.MessageType := "Error";
+ endif;
+
+ elseIf (local_session.Sess_APTTValue >= 66) and (local_session.Sess_APTTValue <= 76) then
+ If (Bolus_80.IsSelected = True) or ((Bolus_40.IsSelected = False) and (Bolus_80.IsSelected = False)) then
+
+ Prot_Act.control_Visible:=True;
+ No_Prot_Act.control_Visible:=True;
+
+ bolus_error := true;
+
+ this_communication.Message := "The patients APTT value is " || local_session.Sess_APTTValue || "\n" ||
+ " Protocol recommends the 40 units/kg Bolus" || "\n" ||
+ "On the form please select either: " || "\n" ||
+ " Order Bolus Per Protocol (or) " || "\n" ||
+ " Override Recommended Bolus Dosing"
+ ;
+ this_communication.MessageType := "Error";
+ endif;
+ elseIf (local_session.Sess_APTTValue > 76) then
+ If ((Bolus_40.IsSelected = True) or (Bolus_80.IsSelected = True)) then
+
+ Prot_Act.control_Visible:=True;
+ No_Prot_Act.control_Visible:=True;
+
+ bolus_error := true;
+
+ this_communication.Message := "The patients APTT value is " || local_session.Sess_APTTValue || "\n" ||
+ " Protocol recommends NO Bolus" || "\n" ||
+ "On the form please select either: " || "\n" ||
+ " Order Bolus Per Protocol (or) " || "\n" ||
+ " Override Recommended Bolus Dosing"
+ ;
+ this_communication.MessageType := "Error";
+ endif;
+
+
+ endif;
+
+ endif;
+
+
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered today to 2 days from now.
+ // Set the check box as needed
+
+ // Only need if:
+// Today Today + 1 Day Today + 2 Days Order for
+// None None None Today + 1 day
+// None None Order Today
+// Order None None Today + 2 days
+// primreqdate;
+
+ If bolus_error = false then
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+
+ tempday := call str_parse with (today as time), " ";
+ today0 := first(tempday);
+ tempday := call str_parse with ((today as time) + 1 day), " ";
+ today1 := first(tempday);
+ tempday := call str_parse with ((today as time) + 2 day), " ";
+ today2 := first(tempday);
+
+ end_date := (today as time) + 3 days;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20)"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(today)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If (today0 not in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 not in CBC_daily_dates) then
+ primreqdate.value := (today as time) + 1 day;
+
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True);
+
+ Message_Date := "GRID CBC order should be set with date: " ||(today as time) + 1 day;
+
+ elseif (today0 not in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 in CBC_daily_dates) then
+ primreqdate.value := (today as time) ;
+ primreqtime_value.ReqTimeCode := "Today";
+
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,True);
+ Message_Date := "GRID CBC order should be set with date: " || (today as time) || "\n with time " || "Today";
+
+
+ elseif (today0 in CBC_daily_dates) and (today1 not in CBC_daily_dates) and (today2 not in CBC_daily_dates) then
+ primreqdate.value := (today as time) + 2 days;
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,Reset_CBC_Grid);
+ Message_Date := "GRID CBC order should be set with date: " || (today as time) + 2 days;
+
+ else
+ Lab_Daily_List.IsSelected := (Fnd_APTT.IsSelected,False);
+ Message_Date := "GRID CBC order should not be checked";
+ endif;
+
+
+ endif;
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please Select a Heparin Infusion Order.\n\n" ||
+ " 500ml D5W (Standard Concentration)\n" ||
+ " or \n" ||
+ " 500ml 0.9% NaCl (If Specifically Requested By Physician)";
+ this_communication.MessageType := "Error";
+
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_HYPOGLYCEMIA.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_HYPOGLYCEMIA.mlm
new file mode 100644
index 0000000..a099e18
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_HYPOGLYCEMIA.mlm
@@ -0,0 +1,470 @@
+maintenance:
+
+ title: FORM_SET_HYPOGLYCEMIA;;
+ mlmname: FORM_SET_HYPOGLYCEMIA;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Dean Miklavic;;
+ specialist: Don Warnick;;
+ date: 2016-04-27;;
+ validation: testing;;
+
+library:
+ purpose: Select orders from the Hypoglycemic Standing Order OS based upon the combiniation of selections in 3 drop down boxes
+ ;;
+
+ explanation: This MLM is called from the Hypoglycemic Standing Order Set
+
+
+ Change history
+
+ 04.27.2016 - DJW CSR# 34322 - Created
+ 05.11.2017 - TMS CSR# 35673 - Adjust MLM to support adding of Glutose as a selectable option for scenario 1, 6, 2 and 9.
+ 03.19.2018 - TMS CSR# 38042 - Modify MLM to support order set having two options for BGM 50 - 69 MG/DL and BGM 40 - 59 MG/DL.
+ Default selection to Dextrose 50% Inj, but allow user to change to D10W Infusion. Dextrose 50% Inj
+ was replaced by D10W during shortage of Dextrose. Both options are to remain onthe order set with only
+ one option selected for entry.
+
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ BGM := first of (field_list where field_list.DataItemName = "NUR_Hypoglycemic_BGM");
+ Condition:= first of (field_list where field_list.DataItemName = "NUR_Hypoglycemic_Condition");
+ IVAccess := first of (field_list where field_list.DataItemName = "NUR_Hypoglycemic_IVAccess");
+
+ Preview := first of (field_list where field_list.DataItemName = "NUR_Hypoglycemic_Preview" and field_List.Control_MultiFieldOccNum = 1);
+
+ NurseInstructions5069Grid := first of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 2);
+ NurseInstructions4049Grid := first of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 3);
+ NurseInstructions0039Grid := first of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 4);
+
+ IVGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 50);
+ MedicationGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 56);
+ OralMedicationGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 62);
+
+ Instructions5069Grid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 59);
+ Instructions4049Grid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 60);
+ Instructions0039Grid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 61);
+
+
+// Determine the scenario
+
+ Scenario := "0";
+
+ if BGM.Value is not null and Condition.value is not null and IVAccess.value is not null
+
+ then // All fields are addressed
+
+ if BGM.Value = "50 - 69 MG/DL"
+
+ then // BGM 50-60
+
+ if Condition.value = "Patient is alert and eating"
+
+ then // Able to Swallow
+
+ If IVAccess.value = "Patient has IV Access"
+ then
+ Scenario := "1";
+ else
+ Scenario := "6";
+ endif;
+
+ else // Unable to Swallow
+
+ If IVAccess.value = "Patient has IV Access"
+ then
+ Scenario := "4";
+ else
+ Scenario := "5";
+ endif;
+
+ endif;
+
+
+ elseif BGM.Value = "40 - 49 MG/DL"
+
+
+ then // BGM 40 - 49
+
+ if Condition.value = "Patient is alert and eating"
+
+ then // Able to Swallow
+
+ If IVAccess.value = "Patient has IV Access"
+ then
+ Scenario := "2";
+ else
+ Scenario := "9";
+ endif;
+
+ else // Unable to Swallow
+
+ If IVAccess.value = "Patient has IV Access"
+ then
+ Scenario := "7";
+ else
+ Scenario := "8";
+ endif;
+
+ endif;
+
+ else // BGM.Value = "<40"
+
+ if Condition.value = "Patient is alert and eating"
+
+ then // Able to Swallow
+
+ If IVAccess.value = "Patient has IV Access"
+ then
+ Scenario := "3";
+ else
+ Scenario := "12";
+ endif;
+
+ else // Unable to Swallow
+
+ If IVAccess.value = "Patient has IV Access"
+ then
+ Scenario := "10";
+ else
+ Scenario := "11";
+ endif;
+
+ endif;
+
+
+ endif; // BGM Question
+
+
+ endif; // All fields are filled
+
+
+
+ // Select the appropriate orders for the scenario
+
+
+
+ If Scenario <> "0"
+
+ then
+ // All fields are addressed
+ If callingfield <> "MultiOrderGrid|56" then
+
+ // Initialize all order fields
+ NurseInstructions5069Grid.Value.IsSelected := False;
+ NurseInstructions5069Grid.Value.IsReadonly := True;
+ NurseInstructions4049Grid.Value.IsSelected := False;
+ NurseInstructions4049Grid.Value.IsReadonly := True;
+ NurseInstructions0039Grid.Value.IsSelected := False;
+ NurseInstructions0039Grid.Value.IsReadonly := True;
+ IVGrid.Value[1].IsSelected := False;
+ IVGrid.Value[1].IsReadonly := True;
+
+ index_list := 1 seqto (count MedicationGrid.Value);
+ for I in index_list do
+ MedicationGrid.Value[I].IsSelected := False;
+ MedicationGrid.value[I].IsReadonly := True;
+ enddo;
+ index_list := 1 seqto (count OralMedicationGrid.Value);
+ for I in index_list do
+ // OralMedicationGrid.Value[I].IsSelected := False;
+ OralMedicationGrid.value[I].IsReadonly := True;
+ enddo;
+ index_list := 1 seqto (count Instructions5069Grid.Value);
+ for I in index_list do
+ Instructions5069Grid.Value[I].IsSelected := False;
+ Instructions5069Grid.value[I].IsReadonly := True;
+ enddo;
+ index_list := 1 seqto (count Instructions4049Grid.Value);
+ for I in index_list do
+ Instructions4049Grid.Value[I].IsSelected := False;
+ Instructions4049Grid.Value[I].IsReadonly := True;
+ enddo;
+ index_list := 1 seqto (count Instructions0039Grid.Value);
+ for I in index_list do
+ Instructions0039Grid.Value[I].IsSelected := False;
+ Instructions0039Grid.Value[I].IsReadonly := True;
+ enddo;
+ endif;
+
+ // If user switches between D10W infusion and Dextrose 50% syringe mark other option as not selected and read only
+
+ If CallingEvent = "Fieldchange" and callingfield = "MultiOrderGrid|56" then
+
+ If (MedicationGrid.Value[2].IsSelected = True and MedicationGrid.Value[1].IsSelected = True and MedicationGrid.Value[1].IsReadOnly = True) then
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := True;
+ MedicationGrid.Value[1].IsReadOnly := False;
+ MedicationGrid.Value[2].IsReadOnly := True;
+ endif;
+ If (MedicationGrid.Value[2].IsSelected = True and MedicationGrid.Value[1].IsSelected = True and MedicationGrid.Value[2].IsReadOnly = True) then
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[1].IsSelected := True;
+ MedicationGrid.Value[2].IsReadOnly := False;
+ MedicationGrid.Value[1].IsReadOnly := True;
+ endif;
+ If (MedicationGrid.Value[5].IsSelected = True and MedicationGrid.Value[4].IsSelected = True and MedicationGrid.Value[4].IsReadOnly = True) then
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := True;
+ MedicationGrid.Value[4].IsReadOnly := False;
+ MedicationGrid.Value[5].IsReadOnly := True;
+ endif;
+ If (MedicationGrid.Value[5].IsSelected = True and MedicationGrid.Value[4].IsSelected = True and MedicationGrid.Value[5].IsReadOnly = True) then
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := True;
+ MedicationGrid.Value[5].IsReadOnly := False;
+ MedicationGrid.Value[4].IsReadOnly := True;
+ endif;
+ If (MedicationGrid.Value[8].IsSelected = True and MedicationGrid.Value[7].IsSelected = True and MedicationGrid.Value[7].IsReadOnly = True) then
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := True;
+ MedicationGrid.Value[7].IsReadOnly := False;
+ MedicationGrid.Value[8].IsReadOnly := True;
+ endif;
+ If (MedicationGrid.Value[8].IsSelected = True and MedicationGrid.Value[7].IsSelected = True and MedicationGrid.Value[8].IsReadOnly = True) then
+ MedicationGrid.Value[8].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := True;
+ MedicationGrid.Value[8].IsReadOnly := False;
+ MedicationGrid.Value[7].IsReadOnly := True;
+ endif;
+
+ endif;
+
+ If (callingevent = "Fieldchange" and CallingField = "NUR_Hypoglycemic_Preview|1") or CallingEvent = "FormClose" then
+ // Populate new fields based upon the selected scenarios
+
+ if Scenario = "1"
+ then
+ NurseInstructions5069Grid.Value.IsSelected := True;
+ Instructions5069Grid.Value[1].IsSelected := True;
+ OralMedicationGrid.Value[1].IsReadOnly := False;
+ OralMedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := False;
+ MedicationGrid.Value[9].IsSelected := False;
+ elseif Scenario = "2"
+ then
+ NurseInstructions4049Grid.Value.IsSelected := True;
+ Instructions4049Grid.Value[1].IsSelected := True;
+ OralMedicationGrid.Value[2].IsReadOnly := False;
+ OralMedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := False;
+ MedicationGrid.Value[9].IsSelected := False;
+ elseif Scenario = "3"
+ then
+ NurseInstructions0039Grid.Value.IsSelected := True;
+ Instructions0039Grid.Value[1].IsSelected := True;
+ MedicationGrid.Value[7].IsSelected := True;
+ MedicationGrid.Value[8].IsReadOnly := False;
+ IVGrid.Value.IsSelected := True;
+ OralMedicationGrid.Value[1].IsSelected := False;
+ OralMedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[9].IsSelected := False;
+ elseif Scenario = "4"
+ then
+ NurseInstructions5069Grid.Value.IsSelected := True;
+ Instructions5069Grid.Value[2].IsSelected := True;
+ OralMedicationGrid.Value[1].IsSelected := False;
+ OralMedicationGrid.Value[2].IsSelected := False;
+ If (MedicationGrid.Value[1].IsSelected = False and MedicationGrid.Value[2].IsSelected = False) then
+ MedicationGrid.Value[1].IsSelected := True;
+ MedicationGrid.Value[1].IsReadOnly := True;
+ MedicationGrid.Value[2].IsReadOnly := False;
+ endif;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := False;
+ MedicationGrid.Value[9].IsSelected := False;
+
+ elseif Scenario = "5"
+ then
+ NurseInstructions5069Grid.Value.IsSelected := True;
+ Instructions5069Grid.Value[3].IsSelected := True;
+ MedicationGrid.Value[3].IsSelected := True;
+ OralMedicationGrid.Value[1].IsSelected := False;
+ OralMedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := False;
+ MedicationGrid.Value[9].IsSelected := False;
+ elseif Scenario = "6"
+ then
+ NurseInstructions5069Grid.Value.IsSelected := True;
+ Instructions5069Grid.Value[1].IsSelected := True;
+ OralMedicationGrid.Value[1].IsReadOnly := False;
+ OralMedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := False;
+ MedicationGrid.Value[9].IsSelected := False;
+ elseif Scenario = "7"
+ then
+ NurseInstructions4049Grid.Value.IsSelected := True;
+ Instructions4049Grid.Value[2].IsSelected := True;
+ OralMedicationGrid.Value[1].IsSelected := False;
+ OralMedicationGrid.Value[2].IsSelected := False;
+ If (MedicationGrid.Value[4].IsSelected = False and MedicationGrid.Value[5].IsSelected = False) then
+ MedicationGrid.Value[4].IsSelected := True;
+ MedicationGrid.Value[4].IsReadOnly := True;
+ MedicationGrid.Value[5].IsReadOnly := False;
+ endif;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := False;
+ MedicationGrid.Value[9].IsSelected := False;
+ elseif Scenario = "8"
+ then
+ NurseInstructions4049Grid.Value.IsSelected := True;
+ Instructions4049Grid.Value[3].IsSelected := True;
+ MedicationGrid.Value[6].IsSelected := True;
+ OralMedicationGrid.Value[1].IsSelected := False;
+ OralMedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := False;
+ MedicationGrid.Value[9].IsSelected := False;
+ elseif Scenario = "9"
+ then
+ NurseInstructions4049Grid.Value.IsSelected := True;
+ Instructions4049Grid.Value[1].IsSelected := True;
+ OralMedicationGrid.Value[2].IsReadOnly := False;
+ OralMedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := False;
+ MedicationGrid.Value[9].IsSelected := False;
+ elseif Scenario = "10"
+ then
+ NurseInstructions0039Grid.Value.IsSelected := True;
+ Instructions0039Grid.Value[1].IsSelected := True;
+ OralMedicationGrid.Value[1].IsSelected := False;
+ OralMedicationGrid.Value[2].IsSelected := False;
+ IVGrid.Value.IsSelected := True;
+ If (MedicationGrid.Value[7].IsSelected = False and MedicationGrid.Value[8].IsSelected = False) then
+ MedicationGrid.Value[7].IsSelected := True;
+ MedicationGrid.Value[7].IsReadOnly := True;
+ MedicationGrid.Value[8].IsReadOnly := False;
+ endif;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[9].IsSelected := False;
+ elseif Scenario = "11"
+ then
+ NurseInstructions0039Grid.Value.IsSelected := True;
+ Instructions0039Grid.Value[2].IsSelected := True;
+ MedicationGrid.Value[9].IsSelected := True;
+ OralMedicationGrid.Value[1].IsSelected := False;
+ OralMedicationGrid.Value[2].IsSelected := False;
+ IVGrid.Value.IsSelected := True;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := False;
+ elseif Scenario = "12"
+ then
+ NurseInstructions0039Grid.Value.IsSelected := True;
+ Instructions0039Grid.Value[2].IsSelected := True;
+ MedicationGrid.Value[9].IsSelected := True;
+ OralMedicationGrid.Value[1].IsSelected := False;
+ OralMedicationGrid.Value[2].IsSelected := False;
+ IVGrid.Value.IsSelected := True;
+ MedicationGrid.Value[1].IsSelected := False;
+ MedicationGrid.Value[2].IsSelected := False;
+ MedicationGrid.Value[3].IsSelected := False;
+ MedicationGrid.Value[4].IsSelected := False;
+ MedicationGrid.Value[5].IsSelected := False;
+ MedicationGrid.Value[6].IsSelected := False;
+ MedicationGrid.Value[7].IsSelected := False;
+ MedicationGrid.Value[8].IsSelected := False;
+ endif;
+ endif;
+ endif;
+
+
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_IFEX_MESNA.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_IFEX_MESNA.mlm
new file mode 100644
index 0000000..4a3b09f
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_IFEX_MESNA.mlm
@@ -0,0 +1,205 @@
+maintenance:
+
+ title: Set ifosfamide order set with automatic mesna ordering;;
+ mlmname: FORM_Set_Ifex_Mesna ;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: St. Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: Shawn Roberts ;;
+ date: 2018-10-29;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation: This MLM is called from the {{{SINGLE-QUOTE}}}Ifosfamide and Mesna orders{{{SINGLE-QUOTE}}} order set, form: PRX_OsIfex_Mesna
+
+ Change history
+
+ 10.29.2018 SZ CSR #35198 - ifex-mesna order set - derived from FORM_Set_Lovenox_Orders_Inj as a model
+
+ ;;
+ keywords: Ifex, ifosfamide, mesna, mesnex
+ ;;
+ citations:
+ ;;
+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;
+
+ // Use String parse
+ 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;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ current_time := NOW as time;
+ current_hour := extract hour NOW;
+ current_minute := extract minute NOW;
+ now_plus_half_hour := Now + 30 minutes;
+ now_plus_one_hour := Now + 1 hour;
+ now_plus_three_half_hour := Now + 3 hours + 30 minutes;
+
+ Ifex_Order_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Mesna_Order_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Mesna_Order_Grid_List := Mesna_Order_Grid.Value;
+
+ // Find all reuqested date and requested time fields
+ request_date_1:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ request_date_2:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ request_date_3:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+ request_date_4:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 4);
+ requested_time_1:= last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1);
+ requested_time_2:= last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2);
+ requested_time_3:= last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3);
+ requested_time_4:= last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 4);
+
+
+ requested_time_1_VALUE := requested_time_1.Value;
+ requested_time_2_VALUE := requested_time_2.Value;
+ requested_time_3_VALUE := requested_time_3.Value;
+
+ stop_after_1:= last of (field_list where field_list.DataItemName = "StopAfter" and field_List.Control_MultiFieldOccNum = 1);
+ stop_after_Value := stop_after_1.Value;
+
+ comb_ht_wt_field := (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;
+ wt_type := comb_ht_wt_val.weighttype;
+ bsa := first of comb_ht_wt_val.bsa;
+ bmi := comb_ht_wt_val.bmi;
+ endif;
+
+
+ //Find if any of the med boxes are checked...if so, set Med_Was_Selected to "yes"
+ Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ // Med_GridC := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Med_List := Med_Grid.Value;
+ //Med_ListC :=Med_GridC.Value;
+ Med_SelList := Med_List.IsSelected;
+ //Med_SelListC := Med_ListC.IsSelected;
+ Med_Selected := true in Med_SelList;
+ //Med_SelectedC := true in Med_SelListC;
+ If (Med_Selected = True) then
+ Med_Was_Selected := "yes";
+ else Med_Was_Selected := "no" ;
+ endif;
+
+
+
+/**************************** rules start below *************************************************/
+
+ // if a ifosfamide order is selected, then auto-select all mesna orders
+ If (CallingEvent = "FieldChange") and (Med_Was_Selected = "yes") then
+ Mesna_Order_Grid_List.IsSelected := (True,True,True);
+ // ifosfamide order is unchecked in order grid 1F
+ else
+ Mesna_Order_Grid_List.IsSelected := (False,False,False);
+ endif; // If (CallingEvent = "FieldChange") and (Med_Was_Selected = "yes") then
+
+
+
+ If (CallingEvent = "FieldChange") and (CallingField = "RequestedTime|1") then
+
+ ifex_target_time_formatted := requested_time_1_VALUE.ReqTimeValue as time;
+
+ date_manipulation := (extract month request_date_1.value) formatted with "%02d" || "-" ||
+ (extract day request_date_1.value) formatted with "%02d" || "-" ||
+ (extract year request_date_1.value) formatted with "%04d" || " " ||
+ (requested_time_1_VALUE.ReqTimeValue) || ":" ||
+ 00 formatted with "%02d";
+
+ date_manipulation_time := date_manipulation as time;
+
+
+ // time manipulation happens here, correct the date prior to this step
+ //ifex_target_time_back_half_hour := ifex_target_time_formatted - 30 minutes;
+ //ifex_target_time_plus_two_half_hour := ifex_target_time_formatted + 2 hours + 30 minutes;
+ ifex_target_time_back_half_hour := date_manipulation_time - 30 minutes;
+ ifex_target_time_plus_two_half_hour := date_manipulation_time + 2 hours + 30 minutes;
+
+ request_date_2.value := ifex_target_time_back_half_hour;
+ request_date_3.value := ifex_target_time_plus_two_half_hour;
+
+ requested_time_2_VALUE.ReqTimeCode := "Scheduled/Start Time";
+ requested_time_2_VALUE.ReqTimeValue := (extract hour ifex_target_time_back_half_hour) formatted with "%02d" || ":" || (extract minute ifex_target_time_back_half_hour) formatted with "%02d" ;
+ requested_time_3_VALUE.ReqTimeCode := "Scheduled/Start Time";
+ requested_time_3_VALUE.ReqTimeValue := (extract hour ifex_target_time_plus_two_half_hour) formatted with "%02d" || ":" || (extract minute ifex_target_time_plus_two_half_hour) formatted with "%02d" ;
+
+
+ endif; //If (CallingEvent = "FieldChange") and (CallingField = "RequestedTime|1") then
+
+
+
+ // upon FormOpen, make all daily lab orders and baseline labs read only
+ // also sets hidden fields so that when a med is selected, the dates populate up to the orders "Scheduled Date"
+ If (CallingEvent = "FormOpen") then
+
+ Mesna_Order_Grid_List.IsSelected := (True,True,True);
+
+ requested_time_1_VALUE.ReqTimeCode := "Scheduled/Start Time";
+ requested_time_1_VALUE.ReqTimeValue := (extract hour now_plus_one_hour) formatted with "%02d" || ":" || (extract minute now_plus_one_hour) formatted with "%02d" ;
+ requested_time_2_VALUE.ReqTimeCode := "Scheduled/Start Time";
+ requested_time_2_VALUE.ReqTimeValue := (extract hour now_plus_half_hour) formatted with "%02d" || ":" || (extract minute now_plus_half_hour) formatted with "%02d" ;
+ requested_time_3_VALUE.ReqTimeCode := "Scheduled/Start Time";
+ requested_time_3_VALUE.ReqTimeValue := (extract hour now_plus_three_half_hour) formatted with "%02d" || ":" || (extract minute now_plus_three_half_hour) formatted with "%02d" ;
+
+ startdate:= request_date_1.value; // used to calculate dates for hidden fields below
+
+ stop_after_Value.Option := "Times";
+
+
+ endif; // If CallingEvent = "FormOpen" then
+
+
+
+
+ If (CallingEvent = "FieldChange") and (CallingField = "RequestedDate|1") then
+
+ day_difference := request_date_1.value - request_date_4.value;
+
+ request_date_2.value := request_date_2.value + day_difference;
+ request_date_3.value := request_date_3.value + day_difference;
+
+ request_date_4.value := request_date_1.value; // saves the new date for ifex
+
+ endif; // If (CallingEvent = "FieldChange") and (CallingField = "RequestedDate|1") then
+
+
+
+
+ ;;
+ priority: 50
+ ;;
+ 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;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_INFLIXIMAB_DOSING.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_INFLIXIMAB_DOSING.mlm
new file mode 100644
index 0000000..947e843
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_INFLIXIMAB_DOSING.mlm
@@ -0,0 +1,251 @@
+maintenance:
+
+ title: Intravenous Infliximab Physician Orders;;
+ mlmname: FORM_Set_Infliximab_Dosing;;
+ arden: version 2.5;;
+ version: 16.30;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ext 7448;;
+ specialist: Teresa Spicuzza, Allscripts ext 7448;;
+ date: 2018-11-07;;
+ validation: testing;;
+
+library:
+ purpose: Used for Intravenous Infliximab (Remicade) or Infliximab-dyyb (Inflectra) Physician Order Set.
+ ;;
+
+ explanation: This MLM is called from the Intravenous Infliximab (Remicade) or Infliximab-dyyb (Inflectra) Physician Order Set
+
+
+ Change history
+
+ 11.07.2018 TMS CSR 36315: Initial build
+ 01.25.2019 TMS CSR 36315: Removed hard stop when no infliximab is entered
+
+
+ ;;
+ keywords: Called MLMs, Infliximab, Remicade, Infliximab-dyyb, Inflectra)
+ ;;
+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;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+
+ MgPerKg:= last of (field_list where field_list.DataItemName = "PRX_DosePerKg" and field_List.Control_MultiFieldOccNum = 1);
+ FixedDose:= last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 1);
+ OrderedDose := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 2);
+ CalcDose:= last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 2);
+ TitrateButton:= last of (field_list where field_list.DataItemName = "PRX_Generic_CB" and field_List.Control_MultiFieldOccNum = 1);
+ DosingInfo:= last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 3);
+ OrderGrid:= last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ OrderGrid_List := OrderGrid.Value;
+ RateInfo := last of (field_list where field_list.DataItemName = "AdminInstructions" and field_List.Control_MultiFieldOccNum = 1);
+ DosingInfo_List := DosingInfo.value;
+
+ ReasonMessage := "Please select either Infliximab (Remicade)Order" ||CRLF || "or Infliximab-dyyb (Inflectra)Order to continue.";
+
+ DoseInfo1:= last of (field_list where field_list.DataItemName = "PRX_Dosing_Info" and field_List.Control_MultiFieldOccNum = 1);
+ DoseInfo2:= last of (field_list where field_list.DataItemName = "PRX_Dosing_Info" and field_List.Control_MultiFieldOccNum = 2);
+ //OrderSetComplete := last of (field_list where field_list.DataItemName = "PRX_Generic_Text_Box" and field_List.Control_MultiFieldOccNum = 2);
+ //OrderSetComplete.Control_Mandatory := True;
+ EntryTime := (now as time) ;
+ GiveMinute := extract minute EntryTime;
+ GiveHour := extract hour EntryTime;
+ StandardRate := "Infuse at 125 mL/hr over 2 hours";
+ Remicade := first of (OrderGrid_List where OrderGrid_List.Name = "Infliximab:");
+ Inflectra := first of (OrderGrid_List where OrderGrid_List.Name = "Infliximab-dyyb:");
+ TitrateRate := "Infuse at 10 mL/hr for 15 minutes" || CRLF
+ || TAB || " 20 mL/hr for 15 minutes" || CRLF
+ || TAB || " 40 mL/hr for 15 minutes" || CRLF
+ || TAB || " 80 mL/hr for 15 minutes" || CRLF
+ || TAB || "150 mL/hr for 30 minutes" || CRLF
+ || TAB || "250 mL/hr Until the end of therapy";
+
+ Info2 := "Titration recommended per provider’s order: "|| CRLF ||CRLF
+ || TAB ||"Infuse at: " || TAB ||" 10 mL/hr for 15 minutes, then" || TAB || TAB ||" 20 mL/hr for 15 minutes, then " || CRLF
+ || TAB ||TAB || " 40 mL/hr for 15 minutes, then " || TAB ||" 80 mL/hr for 15 minutes, then " || CRLF
+ || TAB ||TAB || "150 mL/hr for 30 minutes, then " || TAB || "250 mL/hr Until the end of therapy";
+
+
+ Info1 := "Standard Infusion Rate:" || CRLF || CRLF
+ || TAB || "Infuse at 125 mL/hr over 2 hours";
+ DoseInfo1.value := Info1;
+ DoseInfo2.value := Info2;
+
+
+
+
+
+
+ // 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);
+ needweight := false;
+ Endif;
+
+ If weightvalue is null or weightvalue = 0 then
+ needweight := true;
+ AlertingFixedDose := 1500;
+ else
+ AlertingFixedDose := ((wt as number) * 10) + 100;
+ endif;
+
+ If CallingEvent = "FieldChange" and CallingField = "CombinedMeasurements|1"
+ and MgPerKg.value is not null
+ and FixedDose.value is null then
+ RawDose := (wt as number) * (MgPerKg.value as number);
+ OrderedDose.value := int((RawDose + 5)/10) * 10;
+ endif;
+
+ DosingInfo_List.IsReadOnly := (true, true);
+
+ If CallingEvent = "FieldChange" and CallingField = "PRX_DosePerKg|1" then
+ If FixedDose.value is not null then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You have already entered a value for FIXED Dosing."
+ ||" \n\n Choose YES to continue with the entered FIXED Dose."
+ ||" \n\n Choose NO to continue with WEIGHT BASED Dosing." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult as string) = "Yes") then
+ MgPerKg.value := null;
+ If (FixedDose.value as number) > (AlertingFixedDose as number) then
+ dialogResult3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " The dose you entered, " || FixedDose.value || " mg, is higher than the" || CRLF ||
+ "recommended dosing for Infliximab. Please verify dose. ", "High Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+ OrderedDose.value := FixedDose.value;
+ elseif ((dialogResult as string) = "No") then
+ FixedDose.value := null;
+ endif;
+ endif;
+ If FixedDose.value is null then
+ If Needweight = true then
+ dialogResult2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Please enter a weight to"|| CRLF ||
+ "calculate Weight Based Dosing.", "Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Else
+ If (MgPerKg.value as number) > 10 then
+ dialogResult3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " The dose you entered, " || MgPerKg.value || " mg/kg, is higher than the" || CRLF ||
+ "recommended dosing for Infliximab. Please verify dose. ", "High Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+ RawDose := (wt as number) * (MgPerKg.value as number);
+ OrderedDose.value := int((RawDose + 5)/10) * 10;
+ endif;
+ endif;
+ endif;
+
+ If CallingEvent = "FieldChange" and CallingField = "DosageLow|1" then
+ If MgPerKg.value is not null then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You have already entered a value for WEIGHT BASED Dosing."
+ ||" \n\n Choose YES to continue with WEIGHT BASED Dosing."
+ ||" \n\n Choose NO to continue with the entered FIXED Dose." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult as string) = "Yes") then
+ If Needweight = true then
+ dialogResult2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Please enter a weight to"|| CRLF ||
+ "calculate Weight Based Dosing.", "Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Else
+ If (MgPerKg.value as number) > 10 then
+ dialogResult2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " The dose you entered, " || MgPerKg.value || " mg/kg, is higher than the" || CRLF ||
+ "recommended dosing for Infliximab. Please verify dose. ", "High Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif; RawDose := (wt as number) * (MgPerKg.value as number);
+ OrderedDose.value := int((RawDose + 5)/10) * 10;
+ FixedDose.value := null;
+ endif;
+ elseif ((dialogResult as string) = "No") then
+ MgPerKg.value := null;
+ endif;
+ endif;
+
+ If MgPerKg.value is null then
+
+ If (FixedDose.value as number) > (AlertingFixedDose as number) then
+ dialogResult3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " The dose you entered, " || FixedDose.value || " mg, is higher than the" || CRLF ||
+ "recommended dosing for Infliximab. Please verify dose. ", "High Dose Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+ OrderedDose.value := FixedDose.value;
+ endif;
+ endif;
+
+ If CallingEvent = "FieldChange" and CallingField = "PRX_Generic_CB|1" then
+ If TitrateButton.value = true then
+ RateInfo.value := TitrateRate;
+ Else RateInfo.value := StandardRate;
+ endif;
+ endif;
+ If CallingField = "MultiOrderGrid|1" then
+ If Remicade.IsSelected = true then
+ Inflectra.IsSelected := false;
+ Inflectra.IsReadOnly := true;
+ Elseif Inflectra.IsSelected = true then
+ Remicade.IsSelected := false;
+ Remicade.IsReadOnly := true;
+ else
+ Remicade.IsSelected := false;
+ Remicade.IsReadOnly := false;
+ Inflectra.IsSelected := false;
+ Inflectra.IsReadOnly := false;
+ endif;
+ endif;
+
+ If Remicade.IsSelected = False and Inflectra.IsSelected = False then
+ hardstop := "no";
+ // changed to remove hardstop as they enter pre med orders before the patient is arrived and weighed and then
+ // go back into the order set to enter the infliximab. TMS 01/25/2019
+ // hardstop := "yes";
+ else hardstop := "no";
+ endif;
+
+ ReasonMessage := "Please select Infliximab (Remicade) or Infliximab-dyyb (Inflectra) to continue.";
+
+ If callingevent = "FormClose" then
+ If hardstop = "yes" then //Present user with message box and stop order set from being submitted.
+ this_communication.DisplayForm := "yes";
+ this_communication.Message := ReasonMessage;
+ this_communication.MessageType := "Error";
+ else
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_INSTRUCTIONS_IN_CHF_ADMISSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_INSTRUCTIONS_IN_CHF_ADMISSION.mlm
new file mode 100644
index 0000000..c74fe74
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_INSTRUCTIONS_IN_CHF_ADMISSION.mlm
@@ -0,0 +1,94 @@
+maintenance:
+
+ title: FORM_SET_INSTRUCTIONS_IN_CHF_ADMISSION ;;
+ mlmname: FORM_SET_INSTRUCTIONS_IN_CHF_ADMISSION ;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-06-12;;
+ validation: testing;;
+
+library:
+ purpose:
+
+ ;;
+ explanation: Set The Instruction Coulmn Value
+
+
+ Change history
+
+ 03.30.2015 SJ CSR# 33352 - Created
+ 06.09.2016 DW CSR# 33788 - Cardizem. New modifiers need to populate the medication instructions field
+
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ ( this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ Prm_BP := last of (field_list where field_list.DataItemName = "CHF_Admission_Hold_SBP");
+ Prm_HR := last of (field_list where field_list.DataItemName = "CHF_Admission_Hold_HR");
+ Prm_Mod_IV := last of (field_list where field_list.DataItemName = "CHF_Admission_Modify_IV_Rate");
+ Prm_Keep_HR:= last of (field_list where field_list.DataItemName = "CHF_Admission_HR_Less_Than_100");
+ Prm_Admin_instr := last of (field_list where field_list.DataItemName = "AdminInstructions");
+
+
+
+
+// Third flow *****************************************************************
+Admin_Instr:= "";
+
+ If Prm_BP.Value is not Null Then
+ Admin_Instr := Prm_BP.Value ;
+ EndIf;
+
+ If Prm_HR.Value is not Null Then
+ If Admin_Instr <> "" Then
+ Admin_Instr := Admin_Instr || " , " || Prm_HR.Value ;
+ Else
+ Admin_Instr := Prm_HR.Value ;
+ Endif;
+ EndIf;
+
+ If Prm_Mod_IV.Value is not Null Then
+ If Admin_Instr <> "" Then
+ Admin_Instr := Admin_Instr || " , " || Prm_Mod_IV.Value ;
+ Else
+ Admin_Instr := Prm_Mod_IV.Value ;
+ Endif;
+ EndIf;
+
+ If Prm_Keep_HR.Value is not Null Then
+ If Admin_Instr <> "" Then
+ Admin_Instr := Admin_Instr || " , " || Prm_Keep_HR.Value ;
+ Else
+ Admin_Instr := Prm_Keep_HR.Value ;
+ Endif;
+ EndIf;
+
+
+ Prm_Admin_instr.Value := Admin_Instr;
+
+
+
+;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_INTRA_ABDOMINAL_ANTIBIOTICS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_INTRA_ABDOMINAL_ANTIBIOTICS.mlm
new file mode 100644
index 0000000..718805f
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_INTRA_ABDOMINAL_ANTIBIOTICS.mlm
@@ -0,0 +1,775 @@
+maintenance:
+
+ title: FORM_SET_INTRA_ABDOMINAL_ANTIBIOTICS;;
+ mlmname: FORM_SET_INTRA_ABDOMINAL_ANTIBIOTICS;;
+ 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 Intra-Abdominal Antibiotics order set
+ ;;
+
+ explanation: This MLM is called from Intra-Abdominal Antibiotics Order Set
+
+ Change history
+ 05.09.2016 JML CSR 34091: Created for Intra-Abdominal Antibiotic Order Set
+ 04.12.2017 JML CSR 35566: Change default Zosyn selection to lower dose.
+ 02.13.2018 JML CSR 26163: Replaced cefepime / ceftriaxone with mini-syringes due to drug shortage
+ 03.09.2018 TMS CSR 34822: Update Zosyn selections to use extended infusion logic
+
+ ;;
+ keywords: Called MLMs, Antibiotic Intra-Abdominal, 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}}};
+ crcl_mlm := mlm {{{SINGLE-QUOTE}}}FORM_MLM_Creatinine_Clearance_OS{{{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}}};
+ antibiotic_guideline_mlm := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_DISPLAY_ANTIBIOTIC_GUIDELINES{{{SINGLE-QUOTE}}};
+
+ AutoMedScheduling := MLM {{{SINGLE-QUOTE}}}FORM_Antibiotic_Scheduling{{{SINGLE-QUOTE}}};
+
+ exceptFld := ();
+ cefazolin_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
+ Augmentin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 1 );
+ Levaquin_Flagyl_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 2 );
+ Zosyn_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 3 );
+ Cefepime_Flagyl_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 5 );
+ Zosyn2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 4 );
+ Cipro_Flagyl_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 7 );
+ Ancef_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 8 );
+ Zosyn3_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 9 );
+ Cipro_Flagyl2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 11 );
+ Fluconazole_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 16 );
+
+ 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 );
+
+ Antibiotics_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 1 );
+ Antibiotics_Grid_Value := Antibiotics_Grid.Value;
+
+ Augmentin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Amoxicillin/Clavulanic Acid 875mg Tab" );
+ Levaquin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Levofloxacin 750mg Tab" );
+ Flagyl_Oral := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Metronidazole 500mg Tab" );
+ Flagyl_IV := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Metronidazole:" );
+ Zosyn := last of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Piperacillin/Tazobactam:" );
+ Zosyn_Low := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Piperacillin/Tazobactam:" );
+ Cefepime := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Cefepime:" OR Antibiotics_Grid_Value.Name = "Cefepime Mini-Syringe" );
+ Ciprofloxacin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Ciprofloxacin;" );
+ Ancef := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Cefazolin:" );
+ Fluconazole_Now := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Fluconazole:" );
+ Fluconazole := last of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Fluconazole:" );
+
+ Ancef_Dose := first of ( field_list WHERE field_list.DataItemName = "DosageLow" AND field_list.Control_MultiFieldOccNum = 1 );
+
+ Override_ABX_Schedule := first of ( field_list WHERE field_list.DataItemname = "PRX_Override_Abx_Scheduling" AND field_list.Control_MultiFieldOccNum = 1 );
+ Load_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 12);
+ Load_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 12);
+ 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 = 1);
+ 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 = 13);
+ Maint_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 13);
+ 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);
+ ZosynMsg := last of ( field_list WHERE field_list.DataItemName = "NUR_GenAdditiionalLabel"
+ and field_list.Control_MultiFieldOccNum = 9);
+ NoLoad := false;
+ 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;
+
+ //Populate Guidelines
+ ( this_communication, this_form ) := call antibiotic_guideline_mlm WITH this_communication, this_form, client_info_obj;
+
+ for item IN Antibiotics_Grid_Value do
+ // if ( item.Name NOT IN ("Piperacillin/Tazobactam:", "Fluconazole:") ) then
+ if ( item.Name NOT IN ("Fluconazole:") ) then
+ item.IsReadonly := true;
+ endif;
+ enddo;
+
+ If OrderSetName = "IntraAbdominal Antibiotic 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 ( Ancef_Chk.Value = true ) then
+ cefazolin_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;
+ endif;
+
+ //*********** AUGMENTIN ********************
+ if ( CallingField = "PRX_Checkbox1|1" ) then
+ fieldValue := Augmentin_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Augmentin.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Augmentin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //********** LEVAQUIN + FLAGYL **************
+ if ( CallingField = "PRX_Checkbox1|2" ) then
+ fieldValue := Levaquin_Flagyl_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Levaquin.IsSelected := true;
+ Flagyl_Oral.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Levaquin.IsSelected := false;
+ Flagyl_Oral.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************ ZOSYN *****************
+ if ( OrderSetName = "IntraAbdominal Antibiotic ED" and
+ ( CallingField = "PRX_Checkbox1|3" OR CallingField = "PRX_Checkbox1|4" OR CallingField = "PRX_Checkbox1|9" ) ) then
+
+ if ( CallingField = "PRX_Checkbox1|3" ) then
+ fieldValue := Zosyn_Chk.Value;
+
+ exceptFld := exceptFld, Fluconazole_Chk.DataItemName || "|" || Fluconazole_Chk.Control_MultiFieldOccNum;
+ elseif ( CallingField = "PRX_Checkbox1|4" ) then
+ fieldValue := Zosyn2_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|9" ) then
+ fieldValue := Zosyn3_Chk.Value;
+ endif;
+
+ if ( fieldValue = true ) then
+ Zosyn_Low.IsSelected := true;
+
+ 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 = "IntraAbdominal Antibiotic" and
+ ( CallingField = "PRX_Checkbox1|3" OR CallingField = "PRX_Checkbox1|4" OR CallingField = "PRX_Checkbox1|9" )
+ or ( CallingField = "PRX_Zosyn_Ext_Inf_Freq|1" and (Zosyn_Chk.Value= true or Zosyn2_Chk.Value= true or Zosyn3_Chk.Value= true) )
+ or (CallingField = "PRX_Generic_CB|1" and (Zosyn_Chk.Value= true or Zosyn2_Chk.Value= true or Zosyn3_Chk.Value= true) )
+ or (CallingField = "PRX_Generic_CB|2" and (Zosyn_Chk.Value= true or Zosyn2_Chk.Value= true or Zosyn3_Chk.Value= true) ) then
+
+ if ( CallingField = "PRX_Checkbox1|3" or Zosyn_Chk.Value= true ) then
+ fieldValue := Zosyn_Chk.Value;
+
+ exceptFld := exceptFld, Fluconazole_Chk.DataItemName || "|" || Fluconazole_Chk.Control_MultiFieldOccNum;
+ elseif ( CallingField = "PRX_Checkbox1|4" or Zosyn2_Chk.Value= true) then
+ fieldValue := Zosyn2_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|9" or Zosyn3_Chk.Value= true ) then
+ fieldValue := Zosyn3_Chk.Value;
+ endif;
+
+ if ( fieldValue = true ) then
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+
+ //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|5" ) then
+ fieldValue := Cefepime_Flagyl_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Cefepime.IsSelected := true;
+ Flagyl_IV.IsSelected := true;
+
+ exceptFld := exceptFld, Fluconazole_Chk.DataItemName || "|" || Fluconazole_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_IV.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************ CIPROFLOXACIN + FLAGYL ********************
+ if ( CallingField = "PRX_Checkbox1|7" OR CallingField = "PRX_Checkbox1|11" ) then
+ if ( CallingField = "PRX_Checkbox1|7" ) then
+ fieldValue := Cipro_Flagyl_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|11" ) then
+ fieldValue := Cipro_Flagyl2_Chk.Value;
+ endif;
+
+ if ( fieldValue = true ) then
+ Ciprofloxacin.IsSelected := true;
+ Flagyl_IV.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Ciprofloxacin.IsSelected := false;
+ Flagyl_IV.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************ CEFAZOLIN (ANCEF) ******************
+ if ( CallingField = "PRX_Checkbox1|8" ) then
+ fieldValue := Ancef_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Ancef.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;
+ Ancef.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //******** FLUCONAZOLE ********
+ if ( CallingField = "PRX_Checkbox1|16" ) then
+
+ fieldValue := Fluconazole_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ //Determine if loading dose should be given
+ //Check if fluconazole has been given in last 24 hours
+ fluconazole_exists := READ LAST {"SELECT 1"
+ || " 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"
+ || " WHERE o.NAME LIKE {{{SINGLE-QUOTE}}}FLUCONAZOLE%{{{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()) <= 24"
+ || " order by o.Entered desc" };
+
+ if ( exists fluconazole_exists ) then
+ Fluconazole_Now.IsSelected := false;
+ Override_ABX_Schedule.Value := false;
+ else
+ Fluconazole_Now.IsSelected := true;
+ Override_ABX_Schedule.Value := true;
+ endif;
+
+ Fluconazole.IsSelected := true;
+
+ exceptFld := exceptFld, Zosyn_Chk.DataItemName || "|" || Zosyn_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Cefepime_Flagyl_Chk.DataItemName || "|" || Cefepime_Flagyl_Chk.Control_MultiFieldOccNum;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Fluconazole_Now.IsSelected := false;
+ Fluconazole.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //******* ANTIBIOTICS GRID ***************
+ if ( CallingField = "MultiOrderGrid|1" ) then
+ if ( ( Zosyn.IsSelected = true OR Zosyn_Low.IsSelected = true ) AND ( Zosyn_Chk.Value = false AND Zosyn2_Chk.Value = false AND Zosyn3_Chk.Value = false ) ) then
+ Zosyn.IsSelected := false;
+ Zosyn_Low.IsSelected := false;
+ elseif ( ( Zosyn.IsSelected = false AND Zosyn_Low.IsSelected = false ) AND ( Zosyn_Chk.Value = true OR Zosyn2_Chk.Value = true OR Zosyn3_Chk.Value = true ) ) then
+ Zosyn_Chk.Value := false;
+ Zosyn2_Chk.Value := false;
+ Zosyn3_Chk.Value := false;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+
+ if ( Fluconazole.IsSelected = true OR Fluconazole_Now.IsSelected = true ) then
+ if ( Fluconazole_Chk.Value = false ) then
+ Fluconazole_Chk.Value := true;
+ endif;
+ elseif ( Fluconazole.IsSelected = false AND Fluconazole_Now.IsSelected = false ) then
+ Fluconazole_Chk.Value := false;
+ endif;
+
+ if ( Fluconazole_Now.IsSelected = false AND Fluconazole.IsSelected = true ) then
+ Override_ABX_Schedule.Value := false;
+ endif;
+
+ if ( Fluconazole_Now.IsSelected = true AND Fluconazole.IsSelected = true ) then
+ Override_ABX_Schedule.Value := true;
+ endif;
+
+ endif;
+ endif; //End FieldChange
+
+ 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
+ Ancef_Dose.Value := ( 1 as number );
+ elseif ( weightvalue >= 80 ) then
+ Ancef_Dose.Value := ( 2 as number );
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_IVIG_DOSING.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_IVIG_DOSING.mlm
new file mode 100644
index 0000000..1a3ed3a
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_IVIG_DOSING.mlm
@@ -0,0 +1,230 @@
+maintenance:
+
+ title: Intravenous Immune Globulin Orders;;
+ mlmname: FORM_Set_IVIG_Dosing;;
+ arden: version 2.5;;
+ version: 16.30;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ext 7448;;
+ specialist: Teresa Spicuzza, Allscripts ext 7448;;
+ date: 2018-11-07;;
+ validation: testing;;
+
+library:
+ purpose: Used for Intravenous Immune Globulin Dosing (Privigen).
+ ;;
+
+ explanation: This MLM is called from the Intravenous Immune Globulin Orders
+
+ Change history
+
+ 01.23.2019 TMS CSR 37605 and CSR 37612: Initial build
+
+
+ ;;
+ keywords: Called MLMs, IVIG, Privigen, Intranvenous Immune Globulin 10% Liquid
+ ;;
+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;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+
+ MgPerKg:= last of (field_list where field_list.DataItemName = "PRX_DosePerKg" and field_List.Control_MultiFieldOccNum = 1);
+ FixedDose:= last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 1);
+ OrderedDose := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 2);
+ OrderGrid:= last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ OrderGrid_List := OrderGrid.Value;
+ RateInfo := last of (field_list where field_list.DataItemName = "AdminInstructions" and field_List.Control_MultiFieldOccNum = 1);
+ OtherMedGrid:= last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 7);
+ OtherMedGrid_List := OtherMedGrid.Value;
+ ReactionMedGrid:= last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 8);
+ ReactionMedGrid_List := ReactionMedGrid.Value;
+ Diphenhydramine_Order := first of (ReactionMedGrid_List where ReactionMedGrid_List.Name = "Diphenhydramine Inj");
+ MethylPREDNISolone_Order := first of (ReactionMedGrid_List where ReactionMedGrid_List.Name = "MethylPREDNISolone Inj");
+ MLMTextBox := last of (field_list where field_list.DataItemName = "PRX_Generic_Text_Box" and field_List.Control_MultiFieldOccNum = 1);
+
+
+ DoseInfo1:= last of (field_list where field_list.DataItemName = "PRX_Dosing_Info" and field_List.Control_MultiFieldOccNum = 1);
+ DoseInfo2:= last of (field_list where field_list.DataItemName = "PRX_Dosing_Info" and field_List.Control_MultiFieldOccNum = 2);
+ EntryTime := (now as time) ;
+ GiveMinute := extract minute EntryTime;
+ GiveHour := extract hour EntryTime;
+
+ TitrateRate := "Initial Infusion Rate: 0.3 mL/kg/hour, for first 30 minutes" || CRLF
+ || "If tolerated, infusion rate can be titrated as follows:" || CRLF
+ || TAB || " 0.6 mL/kg for 30 minutes, then" || CRLF
+ || TAB || " 0.9 mL/kg for 30 minutes, then" || CRLF
+ || TAB || " 1.2 mL/kg for 30 minutes" || CRLF ||CRLF
+ || TAB || "Maximum infusion rate: 2.4 mL/kg/hr";
+
+ Info1 := "Initial Infusion Rate: 0.3 mL/kg/hour, for first 30 minutes" ||TAB || TAB || "**Maximum infusion rate: 2.4 mL/kg/hr **"|| CRLF
+ || "If tolerated, infusion rate can be titrated as follows:" || CRLF
+ || TAB || " 0.6 mL/kg for 30 minutes, then" || CRLF
+ || TAB || " 0.9 mL/kg for 30 minutes, then" || CRLF
+ || TAB || " 1.2 mL/kg for 30 minutes";
+
+ RateInfo.value := TitrateRate;
+
+ DoseInfo1.value := Info1;
+ needweight := true;
+
+ // 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);
+ If weightvalue is not null and weightvalue <> 0 then
+ needweight := false;
+ endif;
+ Endif;
+
+ If CallingEvent = "FieldChange" and CallingField = "CombinedMeasurements|1"
+ and MgPerKg.value is not null
+ and FixedDose.value is null then
+ RawDose := ((wt as number) * (MgPerKg.value as number)/1000);
+ OrderedDose.value := int((RawDose + 2.5)/5) * 5;
+ endif;
+
+ If CallingEvent = "FieldChange" and CallingField = "MultiOrderGrid|7" then
+
+ index_list := 1 seqto (count OtherMedGrid_List) ;
+ ReadOnlyMeds := ();
+
+ if true in OtherMedGrid_List.IsSelected then
+ for i in index_list do
+ If (OtherMedGrid_List.IsSelected[i]= true) then
+ ReadOnlyMeds := (ReadOnlyMeds ,false);
+ else
+ ReadOnlyMeds := (ReadOnlyMeds ,true);
+ endif;
+ enddo;
+ else
+ for i in index_list do
+ ReadOnlyMeds := (ReadOnlyMeds ,false);
+ enddo;
+ endif;
+ OtherMedGrid_List.IsReadOnly := ReadOnlyMeds ;
+
+ endif;
+
+
+
+ If CallingEvent = "FieldChange" and CallingField = "MultiOrderGrid|8" then
+ If Diphenhydramine_Order.IsSelected = True and MLMTextBox.value is null then
+ MethylPREDNISolone_Order.IsSelected := True;
+ MLMTextBox.value := "D";
+ elseif Diphenhydramine_Order.IsSelected = False and (MLMTextBox.value = "D" or MLMTextBox.value = "M") then
+ MethylPREDNISolone_Order.IsSelected := False;
+ MLMTextBox.value := "";
+ elseIf MethylPREDNISolone_Order.IsSelected = True and MLMTextBox.value is null then
+ Diphenhydramine_Order.IsSelected := True;
+ MLMTextBox.value := "M";
+ elseif MethylPREDNISolone_Order.IsSelected = False and (MLMTextBox.value = "D" or MLMTextBox.value = "M") then
+ Diphenhydramine_Order.IsSelected := False;
+ MLMTextBox.value := "";
+ endif;
+ endif;
+
+
+
+
+
+ If CallingEvent = "FieldChange" and CallingField = "PRX_DosePerKg|1" then
+ If FixedDose.value is not null then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You have already entered a value for FIXED Dosing."
+ ||" \n\n Choose YES to continue with the entered FIXED Dose."
+ ||" \n\n Choose NO to continue with WEIGHT BASED Dosing." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult as string) = "Yes") then
+ MgPerKg.value := null;
+ FixedDoseNumber := (FixedDose.value as number);
+ OrderedDose.value := int((FixedDoseNumber + 2.5)/5) * 5;
+ elseif ((dialogResult as string) = "No") then
+ FixedDose.value := null;
+ endif;
+ endif;
+ If FixedDose.value is null then
+ If Needweight = true then
+ dialogResult2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Please enter a weight to"|| CRLF ||
+ "calculate Weight Based Dosing.", "Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Else
+ RawDose := ((wt as number) * (MgPerKg.value as number)/1000);
+ OrderedDose.value := int((RawDose + 2.5)/5) * 5;
+ endif;
+ endif;
+ endif;
+
+ If CallingEvent = "FieldChange" and CallingField = "DosageLow|1" then
+ If MgPerKg.value is not null then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You have already entered a value for WEIGHT BASED Dosing."
+ ||" \n\n Choose YES to continue with WEIGHT BASED Dosing."
+ ||" \n\n Choose NO to continue with the entered FIXED Dose." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult as string) = "Yes") then
+ If Needweight = true then
+ dialogResult2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Please enter a weight to"|| CRLF ||
+ "calculate Weight Based Dosing.", "Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Else
+ RawDose := ((wt as number) * (MgPerKg.value as number)/1000);
+ OrderedDose.value := int((RawDose + 2.5)/5) * 5;
+ FixedDose.value := null;
+ endif;
+ elseif ((dialogResult as string) = "No") then
+ MgPerKg.value := null;
+ endif;
+ endif;
+
+ If MgPerKg.value is null then
+
+ FixedDoseNumber := (FixedDose.value as number);
+ OrderedDose.value := int((FixedDoseNumber + 2.5)/5) * 5;
+ endif;
+ endif;
+
+
+ If callingevent = "FormClose" then
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_KCENTRA.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_KCENTRA.mlm
new file mode 100644
index 0000000..3f86411
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_KCENTRA.mlm
@@ -0,0 +1,190 @@
+maintenance:
+
+ title: Form_Kcentra;;
+ mlmname: Form_Set_Kcentra;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: SCH ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-01-15;;
+ validation: testing;;
+
+library:
+ purpose: Ø On the grid “Select on the basis of INR” user should be able to select only one “4F-PCC” i.e. if the user select any “4F-PCC” then the other should get disabled;;
+ explanation:
+ Change History
+ -----------------
+ 07.07.2015 SJ CSR# 32480 : Created
+ 11.09.2015 TMS Updated MLM to only populate order set information boxes, No other functionality.
+ Moved to production 11/9/2015 CSR 32480
+ 05.02.2018 TMS CSR 36420 Updated MLM to include button for allowing physician to choose between
+ Warfarin reversal using INR values or NOAC reversal using 50 units/kg. Updated
+ info boxes with dose capping values and calculation info for NOACs
+ 06.26.2018 TMS CSR 36420 Updated message when no weight available if referenced from another order
+ set and precheck Warfarin reversal or NOAC reversal when called from hemorrhagic stroke
+ order set based upon selection on parent order set.
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ Client_GUID := this_communication.ClientGUID;
+ ClientVisit_GUID := this_communication.ClientVisitGUID;
+ Chart_GUID := this_communication.ChartGUID;
+ form_name := this_form.Name;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ Primary_object := this_communication.PrimaryObj;
+ ParentOrderSet := this_communication.ParentOrderSetGUID;
+ OrderSetName := Primary_Object.OrderSetName;
+
+
+ Indication := First of ( field_list where field_list.DataItemName = "AdminInstructions" And field_list.Control_MultiFieldOccNum = 1 ) ;
+ ContraInd := First of ( field_list where field_list.DataItemName = "AdminInstructions" and field_list.Control_MultiFieldOccNum = 2 ) ;
+ NOACIndication := First of ( field_list where field_list.DataItemName = "AdminInstructions" And field_list.Control_MultiFieldOccNum = 3 ) ;
+ WarfarinReversal := Last of ( field_list where field_list.DataItemName = "PRX_WarfarinReversal" And field_list.Control_MultiFieldOccNum = 1 ) ;
+ NOACReversal := last of ( field_list where field_list.DataItemName = "PRX_NOACReversal" And field_list.Control_MultiFieldOccNum = 1 ) ;
+ VitaminK_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 49 );
+ VitaminK_Grid_Value := VitaminK_Grid.Value;
+ VitaminK := first of ( VitaminK_Grid_Value WHERE VitaminK_Grid_Value.Name = "Phytonadione:" );
+ KCentra_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 50 );
+ KCentra_Grid_Value := Kcentra_Grid.Value;
+ Kcentra := first of ( Kcentra_Grid_Value WHERE Kcentra_Grid_Value.Name = "4F-PCC" );
+ Lab_CB1 := first of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox" AND field_list.Control_MultiFieldOccNum = 1 );
+ Lab_CB1_Value := Lab_CB1.value;
+ PT_INR1 := first of ( Lab_CB1_Value WHERE Lab_CB1_Value.Name = "Prothrombin/INR" );
+ Lab_CB2 := first of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox" AND field_list.Control_MultiFieldOccNum = 2 );
+ Lab_CB2_Value := Lab_CB2.value;
+ PT_INR2 := first of ( Lab_CB2_Value WHERE Lab_CB2_Value.Name = "Prothrombin/INR" );
+ HtWt := First of ( field_list where field_list.DataItemName = "CombinedMeasurements" AND field_list.Control_MultiFieldOccNum = 1 );
+ Val_Wt := HtWt.Value.WEIGHT;
+
+ // check weight Value for Patient and Give warning message
+ Wt := Val_Wt ;
+
+ If (Wt is 0 and callingevent = "FormOpen") then
+ If this_communication.ParentOrderSetGUID is null then
+ Void := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please enter a weight for this patient" ,"Sunrise Clinical Manager", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ else
+ Void := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please open the order set and enter a weight for this patient" ,"Sunrise Clinical Manager", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ endif;
+ Endif;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+
+
+ if ( CallingEvent = "FormOpen" ) then
+
+ Indication.Value := "Emergent reversal of warfarin when INR is >= 2 AND patient has life-threatening bleeding AND/OR need for emergent surgery or invasive intervention." || CRLF
+ || TAB || "INR 2 to 3.9: " || TAB || "25 units/kg" || TAB || "Dose not to exceed 2500 units." || CRLF
+ || TAB || "INR 4 to 5.9: " || TAB || "35 units/kg" || TAB || "Dose not to exceed 3500 units." || CRLF
+ || TAB || "INR 6 or greater:" || TAB || "50 units/kg" || TAB || "Dose not to exceed 5000 units. ";
+ ContraInd.Value := "Disseminated Intravascular Coagulation (DIC) "|| CRLF
+ || "History of Heparin-Induced Thrombocytopenia (HIT) " || CRLF
+ || "Hypersensitivity to any components of Prothrombin Complex Concentrate " ;
+ NOACIndication.Value := "For Apixaban, Edoxaban, Rivaroxaban. NOT indicated for Dabigatran" || CRLF || CRLF
+ || TAB || "50 units/kg" || TAB || "Dose not to exceed 5000 units." ;
+
+ VitaminK.IsReadOnly := True;
+ KCentra.IsReadOnly := True;
+ If ParentOrderSet is not null and OrderSetName = "Prothrombin Complex Concentrate for Emergent Anticoagulant Reversal" then
+ WarfarinReversal.Value := true;
+ Elseif ParentOrderSet is not null and OrderSetName = "Prothrombin Complex Concentrate for Emergent Anticoagulant Reversal" then
+ NoacReversal.value := true;
+ Endif;
+
+ EndIf; /// Form Opening Event End
+ If ( CallingEvent = "FormOpen" ) or (CallingEvent = "FieldChange") then
+
+ If ((CallingField = "PRX_WarfarinReversal|1" and WarfarinReversal.Value= True)
+ or (CallingEvent = "FormOpen" and WarfarinReversal.Value = True)) then
+ NoacReversal.value := false;
+ VitaminK.IsReadOnly := False;
+ KCentra.IsReadOnly := False;
+ VitaminK.IsSelected := True;
+ KCentra.Isselected := True;
+ PT_INR1.Isselected := True;
+ PT_INR2.Isselected := True;
+ elseif ((CallingField = "PRX_NoacReversal|1" and NOACReversal.Value = True)
+ or (CallingEvent = "FormOpen" and NOACReversal.Value = True)) then
+ WarfarinReversal.Value := false;
+ VitaminK.IsReadOnly := True;
+ KCentra.IsReadOnly := False;
+ VitaminK.IsSelected := False;
+ KCentra.Isselected := True;
+ PT_INR1.Isselected := False;
+ PT_INR2.Isselected := False;
+ elseif (CallingField = "PRX_NoacReversal|1" and NOACReversal.Value = False) then
+ WarfarinReversal.Value := true;
+ VitaminK.IsReadOnly := False;
+ KCentra.IsReadOnly := False;
+ VitaminK.IsSelected := True;
+ KCentra.Isselected := True;
+ PT_INR1.Isselected := True;
+ PT_INR2.Isselected := True;
+ elseif (CallingField = "PRX_WarfarinReversal|1" and WarfarinReversal.Value =False) then
+ NoacReversal.value := true;
+ VitaminK.IsReadOnly := True;
+ KCentra.IsReadOnly := False;
+ VitaminK.IsSelected := False;
+ KCentra.Isselected := True;
+ PT_INR1.Isselected := False;
+ PT_INR2.Isselected := False;
+ else
+ VitaminK.IsReadOnly := True;
+ KCentra.IsReadOnly := True;
+ VitaminK.IsSelected := False;
+ KCentra.Isselected := False;
+ PT_INR1.Isselected := False;
+ PT_INR2.Isselected := False;
+
+ endif;
+ endif;
+
+ If ( CallingEvent = "FormClose" ) then
+
+ If (WarfarinReversal.Value = False and NoacReversal.Value = False) then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please select Warfarin Reversal or NOAC Reversal.";
+ this_communication.MessageType := "Error";
+ else
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ endif;
+
+
+
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_LABS_ANEMIA.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_LABS_ANEMIA.mlm
new file mode 100644
index 0000000..efce49a
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_LABS_ANEMIA.mlm
@@ -0,0 +1,120 @@
+maintenance:
+
+ title: Labs Deselected On Order Sets;;
+ mlmname: FORM_Set_Labs_Anemia;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Lisa Hancher, Eclipsys Corp ext PINT;;
+ date: 2008-05-19;;
+ validation: testing;;
+
+library:
+ purpose: Used to Select / Deselect all ORders on Anemia Order Set For ED
+ ;;
+
+ explanation: This MLM is called from Anemia Checkboxes on the order set
+
+ Change history
+
+ 05.17.2010 RS Altered for the Observation OS
+
+
+ ;;
+ keywords: Called MLMs, Lab Grids on Order Sets, Inital ED
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ locateAnemia := first of (field_list where field_list.DataItemName = "MLM_AnemiaID1");
+
+ OccNumText := last of (callList);
+
+ DeSelect := "Select / Deselect All For Anemia Profile";
+ OccNumber:= locateAnemia.value As Number;
+
+ // Now do True and false logic for EVERY grid on this form
+
+ //Get the multi order grid check box value
+ Grid_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = OccNumber);
+ Grid_list :=Grid_fld.Value;
+ Grid_SelList := Grid_List.IsSelected;
+
+ PrevSel_Fld := last of (field_list where field_list.DataItemName = "MLM_CM 1");
+
+ Found_DeSelect:= First of (Grid_list where Grid_list.Name = DeSelect );
+
+
+ If CallingEvent = "FieldChange" Then
+ If Found_DeSelect.IsSelected = PrevSel_Fld.Value then
+ NoHarmNoFoul:=True;
+ Else
+ ListMembs:= count Grid_SelList;
+ FalseList := ();
+ TrueList := ();
+ for k in (1 seqto ListMembs) do
+ FalseList := FalseList,False;
+ TrueList := TrueList,True;
+ enddo;
+ If Found_DeSelect.IsSelected = True then
+ Grid_List.IsSelected := TrueList;
+ Else
+ Grid_List.IsSelected := FalseList;
+ endif;
+ PrevSel_Fld.Value := Found_DeSelect.IsSelected;
+ endif;
+ Elseif CallingEvent = "FormClose" then
+ Found_DeSelect.IsSelected:= False;
+ Endif;
+
+
+
+
+ /* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Found_DeSelect is " || Found_DeSelect.|| "\n\n" ||
+ "NoRisk Select" || Found_NoRisk.IsSelected || "\n\n" ||
+ "NoRisk Value " || Found_NoRisk.Value;
+ this_communication.MessageType := "Informational";
+ */
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_LABS_DESELECTED.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_LABS_DESELECTED.mlm
new file mode 100644
index 0000000..609ad0a
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_LABS_DESELECTED.mlm
@@ -0,0 +1,111 @@
+maintenance:
+
+ title: Labs Deselected On Order Sets;;
+ mlmname: FORM_Set_Labs_Deselected;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Lisa Hancher, Eclipsys Corp ext PINT;;
+ date: 2008-05-19;;
+ validation: testing;;
+
+library:
+ purpose: Used for all Lab Grids with a Deselect all button
+ Initial use within ED CPOE Order sets
+ ;;
+
+ explanation: This MLM is called from all possible orders with Lab grids
+
+ Change history
+
+ 11.24.2010 DW Altered to enter escort order if MI item with the escort class has been selected
+
+
+
+ ;;
+ keywords: Called MLMs, Lab Grids on Order Sets, Inital ED
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ if CallingEvent = "FormClose" then
+
+ Escort_MLM := mlm {{{SINGLE-QUOTE}}}Form_Func_Escort_Order{{{SINGLE-QUOTE}}};
+ EscortQuestion := call Escort_MLM with this_form,this_communication;
+
+else
+
+ DeSelect := "Deselect All Lab Orders";
+ OccNumber:=1;
+
+ // Now do True and false logic for EVERY grid on this form
+
+ //Get the multi order grid check box value
+ Grid_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = OccNumber);
+ Grid_list :=Grid_fld.Value;
+ Grid_SelList := Grid_List.IsSelected;
+
+ Found_DeSelect:= First of (Grid_list where Grid_list.Name = DeSelect );
+
+ If Found_DeSelect.IsSelected = True then
+ ListMembs:= count Grid_SelList;
+ FalseList := ();
+ for k in (1 seqto ListMembs) do
+ FalseList := FalseList,False;
+ enddo;
+
+ Grid_List.IsSelected:= FalseList;
+ endif;
+
+
+endif;
+
+ /* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "One Of Rest Selection is " || OneOfRest|| "\n\n" ||
+ "NoRisk Select" || Found_NoRisk.IsSelected || "\n\n" ||
+ "NoRisk Value " || Found_NoRisk.Value;
+ this_communication.MessageType := "Informational";
+*/
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_LABS_DESELECTED_ICU.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_LABS_DESELECTED_ICU.mlm
new file mode 100644
index 0000000..85f6b9d
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_LABS_DESELECTED_ICU.mlm
@@ -0,0 +1,101 @@
+maintenance:
+
+ title: Labs Deselected On Order Sets;;
+ mlmname: FORM_Set_Labs_Deselected_ICU;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Dean Miklavic, Eclipsys Corp ext 7466;;
+ date: 2009-08-20;;
+ validation: testing;;
+
+library:
+ purpose: Used for all Lab Grids with a Deselect all button
+ Initial use within ICU CPOE Order sets
+ ;;
+
+ explanation: This MLM is called from all possible orders with Lab grids
+ ;;
+ keywords: Called MLMs, Lab Grids on Order Sets, Inital ED
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ DeSelect := "Deselect All Lab Orders";
+ OccNumber:=2;
+
+ // Now do True and false logic for EVERY grid on this form
+
+ //Get the multi order grid check box value
+ Grid_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = OccNumber);
+ Grid_list :=Grid_fld.Value;
+ Grid_SelList := Grid_List.IsSelected;
+
+ Found_DeSelect:= First of (Grid_list where Grid_list.Name = DeSelect );
+
+ If (this_form.Name = "CCM Admission OS") then
+ Urinalysis := FIRST OF (Grid_list where Grid_list.Name = "Urinalysis with Reflex Culture");
+ Urinalysis_selected := true;
+ EndIf;
+
+ If Found_DeSelect.IsSelected = True then
+ ListMembs:= count Grid_SelList;
+ FalseList := ();
+ for k in (1 seqto ListMembs) do
+ FalseList := FalseList,False;
+ enddo;
+
+ Grid_List.IsSelected:= FalseList;
+ endif;
+
+ If (this_form.Name = "CCM Admission OS") then
+ Urinalysis.IsSelected := Urinalysis_selected;
+ EndIf;
+ /* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "One Of Rest Selection is " || OneOfRest|| "\n\n" ||
+ "NoRisk Select" || Found_NoRisk.IsSelected || "\n\n" ||
+ "NoRisk Value " || Found_NoRisk.Value;
+ this_communication.MessageType := "Informational";
+*/
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_LAB_ORDER_24HR.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_LAB_ORDER_24HR.mlm
new file mode 100644
index 0000000..35b6f32
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_LAB_ORDER_24HR.mlm
@@ -0,0 +1,177 @@
+maintenance:
+
+ title: FORM_SET_LAB_ORDER_24hr;;
+ mlmname: FORM_SET_LAB_ORDER_24hr;;
+ arden: version 2.5;;
+ version: 15.1;;
+ institution: St Clair Hospital;;
+ author: Bryan Berkeybile, Allscripts Corp;;
+ specialist: Bryan Berkeybile;;
+ date: 2016-05-18;;
+ validation: testing;;
+
+library:
+ purpose: To select labs on an Orderset form, if available lab results not within 24 hours.
+ ;;
+ explanation: Lab grouping on the Orderset form will be auto selected, if there are no results for the lab grouping within past 24 hours.
+
+ Change History
+ 2016.05.18 BB CSR# 34528: Created
+ 2016.07.15 BB Ticket# 2228125: Removing lab auto-selecting, if the patient does not have a visit type of "Inpatient", "Observation", or "Emergency" .
+ 11.20.2018 DJW CSR# 37100 Powerscribe - altered to call FORM_SET_MEDICAL_IMAGING_GRID_ITEM_DESELECT
+ 12.4.2018 STH CSR# 37682 Added call to the generic MLM to be used for the form MI CT PrepLbsPeriCar on "formopen" only. Used on CT Pericardocentesis {Go-Live 12/4/2018}
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+
+
+ log_execution_info := FALSE;
+
+ if Called_By_Editor Then
+ (ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID};
+ //(UserGUID ) := read last { UserInfo: GUID };
+
+ Else
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+ ClientGuid := this_communication.ClientGUID;
+ endif;
+ //[BB] 7/15/16
+ //obtaning the patient visit type
+ (Visit_Type) := read last { " select TypeCode"
+ || " from cv3clientvisit with (nolock) "
+ || " where clientguid = " || sql(ClientGUID)
+ || " and chartguid = " || sql(ChartGuid)
+ || " and guid = " || sql(ClientVisitGuid) };
+ //[bb]
+
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ FormName := this_form.Name;
+ //ClientVisitGuid := this_communication.ClientVisitGUID;{{{SINGLE-QUOTE}}}
+ //ChartGuid := this_communication.ChartGUID;
+ //ClientGuid := this_communication.ClientGUID;
+
+
+ Labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.label = "Labs");
+ Labs_fld_List := Labs_fld.Value;
+
+
+ Labs_field_selected := labs_fld_list.isselected;
+
+ // pulling Order results from client
+ (Lab_Results) := read
+ {"SELECT DISTINCT o.Name AS {{{SINGLE-QUOTE}}}Orders{{{SINGLE-QUOTE}}} "
+ || " FROM CV3ClientVisit cv "
+ || " INNER JOIN CV3Client c ON cv.ClientGUID = c.GUID "
+ || " INNER JOIN CV3Order o ON cv.GUID = o.ClientVisitGUID AND o.ClientGUID = cv.ClientGUID ANd o.ChartGUID = cv.ChartGUID "
+ || " JOIN CV3BasicObservation bo ON o.GUID = bo.OrderGUID AND bo.ClientVisitGUID = cv.GUID AND bo.ClientGUID = c.GUID AND bo.ChartGUID = o.ChartGUID "
+ || " WHERE o.Name IN ({{{SINGLE-QUOTE}}}cbc no Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}BUN{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Creatinine{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " AND cv.ClientGUID = " || SQL(ClientGuid)
+ || " AND bo.ArrivalDtm > getdate()-1 "
+ };
+
+// Additional labs
+
+ // pulling OrderItem results from client
+ (Lab_Result_Battery) := read
+ {"SELECT DISTINCT rci2.ItemName AS {{{SINGLE-QUOTE}}}Ords{{{SINGLE-QUOTE}}} "
+ || " FROM CV3ClientVisit cv "
+ || " INNER JOIN CV3Client c ON cv.ClientGUID = c.GUID "
+ || " INNER JOIN CV3Order o ON cv.GUID = o.ClientVisitGUID AND o.ClientGUID = cv.ClientGUID ANd o.ChartGUID = cv.ChartGUID "
+ || " JOIN CV3BasicObservation bo ON o.GUID = bo.OrderGUID AND bo.ClientVisitGUID = cv.GUID AND bo.ClientGUID = c.GUID AND bo.ChartGUID = o.ChartGUID "
+ || " JOIN CV3OrderCatalogMasterItem ocmi on o.OrderCatalogMasterItemGUID = ocmi.GUID "
+ || " JOIN CV3ResultCatalogItem rci ON rci.OrderMasterItemGUID = ocmi.guid "
+ || " JOIN CV3ResultComponent rcom ON rci.GUID = rcom.ItemParentGUID "
+ || " JOIN CV3ResultCatalogItem rci2 ON rcom.ItemChildGUID = rci2.GUID "
+ || " WHERE rci2.ItemName in ({{{SINGLE-QUOTE}}}BUN{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Creatinine Plasma/Serum{{{SINGLE-QUOTE}}})"
+ || " AND cv.ClientGUID = " || SQL(ClientGuid)
+ || " AND bo.ArrivalDtm > getdate()-1 "
+ };
+ //[BB] 7/15/16
+ if ((trim(Visit_Type) in ("Inpatient","Observation","Emergency"))) then
+ Inpat := true;
+ else
+ Inpat := false;
+ endif;
+
+
+ if Inpat = true Then
+ //[bb]
+
+ If (("cbc no Diff (Hemogram Only)" in Lab_Results) or ("CBC (Includes Diff)" in Lab_Results) or ("CBC with Manual Diff" in Lab_Results ))
+ THEN create_CBC := false; Else create_CBC := true; endif;
+ if (("BUN" in Lab_Results) or ("BUN" in Lab_Result_Battery))
+ THEN create_BUN := false; Else create_BUN := true; endif;
+ if (("Creatinine" in Lab_Results) or ("Creatinine Plasma/Serum" in Lab_Result_Battery))
+ THEN create_Cr := false; Else create_Cr := true; endif;
+ if "Prothrombin/INR" in Lab_Results
+ THEN create_PTINR := false; Else create_PTINR := true; endif;
+
+
+ for x in 1 seqto (count Labs_fld_List) do
+ aaa := Labs_fld_List[x];
+ // ccc := Labs_fld.value.isselected;
+ ddd := Labs_fld.value[x].isselected;
+ ggg := Labs_fld.value[x];
+ // eee := Labs_fld[x].value.isselected;
+
+
+ if (ggg.name in( "cbc no Diff (Hemogram Only)" , "CBC (Includes Diff)" , "CBC with Manual Diff") AND create_CBC = true)
+ or (ggg.name = "BUN" AND create_BUN = true)
+ or (ggg.name = "Creatinine" AND create_Cr = true)
+ or (ggg.name = "Prothrombin/INR" AND create_PTINR = true) then
+ Labs_fld.value[x].isselected := true;
+ else
+ Labs_fld.value[x].isselected := false;
+ endif;
+
+ Enddo;
+
+ else // Inpat = false
+
+
+
+
+ // Call the Grid Deselect MLM
+
+ GridDeselectMLM:= mlm {{{SINGLE-QUOTE}}}FORM_SET_MEDICAL_IMAGING_GRID_ITEM_DESELECT{{{SINGLE-QUOTE}}};
+ (this_communication,this_form,client_info_obj):= call GridDeselectMLM with this_communication,this_form,client_info_obj;
+
+
+ endif; //[BB] 7/15/16
+
+ if ((CallingEvent = "FormOpen") and (formname = "MI CT PrepLbsPeriCar"))then
+ GenericMLM := mlm {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}};
+ (this_communication,this_form,client_info_obj):= call GenericMLM with this_communication,this_form,client_info_obj;
+ endif;
+ ;;
+
+ evoke:
+
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+
+
+ return this_communication, this_form;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_LAB_PRIORITY_TIMES.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_LAB_PRIORITY_TIMES.mlm
new file mode 100644
index 0000000..60e5132
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_LAB_PRIORITY_TIMES.mlm
@@ -0,0 +1,90 @@
+maintenance:
+
+ title: FORM_SET_LAB_PRIORITY_TIMES ;;
+ mlmname: FORM_SET_LAB_PRIORITY_TIMES;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St. Clair Hospital;;
+ author: Shawn Head x7468;;
+ specialist: Maria Pest;;
+ date: 2015-03-03;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will require or diable the "user friendly scheduled time" field depending on if schedule time is required.
+
+ ;;
+ explanation:
+
+ 2015-03-03 - STH CSR#: 32765 create MLM
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+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;
+
+ stop := false;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+
+ //Retrieve fields
+
+
+ UserFriendly_Lab_Priorities := last of (field_list WHERE field_list.DataItemName = "LAB_Order Priorities"
+ AND field_list.Control_MultiFieldOccNum = 1);
+ UserFriendly_Lab_times := last of (field_list WHERE field_list.DataItemName = "LAB_Phleb Draw Sched Time"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+
+ if (CallingField = "LAB_Order Priorities|1") then
+ if (UserFriendly_Lab_Priorities.Value = "Scheduled Time") then
+ UserFriendly_Lab_times.Control_Read_Only := false;
+ UserFriendly_Lab_times.Control_Mandatory := true;
+ else
+ UserFriendly_Lab_times.Control_Read_Only := true;
+ UserFriendly_Lab_times.Control_Mandatory := false;
+ UserFriendly_Lab_times.Value := "";
+ endif;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_LIDODERM_PATCH.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_LIDODERM_PATCH.mlm
new file mode 100644
index 0000000..cd0c957
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_LIDODERM_PATCH.mlm
@@ -0,0 +1,127 @@
+maintenance:
+
+ title: Lidoderm_Patch Order Set;;
+ mlmname: FORM_Set_Lidoderm_Patch;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Peggy Karish, Allscripts ;;
+ specialist: Don Warnick, Allscripts;;
+ date: 2012-12-05;;
+ validation: testing;;
+
+library:
+ purpose: Patch removal time will be calculated based upon the time of patch application
+ ;;
+
+ explanation: This MLM is called from the TPN Parental Nutrition Order Set (TPN Parent Nut Ord)
+
+ Change history
+ 12.05.2012 DJW CSR# 31205 copied from FORM_Set_TPN
+ 04.26.2016 TMS CSR 33465 Add call on form Close to Medication Order Management MLM
+
+ ;;
+ keywords: Called MLMs, Lidoderm Lidocaine Patch
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Communication object Form object Arden ClientInfo object
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ FrequencyCode := first of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = 1);
+ ApplyStartDate := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ ApplyStartTime := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3);
+ RemovalStartDate:= first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ RemovalStartTime:= first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1);
+
+ FrequencyCodeValue := FrequencyCode.value;
+ ApplyStartDateValue := ApplyStartDate.value;
+ ApplyStartTimeValue := ApplyStartTime.value;
+ RemovalStartTimeValue := RemovalStartTime.value;
+
+
+// FORM OPEN EVENT SECTION - Set fields to the standard values
+
+ If CallingEvent = "FormOpen" Then
+ FrequencyCodeValue.FrequencySummary:= "Q24H";
+ ApplyStartTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ ApplyStartDate.value := NOW;
+ endif;
+
+
+// FORM CLOSE EVENT SECTION
+
+ If CallingEvent = "FormClose" Then
+
+ PatchSchedule:= ApplyStartTimeValue.ReqTimeCode;
+
+ ScheduledApplyTimeHour:= substring 2 characters from ApplyStartTimeValue.ReqTimeValue as number;
+ ScheduledApplyTimeMin := substring 2 characters starting at 4 from ApplyStartTimeValue.ReqTimeValue;
+
+ If (PatchSchedule = "Routine" or PatchSchedule = "STAT") and Extract Minute NOW <> 00
+ then HR := Extract Hour NOW +1;
+ MN := "00";
+ elseif (PatchSchedule = "Routine" or PatchSchedule = "STAT") and Extract Minute NOW = 00
+ then HR := Extract Hour NOW;
+ MN := "00";
+ else HR := ScheduledApplyTimeHour;
+ MN := ScheduledApplyTimeMin;
+ endif;
+
+ If HR < 12 then // 00:00 - 11:59
+ RemovalDay:= ApplyStartDate.value;
+ HRRemove := HR + 12;
+
+ elseif HR > 21 then // 22:00 - 23:59
+ RemovalDay:= ApplyStartDate.value +1 day;
+ HRRemove := HR - 12;
+
+ else // 12:00 - 21:59
+ RemovalDay:= ApplyStartDate.value +1 day;
+ HRRemove := HR - 12;
+ HRRemove := "0" || HRRemove;
+ endif;
+
+ PatchRemovalTime:= HRRemove ||":" || MN;
+ RemovalStartDate.Value :=RemovalDay;
+ RemovalStartTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ RemovalStartTimeValue.ReqTimeValue := PatchRemovalTime;
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ endif; // Close Section
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_LOVENOX_ORDERS_INJ.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_LOVENOX_ORDERS_INJ.mlm
new file mode 100644
index 0000000..ec2d9ff
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_LOVENOX_ORDERS_INJ.mlm
@@ -0,0 +1,387 @@
+maintenance:
+
+ title: Set Lovenox Nurse Orders Injectable;;
+ mlmname: FORM_Set_Lovenox_Orders_Inj;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Don Warnick, Eclipsys Corp Ext 7463;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-09-22;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds Lovenox order set
+ ;;
+
+ explanation: This MLM is called from the lovenox order set, form: PRX_OsEnoxaparin
+
+
+ Change history
+
+ 09.23.2008 DW Initial build - derived from FORM_SET_HEPARIN_WEIGHT_BASED_INIT
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 07.21.2011 TMS Added info for additional grid (MedGridC) to set Med_Was_Selected flag
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ 12.04.2017 TMS Restrict selections in Grid 1 when ordered from {{{SINGLE-QUOTE}}}Enoxaparin Inj Orders - Post Op Hip{{{SINGLE-QUOTE}}}
+ or "Enoxaparin Inj Orders - Post Op Fx Hip" order sets HD # 2978284
+
+ ;;
+ keywords: Called MLMs, warfarin
+ ;;
+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;
+
+
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ comm_obj := this_communication.primaryobj;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ OrderSetName := comm_obj.OrderSetName;
+
+ //Find the baseline order checkbox that may need to be ordered with this protocol
+
+ Labs_Baseline_field := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 1);
+ Labs_Baseline_List := Labs_Baseline_field.Value;
+ Baseline_CBC:= first of (Labs_Baseline_list where Labs_Baseline_list.Name = "CBC No Diff (Hemogram Only)");
+ Baseline_Creatinine:= first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Creatinine");
+
+
+ //Find the daily order that may needs to accompany this protocol
+
+ Lab_Daily_Order_field := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_Order_List := Lab_Daily_Order_field.Value;
+
+ // Find the 5 Requested Date fields - #1 is visible, #2 - #5 are hidden
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 5);
+
+ //Find the daily reminder that may need to be ordered with this protocol
+
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Lab_Rem_List := Lab_Rem.Value;
+ Daily_Reminder := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+ //Find if any of the med boxes are checked...if so, set Med_Was_Selected to "yes"
+ Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Med_GridC := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 4);
+ Med_List := Med_Grid.Value;
+ Med_ListC :=Med_GridC.Value;
+ Med_SelList := Med_List.IsSelected;
+ Med_ReadList := Med_List.IsReadOnly;
+ Med_SelListC := Med_ListC.IsSelected;
+ Med_Selected := true in Med_SelList;
+ Med_SelectedC := true in Med_SelListC;
+
+ If (Med_Selected = True or Med_SelectedC = True) then Med_Was_Selected := "yes"; else Med_Was_Selected := "no" ; endif;
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If (CallingField = "MultiOrderGrid|1" or CallingField = "MultiOrderGrid|4") then
+
+ If Med_Was_Selected = "yes"
+ then
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_Order_List.IsSelected := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+ Daily_Reminder.IsSelected := True;
+ else
+ Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
+ Daily_Reminder.IsSelected := False;
+ endif;
+
+ If CallingField = "MultiOrderGrid|1" and (OrderSetName = "Enoxaparin Inj Orders - Post Op Fx Hip" or OrderSetName = "Enoxaparin Inj Orders - Post Op Hip") then
+
+ If Med_SelList [1] = True and Med_SelList [2] = False and Med_ReadList [2] = False and Med_ReadList [1] = False then
+
+ Med_List.IsSelected := (True, True, False, False);
+ Med_List.IsReadOnly := (False, True, True, True);
+ Elseif
+ Med_SelList [1] = False and Med_SelList [2] = True and Med_ReadList [2] = True then
+
+ Med_List.IsSelected := (False, False, False, False);
+ Med_List.IsReadOnly := (False, False, False, False);
+ Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
+ Daily_Reminder.IsSelected := False;
+ Elseif
+
+ Med_SelList [2] = True and Med_SelList [1] = False and Med_ReadList [1] = False and Med_ReadList [2] = False then
+
+ Med_List.IsSelected := (True, True, False, False);
+ Med_List.IsReadOnly := (True, False, True, True);
+
+ Elseif
+ Med_SelList [2] = False and Med_SelList [1] = True and Med_ReadList [1] = True then
+
+ Med_List.IsSelected := (False, False, False, False);
+ Med_List.IsReadOnly := (False, False, False, False);
+ Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
+ Daily_Reminder.IsSelected := False;
+
+ Elseif Med_SelList [3] = True then
+ Med_List.IsReadOnly := (True, True, False, True);
+ Elseif Med_SelList [4] = True then
+ Med_List.IsReadOnly := (True, True, True, False);
+ Else
+ Med_List.IsReadOnly := (False, False, False, False);
+ Endif;
+
+ endif;
+
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")";
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ endif;
+
+ elseif CallingEvent = "FormOpen" then
+
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+// Daily_Reminder.IsSelected := True;
+
+// Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ elseif CallingEvent = "FormClose" then
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+
+ /* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Found_CBC (" || Found_CBC.value || ")";
+ this_communication.MessageType := "Error";
+*/
+ Med_SelList := Med_List.IsSelected;
+ Med_SelListC := Med_ListC.IsSelected;
+ Med_Selected := true in Med_SelList;
+ Med_SelectedC := true in Med_SelListC;
+
+
+ If (Med_Selected = True or Med_SelectedC = True) then Med_Was_Selected := "yes"; else Med_Was_Selected := "no" ; endif;
+
+ If Med_Was_Selected = "yes" then
+
+ // Find if there is a baseline CBC in the past 24 hours and if one is not found, check the baseline box
+
+
+ If (Baseline_CBC.IsSelected =false) or (Baseline_Creatinine.IsSelected = false) then
+
+ If Baseline_CBC.IsSelected = false then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If not exists CBC_Val then Baseline_CBC.ISSelected :=True; endif;
+
+ endif;
+
+
+ If Baseline_Creatinine.IsSelected = false then
+
+ Creatinine_Val := read last
+ {" Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Creatinine{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel Fasting{{{SINGLE-QUOTE}}})"
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If not exists Creatinine_Val then Baseline_Creatinine.ISSelected :=True; endif;
+
+ endif;
+
+ endif;
+
+
+
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}S ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+
+ for J in index_list do
+ singledate := formlist[J];
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+ enddo;
+
+ Lab_Daily_Order_List.IsSelected := (Reset_CBC_Grid);
+
+/*
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "THIS MESSAGE IS FOR TESTING PURPOSES ONLY \n\n\n\n" ||
+ "Did you see any changes to the CBC Grid check boxes? \n\n" ||
+ "SQL returned dates for CBCS: " || CBC_daily_dates || "\n\n" ||
+ "GRID CBC orders with these dates should have been unchecked by this MLM!!!" || "\n\n\n"
+ ;
+ this_communication.MessageType := "Informational";
+*/
+
+ endif; //If exist
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please enter a Lovenox Order or Cancel to Continue.\n\n" ;
+ this_communication.MessageType := "Error";
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_MASSIVE_TRANSFUSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_MASSIVE_TRANSFUSION.mlm
new file mode 100644
index 0000000..0dbaae3
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_MASSIVE_TRANSFUSION.mlm
@@ -0,0 +1,275 @@
+maintenance:
+
+ title: FORM_SET_MASSIVE_TRANSFUSION;;
+ mlmname: FORM_SET_MASSIVE_TRANSFUSION;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St. Clair Hospital;;
+ author: Shawn Head, Allscripts Outsourcing;;
+ specialist: Maria Pest, Allscripts Outsourcing;;
+ date: 2016-09-16;;
+ validation: testing;;
+
+library:
+ purpose:
+ CSR#: 34827 - This MLM was developed to assist with properly ordering the necesary blood products in when treating a patient with a massive bleed.
+ ;;
+ explanation:
+ 9.16.2016 - CSR#: 34827 - STH - Created {Go-Live 11/29/2016}
+ 10.01.2019 STH - CA Service Desk#: 3905806 - Lab System upgrade introduced a new issue with type and screen result data having a new format of date,time (previously just date).
+ Adjusted MLM to addres this.
+ ;;
+ keywords:
+ LAB BB RBCs, FFP, CRYO, Platelet, type and screen
+
+ ;;
+ citations:
+ ;;
+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;
+// local_session := cds_session.local;
+// check_Unsubmitted_typescreen := local_session.SessionUnSubTypeandScreen;
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ if(Called_By_Editor) then
+ ClientGuid := "9000002285800200";
+ ChartGuid := "9000004247800170";
+ ClientVisitGuid := "9000004247900270";
+ else
+ ClientGuid := this_communication.ClientGUID;
+ ChartGuid := this_communication.ChartGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ endif;
+
+ (ClientLocation, location_GUID, Visit_Type) := read last { "select CurrentLocation, CurrentLocationGUID, TypeCode "
+ || " from cv3clientvisit with (nolock) "
+ || " where clientguid = " || sql(ClientGUID)
+ || " and chartguid = " || sql(ChartGuid)
+ || " and guid = " || sql(ClientVisitGuid) };
+
+
+ OBPatient_fld := last of (field_list WHERE field_list.DataItemName = "BB Massive Tx OB patient"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ OBPatient_fld.Control_Read_Only := true;
+ if((trim(ClientLocation) matches pattern "5C-%") or (trim(ClientLocation) matches pattern "FBC-%") or (OBPatient_fld.Value=true)) then
+ OB_Patient := true;
+ else
+ OB_Patient := false;
+ endif;
+ TypeAndScreen_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ AND field_list.Control_MultiFieldOccNum = 2);
+
+
+
+
+ MultiOrderGrids := (field_list WHERE field_list.DataItemName = "MultiOrderGrid");
+
+ MassiveTx_Protocol_Labs := (field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ MassiveTx_TypeScreen := (field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
+ AND field_list.Control_MultiFieldOccNum = 2);
+
+
+
+ OS_Entered_Ct_24hours := read last { " select distinct count(os.guid) as {{{SINGLE-QUOTE}}}OS_Entered_Ct{{{SINGLE-QUOTE}}} from CV3OrderSet os with(nolock)
+ where os.clientguid = " || sql(ClientGuid)
+ || " and os.ChartGUID = " || sql(ChartGuid)
+ || " and os.ClientVisitGUID = " || sql(ClientVisitGuid)
+ || " and os.OrderSetName = {{{SINGLE-QUOTE}}}Massive Transfusion Protocol{{{SINGLE-QUOTE}}} "
+ || " and os.StartDtm >= dateadd(dd,-1,getdate())
+ and os.GUID in (select distinct o.ordersetguid from CV3Order o with (nolock) where os.GUID = o.OrderSetGUID
+ and os.ClientGUID = o.ClientGUID
+ and os.ChartGUID = o.ChartGUID
+ and os.ClientVisitGUID = o.ClientVisitGUID
+ and o.StopDtm is null) " };
+
+ if (CallingEvent = "FormOpen") then
+
+
+ if((OS_Entered_Ct_24hours as number) = 0) then
+
+ (Sepciemen_Expiration_DTTM) := read { " select cv.clientguid, cv.chartguid, cv.guid, cv.TypeCode
+ into #tmp_cv
+ from cv3clientvisit cv with (nolock)
+ where ((cv.ClientGUID = " || sql(ClientGUID) || "
+ and cv.chartguid = " || sql(ChartGuid) || "
+ and cv.guid = " || sql(ClientVisitGuid) || ")
+ or (cv.ClientGUID = " || sql(ClientGUID) || "
+ and cv.TypeCode in ({{{SINGLE-QUOTE}}}Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Admit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SDC{{{SINGLE-QUOTE}}})
+ and cv.AdmitDtm > dateadd(dd,-30,getdate())
+ ))
+
+
+ select
+ o.SignificantDtm
+ , (case when tol.text is null
+ then {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}
+ when tol.Text like {{{SINGLE-QUOTE}}}%,%{{{SINGLE-QUOTE}}} then dateadd(hh,7,cast(substring(tol.text,0,charindex({{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}},tol.text,0)) as datetime))
+ else dateadd(hh,7,cast(tol.text as datetime))
+ end) as {{{SINGLE-QUOTE}}}specimen_expiration_date{{{SINGLE-QUOTE}}}
+ ,tol.TouchedWhen as {{{SINGLE-QUOTE}}}speciemen_touchedwhen{{{SINGLE-QUOTE}}}
+ into #tmp_TF_Spec_Exp
+ from #tmp_cv cv with (nolock)
+ inner join CV3Order o with (nolock)
+ on cv.clientguid = o.clientguid
+ and cv.ChartGUID = o.ChartGUID
+ and cv.guid = o.ClientVisitGUID
+ left outer join CV3BasicObservation bo with (nolock)
+ on cv.ClientGUID = bo.ClientGUID
+ and cv.ChartGUID = bo.ChartGUID
+ and cv.guid = bo.ClientVisitGUID
+ and bo.ItemName = {{{SINGLE-QUOTE}}}Specimen Expiration{{{SINGLE-QUOTE}}}
+ and bo.OrderGUID = o.GUID
+ and bo.IsHistory = 0
+ left outer join CV3TextualObservationLine tol with (nolock)
+ on bo.ClientGUID = tol.ClientGUID
+ and bo.GUID = tol.ObservationGUID
+ and tol.Active = 1
+ where o.name = {{{SINGLE-QUOTE}}}Type and screen{{{SINGLE-QUOTE}}}
+ and o.ClientGUID = " || sql(ClientGUID) || "
+ and ((
+ (cv.ChartGUID = " || sql(ChartGuid) || "
+ and cv.guid = " || sql(ClientVisitGuid) || ")
+ or (cv.TypeCode in ({{{SINGLE-QUOTE}}}Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Admit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SDC{{{SINGLE-QUOTE}}})
+ and o.SignificantDtm >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), -15)
+ ))
+ and ((tol.Text is not null
+ and tol.Active = 1)))
+
+
+ select specimen_expiration_date from #tmp_TF_Spec_Exp
+ where specimen_expiration_date >= DateAdd(Day, Datediff(Day,0, GetDate() -0), 0)
+ drop table #tmp_cv, #tmp_TF_Spec_Exp
+ "};
+
+ if(count(Sepciemen_Expiration_DTTM)>0) then
+ TypeAndScreen_fld.Value.IsReadOnly := true;
+ TypeAndScreen_fld.Value.Selected := false;
+ else
+ TypeAndScreen_fld.Value.IsSelected := true;
+ TypeAndScreen_fld.Value.IsReadOnly :=true;
+ endif;
+ MassiveTx_Protocol_Labs.Value.IsSelected := true;
+
+ if(OB_Patient = false) then
+
+
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "Is this an OB Patient?","Alert", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ abc123 := dlg_result;
+ if((dlg_result as string) = "YES") then
+ OB_Patient := true;
+ OBPatient_fld.Value := true;
+ else
+ OB_Patient := false;
+ OBPatient_fld.Value := false;
+ endif;
+ else
+ OBPatient_fld.Value := true;
+ endif;
+ else
+ MassiveTx_Protocol_Labs.Value.IsSelected := false;
+ MassiveTx_TypeScreen.Value.IsSelected := false;
+ endif;
+
+ if((OS_Entered_Ct_24hours as number) in(0,4,8,12,16)) then
+
+ for x in (1 seqto count(MultiOrderGrids)) do
+ if(MultiOrderGrids[x].Control_MultiFieldOccNum = 1) then
+ if(OB_Patient) then
+ MultiOrderGrids[x].Value.IsSelected := true;
+ else
+ for y in (1 seqto 2) do
+ MultiOrderGrids[x].Value[y].IsSelected := true;
+ enddo;
+ endif;
+ elseif(MultiOrderGrids[x].Control_MultiFieldOccNum = 2) then
+ if(OB_Patient) then
+ MultiOrderGrids[x].Value.IsSelected := true;
+ else
+ for y in (1 seqto 8) do
+ MultiOrderGrids[x].Value[y].IsSelected := true;
+ enddo;
+ endif;
+ else
+ MultiOrderGrids[x].Value.IsSelected := false;
+ MultiOrderGrids[x].Value.IsReadOnly := true;
+ endif;
+ enddo;
+
+ elseif((OS_Entered_Ct_24hours as number) in (1,5,9,13,17)) then
+ for x in (1 seqto count(MultiOrderGrids)) do
+ if(MultiOrderGrids[x].Control_MultiFieldOccNum = 3) then
+ MultiOrderGrids[x].Value.IsSelected := true;
+ elseif(MultiOrderGrids[x].Control_MultiFieldOccNum = 4) then
+ MultiOrderGrids[x].Value.IsSelected := true;
+ else
+ MultiOrderGrids[x].Value.IsSelected := false;
+ MultiOrderGrids[x].Value.IsReadOnly := true;
+ endif;
+ enddo;
+ elseif((OS_Entered_Ct_24hours as number) in (2,6,10,14,18)) then
+ for x in (1 seqto count(MultiOrderGrids)) do
+ if(MultiOrderGrids[x].Control_MultiFieldOccNum = 5) then
+ MultiOrderGrids[x].Value.IsSelected := true;
+ elseif(MultiOrderGrids[x].Control_MultiFieldOccNum = 6) then
+ MultiOrderGrids[x].Value.IsSelected := true;
+ else
+ MultiOrderGrids[x].Value.IsSelected := false;
+ MultiOrderGrids[x].Value.IsReadOnly := true;
+ endif;
+ enddo;
+ elseif((OS_Entered_Ct_24hours as number) in (3,7,11,15,19)) then
+ for x in (1 seqto count(MultiOrderGrids)) do
+ if(MultiOrderGrids[x].Control_MultiFieldOccNum = 7) then
+ MultiOrderGrids[x].Value.IsSelected := true;
+ elseif(MultiOrderGrids[x].Control_MultiFieldOccNum = 8) then
+ MultiOrderGrids[x].Value.IsSelected := true;
+ else
+ MultiOrderGrids[x].Value.IsSelected := false;
+ MultiOrderGrids[x].Value.IsReadOnly := true;
+ endif;
+ enddo;
+ endif;
+
+
+
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: // No evoke statement
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_MEDICAL_IMAGING_GRID_ITEM_DESELECT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_MEDICAL_IMAGING_GRID_ITEM_DESELECT.mlm
new file mode 100644
index 0000000..6404547
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_MEDICAL_IMAGING_GRID_ITEM_DESELECT.mlm
@@ -0,0 +1,124 @@
+maintenance:
+
+ title: FORM_SET_MEDICAL_IMAGING_GRID_ITEM_DESELECT;;
+ mlmname: FORM_SET_MEDICAL_IMAGING_GRID_ITEM_DESELECT;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Michelle Palmer;;
+ specialist: Don Warnick;;
+ date: 2018-08-21;;
+ validation: testing;;
+
+library:
+ purpose: Deselct grid items based upon patient type
+ ;;
+
+ explanation: This MLM may be called from any Order Set that has this requirement
+
+
+ Change history
+
+ 08.21.2018 - DJW CSR# 37100 - Created for Powerscribe, but may be used for other order sets
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ ClientGuid := this_communication.ClientGUID;
+ ChartGUID := this_communication.ChartGuid;
+ VisitGuid := this_communication.ClientVisitGUID;
+
+
+ // Call the Generic MLM (will be used if needed)
+
+ CalledMLM := MLM {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}};
+ this_communication,this_form := Call CalledMLM With this_communication,this_form,client_info_obj ;
+
+
+ TypeCode := read last { "
+ select typecode from CV3ActiveVisitList
+ where clientguid = " || ClientGuid || " and ChartGUID = " || chartguid || " and Guid = " || VisitGuid || " and typecode in ({{{SINGLE-QUOTE}}}clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}recurring{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}sdc{{{SINGLE-QUOTE}}})
+ "};
+
+
+ if exists TypeCode
+
+ then
+
+
+ Grid1 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Label = "Nursing - Test Prep");
+ Grid1Value:= Grid1.value;
+
+ Grid2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Label = "Dietary");
+ Grid2Value:= Grid2.value;
+
+ Grid3 := first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Label = "Labs");
+ Grid3Value:= Grid3.value;
+
+ Grid4 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Label = "Notify");
+ Grid4Value:= Grid4.value;
+
+ Grid5 := first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Label = "Blood Bank - within 72 hrs");
+ Grid5Value:= Grid5.value;
+
+ for i IN 1 seqto ( count Grid1Value ) do
+ GridItem1:= Grid1.Value[i];
+ GridItem1.IsSelected := false;
+ enddo;
+
+ for i IN 1 seqto ( count Grid2Value ) do
+ GridItem2 := Grid2.Value[i];
+ GridItem2.IsSelected := false;
+ enddo;
+
+ for i IN 1 seqto ( count Grid3Value ) do
+ GridItem3:= Grid3.Value[i];
+ GridItem3.IsSelected := false;
+ enddo;
+
+ for i IN 1 seqto ( count Grid4Value ) do
+ GridItem4:= Grid4.Value[i];
+ GridItem4.IsSelected := false;
+ enddo;
+
+ for i IN 1 seqto ( count Grid5Value ) do
+ GridItem5:= Grid5.Value[i];
+ GridItem5.IsSelected := false;
+ enddo;
+
+
+ endif;
+
+
+ ;;
+ evoke: // No evoke statement
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_MEDROL_DOSE_PAK.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_MEDROL_DOSE_PAK.mlm
new file mode 100644
index 0000000..f05b578
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_MEDROL_DOSE_PAK.mlm
@@ -0,0 +1,156 @@
+maintenance:
+
+ title: Medrol Dose Pak Orders;;
+ mlmname: FORM_Set_Medrol_Dose_Pak;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts Corp ext 7448;;
+ specialist: Teresa Spicuzza, Allscripts Corp ext 7448;;
+ date: 2014-10-16;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids on Medrol Dose Pak Orders
+ ;;
+
+ explanation: This MLM is called from the Medrol Dose Pak Orders
+
+
+Change history
+
+ 11.04.2014 TMS Created for new Medrol dose pak order set. MLM looks at current time
+ and selects correct order in the grid for start time. CSR #31407
+ 09.12.2016 TMS Call added on FormClose to call Order Mgt MLM and to uncheck all
+ methylprednisolone 4mg tab orders if the dose pack in the
+ multiordercheckbox is selected to be unchecked as a duplicate. HD 2347914
+ ;;
+
+ keywords: Called MLMs, Medrol Dose Pak, Methylprednisolone
+ ;;
+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;
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ //local_session := cds_session.local;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Med_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Med_Orders_List := Med_Orders.Value;
+
+ Med_Selected := true in Med_Orders_List;
+
+
+ Dose_Pak_Order := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 1);
+ Dose_Pak_Order_List := Dose_Pak_Order.Value;
+ Dose_Pak_Selected := true in Dose_Pak_Order_List ;
+
+
+// Test time for testing only
+
+// Testtime := now + 5 hours;
+// testtime := testtime + 53 minutes;
+// thishour := extract hour testtime;
+// thismin := extract minute testtime; if ThisMin < 10 then ThisMin := "0"||ThisMin; endif;
+
+ ThisHour := extract hour now;
+ ThisMin := extract minute now; if ThisMin < 10 then ThisMin := "0"||ThisMin; endif;
+ ThisTime := (ThisHour||ThisMin) as number;
+
+
+
+
+ // On form open check current hour and select appropriate start time
+ If CallingEvent = "FormOpen" or (CallingEvent = "FormClose" and true not in Med_Orders_list.isSelected) then
+ Dose_Pak_Order_List.IsReadOnly := (True);
+ If ThisTime >= 0 and ThisTime <= 700 then
+ Med_Orders_List.IsSelected := (True, False, False, False, False);
+ Med_Orders_List.IsReadOnly := (False, True, True, True, True);
+ elseIf ThisTime > 700 and ThisTime <= 1300 then
+ Med_Orders_List.isselected := (False, True, False, False, False);
+ Med_Orders_List.IsReadOnly := (True, False, True, True, True);
+ elseIf ThisTime > 1300 and ThisTime <= 1800 then
+ Med_Orders_List.isselected := (False, False, True, False, False);
+ Med_Orders_List.IsReadOnly := (True, True, False, True, True);
+ elseIf ThisTime > 1800 and ThisTime <= 2100 then
+ Med_Orders_List.isselected := (False, False, False, True, False);
+ Med_Orders_List.IsReadOnly := (True, True, True, False, True);
+ elseIf ThisTime > 2100 and ThisTime <= 2400 then
+ Med_Orders_List.IsSelected := (False, False, False, False, True);
+ Med_Orders_List.IsReadOnly := (True, True, True, True, False);
+ Endif;
+
+ Endif;
+
+
+
+ If CallingEvent = "FieldChange" and true not in Med_Orders_list.isSelected then
+ Med_Orders_List.IsReadOnly := (False, False, False, False, False);
+ else
+ protectvaluelist := ();
+ for r in 1 seqto (count Med_Orders_List) do
+ If Med_Orders_List.IsSelected [r] = true then
+ protectvalue := "false";
+ else protectvalue := "true";
+ endif;
+ protectvaluelist := protectvaluelist , protectvalue;
+ enddo;
+
+ Med_Orders_List.IsReadOnly := protectvaluelist;
+ Endif;
+
+ If CallingEvent = "FormClose" then
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ if false in Dose_Pak_Order_List.isselected then
+ Med_Orders_List.IsSelected := (False, False, False, False, False);
+ Med_Orders_List.IsReadOnly := (True, True, True, True, True);
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_METHOTREXATE_ETOPIC_PREGNANCY.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_METHOTREXATE_ETOPIC_PREGNANCY.mlm
new file mode 100644
index 0000000..ff9f45f
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_METHOTREXATE_ETOPIC_PREGNANCY.mlm
@@ -0,0 +1,66 @@
+maintenance:
+
+ title: FORM_SET_METHOTREXATE_ETOPIC_PREGNANCY;;
+ mlmname: FORM_SET_METHOTREXATE_ETOPIC_PREGNANCY;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Hospital;;
+ author: Deevya Gaikwad;;
+ specialist: Don Warnick;;
+ date: 2016-07-11;;
+ validation: testing;;
+
+library:
+ purpose: This MLM Calcualtes Methotrexate dosage
+
+ ;;
+ explanation: Calcualtes Methotrexate dosage
+
+ Change History:
+
+ 07.11.2016 DW CSR# 34789 - Created
+
+ ;;
+ keywords: Called MLMs, Form fields, Methotrexate Etopic Pregnancy
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ log_execution_info := FALSE;
+
+ error_message:="";
+
+ field_list:= this_form.fields;
+ Visit_Guid := this_communication.ClientVisitGuid;
+ CallingField :=this_communication.CallingFieldName;
+ CallingEvent := this_communication.CallingEvent;
+
+ 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;
+ bsa := comb_ht_wt_val.bsa;
+ endif;
+
+ dosefield := first of (field_list where field_list.DataItemName = "DosageLow");
+
+ if BSA * 50 <> 0
+ then
+ dosefield.value := BSA * 50;
+ endif;
+
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+
+ return this_communication, this_form;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_METHOTREXATE_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_METHOTREXATE_ORDERS.mlm
new file mode 100644
index 0000000..166d768
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_METHOTREXATE_ORDERS.mlm
@@ -0,0 +1,258 @@
+maintenance:
+
+ title: Methotrexate Orders;;
+ mlmname: FORM_Set_Methotrexate_Orders;;
+ arden: version 2;;
+ version: 15.10;;
+ institution: St Clair Admissions;;
+ author: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2016-01-06;;
+ validation: testing;;
+
+library:
+ purpose: Used for methotrexate orders to allow user to easily enter weekly schedules
+ and creating a from their selections.
+ ;;
+
+ explanation: This MLM is called from the methotrexate order set
+
+
+ Change history
+
+ 01.26.2016 TMS Initial build CSR 33699
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+
+ ;;
+ keywords: Called MLMs, methotrexate
+ ;;
+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;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ //using "ObjectsPlusXA.SCM.Forms";
+ //using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Find the baseline order checkbox that may need to be ordered with this protocol
+
+ DoseA := last of (field_list where field_list.DataItemName = "MethotrexateDose" and field_List.Control_MultiFieldOccNum = 1);
+ DoseA_value := DoseA.value;
+ Dosage := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 1);
+ Dosage_val := dosage.value;
+ AltDaysDoseA := last of (field_list where field_list.DataItemName = "PRX_AltSchedule1" and field_List.Control_MultiFieldOccNum = 1);
+ AltDaysDoseA_list := AltDaysDoseA.value;
+ AdminTimesDoseA := last of (field_list where field_list.DataItemName = "PRX_WeeklyAdminTime" and field_List.Control_MultiFieldOccNum = 1);
+ AdminTimesDoseA_list := AdminTimesDoseA.value;
+ NonWeeklyFreqDoseA := last of (field_list where field_list.DataItemName = "PRX_NonWeeklySchedule" and field_List.Control_MultiFieldOccNum = 1);
+ NonWeeklyFreqDoseA_list := NonWeeklyFreqDoseA.value;
+ DoseADays := last of (field_list where field_list.DataItemName = "PRX_Scheddays1" and field_List.Control_MultiFieldOccNum = 1);
+ DoseATimes := last of (field_list where field_list.DataItemName = "PRX_SchedTimes" and field_List.Control_MultiFieldOccNum = 1);
+ NonWeeklyCB := last of (field_list where field_list.DataItemName = "PRX_Generic_CB" and field_List.Control_MultiFieldOccNum = 1);
+ NonWeeklyCB_value := NonWeeklyCB.value;
+ Frequency := last of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = 1);
+ Frequency_val := Frequency.value;
+ DailyFreq := last of (field_list where field_list.DataItemName = "PRX_Std_Schedule" and field_List.Control_MultiFieldOccNum = 1);
+ DailyFreq_value := DailyFreq.value;
+ DoseAStartdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 1);
+ Instructions := first of (field_list where field_list.DataItemName = "AdminInstructions" and field_List.Control_MultiFieldOccNum = 1);
+
+
+
+ If CallingEvent = "FieldChange" or CallingEvent = "FormClose" Then
+
+ //Make appropriate fields available on the form for weekly and one time frequencies
+
+ If CallingField = "PRX_Generic_CB|1" then
+
+ If NonWeeklyCB.Value = false then
+ AltDaysDoseA.control_read_only := False;
+ AdminTimesDoseA.control_read_only := False;
+ Frequency_val.frequencysummary := Null;
+ NonWeeklyFreqDoseA.control_read_only := true;
+ NonWeeklyFreqDoseA.value:= Null;
+
+
+ elseif NonWeeklyCB_Value = true then
+ AltDaysDoseA.value := Null;
+ AltDaysDoseA.control_read_only := True;
+ AdminTimesDoseA.control_read_only := True;
+ AdminTimesDoseA.value := Null;
+ DoseADays.value := "None";
+ DoseATimes.value := "None";
+ NonWeeklyFreqDoseA.control_read_only := false;
+ endif;
+
+ endif;
+
+ // Determine the day of the week for today and the following 6 days
+
+ ThisTime := (now as time) ;
+ FormatDate := extract month ThisTime ||"-" || extract day ThisTime ||"-" ||extract year ThisTime;
+ ThisDay := extract year ThisTime || "-" || extract month ThisTime ||"-" || extract day ThisTime;
+ DayofWeek1 := read last {"SELECT DATENAME(dw, GETDATE ())"};
+ DayofWeek2 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,1,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek3 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,2,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek4 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,3,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek5 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,4,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek6 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,5,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek7 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,6,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+
+ If CallingField = "PRX_NonWeeklySchedule|1" then
+ Frequency_val.frequencysummary := NonWeeklyFreqDoseA.value;
+ DailyFreq.value := Frequency_val.frequencysummary;
+ endif;
+
+ If CallingField = "MultiOrderGrid|1" and DoseA_value is Null then
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Please select Dose of Methotrexate and Frequency from selection options. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Grid1Orders_List.IsReadOnly := (True);
+ Grid1Orders_List.IsSelected := (False);
+ endif;
+
+ // Add dose selected, days selected and times selected to hidden fields to map to order
+ If CallingField = "MethotrexateDose|1" then
+
+ If DoseA_value is not null then
+
+ (doselist) := call str_parse with DoseA_value," ";
+
+ for r in doselist do
+ dosage.value := doselist [1];
+ enddo;
+
+ numtabs := (dosage.value as number) / 2.5;
+ endif;
+ endif;
+
+ If CallingField = "PRX_WeeklyAdminTime|1" then
+
+ if AdminTimesDoseA.value is not null then
+ DoseATimes.value := AdminTimesDoseA_list;
+ (adminlist) := call str_parse with AdminTimesDoseA_list,",";
+ admin_count := count adminlist;
+
+ endif;
+ endif;
+
+ // Loop through days selected, compare with days of the week to determine starting day
+ if callingfield = "PRX_AltSchedule1|1" then
+ if AltDaysDoseA.value is not null then
+ DoseADays.value := AltDaysDoseA_list;
+ StartDay1A := "NO";
+ StartDay2A := "NO";
+ StartDay3A := "NO";
+ StartDay4A := "NO";
+ StartDay5A := "NO";
+ StartDay6A := "NO";
+ StartDay7A := "NO";
+ ListOfDaysA := call str_parse with DoseADays.value, ",";
+
+ for r in 1 seqto (count ListOfDaysA) do
+
+ If DayofWeek1 = ListOfDaysA [r] then
+ StartDay1A := "YES";
+ elseif DayofWeek2 = ListOfDaysA [r] then
+ StartDay2A := "Yes";
+ elseif DayofWeek3 = ListOfDaysA [r] then
+ StartDay3A := "Yes";
+ elseif DayofWeek4 = ListOfDaysA [r] then
+ StartDay4A := "Yes";
+ elseif DayofWeek5 = ListOfDaysA [r] then
+ StartDay5A := "Yes";
+ elseif DayofWeek6 = ListOfDaysA [r] then
+ StartDay6A := "Yes";
+ elseif DayofWeek7 = ListOfDaysA [r] then
+ StartDay7A := "Yes";
+ endif;
+ enddo;
+
+ endif;
+ endif;
+
+ // Determine start date for order
+
+ If StartDay1A = "Yes" then
+ DoseAStartDate.value := Thistime;
+ elseif StartDay2A = "Yes" then
+ DoseAStartDate.value := Thistime + 1 day;
+ elseif StartDay3A = "Yes" then
+ DoseAStartDate.value := Thistime + 2 day;
+ elseif StartDay4A = "Yes" then
+ DoseAStartDate.value := Thistime + 3 day;
+ elseif StartDay5A = "Yes" then
+ DoseAStartDate.value := Thistime + 4 day;
+ elseif StartDay6A = "Yes" then
+ DoseAStartDate.value := Thistime + 5 day;
+ elseif StartDay7A = "Yes" then
+ DoseAStartDate.value := Thistime + 6 day;
+ endif;
+
+ endif; //CallingEvent = "FieldChange" or CallingEvent = "FormClose"
+
+ If CallingEvent = "FormClose" then
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+ endif;
+
+ // Determine how many tablets to administer for dose selected add to admin instructions
+
+ numtabs := (dosage.value as number) / 2.5;
+
+ If (numtabs is not null) then
+ If (DoseATimes.value <> "None") and (DoseADays.value <> "None") then
+ instructions.value := "Give " || numtabs || " tablets, every " || DoseADays.value || " at " || DoseATimes.value;
+ elseif (DoseATimes.value = "None") and (DoseADays.value = "None") then
+ instructions.value := "Give " || numtabs || " tablets " ;
+ endif;
+ else
+ instructions.value := "";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_MOVIPREP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_MOVIPREP.mlm
new file mode 100644
index 0000000..5fa183b
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_MOVIPREP.mlm
@@ -0,0 +1,195 @@
+maintenance:
+
+ title: FORM_SET_MOVIPREP;;
+ mlmname: FORM_SET_MOVIPREP;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Bryan Berkeybile, Allscripts;;
+ date: 2013-03-18;;
+ validation: testing;;
+
+library:
+ purpose: Change date/time on Moviprep orders based on Opening date/time
+ ;;
+
+ explanation: This MLM is called from the Moviprep OS (bowel prep for Colonoscopy)
+
+ Change history
+ 13.03.18 JML CSR# 30966 copied from FORM_SET_LIDODERM_PATCH
+ 19.11.27 TMS CSR# 38801 Add scheduling logic for baseline and follow up
+ magnesium and electrolytes.
+ ;;
+ keywords: Called MLMs, Moviprep
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Communication object Form object Arden ClientInfo object
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ // Use Generic MLM
+ generic_mlm := mlm {{{SINGLE-QUOTE}}}FORM_Set_Generic_Item_Control{{{SINGLE-QUOTE}}};
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Capture Opening Date and Time fields; synchs with first medication date and time
+ OpeningDate := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ AND field_list.Control_MultiFieldOccNum = 4);
+ OpeningTime := first of (field_list WHERE field_list.DataItemName = "RequestedTime"
+ AND field_list.Control_MultiFieldOccNum = 5);
+ OpeningTimeValue := OpeningTime.Value;
+
+ //Capture second medication date and time
+ PolyReqDate2 := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ AND field_list.Control_MultiFieldOccNum = 2);
+ PolyReqTime2 := first of (field_list WHERE field_list.DataItemName = "RequestedTime"
+ AND field_list.Control_MultiFieldOccNum = 3);
+ PolyReqTime2Value := PolyReqTime2.Value;
+
+ //Capture NPO date and time
+ NPOReqDate := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ AND field_list.Control_MultiFieldOccNum = 3);
+ NPOReqTime := first of (field_list WHERE field_list.DataItemName = "RequestedTime"
+ AND field_list.Control_MultiFieldOccNum = 4);
+ NPOReqTimeValue := NPOReqTime.Value;
+
+ // Capture dates and priority of baseline and follow up lab tests
+ BaseLineLab := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ AND field_list.Control_MultiFieldOccNum = 5);
+ FollowupLab := first of (field_list WHERE field_list.DataItemName = "RequestedDate"
+ AND field_list.Control_MultiFieldOccNum = 6);
+ BaselinePriority := first of (field_list WHERE field_list.DataItemName = "LAB_Order Priorities"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ EntryTime := (now as time) ;
+ EntryHour := extract hour EntryTime;
+ EntryMonth := extract month EntryTime;
+ EntryDay := extract day EntryTime;
+ EntryYear := extract year EntryTime;
+ EntryDate := EntryMonth || "-" || EntryDay || "-" || EntryYear || " 00:00";
+
+
+ if (CallingEvent = "FormOpen") then
+
+ //Execute the generic MLM on form open
+ execute_generic_mlm := call generic_mlm with this_communication, this_form, client_info_obj;
+
+ //Default the Opening Requested time to 6:00PM
+ OpeningTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ OpeningTimeValue.ReqTimeValue := "18:00";
+
+ //Default the second medication date / time to T+1 and 4:00am
+ PolyReqDate2.Value := OpeningDate.Value + 1 day;
+ PolyReqTime2Value.ReqTimeCode := "Scheduled/Start Time";
+ PolyReqTime2Value.ReqTimeValue := "04:00";
+
+ //Default the NPO to one hour past the second medication date/time
+ NPOReqDate.Value := PolyReqDate2.Value;
+ NPOReqTimeValue.ReqTimeCode := "Scheduled Time";
+ NPOReqTimeValue.ReqTimeValue := "05:00";
+
+ //Default Lab Draws, schedule baseline for next even hour if AM rounds has passed.
+ BaselineLab.value := OpeningDate.Value;
+ FollowupLab.value := OpeningDate.Value + 1 day;
+ If (EntryHour as number) < 5 then
+ BaselinePriority.value := "AM Rounds";
+ else
+ BaselinePriority.value := "ROUTINE (Drawn next even hour)";
+ endif;
+
+ elseif (CallingEvent = "FieldChange") then
+ //Event handle if user changes the opening date /time that synchs with first medication date/time
+ if ((CallingField = "RequestedDate|4") OR (CallingField = "RequestedTime|5")) then
+
+ //Retrieve Opening date
+ StartDate := OpeningDate.Value;
+
+
+ // If Date of procedure changed to day other then today adjust collection of baseline
+ // and follow up lab to be day before and day of procedure.
+ If (StartDate as time) > (EntryDate as time) then
+ BaselineLab.value := OpeningDate.Value;
+ FollowupLab.value := OpeningDate.Value + 1 day;
+ BaselinePriority.value := "AM Rounds";
+ endif;
+
+
+ //Retrieve opening hour plus the full time cast as a Time data type
+ OpeningTimeHour := (substring 2 characters from OpeningTimeValue.ReqTimeValue) as number;
+ OpeningTimeFullTime := OpeningTimeValue.ReqTimeValue as Time;
+
+ //We need to know when we have to flip the date to T+1 on the second med order
+ //Easiest way I could figure to do this is to grab the opening date and time
+ //If the opening time is greater than or equal to 14:00 (i.e. 2:00PM), then flip the second
+ //med date to T+1
+ if (OpeningTimeHour >= 14) then
+ PolyReqDate2.Value := (OpeningDate.Value + 1 day);
+ else
+ PolyReqDate2.Value := OpeningDate.Value;
+ endif;
+
+ //Second medication time needs to be 10 hours past the opening (or first med) time
+ NewMedTime := OpeningTimeFullTime + 10 hours;
+ NewMedTimeHour := extract hour NewMedTime;
+ if (length (NewMedTimeHour as string) = 1) then
+ Hr := "0" || NewMedTimeHour;
+ else
+ Hr := NewMedTimeHour;
+ endif;
+
+ NewMedTimeMinute := extract minute NewMedTime;
+ if (length (newMedTimeMinute as string) = 1) then
+ Mins := "0" || NewMedTimeMinute;
+ else
+ Mins := NewMedTimeMinute;
+ endif;
+ PolyReqTime2Value.ReqTimeValue := Hr || ":" || Mins;
+
+ //Deal with the NPO
+ NPOReqDate.Value := PolyReqDate2.Value;
+ //Need to add 1 hour to the second med hour for the NPO
+ NPOTimeHour := NewMedTimeHour + 1;
+ if (NPOTimeHour = 24) then
+ NPOTimeHour := "00";
+ NPOReqDate.Value := PolyReqDate2.Value + 1 day;
+ endif;
+
+ if (length (NPOTimeHour as string) = 1) then
+ NPOHr := "0" || NPOTimeHour;
+ else
+ NPOHr := NPOTimeHour;
+ endif;
+ NPOReqTimeValue.ReqTimeValue := NPOHr || ":" || Mins;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_NEWBORN_NURSERY_ADMISSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_NEWBORN_NURSERY_ADMISSION.mlm
new file mode 100644
index 0000000..58c0562
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_NEWBORN_NURSERY_ADMISSION.mlm
@@ -0,0 +1,162 @@
+maintenance:
+
+ title: FORM_SET_NEWBORN_NURSERY_ADMISSION;;
+ mlmname: FORM_SET_NEWBORN_NURSERY_ADMISSION;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M Law, Allscripts x7461;;
+ specialist: Peggy Karish, Allscripts ext 7441;;
+ date: 2014-10-09;;
+ validation: testing;;
+
+library:
+ purpose: Automatically select and disable medication orders based on prescence of lab result on mother.
+
+ ;;
+
+ explanation: This MLM is called from the Newborn Nursery Admission Order Set. On Form open, based on the existence and result of
+ the Hepatitis B Surface Antigen lab on the mother, the appropriate medications will be selected and all others disabled.
+
+ Change History
+ -----------------
+ 10.09.2014 JML CSR# 32644: Created
+ 10.29.2014 JML Moved to Production
+ 01.14.2019 JML CSR#37671: Include criteria for newborn baby weight when disabling medication grid selections.
+ ;;
+ keywords: Called MLMs, Newborn, Admission, Hepatitis B
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+
+ pObj := this_communication.PrimaryObj;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Retrieve relevant form fields
+ Hep_Meds_NEG_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 50 );
+ Hep_Meds_NEG := Hep_Meds_NEG_Grid.Value;
+
+ Hep_Meds_UNK_WtLg_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 51 );
+ Hep_Meds_UNK_WtLg := Hep_Meds_UNK_WtLg_Grid.Value;
+
+ Hep_Meds_UNK_WtSm_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 54 );
+ Hep_Meds_UNK_WtSm := Hep_Meds_UNK_WtSm_Grid.Value;
+
+ Hep_Meds_POS_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 53 );
+ Hep_Meds_POS := Hep_Meds_POS_Grid.Value;
+
+ //Locate MOM
+ //Retrieve MOM{{{SINGLE-QUOTE}}}s visit guid from cross reference table
+ momVisitGUID := read last {"SELECT mcv.MotherDeliveryVisitGUID "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN SXAAMMotherChildVisitXRef mcv WITH (NOLOCK)"
+ || " ON cv.GUID = mcv.ClientVisitGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)
+ || " AND cv.ChartGUID = " || Sql(chart_guid)};
+
+ (momClientGUID,
+ momChartGUID) := read last {"SELECT cv.ClientGUID, cv.ChartGUID"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK)"
+ || " WHERE cv.GUID = " || Sql(momVisitGUID)};
+
+ //Retrieve MOM{{{SINGLE-QUOTE}}}s Hepatitis B Surface Antigen result from OB Patient Profile
+ hepB_SAG_result := read last {"SELECT fsl.value"
+ || " FROM CV3PatientCareDocument pcd WITH (NOLOCK) JOIN SXACDObservationParameter obsparam WITH (NOLOCK)"
+ || " ON pcd.GUID = obsparam.PatCareDocGUID"
+ || " LEFT JOIN SCMObsFSListValues fsl WITH (NOLOCK)"
+ || " ON obsparam.ObservationDocumentGUID = fsl.ParentGUID"
+ || " AND obsparam.ClientGUID = fsl.ClientGUID"
+ || " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON obsparam.ObsMasterItemGUID = ocmi.GUID"
+ || " WHERE obsparam.ClientGUID = " || SQL(momClientGUID)
+ || " AND obsparam.ClientVisitGUID = " || SQL(momVisitGUID)
+ || " AND obsparam.ChartGUID = " || SQL(momChartGUID)
+ || " AND pcd.Name = {{{SINGLE-QUOTE}}}OB Patient Profile{{{SINGLE-QUOTE}}}"
+ || " AND obsparam.IsCanceled = 0"
+ || " AND ocmi.Name like {{{SINGLE-QUOTE}}}PRO hbsag%{{{SINGLE-QUOTE}}}" };
+
+ baby_Wt := read last {"SELECT obsparam.ValueText"
+ || " FROM CV3PatientCareDocument pcd WITH (NOLOCK) JOIN SXACDObservationParameter obsparam WITH (NOLOCK)"
+ || " ON pcd.GUID = obsparam.PatCareDocGUID"
+ || " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON obsparam.ObsMasterItemGUID = ocmi.GUID"
+ || " WHERE pcd.Name = {{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}}"
+ || " AND obsparam.IsCanceled = 0"
+ || " AND ocmi.Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}}"
+ || " AND obsparam.ClientGUID = " || SQL(client_guid)
+ || " AND obsparam.ClientVisitGUID = " || SQL(visit_guid)
+ || " AND obsparam.ChartGUID = " || SQL(chart_guid) };
+
+
+ //Fire on Form Open event
+ if ( CallingEvent = "FormOpen" ) then
+
+ //If Mom{{{SINGLE-QUOTE}}}s Hepatitis B Surface Antigen result is negative, preselect Inj order under NEGA header
+ if ( hepB_SAG_result = "negative" AND ( baby_wt as number ) >= 2000 ) then
+
+ Hep_Meds_NEG.IsReadOnly := false;
+
+ Hep_Meds_UNK_WtLg.IsReadOnly := true;
+ Hep_Meds_UNK_WtSm.IsReadOnly := true;
+ Hep_Meds_POS.IsReadOnly := true;
+
+ elseif ( ( hepB_SAG_result = "unknown" OR hepB_SAG_result = "n/a" ) AND ( baby_wt as number) >= 2000 ) then
+
+ Hep_Meds_UNK_WtSm.IsReadOnly := true;
+
+ elseif ( ( hepB_SAG_result = "unknown" OR hepB_SAG_result = "n/a" ) AND ( baby_wt as number ) < 2000 ) then
+
+ Hep_Meds_UNK_WtLg.IsReadOnly := true;
+
+ elseif ( hepB_SAG_result = "positive" ) then
+
+ Hep_Meds_POS.IsReadOnly := false;
+
+ Hep_Meds_UNK_WtLg.IsReadOnly := true;
+ Hep_Meds_UNK_WtSm.IsReadOnly := true;
+ Hep_Meds_NEG.IsReadOnly := true;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_NEWBORN_PROFILE_ADMISSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_NEWBORN_PROFILE_ADMISSION.mlm
new file mode 100644
index 0000000..a8ad0c2
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_NEWBORN_PROFILE_ADMISSION.mlm
@@ -0,0 +1,215 @@
+maintenance:
+
+ title: NewBorn Profile Admission Order Set;;
+ mlmname: FORM_Set_NewBorn_Profile_Admission;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Peggy Karish, Eclipsys Corp ext 7441;;
+ date: 2008-04-10;;
+ validation: testing;;
+
+library:
+ purpose: Used for grids that perform all true or no risk
+
+ ;;
+
+ explanation: This MLM is called from the Patient Profile- NewBorn Admission Orders
+ ;;
+ keywords: Called MLMs, Respiratory ORder Set, New Born Admission
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ If CallingField = "MultiOrderCheckBox|2" then
+ NoRisk := "No Discharge Risk Criteria";
+ OccNumber := 2;
+ Elseif CallingField = "MultiOrderCheckBox|9" then
+ NoRisk := "No Pediatric Nutritional Risk";
+ OccNumber := 9;
+ Elseif CallingField = "MultiOrderCheckBox|7" then
+ NoRisk := "No Parent Smoking Risk";
+ OccNumber := 7;
+ endif;
+
+ // Now do True and false logic for EVERY grid on this form
+
+ //Get the multi order grid check box value
+ Grid_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = OccNumber);
+ Grid_list :=Grid_fld.Value;
+ Grid_SelList := Grid_List.IsSelected;
+
+ Found_NoRisk:= First of (Grid_list where Grid_list.Name = NoRisk );
+
+ ListMembs:= count Grid_SelList;
+ AllButNo:= ();
+ FalseList := ();
+ TrueList := ();
+ for k in (1 seqto (ListMembs-1)) do
+ AllButNo:= AllButNo, Grid_SelList[k];
+ FalseList := FalseList,False;
+ TrueList := TrueList ,True;
+ enddo;
+
+ OneOfRest := true in AllButNo;
+
+ If Found_NoRisk.IsSelected = True then
+ Grid_List.IsSelected:= FalseList , True;
+ Grid_List.IsReadOnly:= TrueList , False;
+ endif;
+
+ If (Found_NoRisk.IsSelected = False) and (OneOfRest = False) then // deselected No Risk
+ Grid_List.IsSelected := FalseList , False;
+ Grid_List.IsReadOnly := FalseList , False;
+ Endif;
+
+ If (OneOfRest = True) and (Found_NoRisk.IsSelected = False) then
+ Found_NoRisk.IsSelected := False;
+ Found_NoRisk.IsReadOnly := True;
+ endif;
+
+
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Now for the extras per grid //
+ /////////////////////////////////////////////
+ If CallingField = "MultiOrderCheckBox|7" then
+
+ SmokeCon_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 5);
+ SmokeCon_list :=SmokeCon_fld.Value;
+ Found_SmokeConOrder:= first of (SmokeCon_list where SmokeCon_list.Name = "Pulmonary Health Education Consult");
+ Smoke_Comment := last of (field_list where field_list.DataItemName = "NUR_Comment 3");
+ Smoke_ConReason := last of (field_list where field_list.DataItemName = "RESP Pulmonary Health Education");
+
+ PrevUseToB_Fld := last of (field_list where field_list.DataItemName = "NUR_CheckBox 4");
+ PrevUseToB_Value := PrevUseToB_Fld.Value;
+
+ PrevLess12_Fld := last of (field_list where field_list.DataItemName = "NUR_CheckBox 5");
+ PrevLess12_Value:= PrevLess12_Fld.Value;
+
+
+ If Found_NoRisk.IsSelected = True then
+ Smoke_Comment.Value := "";
+ Smoke_ConReason := " ";
+ Smoke_ConReason := "";
+ endif;
+
+ Found_UTBOrder:= first of (Grid_list where Grid_list.Name = "Parent Uses Tobacco");
+ UTB_Selected:= Found_UTBOrder.IsSelected;
+ Found_Less12Order := first of (Grid_list where Grid_list.Name = "Parent Quit Tobacco- Last 12 months");
+ Less12_Selected := Found_Less12Order.IsSelected;
+
+ If Less12_Selected = PrevLess12_Value then
+ Robert:="KEWL";
+ Else
+ If Less12_Selected = True then
+ Found_UTBOrder.IsReadOnly := True;
+ Found_SmokeConOrder.IsSelected := True;
+ Found_SmokeConOrder.IsReadOnly := True;
+ Smoke_Comment.Value := "By selecting Smoking Risk Order- an order for a Pulmonary Health Education Consult (Quit Smoking in Last 12 Months) has automatically been created";
+ Smoke_ConReason.Value := "Quit Smoking in Last 12 Months";
+ Else
+ Found_UTBOrder.IsReadOnly := False;
+ Found_SmokeConOrder.IsSelected := False;
+ Found_SmokeConOrder.IsReadOnly := False;
+ Smoke_Comment.Value := "By deselecting Smoking Risk Order- an order for a Pulmonary Health Education Consult (Quit Smoking in Last 12 Months) has automatically been removed";
+ Smoke_ConReason.Value := "";
+ Endif;
+ PrevLess12_Fld.Value:= Less12_Selected;
+ endif;
+
+ If UTB_Selected = PrevUseToB_Value then
+ Robert := "Still KEWL";
+ Else
+ If UTB_Selected = True then
+ Found_Less12Order.IsReadOnly := True;
+ Found_SmokeConOrder.IsSelected := True;
+ Found_SmokeConOrder.IsReadOnly := True;
+ Smoke_Comment.Value := "By selecting Smoking Risk Order- an order for a Pulmonary Health Education Consult (Smoking Cessation) has automatically been created";
+ Smoke_ConReason.Value := "Smoking Cessation";
+ Else
+ Found_Less12Order.IsReadonly := False;
+ Found_SmokeConOrder.IsSelected := False;
+ Found_SmokeConOrder.IsReadOnly := False;
+ Smoke_Comment.Value := "By deselecting Smoking Risk Order- an order for a Pulmonary Health Education Consult (Smoking Cessation) has automatically been removed";
+ Smoke_ConReason.Value := "";
+ Endif;
+ PrevUseToB_Fld.Value := UTB_Selected;
+ endif;
+ Elseif CallingField = "MultiOrderCheckBox|9" then
+
+
+
+
+ LactCon_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 5);
+ LactCon_list :=LactCon_fld.Value;
+ Found_LacConOrder:= first of (LactCon_list where LactCon_list.Name = "Lactation Consult");
+
+ Nutrition_Comment:= last of (field_list where field_list.DataItemName = "NUR_Comment 4");
+
+ Found_Breast:= first of (Grid_list where Grid_list.Name = "Breastfeeding - Newborn");
+ Found_Breast_Selected:= Found_Breast.IsSelected;
+
+
+ if Found_Breast_Selected = True then
+ Found_LacConOrder.IsSelected := True;
+ Found_LacConOrder.IsReadOnly := True;
+ Nutrition_Comment.Value := "By selecting Breastfeeding - Newborn, an order for a Lactation Consult has automatically been created";
+ else
+ Found_LacConOrder.IsSelected := False;
+ Found_LacConOrder.IsReadOnly := False;
+ Nutrition_Comment.Value := "By deselecting Breastfeeding - Newborn, an order for a Lactation Consult has automatically been removed";
+ endif;
+
+endif;
+
+ /* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "One Of Rest Selection is " || OneOfRest|| "\n\n" ||
+ "NoRisk Select" || Found_NoRisk.IsSelected || "\n\n" ||
+ "NoRisk Value " || Found_NoRisk.Value;
+ this_communication.MessageType := "Informational";
+*/
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_NONFORM_ARIXTRA.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_NONFORM_ARIXTRA.mlm
new file mode 100644
index 0000000..1c93950
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_NONFORM_ARIXTRA.mlm
@@ -0,0 +1,418 @@
+maintenance:
+
+ title: Set Lovenox Nurse Orders Injectable;;
+ mlmname: FORM_Set_NonForm_Arixtra;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Don Warnick, Eclipsys Corp Ext 7463;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-09-22;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds warfarin order set
+ ;;
+
+ explanation: This MLM is called from the warfarin order set, form: PRX_OsEnoxaparin
+
+
+ Change history
+
+ 09.23.2008 RS Initial build - derived from FORM_SET_HEPARIN_WEIGHT_BASED_INIT
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 05.02.2013 JML CSR #31334: Leapfrog changes; adding call to Anticoagulant alert function to
+ check conflicts with Arixtra
+ 04.26.2016 TMS CSR 33465: Add call on form Close to Medication Order Management MLM
+
+
+ ;;
+ keywords: Called MLMs, warfarin
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ anticoagulant_check := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{SINGLE-QUOTE}}};
+
+ //Include standard .Net libraries
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //CSR 31334: Leapfrog
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Find the baseline order checkbox that may need to be ordered with this protocol
+
+ Labs_Baseline_field := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 1);
+ Labs_Baseline_List := Labs_Baseline_field.Value;
+ Baseline_CBC:= first of (Labs_Baseline_list where Labs_Baseline_list.Name = "CBC No Diff (Hemogram Only)");
+ Baseline_Creatinine:= first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Creatinine");
+
+
+ //Find the daily order that may needs to accompany this protocol
+
+ Lab_Daily_Order_field := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_Order_List := Lab_Daily_Order_field.Value;
+
+ // Find the 5 Requested Date fields - #1 is visible, #2 - #5 are hidden
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 5);
+
+ primtime:= last of (Field_list where field_list.DataItemName = "RequestedTime");
+ //Find the daily reminder that may need to be ordered with this protocol
+
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Lab_Rem_List := Lab_Rem.Value;
+ Daily_Reminder := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+ //Find if any of the arixtra med box exists, if not, it is not applicapable on this order set
+
+ Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Med_List :=Med_Grid.Value;
+ Fnd_Arixtra := first of (Med_List WHERE Med_List.Name = "Fondaparinux Inj");
+
+ Med_List_Sel := Med_List.IsSelected;
+ Med_List_Name := Med_List.Name;
+
+ ArixtraSel := false;
+
+ ListMembMed := count Med_List_Sel;
+ for k in (1 seqto ListMembMed) do
+ if ((Med_List_Name[k] = "Fondaparinux Inj") and (Med_List_Sel[k] = True))
+ then
+ ArixtraSel := True;
+ endif;
+ enddo;
+
+
+// Arixtra_fld := first of (Med_List where Med_List.Name = "Fondaparinux Inj");
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+ If (CallingEvent = "FieldChange") then
+
+ If CallingField = "MultiOrderGrid|1" then
+
+ If (ArixtraSel = True) and (Daily_Reminder.IsSelected = False)
+ then
+
+ //CSR # 31334: Leapfrog changes; calling anticoagulant alert check function for Arixtra
+ (stop, stop_message, severity) := CALL anticoagulant_check WITH (this_communication, this_form, client_info_obj, Fnd_Arixtra.Name);
+
+
+ if (stop = true) then
+ if (severity = "high") then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Lab_Daily_Order_List.IsReadOnly := (False,False,False,False,False);
+ Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
+ Daily_Reminder.IsReadOnly := False;
+ Daily_Reminder.IsSelected := False;
+ Baseline_CBC.IsReadOnly := True;
+ Baseline_Creatinine.IsReadOnly := True;
+ primreqdate.control_read_only := True;
+ primtime.control_read_only := True;
+
+ ListMembMed := count Med_List_Sel;
+ for k in (1 seqto ListMembMed) do
+ if ((Med_List_Name[k] = "Fondaparinux Inj") and (Med_List_Sel[k] = True))
+ then
+ Med_List[k].IsSelected := False;
+ endif;
+ enddo;
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ((dialogRes as String) = "No") then
+ Lab_Daily_Order_List.IsReadOnly := (False,False,False,False,False);
+ Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
+ Daily_Reminder.IsReadOnly := False;
+ Daily_Reminder.IsSelected := False;
+ Baseline_CBC.IsReadOnly := True;
+ Baseline_Creatinine.IsReadOnly := True;
+ primreqdate.control_read_only := True;
+ primtime.control_read_only := True;
+
+ ListMembMed := count Med_List_Sel;
+ for k in (1 seqto ListMembMed) do
+ if ((Med_List_Name[k] = "Fondaparinux Inj") and (Med_List_Sel[k] = True))
+ then
+ Med_List[k].IsSelected := False;
+ endif;
+ enddo;
+
+ else
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_Order_List.IsSelected := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+ Daily_Reminder.IsSelected := True;
+ Baseline_CBC.IsReadOnly := False;
+ Baseline_Creatinine.IsReadOnly := False;
+ primreqdate.control_read_only := False;
+ primtime.control_read_only := False;
+ endif;
+ endif;
+ else
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_Order_List.IsSelected := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+ Daily_Reminder.IsSelected := True;
+ Baseline_CBC.IsReadOnly := False;
+ Baseline_Creatinine.IsReadOnly := False;
+ primreqdate.control_read_only := False;
+ primtime.control_read_only := False;
+
+ endif;
+
+ elseif (ArixtraSel= False) and (Daily_Reminder.IsSelected = True)
+ then
+ Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
+ Daily_Reminder.IsSelected := False;
+ Baseline_CBC.IsReadOnly := True;
+ Baseline_CBC.IsSelected := False;
+ Baseline_Creatinine.IsReadOnly := True;
+ Baseline_Creatinine.IsSelected := False;
+ primreqdate.control_read_only := True;
+ primtime.control_read_only := True;
+
+
+ endif;
+
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")";
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 1 days;
+ thirdreqdate.value := startdate + 2 days;
+ fourthreqdate.value := startdate + 3 days;
+ fifthreqdate.value := startdate + 4 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ endif;
+
+ elseif CallingEvent = "FormOpen" then
+
+
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+ Baseline_CBC.IsReadOnly := True;
+ Baseline_Creatinine.IsReadOnly := True;
+ primreqdate.control_read_only := True;
+ primtime.control_read_only := True;
+
+// Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 1 days;
+ thirdreqdate.value := startdate + 2 days;
+ fourthreqdate.value := startdate + 3 days;
+ fifthreqdate.value := startdate + 4 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ elseif CallingEvent = "FormClose" then
+
+
+ If ArixtraSel= True then
+
+ // Find if there is a baseline CBC in the past 24 hours and if one is not found, check the baseline box
+
+
+ If (Baseline_CBC.IsSelected =false) or (Baseline_Creatinine.IsSelected = false) then
+
+ If Baseline_CBC.IsSelected = false then
+
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If not exists CBC_Val then Baseline_CBC.ISSelected :=True; endif;
+
+ endif;
+
+
+ If Baseline_Creatinine.IsSelected = false then
+
+ Creatinine_Val := read last
+ {" Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Creatinine{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel Fasting{{{SINGLE-QUOTE}}})"
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If not exists Creatinine_Val then Baseline_Creatinine.ISSelected :=True; endif;
+
+ endif;
+
+ endif;
+
+
+
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}S ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+
+ for J in index_list do
+ singledate := formlist[J];
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+ enddo;
+
+ Lab_Daily_Order_List.IsSelected := (Reset_CBC_Grid);
+
+
+
+
+
+ endif; //If exist
+
+ elseif (true not in Med_List.IsSelected) then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please enter a Lovenox Order.\n\n" ;
+ this_communication.MessageType := "Error";
+
+ endif;
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_OPEN_HEART_ANESTHESIA.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_OPEN_HEART_ANESTHESIA.mlm
new file mode 100644
index 0000000..699ec9f
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_OPEN_HEART_ANESTHESIA.mlm
@@ -0,0 +1,201 @@
+maintenance:
+
+ title: FORM_Set_Open_Heart_Anesthesia;;
+ mlmname: FORM_Set_Open_Heart_Anesthesia;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza;;
+ specialist: Michele Palmer;;
+ date: 2018-11-02;;
+ validation: testing;;
+
+library:
+ purpose: Used for Post Open Heart anesthesia Order Set
+ ;;
+
+ explanation: This MLM is called from the Post Open Heart Anesthesia Order Set to calculate the Standard Dose Sugammadex (Bridion) at 2mg/kg, rounded to the nearest whole number.
+ Also only allows for either the standard dosing of a drug or the non standard dosing of a drug to be selected, but not both.
+
+ Change History
+ 11.02.2018 TMS CSR 37529 Created to calculate Sugammadex for Standard Dosing Grid at 2mg/kg. Added logic to only allow a drug to be selected in either the Standard dosing grid
+ or the non standard dosing grid, but not both. This was previously handled by the Generic MLM.
+
+ ;;
+ keywords: Called MLMs, Post Open Heart Anesthesia
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Standard_Dose_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 11);
+ Standard_Dose_List :=Standard_Dose_Grid.Value;
+ NonStandard_Dose_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 12);
+ NonStandard_Dose_List :=NonStandard_Dose_Grid.Value;
+
+ Sugammadex := first of (Standard_Dose_List where Standard_Dose_List.Name = "Sugammadex Inj");
+ Neostigmine := first of (Standard_Dose_List where Standard_Dose_List.Name = "Neostigmine Inj");
+ Physostigmine := first of (Standard_Dose_List where Standard_Dose_List.Name = "Physostigmine Inj");
+ Glycopyrrolate := first of (Standard_Dose_List where Standard_Dose_List.Name = "Glycopyrrolate Inj");
+
+ Sugammadex_NonStd:= first of (NonStandard_Dose_List where NonStandard_Dose_List.Name = "Sugammadex Inj");
+ Neostigmine_NonStd := first of (NonStandard_Dose_List where NonStandard_Dose_List.Name = "Neostigmine Inj");
+ Physostigmine_NonStd := first of (NonStandard_Dose_List where NonStandard_Dose_List.Name = "Physostigmine Inj");
+ Glycopyrrolate_NonStd := first of (NonStandard_Dose_List where NonStandard_Dose_List.Name = "Glycopyrrolate Inj");
+ Calc_Dose := first of (field_list where field_list.DataItemName = "DosageLow"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Calc_Dose_Value := Calc_Dose.value;
+ comb_ht_wt_fld := first of (field_list
+ where field_list.DataItemName = "CombinedMeasurements" and field_List.Control_MultiFieldOccNum = 2);
+
+
+
+ if exists comb_ht_wt_fld then
+ comb_ht_wt_val := comb_ht_wt_fld.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;
+
+ If CallingEvent = "FormOpen" Then
+ Calc_Raw_Dose := wt * 2;
+ round_dose := int((Calc_Raw_Dose + 0.5)/1) * 1;
+ Calc_Dose.value := round_dose;
+ endif;
+
+ If CallingEvent = "FieldChange" then
+ If CallingField = "MultiOrderGrid|11" then
+
+ If Sugammadex.IsSelected = True then
+ If wt is null or wt = 0 then
+ msg1 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Sugammadex (Bridion) is calculated at 2mg/kg. \n\n Please enter a weight for this patient." ,"Sunrise Clinical Manager", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ Calc_Dose.value := null;
+ else
+ Calc_Raw_Dose := wt * 2;
+ round_dose := int((Calc_Raw_Dose + 0.5)/1) * 1;
+ Calc_Dose.value := round_dose;
+ endif;
+ Sugammadex_NonStd.IsReadOnly := True;
+
+ elseif Sugammadex.IsSelected = False then
+ Sugammadex_NonStd.IsReadOnly := False;
+ endif;
+
+ If Neostigmine.IsSelected = True then
+ Neostigmine_NonStd.IsReadOnly := True;
+ Neostigmine.IsReadOnly := False;
+ elseif Neostigmine.IsSelected = False then
+ Neostigmine_NonStd.IsReadOnly := False;
+ endif;
+
+ If Physostigmine.IsSelected = True then
+ Physostigmine_NonStd.IsReadOnly := True;
+ elseif Physostigmine.IsSelected = False then
+ Physostigmine_NonStd.IsReadOnly := False;
+ endif;
+
+ If Glycopyrrolate.IsSelected = True then
+ Glycopyrrolate_NonStd.IsReadOnly := True;
+ elseif Glycopyrrolate.IsSelected = False then
+ Glycopyrrolate_NonStd.IsReadOnly := False;
+ endif;
+
+ endif; //If CallingField = "MultiOrderGrid|11"
+
+ If CallingField = "MultiOrderGrid|12" then
+
+ If Sugammadex_NonStd.IsSelected = True then
+ Sugammadex.IsReadOnly := True;
+ elseif Sugammadex_NonStd.IsSelected = False then
+ Sugammadex.IsReadOnly := False;
+ endif;
+
+ If Neostigmine_NonStd.IsSelected = True then
+ Neostigmine.IsReadOnly := True;
+ elseif Neostigmine_NonStd.IsSelected = False then
+ Neostigmine.IsReadOnly := False;
+ endif;
+
+ If Physostigmine_NonStd.IsSelected = True then
+ Physostigmine.IsReadOnly := True;
+ elseif Physostigmine_NonStd.IsSelected = False then
+ Physostigmine.IsReadOnly := False;
+ endif;
+
+ If Glycopyrrolate_NonStd.IsSelected = True then
+ Glycopyrrolate.IsReadOnly := True;
+ elseif Glycopyrrolate_NonStd.IsSelected = False then
+ Glycopyrrolate.IsReadOnly := False;
+ endif;
+
+ endif; //If CallingField = "MultiOrderGrid|12"
+
+
+ If CallingField = "CombinedMeasurements|2" then
+
+ If wt is null or wt = 0 then
+ Calc_Dose.value := null;
+ else
+ Calc_Raw_Dose := wt * 2;
+ round_dose := int((Calc_Raw_Dose + 0.5)/1) * 1;
+ Calc_Dose.value := round_dose;
+
+ endif;
+ endif; //If CallingField = "CombinedMeasurements|2"
+ endif; //If CallingEvent = "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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ORTHO_HIP_FRACTURE_CONSULT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ORTHO_HIP_FRACTURE_CONSULT.mlm
new file mode 100644
index 0000000..5c4e411
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ORTHO_HIP_FRACTURE_CONSULT.mlm
@@ -0,0 +1,88 @@
+maintenance:
+
+ title: FORM_SET_ORTHO_HIP_FRACTURE_CONSULT;;
+ mlmname: FORM_SET_ORTHO_HIP_FRACTURE_CONSULT;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M Law, Allscripts x7461;;
+ specialist: Debbie Eiler, Allscripts ext 7446;;
+ date: 2014-12-12;;
+ validation: testing;;
+
+library:
+ purpose:
+
+ ;;
+
+ explanation:
+
+ Change History
+ -----------------
+ 12.12.2014 JML CSR# 32914: Created
+ ;;
+ keywords: Called MLMs, Newborn, Admission, Hepatitis B
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+
+ pObj := this_communication.PrimaryObj;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Retrieve relevant fields
+ Pharmacy_Meds := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 49 );
+ Pharmacy_Meds_Val := Pharmacy_Meds.Value;
+
+ Surgery_Date := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 1 );
+
+ if ( CallingEvent = "FieldChange" ) then
+ if ( CallingField = "MultiOrderGrid|49" ) then
+ if ( true IN Pharmacy_Meds_Val.IsSelected ) then
+ Surgery_Date.Control_Mandatory := true;
+ else
+ Surgery_Date.Control_Mandatory := false;
+ endif;
+ endif;
+ endif; //END FieldChange event
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PARACENTESIS_CCM_LABS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PARACENTESIS_CCM_LABS.mlm
new file mode 100644
index 0000000..7abb569
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PARACENTESIS_CCM_LABS.mlm
@@ -0,0 +1,376 @@
+maintenance:
+
+ title: FORM_SET_PARACENTESIS_CCM_LABS;;
+ mlmname: FORM_SET_PARACENTESIS_CCM_LABS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Maria Pest, Allscripts;;
+ date: 2012-12-03;;
+ validation: testing;;
+
+library:
+ purpose: Lab orders entered on Thoracentesis and Paracentesis Order Sets need to display on MI and Cytology requisitions
+ ;;
+
+ explanation: This MLM is called from ...
+
+ Change history
+ 2012.12.03 JML CSR 30985: Created
+ 2014.09.15 STH CSR 31956: Changed name from "FORM_SET_THORACENTESIS_PARACENTESIS_LABS" to "FORM_SET_PARACENTESIS_CCM_LABS" as this MLM will be for para and CCM. Thoracentesis OS was updated for new layout and logic.
+
+
+ ;;
+ keywords: Called MLMs, Thoracentesis, Paracentesis
+ ;;
+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";
+
+ generic_item_control := mlm {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}};
+ ccm_thoracentesis := mlm {{{SINGLE-QUOTE}}}FORM_SET_CCM_THORACENTESIS{{{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;
+
+
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ FormName := this_form.Name;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+
+ //Retrieve fields
+ Labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Labs_fld_List := Labs_fld.Value;
+
+ US_Thor_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 2);
+ US_Thor_fld_List := US_Thor_fld.Value;
+
+ CCM_Left_Thor_fld := last of (field_list WHERE field_list.DataItemName = "CCM Left Thoracentesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+ CCM_Left_Thor_fld_List := CCM_Left_Thor_fld.Value;
+
+ CCM_Right_Thor_fld := last of (field_list WHERE field_list.DataItemName = "CCM Right Thoracentesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+ CCM_Right_Thor_fld_List := CCM_Right_Thor_fld.Value;
+
+ CCM_LR_Thor_fld := last of (field_list WHERE field_List.DataItemName = "CCM L/R Thoracentesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+ CCM_LR_Thor_fld_List := CCM_LR_Thor_fld.Value;
+
+ CCM_Left_Thor_Labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 2);
+ CCM_Left_Labs_List := CCM_Left_Thor_Labs_fld.Value;
+
+ CCM_Right_Thor_Labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 3);
+ CCM_Right_Labs_List := CCM_Right_Thor_Labs_fld.Value;
+
+ Labs_Right_Left_fld := last of (field_list WHERE field_list.DataItemName = "LAB_VO_Right or Left");
+ //and field_list.Control_MultiFieldOccNum = 1);
+
+ Labs_Right_Left2_fld := last of (field_list WHERE field_list.DataItemName = "LAB_SREQ_VO_DI_Left or Right");
+ //and field_list.Control_MultiFieldOccNum = 1);
+
+ Labs_List_fld := last of (field_list WHERE field_list.DataItemName = "Labs on Centesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Cytology_List_fld := last of (field_list WHERE field_list.DataItemName = "Cytology on Centesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ if (CallingEvent = "FieldChange") then
+ //Applies to Order Set(s) US Thoracentesis and US Paracentesis
+ if (CallingField = "MultiOrderGrid|2") then
+ (this_communication, this_form) := call generic_item_control WITH (this_communication, this_form, client_info_obj);
+
+ if (US_Thor_fld_List.IsSelected[1] = true) then
+
+ //Above MLM call checks all of the labs; populate text boxes
+ for i in 1 seqto (count Labs_fld_List.Name) do
+ if (not (Labs_fld_List.Name[i] matches pattern "%Cytology%")) then
+ if (Labs_List_fld.Value IS NULL) then
+ Labs_List_fld.Value := Labs_fld_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || Labs_fld_List.Name[i];
+ endif;
+ else
+ if (Cytology_List_fld.Value IS NULL) then
+ Cytology_List_fld.Value := Labs_fld_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || Labs_fld_List.Name[i];
+ endif;
+ endif;
+ enddo;
+ else
+ Labs_List_fld.Value := null;
+ Cytology_List_fld.Value := null;
+
+ endif;
+ //Applies to Order Set(s) US Thoracentesis, SP Thoracentesis, CT Thoracentesis,
+ // US Paracentesis, SP Paracentesis, CT Paracentesis
+ elseif (CallingField = "MultiOrderCheckbox|1") then
+
+ if (Labs_Right_Left_fld.Value IS NOT NULL) then
+ if (Labs_Right_Left_fld.Value matches pattern "%Left%") then
+ Labs_List_fld.Value := "Left: ";
+ Cytology_List_fld.Value := "Left: ";
+ elseif (Labs_Right_Left_fld.Value matches pattern "%Right%") then
+ Labs_List_fld.Value := "Right: ";
+ Cytology_List_fld.Value := "Right: ";
+ else
+ Labs_List_fld.Value := "";
+ Cytology_List_fld.Value := "";
+ endif;
+ else
+ Labs_List_fld.Value := "";
+ Cytology_List_fld.Value := "";
+ endif;
+
+ for i in 1 seqto (count Labs_fld_List.Name) do
+ if (not (Labs_fld_List.Name[i] matches pattern "%Cytology%")) then
+ if (Labs_fld_List.IsSelected[i]) then
+ if (Labs_List_fld.Value = "") then
+ Labs_List_fld.Value := Labs_fld_List.Name[i];
+ elseif (Labs_List_fld.Value = "Left: " OR Labs_List_fld.Value = "Right: ") then
+ Labs_List_fld.Value := Labs_List_fld.Value || Labs_fld_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || Labs_fld_List.Name[i];
+ endif;
+ endif;
+ else
+ if (Labs_fld_List.IsSelected[i]) then
+ if (Cytology_List_fld.Value = "") then
+ Cytology_List_fld.Value := Labs_fld_List.Name[i];
+ elseif (Cytology_List_fld.Value = "Left: " OR Cytology_List_fld.Value = "Right: ") then
+ Cytology_List_fld.Value := Cytology_List_fld.Value || Labs_fld_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || Labs_fld_List.Name[i];
+ endif;
+ endif;
+ endif;
+ enddo;
+ elseif (CallingField = "LAB_VO_Right or Left|1") then
+ new_string := Labs_List_fld.Value;
+ new_string2 := Cytology_List_fld.Value;
+
+ //Need to test if preceeding {{{SINGLE-QUOTE}}}right{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}left{{{SINGLE-QUOTE}}} already exists
+ rt_side_loc := FIND "Right:" IN STRING Labs_List_fld.Value;
+ if (rt_side_loc = 0) then
+ lt_side_loc := FIND "Left: " IN STRING Labs_List_fld.Value;
+ if (lt_side_loc > 0) then
+ new_string := SUBSTRING ((Length Labs_List_fld.Value) - (Length "Left: ")) CHARACTERS STARTING AT 7 FROM Labs_List_fld.Value;
+ endif;
+ elseif (rt_side_loc > 0) then
+ new_string := SUBSTRING ((Length Labs_List_fld.Value) - (Length "Right: ")) CHARACTERS STARTING AT 8 FROM Labs_List_fld.Value;
+ endif;
+
+ Labs_List_fld.Value := new_string;
+
+ rt_side_loc2 := FIND "Right: " IN STRING Cytology_List_fld.Value;
+ if (rt_side_loc2 = 0) then
+ lt_side_loc2 := FIND "Left: " IN STRING Cytology_List_fld.Value;
+ if (lt_side_loc2 > 0) then
+ new_string2 := SUBSTRING ((LENGTH Cytology_List_fld.Value) - (LENGTH "Left: ")) CHARACTERS STARTING AT 7 FROM Cytology_List_fld.Value;
+ endif;
+ else
+ new_string2 := SUBSTRING ((LENGTH Cytology_List_fld.Value) - (LENGTH "Right: ")) CHARACTERS STARTING AT 8 FROM Cytology_List_fld.Value;
+ endif;
+
+ Cytology_List_fld.Value := new_string2;
+
+ if (Labs_Right_Left_fld.Value matches pattern "%Left%") then
+ Labs_Right_Left2_fld.Value := "Fluid Collected Left Side (LEFT)";
+ lab_side := "Left: ";
+ elseif (Labs_Right_Left_fld.Value matches pattern "%Right%") then
+ Labs_Right_Left2_fld.Value := "Fluid Collected Right Side (RI)";
+ lab_side := "Right: ";
+ endif;
+
+ if (Labs_List_fld.Value is not null) then
+ Labs_List_fld.Value := lab_side || Labs_List_fld.Value;
+ endif;
+ if (Cytology_List_fld.Value is not null) then
+ Cytology_List_fld.Value := lab_side || Cytology_List_fld.Value;
+ endif;
+ //Applies to Order Set Thoracentesis Specimen Handling for CCM (Dr. Fino)
+ elseif (CallingField = "CCM Left Thoracentesis|1" OR CallingField = "CCM Right Thoracentesis|1"
+ OR CallingField = "CCM L/R Thoracentesis|1") then
+
+ (this_communication, this_form) := call ccm_thoracentesis with (this_communication, this_form, client_info_obj);
+
+ //Populate with all right, left, or both labs
+ if (CallingField = "CCM Left Thoracentesis|1") then
+ if (CCM_Left_Thor_fld_List = true) then
+ for i in 1 seqto (Count CCM_Left_Labs_List.Name) do
+ if (not (CCM_Left_Labs_List.Name[i] matches pattern "%Cytology%")) then
+ if (Labs_List_fld.Value IS NULL) then
+ Labs_List_fld.Value := "Left side: " || CCM_Left_Labs_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ else
+ if (Cytology_List_fld.Value IS NULL) then
+ Cytology_List_fld.Value := "Left side: " || CCM_Left_Labs_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ endif;
+ enddo;
+ else
+ Labs_List_fld.Value := null;
+ Cytology_List_fld.Value := null;
+ endif;
+ elseif (CallingField = "CCM Right Thoracentesis|1") then
+ if (CCM_Right_Thor_fld_List = true) then
+
+ for i in 1 seqto (count CCM_Right_Labs_List.Name) do
+ if (not (CCM_Right_Labs_List.Name[i] matches pattern "%Cytology%")) then
+ if (Labs_List_fld.Value IS NULL) then
+ Labs_List_fld.Value := "Right side: " || CCM_Right_Labs_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Right_Labs_List.Name[i];
+ endif;
+ else
+ if (Cytology_List_fld.Value IS NULL) then
+ Cytology_List_fld.Value := "Right side: " || CCM_Right_Labs_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Right_Labs_List.Name[i];
+ endif;
+ endif;
+ enddo;
+ else
+ Labs_List_fld.Value := null;
+ Cytology_List_fld.Value := null;
+ endif;
+ elseif (CallingField = "CCM L/R Thoracentesis|1") then
+ if (CCM_LR_Thor_fld_List = true) then
+ for i in 1 seqto (count CCM_Left_Labs_List.Name) do
+ if (not (CCM_Left_Labs_List.Name[i] matches pattern "%Cytology%")) then
+ if (Labs_List_fld.Value IS NULL) then
+ Labs_List_fld.Value := "Left side: " || CCM_Left_Labs_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ else
+ if (Cytology_List_fld.Value IS NULL) then
+ Cytology_List_fld.Value := "Left side: " || CCm_Left_Labs_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ endif;
+ enddo;
+ for j in 1 seqto (count CCM_Right_Labs_List.Name) do
+ if (not (CCM_Right_Labs_List.Name[j] matches pattern "%Cytology%")) then
+ if (not (Labs_List_fld.Value matches pattern "%Right side:%")) then
+ Labs_List_fld.Value := Labs_List_fld.Value || CR || LF || "Right side: " || CCM_Right_Labs_List.Name[j];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Right_Labs_List.Name[j];
+ endif;
+ else
+ if (not (Cytology_List_fld.Value matches pattern "%Right side:%")) then
+ Cytology_List_fld.Value := Cytology_List_fld.Value || CR || LF || "Right side: " || CCM_Right_Labs_List.Name[j];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Right_Labs_List.Name[j];
+ endif;
+ endif;
+ enddo;
+ else
+ Labs_List_fld.Value := null;
+ Cytology_List_fld.Value := Null;
+ endif;
+ endif;
+ //Applies to Order Set Thoracentesis Specimen Handling for CCM (Dr. Fino)
+ elseif (CallingField = "MultiOrderCheckbox|2" OR CallingField = "MultiOrderCheckbox|3") then
+ Labs_List_fld.Value := "";
+ Cytology_List_fld.Value := "";
+ for i in 1 seqto (count CCM_Left_Labs_List.Name) do
+ if (not (CCM_Left_Labs_List.Name[i] matches pattern "%Cytology%")) then
+ if (CCM_Left_Labs_List.IsSelected[i]) then
+ if (Labs_List_fld.Value = "") then
+ Labs_List_fld.Value := "Left side: " || CCM_Left_Labs_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ endif;
+ else
+ if (CCM_Left_Labs_List.IsSelected[i]) then
+ if (Cytology_List_fld.Value = "") then
+ Cytology_List_fld.Value := "Left side: " || CCM_Left_Labs_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ endif;
+ endif;
+ enddo;
+ for j in 1 seqto (count CCM_Right_Labs_List.Name) do
+ if (not (CCM_Right_Labs_List.Name[j] matches pattern "%Cytology%")) then
+ if (CCM_Right_Labs_List.IsSelected[j]) then
+ if (not (Labs_List_fld.Value matches pattern "%Right side:%")) then
+ Labs_List_fld.Value := Labs_List_fld.Value || CR || LF || "Right side: " || CCM_Right_Labs_List.Name[j];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Right_Labs_List.Name[j];
+ endif;
+ endif;
+ else
+ if (CCM_Right_Labs_List.IsSelected[j]) then
+ if (not (Cytology_List_fld.Value matches pattern "%Right side:%")) then
+ Cytology_List_fld.Value := Cytology_List_fld.Value || CR || LF || "Right side: " || CCM_Right_Labs_List.Name[j];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Right_Labs_List.Name[j];
+ endif;
+ endif;
+ endif;
+ enddo;
+ endif;
+ elseif (CallingEvent = "FormClose") then
+ if (Labs_List_fld.Value = "Left:" OR Labs_List_fld.Value = "Right:") then
+ Labs_List_fld.Value := "";
+ endif;
+ if (Cytology_List_fld.Value = "Left:" OR Cytology_List_fld.Value = "Right:") then
+ Cytology_List_fld.Value := "";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PARKINSONS_MED_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PARKINSONS_MED_ORDERS.mlm
new file mode 100644
index 0000000..4146504
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PARKINSONS_MED_ORDERS.mlm
@@ -0,0 +1,236 @@
+maintenance:
+
+ title: Parkinson{{{SINGLE-QUOTE}}}s Medication Orders;;
+ mlmname: FORM_Set_Parkinsons_Med_Orders;;
+ arden: version 2;;
+ version: 15.10;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2016-01-06;;
+ validation: testing;;
+
+library:
+ purpose: Used for medications orders for parkinson{{{SINGLE-QUOTE}}}s disease to allow user to easily enter non standard schedules
+ and creating a from their selections.
+ ;;
+
+ explanation: This MLM is called from the order set form PRX_OSParkinsonMed
+
+
+ Change history
+
+ 10.04.2016 TMS Initial build CSR 34278
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+
+ ;;
+ keywords: Called MLMs, parkinson{{{SINGLE-QUOTE}}}s
+ ;;
+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;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ //using "ObjectsPlusXA.SCM.Forms";
+ //using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Find the baseline order checkbox that may need to be ordered with this protocol
+
+ DoseA := last of (field_list where field_list.DataItemName = "MethotrexateDose" and field_List.Control_MultiFieldOccNum = 1);
+ DoseA_value := DoseA.value;
+ Dosage := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 1);
+ Dosage_val := dosage.value;
+ DosageUOM := first of (field_list where field_list.DataItemName = "UOM" and field_List.Control_MultiFieldOccNum = 1);
+ AltDaysDoseA := last of (field_list where field_list.DataItemName = "PRX_AltSchedule1" and field_List.Control_MultiFieldOccNum = 1);
+ AltDaysDoseA_list := AltDaysDoseA.value;
+ AdminTimesDoseA := last of (field_list where field_list.DataItemName = "PRX_TimeofDay" and field_List.Control_MultiFieldOccNum = 1);
+ AdminTimesDoseA_list := AdminTimesDoseA.value;
+ NonWeeklyFreqDoseA := last of (field_list where field_list.DataItemName = "PRX_NonWeeklySchedule" and field_List.Control_MultiFieldOccNum = 1);
+ NonWeeklyFreqDoseA_list := NonWeeklyFreqDoseA.value;
+ DoseADays := last of (field_list where field_list.DataItemName = "PRX_Scheddays1" and field_List.Control_MultiFieldOccNum = 1);
+ DoseATimes := last of (field_list where field_list.DataItemName = "PRX_SchedTimes" and field_List.Control_MultiFieldOccNum = 1);
+ UserSchedCB := last of (field_list where field_list.DataItemName = "PRX_Generic_CB" and field_List.Control_MultiFieldOccNum = 1);
+ UserSchedCB_value := UserSchedCB.value;
+ Frequency := last of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = 1);
+ Frequency_val := Frequency.value;
+ MedOrders := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+
+// if CallingEvent = "FormOpen" then
+
+
+
+ gridval := MedOrders.value;
+ index_list := 1 seqto (count gridval) ;
+
+ if exist MedOrders then
+ for S in index_list do
+ selorders1 := gridval.IsSelected [S];
+ if selorders1 = true then
+ medordername := Gridval.Name [S] ;
+ medorderguid := gridval.OrderCatalogMasterItemGUID [S];
+ endif;
+ enddo;
+ endif;
+
+
+ If callingevent = "FormOpen" then
+ AltDaysDoseA.control_read_only := True;
+ AdminTimesDoseA.control_read_only := True;
+
+ (defaultdose, defaultuom) := read last
+ { " select me.dosagelow, me.uom from CV3OrderCatalogItem oci "
+ || " join CV3MedicationExtension me on me.guid = oci.OrderGUID "
+ || " where oci.Modifier = {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} and oci.OrderMasterItemGUID = " || medorderguid
+ };
+
+ ordertemplateguid := read last { "select OrderGUID from CV3OrderCatalogItem where OrderMasterItemGUID = " || medorderguid || " and Modifier = {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} " };
+
+ If ordertemplateguid is not null then
+
+ (defaultdose_uddi) := read last
+ { "select oud.Value from CV3order o "
+ || "join CV3OrderUserData oud on oud.OrderGUID = o.guid "
+ || "where o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and o.GUID = " ||ordertemplateguid
+ || " and o.OrderCatalogMasterItemGUID = " || medorderguid
+ || "and oud.UserDataCode = {{{SINGLE-QUOTE}}}PRX_Default_Dose{{{SINGLE-QUOTE}}} "
+ || "and oud.value is not null "};
+
+ (defaultuom_uddi) := read last
+ { " select oud.Value from CV3order o "
+ || " join CV3OrderUserData oud on oud.OrderGUID = o.guid "
+ || " where o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and o.GUID = " ||ordertemplateguid
+ || " and o.OrderCatalogMasterItemGUID = " || medorderguid
+ || " and oud.UserDataCode = {{{SINGLE-QUOTE}}}PRX_Default_UOM{{{SINGLE-QUOTE}}} "
+ || " and oud.value is not null "};
+
+ endif;
+
+ If defaultdose is not null then
+ dosage.value := defaultdose;
+ elseif defaultdose_uddi is not null then
+ dosage.value := defaultdose_uddi;
+ endif;
+
+ If defaultuom is not null then
+ dosageuom.value := defaultuom;
+ elseif defaultuom_uddi is not null then
+ dosageuom.value := defaultuom_uddi;
+ endif;
+
+ endif; //CallingEvent = "FormOpen"
+
+ If CallingEvent = "FieldChange" or CallingEvent = "FormClose" Then
+
+ //Make appropriate fields available on the form for weekly and one time frequencies
+
+ If CallingField = "PRX_Generic_CB|1" then
+
+ If UserSchedCB.Value = true then
+ AltDaysDoseA.control_read_only := False;
+ AdminTimesDoseA.control_read_only := False;
+ Frequency_val.frequencysummary := Null;
+ Frequency.control_read_only := True;
+ Frequency.control_mandatory := false;
+ NonWeeklyFreqDoseA.control_read_only := true;
+ NonWeeklyFreqDoseA.value:= Null;
+
+
+
+ elseif UserSchedCB_Value = false then
+ AltDaysDoseA.value := Null;
+ AltDaysDoseA.control_read_only := True;
+ AdminTimesDoseA.control_read_only := True;
+ AdminTimesDoseA.value := Null;
+ DoseADays.value := "None";
+ DoseATimes.value := "None";
+ NonWeeklyFreqDoseA.control_read_only := false;
+ Frequency.control_read_only := False;
+ Frequency.control_mandatory := True;
+
+ endif;
+
+
+
+ endif;
+
+
+ // Determine the day of the week for today and the following 6 days
+
+ ThisTime := (now as time) ;
+ FormatDate := extract month ThisTime ||"-" || extract day ThisTime ||"-" ||extract year ThisTime;
+ ThisDay := extract year ThisTime || "-" || extract month ThisTime ||"-" || extract day ThisTime;
+ DayofWeek1 := read last {"SELECT DATENAME(dw, GETDATE ())"};
+ DayofWeek2 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,1,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek3 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,2,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek4 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,3,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek5 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,4,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek6 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,5,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek7 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,6,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+
+
+
+ If CallingField = "PRX_TimeofDay|1" then
+
+ if AdminTimesDoseA.value is not null then
+ DoseATimes.value := AdminTimesDoseA_list;
+ (adminlist) := call str_parse with AdminTimesDoseA_list,",";
+ admin_count := count adminlist;
+ DoseADays.value := "AllDays";
+
+ endif;
+ endif;
+ endif; //CallingEvent = "FieldChange" or CallingEvent = "FormClose"
+
+ If CallingEvent = "FormClose" then
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PCA_DILAUDID_SHORTAGE.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PCA_DILAUDID_SHORTAGE.mlm
new file mode 100644
index 0000000..319ca15
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PCA_DILAUDID_SHORTAGE.mlm
@@ -0,0 +1,162 @@
+maintenance:
+
+ title: FORM_SET_PCA_DILAUDID_SHORTAGE ;;
+ mlmname: FORM_SET_PCA_DILAUDID_SHORTAGE ;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: St Clair Hospital;;
+ date: 2018-03-20;;
+ validation: testing;;
+
+library:
+ purpose: Notify user of inability to order PCA-Hydromorphone due to nationwide shortage.
+ When shortage is over remove MLM from production, Remove call from Form Open and Form Close on
+ OS_PCA Dilaudid Order Form and Change Form Close MLM to FORM_SET_Rx_Medication_Order_Mgt
+;;
+
+ explanation:
+
+ Change history
+ 03.20.2018 TMS CSR 36531 Moved to production 4/19/2018
+ 10.17.2018 TMS CSR 37151 Removed from production - shortage resolved
+ 05.06.2019 TMS CSR 38270 Reinstate MLM to production status and modify informational text to
+ include intermittent Hydromorphone as an alternative during shortage.
+
+ ;;
+ keywords: PCA Hydromorphone, PCA Dilaudid
+ ;;
+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";
+
+ // 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;
+
+ comm_obj := this_communication.primaryobj;
+ /*******************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:="";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 FORMATTED WITH "%C" ;
+ TAB2 := TAB || TAB ;
+ TAB3 := TAB || TAB || TAB;
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+
+
+
+ //Form fields
+ IV_Access_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 7 );
+ PCA_Dilaudid_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ PCA_Conc_Dilaudid_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ AND field_list.Control_MultiFieldOccNum = 3 );
+ Nurse_Instructions:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Pulse_Ox_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 8 );
+ Respiratory_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ Narcan_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Notify_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 9 );
+
+ IV_Access_Orders_Value := IV_Access_Orders.Value;
+ PCA_Dilaudid_Orders_Value := PCA_Dilaudid_Orders.Value;
+ PCA_Conc_Dilaudid_Orders_Value := PCA_Conc_Dilaudid_Orders.Value ;
+ Nurse_Instructions_Value := Nurse_Instructions.Value;
+ Pulse_Ox_Orders_Value := Pulse_Ox_Orders.Value;
+ Respiratory_Orders_Value := Respiratory_Orders.Value;
+ Narcan_Orders_Value := Narcan_Orders.Value;
+ Notify_Orders_Value := Notify_Orders.Value;
+
+
+
+ If CallingEvent = "FormOpen" then
+ ShortageDialog := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\nHYDROmorphone PCA is unavailable due to a nationwide shortage. \n\nPlease consider Morphine PCA or intermittent IV HYDROmorphone or Morphine.","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+
+ IV_Access_Orders_Value.IsSelected := false;
+ IV_Access_Orders_Value.IsReadOnly := true;
+ PCA_Dilaudid_Orders_Value.IsReadOnly := (true, true, true) ;
+ PCA_Dilaudid_Orders_Value.IsSelected := (false, false, false);
+ PCA_Conc_Dilaudid_Orders_Value.IsReadOnly := (true, true, true, true, true);
+ PCA_Conc_Dilaudid_Orders_Value.IsSelected:= (false, false, false, false, false) ;
+ Nurse_Instructions_Value.IsSelected:= (false, false, false);
+ Nurse_Instructions_Value.IsReadOnly:= (true, true, true) ;
+ Pulse_Ox_Orders_Value.IsSelected:= (false);
+ Pulse_Ox_Orders_Value.IsReadOnly := (true);
+ Respiratory_Orders_Value.IsSelected:= (false);
+ Respiratory_Orders_Value.IsReadOnly := (true);
+ Narcan_Orders_Value.IsSelected := (false);
+ Narcan_Orders_Value.IsReadOnly := (true);
+ Notify_Orders_Value.IsSelected:= (false);
+ Notify_Orders_Value.IsReadOnly := (true);
+ endif;
+
+ If CallingEvent = "FormClose" then
+
+ index_list := 1 seqto (count IV_Access_Orders_Value) ;
+
+ allvalues := ();
+ allreadonly := ();
+ for S in index_list do
+ selorders := IV_Access_Orders_Value.IsSelected [S];
+ //if selorders = true then
+ //allvalues := allvalues, False;
+ //allreadonly := allreadonly, True;
+ //else
+ allvalues := allvalues, False;
+ allreadonly := allreadonly, True;
+ enddo;
+
+ IV_Access_Orders_Value.IsSelected := allvalues;
+ IV_Access_Orders_Value.IsReadOnly := allreadonly;
+ If s > 2 then
+ NoOrdersDialog := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n No orders will be entered from the PCA Hydromorphone Order Set.","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PEDIATRIC_IV_RATE.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PEDIATRIC_IV_RATE.mlm
new file mode 100644
index 0000000..eb0945d
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PEDIATRIC_IV_RATE.mlm
@@ -0,0 +1,106 @@
+maintenance:
+
+ title: FORM_SET_PEDIATRIC_IV_RATE;;
+ mlmname: FORM_SET_PEDIATRIC_IV_RATE;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Don Warnick, Allscripts ;;
+ specialist: Bryan Berkeybile, Allscripts;;
+ date: 2013-08-02;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+
+ explanation: This MLM is called from the IV Fluid Order Set, Pediatric IV Bolus grid. The MLM updates
+ the rate field on the IV Infusion Orders form with 20x the most recent patient weight in kg.
+ We needed to add the MLM_From Order Set field to the OS and form to make the value visible
+ in the grid.
+
+ Change history
+ 2013.08.02 DJW CSR 13570 Created
+
+ ;;
+ keywords: Called MLMs
+ ;;
+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";
+
+ // 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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ChartGuid := this_communication.ChartGUID;
+ FormName := this_form.Name;
+
+ //Retrieve Fields
+
+ IV := last of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 2);
+ IV_List := IV.Value;
+
+ CombinedMeasurements := first of (field_list WHERE field_list.DataItemName = "CombinedMeasurements");
+ CombinedMeasurements_fld := CombinedMeasurements.Value;
+ patient_weight := CombinedMeasurements_fld.Weight;
+
+ if (CallingEvent = "FieldChange")
+
+ then
+
+ If (CallingField = "CombinedMeasurements|1")
+ then
+
+ if (patient_weight > 0)
+ then
+ IV_List.IsReadOnly := (false);
+ endif;
+
+ elseif (CallingField = "Multiordergrid|2") and (patient_weight = 0)
+
+ then
+ IV_List.IsReadOnly := (true);
+ IV_List.IsSelected := (false);
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please enter a calculation weight for this patient. ", "Error","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PEDIATRIC_PACU_MEDS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PEDIATRIC_PACU_MEDS.mlm
new file mode 100644
index 0000000..0ffbca2
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PEDIATRIC_PACU_MEDS.mlm
@@ -0,0 +1,303 @@
+maintenance:
+
+ title: FORM_SET_Pediatric_PACU_Meds;;
+ mlmname: FORM_SET_Pediatric_PACU_Meds;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Peggy Leschak;;
+ date: 2017-09-05;;
+ validation: testing;;
+
+library:
+ purpose: Provide Pediatric Dose Amounts based upon patient weight and/or age
+ ;;
+
+ explanation:
+
+ Change history
+ 04.09.2018 TMS CSR 35320 - Created for PACU Pedatric Medication Dose Calculation
+
+ ;;
+ keywords: PACU, weight based, pediatric
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ // local_session := CDS_SESSION.local;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ // 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;
+
+ comm_obj := this_communication.primaryobj;
+ /*******************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:="";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 FORMATTED WITH "%C" ;
+ TAB2 := TAB || TAB ;
+ TAB3 := TAB || TAB || TAB;
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+
+
+
+ //Form fields
+ CurrWeight := last of ( field_list WHERE field_list.DataItemName = "CombinedMeasurements"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Morphine_Mod := last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Morphine_Sev := last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ Hydromorphone_Mod:= last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 3 );
+ Hydromorphone_Sev:= last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 4 );
+ Fentanyl_Mod:= last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 5 );
+ Fentanyl_Sev:= last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 6 );
+ Oxycodone_Liq:= last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 7 );
+ Oxycodone_Tab:= last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 8 );
+ Ketorolac := last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 9 );
+ Acetaminophen_Oral:= last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 10 );
+ Acetaminophen_Rectal:= last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 11 );
+ Meperidine := last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 12 );
+ Metoclopramide := last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 13 );
+ Ondansetron_IV := last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 14 );
+ Midazolam := last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 15 );
+ RacemicEpi := last of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 16 );
+
+ Morphine_Mod_Note := last of ( field_list WHERE field_list.DataItemName = "PRX_NoteComment0"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Morphine_Sev_Note := last of ( field_list WHERE field_list.DataItemName = "PRX_NoteComment0"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ Hydromorphone_Mod_Note := last of ( field_list WHERE field_list.DataItemName = "PRX_NoteComment0"
+ AND field_list.Control_MultiFieldOccNum = 3 );
+ Hydromorphone_Sev_Note := last of ( field_list WHERE field_list.DataItemName = "PRX_NoteComment0"
+ AND field_list.Control_MultiFieldOccNum = 4 );
+ Fentanyl_Mod_Note := last of ( field_list WHERE field_list.DataItemName = "PRX_NoteComment0"
+ AND field_list.Control_MultiFieldOccNum = 5 );
+ Fentanyl_Sev_Note := last of ( field_list WHERE field_list.DataItemName = "PRX_NoteComment0"
+ AND field_list.Control_MultiFieldOccNum = 6 );
+ Acetaminophen_Stat_Note := last of ( field_list WHERE field_list.DataItemName = "AdminInstructions"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Acetaminophen_Note := last of ( field_list WHERE field_list.DataItemName = "AdminInstructions"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ AcetaminophenOrders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 6 );
+ Ondansetron_Note := last of ( field_list WHERE field_list.DataItemName = "PRX_NoteComment0"
+ AND field_list.Control_MultiFieldOccNum = 8 );
+ AcetaminophenGrid := AcetaminophenOrders.value;
+ Metoclopramide_Note := last of ( field_list WHERE field_list.DataItemName = "PRX_NoteComment0"
+ AND field_list.Control_MultiFieldOccNum = 7 );
+ RacemicEpi_Note := last of ( field_list WHERE field_list.DataItemName = "PRX_NoteComment0"
+ AND field_list.Control_MultiFieldOccNum = 9 );
+
+
+ if exists CurrWeight then
+ CurrWeight_val := CurrWeight.Value;
+ wt := CurrWeight_val.weight;
+ fmtwt := wt formatted with "%.1f";
+ else
+ wtgm := read last
+ { " Select Text from CV3PhysicalNoteDeclaration "
+ || " where ClientGUID = " || SQL(clientguid)
+ || " and ClientVisitGUID = " || SQL(clientvisitguid)
+ || " and TypeCode = {{{SINGLE-QUOTE}}}weight{{{SINGLE-QUOTE}}} "
+ || " order by Entered asc " };
+ wt := (wtgm as number) / 1000;
+ fmtwt := wt formatted with "%.1f";
+ endif;
+
+ Calc_0_005 := (wt as number) * 0.005;
+ Calc_0_01 := (wt as number) * 0.01;
+ Calc_0_03 := (wt as number) * 0.03;
+ Calc_0_05 := (wt as number) * 0.05;
+ Calc_0_15 := (wt as number) * 0.15;
+ Calc_0_1 := (wt as number) * 0.1;
+ Calc_0_3 := (wt as number) * 0.3;
+ Calc_0_5 := (wt as number) * 0.5;
+ Calc_1_5 := (wt as number) * 1.5;
+ Calc_15 := (wt as number) * 15;
+
+
+ Calc_3 := wt * 3;
+ Calc_5 := wt * 5;
+ Calc_1 := wt * 1;
+ Calc_15 := wt * 15;
+
+ rnd_Calc_0_03:= (int((Calc_3 + 2.5)/5) * 5) /100;
+ rnd_Calc_0_05:= (int((Calc_5 + 2.5)/5) * 5) /100;
+ rnd_Calc_0_005:= (int((Calc_5 + 25)/50) * 50) /1000;
+ rnd_Calc_0_01:= (int((Calc_1 + 2.5)/5) * 5) /100;
+ rnd_Calc_0_3:= (int((Calc_3 + 0.5)/1) * 1) / 10;
+ rnd_Calc_0_5:= (int((Calc_5 + 0.5)/1) * 1) / 10;
+ rnd_Calc_0_15 := (int((Calc_15 + 50)/100) * 100) / 100;
+ rnd_Calc_1_5 := (int((Calc_15 + 5)/10) * 10) / 10;
+ rnd_Calc_0_1 := (int((Calc_1 + 0.5)/1) * 1) / 10;
+ Morphine_Mod.Value := rnd_Calc_0_03 as number;
+ Morphine_Sev.Value := rnd_Calc_0_05 as number;
+ Hydromorphone_Mod.Value := rnd_Calc_0_005 as number;
+ Hydromorphone_Sev.Value := rnd_Calc_0_01 as number;
+ Fentanyl_Mod.Value := rnd_Calc_0_3 as number;
+ Fentanyl_Sev.Value := rnd_Calc_0_5 as number;
+ Metoclopramide.Value := rnd_Calc_0_1 as number;
+ Acetaminophen_ml := (Int((((Calc_15 / 32) * 10) + 2.5)/5) *5) /10 ;
+
+
+
+ Morphine_Mod_Note.Value := "Morphine 0.03 mg/kg (" ||rnd_Calc_0_03 || " mg)" || CRLF
+ || "(Maximum Dose: 0.15 mg/kg (" || rnd_Calc_0_15 || " mg) TOTAL of all Morphine administered in PACU)";
+
+ Morphine_Sev_Note.Value := "Morphine 0.05 mg/kg (" ||rnd_Calc_0_05 || " mg)" || CRLF
+ || "(Maximum Dose: 0.15 mg/kg (" || rnd_Calc_0_15 || " mg) TOTAL of all Morphine administered in PACU)";
+
+
+ Hydromorphone_Mod_Note.Value := "Hydromorphine 0.005 mg/kg (" || rnd_Calc_0_005 || " mg)" || CRLF
+ || "(Maximum Dose: 0.03 mg/kg (" || rnd_Calc_0_03 || " mg) TOTAL)";
+
+ Hydromorphone_Sev_Note.Value := "Hydromorphine 0.01 mg/kg (" || rnd_Calc_0_01 || " mg)" || CRLF
+ || "(Maximum Dose: 0.03 mg/kg (" || rnd_Calc_0_03 || " mg) TOTAL)";
+
+
+ Fentanyl_Mod_Note.Value := "Fentanyl 0.3 mcg/kg (" || rnd_Calc_0_3 || " mcg)" || CRLF
+ || "(Maximum Dose: 1.5 mcg/kg (" || rnd_Calc_1_5 || " mcg) TOTAL)";
+
+ Fentanyl_Sev_Note.Value := "Fentanyl 0.5 mcg/kg (" || rnd_Calc_0_5 || " mcg)" || CRLF
+ || "(Maximum Dose: 1.5 mcg/kg (" || rnd_Calc_1_5 || " mcg) TOTAL)";
+
+ Metoclopramide_Note.Value := "Metoclopramide 0.1 mg/kg (" || rnd_Calc_0_1 || " mg)" || CRLF
+ || "(Maximum Dose: 10 mg)";
+
+
+
+ If (Calc_0_5 as number) < 30 then
+ Ketorolac.Value := rnd_Calc_0_5 as number;
+ else
+ Ketorolac.Value := 30;
+ endif;
+
+ Acetaminophen_Oral.Value := (Acetaminophen_ml as number) * 32;
+ Acetaminophen_Stat_Note.Value := "PACU ONLY. Give upon arrival in PACU. Acetaminophen 15 mg/kg. May give through NG tube."|| CRLF
+ || Acetaminophen_Oral.Value || " mg = " || Acetaminophen_ml || " ml";
+ Acetaminophen_Note.Value := "PACU ONLY. For Mild pain score of 1-3. Acetaminophen 15 mg/kg. May give through NG tube."|| CRLF
+ || Acetaminophen_Oral.Value || " mg = " || Acetaminophen_ml || " ml";
+ If (Calc_15 as number) > 0 and (Calc_15 as number) <= 300 then
+ Acetaminophen_Rectal.Value := 120;
+ AcetaminophenGrid.IsReadOnly := (False, False, False, True, True);
+ Elseif (Calc_15 as number) > 300 and (Calc_15 as number) <= 645 then
+ Acetaminophen_Rectal.Value := 325;
+ AcetaminophenGrid.IsReadOnly := (False, False, True, False, True);
+ Elseif (Calc_15 as number) > 645 then
+ Acetaminophen_Rectal.Value := 650;
+ AcetaminophenGrid.IsReadOnly := (False, False, True, True, False );
+ else
+ AcetaminophenGrid.IsReadOnly := (False, False, False, False, False);
+ endif;
+
+
+ If (Calc_0_5 as number) >= 50 then
+ Meperidine.Value := 50;
+ Else
+ Meperidine.Value := rnd_Calc_0_5 as number;
+ endif;
+
+ If (rnd_Calc_0_1 as number) >= 10 then
+ Metoclopramide.Value := 10;
+ Else
+ Metoclopramide.Value := rnd_Calc_0_1 as number;
+ endif;
+
+ If (wt as number)> 0 and (wt as number)< 10 then
+ Ondansetron_IV.value := rnd_Calc_0_1 as number;
+ Ondansetron_Note.value := "Patients less than 10 kg. 0.1 mg/kg (" ||rnd_Calc_0_1 || "). ";
+ elseif (wt as number)>= 10 and (wt as number)< 20 then
+ Ondansetron_IV.value := 1;
+ Ondansetron_Note.value := "Patients 10 to less than 20 kg.";
+ elseif (wt as number)>= 20 and (wt as number)< 30 then
+ Ondansetron_IV.value := 2;
+ Ondansetron_Note.value := "Patients 20 to less than 30 kg.";
+ elseif (wt as number)>= 30 and (wt as number)< 40 then
+ Ondansetron_IV.value := 3;
+ Ondansetron_Note.value := "Patients 30 to less than 40 kg.";
+ elseif (wt as number)>= 40 then
+ Ondansetron_IV.value := 4;
+ Ondansetron_Note.value := "Patients 40 kg or greater.";
+ endif;
+
+ If (Calc_0_05 as number) >= 2 then
+ Midazolam.Value := 2;
+ Else
+ Midazolam.Value := rnd_Calc_0_05 as number;
+ endif;
+
+ If (Calc_0_05 as number) >= 0.5 then
+ RacemicEpi.Value := 0.5;
+ RacemicEpi_Note.Value := "PACU ONLY. Racemic Epinephrine Inhalation 0.05 ml/kg/dose equals " ||RacemicEpi.Value || " ml diluted to 3 ml with normal saline over 15 min (MAXIMUM TOTAL DOSE Racemic Epinephrine: 0.5 ml)";
+ Else
+ RacemicEpi.Value := rnd_Calc_0_05 as number;
+ RacemicEpi_Note.Value := "PACU ONLY. Racemic Epinephrine Inhalation 0.05 ml/kg/dose equals " ||RacemicEpi.Value || " ml diluted to 3 ml with normal saline over 15 min (MAXIMUM TOTAL DOSE Racemic Epinephrine: 0.5 ml)";
+ endif;
+
+
+ If CurrWeight_val.Weight = 0 then
+
+ this_communication.Message := "Please enter a weight on this patient to continue." ; this_communication.MessageType := "Informational";
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PEDIATRIC_PROFILE_ADMISSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PEDIATRIC_PROFILE_ADMISSION.mlm
new file mode 100644
index 0000000..07843f3
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PEDIATRIC_PROFILE_ADMISSION.mlm
@@ -0,0 +1,398 @@
+maintenance:
+
+ title: Pediatric Profile Admission Order Set;;
+ mlmname: FORM_Set_Pediatric_Profile_Admission;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Peggy Karish, Eclipsys Corp ext 7441;;
+ date: 2008-04-10;;
+ validation: testing;;
+
+library:
+ purpose: Used for grids that perform all true or no risk
+
+ ;;
+
+ explanation: This MLM is called from the Patient Profile- Adult Admission Orders
+ ;;
+ keywords: Called MLMs, Respiratory ORder Set, Adult Admission
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ If CallingField = "MultiOrderCheckBox|1" then
+ NoRisk := "No Diagnosis Risk Criteria";
+ OccNumber := 1;
+ Elseif CallingField = "MultiOrderCheckBox|2" then
+ NoRisk := "No Discharge Risk Criteria";
+ OccNumber := 2;
+ Elseif CallingField = "MultiOrderCheckBox|3" then
+ NoRisk := "No Functional Risk Criteria";
+ OccNumber :=3;
+ Elseif CallingField = "MultiOrderCheckBox|7" then
+ NoRisk := "No Smoking Risk";
+ OccNumber := 7;
+ Elseif CallingField = "MultiOrderCheckBox|9" then
+ NoRisk := "No Pediatric Nutritional Risk";
+ OccNumber := 9;
+ Elseif CallingField = "MultiOrderCheckBox|10" then
+ NoRisk := "No Parent Smoking Risk";
+ OccNumber := 10;
+ endif;
+
+ // Now do True and false logic for EVERY grid on this form
+
+ //Get the multi order grid check box value
+ Grid_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = OccNumber);
+ Grid_list :=Grid_fld.Value;
+ Grid_SelList := Grid_List.IsSelected;
+
+ Found_NoRisk:= First of (Grid_list where Grid_list.Name = NoRisk );
+
+ ListMembs:= count Grid_SelList;
+ AllButNo:= ();
+ FalseList := ();
+ TrueList := ();
+ for k in (1 seqto (ListMembs-1)) do
+ AllButNo:= AllButNo, Grid_SelList[k];
+ FalseList := FalseList,False;
+ TrueList := TrueList ,True;
+ enddo;
+
+ OneOfRest := true in AllButNo;
+
+ If Found_NoRisk.IsSelected = True then
+ Grid_List.IsSelected:= FalseList , True;
+ Grid_List.IsReadOnly:= TrueList , False;
+ endif;
+
+ If (Found_NoRisk.IsSelected = False) and (OneOfRest = False) then // deselected No Risk
+ Grid_List.IsSelected := FalseList , False;
+ Grid_List.IsReadOnly := FalseList , False;
+ Endif;
+
+ If (OneOfRest = True) and (Found_NoRisk.IsSelected = False) then
+ Found_NoRisk.IsSelected := False;
+ Found_NoRisk.IsReadOnly := True;
+ endif;
+
+
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Now for the extras per grid //
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ If CallingField = "MultiOrderCheckBox|1" then
+ // Set the Order Set fields, comment and mapped to Dietitian Consult Reason
+ Set_Comment := last of (field_list where field_list.DataItemName = "NUR_ Comment 1 line");
+ Set_ConReason := last of (field_list where field_list.DataItemName = "NUTR_Consult Reasons");
+
+ If Found_NoRisk.IsSelected = True then
+ Set_Comment.Value := "";
+ Endif;
+
+ //Get the order set value
+ PrevCon_Fld := last of (field_list where field_list.DataItemName = "NUR_CheckBox");
+ PrevCon_Value := PrevCon_Fld.Value;
+
+ Grid_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = OccNumber);
+ Grid_list :=Grid_fld.Value;
+ Found_NODOrder:= first of (Grid_list where Grid_list.Name = "New Onset Diabetes");
+ NOD_Selected:= Found_NODOrder.IsSelected;
+
+ //If they are the same, this grid check box did not change, hence do nothing
+ If PrevCon_Value = NOD_Selected
+ then
+ Tester:="Dont Do anything";
+ else
+ // Set the fields we are about to change as the New Onset Diabeters Box Changed
+ // First get the entire field components for the MultiOrdercheckBox
+ Consult_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Consult_list :=Consult_fld.Value;
+
+ // Pull out the Dietitian Data from the MultiOrder
+ Found_DietConOrder:= first of (Consult_list where Consult_list.Name = "Dietitian Consult");
+
+ // Peform logic based on the value of the New Order Diabetes
+ If NOD_Selected = True then
+ Found_DietConOrder.IsSelected := True;
+ Found_DietConOrder.IsReadOnly := True;
+ Set_Comment.Value := "By Selecting New Onset Diabetes- an order for a Dietitian Consult (New Onset Diabetes) has automatically been created";
+ Set_ConReason.Value := "New Onset Diabetes";
+ else
+ Found_DietConOrder.IsSelected := False;
+ Found_DietConOrder.IsReadOnly := False;
+ Set_Comment.Value := "By Deselecting New Onset Diabetes- the order for Dietitian Consult (New Onset Diabetes) has automatically been removed";
+ Set_ConReason.Value := "";
+ endif;
+
+ // Set set from field to record the new value of New Order Diabetes (can tell if it changes again)
+ PrevCon_Fld.Value:= NOD_Selected;
+ endif;
+ ElseIf CallingField = "MultiOrderCheckBox|7" then
+ SmokeCon_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 5);
+ SmokeCon_list :=SmokeCon_fld.Value;
+ Found_SmokeConOrder:= first of (SmokeCon_list where SmokeCon_list.Name = "Pulmonary Health Education Consult");
+
+ ParentSmok_fld :=last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 10);
+ ParentSmok_list :=ParentSmok_fld.Value;
+ ParentSmok_SelList := ParentSmok_list.IsSelected;
+ ParMembs:= count ParentSmok_SelList;
+ ParAllButNo:= ();
+ for k in (1 seqto (ParMembs-1)) do
+ ParAllButNo:= ParAllButNo, ParentSmok_SelList[k];
+ enddo;
+
+
+ ParOneTrue := True in (ParAllButNo);
+
+
+
+ Smoke_Comment := last of (field_list where field_list.DataItemName = "NUR_Comment 3");
+ Smoke_ConReason1 := last of (field_list where field_list.DataItemName = "RESP Pulmonary Health Education");
+ Smoke_ConReason2 := last of (field_list where field_list.DataItemName = "RESP Pulmonary Health Consult 2");
+
+ Found_UTBOrder:= first of (Grid_list where Grid_list .Name = "Patient Uses Tobacco");
+ UTB_Selected:= Found_UTBOrder.IsSelected;
+ Found_Less12Order := first of (Grid_list where Grid_list .Name = "Quit tobacco use in the last 12 months");
+ Less12_Selected := Found_Less12Order.IsSelected;
+
+ PrevUseToB_Fld := last of (field_list where field_list.DataItemName = "NUR_CheckBox 2");
+ PrevUseToB_Value := PrevUseToB_Fld.Value;
+
+ PrevLess12_Fld := last of (field_list where field_list.DataItemName = "NUR_CheckBox 3");
+ PrevLess12_Value:= PrevLess12_Fld.Value;
+
+
+ If (Found_NoRisk.IsSelected = True) then
+ If ParOneTrue = False then
+ Smoke_Comment.Value := "";
+ endif;
+ Smoke_ConReason1.Value := "";
+ endif;
+
+
+ If Less12_Selected = PrevLess12_Value then
+ Robert:="KEWL";
+ Else
+ If Less12_Selected = True then
+ Found_UTBOrder.IsReadOnly := True;
+ Found_SmokeConOrder.IsSelected := True;
+ Found_SmokeConOrder.IsReadOnly := True;
+ If ParOneTrue =False then
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult " ||
+ "(Quit Smoking in Last 12 Months) has automatically been created";
+ else
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult " ||
+ "(Quit Smoking in Last 12 Months, " || Smoke_ConReason2.Value ||
+ ") has automatically been created";
+ endif;
+ Smoke_ConReason1.Value := "Quit Smoking in Last 12 Months";
+ Else
+ Found_UTBOrder.IsReadOnly := False;
+ If ParOneTrue =False then
+ Found_SmokeConOrder.IsSelected := False;
+ Found_SmokeConOrder.IsReadOnly := False;
+ Smoke_Comment.Value := "By DeSelecting Smoking Risk Orders- an order for a Pulmonary Health Consult has automatically been removed";
+ else
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult (" ||
+ Smoke_ConReason2.Value || ") has automatically been created";
+ endif;
+ Smoke_ConReason1.Value := "";
+ Endif;
+ PrevLess12_Fld.Value:= Less12_Selected;
+ endif;
+
+ If UTB_Selected = PrevUseToB_Value then
+ Robert := "Still KEWL";
+ Else
+ If UTB_Selected = True then
+ Found_Less12Order.IsReadOnly := True;
+ Found_SmokeConOrder.IsSelected := True;
+ Found_SmokeConOrder.IsReadOnly := True;
+ If ParOneTrue =False then
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult " ||
+ "(Smoking Cessation) has automatically been created";
+ else
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult " ||
+ "(Smoking Cessation, " || Smoke_ConReason2.Value ||
+ ") has automatically been created";
+ endif;
+ Smoke_ConReason1.Value := "Smoking Cessation";
+ Else
+ Found_Less12Order.IsReadonly := False;
+ Found_UTBOrder.IsReadOnly := False;
+ If ParOneTrue =False then
+ Found_SmokeConOrder.IsSelected := False;
+ Found_SmokeConOrder.IsReadOnly := False;
+ Smoke_Comment.Value := "By DeSelecting Smoking Risk Orders- an order for a Pulmonary Health Consult has automatically been removed";
+ else
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult (" ||
+ Smoke_ConReason2.Value || ") has automatically been created";
+ endif;
+ Smoke_ConReason1.Value := "";
+ Endif;
+ PrevUseToB_Fld.Value := UTB_Selected;
+ endif;
+
+ ElseIf CallingField = "MultiOrderCheckBox|10" then
+ SmokeCon_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 5);
+ SmokeCon_list :=SmokeCon_fld.Value;
+ Found_SmokeConOrder:= first of (SmokeCon_list where SmokeCon_list.Name = "Pulmonary Health Education Consult");
+
+ ParentSmok_fld :=last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 7);
+ ParentSmok_list :=ParentSmok_fld.Value;
+ ParentSmok_SelList := ParentSmok_list.IsSelected;
+ ParMembs:= count ParentSmok_SelList;
+ ParAllButNo:= ();
+ for k in (1 seqto (ParMembs-1)) do
+ ParAllButNo:= ParAllButNo, ParentSmok_SelList[k];
+ enddo;
+
+
+ ParOneTrue := True in (ParAllButNo);
+
+
+
+ Smoke_Comment := last of (field_list where field_list.DataItemName = "NUR_Comment 3");
+ Smoke_ConReason1 := last of (field_list where field_list.DataItemName = "RESP Pulmonary Health Education");
+ Smoke_ConReason2 := last of (field_list where field_list.DataItemName = "RESP Pulmonary Health Consult 2");
+
+ Found_UTBOrder:= first of (Grid_list where Grid_list .Name = "Parent Uses Tobacco");
+ UTB_Selected:= Found_UTBOrder.IsSelected;
+ Found_Less12Order := first of (Grid_list where Grid_list .Name = "Parent Quit Tobacco- Last 12 months");
+ Less12_Selected := Found_Less12Order.IsSelected;
+
+ PrevUseToB_Fld := last of (field_list where field_list.DataItemName = "NUR_CheckBox 4");
+ PrevUseToB_Value := PrevUseToB_Fld.Value;
+
+ PrevLess12_Fld := last of (field_list where field_list.DataItemName = "NUR_CheckBox 5");
+ PrevLess12_Value:= PrevLess12_Fld.Value;
+
+
+ If (Found_NoRisk.IsSelected = True) then
+ If ParOneTrue = False then
+ Smoke_Comment.Value := "";
+ endif;
+ Smoke_ConReason2.Value := "";
+ endif;
+
+
+ If Less12_Selected = PrevLess12_Value then
+ Robert:="KEWL";
+ Else
+ If Less12_Selected = True then
+ Found_UTBOrder.IsReadOnly := True;
+ Found_SmokeConOrder.IsSelected := True;
+ Found_SmokeConOrder.IsReadOnly := True;
+ If ParOneTrue =False then
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult " ||
+ "(Parent Quit Tobacco-Last 12 Months) has automatically been created";
+ else
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult " ||
+ "(" || Smoke_ConReason1.Value || ", Parent Quit Tobacco-Last 12 Months) has automatically been created";
+ endif;
+ Smoke_ConReason2.Value := "Parent Quit Tobacco-Last 12 Months";
+ Else
+ Found_UTBOrder.IsReadOnly := False;
+ If ParOneTrue =False then
+ Found_SmokeConOrder.IsSelected := False;
+ Found_SmokeConOrder.IsReadOnly := False;
+ Smoke_Comment.Value := "By DeSelecting Smoking Risk Orders- an order for a Pulmonary Health Consult has automatically been removed";
+ else
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult (" ||
+ Smoke_ConReason1.Value || ") has automatically been created";
+ endif;
+ Smoke_ConReason2.Value := "";
+ Endif;
+ PrevLess12_Fld.Value:= Less12_Selected;
+ endif;
+
+ If UTB_Selected = PrevUseToB_Value then
+ Robert := "Still KEWL";
+ Else
+ If UTB_Selected = True then
+ Found_Less12Order.IsReadOnly := True;
+ Found_SmokeConOrder.IsSelected := True;
+ Found_SmokeConOrder.IsReadOnly := True;
+ If ParOneTrue =False then
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult " ||
+ "(Parent Uses Tobacco) has automatically been created";
+ else
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult " ||
+ "(" || Smoke_ConReason1.Value || ", Parent Uses Tobacco) has automatically been created";
+ endif;
+
+ Smoke_ConReason2.Value := "Parent Uses Tobacco";
+ Else
+ Found_Less12Order.IsReadonly := False;
+ Found_UTBOrder.IsReadOnly := False;
+ If ParOneTrue =False then
+ Found_SmokeConOrder.IsSelected := False;
+ Found_SmokeConOrder.IsReadOnly := False;
+ Smoke_Comment.Value := "By DeSelecting Smoking Risk Orders- an order for a Pulmonary Health Consult has automatically been removed";
+ else
+ Smoke_Comment.Value := "By Selecting Smoking Risk Order(s)- an order for a Pulmonary Health Consult (" ||
+ Smoke_ConReason1.Value || ") has automatically been created";
+ endif;
+ Smoke_ConReason2.Value := "";
+ Endif;
+ PrevUseToB_Fld.Value := UTB_Selected;
+ endif;
+ endif;
+
+
+ /* this_communication.DisplayForm := "Yes";
+ this_communication.Message := "One Of Rest Selection is " || OneOfRest|| "\n\n" ||
+ "NoRisk Select" || Found_NoRisk.IsSelected || "\n\n" ||
+ "NoRisk Value " || Found_NoRisk.Value;
+ this_communication.MessageType := "Informational";
+*/
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PERICARDIOCENTESIS_LABS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PERICARDIOCENTESIS_LABS.mlm
new file mode 100644
index 0000000..61b8008
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PERICARDIOCENTESIS_LABS.mlm
@@ -0,0 +1,147 @@
+maintenance:
+
+ title: FORM_SET_PERICARDIOCENTESIS_LABS;;
+ mlmname: FORM_SET_PERICARDIOCENTESIS_LABS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Shawn Head, Allscripts ;;
+ specialist: Michelle Palmer, Allscripts;;
+ date: 2012-12-03;;
+ validation: testing;;
+
+library:
+ purpose: Lab orders entered on Pericarocentesis Order Sets need to display on MI and Cytology requisitions
+ ;;
+
+ explanation: This MLM is called from ...
+
+ Change history
+ 2012.12.03 STH CSR 30985: Created from copy of FORM_SET_THORACENTESIS_LABS {Go-Live 12/4/2018}
+
+
+
+ ;;
+ keywords: Called MLMs, Thoracentesis, Paracentesis
+ ;;
+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";
+
+ generic_item_control := mlm {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{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;
+
+
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ FormName := this_form.Name;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+
+ //Retrieve fields
+ Labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Labs_fld_List := Labs_fld.Value;
+
+ CT_Pericard_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 2);
+ CT_Pericard_fld_list := CT_Pericard_fld.Value;
+
+ Labs_List_fld := last of (field_list WHERE field_list.DataItemName = "Labs on Centesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ Cytology_List_fld := last of (field_list WHERE field_list.DataItemName = "Cytology on Centesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ lablist := null;
+ cytologylist := null;
+ if (CallingEvent = "FieldChange")then
+ if (CallingField = "MultiOrderGrid|2") then
+ if (CT_Pericard_fld_list.IsSelected[1] = true) then
+ Labs_fld.Value.IsSelected := true;
+ else
+ Labs_fld.Value.IsSelected := false;
+ endif;
+ endif;
+
+ (this_communication, this_form) := call generic_item_control WITH (this_communication, this_form, client_info_obj);
+ if (CT_Pericard_fld_list.IsSelected[1] = true) then
+ for i in 1 seqto (count Labs_fld_List.Name) do
+ if(Labs_fld.Value.IsSelected[i] = true) then
+ if (not (Labs_fld_List.Name[i] matches pattern "%Cytology%")) then
+ if (lablist IS NULL) then
+ lablist := Labs_fld_List.Name[i];
+ else
+ lablist := lablist || ", " || Labs_fld_List.Name[i];
+ endif;
+ else
+ if (cytologylist IS NULL) then
+ cytologylist := Labs_fld_List.Name[i];
+ else
+ cytologylist := cytologylist || ", " || Labs_fld_List.Name[i];
+ endif;
+ endif;
+ endif;
+ enddo;
+ else
+ cytologylist := ();
+ lablist := ();
+ endif;
+
+
+ Labs_List_fld.Value := "";
+ Cytology_List_fld.Value := "";
+
+ if lablist <> "" and lablist is not null then
+ Labs_List_fld.Value := "Labs: " || lablist || CR || LF;
+ endif;
+ if cytologylist <> "" and cytologylist is not null then
+ Cytology_List_fld.Value := "Cytology: " || cytologylist || CR || LF;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PERICARDITIS_PAIN.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PERICARDITIS_PAIN.mlm
new file mode 100644
index 0000000..eb36bfc
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PERICARDITIS_PAIN.mlm
@@ -0,0 +1,301 @@
+maintenance:
+
+ title: Pericarditis Pain Taper Orders;;
+ mlmname: FORM_Set_Pericarditis_Pain;;
+ arden: version 2.5;;
+ version: 15.10;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts Corp ext 7448;;
+ specialist: Teresa Spicuzza, Allscripts Corp ext 7448;;
+ date: 2016-01-21;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids on Tapering Ibuprofen on Pericarditis Pain
+ ;;
+
+ explanation: This MLM is called from the Tapering Ibuprofen on Pericarditis Pain
+
+
+Change history
+
+ 03.08.2016 TMS Created for new Pericarditis Pain Order set. MLM looks at current time
+ and selects correct order in the grid for start time. CSR #32396
+ ;;
+
+ keywords: Called MLMs, Pericarditis, Pain, Ibuprofen, Tapering
+ ;;
+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;
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ //local_session := cds_session.local;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Med_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 49);
+ Med_Orders_List := Med_Orders.Value;
+ ReqDate1 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ ReqDate2 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ ReqDate3 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+ ReqDate4 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 4);
+ RequestTime1 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1);
+ RequestTime2 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2);
+ RequestTime3 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3);
+ RequestTime4 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 4);
+ RxInstruct1 := last of (field_list where field_list.DataItemName = "Rx Comments" and field_List.Control_MultiFieldOccNum = 1);
+ RxInstruct2 := last of (field_list where field_list.DataItemName = "Rx Comments" and field_List.Control_MultiFieldOccNum = 2);
+ RxInstruct3 := last of (field_list where field_list.DataItemName = "Rx Comments" and field_List.Control_MultiFieldOccNum = 3);
+ RxInstruct4 := last of (field_list where field_list.DataItemName = "Rx Comments" and field_List.Control_MultiFieldOccNum = 4);
+
+
+ ReqTime1 := RequestTime1.value;
+ ReqTime2 := RequestTime2.value;
+ ReqTime3 := RequestTime3.value;
+ ReqTime4 := RequestTime4.value;
+ Med_Selected := true in Med_Orders_List;
+
+
+
+ ThisHour := extract hour now;
+ ThisMin := extract minute now; if ThisMin < 10 then ThisMin := "0"||ThisMin; endif;
+ ThisTime := (ThisHour||ThisMin) as number;
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+// baseday:= yr || "-" || mn || "-" || dd || "T00:00:00";
+ baseday:= yr || "-" || mn || "-" || dd ;
+ today := (baseday as time);
+ tomorrow := (baseday as time) +1 day;
+
+
+
+
+
+ // On form open check current hour and select appropriate start time
+ If CallingEvent = "FormOpen" or (CallingEvent = "FormClose" and true not in Med_Orders_list.isSelected) then
+ If ThisTime >= 0 and ThisTime <= 900 then
+ Med_Orders_List.IsSelected := (True, True, True, True);
+ Med_Orders_List.IsReadOnly := (True, True, True, True);
+
+ ReqDate1.value := today;
+ ReqTime1.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime1.ReqTimeValue := "09:00";
+
+ FullDate1 := (ReqDate1.value as time);
+ yr1 := extract year FullDate1; mn1 := extract month FullDate1; dd1 := extract day FullDate1;
+ InstructDay1 := mn1 || "-" || dd1 || "-" || yr1;
+ RxInstruct1.value := "Take 3 times a day for 3 days beginning on " || InstructDay1 || " at 9:00AM ";
+
+ ReqDate2.value := today + 3 days;
+ ReqTime2.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime2.ReqTimeValue := "09:00";
+
+ FullDate2 := (ReqDate2.value as time);
+ yr2 := extract year FullDate2; mn2 := extract month FullDate2; dd2 := extract day FullDate2;
+ InstructDay2 := mn2 || "-" || dd2 || "-" || yr2;
+ RxInstruct2.value := "Take 3 times a day for 3 days beginning on " || InstructDay2 || " at 9:00AM ";
+
+ ReqDate3.value := today + 6 days;
+ ReqTime3.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime3.ReqTimeValue := "09:00";
+
+ FullDate3 := (ReqDate3.value as time);
+ yr3 := extract year FullDate3; mn3 := extract month FullDate3; dd3 := extract day FullDate3;
+ InstructDay3 := mn3 || "-" || dd3 || "-" || yr3;
+ RxInstruct3.value := "Take 2 times a day for 3 days beginning on " || InstructDay3 || " at 9:00AM ";
+
+ ReqDate4.value := today + 9 days;
+ ReqTime4.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime4.ReqTimeValue := "09:00";
+
+ FullDate4 := (ReqDate4.value as time);
+ yr4 := extract year FullDate4; mn4 := extract month FullDate4; dd4 := extract day FullDate4;
+ InstructDay4 := mn4 || "-" || dd4 || "-" || yr4;
+ RxInstruct4.value := "Take once a day for 3 days beginning on " || InstructDay4 || " at 9:00AM ";
+
+
+ elseIf ThisTime > 900 and ThisTime <= 1400 then
+ Med_Orders_List.IsSelected := (True, True, True, True);
+ Med_Orders_List.IsReadOnly := (True, True, True, True);
+
+ ReqDate1.value := today;
+ ReqTime1.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime1.ReqTimeValue := "14:00";
+
+ FullDate1 := (ReqDate1.value as time);
+ yr1 := extract year FullDate1; mn1 := extract month FullDate1; dd1 := extract day FullDate1;
+ InstructDay1 := mn1 || "-" || dd1 || "-" || yr1;
+ RxInstruct1.value := "Take 3 times a day for 3 days beginning on " || InstructDay1|| " at 2:00PM ";
+
+ ReqDate2.value := today + 3 days;
+ ReqTime2.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime2.ReqTimeValue := "14:00";
+
+ FullDate2 := (ReqDate2.value as time);
+ yr2 := extract year FullDate2; mn2 := extract month FullDate2; dd2 := extract day FullDate2;
+ InstructDay2 := mn2 || "-" || dd2 || "-" || yr2;
+ RxInstruct2.value := "Take 3 times a day for 3 days beginning on " || InstructDay2 || " at 2:00PM ";
+
+ ReqDate3.value := today + 6 days;
+ ReqTime3.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime3.ReqTimeValue := "21:00";
+
+ FullDate3 := (ReqDate3.value as time);
+ yr3 := extract year FullDate3; mn3 := extract month FullDate3; dd3 := extract day FullDate3;
+ InstructDay3 := mn3 || "-" || dd3 || "-" || yr3;
+ RxInstruct3.value := "Take 2 times a day for 3 days beginning on " || InstructDay3 || " at 9:00PM ";
+
+ ReqDate4.value := today + 10 days;
+ ReqTime4.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime4.ReqTimeValue := "09:00";
+
+ FullDate4 := (ReqDate4.value as time);
+ yr4 := extract year FullDate4; mn4 := extract month FullDate4; dd4 := extract day FullDate4;
+ InstructDay4 := mn4 || "-" || dd4 || "-" || yr4;
+ RxInstruct4.value := "Take once a day for 3 days beginning on " || InstructDay4 || " at 9:00AM ";
+
+ elseIf ThisTime > 1400 and ThisTime <= 2100 then
+
+ Med_Orders_List.IsSelected := (True, True, True, True);
+ Med_Orders_List.IsReadOnly := (True, True, True, True);
+
+ ReqDate1.value := today;
+ ReqTime1.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime1.ReqTimeValue := "21:00";
+
+ FullDate1 := (ReqDate1.value as time);
+ yr1 := extract year FullDate1; mn1 := extract month FullDate1; dd1 := extract day FullDate1;
+ InstructDay1 := mn1 || "-" || dd1 || "-" || yr1;
+ RxInstruct1.value := "Take 3 times a day for 3 days beginning on " || InstructDay1 || " at 9:00PM ";
+
+ ReqDate2.value := today + 3 days;
+ ReqTime2.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime2.ReqTimeValue := "21:00";
+
+ FullDate2 := (ReqDate2.value as time);
+ yr2 := extract year FullDate2; mn2 := extract month FullDate2; dd2 := extract day FullDate2;
+ InstructDay2 := mn2 || "-" || dd2 || "-" || yr2;
+ RxInstruct2.value := "Take 3 times a day for 3 days beginning on " || InstructDay2 || " at 9:00PM ";
+
+ ReqDate3.value := today + 7 days;
+ ReqTime3.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime3.ReqTimeValue := "09:00";
+
+ FullDate3 := (ReqDate3.value as time);
+ yr3 := extract year FullDate3; mn3 := extract month FullDate3; dd3 := extract day FullDate3;
+ InstructDay3 := mn3 || "-" || dd3 || "-" || yr3;
+ RxInstruct3.value := "Take 2 times a day for 3 days beginning on " || InstructDay3 || " at 9:00AM ";
+
+ ReqDate4.value := today + 10 days;
+ ReqTime4.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime4.ReqTimeValue := "09:00";
+
+ FullDate4 := (ReqDate4.value as time);
+ yr4 := extract year FullDate4; mn4 := extract month FullDate4; dd4 := extract day FullDate4;
+ InstructDay4 := mn4 || "-" || dd4 || "-" || yr4;
+ RxInstruct4.value := "Take once a day for 3 days beginning on " || InstructDay4 || " at 9:00AM ";
+
+ elseIf ThisTime > 2100 and ThisTime <= 2400 then
+ Med_Orders_List.IsSelected := (True, True, True, True);
+ Med_Orders_List.IsReadOnly := (True, True, True, True);
+
+ ReqDate1.value := today + 1 days;
+ ReqTime1.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime1.ReqTimeValue := "09:00";
+
+ FullDate1 := (ReqDate1.value as time);
+ yr1 := extract year FullDate1; mn1 := extract month FullDate1; dd1 := extract day FullDate1;
+ InstructDay1 := mn1 || "-" || dd1 || "-" || yr1;
+ RxInstruct1.value := "Take 3 times a day for 3 days beginning on " || InstructDay1 || " at 9:00AM ";
+
+ FullDate2 := (ReqDate2.value as time);
+ yr2 := extract year FullDate2; mn2 := extract month FullDate2; dd2 := extract day FullDate2;
+ InstructDay2 := mn2 || "-" || dd2 || "-" || yr2;
+
+ ReqDate2.value := today + 4 days;
+ ReqTime2.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime2.ReqTimeValue := "09:00";
+ RxInstruct2.value := "Take 3 times a day for 3 days beginning on " || InstructDay2 || " at 9:00AM ";
+
+ ReqDate3.value := today + 7 days;
+ ReqTime3.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime3.ReqTimeValue := "09:00";
+
+ FullDate3 := (ReqDate3.value as time);
+ yr3 := extract year FullDate3; mn3 := extract month FullDate3; dd3 := extract day FullDate3;
+ InstructDay3 := mn3 || "-" || dd3 || "-" || yr3;
+ RxInstruct3.value := "Take 3 times a day for 3 days beginning on " || InstructDay3 || " at 9:00AM ";
+
+ ReqDate4.value := today + 10 days;
+ ReqTime4.ReqTimeCode := "Scheduled/Start Time";
+ ReqTime4.ReqTimeValue := "09:00";
+
+ FullDate4 := (ReqDate4.value as time);
+ yr4 := extract year FullDate4; mn4 := extract month FullDate4; dd4 := extract day FullDate4;
+ InstructDay4 := mn4 || "-" || dd4 || "-" || yr4;
+ RxInstruct4.value := "Take once a day for 3 days beginning on " || InstructDay4 || " at 9:00AM ";
+ Endif;
+
+ Endif;
+
+
+
+ If CallingEvent = "FieldChange" and true not in Med_Orders_list.isSelected then
+ Med_Orders_List.IsReadOnly := (False, False, False, False);
+ else
+ protectvaluelist := ();
+ for r in 1 seqto (count Med_Orders_List) do
+ If Med_Orders_List.IsSelected [r] = true then
+ protectvalue := "false";
+ else protectvalue := "true";
+ endif;
+ protectvaluelist := protectvaluelist , protectvalue;
+ enddo;
+
+ Med_Orders_List.IsReadOnly := protectvaluelist;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PERIOPERATIVE_GLUCOSE_CONTROL.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PERIOPERATIVE_GLUCOSE_CONTROL.mlm
new file mode 100644
index 0000000..e566994
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PERIOPERATIVE_GLUCOSE_CONTROL.mlm
@@ -0,0 +1,116 @@
+maintenance:
+
+ title: FORM_SET_PERIOPERATIVE_GLUCOSE_CONTROL;;
+ mlmname: FORM_SET_PERIOPERATIVE_GLUCOSE_CONTROL;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Janet Nordin;;
+ specialist: Don Warnick;;
+ date: 2016-07-26;;
+ validation: testing;;
+
+library:
+ purpose: Upon open of the diabetic buttons, other buttons are selected
+ ;;
+
+ explanation: This MLM is called from the Peri-Operative Glucose Control Order Set
+
+
+ Change history
+
+ 07.26.2016 - DJW CSR# 34934 - Created
+
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ Diabetic := first of (field_list where field_list.DataItemName = "Diabetic Patient");
+ NonDiabetic_GT:= first of (field_list where field_list.DataItemName = "Non-Diabetic patients");
+ NonDiabetic_LT:= first of (field_list where field_list.DataItemName = "Non-Diabetic");
+
+ InsulinGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 65);
+ NursingGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 69);
+
+ RequiredField:= first of (field_list where field_list.DataItemName = "Required Field");
+
+ // Determine which box was selected and de-select the other 2
+
+ If this_communication.CallingFieldName = "Diabetic Patient|1" and Diabetic.Value = true
+ then
+ SelectedBox:= "Diabetic"; NonDiabetic_GT.Value:= false; NonDiabetic_LT.Value:= false; RequiredField.Value := "Glucose Control Addressed";
+
+ elseif this_communication.CallingFieldName = "Non-Diabetic patients|1" and NonDiabetic_GT.Value = true
+ then
+ SelectedBox:= "NonDiabeticGT"; Diabetic.Value:= false; NonDiabetic_LT.Value:= false; RequiredField.Value := "Glucose Control Addressed";
+
+ elseif this_communication.CallingFieldName = "Non-Diabetic|1" and NonDiabetic_LT.Value = true
+ then
+ SelectedBox:= "NonDiabeticLT"; Diabetic.Value:= false; NonDiabetic_GT.Value:= false; RequiredField.Value := "Glucose Control Addressed";
+
+ else SelectedBox := ""; RequiredField.Value := "";
+ endif;
+
+
+
+ // De-select and protect both grids
+
+ index_list := 1 seqto (count NursingGrid.Value);
+ for I in index_list do
+ InsulinGrid.Value[I].IsSelected := False;
+ InsulinGrid.Value[I].IsReadOnly := True;
+ NursingGrid.Value[I].IsSelected := False;
+ NursingGrid.Value[I].IsReadOnly := True;
+ enddo;
+
+
+ // Select both grids
+
+ index_list := 1 seqto (count NursingGrid.Value);
+ for J in index_list do
+ If SelectedBox = "Diabetic" or SelectedBox = "NonDiabeticGT"
+ then
+ NursingGrid.Value[J].IsSelected := True;
+ InsulinGrid.Value[J].IsSelected := True;
+ else
+ NursingGrid.Value[J].IsSelected := False;
+ InsulinGrid.Value[J].IsSelected := False;
+ endif;
+
+ enddo;
+
+
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PNEUMONIA_ANTIBIOTICS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PNEUMONIA_ANTIBIOTICS.mlm
new file mode 100644
index 0000000..c63e4f1
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PNEUMONIA_ANTIBIOTICS.mlm
@@ -0,0 +1,1257 @@
+maintenance:
+
+ title: FORM_SET_PNEUMONIA_ANTIBIOTICS;;
+ mlmname: FORM_SET_PNEUMONIA_ANTIBIOTICS;;
+ arden: version 2.5;;
+ version: 15.10;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Peggy Leschak, Allscripts;;
+ date: 2016-03-23;;
+ validation: testing;;
+
+library:
+ purpose: Used for Pneumonia Antibiotics order set
+ ;;
+
+ explanation: This MLM is called from Pneumonia Antibiotics Order Set
+
+ Change history
+ 03.23.2016 JML CSR 34091: Created for Pneumonia Antibiotic Order Set
+ 08.18.2016 JML Adding Ceftazidime / removing Cefepime due to shortage.
+ 04.12.2017 JML CSR 35213 / 35566: Add Cefepime back; add Azithro. PO x 5 days for Community
+ acquired NON-ICU and allow to toggle between PO and IV Azithro
+ 02.13.2018 JML CSR 26163: 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 Pneumonia, 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;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ exceptFld := ();
+ vanco_logic_run := false;
+ tobra_logic_run := false;
+ ceftriaxone_logic_run := false;
+
+ //Define fields
+ Ceftria_Azithro_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 1);
+ Ampicillin_Azithro_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 2);
+ Levaquin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 3);
+ Zosyn_Azithro_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 5);
+ Azithro_Merop_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 4);
+ Aztreonam_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 7);
+ Aztreonam_Levaquin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 14);
+ Meropenem_Tobramycin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 10);
+ Vanco_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 8);
+ Vanco2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 16);
+ Cefepime_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 17 );
+ Cefepime_Azithro_Chk := first of ( field_list WHERE field_list.DataItemname = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 18);
+ Cefepime_Tobramycin_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);
+ Antibiotics_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;
+
+ Ceftriaxone_Dose := first of ( field_list WHERE field_list.DataItemName = "DosageLow" AND field_list.Control_MultiFieldOccNum = 1 );
+ Ceftriaxone_WORX_Code := first of ( field_list WHERE field_list.DataItemName = "PRX_DRUGIDCODE" AND field_list.Control_MultiFieldOccNum = 1 );
+ Tobramycin_Dose := first of ( field_list WHERE field_list.DataItemName = "DosageLow" AND field_list.Control_MultiFieldOccNum = 10 );
+ Vancomycin_Freq := first of ( field_list WHERE field_list.DataItemName = "FrequencyCode" AND field_list.Control_MultiFieldOccNum = 1 );
+ Vancomycin_Freq_Val := Vancomycin_Freq.Value;
+
+ Ceftriaxone := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Ceftriaxone:" OR Antibiotics_Grid_Value.Name = "Ceftriaxone Mini-Syringe" );
+ Azithromycin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Azithromycin:" );
+ Azithromycin_PO := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Azithromycin 250mg Tab" );
+ Ampicillin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Ampicillin:" );
+ Levaquin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Levofloxacin:" );
+ Zosyn_Low := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Piperacillin/Tazobactam:" );
+ Zosyn := last of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Piperacillin/Tazobactam:" );
+ Meropenem := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Meropenem:" );
+ Aztreonam := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Aztreonam:" );
+
+ Cefepime := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Cefepime:" OR Antibiotics_Grid_Value.Name = "Cefepime Mini-Syringe" );
+ Ceftazidime := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Ceftazidime:" );
+
+ Tobramycin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Tobramycin:" );
+ 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:" );
+
+ PCN_Allergy := first of ( field_list WHERE field_list.DataItemName = "PRX_PCN Allergy" AND field_list.Control_MultiFieldOccNum = 1 );
+ 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);
+ ZosynMsg := last of ( field_list WHERE field_list.DataItemName = "NUR_GenAdditiionalLabel"
+ and field_list.Control_MultiFieldOccNum = 10);
+ NoLoad := false;
+ 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" 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;
+ 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;
+
+ //Populate Guidelines
+ ( this_communication, this_form ) := call antibiotic_guideline_mlm WITH this_communication, this_form, client_info_obj;
+
+ for item IN Antibiotics_Grid_Value do
+ if ( item.Name NOT IN ( "Tobramycin:") ) then
+ item.IsReadonly := true;
+ endif;
+ enddo;
+
+ //Retrieve PCN Allergy information
+ // Obtain Coded Allergen Guids
+ (AllergenGuids) := READ {"SELECT GUID"
+ || " FROM CV3Allergen a WITH (NOLOCK)"
+ || " WHERE a.Code like {{{SINGLE-QUOTE}}}Penicill%{{{SINGLE-QUOTE}}} OR a.Code like {{{SINGLE-QUOTE}}}Cef%{{{SINGLE-QUOTE}}} OR a.Code like {{{SINGLE-QUOTE}}}%cillin{{{SINGLE-QUOTE}}} OR a.Code like {{{SINGLE-QUOTE}}}Cephalex%{{{SINGLE-QUOTE}}}"};
+
+ (PCNAllergyReaction) := READ {"SELECT ad.SvrtyLevelDisplay"
+ || " FROM CV3AllergyDeclaration ad WITH (NOLOCK)"
+ || " WHERE ad.ClientGUID = " || SQL(ClientGuid)
+ || " AND ((ad.Text LIKE {{{SINGLE-QUOTE}}}penicil%{{{SINGLE-QUOTE}}} OR ad.Text LIKE {{{SINGLE-QUOTE}}}%pcn%{{{SINGLE-QUOTE}}} OR ad.Text LIKE {{{SINGLE-QUOTE}}}%cephalexin%{{{SINGLE-QUOTE}}} OR ad.Text LIKE {{{SINGLE-QUOTE}}}%cillin%{{{SINGLE-QUOTE}}} OR ad.Text LIKE {{{SINGLE-QUOTE}}}cef%{{{SINGLE-QUOTE}}}) "
+ || " AND ad.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} AND ad.TypeCodeForOther = {{{SINGLE-QUOTE}}}drug{{{SINGLE-QUOTE}}})"
+ || " OR (ad.ClientGUID = " || SQL(ClientGuid)
+ || " AND ad.AllergenGUID IN (" || SQL(AllergenGuids) || ") AND ad.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}})"};
+
+ a := "";
+ for i IN 1 seqto ( count PCNAllergyReaction ) do
+ a := a || PCNAllergyReaction[i];
+ enddo;
+
+ if ( a <> "" ) then
+ PCN_Allergy.Value := ( a as String );
+ else
+ PCN_Allergy.Value := "NO ALLERGY";
+ endif;
+
+ //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 = "Pneumonia Antibiotic 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 ( Cefepime_Tobramycin_Chk.Value = true OR Meropenem_Tobramycin_Chk.Value = true ) then
+ tobra_logic_run := true;
+ endif;
+
+ if (Ceftria_Azithro_Chk.Value = true ) then
+ ceftriaxone_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 ) then
+ vanco_logic_run := true;
+ endif;
+ endif;
+
+ //********* CEFTRIAXONE + AZITHROMYCIN *************
+ if ( CallingField = "PRX_Checkbox1|1" ) then
+
+ fieldValue := Ceftria_Azithro_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Ceftriaxone.IsSelected := true;
+
+ ceftriaxone_logic_run := true;
+
+ Azithromycin.IsReadonly := false;
+ Azithromycin_PO.IsReadonly := false;
+
+ Azithromycin_PO.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ ceftriaxone_logic_run := false;
+
+ Ceftriaxone.IsSelected := false;
+
+ Azithromycin.IsReadonly := true;
+ Azithromycin_PO.IsReadonly := true;
+
+ Azithromycin_PO.IsSelected := false;
+ Azithromycin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //********** AMPICILLIN + AZITHROMYCIN *******************
+ if ( CallingField = "PRX_Checkbox1|2" ) then
+
+ fieldValue := Ampicillin_Azithro_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ Ampicillin.IsSelected := true;
+
+ Azithromycin.IsReadOnly := false;
+ Azithromycin_PO.IsReadOnly := false;
+
+ Azithromycin_PO.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, true, "";
+
+ elseif ( fieldValue = false ) then
+
+ Ampicillin.IsSelected := false;
+
+ Azithromycin.IsReadOnly := true;
+ Azithromycin_PO.IsReadOnly := true;
+
+ Azithromycin_PO.IsSelected := false;
+ Azithromycin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+
+ endif;
+
+ //*********** LEVAQUIN ************************
+ if ( CallingField = "PRX_Checkbox1|3" ) then
+
+ fieldValue := Levaquin_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Levaquin.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, true, "";
+
+ elseif ( fieldValue = false ) then
+ Levaquin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //*************** AZITHROMYCIN + MEROPENEM ********************
+ if ( CallingField = "PRX_Checkbox1|4" ) then
+
+ fieldValue := Azithro_Merop_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Azithromycin.IsSelected := true;
+ Meropenem.IsSelected := true;
+
+ exceptFld := exceptFld, Vanco_Chk.DataItemName || "|" || Vanco_Chk.Control_MultiFieldOccNum;
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+
+ elseif ( fieldValue = false ) then
+ Azithromycin.IsSelected := false;
+ Meropenem.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+
+ endif;
+ //*********** ZOSYN + AZITHROMYCIN ***************************
+
+ if ( OrderSetName = "Pneumonia Antibiotic ED" and CallingField = "PRX_Checkbox1|5" ) then
+
+ fieldValue := Zosyn_Azithro_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Zosyn.IsSelected := true;
+ Azithromycin.IsSelected := true;
+
+ exceptFld := exceptFld, Vanco_Chk.DataItemName || "|" || Vanco_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;
+ Azithromycin.IsSelected := false;
+ Zosyn_Low.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //*********** ZOSYN + AZITHROMYCIN ***************************
+ 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 = "Pneumonia Antibiotic" and ( CallingField = "PRX_Checkbox1|5"
+ or ( CallingField = "PRX_Zosyn_Ext_Inf_Freq|1" and Zosyn_Azithro_Chk.Value = true)
+ or (CallingField = "PRX_Generic_CB|1" and Zosyn_Azithro_Chk.Value = true)
+ or (CallingField = "PRX_Generic_CB|2" and Zosyn_Azithro_Chk.Value = true)) ) then
+ fieldValue := Zosyn_Azithro_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ Azithromycin.IsSelected := true;
+
+ exceptFld := exceptFld, Vanco_Chk.DataItemName || "|" || Vanco_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;
+ Azithromycin.IsSelected := false;
+ Zosyn_Low.IsSelected := false;
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //********** AZTREONAM ***********************
+ //JML: Changed to include Levaquin
+ if ( CallingField = "PRX_Checkbox1|7" ) then
+
+ fieldValue := Aztreonam_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Aztreonam.IsSelected := true;
+ Levaquin.IsSelected := true;
+
+ exceptFld := exceptFld, Vanco_Chk.DataItemName || "|" || Vanco_Chk.Control_MultiFieldOccNum;
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Aztreonam.IsSelected := false;
+ Levaquin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************ CEFEPIME ****************************
+ if ( CallingField = "PRX_Checkbox1|17" ) then
+ fieldValue := Cefepime_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Cefepime.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;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************ MEROPENEM + TOBRAMYCIN ***********************************
+ if ( CallingField = "PRX_Checkbox1|10" ) then
+
+ fieldValue := Meropenem_Tobramycin_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ //Determine if Tobramycin should be ordered
+ //Check for dose given in last 24 hours
+ tobramycin_exists := READ LAST { "SELECT 1"
+ || " 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"
+ || " WHERE o.NAME LIKE {{{SINGLE-QUOTE}}}TOBRAMYCIN%{{{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()) <= 24"
+ || " order by o.Entered desc" };
+
+ if ( exists tobramycin_exists ) then
+ Tobramycin.IsSelected := false;
+ else
+ Tobramycin.IsSelected := true;
+ endif;
+
+ Meropenem.IsSelected := true;
+
+ //Disable all other checkboxes EXCEPT Vanco
+ 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;
+
+ tobra_logic_run := true;
+
+ elseif ( fieldValue = false ) then
+ tobra_logic_run := false;
+
+ Meropenem.IsSelected := false;
+ Tobramycin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************** CEFEPIME + AZITHROMYCIN *********************
+ if ( CallingField = "PRX_Checkbox1|18" ) then
+ fieldValue := Cefepime_Azithro_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Cefepime.IsSelected := true;
+ Azithromycin.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;
+ Azithromycin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //***************** AZTREONAM + LEVAQUIN ***************************
+ if ( CallingField = "PRX_Checkbox1|14" ) then
+
+ fieldValue := Aztreonam_Levaquin_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Aztreonam.IsSelected := true;
+ Levaquin.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
+ Aztreonam.IsSelected := false;
+ Levaquin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //*************** CEFEPIME + Tobramycin ************************
+ if ( CallingField = "PRX_Checkbox1|19" ) then
+ fieldValue := Cefepime_Tobramycin_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ //Determine if Tobramycin should be ordered
+ //Check for dose given in last 24 hours
+ tobramycin_exists := READ LAST { "SELECT 1"
+ || " 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"
+ || " WHERE o.NAME LIKE {{{SINGLE-QUOTE}}}TOBRAMYCIN%{{{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()) <= 24"
+ || " order by o.Entered desc" };
+
+ if ( exists tobramycin_exists ) then
+ Tobramycin.IsSelected := false;
+ else
+ Tobramycin.IsSelected := true;
+ endif;
+
+ Cefepime.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;
+
+ tobra_logic_run := true;
+
+ elseif ( fieldValue = false ) then
+
+ tobra_logic_run := false;
+
+ Cefepime.IsSelected := false;
+ Tobramycin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************ VANCOMYCIN *****************************
+ if ( CallingField = "PRX_Checkbox1|8" OR CallingField = "PRX_Checkbox1|16" ) then
+
+ if ( CallingField = "PRX_Checkbox1|8" ) then
+ fieldValue := Vanco_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|16" ) then
+ fieldValue := Vanco2_Chk.Value;
+ endif;
+
+ if ( fieldValue = true ) then
+
+ vanco_logic_run := true;
+
+ elseif ( fieldValue = false ) then
+
+ vanco_logic_run := false;
+
+ Vancomycin_Load.IsSelected := false;
+ Vancomycin.IsSelected := false;
+ 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_Azithro_Chk.Value = false ) then
+ Zosyn_Azithro_Chk.Value := true;
+ Azithromycin.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, "PRX_Checkbox1|5", true, "";
+ endif;
+ elseif ( Zosyn.IsSelected = false AND Zosyn_Low.IsSelected = false ) then
+ if ( NOT ( Ceftria_Azithro_Chk.Value = true OR Ampicillin_Azithro_Chk.Value = true ) ) then
+ Azithromycin.IsSelected := false;
+ Zosyn_Azithro_Chk.Value := false;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ if ( Tobramycin.IsSelected = true AND ( Cefepime_Tobramycin_Chk.Value = false OR Meropenem_Tobramycin_Chk.Value = false ) ) then
+ Tobramycin.IsSelected := false;
+ endif;
+
+ if ( Ceftria_Azithro_Chk.Value = true OR Ampicillin_Azithro_Chk.Value = true ) then
+ if ( Azithromycin.IsSelected = true AND Azithromycin_PO.IsSelected = true ) then
+ Azithromycin_PO.IsSelected := false;
+ Azithromycin.IsSelected := true;
+ endif;
+ endif;
+
+ endif;
+
+ //************ VANCOMYCIN GRID *******************
+ if ( CallingField = "MultiOrderGrid|2" ) then
+
+ if ( Vancomycin_Load.IsSelected = false AND Vancomycin.IsSelected = false ) then
+ Vanco_Chk.Value := false;
+ Vanco2_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;
+
+ Vancomycin_Trough.IsSelected := true;
+ endif;
+
+ if ( Vancomycin_Load.IsSelected = true AND Vancomycin.IsSelected = true ) then
+ vanco_logic_run := true;
+ endif;
+
+ endif;
+
+ endif; //End Fieldchange
+
+
+ //Handle vancomycin ordering
+ if ( vanco_logic_run = true ) then
+
+ if ( OrderSetName = "Pneumonia Antibiotic 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}}};
+
+
+ Vanco_Chk.Value := false;
+ Vanco2_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}}};
+
+ Vanco_Chk.Value := false;
+ Vanco2_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;
+
+ 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 ( tobra_logic_run = true ) then
+
+ //Calculate Tobramycin dosing
+ //Retrieve Adjusted Body Weight
+ if ( weightvalue = 0 OR weightvalue IS NULL OR ht = 0 OR ht IS NULL ) then
+ dialogResult := 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}}};
+ else
+ this_communication, this_form, ABW := call calc_abw_mlm WITH this_communication, this_form, client_info_obj;
+ ABW_Val.Value := ( ABW as number);
+
+ rawTobraDose := ( ( ABW as number ) * 5);
+ roundingFactor := 20;
+ halfRoundingFactor := 10;
+
+ rounded_dose := int((rawTobraDose + halfRoundingFactor)/roundingFactor) * roundingFactor;
+
+ Tobramycin_Dose.Value := rounded_dose;
+ endif;
+
+ endif;
+
+ if ( ceftriaxone_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
+ Ceftriaxone_Dose.Value := ( 1 as number );
+ if ( Ceftriaxone.Name = "Ceftriaxone:" ) then
+ Ceftriaxone_WORX_Code.Value := "08561P";
+ elseif ( Ceftriaxone.Name = "Ceftriaxone Mini-Syringe" ) then
+ Ceftriaxone_WORX_Code.Value := "08561";
+ endif;
+
+
+ elseif ( weightvalue >= 80 ) then
+ Ceftriaxone_Dose.Value := ( 2 as number );
+
+ if ( Ceftriaxone.Name = "Ceftriaxone:" ) then
+ Ceftriaxone_WORX_Code.Value := "08555P";
+ elseif ( Ceftriaxone.Name = "Ceftriaxone Mini-Syringe" ) then
+ Ceftriaxone_WORX_Code.Value := "08555";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PNEUMONIA_ANTIBIOTICS_OUTPATIENT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PNEUMONIA_ANTIBIOTICS_OUTPATIENT.mlm
new file mode 100644
index 0000000..811d0cc
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PNEUMONIA_ANTIBIOTICS_OUTPATIENT.mlm
@@ -0,0 +1,324 @@
+maintenance:
+
+ title: FORM_SET_PNEUMONIA_ANTIBIOTICS_OUTPATIENT;;
+ mlmname: FORM_SET_PNEUMONIA_ANTIBIOTICS_OUTPATIENT;;
+ 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 Pneumonia Antibiotic Outpatient Order Set
+
+ ;;
+ keywords: Called MLMs, Antibiotic Pneumonia, Outpatient, 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";
+
+ // 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:="";
+
+ display_field_mlm := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_DISPLAY_FORM_FIELD{{{SINGLE-QUOTE}}};
+ enable_chkbx_mlm := mlm {{{SINGLE-QUOTE}}}FORM_Func_Disable_OS_Checkboxes{{{SINGLE-QUOTE}}};
+ antibiotic_guideline_mlm := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_DISPLAY_ANTIBIOTIC_GUIDELINES{{{SINGLE-QUOTE}}};
+
+ exceptFld := ();
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Azithromycin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 1 );
+ Doxycycline_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 2 );
+ Cefuroxime_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 3 );
+ Cefaclor_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 5 );
+ Levofloxacin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 10 );
+ Amoxicillin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 11 );
+
+ Antibiotics_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 1 );
+ Antibiotics_Grid_Value := Antibiotics_Grid.Value;
+ Alternative_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 2 );
+ Alternative_Grid_Value := Alternative_Grid.Value;
+
+ Azithromycin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Azithromycin 250mg Tab" );
+ Doxycycline := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Doxycycline 100mg Cap" );
+ Cefuroxime := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Cefuroxime 500mg Tab" );
+ Cefaclor := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Cefaclor 250mg Cap" );
+ Amoxicillin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Amoxicillin 500mg Cap" );
+ Levofloxacin := first of ( Alternative_Grid_Value WHERE Alternative_Grid_Value.Name = "Levofloxacin 750mg Tab" );
+
+ // 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
+ ( this_communication, this_form ) := call antibiotic_guideline_mlm WITH this_communication, this_form, client_info_obj;
+
+ for item IN Antibiotics_Grid_Value do
+ item.IsReadonly := true;
+ enddo;
+ for drug IN Alternative_Grid_Value do
+ drug.IsReadonly := true;
+ enddo;
+ endif;
+
+ if ( CallingEvent = "FieldChange" ) then
+
+ //********** AZITHROMYCIN *********************
+ if ( CallingField = "PRX_Checkbox1|1" ) then
+
+ fieldValue := Azithromycin_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Azithromycin.IsSelected := true;
+
+ exceptFld := exceptFld, Cefuroxime_Chk.DataItemName || "|" || Cefuroxime_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Cefaclor_Chk.DataItemName || "|" || Cefaclor_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Amoxicillin_Chk.DataItemName || "|" || Amoxicillin_Chk.Control_MultiFieldOccNum;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Azithromycin.IsSelected := false;
+
+ if ( Cefuroxime_Chk.Value = true OR Cefaclor_Chk.value = true OR Amoxicillin_Chk.Value = true ) then
+ exceptFld := exceptFld, Levofloxacin_Chk.DataItemName || "|" || Levofloxacin_Chk.Control_MultiFieldOccNum;
+ endif;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+ endif;
+
+ endif;
+
+ //*********** DOXYCYCLINE *********************
+ if ( CallingField = "PRX_Checkbox1|2" ) then
+
+ fieldValue := Doxycycline_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Doxycycline.IsSelected := true;
+
+ exceptFld := exceptFld, Cefuroxime_Chk.DataItemName || "|" || Cefuroxime_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Cefaclor_Chk.DataItemName || "|" || Cefaclor_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Amoxicillin_Chk.DataItemName || "|" || Amoxicillin_Chk.Control_MultiFieldOccNum;
+
+ if ( Cefuroxime_Chk.Value = true OR Cefaclor_Chk.value = true OR Amoxicillin_Chk.Value = true ) then
+ exceptFld := exceptFld, Levofloxacin_Chk.DataItemName || "|" || Levofloxacin_Chk.Control_MultiFieldOccNum;
+ endif;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+
+ elseif ( fieldValue = false ) then
+ Doxycycline.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //*********** CEFUROXIME ********************
+ if ( CallingField = "PRX_Checkbox1|3" ) then
+
+ fieldValue := Cefuroxime_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Cefuroxime.IsSelected := true;
+
+ if ( Cefaclor_Chk.Value = true ) then
+ Cefaclor_Chk.Value := false;
+ Cefaclor.IsSelected := false;
+ endif;
+ if ( Amoxicillin_Chk.Value = true ) then
+ Amoxicillin_Chk.Value := false;
+ Amoxicillin.IsSelected := false;
+ endif;
+
+ exceptFld := exceptFld, Azithromycin_Chk.DataItemName || "|" || Azithromycin_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Doxycycline_Chk.DataItemName || "|" || Doxycycline_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Cefaclor_Chk.DataItemName || "|" || Cefaclor_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Amoxicillin_Chk.DataItemName || "|" || Amoxicillin_Chk.Control_MultiFieldOccNum;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Cefuroxime.IsSelected := false;
+
+ if ( Azithromycin_Chk.Value = false ) then
+ exceptFld := exceptFld, Azithromycin_Chk.DataItemName || "|" || Azithromycin_Chk.Control_MultiFieldOccNum;
+ endif;
+ if ( Doxycycline_Chk.Value = false ) then
+ exceptFld := exceptFld, Doxycycline_Chk.DataItemName || "|" || Doxycycline_Chk.Control_MultiFieldOccNum;
+ endif;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+ endif;
+ endif;
+
+ //************* CEFACLOR ********************
+ if ( CallingField = "PRX_Checkbox1|5" ) then
+
+ fieldValue := Cefaclor_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Cefaclor.IsSelected := true;
+
+ if ( Cefuroxime_Chk.Value = true ) then
+ Cefuroxime_Chk.Value := false;
+ Cefuroxime.IsSelected := false;
+ endif;
+ if ( Amoxicillin_Chk.Value = true ) then
+ Amoxicillin_Chk.Value := false;
+ Amoxicillin.IsSelected := false;
+ endif;
+
+ exceptFld := exceptFld, Azithromycin_Chk.DataItemName || "|" || Azithromycin_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Doxycycline_Chk.DataItemName || "|" || Doxycycline_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Cefuroxime_Chk.DataItemName || "|" || Cefuroxime_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Amoxicillin_Chk.DataItemName || "|" || Amoxicillin_Chk.Control_MultiFieldOccNum;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Cefaclor.IsSelected := false;
+
+ if ( Azithromycin_Chk.Value = false ) then
+ exceptFld := exceptFld, Azithromycin_Chk.DataItemName || "|" || Azithromycin_Chk.Control_MultiFieldOccNum;
+ endif;
+ if ( Doxycycline_Chk.Value = false ) then
+ exceptFld := exceptFld, Doxycycline_Chk.DataItemName || "|" || Doxycycline_Chk.Control_MultiFieldOccNum;
+ endif;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+ endif;
+ endif;
+
+ //************* Amoxicillin ******************
+ if ( CallingField = "PRX_Checkbox1|11" ) then
+ fieldValue := Amoxicillin_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Amoxicillin.IsSelected := true;
+
+ if ( Cefaclor_Chk.Value = true ) then
+ Cefaclor_Chk.Value := false;
+ Cefaclor.IsSelected := false;
+ endif;
+ if ( Cefuroxime_Chk.Value = true ) then
+ Cefuroxime_Chk.Value := false;
+ Cefuroxime.IsSelected := false;
+ endif;
+
+ exceptFld := exceptFld, Azithromycin_Chk.DataItemName || "|" || Azithromycin_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Doxycycline_Chk.DataItemName || "|" || Doxycycline_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Cefuroxime_Chk.DataItemName || "|" || Cefuroxime_Chk.Control_MultiFieldOccNum;
+ exceptFld := exceptFld, Cefaclor_Chk.DataItemName || "|" || Cefaclor_Chk.Control_MultiFieldOccNum;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Amoxicillin.IsSelected := false;
+
+ if ( Azithromycin_Chk.Value = false ) then
+ exceptFld := exceptFld, Azithromycin_Chk.DataItemName || "|" || Azithromycin_Chk.Control_MultiFieldOccNum;
+ endif;
+ if ( Doxycycline_Chk.Value = false ) then
+ exceptFld := exceptFld, Doxycycline_Chk.DataItemName || "|" || Doxycycline_Chk.Control_MultiFieldOccNum;
+ endif;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, exceptFld;
+ endif;
+
+ endif;
+
+ //************* LEVOFLOXACIN ******************
+ if ( CallingField = "PRX_Checkbox1|10" ) then
+
+ fieldValue := Levofloxacin_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Levofloxacin.IsSelected := true;
+
+ if ( Azithromycin_Chk.Value = true ) then
+ Azithromycin.IsSelected := false;
+ Azithromycin_Chk.Value := false;
+ endif;
+
+ if ( Doxycycline_Chk.value = true ) then
+ Doxycycline.IsSelected := false;
+ Doxycycline_Chk.Value := false;
+ endif;
+
+ if ( Cefuroxime_Chk.Value = true ) then
+ Cefuroxime.IsSelected := false;
+ Cefuroxime_Chk.Value := false;
+ endif;
+ if ( Cefaclor_chk.Value = true ) then
+ Cefaclor.IsSelected := false;
+ Cefaclor_Chk.Value := false;
+ endif;
+ if ( Amoxicillin_Chk.Value = true ) then
+ Amoxicillin_chk.Value := false;
+ Amoxicillin.IsSelected := false;
+ endif;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
+ elseif ( fieldValue = false ) then
+ Levofloxacin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ endif; //End FieldChange event
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_POSTOP_ANTERIOR_CERVICAL_DISC.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_POSTOP_ANTERIOR_CERVICAL_DISC.mlm
new file mode 100644
index 0000000..08a7ccc
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_POSTOP_ANTERIOR_CERVICAL_DISC.mlm
@@ -0,0 +1,497 @@
+maintenance:
+
+ title: Multi Dose Now and Then Orders;;
+ mlmname: FORM_SET_POSTOP_ANTERIOR_CERVICAL_DISC;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Michele Payne, Allscripts;;
+ date: 2012-03-16;;
+ validation: testing;;
+
+library:
+ purpose: Used for grids to limit duplicate selections for analgesics and antibiotics
+ ;;
+
+ explanation: This MLM is called from the Post Op Anterior Cervical Discectomy Order Set
+
+ Change history
+ 2012.03.16 JML Created for CSR #26791; copied from FORM_SET_POSTOP_LUMBAR_LAM due to grids being at different indexes
+ 2012.03.16 JML Added logic to restrict IV management of discontinue of PCA/IV Opioid
+ and auto fill the post op day to either T+1 or T+2, depending on user selected option.
+ 2012.03.28 JML Modified logic to include two additional post discharge Vicodin orders
+ 2014.10.29 JML CSR# 32823: Added logic to make mandatory discontinue checkboxes when opioid analgesics is selected.
+ 2016.04.26 TMS CSR 33465: Add call on Form Close to Medication Order Management MLM
+ 2017.03.03 SSJ CSR # 35110 - Post Op Anterior Cervical Discectomy Order added code for Checkbox 3 and 4.
+ 2017.03.31 SSJ CSR # 35110 - Commented the logic of [MultiOrderGrid, – MultiFieldOccNum’s 11, 39, 40, and 41] As per teresa/Robert{{{SINGLE-QUOTE}}}s mail [SJ20170331]
+ 2018.08.22 JML CSR #37178 - Update MLM to work with changes made as a result of the Order Set Review process
+
+ ;;
+ keywords: Called MLMs, Post Op Lumbar Laminectomy
+ ;;
+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;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+ /*******************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:="";
+
+ myBool := true;
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Mlt_Order_Grid5:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 5);
+ Mlt_Order_Grid28:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 28);
+ Mlt_Order_Grid33:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 33);
+ Mlt_Order_Grid34:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 34);
+ Mlt_Order_Grid35:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 35);
+// [SJ20170331]- Commented as per header comment
+/* Mlt_Order_Grid11:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 11);
+ Mlt_Order_Grid39:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 39);
+ Mlt_Order_Grid40:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 40);
+ Mlt_Order_Grid41:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 41);*/
+ Mtl_Order_Grid43:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 43);
+
+ Chk_DiscPCADay1 := first of (field_list where field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 1);
+ Chk_DiscPCADay2 := first of (field_list where field_list.DataItemName = "PRX_Checkbox2" AND field_list.Control_MultiFieldOccNum = 1);
+ Chk_DiscPCADay3 := first of (field_list where field_list.DataItemName = "PRX_Checkbox3" AND field_list.Control_MultiFieldOccNum = 1);
+ Chk_DiscPCADay4 := first of (field_list where field_list.DataItemName = "PRX_Checkbox4" AND field_list.Control_MultiFieldOccNum = 1);
+ DiscPCARequestedDate := first of (field_list where field_list.DataItemName = "RequestedDate");
+
+ Mlt_Grid5 := Mlt_Order_Grid5.Value;
+ Mlt_Grid28 := Mlt_Order_Grid28.Value;
+ Mlt_Grid33 := Mlt_Order_Grid33.Value;
+ Mlt_Grid34 := Mlt_Order_Grid34.Value;
+ Mlt_Grid35 := Mlt_Order_Grid35.Value;
+ // [SJ20170331]- Commented as per header comment
+ /*Mlt_Grid11 := Mlt_Order_Grid11.Value;
+ Mlt_Grid39 := Mlt_Order_Grid39.Value;
+ Mlt_Grid40 := Mlt_Order_Grid40.Value;
+ Mlt_Grid41 := Mlt_Order_Grid41.Value; */
+ Mlt_Grid43 := Mtl_Order_Grid43.Value;
+
+ falselist28 := ();
+ truelist28 := ();
+ falselist33 := ();
+ truelist33 := ();
+ falselist34 := ();
+ truelist34 := ();
+ falselist35 := ();
+ truelist35 := ();
+ buttonresult:="";
+
+// 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);
+ endif;
+
+ Gridlist28 := count Mlt_Grid28 ;
+ Gridlist33 := count Mlt_Grid33;
+ Gridlist34 := count Mlt_Grid34;
+ Gridlist35 := count Mlt_Grid35;
+
+
+ for p in (1 seqto GridList28) do
+ falselist28 := falselist28, false;
+ truelist28 := truelist28, true;
+ enddo;
+
+ for r in (1 seqto GridList33) do
+ falselist33 := falselist33, false;
+ truelist33 := truelist33, true;
+ enddo;
+
+ for k in (1 seqto GridList34) do
+ falselist34 := falselist34, false;
+ truelist34 := truelist34, true;
+ enddo;
+
+ for s in (1 seqto GridList35) do
+ falselist35 := falselist35, false;
+ truelist35 := truelist35, true;
+ enddo;
+
+ If CallingEvent = "FormOpen" Then
+ Mlt_Grid43.IsReadOnly := true;
+ Endif;
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|28" Then
+ If true in Mlt_Grid28.IsSelected Then
+ Mlt_Grid33.IsSelected := falselist33;
+ Mlt_Grid33.IsReadOnly := truelist33;
+ Mlt_Grid34.IsSelected := falselist34;
+ Mlt_Grid34.IsReadOnly := truelist34;
+ Mlt_Grid35.IsSelected := falselist35;
+ Mlt_Grid35.IsReadOnly := truelist35;
+ /*** Start : CSR # 35110 - Added By shivprasad ****/
+ Chk_DiscPCADay3.Control_Read_Only := true; Chk_DiscPCADay3.Value := False;
+ Chk_DiscPCADay4.Control_Read_Only := true; Chk_DiscPCADay4.Value := False;
+
+ Else
+ Mlt_Grid33.IsReadOnly := falselist33;
+ Mlt_Grid34.IsReadOnly := falselist34;
+ Mlt_Grid35.IsReadOnly := falselist35;
+ /*** Start : CSR # 35110 - Added By shivprasad ****/
+ Chk_DiscPCADay3.Control_Read_Only := False;
+ Chk_DiscPCADay4.Control_Read_Only := False;
+
+ Endif;
+ Endif;
+
+ If CallingField = "MultiOrderGrid|33" Then
+ If true in Mlt_Grid33.IsSelected Then
+
+ Mlt_Grid28.IsSelected := falselist28;
+ Mlt_Grid28.IsReadOnly := truelist28;
+ Mlt_Grid34.IsSelected := falselist34;
+ Mlt_Grid34.IsReadOnly := truelist34;
+ Mlt_Grid35.IsSelected := falselist35;
+ Mlt_Grid35.IsReadOnly := truelist35;
+ /*** Start : CSR # 35110 - Added By shivprasad ****/
+ Chk_DiscPCADay3.Control_Read_Only := true; Chk_DiscPCADay3.Value := False;
+ Chk_DiscPCADay4.Control_Read_Only := true; Chk_DiscPCADay4.Value := False;
+ Else
+ Mlt_Grid28.IsReadOnly := falselist28;
+ Mlt_Grid34.IsReadOnly := falselist34;
+ Mlt_Grid35.IsReadOnly := falselist35;
+ /*** Start : CSR # 35110 - Added By shivprasad ****/
+ Chk_DiscPCADay3.Control_Read_Only := False;
+ Chk_DiscPCADay4.Control_Read_Only := False;
+
+ Endif;
+ Endif;
+
+ If CallingField = "MultiOrderGrid|34" Then
+ If true in Mlt_Grid34.IsSelected Then
+ Mlt_Grid28.IsSelected := falselist28;
+ Mlt_Grid28.IsReadOnly := truelist28;
+ Mlt_Grid33.IsSelected := falselist33;
+ Mlt_Grid33.IsReadOnly := truelist33;
+ Mlt_Grid35.IsSelected := falselist35;
+ Mlt_Grid35.IsReadOnly := truelist35;
+
+ Else
+ Mlt_Grid28.IsReadOnly := falselist28;
+ Mlt_Grid33.IsReadOnly := falselist33;
+ Mlt_Grid35.IsReadOnly := falselist35;
+
+ Endif;
+ Endif;
+
+ If CallingField = "MultiOrderGrid|35" Then
+ If true in Mlt_Grid35.IsSelected Then
+ Mlt_Grid28.IsSelected := falselist28;
+ Mlt_Grid28.IsReadOnly := truelist28;
+ Mlt_Grid33.IsSelected := falselist33;
+ Mlt_Grid33.IsReadOnly := truelist33;
+ Mlt_Grid34.IsSelected := falselist34;
+ Mlt_Grid34.IsReadOnly := truelist34;
+
+ Else
+ Mlt_Grid28.IsReadOnly := falselist28;
+ Mlt_Grid33.IsReadOnly := falselist33;
+ Mlt_Grid34.IsReadOnly := falselist34;
+
+ Endif;
+ Endif;
+
+
+ If CallingField = "MultiOrderGrid|5" Then
+ If true in Mlt_Grid5.IsSelected Then
+
+ If Mlt_Grid5.IsSelected [1] = true Then
+ Mlt_Grid5.IsReadOnly := (False,True,True,True);
+ Endif;
+
+ If Mlt_Grid5.IsSelected [2] = true Then
+ Mlt_Grid5.IsReadOnly := (True,False,True,True);
+ Endif;
+
+ If Mlt_Grid5.IsSelected [3] = true Then
+ Mlt_Grid5.IsReadOnly := (True,True,False,True);
+ Endif;
+
+ If Mlt_Grid5.IsSelected [4] = true Then
+ Mlt_Grid5.IsReadOnly := (True,True,True,False);
+ Endif;
+
+ Else
+ Mlt_Grid5.IsReadOnly := (False,False,False,False);
+ Endif;
+ Endif;
+ //* // [SJ20170331]- Commented as per header comment*/
+ /* If CallingField = "MultiOrderGrid|11" then
+ If true in Mlt_Grid11.IsSelected Then
+ Mlt_Grid39.IsSelected := (False,False);
+ Mlt_Grid39.IsReadOnly := (True,True);
+ Mlt_Grid40.IsSelected := (False,False);
+ Mlt_Grid40.IsReadOnly := (True,True);
+
+ If Mlt_Grid11.IsSelected [1] = True then
+ Mlt_Grid11.IsSelected := (True,False);
+
+ If weightvalue >= 80 then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is greater than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid11.IsSelected := (False,True); endif;
+ endif;
+ endif;
+
+ If Mlt_Grid11.IsSelected [2] = True then
+ Mlt_Grid11.IsSelected := (False, True);
+
+ If (weightvalue < 80 and weightvalue > 0) then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is less than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid11.IsSelected := (True,False); endif;
+ endif;
+ endif;
+
+ Else
+ Mlt_Grid11.IsReadOnly := (False,False);
+ Mlt_Grid39.IsReadOnly := (False,False);
+ Mlt_Grid40.IsReadOnly := (False,False);
+
+ Endif;
+ Endif; //If CallingField = "MultiOrderGrid|11"
+
+ If CallingField = "MultiOrderGrid|39" Then
+ If true in Mlt_Grid39.IsSelected Then
+ Mlt_Grid11.IsSelected := (False,False);
+ Mlt_Grid11.IsReadOnly := (True,True);
+ Mlt_Grid40.IsSelected := (False,False);
+ Mlt_Grid40.IsReadOnly := (True,True);
+
+ If Mlt_Grid39.IsSelected [1] = True then
+ Mlt_Grid39.IsSelected := (True,False);
+
+ If weightvalue >= 80 then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is greater than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid39.IsSelected := (False,True); endif;
+ endif;
+ endif;
+
+ If Mlt_Grid39.IsSelected [2] = True then
+ Mlt_Grid39.IsSelected := (False, True);
+
+ If (weightvalue < 80 and weightvalue > 0) then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is less than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid39.IsSelected := (True, False); endif;
+ endif;
+ endif;
+ Else
+ Mlt_Grid11.IsReadOnly := (False,False);
+ Mlt_Grid40.IsReadOnly := (False,False);
+
+ Endif;
+ Endif; //If CallingField = "MultiOrderGrid|39"
+
+ If CallingField = "MultiOrderGrid|40" Then
+ If true in Mlt_Grid40.IsSelected Then
+ Mlt_Grid11.IsSelected := (False,False);
+ Mlt_Grid11.IsReadOnly := (True,True);
+ Mlt_Grid39.IsSelected := (False,False);
+ Mlt_Grid39.IsReadOnly := (True,True);
+
+ If Mlt_Grid40.IsSelected [1] = True then
+ Mlt_Grid40.IsSelected := (True,False);
+
+ If weightvalue >= 80 then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is greater than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid40.IsSelected := (False, True); endif;
+ endif;
+
+ If weightvalue < 50 and weightvalue > 0 then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is less than 50kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid40.IsSelected := (False, True); endif;
+ endif;
+ endif;
+
+ If Mlt_Grid40.IsSelected [2] = True then
+ Mlt_Grid40.IsSelected := (False, True);
+
+ If (weightvalue >= 50 and weightvalue < 80) then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is between 50kg to 79kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid40.IsSelected := (True, False); endif;
+ endif;
+ endif;
+ Else
+ Mlt_Grid40.IsSelected := (False,False);
+ Mlt_Grid11.IsReadOnly := (False,False);
+ Mlt_Grid39.IsReadOnly := (False,False);
+ Endif;
+ Endif; //If CallingField = "MultiOrderGrid|40"
+
+ If CallingField = "MultiOrderGrid|41" Then
+ If true in Mlt_Grid41.IsSelected Then
+ Mlt_Grid11.IsSelected := (False,False);
+ Mlt_Grid11.IsReadOnly := (True,True);
+ Mlt_Grid39.IsSelected := (False,False);
+ Mlt_Grid39.IsReadOnly := (True,True);
+ Mlt_Grid40.IsSelected := (False,False);
+ Mlt_Grid40.IsReadOnly := (True, True);
+ Else
+ Mlt_Grid11.IsReadOnly := (False,False);
+ Mlt_Grid39.IsReadOnly := (False,False);
+ Mlt_Grid40.IsReadOnly := (False,False);
+ Endif;
+ Endif; //If CallingField = "MultiOrderGrid|41" */
+
+ if (CallingField = "PRX_Checkbox1|1") then
+ if (Chk_DiscPCADay1.Value = true) then
+ Chk_DiscPCADay2.Control_Read_Only := true;
+ Mlt_Grid43.IsSelected := true;
+
+ PostOpDay1Date := (NOW + 1 day) FORMATTED WITH "%.2t";
+ If (Chk_DiscPCADay3.Value = true) then
+ DiscPCARequestedDate.Value := (NOW) FORMATTED WITH "%.2t";
+ Else
+ DiscPCARequestedDate.Value := PostOpDay1Date;
+ Endif;
+
+ else
+ Chk_DiscPCADay2.Control_Read_Only := false;
+ Mlt_Grid43.IsSelected := false;
+ DiscPCARequestedDate.Value := "";
+
+ endif;
+ endif; //If CallingField = "PRX_Checkbox1|1"
+
+ if (CallingField = "PRX_Checkbox2|1") then
+ if (Chk_DiscPCADay2.Value = true) then
+ Chk_DiscPCADay1.Control_Read_Only := true;
+ Mlt_Grid43.IsSelected := true;
+
+ PostOpDay2Date := (NOW + 2 day) FORMATTED WITH "%.2t";
+ If (Chk_DiscPCADay3.Value = true) then
+ DiscPCARequestedDate.Value := (NOW) FORMATTED WITH "%.2t";
+ Else
+ DiscPCARequestedDate.Value := PostOpDay2Date;
+ Endif;
+ else
+ Chk_DiscPCADay1.Control_Read_Only := false;
+ Mlt_Grid43.IsSelected := false;
+ DiscPCARequestedDate.Value := "";
+
+ endif;
+ endif; //If CallingField = "PrX_Checkbox2|1"
+
+/*** Start : Added By shivprasad ****/
+
+ if (CallingField = "PRX_Checkbox3|1") then
+ if (Chk_DiscPCADay3.Value = true) then
+ Chk_DiscPCADay4.Control_Read_Only := true;
+ //Mlt_Grid43.IsSelected := true;
+
+ PostOpDay1Date3 := (NOW ) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date3;
+ else
+ Chk_DiscPCADay4.Control_Read_Only := false;
+ //Mlt_Grid43.IsSelected := false;
+ DiscPCARequestedDate.Value := "";
+ If (Chk_DiscPCADay1.Value = true) then
+ PostOpDay1Date := (NOW + 1 day) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date;
+ ElseIf (Chk_DiscPCADay2.Value = true) then
+ PostOpDay2Date := (NOW + 2 day) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay2Date;
+ Else
+ PostOpDay1Date3 := (NOW ) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date3;
+ Endif;
+
+ endif;
+ endif; //If CallingField = "PRX_Checkbox3|1"
+
+ if (CallingField = "PRX_Checkbox4|1") then
+ if (Chk_DiscPCADay4.Value = true) then
+ Chk_DiscPCADay3.Control_Read_Only := true;
+ //Mlt_Grid43.IsSelected := true;
+ If (Chk_DiscPCADay1.Value = true) then
+ PostOpDay1Date := (NOW + 1 day) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date;
+ ElseIf (Chk_DiscPCADay2.Value = true) then
+ PostOpDay2Date := (NOW + 2 day) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay2Date;
+ Else
+ PostOpDay1Date3 := (NOW ) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date3;
+ Endif;
+ else
+ Chk_DiscPCADay3.Control_Read_Only := false;
+ //Mlt_Grid43.IsSelected := false;
+ DiscPCARequestedDate.Value := "";
+
+ endif;
+ endif; //If CallingField = "PrX_Checkbox4|1"
+
+
+ /*** End : Added By Shivprasad ***/
+
+
+
+ elseif ( callingEvent = "FormClose" ) then
+
+
+ //Check to see if Opioid Analgesic PCA order was selected
+ If ( ( true in Mlt_Grid28.IsSelected ) OR ( true in Mlt_Grid33.IsSelected )
+ OR ( true in Mlt_Grid34.IsSelected ) OR ( true in Mlt_Grid35.IsSelected ) ) Then
+
+ if ( ( Chk_DiscPCADay1.Value = false ) AND ( Chk_DiscPCADay2.Value = false ) ) then
+ alert_message := "Please select a Discontinue PCA/IV Opioid Post op Day 1 or Day 2 checkbox.";
+ this_communication.DisplayForm := true;
+ this_communication.Message := alert_message;
+ this_communication.MessageType := "Error";
+
+ endif;
+ endif;
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ Endif; // If callingEvent = "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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_POSTOP_LUMBAR_LAM.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_POSTOP_LUMBAR_LAM.mlm
new file mode 100644
index 0000000..5121804
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_POSTOP_LUMBAR_LAM.mlm
@@ -0,0 +1,496 @@
+maintenance:
+
+ title: Multi Dose Now and Then Orders;;
+ mlmname: FORM_Set_PostOp_Lumbar_Lam;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Michele Payne, Allscripts;;
+ date: 2011-11-01;;
+ validation: testing;;
+
+library:
+ purpose: Used for grids to limit duplicate selections for analgesics and antibiotics
+ ;;
+
+ explanation: This MLM is called from the Post Op Lumbar Laminectomy Order Set
+
+ Change history
+ 2011.01.11 TMS Created for CSR #26791
+ 2012.03.16 JML Added logic to restrict IV management of discontinue of PCA/IV Opioid
+ and auto fill the post op day to either T+1 or T+2, depending on user selected option.
+ 2012.03.28 JML Modified logic to include two additional post discharge Vicodin orders
+ 2014.10.29 JML CSR 32824: Modified logic to display alert on form close if Opioid analgesic med
+ was selected without selecting a post op discontinue pca order
+ 2014.11.05 JML CSR 32824: Moved to production
+ 2016.04.26 TMS CSR 33465: Add call on Form Close to Medication Order Management MLM
+ 2017.03.03 SSJ CSR # 35111 - Post Op Anterior Cervical Discectomy Order added code for Checkbox 3 and 4.
+ 2017.03.31 SSJ CSR # 35110 - Commented the logic of [MultiOrderGrid, – MultiFieldOccNum’s 11, 39, 40, and 41] As per teresa/Robert{{{SINGLE-QUOTE}}}s mail [SJ20170331]
+ 2018.08.22 JML CSR # 37177, 37176 - Update logic as a result of Order Set Review process.
+ ;;
+ keywords: Called MLMs, Post Op Lumbar Laminectomy
+ ;;
+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;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Mlt_Order_Grid5:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 5);
+ Mlt_Order_Grid28:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 28);
+ Mlt_Order_Grid33:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 33);
+ Mlt_Order_Grid34:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 34);
+ Mlt_Order_Grid35:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 35);
+// [SJ20170331]- Commented as per header comment
+/*
+ Mlt_Order_Grid11:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 11);
+ Mlt_Order_Grid39:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 39);
+ Mlt_Order_Grid40:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 40);
+ Mlt_Order_Grid41:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 41); */
+ Mtl_Order_Grid42:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 42);
+
+ Chk_DiscPCADay1 := first of (field_list where field_list.DataItemName = "PRX_Checkbox1");
+ Chk_DiscPCADay2 := first of (field_list where field_list.DataItemName = "PRX_Checkbox2");
+ /*** Start : CSR # 35111 - Added By shivprasad ****/
+ Chk_DiscPCADay3 := first of (field_list where field_list.DataItemName = "PRX_Checkbox3" AND field_list.Control_MultiFieldOccNum = 1);
+ Chk_DiscPCADay4 := first of (field_list where field_list.DataItemName = "PRX_Checkbox4" AND field_list.Control_MultiFieldOccNum = 1);
+ /*** End : CSR # 35111 - Added By shivprasad ****/
+ DiscPCARequestedDate := first of (field_list where field_list.DataItemName = "RequestedDate");
+
+ Mlt_Grid5 := Mlt_Order_Grid5.Value;
+ Mlt_Grid28 := Mlt_Order_Grid28.Value;
+ Mlt_Grid33 := Mlt_Order_Grid33.Value;
+ Mlt_Grid34 := Mlt_Order_Grid34.Value;
+ Mlt_Grid35 := Mlt_Order_Grid35.Value;
+// [SJ20170331]- Commented as per header comment
+/* Mlt_Grid11 := Mlt_Order_Grid11.Value;
+ Mlt_Grid39 := Mlt_Order_Grid39.Value;
+ Mlt_Grid40 := Mlt_Order_Grid40.Value;
+ Mlt_Grid41 := Mlt_Order_Grid41.Value; */
+ Mlt_Grid42 := Mtl_Order_Grid42.Value;
+
+ falselist28 := ();
+ truelist28 := ();
+ falselist33 := ();
+ truelist33 := ();
+ falselist34 := ();
+ truelist34 := ();
+ falselist35 := ();
+ truelist35 := ();
+ buttonresult:="";
+
+// 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);
+ endif;
+
+ Gridlist28 := count Mlt_Grid28 ;
+ Gridlist33 := count Mlt_Grid33;
+ Gridlist34 := count Mlt_Grid34;
+ Gridlist35 := count Mlt_Grid35;
+
+
+ for p in (1 seqto GridList28) do
+ falselist28 := falselist28, false;
+ truelist28 := truelist28, true;
+ enddo;
+
+ for r in (1 seqto GridList33) do
+ falselist33 := falselist33, false;
+ truelist33 := truelist33, true;
+ enddo;
+
+ for k in (1 seqto GridList34) do
+ falselist34 := falselist34, false;
+ truelist34 := truelist34, true;
+ enddo;
+
+ for s in (1 seqto GridList35) do
+ falselist35 := falselist35, false;
+ truelist35 := truelist35, true;
+ enddo;
+
+ If CallingEvent = "FormOpen" Then
+ Mlt_Grid42.IsReadOnly := true;
+ Endif;
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|28" Then
+ If true in Mlt_Grid28.IsSelected Then
+ Mlt_Grid33.IsSelected := falselist33;
+ Mlt_Grid33.IsReadOnly := truelist33;
+ Mlt_Grid34.IsSelected := falselist34;
+ Mlt_Grid34.IsReadOnly := truelist34;
+ Mlt_Grid35.IsSelected := falselist35;
+ Mlt_Grid35.IsReadOnly := truelist35;
+ /*** Start : CSR # 35110 - Added By shivprasad ****/
+ Chk_DiscPCADay3.Control_Read_Only := true; Chk_DiscPCADay3.Value := False;
+ Chk_DiscPCADay4.Control_Read_Only := true; Chk_DiscPCADay4.Value := False;
+
+ Else
+ Mlt_Grid33.IsReadOnly := falselist33;
+ Mlt_Grid34.IsReadOnly := falselist34;
+ Mlt_Grid35.IsReadOnly := falselist35;
+ /*** Start : CSR # 35110 - Added By shivprasad ****/
+ Chk_DiscPCADay3.Control_Read_Only := False;
+ Chk_DiscPCADay4.Control_Read_Only := False;
+
+ Endif;
+ Endif;
+
+ If CallingField = "MultiOrderGrid|33" Then
+ If true in Mlt_Grid33.IsSelected Then
+
+ Mlt_Grid28.IsSelected := falselist28;
+ Mlt_Grid28.IsReadOnly := truelist28;
+ Mlt_Grid34.IsSelected := falselist34;
+ Mlt_Grid34.IsReadOnly := truelist34;
+ Mlt_Grid35.IsSelected := falselist35;
+ Mlt_Grid35.IsReadOnly := truelist35;
+ /*** Start : CSR # 35110 - Added By shivprasad ****/
+ Chk_DiscPCADay3.Control_Read_Only := true; Chk_DiscPCADay3.Value := False;
+ Chk_DiscPCADay4.Control_Read_Only := true; Chk_DiscPCADay4.Value := False;
+ Else
+ Mlt_Grid28.IsReadOnly := falselist28;
+ Mlt_Grid34.IsReadOnly := falselist34;
+ Mlt_Grid35.IsReadOnly := falselist35;
+ /*** Start : CSR # 35110 - Added By shivprasad ****/
+ Chk_DiscPCADay3.Control_Read_Only := False;
+ Chk_DiscPCADay4.Control_Read_Only := False;
+
+ Endif;
+ Endif;
+
+ If CallingField = "MultiOrderGrid|34" Then
+ If true in Mlt_Grid34.IsSelected Then
+ Mlt_Grid28.IsSelected := falselist28;
+ Mlt_Grid28.IsReadOnly := truelist28;
+ Mlt_Grid33.IsSelected := falselist33;
+ Mlt_Grid33.IsReadOnly := truelist33;
+ Mlt_Grid35.IsSelected := falselist35;
+ Mlt_Grid35.IsReadOnly := truelist35;
+ Else
+ Mlt_Grid28.IsReadOnly := falselist28;
+ Mlt_Grid33.IsReadOnly := falselist33;
+ Mlt_Grid35.IsReadOnly := falselist35;
+ Endif;
+ Endif;
+
+ If CallingField = "MultiOrderGrid|35" Then
+ If true in Mlt_Grid35.IsSelected Then
+ Mlt_Grid28.IsSelected := falselist28;
+ Mlt_Grid28.IsReadOnly := truelist28;
+ Mlt_Grid33.IsSelected := falselist33;
+ Mlt_Grid33.IsReadOnly := truelist33;
+ Mlt_Grid34.IsSelected := falselist34;
+ Mlt_Grid34.IsReadOnly := truelist34;
+ Else
+ Mlt_Grid28.IsReadOnly := falselist28;
+ Mlt_Grid33.IsReadOnly := falselist33;
+ Mlt_Grid34.IsReadOnly := falselist34;
+ Endif;
+ Endif;
+
+
+ If CallingField = "MultiOrderGrid|5" Then
+ If true in Mlt_Grid5.IsSelected Then
+
+ If Mlt_Grid5.IsSelected [1] = true Then
+ Mlt_Grid5.IsReadOnly := (False,True,True,True);
+ Endif;
+
+ If Mlt_Grid5.IsSelected [2] = true Then
+ Mlt_Grid5.IsReadOnly := (True,False,True,True);
+ Endif;
+
+ If Mlt_Grid5.IsSelected [3] = true Then
+ Mlt_Grid5.IsReadOnly := (True,True,False,True);
+ Endif;
+
+ If Mlt_Grid5.IsSelected [4] = true Then
+ Mlt_Grid5.IsReadOnly := (True,True,True,False);
+ Endif;
+
+ Else
+ Mlt_Grid5.IsReadOnly := (False,False,False,False);
+ Endif;
+ Endif;
+// [SJ20170331]- Commented as per header comment
+/*
+ If CallingField = "MultiOrderGrid|11" then
+ If true in Mlt_Grid11.IsSelected Then
+ Mlt_Grid39.IsSelected := (False,False);
+ Mlt_Grid39.IsReadOnly := (True,True);
+ Mlt_Grid40.IsSelected := (False,False);
+ Mlt_Grid40.IsReadOnly := (True,True);
+
+ If Mlt_Grid11.IsSelected [1] = True then
+ Mlt_Grid11.IsSelected := (True,False);
+
+ If weightvalue >= 80 then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is greater than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid11.IsSelected := (False,True); endif;
+ endif;
+ endif;
+
+ If Mlt_Grid11.IsSelected [2] = True then
+ Mlt_Grid11.IsSelected := (False, True);
+
+ If (weightvalue < 80 and weightvalue > 0) then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is less than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid11.IsSelected := (True,False); endif;
+ endif;
+ endif;
+
+ Else
+ Mlt_Grid11.IsReadOnly := (False,False);
+ Mlt_Grid39.IsReadOnly := (False,False);
+ Mlt_Grid40.IsReadOnly := (False,False);
+
+ Endif;
+ Endif; //If CallingField = "MultiOrderGrid|11"
+
+ If CallingField = "MultiOrderGrid|39" Then
+ If true in Mlt_Grid39.IsSelected Then
+ Mlt_Grid11.IsSelected := (False,False);
+ Mlt_Grid11.IsReadOnly := (True,True);
+ Mlt_Grid40.IsSelected := (False,False);
+ Mlt_Grid40.IsReadOnly := (True,True);
+
+ If Mlt_Grid39.IsSelected [1] = True then
+ Mlt_Grid39.IsSelected := (True,False);
+
+ If weightvalue >= 80 then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is greater than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid39.IsSelected := (False,True); endif;
+ endif;
+ endif;
+
+ If Mlt_Grid39.IsSelected [2] = True then
+ Mlt_Grid39.IsSelected := (False, True);
+
+ If (weightvalue < 80 and weightvalue > 0) then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is less than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid39.IsSelected := (True, False); endif;
+ endif;
+ endif;
+ Else
+ Mlt_Grid11.IsReadOnly := (False,False);
+ Mlt_Grid40.IsReadOnly := (False,False);
+
+ Endif;
+ Endif; //If CallingField = "MultiOrderGrid|39"
+
+ If CallingField = "MultiOrderGrid|40" Then
+ If true in Mlt_Grid40.IsSelected Then
+ Mlt_Grid11.IsSelected := (False,False);
+ Mlt_Grid11.IsReadOnly := (True,True);
+ Mlt_Grid39.IsSelected := (False,False);
+ Mlt_Grid39.IsReadOnly := (True,True);
+
+ If Mlt_Grid40.IsSelected [1] = True then
+ Mlt_Grid40.IsSelected := (True,False);
+
+ If weightvalue >= 80 then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is greater than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid40.IsSelected := (False, True); endif;
+ endif;
+
+ If weightvalue < 50 and weightvalue > 0 then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is less than 50kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid40.IsSelected := (False, True); endif;
+ endif;
+ endif;
+
+ If Mlt_Grid40.IsSelected [2] = True then
+ Mlt_Grid40.IsSelected := (False, True);
+
+ If (weightvalue >= 50 and weightvalue < 80) then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is between 50kg to 79kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ buttonresult := dialogResult as string;
+ If buttonresult = "Yes" then Mlt_Grid40.IsSelected := (True, False); endif;
+ endif;
+ endif;
+ Else
+ Mlt_Grid40.IsSelected := (False,False);
+ Mlt_Grid11.IsReadOnly := (False,False);
+ Mlt_Grid39.IsReadOnly := (False,False);
+ Endif;
+ Endif; //If CallingField = "MultiOrderGrid|40"
+
+ If CallingField = "MultiOrderGrid|41" Then
+ If true in Mlt_Grid41.IsSelected Then
+ Mlt_Grid11.IsSelected := (False,False);
+ Mlt_Grid11.IsReadOnly := (True,True);
+ Mlt_Grid39.IsSelected := (False,False);
+ Mlt_Grid39.IsReadOnly := (True,True);
+ Mlt_Grid40.IsSelected := (False,False);
+ Mlt_Grid40.IsReadOnly := (True, True);
+ Else
+ Mlt_Grid11.IsReadOnly := (False,False);
+ Mlt_Grid39.IsReadOnly := (False,False);
+ Mlt_Grid40.IsReadOnly := (False,False);
+ Endif;
+ Endif; //If CallingField = "MultiOrderGrid|41" */
+
+
+ if (CallingField = "PRX_Checkbox1|1") then
+ if (Chk_DiscPCADay1.Value = true) then
+ Chk_DiscPCADay2.Control_Read_Only := true;
+ Mlt_Grid42.IsSelected := true;
+
+ PostOpDay1Date := (NOW + 1 day) FORMATTED WITH "%.2t";
+ If (Chk_DiscPCADay3.Value = true) then
+ DiscPCARequestedDate.Value := (NOW) FORMATTED WITH "%.2t";
+ Else
+ DiscPCARequestedDate.Value := PostOpDay1Date;
+ Endif;
+
+ else
+ Chk_DiscPCADay2.Control_Read_Only := false;
+ Mlt_Grid42.IsSelected := false;
+ DiscPCARequestedDate.Value := "";
+
+ endif;
+ endif; //If CallingField = "PRX_Checkbox1|1"
+
+
+ if (CallingField = "PRX_Checkbox2|1") then
+ if (Chk_DiscPCADay2.Value = true) then
+ Chk_DiscPCADay1.Control_Read_Only := true;
+ Mlt_Grid42.IsSelected := true;
+
+ PostOpDay2Date := (NOW + 2 day) FORMATTED WITH "%.2t";
+ If (Chk_DiscPCADay3.Value = true) then
+ DiscPCARequestedDate.Value := (NOW) FORMATTED WITH "%.2t";
+ Else
+ DiscPCARequestedDate.Value := PostOpDay2Date;
+ Endif;
+ else
+ Chk_DiscPCADay1.Control_Read_Only := false;
+ Mlt_Grid42.IsSelected := false;
+ DiscPCARequestedDate.Value := "";
+
+ endif;
+ endif; //If CallingField = "PrX_Checkbox2|1"
+
+/*** Start : Added By shivprasad ****/
+
+ if (CallingField = "PRX_Checkbox3|1") then
+ if (Chk_DiscPCADay3.Value = true) then
+ Chk_DiscPCADay4.Control_Read_Only := true;
+
+
+ PostOpDay1Date3 := (NOW ) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date3;
+ else
+ Chk_DiscPCADay4.Control_Read_Only := false;
+ DiscPCARequestedDate.Value := "";
+
+ If (Chk_DiscPCADay1.Value = true) then
+ PostOpDay1Date := (NOW + 1 day) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date;
+ ElseIf (Chk_DiscPCADay2.Value = true) then
+ PostOpDay2Date := (NOW + 2 day) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay2Date;
+ Else
+ PostOpDay1Date3 := (NOW ) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date3;
+ Endif;
+
+ endif;
+ endif; //If CallingField = "PRX_Checkbox3|1"
+
+ if (CallingField = "PRX_Checkbox4|1") then
+ if (Chk_DiscPCADay4.Value = true) then
+ Chk_DiscPCADay3.Control_Read_Only := true;
+
+ If (Chk_DiscPCADay1.Value = true) then
+ PostOpDay1Date := (NOW + 1 day) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date;
+ ElseIf (Chk_DiscPCADay2.Value = true) then
+ PostOpDay2Date := (NOW + 2 day) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay2Date;
+ Else
+ PostOpDay1Date3 := (NOW ) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date3;
+ Endif;
+ else
+ Chk_DiscPCADay3.Control_Read_Only := false;
+ DiscPCARequestedDate.Value := "";
+
+ endif;
+ endif; //If CallingField = "PrX_Checkbox4|1"
+
+
+ /*** End : Added By Shivprasad ***/
+
+ //CSR 32824 Change
+ elseif ( callingEvent = "FormClose" ) then
+
+ //Check to see if Opioid Analgesic PCA order was selected
+ If ( ( true in Mlt_Grid28.IsSelected ) OR ( true in Mlt_Grid33.IsSelected )
+ OR ( true in Mlt_Grid34.IsSelected ) OR ( true in Mlt_Grid35.IsSelected ) ) Then
+
+ if ( ( Chk_DiscPCADay1.Value = false ) AND ( Chk_DiscPCADay2.Value = false ) ) then
+ alert_message := "Please select a Discontinue PCA/IV Opioid Post op Day 1 or Day 2 checkbox.";
+ this_communication.DisplayForm := true;
+ this_communication.Message := alert_message;
+ this_communication.MessageType := "Error";
+
+ endif;
+ endif;
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ Endif; // If callingEvent = "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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_POST_OP_COLON_RESECTION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_POST_OP_COLON_RESECTION.mlm
new file mode 100644
index 0000000..f845467
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_POST_OP_COLON_RESECTION.mlm
@@ -0,0 +1,143 @@
+maintenance:
+
+ title: FORM_SET_POST_OP_COLON_RESECTION;;
+ mlmname: FORM_SET_POST_OP_COLON_RESECTION;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Janet Nordin;;
+ specialist: Don Warnick;;
+ date: 2016-05-16;;
+ validation: testing;;
+
+library:
+ purpose: Select orders from the Post OP Colon Resection OS based upon the selection from the Glucose Control field
+ ;;
+
+ explanation: This MLM is called from the Post OP Colon Resection OS
+
+
+ Change history
+
+ 05.16.2016 - DJW CSR# 34623 - Created
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ GlucoseControlDiabetic := first of (field_list where field_list.DataItemName = "Diabetic and/or Received Insulin IntraOp");
+ GlucoseControlNonDiabetic:= first of (field_list where field_list.DataItemName = "NonDiabetic/No Insulin received IntraOp");
+
+ DiabeticGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 67);
+ NonDiabeticGrid:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 68);
+
+ RequiredField:= first of (field_list where field_list.DataItemName = "Required Field");
+
+
+ // Field Change Event
+
+
+ If this_communication.CallingFieldLabel = "Diabetic and/or Received Insulin IntraOp"
+
+ then
+
+ if GlucoseControlDiabetic.Value = true
+
+ then
+ GlucoseControlNonDiabetic.Value := false;
+ RequiredField.Value := "Glucose Control Addressed";
+
+ index_list := 1 seqto (count DiabeticGrid.Value);
+ for I in index_list do
+ if DiabeticGrid.Value[I].name <> "Subcutaneous Insulin Orders"
+ then
+ DiabeticGrid.Value[I].IsSelected := True;
+ DiabeticGrid.Value[I].IsReadOnly := True;
+ endif;
+ enddo;
+
+ index_list := 1 seqto (count NonDiabeticGrid.Value);
+ for I in index_list do
+ NonDiabeticGrid.Value[I].IsSelected := False;
+ NonDiabeticGrid.Value[I].IsReadOnly := True;
+ enddo;
+
+ else
+
+ GlucoseControlDiabetic.Value := true;
+
+ endif;
+
+ endif;
+
+
+
+ // Select the orders in the Non-Diabetic Grid
+
+
+ If this_communication.CallingFieldLabel = "NonDiabetic/No Insulin received IntraOp"
+
+ then
+
+ if GlucoseControlNonDiabetic.Value = true
+
+ then
+
+ GlucoseControlDiabetic.Value := false;
+ RequiredField.Value := "Glucose Control Addressed";
+
+ index_list := 1 seqto (count NonDiabeticGrid.Value);
+ for I in index_list do
+ NonDiabeticGrid.Value[I].IsSelected := True;
+ NonDiabeticGrid.Value[I].IsReadOnly := True;
+ enddo;
+
+ index_list := 1 seqto (count DiabeticGrid.Value);
+ for I in index_list do
+ if DiabeticGrid.Value[I].name <> "Subcutaneous Insulin Orders"
+ then
+ DiabeticGrid.Value[I].IsSelected := False;
+ DiabeticGrid.Value[I].IsReadOnly := True;
+ endif;
+ enddo;
+
+ else
+
+ GlucoseControlNonDiabetic.Value := true;
+
+ endif;
+
+ endif;
+
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_POST_OP_NECK_DISSECTION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_POST_OP_NECK_DISSECTION.mlm
new file mode 100644
index 0000000..26b5b49
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_POST_OP_NECK_DISSECTION.mlm
@@ -0,0 +1,274 @@
+maintenance:
+
+ title: Post Op Neck Dissection;;
+ mlmname: FORM_Set_Post_Op_Neck_Dissection;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts Corp ext 7448;;
+ specialist: Dean Miklavic, Allscripts Corp Ext 7466;;
+ date: 2014-09-09;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids on post op Neck Dissection Orders
+ ;;
+
+ explanation: This MLM is called from the post op Neck Dissection order set
+
+
+Change history
+
+ 09.09.2014 TMS Created for new order set CSR #32692
+ 02/21/2017 TMS CSR: 35186 Updated search for "Hydrocodone 5mg/Acetaminophen 325mg name change
+ 12/10/2018 TMS CSR: 37613 Updated logic to change Cefazolin dosing from 1 gm for wt < 80 kg and
+ 2 gm for wt >= 80 kg to Cefazolin 2 gm for wt < 120 kg and 3 gm for wt >= 120 kg.
+
+ ;;
+
+ keywords: Called MLMs, Neck Dissection, Post Op
+ ;;
+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;
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ //local_session := cds_session.local;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Antibiotic_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 64);
+ Antibiotic_Orders_List := Antibiotic_Orders.Value;
+
+ Cefazolin_2gm := first of (Antibiotic_Orders_List where Antibiotic_Orders_List.Name = "Cefazolin:");
+ Cefazolin_3gm := last of (Antibiotic_Orders_List where Antibiotic_Orders_List.Name = "Cefazolin:");
+ Amp_Sulbactam_1_5gm := first of (Antibiotic_Orders_List where Antibiotic_Orders_List.Name = "Ampicillin/Sulbactam:");
+ Amp_Sulbactam_3gm := last of (Antibiotic_Orders_List where Antibiotic_Orders_List.Name = "Ampicillin/Sulbactam:");
+
+ Pain_Med_Orders_Mod := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 67);
+ Pain_Med_Orders_Mod_List := Pain_Med_Orders_Mod.Value;
+
+ Pain_Med_Orders_Sev := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 68);
+ Pain_Med_Orders_Sev_List := Pain_Med_Orders_Sev.Value;
+
+ Oxycod_Acet_Soln_5ml := first of (Pain_Med_Orders_Mod_List where Pain_Med_Orders_Mod_List.Name = "OxyCODONE 5mg/Acetaminophen 325mg Soln");
+ Hydrocod_Acet := last of (Pain_Med_Orders_Mod_List where Pain_Med_Orders_Mod_List.Name matches pattern "Hydrocodone 5mg/Acetaminophen 325mg%");
+ Morphine_Inj := last of (Pain_Med_Orders_Sev_List where Pain_Med_Orders_Sev_List.Name = "Morphine Inj");
+ Oxycod_Acet_Soln_10ml := last of (Pain_Med_Orders_Sev_List where Pain_Med_Orders_Sev_List.Name = "OxyCODONE 5mg/Acetaminophen 325mg Soln");
+ Oxycod_Acet_Tab := last of (Pain_Med_Orders_Sev_List where Pain_Med_Orders_Sev_List.Name = "OxyCODONE 5mg/Acetaminophen 325mg Tab");
+
+ No_Pt_Weight := "There is no weight documented on this visit. Please enter a weight or verify you are selecting the correct dose based upon the patient{{{SINGLE-QUOTE}}}s known weight.";
+
+ Nursing_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 48);
+ Nursing_Orders_List := Nursing_Orders.Value;
+ Dressing_Order := first of (Nursing_Orders_List where Nursing_Orders_List.Name = "Nurse Instruction:");
+
+ Medication_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 49);
+ Medication_Orders_List := Medication_Orders.Value;
+ NeoPolyBacOint_Order := first of (Medication_Orders_List where Medication_Orders_List.Name = "Neomycin/Polymixin/Bacitracin Ointment");
+
+ // 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);
+ Endif;
+
+ If weightvalue is null or weightvalue = 0 then
+ needweight := true;
+ Else needweight := false;
+ If weightvalue >0 and weightvalue <120 then lowdose := true;
+ Elseif weightvalue >=120 then lowdose := false;
+ Endif;
+ Endif;
+
+ // On form open if weight is present disable cefazolin dose not appropriate for patient weight
+
+ If CallingEvent = "FormOpen" then
+ If lowdose = true then
+ Antibiotic_Orders_List.IsReadOnly := (false, true, false, false);
+ Elseif lowdose = false then
+ Antibiotic_Orders_List.IsReadOnly := (true, false, false, false);
+ Else
+ Antibiotic_Orders_List.IsReadOnly := (false, false, false, false);
+ Endif;
+ Endif;
+
+ // Determine which cefazolin dose is available based upon patient weight
+ If CallingEvent = "FieldChange" and (CallingField = "CombinedMeasurements|1") then
+ If weightvalue >0 and weightvalue <120 then lowdose := true;
+ Elseif weightvalue >=120 then lowdose := false;
+ Endif;
+
+ If lowdose = true and Cefazolin_3gm.IsSelected = true and needweight = false then
+ Cefazolin_2gm.IsSelected := true;
+ Cefazolin_3gm.IsSelected := false;
+ Amp_Sulbactam_1_5gm.IsSelected := false;
+ Amp_Sulbactam_3gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (false, true, true, true);
+ Elseif lowdose = false and Cefazolin_2gm.IsSelected = true and needweight = false then
+ Cefazolin_2gm.IsSelected := false;
+ Cefazolin_3gm.IsSelected := true;
+ Amp_Sulbactam_1_5gm.IsSelected := false;
+ Amp_Sulbactam_3gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, false, true, true);
+ endif;
+ endif;
+
+ // Disable remaining moderate pain med selections when one is selected by user
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderGrid|67") then
+
+ If Oxycod_Acet_Soln_5ml.IsSelected = true then
+ Hydrocod_Acet.IsSelected := false;
+ Pain_Med_Orders_Mod_List.IsReadOnly := (false, true);
+ Elseif
+ Hydrocod_Acet.IsSelected = true then
+ Oxycod_Acet_Soln_5ml.IsSelected := false;
+ Pain_Med_Orders_Mod_List.IsReadOnly := (true, false);
+ Else
+ Pain_Med_Orders_Mod_List.IsReadOnly := (false, false);
+ Endif;
+ Endif;
+
+ // Disable remaining severe pain med selections when one is selected by user
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderGrid|68") then
+
+ If Morphine_Inj.IsSelected = true then
+ Oxycod_Acet_Tab.IsSelected := false;
+ Oxycod_Acet_Soln_10ml.IsSelected := false;
+ Pain_Med_Orders_Sev_List.IsReadOnly := (false, true, true);
+ Elseif
+ Oxycod_Acet_Soln_10ml.IsSelected = true then
+ Morphine_Inj.IsSelected := false;
+ Oxycod_Acet_Tab.IsSelected := false;
+ Pain_Med_Orders_Sev_List.IsReadOnly := (true, false, true);
+ Elseif
+ Oxycod_Acet_Tab.IsSelected = true then
+ Morphine_Inj.IsSelected := false;
+ Oxycod_Acet_Soln_10ml.IsSelected := false;
+ Pain_Med_Orders_Sev_List.IsReadOnly := (true, true, false);
+ Else
+ Pain_Med_Orders_Sev_List.IsReadOnly := (false, false, false);
+
+ Endif;
+ Endif;
+
+ // Disable remaining antibiotic selections when one is selected by user. If no weight is available alert user
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderGrid|64") then
+
+ If Cefazolin_2gm.IsSelected = true and needweight = false and lowdose = true then
+ Cefazolin_3gm.IsSelected := false;
+ Amp_Sulbactam_1_5gm.IsSelected := false;
+ Amp_Sulbactam_3gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (false, true, true, true);
+ ElseIf
+ Cefazolin_2gm.IsSelected = true and needweight = false and lowdose = false then
+ Cefazolin_2gm.IsSelected := false;
+ Cefazolin_3gm.IsSelected := true;
+ Amp_Sulbactam_1_5gm.IsSelected := false;
+ Amp_Sulbactam_3gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, false, true, true);
+ ElseIf
+ Cefazolin_3gm.IsSelected = true and needweight = false and lowdose = false then
+ Cefazolin_2gm.IsSelected := false;
+ Cefazolin_3gm.IsSelected := true;
+ Amp_Sulbactam_1_5gm.IsSelected := false;
+ Amp_Sulbactam_3gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, false, true, true);
+ ElseIf
+ Cefazolin_3gm.IsSelected = true and needweight = false and lowdose = true then
+ Cefazolin_2gm.IsSelected := true;
+ Cefazolin_3gm.IsSelected := false;
+ Amp_Sulbactam_1_5gm.IsSelected := false;
+ Amp_Sulbactam_3gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (false, true, true, true);
+ Elseif
+ Cefazolin_3gm.IsSelected = true and needweight = true then
+ Amp_Sulbactam_1_5gm.IsSelected := false;
+ Amp_Sulbactam_3gm.IsSelected := false;
+ Cefazolin_2gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, false, true, true);
+ Wt_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with No_Pt_Weight ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Elseif
+ Cefazolin_2gm.IsSelected = true and needweight = true then
+ Cefazolin_3gm.IsSelected := false;
+ Amp_Sulbactam_1_5gm.IsSelected := false;
+ Amp_Sulbactam_3gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (false, true, true, true);
+ Wt_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with No_Pt_Weight ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Elseif
+ Amp_Sulbactam_1_5gm.IsSelected = true then
+ Amp_Sulbactam_3gm.IsSelected := false;
+ Cefazolin_2gm.IsSelected := false;
+ Cefazolin_3gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, true, false, true);
+ Elseif
+ Amp_Sulbactam_3gm.IsSelected = true then
+ Cefazolin_2gm.IsSelected := false;
+ Cefazolin_3gm.IsSelected := false;
+ Amp_Sulbactam_1_5gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, true, true, false);
+ Elseif
+ Amp_Sulbactam_3gm.IsSelected = false and Cefazolin_2gm.IsSelected = false and
+ Cefazolin_3gm.IsSelected = false and Amp_Sulbactam_1_5gm.IsSelected = false then
+ Antibiotic_Orders_List.IsReadOnly := (false, false, false, false);
+ Endif;
+ Endif;
+
+ // Select Bacitracin Medication Order if Dressing Order is selected
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderGrid|48") then
+ If Dressing_Order.IsSelected = true and NeoPolyBacOint_Order.IsSelected = false then
+ NeoPolyBacOint_Order.IsSelected := true;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_POST_OP_THYROIDECTOMY_PARATHYROIDECTOMY.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_POST_OP_THYROIDECTOMY_PARATHYROIDECTOMY.mlm
new file mode 100644
index 0000000..2a61e42
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_POST_OP_THYROIDECTOMY_PARATHYROIDECTOMY.mlm
@@ -0,0 +1,392 @@
+maintenance:
+
+ title: Post Op Throidectomy/Parathyroidectomy;;
+ mlmname: FORM_Set_Post_Op_Thyroidectomy_Parathyroidectomy;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts Corp ext 7448;;
+ specialist: Dean Miklavic, Allscripts Corp Ext 7466;;
+ date: 2014-09-09;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids on post op Throidectomy/Parathyroidectomy Orders
+ ;;
+
+ explanation: This MLM is called from the post op Throidectomy/Parathyroidectomy order set
+
+
+Change history
+
+ 09.15.2014 TMS Created for new order set CSR #326923
+ 02.21.2017 TMS CSR: 35186 Updated search for "Hydrocodone 5mg/Acetaminophen 325mg name change
+ 11.20.2018 TMS CSR: 36714 Updated to change Cefazolin dosing from 1 gm for wt < 80 kg and
+ 2 gm for wt >= 80 kg to Cefazolin 2 gm for wt < 120 kg and 3 gm for wt >= 120 kg.
+ Changes also made to allow only one selection from several grids.
+ ;;
+
+ keywords: Called MLMs, Thyroidectomy, Parathyroidectomy, Post Op
+ ;;
+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;
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ //local_session := cds_session.local;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list := this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ StartDate := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ StartTime := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1);
+ StartDate_Value := StartDate.value;
+ StartTime_Value := StartTime.value;
+
+ OnceLab := first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 4);
+ OnceLab_List := OnceLab.value;
+ Once_Calcium := first of (OnceLab_List where OnceLab_List.Name = "Calcium Plasma/Serum");
+
+ RecurLab := first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 5);
+ RecurLab_List := RecurLab.value;
+ Recur_Calcium := first of (RecurLab_List where RecurLab_List.Name = "Calcium Plasma/Serum");
+
+
+ Antibiotic_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 64);
+ Antibiotic_Orders_List := Antibiotic_Orders.Value;
+
+ Cefazolin_2gm := first of (Antibiotic_Orders_List where Antibiotic_Orders_List.Name = "Cefazolin:");
+ Cefazolin_3gm := last of (Antibiotic_Orders_List where Antibiotic_Orders_List.Name = "Cefazolin:");
+ Clindamycin_600mg := first of (Antibiotic_Orders_List where Antibiotic_Orders_List.Name = "Clindamycin:");
+
+ Diet_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 29);
+ Diet_Orders_List := Diet_Orders.Value;
+
+ Pain_Med_Orders_Mod := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 67);
+ Pain_Med_Orders_Mod_List := Pain_Med_Orders_Mod.Value;
+
+ Pain_Med_Orders_Sev := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 69);
+ Pain_Med_Orders_Sev_List := Pain_Med_Orders_Sev.Value;
+
+ Thyroid_Med_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 70);
+ Thyroid_Med_Orders_List := Thyroid_Med_Orders.Value;
+
+ Decadron_Med_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 71);
+ Decadron_Med_Orders_List := Decadron_Med_Orders.Value;
+
+ Lorazepam_Med_Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 72);
+ Lorazepam_Med_Orders_List := Lorazepam_Med_Orders.Value;
+
+ Oxycod_Acet_1Tab := first of (Pain_Med_Orders_Mod_List where Pain_Med_Orders_Mod_List.Name = "OxyCODONE 5mg/Acetaminophen 325mg Tab");
+ Hydrocod_Acet_1Tab := first of (Pain_Med_Orders_Mod_List where Pain_Med_Orders_Mod_List.Name matches pattern "Hydrocodone 5mg/Acetaminophen 325mg%");
+ Morphine_Inj := last of (Pain_Med_Orders_Sev_List where Pain_Med_Orders_Sev_List.Name = "Morphine Inj");
+ Hydrocod_Acet_2Tab := last of (Pain_Med_Orders_Sev_List where Pain_Med_Orders_Sev_List.Name matches pattern "Hydrocodone 5mg/Acetaminophen 325mg%");
+ Oxycod_Acet_2Tab := last of (Pain_Med_Orders_Sev_List where Pain_Med_Orders_Sev_List.Name = "OxyCODONE 5mg/Acetaminophen 325mg Tab");
+
+ No_Pt_Weight := "There is no weight documented on this visit. Please enter a weight or verify you are selecting the correct dose based upon the patient{{{SINGLE-QUOTE}}}s known weight.";
+
+
+ // 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);
+ Endif;
+
+ If weightvalue is null or weightvalue = 0 then
+ needweight := true;
+ Else needweight := false;
+ If weightvalue >0 and weightvalue <120 then lowdose := true;
+ Elseif weightvalue >=120 then lowdose := false;
+ Endif;
+ Endif;
+
+ // Get start time for Calcium Plasma/Serum Q12hrs and format for date and time
+
+ ThisTime := (now as time) ;
+ ThisHour := extract hour ThisTime;
+ RoundHours := (ThisHour - ((truncate(ThisHour/2)) + (truncate(ThisHour/2))));
+
+ NextTime := ThisTime + 12 hours + RoundHours hours;
+ NextHour := extract hour Nexttime;
+ If Nexthour < 10 then
+ FormatTime := "0" || NextHour || ":00";
+ else
+ FormatTime := NextHour || ":00";
+ endif;
+
+ FormatDate := extract month NextTime ||"-" || extract day NextTime ||"-" ||extract year NextTime;
+
+ // On form open if weight is present disable cefazolin dose not appropriate for patient weight
+
+ If CallingEvent = "FormOpen" then
+ If lowdose = true then
+ Antibiotic_Orders_List.IsReadOnly := (false, true, false);
+ Elseif lowdose = false then
+ Antibiotic_Orders_List.IsReadOnly := (true, false, false);
+ Else
+ Antibiotic_Orders_List.IsReadOnly := (false, false, false);
+ Endif;
+ Endif;
+
+
+ // If pacu calcium level is selected determine start date for 12 hours after pacu draw
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderCheckbox|4") then
+ If Once_Calcium.IsSelected = true then
+ StartDate.value := FormatDate;
+ StartTime_value.reqtimecode := "Scheduled Time";
+ StartTime_value.reqtimevalue := FormatTime;
+ Endif;
+ Endif;
+
+ // If Q12H recurring calcium level is selected auto select once pacu calcium draw
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderCheckbox|5") then
+ If Recur_Calcium.IsSelected = true then
+ StartDate.value := FormatDate;
+ StartTime_value.reqtimecode := "Scheduled Time";
+ StartTime_value.reqtimevalue := FormatTime;
+ Once_Calcium.IsSelected := true;
+ Endif;
+ Endif;
+
+ // Determine which cefazolin dose is available based upon patient weight
+
+ If CallingEvent = "FieldChange" and (CallingField = "CombinedMeasurements|1") then
+ If weightvalue >0 and weightvalue <120 then lowdose := true;
+ Elseif weightvalue >=120 then lowdose := false;
+ Endif;
+
+ If lowdose = true and Cefazolin_3gm.IsSelected = true and needweight = false then
+ Cefazolin_2gm.IsSelected := true;
+ Cefazolin_3gm.IsSelected := false;
+ Clindamycin_600mg.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (false, true, true);
+ Elseif lowdose = false and Cefazolin_2gm.IsSelected = true and needweight = false then
+ Cefazolin_2gm.IsSelected := false;
+ Cefazolin_3gm.IsSelected := true;
+ Clindamycin_600mg.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, false, true);
+ endif;
+ endif;
+
+ // Disable remaining moderate to severe pain med selections when one is selected by user
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderGrid|67") then
+ If Pain_Med_Orders_Mod_List.IsSelected [1] = true then
+ Pain_Med_Orders_Mod_List.IsSelected:= (true, false, false, false);
+ Pain_Med_Orders_Mod_List.IsReadOnly := (false, true, true, true);
+ ElseIf
+ Pain_Med_Orders_Mod_List.IsSelected [2] = true then
+ Pain_Med_Orders_Mod_List.IsSelected:= (false, true, false, false);
+ Pain_Med_Orders_Mod_List.IsReadOnly := (true, false, true, true);
+
+ ElseIf
+ Pain_Med_Orders_Mod_List.IsSelected [3] = true then
+ Pain_Med_Orders_Mod_List.IsSelected:= (false, false, true, false);
+ Pain_Med_Orders_Mod_List.IsReadOnly := (true, true, false, true);
+ ElseIf
+ Pain_Med_Orders_Mod_List.IsSelected [4] = true then
+ Pain_Med_Orders_Mod_List.IsSelected:= (false, false, false, true);
+ Pain_Med_Orders_Mod_List.IsReadOnly := (true, true, true, false);
+ Else
+ Pain_Med_Orders_Mod_List.IsReadOnly := (false, false,false, false);
+ Endif;
+ Endif;
+
+ // Allow only one diet to be selected
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderGrid|29") then
+ If Diet_Orders_List.IsSelected [1] = true then
+ Diet_Orders_List.IsSelected := (true, false, false, false, false);
+ Diet_Orders_List.IsReadOnly := (false, true, true, true, true);
+ ElseIf
+ Diet_Orders_List.IsSelected [2] = true then
+ Diet_Orders_List.IsSelected := (false, true, false, false, false);
+ Diet_Orders_List.IsReadOnly := (true, false, true, true, true);
+ ElseIf
+ Diet_Orders_List.IsSelected [3] = true then
+ Diet_Orders_List.IsSelected := (false, false, true, false, false);
+ Diet_Orders_List.IsReadOnly := (true, true, false, true, true);
+ ElseIf
+ Diet_Orders_List.IsSelected [4] = true then
+ Diet_Orders_List.IsSelected := (false, false, false, true, false);
+ Diet_Orders_List.IsReadOnly := (true, true, true, false, true);
+ ElseIf
+ Diet_Orders_List.IsSelected [5] = true then
+ Diet_Orders_List.IsSelected := (false, false, false, false, true);
+ Diet_Orders_List.IsReadOnly := (true, true, true, true, false);
+ Else
+ Diet_Orders_List.IsReadOnly := (false, false, false, false, false);
+ Endif;
+ Endif;
+
+ // Disable remaining Decadron med selections when one is selected by user
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderGrid|70") then
+ If Thyroid_Med_Orders_List.isSelected [1] = true then
+ Thyroid_Med_Orders_List.IsSelected := (true, false);
+ Thyroid_Med_Orders_List.IsReadOnly := (false, true);
+ ElseIf
+ Thyroid_Med_Orders_List.isSelected [2] = true then
+ Thyroid_Med_Orders_List.IsSelected := (false, true);
+ Thyroid_Med_Orders_List.IsReadOnly := (true, false);
+ Else
+ Thyroid_Med_Orders_List.IsReadOnly := (false, false);
+ Endif;
+ Endif;
+
+ // Disable remaining Decadron med selections when one is selected by user
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderGrid|71") then
+ If Decadron_Med_Orders_List.isSelected [1] = true then
+ Decadron_Med_Orders_List.IsSelected := (true, false);
+ Decadron_Med_Orders_List.IsReadOnly := (false, true);
+ ElseIf
+ Decadron_Med_Orders_List.isSelected [2] = true then
+ Decadron_Med_Orders_List.IsSelected := (false, true);
+ Decadron_Med_Orders_List.IsReadOnly := (true, false);
+ Else
+ Decadron_Med_Orders_List.IsReadOnly := (false, false);
+ Endif;
+ Endif;
+
+ // Disable remaining Lorazepam med selections when one is selected by user
+
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderGrid|72") then
+ If Lorazepam_Med_Orders_List.isSelected [1] = true then
+ Lorazepam_Med_Orders_List.IsSelected := (true, false);
+ Lorazepam_Med_Orders_List.IsReadOnly := (false, true);
+ ElseIf
+ Lorazepam_Med_Orders_List.isSelected [2] = true then
+ Lorazepam_Med_Orders_List.IsSelected := (false, true);
+ Lorazepam_Med_Orders_List.IsReadOnly := (true, false);
+ Else
+ Lorazepam_Med_Orders_List.IsReadOnly := (false, false);
+ Endif;
+ Endif;
+
+ // Disable remaining severe pain med selections when one is selected by user
+/*
+ If CallingEvent = "FieldChange" and (CallingField = "MultiOrderGrid|69") then
+
+ If Hydrocod_Acet_2Tab.IsSelected = true then
+ Oxycod_Acet_2Tab.IsSelected := false;
+ Morphine_Inj.IsSelected := false;
+ Pain_Med_Orders_Sev_List.IsReadOnly := (false, true, true);
+ Elseif
+ Oxycod_Acet_2Tab.IsSelected = true then
+ Morphine_Inj.IsSelected := false;
+ Hydrocod_Acet_2Tab.IsSelected := false;
+ Pain_Med_Orders_Sev_List.IsReadOnly := (true, false, true);
+ ElseIf
+ Morphine_Inj.IsSelected = true then
+ Oxycod_Acet_2Tab.IsSelected := false;
+ Hydrocod_Acet_2Tab.IsSelected := false;
+ Pain_Med_Orders_Sev_List.IsReadOnly := (true, true, false);
+ Else
+ Pain_Med_Orders_Sev_List.IsReadOnly := (false, false, false);
+
+ Endif;
+ Endif;
+*/
+ // Disable remaining antibiotic selections when one is selected by user. If no weight is available alert user
+
+ If CallingEvent = "FieldChange" and ((CallingField = "MultiOrderGrid|64") or (CallingField = "CombinedMeasurements|1")) then
+
+ If Cefazolin_2gm.IsSelected = true and needweight = false and lowdose = true then
+ Cefazolin_3gm.IsSelected := false;
+ Clindamycin_600mg.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (false, true, true);
+ ElseIf
+ Cefazolin_2gm.IsSelected = true and needweight = false and lowdose = false then
+ Cefazolin_2gm.IsSelected := false;
+ Cefazolin_3gm.IsSelected := true;
+ Clindamycin_600mg.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, false, true);
+ Elseif
+ Cefazolin_3gm.IsSelected = true and needweight = false and lowdose = true then
+ Clindamycin_600mg.IsSelected := false;
+ Cefazolin_2gm.IsSelected := true;
+ Cefazolin_3gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (false, true, true);
+ Elseif
+ Cefazolin_3gm.IsSelected = true and needweight = false and lowdose = false then
+ Clindamycin_600mg.IsSelected := false;
+ Cefazolin_2gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, false, true);
+ Elseif
+ Cefazolin_2gm.IsSelected = true and needweight = true then
+ Cefazolin_3gm.IsSelected := false;
+ Clindamycin_600mg.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (false, true, true);
+ Wt_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with No_Pt_Weight ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Elseif
+ Cefazolin_3gm.IsSelected = true and needweight = true then
+ Clindamycin_600mg.IsSelected := false;
+ Cefazolin_2gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, false, true);
+ Wt_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with No_Pt_Weight ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Elseif
+ Cefazolin_2gm.IsSelected = true and needweight = true then
+ Cefazolin_3gm.IsSelected := false;
+ Clindamycin_600mg.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (false, true, true);
+ Wt_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with No_Pt_Weight ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Elseif
+ Clindamycin_600mg.IsSelected = true then
+ Cefazolin_2gm.IsSelected := false;
+ Cefazolin_3gm.IsSelected := false;
+ Antibiotic_Orders_List.IsReadOnly := (true, true, false);
+ Elseif
+ Clindamycin_600mg.IsSelected = false and Cefazolin_2gm.IsSelected = false and
+ Cefazolin_3gm.IsSelected = false then
+ Antibiotic_Orders_List.IsReadOnly := (false, false, false);
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PREINITIATION_CATHETER_THROMBOLYTIC_THERAPY.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PREINITIATION_CATHETER_THROMBOLYTIC_THERAPY.mlm
new file mode 100644
index 0000000..ac757e7
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PREINITIATION_CATHETER_THROMBOLYTIC_THERAPY.mlm
@@ -0,0 +1,124 @@
+maintenance:
+
+ title: FORM_SET_PREINITIATION_CATHETER_THROMBOLYTIC_THERAPY;;
+ mlmname: FORM_SET_PREINITIATION_CATHETER_THROMBOLYTIC_THERAPY;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ext 7461;;
+ specialist: Peggy Karish, Allscripts ext 7441;;
+ date: 2014-09-25;;
+ validation: testing;;
+
+library:
+ purpose: Used on the Pre-Initiation Catheter Direct Thrombolytic Therapy order set to determine labs ordered.
+ ;;
+
+ explanation: This MLM is called from the Pre-Initiation Catheter Direct Thrombolytic Therapy order set. This MLM will determine
+ if the patient has the following labs ordered in the last 24 hours; if not, the MLM will automatically select the labs on
+ form open: Fibrinogen, CBC No Diff (Hemogram only), Basic Metabolic Panel, Prothrombin/INR, APTT
+
+ Change history
+ 2014.09.25 JML CSR 32527: Created.
+
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+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;
+
+
+ //.Net libraries
+ 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:="";
+
+ //Declare list of wanted labs
+ wanted_labs := ( "Fibrinogen",
+ "CBC No Diff (Hemogram Only)",
+ "Basic Metabolic Panel",
+ "Prothrombin/INR",
+ "APTT");
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Retrieve guids
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+
+ //Retrieve form fields
+ Stat_Labs_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ AND field_list.Control_MultiFieldOccNum = 6 );
+ Stat_Labs := Stat_Labs_Grid.Value;
+
+ //Retrieve existing labs
+ ( existing_labs ) := read { "SELECT o.Name"
+ || " 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 cv3ordercatalogmasteritem om with (nolock) "
+ || " ON om.guid = o.ordercatalogmasteritemguid"
+ || " JOIN CV3OrderStatusHistory osh WITH (NOLOCK)"
+ || " on o.GUID = osh.OrderGUID"
+ || " and o.ClientGUID = osh.ClientGUID"
+ || " WHERE DATEDIFF(HOUR, osh.ArrivalDtm, GetDate()) <= 24"
+ || " AND cv.ClientGUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)
+ || " AND cv.ChartGUID = " || Sql(chart_guid)
+ || " AND o.name IN ({{{SINGLE-QUOTE}}}Fibrinogen{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No diff (Hemogram only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}})"
+ || " AND ((o.OrderStatusLevelNum >= 60"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
+ || " AND cv.visitstatus <> {{{SINGLE-QUOTE}}}can{{{SINGLE-QUOTE}}}"
+ || " group by o.Name" };
+
+ if ( CallingEvent = "FormOpen") then
+ if ( exists ( existing_labs ) ) then
+ for i in 1 seqto ( count Stat_Labs ) do
+ if ( Stat_Labs.Name[i] NOT IN existing_labs ) then
+ Stat_Labs[i].IsSelected := true;
+ endif;
+ enddo;
+ else
+ for i in 1 seqto (count Stat_Labs) do
+ Stat_Labs[i].IsSelected := true;
+ enddo;
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_PRE_PACEMAKER_OR_ICD_INSERTION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_PRE_PACEMAKER_OR_ICD_INSERTION.mlm
new file mode 100644
index 0000000..954283a
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_PRE_PACEMAKER_OR_ICD_INSERTION.mlm
@@ -0,0 +1,201 @@
+maintenance:
+
+ title: FORM_SET_PRE_PACEMAKER_OR_ICD_INSERTION;;
+ mlmname: FORM_SET_PRE_PACEMAKER_OR_ICD_INSERTION;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M Law, Allscripts x7461;;
+ specialist: Debbie Eiler, Allscripts ext 7446;;
+ date: 2014-12-10;;
+ validation: testing;;
+
+library:
+ purpose:
+
+ ;;
+
+ explanation:
+
+ Change History
+ -----------------
+ 12.10.2014 JML CSR# 32772: Created
+ ;;
+ keywords: Called MLMs, Newborn, Admission, Hepatitis B
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+
+ pObj := this_communication.PrimaryObj;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Retrieve relevant form fields
+ Labs_96Hr := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 5);
+ Labs_96Hr_Val := Labs_96Hr.Value;
+
+ Labs_24Hr := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 7);
+ Labs_24Hr_Val := Labs_24Hr.Value;
+
+ // Hide By Shivprasad Jadhav As per the CSR:32772 change Request, Created New MLM [FORM_PRE_PACEMAKER_ICDINSERTION_ANESTHESIA] for this change.
+
+ /* Anesthesia_Consult := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 57 );
+ Anesthesia_Consult_Val := Anesthesia_Consult.Value;
+
+ Nursing_Instr := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 48 );
+ Nursing_Instr_Val := Nursing_Instr.Value;*/
+
+
+ //if ( CallingEvent = "FormOpen" ) then
+
+ //Check to see if patient is on continuous heparin
+ cont_heparin_check := read last {"SELECT Case When O.OrderStatusCode In ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}})"
+ || " Then DATEDIFF(HH, O.TouchedWhen, GetDate()) "
+ || " When O.OrderStatusCode In ({{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}}) "
+ || " Then DATEDIFF(HH, O.TouchedWhen, GetDate()) End As Hours , O.OrderStatusCode as Status "
+ || " Into #StatusHours "
+ || " FROM CV3ORDER o"
+ || " WHERE o.ClientGuid = " || Sql(client_guid)
+ || " AND o.ClientVisitGUID = " || Sql(visit_guid)
+ || " AND o.ChartGUID = " || Sql(chart_guid)
+ || " AND o.Name LIKE {{{SINGLE-QUOTE}}}%Heparin%{{{SINGLE-QUOTE}}}"
+ || " AND o.OrderStatusCode in ({{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}}) "
+ || " "
+ || " Select 1 "
+ || " from #StatusHours s "
+ || " Where (s.Status in ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}})And S.Hours <= 24 ) "
+ || " Or (s.Status in ({{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}}) And S.Hours >= 0 )" };
+
+
+ if ( Not exists cont_heparin_check ) then
+
+
+ //Check to see if patient had these labs drawn in last 96 hours
+ lab_name := read {"SELECT o.Name"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND o.NAME IN ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " AND DATEDIFF(HH, o.ARRIVALDTM, GetDate()) <= 96 "
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
+
+ aptt_lab := read last {"SELECT {{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}} as {{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}} " };
+
+ lab_name := ( lab_name);
+
+
+ elseif ( exists cont_heparin_check ) then
+
+ //Check to see if patient had these labs drawn in last 96 hours
+ ( lab_name ) := read {"SELECT o.Name"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND o.NAME IN ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " AND DATEDIFF(HH, o.ARRIVALDTM, GetDate()) <= 96 "
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}})"};
+
+
+
+ //Patient on continuous heparin, check for APTT in last 24 hours
+ aptt_lab := read last {"SELECT o.Name "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND o.NAME = {{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}}"
+ || " AND DATEDIFF(HH, o.ARRIVALDTM, GetDate()) <= 24 "
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}) " };
+
+
+ lab_name := ( lab_name);
+ endif;
+
+ if ( exists aptt_lab ) then
+ for lab in 1 seqto ( count Labs_24Hr_Val ) do
+ if ( Labs_24Hr_Val[lab].Name NOT IN aptt_lab ) then
+ Labs_24Hr_Val[lab].IsSelected := true;
+ else
+ Labs_24Hr_Val[lab].IsSelected := false;
+ endif;
+ enddo;
+ else
+ //No labs exist for this patient, select all labs
+ Labs_24Hr_Val.IsSelected := ( true );
+
+ endif;
+
+
+ if ( exists lab_name ) then
+ for lab in 1 seqto ( count Labs_96Hr_Val ) do
+ if ( Labs_96Hr_Val[lab].Name NOT IN lab_name ) then
+ Labs_96Hr_Val[lab].IsSelected := true;
+ else
+ Labs_96Hr_Val[lab].IsSelected := false;
+ endif;
+ enddo;
+ else
+ //No labs exist for this patient, select all labs
+ Labs_96Hr_Val.IsSelected := ( true, true, true);
+
+ endif;
+
+
+ // Hide By Shivprasad Jadhav As per the CSR:32772 change Request, Created New MLM [FORM_PRE_PACEMAKER_ICDINSERTION_ANESTHESIA] for this change.
+ /*elseif ( CallingEvent = "FieldChange" ) then
+ if ( CallingField = "MultiOrderGrid|57") then
+ if ( true IN Anesthesia_Consult_Val.IsSelected ) then
+ Nursing_Instr_Val[1].IsSelected := true;
+ else
+ Nursing_Instr_Val[1].IsSelected := false;
+ endif;
+ endif;*/
+ //End FormOpen Event
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_REPEAT_LAB_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_REPEAT_LAB_ORDERS.mlm
new file mode 100644
index 0000000..67728ed
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_REPEAT_LAB_ORDERS.mlm
@@ -0,0 +1,532 @@
+maintenance:
+
+ title: FORM_Set_Repeat_Lab_Orders;;
+ mlmname: FORM_Set_Repeat_Lab_Orders;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-04-01;;
+ validation: testing;;
+
+library:
+ purpose: Used for Creating Repeating Lab Orders
+ ;;
+
+ explanation: This MLM is called from ___ Order Set
+
+ Change history
+ 06.12.2012 TMS Created in DEV
+ 11.26.2012 TMS Moved to Production CSR 26927
+ 02.25.2013 TMS Added logic to look for heparin orders for APTT heparin status
+ Missing from first repeat order, identified during AM Rounds project. HD ticket 156616
+ 03.25.2015 JML CSR 32953 Modified logic to work for internal medicine order set as well as CCM Common Labs;
+ retrieving orderset name so correct dataitem is pulled.
+ 06.17.2015 TMS Modified to add new dataitems used for Labs, Time and Frquency for
+ Post Initiation Catheter Directed Thrombolytic Therapy CSR:32710
+ 08.03.2015 GOS Added new code to change format of Order information display on form CSR:32710
+ 11.30.2015 JML WO #1949479: Modified code to properly display user-friendly verbiage for AM Rounds and other frequencies
+ in repeat lab orders text box.
+ 12.03.2015 JML Moved to Production.
+ 01.07.2016 STH CSR#: 33758 - Updated section for Post Initiation Thrombolytic to call the custom repeat lab scheduling MLM {go-live 3/7/2016}
+ 04.26.2016 TMS CSR 33465 Add call on form Close to Medication Order Management MLM
+ 03.11.2019 TMS CSR 37602 Added Hospitalist Orders to use data item "Repeat_Labs 2".
+ 07.02.2019 TMS CSR 38460 Added General Admission Orders to use data item "Repeat_Labs 2". This is going to be the new
+ name for the Hospitalist Orders.
+ 09.05.2019 TMS CSR 38460 Added Admission Orders - General to use data item "Repeat_Labs 2". This is going to be the new
+ name for the General Admission Orders .
+
+ ;;
+ keywords: Called MLMs, Repeat Lab Orders
+ ;;
+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";
+
+ // 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;
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* Set to True if a decision.log is needed.*/
+ log_execution_info := False;
+
+ CreateRepeatOrder := MLM {{{SINGLE-QUOTE}}}SCH_DIAG_WRITE_ORDER{{{SINGLE-QUOTE}}};
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ Post_Init_cath_dir_Thrombolytic := mlm {{{SINGLE-QUOTE}}}FORM_POST_INITIATION_CATHETER_DIR_THROMBOLYTIC{{{SINGLE-QUOTE}}};
+
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+ error_occurred := 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;
+
+ PrimaryObjDetail := this_communication.PrimaryObj;
+ OrderSetName := PrimaryObjDetail.OrderSetName;
+
+ // Define other fields
+
+ if ( OrderSetName = "CCM Common Lab Orders" ) then
+ RepeatLabs := last of (field_list where field_list.DataItemName = "Repeat_Labs" and field_List.Control_MultiFieldOccNum = 1);
+ RepeatFreq := last of (field_list where field_list.DataItemName = "CPOE_Repeat_Frequency" and field_List.Control_MultiFieldOccNum = 1);
+ StartTimeB := last of (field_list where field_list.DataItemName = "CPOE_Repeat_Lab_Time" and field_List.Control_MultiFieldOccNum = 1);
+
+ elseif ( OrderSetName in ("Hospitalist Orders","Internal Medicine Order Set","General Admission Orders", "Admission Orders - General" )) then
+ RepeatLabs := last of (field_list where field_list.DataItemName = "Repeat_Labs 2" and field_List.Control_MultiFieldOccNum = 1);
+ RepeatFreq := last of (field_list where field_list.DataItemName = "CPOE_Repeat_Frequency" and field_List.Control_MultiFieldOccNum = 1);
+ StartTimeB := last of (field_list where field_list.DataItemName = "CPOE_Repeat_Lab_Time" and field_List.Control_MultiFieldOccNum = 1);
+
+ elseif ( trim(OrderSetName) = "Post Initiation Catheter Directed Thrombolytic Therapy" ) then
+
+ RepeatLabs := last of (field_list where field_list.DataItemName = "Repeat_Labs 3" and field_List.Control_MultiFieldOccNum = 1);
+ RepeatFreq := last of (field_list where field_list.DataItemName = "CPOE_Rpt_Freq_LyticTherapy" and field_List.Control_MultiFieldOccNum = 1);
+ StartTimeB := last of (field_list where field_list.DataItemName = "CPOE_Rpt_Time_LyticTherapy" and field_List.Control_MultiFieldOccNum = 1);
+ //Occurances := last of (field_list where field_list.DataItemName = "CPOE_Repeat_Lab_Occur" and field_list.Control_MultiFieldOccNum = 1 );
+ //if (Occurances.Value = "5 Times") then
+ void := call Post_Init_cath_dir_Thrombolytic with (this_communication,this_form,client_info_obj);
+
+ //endif;
+ else
+ RepeatLabs := last of (field_list where field_list.DataItemName = "Repeat_Labs" and field_List.Control_MultiFieldOccNum = 1);
+ RepeatFreq := last of (field_list where field_list.DataItemName = "CPOE_Repeat_Frequency" and field_List.Control_MultiFieldOccNum = 1);
+ StartTimeB := last of (field_list where field_list.DataItemName = "CPOE_Repeat_Lab_Time" and field_List.Control_MultiFieldOccNum = 1);
+
+ endif;
+
+ StartOn := last of (field_list where field_list.DataItemName = "CPOE_Repeat Lab Start" and field_List.Control_MultiFieldOccNum = 1);
+ StartDate := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ StartTime := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1);
+ RepeatOcc := last of (field_list where field_list.DataItemName = "CPOE_Repeat_Lab_Occur" and field_List.Control_MultiFieldOccNum = 1);
+ SubmitButton := last of (field_list where field_list.DataItemName = "CPOE Repeat Lab Submit Button" and field_List.Control_MultiFieldOccNum = 1);
+ OrderAccumBox := last of (field_list where field_list.DataItemName = "CPOE Repeat Lab Accumulator" and field_List.Control_MultiFieldOccNum = 1);
+ SendButton := last of (field_list where field_list.DataItemName = "MLM Generic Checkbox" and field_List.Control_MultiFieldOccNum = 1);
+ StartDate_val := StartDate.Value;
+ StartOn_val := StartOn.Value;
+ StartTime_val := StartTime.Value;
+ StartTimeB_val := StartTimeB.Value;
+ RepeatOcc_val := RepeatOcc.Value;
+ RepeatFreq_val := RepeatFreq.Value;
+ SendButton_val := SendButton.Value;
+ SubmitButton_val := SubmitButton.Value;
+ OrderAccumBox_val := OrderAccumBox;
+
+ //------------------------------------------------------------
+ // Define the ObjectsPlus destinations
+ //------------------------------------------------------------
+
+ Parent_DiagnosticOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM, placed on worksheet",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2080 ];
+
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ CurrentLocation := read last {"Select CurrentLocation "
+ ||" From cv3Clientvisit "
+ ||" Where Guid = " || SQL(ClientVisitGuid)
+ ||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" };
+
+ If CallingEvent = "FormClose" then
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+ endif;
+
+ If (callingevent = "FormClose" or callingfield = "MLM Generic Checkbox|1" or callingfield = "CPOE Repeat Lab Submit Button|1") then
+
+
+ // retrieve if patient on IV heparin for APTT order form
+ heparin_order_iv := "%Heparin 25,000%";
+ heparin_order_iv_found := read last {"select name from cv3order where name like " || SQL(heparin_order_iv)
+ || " and ClientGUID = " || SQL(clientguid)
+ || " and ChartGUID = " || SQL(chartguid)
+ || " and ClientVisitGUID= " || SQL(clientvisitguid)
+ || " and OrderStatusLevelNum > 15 "
+ || " and OrderStatusLevelNum not in (69, 70) " };
+
+ if heparin_order_IV_found is not null then
+ heparin_iv_found := true;
+ else
+ heparin_iv_found := false;
+ endif;
+
+
+ If RepeatFreq.value is Null then
+ orderfreq := "NONE";
+ else
+ orderfreq := RepeatFreq.value;
+ endif;
+
+ If RepeatOcc.value = "2 Times" then
+ ordertimes := "x 2";
+ OccTime := (2 as number); // Added By Shivprasad for CSR #32710
+ elseif RepeatOcc.value = "3 Times" then
+ ordertimes := "x 3";
+ OccTime := (3 as number); // Added By Shivprasad for CSR #32710
+ elseif RepeatOcc.value= "4 Times" then
+ ordertimes := "x 4";
+ OccTime := (4 as number); // Added By Shivprasad for CSR #32710
+ elseif RepeatOcc.value = "5 Times" then
+ ordertimes := "x 5";
+ OccTime := ( 5 as number); // Added By Shivprasad for CSR #32710
+ else
+ ordertimes := "NONE";
+ endif;
+
+ If StartOn.value = "Today" then
+ StartVerName := "Today";
+ SDate := Read First { " Select GetDate() " } ; // Added By Shivprasad
+ elseif StartOn.value = "Tomorrow" then
+ StartVerName := "Tomorrow";
+ SDate := Read First { " Select DateAdd(Day, 1, GetDate()) "} ; // Added By Shivprasad
+ else
+ VerName := "NONE";
+ endif;
+
+ stimeb2:= StartTimeb.value;
+
+ If StartTimeb.value = "AM Rounds" then
+ If repeatfreq.value <> "Daily" and repeatfreq.value <> "NONE" then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You cannot choose " || StartTimeb.value ||" with a frequency of " || repeatfreq.value
+ ||". Please change your frequency to Daily, or select a valid start time to continue. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ goodtime := "no";
+ else
+ stimeb1 := StartTimeb.value;
+ orderfreq := "AM Rounds";
+ stimeb2 := Null;
+ goodtime := "yes";
+ endif;
+ else
+ hourmin := call str_parse with ((stimeb2 as string),":");
+ stimeb1 := "Scheduled Time";
+ stimebhr := hourmin [1];
+ stimebmin := hourmin [2];
+ goodtime := "yes";
+ If StartOn.value = "Today" then
+ getcurrenthour := extract hour now;
+ starthour := stimebhr as number;
+ currenthour := getcurrenthour as number;
+
+ If currenthour >= starthour then
+ goodtime := "no";
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "The start time of " || stimeb2 ||" " || starton.value
+ ||" has already passed, please choose another start date or time to continue. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ else
+ goodtime := "yes";
+ endif;
+ endif;
+ endif;
+
+ if (RepeatLabs.value is not null or RepeatLabs.value = "") then
+ StartTimeb.Control_Mandatory := true;
+ StartOn.Control_Mandatory := true;
+ RepeatOcc.Control_Mandatory := true;
+ RepeatFreq.Control_Mandatory := true;
+ else
+ StartTimeb.Control_Mandatory := false;
+ StartOn.Control_Mandatory := false;
+ RepeatOcc.Control_Mandatory := false;
+ RepeatFreq.Control_Mandatory := false;
+ endif;
+
+ If ordertimes <> "NONE" and orderfreq <> "NONE" and StartVerName <> "NONE" and goodtime = "yes" then
+ If RepeatLabs is not null then
+ SendButton.value := false;
+
+ If OrderAccumBox.value is null then
+ OrderAccumBox.value := "Ordered: ";
+ endif;
+
+ Placeorder := "yes";
+ modname := orderfreq || " " || ordertimes;
+ vername := StartVerName;
+ sdate := StartDate.Value;
+ stime1 := StartTime_val.ReqTimeCode;
+ else
+ placeorder := "No";
+ endif;
+ endif;
+ endif;
+
+ // WITH WORKSHEET
+ try
+ //-----------------------------------------------------------
+ // Retrieve current order entry batch.
+ // The companion order can be added only if the parent order
+ // belongs to the order entry batch
+ // object owned by the OrderEntryWorksheet.
+ //-----------------------------------------------------------
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+
+ if worksheetInfo is NULL OR "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String) then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unable to retrieve the Worksheet Info for this Order Batch" ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+ //------------------------------------------------------------
+ // Get the .NET version of the Client Visit object.
+ // Needed to create new ObjectsPlus object
+ //------------------------------------------------------------
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((Active_ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ //-----------------------------------------------------------
+ // Check the order entry worksheet. If there are no entries
+ // already on the worksheet set the initial values for
+ // the worksheet.
+ //-----------------------------------------------------------
+ if worksheetInfo.UnsubmittedOrdersCount = 0 then
+ // If there are no orders on the worksheet set
+ // defaults that will be used to create the orders
+
+ WSSessionType := "Standard";
+ WSSessionReason := " ";
+ WSRequestedBySource := "";
+
+ // Set the session type and reason on the worksheet
+ void := call worksheetInfo.SetSessionType with (WSSessionType, WSSessionReason);
+
+ // Set the requesting source string
+ worksheetInfo.RequestedBySource := WSRequestedBySource;
+
+ //Get the current user as the default care provider
+ WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById
+ with ( user_IDType, user_IDCode );
+
+ //Set the requesting provider
+ worksheetInfo.RequestedBy := WSRequestedBy_obj;
+
+ // Get the location that will be used for the orders.
+ WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((LocationGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ //Set the expected release location group
+ worksheetInfo.ExpectedReleaseLocationGroup := WSlocation_obj;
+
+ //Dispose RequestedBy CareProvider
+ if( WSRequestedBy_obj is NOT NULL ) then
+ void := call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ //Dispose ExpectedReleaseLocationGroup
+ if( WSlocation_obj is NOT NULL ) then
+ void := call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+
+ else
+ //If there are orders on the worksheet retrieve the default values
+ // on the worksheet.
+ // These values are not required for this sample MLM however they
+ // contain useful information that can be used in the logic of an
+ // MLM.
+ WSSessionType := worksheetInfo.SessionType;
+ WSSessionReason := worksheetInfo.SessionReason;
+ WSRequestedBySource := worksheetInfo.RequestedBySource;
+ WSRequestedBy_obj := worksheetInfo.RequestedBy;
+ WSlocation_obj := worksheetInfo.ExpectedReleaseLocationGroup;
+ endif;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+
+ if( worksheetInfo is NOT NULL ) then
+ void := call worksheetInfo.Dispose;
+ worksheetInfo:= null;
+ endif;
+
+ if( client_visit_obj is NOT NULL ) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ if( WSRequestedBy_obj is NOT NULL ) then
+ void := call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ if( WSlocation_obj is NOT NULL ) then
+ void := call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+
+ // If unable to initialize starting data, do not continue
+ // with the creation of any orders.
+ // Still conclude true as the error message needs to
+ // be displayed as an error.
+
+ endcatch;
+
+ //----------------------------------------------------------------------
+ // Create a new Diagnostic order from a PreFilled item
+ // Place the order onto the order entry worksheet
+ //----------------------------------------------------------------------
+
+ // Added By Shivprasad for CSR# 32710 - Post Throbolytic OS
+
+
+ If (RepeatLabs.value is not null) and ( repeatfreq.value is Not Null ) and (OccTime is not Null) and (starttimeb.value is not Null) then
+
+ if ( StartTimeb.value <> "AM Rounds" ) then
+
+ if repeatfreq.value = "Daily" Then
+ Freq := (24 as number);
+ Elseif repeatfreq.value = "Q2H" Then
+ Freq := (2 as number);
+ Elseif repeatfreq.value = "Q4H" Then
+ Freq := (4 as number);
+ Elseif repeatfreq.value = "Q6H" Then
+ Freq := (6 as number);
+ Elseif repeatfreq.value = "Q8H" Then
+ Freq := (8 as number);
+ Elseif repeatfreq.value = "Q12H" Then
+ Freq := (12 as number);
+ Else
+ Freq := (0 as number);
+ Endif;
+
+ if ( StartOn.Value = "Today" ) then
+ Dat := read first { "SELECT FORMAT(GetDate(), {{{SINGLE-QUOTE}}}yyyy-MM-dd{{{SINGLE-QUOTE}}}) "};
+ elseif ( StartOn.Value = "Tomorrow" ) then
+ Dat := Read First { "Select FORMAT(DateAdd(Day, 1, GetDate()), {{{SINGLE-QUOTE}}}yyyy-MM-dd{{{SINGLE-QUOTE}}}) "} ;
+ endif;
+
+ StartDate1 := Dat ||" " || starttimeb.value ;
+ StartDateNew := Read first {" Select CONVERT(Datetime, {{{SINGLE-QUOTE}}}"|| StartDate1 || "{{{SINGLE-QUOTE}}}, 101)"} ;
+ FinalDate := StartDateNew + ( (( OccTime as Number ) - 1 ) * (Freq As Number ) * (60 as Number ) ) Minutes ;
+ FinalDate:= Read First { " Select FORMAT( Convert(Datetime, {{{SINGLE-QUOTE}}}" || FinalDate || "{{{SINGLE-QUOTE}}}),{{{SINGLE-QUOTE}}}yyyy-MM-dd HH:mm{{{SINGLE-QUOTE}}})"};
+ else
+ //Handling AM Rounds
+ //We force user to select Daily as frequency above; preset variable to 24
+ Freq := (24 as number);
+
+ //Need to check patient{{{SINGLE-QUOTE}}}s current location to determine AM Rounds start time
+ if ( currentLocation matches pattern "ICU%" OR currentLocation matches pattern "CVSU%" ) then
+ startTime := "04:00";
+ startHour := (4 as number);
+ stimebhr := "04";
+ stimebmin := "00";
+ else
+ startTime := "06:00";
+ startHour := (6 as number);
+ stimebhr := "06";
+ stimebmin := "00";
+ endif;
+
+ if ( StartOn.Value = "Today" ) then
+ if ( currentHour >= startHour ) then
+ Dat := read first { " SELECT FORMAT(DateAdd(Day, 1, GetDate()), {{{SINGLE-QUOTE}}}yyyy-MM-dd{{{SINGLE-QUOTE}}}) " };
+ else
+ Dat := read first { " SELECT FORMAT(GETDATE(), {{{SINGLE-QUOTE}}}yyyy-MM-dd{{{SINGLE-QUOTE}}}) " };
+ endif;
+ elseif ( StartOn.Value = "Tomorrow" ) then
+ Dat := read first { " SELECT FORMAT(DateAdd(Day, 1, GetDate()), {{{SINGLE-QUOTE}}}yyyy-MM-dd{{{SINGLE-QUOTE}}}) " };
+ endif;
+
+ StartDate1 := Dat || " " || startTime;
+ StartDateNew := read first { "SELECT CONVERT(DateTime, {{{SINGLE-QUOTE}}}" || StartDate1 || "{{{SINGLE-QUOTE}}}, 101)" };
+ FinalDate := StartDateNew + ( ( (OccTime as number) - 1 ) * ( Freq as number ) * ( 60 as number ) ) Minutes;
+ FinalDate := read first { "SELECT FORMAT(Convert(DateTime, {{{SINGLE-QUOTE}}}" || FinalDate || "{{{SINGLE-QUOTE}}}), {{{SINGLE-QUOTE}}}yyyy-MM-dd HH:mm{{{SINGLE-QUOTE}}})" };
+
+ endif;
+
+ Endif;
+
+ // end Shivprasad
+
+ If placeorder = "yes" then
+
+ linebreakme:= read last {" SELECT {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + char(13) + char(10) " };
+
+ lablist := call str_parse with ((repeatlabs.value),";");
+
+ If RepeatLabs.value is not null then
+ // Added By Shivprasad for CSR# 32710 - Post Throbolytic OS
+ OrderAccumBox.value := OrderAccumBox.value || linebreakme || " " || repeatlabs.value || ", Repeat From: " || StartDate1 || " To: " || FinalDate || ", Every " || Freq || " hr(s) " ;
+
+ Numords := count lablist;
+ for k in (1 seqto NumOrds) do
+ ordernamex := lablist [k];
+ ordername := ordernamex;
+
+ ws_call := call CreateRepeatOrder with
+ ordername,
+ modname,
+ vername,
+ worksheetInfo,
+ stimeb1,
+ stimebhr,
+ stimebmin,
+ heparin_iv_found,
+ //Active_OrderGUID,
+ //Active_SignificiantDtm,
+ client_visit_obj;
+
+ enddo;
+
+ RepeatLabs.value := "";
+ StartTimeb.value := Null;
+ StartOn.value := "";
+ RepeatOcc.value := "";
+ RepeatFreq.value := "";
+ StartTimeb.Control_Mandatory := false;
+ StartOn.Control_Mandatory := false;
+ RepeatOcc.Control_Mandatory := false;
+ RepeatFreq.Control_Mandatory := false;
+
+ else
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please choose the test(s) you wish to order and choose submit . " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+ endif; // End of Place Order = Yes section
+
+ ;;
+ 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;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_REQDATE_TOTAL_REP_POST_OP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_REQDATE_TOTAL_REP_POST_OP.mlm
new file mode 100644
index 0000000..827656d
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_REQDATE_TOTAL_REP_POST_OP.mlm
@@ -0,0 +1,124 @@
+maintenance:
+
+ title: Multi Dose Now and Then Orders;;
+ mlmname: FORM_SET_ReqDate_Total_Rep_Post_Op;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Jignesh Dhandhukia, Allscripts ;;
+ specialist: Allscripts;;
+ date: 2012-03-16;;
+ validation: testing;;
+
+library:
+ purpose: This MLM is called from the PRX Check Box To set Date in Requested Date
+ ;;
+
+ explanation: This MLM is called from the PRX Check Box To set Date in Requested Date
+
+
+ ;;
+ keywords: Called MLMs, ReqDate_Total_Rep_Post_Op
+ ;;
+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;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Chk_DiscPCADay1 := first of (field_list where field_list.DataItemName = "PRX_Checkbox1");
+ Chk_DiscPCADay2 := first of (field_list where field_list.DataItemName = "PRX_Checkbox2");
+ DiscPCARequestedDate := first of (field_list where field_list.DataItemName = "RequestedDate" and field_list.Label = "Mapped date for PO Opioids" );
+
+//jp
+ Grid_IV_Meds := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 28);
+ Grid_IV_Meds_List :=Grid_IV_Meds.value ;
+
+ (thisDocumentCommunication) := argument;
+ FORM_SET_GENERIC_ITEM_CONTROL := MLM {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}};
+ thisDocumentCommunication := CALL FORM_SET_GENERIC_ITEM_CONTROL WITH thisDocumentCommunication;
+
+
+
+ If CallingEvent = "FieldChange" Then
+
+ if (CallingField = "PRX_Checkbox1|1") or (CallingField = "PRX_Checkbox2|1") Then
+ if (Chk_DiscPCADay1.Value = true) or (Chk_DiscPCADay2.Value = true) then
+ Grid_IV_Meds_List.IsSelected := (True);
+ Else
+ Grid_IV_Meds_List.IsSelected := (False);
+ EndIf;
+ Endif;
+
+ if (CallingField = "PRX_Checkbox1|1") then
+ if (Chk_DiscPCADay1.Value = true) then
+ Chk_DiscPCADay2.Control_Read_Only := true;
+ //Mlt_Grid43.IsSelected := true;
+
+ PostOpDay1Date := (NOW + 1 day) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay1Date;
+//break;
+
+
+ else
+ Chk_DiscPCADay2.Control_Read_Only := false;
+ //Mlt_Grid43.IsSelected := false;
+ DiscPCARequestedDate.Value := "";
+ endif;
+ endif; //If CallingField = "PRX_Checkbox1|1"
+
+ if (CallingField = "PRX_Checkbox2|1") then
+ if (Chk_DiscPCADay2.Value = true) then
+ Chk_DiscPCADay1.Control_Read_Only := true;
+ //Mlt_Grid43.IsSelected := true;
+
+ PostOpDay2Date := (NOW + 2 day) FORMATTED WITH "%.2t";
+ DiscPCARequestedDate.Value := PostOpDay2Date;
+ else
+ Chk_DiscPCADay1.Control_Read_Only := false;
+ //Mlt_Grid43.IsSelected := false;
+ DiscPCARequestedDate.Value := "";
+ endif;
+ endif; //If CallingField = "PrX_Checkbox2|1"
+
+ Endif; // If callingEvent = "FieldChange"
+//break;
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ROBOTIC_PROSTATECTOMY.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ROBOTIC_PROSTATECTOMY.mlm
new file mode 100644
index 0000000..4c31e7a
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ROBOTIC_PROSTATECTOMY.mlm
@@ -0,0 +1,204 @@
+maintenance:
+
+ title: FORM_SET_ROBOTIC_PROSTATECTOMY;;
+ mlmname: FORM_SET_ROBOTIC_PROSTATECTOMY;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, ext. 7461;;
+ specialist: Maria Pest, ext. 7443;;
+ date: 2012-03-05;;
+ validation: testing;;
+
+library:
+ purpose: Used for the Robotic Prostatectomy Order Set.
+ ;;
+ explanation: Used for the Robotic Prostatectomy Order Set.
+
+ Change history
+
+ 03.05.2012 JMLaw Created.
+ ;;
+ keywords: Robotic, Prostatectomy, Called MLMs
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (
+ this_communication,
+ this_form,
+ client_info_obj
+ ) := argument;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ error_message := "";
+
+ field_list := this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ Pharmacy_Meds := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 30);
+ Pharmacy_Meds_List := Pharmacy_Meds.Value;
+
+ //Determine if patient is allergic to sulfa drugs
+ (allergen) := read {"SELECT a.Code, a.TouchedWhen"
+ || " FROM CV3AllergyDeclaration ad with (nolock) JOIN CV3Allergen a with (nolock) "
+ || " ON a.GUID = ad.AllergenGUID"
+ || " WHERE a.Code = {{{SINGLE-QUOTE}}}sulfa drugs{{{SINGLE-QUOTE}}}"
+ || " AND ad.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} "
+ || " AND ad.ClientGUID = " || Sql(client_guid)
+ , primaryTime = touchedWhen};
+
+ //Set boolean variable based on number of sulfa allergies returned from above query
+ sulfaAllergyExists := ((count allergen) > 0);
+
+ //If Form Open event AND patient has a sulfa allergy, set the Celecoxib medication to Read Only
+ if (CallingEvent = "FormOpen") then
+ if (sulfaAllergyExists = true) then
+ celecoxibFld := first of (Pharmacy_Meds_List WHERE Pharmacy_Meds_List.Name = "Celecoxib 200mg Cap");
+ celecoxibFld.IsReadOnly := true;
+ endif;
+ endif;
+
+ //On Field Change event, control ability to select certain medications in the Pharmacy / Medications grid
+ if (CallingEvent = "FieldChange") then
+ if (CallingField = "MultiOrderGrid|30") then
+
+ //List of medications in the Narcotic section in the Pharmacy / Medications grid
+ //List contains OxyCODONE 5 mg/Acetaminophen 325 mg (percocet) 1 tab PO every 4 hours as needed for moderate pain
+ //and oxyCODONE 5 mg / Acetaminophen 325 mg (Percocet) 2 tabs PO every 4 hours as needed for severe pain
+ Narcotic_Meds := (Pharmacy_Meds_List.IsSelected[8],
+ Pharmacy_Meds_List.IsSelected[9]);
+
+ NarcoticMedsTrueCount := count (Narcotic_Meds WHERE Narcotic_Meds = true);
+ //Initialize variables used to set the IsReadOnly and IsSelected property on medications in grid
+ NewReadOnly := ();
+ NewSelected := ();
+
+ //Begin to loop through all the medications contained in the Pharmacy / Medications grid
+ for i in 1 seqto (count Pharmacy_Meds_List.IsSelected) do
+ //If one or both Narcotic medications defined in the list above are selected,
+ //disable the OxyCODONE 5 mg 1 to 2 tablets PO, every 4 hours as needed for moderate to severe pain
+ //medication - all other grid fields are left alone
+ if ((NarcoticMedsTrueCount = 1 AND Pharmacy_Meds_List.IsReadOnly[10] = false) OR (NarcoticMedsTrueCount = 2)) then
+ if (i >= 8 AND i < 10) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ elseif (i = 10) then
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ else
+ NewReadOnly := NewReadOnly, Pharmacy_Meds_List.IsReadOnly[i];
+ NewSelected := NewSelected, Pharmacy_Meds_List.IsSelected[i];
+ endif;
+ elseif (NarcoticMedsTrueCount = 1 AND Pharmacy_Meds_List.IsReadOnly[10] = true) then
+ if (i >= 8 AND i < 10) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, false;
+ elseif (i = 10) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, false;
+ else
+ NewReadOnly := NewReadOnly, Pharmacy_Meds_List.IsReadOnly[i];
+ NewSelected := NewSelected, Pharmacy_Meds_List.IsSelected[i];
+ endif;
+
+ //If the third oxycodone med is selected
+ // (OxyCODONE 5 mg 1 to 2 tablets PO, every 4 hours as needed for moderate to severe pain),
+ //disable the medications contained in the narcotic meds list - all other grid fields are left alone
+ elseif (Pharmacy_Meds_List.IsSelected[10] = true) then
+ if (i >= 8 AND i < 10) then
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ else
+ NewReadOnly := NewReadOnly, Pharmacy_Meds_List.IsReadOnly[i];
+ NewSelected := NewSelected, Pharmacy_Meds_List.IsSelected[i];
+ endif;
+ //Nothing is selected; reset all 3 oxycodone medications to NOT Read Only and NOT selected
+ //all other grid fields are left alone
+ else
+ if (i >= 8 AND i <= 10) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, false;
+ else
+ NewReadOnly := NewReadOnly, Pharmacy_Meds_List.IsReadOnly[i];
+ NewSelected := NewSelected, Pharmacy_Meds_List.IsSelected[i];
+ endif;
+ endif;
+ enddo;
+ //Update Pharmacy / Medication grid fields with appropriate IsReadOnly and IsSelected properties
+ Pharmacy_Meds_List.IsReadOnly := NewReadOnly;
+ Pharmacy_Meds_List.IsSelected := NewSelected;
+
+ //If patient does NOT have a sulfa allergy, then control the ability to select only 1 medication field under
+ //the NSAIDs section in the Pharmacy / Medication grid
+ //NOTE: only need to perform this logic IF patient does not have sulfa allergy since
+ //celecoxib med is disabled on form open for patients with sulfa allergy
+ if (sulfaAllergyExists = false) then
+ //List of NSAIDs meds selected
+ Nsaid_Meds := (Pharmacy_Meds_List.IsSelected[2],
+ Pharmacy_Meds_List.IsSelected[3]);
+
+ //Initialize variabled used to set IsReadOnly and IsSelected properties
+ NewReadOnly := ();
+ NewSelected := ();
+ //Loop through all medications in grid
+ for k in 1 seqto (count Pharmacy_Meds_List.IsSelected) do
+ //If one medication in the NSAID meds list is selected, disable the other NSAID med
+ //all other meds in grid are left alone
+ if (true IN Nsaid_Meds) then
+ if (k >= 2 AND k < 4) then
+ if (Pharmacy_Meds_List.IsSelected[k] = true) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ endif;
+ else
+ NewReadOnly := NewReadOnly, Pharmacy_Meds_List.IsReadOnly[k];
+ NewSelected := NewSelected, Pharmacy_Meds_List.IsSelected[k];
+ endif;
+ //No NSAID med is selected, reset both medications in list to NOT read only and NOT selected
+ //all other meds in grid are left alone
+ else
+ if (k >= 2 AND k < 4) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, false;
+ else
+ NewReadOnly := NewReadOnly, Pharmacy_Meds_List.IsReadOnly[k];
+ NewSelected := NewSelected, Pharmacy_Meds_List.IsSelected[k];
+ endif;
+ endif;
+ enddo;
+ //Update Pharmacy / Medication grid fields with appropriate IsReadOnly and IsSelected properties
+ Pharmacy_Meds_List.IsReadOnly := NewReadOnly;
+ Pharmacy_Meds_List.IsSelected := NewSelected;
+ endif;
+ endif;
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_RX_MEDICATION_ORDER_MGT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_RX_MEDICATION_ORDER_MGT.mlm
new file mode 100644
index 0000000..0ec5b37
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_RX_MEDICATION_ORDER_MGT.mlm
@@ -0,0 +1,548 @@
+maintenance:
+
+maintenance:
+ title: Order Retrieval for Pharmacy Obj Plus Discontinue Function;;
+ filename: FORM_SET_Rx_Medication_Order_Mgt;;
+ arden: version 2.5;;
+ version: 15.10;;
+ institution: Eclipsys, System MLM;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2015-10-05;;
+ validation: testing;;
+library:
+ purpose: This MLM retrieves medication by therapeutic class for deletion from within the order form.
+
+ ;;
+ explanation: This MLM retrieves medication by therapeutic class for deletion from within the order form.
+
+ History:
+ 04.27.2016 TMS CSR 33465 Created to present duplicate therapeutic medication alerts in an interactive
+ window allowing users to discontinue existing orders or abandon the order they are
+ trying to enter in a user friendly presentation. This MLM uses the duplicate checking
+ stored procedures that are used by the STD_Duplicate_Medication_Therapy MLM and the Multum
+ Data Configuration in Decision Support. This MLM is called from order sets on Form Close.
+ Medications not on an order set are checked using Form_Rx_Medication_Retrieval on Form Open.
+ 08.30.2016 TMS Modified to limit number of characters stored in the info box containing the order guids
+ presented to the user as a duplicate. Duplicate guids returned from stored procedure also
+ eliminated to reduce the amount of characters stored in the info box. HD# 2234060
+ 09.12.2016 TMS Modified to add call to duplicate MLM logic to address pharmacy orders in MultiOrder Checkbox.
+ Added logic to only process order sets embedded in other order sets from the calling (parent) order set.
+ These same order sets will process logic when called independent from any other order set.
+ **Any changes made to this MLM will also need made to FORM_SET_Rx_Medication_Order_Mgt_MOCB.
+ HD# 2347914
+ 12.05.2016 TMS Change name of stored procedure used to gather duplicate order guids from
+ SCMTherapeuticDuplicateMedsCheckingPR to SCHTherapeuticDuplicateMedsCheckingPR. This is
+ a copy of the 15.1 version of the stored procedure. This will be used instead of the
+ 16.3 version of SCMTherapeuticDuplicateMedsCheckingPR to eliminate modifying MLM to send
+ additional fields for community medication orders - a new feature not needed for this MLM
+ CSR 35130
+ 04.11.2017 TMS Modified format of order guids in hidden field to save without encasing values in single quotes
+ for use by SCH_ALERT_ON_DUPLICATE_ORDERS. CSR 33465
+ 05.09.2017 TMS Modified to supress duplicate alerts from between Vancomycin PO and Vancomycin IV.
+ CSR 34904
+ 05.23.2017 TMS Modified to change noalertname value from NULL to " ". Was not recognizing NULL <> retrieved medication name.
+ CSR 34904 HD# 2700775
+ 07.18.2017 TMS Supress duplicate alerting for alcohol withdrawal protocol CSR 35319
+
+
+ ;;
+ keywords: Called MLMs, Form fields, Therapeutic Duplication
+;;
+ citations:
+{{+B}}Development{{-B}}: Drug information provided by Cerner Multum, Inc. Drug information can be customized and configured by local facility.
+{{+B}}Funding{{-B}}: Cerner Multum, Inc.
+{{+B}}Citations{{-B}}: None supplied by Cerner Multum, Inc.
+
+{{+B}}Release{{-B}}: VantageRx Multum Database
+
+ ;;
+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;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ comm_obj := this_communication.primaryobj;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ continue_checking_meds := TRUE;
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ calledfromset := last of (field_list where field_list.DataItemName = "MLM_From Order Set" and field_List.Control_MultiFieldOccNum = 1);
+ Dup_Order_Box := last of (field_list where field_list.DataItemName = "PRX_Order_Guids" and field_List.Control_MultiFieldOccNum = 1);
+ Dup_Order_Guids := Dup_Order_Box.value;
+ Selected_Order_Box := last of (field_list where field_list.DataItemName = "PRX_Existing_Order_Guids" and field_List.Control_MultiFieldOccNum = 1);
+ Selected_Order_Guids := Selected_Order_Box.value;
+ MedOrderBox := last of (field_list where field_list.DataItemName = "OBJ_Plus_Med" );
+ DupFlag := last of (field_list where field_list.DataItemName = "PRX_Dup_Action_Flag");
+ InfoBox := last of (field_list where field_list.DataItemName = "PRX_OrderSet_Duplicate_Info");
+ Obj_Plus_Launch := last of (field_list where field_list.DataItemName = "PRX_Alert_from_Order_Form");
+ Dup_Order_Action := last of (field_list where field_list.DataItemName = "PRX_Duplicate_Order_Action_Text");
+ session_type := comm_obj.internalprocessingtype;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ User_GUID := this_communication.UserGUID;
+ OrderSource := comm_obj.SourceCode;
+ ProviderGuid := this_communication.CareProviderGUID;
+ Infomsg := "";
+
+ // Set to a different Order Status Level
+ // if fewer order statuses should be included
+ lowest_status_level_for_meds:= 0;
+
+ // Normally orders with a StopDTM will have 3 times their half-life added to
+ // their stopDTM when figuring what drugs are still active in the patient{{{SINGLE-QUOTE}}}s system.
+ // This value indicates that if a completed drug has a half
+ // life less than this then not to bother adding on the 3 x the half-life
+ Past_HalfLife_Grace_Period := 10000; // value in hours
+
+ // Normally if the drug being ordered has a StopDTM then we add 3 times the
+ // half-life to the StopDTM when figuring what drugs in the database with
+ // start times in the future to include in the checking.
+ // This value indicates that if the drug being ordered has a half
+ // life less than this then not to bother adding on the 3 x the half-life
+ Future_HalfLife_Grace_Period := 10000; //value in hours
+
+ // Set the variable to indicate timeframe in minutes between the stopdtm
+ // and startdtm of identical orders that would make them be considered
+ // a reorder and thus not included in the duplicate checking.
+ Reorder_Grace_Period := 0; // value in minutes
+ at_in_house_session_list:= ("Inhouse");
+ // setting for "Suppress Duplicate Checking for Items in This Set"
+ use_catalog_setting_to_suppress_duplicate_checking_in_sets:= TRUE;
+ Order_Mgt_MLM := mlm {{{SINGLE-QUOTE}}}SCH_LAUNCH_ORDER_MANAGEMENT{{{SINGLE-QUOTE}}};
+
+ main_order_name := comm_obj.Name;
+ evoking_order_object_guid := comm_obj.GUID;
+ order_status_code := comm_obj.itemstatus;
+ Order_summary_line := "Summary Line Info";
+ main_item_catalog_guid := this_communication.ItemID;
+ chart_guid := this_communication.chartguid;
+ client_guid := this_communication.clientguid;
+ client_visit_guid := this_communication.clientvisitguid;
+ significant_date := comm_obj.significantdtm;
+ stop_date := comm_obj.stopdtm;
+ order_is_conditional := comm_obj.isconditional;
+ order_exists := false;
+ parent_conditional_order_guid := null;
+ order_component_obj := null;
+ complex_order := comm_obj.complexordertype;
+ order_is_for_discharge := comm_obj.isformdischarge;
+ order_alternate_order_type := null;
+ evoking_med_source := null;
+ order_session_type_bit_flags := 1;
+ unsubmitted_session_type_bit_flags := 1;
+ db_session_type_bit_flags := 1;
+ back_up_obj := null;
+ // Executes only when this MLM is called by the editor
+ if called_by_editor then
+
+ main_order_name := "Codeine 30mg Tab";
+ evoking_order_object_guid := comm_obj.GUID;
+ order_status_code := comm_obj.itemstatus;
+ Order_summary_line := "Summary Line Info";
+ main_item_catalog_guid := 8000001351073001;
+ chart_guid := this_communication.chartguid;
+ client_guid := this_communication.clientguid;
+ client_visit_guid := this_communication.clientvisitguid;
+ significant_date := comm_obj.significantdtm;
+ stop_date := "25-Feb-2016 0:00:00.000";
+ // stop_date := comm_obj.stopdtm;
+ order_is_conditional := comm_obj.isconditional;
+ order_exists := false;
+ parent_conditional_order_guid := null;
+ order_component_obj := null;
+ complex_order := comm_obj.complexordertype;
+ order_is_for_discharge := comm_obj.isformdischarge;
+ order_alternate_order_type := null;
+ evoking_med_source := null;
+ client_guid := 9000002166800200;
+
+ client_visit_guid := 9000003935500270;
+ user_guid := 4000001117119000;
+ db_session_type_bit_flags := 1;
+ avoid_parent_orderset_guid := "";
+ evoking_order_object_guid := 9001132042600680;
+ back_up_obj := null;
+ endif;
+
+ func_dup_suppress_checking := MLM {{{SINGLE-QUOTE}}}STD_FUNC_Dup_Suppress_Checking{{{SINGLE-QUOTE}}};
+ // Initialize input XML parameter
+ evoking_order_parameter_xml := "";
+ // evoking_rx_parameter_xml := "";
+ unsubmitted_order_parameter_xml := "";
+
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+
+ calledfromset.value := True;
+ OrderSetName := comm_obj.OrderSetName;
+
+/* If exist order_component_obj
+ then
+ // Gets the catalog item from the order component object
+ (evoking_additive_cat_item_guid_list,
+ evoking_additive_name_list) := read
+ { OrderComponent: OrderCatalogMasterItemGUID, Name
+ REFERENCING order_component_obj
+ where (Dosage AS Number) > 0 };
+ endif;
+*/
+ /* Initialize variable to empty string */
+ avoid_parent_orderset_guid := "";
+ avoid_child_orderset_guid := "";
+
+ cont1 := continue_checking_meds; //marker RS
+ mainorder := main_order_name; //marker RS
+ AWPCount := 0;
+
+
+ evoking_item_name := main_order_name;
+
+ continue_checking_meds := TRUE;
+ start_date := (day floor of now);
+ db_session_type_bit_flags := order_session_type_bit_flags;
+ unsubmitted_session_type_bit_flags := order_session_type_bit_flags;
+
+ // Check medications from significant date for non-alert checking triggers
+ start_date := significant_date;
+
+ if (start_date is NULL)
+ then
+ // Prescriptions can have empty start dates. Set it to Today.
+ start_date := (day floor of now);
+ endif;
+ evoking_is_selected := 1;
+
+ If CallingEvent = "FormClose" and this_communication.ParentOrderSetGUID is null then
+ Selected_Order_Box.value := "None";
+
+ checkorders := "";
+ Cat_Guid_List :=();
+ Cat_Name_List := ();
+ Evoke_Guid_List := ();
+ numgrids := 99;
+ r := 1;
+ grid_count := 1 seqto numgrids;
+
+ for r in grid_count do
+ Currentgrid := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = r);
+ gridval := currentgrid.value;
+ allvalues := ();
+ index_list := 1 seqto (count gridval) ;
+ if exist currentgrid then
+ for S in index_list do
+ selorders1 := gridval.IsSelected [S];
+
+ if selorders1 = true then
+
+ main_order_name1 := Gridval.Name [S] ;
+ main_item_catalog_guid1 := Gridval.OrderCatalogMasterItemGUID [S];
+ ordertype := read last
+ { " Select guid from CV3OrderCatalogMasterItem where guid = " || main_item_catalog_guid1
+ || " and TherapeuticCategoryID > 0"
+ };
+
+ If ordertype = main_item_catalog_guid1 then
+ if main_order_name1 in ("Lorazepam 2mg Tab", "Lorazepam 1mg Tab", "Lorazepam 0.5mg Tab", "Lorazepam Inj", "Diazepam Inj") then
+ AWPOrder := "True";
+ else
+ AWPOrder := "False";
+ endif;
+
+
+ checkorders := checkorders || " " || ordertype ;
+ Selected_Order_box.value := ordertype;
+ Cat_Guid_List := main_item_catalog_guid1;
+ Evoke_Guid_List := evoking_order_object_guid;
+ Cat_Name_List := main_order_name1;
+ gridnum := R;
+ gridloc := S;
+ griditem := Gridval.OrderCatalogMasterItemGUID [S];
+
+ evoking_order_parameter_xml :=
+ " \n";
+
+ input_parameter_xml := "\n\n" || evoking_order_parameter_xml || "\n";
+
+ If this_communication.OrderSet = "Linked" then
+ linkedset := read
+ { " select ocmi.Name from cv3order o "
+ || " join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGUID "
+ || " join CV3OrderCatalogSet ocs on ocs.guid = o.OrderSetGUID "
+ || " where o.IsRequired = 1 and o.IsPartOfSet = 1 and o.IDCode is null and o.ClientVisitGUID = 0 and o.ClientGUID = 0 and o.OrderSetType = 4 and o.TypeCode = {{{SINGLE-QUOTE}}}medication{{{SINGLE-QUOTE}}} "
+ || " and o.OrderSetGuid = " || SQL (main_item_catalog_guid) };
+
+ endif;
+
+ // Convert the boolean values to binary flag
+ ignore_discontinued_prescriptons_flag := ignore_discontinued_prescriptons as number;
+ display_lowest_category_exceeded_flag := display_lowest_category_exceeded as number;
+ check_parent_conditionarl_order := 0;
+
+ // Call stored proc to check duplicate medication therapy
+ (ComponentDrugKey_list,
+ ParentDrugKey_list,
+ EnteredDrugComponent_list,
+ EnteredDrugName_list,
+ EnteredIsAdditive_list,
+ DuplicateOrderName_list,
+ DuplicateAdditiveName_list,
+ DupIngredientName_list,
+ DupIsAdditive_list,
+ DupOrderGUID_list,
+ OrderCatlogMasterItem_list,
+ DupCategoryName_list,
+ MaxDupThreshold_list,
+ DupSummaryLine_list,
+ DupStartDTM_list,
+ DupStopDTM_list,
+ DupOrderStatusNum_list,
+ DupOrderStatus_list,
+ CategoryLevel_list,
+ IsMapped_list,
+ DupIsOrder_list):= read{" SCHTherapeuticDuplicateMedsCheckingPR "
+ || SQL(input_parameter_xml) || ", "
+ || client_guid || ", "
+ || user_guid || ", "
+ || SQL(Past_HalfLife_Grace_Period) || ", "
+ || SQL(Future_HalfLife_Grace_Period) || ", "
+ || SQL(Reorder_Grace_Period) || ", "
+ || SQL(lowest_status_level_for_meds) || ", "
+ || db_session_type_bit_flags || ","
+ || SQL(avoid_parent_orderset_guid) || ","
+ || SQL(avoid_child_orderset_guid) || ", "
+ || SQL(ignore_discontinued_prescriptons_flag) || ", "
+ || SQL(display_lowest_category_exceeded_flag) || ", "
+ || SQL(check_parent_conditionarl_order) || ", "
+ || SQL(parent_conditional_order_guid)
+ };
+
+ If AwPOrder = "True" then
+ AWPCount := AWPCount + 1;
+ endif;
+
+
+ //added from RS custom coding
+ //marker RS added flag to make the process account level based
+
+ sqlextract := "";
+ Orderguids := "";
+ countnosub := 0;
+ oldsingorder := "";
+
+ if exist EnteredDrugName_list then
+
+ if main_order_name1 = "Vancomycin:" then
+ noalertname := "Vancomycin Soln";
+ elseif main_order_name1 = "Vancomycin Soln" then
+ noalertname := "Vancomycin:";
+ else noalertname := " ";
+ endif;
+
+
+ spool_list := 1 seqto count (EnteredDrugName_list);
+
+ for countorder in spool_list do
+ singorder := DupOrderGUID_list[countorder];
+ singsum := DupSummaryLine_list[countorder];
+ singname:= DuplicateOrderName_list[countorder];
+
+ if ((singsum <>"Unsubmitted") and (singsum is not null) and (singname <> noalertname)) then // no need to check different account if = unsubmitted
+ If singorder <> oldsingorder then
+
+ cvguid := read last
+ {" select o.ClientVisitGUID from cv3order o "
+ || " where o.guid = " || singorder };
+
+ if cvguid = visit_guid then
+ countnosub := countnosub + 1;
+ if countnosub = 1 then
+ sqlextract := "{{{SINGLE-QUOTE}}}" || singorder || "{{{SINGLE-QUOTE}}}";
+ Orderguids := singorder;
+ alertlist := singorder;
+ oldsingorder := singorder;
+ else
+ sqlextract := sqlextract || ",{{{SINGLE-QUOTE}}}" || singorder || "{{{SINGLE-QUOTE}}}";
+ Orderguids:= Orderguids || "," ||singorder;
+ oldsingorder := singorder;
+ alertlist := alertlist, singorder;
+ endif;
+ endif;
+ endif;
+ endif;
+ enddo;
+ endif;
+
+ charnum :=0;
+ newmsgnum := 0;
+ objplusmsg := "";
+
+ If (countnosub > 0) and ((AwpOrder = "False") or (AWPOrder = "True" and AWPCount = 1)) then
+
+ If OrderSource is null then OrderSource := " "; endif;
+ objplusmsg := main_order_name1 || "|S|" || sqlextract|| "|" || OrderSource || "|" || ProviderGuid || "|" || "Pharmacy|";
+
+ Infomsg := main_order_name1 || "|" || alertlist|| "|" ;
+
+ Dupflag := call Order_Mgt_MLM
+ with (objplusmsg);
+
+ charnum := length infobox.value;
+ newmsgnum := length infomsg;
+ totalchars := charnum + newmsgnum;
+
+ If exists Dupflag and dupflag is not null then
+ If dupflag = "NN" then
+ allvalues := allvalues, selorders1;
+ If InfoBox.value is null then
+ InfoBox.value := infomsg ||"NCI";
+ else
+ If (totalchars) < 1900 then
+ InfoBox.value := InfoBox.value || "^" || infomsg ||"NCI";
+ endif;
+ endif;
+
+ elseIf dupflag matches pattern "YN" then
+ allvalues := allvalues, selorders1;
+ If InfoBox.value is null then
+ InfoBox.value := infomsg ||"AT";
+ else
+ If (totalchars) < 1900 then
+ InfoBox.value := InfoBox.value || "^" || infomsg ||"AT";
+ endif;
+ endif;
+
+ elseif dupflag matches pattern "YY" then
+
+ allvalues := allvalues, False;
+
+ If InfoBox.value is null then
+ InfoBox.value := infomsg ||"AT";
+ else
+ If (totalchars) < 1900 then
+ InfoBox.value := InfoBox.value || "^" || infomsg ||"AT";
+ endif;
+ endif;
+
+ elseif dupflag matches pattern "NY" then
+
+ allvalues := allvalues, False;
+
+ If InfoBox.value is null then
+
+ InfoBox.value := infomsg ||"NCI";
+ else
+ If (totalchars) < 1900 then
+ InfoBox.value := InfoBox.value || "^" || infomsg ||"NCI";
+ endif;
+ endif;
+ else
+ If InfoBox.value is null then
+
+ InfoBox.value := infomsg ||"NA";
+ else
+ If (totalchars) < 1900 then
+ InfoBox.value := InfoBox.value || "^" || infomsg ||"NA";
+ endif;
+ endif;
+ endif;
+ else allvalues := allvalues, selorders1;
+ endif; //If exists Dupflag and dupflag is not null
+
+
+
+
+ If Dup_Order_Box.value = "N" then
+
+ Dup_Order_box.value := orderguids;
+
+ else
+ Dup_Order_box.value := orderguids;
+
+ endif;
+
+
+
+ else allvalues := allvalues, selorders1;
+ endif; // if countnosub > 0
+ else allvalues := allvalues, selorders1;
+
+ endif; //If ordertype = main_item_catalog_guid1
+ else
+ allvalues := allvalues, selorders1;
+
+
+ endif;
+
+
+ enddo;
+
+
+ gridval.isselected := allvalues;
+
+ endif;
+
+ enddo;
+
+ Med_Order_Mgt_MOCB := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt_MOCB{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt_MOCB with this_communication, this_form, client_info_obj;
+
+ endif;
+
+
+
+
+ // Get the last revision date of the Multum database, strip out time portion
+ revision_date := read last { "select change_date from SXAMTdatabase_infoSYN" };
+ revision_date := revision_date formatted with "%.2t";
+ revision_date_string := "\n{{+B}}Revision Date{{-B}}: " || revision_date;
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_RX_MEDICATION_ORDER_MGT_MOCB.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_RX_MEDICATION_ORDER_MGT_MOCB.mlm
new file mode 100644
index 0000000..c39bffe
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_RX_MEDICATION_ORDER_MGT_MOCB.mlm
@@ -0,0 +1,522 @@
+maintenance:
+
+maintenance:
+ title: Order Retrieval for Pharmacy Obj Plus Discontinue Function;;
+ filename: FORM_SET_Rx_Medication_Order_Mgt_MOCB;;
+ arden: version 2.5;;
+ version: 15.10;;
+ institution: Eclipsys, System MLM;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2015-10-05;;
+ validation: testing;;
+library:
+ purpose: This MLM retrieves medication by therapeutic class for deletion from within the order form.
+
+ ;;
+ explanation: This MLM retrieves medication by therapeutic class for deletion from within the order form.
+
+ History:
+ 04.27.2016 TMS CSR 33465 Created to present duplicate therapeutic medication alerts in an interactive
+ window allowing users to discontinue existing orders or abandon the order they are
+ trying to enter in a user friendly presentation. This MLM uses the duplicate checking
+ stored procedures that are used by the STD_Duplicate_Medication_Therapy MLM and the Multum
+ Data Configuration in Decision Support. This MLM is called from order sets on Form Close.
+ Medications not on an order set are checked using Form_Rx_Medication_Retrieval on Form Open.
+ 08.30.2016 TMS Modified to limit number of characters stored in the info box containing the order guids
+ presented to the user as a duplicate. Duplicate guids returned from stored procedure also
+ eliminated to reduce the amount of characters stored in the info box. HD# 2234060
+ 09.12.2016 TMS Copy of FORM_SET_Rx_Medication_Order_Mgt to handle pharmacy orders in MultiOrderCheckboxes.
+ This MLM is called from FORM_SET_Rx_Medication_Order_Mgt. Any changes made to
+ FORM_SET_Rx_Medication_Order_Mgt will also need made to this MLM. HD# 2347914
+ 12.05.2016 TMS Change name of stored procedure used to gather duplicate order guids from
+ SCMTherapeuticDuplicateMedsCheckingPR to SCHTherapeuticDuplicateMedsCheckingPR. This is
+ a copy of the 15.1 version of the stored procedure. This will be used instead of the
+ 16.3 version of SCMTherapeuticDuplicateMedsCheckingPR to eliminate modifying MLM to send
+ additional fields for community medication orders - a new feature not needed for this MLM
+ CSR 35130
+ 04.11.2017 TMS Modified format of order guids in hidden field to save without encasing values in single quotes
+ for use by SCH_ALERT_ON_DUPLICATE_ORDERS. CSR 33465
+
+ ;;
+ keywords: Called MLMs, Form fields, Therapeutic Duplication
+;;
+ citations:
+{{+B}}Development{{-B}}: Drug information provided by Cerner Multum, Inc. Drug information can be customized and configured by local facility.
+{{+B}}Funding{{-B}}: Cerner Multum, Inc.
+{{+B}}Citations{{-B}}: None supplied by Cerner Multum, Inc.
+
+{{+B}}Release{{-B}}: VantageRx Multum Database
+
+ ;;
+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;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ comm_obj := this_communication.primaryobj;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ continue_checking_meds := TRUE;
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ calledfromset := last of (field_list where field_list.DataItemName = "MLM_From Order Set" and field_List.Control_MultiFieldOccNum = 1);
+ Dup_Order_Box := last of (field_list where field_list.DataItemName = "PRX_Order_Guids" and field_List.Control_MultiFieldOccNum = 1);
+ Dup_Order_Guids := Dup_Order_Box.value;
+ Selected_Order_Box := last of (field_list where field_list.DataItemName = "PRX_Existing_Order_Guids" and field_List.Control_MultiFieldOccNum = 1);
+ Selected_Order_Guids := Selected_Order_Box.value;
+ MedOrderBox := last of (field_list where field_list.DataItemName = "OBJ_Plus_Med" );
+ DupFlag := last of (field_list where field_list.DataItemName = "PRX_Dup_Action_Flag");
+ InfoBox := last of (field_list where field_list.DataItemName = "PRX_OrderSet_Duplicate_Info");
+ Obj_Plus_Launch := last of (field_list where field_list.DataItemName = "PRX_Alert_from_Order_Form");
+ Dup_Order_Action := last of (field_list where field_list.DataItemName = "PRX_Duplicate_Order_Action_Text");
+ session_type := comm_obj.internalprocessingtype;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ User_GUID := this_communication.UserGUID;
+ OrderSource := comm_obj.SourceCode;
+ ProviderGuid := this_communication.CareProviderGUID;
+ Infomsg := "";
+
+ // Set to a different Order Status Level
+ // if fewer order statuses should be included
+ lowest_status_level_for_meds:= 0;
+
+ // Normally orders with a StopDTM will have 3 times their half-life added to
+ // their stopDTM when figuring what drugs are still active in the patient{{{SINGLE-QUOTE}}}s system.
+ // This value indicates that if a completed drug has a half
+ // life less than this then not to bother adding on the 3 x the half-life
+ Past_HalfLife_Grace_Period := 10000; // value in hours
+
+ // Normally if the drug being ordered has a StopDTM then we add 3 times the
+ // half-life to the StopDTM when figuring what drugs in the database with
+ // start times in the future to include in the checking.
+ // This value indicates that if the drug being ordered has a half
+ // life less than this then not to bother adding on the 3 x the half-life
+ Future_HalfLife_Grace_Period := 10000; //value in hours
+
+ // Set the variable to indicate timeframe in minutes between the stopdtm
+ // and startdtm of identical orders that would make them be considered
+ // a reorder and thus not included in the duplicate checking.
+ Reorder_Grace_Period := 0; // value in minutes
+ at_in_house_session_list:= ("Inhouse");
+ // setting for "Suppress Duplicate Checking for Items in This Set"
+ use_catalog_setting_to_suppress_duplicate_checking_in_sets:= TRUE;
+ Order_Mgt_MLM := mlm {{{SINGLE-QUOTE}}}SCH_LAUNCH_ORDER_MANAGEMENT{{{SINGLE-QUOTE}}};
+
+ main_order_name := comm_obj.Name;
+ evoking_order_object_guid := comm_obj.GUID;
+ order_status_code := comm_obj.itemstatus;
+ Order_summary_line := "Summary Line Info";
+ main_item_catalog_guid := this_communication.ItemID;
+ chart_guid := this_communication.chartguid;
+ client_guid := this_communication.clientguid;
+ client_visit_guid := this_communication.clientvisitguid;
+ significant_date := comm_obj.significantdtm;
+ stop_date := comm_obj.stopdtm;
+ order_is_conditional := comm_obj.isconditional;
+ order_exists := false;
+ parent_conditional_order_guid := null;
+ order_component_obj := null;
+ complex_order := comm_obj.complexordertype;
+ order_is_for_discharge := comm_obj.isformdischarge;
+ order_alternate_order_type := null;
+ evoking_med_source := null;
+ order_session_type_bit_flags := 1;
+ unsubmitted_session_type_bit_flags := 1;
+ db_session_type_bit_flags := 1;
+ back_up_obj := null;
+ // Executes only when this MLM is called by the editor
+ if called_by_editor then
+
+ main_order_name := "Codeine 30mg Tab";
+ evoking_order_object_guid := comm_obj.GUID;
+ order_status_code := comm_obj.itemstatus;
+ Order_summary_line := "Summary Line Info";
+ main_item_catalog_guid := 8000001351073001;
+ chart_guid := this_communication.chartguid;
+ client_guid := this_communication.clientguid;
+ client_visit_guid := this_communication.clientvisitguid;
+ significant_date := comm_obj.significantdtm;
+ stop_date := "25-Feb-2016 0:00:00.000";
+ // stop_date := comm_obj.stopdtm;
+ order_is_conditional := comm_obj.isconditional;
+ order_exists := false;
+ parent_conditional_order_guid := null;
+ order_component_obj := null;
+ complex_order := comm_obj.complexordertype;
+ order_is_for_discharge := comm_obj.isformdischarge;
+ order_alternate_order_type := null;
+ evoking_med_source := null;
+ client_guid := 9000002166800200;
+
+ client_visit_guid := 9000003935500270;
+ user_guid := 4000001117119000;
+ db_session_type_bit_flags := 1;
+ avoid_parent_orderset_guid := "";
+ evoking_order_object_guid := 9001132042600680;
+ back_up_obj := null;
+ endif;
+
+ func_dup_suppress_checking := MLM {{{SINGLE-QUOTE}}}STD_FUNC_Dup_Suppress_Checking{{{SINGLE-QUOTE}}};
+ // Initialize input XML parameter
+ evoking_order_parameter_xml := "";
+ // evoking_rx_parameter_xml := "";
+ unsubmitted_order_parameter_xml := "";
+
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+
+ calledfromset.value := True;
+ OrderSetName := comm_obj.OrderSetName;
+
+/* If exist order_component_obj
+ then
+ // Gets the catalog item from the order component object
+ (evoking_additive_cat_item_guid_list,
+ evoking_additive_name_list) := read
+ { OrderComponent: OrderCatalogMasterItemGUID, Name
+ REFERENCING order_component_obj
+ where (Dosage AS Number) > 0 };
+ endif;
+*/
+ /* Initialize variable to empty string */
+ avoid_parent_orderset_guid := "";
+ avoid_child_orderset_guid := "";
+
+ cont1 := continue_checking_meds; //marker RS
+ mainorder := main_order_name; //marker RS
+
+
+ evoking_item_name := main_order_name;
+
+ continue_checking_meds := TRUE;
+ start_date := (day floor of now);
+ db_session_type_bit_flags := order_session_type_bit_flags;
+ unsubmitted_session_type_bit_flags := order_session_type_bit_flags;
+
+ // Check medications from significant date for non-alert checking triggers
+ start_date := significant_date;
+
+ if (start_date is NULL)
+ then
+ // Prescriptions can have empty start dates. Set it to Today.
+ start_date := (day floor of now);
+ endif;
+ evoking_is_selected := 1;
+
+ If CallingEvent = "FormClose" and this_communication.ParentOrderSetGUID is null then
+ Selected_Order_Box.value := "None";
+
+ checkorders := "";
+ Cat_Guid_List :=();
+ Cat_Name_List := ();
+ Evoke_Guid_List := ();
+ numgrids := 99;
+ r := 1;
+ grid_count := 1 seqto numgrids;
+
+ for r in grid_count do
+ Currentgrid := last of (field_list where field_list.DataItemName = "MultiOrderCheckbox"
+ and field_List.Control_MultiFieldOccNum = r);
+ gridval := currentgrid.value;
+ allvalues := ();
+ index_list := 1 seqto (count gridval) ;
+ if exist currentgrid then
+ for S in index_list do
+ selorders1 := gridval.IsSelected [S];
+
+ if selorders1 = true then
+
+ main_order_name1 := Gridval.Name [S] ;
+ main_item_catalog_guid1 := Gridval.OrderCatalogMasterItemGUID [S];
+ ordertype := read last
+ { " Select guid from CV3OrderCatalogMasterItem where guid = " || main_item_catalog_guid1
+ || " and TherapeuticCategoryID > 0"
+ };
+
+ If ordertype = main_item_catalog_guid1 then
+
+ checkorders := checkorders || " " || ordertype ;
+ Selected_Order_box.value := ordertype;
+ Cat_Guid_List := main_item_catalog_guid1;
+ Evoke_Guid_List := evoking_order_object_guid;
+ Cat_Name_List := main_order_name1;
+ gridnum := R;
+ gridloc := S;
+ griditem := Gridval.OrderCatalogMasterItemGUID [S];
+
+ evoking_order_parameter_xml :=
+ " \n";
+
+ input_parameter_xml := "\n\n" || evoking_order_parameter_xml || "\n";
+
+ If this_communication.OrderSet = "Linked" then
+ linkedset := read
+ { " select ocmi.Name from cv3order o "
+ || " join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGUID "
+ || " join CV3OrderCatalogSet ocs on ocs.guid = o.OrderSetGUID "
+ || " where o.IsRequired = 1 and o.IsPartOfSet = 1 and o.IDCode is null and o.ClientVisitGUID = 0 and o.ClientGUID = 0 and o.OrderSetType = 4 and o.TypeCode = {{{SINGLE-QUOTE}}}medication{{{SINGLE-QUOTE}}} "
+
+ || " and o.OrderSetGuid = " || SQL (main_item_catalog_guid) };
+
+ endif;
+
+
+
+ // Convert the boolean values to binary flag
+ ignore_discontinued_prescriptons_flag := ignore_discontinued_prescriptons as number;
+ display_lowest_category_exceeded_flag := display_lowest_category_exceeded as number;
+ check_parent_conditionarl_order := 0;
+
+ // Call stored proc to check duplicate medication therapy
+ (ComponentDrugKey_list,
+ ParentDrugKey_list,
+ EnteredDrugComponent_list,
+ EnteredDrugName_list,
+ EnteredIsAdditive_list,
+ DuplicateOrderName_list,
+ DuplicateAdditiveName_list,
+ DupIngredientName_list,
+ DupIsAdditive_list,
+ DupOrderGUID_list,
+ OrderCatlogMasterItem_list,
+ DupCategoryName_list,
+ MaxDupThreshold_list,
+ DupSummaryLine_list,
+ DupStartDTM_list,
+ DupStopDTM_list,
+ DupOrderStatusNum_list,
+ DupOrderStatus_list,
+ CategoryLevel_list,
+ IsMapped_list,
+ DupIsOrder_list):= read{" SCHTherapeuticDuplicateMedsCheckingPR "
+ || SQL(input_parameter_xml) || ", "
+ || client_guid || ", "
+ || user_guid || ", "
+ || SQL(Past_HalfLife_Grace_Period) || ", "
+ || SQL(Future_HalfLife_Grace_Period) || ", "
+ || SQL(Reorder_Grace_Period) || ", "
+ || SQL(lowest_status_level_for_meds) || ", "
+ || db_session_type_bit_flags || ","
+ || SQL(avoid_parent_orderset_guid) || ","
+ || SQL(avoid_child_orderset_guid) || ", "
+ || SQL(ignore_discontinued_prescriptons_flag) || ", "
+ || SQL(display_lowest_category_exceeded_flag) || ", "
+ || SQL(check_parent_conditionarl_order) || ", "
+ || SQL(parent_conditional_order_guid)
+ };
+
+
+ //added from RS custom coding
+ //marker RS added flag to make the process account level based
+
+ sqlextract := "";
+ Orderguids := "";
+ countnosub := 0;
+ oldsingorder := "";
+
+ if exist EnteredDrugName_list then
+
+
+ spool_list := 1 seqto count (EnteredDrugName_list);
+
+ for countorder in spool_list do
+ singorder := DupOrderGUID_list[countorder];
+ singsum := DupSummaryLine_list[countorder];
+
+ if (singsum <>"Unsubmitted" and (singsum is not null)) then // no need to check different accoutn if = unsubmitted
+
+ If singorder <> oldsingorder then
+
+ cvguid := read last
+ {" select o.ClientVisitGUID from cv3order o "
+ || " where o.guid = " || singorder };
+
+ if cvguid = visit_guid then
+ countnosub := countnosub + 1;
+ if countnosub = 1 then
+ sqlextract := "{{{SINGLE-QUOTE}}}" || singorder || "{{{SINGLE-QUOTE}}}";
+ Orderguids := singorder;
+ alertlist := singorder;
+ oldsingorder := singorder;
+ else
+ sqlextract := sqlextract || ",{{{SINGLE-QUOTE}}}" || singorder || "{{{SINGLE-QUOTE}}}";
+ Orderguids:= Orderguids || "," ||singorder;
+ oldsingorder := singorder;
+ alertlist := alertlist, singorder;
+ endif;
+
+ endif;
+ endif;
+ endif;
+ enddo;
+ endif;
+
+ charnum :=0;
+ newmsgnum := 0;
+ objplusmsg := "";
+ If (countnosub > 0) then
+
+ If OrderSource is null then OrderSource := " "; endif;
+ objplusmsg := main_order_name1 || "|S|" || sqlextract|| "|" || OrderSource || "|" || ProviderGuid || "|" || "Pharmacy|";
+ // infomsg := objplusmsg;
+ Infomsg := main_order_name1 || "|" || alertlist|| "|" ;
+ // Infomsg := main_order_name1 || ": (" || sqlextract|| ")" ;
+ Dupflag := call Order_Mgt_MLM
+ with (objplusmsg);
+
+ charnum := length infobox.value;
+ newmsgnum := length infomsg;
+ totalchars := charnum + newmsgnum;
+
+ If exists Dupflag and dupflag is not null then
+ If dupflag = "NN" then
+ allvalues := allvalues, selorders1;
+ If InfoBox.value is null then
+ InfoBox.value := infomsg ||"NCI";
+ else
+ If (totalchars) < 1900 then
+ InfoBox.value := InfoBox.value || "^" || infomsg ||"NCI";
+ endif;
+ endif;
+
+ elseIf dupflag matches pattern "YN" then
+ allvalues := allvalues, selorders1;
+ If InfoBox.value is null then
+ InfoBox.value := infomsg ||"AT";
+ else
+ If (totalchars) < 1900 then
+ InfoBox.value := InfoBox.value || "^" || infomsg ||"AT";
+ endif;
+ endif;
+
+ elseif dupflag matches pattern "YY" then
+
+ allvalues := allvalues, False;
+
+ If InfoBox.value is null then
+ InfoBox.value := infomsg ||"AT";
+ else
+ If (totalchars) < 1900 then
+ InfoBox.value := InfoBox.value || "^" || infomsg ||"AT";
+ endif;
+ endif;
+
+ elseif dupflag matches pattern "NY" then
+
+ allvalues := allvalues, False;
+
+ If InfoBox.value is null then
+
+ InfoBox.value := infomsg ||"NCI";
+ else
+ If (totalchars) < 1900 then
+ InfoBox.value := InfoBox.value || "^" || infomsg ||"NCI";
+ endif;
+ endif;
+ else
+ If InfoBox.value is null then
+
+ InfoBox.value := infomsg ||"NA";
+ else
+ If (totalchars) < 1900 then
+ InfoBox.value := InfoBox.value || "^" || infomsg ||"NA";
+ endif;
+ endif;
+ endif;
+ else allvalues := allvalues, selorders1;
+ endif; //If exists Dupflag and dupflag is not null
+
+
+
+
+ If Dup_Order_Box.value = "N" then
+
+ Dup_Order_box.value := orderguids;
+
+ else
+ Dup_Order_box.value := orderguids;
+
+ endif;
+
+
+
+ else allvalues := allvalues, selorders1;
+ endif; // if countnosub > 0
+ else allvalues := allvalues, selorders1;
+
+ endif; //If ordertype = main_item_catalog_guid1
+ else
+ allvalues := allvalues, selorders1;
+
+
+ endif;
+
+
+ enddo;
+
+
+ gridval.isselected := allvalues;
+
+ endif;
+
+ enddo;
+
+ endif;
+
+
+
+
+ // Get the last revision date of the Multum database, strip out time portion
+ revision_date := read last { "select change_date from SXAMTdatabase_infoSYN" };
+ revision_date := revision_date formatted with "%.2t";
+ revision_date_string := "\n{{+B}}Revision Date{{-B}}: " || revision_date;
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_RX_SEDATIVE_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_RX_SEDATIVE_ORDERS.mlm
new file mode 100644
index 0000000..2d24c99
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_RX_SEDATIVE_ORDERS.mlm
@@ -0,0 +1,221 @@
+maintenance:
+
+ title: Sedative Orders with Dose Reduction;;
+ mlmname: FORM_Set_Rx_Sedative_Orders;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-07-22;;
+ validation: testing;;
+
+library:
+ purpose: Used for Dose Reduction of Sedative Orders in patients over 65 years of age (Changed to 18 years of age)
+ ;;
+
+ explanation: This MLM is called from ...
+
+ Change history
+ 05.07.2013 TMS Change made to reduce age from 65 to 18 per Med Exec for Leapfrog project. Added yes/no
+ decision box for "if physician has order for do not substitute" CSR 31334
+ 06.11.2015 BB Change made to Lunesta, to reduce the 2mg selection to 1mg. So now when 3mg or 2mg Lunesta
+ is selected, the 1mg is automatically selected. CSR#33494
+ 03.29.2016 TMS Changes made to remove logic for Eszopiclone 3mg Tab and Zolpidem CR 12.5mg Tab which are
+ being removed from the formulary. CSR 34225
+
+
+ ;;
+ keywords: Called MLMs, Sedatives
+ ;;
+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";
+
+ // 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;
+
+ comm_obj := this_communication.primaryobj;
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ CallingSet := comm_obj.OrderSetName;
+
+ Info_fld := last of (field_list where field_list.DataItemName = "PRX_NoteComment0"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Override_fld := last of (field_list where field_list.DataItemName = "PRX_DosageOverride"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Substitute_fld := last of (field_list where field_list.DataItemName = "PRX_NoteComment2"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ message18 := "Lower dose substituted by approval of Medical Executive Committee.";
+ message65 := "Lower dose substituted by approval of Medical Executive Committee; patient is 65 years or older";
+ nomessage := " ";
+ messageDoNotSub := Override_fld.Label;
+
+ SedativeOrders := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 1);
+ SedativeOrders_List := SedativeOrders.Value;
+
+
+ Found_Zolpidem5Prn := first of (SedativeOrders_List where SedativeOrders_List.Name = "Zolpidem 5mg Tab");
+ Found_Zolpidem10Prn := first of (SedativeOrders_List where SedativeOrders_List.Name = "Zolpidem 10mg Tab");
+ Found_Zolpidem5Sch := last of (SedativeOrders_List where SedativeOrders_List.Name = "Zolpidem 5mg Tab");
+ Found_Zolpidem10Sch := last of (SedativeOrders_List where SedativeOrders_List.Name = "Zolpidem 10mg Tab");
+ Found_Zolpidem6CRPrn := first of (SedativeOrders_List where SedativeOrders_List.Name = "Zolpidem CR 6.25mg Tab");
+ Found_Zolpidem12CRPrn := first of (SedativeOrders_List where SedativeOrders_List.Name = "Zolpidem CR 12.5mg Tab");
+ Found_Zolpidem6CRSch := last of (SedativeOrders_List where SedativeOrders_List.Name = "Zolpidem CR 6.25mg Tab");
+ Found_Zolpidem12CRSch := last of (SedativeOrders_List where SedativeOrders_List.Name = "Zolpidem CR 12.5mg Tab");
+ Found_Temazepam7Prn := first of (SedativeOrders_List where SedativeOrders_List.Name = "Temazepam 7.5mg Cap");
+ Found_Temazepam15Prn := first of (SedativeOrders_List where SedativeOrders_List.Name = "Temazepam 15mg Cap");
+ Found_Temazepam30Prn := first of (SedativeOrders_List where SedativeOrders_List.Name = "Temazepam 30mg Cap");
+ Found_Temazepam7Sch := last of (SedativeOrders_List where SedativeOrders_List.Name = "Temazepam 7.5mg Cap");
+ Found_Temazepam15Sch := last of (SedativeOrders_List where SedativeOrders_List.Name = "Temazepam 15mg Cap");
+ Found_Temazepam30Sch := last of (SedativeOrders_List where SedativeOrders_List.Name = "Temazepam 30mg Cap");
+ Found_Eszopiclone1Prn := first of (SedativeOrders_List where SedativeOrders_List.Name = "Eszopiclone 1mg Tab");
+ Found_Eszopiclone2Prn := first of (SedativeOrders_List where SedativeOrders_List.Name = "Eszopiclone 2mg Tab");
+// Found_Eszopiclone3Prn := first of (SedativeOrders_List where SedativeOrders_List.Name = "Eszopiclone 3mg Tab");
+ Found_Eszopiclone1Sch := last of (SedativeOrders_List where SedativeOrders_List.Name = "Eszopiclone 1mg Tab");
+ Found_Eszopiclone2Sch := last of (SedativeOrders_List where SedativeOrders_List.Name = "Eszopiclone 2mg Tab");
+// Found_Eszopiclone3Sch := last of (SedativeOrders_List where SedativeOrders_List.Name = "Eszopiclone 3mg Tab");
+
+ if exists (client_info_obj) then
+ (birthdate,dobM,dobD,dobY) := read last {ClientInfo: BirthDate, BirthMonthNum, BirthDayNum, BirthYearNum
+ REFERENCING client_info_obj};
+ endif;
+
+ patientAge := (NOW - birthdate) / (1 year);
+
+ if (patientAge > 17.99) then
+ if (CallingField = "MultiOrderGrid|1") then
+ if (Override_fld.value = false) then
+ if (Found_Zolpidem10Prn.IsSelected = true) then
+ SedativeOrders_List.IsSelected := (true, false, false, false);
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+ elseif (Found_Zolpidem10Sch.IsSelected = true) then
+ SedativeOrders_List.IsSelected := (false, false, true, false);
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+ elseif (Found_Zolpidem12CRPrn.IsSelected = true) then
+ SedativeOrders_List.IsSelected := (true, false, false, false);
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+ elseif (Found_Zolpidem12CRSch.IsSelected = true) then
+ SedativeOrders_List.IsSelected := (false, false, true, false);
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+ elseif (Found_Temazepam30Prn.IsSelected = true) then
+ SedativeOrders_List.IsSelected := (false, true, false, false, false, false);
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+ elseif (Found_Temazepam30Sch.IsSelected = true) then
+ SedativeOrders_List.IsSelected := (false, false, false, false, true, false);
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+ //[BB CSR33494]
+ elseif (Found_Eszopiclone2Prn.IsSelected = true) then
+ SedativeOrders_List.IsSelected := (true, false, false, false); //(true, false, false, false, false, false);
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+ elseif (Found_Eszopiclone2Sch.IsSelected = true) then
+ SedativeOrders_List.IsSelected := (false, false, true, false); //(false, false, false, true, false, false);
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+ //[BB CSR33494 END]
+/*
+ elseif (Found_Eszopiclone3Prn.IsSelected = true) then
+ SedativeOrders_List.IsSelected := (true, false, false, false, false, false); //(false, true, false, false, false, false); //[BB mod]
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+ elseif (Found_Eszopiclone3Sch.IsSelected = true) then
+ SedativeOrders_List.IsSelected := (false, false, false, true, false, false); //(false, false, false, false, true, false); //[BB mod]
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+*/
+ else
+ Info_fld.Value := nomessage;
+ Substitute_fld.Value := nomessage;
+ endif;
+ endif; //Override_fld.value = false
+ endif; //CallingField = "MultiOrderGrid|1"
+
+ if (CallingField = "PRX_DosageOverride|2") then
+
+ If Override_fld.value = True then
+ messagetext:="You have chosen to override the Medical Executive Committee "
+ || "approved protocol to lower sedative/hypnotic doses in ALL patients over 18 years "
+ || "old. \n\n Do you have a physician order to override the automatic "
+ || "substitution that states Do Not Substitute the Lower Dose? \n\n If you have an "
+ || "order, click YES below.";
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with Messagetext ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult as string) = "Yes") then
+
+ Info_fld.Value := nomessage;
+ Substitute_fld.Value := messageDoNotSub;
+ if (count(SedativeOrders_List) = 4) then
+ SedativeOrders_List.IsSelected := (false, false, false, false);
+ else
+ SedativeOrders_List.IsSelected := (false, false, false, false, false, false);
+ endif;
+ endif;
+
+ if((dialogResult as string) = "No") then
+ Override_fld.Value := false;
+
+ endif;
+
+ else
+
+ Substitute_fld.Value := nomessage;
+
+ if (count(SedativeOrders_List) = 4) then
+ SedativeOrders_List.IsSelected := (false, false, false, false);
+ else
+ SedativeOrders_List.IsSelected := (false, false, false, false, false, false);
+ endif;
+
+ endif; //CallingField = "PRX_DosageOverride|2"
+ endif; //patientAge > 17.99
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_RX_SEDATIVE_ORDERS_FBC.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_RX_SEDATIVE_ORDERS_FBC.mlm
new file mode 100644
index 0000000..c15753c
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_RX_SEDATIVE_ORDERS_FBC.mlm
@@ -0,0 +1,167 @@
+maintenance:
+
+ title: Sedative Orders with Dose Reduction;;
+ mlmname: FORM_Set_Rx_Sedative_Orders_FBC;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-07-22;;
+ validation: testing;;
+
+library:
+ purpose: Used for Dose Reduction of Sedative Orders in patients over 65 years of age (Changed to 18 years of age)
+ ;;
+
+ explanation: This MLM is called from FBC Order sets with Zolpidem orders.
+
+ Change history
+ 09.11.2013 TMS Copied from FORM_SET_RX_SEDATIVE_ORDERS for use with FBC Order sets with Zolpidem 10mg orders. CSR 31334
+ 10.22.2014 JML Added call to new FORM_SET_FBC_POSTPARTUM_ORDERS MLM for CSR 32679
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+
+
+
+ ;;
+ keywords: Called MLMs, Sedatives
+ ;;
+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";
+
+ fbc_postpartum_orders := MLM {{{SINGLE-QUOTE}}}FORM_SET_FBC_POSTPARTUM_ORDERS{{{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;
+
+ comm_obj := this_communication.primaryobj;
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ CallingSet := comm_obj.OrderSetName;
+
+ Info_fld := last of (field_list where field_list.DataItemName = "PRX_NoteComment0"
+ and field_List.Control_MultiFieldOccNum = 1);
+ Override_fld := last of (field_list where field_list.DataItemName = "PRX_DosageOverride"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Substitute_fld := last of (field_list where field_list.DataItemName = "PRX_NoteComment2"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ message18 := "Lower dose substituted by approval of Medical Executive Committee.";
+// message65 := "Lower dose substituted by approval of Medical Executive Committee; patient is 65 years or older";
+ nomessage := " ";
+ messageDoNotSub := Override_fld.Label;
+
+ FBCSedativeOrders := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 16);
+ FBCSedativeOrders_List := FBCSedativeOrders.Value;
+
+
+
+ Found_Zolpidem5FBC := first of (FBCSedativeOrders_List where FBCSedativeOrders_List.Name = "Zolpidem 5mg Tab");
+ Found_Zolpidem10FBC := first of (FBCSedativeOrders_List where FBCSedativeOrders_List.Name = "Zolpidem 10mg Tab");
+
+ //CALL FORM_SET_FBC_POSTPARTUM_ORDERS MLM to determine RH Negative status
+ ( this_communication, this_form ) := CALL fbc_postpartum_orders WITH (this_communication, this_form, client_info_obj);
+
+ if exists (client_info_obj) then
+ (birthdate,dobM,dobD,dobY) := read last {ClientInfo: BirthDate, BirthMonthNum, BirthDayNum, BirthYearNum
+ REFERENCING client_info_obj};
+ endif;
+
+ patientAge := (NOW - birthdate) / (1 year);
+
+ if (patientAge > 17.99) then
+ if (CallingField = "MultiOrderGrid|16") then
+ if (Override_fld.value = false) then
+ if (Found_Zolpidem10Fbc.IsSelected = true) then
+ FBCSedativeOrders_List.IsSelected := (true, false);
+ Info_fld.Value := message18;
+ Substitute_fld.Value := message18;
+ else
+ Info_fld.Value := nomessage;
+ Substitute_fld.Value := nomessage;
+ endif;
+ endif; //Override_fld.value = false
+ endif; //CallingField = "MultiOrderGrid|16")
+
+ if (CallingField = "PRX_DosageOverride|2") then
+
+ If Override_fld.value = True then
+ messagetext:="You have chosen to override the Medical Executive Committee "
+ || "approved protocol to lower sedative/hypnotic doses in ALL patients over 18 years "
+ || "old. \n\n Do you have a physician order to override the automatic "
+ || "substitution that states Do Not Substitute the Lower Dose? \n\n If you have an "
+ || "order, click YES below.";
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with Messagetext ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult as string) = "Yes") then
+
+ Info_fld.Value := nomessage;
+ Substitute_fld.Value := messageDoNotSub;
+ if (count(FBCSedativeOrders_List) = 2) then
+ FBCSedativeOrders_List.IsSelected := (false, true);
+ endif;
+ endif;
+
+ if((dialogResult as string) = "No") then
+ Override_fld.Value := false;
+ endif;
+
+ else
+
+ Substitute_fld.Value := nomessage;
+ if (count(FBCSedativeOrders_List) = 2) then
+ FBCSedativeOrders_List.IsSelected := (false, false);
+ endif;
+
+ endif; //If Override_fld.value = True
+ endif; //CallingField = "PRX_DosageOverride|2"
+ endif; //if (patientAge > 17.99)
+
+ If CallingEvent = "FormClose" then
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SCIP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SCIP.mlm
new file mode 100644
index 0000000..d50c874
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SCIP.mlm
@@ -0,0 +1,630 @@
+maintenance:
+
+ title: SCIP Surgical Antibiotic Prophylaxis Orders;;
+ mlmname: FORM_Set_SCIP;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-04-01;;
+ validation: testing;;
+
+library:
+ purpose: Used for Surgical Antibiotic Prophylaxis Weight Based Dosing
+ ;;
+
+ explanation: This MLM is called from Surgical Antibiotic Prophylaxis Order Set
+
+ Change history
+ 03.12.2013 TMS Created for SCIP Antibiotic Orders in order sets
+ 04.08.2013 TMS Moved to production as part of the Mini-Syringe to Mini-Bag project to reduce item changes
+ needing completed in order sets and to standarize the look of SCIP orders in the post op order
+ sets. CSR 31359
+ 06.02.2013 TMS Added SCIP Antibiotics: Pre-op Open Heart Surgery to same MRSA routine used by
+ SCIP Antibiotics: Open Heart Surgery CSR 32467
+ 08.17.2016 TMS Added Penicillin/Cephalosporin allergy guidelines to all SCIP Order Sets CSR 34749
+ 07.06.2017 TMS Updated to reflect changes to SCIP Antibiotics for heart procedures to use the
+ higher dose of Cefazolin 2 gm < 120 kg and 3 gm for 120 kg or greater. CSR 35793
+ 09.28.2017 TMS CSR #35222 Upadated MLM for allergy info message for Cefoxitin.
+ 09.05.2018 TMS CSR #37176, 37177, 37178, 37062 Added query for Updated Ortho to populate info box
+ with new Cefazolin Dosing for Ortho order sets updated for review.
+ 11.20.2018 TMS CSR{{{SINGLE-QUOTE}}}s 37583 (Abdominoplasty Post Op), 37556 (Post Op Lap Chole) and
+ 37557 (Wound Debridement Post Op Orders): Changed to use new cefazolin dosing.
+ 12.03.2018 TMS CSR{{{SINGLE-QUOTE}}}s 37585 (Gastric Bypass Post Op)and 37533 (Post Op Vascular Surgery):
+ Changed to use new cefazolin dosing.
+ 12.17.2018 TMS CSR 37346 (Fractured Hip Post Op Orders), 37345 (Total Hip Replacement Post Op Orders),
+ 37344 (Total Knee Replacement Post Op Orders)
+ 02.20.2019 TMS 37530 (Post Op Open Chole) Changed to use new cefazolin dosing.
+ 01.15.2020 TMS 38595 (Post Op Foot and Ankle) Changed to use new cefazolin dosing.
+ 01.15.2020 TMS 37873 (Free Flap Post Op) Added to use static dosing for Cefazolin and Clindamycin.
+
+
+
+ ;;
+ keywords: Called MLMs, Antibiotic Prophylaxis, 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";
+
+ // 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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+// Identify order sets with old cefazolin dosing
+ (AltSCIPSets) := read {"select GUID from CV3OrderCatalogSet where name in ({{{SINGLE-QUOTE}}}Free Flap Post Op Orders{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCIP Antibiotics: Free Flap Surgery{{{SINGLE-QUOTE}}})"};
+
+
+// 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);
+ 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 = " || ClientGuid || " "
+ };
+//
+If patientage < 12 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;
+//
+
+// Define other fields
+ StartNow := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
+ Dose := first of (field_list where field_list.DataItemName = "DosageLow");
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+
+ Cefazolin := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 1);
+ Cefoxitin := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 2);
+ Clindamycin := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 3);
+ Vancomycin := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 4);
+ Gentamicin := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 5);
+
+ CefazolinDose := Cefazolin.Value;
+ CefoxitinDose := Cefoxitin.Value;
+ ClindamycinDose := Clindamycin.Value;
+ VancomycinDose := Vancomycin.Value;
+ GentamicinDose := Gentamicin.Value;
+
+ CefazolinID := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode" and field_List.Control_MultiFieldOccNum = 1);
+ CefoxitinID := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode" and field_List.Control_MultiFieldOccNum = 3);
+ ClindamycinID := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode" and field_List.Control_MultiFieldOccNum = 2);
+ VancomycinID := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode" and field_List.Control_MultiFieldOccNum = 4);
+ GentamicinID := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode" and field_List.Control_MultiFieldOccNum = 5);
+
+ CefazolinCode := CefazolinID.Value;
+ CefoxitinCode := CefoxitinID.Value;
+ ClindamycinCode := ClindamycinID.Value;
+ VancomycinCode := VancomycinID.Value;
+ GentamicinCode := GentamicinID.Value;
+
+
+ RequestedTime1 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1);
+ RequestedTime2 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2);
+ RequestedTime3 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3);
+ RequestedTime4 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 4);
+ RequestedTime5 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 5);
+
+ RequestedDate1 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ RequestedDate2 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ RequestedDate3 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+ RequestedDate4 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 4);
+ RequestedDate5 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 5);
+
+ Grid1Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Grid1Orders_List := Grid1Orders.Value;
+ Grid2Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Grid2Orders_List := Grid2Orders.Value;
+
+ SCIPMedInfo := last of (field_list where field_list.DataItemName = "NUR_GenAdditionalTxt" and field_List.Control_MultiFieldOccNum = 1);
+ SCIPPCNMedInfo := last of (field_list where field_list.DataItemName = "NUR_GenAdditionalTxt" and field_List.Control_MultiFieldOccNum = 2);
+ SCIPSetInfo := last of (field_list where field_list.DataItemName = "NUR_GenAdditionalTxt" and field_List.Control_MultiFieldOccNum = 3);
+ AltCefazolinInfo := CRLF || TAB ||"Cefazolin 1 gm" ;
+ CefazolinInfo := CRLF || TAB ||"Cefazolin 2 gm" ||TAB || "(Weight less than 120 kg)" || CRLF || TAB || "Cefazolin 3 gm"|| TAB || "( Weight 120 kg or greater)" ;
+ CefoxitinInfo := CRLF || TAB ||"Cefoxitin 1 gm" || TAB || "(Weight less than 80 kg)" || CRLF || TAB || "Cefoxitin 2 gm" || TAB || "(Weight 80 kg or greater)";
+
+ ClindamycinInfo := CRLF || TAB || "Clindamycin 600mg" || TAB || TAB || "(Weight less than 80 kg)" || CRLF || TAB || "Clindamycin 900mg" || TAB || TAB || "(Weight 80 kg or greater)";
+ AltClindamycinInfo := CRLF || TAB || "Clindamycin 600mg" ;
+
+ VancomycinInfo := CRLF || TAB || "Vancomycin 1 gm" || TAB || TAB || "(Weight between 50kg and less than 80 kg)" || CRLF || TAB || "Vancomycin 15mg/kg" || TAB || "(Weight less than 50kg or 80kg and greater)";
+
+ ClindaGentInfo := CRLF || TAB || TAB || TAB || " AND"|| CRLF || TAB || "Gentamicin" || TAB || TAB || "(1.5mg/kg)" ;
+
+ OpenHeartInfo := "Cefazolin" || TAB || TAB || TAB || "- Patient MRSA negative and NOT allergic to cephalosporins or penicillins" || CRLF ||
+ "Vancomycin or Clindamycin"|| TAB || "- Patient MRSA negative AND allergic to cephalosporins or penicillins" || CRLF ||
+ "Cefazolin and Vancomycin"|| TAB || "- Patient MRSA positive and NOT allergic to cephalosporins or penicillins" || CRLF ||
+ "Vancomycin" || TAB || TAB || "- Patient MRSA positive AND allergic to cephalosporins or penicillins" || CRLF ||
+ "Note: " ||TAB || "Simple rash, nausea, or vomiting does not exclude the use of Cephalosporins. Avoid cephalosporins " ||
+ "only if immediate hypersensitivity (i.e., hives, anaphylaxis, pharyngeal edema, neutropenia, fever)" ;
+
+ OrthoInfo := "Cefazolin" || TAB || TAB || TAB || "- Patient MRSA negative and NOT allergic to cephalosporins or penicillins" || CRLF ||
+ "Clindamycin or Vancomycin"|| TAB || "- Patient MRSA negative AND allergic to cephalosporins or penicillins" || CRLF ||
+ "Cefazolin and Vancomycin"|| TAB || "- Patient MRSA positive and NOT allergic to cephalosporins or penicillins" || CRLF ||
+ "Vancomycin" || TAB || TAB || "- Patient MRSA positive AND allergic to cephalosporins or penicillins" || CRLF ||
+ "Note: " ||TAB || "For Penicillin allergy, simple rash, nausea, or vomiting does not exclude the use of Cephalosporins. Avoid cephalosporins " ||
+ "only if immediate " || TAB || TAB || "hypersensitivity (i.e., hives, anaphylaxis, pharyngeal edema, neutropenia, fever)" ;
+
+ AllergyInfo := CRLF || TAB || "Note: " ||TAB || "Simple rash, nausea, or vomiting does not exclude the use of Cephalosporins. Avoid cephalosporins" ||CRLF || TAB || TAB ||
+ "only if immediate hypersensitivity (i.e., hives, anaphylaxis, pharyngeal edema, neutropenia, fever)" ;
+
+ AllergyInfoCefoxitin := CRLF || TAB || "Note: " ||TAB || "Simple rash, nausea, or vomiting does not exclude the use of (cefoxitin) Cephalosporins. Avoid cephalosporins" ||CRLF || TAB || TAB ||
+ "only if immediate hypersensitivity (i.e., hives, anaphylaxis, pharyngeal edema, neutropenia, fever)" ;
+
+ Found_Cefazolin := first of (Grid1Orders_List where Grid1Orders_List.Name = "Cefazolin:");
+ Found_Cefoxitin := first of (Grid1Orders_List where Grid1Orders_List.Name = "Cefoxitin:");
+ Found_Vancomycin := first of (Grid2Orders_List where Grid2Orders_List.Name = "Vancomycin:");
+ Found_Clindamycin := first of (Grid2Orders_List where Grid2Orders_List.Name = "Clindamycin:");
+ Found_Gentamicin := first of (Grid2Orders_List where Grid2Orders_List.Name = "Gentamicin:");
+
+ CefazolinBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 1);
+ CefazolinBoxValue := CefazolinBox.Value;
+
+ VancomycinBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 4);
+ VancomycinBoxValue := VancomycinBox.Value;
+
+ ClindamycinBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 3);
+ ClindamycinBoxValue := ClindamycinBox.Value;
+
+ ClindaGentBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 5);
+ ClindaGentBoxValue := ClindaGentBox.Value;
+
+ CefoxitinBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 2);
+ CefoxitinBoxValue := CefoxitinBox.Value;
+
+
+
+ If OrderSetName = "SCIP Antibiotics: Open Heart Surgery" or OrderSetName = "SCIP Antibiotics: Pre-op Open Heart Surgery" then
+ SCIPSetInfo.value := OpenHeartInfo;
+ OS_with_MRSA := "True";
+ elseif OrderSetName = "SCIP Antibiotics: Cefazolin-Clindamycin-Vancomycin" then
+ SCIPSetInfo.value := OrthoInfo;
+ OS_with_MRSA := "True";
+ elseif OrderSetName = "SCIP Antibiotics: Cefoxitin-Clindamycin w/ Gentamicin" then
+ SCIPSetInfo.value := AllergyInfoCefoxitin;
+ else
+ SCIPSetInfo.value := AllergyInfo;
+ endif;
+
+// Obtain Coded Allergen Guids
+(AllergenGuids) := read
+{ " select guid from cv3allergen where code like {{{SINGLE-QUOTE}}}Penicill%{{{SINGLE-QUOTE}}}or code like {{{SINGLE-QUOTE}}}Cef%{{{SINGLE-QUOTE}}} or code like {{{SINGLE-QUOTE}}}%cillin{{{SINGLE-QUOTE}}} or code like {{{SINGLE-QUOTE}}}Cephalex%{{{SINGLE-QUOTE}}}"};
+
+// Retrieve coded and possible typed in allergies to penicillin
+(PCNAllergy) := read last
+ { " Select Status from CV3AllergyDeclaration "
+ || " where ClientGUID = " || SQL(clientguid) || " and "
+ || " ((Text like {{{SINGLE-QUOTE}}}penicil%{{{SINGLE-QUOTE}}} or text like {{{SINGLE-QUOTE}}}%pcn%{{{SINGLE-QUOTE}}} or text like {{{SINGLE-QUOTE}}}%cephalexin%{{{SINGLE-QUOTE}}} or "
+ || " text like {{{SINGLE-QUOTE}}}%cillin%{{{SINGLE-QUOTE}}} or text like {{{SINGLE-QUOTE}}}cef%{{{SINGLE-QUOTE}}}) and Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and TypeCodeForOther = {{{SINGLE-QUOTE}}}drug{{{SINGLE-QUOTE}}}) "
+ || " or (ClientGUID = " || SQL(clientguid) || " and AllergenGUID in (" || SQL(allergenguids) || ") and Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} ) "
+ };
+
+
+
+// Check for MRSA Result
+
+(ResultValue) := read last
+{"SELECT tol.text "
+|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
+|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
+|| " and o.orderstatuscode In ({{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}}) "
+|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
+|| " left join cv3BasicObservation bo with (nolock) on bo.OrderGuid = o.guid and bo.clientguid = " || SQL(clientguid) || " and bo.chartguid = " || SQL(chartguid) || " and bo.clientvisitguid = " || SQL(clientvisitguid)
+|| " and bo.itemname = {{{SINGLE-QUOTE}}}culture{{{SINGLE-QUOTE}}} "
+|| " left join cv3textualobservationline tol with (nolock) on tol.observationguid = bo.guid and tol.clientguid = " || SQL(clientguid)
+|| " order by o.significantdtm " };
+
+ if ResultValue = "METHICILLIN RESISTANT STAPHYLOCOCCUS AUREUS" then MRSAPositive := "Yes"; else MRSAPositive := "No"; endif;
+
+// Check for MRSA Flag
+
+(MRSAHist) := read last
+{ " select case when EnterpriseClientcol8 in ({{{SINGLE-QUOTE}}}MRSA{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Both{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} end "
+|| " from cv3enterpriseclientdata where clientguid = " || SQL(clientguid) || " " };
+ if exist MRSAHist then MRSAHistory := "Yes"; else MRSAHistory := "No"; endif;
+
+ If (VancomycinBoxValue = True or CefazolinBoxValue = True or ClindamycinBoxValue = True or ClindaGentBoxValue = True
+ or CefoxitinBoxValue = True) and weightvalue = 0 then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please enter a weight to calculate dosing.","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+CurrentLocation := read last
+ {"Select CurrentLocation "
+ ||" From cv3Clientvisit "
+ ||" Where Guid = " || SQL(ClientVisitGuid)
+ ||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" };
+
+ If CallingEvent = "FormOpen" then
+ sciporders := ""; grid1true := (); grid1false := ();
+ index_list := 1 seqto (count Grid1Orders_List ) ;
+ for J in index_list do
+ sciporders := sciporders || Grid1Orders_List.Name ;
+ enddo;
+
+ index_list2 := 1 seqto (count Grid2Orders_List ) ;grid2true := (); grid2false := ();
+ for K in index_list2 do
+ sciporders := sciporders || Grid2Orders_List.Name ;
+ enddo;
+
+ if sciporders matches pattern "%cefazolin%" then
+ RequestedTime1.control_visible := true;
+ RequestedDate1.control_visible := true;
+ CefazolinBox.control_visible := true;
+
+ If this_communication.CatalogParentOrderSetGUID in AltSCIPSets or this_communication.CatalogOrderSetGUID in AltSCIPSets then
+ SCIPMedInfo.value := AltCefazolinInfo;
+ ClindamycinInfo := AltClindamycinInfo;
+ else
+ SCIPMedInfo.value := CefazolinInfo;
+ endif;
+
+ endif;
+
+
+ if sciporders matches pattern "%cefoxitin%" then
+ RequestedTime2.control_visible := true;
+ RequestedDate2.control_visible := true;
+ CefoxitinBox.control_visible := true;
+ SCIPMedInfo.value := CefoxitinInfo;
+ endif;
+
+ if sciporders matches pattern "%clindamycin%" then
+ if sciporders matches pattern "%Gentamicin%" then
+ RequestedTime5.control_visible := true;
+ RequestedDate5.control_visible := true;
+ RequestedTime3.control_visible := true;
+ RequestedDate3.control_visible := true;
+ ClindaGentBox.control_visible := true;
+ SCIPPcnMedInfo.value := ClindamycinInfo ||ClindaGentInfo;
+ elseif sciporders matches pattern "%vancomycin%" then
+ SCIPPcnMedInfo.value := CLINDAMYCInInfo || VancomycinInfo;
+ RequestedTime3.control_visible := true;
+ RequestedDate3.control_visible := true;
+ ClindamycinBox.control_visible := true;
+ RequestedTime4.control_visible := true;
+ RequestedDate4.control_visible := true;
+ VancomycinBox.control_visible := true;
+ else
+ RequestedTime3.control_visible := true;
+ RequestedDate3.control_visible := true;
+ ClindamycinBox.control_visible := true;
+ SCIPPcnMedInfo.value := CLINDAMYCInInfo;
+ endif;
+ endif;
+ if sciporders matches pattern "%vancomycin%" then
+ if sciporders matches pattern "%Clindamycin%" then
+ SCIPPcnMedInfo.value := CLINDAMYCInInfo || VancomycinInfo;
+ RequestedTime3.control_visible := true;
+ RequestedDate3.control_visible := true;
+ ClindamycinBox.control_visible := true;
+ RequestedTime4.control_visible := true;
+ RequestedDate4.control_visible := true;
+ VancomycinBox.control_visible := true;
+ else
+ RequestedTime4.control_visible := true;
+ RequestedDate4.control_visible := true;
+ VancomycinBox.control_visible := true;
+ SCIPPcnMedInfo.value := VancomycinInfo;
+ endif;
+ endif;
+/*
+ grid1control := ();
+ grid2control := ();
+ index1_list := 1 seqto (count Grid1Orders_List ) ;
+ index2_list := 1 seqto (count Grid2Orders_List ) ;
+ for a in index1_list do
+ grid1control := grid1control , "true";
+ enddo;
+ for b in index2_list do
+ grid2control := grid2control , "true";
+ enddo;
+
+ Grid1Orders_List.IsReadOnly := grid1control;
+ Grid2Orders_List.IsReadOnly := grid2control;
+*/
+ endif;
+
+
+If CallingEvent = "FieldChange" then
+ grid1control := (); grid1default := ();
+ grid2control := (); grid2default := ();
+ index1_list := 1 seqto (count Grid1Orders_List ) ;
+ index2_list := 1 seqto (count Grid2Orders_List ) ;
+
+ // Cefazolin
+ If CallingField = "PRX_Checkbox1|1" then
+ If CefazolinBoxValue = True then
+ Found_Cefazolin.IsSelected := True;
+ CefoxitinBox.control_read_only := True;
+ ClindamycinBox.control_read_only := True;
+ ClindaGentBox.control_read_only := True;
+
+ for a in index1_list do
+ grid1select := grid1select , grid1orders_list.isselected [a];
+ if grid1orders_list.isselected [a] = true then
+ grid1default := grid1default , "true";
+ grid1control := grid1control , "false"; else
+ grid1control := grid1control , "true";
+ grid1default := grid1default , "true";
+ endif;
+ enddo;
+
+ for b in index2_list do
+ grid2select := grid2select , grid2orders_list.isselected [b];
+ if grid2orders_list.isselected [b] = true then
+ grid2default := grid2default , "true";
+ grid2control := grid2control , "false"; else
+ grid2default := grid2default , "true";
+ grid2control := grid2control , "true"; endif;
+ enddo;
+ Grid1Orders_List.IsReadOnly := grid1control;
+ Grid2Orders_List.IsReadOnly := grid2control;
+
+ If (MRSAPositive = "Yes" or MRSAHistory = "Yes") and (PCNAllergy <> "Active" or PCNAllergy is null) and OS_with_MRSA = "True" then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Your patient may be flagged as MRSA Positive, consider ordering Vancomycin in addition to Cefazolin.","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+ If PCNAllergy = "Active" and MRSAPositive = "No" and MRSAHistory = "No" then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Your patient may have a documented allergy to Penicillin or Cephalosporins, please review Allergies before continuing. ","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+ If (MRSAPositive = "Yes" or MRSAHistory = "Yes") and PCNAllergy = "Active" and OS_with_MRSA = "True" then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Your patient may be flagged as MRSA Positive and may have a documented allergy to Penicillin or Cephalosporins. " || "\n\n Please review before ordering.","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+ elseif
+ CefazolinBoxValue = FALSE then
+ Found_Cefazolin.IsSelected := False;
+ ClindamycinBox.control_read_only := False;
+ ClindaGentBox.control_read_only := False;
+ VancomycinBox.control_read_only := False;
+ CefoxitinBox.control_read_only := False;
+ Grid1Orders_List.IsReadOnly := grid1default;
+ Grid2Orders_List.IsReadOnly := grid2default;
+ endif;
+ endif;
+
+ // Cefoxitin
+ If CallingField = "PRX_Checkbox1|2" then
+ If CefoxitinBoxValue = True then
+
+ Found_Cefoxitin.IsSelected := True;
+ CefazolinBox.control_read_only := True;
+ ClindamycinBox.control_read_only := True;
+ VancomycinBox.control_read_only := True;
+ ClindaGentBox.control_read_only := True;
+
+
+ for a in index1_list do
+ grid1select := grid1select , grid1orders_list.isselected [a];
+ if grid1orders_list.isselected [a] = true then
+ grid1default := grid1default , "true";
+ grid1control := grid1control , "false"; else
+ grid1control := grid1control , "true";
+ grid1default := grid1default , "true";
+ endif;
+ enddo;
+
+ for b in index2_list do
+ grid2select := grid2select , grid2orders_list.isselected [b];
+ if grid2orders_list.isselected [b] = true then
+ grid2default := grid2default , "true";
+ grid2control := grid2control , "false"; else
+ grid2default := grid2default , "true";
+ grid2control := grid2control , "true"; endif;
+ enddo;
+ Grid1Orders_List.IsReadOnly := grid1control;
+ Grid2Orders_List.IsReadOnly := grid2control;
+ elseif
+ CefoxitinBoxValue = FALSE then
+ Found_Cefoxitin.IsSelected := False;
+ ClindamycinBox.control_read_only := False;
+ ClindaGentBox.control_read_only := False;
+ VancomycinBox.control_read_only := False;
+ CefazolinBox.control_read_only := False;
+
+ Grid1Orders_List.IsReadOnly := grid1default;
+ Grid2Orders_List.IsReadOnly := grid2default;
+ endif;
+ endif;
+
+
+
+ // Clindamycin
+ If CallingField = "PRX_Checkbox1|3" then
+ If ClindamycinBoxValue = True then
+
+
+ Found_Clindamycin.IsSelected := True;
+ CefazolinBox.control_read_only := True;
+ CefoxitinBox.control_read_only := True;
+ VancomycinBox.control_read_only := True;
+ ClindaGentBox.control_read_only := True;
+
+
+ for a in index1_list do
+ grid1select := grid1select , grid1orders_list.isselected [a];
+ if grid1orders_list.isselected [a] = true then
+ grid1default := grid1default , "true";
+ grid1control := grid1control , "false"; else
+ grid1control := grid1control , "true";
+ grid1default := grid1default , "true";
+ endif;
+ enddo;
+
+ for b in index2_list do
+ grid2select := grid2select , grid2orders_list.isselected [b];
+ if grid2orders_list.isselected [b] = true then
+ grid2default := grid2default , "true";
+ grid2control := grid2control , "false"; else
+ grid2default := grid2default , "true";
+ grid2control := grid2control , "true"; endif;
+ enddo;
+ Grid1Orders_List.IsReadOnly := grid1control;
+ Grid2Orders_List.IsReadOnly := grid2control;
+ elseif
+ ClindamycinBoxValue = FALSE then
+ Found_Clindamycin.IsSelected := False;
+ CefazolinBox.control_read_only := False;
+ ClindaGentBox.control_read_only := False;
+ VancomycinBox.control_read_only := False;
+ CefoxitinBox.control_read_only := False;
+
+ Grid1Orders_List.IsReadOnly := grid1default;
+ Grid2Orders_List.IsReadOnly := grid2default;
+ endif;
+ endif;
+
+
+
+
+ //
+ If CallingField = "PRX_Checkbox1|4" then
+ If VancomycinBoxValue = True then
+ Found_Vancomycin.IsSelected := True;
+ CefoxitinBox.control_read_only := True;
+ ClindamycinBox.control_read_only := True;
+ ClindaGentBox.control_read_only := True;
+
+
+ for a in index1_list do
+ grid1select := grid1select , grid1orders_list.isselected [a];
+ if grid1orders_list.isselected [a] = true then
+ grid1default := grid1default , "true";
+ grid1control := grid1control , "false"; else
+ grid1control := grid1control , "true";
+ grid1default := grid1default , "true";
+ endif;
+ enddo;
+
+ for b in index2_list do
+ grid2select := grid2select , grid2orders_list.isselected [b];
+ if grid2orders_list.isselected [b] = true then
+ grid2default := grid2default , "true";
+ grid2control := grid2control , "false"; else
+ grid2default := grid2default , "true";
+ grid2control := grid2control , "true"; endif;
+ enddo;
+ Grid1Orders_List.IsReadOnly := grid1control;
+ Grid2Orders_List.IsReadOnly := grid2control;
+ elseif
+ VancomycinBoxValue = FALSE then
+ Found_Vancomycin.IsSelected := False;
+ CefazolinBox.control_read_only := False;
+ ClindaGentBox.control_read_only := False;
+ ClindamycinBox.control_read_only := False;
+ CefoxitinBox.control_read_only := False;
+
+ Grid1Orders_List.IsReadOnly := grid1default;
+ Grid2Orders_List.IsReadOnly := grid2default;
+ endif;
+ endif;
+
+ //
+ If CallingField = "PRX_Checkbox1|5" then
+ If ClindaGentBoxValue = True then
+ Found_Clindamycin.IsSelected := True;
+ Found_Gentamicin.IsSelected := True;
+ VancomycinBox.control_read_only := True;
+ ClindamycinBox.control_read_only := True;
+ CefazolinBox.control_read_only := True;
+ CefoxitinBox.control_read_only := True;
+ for a in index1_list do
+ grid1select := grid1select , grid1orders_list.isselected [a];
+ if grid1orders_list.isselected [a] = true then
+ grid1default := grid1default , "true";
+ grid1control := grid1control , "false"; else
+ grid1control := grid1control , "true";
+ grid1default := grid1default , "true";
+ endif;
+ enddo;
+
+ for b in index2_list do
+ grid2select := grid2select , grid2orders_list.isselected [b];
+ if grid2orders_list.isselected [b] = true then
+ grid2default := grid2default , "true";
+ grid2control := grid2control , "false"; else
+ grid2default := grid2default , "true";
+ grid2control := grid2control , "true"; endif;
+ enddo;
+ Grid1Orders_List.IsReadOnly := grid1control;
+ Grid2Orders_List.IsReadOnly := grid2control;
+ elseif
+ ClindaGentBoxValue = FALSE then
+
+
+
+ Found_Clindamycin.IsSelected := False;
+ Found_Gentamicin.IsSelected := False;
+ CefazolinBox.control_read_only := False;
+ VancomycinBox.control_read_only := False;
+ ClindamycinBox.control_read_only := False;
+ CefoxitinBox.control_read_only := False;
+
+ Grid1Orders_List.IsReadOnly := grid1default;
+ Grid2Orders_List.IsReadOnly := grid2default;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SEPSIS_UNKNOWN_SOURCE_ANTIBIOTICS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SEPSIS_UNKNOWN_SOURCE_ANTIBIOTICS.mlm
new file mode 100644
index 0000000..8005bd5
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SEPSIS_UNKNOWN_SOURCE_ANTIBIOTICS.mlm
@@ -0,0 +1,891 @@
+maintenance:
+
+ title: FORM_SET_SEPSIS_UNKNOWN_SOURCE_ANTIBIOTICS;;
+ mlmname: FORM_SET_SEPSIS_UNKNOWN_SOURCE_ANTIBIOTICS;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Peggy Leschak, Allscripts;;
+ date: 2017-04-26;;
+ validation: testing;;
+
+library:
+ purpose: Used for Sepsis Unknown Source Antibiotics order set
+ ;;
+
+ explanation: This MLM is called from Sepsis Unknown Source Antibiotics Order Set
+
+ Change history
+ 04.26.2017 JML CSR 35272: Created for Sepsis Unknown Source Antibiotic Order Set
+ 02.13.2018 JML CSR 26163: 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 Sepsis, 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;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Boolean variable to run Vancomycin Logic
+ vanco_logic_run := false;
+
+ //Define fields
+ Zosyn_Vanco_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 12 );
+ Cefepime_Vanco_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 15 );
+
+ 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 );
+
+ 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 );
+
+ 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;
+
+ Vancomycin_Freq := first of ( field_list WHERE field_list.DataItemName = "FrequencyCode" AND field_list.Control_MultiFieldOccNum = 1 );
+ Vancomycin_Freq_Val := Vancomycin_Freq.Value;
+
+ 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" );
+
+ 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:" );
+
+ PCN_Allergy := first of ( field_list WHERE field_list.DataItemName = "PRX_PCN Allergy" AND field_list.Control_MultiFieldOccNum = 1 );
+ 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 = 2);
+ 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 = 2);
+ 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" 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;
+ 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;
+
+ //Populate Guidelines
+ ( this_communication, this_form ) := call antibiotic_guideline_mlm WITH this_communication, this_form, client_info_obj;
+
+ //Disable all drugs in grids
+ Cefepime.IsReadonly := true;
+ Vancomycin.IsReadonly := true;
+ Zosyn.IsReadonly := true;
+ Zosyn_Low.IsReadonly := true;
+
+ //Retrieve PCN Allergy information
+ // Obtain Coded Allergen Guids
+ (AllergenGuids) := READ {"SELECT GUID"
+ || " FROM CV3Allergen a WITH (NOLOCK)"
+ || " WHERE a.Code like {{{SINGLE-QUOTE}}}Penicill%{{{SINGLE-QUOTE}}} OR a.Code like {{{SINGLE-QUOTE}}}Cef%{{{SINGLE-QUOTE}}} OR a.Code like {{{SINGLE-QUOTE}}}%cillin{{{SINGLE-QUOTE}}} OR a.Code like {{{SINGLE-QUOTE}}}Cephalex%{{{SINGLE-QUOTE}}}"};
+
+ (PCNAllergyReaction) := READ {"SELECT ad.SvrtyLevelDisplay"
+ || " FROM CV3AllergyDeclaration ad WITH (NOLOCK)"
+ || " WHERE ad.ClientGUID = " || SQL(ClientGuid)
+ || " AND ((ad.Text LIKE {{{SINGLE-QUOTE}}}penicil%{{{SINGLE-QUOTE}}} OR ad.Text LIKE {{{SINGLE-QUOTE}}}%pcn%{{{SINGLE-QUOTE}}} OR ad.Text LIKE {{{SINGLE-QUOTE}}}%cephalexin%{{{SINGLE-QUOTE}}} OR ad.Text LIKE {{{SINGLE-QUOTE}}}%cillin%{{{SINGLE-QUOTE}}} OR ad.Text LIKE {{{SINGLE-QUOTE}}}cef%{{{SINGLE-QUOTE}}}) "
+ || " AND ad.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} AND ad.TypeCodeForOther = {{{SINGLE-QUOTE}}}drug{{{SINGLE-QUOTE}}})"
+ || " OR (ad.ClientGUID = " || SQL(ClientGuid)
+ || " AND ad.AllergenGUID IN (" || SQL(AllergenGuids) || ") AND ad.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}})"};
+
+ a := "";
+ for i IN 1 seqto ( count PCNAllergyReaction ) do
+ a := a || PCNAllergyReaction[i];
+ enddo;
+
+ if ( a <> "" ) then
+ PCN_Allergy.Value := ( a as String );
+ else
+ PCN_Allergy.Value := "NO ALLERGY";
+ endif;
+
+ //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 = "Sepsis Unknown Source Antibiotic 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 ( Zosyn_Vanco_Chk.Value = true OR Cefepime_Vanco_Chk.Value = true ) then
+ vanco_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 ( Zosyn_Vanco_Chk.Value = true OR Cefepime_Vanco_Chk.Value = true ) then
+ vanco_logic_run := true;
+ endif;
+ endif;
+
+ //********** ZOSYN + VANCOMYCIN ****************
+ if ( OrderSetName = "Sepsis Unknown Source Antibiotic ED" and CallingField = "PRX_Checkbox1|12" ) then
+
+ fieldValue := Zosyn_Vanco_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ Zosyn.IsSelected := true;
+
+ vanco_logic_run := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+
+ elseif ( fieldValue = false ) then
+
+ Zosyn_Low.IsSelected := false;
+ Zosyn.IsSelected := false;
+
+ Vancomycin_Load.IsSelected := false;
+ Vancomycin.IsSelected := false;
+
+ Vancomycin_Trough.IsSelected := false;
+ Vancomycin_Nursing_Instr.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+ //********** ZOSYN EXXTENDED INFUSION + VANCOMYCIN ****************
+ 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 = "Sepsis Unknown Source Antibiotic" and (CallingField = "PRX_Checkbox1|12"
+ or ( CallingField = "PRX_Zosyn_Ext_Inf_Freq|1" and Zosyn_Vanco_Chk.Value = true)
+ or (CallingField = "PRX_Generic_CB|1" and Zosyn_Vanco_Chk.Value = true)
+ or (CallingField = "PRX_Generic_CB|2" and Zosyn_Vanco_Chk.Value = true)) ) then
+
+ fieldValue := Zosyn_Vanco_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ vanco_logic_run := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ // **** 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_Low.IsSelected := false;
+ Zosyn.IsSelected := false;
+
+ Vancomycin_Load.IsSelected := false;
+ Vancomycin.IsSelected := false;
+
+ Vancomycin_Trough.IsSelected := false;
+ Vancomycin_Nursing_Instr.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //********** CEFEPIME + VANCOMYCIN ************
+ if ( CallingField = "PRX_Checkbox1|15" ) then
+ fieldValue := Cefepime_Vanco_Chk.Value;
+
+ if ( fieldValue = true ) then
+ Cefepime.IsSelected := true;
+
+ vanco_logic_run := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Cefepime.IsSelected := false;
+
+ Vancomycin_Load.IsSelected := false;
+ Vancomycin.IsSelected := false;
+
+ Vancomycin_Trough.IsSelected := false;
+ Vancomycin_Nursing_Instr.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ if ( CallingField = "MultiOrderGrid|1" ) then
+
+ if ( Zosyn.IsSelected = true OR Zosyn_Low.IsSelected = true ) then
+ if ( Zosyn_Vanco_Chk.Value = false ) then
+ Zosyn_Vanco_Chk.Value := true;
+
+ vanco_logic_run := true;
+
+ rtnValue := call enable_chkbx_mlm with this_communication, this_form, client_info_obj, "PRX_Checkbox1|12", true, "";
+ endif;
+ elseif ( Zosyn.IsSelected = false AND Zosyn_Low.IsSelected = false ) then
+ Zosyn_Vanco_Chk.Value := false;
+
+ Vancomycin_Load.IsSelected := false;
+ Vancomycin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+
+ endif;
+ endif;
+
+ //Handle vancomycin ordering
+ if ( vanco_logic_run = true ) then
+
+ if ( OrderSetName = "Sepsis Unknown Source Antibiotic 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}}};
+
+ Zosyn_Vanco_Chk.Value := false;
+ Cefepime_Vanco_Chk.Value := false;
+
+ Zosyn_Low.IsSelected := false;
+ Zosyn.IsSelected := false;
+ Cefepime.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+
+ else
+ Vancomycin.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}}};
+
+ Zosyn_Vanco_Chk.Value := false;
+ Cefepime_Vanco_Chk.Value := false;
+
+ Zosyn_Low.IsSelected := false;
+ Zosyn.IsSelected := false;
+ Cefepime.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, 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";
+
+ Zosyn_Vanco_Chk.Value := false;
+ Cefepime_Vanco_Chk.Value := false;
+
+ Zosyn_Low.IsSelected := false;
+ Zosyn.IsSelected := false;
+ Cefepime.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, 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
+ Zosyn_Vanco_Chk.Value := false;
+ Cefepime_Vanco_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;
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SHOULDER_POST_OP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SHOULDER_POST_OP.mlm
new file mode 100644
index 0000000..b6cc440
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SHOULDER_POST_OP.mlm
@@ -0,0 +1,331 @@
+maintenance:
+
+ title: FORM_SET_SHOULDER_POST_OP;;
+ mlmname: FORM_SET_SHOULDER_POST_OP;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair Admissions;;
+ author: Juliet Law, Eclipsys Corp Ext 7461;;
+ specialist: Michele Carter-Payne, Eclipsys Corp Ext 7445;;
+ date: 2011-09-02;;
+ validation: testing;;
+
+library:
+ purpose: Used for Post Op Shoulder Order Set
+ ;;
+
+ explanation: Used for Post Op Shoulder Order Set
+
+Change history
+
+ 09.02.2011 JMLaw Created.
+ 09.07.2018 JMLaw CSR 37062: Logic added to support annual Order Set Revisions project. Concurrently implementing
+ anticoagulant check (previously documented in service ticket# 3260474)
+
+ ;;
+ keywords: Called MLMs, Shoulder, Post Op
+ ;;
+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*******************/
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ //Need to implicitly call the generic MLM ONLY for the Anticoagulant Grids
+ anticoagulant_conflict := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{SINGLE-QUOTE}}};
+
+ // Retrieve field list of Nursing Assessment Grid
+ NursingAssessments := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 12);
+ NursingAssessments_List := NursingAssessments.Value;
+
+ //Retrieve field list of Conditional Order Grid
+ ConditionalOrders := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 31);
+ ConditionalOrders_List := ConditionalOrders.Value;
+
+ // Retrieve field list of Bowel Regimen Order Grid
+ BowelOrders := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 7);
+ BowelOrders_List := BowelOrders.Value;
+
+ // Retrieve field list of Anti-Emetic Order Grid
+ AntiEmeticOrders := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 6);
+ AntiEmeticOrders_List := AntiEmeticOrders.Value;
+
+ //Retrieve field list of Moderate Pain Order Grid
+ ModPainOrders := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 5);
+ ModPainOrders_List := ModPainOrders.Value;
+
+ //Retrieve field list of Severe Pain Order Grid
+ SeverePainOrders := last of (field_list where field_list.DataItemname = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 4);
+ SeverePainOrders_List := SeverePainOrders.Value;
+
+ Lovenox_AntiCoag_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 9 );
+ Lovenox_AntiCoag_List := Lovenox_AntiCoag_Orders.Value;
+ Aspirin_AntiCoag_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 41 );
+ Aspirin_AntiCoag_List := Aspirin_AntiCoag_Orders.Value;
+
+
+
+ if (CallingField = "MultiOrderGrid|12") then
+ InstrFld := first of (NursingAssessments_List where NursingAssessments_List.Name = "Nurse Instruction:");
+
+ if (InstrFld.IsSelected = true) then
+ ConditionalOrders_List.IsSelected := (true,true);
+ else
+ ConditionalOrders_List.IsSelected := (false,false);
+ endif;
+ endif;
+
+ if (CallingField = "MultiOrderGrid|7") then
+ Found_MofM := first of (BowelOrders_List where BowelOrders_List.Name = "Magnesium Hydroxide Susp");
+ Found_Senna := first of (BowelOrders_List where BowelOrders_List.Name = "Senna Tab");
+
+ if (Found_MofM.IsSelected = true) then
+ Found_Senna.IsSelected := false;
+ Found_Senna.IsReadOnly := true;
+ elseif (Found_Senna.IsSelected = true) then
+ Found_MofM.IsSelected := false;
+ Found_MofM.IsReadOnly := true;
+ else
+ Found_Senna.IsSelected := false;
+ Found_MofM.IsSelected := false;
+ Found_Senna.IsReadOnly := false;
+ Found_MofM.IsReadOnly := false;
+ endif;
+
+ endif;
+
+ if (CallingField = "MultiOrderGrid|6") then
+
+ FirstThree := (AntiEmeticOrders_List.IsSelected[1],
+ AntiEmeticOrders_List.IsSelected[2],
+ AntiEmeticOrders_List.IsSelected[3]);
+
+ if true in Firstthree then
+ NewReadOnly := ();
+ NewSelected := ();
+ for k in (1 seqto (count AntiEmeticOrders_List.IsSelected)) do
+
+ if k <= 3 then
+ if AntiEmeticOrders_List.IsSelected[k] = true then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected,true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ endif;
+ elseif k = 4 then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected,AntiEmeticOrders_List.IsSelected[k];
+ elseif (k <= 8) then
+ NewReadOnly := NewReadOnly, true;
+ NewSelected:= NewSelected, AntiEmeticOrders_List.IsSelected[4];
+ else
+ NewReadOnly := NewReadOnly, AntiEmeticOrders_List.IsReadOnly[k];
+ NewSelected := NewSelected, AntiEmeticOrders_List.IsSelected[k];
+ endif;
+ enddo;
+ AntiEmeticOrders_List.IsReadOnly := NewReadOnly;
+ AntiEmeticOrders_List.IsSelected := NewSelected;
+
+ else
+ NewReadOnly := ();
+ DeselectAll := ();
+ for k in (1 seqto (count AntiEmeticOrders_List.IsSelected)) do
+ if k <= 3 then
+ NewReadOnly := NewReadOnly, false;
+ DeselectAll := DeselectAll ,false;
+ elseif k>8 then
+ NewReadOnly := NewReadOnly, AntiEmeticOrders_List.IsReadOnly[k];
+ DeselectAll := DeselectAll, AntiEmeticOrders_List.IsSelected[k];
+ else
+ NewReadOnly := NewReadOnly, true;
+ DeselectAll := DeselectAll, false;
+ endif;
+ enddo;
+ AntiEmeticOrders_List.IsReadOnly := NewReadOnly;
+ AntiEmeticOrders_List.IsSelected := DeselectAll;
+ endif;
+ endif;
+
+ if (CallingField = "MultiOrderGrid|5") then
+
+ LastThree := (ModPainOrders_List.IsSelected[2],
+ ModPainOrders_List.IsSelected[3],
+ ModPainOrders_List.IsSelected[4]);
+
+ if true IN LastThree then
+ NewReadOnly := ();
+ NewSelected := ();
+ for k in (1 seqto (count ModPainOrders_List.IsSelected)) do
+ if (k = 1) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, ModPainOrders_List.IsSelected[k];
+ elseif (k > 1) then
+ if (ModPainOrders_List.IsSelected[k] = true) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ endif;
+ else
+ NewReadOnly := NewReadOnly, ModPainOrders_List.IsReadOnly[k];
+ NewSelected := NewSelected, ModPainOrders_List.IsSelected[k];
+ endif;
+ enddo;
+ ModPainOrders_List.IsSelected := NewSelected;
+ ModPainOrders_List.IsReadOnly := NewReadOnly;
+ else
+ NewReadOnly := ();
+ DeSelectAll := ();
+ for k in (1 seqto (count ModPainOrders_List.IsSelected)) do
+ if (k=1) then
+ NewReadOnly := NewReadOnly, false;
+ DeSelectAll := DeSelectAll, ModPainOrders_List.IsSelected[k];
+ elseif (k > 1) then
+ NewReadOnly := NewReadOnly, false;
+ DeSelectAll := DeSelectAll, false;
+ else
+ NewReadOnly := NewReadOnly, ModPainOrders_List.IsReadOnly[k];
+ DeSelectAll := DeSelectAll, ModPainOrders_List.IsSelected[k];
+ endif;
+ enddo;
+ ModPainOrders_List.IsSelected := DeSelectAll;
+ ModPainOrders_List.IsReadOnly := NewReadOnly;
+
+ endif;
+
+ endif;
+
+ if (CallingField = "MultiOrderGrid|4") then
+
+ severe_pain_meds := ("Oxycodone 5mg Tab",
+ "Acetaminophen 500mg/Hydrocodon 7.5mg Tab",
+ "PCA - Hydromorphone Order Set",
+ "PCA - Morphine Order Set");
+
+ if (true IN SeverePainOrders_List.IsSelected) then
+ NewReadOnly := ();
+ NewSelected := ();
+ for k IN (1 seqto (count SeverePainOrders_List.IsSelected)) do
+ if (SeverePainOrders_List.Name[k] IN severe_pain_meds) then
+ if (SeverePainOrders_List.IsSelected[k] = true) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ endif;
+ else
+ NewReadOnly := NewReadOnly, SeverePainOrders_List.IsReadOnly[k];
+ NewSelected := NewSelected, SeverePainOrders_List.IsSelected[k];
+ endif;
+ enddo;
+ SeverePainOrders_List.IsSelected := NewSelected;
+ SeverePainOrders_List.IsReadOnly := NewReadOnly;
+ else
+ NewReadOnly := ();
+ DeSelectAll := ();
+ for k in (1 seqto (count SeverePainOrders_List.IsSelected)) do
+ if (SeverePainOrders_List.Name[k] IN severe_pain_meds) then
+ NewReadOnly := NewReadOnly, false;
+ DeSelectAll := DeSelectAll, false;
+ else
+ NewReadOnly := NewReadOnly, SeverePainOrders_List.IsReadOnly[k];
+ DeSelectAll := DeSelectAll, SeverePainOrders_List.IsSelected[k];
+ endif;
+ enddo;
+ SeverePainOrders_List.IsSelected := DeSelectAll;
+ SeverePainOrders_List.IsReadOnly := NewReadOnly;
+ endif;
+ endif;
+
+ //CSR 37062: Begin Change
+ if ( CallingField = "MultiOrderGrid|9" OR CallingField = "MultiOrderGrid|41" ) then
+
+ Enoxaparin_Select := first of ( Lovenox_AntiCoag_List WHERE Lovenox_AntiCoag_List.Name matches pattern "Enoxaparin%" );
+ Aspirin_Select := first of ( Aspirin_AntiCoag_List WHERE Aspirin_AntiCoag_List.Name matches pattern "Aspirin%" );
+
+ if ( Enoxaparin_Select.IsSelected = true )then
+
+ Aspirin_Select.IsSelected := false;
+ Aspirin_Select.IsReadonly := true;
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Enoxaparin_Select.Name);
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Enoxaparin_Select.IsSelected := false;
+ Aspirin_Select.IsReadonly := false;
+
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+ Enoxaparin_Select.IsSelected := false;
+ Aspirin_Select.IsReadonly := false;
+ endif;
+ endif;
+ endif;
+
+ elseif ( Aspirin_Select.IsSelected = true ) then
+ Enoxaparin_Select.IsSelected := false;
+ Enoxaparin_Select.IsReadonly := true;
+
+ else
+ Enoxaparin_Select.IsSelected := false;
+ Enoxaparin_Select.IsReadonly := false;
+ Aspirin_Select.IsSelected := false;
+ Aspirin_Select.IsReadonly := false;
+ endif;
+
+
+ endif;
+ //CSR 37062: End Change
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SKIN_ANTIBIOTICS_INPATIENT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SKIN_ANTIBIOTICS_INPATIENT.mlm
new file mode 100644
index 0000000..073e9bb
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SKIN_ANTIBIOTICS_INPATIENT.mlm
@@ -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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SKIN_ANTIBIOTICS_OUTPATIENT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SKIN_ANTIBIOTICS_OUTPATIENT.mlm
new file mode 100644
index 0000000..7cb507a
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SKIN_ANTIBIOTICS_OUTPATIENT.mlm
@@ -0,0 +1,300 @@
+maintenance:
+
+ title: FORM_SET_SKIN_ANTIBIOTICS_OUTPATIENT;;
+ mlmname: FORM_SET_SKIN_ANTIBIOTICS_OUTPATIENT;;
+ 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 Skin Antibiotics Outpatient order set
+ ;;
+
+ explanation: This MLM is called from Skin Antibiotics Outpatient Order Set
+
+ Change history
+ 05.09.2016 JML CSR 34091: Created for Skin Antibiotic Outpatient Order Set
+
+ ;;
+ keywords: Called MLMs, Antibiotic Skin, Outpatient, 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";
+
+ // 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}}};
+ antibiotic_guideline_mlm := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_DISPLAY_ANTIBIOTIC_GUIDELINES{{{SINGLE-QUOTE}}};
+
+ exceptFld := ();
+ cephalexin_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
+ Cephalexin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Clindamycin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ Amoxicillin_Levaquin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ AND field_list.Control_MultiFieldOccNum = 9 );
+ Keflex_Levaquin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ AND field_list.Control_MultiFieldOccNum = 11 );
+ Clindamycin_Levaquin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ AND field_list.Control_MultiFieldOccNum = 12 );
+ Cephalexin2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ AND field_list.Control_MultiFieldOccNum = 13 );
+ Clindamycin2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ AND field_list.Control_MultiFieldOccNum = 14 );
+ Doxycycline_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ AND field_list.Control_MultiFieldOccNum = 10 );
+ Bactrim_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ AND field_list.Control_MultiFieldOccNum = 20 );
+
+ Antibiotics_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Antibiotics_Grid_Value := Antibiotics_Grid.Value;
+
+ Cephalexin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Cephalexin 500mg Cap" );
+ Clindamycin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Clindamycin 150mg Cap" );
+ Amoxicillin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Amoxicillin/Clavulanic Acid 875mg Tab" );
+ Doxycycline := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Doxycycline 100mg Cap" );
+ Bactrim := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Sulfamethox 800mg/Trimeth 160mg DS Tab" );
+ Levaquin := first of ( Antibiotics_Grid_Value WHERE Antibiotics_Grid_Value.Name = "Levofloxacin 500mg Tab" );
+
+ Cephalexin_Dose := first of ( field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ // 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
+ ( this_communication, this_form ) := call antibiotic_guideline_mlm WITH this_communication, this_form, client_info_obj;
+
+ for item IN Antibiotics_Grid_Value do
+ item.IsReadonly := true;
+ enddo;
+ endif;
+
+ if ( CallingEvent = "FieldChange" ) then
+
+ //********* Height / Weight Measurements *******
+ if ( CallingField = "CombinedMeasurements|1" ) then
+ if ( Cephalexin_Chk.Value = true OR Keflex_Levaquin_Chk.Value = true OR Cephalexin2_Chk.Value ) then
+ cephalexin_logic_run := true;
+ endif;
+ endif;
+
+ //********************* CEPHALEXIN (KEFLEX) *************************
+ if ( CallingField = "PRX_Checkbox1|1" OR CallingField = "PRX_Checkbox1|13" ) then
+
+ if ( CallingField = "PRX_Checkbox1|1" ) then
+ fieldValue := Cephalexin_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|13" ) then
+ fieldValue := Cephalexin2_Chk.Value;
+ endif;
+
+ if ( fieldValue = true ) then
+
+ Cephalexin.IsSelected := true;
+
+ cephalexin_logic_run := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ cephalexin_logic_run := false;
+ Cephalexin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************* CLINDAMYCIN ***********************
+ if (CallingField = "PRX_Checkbox1|2" OR CallingField = "PRX_Checkbox1|14" ) then
+
+ if ( CallingField = "PRX_Checkbox1|2" ) then
+ fieldValue := Clindamycin_Chk.Value;
+ elseif ( CallingField = "PRX_Checkbox1|14" ) then
+ fieldValue := Clindamycin2_Chk.Value;
+ endif;
+
+ if ( fieldValue = true ) then
+
+ Clindamycin.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Clindamycin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************** AMOXICILLIN + LEVAQUIN ********************
+ if ( CallingField = "PRX_Checkbox1|9" ) then
+
+ fieldValue := Amoxicillin_Levaquin_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ Amoxicillin.IsSelected := true;
+ Levaquin.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Amoxicillin.IsSelected := false;
+ Levaquin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //******** CEPHALEXIN (KEFLEX) + LEVAQUIN *****************
+ if ( CallingField = "PRX_Checkbox1|11" ) then
+ fieldValue := Keflex_Levaquin_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ Cephalexin.IsSelected := true;
+ Levaquin.IsSelected := true;
+
+ cephalexin_logic_run := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ cephalexin_logic_run := false;
+ Cephalexin.IsSelected := false;
+ Levaquin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //******** CLINDAMYCIN + LEVAQUIN *******************
+ if ( CallingField = "PRX_Checkbox1|12" ) then
+ fieldValue := Clindamycin_Levaquin_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ Clindamycin.IsSelected := true;
+ Levaquin.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Clindamycin.IsSelected := false;
+ Levaquin.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************ DOXYCYCLINE ******************
+ if ( CallingField = "PRX_Checkbox1|10" ) then
+ fieldValue := Doxycycline_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ Doxycycline.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Doxycycline.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ //************ BACTRIM ************************
+ if ( CallingField = "PRX_Checkbox1|20" ) then
+ fieldValue := Bactrim_Chk.Value;
+
+ if ( fieldValue = true ) then
+
+ Bactrim.IsSelected := true;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
+ elseif ( fieldValue = false ) then
+ Bactrim.IsSelected := false;
+
+ rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
+ endif;
+ endif;
+
+ endif; //End FieldChange
+
+ if ( cephalexin_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 <= 110 ) then
+ Cephalexin_Dose.Value := 500;
+ elseif ( weightvalue > 110 ) then
+ Cephalexin_Dose.Value := 1000;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SKIN_PRESSURE_ULCER_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SKIN_PRESSURE_ULCER_ORDERS.mlm
new file mode 100644
index 0000000..abe9b2d
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SKIN_PRESSURE_ULCER_ORDERS.mlm
@@ -0,0 +1,123 @@
+maintenance:
+
+ title: FORM_SET_SKIN_PRESSURE_ULCER_ORDERS;;
+ mlmname: FORM_SET_SKIN_PRESSURE_ULCER_ORDERS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Janardhan Chavan;;
+ specialist: Don Warnick;;
+ date: 2016-08-16;;
+ validation: testing;;
+
+library:
+ purpose: Select the appropriate pressure ulcer care the selected presure ulcer type checkbox.
+ ;;
+
+ explanation: This MLM is called from the Pressure Ulcer Orders Order Set
+
+
+ Change history
+
+ 08.16.2016 - DJW CSR# 34945 - Created
+#1 12.20.2017 - AMistry CSR# 35303 - Resolved Issue
+ 05.21.2018 - DJW CSR# 36674 - Order set review changes
+
+ ;;
+ keywords: Called MLMs,
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ // Define the checkbox that was selected
+
+ checkboxnumber:= substring 2 characters starting at 14 from this_communication.CallingFieldName;
+ selectedcheckbox := first of (field_list where field_list.DataItemName = "NUR_Checkbox" and field_List.Control_MultiFieldOccNum = (checkboxnumber as number));
+
+ // Define the grid
+
+ PressureUlcerTreatmentOrderGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 38);
+ MedOrderGrid := first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 49);
+
+ // Map the row number in the grid related to each of the checkboxes
+
+ put_griditem:= 999;
+ rx_griditem := "no";
+
+
+ if checkboxnumber = "8" then put_griditem := 1; // stage 0
+ elseif checkboxnumber = "12" then put_griditem := 2; // stage 1
+ elseif checkboxnumber = "7" then put_griditem := 3; // stage 1 hip or renal
+ elseif checkboxnumber = "9" then put_griditem := 4; // stage 2 no drainage
+ elseif checkboxnumber = "23" then put_griditem := 5; // stage 2 light drainage
+ elseif checkboxnumber = "15" then put_griditem := 7; // stage 3 eschar
+ elseif checkboxnumber = "16" then put_griditem := 8; // stage 4 eschar slough
+ elseif checkboxnumber = "17" then put_griditem := 9; // unstagable full thickness
+ elseif checkboxnumber = "24" then put_griditem := 10; // unstagable dry
+ elseif checkboxnumber = "19" then put_griditem := 11; // yeast like rash
+ elseif checkboxnumber = "20" then put_griditem := 12; // intertigo
+ elseif checkboxnumber = "21" then put_griditem := 13; // incontenance
+ elseif checkboxnumber = "22" then put_griditem := 14; rx_grid := "yes"; // moisture
+ endif;
+
+
+ // Set the trufalse value to determine if the grid item is to be checked or unchecked
+
+ if selectedcheckbox.Value = true
+ then truefalse := true;
+ else truefalse := false;
+ endif;
+
+
+ // Update the Pressure Ulcer Treatment Grid
+
+ index_list := 1 seqto (count PressureUlcerTreatmentOrderGrid.Value);
+ for I in index_list do
+ if put_griditem = I
+ then PressureUlcerTreatmentOrderGrid.Value[put_griditem].IsSelected := truefalse;
+ endif;
+ enddo;
+
+ // Update the Medications Grid
+
+ If rx_grid = "yes"
+ then
+ index_list := 1 seqto (count MedOrderGrid.Value);
+ for I in index_list do
+ MedOrderGrid.Value[I].IsSelected := truefalse;
+ enddo;
+ endif;
+
+
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SPECIAL_CARE_NURSERY_ADMISSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SPECIAL_CARE_NURSERY_ADMISSION.mlm
new file mode 100644
index 0000000..26d9b24
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SPECIAL_CARE_NURSERY_ADMISSION.mlm
@@ -0,0 +1,151 @@
+maintenance:
+
+ title: FORM_SET_Special_Care_Nursery_Admission;;
+ mlmname: FORM_SET_Special_Care_Nursery_Admission;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Shivprasad Jadhav;;
+ specialist: ;;
+ date: 2014-10-09;;
+ validation: testing;;
+
+library:
+ purpose: Automatically select and disable medication orders based on prescence of lab result on mother.
+
+ ;;
+
+ explanation: This MLM is called from the Special Care Nursery Admission Order Set. On Form open, based on the existence and result of
+ the Hepatitis B Surface Antigen lab on the mother, the appropriate medications will be selected and all others disabled.
+
+ Change History
+ -----------------
+ 10.09.2014 JML CSR# 33072: Created
+
+ ;;
+ keywords: Called MLMs, Newborn, Admission, Hepatitis B
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+
+ pObj := this_communication.PrimaryObj;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Retrieve relevant form fields
+ Hep_Meds := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 70 );
+ Hep_Meds_Val := Hep_Meds.Value;
+
+ NEG_Hep_Inj := Hep_Meds_Val[3];
+
+ UNK_Hep_Inj := Hep_Meds_Val[4];
+ UNK_Hep_Imm_Glob_Inj := Hep_Meds_Val[5];
+
+ POS_Hep_Inj := Hep_Meds_Val[6];
+ POS_Hep_Imm_Glob_Inj := Hep_Meds_Val[7];
+
+ //Locate MOM
+ //Retrieve MOM{{{SINGLE-QUOTE}}}s visit guid from cross reference table
+ momVisitGUID := read last {"SELECT mcv.MotherDeliveryVisitGUID "
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN SXAAMMotherChildVisitXRef mcv WITH (NOLOCK)"
+ || " ON cv.GUID = mcv.ClientVisitGUID"
+ || " WHERE cv.ClientGUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)
+ || " AND cv.ChartGUID = " || Sql(chart_guid)};
+
+ (momClientGUID,
+ momChartGUID) := read last {"SELECT cv.ClientGUID, cv.ChartGUID"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK)"
+ || " WHERE cv.GUID = " || Sql(momVisitGUID)};
+
+ //Retrieve MOM{{{SINGLE-QUOTE}}}s Hepatitis B Surface Antigen result from OB Patient Profile
+ hepB_SAG_result := read last {"SELECT fsl.value"
+ || " FROM CV3CLIENT c WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
+ || " ON c.GUID = cv.ClientGUID"
+ || " JOIN CV3ClientDocumentCUR cd WITH (NOLOCK) ON cv.GUID = cd.ClientVisitGUID"
+ || " AND cv.ClientGUID = cd.ClientGUID"
+ || " AND cv.ChartGUID = cd.ChartGUID"
+ || " JOIN CV3ClientDocDetailCUR cdd WITH (NOLOCK) ON cd.GUID = cdd.ClientDocumentGUID"
+ || " AND cd.ClientGUID = cdd.ClientGUID"
+ || " JOIN CV3ObservationDocumentCUR od WITH (NOLOCK) ON cdd.ClientDocumentGUID = od.OwnerGUID"
+ || " LEFT JOIN SCMObsFsListValues fsl WITH (NOLOCK) ON od.ObservationDocumentGUID = fsl.ParentGUID"
+ || " AND cdd.ClientGUID = fsl.ClientGUID"
+ || " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK) ON od.ObsMasterItemGUID = ocmi.GUID"
+ || " JOIN CV3ObservationCUR o WITH (NOLOCK) ON od.ObservationGUID = o.GUID"
+ || " JOIN CV3ObsCatalogItem oci WITH (NOLOCK) ON o.ObsItemGUID = oci.GUID"
+ || " WHERE c.GUID = " || Sql(momClientGUID)
+ || " AND cv.GUID = " || Sql(momVisitGUID)
+ || " AND cv.ChartGUID = " || Sql(momChartGUID)
+ || " AND cd.DocumentName = {{{SINGLE-QUOTE}}}OB Patient Profile{{{SINGLE-QUOTE}}}"
+ || " AND cdd.Active = 1"
+ || " AND od.Active = 1"
+ || " AND oci.Name like {{{SINGLE-QUOTE}}}PRO hbsag%{{{SINGLE-QUOTE}}}" };
+
+ //Fire on Form Open event
+ if ( CallingEvent = "FormOpen" ) then
+
+ //If Mom{{{SINGLE-QUOTE}}}s Hepatitis B Surface Antigen result is negative, preselect Inj order under NEGA header
+ if ( hepB_SAG_result = "negative" ) then
+
+ NEG_Hep_Inj.IsSelected := true;
+
+ Hep_Meds_Val.IsReadonly := (false, false, false, true, true, true, true);
+
+ elseif ( hepB_SAG_result = "positive" ) then
+
+ POS_Hep_Inj.IsSelected := true;
+ POS_Hep_Imm_Glob_Inj.IsSelected := true;
+
+ Hep_Meds_Val.IsReadOnly := (false, false, true, true, true, false, false);
+
+ //elseif ( ( NOT (exists hepB_SAG_result ) ) OR ( hepB_SAG_result = "n/a" ) ) then
+
+ //UNK_Hep_Inj.IsSelected := true;
+ //UNK_Hep_Imm_Glob_Inj.IsSelected := true;
+
+ //Hep_Meds_Val.IsReadOnly := (false, false, true, false, false, true, true);
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SPINALTAP_LABS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SPINALTAP_LABS.mlm
new file mode 100644
index 0000000..ff1e652
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SPINALTAP_LABS.mlm
@@ -0,0 +1,157 @@
+maintenance:
+
+ title: FORM_SET_SPINALTAP_LABS;;
+ mlmname: FORM_SET_SPINALTAP_LABS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Shawn Head x7468, Allscripts ;;
+ specialist: Maria Pest, Allscripts;;
+ date: 2018-04-05;;
+ validation: testing;;
+
+library:
+ purpose: coppied from FORM_SET_THORACENTESIS MLM ;;
+
+ explanation: This MLM is called from ...
+
+ Change history
+ 2018.04.05 STH CSR 36361: Created {GO LIVE 4/17/2018}
+
+ ;;
+ keywords: Called MLMs, Thoracentesis, Paracentesis
+ ;;
+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";
+
+ generic_mlm := mlm {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}};
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{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;
+
+
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ FormName := this_form.Name;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+
+ //This field was already available from the Centesis order set. Might want to create a new field?
+ Labs_List_fld := last of (field_list WHERE field_list.DataItemName = "Labs on Centesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ //This field was already available from the Centesis order set. Might want to create a new field?
+ Cytology_List_fld := last of (field_list WHERE field_list.DataItemName = "Cytology on Centesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+
+ LabSerumRequired_fld := last of (field_list WHERE field_list.DataItemName = "LAB_SpecType_Protected"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+
+ LabSerumItems_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 3);
+
+ if(true in LabSerumItems_fld.Value.IsSelected) then
+ LabSerumRequired_fld.Value := "Serum Specimen (Red Top) MUST accompany Spinal Fluid for Orders entered";
+ else
+ LabSerumRequired_fld.Value := "";
+ endif;
+
+ if (CallingEvent = "FieldChange") then
+ listings := call str_parse with CAllingField,"|";
+ CF_DataItemName := listings[1];
+ CF_MF_OccNum := listings[2];
+
+ SelectedItems_Fld := last of (field_list where field_list.DataItemName = CF_DataItemName
+ and field_list.Control_MultiFieldOccNum = (CF_MF_OccNum as number));
+
+ SelectedItems_list := (SelectedItems_Fld.Value.Name where SelectedItems_Fld.Value.IsSelected = true);
+ DeSelectedItems_list := (SelectedItems_Fld.Value.Name where SelectedItems_Fld.Value.IsSelected = false);
+ if(DeSelectedItems_list[1] matches pattern "%cytology%") then
+ Cytology_List_fld.Value := "";
+ endif;
+ for i in 1 seqto (count SelectedItems_list) do
+ if((SelectedItems_list[i] matches pattern "%cytology%"))then
+ Cytology_List_fld.Value := SelectedItems_list[i];
+ else
+ findselected := find SelectedItems_list[i] in string Labs_List_fld.Value;
+ if((findselected = 0) OR (findselected is null)) then
+ if (not (SelectedItems_list[i] matches pattern "%Cytology%")) then
+ if ((Labs_List_fld.Value is null) or (Labs_List_fld.Value = "")) then
+ Labs_List_fld.Value := SelectedItems_list[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || SelectedItems_list[i];
+ endif;
+ endif;
+ endif;
+ endif;
+ enddo;
+
+ AllLabs := Labs_List_fld.Value;
+ for i in 1 seqto (count deSelectedItems_list) do
+ findlabs := find deSelectedItems_list[i] in string Labs_List_fld.Value;
+ if(findlabs > 0) then
+ replaceitem := deSelectedItems_list[i];
+ if(findlabs > 0 or findcyto > 0) then
+ UpdatedSelectedItems := read last {"select replace(replace(" || sql(AllLabs)
+ || ",{{{SINGLE-QUOTE}}}, " || replaceitem
+ || "{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})," || sql(replaceitem)
+ || ",{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})"};
+ AllLabs := UpdatedSelectedItems;
+ endif;
+ endif;
+ enddo;
+ findcomma := find ", " in string AllLabs;
+
+ if(findcomma = 1) then
+ AllLabs := substring ((length of AllLabs) -2) characters STARTING AT 3 from AllLabs;
+ endif;
+
+ Labs_List_fld.Value := AllLabs;
+
+ endif;
+ //Execute the generic MLM on form open
+ execute_generic_mlm := call generic_mlm with this_communication, this_form, client_info_obj;
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_STOOL_SHIGA_TOXIN.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_STOOL_SHIGA_TOXIN.mlm
new file mode 100644
index 0000000..69cc6c1
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_STOOL_SHIGA_TOXIN.mlm
@@ -0,0 +1,132 @@
+maintenance:
+
+ title: Lab Stool Culture on Order Set Must Order Shiga Toxin 1 and 2;;
+ mlmname: FORM_Set_Stool_Shiga_Toxin;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Isolation Set MLM;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Bryan Berkeybile, Eclipsys Corp ext 7469;;
+ date: 2007-11-21;;
+ validation: testing;;
+
+library:
+ purpose: When selecting Stool Culture on the Order Set, Make Shiga Toxin Mandatory (check it for the user)
+ Deselecting Stool Culture will deselect Shiga Toxin
+ Selecting Shiga Toxin when Stool Culture is not selected, pop up message and select Stool Culture
+ Note: Stool Culture cannot be false at this time
+ Deselecting Shiga Toxin when Stool Culture is true will pop up message and deselect Stool
+ Note: Stool Culture cannot be true at this time
+
+ ;;
+
+ explanation: This MLM is called from the Stool Order set (Lab Stool Order Set)
+
+
+ Change history
+
+ 11.21.2007 RS Created
+ 08.23.2016 DW CSR# 34947 - GI Pathogen changes
+
+ ;;
+ keywords: Called MLMs, Stool order set, Lab
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ (this_communication, this_form, client_info_obj) := argument;
+
+ log_execution_info := FALSE;
+
+ error_message:="";
+
+
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid:=this_communication.ClientGUID;
+ ClientChartGUID:=this_communication.ChartGUID;
+
+
+ StoolCB:= last of (field_list where field_list.DataItemName = "Lab_CB_Stool" );
+ ClonicCB:= last of (field_list where field_list.DataItemName = "Lab_CB_Clonic_Fluid" );
+
+ Multi_fld3 := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 3 );
+ Multi_list3 :=Multi_fld3.Value;
+
+ Multi_fld4 := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 4 );
+ Multi_list4 :=Multi_fld4.Value;
+
+ Rotavirus_Order:= first of (Multi_list3 where Multi_list3.Name = "Rotavirus Antigen, Stool (Mayo)");
+ Fecal_Order := first of (Multi_list4 where Multi_list4.Name = "Fecal Fat Quantitative (Mayo)");
+ Reducing_Order := first of (Multi_list4 where Multi_list4.Name = "Reducing Substance Stool (Mayo)");
+
+ Type1Fld := last of (field_list where field_list.DataItemName = "Lab_M_VO_OBR15_SpecT_StolColFl" );
+ Type2Fld := last of (field_list where field_list.DataItemName = "LAB_RC_SDES_MicroSource_Stool" );
+
+
+
+ If CallingField = "Lab_CB_Stool|1"
+
+ then
+
+ If StoolCB.Value = True
+
+ then
+ ClonicCB.Value := False;
+ ClonicCB.control_read_only := True;
+ Type1Fld.Value := "Stool (STOL)";
+ Type2Fld.Value := "Stool (STOL)";
+ else
+ ClonicCB.control_read_only :=False;
+ Type1Fld.Value := "";
+ Type2Fld.Value := "";
+ endif;
+
+ elseif CallingField = "Lab_CB_Clonic_Fluid|1"
+
+ then
+
+ If ClonicCB.Value = True
+ then
+ StoolCB.Value := False;
+ StoolCB.control_read_only := True;
+ Type1Fld.Value := "Colonic Fluid (COLFLD)";
+ Type2Fld.Value := "Colonic Fluid (COLFLD)";
+
+ Rotavirus_Order.IsReadonly:=True;
+ Reducing_Order.IsReadonly:=True;
+ Fecal_Order.IsReadonly:=True;
+
+ else
+ StoolCB.control_read_only := False;
+ Type1Fld.Value := "";
+ Type2Fld.Value := "";
+
+ Rotavirus_Order.IsReadonly:=False;
+ Reducing_Order.IsReadonly:=False;
+ Fecal_Order.IsReadonly:=False;
+ endif;
+
+
+ endif; // Calling Field
+
+
+ ;;
+
+ evoke:
+ ;;
+
+ logic:
+
+ conclude true;
+ ;;
+
+ action:
+
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_STROKE_ADDENDUM.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_STROKE_ADDENDUM.mlm
new file mode 100644
index 0000000..2db6b54
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_STROKE_ADDENDUM.mlm
@@ -0,0 +1,101 @@
+maintenance:
+
+ title: Generic Form Control for Order Sets;;
+ mlmname: FORM_Set_Stroke_Addendum;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair;;
+ author: Shawn Head, Eclipsys Corp ext 7468;;
+ specialist: Maria Pest, Eclipsys Corp ext 7443;;
+ date: 2012-08-01;;
+ validation: testing;;
+
+library:
+ purpose: Used to select grid items on order set forms.
+ ;;
+
+ explanation: Following this strategy to improve CPOE turnaround
+
+Change history
+
+ 08-06-2012 STH CSR #: 30685 - Created to handle selecting all items in grid(s) based on "OS_Checkbox 1" observation being selected/de-selected
+
+ ;;
+ keywords: Generic, FormOpen, Item select, update items, CPOE, CPOE updates, CPOE items
+ ;;
+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;
+
+ field_list:= this_form.fields;
+ formitemtype := ();
+ formitemnumber := ();
+
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := FALSE;
+
+ callinggdataitemname := "OS_Checkbox 1";
+
+ formitemtype := ("MultiOrderCheckBox","MultiOrderInLine");
+
+ formitemnumber := (1,1);
+
+
+ /***************************************************************************************/
+
+ list_false_true := mlm {{{SINGLE-QUOTE}}}UTIL_LIST_FALSE_TRUE{{{SINGLE-QUOTE}}}; //used to disable/enable the update grid item(s) to the value passed in
+ //to the MLM. If yous end true all items are disabled if you send false all items
+ //are enabled. Originally developed by robert spence
+
+
+
+ // Initialize error message
+ error_message:="";
+
+ // get the list of configured items to be updates based on the form item MLMGenericItemControl
+
+ itemlist := ();
+ itemstf := ();
+
+ itemselected := ();
+ itemname := ();
+
+ itemselected := last of (field_list.Value where field_list.DataItemName = callinggdataitemname);
+ itemname := (field_list.Label where field_list.DataItemName = callinggdataitemname);
+
+ //cycle through all items added to the grid(s) and update based on the observation item "OS_Checkbox 1" being selected/de-selected
+ for x in (1 seqto count formitemtype) do
+
+ itemlist := last of (field_list.Value where field_list.DataItemName = formitemtype[x]
+ and field_List.Control_MultiFieldOccNum = formitemnumber[x]);
+
+ itemstf := call list_false_true with itemlist.IsSelected, itemselected;
+
+ itemlist.IsSelected := itemstf;
+
+ enddo;
+
+
+;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SUBCUTANEOUS_INSULIN.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SUBCUTANEOUS_INSULIN.mlm
new file mode 100644
index 0000000..07fd4a2
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SUBCUTANEOUS_INSULIN.mlm
@@ -0,0 +1,229 @@
+maintenance:
+
+ title: Subcutaneous Insulin;;
+ mlmname: FORM_Set_Subcutaneous_Insulin;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clairs;;
+ author: Juliet M. Law, Allscripts Corp ext 7461;;
+ specialist: Shawn Head, Allscripts Corp Ext 7468;;
+ date: 2011-07-25;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids to disable dosing instruction checkbox in Subcutaneous Insulin order set
+ ;;
+
+ explanation: This MLM is called from the Subcutaneous Insulin order set
+
+
+Change history
+
+ 07.25.2011 JML Copied from FORM_Set_VTE_Prophylaxis
+ 07.01-2013 STH Updated to handle the Diabetes and Nutritional Education orders only allowing it to be order if
+ there is not already an active order on the patients chart.
+ 11.18.2013 JML CSR 31945: If patient does not a recent NPO or Carb-Controlled Diet order, automatically
+ select the diet order on Form Close.
+ 03.22.2014 STH CSR 32245: Update outpatient diabetes education order names to be unique for Diabetes and Nutritional education required.
+ 05.13.2014 JML WO# 164724: Remove Subcutaneous Insulin automatic checking of Carb Controlled Diet order.
+ ;;
+ keywords: Called MLMs, Subcutaneous Insulin
+ ;;
+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;
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ //local_session := cds_session.local;
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+
+ Dosing_Guidelines := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 5);
+ Dosing_Guidelines_List := Dosing_Guidelines.Value;
+
+ //CSR 31945: JML Change
+ Diet_Order := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 6);
+ Diet_Order_List := Diet_Order.Value;
+
+/*
+ Nutritional_Text := last of ( field_list WHERE field_list.DataItemName = "OS_ Free Text IF order"
+ and field_list.Control_MultiFieldOccNum = 1);
+*/
+ //--------BEGIN DIABETES AND NUTRITIONAL SERVICE EDUCATION SECTION ADDED 7-1-2013 STH
+ diabetes_education := null;
+ nutritional_education := null;
+ clientGuid := this_communication.ClientGUID;
+ clientvisitGuid := this_communication.ClientVisitGUID;
+
+ check_for_diabetes_order := read last {"select top 1 {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} as {{{SINGLE-QUOTE}}}diabetes_order{{{SINGLE-QUOTE}}} "
+ || " from CV3Order o with (Nolock) "
+ || " where o.ClientGUID = " || SQL(clientGuid) //{{{SINGLE-QUOTE}}}9000063678500200{{{SINGLE-QUOTE}}}
+ || " and o.ClientVisitGUID = " || SQL(clientvisitGuid) //{{{SINGLE-QUOTE}}}9000368574700270{{{SINGLE-QUOTE}}}
+ || " and o.name = {{{SINGLE-QUOTE}}}Diabetes Education, Outpatient{{{SINGLE-QUOTE}}} "
+ || " and (o.OrderStatusCode like {{{SINGLE-QUOTE}}}au%{{{SINGLE-QUOTE}}} or o.OrderStatusCode = {{{SINGLE-QUOTE}}}discd{{{SINGLE-QUOTE}}}) "};
+
+ check_for_nutritional_order := read last {"select top 1 {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} as {{{SINGLE-QUOTE}}}diabetes_order{{{SINGLE-QUOTE}}} "
+ || " from CV3Order o with (Nolock) "
+ || " where o.ClientGUID = " || SQL(clientGuid) //{{{SINGLE-QUOTE}}}9000063678500200{{{SINGLE-QUOTE}}}
+ || " and o.ClientVisitGUID = " || SQL(clientvisitGuid) //{{{SINGLE-QUOTE}}}9000368574700270{{{SINGLE-QUOTE}}}
+ || " and o.name = {{{SINGLE-QUOTE}}}Diabetes Nutritional Counseling, Outpatient{{{SINGLE-QUOTE}}} "
+ || " and (o.OrderStatusCode like {{{SINGLE-QUOTE}}}au%{{{SINGLE-QUOTE}}} or o.OrderStatusCode = {{{SINGLE-QUOTE}}}discd{{{SINGLE-QUOTE}}}) "};
+
+ update_itemlist := ();
+ update_itemcheck := ();
+ update_itemname := ();
+ update_itemRO := ();
+
+ update_itemflds := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ update_itemlist := update_itemflds.Value;
+ update_itemcheck := update_itemlist.IsSelected;
+ update_itemname := update_itemlist.name;
+ update_itemRO := update_itemlist.IsReadOnly;
+ //--------END DIABETES AND NUTRITIONAL SERVICE EDUCATION SECTION ADDED 7-1-2013 STH
+
+ if CallingEvent = "FormOpen" then
+ Dosing_Guidelines_List.IsReadOnly := (True);
+
+ //BEGIN DIABETES AND NUTRIONAL SERVICE EDUCATION UPDATE SECTION ADDED 7-1-2013 STH
+ if check_for_nutritional_order = "YES" then
+ update_itemcheck[3] := false;
+ update_itemRO[3] := true;
+ else
+ update_itemcheck[3] := true;
+ update_itemRO[3] := false;
+ endif;
+
+ if check_for_diabetes_order = "YES" then
+ update_itemcheck[2] := false;
+ update_itemRO[2] := true;
+ else
+ update_itemcheck[2] := true;
+ update_itemRO[2] := false;
+ endif;
+
+ update_itemlist.IsSelected := update_itemcheck;
+ update_itemlist.IsReadOnly := update_itemRO;
+
+ //END DIABETES AND NUTRIONAL SERVICE EDUCATION UPDATE SECTION ADDED 7-1-2013 STH
+
+ //BEGIN WO# 164724 Changes JML
+/*
+ elseif (CallingEvent = "FormClose") then
+ //********** Begin CSR 31945: JML Changes *************************
+
+
+ if ( NOT ( Nutritional_Text.Value IS NULL ) ) then
+ oName := Nutritional_Text.Value;
+ elseif ( NOT ( local_session.SessionUnsubmittedOrdersSubcutInsulinDiets = "" ) ) then
+ oName := local_session.SessionUnsubmittedOrdersSubcutInsulinDiets;
+ else
+
+ //Retrieve most recent active diet order for patient
+ (oGuid, oName) := read last {"SELECT o.GUID, o.Name"
+ || " FROM CV3Order o"
+ || " WHERE o.ClientGUID = " || Sql(ClientGuid)
+ || " AND o.ClientVisitGUID = " || Sql(ClientVisitGuid)
+ || " AND (o.Name = {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}}"
+ || " OR o.Name = {{{SINGLE-QUOTE}}}NPO{{{SINGLE-QUOTE}}}"
+ || " OR o.Name = {{{SINGLE-QUOTE}}}Tube Feeding{{{SINGLE-QUOTE}}}"
+ || " OR o.Name = {{{SINGLE-QUOTE}}}NPO for Testing/Procedure{{{SINGLE-QUOTE}}})"
+ || " AND ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
+ || " ORDER BY o.CreatedWhen ASC"};
+ endif;
+
+ if ( not ( exists oName ) ) then
+ //Autocheck diet order
+ autoCheckDiet := true;
+
+ elseif ( ( oName = "NPO" ) OR ( oName = "Tube Feeding" ) OR ( oName = "NPO for Testing/Procedure" ) ) then
+ //if NPO order, don{{{SINGLE-QUOTE}}}t autcheck diet order
+ autoCheckDiet := false;
+ else
+
+ if ( oName = "Diet" ) then
+
+ //Check if diet is for carb controlled
+ (oCarbCode, oCarbValue) := read {"SELECT oud.UserDataCode, oud.Value"
+ || " FROM CV3OrderUserData oud"
+ || " WHERE oud.OrderGUID = " || Sql(oGuid)
+ || " AND (oud.UserDataCode = {{{SINGLE-QUOTE}}}DIET_DSD_Liquid{{{SINGLE-QUOTE}}}"
+ || " OR oud.UserDataCode = {{{SINGLE-QUOTE}}}DIET_DSD_ADA or Calorie{{{SINGLE-QUOTE}}})"};
+
+ if ( not ( exists oCarbCode ) ) then
+ autoCheckDiet := true;
+ else
+ stopCheck := false;
+ for i IN 1 seqto ( count oCarbValue ) do
+ if ( oCarbValue[i] matches pattern "%Controlled Carbohydrate%" ) then
+ autoCheckDiet := false;
+ stopCheck := true;
+ elseif ( oCarbValue[i] matches pattern "%Consistent Carbohydrate%" ) then
+ autoCheckDiet := false;
+ stopCheck := true;
+ else
+ if (not stopCheck) then
+ autoCheckDiet := true;
+ else
+ autoCheckDiet := false;
+ endif;
+ endif;
+ enddo;
+ endif;
+ elseif ( oName matches pattern "Diet%Carb%" ) then
+ autoCheckDiet := false;
+ endif;
+ endif;
+
+ if (autoCheckDiet) then
+ Diet_Order_List.IsSelected := true;
+ endif;
+
+ //***************** End CSR 31945: JML Changes **********************
+*/
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SUBCUTANEOUS_INSULIN_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SUBCUTANEOUS_INSULIN_ORDERS.mlm
new file mode 100644
index 0000000..be87d09
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SUBCUTANEOUS_INSULIN_ORDERS.mlm
@@ -0,0 +1,2370 @@
+maintenance:
+
+maintenance:
+ title: FORM_SET_Subcutaneous_Insulin_Orders;;
+ mlmname: FORM_SET_Subcutaneous_Insulin_Orders;;
+ arden: version 2.5;;
+ version: 18.4;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: St Clair Hospital;;
+ date: 2019-01-09;;
+ validation: testing;;
+
+library:
+ purpose: Support best practice for diabetic management including standardized weight based calculation long and short acting insulin.
+ ;;
+
+ explanation:
+
+ Change history
+ 01.14.2020 TMS CSR 37690: Created to calculate weight based insulin orders using similar logic as is used for Diabetic Managment Protocol
+ 01.23.2020 TMS CSR 37690: Added checkboxes for correctional scale and logic to allow user to change sliding scale by selecting new sliding scale range box or by selecting the
+ desired scale without unchecking anything in the order selection checkboxes. Original method was confusing to users, whereby they had to deselect
+ ;;
+
+ keywords: Insulin, weight based, diabetic
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ local_session := CDS_SESSION.local;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ // 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;
+
+ comm_obj := this_communication.primaryobj;
+
+ /*******************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:="";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 FORMATTED WITH "%C" ;
+ TAB2 := TAB || TAB ;
+ TAB3 := TAB || TAB || TAB;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+ UserGuid := this_communication.UserGuid;
+
+
+ //Form fields
+ DosingGuidelines := last of (field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 5);
+ DosingGuidelines_List := DosingGuidelines.value;
+
+ Nur_Instruct:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 5 );
+ Nur_InstructList := Nur_Instruct.value;
+ Physician_Consult:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 8 );
+ Physician_ConsultList := Physician_Consult.value;
+ InsulinLowDose := last of (field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 1);
+ InsulinLowDose_List := InsulinLowDose.value;
+ InsulinModDose := last of (field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 2);
+ InsulinModDose_List := InsulinModDose.value;
+ InsulinHighDose := last of (field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 3);
+ InsulinHighDose_List := InsulinHighDose.value;
+ InsulinTypeInDose := last of (field_list WHERE field_list.DataItemName = "MultiOrderInline"
+ AND field_list.Control_MultiFieldOccNum = 4);
+ InsulinTypeInDoseList := InsulinTypeInDose.value;
+ BasalInsulin:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ BasalInsulinList := BasalInsulin.value;
+ NutrInsulin:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 3 );
+ NutrInsulinList := NutrInsulin.value;
+ CurrWeight := last of ( field_list WHERE field_list.DataItemName = "CombinedMeasurements"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ OrderInfo := last of ( field_list WHERE field_list.DataItemName = "PRX_NOTECOMMENT0"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ BGMFrequencyCode := last of ( field_list WHERE field_list.DataItemName = "FrequencyCode"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ BGMFrequency := BGMFrequencyCode.value;
+
+ BGMOrders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ BGMOrders_List := BGMOrders.value;
+
+ HomeMedList := last of ( field_list WHERE field_list.DataItemName = "PRX_Dosing_Info"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ CurrentMedList := last of ( field_list WHERE field_list.DataItemName = "PRX_Dosing_Info"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+
+ SingleOral_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_SingleOralHomeMed"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ MultipleOralOrInsulin_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_MultipleOralOrInsulin"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ Diabetic_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_PatientIsDiabetic"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ InsulinPump_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_PatientOnInsulinPump"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ PumpNotFunctioning_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_NonFunctioningPump"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ DietControlled_CB:= last of ( field_list WHERE field_list.DataItemName = "PRX_DM_PatientDietControlled"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ GFR_CB:= last of ( field_list WHERE field_list.DataItemName = "PRX_DM_GFR_LT_30"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ IvSteroid_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_DM_PtOnIvSteroids"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Override_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_Generic_CB"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+
+ Basal_Lantus_Levemir_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_Basal_Lantus-Levemir"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Basal_NPH_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_Basal_NPH-Isophane"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Basal_Freq_Daily_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_Basal_Frequency"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Basal_Freq_BID_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_Basal_Frequency"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+
+ Nutr_Aspart_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_Insulin_Aspart"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Nutr_Regular_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_Insulin_Regular"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Nutr_Freq_Bkfst_CB:= last of ( field_list WHERE field_list.DataItemName = "PRX_Nutritional_Frequency"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Nutr_Freq_Lunch_CB:= last of ( field_list WHERE field_list.DataItemName = "PRX_Nutritional_Frequency"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ Nutr_Freq_Dinner_CB:= last of ( field_list WHERE field_list.DataItemName = "PRX_Nutritional_Frequency"
+ AND field_list.Control_MultiFieldOccNum = 3 );
+ Nutr_Freq_TID_CB:= last of ( field_list WHERE field_list.DataItemName = "PRX_Nutritional_Frequency"
+ AND field_list.Control_MultiFieldOccNum = 4 );
+ Nutr_Freq_QHS_CB:= last of ( field_list WHERE field_list.DataItemName = "PRX_Nutritional_Frequency"
+ AND field_list.Control_MultiFieldOccNum = 5 );
+
+ Corr_Aspart_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_Insulin_Aspart"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ Corr_Regular_CB := last of ( field_list WHERE field_list.DataItemName = "PRX_Insulin_Regular"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ Corr_Dose_Type := last of (field_list WHERE field_list.DataItemName = "PRX_Corr_Insulin_Dose"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Corr_Low_Dose_Scale := last of (field_list WHERE field_list.DataItemName = "PRX_Corr_Insulin_Scale"
+ AND field_list.Control_MultiFieldOccNum = 1 );
+ Corr_Mod_Dose_Scale := last of (field_list WHERE field_list.DataItemName = "PRX_Corr_Insulin_Scale"
+ AND field_list.Control_MultiFieldOccNum = 2 );
+ Corr_High_Dose_Scale := last of (field_list WHERE field_list.DataItemName = "PRX_Corr_Insulin_Scale"
+ AND field_list.Control_MultiFieldOccNum = 3 );
+ Corr_Ind_Dose_Scale := last of (field_list WHERE field_list.DataItemName = "PRX_Corr_Insulin_Scale"
+ AND field_list.Control_MultiFieldOccNum = 4 );
+ CurrentLoc := read last
+ {" select currentlocation from cv3clientvisit "
+ || " where ClientGUID = " || SQL(clientguid)
+ || " and GUID = " || SQL(clientvisitguid)};
+
+
+
+ InsulinLowDoseList := InsulinLowDose.value;
+ InsulinModDoseList := InsulinModDose.value;
+ InsulinHighDoseList := InsulinHighDose.value;
+ BasalInsulinList := BasalInsulin.value;
+ NutrInsulinList := NutrInsulin.value;
+ Physician_ConsultList := Physician_Consult.value;
+ //Nur_InstructList := Endo_Consult.value;
+
+ CalcDoseBasal := last of (field_list WHERE field_list.DataItemName = "PRX_Basal_TDD"
+ AND field_list.Control_MultiFieldOccNum = 1);
+ CalcDoseNutr := last of (field_list WHERE field_list.DataItemName = "PRX_Nutritional_TDD"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ BasalDoseValue := last of (field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 1);
+ NutrDoseValue := last of (field_list WHERE field_list.DataItemName = "DosageLow"
+ AND field_list.Control_MultiFieldOccNum = 2);
+
+ if exists CurrWeight then
+
+ CurrWeight_val := CurrWeight.Value;
+ wt := CurrWeight_val.weight;
+ fmtwt := wt formatted with "%.1f";
+
+ else
+ wtgm := read last
+ { " Select Text from CV3PhysicalNoteDeclaration "
+ || " where ClientGUID = " || SQL(clientguid)
+ || " and ClientVisitGUID = " || SQL(clientvisitguid)
+ || " and TypeCode = {{{SINGLE-QUOTE}}}weight{{{SINGLE-QUOTE}}} "
+ || " order by Entered asc " };
+ wt := (wtgm as number) / 1000;
+ fmtwt := wt formatted with "%.1f";
+
+ // calculate Total Daily Dose for patient weight
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ TDD_half_div := (TDD_half as number) ;
+ TDD_Half_div_rnd := int (((TDD_half_div as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv_rnd := TDD_half_div_rnd formatted with "%.0f";
+ TDD_half_div2 := (TDD_half as number) / 2;
+ TDD_Half_div2_rnd := int (((TDD_half_div2 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv2_rnd := TDD_half_div2_rnd formatted with "%.0f";
+ TDD_half_div3 := (TDD_half as number) / 3;
+ TDD_Half_div3_rnd := int (((TDD_half_div3 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv3_rnd := TDD_half_div3_rnd formatted with "%.0f";
+ TDD_half_div4 := (TDD_half as number) / 4;
+ TDD_Half_div4_rnd := int (((TDD_half_div4 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv4_rnd := TDD_half_div4_rnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ endif;
+
+ If CallingEvent = "FormOpen" then
+
+ DosingGuidelines_List.IsReadOnly := (true);
+
+ //Obtain and format Home Medication Orders for display on form
+
+ (HomeMed, HomeMedInfo) := read { "select distinct cp.DrugName, cp.instructions
+ from SXAAMBClientPrescription cp
+ inner join SXAMTDrugNameMapVW dnm on dnm.drug_synonym_id = cp.FormularyBrandKey
+ join SXAMTCategoryDrugXREFVW cdx on cdx.drug_id = dnm.drug_id
+ join SXAMTDrugCategoriesVW cat on cat.multum_category_id = cdx.multum_category_id
+ where cp.ClientGUID = " || SQL(clientguid) || " and cp.StatusType ={{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ and cat.category_name in ({{{SINGLE-QUOTE}}}insulin{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}dipeptidyl peptidase 4 inhibitors{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}antidiabetic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}sulfonylureas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}biguanides{{{SINGLE-QUOTE}}})
+ and cp.EndDate is null " };
+ NumMeds:= 1 seqto (count HomeMed) ;
+ fmtMessage := "";
+
+ for i in NumMeds do
+ fmtMessage := fmtMessage || HomeMed [i] || " " || HomeMedInfo [i] || CRLF;
+ enddo;
+
+ HomeMedList.value := fmtMessage;
+
+ //Obtain and format Current Inpatient Medication Orders for display on form
+
+ (IpMedCode, IpMedName, IpMedSumm, IPMedDate) := read { "select distinct o.idcode, o.name, Replace (o.summaryline, CHAR(13) + CHAR(10), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})
+ from cv3order o
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGUID
+ join CV3DrugMapping dm on dm.CatalogItemGUID = ocmi.guid
+ join SXAMultumLevelsForDupMedTherapy dup on dup.DrugId = dm.DrugKey
+ join SXAMTCategoryDrugXREFVW cdx on cdx.drug_id = dm.drugkey
+ join SXAMTDrugCategoriesVW cat on cat.multum_category_id = cdx.multum_category_id
+ where cat.category_name in ({{{SINGLE-QUOTE}}}insulin{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}dipeptidyl peptidase 4 inhibitors{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}antidiabetic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}sulfonylureas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}biguanides{{{SINGLE-QUOTE}}})
+ and o.ClientGUID = " || SQL(clientguid) || " and o.clientvisitguid = " || SQL(clientvisitguid) || "
+ and o.OrderStatusCode not in ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}COMP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}})"};
+
+ NumIPMeds:= 1 seqto (count IPMedCode) ;
+ fmtIPMessage := "";
+
+ for s in NumIPMeds do
+ fmtIPMessage := fmtIPMessage || IPMedName [s] || " " || IPMedSumm [s] || CRLF;
+ enddo;
+
+ CurrentMedList.value := fmtIPMessage;
+
+ endif; //If CallingEvent = "FormOpen"
+
+ If CallingEvent = "FormOpen" or (CallingEvent = "FieldChange" and CallingField = "CombinedMeasurements|1")
+ or (CallingEvent = "FieldChange" and CallingField = "PRX_Generic_CB|1" and Override_CB.Value = False) then
+
+ /*********************************BEGIN HEALTH ISSUE SECTION**********************************************/
+
+ HealthIssue := read last {" select distinct hi.ShortName
+ from cv3healthissuedeclaration hi with (nolock)
+ inner join cv3codedhealthissue chi with (nolock) on hi.CodedHealthIssueGUID = chi.guid and chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})
+ where Clientguid = " || SQL (clientguid)
+ || " and hi.active = 1
+ and Status in ({{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chronic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Retired Code{{{SINGLE-QUOTE}}})
+ and (((ICD10Code like {{{SINGLE-QUOTE}}}E10%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}}))
+ or ((ICD9Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
+ or ((ICD9Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
+ or ((chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})) and ((chi.Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}}))
+ or ((chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}}) and ((chi.Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}})))"};
+
+ if exist HealthIssue then Patient_is_Diabetic := "Yes"; else Patient_is_Diabetic := "No"; endif;
+
+ If Patient_is_Diabetic = "Yes" then
+ Diabetic_CB.value := True;
+ Diabetic_CB.Control_Read_Only := True;
+ else
+ If Diabetic_CB.value = False then
+ dialogResult1 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unable to retrieve health issues for Diabetes. \n Does this patient have Diabetes? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogResult1 as string) = "Yes") then
+ Diabetic_CB.value := True;
+ Diabetic_CB.Control_Read_Only := True;
+ else
+ Diabetic_CB.Control_Read_Only := False;
+ endif;
+ endif;
+ endif;
+ /***********************BEGIN INSULIN PUMP DOCUMENTATION SEARCH ********************************/
+
+ (InsulinPump) := read last {"select fsl.value "
+ || " from CV3ClientDocument cd with (nolock) "
+ || " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || SQL(clientguid) || " and cdd.active = 1) "
+ || " left join CV3ObservationDocument od with (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
+ || " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID and ocmi.name in ({{{SINGLE-QUOTE}}}SCHCK type of insulin{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCHCK insulin pump type{{{SINGLE-QUOTE}}}) "
+ || " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL(clientguid) || ") "
+ || " where cd.clientguid = " || SQL(clientguid) || " and cd.clientvisitguid = " || SQL(clientvisitguid)
+ || " and cd.documentname in ({{{SINGLE-QUOTE}}}ED Triage Note{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}adult patient profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}OB Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pediatric Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Test{{{SINGLE-QUOTE}}}) " };
+
+ if exist insulinPump then
+ Patient_on_Insulin_Pump := "Yes";
+ else
+
+ PumpHealthIssue := read last {" select distinct hi.ShortName
+ from cv3healthissuedeclaration hi with (nolock)
+ inner join cv3codedhealthissue chi with (nolock) on hi.CodedHealthIssueGUID = chi.guid and chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})
+ where Clientguid = " || SQL (clientguid)
+ || " and hi.active = 1
+ and Status in ({{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chronic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Retired Code{{{SINGLE-QUOTE}}})
+ and ((ICD10Code = {{{SINGLE-QUOTE}}}Z96.41{{{SINGLE-QUOTE}}})
+ or (ICD9Code = {{{SINGLE-QUOTE}}}V45.85{{{SINGLE-QUOTE}}} and ICD10Code is null)
+ or ((chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}}) and (chi.Code = {{{SINGLE-QUOTE}}}Z96.41{{{SINGLE-QUOTE}}})))"};
+
+ if exist pumpHealthIssue then Patient_on_Insulin_Pump := "Yes"; else Patient_on_Insulin_Pump := "No"; endif;
+ endif;
+
+
+
+ /***********************BEGIN HOME MEDICATION ORAL DIABETIC AGENT SEARCH********************************/
+ (OralHomeMed,rxid) := read { "select distinct cp.DrugName, cp.prescriptionid
+ from SXAAMBClientPrescription cp
+ inner join SXAMTDrugNameMapVW dnm on dnm.drug_synonym_id = cp.FormularyBrandKey
+ join SXAMTCategoryDrugXREFVW cdx on cdx.drug_id = dnm.drug_id
+ join SXAMTDrugCategoriesVW cat on cat.multum_category_id = cdx.multum_category_id
+ where cp.ClientGUID = " || SQL(ClientGuid) || " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ and cat.category_name in ({{{SINGLE-QUOTE}}}dipeptidyl peptidase 4 inhibitors{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}antidiabetic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}sulfonylureas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}biguanides{{{SINGLE-QUOTE}}})"};
+
+ if exist OralHomeMed then Patient_on_Oral_Home_Agent := "Yes"; else Patient_on_Oral_Home_Agent := "No"; endif;
+
+ HomeMedCount := count (OralHomeMed);
+
+ If Patient_on_Oral_Home_Agent = "Yes" then
+ If HomeMedCount = 1 then
+ SingleOralAgent := "Yes";
+ MultiOralAgent := "No";
+ else
+ SingleOralAgent := "No";
+ MultiOralAgent := "Yes";
+ endif;
+ endif;
+
+
+ /*********************************BEGIN HOME INSULIN SEARCH********************************************/
+ InsulinHomeMed := read last { "select distinct cp.DrugName
+ from SXAAMBClientPrescription cp
+ inner join SXAMTDrugNameMapVW dnm on dnm.drug_synonym_id = cp.FormularyBrandKey
+ join SXAMTCategoryDrugXREFVW cdx on cdx.drug_id = dnm.drug_id
+ join SXAMTDrugCategoriesVW cat on cat.multum_category_id = cdx.multum_category_id
+ where cp.ClientGUID = " || SQL(ClientGuid) || " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ and cat.category_name = {{{SINGLE-QUOTE}}}insulin{{{SINGLE-QUOTE}}}
+ and cp.EndDate is null "};
+ if exist InsulinHomeMed then Patient_on_Home_Insulin := "Yes"; else Patient_on_Home_Insulin := "No"; endif;
+
+ /********************************* BEGIN DIET ORDER SEARCH********************************************/
+ NPO := read last { "select o.guid from cv3order o
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGUID
+ where clientvisitguid = " || SQL (clientvisitguid) || " and o.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Other{{{SINGLE-QUOTE}}}
+ and ocmi.Name = {{{SINGLE-QUOTE}}}NPO{{{SINGLE-QUOTE}}}"};
+
+ Diet := read last { "select o.guid from cv3order o
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGUID
+ where clientvisitguid = " || SQL (clientvisitguid) || " and o.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Other{{{SINGLE-QUOTE}}}
+ and ocmi.Name = {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}}"};
+
+ //Unsubmitted Active NPO order determined by local session variable
+ if (local_session.SessionUnsubNPOOrder = true) then
+ UnsubNPOOrderExists := true;
+ endif;
+
+ //Unsubmitted Active Diet order determined by local session variable
+ if (local_session.SessionUnsubDietOrder = true) then
+ UnsubDietOrderExists := true;
+ endif;
+
+
+ /***********************BEGIN IV STEROID SEARCH ********************************/
+
+ IvAddSteroid := read last { "select o.guid from cv3order o
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = o.OrderCatalogMasterItemGUID
+ join CV3MedicationExtension me on me.guid = o.guid
+ left join CV3OrderComponent oc on oc.OrderGUID = o.guid
+ where clientvisitguid = " || SQL (clientvisitguid) || " and o.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
+ and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}hormones/hormone modifiers | adrenal cortical steroids{{{SINGLE-QUOTE}}}
+ and me.OrderRouteCode in ({{{SINGLE-QUOTE}}}IV{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IV Push{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IVPB{{{SINGLE-QUOTE}}})"};
+
+ IvSteroid := read last { " select o.guid from cv3order o
+ join CV3MedicationExtension me on me.guid = o.guid
+ left join CV3OrderComponent oc on oc.OrderGUID = o.guid
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = oc.OrderCatalogMasterItemGUID
+ where clientvisitguid = " || SQL (clientvisitguid) || " and o.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
+ and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}hormones/hormone modifiers | adrenal cortical steroids{{{SINGLE-QUOTE}}}
+ and me.OrderRouteCode in ({{{SINGLE-QUOTE}}}IV{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IV Push{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IVPB{{{SINGLE-QUOTE}}})"};
+
+ IvSteroidTask := read {" select TaskStatusCode from CV3OrderTaskOccurrence oto
+ join cv3order o on o.guid = oto.OrderGUID
+ join CV3OrderCatalogMasterItem ocmi on ocmi.GUID = o.OrderCatalogMasterItemGUID
+ join CV3MedicationExtension me on me.guid = o.guid
+ where clientvisitguid = " || SQL (clientvisitguid) || " and oto.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
+ and oto.TaskStatusCode <> ({{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}})
+ and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}hormones/hormone modifiers | adrenal cortical steroids{{{SINGLE-QUOTE}}}
+ and me.OrderRouteCode in ({{{SINGLE-QUOTE}}}IV{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IV Push{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}IVPB{{{SINGLE-QUOTE}}})"};
+
+ IvAddSteroidTask := read {" select TaskStatusCode from CV3OrderTaskOccurrence oto
+ join cv3order o on o.guid = oto.OrderGUID
+ join CV3MedicationExtension me on me.guid = o.guid
+ left join CV3OrderComponent oc on oc.OrderGUID = o.guid
+ join CV3OrderCatalogMasterItem ocmi on ocmi.guid = oc.OrderCatalogMasterItemGUID
+ where clientvisitguid = " || SQL (clientvisitguid) || " and oto.clientguid = " || SQL (clientguid) ||"
+ and o.typecode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
+ and oto.TaskStatusCode <> ({{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}})
+ and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}hormones/hormone modifiers | adrenal cortical steroids{{{SINGLE-QUOTE}}}
+ and me.OrderRouteCode in ({{{SINGLE-QUOTE}}}IV{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}IV Push{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}IVPB{{{SINGLE-QUOTE}}})"};
+
+ if (local_session.SessionUnsubIVSteroidOrder = true) then
+ UnsubSteroidOrderExists := true;
+ endif;
+
+ if exist IvSteroid then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ elseif exist IvSteroidTask then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ elseif exist IvAddSteroid then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ elseif exist IvAddSteroidTask then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ elseif
+ UnsubSteroidOrderExists = True then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ else
+ Patient_on_IV_Steroid := "No";
+ IvSteroid_CB.value := False;
+ IvSteroid_CB.Control_Read_only := True;
+ endif;
+
+ /**************************GFR LAB VALUE SEARCH ***********************************/
+
+ Race := read last
+ {" Select RaceCode from cv3client where RaceCode like {{{SINGLE-QUOTE}}}%African%{{{SINGLE-QUOTE}}} and Guid = " ||SQL (clientguid)};
+
+ If Race is not null then
+
+ GFR, GFRName, GFRUom, AbnCode := read last
+ {"Select top 1 bo.value, bo.itemname, bo.UnitofMeasure, bo.AbnormalityCode "
+ || " 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(clientguid)
+ || " and o.performeddtm >= (DATEADD(hour, -240, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}GFR (African American){{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ else
+
+ GFR, GFRName, GFRUom, AbnCode := read last
+ {"Select top 1 bo.value, bo.itemname, bo.UnitofMeasure, bo.AbnormalityCode "
+ || " 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(clientguid)
+ || " and o.performeddtm >= (DATEADD(hour, -240, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}GFR (Caucasian/Other){{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ endif;
+
+ If ABNCode = "L" and (GFR as number ) < 30 then
+ Low_GFR := "Yes";
+ GFR_CB.value := True;
+ GFR_CB.Control_Read_Only := True;
+ elseif GFR is Null then
+ No_GFR := "Yes";
+ GFR_CB.value := False;
+ GFR_CB.Control_Read_Only := True;
+ else
+ Low_GFR := "No";
+ GFR_CB.value := False;
+ GFR_CB.Control_Read_Only := True;
+ endif;
+
+
+ // patient on insulin pump or patient diet controlled
+ If Patient_is_Diabetic = "Yes" and Patient_on_Insulin_Pump = "Yes" then
+ EndoDoc := read last { " Select DisplayName from CV3ClientVisitProvidersJoin "
+ || " where ClientVisitGUID = " || SQL(clientvisitguid)
+ || " and Discipline = {{{SINGLE-QUOTE}}}Endocrinology{{{SINGLE-QUOTE}}}"
+ || " and RoleCode = {{{SINGLE-QUOTE}}}Consulting{{{SINGLE-QUOTE}}}"
+ || " and status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"};
+ If EndoDoc is not null then
+ ThisMsgB := "Patient on an Insulin Pump." || CRLF
+ || "Patient has an existing Endocrinology Consult to " || EndoDoc ||".";
+ Nur_InstructList.IsSelected := (True, True);
+ Physician_ConsultList.IsSelected := (False);
+ else
+
+ Nur_InstructList.IsSelected := (True, True);
+ Physician_ConsultList.IsSelected := (True);
+ ThisMsgB := "Patient on an Insulin Pump." || CRLF
+ || "Place a STAT Endocrinology Consult.";
+ endif;
+ OrderInfo.value := ThisMsgB;
+ InsulinPump_CB.value := True;
+ Diabetic_CB.value := True;
+ DietControlled_CB.value:= False;
+ MultipleOralOrInsulin_CB.value := False;
+ SingleOral_CB.value := False;
+ DietControlled_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ dialogResult7 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Documentation states this patient has an insulin pump. \n Is the pump actively providing insulin therapy for this patient?" ,"Insulin Pump Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogResult7 as string) = "Yes") then
+ Basal_Lantus_Levemir_CB.value := False;
+ Nutr_Aspart_CB.value := False;
+ Corr_Aspart_CB.value := False;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Nutr_Freq_Bkfst_CB.value := false;
+ Nutr_Freq_Lunch_CB.value := false;
+ Nutr_Freq_Dinner_CB.value := false;
+ Nutr_Freq_TID_CB.value := false;
+ Nutr_Freq_QHS_CB.value := false;
+ Basal_Freq_Daily_CB.value := false;
+ Basal_Freq_BID_CB.value := false;
+ Basal_NPH_CB.value := false;
+ Nutr_Regular_CB.value := false;
+ Corr_Regular_CB.value := false;
+ BasalInsulinList.IsSelected := (false, false, false, false);
+ NutrInsulinList.IsSelected := (false, false, false, false, false, false, false, false, false, false);
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False, False);
+ InsulinHighDoseList.IsSelected := (False, False);
+ PumpNotFunctioning_CB.value := False;
+ else
+
+ Basal_Lantus_Levemir_CB.value := True;
+ Nutr_Aspart_CB.value := True;
+ Corr_Aspart_CB.value := True;
+ PumpNotFunctioning_CB.value := True;
+ endif;
+
+
+ ElseIf Patient_on_Insulin_Pump = "No" and Patient_on_Oral_Home_Agent = "No" and Patient_on_Home_Insulin = "No" then
+
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unable to retrieve any home insulin or home oral diabetic agents. \n\n Please select {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} to confirm that this patient does not take oral diabetic agents or insulin. ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult as string) = "Yes") then
+ Patient_is_Diet_Controlled := "Yes";
+ DietControlled_CB.value := True;
+ MultipleOralOrInsulin_CB.value := False;
+ MultipleOralOrInsulin_CB.Control_Read_Only := True;
+ SingleOral_CB.value := False;
+ SingleOral_CB.Control_Read_Only := True;
+ InsulinPump_CB.value := False;
+ InsulinPump_CB.Control_Read_Only := True;
+ Basal_Lantus_Levemir_CB.value := false;
+ Nutr_Aspart_CB.value := false;
+ Corr_Aspart_CB.value := false;
+ Corr_Low_Dose_Scale := False;
+ Corr_Mod_Dose_Scale := False;
+ Corr_High_Dose_Scale := False;
+ Corr_Ind_Dose_Scale := False;
+ Nutr_Freq_Bkfst_CB.value := false;
+ Nutr_Freq_Lunch_CB.value := false;
+ Nutr_Freq_Dinner_CB.value := false;
+ Nutr_Freq_TID_CB.value := false;
+ Nutr_Freq_QHS_CB.value := false;
+ Basal_Freq_Daily_CB.value := false;
+ Basal_Freq_BID_CB.value := false;
+ Basal_NPH_CB.value := false;
+ Nutr_Regular_CB.value := false;
+ Corr_Regular_CB.value := false;
+ BasalInsulinList.IsSelected := (false, false, false, false);
+ NutrInsulinList.IsSelected := (false, false, false, false, false, false, false, false, false, false);
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False, False);
+ InsulinHighDoseList.IsSelected := (False, False);
+
+ if Diet is not null or UnsubDietOrderExists then
+ BGMOrders_List.IsSelected := (True, False, False, False, False, False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ elseif NPO is not null or UnsubNPOOrderExists then
+ BGMOrders_List.IsSelected := (False, True, False, False, False, False);
+ BGMFrequency.FrequencySummary := "Q6H";
+ else
+ dialogResult3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unable to retrieve any diet orders. \n Is this patient NPO? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogResult3 as string) = "Yes") then
+ BGMOrders_List.IsSelected := (False, True, False, False, False, False);
+ else
+ BGMOrders_List.IsSelected := (True, False, False, False, False, False);
+ endif;
+ endif;
+ else
+ If this_communication.CatalogParentOrderSetGUID is not null then
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n You will need to re-open the Diabetic Management Protocol Order Set from the Review Screen before submitting orders to make any Parameter Selections." ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+ Patient_is_Diet_Controlled := "No";
+ DietControlled_CB.value := False;
+ Override_CB.value := True;
+ GFR_CB.Control_Read_Only := False;
+ IvSteroid_CB.Control_Read_only := False;
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ InsulinPump_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+
+ endif;
+ endif; // patient on insulin pump or patient diet controlled
+
+ // patient is diabetic and patient not on insulin pump or patient not diet controlled
+ if (Patient_is_Diabetic = "Yes" and Patient_on_Insulin_Pump = "No" and (Patient_is_Diet_Controlled = "No" or Patient_is_Diet_Controlled is Null))
+ or (Patient_is_Diabetic = "Yes" and Patient_on_Insulin_Pump = "Yes" and PumpNotFunctioning_CB.value = True) then
+ If Patient_on_IV_Steroid = "No" and this_communication.CatalogParentOrderSetGUID is not null and (MultiOralAgent = "Yes" or Patient_on_Home_Insulin = "Yes") then
+ dialogResult6 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Will you be placing this patient on IV Steroids?" ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogResult6 as string) = "Yes") then
+ Patient_on_IV_Steroid := "Yes";
+ IvSteroid_CB.value := True;
+ IvSteroid_CB.Control_Read_only := True;
+ else
+ Patient_on_IV_Steroid := "No";
+ endif;
+ endif;
+
+ // Get patient weight
+
+ if exists CurrWeight then
+ CurrWeight_val := CurrWeight.Value;
+ wt := CurrWeight_val.weight;
+ fmtwt := wt formatted with "%.1f";
+ else
+ wtgm := read last
+ { " Select Text from CV3PhysicalNoteDeclaration "
+ || " where ClientGUID = " || SQL(clientguid)
+ || " and ClientVisitGUID = " || SQL(clientvisitguid)
+ || " and TypeCode = {{{SINGLE-QUOTE}}}weight{{{SINGLE-QUOTE}}} "
+ || " order by Entered asc " };
+ wt := (wtgm as number) / 1000;
+ fmtwt := wt formatted with "%.1f";
+ endif;
+
+ If wt = 0 or wt is null then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please enter a patient weight to continue. ","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ CurrWeight.Control_Mandatory := True;
+
+ endif;
+
+ If Patient_on_Oral_Home_Agent = "Yes" and SingleOralAgent = "Yes" and MultiOralAgent = "No" and Patient_on_Home_Insulin = "No" then
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ If (BasalInsulinList.IsSelected = (True, False, False, False) or BasalInsulinList.IsSelected = (True, True, False, False) or BasalInsulinList.IsSelected = (False, True, False, False)) then
+ BasalInsulinList.IsReadOnly := (False, False, True, True); endif;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ SingleOral_CB.value := True;
+ MultipleOralOrInsulin_CB.value := False;
+ InsulinPump_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+
+ If (TDD_calc as number) > 80 then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+ ThisMsg := "Patient on single oral agent at home." || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD|| " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ elseif ((Patient_on_Oral_Home_Agent = "Yes" and SingleOralAgent = "No" and MultiOralAgent = "Yes") or Patient_on_Home_Insulin = "Yes") and Patient_on_IV_Steroid = "Yes" and PumpNotFunctioning_CB.value = False then
+
+ TDD_calc := (wt as number) * 0.5;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ SingleOral_CB.value := False;
+ MultipleOralOrInsulin_CB.value := True;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+ Slidescale := "Use Moderate Dose Correctional Sliding Scale";
+
+ ThisMsg := "Patient on IV Steroids." || CRLF
+ || "Total Daily Dose = 0.5 units/kg || (" || fmtwt || " kg * 0.5 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+
+ elseif PumpNotFunctioning_CB.value = True and Patient_on_IV_Steroid = "Yes" then
+
+ TDD_calc := (wt as number) * 0.5;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+ Slidescale := "Use Moderate Dose Correctional Sliding Scale";
+
+ ThisMsg := ThisMsgB || CRLF ||"Patient on IV Steroids." || CRLF
+ || "Total Daily Dose = 0.5 units/kg || (" || fmtwt || " kg * 0.5 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ elseif ((Patient_on_Oral_Home_Agent = "Yes" and SingleOralAgent = "No" and MultiOralAgent = "Yes") or Patient_on_Home_Insulin = "Yes" ) and Patient_on_IV_Steroid = "No" and Low_GFR = "Yes" and PumpNotFunctioning_CB.value = False then
+
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ If (BasalInsulinList.IsSelected = (True, False, False, False) or BasalInsulinList.IsSelected = (True, True, False, False) or BasalInsulinList.IsSelected = (False, True, False, False)) then
+ BasalInsulinList.IsReadOnly := (False, False, True, True); endif;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ GFR_CB.value := True;
+ GFR_CB.Control_Read_Only := True;
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ SingleOral_CB.value := False;
+ MultipleOralOrInsulin_CB.value := True;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+
+ If (TDD_calc as number) > 80 then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+
+ ThisMsg := GFRName ||" " || GFR || " " || GFRUom || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD|| " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+
+ elseif PumpNotFunctioning_CB.value = True and Patient_on_IV_Steroid = "No" and Low_GFR = "Yes" then
+
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ If (BasalInsulinList.IsSelected = (True, False, False, False) or BasalInsulinList.IsSelected = (True, True, False, False) or BasalInsulinList.IsSelected = (False, True, False, False)) then
+ BasalInsulinList.IsReadOnly := (False, False, True, True);
+ endif;
+
+
+ If (TDD_calc as number) > 80 then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+
+ ThisMsg := GFRName ||" " || GFR || " " || GFRUom || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD|| " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ elseif ((Patient_on_Oral_Home_Agent = "Yes" and SingleOralAgent = "No" and MultiOralAgent = "Yes") or Patient_on_Home_Insulin = "Yes") and Patient_on_IV_Steroid = "No" and Low_GFR = "No" and PumpNotFunctioning_CB.value = False then
+
+ TDD_calc := (wt as number) * 0.4;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ If (BasalInsulinList.IsSelected = (True, False, False, False)
+ or BasalInsulinList.IsSelected = (True, True, False, False)
+ or BasalInsulinList.IsSelected = (False, True, False, False)) then
+ BasalInsulinList.IsReadOnly := (False, False, True, True);
+ endif;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ GFR_CB.value := False ;
+ SingleOral_CB.value := False;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.value := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+ DietControlled_CB.value := False;
+ DietControlled_CB.control_read_only := True;
+
+ If Patient_on_Home_Insulin = "No" then
+ InsulinPump_CB.Control_Read_Only := True;
+ else
+ InsulinPump_CB.Control_Read_Only := False;
+ endif;
+
+
+ If (TDD_calc as number) > 80 then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ ThisMsg := GFRName ||" " || GFR || " " || GFRUom || CRLF
+ || "Total Daily Dose = 0.4 units/kg || (" || fmtwt || " kg * 0.4 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+
+ elseif PumpNotFunctioning_CB.value = True and Patient_on_IV_Steroid = "No" and Low_GFR = "No" then
+
+ TDD_calc := (wt as number) * 0.4;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ If (BasalInsulinList.IsSelected = (True, False, False, False)
+ or BasalInsulinList.IsSelected = (True, True, False, False)
+ or BasalInsulinList.IsSelected = (False, True, False, False)) then
+ BasalInsulinList.IsReadOnly := (False, False, True, True);
+ endif;
+
+
+ If (TDD_calc as number) > 80 then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ ThisMsg := GFRName ||" " || GFR || " " || GFRUom || CRLF
+ || "Total Daily Dose = 0.4 units/kg || (" || fmtwt || " kg * 0.4 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ elseif ((Patient_on_Oral_Home_Agent = "Yes" and SingleOralAgent = "No" and MultiOralAgent = "Yes") or Patient_on_Home_Insulin = "Yes" ) and Patient_on_IV_Steroid = "No" and No_GFR = "Yes" and PumpNotFunctioning_CB.value = False then
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ GFR_CB.value := False ;
+ SingleOral_CB.value := False;
+ SingleOral_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.value := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+ DietControlled_CB.value := False;
+ DietControlled_CB.control_read_only := True;
+ If Patient_on_Home_Insulin = "No" then
+ InsulinPump_CB.Control_Read_Only := True;
+ else
+ InsulinPump_CB.Control_Read_Only := False;
+ endif;
+
+ If (TDD_calc as number) > 80 then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ ThisMsg := " No GFR Value Found" || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ elseif PumpNotFunctioning_CB.value = True and Patient_on_IV_Steroid = "No" and No_GFR = "Yes" then
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+
+ If (TDD_calc as number) > 80 then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ ThisMsg := " No GFR Value Found" || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+ else
+ ThisMsg := " " ;
+ OrderInfo.value := ThisMsg;
+ endif;
+ endif;
+ endif;
+
+
+
+ If callingEvent = "FieldChange" or callingEvent = "FormClose" then
+
+ // Present error window if no weight available
+ If callingEvent = "FormClose" and (MultipleOralOrInsulin_CB.value = True or SingleOral_CB.value = True) and (wt = 0 or wt is null) then
+
+ this_communication.DisplayForm := "yes";
+ this_communication.Message := "\n You must enter a patient weight to continue. ";
+ this_communication.MessageType := "Error";
+ endif;
+
+ // call Medication order management MLM on close for duplicate therapeutic medication review
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ if callingevent = "FieldChange" then
+ // If override parameters box is selected make all parameters available
+ If CallingField = "PRX_Generic_CB|1" and Override_CB.Value = True then
+ InsulinPump_CB.Control_Read_Only := False;
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+ GFR_CB.Control_Read_Only := False;
+ IvSteroid_CB.Control_Read_only := False;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ BasalInsulinList.IsSelected := (False);
+ endif;
+
+ If CallingField = "PRX_DM_PatientOnInsulinPump|1" then
+
+ If InsulinPump_CB.value = False then
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ ThisMsg := " " ;
+ Basal_Lantus_Levemir_CB.value := True;
+ Nutr_Aspart_CB.value := True;
+ Corr_Aspart_CB.value := True;
+
+ // If patient has insulin pump enter Endo Consult
+ Elseif InsulinPump_CB.value = True then
+
+ EndoDoc := read last { " Select DisplayName from CV3ClientVisitProvidersJoin "
+ || " where ClientVisitGUID = " || SQL(clientvisitguid)
+ || " and Discipline = {{{SINGLE-QUOTE}}}Endocrinology{{{SINGLE-QUOTE}}}"
+ || " and RoleCode = {{{SINGLE-QUOTE}}}Consulting{{{SINGLE-QUOTE}}}"
+ || " and status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"};
+ If EndoDoc is not null then
+ ThisMsg := "Patient on an Insulin Pump." || CRLF
+ || "Patient has an existing Endocrinology Consult to " || EndoDoc ||".";
+
+ Nur_InstructList.IsSelected := (True, True);
+ Physician_ConsultList.IsSelected := (False);
+ else
+ ThisMsg := "Patient on an Insulin Pump." || CRLF
+ || "Place a STAT Endocrinology Consult.";
+
+ Nur_InstructList.IsSelected := (True, True);
+ Physician_ConsultList.IsSelected := (True);
+ endif;
+
+ BasalInsulinList.IsSelected := (False, False, False, False);
+ NutrInsulinList.IsSelected := (False, False, False, False, False, False, False, False, False, False);
+ Corr_Aspart_CB.value := False;
+ Corr_Regular_CB.value := False;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ InsulinLowDoseList.IsSelected := (False, False);
+ InsulinModDoseList.IsSelected := (False, False);
+ InsulinHighDoseList.IsSelected := (False, False);
+ OrderInfo.value := ThisMsg;
+ Diabetic_CB.value := True;
+ DietControlled_CB.value:= False;
+ MultipleOralOrInsulin_CB.value := False;
+ SingleOral_CB.value := False;
+ DietControlled_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+ Basal_Lantus_Levemir_CB.value := False;
+ Nutr_Aspart_CB.value := False;
+ Corr_Aspart_CB.value := False;
+ endif;
+ endif; //If CallingField = "PRX_DM_PatientOnInsulinPump|1"
+
+ If (CallingField = "PRX_DM_SingleOralHomeMed|1" and (SingleOral_CB.value = True or SingleOral_CB.value = False))or (CallingField = "CombinedMeasurements|1" and SingleOral_CB.value = true) then
+ If SingleOral_CB.value = False then
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+ InsulinPump_CB.control_read_only := False;
+ Elseif SingleOral_CB.value = True then
+
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ TDD_half_div := (TDD_half as number);
+ TDD_Half_div_rnd := int (((TDD_half_div as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv_rnd := TDD_half_div_rnd formatted with "%.0f";
+ TDD_half_div2 := (TDD_half as number) / 2;
+ TDD_Half_div2_rnd := int (((TDD_half_div2 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv2_rnd := TDD_half_div2_rnd formatted with "%.0f";
+ TDD_half_div3 := (TDD_half as number) / 3;
+ TDD_Half_div3_rnd := int (((TDD_half_div3 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv3_rnd := TDD_half_div3_rnd formatted with "%.0f";
+ TDD_half_div4 := (TDD_half as number) / 4;
+ TDD_Half_div4_rnd := int (((TDD_half_div4 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv4_rnd := TDD_half_div4_rnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ MultipleOralOrInsulin_CB.value := False;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ MultipleOralOrInsulin_CB.control_read_only := True;
+
+ If (TDD_calc as number) > 80 then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ ThisMsg := "Patient on single oral agent at home." || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD|| " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+ endif;
+ endif; //If (CallingField = "PRX_DM_SingleOralHomeMed|1" and (SingleOral_CB.value = True or SingleOral_CB.value = False))or (CallingField = "CombinedMeasurements|1" and SingleOral_CB.value = true)
+
+ If (CallingField = "PRX_DM_MultipleOralOrInsulin|1" or CallingField = "PRX_DM_PtOnIvSteroids|1" or CallingField = "PRX_DM_GFR_LT_30|1")
+ or (CallingField = "CombinedMeasurements|1" and MultipleOralOrInsulin_CB.value = true) then
+
+ If MultipleOralOrInsulin_CB.value = False then
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+ InsulinPump_CB.control_read_only := False;
+
+ ElseIf MultipleOralOrInsulin_CB.value = True then
+ If IvSteroid_CB.value = True then
+
+ TDD_calc := (wt as number) * 0.5;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ TDD_half_div := (TDD_half as number) ;
+ TDD_Half_div_rnd := int (((TDD_half_div as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv_rnd := TDD_half_div_rnd formatted with "%.0f";
+ TDD_half_div2 := (TDD_half as number) / 2;
+ TDD_Half_div2_rnd := int (((TDD_half_div2 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv2_rnd := TDD_half_div2_rnd formatted with "%.0f";
+ TDD_half_div3 := (TDD_half as number) / 3;
+ TDD_Half_div3_rnd := int (((TDD_half_div3 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv3_rnd := TDD_half_div3_rnd formatted with "%.0f";
+ TDD_half_div4 := (TDD_half as number) / 4;
+ TDD_Half_div4_rnd := int (((TDD_half_div4 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv4_rnd := TDD_half_div4_rnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ SingleOral_CB.value := False;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+
+ Slidescale := "Use Moderate Dose Correctional Sliding Scale";
+
+ ThisMsg := "Patient on IV Steroids." || CRLF
+ || "Total Daily Dose = 0.5 units/kg || (" || fmtwt || " kg * 0.5 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ ElseIf GFR_CB.value = True and IvSteroid_CB.value = False then
+ TDD_calc := (wt as number) * 0.2;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ TDD_half_div := (TDD_half as number);
+ TDD_Half_div_rnd := int (((TDD_half_div as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv_rnd := TDD_half_div_rnd formatted with "%.0f";
+ TDD_half_div2 := (TDD_half as number) / 2;
+ TDD_Half_div2_rnd := int (((TDD_half_div2 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv2_rnd := TDD_half_div2_rnd formatted with "%.0f";
+ TDD_half_div3 := (TDD_half as number) / 3;
+ TDD_Half_div3_rnd := int (((TDD_half_div3 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv3_rnd := TDD_half_div3_rnd formatted with "%.0f";
+ TDD_half_div4 := (TDD_half as number) / 4;
+ TDD_Half_div4_rnd := int (((TDD_half_div4 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv4_rnd := TDD_half_div4_rnd formatted with "%.0f";
+
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ If (BasalInsulinList.IsSelected = (True, False, False, False) or BasalInsulinList.IsSelected = (True, True, False, False) or BasalInsulinList.IsSelected = (False, True, False, False)) then
+ BasalInsulinList.IsReadOnly := (False, False, True, True); endif;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ InsulinPump_CB.value:= False;
+ DietControlled_CB.value:= False;
+ SingleOral_CB.value := False;
+ InsulinPump_CB.control_read_only := True;
+ DietControlled_CB.control_read_only := True;
+ SingleOral_CB.control_read_only := True;
+
+ If (TDD_calc as number) > 80 then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ ThisMsg := "This patient has a GFR < 30ml/min" || CRLF
+ || "Total Daily Dose = 0.2 units/kg || (" || fmtwt || " kg * 0.2 = " || fmt_TDD|| " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ OrderInfo.value := ThisMsg;
+
+ ElseIf GFR_CB.value = False and IvSteroid_CB.value = False then
+ TDD_calc := (wt as number) * 0.4;
+ fmt_TDD := TDD_calc formatted with "%.0f";
+ TDD_half := (TDD_calc as number) * 0.5;
+ TDD_halfrnd := int (((TDD_half as number) + 0.5)/1)*1;
+ fmt_TDD_halfrnd := TDD_halfrnd formatted with "%.0f";
+ TDD_half_div := (TDD_half as number) ;
+ TDD_Half_div_rnd := int (((TDD_half_div as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv_rnd := TDD_half_div_rnd formatted with "%.0f";
+ TDD_half_div2 := (TDD_half as number) / 2;
+ TDD_Half_div2_rnd := int (((TDD_half_div2 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv2_rnd := TDD_half_div2_rnd formatted with "%.0f";
+ TDD_half_div3 := (TDD_half as number) / 3;
+ TDD_Half_div3_rnd := int (((TDD_half_div3 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv3_rnd := TDD_half_div3_rnd formatted with "%.0f";
+ TDD_half_div4 := (TDD_half as number) / 4;
+ TDD_Half_div4_rnd := int (((TDD_half_div4 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv4_rnd := TDD_half_div4_rnd formatted with "%.0f";
+ CalcDoseBasal.Value := TDD_halfrnd;
+ CalcDoseNutr.Value := TDD_halfrnd;
+ If (BasalInsulinList.IsSelected = (True, False, False, False) or BasalInsulinList.IsSelected = (True, True, False, False) or BasalInsulinList.IsSelected = (False, True, False, False)) then
+ BasalInsulinList.IsReadOnly := (False, False, True, True);
+ endif;
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ SingleOral_CB.value := False;
+ SingleOral_CB.control_read_only := True;
+ DietControlled_CB.value := False;
+ DietControlled_CB.control_read_only := True;
+
+ If (TDD_calc as number) > 80 then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose > 80 units - Use High Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) >= 40 and (TDD_calc as number) <= 80 then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose 40 - 80 units - Use Moderate Dose Correctional Sliding Scale";
+ elseif (TDD_calc as number) < 40 then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Slidescale := "Total Daily Dose < 40 units - Use Low Dose Correctional Sliding Scale";
+ endif;
+
+ If GFRName is not null then
+ ThisMsg := GFRName ||" " || GFR || " " || GFRUom || CRLF
+ || "Total Daily Dose = 0.4 units/kg || (" || fmtwt || " kg * 0.4 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ Else
+ ThisMsg := " " || CRLF
+ || "Total Daily Dose = 0.4 units/kg || (" || fmtwt || " kg * 0.4 = " || fmt_TDD || " units)" || CRLF
+ || "Basal Insulin = 50% of Total Daily Dose || (" || fmt_TDD ||" units * 0.5 = " || fmt_TDD_halfrnd || " units)" ||CRLF || Slidescale;
+ Endif;
+ OrderInfo.value := ThisMsg;
+ endif;
+
+ endif;
+
+ endif; //If (CallingField = "PRX_DM_MultipleOralOrInsulin|1" or CallingField = "PRX_DM_PtOnIvSteroids|1" or CallingField = "PRX_DM_GFR_LT_30|1")
+ //or (CallingField = "CombinedMeasurements|1" and MultipleOralOrInsulin_CB.value = true)
+
+ If CallingField = "PRX_DM_PatientDietControlled|1" then
+
+ If DietControlled_CB.value = False then
+ MultipleOralOrInsulin_CB.control_read_only := False;
+ SingleOral_CB.control_read_only := False;
+ DietControlled_CB.control_read_only := False;
+ InsulinPump_CB.control_read_only := False;
+ ElseIf DietControlled_CB.value = True then
+
+ BasalInsulinList.IsSelected := (False);
+ Nur_InstructList.IsSelected := (True, False);
+ Physician_ConsultList.IsSelected := (False);
+ Basal_Lantus_Levemir_CB.value := False;
+ Basal_NPH_CB.value := False;
+ Nutr_Aspart_CB.value := False;
+ Nutr_Regular_CB.value := False;
+ Corr_Aspart_CB.value := False;
+ Corr_Regular_CB.value := False;
+ Nutr_Freq_Bkfst_CB.value := false;
+ Nutr_Freq_Lunch_CB.value := false;
+ Nutr_Freq_Dinner_CB.value := false;
+ Nutr_Freq_TID_CB.value := false;
+ Nutr_Freq_QHS_CB.value := false;
+ Basal_Freq_Daily_CB.value := false;
+ Basal_Freq_BID_CB.value := false;
+ NutrInsulinList.IsSelected := (false, false, false, false, false, false, false, false, false, false);
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False, False);
+ InsulinHighDoseList.IsSelected := (False, False);
+ Corr_Dose_Type.Value := "";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ MultipleOralOrInsulin_CB.value := False;
+ MultipleOralOrInsulin_CB.Control_Read_Only := True;
+ SingleOral_CB.value := False;
+ SingleOral_CB.Control_Read_Only := True;
+ InsulinPump_CB.value := False;
+ InsulinPump_CB.Control_Read_Only := True;
+ ThisMsg := " " || CRLF;
+ OrderInfo.value := ThisMsg;
+ if Diet is not null or UnsubDietOrderExists then
+ BGMOrders_List.IsSelected := (True, False, False, False, False, False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ elseif NPO is not null or UnsubNPOOrderExists then
+ BGMOrders_List.IsSelected := (False, True, False, False, False, False);
+ BGMFrequency.FrequencySummary := "Q6H";
+ else
+ dialogResult3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unable to retrieve any diet orders. \n Is this patient NPO? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogResult3 as string) = "Yes") then
+
+ BGMOrders_List.IsSelected := (False, True, False, False, False, False);
+ BGMFrequency.FrequencySummary := "Q6H";
+ else
+ BGMOrders_List.IsSelected := (True, False, False, False, False, False);
+ BGMFrequency.FrequencySummary := "QID (AC and HS)";
+ endif;
+ endif;
+ endif;
+ endif;
+
+ If CallingField = "PRX_Corr_Insulin_Scale|1" then
+ If Corr_Low_Dose_Scale.Value = False then
+ Corr_Dose_Type.Value := "";
+ InsulinLowDoseList.IsSelected := (False,False);
+ Elseif Corr_Low_Dose_Scale.Value = True then
+ Corr_Dose_Type.Value := "Low";
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Endif;
+ Endif;
+ If CallingField = "PRX_Corr_Insulin_Scale|2" then
+ If Corr_Mod_Dose_Scale.Value = False then
+ Corr_Dose_Type.Value := "";
+ InsulinModDoseList.IsSelected := (False,False);
+ Elseif Corr_Mod_Dose_Scale.Value = True then
+ Corr_Dose_Type.Value := "Moderate";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Endif;
+ Endif;
+ If CallingField = "PRX_Corr_Insulin_Scale|3" then
+ If Corr_High_Dose_Scale.Value = False then
+ Corr_Dose_Type.Value := "";
+ InsulinHighDoseList.IsSelected := (False,False);
+ Elseif Corr_High_Dose_Scale.Value = True then
+ Corr_Dose_Type.Value := "High";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Endif;
+ Endif;
+ If CallingField = "PRX_Corr_Insulin_Scale|4" then
+ If Corr_Ind_Dose_Scale.Value = False then
+ Corr_Dose_Type.Value := "";
+ InsulinTypeInDoseList.IsSelected := (False,False);
+ Elseif Corr_Ind_Dose_Scale.Value = True then
+ Corr_Dose_Type.Value := "Individualized";
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Endif;
+ Endif;
+
+
+ endif;
+
+
+ // find out how many times nutritional insulin will be administered per day
+
+ If Nutr_Freq_Bkfst_CB.value = true then
+ NutrSel1 := 1;
+ else
+ NutrSel1 := 0;
+ endif;
+ If Nutr_Freq_Lunch_CB.value = true then
+ NutrSel2 := 1;
+ else
+ NutrSel2 := 0;
+ endif;
+ If Nutr_Freq_Dinner_CB.value = true then
+ NutrSel3 := 1;
+ else
+ NutrSel3 := 0;
+ endif;
+ If Nutr_Freq_TID_CB.value = true then
+ NutrSel4 := 3;
+ Nutr_Freq_Bkfst_CB.value := false; NutrSel1 := 0;
+ Nutr_Freq_Lunch_CB.value := false; NutrSel2 := 0;
+ Nutr_Freq_Dinner_CB.value := false; NutrSel3 := 0;
+ else
+ NutrSel4 := 0;
+ endif;
+ If Nutr_Freq_QHS_CB.value = true then
+ NutrSel5 := 1;
+ else
+ NutrSel5 := 0;
+ endif;
+
+ Nutr_Frequency := (NutrSel1 as number) + (NutrSel2 as number) + (NutrSel3 as number) + (NutrSel4 as number) + (NutrSel5 as number);
+
+
+ // calculate nutritional dose based upon adminsitrations per day
+ If Nutr_Frequency = 1 then
+ TDD_half_div := (CalcDoseNutr.Value as number);
+ TDD_Half_div_rnd := int (((TDD_half_div as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv_rnd := TDD_half_div_rnd formatted with "%.0f";
+ NutrDoseValue.Value := fmt_TDD_halfdiv_rnd;
+ elseif (Nutr_Frequency as number) = 2 then
+ TDD_half_div2 := (CalcDoseNutr.Value as number) / 2;
+ TDD_Half_div2_rnd := int (((TDD_half_div2 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv2_rnd := TDD_half_div2_rnd formatted with "%.0f";
+ NutrDoseValue.Value := fmt_TDD_halfdiv2_rnd;
+ elseif Nutr_Frequency = 3 then
+ TDD_half_div3 := (CalcDoseNutr.Value as number) / 3;
+ TDD_Half_div3_rnd := int (((TDD_half_div3 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv3_rnd := TDD_half_div3_rnd formatted with "%.0f";
+ NutrDoseValue.Value := fmt_TDD_halfdiv3_rnd;
+ elseif Nutr_Frequency = 4 then
+ TDD_half_div4 := (CalcDoseNutr.Value as number) / 4;
+ TDD_Half_div4_rnd := int (((TDD_half_div4 as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv4_rnd := TDD_half_div4_rnd formatted with "%.0f";
+ NutrDoseValue.Value := fmt_TDD_halfdiv4_rnd;
+ else
+ NutrDoseValue.Value := null;
+ endif;
+
+
+ // select correct basal insulin from selected insulin checkbox and selected frequency checkbox
+
+ If CallingField = "PRX_Basal_Lantus-Levemir|1" or Basal_Lantus_Levemir_CB.value = True then
+ If Basal_Lantus_Levemir_CB.value = True then
+ Basal_NPH_CB.value := False;
+
+ If Basal_Freq_Daily_CB.value = true and CalcDoseBasal.value is not null then
+
+ BasalDoseValue.Value := CalcDoseBasal.Value as number;
+ BasalInsulinList.IsSelected := (true, false, false, false);
+
+
+ Elseif Basal_Freq_BID_CB.value = true and CalcDoseBasal.value is not null then
+
+ TDD_half_div := (CalcDoseBasal.value as number) / 2;
+ TDD_Half_div_rnd := int (((TDD_half_div as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv_rnd := TDD_half_div_rnd formatted with "%.0f";
+ BasalDoseValue.Value := fmt_TDD_halfdiv_rnd;
+ BasalInsulinList.IsSelected := (false, true, false, false);
+ endif;
+ else
+ If Basal_NPH_CB.value = False then
+ BasalInsulinList.IsSelected := (false, false, false, false);
+ endif;
+ endif;
+ endif;
+
+ If CallingField = "PRX_Basal_NPH-Isophane|1" or Basal_NPH_CB.value = True then
+ If Basal_NPH_CB.value = True then
+ Basal_Lantus_Levemir_CB.value := False;
+
+ If Basal_Freq_Daily_CB.value = true and CalcDoseBasal.value is not null then
+
+ BasalDoseValue.Value := CalcDoseBasal.Value as number;
+ BasalInsulinList.IsSelected := (false, false, true, false);
+
+ Elseif Basal_Freq_BID_CB.value = true and CalcDoseBasal.value is not null then
+
+ TDD_half_div := (CalcDoseBasal.value as number) / 2;
+ TDD_Half_div_rnd := int (((TDD_half_div as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv_rnd := TDD_half_div_rnd formatted with "%.0f";
+ BasalDoseValue.Value := fmt_TDD_halfdiv_rnd ;
+
+ BasalInsulinList.IsSelected := (false, false, false, true);
+
+ endif;
+
+ else
+ If Basal_Lantus_Levemir_CB.value = False then
+ BasalInsulinList.IsSelected := (false, false, false, false);
+ endif;
+ endif;
+ endif;
+ endif;
+
+ If CallingField = "PRX_Basal_Frequency|1" then
+ If Basal_Freq_Daily_CB.value = True then
+ Basal_Freq_BID_CB.value := False;
+
+ If Basal_Freq_Daily_CB.value = true and CalcDoseBasal.value is not null then
+
+ BasalDoseValue.Value := CalcDoseBasal.Value as number;
+
+ If Basal_Lantus_Levemir_CB.value = True then
+ BasalInsulinList.IsSelected := (true, false, false, false);
+ Elseif Basal_NPH_CB.value = True then
+ BasalInsulinList.IsSelected := (false, false, true, false);
+ endif;
+ endif;
+
+ else
+ If Basal_Freq_BID_CB.value = false then
+ BasalInsulinList.IsSelected := (false, false, false, false);
+ endif;
+ endif;
+ endif;
+
+ If CallingField = "PRX_Basal_Frequency|2" then
+ If Basal_Freq_BID_CB.value = True then
+ Basal_Freq_Daily_CB.value := False;
+
+ If Basal_Freq_BID_CB.value = true and CalcDoseBasal.value is not null then
+ TDD_half_div := (CalcDoseBasal.value as number) / 2;
+ TDD_Half_div_rnd := int (((TDD_half_div as number) + 0.5)/1)*1;
+ fmt_TDD_halfdiv_rnd := TDD_half_div_rnd formatted with "%.0f";
+ BasalDoseValue.Value := fmt_TDD_halfdiv_rnd;
+ If Basal_Lantus_Levemir_CB.value = True then
+ BasalInsulinList.IsSelected := (false, true, false, false);
+ Elseif Basal_NPH_CB.value = True then
+ BasalInsulinList.IsSelected := (false, false, false, true);
+ endif;
+ endif;
+
+ else
+ If Basal_Freq_Daily_CB.value = false then
+ BasalInsulinList.IsSelected := (false, false, false, false);
+ endif;
+ endif;
+ endif;
+
+ index_list := 1 seqto (count NutrInsulinList) ;
+
+ If CallingField = "PRX_Insulin_Aspart|1" then
+ If Nutr_Aspart_CB.value = True then
+ index_list := 1 seqto (count NutrInsulinList) ;
+
+ gridvalue := ();
+ Nutr_Regular_CB.value := False;
+ Nutr_Regular_CB.control_read_only := True;
+
+ If (Nutr_Freq_Bkfst_CB.value = true or Nutr_Freq_TID_CB.value = true) and CalcDoseNutr.value is not null then
+ for a in index_list do
+ If a = 1 then
+ gridvalue := gridvalue,"true";
+ else gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+ endif;
+
+ If (Nutr_Freq_Lunch_CB.value = true or Nutr_Freq_TID_CB.value = true) and CalcDoseNutr.value is not null then
+ for a in index_list do
+ If a = 2 then
+ gridvalue := gridvalue, "true";
+ else gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+ endif;
+
+ If (Nutr_Freq_Dinner_CB.value = true or Nutr_Freq_TID_CB.value = true) and CalcDoseNutr.value is not null then
+ for a in index_list do
+ If a = 3 then
+ gridvalue := gridvalue, "true";
+ else gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+ endif;
+
+ If Nutr_Freq_QHS_CB.value = true and CalcDoseNutr.value is not null then
+ for a in index_list do
+ If a = 4 then
+ gridvalue := gridvalue, "true";
+ else gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+ endif;
+
+ If CalcDoseNutr.value is not null then
+ for a in index_list do
+ If a in (6, 7, 8, 9, 10) then
+ gridvalue := gridvalue, "false";
+ else gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+ endif;
+
+ else
+ Nutr_Regular_CB.control_read_only := False;
+ endif;
+ endif;
+
+ If CallingField = "PRX_Insulin_Regular|1" then
+ If Nutr_Regular_CB.value = True then
+ gridvalue := ();
+ Nutr_Aspart_CB.value := False;
+ Nutr_Aspart_CB.control_read_only := True;
+ If (Nutr_Freq_Bkfst_CB.value = true or Nutr_Freq_TID_CB.value = true) and CalcDoseNutr.value is not null then
+ for a in index_list do
+ If a = 6 then
+ gridvalue := gridvalue,"true";
+ else gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+ endif;
+
+ If (Nutr_Freq_Lunch_CB.value = true or Nutr_Freq_TID_CB.value = true) and CalcDoseNutr.value is not null then
+ for a in index_list do
+ If a = 7 then
+ gridvalue := gridvalue, "true";
+ else gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+ endif;
+
+ If (Nutr_Freq_Dinner_CB.value = true or Nutr_Freq_TID_CB.value = true) and CalcDoseNutr.value is not null then
+ for a in index_list do
+ If a = 8 then
+ gridvalue := gridvalue, "true";
+ else gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+ endif;
+
+ If Nutr_Freq_QHS_CB.value = true and CalcDoseNutr.value is not null then
+ for a in index_list do
+ If a = 9 then
+ gridvalue := gridvalue, "true";
+ else gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+ endif;
+
+ If CalcDoseNutr.value is not null then
+ for a in index_list do
+ If a in (1, 2, 3, 4, 5) then
+ gridvalue := gridvalue, "false";
+ else gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+ endif;
+
+ else
+ Nutr_Aspart_CB.control_read_only := False;
+
+ endif;
+ endif;
+
+
+
+ If (CallingField = "PRX_Nutritional_Frequency|1" or
+ CallingField = "PRX_Nutritional_Frequency|2" or
+ CallingField = "PRX_Nutritional_Frequency|3" or
+ CallingField = "PRX_Nutritional_Frequency|4" or
+ CallingField = "PRX_Nutritional_Frequency|5") then
+
+ If Nutr_Aspart_CB.value = True then
+ index_list := 1 seqto (count NutrInsulinList) ;
+
+ gridvalue := ();
+ Nutr_Regular_CB.value := False;
+ Nutr_Regular_CB.control_read_only := True;
+
+
+ for a in index_list do
+
+ If a = 1 and (Nutr_Freq_Bkfst_CB.value = true or Nutr_Freq_TID_CB.value = true) and Nutr_Aspart_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"true";
+ elseif a = 1 and (Nutr_Freq_Bkfst_CB.value = false and Nutr_Freq_TID_CB.value = false)and Nutr_Aspart_CB.value = True and CalcDoseNutr.value is not null then
+
+ gridvalue := gridvalue,"false";
+ elseif a = 1 then
+ gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+
+
+
+ If a = 2 and (Nutr_Freq_Lunch_CB.value = true or Nutr_Freq_TID_CB.value = true) and Nutr_Aspart_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"true";
+ elseif a = 2 and (Nutr_Freq_Lunch_CB.value = false and Nutr_Freq_TID_CB.value = false) and Nutr_Aspart_CB.value = True and CalcDoseNutr.value is not null then
+
+ gridvalue := gridvalue,"false";
+ elseif a= 2 then
+ gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+
+
+
+ If a = 3 and (Nutr_Freq_Dinner_CB.value = true or Nutr_Freq_TID_CB.value = true) and Nutr_Aspart_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"true";
+ elseif a = 3 and (Nutr_Freq_Dinner_CB.value = false and Nutr_Freq_TID_CB.value = false) and Nutr_Aspart_CB.value = True and CalcDoseNutr.value is not null then
+
+ gridvalue := gridvalue,"false";
+ elseif a= 3 then
+ gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+
+
+ If a = 4 and (Nutr_Freq_QHS_CB.value = true ) and Nutr_Aspart_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"true";
+ elseif a = 4 and (Nutr_Freq_QHS_CB.value = false ) and Nutr_Aspart_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"false";
+ elseif a = 4 then
+ gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+
+
+ If a = 5 and Nutr_Aspart_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+
+ If a in (6, 7, 8, 9, 10) then
+ gridvalue := gridvalue,"false";
+ endif;
+ enddo;
+
+ NutrInsulinList.IsSelected:= gridvalue;
+ gridvalue := ();
+
+ ElseIf Nutr_Regular_CB.value = True then
+ index_list := 1 seqto (count NutrInsulinList) ;
+
+ gridvalue := ();
+ Nutr_Aspart_CB.value := False;
+ Nutr_Aspart_CB.control_read_only := True;
+ for a in index_list do
+
+
+ If a in (1, 2, 3, 4, 5) then
+ gridvalue := gridvalue,"false";
+ endif;
+
+ If a = 6 and (Nutr_Freq_Bkfst_CB.value = true or Nutr_Freq_TID_CB.value = true) and Nutr_Regular_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"true";
+ elseif a = 6 and (Nutr_Freq_Bkfst_CB.value = false and Nutr_Freq_TID_CB.value = false) and Nutr_Regular_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"false";
+ elseif a= 6 then
+ gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+
+ If a = 7 and (Nutr_Freq_Lunch_CB.value = true or Nutr_Freq_TID_CB.value = true) and Nutr_Regular_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"true";
+ elseif a = 7 and (Nutr_Freq_Lunch_CB.value = false and Nutr_Freq_TID_CB.value = false) and Nutr_Regular_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"false";
+ elseif a= 7 then
+ gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+
+ If a = 8 and (Nutr_Freq_Dinner_CB.value = true or Nutr_Freq_TID_CB.value = true) and Nutr_Regular_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"true";
+ elseif a = 8 and (Nutr_Freq_Dinner_CB.value = false and Nutr_Freq_TID_CB.value = false) and Nutr_Regular_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"false";
+ elseif a= 8 then
+ gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+
+ If a = 9 and (Nutr_Freq_QHS_CB.value = true ) and Nutr_Regular_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"true";
+ elseif a = 9 and (Nutr_Freq_QHS_CB.value = false ) and Nutr_Regular_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue,"false";
+ elseif a= 9 then
+ gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+
+ If a = 10 and Nutr_Regular_CB.value = True and CalcDoseNutr.value is not null then
+ gridvalue := gridvalue, NutrInsulinList.IsSelected [a];
+ endif;
+ enddo;
+ NutrInsulinList.IsSelected:= gridvalue;
+
+ gridvalue := ();
+ endif;
+
+ endif;
+
+ // select correctional sliding scale if modified or selected from checkboxes
+ If CallingField = "MultiOrderInline|1" then
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "";
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+
+ If InsulinLowDoseList.IsSelected [1] = true and InsulinLowDoseList.IsSelected [2] = false then
+ Corr_Aspart_CB.value := True;
+ Corr_Aspart_CB.Control_Read_Only:= False;
+ Corr_Regular_CB.value := False;
+ Corr_Regular_CB.Control_Read_Only := True;
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "Low";
+
+ Elseif InsulinLowDoseList.IsSelected [1] = false and InsulinLowDoseList.IsSelected [2] = true then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only := True;
+ Corr_Regular_CB.value := True;
+ Corr_Regular_CB.Control_Read_Only := False;
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "Low";
+
+ Elseif InsulinLowDoseList.IsSelected [1] = false and InsulinLowDoseList.IsSelected [2] = false then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only := False;
+ Corr_Regular_CB.value := False;
+ Corr_Regular_CB.Control_Read_Only := False;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "";
+
+ Elseif InsulinLowDoseList.IsSelected [1] = true and InsulinLowDoseList.IsSelected [2] = true then
+ If Corr_Aspart_CB.value = True then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only := True;
+ Corr_Regular_CB.value := true;
+ Corr_Regular_CB.Control_Read_Only := False;
+ InsulinLowDoseList.IsSelected := (False, True);
+ elseif Corr_Regular_CB.value = true then
+ Corr_Regular_CB.value := false;
+ Corr_Regular_CB.Control_Read_Only := True;
+ Corr_Aspart_CB.value := True;
+ Corr_Aspart_CB.Control_Read_Only := false;
+ InsulinLowDoseList.IsSelected := (True, False);
+ endif;
+ Corr_Low_Dose_Scale.Value := True;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "Low";
+ Endif;
+ Endif;
+
+ If CallingField = "MultiOrderInline|2" then
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "";
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+
+ If InsulinModDoseList.IsSelected [1] = true and InsulinModDoseList.IsSelected [2] = false then
+ Corr_Aspart_CB.value := True;
+ Corr_Aspart_CB.Control_Read_Only:= False;
+ Corr_Regular_CB.value := False;
+ Corr_Regular_CB.Control_Read_Only := True;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "Moderate";
+
+ Elseif InsulinModDoseList.IsSelected [1] = false and InsulinModDoseList.IsSelected [2] = true then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only:= True;
+ Corr_Regular_CB.value := True;
+ Corr_Regular_CB.Control_Read_Only := False;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "Moderate";
+
+ Elseif InsulinModDoseList.IsSelected [1] = false and InsulinModDoseList.IsSelected [2] = false then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only:= False;
+ Corr_Regular_CB.value := False;
+ Corr_Regular_CB.Control_Read_Only := False;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "";
+
+ Elseif InsulinModDoseList.IsSelected [1] = true and InsulinModDoseList.IsSelected [2] = true then
+ If Corr_Aspart_CB.value = True then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only := True;
+ Corr_Regular_CB.value := True;
+ Corr_Regular_CB.Control_Read_Only := False;
+ InsulinModDoseList.IsSelected := (False, True);
+ elseif Corr_Regular_CB.value = true then
+ Corr_Regular_CB.value := false;
+ Corr_Regular_CB.Control_Read_Only := true;
+ Corr_Aspart_CB.value := true;
+ Corr_Aspart_CB.Control_Read_Only := false;
+ InsulinModDoseList.IsSelected := (True, False);
+ endif;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := True;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "Moderate";
+ Endif;
+ Endif;
+
+ If CallingField = "MultiOrderInline|3" then
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "";
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+
+ If InsulinHighDoseList.IsSelected [1] = true and InsulinHighDoseList.IsSelected [2] = false then
+ Corr_Aspart_CB.value := True;
+ Corr_Aspart_CB.Control_Read_Only:= False;
+ Corr_Regular_CB.value := False;
+ Corr_Regular_CB.Control_Read_Only := True;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "High";
+
+ Elseif InsulinHighDoseList.IsSelected [1] = false and InsulinHighDoseList.IsSelected [2] = true then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only := True;
+ Corr_Regular_CB.value := True;
+ Corr_Regular_CB.Control_Read_Only := False;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "High";
+
+ Elseif InsulinHighDoseList.IsSelected [1] = false and InsulinHighDoseList.IsSelected [2] = false then
+ Corr_Aspart_CB.value := False;
+ Corr_Regular_CB.value := False;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "";
+
+ Elseif InsulinHighDoseList.IsSelected [1] = true and InsulinHighDoseList.IsSelected [2] = true then
+ If Corr_Aspart_CB.value = True then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only := False;
+ Corr_Regular_CB.value := True;
+ Corr_Regular_CB.Control_Read_Only := False;
+ InsulinHighDoseList.IsSelected := (False, True);
+ elseif Corr_Regular_CB.value = true then
+ Corr_Regular_CB.value := false;
+ Corr_Regular_CB.Control_Read_Only := True;
+ Corr_Aspart_CB.value := true;
+ Corr_Aspart_CB.Control_Read_Only := false;
+ InsulinHighDoseList.IsSelected := (True, False);
+ endif;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := True;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "High";
+ Endif;
+ Endif;
+ If CallingField = "MultiOrderInline|4" then
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "";
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+
+ If InsulinTypeInDoseList.IsSelected [1] = true and InsulinTypeInDoseList.IsSelected [2] = false then
+ Corr_Aspart_CB.value := True;
+ Corr_Aspart_CB.Control_Read_Only:= False;
+ Corr_Regular_CB.value := False;
+ Corr_Regular_CB.Control_Read_Only := True;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := True;
+ Corr_Dose_Type.Value := "Individualized";
+
+ Elseif InsulinTypeInDoseList.IsSelected [1] = false and InsulinTypeInDoseList.IsSelected [2] = true then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only:= True;
+ Corr_Regular_CB.value := True;
+ Corr_Regular_CB.Control_Read_Only := False;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := True;
+ Corr_Dose_Type.Value := "Individualized";
+
+ Elseif InsulinTypeInDoseList.IsSelected [1] = false and InsulinTypeInDoseList.IsSelected [2] = false then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only:= False;
+ Corr_Regular_CB.value := False;
+ Corr_Regular_CB.Control_Read_Only := False;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := False;
+ Corr_Dose_Type.Value := "";
+
+ Elseif InsulinTypeInDoseList.IsSelected [1] = true and InsulinTypeInDoseList.IsSelected [2] = true then
+ If Corr_Aspart_CB.value = True then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.Control_Read_Only:= True;
+ Corr_Regular_CB.value := true;
+ Corr_Regular_CB.Control_Read_Only := false;
+ InsulinTypeInDoseList.IsSelected := (False, True);
+ elseif Corr_Regular_CB.value = true then
+ Corr_Regular_CB.value := false;
+ Corr_Regular_CB.Control_Read_Only := true;
+ Corr_Aspart_CB.value := true;
+ Corr_Aspart_CB.Control_Read_Only := false;
+ InsulinTypeInDoseList.IsSelected := (True, False);
+ endif;
+ Corr_Low_Dose_Scale.Value := False;
+ Corr_Mod_Dose_Scale.Value := False;
+ Corr_High_Dose_Scale.Value := False;
+ Corr_Ind_Dose_Scale.Value := True;
+ Corr_Dose_Type.Value := "Individualized";
+
+ Endif;
+ Endif;
+
+
+ If CallingField = "PRX_Insulin_Aspart|2" or Corr_Aspart_CB.value = True then
+
+ If Corr_Aspart_CB.value = True then
+ Corr_Regular_CB.value := False;
+ Corr_Regular_CB.control_read_only := True;
+ If Corr_Dose_Type.Value = "Low" then
+ InsulinLowDoseList.IsSelected := (True,False);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+ endif;
+
+ If Corr_Dose_Type.Value = "Moderate" then
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (True,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+ endif;
+
+ If Corr_Dose_Type.Value = "High" then
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (True,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+ endif;
+ If Corr_Dose_Type.Value = "Individualized" then
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (True,False);
+ endif;
+
+ If Corr_Dose_Type.Value = "" then
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+ endif;
+
+ else
+ Corr_Regular_CB.control_read_only := False;
+ endif;
+ endif;
+
+ If CallingField = "PRX_Insulin_Regular|2" or Corr_Regular_CB.value = True then
+
+ If Corr_Regular_CB.value = True then
+ Corr_Aspart_CB.value := False;
+ Corr_Aspart_CB.control_read_only := True;
+ If Corr_Dose_Type.Value = "Low" then
+ InsulinLowDoseList.IsSelected := (False,True);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+ endif;
+
+ If Corr_Dose_Type.Value = "Moderate" then
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False,True);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+ endif;
+
+ If Corr_Dose_Type.Value = "High" then
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,True);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+ endif;
+
+ If Corr_Dose_Type.Value = "Individualized" then
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,True);
+ endif;
+
+ If Corr_Dose_Type.Value = "" then
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+ endif;
+
+ else
+
+ Corr_Aspart_CB.control_read_only := False;
+
+ endif;
+ endif;
+
+ If (CallingField = "PRX_Insulin_Aspart|2" and Corr_Aspart_CB.value = False and Corr_Regular_CB.value = False)
+ OR (CallingField = "PRX_Insulin_Regular|2" and Corr_Aspart_CB.value = False and Corr_Regular_CB.value = False) then
+
+ InsulinLowDoseList.IsSelected := (False,False);
+ InsulinModDoseList.IsSelected := (False,False);
+ InsulinHighDoseList.IsSelected := (False,False);
+ InsulinTypeInDoseList.IsSelected := (False,False);
+ Corr_Regular_CB.control_read_only := False;
+ Corr_Aspart_CB.control_read_only := False;
+
+
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_SURG_ANTIBIOTIC_PROPHYLAXIS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_SURG_ANTIBIOTIC_PROPHYLAXIS.mlm
new file mode 100644
index 0000000..7217840
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_SURG_ANTIBIOTIC_PROPHYLAXIS.mlm
@@ -0,0 +1,555 @@
+maintenance:
+
+ title: Surgical Antibiotic Prophylaxis Orders;;
+ mlmname: FORM_Set_Surg_Antibiotic_Prophylaxis;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ;;
+ specialist: Teresa Spicuzza, Allscripts;;
+ date: 2011-04-01;;
+ validation: testing;;
+
+library:
+ purpose: Used for Surgical Antibiotic Prophylaxis Weight Based Dosing
+ ;;
+
+ explanation: This MLM is called from Surgical Antibiotic Prophylaxis Order Set
+
+ Change history
+ 09.21.2011 TMS Moved to Prod
+ 04.09.2013 TMS Modified to change orders to Mini-bags instead of Mini-syringes. Dose calculations and
+ Worx code assignment done on order item MLM instead of order set MLM.
+ 11.13.2015 TMS Updated with changes for cefazolin and cefoxitin dosing and to add additional drugs
+ per order set revision. CSR 33885
+ 11.30.2014 TMS Remove Cefoxitin from list of orders requiring a weight. Order is correct, however if
+ there is no weight on the patient, they are being alerted. HD ticket 1955493
+
+
+
+ ;;
+ keywords: Called MLMs, Antibiotic Prophylaxis, 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";
+
+ // 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;
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+// 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);
+ 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 = " || ClientGuid || " "
+ };
+//
+If patientage < 12 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;
+//
+
+// Define other fields
+ StartNow := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
+ Dose := first of (field_list where field_list.DataItemName = "DosageLow");
+
+ Cefazolin := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 1);
+ Clindamycin := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 2);
+ Cefoxitin := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 3);
+ GentamicinMS := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 4);
+ GentamicinPB := last of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 5);
+
+ CefazolinDose := Cefazolin.Value;
+ ClindamycinDose := Clindamycin.Value;
+ CefoxitinDose := Cefoxitin.Value;
+ GentamicinMSDose := GentamicinMS.Value;
+ GentamicinPBDose := GentamicinPB.Value;
+
+ CefazolinID := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode" and field_List.Control_MultiFieldOccNum = 1);
+ ClindamycinID := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode" and field_List.Control_MultiFieldOccNum = 2);
+ CefoxitinID := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode" and field_List.Control_MultiFieldOccNum = 3);
+ GentamicinMSID := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode" and field_List.Control_MultiFieldOccNum = 4);
+ GentamicinPBID := last of (field_list where field_list.DataItemName = "PRX_DrugIDCode" and field_List.Control_MultiFieldOccNum = 5);
+
+ CefazolinCode := CefazolinID.Value;
+ ClindamycinCode := ClindamycinID.Value;
+ CefoxitinCode := CefoxitinID.Value;
+ GentamicinMSCode := GentamicinMSID.Value;
+ GentamicinPBCode := GentamicinPBID.Value;
+
+ Guidelines1 := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 1);
+ Guidelines2 := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 2);
+ Guidelines3 := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 3);
+ Guidelines4 := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 4);
+ Guidelines5 := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 5);
+ Guidelines6 := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 6);
+ Guidelines7 := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 7);
+
+ GuidelineBox1 := Guidelines1.Value;
+ GuidelineBox2 := Guidelines2.Value;
+ GuidelineBox3 := Guidelines3.Value;
+ GuidelineBox4 := Guidelines4.Value;
+ GuidelineBox5 := Guidelines5.Value;
+ GuidelineBox6 := Guidelines6.Value;
+ GuidelineBox7 := Guidelines7.Value;
+
+ RequestedTime1 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1);
+ RequestedTime2 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2);
+ RequestedTime3 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3);
+ RequestedTime4 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 4);
+ RequestedTime5 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 5);
+ RequestedTime6 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 6);
+ RequestedTime7 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 7);
+ RequestedTime8 := last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 8);
+ RequestedDate9 := last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 9);
+
+ Grid1Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Grid1Orders_List := Grid1Orders.Value;
+ Grid2Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Grid2Orders_List := Grid2Orders.Value;
+ Grid3Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Grid3Orders_List := Grid3Orders.Value;
+ Grid4Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 4);
+ Grid4Orders_List := Grid4Orders.Value;
+ Grid5Orders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 5);
+ Grid5Orders_List := Grid5Orders.Value;
+
+ Found_Cefazolin := first of (Grid1Orders_List where Grid1Orders_List.Name = "Cefazolin:");
+ Found_Vancomycin := first of (Grid1Orders_List where Grid1Orders_List.Name = "Vancomycin:");
+ Found_Clindamycin := first of (Grid2Orders_List where Grid2Orders_List.Name = "Clindamycin:");
+ Found_Clindamycin2 := last of (Grid2Orders_List where Grid2Orders_List.Name = "Clindamycin:");
+ Found_Vancomycin2 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Vancomycin:");
+ Found_GentamicinMS := first of (Grid2Orders_List where Grid2Orders_List.Name = "Gentamicin Mini-Syringe:");
+ Found_GentamicinPB := last of (Grid2Orders_List where Grid2Orders_List.Name = "Gentamicin:");
+ Found_Cefoxitin := last of (Grid3Orders_List where Grid3Orders_List.Name = "Cefoxitin:");
+ Found_Clindamycin3 := last of (Grid4Orders_List where Grid4Orders_List.Name = "Clindamycin:");
+ Found_Gentamicin2MB := first of (Grid4Orders_List where Grid4Orders_List.Name = "Gentamicin: Mini-Syringe:");
+ Found_Gentamicin2PB := last of (Grid4Orders_List where Grid4Orders_List.Name = "Gentamicin:");
+ Found_Cipro500 := last of (Grid5Orders_List where Grid5Orders_List.Name = "Ciprofloxacin 500mg Tab");
+ Found_Cipro750 := last of (Grid5Orders_List where Grid5Orders_List.Name = "Ciprofloxacin 750mg Tab");
+ Found_Pip_Taz := last of (Grid5Orders_List where Grid5Orders_List.Name = "Piperacillin/Tazobactam:");
+ CefazolinBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 1);
+ CefazolinBoxValue := CefazolinBox.Value;
+
+ VancomycinBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 2);
+ VancomycinBoxValue := VancomycinBox.Value;
+
+ ClindamycinBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 3);
+ ClindamycinBoxValue := ClindamycinBox.Value;
+
+ Vancomycin2Box := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 4);
+ Vancomycin2BoxValue := Vancomycin2Box.Value;
+
+ ClindaGentBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 5);
+ ClindaGentBoxValue := ClindaGentBox.Value;
+
+ PCNAllergyBox1 := last of (field_list where field_list.DataItemName = "PRX_Checkbox1" and field_List.Control_MultiFieldOccNum = 6);
+ PCNAllergyBox1Value := PCNAllergyBox1.Value;
+
+ UnasynBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox2" and field_List.Control_MultiFieldOccNum = 1);
+ UnasynBoxValue := UnasynBox.Value;
+
+ CefoxitinBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox2" and field_List.Control_MultiFieldOccNum = 2);
+ CefoxitinBoxValue := CefoxitinBox.Value;
+
+ ClindaGent2Box := last of (field_list where field_list.DataItemName = "PRX_Checkbox2" and field_List.Control_MultiFieldOccNum = 3);
+ ClindaGent2BoxValue := ClindaGent2Box.Value;
+
+ MetronGentBox := last of (field_list where field_list.DataItemName = "PRX_Checkbox2" and field_List.Control_MultiFieldOccNum = 4);
+ MetronGentBoxValue := MetronGentBox.Value;
+
+ PCNAllergyBox2 := last of (field_list where field_list.DataItemName = "PRX_Checkbox2" and field_List.Control_MultiFieldOccNum = 5);
+ PCNAllergyBox2Value := PCNAllergyBox2.Value;
+
+ AdminInstruct := last of (field_list where field_list.DataItemName = "AdminInstructions" and field_List.Control_MultiFieldOccNum = 1);
+ AdminInstructValue := AdminInstruct.Value;
+
+// Obtain Coded Allergen Guids
+(AllergenGuids) := read
+{ " select guid from cv3allergen where code like {{{SINGLE-QUOTE}}}Penicill%{{{SINGLE-QUOTE}}}"};
+
+// Retrieve coded and possible typed in allergies to penicillin
+(PCNAllergy) := read last
+ { " Select Status from CV3AllergyDeclaration "
+ || " where ((clientvisitguid = " || SQL(clientvisitguid) || ") and "
+ || " ((Text like {{{SINGLE-QUOTE}}}penicil%{{{SINGLE-QUOTE}}} or text like {{{SINGLE-QUOTE}}}%pcn%{{{SINGLE-QUOTE}}}) and Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and TypeCodeForOther = {{{SINGLE-QUOTE}}}drug{{{SINGLE-QUOTE}}} )) or "
+ || " ((clientvisitguid = " || SQL(clientvisitguid) || ") and "
+ || " (AllergenGUID in ( " ||SQL(allergenguids) || ") and Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}})) "
+ };
+
+// Check for MRSA Result
+
+(ResultValue) := read last
+{"SELECT tol.text "
+|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
+|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
+|| " and o.orderstatuscode In ({{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}}) "
+|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
+|| " left join cv3BasicObservation bo with (nolock) on bo.OrderGuid = o.guid and bo.clientguid = " || SQL(clientguid) || " and bo.chartguid = " || SQL(chartguid) || " and bo.clientvisitguid = " || SQL(clientvisitguid)
+|| " and bo.itemname = {{{SINGLE-QUOTE}}}culture{{{SINGLE-QUOTE}}} "
+|| " left join cv3textualobservationline tol with (nolock) on tol.observationguid = bo.guid and tol.clientguid = " || SQL(clientguid)
+|| " order by o.significantdtm " };
+
+ if ResultValue = "METHICILLIN RESISTANT STAPHYLOCOCCUS AUREUS" then MRSAPositive := "Yes"; else MRSAPositive := "No"; endif;
+
+// Check for MRSA Flag
+
+(MRSAHist) := read last
+{ " select case when EnterpriseClientcol8 in ({{{SINGLE-QUOTE}}}MRSA{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Both{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} end "
+|| " from cv3enterpriseclientdata where clientguid = " || SQL(clientguid) || " " };
+ if exist MRSAHist then MRSAHistory := "Yes"; else MRSAHistory := "No"; endif;
+
+ If (VancomycinBoxValue = True or CefazolinBoxValue = True or ClindamycinBoxValue = True or ClindaGentBoxValue = True
+ or Vancomycin2BoxValue or ClindaGent2BoxValue = True or MetronGentBoxValue = True) and weightvalue = 0 then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Please enter a weight to calculate dosing.","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+CurrentLocation := read last
+ {"Select CurrentLocation "
+ ||" From cv3Clientvisit "
+ ||" Where Guid = " || SQL(ClientVisitGuid)
+ ||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" };
+
+ If CallingEvent = "FormOpen" then
+ GuidelineBox1.IsReadOnly := (True);
+ GuidelineBox2.IsReadOnly := (True);
+ GuidelineBox3.IsReadOnly := (True);
+ GuidelineBox4.IsReadOnly := (True);
+ GuidelineBox5.IsReadOnly := (True);
+ GuidelineBox6.IsReadOnly := (True);
+ GuidelineBox7.IsReadOnly := (True);
+ Grid2Orders_List.IsReadOnly := (True,True,True,True);
+ Grid1Orders_List.IsReadOnly := (True,True);
+ Grid3Orders_List.IsReadOnly := (True,True);
+ Grid4Orders_List.IsReadOnly := (True,True,True,True);
+ AdminInstruct.value := "Begin < 60 minutes prior to start of procedure.";
+ If CurrentLocation = "St. Clair Hospital Anc" then
+ RequestedTime1.control_visible := false;
+ RequestedTime2.control_visible := false;
+ RequestedTime3.control_visible := false;
+ RequestedTime4.control_visible := false;
+ RequestedTime5.control_visible := false;
+ RequestedTime6.control_visible := false;
+ RequestedTime7.control_visible := false;
+ RequestedTime8.control_visible := false;
+ RequestedDate9.control_visible := false;
+ // UnasynBox.control_visible := false;
+ // NeoErythBox.Control_Read_Only := true;
+ endif;
+
+ endif;
+
+/*
+ If CallingEvent in ("FormOpen", "FieldChange") then
+ If (weightvalue > 0 and weightvalue < 80) and patientage >= 12 then
+ Cefazolin.Value := 1;
+ Clindamycin.Value := 600;
+ Cefoxitin.Value := 1;
+ CefazolinID.Value := "08498";
+ ClindamycinID.Value := "08508";
+ CefoxitinID.Value := "08515";
+ endif;
+ If patientage < 12 then
+ CefazolinID.Value := "08498";
+ ClindamycinID.Value := "08508";
+ CefoxitinID.Value := "08515";
+ endif;
+ If weightvalue >= 80 then
+ Cefazolin.Value := 2;
+ Clindamycin.Value := 900;
+ Cefoxitin.Value := 2;
+ CefazolinID.Value := "08499";
+ ClindamycinID.Value := "08509";
+ CefoxitinID.Value := "08516";
+ endif;
+ If weightvalue = 0 then
+ Cefazolin.Value := Null;
+ Clindamycin.Value := Null;
+ Cefoxitin.Value := Null;
+ CefazolinID.Value := "";
+ ClindamycinID.Value := "";
+ CefoxitinID.Value := "";
+ endif;
+
+ endif;
+
+// Calc Gent Dose
+rawdose := weightvalue * 1.5;
+ If patientage >= 12 then
+ gentdose := INT((rawdose + 5)/10)*10;
+ else
+ gentdose := INT((rawdose + 2.5)/5)*5;
+ endif;
+
+ if gentdose >0 and gentdose <= 250 then
+ GentamicinMS.Value :=gentdose; GentamicinMSID.Value := "02060"; GentType := "MS";
+ else
+ GentamicinPB.Value := gentdose; GentamicinPBID.Value := "00062"; GentType := "PB";
+ endif;
+
+if gentdose = 40 then GentamicinMS.Value := gentdose; GentamicinMSID.Value := "08582"; GentType := "MS"; endif;
+if gentdose = 60 then GentamicinMS.Value := gentdose; GentamicinMSID.Value := "08513"; GentType := "MS"; endif;
+if gentdose = 80 then GentamicinMS.Value := gentdose; GentamicinMSID.Value := "08390"; GentType := "MS"; endif;
+if gentdose = 100 then GentamicinMS.Value := gentdose; GentamicinMSID.Value := "08392"; GentType := "MS"; endif;
+if gentdose = 120 then GentamicinMS.Value := gentdose; GentamicinMSID.Value := "00191"; GentType := "MS"; endif;
+*/
+If CallingEvent = "FieldChange" then
+ // Not Requiring GI Prophylaxis Cefazolin
+ If CallingField = "PRX_Checkbox1|1" then
+ If CefazolinBoxValue = True then
+ Found_Cefazolin.IsSelected := True;
+ ClindamycinBox.control_read_only := True;
+ Vancomycin2Box.control_read_only := True;
+ ClindaGentBox.control_read_only := True;
+ Found_Clindamycin.control_read_only := True;
+ Grid1Orders_List.IsReadOnly := (False,True);
+
+ If (MRSAPositive = "Yes" or MRSAHistory = "Yes") and (PCNAllergy <> "Active" or PCNAllergy is null) then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Your patient may be flagged as MRSA Positive, consider ordering Vancomycin in addition to Cefazolin.","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+ If PCNAllergy = "Active" and MRSAPositive = "No" and MRSAHistory = "No" then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Your patient may have a documented allergy to Penicillin, please review Allergies before continuing. ","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+ If (MRSAPositive = "Yes" or MRSAHistory = "Yes") and PCNAllergy = "Active" then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Your patient may be flagged as MRSA Positive. " || "\n - and - " || "\n Your patient may have a documented allergy to Penicillin. " || "\n\n Please review before ordering.","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+ else
+
+ Found_Cefazolin.IsSelected := False;
+ Found_Vancomycin.IsSelected := False;
+ ClindamycinBox.control_read_only := False;
+ ClindaGentBox.control_read_only := False;
+ Vancomycin2Box.control_read_only := False;
+ VancomycinBox.value := False;
+ Grid1Orders_List.IsReadOnly := (True,True);
+ endif;
+ endif;
+ // Not Requiring GI Prophylaxis MRSA Vancomycin
+ If CallingField = "PRX_Checkbox1|2" then
+ If VancomycinBoxValue = True then
+ Found_Vancomycin.IsSelected := True;
+ Found_Cefazolin.IsSelected := True;
+ CefazolinBox.Value:= True;
+ ClindamycinBox.control_read_only := True;
+ ClindaGentBox.control_read_only := True;
+ Vancomycin2Box.control_read_only := True;
+ Grid1Orders_List.IsReadOnly := (False,False);
+ else
+ Found_Vancomycin.IsSelected := False;
+ Grid1Orders_List.IsReadOnly := (False,True);
+ endif;
+ endif;
+ // Not Requiring GI Prophylaxis PCN Allergy Clindamycin
+ If CallingField = "PRX_Checkbox1|3" then
+ If ClindamycinBoxValue = True then
+ Found_Clindamycin.IsSelected := True;
+ CefazolinBox.control_read_only := True;
+ VancomycinBox.control_read_only := True;
+ Vancomycin2Box.control_read_only := True;
+ ClindaGentBox.control_read_only := True;
+ PCNAllergyBox1.Control_read_only := True;
+ Grid2Orders_List.IsReadOnly := (False,True,True,True);
+ else
+ Found_Clindamycin.IsSelected := False;
+ CefazolinBox.control_read_only := False;
+ VancomycinBox.control_read_only := False;
+ Vancomycin2Box.control_read_only := False;
+ ClindaGentBox.control_read_only := False;
+ PCNAllergyBox1.Control_read_only := False;
+ Grid2Orders_List.IsReadOnly := (True,True,True,True);
+ endif;
+ endif;
+ // Not Requiring GI Prophylaxis PCN Allergy Vancomycin
+ If CallingField = "PRX_Checkbox1|4" then
+ If Vancomycin2BoxValue = True then
+ Found_Vancomycin2.IsSelected := True;
+ VancomycinBox.control_read_only := True;
+ ClindamycinBox.control_read_only := True;
+ CefazolinBox.control_read_only := True;
+ ClindaGentBox.control_read_only := True;
+ PCNAllergyBox1.Control_read_only := True;
+ Grid2Orders_List.IsReadOnly := (True,False,True,True);
+ else
+ Found_Vancomycin2.IsSelected := False;
+ CefazolinBox.control_read_only := False;
+ VancomycinBox.control_read_only := False;
+ ClindamycinBox.control_read_only := False;
+ ClindaGentBox.control_read_only := False;
+ PCNAllergyBox1.Control_read_only := False;
+ Grid2Orders_List.IsReadOnly := (True,True,True,True);
+ endif;
+ endif;
+ // Not Requiring GI Prophylaxis PCN Allergy OB Gyne Clindamycin-Gentamicin
+ If CallingField = "PRX_Checkbox1|5" then
+ If ClindaGentBoxValue = True then
+ Grid2Orders_List.IsSelected := (False,False,True,True);
+ Grid2Orders_List.IsReadOnly := (True,True,False,False);
+ VancomycinBox.control_read_only := True;
+ ClindamycinBox.control_read_only := True;
+ CefazolinBox.control_read_only := True;
+ Vancomycin2Box.control_read_only := True;
+ PCNAllergyBox1.Control_read_only := True;
+ Else
+ Grid2Orders_List.IsSelected := (False,False,False,False);
+ Grid2Orders_List.IsReadOnly := (True,True,True,True);
+ VancomycinBox.control_read_only := False;
+ ClindamycinBox.control_read_only := False;
+ CefazolinBox.control_read_only := False;
+ Vancomycin2Box.control_read_only := False;
+ PCNAllergyBox1.Control_read_only := False;
+ endif;
+ endif;
+
+ If CallingField = "PRX_Checkbox1|6" then
+ If PCNAllergyBox1Value = True then
+
+ AdminInstruct.Value := "May give with Reported PCN allergy. Begin < 60 minutes prior to start of procedure.";
+ else
+ AdminInstruct.Value := "Begin < 60 minutes prior to start of procedure.";
+ endif;
+ endif;
+ // Colorectal Surgeries Cefoxitin or Unasyn
+ If (CallingField = "PRX_Checkbox2|1") then
+ If UnasynBoxValue = True then
+ Grid3Orders_List.IsSelected := (False,True);
+ Grid3Orders_List.IsReadOnly := (True,False);
+ ClindaGent2Box.control_read_only := True;
+ CefoxitinBox.control_read_only := True;
+ MetronGentBox.control_read_only := True;
+ else
+ Grid3Orders_List.IsSelected := (False,False);
+ Grid3Orders_List.IsReadOnly := (True,True);
+ ClindaGent2Box.control_read_only := False;
+ CefoxitinBox.control_read_only := False;
+ MetronGentBox.control_read_only := False;
+ endif;
+ endif;
+ If (CallingField = "PRX_Checkbox2|2") then
+ If CefoxitinBoxValue = True then
+ Grid3Orders_List.IsSelected := (True,False);
+ Grid3Orders_List.IsReadOnly := (False,True);
+ ClindaGent2Box.control_read_only := True;
+ UnasynBox.control_read_only := True;
+ MetronGentBox.control_read_only := True;
+ else
+ Grid3Orders_List.IsSelected := (False,False);
+ Grid3Orders_List.IsReadOnly := (True,True);
+ ClindaGent2Box.control_read_only := False;
+ UnasynBox.control_read_only := False;
+ MetronGentBox.control_read_only := False;
+ endif;
+ endif;
+
+ // Colorectal Surgeries Penicillin Allergy Clindamycin plus Gentamicin
+ If CallingField = "PRX_Checkbox2|3" then
+ If ClindaGent2BoxValue = True then
+
+ Grid4Orders_List.IsSelected := (True,True,False,False);
+ Grid4Orders_List.IsReadOnly := (False,False,True,True );
+ UnasynBox.control_read_only := True;
+ CefoxitinBox.control_read_only := True;
+ MetronGentBox.control_read_only := True;
+ Else
+ Grid4Orders_List.IsSelected := (False,False,False,False);
+ Grid4Orders_List.IsReadOnly := (True,True,True,True);
+ UnasynBox.control_read_only := False;
+ CefoxitinBox.control_read_only := False;
+ MetronGentBox.control_read_only := False;
+ endif;
+ endif;
+ // Colorectal Surgeries Penicillin Allergy Metronidazole plus Gentamicin
+ If CallingField = "PRX_Checkbox2|4" then
+ If MetronGentBoxValue = True then
+
+ Grid4Orders_List.IsSelected := (False,False,True,True);
+ Grid4Orders_List.IsReadOnly := (True,True,False,False);
+ UnasynBox.control_read_only := True;
+ CefoxitinBox.control_read_only := True;
+ ClindaGent2Box.control_read_only := True;
+ Else
+ Grid4Orders_List.IsSelected := (False,False,False,False);
+ Grid4Orders_List.IsReadOnly := (True,True,True,True);
+ UnasynBox.control_read_only := False;
+ CefoxitinBox.control_read_only := False;
+ ClindaGent2Box.control_read_only := False;
+ endif;
+ endif;
+
+ If CallingField = "PRX_Checkbox2|5" then
+ If PCNAllergyBox2Value = True then
+
+ AdminInstruct.Value := "May give with Reported PCN allergy. Begin < 60 minutes prior to start of procedure.";
+ else
+ AdminInstruct.Value := "Begin < 60 minutes prior to start of procedure.";
+ endif;
+ endif;
+
+ If CallingEvent = "FieldChange" then
+ If Found_Cipro500.IsSelected = True then Grid5Orders_List.IsReadOnly := (False, True,True);
+ elseIf Found_Cipro750.IsSelected = True then Grid5Orders_List.IsReadOnly := (True, False, True);
+ elseIf Found_Pip_Taz.IsSelected = True then Grid5Orders_List.IsReadOnly := (True,True,False);
+ else Grid5Orders_List.IsReadOnly := (False, False,False);
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_THORACENTESIS_LABS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_THORACENTESIS_LABS.mlm
new file mode 100644
index 0000000..a0a6ae2
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_THORACENTESIS_LABS.mlm
@@ -0,0 +1,261 @@
+maintenance:
+
+ title: FORM_SET_THORACENTESIS_LABS;;
+ mlmname: FORM_SET_THORACENTESIS_LABS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Maria Pest, Allscripts;;
+ date: 2012-12-03;;
+ validation: testing;;
+
+library:
+ purpose: Lab orders entered on Thoracentesis and Paracentesis Order Sets need to display on MI and Cytology requisitions
+ ;;
+
+ explanation: This MLM is called from ...
+
+ Change history
+ 2012.12.03 JML CSR 30985: Created
+ 2014.07.28 STH CSR 31956: Rewrote MLM to work based on Bryans MLM specs. Also created a copy of this original MLM to still be used by the Thoracentesis Specimen Handling (CCM) Order set.
+ The copied MLM was re-named to FORM_SET_CCM_THORA_SPEC_HAND
+
+
+
+ ;;
+ keywords: Called MLMs, Thoracentesis, Paracentesis
+ ;;
+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";
+
+ generic_item_control := mlm {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{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;
+
+
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ FormName := this_form.Name;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+
+ //Retrieve fields
+ Labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Labs_fld_List := Labs_fld.Value;
+
+ US_Thor_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 2);
+ US_Thor_fld_List := US_Thor_fld.Value;
+
+ righ_labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
+ and field_list.Control_MultiFieldOccNum = 1);
+ right_labs_list := righ_labs_fld.Value;
+
+ left_labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
+ and field_list.Control_MultiFieldOccNum = 2);
+ left_labs_list := left_labs_fld.Value;
+
+ tbd_labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
+ and field_list.Control_MultiFieldOccNum = 3);
+ tbd_labs_list := left_labs_fld.Value;
+
+ fld_sideSpecific := last of (field_list WHERE field_list.DataItemName = "MI_MR_VO_OBR31P2_Thoracentesis");
+ fld_diagtherapy := last of (field_list WHERE field_list.DataItemName = "MI_MR_VO_OBR31P2_Thora Diag/Thera");
+
+ SideSelected := fld_sideSpecific.value;
+ DiagSelected := fld_diagtherapy.value;
+
+ Labs_Right_Left_fld := last of (field_list WHERE field_list.DataItemName = "LAB_VO_Right or Left");
+ //and field_list.Control_MultiFieldOccNum = 1);
+
+ Labs_Right_Left2_fld := last of (field_list WHERE field_list.DataItemName = "LAB_SREQ_VO_DI_Left or Right");
+ //and field_list.Control_MultiFieldOccNum = 1);
+
+ Labs_List_fld := last of (field_list WHERE field_list.DataItemName = "Labs on Centesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ Cytology_List_fld := last of (field_list WHERE field_list.DataItemName = "Cytology on Centesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+
+ if (CallingEvent = "FieldChange") then
+
+ if (CallingField = "MI_MR_VO_OBR31P2_Thoracentesis|1" or CallingField = "MI_MR_VO_OBR31P2_Thora Diag/Thera|1") then
+ if ((DiagSelected <> "Therapeutic Process") and (DiagSelected <> "")) then
+
+ if SideSelected = "Left" then
+ righ_labs_fld.Value.IsSelected := false;
+ tbd_labs_fld.Value.IsSelected := false;
+ left_labs_fld.Value.IsSelected := true;
+
+ elseif SideSelected = "Right" then
+ righ_labs_fld.Value.IsSelected := true;
+ left_labs_fld.Value.IsSelected := false;
+ tbd_labs_fld.Value.IsSelected := false;
+
+ elseif Sideselected = "Right and Left" then
+ righ_labs_fld.Value.IsSelected := true;
+ left_labs_fld.Value.IsSelected := true;
+ tbd_labs_fld.Value.IsSelected := false;
+
+ elseif Sideselected = "TBD by IR" then
+ righ_labs_fld.Value.IsSelected := false;
+ left_labs_fld.Value.IsSelected := false;
+ tbd_labs_fld.Value.IsSelected := true;
+
+ else
+ righ_labs_fld.Value.IsSelected := false;
+ left_labs_fld.Value.IsSelected := false;
+ tbd_labs_fld.Value.IsSelected := false;
+
+ endif;
+
+
+ else
+ righ_labs_fld.Value.IsSelected := false;
+ left_labs_fld.Value.IsSelected := false;
+ tbd_labs_fld.Value.IsSelected := false;
+ endif;
+
+ endif;
+
+ leftlabs := "";
+ rightlabs := "";
+ tbdlabs := "";
+ leftcytology := "";
+ rightcytology := "";
+ tbdcytology := "";
+ cytology := "";
+
+ for i in 1 seqto (count right_labs_list.Name) do
+ if (not (right_labs_list.Name[i] matches pattern "%Cytology%")) then
+ if (righ_labs_fld.Value.IsSelected[i]) then
+ if (rightlabs IS NULL) then
+ rightlabs := right_labs_list.Name[i];
+ else
+ rightlabs := rightlabs || ", " || right_labs_list.Name[i];
+ endif;
+ endif;
+ else
+ if (righ_labs_fld.Value.IsSelected[i]) then
+ if (rightcytology IS NULL) then
+ rightcytology := right_labs_list.Name[i];
+ else
+ rightcytology := rightcytology || ", " || right_labs_list.Name[i];
+ endif;
+ endif;
+ endif;
+ enddo;
+
+ for i in 1 seqto (count left_labs_list.Name) do
+ if (not (left_labs_list.Name[i] matches pattern "%Cytology%")) then
+ if (left_labs_fld.Value.IsSelected[i]) then
+ if (leftlabs IS NULL) then
+ leftlabs := left_labs_list.Name[i];
+ else
+ leftlabs := leftlabs || ", " || left_labs_list.Name[i];
+ endif;
+ endif;
+ else
+ if (left_labs_fld.Value.IsSelected[i]) then
+ if (leftcytology IS NULL) then
+ leftcytology := left_labs_list.Name[i];
+ else
+ leftcytology := leftcytology || ", " || left_labs_list.Name[i];
+ endif;
+ endif;
+ endif;
+ enddo;
+
+ for i in 1 seqto (count tbd_labs_list.Name) do
+ if (not (tbd_labs_list.Name[i] matches pattern "%Cytology%")) then
+ if (tbd_labs_fld.Value.IsSelected[i]) then
+ if (tbdlabs IS NULL) then
+ tbdlabs := tbd_labs_list.Name[i];
+ else
+ tbdlabs := tbdlabs || ", " || tbd_labs_list.Name[i];
+ endif;
+ endif;
+ else
+ if (tbd_labs_fld.Value.IsSelected[i]) then
+ if (tbdcytology IS NULL) then
+ tbdcytology := tbd_labs_list.Name[i];
+ else
+ tbdcytology := tbdcytology || ", " || tbd_labs_list.Name[i];
+ endif;
+ endif;
+ endif;
+
+ enddo;
+ Labs_List_fld.Value := "";
+ Cytology_List_fld.Value := "";
+ if leftlabs <> "" and leftlabs is not null then
+ Labs_List_fld.Value := "Left Labs: " || leftlabs || CR || LF;
+ endif;
+ if leftcytology <> "" and leftcytology is not null then
+ Cytology_List_fld.Value := "Left Cytology: " || leftcytology || CR || LF;
+ endif;
+ if rightlabs <> "" and rightlabs is not null then
+ Labs_List_fld.Value := Labs_List_fld.Value || "Right Labs: " || rightlabs || CR || LF;
+ endif;
+ if rightcytology <> "" and rightcytology is not null then
+ Cytology_List_fld.Value := Cytology_List_fld.Value || "Right Cytology: " || rightcytology || CR || LF;
+ endif;
+
+ if tbdlabs <> "" and tbdlabs is not null then
+ Labs_List_fld.Value := Labs_List_fld.Value || "TBD Labs: " || tbdlabs || CR || LF;
+ endif;
+
+ if tbdcytology <> "" and tbdcytology is not null then
+ Cytology_List_fld.Value := Cytology_List_fld.Value || "TBD Cytology: " || tbdcytology || CR || LF;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_THORACENTESIS_PARACENTESIS_LABS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_THORACENTESIS_PARACENTESIS_LABS.mlm
new file mode 100644
index 0000000..d75694e
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_THORACENTESIS_PARACENTESIS_LABS.mlm
@@ -0,0 +1,376 @@
+maintenance:
+
+ title: FORM_SET_THORACENTESIS_PARACENTESIS_LABS;;
+ mlmname: FORM_SET_THORACENTESIS_PARACENTESIS_LABS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Maria Pest, Allscripts;;
+ date: 2012-12-03;;
+ validation: testing;;
+
+library:
+ purpose: Lab orders entered on Thoracentesis and Paracentesis Order Sets need to display on MI and Cytology requisitions
+ ;;
+
+ explanation: This MLM is called from ...
+
+ Change history
+ 2012.12.03 JML CSR 30985: Created
+
+
+
+ ;;
+ keywords: Called MLMs, Thoracentesis, Paracentesis
+ ;;
+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";
+
+ generic_item_control := mlm {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}};
+ ccm_thoracentesis := mlm {{{SINGLE-QUOTE}}}FORM_SET_CCM_THORACENTESIS{{{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;
+
+
+ /*******************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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ FormName := this_form.Name;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+
+ //Retrieve fields
+ Labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Labs_fld_List := Labs_fld.Value;
+
+ US_Thor_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 2);
+ US_Thor_fld_List := US_Thor_fld.Value;
+
+ CCM_Left_Thor_fld := last of (field_list WHERE field_list.DataItemName = "CCM Left Thoracentesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+ CCM_Left_Thor_fld_List := CCM_Left_Thor_fld.Value;
+
+ CCM_Right_Thor_fld := last of (field_list WHERE field_list.DataItemName = "CCM Right Thoracentesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+ CCM_Right_Thor_fld_List := CCM_Right_Thor_fld.Value;
+
+ CCM_LR_Thor_fld := last of (field_list WHERE field_List.DataItemName = "CCM L/R Thoracentesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+ CCM_LR_Thor_fld_List := CCM_LR_Thor_fld.Value;
+
+ CCM_Left_Thor_Labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 2);
+ CCM_Left_Labs_List := CCM_Left_Thor_Labs_fld.Value;
+
+ CCM_Right_Thor_Labs_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
+ and field_list.Control_MultiFieldOccNum = 3);
+ CCM_Right_Labs_List := CCM_Right_Thor_Labs_fld.Value;
+
+ Labs_Right_Left_fld := last of (field_list WHERE field_list.DataItemName = "LAB_VO_Right or Left");
+ //and field_list.Control_MultiFieldOccNum = 1);
+
+ Labs_Right_Left2_fld := last of (field_list WHERE field_list.DataItemName = "LAB_SREQ_VO_DI_Left or Right");
+ //and field_list.Control_MultiFieldOccNum = 1);
+
+ Labs_List_fld := last of (field_list WHERE field_list.DataItemName = "Labs on Centesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Cytology_List_fld := last of (field_list WHERE field_list.DataItemName = "Cytology on Centesis"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ if (CallingEvent = "FieldChange") then
+ //Applies to Order Set(s) US Thoracentesis and US Paracentesis
+ if (CallingField = "MultiOrderGrid|2") then
+ (this_communication, this_form) := call generic_item_control WITH (this_communication, this_form, client_info_obj);
+
+ if (US_Thor_fld_List.IsSelected[1] = true) then
+
+ //Above MLM call checks all of the labs; populate text boxes
+ for i in 1 seqto (count Labs_fld_List.Name) do
+ if (not (Labs_fld_List.Name[i] matches pattern "%Cytology%")) then
+ if (Labs_List_fld.Value IS NULL) then
+ Labs_List_fld.Value := Labs_fld_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || Labs_fld_List.Name[i];
+ endif;
+ else
+ if (Cytology_List_fld.Value IS NULL) then
+ Cytology_List_fld.Value := Labs_fld_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || Labs_fld_List.Name[i];
+ endif;
+ endif;
+ enddo;
+ else
+ Labs_List_fld.Value := null;
+ Cytology_List_fld.Value := null;
+
+ endif;
+ //Applies to Order Set(s) US Thoracentesis, SP Thoracentesis, CT Thoracentesis,
+ // US Paracentesis, SP Paracentesis, CT Paracentesis
+ elseif (CallingField = "MultiOrderCheckbox|1") then
+
+ if (Labs_Right_Left_fld.Value IS NOT NULL) then
+ if (Labs_Right_Left_fld.Value matches pattern "%Left%") then
+ Labs_List_fld.Value := "Left: ";
+ Cytology_List_fld.Value := "Left: ";
+ elseif (Labs_Right_Left_fld.Value matches pattern "%Right%") then
+ Labs_List_fld.Value := "Right: ";
+ Cytology_List_fld.Value := "Right: ";
+ else
+ Labs_List_fld.Value := "";
+ Cytology_List_fld.Value := "";
+ endif;
+ else
+ Labs_List_fld.Value := "";
+ Cytology_List_fld.Value := "";
+ endif;
+
+ for i in 1 seqto (count Labs_fld_List.Name) do
+ if (not (Labs_fld_List.Name[i] matches pattern "%Cytology%")) then
+ if (Labs_fld_List.IsSelected[i]) then
+ if (Labs_List_fld.Value = "") then
+ Labs_List_fld.Value := Labs_fld_List.Name[i];
+ elseif (Labs_List_fld.Value = "Left: " OR Labs_List_fld.Value = "Right: ") then
+ Labs_List_fld.Value := Labs_List_fld.Value || Labs_fld_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || Labs_fld_List.Name[i];
+ endif;
+ endif;
+ else
+ if (Labs_fld_List.IsSelected[i]) then
+ if (Cytology_List_fld.Value = "") then
+ Cytology_List_fld.Value := Labs_fld_List.Name[i];
+ elseif (Cytology_List_fld.Value = "Left: " OR Cytology_List_fld.Value = "Right: ") then
+ Cytology_List_fld.Value := Cytology_List_fld.Value || Labs_fld_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || Labs_fld_List.Name[i];
+ endif;
+ endif;
+ endif;
+ enddo;
+ elseif (CallingField = "LAB_VO_Right or Left|1") then
+ new_string := Labs_List_fld.Value;
+ new_string2 := Cytology_List_fld.Value;
+
+ //Need to test if preceeding {{{SINGLE-QUOTE}}}right{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}left{{{SINGLE-QUOTE}}} already exists
+ rt_side_loc := FIND "Right:" IN STRING Labs_List_fld.Value;
+ if (rt_side_loc = 0) then
+ lt_side_loc := FIND "Left: " IN STRING Labs_List_fld.Value;
+ if (lt_side_loc > 0) then
+ new_string := SUBSTRING ((Length Labs_List_fld.Value) - (Length "Left: ")) CHARACTERS STARTING AT 7 FROM Labs_List_fld.Value;
+ endif;
+ elseif (rt_side_loc > 0) then
+ new_string := SUBSTRING ((Length Labs_List_fld.Value) - (Length "Right: ")) CHARACTERS STARTING AT 8 FROM Labs_List_fld.Value;
+ endif;
+
+ Labs_List_fld.Value := new_string;
+
+ rt_side_loc2 := FIND "Right: " IN STRING Cytology_List_fld.Value;
+ if (rt_side_loc2 = 0) then
+ lt_side_loc2 := FIND "Left: " IN STRING Cytology_List_fld.Value;
+ if (lt_side_loc2 > 0) then
+ new_string2 := SUBSTRING ((LENGTH Cytology_List_fld.Value) - (LENGTH "Left: ")) CHARACTERS STARTING AT 7 FROM Cytology_List_fld.Value;
+ endif;
+ else
+ new_string2 := SUBSTRING ((LENGTH Cytology_List_fld.Value) - (LENGTH "Right: ")) CHARACTERS STARTING AT 8 FROM Cytology_List_fld.Value;
+ endif;
+
+ Cytology_List_fld.Value := new_string2;
+
+ if (Labs_Right_Left_fld.Value matches pattern "%Left%") then
+ Labs_Right_Left2_fld.Value := "Fluid Collected Left Side (LEFT)";
+ lab_side := "Left: ";
+ elseif (Labs_Right_Left_fld.Value matches pattern "%Right%") then
+ Labs_Right_Left2_fld.Value := "Fluid Collected Right Side (RI)";
+ lab_side := "Right: ";
+ endif;
+
+ if (Labs_List_fld.Value is not null) then
+ Labs_List_fld.Value := lab_side || Labs_List_fld.Value;
+ endif;
+ if (Cytology_List_fld.Value is not null) then
+ Cytology_List_fld.Value := lab_side || Cytology_List_fld.Value;
+ endif;
+ //Applies to Order Set Thoracentesis Specimen Handling for CCM (Dr. Fino)
+ elseif (CallingField = "CCM Left Thoracentesis|1" OR CallingField = "CCM Right Thoracentesis|1"
+ OR CallingField = "CCM L/R Thoracentesis|1") then
+
+ (this_communication, this_form) := call ccm_thoracentesis with (this_communication, this_form, client_info_obj);
+
+ //Populate with all right, left, or both labs
+ if (CallingField = "CCM Left Thoracentesis|1") then
+ if (CCM_Left_Thor_fld_List = true) then
+ for i in 1 seqto (Count CCM_Left_Labs_List.Name) do
+ if (not (CCM_Left_Labs_List.Name[i] matches pattern "%Cytology%")) then
+ if (Labs_List_fld.Value IS NULL) then
+ Labs_List_fld.Value := "Left side: " || CCM_Left_Labs_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ else
+ if (Cytology_List_fld.Value IS NULL) then
+ Cytology_List_fld.Value := "Left side: " || CCM_Left_Labs_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ endif;
+ enddo;
+ else
+ Labs_List_fld.Value := null;
+ Cytology_List_fld.Value := null;
+ endif;
+ elseif (CallingField = "CCM Right Thoracentesis|1") then
+ if (CCM_Right_Thor_fld_List = true) then
+
+ for i in 1 seqto (count CCM_Right_Labs_List.Name) do
+ if (not (CCM_Right_Labs_List.Name[i] matches pattern "%Cytology%")) then
+ if (Labs_List_fld.Value IS NULL) then
+ Labs_List_fld.Value := "Right side: " || CCM_Right_Labs_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Right_Labs_List.Name[i];
+ endif;
+ else
+ if (Cytology_List_fld.Value IS NULL) then
+ Cytology_List_fld.Value := "Right side: " || CCM_Right_Labs_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Right_Labs_List.Name[i];
+ endif;
+ endif;
+ enddo;
+ else
+ Labs_List_fld.Value := null;
+ Cytology_List_fld.Value := null;
+ endif;
+ elseif (CallingField = "CCM L/R Thoracentesis|1") then
+ if (CCM_LR_Thor_fld_List = true) then
+ for i in 1 seqto (count CCM_Left_Labs_List.Name) do
+ if (not (CCM_Left_Labs_List.Name[i] matches pattern "%Cytology%")) then
+ if (Labs_List_fld.Value IS NULL) then
+ Labs_List_fld.Value := "Left side: " || CCM_Left_Labs_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ else
+ if (Cytology_List_fld.Value IS NULL) then
+ Cytology_List_fld.Value := "Left side: " || CCm_Left_Labs_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ endif;
+ enddo;
+ for j in 1 seqto (count CCM_Right_Labs_List.Name) do
+ if (not (CCM_Right_Labs_List.Name[j] matches pattern "%Cytology%")) then
+ if (not (Labs_List_fld.Value matches pattern "%Right side:%")) then
+ Labs_List_fld.Value := Labs_List_fld.Value || CR || LF || "Right side: " || CCM_Right_Labs_List.Name[j];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Right_Labs_List.Name[j];
+ endif;
+ else
+ if (not (Cytology_List_fld.Value matches pattern "%Right side:%")) then
+ Cytology_List_fld.Value := Cytology_List_fld.Value || CR || LF || "Right side: " || CCM_Right_Labs_List.Name[j];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Right_Labs_List.Name[j];
+ endif;
+ endif;
+ enddo;
+ else
+ Labs_List_fld.Value := null;
+ Cytology_List_fld.Value := Null;
+ endif;
+ endif;
+ //Applies to Order Set Thoracentesis Specimen Handling for CCM (Dr. Fino)
+ elseif (CallingField = "MultiOrderCheckbox|2" OR CallingField = "MultiOrderCheckbox|3") then
+ Labs_List_fld.Value := "";
+ Cytology_List_fld.Value := "";
+ for i in 1 seqto (count CCM_Left_Labs_List.Name) do
+ if (not (CCM_Left_Labs_List.Name[i] matches pattern "%Cytology%")) then
+ if (CCM_Left_Labs_List.IsSelected[i]) then
+ if (Labs_List_fld.Value = "") then
+ Labs_List_fld.Value := "Left side: " || CCM_Left_Labs_List.Name[i];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ endif;
+ else
+ if (CCM_Left_Labs_List.IsSelected[i]) then
+ if (Cytology_List_fld.Value = "") then
+ Cytology_List_fld.Value := "Left side: " || CCM_Left_Labs_List.Name[i];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Left_Labs_List.Name[i];
+ endif;
+ endif;
+ endif;
+ enddo;
+ for j in 1 seqto (count CCM_Right_Labs_List.Name) do
+ if (not (CCM_Right_Labs_List.Name[j] matches pattern "%Cytology%")) then
+ if (CCM_Right_Labs_List.IsSelected[j]) then
+ if (not (Labs_List_fld.Value matches pattern "%Right side:%")) then
+ Labs_List_fld.Value := Labs_List_fld.Value || CR || LF || "Right side: " || CCM_Right_Labs_List.Name[j];
+ else
+ Labs_List_fld.Value := Labs_List_fld.Value || ", " || CCM_Right_Labs_List.Name[j];
+ endif;
+ endif;
+ else
+ if (CCM_Right_Labs_List.IsSelected[j]) then
+ if (not (Cytology_List_fld.Value matches pattern "%Right side:%")) then
+ Cytology_List_fld.Value := Cytology_List_fld.Value || CR || LF || "Right side: " || CCM_Right_Labs_List.Name[j];
+ else
+ Cytology_List_fld.Value := Cytology_List_fld.Value || ", " || CCM_Right_Labs_List.Name[j];
+ endif;
+ endif;
+ endif;
+ enddo;
+ endif;
+ elseif (CallingEvent = "FormClose") then
+ if (Labs_List_fld.Value = "Left:" OR Labs_List_fld.Value = "Right:") then
+ Labs_List_fld.Value := "";
+ endif;
+ if (Cytology_List_fld.Value = "Left:" OR Cytology_List_fld.Value = "Right:") then
+ Cytology_List_fld.Value := "";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TIA_ADDENDUM.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TIA_ADDENDUM.mlm
new file mode 100644
index 0000000..98cfe5a
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TIA_ADDENDUM.mlm
@@ -0,0 +1,100 @@
+maintenance:
+
+ title: Generic Form Control for Order Sets;;
+ mlmname: FORM_Set_TIA_Addendum;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair;;
+ author: Shawn Head, Eclipsys Corp ext 7468;;
+ specialist: Maria Pest, Eclipsys Corp ext 7443;;
+ date: 2012-08-01;;
+ validation: testing;;
+
+library:
+ purpose: Used to select grid items on order set forms.
+ ;;
+
+ explanation: Following this strategy to improve CPOE turnaround
+
+Change history
+
+ 08-06-2012 STH CSR #: 30685 - Created to handle selecting all items in grid(s) based on "OS_Checkbox 1" observation being selected/de-selected
+
+ ;;
+ keywords: Generic, FormOpen, Item select, update items, CPOE, CPOE updates, CPOE items
+ ;;
+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;
+
+ field_list:= this_form.fields;
+ formitemtype := ();
+ formitemnumber := ();
+
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := FALSE;
+
+ callinggdataitemname := "OS_Checkbox 1";
+
+ formitemtype := ("MultiOrderCheckBox");
+
+ formitemnumber := (1);
+
+
+ /***************************************************************************************/
+
+ list_false_true := mlm {{{SINGLE-QUOTE}}}UTIL_LIST_FALSE_TRUE{{{SINGLE-QUOTE}}}; //used to disable/enable the update grid item(s) to the value passed in
+ //to the MLM. If yous end true all items are disabled if you send false all items
+ //are enabled. Originally developed by robert spence
+
+
+
+ // Initialize error message
+ error_message:="";
+
+ // get the list of configured items to be updates based on the form item MLMGenericItemControl
+
+ itemlist := ();
+ itemstf := ();
+
+ itemselected := ();
+ itemname := ();
+
+ itemselected := last of (field_list.Value where field_list.DataItemName = callinggdataitemname);
+ itemname := (field_list.Label where field_list.DataItemName = callinggdataitemname);
+ //cycle through all items added to the grid(s) and update based on the observation item "OS_Checkbox 1" being selected/de-selected
+ for x in (1 seqto count formitemtype) do
+
+ itemlist := last of (field_list.Value where field_list.DataItemName = formitemtype[x]
+ and field_List.Control_MultiFieldOccNum = formitemnumber[x]);
+
+ itemstf := call list_false_true with itemlist.IsSelected, itemselected;
+
+ itemlist.IsSelected := itemstf;
+
+ enddo;
+
+
+;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TIKOSYN_ELECTROLYTE.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TIKOSYN_ELECTROLYTE.mlm
new file mode 100644
index 0000000..cc3ee15
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TIKOSYN_ELECTROLYTE.mlm
@@ -0,0 +1,482 @@
+maintenance:
+
+ title: Set Tikosyn order set with automatic electrolyte lab ordering date ;;
+ mlmname: FORM_Set_Tikosyn_Electrolyte ;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: St. Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: Sarah Nelson, Amy Georgulis ;;
+ date: 2017-08-28;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation: This MLM is called from the Tikosyn order set, form: PRX_OsTikosynElectro
+
+ Change history
+
+ 08.28.2017 SZ CSR #34930 - Tikosyn Automatic Electrolyte Ordering - Initial build - derived from FORM_Set_Lovenox_Orders_Inj as a model
+
+ ;;
+ keywords: Tikosyn, dofetilide, serum creatinine, potassium, magnesium, electrolyte lab ordering, automatic
+ ;;
+ citations:
+ ;;
+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;
+
+
+ primary_obj := this_communication.PrimaryObj;
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ user_guid := this_communication.UserGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ current_time := NOW as time;
+ current_hour := extract hour NOW;
+
+ //Find the baseline order checkbox that may need to be ordered with this protocol
+
+ Labs_Baseline_field := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 1);
+ Labs_Baseline_List := Labs_Baseline_field.Value;
+ Baseline_BMP := first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Basic Metabolic Panel");
+ Baseline_CMP := first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Comprehensive Metabolic Panel");
+ Baseline_Creatinine := first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Creatinine");
+ Baseline_Potassium := first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Potassium Plasma/Serum");
+ Baseline_Magnesium := first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Magnesium Plasma/Serum");
+ Baseline_ECG := first of (Labs_Baseline_list where Labs_Baseline_list.Name = "EKG 12 Lead");
+
+ //Find the daily lab orders for creatinine, potassium, and magnesium that need to accompany the
+ //creatinine lab orders
+ Lab_Daily_Order_field_1 := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_Order_List_1 := Lab_Daily_Order_field_1.Value;
+
+ //potassium lab orders
+ Lab_Daily_Order_field_2 := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Lab_Daily_Order_List_2 := Lab_Daily_Order_field_2.Value;
+
+ //magnesium lab orders
+ Lab_Daily_Order_field_3 := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 4);
+ Lab_Daily_Order_List_3 := Lab_Daily_Order_field_3.Value;
+
+ // Find the 5 Requested Date fields - #1 is visible, #2 - #5 are hidden
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+
+ //Grab the order info box
+ order_info_box := first of (field_list where field_list.DataItemName = "PRX_OrderSet_Duplicate_Info");
+
+ //Find if any of the med boxes are checked...if so, set Med_Was_Selected to "yes"
+ Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ // Med_GridC := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 4);
+ Med_List := Med_Grid.Value;
+ //Med_ListC :=Med_GridC.Value;
+ Med_SelList := Med_List.IsSelected;
+ //Med_SelListC := Med_ListC.IsSelected;
+ Med_Selected := true in Med_SelList;
+ //Med_SelectedC := true in Med_SelListC;
+ If (Med_Selected = True) then
+ Med_Was_Selected := "yes";
+ else Med_Was_Selected := "no" ;
+ endif;
+
+ // identify each tikosyn order item
+ tikosyn_125 := Med_List[1];
+ tikosyn_250 := Med_List[2];
+ tikosyn_500 := Med_List[3];
+
+/**************************** rules start below *************************************************/
+
+ // if user selects any of the tikosyn orders then gray out other options and prevent selection
+ If (CallingEvent = "FieldChange") and (CallingField = "MultiOrderGrid|1") Then
+ if tikosyn_125.IsSelected = true then
+ //tikosyn_125.IsReadOnly := true;
+ tikosyn_250.IsSelected := false;
+ tikosyn_250.IsReadOnly := true;
+ tikosyn_500.IsSelected := false;
+ tikosyn_500.IsReadOnly := true;
+ elseif tikosyn_250.IsSelected = true then
+ //tikosyn_250.IsReadOnly := true;
+ tikosyn_125.IsReadOnly := true;
+ tikosyn_125.IsSelected := false;
+ tikosyn_500.IsReadOnly := true;
+ tikosyn_500.IsSelected := false;
+ elseif tikosyn_500.IsSelected = true then
+ //tikosyn_500.IsReadOnly := true;
+ tikosyn_125.IsReadOnly := true;
+ tikosyn_125.IsSelected := false;
+ tikosyn_250.IsReadOnly := true;
+ tikosyn_250.IsSelected := false;
+ else
+ tikosyn_125.IsReadOnly := false;
+ tikosyn_125.IsSelected := false;
+ tikosyn_250.IsReadOnly := false;
+ tikosyn_250.IsSelected := false;
+ tikosyn_500.IsReadOnly := false;
+ tikosyn_500.IsSelected := false;
+ endif;
+ endif;
+
+
+
+ // if a tikosyn order was selected then auto-select all daily lab orders and allow selection/removal of them
+ If (CallingEvent = "FieldChange") then
+
+ if (Med_Was_Selected = "yes") then
+
+ // New feature: If Tikosyn is a home med in the OMR, then do not check boxes for daily labs, only necessary baseline labs
+ tikosyn_home_med := read last {
+ "SELECT p.DrugName"
+ ||" FROM SXAAMBClientPrescription p with (nolock) JOIN SXAAMBDrugCategoryXRef xr with (nolock)"
+ ||" ON p.GenericNameID = xr.GenericNameID"
+ ||" JOIN SXAAMBDrugCategory dc with (nolock)"
+ ||" ON xr.DrugCategoryID = dc.DrugCategoryID"
+ ||" WHERE p.ClientGUID = " || sql(client_guid)
+ ||" and (p.DrugName like {{{SINGLE-QUOTE}}}%dofetilide%{{{SINGLE-QUOTE}}} or p.DrugName like {{{SINGLE-QUOTE}}}%tikosyn%{{{SINGLE-QUOTE}}})"
+ ||" and StatusType <> 8"
+ };
+
+ // if tikosyn is a home med then do not check the boxes for daily lab orders
+ if (exist tikosyn_home_med) then
+
+ Lab_Daily_Order_List_1.IsReadOnly := (false, false, false);
+ Lab_Daily_Order_List_2.IsReadOnly := (false, false, false);
+ Lab_Daily_Order_List_3.IsReadOnly := (false, false, false);
+ Baseline_BMP.IsReadOnly := false;
+ Baseline_CMP.IsReadOnly := false;
+ Baseline_Creatinine.IsReadOnly := false;
+ Baseline_Potassium.IsReadOnly := false;
+ Baseline_Magnesium.IsReadOnly := false;
+ Baseline_ECG.IsReadOnly := false;
+
+ order_info_box.Value := "Tikosyn (dofetilide) found in OMR, patient is resuming therapy here. Daily labs are NOT required, but baseline labs are.";
+
+ else
+
+ Lab_Daily_Order_List_1.IsSelected := (True,True,True);
+ Lab_Daily_Order_List_2.IsSelected := (True,True,True);
+ Lab_Daily_Order_List_3.IsSelected := (True,True,True);
+ Lab_Daily_Order_List_1.IsReadOnly := (false, false, false);
+ Lab_Daily_Order_List_2.IsReadOnly := (false, false, false);
+ Lab_Daily_Order_List_3.IsReadOnly := (false, false, false);
+ Baseline_BMP.IsReadOnly := false;
+ Baseline_CMP.IsReadOnly := false;
+ Baseline_Creatinine.IsReadOnly := false;
+ Baseline_Potassium.IsReadOnly := false;
+ Baseline_Magnesium.IsReadOnly := false;
+ Baseline_ECG.IsReadOnly := false;
+
+ order_info_box.Value := "Tikosyn (dofetilide) NOT found in OMR, patient is new to therapy. Daily and baseline labs may be required for ongoing monitoring.";
+
+ endif;
+
+
+ // feature: SQL for baseline labs that were ordered within the past 24 hours, if they were ordered then do not reorder (uncheck).
+ // example: if magnesium plasma ordered 4 hours ago then do not check that on the list
+ (baseline_existing_list) := read {
+ "select "
+ ||" case when ocmi.name like {{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}"
+ ||" when ocmi.name like {{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}}"
+ ||" when ocmi.name like {{{SINGLE-QUOTE}}}%Creatinine%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}}"
+ ||" when ocmi.name = {{{SINGLE-QUOTE}}}Potassium Plasma/Serum{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}4{{{SINGLE-QUOTE}}}"
+ ||" when ocmi.name = {{{SINGLE-QUOTE}}}Magnesium Plasma/Serum{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}5{{{SINGLE-QUOTE}}}"
+ ||" when ocmi.name = {{{SINGLE-QUOTE}}}EKG 12 Lead{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}6{{{SINGLE-QUOTE}}}"
+ ||" end"
+ ||" from cv3ordercatalogmasteritem ocmi with (nolock)"
+ ||" join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid"
+ ||" where"
+ ||" o.clientguid = " || sql(client_guid)
+ ||" and o.chartguid = " || sql(chart_guid)
+ ||" and o.clientvisitguid = " || sql(visit_guid)
+ ||" and o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70)"
+ ||" and (ocmi.name like {{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}} "
+ ||" or ocmi.name like {{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}}"
+ ||" or ocmi.name like {{{SINGLE-QUOTE}}}%Creatinine%{{{SINGLE-QUOTE}}}"
+ ||" or ocmi.name = {{{SINGLE-QUOTE}}}Potassium Plasma/Serum{{{SINGLE-QUOTE}}}"
+ ||" or ocmi.name = {{{SINGLE-QUOTE}}}Magnesium Plasma/Serum{{{SINGLE-QUOTE}}}"
+ ||" or ocmi.name = {{{SINGLE-QUOTE}}}EKG 12 Lead{{{SINGLE-QUOTE}}})"
+ ||" and o.entered >= DATEADD(day, -1, GETDATE())"
+ };
+
+ basline_bmp_existing := 1 IS IN (baseline_existing_list as number);
+ basline_cmp_existing := 2 IS IN (baseline_existing_list as number);
+ basline_creatinine_existing := 3 IS IN (baseline_existing_list as number);
+ basline_potassium_existing := 4 IS IN (baseline_existing_list as number);
+ basline_magnesium_existing := 5 IS IN (baseline_existing_list as number);
+ basline_ECG_existing := 6 IS IN (baseline_existing_list as number);
+
+
+ /**************** true/false switches ************************/
+ // if baseline BMP and baseline CMP do not exist (being false)
+ // then check if baseline creatinine or potassium exist
+ //if either is missing as well then check the box to order them
+
+ if (basline_bmp_existing = false) and (basline_cmp_existing = false) then
+ if (basline_creatinine_existing = false) then
+ Baseline_Creatinine.IsSelected := true;
+ endif;
+ if (basline_potassium_existing = false) then
+ Baseline_Potassium.IsSelected := true;
+ endif;
+ endif;
+
+
+ // notifying user if any baseline labs were not selected to be ordered
+ if true in (basline_bmp_existing, basline_cmp_existing, basline_creatinine_existing, basline_potassium_existing, basline_magnesium_existing) then
+
+
+ if exists order_info_box.Value then
+ order_info_box.Value := order_info_box.Value || " Baseline labs were already ordered within the past 24 hours. Therefore, they do not need to be reordered.";
+ else
+ order_info_box.Value := "Baseline labs were already ordered within the past 24 hours. Therefore, they do not need to be reordered.";
+ endif;
+
+ endif;
+
+
+ if (basline_magnesium_existing = false) then
+ Baseline_Magnesium.IsSelected := true;
+ endif;
+
+ if (basline_ECG_existing = false) then
+ Baseline_ECG.IsSelected := true;
+ endif;
+
+ // this happens when Tikosyn order is unchecked in order grid 1
+ else
+ Lab_Daily_Order_List_1.IsSelected := (False,False,False);
+ Lab_Daily_Order_List_2.IsSelected := (False,False,False);
+ Lab_Daily_Order_List_3.IsSelected := (False,False,False);
+
+ Baseline_BMP.IsSelected := false;
+ Baseline_CMP.IsSelected := false;
+ Baseline_Creatinine.IsSelected := false;
+ Baseline_Potassium.IsSelected := false;
+ Baseline_Magnesium.IsSelected := false;
+ Baseline_ECG.IsSelected := false;
+ order_info_box.Value := "";
+
+ endif; // if (Med_Was_Selected = "yes") then
+
+
+ endif; // If (CallingEvent = "FieldChange")
+
+
+/**************************** Remove Labs rules ***************************************************/
+
+
+ // when "remove labs" is selected all daily order labs are deselected
+ if (CallingField) = "Checkbox|1" then
+ Lab_Daily_Order_List_1.IsSelected := (false, false, false);
+ Lab_Daily_Order_List_2.IsSelected := (false, false, false);
+ Lab_Daily_Order_List_3.IsSelected := (false, false, false);
+ endif;
+
+
+
+/**************************** Requested Date rules ***************************************************/
+
+
+ // if the requested date field changes then update all of the orders
+ If (CallingEvent = "FieldChange") and (CallingField = "RequestedDate|1") then
+
+ //Sets the 2 remaining order set date fields based on the starting date
+ //First lab orders are directly mapped to the "Requested Date" field that user can change
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " "; // sets tomorrow{{{SINGLE-QUOTE}}}s date/time in string format
+ tom_dte := first(tom_list);
+
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ // if the "requested date" is set to anything before tomorrow, it throws a dialog box error
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")";
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif; // If lesstomorrow = true then
+
+ startdate:= primreqdate.value; // used to calculate dates for hidden fields below
+ secreqdate.value := startdate + 1 days; // sets hidden field "RequestedDate - Lab 2", that field is mapped to lab orders "scheduled date"
+ thirdreqdate.value := startdate + 2 days; // sets hidden field "RequestedDate - Lab 3", that field is mapped to lab orders "scheduled date"
+
+ endif; // If (CallingEvent = "FieldChange") and (CallingField = "RequestedDate|1") then
+
+
+
+
+/**************************** Form Open rules ***************************************************/
+
+
+ // upon FormOpen, make all daily lab orders and baseline labs read only
+ // also sets hidden fields so that when a med is selected, the dates populate up to the orders "Scheduled Date"
+ If (CallingEvent = "FormOpen") then
+
+ Lab_Daily_Order_List_1.IsReadOnly := (True,True,True);
+ Lab_Daily_Order_List_2.IsReadOnly := (True,True,True);
+ Lab_Daily_Order_List_3.IsReadOnly := (True,True,True);
+ Baseline_BMP.IsReadOnly := true;
+ Baseline_CMP.IsReadOnly := true;
+ Baseline_Creatinine.IsReadOnly := true;
+ Baseline_Potassium.IsReadOnly := true;
+ Baseline_Magnesium.IsReadOnly := true;
+ Baseline_ECG.IsReadOnly := true;
+
+ startdate:= primreqdate.value; // used to calculate dates for hidden fields below
+ secreqdate.value := startdate + 1 days; // sets hidden field "RequestedDate - Lab 2", that field is mapped to lab orders "scheduled date"
+ thirdreqdate.value := startdate + 2 days; // sets hidden field "RequestedDate - Lab 3", that field is mapped to lab orders "scheduled date"
+
+ endif; // If CallingEvent = "FormOpen" then
+
+
+
+/**************************** Form Close rules ***************************************************/
+
+// upon form close
+ // create a prompt asking user if they would like to reorder additional electrolytes
+ // if {{{SINGLE-QUOTE}}}yes{{{SINGLE-QUOTE}}} is selected, then continue
+
+ If (CallingEvent = "FormClose") then
+
+ // feature: If Tikosyn is a home med in the OMR, then do not present prompt upon form close
+ tikosyn_home_med := read last {
+ "SELECT p.DrugName"
+ ||" FROM SXAAMBClientPrescription p with (nolock) JOIN SXAAMBDrugCategoryXRef xr with (nolock)"
+ ||" ON p.GenericNameID = xr.GenericNameID"
+ ||" JOIN SXAAMBDrugCategory dc with (nolock)"
+ ||" ON xr.DrugCategoryID = dc.DrugCategoryID"
+ ||" WHERE p.ClientGUID = " || sql(client_guid)
+ ||" and (p.DrugName like {{{SINGLE-QUOTE}}}%dofetilide%{{{SINGLE-QUOTE}}} or p.DrugName like {{{SINGLE-QUOTE}}}%tikosyn%{{{SINGLE-QUOTE}}})"
+ ||" and StatusType <> 8"
+ };
+
+ if (not exist tikosyn_home_med) then
+
+ //Retrieve last tikosyn orders
+ (tikosyn_active_order) := READ {
+ "select o.name"
+ ||" from cv3ordercatalogmasteritem as ocmi with (nolock)"
+ ||" join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid"
+ ||" and o.ClientGUID = " || client_guid || " and o.ChartGUID = " || chart_guid || " and o.ClientVisitGUID= " || visit_guid || " "
+ ||" and (o.name like {{{SINGLE-QUOTE}}}%dofetilide%{{{SINGLE-QUOTE}}})"
+ ||" and o.OrderStatusLevelNum >= 15"
+ };
+
+ tikosyn_order_build_variants := ("Dofetilide 250mcg Cap", "Dofetilide 125mcg Cap", "Dofetilide 500mcg Cap");
+ build_variant_count := count tikosyn_order_build_variants;
+ x := ();
+ first_tikosyn_order := true;
+
+ // checks if this would be the patient{{{SINGLE-QUOTE}}}s first tikosyn order
+ // by checking SQL to see if it matches any of the tikosyn order build variants
+ for x in (1 seqto build_variant_count) do
+
+ this_order := tikosyn_order_build_variants[x];
+
+ if (this_order is in tikosyn_active_order) then
+ first_tikosyn_order := false;
+ endif;
+ enddo;
+
+ // if it{{{SINGLE-QUOTE}}}s not the first tikosyn order, ask user if they would like EKGs for first 3 days
+ if (first_tikosyn_order = false) then
+ // checks if this would be a reorder
+ if (EVOKINGOBJECT.Name is in tikosyn_active_order) then
+ tikosyn_reorder := true;
+ else
+ tikosyn_reorder := false;
+ endif;
+ endif;
+
+ // prompt user only if the reorder of tikosyn is a different dose (not a reorder)
+ // if user selects Yes, then create labs
+ // if user selects No, do not create labs
+ if (first_tikosyn_order = false and tikosyn_reorder = false) then
+
+ // check to see if any daily lab orders are selected, if so then continue with prompt.
+ all_daily_lab_orders := (Lab_Daily_Order_List_1.IsSelected, Lab_Daily_Order_List_2.IsSelected, Lab_Daily_Order_List_3.IsSelected);
+
+ // check to see if any daily lab orders are selected, if so then continue with prompt.
+ if (true is in all_daily_lab_orders) then
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ Messagetext := "Patient has already received Tikosyn this visit and is ordered all required electrolytes for the first 3 days of therapy. Do you want to order ADDITIONAL electrolytes for the next 3 days? " ||
+ "\n\nSelecting {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} will add it to the order worksheet." ||
+ "\n\nSelecting {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} will uncheck them from order form."
+ ;
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with Messagetext ,"Dofetilide (Tikosyn) Electrolyte Orders","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult as string) = "No") then
+ Lab_Daily_Order_List_1.IsSelected := (False,False,False);
+ Lab_Daily_Order_List_2.IsSelected := (False,False,False);
+ Lab_Daily_Order_List_3.IsSelected := (False,False,False);
+
+ Baseline_Creatinine.IsSelected := false;
+ Baseline_Potassium.IsSelected := false;
+ Baseline_Magnesium.IsSelected := false;
+ Baseline_ECG.IsSelected := false;
+
+ endif; // if((dialogResult as string) = "No") then
+
+ endif; // if (true is in all_daily_lab_orders) then
+
+ endif; //if (first_tikosyn_order = false and tikosyn_reorder = false) then
+
+ endif; //if (not exist tikosyn_home_med) then
+
+ endif; // If (CallingEvent = "FormClose") then
+
+
+ Order_management_mlm := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Order_management_mlm with this_communication, this_form, client_info_obj;
+
+
+ ;;
+ priority: 50
+ ;;
+ 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;
+
+ ;;
+Urgency: 50;;
+end:', N'f929b0d7-5142-4bcf-9599-a29f6416d3d4', 2, N'Set Tikosyn order set with automatic electrolyte lab ordering date', N'2.5', N'1.00', CAST(N'2017-08-28T00:00:00.000' AS DateTime), N'78ab2d8a-220d-e911-80f9-005056ad099c')
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TORADOL_WITH_IBUPROFEN.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TORADOL_WITH_IBUPROFEN.mlm
new file mode 100644
index 0000000..68914dc
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TORADOL_WITH_IBUPROFEN.mlm
@@ -0,0 +1,236 @@
+maintenance:
+
+ title: Toradol with Ibuprofen on Order Set;;
+ mlmname: FORM_Set_Toradol_with_Ibuprofen;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Debbie Eiler, Allscripts ;;
+ specialist: Shawn Head, Allscripts;;
+ date: 2013-10-14;;
+ validation: testing;;
+
+library:
+ purpose: schedule Ibuprofen for 6 hours after last dose of Toradol
+ ;;
+
+ explanation: This MLM is called from the FBC C Section Order Set
+
+ Change history
+ 10.14.2013 STH Created as a break/fix solution for FBC C Setion Order set.
+ 02.03.2014 STH Trackit Ticket #: 163421 correct issue with Hold session
+ 04.26.2016 TMS CSR 33465: Add call on Form Close to Medication Order Management MLM
+ ;;
+ keywords: Called MLMs, FBC C section, Toradol, Ibuprofen
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Communication object Form object Arden ClientInfo object
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ field_list := this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ itemnames := field_list.value.name;
+
+ ketorolac_selected := false;
+ IBU_selected := false;
+ freqOccNum := ();
+ RequestedDateOccNum := ();
+ RequestedTimeOccNum := ();
+ for x in (1 seqto count(field_list)) do
+ fielditem_values := field_list[x].value;
+ itemnames := fielditem_values.name;
+ selected := fielditem_values.isselected;
+ if ("Ketorolac Inj" in itemnames) or ("Ibuprofen 800mg Tab" in itemnames) then
+ for j in (1 seqto count(itemnames)) do
+ if itemnames[j] = "Ketorolac Inj" and selected[j] = true then
+ ketorolac_selected := true;
+ endif;
+ if itemnames[j] = "Ibuprofen 800mg Tab" and selected[j] = true then
+ IBU_selected := true;
+ endif;
+ enddo;
+ endif;
+
+ if trim(field_list[x].DataItemName) = "FrequencyCode" then
+ freqOccNum := freqOccNum, field_list[x].Control_MultiFieldOccNum;
+ endif;
+
+ if trim(field_list[x].DataItemName) = "RequestedDate" then
+ RequestedDateOccNum := RequestedDateOccNum, field_list[x].Control_MultiFieldOccNum;
+ endif;
+
+ if trim(field_list[x].DataItemName) = "RequestedTime" then
+ RequestedTimeOccNum := RequestedTimeOccNum, field_list[x].Control_MultiFieldOccNum;
+ endif;
+
+ enddo;
+
+
+
+// FORM CLOSE EVENT SECTION
+
+ If CallingEvent = "FormClose" and ketorolac_selected = true and IBU_selected = true Then
+
+
+ freqOccNum := sort Data freqOccNum;
+ RequestedDateOccNum := sort data RequestedDateOccNum;
+ RequestedTimeOccNum := sort data RequestedTimeOccNum;
+
+ FrequencyCode_Toradol := first of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = freqOccNum[1]);
+ StartDate_Toradol := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = RequestedDateOccNum[1]);
+ StartTime_Toradol := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = RequestedTimeOccNum[1]);
+ StartDate_IBU := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = RequestedDateOccNum[2]);
+ StartTime_IBU := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = RequestedTimeOccNum[2]);
+ FreqCodeValue_Toradol := FrequencyCode_Toradol.value.FrequencySummary;
+ StDateValue_Toradol := StartDate_Toradol.value;
+ StTimeValue_Tordol := StartTime_Toradol.value;
+ StTimeValue_IBU := StartTime_IBU.value;
+
+
+ THR := Extract Hour NOW;
+ TMN := Extract Minute NOW;
+
+ if THR < 10 then
+ THR := "0" || THR;
+ endif;
+
+ if TMN < 10 then
+ TMN := "0" || TMN;
+ endif;
+
+ PlusLocation := FIND "+" IN STRING StDateValue_Toradol ;
+ TLocation := FIND "T" IN STRING StDateValue_Toradol ;
+
+ If TLocation = 1 and PlusLocation = 0 then
+ StDateValue_Toradol := (now as time);
+ StTimeValue_Tordol.ReqTimeCode := "Scheduled/Start Time";
+ StTimeValue_Tordol.ReqTimeValue := THR || ":" || TMN;
+ endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF StDateValue_Toradol FROM StDateValue_Toradol ;
+ StDateValue_Toradol := (now as time) + (PlusDays as number) day;
+ StTimeValue_Tordol.ReqTimeCode := "Scheduled/Start Time";
+ StTimeValue_Tordol.ReqTimeValue := THR || ":" || TMN;
+ endif;
+
+ ReqTimeCode_Tordol := StTimeValue_Tordol.ReqTimeCode;
+
+ SchHour_Tordol:= substring 2 characters from StTimeValue_Tordol.ReqTimeValue as number;
+ SchMin_Tordol := substring 2 characters starting at 4 from StTimeValue_Tordol.ReqTimeValue;
+
+ if (ReqTimeCode_Tordol = "Scheduled/Start Time") then
+ HR := SchHour_Tordol;
+ MN := SchMin_Tordol;
+ else
+ HR := Extract Hour NOW;
+ MN := Extract Minute Now;
+ endif;
+
+ if HR < 10 then
+ HR := "0" || HR;
+ endif;
+
+ if MN < 10 then
+ MN := "0" || MN;
+ endif;
+
+ HR_seconds := (60 * (HR as number)) * 60;
+ MN_Seconds := (MN as number) * 60;
+ Calc_starttime_toradol := ((StDateValue_Toradol + (HR_seconds seconds)) + (MN_Seconds seconds));
+ Freq_length := length of FreqCodeValue_Toradol as number;
+ freq_endposition := freq_length;
+ begin_freq := substring 1 characters from FreqCodeValue_Toradol as string;
+ end_freq := substring 1 characters starting at freq_endposition from FreqCodeValue_Toradol as string;
+
+ if begin_freq = "Q" then
+ Freqnum_Toradol := Freq_length - 2;
+ Schnum_Toradol := substring Freqnum_Toradol characters starting at 2 from FreqCodeValue_Toradol;
+ endif;
+
+ schnum_toradol := schnum_Toradol as number;
+
+ if (end_freq = "M") then
+ calc_schnum_seconds := (((86400 / (60 * schnum_toradol)) - 1) * (60 * schnum_toradol)); //take the minutes times 60 to get the seconds, divide that
+ elseif (end_freq = "H") then
+ calc_schnum_seconds := ((((24 / schnum_Toradol)-1) * schnum_toradol) * 60) * 60;
+ endif;
+
+ sched_time := read { "select ScheduledTime from CV3FixedScheduleDefinition fs "
+ || " inner join CV3CodedFreqTranslation ft on fs.ParentGUID = ft.GUID "
+ || " where ft.FrequencyCode = " || sql(FreqCodeValue_Toradol)
+ || " and ft.FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} "};
+
+ sched_time := sort data sched_time;
+ sched_starttime := "";
+ sched_endtime := "";
+ if (count(sched_time) = 0) or (ReqTimeCode_Tordol = "Scheduled/Start Time") then
+ calc_startDTTM_IBU := (Calc_starttime_toradol + calc_schnum_seconds seconds) + 21600 seconds;
+ else
+ tmp_starthhmn := HR || MN;
+ for s in (1 seqto count(sched_time)) do
+ if ((sched_time[s] as number) > (tmp_starthhmn as number)) and sched_starttime = "" then
+ sched_starttime := sched_time[s];
+ endif;
+ if ((sched_time[s] as number) < (tmp_starthhmn as number)) then
+ sched_endtime := sched_time[s];
+ endif;
+ enddo;
+
+ length_sched_endtime := length (sched_endtime as string);
+ sched_minPOS := ((length_sched_endtime as number) - 2) as number;
+ calc_schMIN := (substring 2 characters starting at (sched_minPOS + 1) from (sched_endtime as string)) as number;
+ calc_schHR := (substring (sched_minPOS as number) characters from (sched_endtime as string)) as number;
+ calc_schMIN_Seconds := calc_schMIN * 60;
+ calc_schHR_Seconds := (calc_schHR * 60) * 60;
+ calc_startDTTM_IBU := (((StDateValue_Toradol + 86400 seconds) + calc_schMIN_Seconds seconds) + calc_schHR_seconds seconds) + 21600 seconds;
+ endif;
+
+ format_hr := extract hour calc_startDTTM_IBU;
+ if format_hr < 10 then
+ format_hr := "0" || format_hr;
+ endif;
+
+ format_min := extract minute calc_startDTTM_IBU;
+ if format_min < 10 then
+ format_min := "0" || format_min;
+ endif;
+ IBU_date_extract := (extract month calc_startDTTM_IBU) || "-" || (extract day calc_startDTTM_IBU) || "-" || (extract year calc_startDTTM_IBU);
+ IBU_time_extract := format_hr || ":" || format_min;
+
+ StTimeValue_IBU.ReqTimeCode := "Scheduled/Start Time";
+ StTimeValue_IBU.ReqTimeValue := IBU_time_extract;
+ StartDate_IBU.Value := calc_startDTTM_IBU;
+
+
+ endif; // Close Section
+
+ If CallingEvent = "FormClose" then
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TOTAL_HIP_POST_OP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TOTAL_HIP_POST_OP.mlm
new file mode 100644
index 0000000..d9cb442
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TOTAL_HIP_POST_OP.mlm
@@ -0,0 +1,730 @@
+maintenance:
+
+ title: Set Total Hip Two;;
+ mlmname: FORM_Set_Total_Hip_Post_Op;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Maria Pest, Eclipsys Corp Ext 7443;;
+ date: 2010-01-27;;
+ validation: testing;;
+
+library:
+ purpose: Used for Total Hip Post Op Order Set and Total Knee Replacement
+ ;;
+
+ explanation: Used for Total Hip Post Op Order Set and Total Knee Replacement Order Set
+
+ Change history
+
+ 09.01.2010 DM Modified Antibiotic section and added Clindamycin to grid on orderset.
+ 09.11.2013 TMS Removed logic pertaining to the antibiotics, need to allow user to uncheck the SCIP referenced order set
+ if the physician chooses an alternate antibiotic. HD 160638
+ 01.22.2013 JML CSR 31334: Add Anticoagulant Conflict Alert check to ortho post op order sets.
+ 02.09.2016 - DJW CSR# 33949 - Change to wording of Code Status and CPR orders (Commented out the Code Status section as the Code Status OS was changed to a reference OS)
+ 06.04.2018 JML CA service ticket# 3260474: Changed MLM to enforce anticoagulant conflict check after OS Grid changes.
+
+
+ ;;
+ keywords: Called MLMs, Total Hip, Post Op
+ ;;
+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*******************/
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ PrimaryObj := this_communication.PrimaryObj;
+ OrderSetName := PrimaryObj.OrderSetName;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+
+// Lab Priority Code Section.************************************************************************************
+
+
+ DisplayNewScheduled := first of (field_list.Value
+ where field_list.DataItemName = "LAB_CB_Alternate Priorities");
+
+ if (DisplayNewScheduled) then
+ Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
+ (this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
+ endif;
+
+/****************************************************************************************************************/
+
+ beta_blocker := MLM {{{SINGLE-QUOTE}}}FORM_SET_BETA_BLOCKER_POST_OP{{{SINGLE-QUOTE}}};
+
+
+/*-----------------MLM Call By Shivprasad ----*/
+
+
+ //PreCardiacOpenHeartAtrialFibMLM := MLM {{{SINGLE-QUOTE}}}FORM_PostOpen_Heart_Atrial_Fibrillation{{{SINGLE-QUOTE}}};
+ //this_communication,this_form := call PreCardiacOpenHeartAtrialFibMLM with this_communication,this_form,client_info_obj ;
+
+
+
+/* --------------MLM Cal End By Shivprasad--------*/
+
+ //JML CSR 31334 Change
+ //Need to implicitly call the generic MLM ONLY for the Anticoagulant Grids
+ generic_mlm := MLM {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}};
+ anticoagulant_conflict := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{SINGLE-QUOTE}}};
+
+ Grid_PCA1 := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 4);
+ Grid_PCA1_List :=Grid_PCA1.value ;
+
+ Grid_PCA2 := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 26);
+ Grid_PCA2_List :=Grid_PCA2.value ;
+
+ IvInstruct:= last of (field_list where field_list.DataItemName = "SpecialInstructions"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ Grid_AntiEmetic := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 6);
+ Grid_AntiEmetic_List :=Grid_AntiEmetic.value ;
+
+ Grid_IV_Meds := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 28);
+ Grid_IV_Meds_List :=Grid_IV_Meds.value ;
+
+
+ Grid_After_DC := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Grid_After_DC_List:=Grid_After_DC.value ;
+
+
+ Grid_Nursing := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 29);
+ Grid_Nursing_List:=Grid_Nursing.value ;
+
+ AllergyHold := last of (field_list where field_list.DataItemName = "OS_allergy" );
+
+ InitialAnti := last of (field_list where field_list.DataItemName = "OS_Weight Grid" );
+
+ Grid_Anti := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 11);
+ Grid_Anti_List:=Grid_Anti.value ;
+
+ //JML CSR 31334
+
+ if ( OrderSetName = "Total Hip Replacement Post Op Orders" ) then
+ Enox_Ordinal := 9;
+ Warfarin_Ordinal := 32;
+ Xarelto_Ordinal := 34;
+ elseif ( OrderSetName = "Fractured Hip Post Op Orders" ) then
+ Enox_Ordinal := 9;
+ Warfarin_Ordinal := 36;
+ Xarelto_Ordinal := -1;
+ elseif ( OrderSetName = "Total Knee Replacement Post Op Orders" ) then
+ Enox_Ordinal := 37;
+ Warfarin_Ordinal := 34;
+ Xarelto_Ordinal := 36;
+ endif;
+
+ AntiCoag_Enox := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = Enox_Ordinal);
+ AntiCoag_Enox_List := AntiCoag_Enox.Value;
+
+ AntiCoag_Warfarin := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = Warfarin_Ordinal);
+ AntiCoag_Warfarin_List := AntiCoag_Warfarin.Value;
+
+ if ( Xarelto_Ordinal <> -1 ) then
+ AntiCoag_Xarelto := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = Xarelto_Ordinal);
+ AntiCoag_Xarelto_List := AntiCoag_Xarelto.Value;
+ endif;
+
+ //JML END
+
+ comb_ht_wt_fld := first of (field_list
+ where field_list.DataItemName = "CombinedMeasurements");
+
+ if exists comb_ht_wt_fld then
+ comb_ht_wt_val := comb_ht_wt_fld.Value;
+ wt := comb_ht_wt_val.weight;
+ endif;
+// tms add
+ StartDate := first of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+ StopDate := first of (field_list where field_list.DataItemName = "StopDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+ StopPOD1 := first of (field_list where field_list.DataItemName = "PRX_Checkbox1"
+ and field_List.Control_MultiFieldOccNum = 1);
+ StopPOD2 := first of (field_list where field_list.DataItemName = "PRX_Checkbox2"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ StopPod1_val := StopPod1.Value;
+ StopPod2_val := StopPod2.Value;
+ If CallingField = "PRX_Checkbox1|1" and StopPOD1_val = true then
+ StartDate.value := "T+1";
+ StopDate.value := "T+1";
+ StopPOD2.value := false;
+ IvInstruct.value := "Discontinue PCA post op day 1 at 0600";
+ endif;
+ If CallingField = "PRX_Checkbox2|1" and StopPOD2_val = true then
+ StartDate.value := "T+2";
+ StopDate.value := "T+2";
+ StopPOD1.value := false;
+ IvInstruct.value := "Discontinue PCA post op day 2 at 0600";
+ endif;
+
+//jp
+/*
+ If (True in Grid_PCA1_List.IsSelected) or (True in Grid_PCA2_List.IsSelected) then
+ Grid_IV_Meds_List.IsSelected := (True); else Grid_IV_Meds_List.IsSelected := (False);
+ endif;
+*/
+
+
+ If CallingField = "MultiOrderGrid|4" then
+ OccNumA:= 4;
+ OccNumB:= 26;
+ OccNumC:= 23;
+ Elseif CallingField = "MultiOrderGrid|26" then
+ OccNumA:= 26;
+ OccNumB:= 4;
+ OccNumC:= 23;
+ Elseif CallingField = "MultiOrderGrid|23" then
+ OccNumA:= 23;
+ OccNumB:= 4;
+ OccNumC:= 26;
+ endif;
+
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := false;
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ if CallingEvent = "FieldChange" then
+ If (CallingField = "MultiOrderGrid|4") or (CallingField = "MultiOrderGrid|26") or (CallingField = "MultiOrderGrid|23") then
+
+ Grid_fldA := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = OccNumA);
+ Grid_listA :=Grid_fldA.Value;
+
+
+ Grid_fldB := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = OccNumB);
+ Grid_listB :=Grid_fldB.Value;
+ FalseListB := ();
+ TrueListB := ();
+ for k in (1 seqto (count Grid_ListB.IsSelected)) do
+ FalseListB := FalseListB,False;
+ TrueListB := TrueListB ,True;
+ enddo;
+
+ Grid_fldC := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = OccNumC);
+ Grid_listC :=Grid_fldC.Value;
+ FalseListC := ();
+ TrueListC := ();
+ for k in (1 seqto (count Grid_ListC.IsSelected)) do
+ FalseListC := FalseListC,False;
+ TrueListC := TrueListC ,True;
+ enddo;
+
+ if (true in Grid_ListA.IsSelected) then
+ Grid_ListB.IsReadonly := TruelistB;
+ Grid_ListC.IsReadonly := TrueListC;
+ else
+ Grid_ListB.IsReadonly := FalselistB;
+ Grid_ListC.IsReadonly := FalseListC;
+ endif;
+
+ // extra for order grid 23
+
+ if (CallingField = "MultiOrderGrid|23") then
+ if (true in Grid_ListA.IsSelected) then
+ if first(Grid_ListA.IsSelected) = true then
+ Grid_ListA.IsReadOnly := false,true;
+ else
+ Grid_ListA.IsReadOnly := true,false;
+ endif;
+ else
+ Grid_ListA.IsReadOnly := false,false;
+ endif;
+ endif;
+
+ elseif (CallingField = "MultiOrderGrid|28")
+ then
+ First4DC := (Grid_After_DC_List.IsSelected[1],Grid_After_DC_List.IsSelected[2],
+ Grid_After_DC_List.IsSelected[3],Grid_After_DC_List.IsSelected[4]);
+ Last4DC := (Grid_After_DC_List.IsSelected[5],Grid_After_DC_List.IsSelected[6],
+ Grid_After_DC_List.IsSelected[7],Grid_After_DC_List.IsSelected[8]);
+ First4Read := (Grid_After_DC_List.IsReadOnly[1],Grid_After_DC_List.IsReadOnly[2],
+ Grid_After_DC_List.IsReadOnly[3],Grid_After_DC_List.IsReadOnly[4]);
+ Last4Read := (Grid_After_DC_List.IsReadOnly[5],Grid_After_DC_List.IsReadOnly[6],
+ Grid_After_DC_List.IsReadOnly[7],Grid_After_DC_List.IsReadOnly[8]);
+
+
+
+ if true in Grid_IV_Meds_List.IsSelected
+ then
+ if Grid_IV_Meds_List.IsSelected[1] = true
+ then
+ Grid_IV_Meds_List.IsReadOnly := (false,true);
+
+ if (true in Last4DC) and (true not in First4DC) then
+ Grid_After_Dc_List.ISSelected := Last4DC,First4DC;
+ Grid_After_Dc_List.IsReadOnly:= (Last4Read),(true,true,true,true) as list;
+ else
+ Grid_After_Dc_List.IsReadOnly := (First4Read) , (true,true,true,true) as list;
+ endif;
+
+ else
+ Grid_IV_Meds_List.IsReadOnly := (true,false);
+ if (true in First4DC) and (true not in Last4DC) then
+ Grid_After_DC_List.IsSelected := Last4DC,First4DC;
+ Grid_After_Dc_List.IsReadOnly:= (true,true,true,true), (First4Read) as list;
+ else
+ Grid_After_Dc_List.IsReadOnly := (true,true,true,true) , (Last4Read) as list ;
+ endif;
+
+ endif;
+ else
+ Grid_IV_Meds_List.IsReadOnly := (false,false);
+ if true in Grid_After_Dc_List.IsSelected
+ then
+ if true in (Grid_After_DC_List.IsSelected[1],Grid_After_DC_List.IsSelected[2],
+ Grid_After_DC_List.IsSelected[3],Grid_After_DC_List.IsSelected[4])
+ then
+ Grid_After_DC_List.IsReadOnly := (First4Read) , (true,true,true,true);
+
+ else
+ Grid_After_Dc_List.IsReadOnly := (true,true,true,true) ,(Last4Read);
+ endif;
+ else
+ Grid_After_DC_List.IsReadOnly := (false,false,false,false,false,false,false,false);
+ endif;
+
+
+ endif;
+
+ elseif (CallingField = "MultiOrderGrid|5")
+ then
+ if true in Grid_After_Dc_List.IsSelected
+ then
+ if true in (Grid_After_DC_List.IsSelected[1],Grid_After_DC_List.IsSelected[2],
+ Grid_After_DC_List.IsSelected[3],Grid_After_DC_List.IsSelected[4])
+ then
+ Grid_After_Dc_List.IsReadOnly := (false,false,false,false,true,true,true,true);
+ Grid_IV_Meds_List.IsReadOnly := (false,true);
+ if true in (Grid_IV_Meds_List.IsSelected) then
+ Grid_IV_Meds_List.IsSelected := (true,false);
+ endif;
+ else
+ Grid_After_Dc_List.IsReadOnly := (true,true,true,true,false,false,false,false);
+ Grid_IV_Meds_List.IsReadOnly := (true,false);
+ if true in (Grid_IV_Meds_List.IsSelected) then
+ Grid_IV_Meds_List.IsSelected := (false,true);
+ endif;
+ endif;
+ else
+ Grid_After_DC_List.IsReadOnly := (false,false,false,false,false,false,false,false);
+ if true in (Grid_IV_Meds_List.IsSelected) then
+ if Grid_IV_Meds_List.IsSelected[1] = true then
+ Grid_IV_Meds_List.IsReadOnly := (false,true);
+ Grid_After_DC_List.IsReadOnly := (false,false,false,false,true,true,true,true);
+ else
+ Grid_IV_Meds_List.IsReadOnly := (true,false);
+ Grid_After_DC_List.IsReadOnly := (true,true,true,true,false,false,false,false);
+ endif;
+ else
+ Grid_IV_Meds_List.IsReadOnly := (false,false);
+ Grid_After_DC_List.IsReadOnly := (false,false,false,false,false,false,false,false);
+ endif;
+ endif;
+
+ // now only allow one Moderate or one sever to be selected in this grid...
+
+ // first need to find out what is selected.
+ // matching groups are 1,3 2,4 5,7 6,8
+
+ if true in (Grid_After_DC_List.IsSelected)
+ then
+ holdreadonly := ();
+ SettoReadOnly:= (); // add grid position for readonly, if not there, set to false.
+
+ if Grid_After_DC_List.IsSelected[1] = true then SettoReadOnly := SettoReadOnly,3; endif;
+ if Grid_After_DC_List.IsSelected[2] = true then SettoReadOnly := SettoReadOnly,4; endif;
+ if Grid_After_DC_List.IsSelected[3] = true then SettoReadOnly := SettoReadOnly,1; endif;
+ if Grid_After_DC_List.IsSelected[4] = true then SettoReadOnly := SettoReadOnly,2; endif;
+ if Grid_After_DC_List.IsSelected[5] = true then SettoReadOnly := SettoReadOnly,7; endif;
+ if Grid_After_DC_List.IsSelected[6] = true then SettoReadOnly := SettoReadOnly,8; endif;
+ if Grid_After_DC_List.IsSelected[7] = true then SettoReadOnly := SettoReadOnly,5; endif;
+ if Grid_After_DC_List.IsSelected[8] = true then SettoReadOnly := SettoReadOnly,6; endif;
+
+ for changepermod in (1 seqto (count Grid_After_DC_List.IsSelected)) do
+ if changepermod in (SettoReadOnly)
+ then
+ holdreadonly := (holdreadonly,true);
+ else
+ holdreadonly := (holdreadonly,Grid_After_DC_List.IsReadOnly[changepermod]);
+ endif;
+ enddo;
+
+ Grid_After_DC_List.IsReadOnly := holdreadonly;
+
+ endif;
+
+
+ elseif (CallingField = "MultiOrderGrid|6")
+ then
+ FirstThree := (Grid_AntiEmetic_List.IsSelected[1],
+ Grid_AntiEmetic_List.IsSelected[2],
+ Grid_AntiEmetic_List.IsSelected[3]);
+
+ if true in Firstthree
+ then
+ NewReadOnly := ();
+ NewSelected := ();
+ for k in (1 seqto (count Grid_AntiEmetic_List.IsSelected)) do
+
+ if k <= 3 then
+ if Grid_AntiEmetic_List.IsSelected[k] = true then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected,true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ endif;
+ elseif k = 4 then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected,Grid_AntiEmetic_List.IsSelected[k];
+ elseif k <= 8 then
+ NewReadOnly := NewReadOnly, true;
+ NewSelected:= NewSelected, Grid_AntiEmetic_List.IsSelected[4];
+ else
+ NewReadOnly := NewReadOnly, Grid_AntiEmetic_List.IsReadOnly[k];
+ NewSelected := NewSelected, Grid_AntiEmetic_List.IsSelected[k];
+ endif;
+ enddo;
+ Grid_AntiEmetic_List.IsReadOnly := NewReadOnly;
+ Grid_AntiEmetic_List.IsSelected := NewSelected;
+
+ else
+ NewReadOnly := ();
+ DeselectAll := ();
+ for k in (1 seqto (count Grid_AntiEmetic_List.IsSelected)) do
+ if k <= 3 then
+ NewReadOnly := NewReadOnly, false;
+ DeselectAll := DeselectAll ,false;
+ elseif k>8 then
+ NewReadOnly := NewReadOnly, Grid_AntiEmetic_List.IsReadOnly[k];
+ DeselectAll := DeselectAll, Grid_AntiEmetic_List.IsSelected[k];
+ else
+ NewReadOnly := NewReadOnly, true;
+ DeselectAll := DeselectAll, false;
+ endif;
+
+
+ enddo;
+ Grid_AntiEmetic_List.IsReadOnly := NewReadOnly;
+ Grid_AntiEmetic_List.IsSelected := DeselectAll;
+ endif;
+
+/* dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "First Three is Selected: " || FirstThree
+ ,"Tester","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+*/
+
+/*
+ elseif (CallingField = "MultiOrderCheckBox|4") then // Code Status
+
+ MCB_CodeStatus := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox"
+ and field_List.Control_MultiFieldOccNum = 4);
+ MCB_CodeStatus_List:=MCB_CodeStatus.value ;
+ CodeRead:=();
+ falselist := ();
+ for CodeStatCount in (1 Seqto (count MCB_CodeStatus_List)) do
+ if MCB_CodeStatus_List.IsSelected[CodeStatCount] = true then
+ CodeRead := CodeRead,false;
+ else
+ CodeRead := CodeRead,true;
+ endif;
+
+ falselist := falselist,false;
+ enddo;
+
+ if true in MCB_CodeStatus_List.IsSelected then
+ MCB_CodeStatus_List.IsReadOnly := CodeRead;
+ else
+ MCB_CodeStatus_List.IsReadOnly := falselist;
+ endif;
+*/
+ elseif (CallingField = "MultiOrderGrid|29") // Nursing Instruction
+ then
+ If (Grid_Nursing_List[1].IsSelected = true)
+ then
+ Grid_Nursing_List.IsSelected := (true,true,true);
+ else
+ Grid_Nursing_List.IsSelected := (false,false,false);
+ endif;
+
+ //JML CSR 31334 Change
+ //Dynamically determine callingField based on ordinal change across 3 order sets
+ elseif ( (CallingField = ( "MultiOrderGrid|" || Enox_Ordinal ) )
+ OR (CallingField = ( "MultiOrderGrid|" || Warfarin_Ordinal ) )
+ OR (CallingField = ( "MultiOrderGrid|" || Xarelto_Ordinal ) ) ) then
+
+ (this_communication, this_form) := call generic_mlm WITH this_communication, this_form, client_info_obj;
+
+ if ( TRUE IN AntiCoag_Enox_List.IsSelected ) then
+
+ if ( first of ( AntiCoag_Enox_List WHERE AntiCoag_Enox_List.Name matches pattern "Enoxaparin%" ).IsSelected = true ) then
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, AntiCoag_Enox_List[1].Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ //AntiCoag_Enox_List.IsSelected := (false, false);
+ AntiCoag_Enox_List.IsSelected := false;
+
+ AntiCoag_Warfarin_List.IsReadOnly := false;
+ AntiCoag_Xarelto_List.IsReadOnly := false;
+
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+ //AntiCoag_Enox_List.IsSelected := (false, false);
+ AntiCoag_Enox_List.IsSelected := false;
+
+ AntiCoag_Warfarin_List.IsReadOnly := false;
+ AntiCoag_Xarelto_List.IsReadOnly := false;
+
+ endif;
+ endif;
+ endif;
+ endif;
+ endif;
+
+ if ( TRUE IN AntiCoag_Warfarin_List.IsSelected ) then
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, AntiCoag_Warfarin_List[1].Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ AntiCoag_Warfarin_List.IsSelected := (false, false);
+
+ AntiCoag_Enox_List.IsReadOnly := false;
+ AntiCoag_Xarelto_List.IsReadOnly := false;
+
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+
+ AntiCoag_Warfarin_List.IsSelected := (false, false);
+
+ AntiCoag_Enox_List.IsReadOnly := false;
+ AntiCoag_Xarelto_List.IsReadOnly := false;
+ endif;
+ endif;
+ endif;
+
+ endif;
+
+ if ( TRUE IN AntiCoag_Xarelto_List.IsSelected ) then
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, AntiCoag_Xarelto_List[1].Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ AntiCoag_Xarelto_List.IsSelected := false;
+
+ AntiCoag_Enox_List.IsReadOnly := false;
+ AntiCoag_Warfarin_List.IsReadOnly := false;
+ else
+
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflic", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+ AntiCoag_Xarelto_List.IsSelected := false;
+ AntiCoag_Enox_List.IsReadOnly := false;
+ AntiCoag_Warfarin_List.IsReadOnly := false;
+ endif;
+ endif;
+ endif;
+ endif;
+
+// 9-11-2013 Commented out section for SCIP antibiotics to allow user to uncheck SCIP order set if a non standard SCIP antibiotic is ordered.
+// This logic was for when the antibiotics were listed separately in the grid instead of a referenced order set. (TMS)
+
+/*
+ elseif (CallingField = "MultiOrderGrid|11") // Antibiotics
+ then
+
+
+ if true in (first 6 from Grid_Anti_List.IsSelected)
+ then
+
+ // dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "First Six is Selected: " || (first 6 from Grid_Anti_List.IsSelected)
+ // ,"Tester","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ // Added if statements for #5 and #6 - Dean Miklavic
+
+ holdreadonly := ();
+ SettoReadOnly:= (); // add grid position for readonly, if not there, set to false.
+
+ if Grid_Anti_List.IsSelected[1] = true then SettoReadOnly := SettoReadOnly,2,3,4,5,6; endif;
+ if Grid_Anti_List.IsSelected[2] = true then SettoReadOnly := SettoReadOnly,1,3,4,5,6; endif;
+ if Grid_Anti_List.IsSelected[3] = true then SettoReadOnly := SettoReadOnly,6,5,4,2,1; endif;
+ if Grid_Anti_List.IsSelected[4] = true then SettoReadOnly := SettoReadOnly,6,5,3,2,1; endif;
+ if Grid_Anti_List.IsSelected[5] = true then SettoReadOnly := SettoReadOnly,6,4,3,2,1; endif;
+ if Grid_Anti_List.IsSelected[6] = true then SettoReadOnly := SettoReadOnly,5,4,3,2,1; endif;
+
+
+ for changepermod in (1 seqto (count Grid_Anti_List.IsSelected)) do
+ if changepermod in (SettoReadOnly)
+ then
+ holdreadonly := (holdreadonly,true);
+ else
+ holdreadonly := (holdreadonly,Grid_Anti_List.IsReadOnly[changepermod]);
+ endif;
+ enddo;
+
+ Grid_Anti_List.IsReadOnly := holdreadonly;
+
+
+ else
+ Initial := ();
+ Initial:= call str_parse with InitialAnti.Value, ",";
+ HoldInit:= ();
+ for anticount in (1 seqto (count Grid_Anti_List.IsSelected)) do
+ if anticount <=6 then
+ HoldInit:= HoldInit,Initial[anticount];
+ else
+ HoldInit:= HoldInit,Grid_Anti_List.IsReadOnly[anticount];
+ endif;
+ enddo;
+ Grid_Anti_List.IsReadOnly := HoldInit;
+ endif;
+*/
+
+//put field changes before this line
+
+ endif; // field change
+
+ elseif (callingevent = "FormOpen")
+ then
+
+ (this_communication, this_form) := call beta_blocker with (this_communication, this_form, client_info_obj);
+
+ NewReadOnly := ();
+ for k in (1 seqto (count Grid_AntiEmetic_List.IsSelected)) do
+ if k <= 3 then
+ NewReadOnly := NewReadOnly, false;
+ else
+ NewReadOnly := NewReadOnly, true;
+ endif;
+ enddo;
+ // Grid_AntiEmetic_List.IsReadOnly := NewReadOnly;
+
+ Grid_Nursing_List.IsReadOnly := (false,true,true);
+
+ allergtrue:= read last {"select count(*) from cv3allergydeclaration as ad "
+ || " join cv3allergen as a "
+ || " on a.guid = ad.allergenguid "
+ || " and a.code like {{{SINGLE-QUOTE}}}penicillin%{{{SINGLE-QUOTE}}} "
+ || " where ad.clientguid = " || sql(client_guid)
+ // || " and ad.chartguid = " || sql(chart_guid)
+ || " and ad.active = 1 "
+ || " and ad.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ };
+ numballerg := allergtrue as number;
+
+ if (numballerg >0) then
+ AllergyHold.Value := "True";
+ // Grid_Anti_List.IsReadOnly := (true,true,false,false,false,false,false,false);
+ else AllergyHold.Value := "False";
+ endif;
+
+ // modified this for two new meds. Dean Miklavic
+/*
+ addreadonly:=();
+ if exists (wt) then
+ if wt >=80 then
+ addreadonly := addreadonly,1;
+ addreadonly := addreadonly,3;
+ addreadonly := addreadonly,5;
+
+ elseif wt <80 then
+ addreadonly := addreadonly, 2;
+ addreadonly := addreadonly,4;
+
+ if wt <50 then
+ addreadonly := addreadonly,5;
+ else
+ addreadonly := addreadonly,6;
+ endif;
+ endif;
+ // now replace grid{{{SINGLE-QUOTE}}}s read onlys
+ holdnewallread := ();
+ for wtchange in (1 seqto (count Grid_Anti_List.IsSelected)) do
+ if wtchange in addreadonly
+ then
+ holdnewallread := holdnewallread,true;
+ else
+ holdnewallread := holdnewallread,Grid_Anti_List.IsReadonly[wtchange];
+ endif;
+ enddo;
+
+ Grid_Anti_List.IsReadOnly := holdnewallread;
+ endif;
+
+ openhold:="";
+ for holder in (1 seqto (count Grid_Anti_List.IsSelected)) do
+ openhold := openhold || Grid_Anti_List.IsReadOnly[holder] ;
+ if holder <> (count Grid_Anti_List.IsSelected) then openhold := openhold || ","; endif;
+ enddo;
+ InitialAnti.Value:= openhold;
+
+*/
+
+
+ endif; // calling event
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TOTAL_HIP_POST_OP2.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TOTAL_HIP_POST_OP2.mlm
new file mode 100644
index 0000000..43fb272
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TOTAL_HIP_POST_OP2.mlm
@@ -0,0 +1,468 @@
+maintenance:
+
+ title: Set Total Hip Two;;
+ mlmname: FORM_Set_Total_Hip_Post_Op2;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Maria Pest, Eclipsys Corp Ext 7443;;
+ date: 2010-01-27;;
+ validation: testing;;
+
+library:
+ purpose: Used for Total Hip Post Op Order Set and Total Knee Replacement
+ ;;
+
+ explanation: Used for Total Hip Post Op Order Set and Total Knee Replacement Order Set
+
+ Change history
+
+ 09.01.2010 DM Modified Antibiotic section and added Clindamycin to grid on orderset.
+ 09.11.2013 TMS Removed logic pertaining to the antibiotics, need to allow user to uncheck the SCIP referenced order set
+ if the physician chooses an alternate antibiotic. HD 160638
+ 01.22.2013 JML CSR 31334: Add Anticoagulant Conflict Alert check to ortho post op order sets.
+ 02.09.2016 - DJW CSR# 33949 - Change to wording of Code Status and CPR orders (Commented out the Code Status section as the Code Status OS was changed to a reference OS)
+ 10.25.2016 - STH CSR#: 34943 - This CSR required changed to the order that that were loaded back in August 2016; however the changes affected the MLM and was not identified until October.
+ Cleaned up MLM and corrected issues, moved custom code to generic MLM, and adjusted form to call this MLM instead as the primary MLM instead of the 2 other
+ MLM{{{SINGLE-QUOTE}}}s that were being used. Updated name to version 2 as the original MLM is now attached to 5 other order sets that need reviewed in the future. {Go-Live 10/26/2016}
+ 04.13.2017 - STH SCR#: 35293 - Updated MLM to work with the foot and ankle post op order set as it is very similar to the total hip and total knee. (Go-Live 4/13/2017}
+ 11.7.2018 STH - CSR#: 36715 & 35594 - This MLM is being updated with the new logic for the custom message box that allow for more felxibility with the message box window.
+
+ ;;
+ keywords: Called MLMs, Total Hip, Post Op
+ ;;
+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*******************/
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ PrimaryObj := this_communication.PrimaryObj;
+ OrderSetName := PrimaryObj.OrderSetName;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+
+// Lab Priority Code Section.************************************************************************************
+
+
+ DisplayNewScheduled := first of (field_list.Value
+ where field_list.DataItemName = "LAB_CB_Alternate Priorities");
+
+ if (DisplayNewScheduled) then
+ Call_UserFriendly_Lab_Priorities := mlm {{{SINGLE-QUOTE}}}SCH_LAB_PRIORITY_OPTIONS_CALLED{{{SINGLE-QUOTE}}};
+ (this_communication,this_form) := call Call_UserFriendly_Lab_Priorities with (this_communication,this_form,client_info_obj);
+ endif;
+
+/****************************************************************************************************************/
+
+ beta_blocker := MLM {{{SINGLE-QUOTE}}}FORM_SET_BETA_BLOCKER_POST_OP{{{SINGLE-QUOTE}}};
+
+
+/*-----------------MLM Call By Shivprasad ----*/
+
+
+ //PreCardiacOpenHeartAtrialFibMLM := MLM {{{SINGLE-QUOTE}}}FORM_PostOpen_Heart_Atrial_Fibrillation{{{SINGLE-QUOTE}}};
+ //this_communication,this_form := call PreCardiacOpenHeartAtrialFibMLM with this_communication,this_form,client_info_obj ;
+
+
+
+/* --------------MLM Cal End By Shivprasad--------*/
+
+ //JML CSR 31334 Change
+ //Need to implicitly call the generic MLM ONLY for the Anticoagulant Grids
+ generic_mlm := MLM {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}};
+ anticoagulant_conflict := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{SINGLE-QUOTE}}};
+
+ IvInstruct:= last of (field_list where field_list.DataItemName = "AdminInstructions"
+ and field_List.Control_MultiFieldOccNum = 2);
+
+ Grid_After_DC := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 5);
+ Grid_After_DC_List:=Grid_After_DC.value ;
+
+ Grid_AntiEmetic := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 6);
+ Grid_AntiEmetic_List :=Grid_AntiEmetic.value ;
+
+ Grid_Anti := last of (field_list where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = 11);
+ Grid_Anti_List:=Grid_Anti.value ;
+
+
+ AllergyHold := last of (field_list where field_list.DataItemName = "OS_allergy" );
+
+ InitialAnti := last of (field_list where field_list.DataItemName = "OS_Weight Grid" );
+
+
+ //JML CSR 31334
+
+ if ( OrderSetName = "Total Hip Replacement Post Op Orders" ) then
+ Enox_Ordinal := 9;
+ Warfarin_Ordinal := -1;
+ Xarelto_Ordinal := 34;
+ IVOpiodPostOp_Ordinal := 23;
+ OralOpiodMild_Ordinal := -1;
+ OralOpiodModerate_Ordinal := -1;
+ OralOpiodSevere_Ordinal := -1;
+ elseif ( OrderSetName = "Fractured Hip Post Op Orders" ) then
+ Enox_Ordinal := 9;
+ Warfarin_Ordinal := 36;
+ Xarelto_Ordinal := -1;
+ IVOpiodPostOp_Ordinal := 23;
+ OralOpiodMild_Ordinal := -1;
+ OralOpiodModerate_Ordinal := -1;
+ OralOpiodSevere_Ordinal := -1;
+ elseif ( OrderSetName = "Total Knee Replacement Post Op Orders" ) then
+ Enox_Ordinal := 37;
+ Warfarin_Ordinal := 34;
+ Xarelto_Ordinal := 36;
+ IVOpiodPostOp_Ordinal := 23;
+ OralOpiods_Ordinal := -1;
+ OralOpiodMild_Ordinal := -1;
+ OralOpiodModerate_Ordinal := -1;
+ OralOpiodSevere_Ordinal := -1;
+ elseif ( OrderSetName = "Foot and Ankle Post Op Orders" ) then
+ Enox_Ordinal := 9;
+ Warfarin_Ordinal := -1;
+ Xarelto_Ordinal := 34;
+ IVOpiodPostOp_Ordinal := 23;
+ OralOpiodMild_Ordinal := 42;
+ OralOpiodModerate_Ordinal := 5;
+ OralOpiodSevere_Ordinal := 43;
+
+ endif;
+
+ AntiCoag_Enox := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = Enox_Ordinal);
+ AntiCoag_Enox_List := AntiCoag_Enox.Value;
+
+ if (Warfarin_Ordinal <> -1 ) then
+ AntiCoag_Warfarin := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = Warfarin_Ordinal);
+ AntiCoag_Warfarin_List := AntiCoag_Warfarin.Value;
+ endif;
+
+ if ( Xarelto_Ordinal <> -1 ) then
+ AntiCoag_Xarelto := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = Xarelto_Ordinal);
+ AntiCoag_Xarelto_List := AntiCoag_Xarelto.Value;
+ endif;
+
+ if(IVOpiodPostOp_Ordinal <> -1) then
+ IVOpiodGrid := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = IVOpiodPostOp_Ordinal);
+ IVOpiodGrid_List := IVOpiodGrid.Value;
+
+ endif;
+
+ //JML END
+
+ comb_ht_wt_fld := first of (field_list
+ where field_list.DataItemName = "CombinedMeasurements");
+
+ if exists comb_ht_wt_fld then
+ comb_ht_wt_val := comb_ht_wt_fld.Value;
+ wt := comb_ht_wt_val.weight;
+ endif;
+// tms add
+ StartDate := first of (field_list where field_list.DataItemName = "RequestedDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+ StartTime := first of (field_list where field_list.DataItemName = "RequestedTime"
+ and field_List.Control_MultiFieldOccNum = 3);
+ StopDate := first of (field_list where field_list.DataItemName = "StopDate"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ StopPOD1 := first of (field_list where field_list.DataItemName = "PRX_Checkbox1"
+ and field_List.Control_MultiFieldOccNum = 1);
+ StopPOD2 := first of (field_list where field_list.DataItemName = "PRX_Checkbox2"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+ StopPod1_val := StopPod1.Value;
+ StopPod2_val := StopPod2.Value;
+ If (((CallingField = "PRX_Checkbox1|1")
+ or (CallingField = "MultiOrderGrid|" || OralOpiodMild_Ordinal)
+ or (CallingField = "MultiOrderGrid|" || OralOpiodModerate_Ordinal)
+ or (CallingField = "MultiOrderGrid|" || OralOpiodSevere_Ordinal))
+ and (StopPOD1_val = true)) then
+ StartDate.value := "T+1";
+ StopDate.value := "T+1";
+ StopPOD2.value := false;
+ StartTime.Value.ReqTimeCode := "Scheduled/Start Time";
+ StartTime.Value.ReqTimeValue := "06:00";
+ IvInstruct.value := "Discontinue post op day 1 at 0600";
+ endif;
+ If (((CallingField = "PRX_Checkbox2|1")
+ or (CallingField = "MultiOrderGrid|" || OralOpiodMild_Ordinal)
+ or (CallingField = "MultiOrderGrid|" || OralOpiodModerate_Ordinal)
+ or (CallingField = "MultiOrderGrid|" || OralOpiodSevere_Ordinal))
+ and (StopPOD2_val = true)) then
+ if(OrderSetName = "Foot and Ankle Post Op Orders") then
+ StartDate.value := "T";
+ StopDate.value := null;
+ StopPOD1.value := false;
+ StartTime.Value.ReqTimeValue := null;
+ StartTime.Value.ReqTimeCode := "Routine";
+ IvInstruct.value := "For breakthrough pain, to be used in conjunction with oral opiods.";
+
+ else
+ StartDate.value := "T+2";
+ StopDate.value := "T+2";
+ StopPOD1.value := false;
+ IvInstruct.value := "Discontinue post op day 2 at 0600";
+ endif;
+ endif;
+
+//jp
+/*
+ If (True in Grid_PCA1_List.IsSelected) or (True in Grid_PCA2_List.IsSelected) then
+ Grid_IV_Meds_List.IsSelected := (True); else Grid_IV_Meds_List.IsSelected := (False);
+ endif;
+*/
+
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := false;
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ if CallingEvent = "FieldChange" then
+ (this_communication, this_form) := call generic_mlm WITH this_communication, this_form, client_info_obj;
+
+
+ if (CallingField = "MultiOrderGrid|" || IVOpiodPostOp_Ordinal) then
+
+ if(true in IVOpiodGrid_List.IsSelected) then
+ Custom_Msg_Box := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_CUSTOM_MSGBOX{{{SINGLE-QUOTE}}};
+ MsgBoxButtons := ();
+
+ InPatMsgBoxButtons := ();
+ InPatMsgBoxButtons := ("YES", "CANCEL","EMERGENCY"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
+ InPatMsgBoxContent := "BLOOD CONSENT REQUIREMENT\n\nI have discussed the appropriate risks and benefits of blood transfusion with this patient or the patient{{{SINGLE-QUOTE}}}s representative."
+ || "\n\n***Emergency***\nUnable to obtain consent in life threatening situation.";
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ AlertWindowHeight := "350"; //This will be the hight of the window. Minimum is 250.
+ AlertWindowWidth := "650"; //This will be the width of the window. Minimum is 480;
+ MB_VAlign := "CENTER"; //Options are TOP, BOTTOM, CENTER. This will vertically align the text in the primary message box.
+ MB_HAlign := "CENTER"; //Options are LEFT, RIGHT, CENTER. This will horizontially align the message box textual content in the primary message box.
+
+ AdditionalInfoBox := "";
+ ADINFO_VAlign := "CENTER"; //Options are TOP, BOTTOM, CENTER. This will vertically align the text in the additional info message box.
+ ADINFO_HAlign := "CENTER"; //Options are LEFT, RIGHT, CENTER. This will horizontially align the message box textual content in the additional info message box.
+ //THIS CODE CAN BE ENTERED INTO THE MLM WHERE YOU EXPECT THE MESSAGE BOX TO APPEAR. WHAT EVER THE LABEL/TEXT OF THE BUTTON IS CLICKED WILL BE RETURNED
+ //TO THE dlb_result FOR YOU TO CODE YOU MLM BASED ON THE USERS SELECTION.
+
+
+ if(OrderSetName = "Foot and Ankle Post Op Orders") then
+ MsgBoxButtons := ("POD1", "BREAKTHROUGH"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
+ MsgBoxDetails := "IV Opioid Orders\n\n\n\nHow are you ordering the IV Opioids?\n\nPOD1 = Discontinue Post Op Day 1?\n\nBREAKTROUGH = Ordering for Breakthrough Pain Management?";
+ else
+ MsgBoxButtons := ("DAY 1", "DAY 2"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
+ MsgBoxDetails := "Discontinue IV Opioid\n\n\nDiscontinue IV Opioid Post-Op?";
+ endif;
+ //THIS CODE CAN BE ENTERED INTO THE MLM WHERE YOU EXPECT THE MESSAGE BOX TO APPEAR. WHAT EVER THE LABEL/TEXT OF THE BUTTON IS CLICKED WILL BE RETURNED
+ //TO THE dlb_result FOR YOU TO CODE YOU MLM BASED ON THE USERS SELECTION.
+ dlg_result := call Custom_Msg_Box with (AlertWindowHeight,AlertWindowWidth,MsgBoxDetails,MB_VAlign,MB_HAlign,MsgBoxButtons,AdditionalInfoBox,ADINFO_VAlign,ADINFO_HAlign);
+ if(trim(dlg_result) in ("DAY 1","POD1")) then
+ StopPOD1.value := true;
+ StartDate.value := "T+1";
+ StopDate.value := "T+1";
+ StopPOD2.value := false;
+ StartTime.Value.ReqTimeCode := "Scheduled/Start Time";
+ StartTime.Value.ReqTimeValue := "06:00";
+ IvInstruct.value := "Discontinue post op day 1 at 0600";
+ elseif(trim(dlg_result) = "DAY 2") then
+ StopPOD2.value := true;
+ StartDate.value := "T+2";
+ StopDate.value := "T+2";
+ StopPOD1.value := false;
+ StartTime.Value.ReqTimeCode := "Scheduled/Start Time";
+ StartTime.Value.ReqTimeValue := "06:00";
+ IvInstruct.value := "Discontinue post op day 2 at 0600";
+ elseif(trim(dlg_result) = "BREAKTHROUGH") then
+ StopPOD2.value := true;
+ StartDate.value := "T";
+ StopDate.value := null;
+ StopPOD1.value := false;
+ StartTime.Value.ReqTimeCode := "Routine";
+ StartTime.Value.ReqTimeValue := null;
+ IvInstruct.value := "For breakthrough pain, to be used in conjunction with oral opiods.";
+ else
+ StartDate.value := "";
+ StopDate.value := "";
+ IvInstruct.value := "";
+ StopPOD2.value := false;
+ StopPOD1.value := false;
+ StartTime.Value.ReqTimeCode := null;
+ StartTime.Value.ReqTimeValue := null;
+ IVOpiodGrid_List.IsSelected := false;
+ IVOpiodGrid_List.IsReadOnly := false;
+ endif;
+ else
+ StartDate.value := "";
+ StopDate.value := "";
+ IvInstruct.value := "";
+ StopPOD2.value := false;
+ StopPOD1.value := false;
+ StartTime.Value.ReqTimeCode := null;
+ StartTime.Value.ReqTimeValue := null;
+ endif;
+ //JML CSR 31334 Change
+ //Dynamically determine callingField based on ordinal change across 3 order sets
+ elseif ( (CallingField = ( "MultiOrderGrid|" || Enox_Ordinal ) )
+// elseif ( (CallingField = ( "MultiOrderGrid|" || Enox_Ordinal ) )
+ OR (CallingField = ( "MultiOrderGrid|" || Warfarin_Ordinal ) )
+ OR (CallingField = ( "MultiOrderGrid|" || Xarelto_Ordinal ) ) ) then
+
+
+
+ if ( TRUE IN AntiCoag_Enox_List.IsSelected ) then
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, AntiCoag_Enox_List[1].Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ AntiCoag_Enox_List.IsSelected := (false, false);
+
+ AntiCoag_Warfarin_List.IsReadOnly := false;
+ AntiCoag_Xarelto_List.IsReadOnly := false;
+
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+ AntiCoag_Enox_List.IsSelected := (false, false);
+
+ AntiCoag_Warfarin_List.IsReadOnly := false;
+ AntiCoag_Xarelto_List.IsReadOnly := false;
+
+ endif;
+ endif;
+ endif;
+ endif;
+
+ if ( TRUE IN AntiCoag_Warfarin_List.IsSelected ) then
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, AntiCoag_Warfarin_List[1].Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ AntiCoag_Warfarin_List.IsSelected := (false, false);
+
+ AntiCoag_Enox_List.IsReadOnly := false;
+ AntiCoag_Xarelto_List.IsReadOnly := false;
+
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+
+ AntiCoag_Warfarin_List.IsSelected := (false, false);
+
+ AntiCoag_Enox_List.IsReadOnly := false;
+ AntiCoag_Xarelto_List.IsReadOnly := false;
+ endif;
+ endif;
+ endif;
+
+ endif;
+
+ if ( TRUE IN AntiCoag_Xarelto_List.IsSelected ) then
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, AntiCoag_Xarelto_List[1].Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ AntiCoag_Xarelto_List.IsSelected := false;
+
+ AntiCoag_Enox_List.IsReadOnly := false;
+ AntiCoag_Warfarin_List.IsReadOnly := false;
+ else
+
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflic", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+ AntiCoag_Xarelto_List.IsSelected := false;
+ AntiCoag_Enox_List.IsReadOnly := false;
+ AntiCoag_Warfarin_List.IsReadOnly := false;
+ endif;
+ endif;
+ endif;
+ endif;
+ //put field changes before this line
+
+ endif; // field change
+
+ elseif (callingevent = "FormOpen")
+ then
+
+ NewReadOnly := ();
+ for k in (1 seqto (count Grid_AntiEmetic_List.IsSelected)) do
+ if k <= 3 then
+ NewReadOnly := NewReadOnly, false;
+ else
+ NewReadOnly := NewReadOnly, true;
+ endif;
+ enddo;
+
+ allergtrue:= read last {"select count(*) from cv3allergydeclaration as ad "
+ || " join cv3allergen as a "
+ || " on a.guid = ad.allergenguid "
+ || " and a.code like {{{SINGLE-QUOTE}}}penicillin%{{{SINGLE-QUOTE}}} "
+ || " where ad.clientguid = " || sql(client_guid)
+ || " and ad.active = 1 "
+ || " and ad.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ };
+ numballerg := allergtrue as number;
+
+ if (numballerg >0) then
+ AllergyHold.Value := "True";
+ else AllergyHold.Value := "False";
+ endif;
+
+
+ endif; // calling event
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TPA_ACUTE_ISHEMIC_STROKE.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TPA_ACUTE_ISHEMIC_STROKE.mlm
new file mode 100644
index 0000000..be0d9f8
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TPA_ACUTE_ISHEMIC_STROKE.mlm
@@ -0,0 +1,228 @@
+maintenance:
+
+ title: Set TPA Acute Ishemic Stroke;;
+ mlmname: FORM_Set_TPA_Acute_Ishemic_Stroke;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Robert Spence, Eclipsys Corp Ext 7461;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2009-05-06;;
+ validation: testing;;
+
+library:
+ purpose: Used for TPA Order set to calculate Total Dose, Unused Dose, Bolus Dose and Infusion Dose
+ ;;
+
+ explanation: This MLM is called from the TPA Acute Ishemic Stroke order set, form: OS_TPAORderSet
+
+ Total Dose is Wt in kg * 0.9 With Max of 100
+ Unused Dose = 100 - Total Dose
+ Bolus (Load) Dose = Total Dose * 0.1 Rounded to 1 decimal
+ Infusion Dose = Total Dose * 0.9 Rounded to 1 decimal
+
+ MLM will check and / or height nursing instructions based on if patient is / is not in ED
+ MLM will alert if no weight is input and alert if older than 72 hours.
+ ;;
+ keywords: Called MLMs, TPA, Weight Based Calculator / Calculation
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+/////////////////////////
+
+
+ comb_ht_wt_fld := first of (field_list
+ where field_list.DataItemName = "CombinedMeasurements");
+
+ if exists comb_ht_wt_fld then
+ // comb_ht_wt_fld.control_read_only := true;
+ comb_ht_wt_val := comb_ht_wt_fld.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;
+
+
+ emessage1 := "********************** WEIGHT IS NOT ENTERED **********************";
+ emessage2:= "";
+ emessage3:= "********************** THE WEIGHT OF THE PATIENT IS OLDER THAN 6 HOURS"
+ || " **********************";
+//////////////////////
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+///////////////////////
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_Info");
+
+///////////////////
+
+
+ All_Order_Line:= first of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = 1);
+ All_List := All_Order_Line.Value;
+
+
+
+ Non_ED_Order_Line := first of (field_list where field_list.DataItemName = "MultiOrderInline"
+ and field_List.Control_MultiFieldOccNum = 2);
+
+ Non_ED_List := Non_ED_Order_Line.Value;
+
+
+
+/////////////////
+
+ // Mappings, set on order set, sets the children
+
+ Set_Bolus_Dose := last of (field_list where field_list.DataItemName = "DosageLow"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+
+ Set_Infusion_Dose := last of (field_list where field_list.DataItemName = "DosageLow"
+ and field_List.Control_MultiFieldOccNum = 2);
+
+ All_Instructions := first of (field_list where field_list.DataItemName = "NUR_GenAdditionalTxt" and field_List.Control_MultiFieldOccNum = 1);
+
+
+
+ Admin1 := last of (field_list where field_list.DataItemName = "AdminInstructions"
+ and field_List.Control_MultiFieldOccNum = 1);
+
+
+ Admin2 := last of (field_list where field_list.DataItemName = "AdminInstructions"
+ and field_List.Control_MultiFieldOccNum = 2);
+
+ If CallingEvent = "FormOpen" then
+
+ DiffMinutes:= read last
+ {" SELECT Top 1 "
+ || " datediff(minute,touchedwhen, getdate()) "
+ || " from CV3PhysicalNoteDeclaration "
+ || " where clientguid = " || SQL(client_guid)
+ || " and chartguid = " || SQL(chart_guid )
+ || " and active = 1 "
+ || " and typecode = {{{SINGLE-QUOTE}}}WEIGHT{{{SINGLE-QUOTE}}} "
+ || " order by touchedwhen desc "
+ };
+
+
+ wterr := false;
+
+
+ if DiffMinutes >361
+ then
+ wterr:=true;
+ prx_comment.value := emessage3;
+ elseif not exists DiffMinutes then
+ prx_comment.value := emessage1;
+ elseif diffminutes <361 and diffminutes > 0 then
+ prx_comment.value := emessage2;
+ endif;
+
+
+
+ All_List.IsReadOnly := (True,True,True,True,True,True,True,True,True);
+ All_List.IsSelected := (True,True,True,True,True,True,True,True,True);
+
+ elseif (CallingEvent = "FieldChange" and CallingField = "CombinedMeasurements|1") then
+
+ prx_comment.value := emessage;
+
+
+ endif;
+
+
+
+ if exists wt and wt > 0 then
+
+ calctotal:= wt * 0.9;
+
+ If calctotal >= 90 then
+ calctotal := 90;
+ endif;
+
+ calcunused := 100 - calctotal;
+
+ calcbolus := calctotal * 0.1;
+ calcinfusion := calctotal * 0.9;
+
+ calctotal := (int (( calctotal + 0.05) * 10))/10;
+ calcunused := (int (( calcunused + 0.05) * 10))/10;
+ calcbolus := (int (( calcbolus + 0.05) * 10))/10;
+ calcinfusion := (int (( calcinfusion + 0.05) * 10))/10;
+
+ Set_Bolus_Dose.Value := calcbolus;
+ Set_Infusion_Dose.Value := calcinfusion;
+
+ // how to round to one decimal roundme:= (int (( roundme + 0.05) * 10))/10;
+
+
+ Admin1.Value := "Bolus " || calcbolus || " mg of Total Dose: " || calctotal || " mg";
+ Admin2.Value := "Infuse " || calcinfusion || " mg of Total Dose " || calctotal || " mg";
+
+ linebreakme:= read last
+ {" SELECT "
+ || " {{{SINGLE-QUOTE}}}Prepare the Medication:{{{SINGLE-QUOTE}}} +char(13) + char(10) + "
+ || " {{{SINGLE-QUOTE}}}a. Gently reconstitute tPA with the diluent provided. Final concentration of reconstituted solution is 1mg Per ml.{{{SINGLE-QUOTE}}} + "
+ || " char(13) + char(10) "
+ };
+
+ if exists (calcunused) then
+ extramessage := "b. Withdraw the unused quantity (" || calcunused || " ml) and discard.";
+ else
+ extramessage := "b. Withdraw the unused quantity and discard.";
+ endif;
+
+
+ All_Instructions.Value := linebreakme || extramessage;
+ 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:', N'0fdd159e-dcf8-4254-9639-594c4c0dbcaa', 2, N'Set TPA Acute Ishemic Stroke', N'2', N'4.50', CAST(N'2009-05-06T00:00:00.000' AS DateTime), NULL)
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TPA_FOR_PE.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TPA_FOR_PE.mlm
new file mode 100644
index 0000000..fea1717
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TPA_FOR_PE.mlm
@@ -0,0 +1,103 @@
+maintenance:
+
+ title: FORM_SET_tPA_FOR_PE;;
+ mlmname: FORM_SET_tPA_FOR_PE;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet Law, Allscripts 7461;;
+ specialist: Teresa Spicuzza, Allscripts x7461;;
+ date: 2018-09-10;;
+ validation: testing;;
+
+library:
+ purpose: Used for tPA for Pulmonary Embolism order set
+ ;;
+
+ explanation: Used for tPA for Pulmonary Embolism Order Set
+
+Change history
+
+ 09.10.2018 JMLaw CSR 36317 Created.
+
+ ;;
+ keywords: Called MLMs, Shoulder, Post Op
+ ;;
+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*******************/
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ //Need to implicitly call the generic MLM ONLY for the Anticoagulant Grids
+ anticoagulant_conflict := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{SINGLE-QUOTE}}};
+
+ //Retrieve field list of Weight based Heparin Grid
+ WT_Based_Heparin_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 3 );
+ WT_Based_Heparin_List := WT_Based_Heparin_Orders.Value;
+
+ if ( CallingEvent = "FieldChange" ) then
+
+ if ( CallingField = "MultiOrderGrid|3" ) then
+ Heparin_Select := first of ( WT_Based_Heparin_List WHERE WT_Based_Heparin_List.Name matches pattern "%Heparin%" );
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Heparin_Select.Name);
+
+ if ( stop = true ) then
+ if ( severity = "high" ) then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ WT_Based_Heparin_List.IsSelected := false;
+
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ( ( dialogRes as String ) = "No" ) then
+
+ WT_Based_Heparin_List.IsSelected := false;
+
+ endif;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TPN.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TPN.mlm
new file mode 100644
index 0000000..a05a288
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TPN.mlm
@@ -0,0 +1,425 @@
+maintenance:
+
+ title: TPN Order Set;;
+ mlmname: FORM_Set_TPN;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Bryan Berkeybile, Allscripts ;;
+ specialist: Don Warnick, Allscripts;;
+ date: 2012-11-05;;
+ validation: testing;;
+
+library:
+ purpose: Based upon time of day and active patient orders already on the patient,
+ the MLM will select/de-select lab baseline and follow-up orders and determine appropriate start date/time.
+ ;;
+
+ explanation: This MLM is called from the TPN Parental Nutrition Order Set (TPN Parent Nut Ord)
+
+ Change history
+ 11.01.11 DJW CSR# copied from FORM_Set_PostOp_Lumbar_Lam
+ 12.18.19 STH/TMS CSR# 35713 - Added new lab section that needs to work in conjuction with the other lab sections correctly.
+ ;;
+ keywords: Called MLMs, TPN Parent Nut Ord
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Communication object Form object Arden ClientInfo object
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ // Get the current time (hours and minutes zero padded to 2 digits), then determine the time range
+ If (Extract Hour NOW) in(0,1,2,3,4,5,6,7,8,9)then HR:="0"||(Extract Hour NOW); else HR:=(Extract Hour NOW); endif;
+ If (Extract Minute NOW)in(0,1,2,3,4,5,6,7,8,9)then MN:="0"||(Extract Minute NOW);else MN:= (Extract Minute NOW);endif;
+ TimeOfDay := HR || MN;
+
+ if TimeOfDay >= "0000" and TimeOfDay <= "0300" then TimeRange:= "1";
+ elseif TimeOfDay >= "0301" and TimeOfDay <= "0930" then TimeRange:= "2";
+ elseif TimeOfDay >= "0931" and TimeOfDay <= "1400" then TimeRange:= "3";
+ else TimeRange:= "4";
+ endif;
+
+ // Get the current day of week, to detemine Daily Order stop dates
+
+ DayOfWeekToday := read last {" select DATEPART(dw, GETDATE())"};
+ DayOfWeekTomorrow := read last {" select DATEPART(dw, GETDATE()+1)"};
+
+
+ // Set the future date vaules used for populating the order start date and reminder stop date fields
+
+ T_Plus_1 := (NOW + 1 day) FORMATTED WITH "%.2t";
+ T_Plus_2 := (NOW + 2 day) FORMATTED WITH "%.2t";
+ T_Plus_5 := (NOW + 5 day) FORMATTED WITH "%.2t";
+ T_Plus_8 := (NOW + 8 day) FORMATTED WITH "%.2t"; //added for the new days 4 through 7 labs
+
+ T_Plus_14 := (NOW + 14 day) FORMATTED WITH "%.2t";
+ T_Plus_15 := (NOW + 15 day) FORMATTED WITH "%.2t";
+ T_Plus_16 := (NOW + 16 day) FORMATTED WITH "%.2t";
+ T_Plus_17 := (NOW + 17 day) FORMATTED WITH "%.2t";
+ T_Plus_18 := (NOW + 18 day) FORMATTED WITH "%.2t";
+ T_Plus_19 := (NOW + 19 day) FORMATTED WITH "%.2t";
+ T_Plus_20 := (NOW + 20 day) FORMATTED WITH "%.2t";
+ T_Plus_21 := (NOW + 21 day) FORMATTED WITH "%.2t";
+ T_Plus_22 := (NOW + 22 day) FORMATTED WITH "%.2t";
+
+
+ // Date and Time Fields (hidden)
+
+ Baseline_Date := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ Followup_Start_Date_1 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ Followup_Start_Date_2 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+
+ Reminder_Date_1 := first of (field_list where field_list.DataItemName = "Nur_ToDate" and field_List.Control_MultiFieldOccNum = 1);
+ Reminder_Date_2 := first of (field_list where field_list.DataItemName = "Nur_ToDate" and field_List.Control_MultiFieldOccNum = 2);
+
+ Time_Field_1 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1);
+ Time_Field_2 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2);
+
+ Time_Field_1_Value := Time_Field_1.value;
+ Time_Field_2_Value := Time_Field_2.value;
+
+ // Order Checkbox Sections
+
+ Baseline_Today_Checkbox:= first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 4);
+ AddOn_Today_Checkbox:= first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 7);
+ AM_Rounds_Checkbox := first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 5);
+ AM_Rounds4t7_Checkbox := first of (field_list where field_list.DataItemName = "MultiOrderCheckbox" and field_List.Control_MultiFieldOccNum = 8);
+
+ Baseline_Today_List := Baseline_Today_Checkbox.Value;
+ AddOn_Today_Checkbox_Value := AddOn_Today_Checkbox.value;
+ AM_Rounds_List := AM_Rounds_Checkbox.Value;
+ AM_Rounds4t7_List := AM_Rounds4t7_Checkbox.Value;
+
+ Comment_Field := first of (field_list where field_list.DataItemName = "Lab_Info" and field_List.Control_MultiFieldOccNum = 1);
+
+ // Get the Baseline order names and search the patient record for them
+
+ Baseline_Today_List_Names:= Baseline_Today_List.Name;
+ OrderNames := " ";
+ index_list2 := 1 seqto (count Baseline_Today_List_Names) ;
+
+ for J in index_list2 do
+ OrderNames := OrderNames || "{{{SINGLE-QUOTE}}}" || Baseline_Today_List_Names[J] || "{{{SINGLE-QUOTE}}}," ;
+ enddo;
+ OrderNames := OrderNames || "{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}}";
+
+ CurrentOrdersListToday := read
+ { " select distinct "
+ || " case when om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}} "
+ || " when om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Calcium Ionized{{{SINGLE-QUOTE}}} else om.Name end "
+ || " from cv3ordercatalogmasteritem om with (nolock) "
+ || " join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = om.guid and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} "
+ || " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
+ || " and convert(char(10),o.SignificantDtm,20) = convert(char(10), GETDATE(),20) "
+ || " where o.chartguid = " || SQL(chart_guid) || " and o.clientguid = " || SQL(client_guid) || " and o.clientvisitguid = " || SQL(visit_guid) || " "
+ || " and (om.Name in (" || OrderNames ||") or om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} or om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}})"
+ };
+
+ CurrentOrdersListTodayTubeTypeCount := read last
+ { " select count (distinct ctv.value) "
+ || " from cv3ordercatalogmasteritem om with (nolock) "
+ || " join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = om.guid and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} "
+ || " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
+ || " and convert(char(10),o.SignificantDtm,20) = convert(char(10), GETDATE(),20) "
+ || " join cv3catalogclasstypevalue ctv with (nolock) on ctv.catalogmasterguid = om.guid "
+ || " and ctv.Value in ({{{SINGLE-QUOTE}}}Light Green{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lavender{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Kelly Green{{{SINGLE-QUOTE}}}) "
+ || " where o.chartguid = " || SQL(chart_guid) || " and o.clientguid = " || SQL(client_guid) || " and o.clientvisitguid = " || SQL(visit_guid) || " "
+ };
+
+ if CurrentOrdersListTodayTubeTypeCount = 3 then NewBloodDrawNeeded := "No";
+ else NewBloodDrawNeeded := "Yes";
+ endif;
+
+ CurrentOrdersListTomorrow := read
+ { " select distinct "
+ || " case when om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}} "
+ || " when om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Calcium Ionized{{{SINGLE-QUOTE}}} else om.Name end "
+ || " from cv3ordercatalogmasteritem om with (nolock) "
+ || " join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = om.guid and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} "
+ || " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
+ || " and convert(char(10),o.SignificantDtm,20) = convert(char(10), GETDATE()+1,20) "
+ || " where o.chartguid = " || SQL(chart_guid) || " and o.clientguid = " || SQL(client_guid) || " and o.clientvisitguid = " || SQL(visit_guid) || " "
+ || " and (om.Name in (" || OrderNames ||") or om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} or om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}})"
+ };
+
+ // Get the AM Rounds X3 order names and search the patient record for them
+
+ AM_Rounds_List_Names:= AM_Rounds_List.Name;
+ OrderNames := " ";
+ index_list2 := 1 seqto (count AM_Rounds_List_Names) ;
+
+ for J in index_list2 do
+ OrderNames := OrderNames || "{{{SINGLE-QUOTE}}}" || AM_Rounds_List_Names[J] || "{{{SINGLE-QUOTE}}}," ;
+ enddo;
+ OrderNames := OrderNames || "{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}";
+
+ CurrentOrders_3days_Starting_Tomorrow := read
+ { " CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), orderid varchar(100),orddate datetime) "
+ || " INSERT INTO #tmp_aaa (orderid, orddate) "
+ || " select distinct "
+ || " case when om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}} "
+ || " when om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Calcium Ionized{{{SINGLE-QUOTE}}} else om.Name end, "
+ || " convert(char(10),o.SignificantDtm,20) "
+ || " from cv3ordercatalogmasteritem om with (nolock) "
+ || " join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = om.guid and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} "
+ || " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
+ || " and convert(char(10),o.SignificantDtm,20) > convert(char(10), GETDATE(),20) "
+ || " and convert(char(10),o.SignificantDtm,20) < convert(char(10), GETDATE()+4,20) "
+ || " where o.chartguid = " || SQL(chart_guid) || " and o.clientguid = " || SQL(client_guid) || " and o.clientvisitguid = " || SQL(visit_guid) || " "
+ || " and (om.Name in (" || OrderNames ||") or om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} or om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}})"
+ || " CREATE TABLE #tmp_bbb( ID int IDENTITY(1, 1), orderid varchar(100), tot int) "
+ || " INSERT INTO #tmp_bbb (orderid,tot) "
+ || " SELECT orderid, COUNT(orderid) as Total FROM #tmp_aaa GROUP BY orderid ORDER BY Total DESC "
+ || " select orderid from #tmp_bbb where tot =3 "
+ || " drop table #tmp_aaa "
+ || " drop table #tmp_bbb "
+ };
+
+ CurrentOrders_3days_Starting_Day_After_Tomorrow := read
+ { " CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), orderid varchar(100),orddate datetime) "
+ || " INSERT INTO #tmp_aaa (orderid, orddate) "
+ || " select distinct "
+ || " case when om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}} "
+ || " when om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Calcium Ionized{{{SINGLE-QUOTE}}} else om.Name end, "
+ || " convert(char(10),o.SignificantDtm,20) "
+ || " from cv3ordercatalogmasteritem om with (nolock) "
+ || " join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = om.guid and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} "
+ || " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
+ || " and convert(char(10),o.SignificantDtm,20) > convert(char(10), GETDATE()+1,20) "
+ || " and convert(char(10),o.SignificantDtm,20) < convert(char(10), GETDATE()+5,20) "
+ || " where o.chartguid = " || SQL(chart_guid) || " and o.clientguid = " || SQL(client_guid) || " and o.clientvisitguid = " || SQL(visit_guid) || " "
+ || " and (om.Name in (" || OrderNames ||") or om.Name like {{{SINGLE-QUOTE}}}%cbc%{{{SINGLE-QUOTE}}} or om.Name like {{{SINGLE-QUOTE}}}%calcium ionized%{{{SINGLE-QUOTE}}})"
+ || " CREATE TABLE #tmp_bbb( ID int IDENTITY(1, 1), orderid varchar(100), tot int) "
+ || " INSERT INTO #tmp_bbb (orderid,tot) "
+ || " SELECT orderid, COUNT(orderid) as Total FROM #tmp_aaa GROUP BY orderid ORDER BY Total DESC "
+ || " select orderid from #tmp_bbb where tot =3 "
+ || " drop table #tmp_aaa "
+ || " drop table #tmp_bbb "
+ };
+
+
+// OPEN EVENT SECTION
+ If CallingEvent = "FormOpen" Then
+
+ // If Before 1400
+
+ if TimeRange = "1" or Timerange = "2" or Timerange = "3" then
+
+ // Deselect active orders scheduled for today in Baseline Today section
+
+ index_list := 1 seqto (count CurrentOrdersListToday) ;
+ for J in index_list do
+ CurrentOrder := CurrentOrdersListToday[J];
+ Baseline_Today_Item := first of (Baseline_Today_List where Baseline_Today_List.Name = CurrentOrder);
+ Baseline_Today_Item.ISSelected := false;
+ Baseline_Today_Item.ISReadOnly := true;
+ enddo;
+
+ // Once the looping is complete, look for the senario where the patient has no CMP, but has a BMP
+
+ if "Comprehensive Metabolic Panel" not in CurrentOrdersListToday and
+ ("Basic Metabolic Panel" in CurrentOrdersListToday or "Basic Metabolic Panel Fasting" in CurrentOrdersListToday)
+ then
+ AddOn_Today_Checkbox_Value.IsSelected := (true); // set all Add-On checkboxes to true
+ Baseline_Today_Item := first of (Baseline_Today_List where Baseline_Today_List.Name = "Comprehensive Metabolic Panel");
+ Baseline_Today_Item.ISSelected := false;
+ Baseline_Today_Item.ISReadOnly := true;
+ else
+ AddOn_Today_Checkbox_Value.ISReadOnly := (true); // set all Add-On checkboxes to read only
+ endif;
+
+
+ // Deselect AM rounds orders that have a current order scheduled for all 3 days (starting tomorrow)
+
+ index_list := 1 seqto (count CurrentOrders_3days_Starting_Tomorrow) ;
+ for J in index_list do
+ CurrentOrder := CurrentOrders_3days_Starting_Tomorrow[J];
+ AM_Rounds_Item := first of (AM_Rounds_List where AM_Rounds_List.Name = CurrentOrder);
+ AM_Rounds_Item.ISSelected := false;
+ AM_Rounds_Item.ISReadOnly := true;
+ enddo;
+
+ if TimeRange = "1"
+ then
+ if NewBloodDrawNeeded = "Yes"
+ then Time_Field_1_Value.ReqTimeCode := "AM Rounds";
+ else Time_Field_1_Value.ReqTimeCode := "Routine Collected Specimen";
+ endif;
+
+ elseif TimeRange = "2"
+ then
+ if NewBloodDrawNeeded = "Yes"
+ then Time_Field_1_Value.ReqTimeCode := "Today";
+ else Time_Field_1_Value.ReqTimeCode := "Routine Collected Specimen";
+ endif;
+
+ else // TimeRange = "3"
+ if NewBloodDrawNeeded = "Yes"
+ then Time_Field_1_Value.ReqTimeCode := "STAT";
+ else Time_Field_1_Value.ReqTimeCode := "STAT Collected Specimen";
+ endif;
+ endif;
+
+ // Set the Daily Reminder Order Dates - Baseline Order is Today
+
+ if DayOfWeekToday = 2 then Reminder_Date_1.Value := T_Plus_21; Reminder_Date_2.Value := T_Plus_17; // Mon
+ elseif DayOfWeekToday = 3 then Reminder_Date_1.Value := T_Plus_20; Reminder_Date_2.Value := T_Plus_16; // Tue
+ elseif DayOfWeekToday = 4 then Reminder_Date_1.Value := T_Plus_19; Reminder_Date_2.Value := T_Plus_15; // Wed
+ elseif DayOfWeekToday = 5 then Reminder_Date_1.Value := T_Plus_18; Reminder_Date_2.Value := T_Plus_14; // Thu
+
+ elseif DayOfWeekToday = 6 then Reminder_Date_1.Value := T_Plus_20; Reminder_Date_2.Value := T_Plus_17; // Fri
+ elseif DayOfWeekToday = 7 then Reminder_Date_1.Value := T_Plus_19; Reminder_Date_2.Value := T_Plus_16; // Sat
+ elseif DayOfWeekToday = 1 then Reminder_Date_1.Value := T_Plus_18; Reminder_Date_2.Value := T_Plus_15; // Sun
+ endif;
+
+
+ endif; // Before 1400
+
+
+ // If After 14:00
+
+
+ if TimeRange = "4" then
+
+ // Deselect active orders scheduled for tomorrow in Baseline Today section
+
+ index_list := 1 seqto (count CurrentOrdersListTomorrow) ;
+ for J in index_list do
+ CurrentOrder := CurrentOrdersListTomorrow[J];
+ Baseline_Today_Item := first of (Baseline_Today_List where Baseline_Today_List.Name = CurrentOrder);
+ Baseline_Today_Item.ISSelected := false;
+ Baseline_Today_Item.ISReadOnly := true;
+ enddo;
+
+ // Once the looping is complete, look for the senario where the patient has no CMP, but has a BMP
+
+ if "Comprehensive Metabolic Panel" not in CurrentOrdersListTomorrow and
+ ("Basic Metabolic Panel" in CurrentOrdersListTomorrow or "Basic Metabolic Panel Fasting" in CurrentOrdersListTomorrow)
+ then
+ AddOn_Today_Checkbox_Value.IsSelected := (true); // Set all Add-On checkboxes to true
+ Baseline_Today_Item := first of (Baseline_Today_List where Baseline_Today_List.Name = "Comprehensive Metabolic Panel");
+ Baseline_Today_Item.ISSelected := false;
+ Baseline_Today_Item.ISReadOnly := true;
+ else
+ AddOn_Today_Checkbox_Value.ISReadOnly := (true); // set all Add-On checkboxes to read only
+ endif;
+
+ // Deselect AM rounds orders that have a current order scheduled for all 3 days (starting day after tomorrow)
+
+ index_list := 1 seqto (count CurrentOrders_3days_Starting_Day_After_Tomorrow) ;
+ for J in index_list do
+ CurrentOrder := CurrentOrders_3days_Starting_Day_After_Tomorrow[J];
+ AM_Rounds_Item := first of (AM_Rounds_List where AM_Rounds_List.Name = CurrentOrder);
+ AM_Rounds_Item.ISSelected := false;
+ AM_Rounds_Item.ISReadOnly := true;
+ enddo;
+
+ // Set the days ahead by 1 and time to AM Rounds
+
+ Baseline_Date.Value := T_Plus_1;
+ Followup_Start_Date_1.Value := T_Plus_2;
+ Followup_Start_Date_2.Value := T_Plus_5;
+ Time_Field_1_Value.ReqTimeCode := "AM Rounds";
+ Time_Field_2_Value.ReqTimeCode := "Routine";
+
+
+
+ // Set the Daily Reminder Order Dates - Basline Order is Tomorrow
+ // Tod - Tom
+
+ if DayOfWeekTomorrow = 2 then Reminder_Date_1.Value := T_Plus_22; Reminder_Date_2.Value := T_Plus_18; // Sun - Mon
+ elseif DayOfWeekTomorrow = 3 then Reminder_Date_1.Value := T_Plus_21; Reminder_Date_2.Value := T_Plus_17; // Mon - Tue
+ elseif DayOfWeekTomorrow = 4 then Reminder_Date_1.Value := T_Plus_20; Reminder_Date_2.Value := T_Plus_16; // Tue - Wed
+ elseif DayOfWeekTomorrow = 5 then Reminder_Date_1.Value := T_Plus_19; Reminder_Date_2.Value := T_Plus_15; // Wed - Thu
+
+ elseif DayOfWeekTomorrow = 6 then Reminder_Date_1.Value := T_Plus_21; Reminder_Date_2.Value := T_Plus_18; // Thu - Fri
+ elseif DayOfWeekTomorrow = 7 then Reminder_Date_1.Value := T_Plus_20; Reminder_Date_2.Value := T_Plus_17; // Fri - Sat
+ elseif DayOfWeekTomorrow = 1 then Reminder_Date_1.Value := T_Plus_19; Reminder_Date_2.Value := T_Plus_16; // Sat - Sun
+ endif;
+
+ endif; // After 1400
+
+ FU_StartDate_DayOfWeek := read last {" select DATEPART(dw, " || sql(Followup_Start_Date_2.Value) || ")"};
+
+
+ if (FU_StartDate_DayOfWeek = 2) then
+ AM_Rounds4t7_List.IsSelected := (true, false, true, false, true, false);
+ AM_Rounds4t7_List.IsReadOnly := (false, true, false, true, false, true);
+ elseif (FU_StartDate_DayOfWeek in (1,3,4,5,6,7)) then
+ AM_Rounds4t7_List.IsSelected := (false, true, false, true, false, true);
+ AM_Rounds4t7_List.IsReadOnly := (true, false, true, false, true, false);
+ else
+ AM_Rounds4t7_List.IsSelected := (false, false, false, false, false, false);
+ AM_Rounds4t7_List.IsReadOnly := (true, true, true, true, true, true);
+ endif;
+
+
+
+ // Comment Box Section
+
+ Comment:= "For Baseline Lab orders entered at " || HR || ":" || MN || ", ";
+
+ If NewBloodDrawNeeded = "No" and timerange <> "4" then
+ Comment:= Comment || "with the required blood already in the lab,";
+ endif;
+
+ Comment:= Comment || " the schedule is """ || Time_Field_1_Value.ReqTimeCode || """ ";
+
+ If timerange = "4" then
+ Comment:= Comment || " Tomorrow.";
+ endif;
+
+ If NewBloodDrawNeeded = "No" and timerange <> "4" then
+ Comment:= Comment || " * IMPORTANT * You must ""Add Specimen"" to the BaseLine Labs and send the Delivery Document to the Laboratory.";
+ endif;
+
+ Comment_Field.Value := Comment;
+
+
+ Endif; // Open
+
+
+
+// CLOSE EVENT SECTION
+
+
+ If CallingEvent = "FormClose" Then
+
+ If NewBloodDrawNeeded = "No" and timerange <> "4" then
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\nBe sure to ""Add Specimen"" to the BaseLine Labs and send the Delivery Document to the Laboratory.", "Important Reminder","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TRANSFUSION_PRODUCT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TRANSFUSION_PRODUCT.mlm
new file mode 100644
index 0000000..ce6f1e3
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TRANSFUSION_PRODUCT.mlm
@@ -0,0 +1,1238 @@
+maintenance:
+
+ title: FORM_SET_TRANSFUSION_PRODUCT;;
+ mlmname: FORM_SET_TRANSFUSION_PRODUCT;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St. Clair Hospital;;
+ author: Shawn Head, Allscripts Outsourcing;;
+ specialist: Maria Pest, Allscripts Outsourcing;;
+ date: 2014-11-01;;
+ validation: testing;;
+
+library:
+ purpose:
+ CSR#: 32165 - This MLM was developed to assist the orginization with the transfusion products, type and screen,
+ and other product related orders required for the lab and nursing staff. The MLM will be used
+ for the RBC, Platelet, FFP and CRYO transfuse order sets. {GO-Live target date 4/26/2016}
+ ;;
+ explanation:
+ 5.11.2016 STH - CA Service Desk #: 2164523 - Issues with clinic in a bed logic. Needed to add additional code to treate {Go-Live 10/4/2016}
+ 3.22.2017 STH - CA Service Desk #: 2619595 - Issue with Consent order being requested when a patient is in a temp location for surgery. We dont want the alert to fire if the temp location is assigned.
+ 12.18.2017 STH - CSR#: 35959 - Updated auto select statement for platelet ordering when platelet ct >0 and <10.
+ 11.7.2018 STH - CSR#: 36715 & 35594 - This MLM is being updated with the new logic for the custom message box that allow for more felxibility with the message box window. {Go-Live 11/6/2018}
+ 06.13.2018 STH - CSR#: 35594 - Per Maria the blood consent will be moving to whole house instead of just ED. Made changes to the IF logic below for the ER Consent requirements.
+ The section ER_Consent = true has been updated to include both ER_Consent and InPat_Consent being required. {Go-Live 12/5/2018}
+ 03.01.2018 STH - CSR#: 37956 - Added new field for the transfusion rate field. This field needs to work like the indication field for displaying, being mandatory, etc...
+ {go-live 4/16/2019}
+ 07.23.2019 STH - CSR#: 37676 - 18.4 UPGRADE... Required to look for both "1" and "true" for logic in MLM that is looking for a true/false value as it appears 18.4 looks for the SQL value of 0 and 1, and 16.3 looked for the literal true/false.
+ 07.29.2019 STH - CSR#: 37676 - 18.4 UPGRADE... Issue post go-live with transfusion rate showing when it shouldn{{{SINGLE-QUOTE}}}t for staff/MT &/or ASCP.
+ 10.01.2019 STH - CA Service Desk#: 3905806 - Lab System upgrade introduced a new issue with type and screen result data having a new format of date,time (previously just date).
+ Adjusted MLM to addres this. Also update the order source to include "Telephone Read Back Alerts" for CSR #37977.
+ ;;
+ keywords:
+ LAB BB RBCs, FFP, CRYO, Platelet, type and screen
+
+ ;;
+ citations:
+ ;;
+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;
+
+/***************************************************************************************/
+
+ //need to work on unsubmitted orders still this is not currently working
+ local_session := cds_session.local;
+ check_Unsubmitted_typescreen := local_session.SessionUnSubTypeandScreen;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+ WSRequestedBySource := worksheetInfo.RequestedBySource;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ChartGuid := this_communication.ChartGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ formname := trim(this_form.name);
+ cancel_current_order := false;
+ (ClientLocation, location_GUID, Visit_Type, TemporaryLocation) := read last { "select CurrentLocation, CurrentLocationGUID, TypeCode, TemporaryLocation "
+ || " from cv3clientvisit with (nolock) "
+ || " where clientguid = " || sql(ClientGUID)
+ || " and chartguid = " || sql(ChartGuid)
+ || " and guid = " || sql(ClientVisitGuid) };
+ user_guid := this_communication.UserGUID;
+
+ if ((trim(Visit_Type) in ("Inpatient","Observation","Emergency"))) then
+ OutPatient := false;
+ ClinicInBed := false;
+ elseif(trim(Visit_type = "SDC") or (trim(Visit_Type) = "Clinic" and trim(clientLocation) matches pattern "INFUS-%")) then
+ OutPatient := false;
+ ClinicInBed := true;
+ else
+ OutPatient := true;
+ ClinicInBed := false;
+ endif;
+
+ if(trim(clientLocation) matches pattern "INFUS-%") then
+ InfusionPatient := true;
+ else
+ InfusionPatient := false;
+ endif;
+
+ if(ClientLocation = "ER Major" or ClientLocation matches pattern "INFUS-%") then
+ STATPriority := true;
+ endif;
+
+ if(ClientLocation = "ER Major") then
+ STAT_Collected := true;
+ endif;
+
+ //STH - 11.6.2018 - Section updated to identify when its ER Consent required, Inpatient Consent required, or no consent required.
+ if(((ClientLocation = "ER Major") or (ClientLocation matches pattern "ER-%")) and (TemporaryLocation is null)) then
+ ER_Consent := true;
+ InPat_Consent := false;
+ else
+ ER_Consent := false;
+ if(OutPatient) or (ClinicInBed) or (InfusionPatient) then
+ InPat_Consent := false;
+ else
+ InPat_Consent := true;
+ endif;
+ endif;
+
+ occcode := read last {" select OccupationCode from CV3USER U "
+ || " where guid = " || sql(user_guid) };
+ if (formname <> "Lab BB RBCs") or (occcode in ("MD","DO","DMD","DPM","CRNP","PA","PA-C","IT")) then
+ surgprocreq := false;
+ else
+ surgprocreq := true;
+ endif;
+
+ //These users types have been determined to NOT REQUIRE the order to transfuse reason
+ if occcode in ("MT","MT(ASCP)","Staff") then
+ Order2Transfuse := false;
+ else
+ Order2Transfuse := true;
+ endif;
+
+ if ((this_communication.UserGUID = this_communication.CareProviderGUID) and (occcode not in ("MD","DO","DMD","DPM","IT")))then
+ BC_SelectProvider := true;
+ else
+ BC_SelectProvider := false;
+ endif;
+
+ //blood consent select provider section.
+ IF (occcode in ("PA","PA-C","CRNP")) then
+ PA_CRNP := true;
+ else
+ PA_CRNP := false;
+ endif;
+ //physicians should be alerted/prompted to verify they have completed the blood consent discussion with the patient when ordering.
+ if (occcode in ("MD","DO","DMD","DPM","IT")) then
+ Physician := true;
+ else
+ Physician := false;
+ endif;
+
+
+
+/******************************************************************************************************/
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; //used to parse string data into a list
+ Teresas_MLM_for_special_requests := mlm {{{SINGLE-QUOTE}}}FORM_BLOOD_PRODUCT_UPDATE_SIG_EVENTS{{{SINGLE-QUOTE}}};
+ Custom_Msg_Box := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_CUSTOM_MSGBOX{{{SINGLE-QUOTE}}};
+
+ AlertWindowHeight := "350"; //This will be the hight of the window. Minimum is 250.
+ AlertWindowWidth := "650"; //This will be the width of the window. Minimum is 480;
+ MB_VAlign := "CENTER"; //Options are TOP, BOTTOM, CENTER. This will vertically align the text in the primary message box.
+ MB_HAlign := "CENTER"; //Options are LEFT, RIGHT, CENTER. This will horizontially align the message box textual content in the primary message box.
+
+ AdditionalInfoBox := "";
+ ADINFO_VAlign := "CENTER"; //Options are TOP, BOTTOM, CENTER. This will vertically align the text in the additional info message box.
+ ADINFO_HAlign := "CENTER"; //Options are LEFT, RIGHT, CENTER. This will horizontially align the message box textual content in the additional info message box.
+ //THIS CODE CAN BE ENTERED INTO THE MLM WHERE YOU EXPECT THE MESSAGE BOX TO APPEAR. WHAT EVER THE LABEL/TEXT OF THE BUTTON IS CLICKED WILL BE RETURNED
+ //TO THE dlb_result FOR YOU TO CODE YOU MLM BASED ON THE USERS SELECTION.
+
+
+ InPatMsgBoxButtons := ();
+ InPatMsgBoxButtons := ("YES", "SURGICAL","EMERGENCY","CANCEL"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
+ InPatMsgBoxContent := "BLOOD CONSENT REQUIREMENT\n\nThe appropriate risks and benefits of blood transfusion have been discussed with this patient or the patient{{{SINGLE-QUOTE}}}s representative."
+ || "\n\n***Surgical***\nConsent not required for transfusion need during or post surgery."
+ || "\n\n***Emergency***\nUnable to obtain consent in life threatening situation. "
+ || "\n(Uncrossmatched Red Cells)";
+
+ ERMsgBoxButtons := ();
+ ERMsgBoxButtons := ("YES", "CANCEL","EMERGENCY"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
+ ERMsgBoxContent := "BLOOD CONSENT REQUIREMENT\n\nThe appropriate risks and benefits of blood transfusion have been discussed with this patient or the patient{{{SINGLE-QUOTE}}}s representative."
+ || "\n\n***Emergency***\nUnable to obtain consent in life threatening situation. "
+ || "\n(Uncrossmatched Red Cells)";
+
+
+
+ /*
+
+ Custom_Msg_Box := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_CUSTOM_MSGBOX{{{SINGLE-QUOTE}}};
+ ERMsgBoxButtons := ();
+ ERMsgBoxButtons := ("YES", "CANCEL","EMERGENCY"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
+ ERMsgBoxTitleBar := "Blood Consent Requirement";
+ ERMsgBoxDetails := "\n\nThe appropriate risks and benefits of blood transfusion have been discussed with this patient or the patient{{{SINGLE-QUOTE}}}s representative."
+ || "\n\n***Emergency***\nUnable to obtain consent in life threatening situation.";
+ InPatMsgBoxButtons := ();
+ InPatMsgBoxButtons := ("YES", "POST SURGICAL","EMERGENCY"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
+ InPatMsgBoxTitleBar := "Blood Consent Requirement";
+ InPatMsgBoxDetails := "\nThe appropriate risks and benefits of blood transfusion have been discussed with this patient or the patient{{{SINGLE-QUOTE}}}s representative."
+ || "\n\n***Post Surgical***\nConsent not required for transfusion need caused by surgery."
+ || "\n\n***Emergency***\nUnable to obtain consent in life threatening situation.";
+
+
+
+ MsgBoxHeight := "250";
+ MsbBoxWidth := "650";
+*/
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := FALSE;
+
+
+
+
+ //BEGIN LOGIC FOR RED BLOOD CELLS ORDERSET
+ if (formname = "Lab BB RBCs") then
+ transfusion_order_grid := "MultiOrderGrid|2";
+ surgery_order_grid := "MultiOrderGrid|3";
+ Hidden_Lab_LV_BB_Indication := "LAB_VO_DI_BB Indication|1";
+ Hidden_Requested_date := "RequestedDate|1";
+ Hidden_Requested_Time := "RequestedTime|1";
+ Hidden_Units_for_Surgery := "LAB_RC_XMA|1";
+ Hidden_Units_for_Transfusion := "LAB_RC_XMA|2";
+ Transfusion_Date := "LAB_VO_BB Transfuse Date|1";
+ Transfusion_Indication := "LAB_VO_DI_BBProd Trans Ind RC|1";
+ Infusion_Rate := "BB Blood Infusion Rate RBC|1";
+ Surgery_date := "LAB_VO_BB Surgery Date|1";
+ Surgical_Procedure := "LAB_VO_DI_BBProd Surgical Proc|1";
+ Current_Result_details := "BB Query RBC Indication|1";
+ TypeAndScreen_Order_Grid := "MultiOrderCheckBox|2";
+ TypeAndScreen_OP_Order_Grid := "MultiOrderCheckBox|3";
+ Selected_Priority := "RequestedTime|2";
+ transfuse_product_grid := "MultiOrderGrid|5";
+ Infobox := "MultiOrderGrid|6";
+ OutPatient_Transfused_90days := "BB Type and Screen Transfusion Question|1";
+ OutPatient_Pregnant_90days := "BB Type and Screen Pregnancy Question|1";
+ TypeAndScreen_Expiration_dttm := "BB_TYHD_EXX|1";
+ BB_Consent_Provider := "BB Consent 10|1";
+ BB_Consent_Provider_Required := "BB Consent 10|2";
+ Consent_Order := "MultiOrderCheckbox|4";
+ endif;
+ //END LOGIC FOR RED BLOOD CELLS ORDERSET
+
+
+ //BEGIN PLATELET ORDER SET
+ if (formname = "Lab BB Platelets") then
+ transfusion_order_grid := "MultiOrderGrid|2";
+ surgery_order_grid := "MultiOrderGrid|3";
+ Hidden_Lab_LV_BB_Indication := "LAB_VO_DI_BB Indication|1";
+ Hidden_Requested_date := "RequestedDate|1";
+ Hidden_Requested_Time := "RequestedTime|1";
+ Transfusion_Date := "LAB_VO_BB Transfuse Date|1";
+ Transfusion_Indication := "LAB_VO_DI_BBProd Trans Ind Plt|1";
+ Infusion_Rate := "BB Blood Infus Rate FFP PLT|1";
+ Surgery_date := "LAB_VO_BB Surgery Date|1";
+ Surgical_Procedure := "LAB_VO_FT_BB Surg Procedure|1";
+ Current_Result_details := "BB Query PLT Indication|1";
+ TypeAndScreen_Order_Grid := "MultiOrderCheckBox|2";
+ TypeAndScreen_OP_Order_Grid := "MultiOrderCheckBox|3";
+ Selected_Priority := "RequestedTime|2";
+ transfuse_product_grid := "MultiOrderGrid|5";
+ Infobox := "MultiOrderGrid|6";
+ OutPatient_Transfused_90days := "BB Type and Screen Transfusion Question|1";
+ OutPatient_Pregnant_90days := "BB Type and Screen Pregnancy Question|1";
+ TypeAndScreen_Expiration_dttm := "BB_TYHD_EXX|1";
+ Special_Order_Only1 := "BB SpecPlts MLM to Mapped|1";
+ Special_Order_Only2 := "LAB_VO_DI_BB Sp Needs Plt|1";
+ BB_Consent_Provider := "BB Consent 10|1";
+ BB_Consent_Provider_Required := "BB Consent 10|2";
+ Consent_Order := "MultiOrderCheckbox|4";
+
+ endif;
+ //END PLATELET ORDER SET
+
+ //BEGIN FFP ORDER SET
+ if (formname = "Lab BB FFP") then
+ transfusion_order_grid := "MultiOrderGrid|2";
+ surgery_order_grid := "MultiOrderGrid|3";
+ Hidden_Lab_LV_BB_Indication := "LAB_VO_DI_BB Indication|1";
+ Hidden_Requested_date := "RequestedDate|1";
+ Hidden_Requested_Time := "RequestedTime|1";
+ Hidden_Units_for_Surgery := "LAB_RC_%UO|2";
+ Hidden_Units_for_Transfusion := "LAB_RC_%UO|1";
+ Transfusion_Date := "LAB_VO_BB Transfuse Date|1";
+ Transfusion_Indication := "LAB_VO_DI_BBProd Trans Ind FFP|1";
+ Infusion_Rate := "BB Blood Infus Rate FFP PLT|1";
+ Surgery_date := "LAB_VO_BB Surgery Date|1";
+ Surgical_Procedure := "LAB_VO_FT_BB Surg Procedure|1";
+ Current_Result_details := "BB Query RBC Indication|1";
+ TypeAndScreen_Order_Grid := "MultiOrderCheckBox|2";
+ TypeAndScreen_OP_Order_Grid := "MultiOrderCheckBox|3";
+ Selected_Priority := "RequestedTime|2";
+ transfuse_product_grid := "MultiOrderGrid|5";
+ //Infobox := "MultiOrderGrid|6";
+ OutPatient_Transfused_90days := "BB Type and Screen Transfusion Question|1";
+ OutPatient_Pregnant_90days := "BB Type and Screen Pregnancy Question|1";
+ TypeAndScreen_Expiration_dttm := "BB_TYHD_EXX|1";
+ BB_Consent_Provider := "BB Consent 10|1";
+ BB_Consent_Provider_Required := "BB Consent 10|2";
+ Consent_Order := "MultiOrderCheckbox|4";
+
+ endif;
+ //END FFP ORDER SET
+
+
+ //BEGIN CRYO ORDER SET
+ if (formname = "Lab BB CRYO") then
+ transfusion_order_grid := "MultiOrderGrid|2";
+ surgery_order_grid := "MultiOrderGrid|3";
+ Hidden_Lab_LV_BB_Indication := "LAB_VO_DI_BB Indication|1";
+ Hidden_Requested_date := "RequestedDate|1";
+ Hidden_Requested_Time := "RequestedTime|1";
+ Transfusion_Date := "LAB_VO_BB Transfuse Date|1";
+ Transfusion_Indication := "LAB_VO_DI_BBProd Trans Ind Cryo|1";
+ Surgery_date := "LAB_VO_BB Surgery Date|1";
+ Surgical_Procedure := "LAB_VO_FT_BB Surg Procedure|1";
+ Current_Result_details := "BB Query RBC Indication|1";
+ TypeAndScreen_Order_Grid := "MultiOrderCheckBox|2";
+ TypeAndScreen_OP_Order_Grid := "MultiOrderCheckBox|3";
+ Selected_Priority := "RequestedTime|2";
+ transfuse_product_grid := "MultiOrderGrid|5";
+ //Infobox := "MultiOrderGrid|6";
+ OutPatient_Transfused_90days := "BB Type and Screen Transfusion Question|1";
+ OutPatient_Pregnant_90days := "BB Type and Screen Pregnancy Question|1";
+ TypeAndScreen_Expiration_dttm := "BB_TYHD_EXX|1";
+ BB_Consent_Provider := "BB Consent 10|1";
+ BB_Consent_Provider_Required := "BB Consent 10|2";
+ Consent_Order := "MultiOrderCheckbox|4";
+
+ endif;
+ //END CRYO ORDER SET
+
+ //BEGIN - FIELDS ON ORDER SET NEEDED FOR THIS MLM
+ OS_Field_Details := call str_parse with transfusion_order_grid,"|";
+ Product_Transfusion_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with surgery_order_grid,"|";
+ Surgery_Product_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with Hidden_Lab_LV_BB_Indication,"|";
+ Lab_LV_BB_Indication_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+
+ OS_Field_Details := call str_parse with Hidden_Requested_Time ,"|";
+ Hidden_Requested_Time_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+ OS_Field_Details := call str_parse with Hidden_Requested_date ,"|";
+ Hidden_Requested_date_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+ OS_Field_Details := call str_parse with Transfusion_Date ,"|";
+ Transfusion_Date_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+ OS_Field_Details := call str_parse with Transfusion_Indication ,"|";
+ Transfusion_Indication_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+ OS_Field_Details := call str_parse with Infusion_Rate ,"|";
+ Infusion_Rate_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+
+ OS_Field_Details := call str_parse with Surgery_date ,"|";
+ Surgery_date_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+ OS_Field_Details := call str_parse with Surgical_Procedure ,"|";
+ Surgical_Procedure_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+ OS_Field_Details := call str_parse with Current_Result_details ,"|";
+ Current_Result_details_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+ OS_Field_Details := call str_parse with Hidden_Units_for_Surgery ,"|";
+ Hidden_Units_for_Surgery_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+ OS_Field_Details := call str_parse with Hidden_Units_for_Transfusion ,"|";
+ Hidden_Units_for_Transfusion_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+ OS_Field_Details := call str_parse with Selected_Priority ,"|";
+ Selected_Priority_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_Details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_Details[2] as number));
+
+ OS_Field_Details := call str_parse with TypeAndScreen_Order_Grid,"|";
+ TypeAndScreen_Order_Grid_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with TypeAndScreen_OP_Order_Grid,"|";
+ TypeAndScreen_OP_Grid_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+
+ OS_Field_Details := call str_parse with transfuse_product_grid,"|";
+ transfuse_product_Grid_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with Infobox,"|";
+ InfoBox_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with OutPatient_Transfused_90days,"|";
+ OutPatient_Transfused_90days_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with OutPatient_Pregnant_90days,"|";
+ OutPatient_Pregnant_90days_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with TypeAndScreen_Expiration_dttm,"|";
+ TypeAndScreen_Exp_DTTM_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+
+ OS_Field_Details := call str_parse with Special_Order_Only1,"|";
+ Special_Order_Only1_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with Special_Order_Only2,"|";
+ Special_Order_Only2_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with BB_Consent_Provider,"|";
+ BB_Consent_Provider_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with BB_Consent_Provider_Required,"|";
+ BB_Consent_Provider_Required_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ OS_Field_Details := call str_parse with Consent_Order,"|";
+ Consent_Order_fld := last of (field_list WHERE field_list.DataItemName = OS_Field_details[1]
+ AND field_list.Control_MultiFieldOccNum = (OS_Field_details[2] as number));
+
+ typeAndScreen_Order_Item := first of (TypeAndScreen_Order_Grid_fld.Value where TypeAndScreen_Order_Grid_fld.Value.Name = "Type and Screen");
+
+ typeAndScreen_OP_Order_Item := first of (TypeAndScreen_OP_Grid_fld.Value where TypeAndScreen_OP_Grid_fld.Value.Name = "Type and Screen");
+
+
+
+
+ //END - FIELDS ON ORDERSETS NEEDED FOR THIS MLM
+
+/******************************************************************************************************/
+
+
+/******************************************************************************************************/
+
+ //BEGIN - DETERMINE IF RED CELLS FOR TRANSFUSION ORDER IS SELECTED
+ if (true in Product_Transfusion_fld.Value.IsSelected) then
+ Product_Transfusion_Selected := true;
+ else
+ Product_Transfusion_Selected := false;
+ endif;
+ //END - DETEREMINE IF RED CELLS FOR TRANSFUSION IS SELECTED
+
+/******************************************************************************************************/
+ //BEGIN - DETERMINE IF RED CELLS FOR SURGERY IS SELECTED
+ if (true in Surgery_Product_fld.Value.IsSelected) then
+ Product_Surgery_Selected := true;
+ else
+ Product_Surgery_Selected := false;
+ endif;
+ //END - DETERMINE IF RED CELLS FOR SURGERY IS SELECTED
+
+/*****************************************************************************************************/
+ current_speciemen_expiration := ((extract year((TypeAndScreen_Exp_DTTM_fld.Value as time)) || "-" ||extract month((TypeAndScreen_Exp_DTTM_fld.Value as time)) || "-" || extract day((TypeAndScreen_Exp_DTTM_fld.Value as time)) || " 07:00:00") as time);//"Field that holds this data";//sql_speciemen_expiration[1];
+ //BEGIN - FORM OPEN SECTION
+
+ if (CallingEvent = "FormOpen") then
+
+
+ //DISABLE TYPE AND SCREEN GRID
+ typeAndScreen_Order_item.IsReadOnly := true;
+ typeAndScreen_OP_Order_Item.IsReadOnly := true;
+ Consent_Order_fld.Value.IsReadOnly := true;
+ InfoBox_fld.Value.IsReadOnly := true;
+
+ if(STATPriority) then
+ Selected_Priority_fld.Value.ReqTimeCode := "STAT";
+ endif;
+
+ //ALSO NEED TO UPDATE THIS SECTION TO LOOK FOR UNSUBMITTED ORDERS THAT MIGHT HAVE ALREADY BEEN SELECTED, BUT NOT SUBMITTED
+ //FROM OTHER ORDER ENTRY/ORDER SETS
+ //UPDATE LOGIC TO LOOK FOR EXIPRATION DATES > GETDATE() DOWN IN THE FINAL SELECT ON RED CELLS ***ONLY**** ALL OTHER ORDER SETS WILL JUST
+ //LOOK FOR AN EXPIRATION DATE REGARDLESS IF ITS PAST TODAY OR NOT.
+ (sql_speciemen_expiration) := read { " select cv.clientguid, cv.chartguid, cv.guid, cv.TypeCode
+ into #tmp_cv
+ from cv3clientvisit cv with (nolock)
+ where ((cv.ClientGUID = " || sql(ClientGUID) || "
+ and cv.chartguid = " || sql(ChartGuid) || "
+ and cv.guid = " || sql(ClientVisitGuid) || ")
+ or (cv.ClientGUID = " || sql(ClientGUID) || "
+ and cv.TypeCode in ({{{SINGLE-QUOTE}}}Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Admit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SDC{{{SINGLE-QUOTE}}})
+ and cv.AdmitDtm > dateadd(dd,-30,getdate())
+ ))
+
+
+ select
+ o.SignificantDtm
+ , (case when tol.text is null
+ then (DateAdd(hour, 7, DateAdd(day, 4, cast(floor(cast(getdate() as float))as datetime))))
+ when tol.Text like {{{SINGLE-QUOTE}}}%,%{{{SINGLE-QUOTE}}} then dateadd(hh,7,cast(substring(tol.text,0,charindex({{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}},tol.text,0)) as datetime))
+ else dateadd(hh,7,cast(tol.text as datetime))
+ end) as {{{SINGLE-QUOTE}}}specimen_expiration_date{{{SINGLE-QUOTE}}}
+ ,tol.TouchedWhen as {{{SINGLE-QUOTE}}}speciemen_touchedwhen{{{SINGLE-QUOTE}}}
+ into #tmp_TF_Spec_Exp
+ from #tmp_cv cv with (nolock)
+ inner join CV3Order o with (nolock)
+ on cv.clientguid = o.clientguid
+ and cv.ChartGUID = o.ChartGUID
+ and cv.guid = o.ClientVisitGUID
+ left outer join CV3BasicObservation bo with (nolock)
+ on cv.ClientGUID = bo.ClientGUID
+ and cv.ChartGUID = bo.ChartGUID
+ and cv.guid = bo.ClientVisitGUID
+ and bo.ItemName = {{{SINGLE-QUOTE}}}Specimen Expiration{{{SINGLE-QUOTE}}}
+ and bo.OrderGUID = o.GUID
+ and bo.IsHistory = 0
+ left outer join CV3TextualObservationLine tol with (nolock)
+ on bo.ClientGUID = tol.ClientGUID
+ and bo.GUID = tol.ObservationGUID
+ and tol.Active = 1
+ where o.name = {{{SINGLE-QUOTE}}}Type and screen{{{SINGLE-QUOTE}}}
+ and o.ClientGUID = " || sql(ClientGUID) || "
+ and ((
+ (cv.ChartGUID = " || sql(ChartGuid) || "
+ and cv.guid = " || sql(ClientVisitGuid) || ")
+ or (cv.TypeCode in ({{{SINGLE-QUOTE}}}Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Admit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SDC{{{SINGLE-QUOTE}}})
+ and o.SignificantDtm >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), -14) ))
+ and ((tol.Text is not null
+ and tol.Active = 1))
+ or (cv.ChartGUID = " || sql(ChartGuid) || "
+ and cv.guid = " || sql(ClientVisitGuid) || "
+ and (tol.Text is null and o.OrderStatusLevelNum in ({{{SINGLE-QUOTE}}}45{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}55{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}60{{{SINGLE-QUOTE}}})
+ and (DateAdd(hour, 7, DateAdd(day, 4, cast(floor(cast(o.significantDtm as float))as datetime)))) = (DateAdd(hour, 7, DateAdd(day, 4, cast(floor(cast(getdate() as float))as datetime))))
+ )))
+
+ if {{{SINGLE-QUOTE}}}" || sql(check_Unsubmitted_typescreen) || "{{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ begin
+ insert into #tmp_TF_Spec_Exp values (getdate(),(DateAdd(hour, 7, DateAdd(day, 4, cast(floor(cast(getdate() as float))as datetime)))), getdate())
+ end
+
+ if {{{SINGLE-QUOTE}}}" || sql(InfusionPatient) || "{{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ begin
+ delete from #tmp_TF_Spec_Exp
+ where specimen_expiration_date > (DateAdd(hour, 7, DateAdd(day, 4, cast(floor(cast(getdate() as float))as datetime))))
+ select top 1 specimen_expiration_date from #tmp_TF_Spec_Exp with (nolock)
+ where specimen_expiration_date > getdate()
+ order by significantDtm desc
+ end
+
+ else if ((" || sql(formname) || " = {{{SINGLE-QUOTE}}}Lab BB RBCs{{{SINGLE-QUOTE}}})
+ or ({{{SINGLE-QUOTE}}}" || sql(ClinicInBed) || "{{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}))
+ begin
+ select top 1 specimen_expiration_date from #tmp_TF_Spec_Exp with (nolock)
+ where specimen_expiration_date > getdate()
+ order by significantDtm desc
+ end
+ else
+ begin
+
+ select top 1 specimen_expiration_date from #tmp_TF_Spec_Exp with (nolock)
+ order by significantDtm desc
+ end
+
+ drop table #tmp_cv, #tmp_TF_Spec_Exp "};
+ current_speciemen_expiration := sql_speciemen_expiration[1];
+ TypeAndScreen_Exp_DTTM_fld.Value := (current_speciemen_expiration as time);
+ //END - SQL DATABASE FOR VALUES REQUIRED FOR MLM
+
+ transfuse_product_Grid_fld.Value.IsReadOnly := true;
+
+ //THIS CALLS TERESA{{{SINGLE-QUOTE}}}S MLM ON ORDER FORM FOR SPECIAL REQUIREMENTS MAY NEED TO MODIFY TO ALERT ON ORDER SET ONCE IF CHANGING SPECIAL REQUIREMENTS
+ (this_communication, this_form) := call Teresas_MLM_for_special_requests WITH
+ this_communication, this_form, client_info_obj;
+
+ //THIS SECTION IS CALLED TO UPDATE THE HEMOGLOBIN RESULTS ON THE RBC{{{SINGLE-QUOTE}}}S ORDER SET
+ if (this_form.Name = "Lab BB RBCs") then
+
+ //BEGIN - SQL DATABASE FOR VALUES REQUIRED FOR MLM
+ (current_hemoglobin, max_hemoglobin, current_blood_draw_dttm) := read { " select
+ bo.value
+ , (SELECT CONVERT(CHAR(11),o.significantDtm,101)
+ + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + CONVERT(CHAR( 5),o.significantDtm,114) ) as {{{SINGLE-QUOTE}}}significantDtm{{{SINGLE-QUOTE}}}
+ into #tmp_hemoglobin_results
+ from CV3ClientVisit cv with (nolock)
+ inner join CV3BasicObservation bo with(nolock)
+ on cv.ClientGUID = bo.clientguid
+ and cv.ChartGUID = bo.chartguid
+ and cv.guid = bo.clientvisitguid
+ inner join CV3Order o with(nolock)
+ on bo.orderguid = o.guid
+ and bo.clientguid = o.clientguid
+ and bo.chartguid = o.chartguid
+ and bo.clientvisitguid = o.clientvisitguid
+
+ where cv.ClientGUID = " || sql(ClientGUID) || "
+ and cv.ChartGUID = " || sql(ChartGUID) || "
+ and cv.guid = " || sql(ClientVisitGUID) || "
+ and cv.VisitStatus = {{{SINGLE-QUOTE}}}adm{{{SINGLE-QUOTE}}}
+ and bo.ItemName = {{{SINGLE-QUOTE}}}Hemoglobin{{{SINGLE-QUOTE}}}
+ order by bo.Entered desc
+
+ select top 1 value as {{{SINGLE-QUOTE}}}most_recent_value{{{SINGLE-QUOTE}}},
+ (select max(value) from #tmp_hemoglobin_results with(nolock))as {{{SINGLE-QUOTE}}}max_value{{{SINGLE-QUOTE}}}, SignificantDtm as {{{SINGLE-QUOTE}}}dttm_of_most_recent_value{{{SINGLE-QUOTE}}} from #tmp_hemoglobin_results with(nolock)
+ order by SignificantDtm desc "};
+
+ current_hemoglobin_number := (current_hemoglobin[1] as number);
+ max_hemoglobin_number := (max_hemoglobin[1] as number);
+ //BEGIN - UPDATE INFORMATION BOX RELATED TO LATEST HEMOGLOBIN RESULTS
+ if current_blood_draw_dttm[1] <> "" and current_blood_draw_dttm[1] is not null and current_hemoglobin_number > 0 then
+ Current_Result_details_fld.Value := current_hemoglobin_number || " gm/dl - Specimen drawn " ||current_blood_draw_dttm[1];
+ else
+ Current_Result_details_fld.Value := "Hemoglobin Results not available";
+ endif;
+ //END - UPDATE INFORMATION BOX RELATED TO LATEST HEMOGLOBIN RESULTS
+
+ //-------------------------------------------------------------------------------------------------------/
+ //BEGIN - ATTEMPT TO POPULATE TRANSFUSION INDICATION AUTOMATICALLY BASED ON RULES
+ if (current_hemoglobin_number > 0 and current_hemoglobin_number < 7) then
+ Transfusion_Indication_fld.Value := "Hemoglobin less than 7";
+ elseif current_hemoglobin_number > 0 and max_hemoglobin_number > 0 and current_hemoglobin_number < (max_hemoglobin_number * 0.8) then
+ Transfusion_Indication_fld.Value := "Acute Blood Loss";
+ endif;
+ //BEGIN - ATTEMPT TO POPULATE TRANSFUSION INDICATION AUTOMATICALLY BASED ON RULES
+
+ //-------------------------------------------------------------------------------------------------------/
+ endif;
+
+
+
+ if (this_form.Name = "Lab BB Platelets") then
+
+ //BEGIN - SQL DATABASE FOR VALUES REQUIRED FOR MLM
+ (current_platelet, current_blood_draw_dttm) := read { " select
+ bo.value
+ , (SELECT CONVERT(CHAR(11),o.significantDtm,101)
+ + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + CONVERT(CHAR( 5),o.significantDtm,114) ) as {{{SINGLE-QUOTE}}}significantDtm{{{SINGLE-QUOTE}}}
+ from CV3ClientVisit cv with (nolock)
+ inner join CV3BasicObservation bo with(nolock)
+ on cv.ClientGUID = bo.clientguid
+ and cv.ChartGUID = bo.chartguid
+ and cv.guid = bo.clientvisitguid
+ inner join CV3Order o with(nolock) on bo.orderguid = o.guid
+ where cv.ClientGUID = " || sql(ClientGUID) || "
+ and cv.ChartGUID = " || sql(ChartGUID) || "
+ and cv.guid = " || sql(ClientVisitGUID) || "
+ and cv.VisitStatus = {{{SINGLE-QUOTE}}}adm{{{SINGLE-QUOTE}}}
+ and bo.ItemName = {{{SINGLE-QUOTE}}}Platelet Count{{{SINGLE-QUOTE}}}
+ order by bo.Entered desc "};
+
+ current_platelet_number := (current_platelet[1] as number);
+
+ //BEGIN - UPDATE INFORMATION BOX RELATED TO LATEST PLATELET RESULTS
+ if current_blood_draw_dttm[1] <> "" and current_blood_draw_dttm[1] is not null and current_platelet_number > 0 then
+ Current_Result_details_fld.Value := current_platelet_number || " k/ul - Specimen drawn " ||current_blood_draw_dttm[1];
+ else
+ Current_Result_details_fld.Value := "Platelet count result not available";
+ endif;
+ //END - UPDATE INFORMATION BOX RELATED TO LATEST HEMOGLOBIN RESULTS
+
+ //-------------------------------------------------------------------------------------------------------/
+ //BEGIN - ATTEMPT TO POPULATE TRANSFUSION INDICATION AUTOMATICALLY BASED ON RULES
+ if (current_platelet_number > 0 and current_platelet_number < 10) then
+ Transfusion_Indication_fld.Value := "Plt Ct < 10,000/uL in stable, non-bleeding patient";
+ endif;
+ //BEGIN - ATTEMPT TO POPULATE TRANSFUSION INDICATION AUTOMATICALLY BASED ON RULES
+
+ //-------------------------------------------------------------------------------------------------------/
+
+ endif;
+
+
+ if (this_form.Name = "Lab BB FFP") then
+
+ (INR,INR_DTTM) := read { " select
+ bo.value as {{{SINGLE-QUOTE}}}INR{{{SINGLE-QUOTE}}}
+ , (SELECT CONVERT(CHAR(11),o.significantDtm,101)
+ + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + CONVERT(CHAR( 5),o.significantDtm,114) ) as {{{SINGLE-QUOTE}}}significantDtm{{{SINGLE-QUOTE}}}
+ from CV3ClientVisit cv with (nolock)
+ inner join CV3BasicObservation bo with(nolock)
+ on cv.ClientGUID = bo.clientguid
+ and cv.ChartGUID = bo.chartguid
+ and cv.guid = bo.clientvisitguid
+ inner join CV3Order o with(nolock) on bo.orderguid = o.guid
+ where cv.ClientGUID = " || sql(ClientGUID) || "
+ and cv.ChartGUID = " || sql(ChartGUID) || "
+ and cv.guid = " || sql(ClientVisitGUID) || "
+ and cv.VisitStatus = {{{SINGLE-QUOTE}}}adm{{{SINGLE-QUOTE}}}
+ and bo.ItemName = {{{SINGLE-QUOTE}}}INR{{{SINGLE-QUOTE}}}
+ order by o.SignificantDtm desc " };
+
+
+ (PT,PT_DTTM) := read { " select
+ bo.value as {{{SINGLE-QUOTE}}}PT{{{SINGLE-QUOTE}}}
+ , (SELECT CONVERT(CHAR(11),o.significantDtm,101)
+ + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + CONVERT(CHAR( 5),o.significantDtm,114) ) as {{{SINGLE-QUOTE}}}significantDtm{{{SINGLE-QUOTE}}}
+ from CV3ClientVisit cv with (nolock)
+ inner join CV3BasicObservation bo with(nolock)
+ on cv.ClientGUID = bo.clientguid
+ and cv.ChartGUID = bo.chartguid
+ and cv.guid = bo.clientvisitguid
+ inner join CV3Order o with(nolock) on bo.orderguid = o.guid
+ where cv.ClientGUID = " || sql(ClientGUID) || "
+ and cv.ChartGUID = " || sql(ChartGUID) || "
+ and cv.guid = " || sql(ClientVisitGUID) || "
+ and cv.VisitStatus = {{{SINGLE-QUOTE}}}adm{{{SINGLE-QUOTE}}}
+ and bo.ItemName = {{{SINGLE-QUOTE}}}Prothrombin Time{{{SINGLE-QUOTE}}}
+ order by o.SignificantDtm desc " };
+
+ resultdtls := "";
+ if(PT[1] is not null and PT[1] <> "") then
+ resultdtls := "PT: " || PT[1] || " sec " || CRLF;
+ endif;
+ if (INR[1] is not null and INR[1] <> "") then
+ resultdtls := resultdtls || "INR: " || (INR[1] as string);
+ endif;
+ if resultdtls <> "" then
+ Current_Result_details_fld.Value := resultdtls || " - Specimen drawn " || (INR_DTTM[1] as string);
+ else
+ Current_Result_details_fld.Value := "PT/INR results not available";
+ endif;
+
+ endif;
+
+
+
+ if (this_form.Name = "Lab BB CRYO") then
+
+ (Fibrinogen,Fib_DTTM) := read { " select
+ cast(bo.value as varchar) as {{{SINGLE-QUOTE}}}Fibrinogen{{{SINGLE-QUOTE}}}
+ , (SELECT CONVERT(CHAR(11),o.significantDtm,101)
+ + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + CONVERT(CHAR( 5),o.significantDtm,114) ) as {{{SINGLE-QUOTE}}}significantDtm{{{SINGLE-QUOTE}}}
+ from CV3ClientVisit cv with (nolock)
+ inner join CV3BasicObservation bo with(nolock)
+ on cv.ClientGUID = bo.clientguid
+ and cv.ChartGUID = bo.chartguid
+ and cv.guid = bo.clientvisitguid
+ inner join CV3Order o with(nolock) on bo.orderguid = o.guid
+ where cv.ClientGUID = " || sql(ClientGUID) || "
+ and cv.ChartGUID = " || sql(ChartGUID) || "
+ and cv.guid = " || sql(ClientVisitGUID) || "
+ and cv.VisitStatus = {{{SINGLE-QUOTE}}}adm{{{SINGLE-QUOTE}}}
+ and bo.ItemName = {{{SINGLE-QUOTE}}}Fibrinogen{{{SINGLE-QUOTE}}}
+ order by o.SignificantDtm desc " };
+
+ if (Fibrinogen[1] is not null and Fibrinogen[1] <> "") then
+ Current_Result_details_fld.Value := Fibrinogen[1] || " mg/dl - Specimen drawn " || Fib_DTTM[1];
+ else
+ Current_Result_details_fld.Value := "Fibrinogen results not available";
+ endif;
+
+ endif;
+
+ //BEGIN - ORDER TYPE AND SCREEN IF NO EXIPRATION DATE VALID
+ if (current_speciemen_expiration is null OR current_speciemen_expiration = "") then
+ if(outpatient) then
+ typeAndScreen_OP_Order_Item.IsSelected := true;
+ OutPatient_Pregnant_90days_fld.Control_Visible := true;
+ OutPatient_Transfused_90days_fld.Control_Visible := true;
+ OutPatient_Pregnant_90days_fld.Control_Mandatory := true;
+ OutPatient_Transfused_90days_fld.Control_Mandatory := true;
+ else
+ typeAndScreen_Order_Item.IsSelected := true;
+ endif;
+ endif;
+ //END - ORDER TYPE AND SCREEN IF NO EXIPRATION DATE VALID
+ endif;
+ //END - FORM OPEN SECTION
+
+/******************************************************************************************************/
+
+ //BEGIN - FIELD CHANGE SECTION
+ if (CallingEvent = "FieldChange") then
+
+ if(this_communication.CallingFieldName = Special_Order_Only1) then
+ Special_Order_Only2_fld.Value := Special_Order_Only1_fld.Value;//Special_Order_Only1.Value;
+ endif;
+
+
+ surgery := false;
+ transfusion := false;
+
+ if (true in Surgery_Product_fld.Value.IsSelected) then
+ surgery := true;
+ endif;
+ if (true in Product_Transfusion_fld.Value.IsSelected) then
+ transfusion := true;
+ endif;
+ //BEGIN - SHOW/HIDE TRANSFUSION FIELDS BASED ON TRANSFUSION ORDER SELECTION STATUS
+ if (this_communication.CallingFieldName = transfusion_order_grid)then
+ if(transfusion) then
+ Provider_verified := false;
+ OrderConsent := false;
+
+ if((ER_Consent) or (Inpat_Consent))then
+
+ if(local_session.SessionUnSubBloodConsent=false) then
+ active_consent_orders := read last { " select name from cv3order with (nolock)
+ where clientguid = " || sql(ClientGuid)
+ || " and chartguid = " || sql(ChartGuid)
+ || " and clientvisitguid = " || sql(ClientVisitGuid)
+ || " and name = {{{SINGLE-QUOTE}}}Consent for Blood or Blood Products{{{SINGLE-QUOTE}}}
+ and OrderStatusLevelNum >= 15
+ and OrderStatusLevelNum not in (69, 70) "};
+ if(active_consent_orders is null) then
+ //--STH 6/28/2018 - CONSIDER LOGIC HERE TO DETERMINE IF WE NEED A POPUP FOR NURSES TO POSSIBLY BYPASS CONSENT ORDERING. MESSAGE DETAILS TO BE PROVIDED BY MARIA.
+ //THIS ALERT WOULD GIVE THE OPTION TO BYPASS CONSENT FORM BEING REQUIRED AS BLOOD IS BEING ORDER FOR POST PROCEDURE THAT HAS ALREADY RECEIVED CONSENT BASED ON PROCEDURE BEING PERFORMED.
+ OrderConsent := true;
+ endif;
+ endif;
+
+ if(OrderConsent) then
+ Active_Provider := read last { " select cp.DisplayName + {{{SINGLE-QUOTE}}} ({{{SINGLE-QUOTE}}} + u.OccupationCode + {{{SINGLE-QUOTE}}}){{{SINGLE-QUOTE}}} from CV3CareProvider cp with (nolock)
+ inner join cv3user u with (nolock) on cp.guid = u.guid
+ where cp.guid = " || sql(this_communication.CareProviderGUID) };
+
+ Requesting_User := read last { "select cp.DisplayName + {{{SINGLE-QUOTE}}} ({{{SINGLE-QUOTE}}} + u.OccupationCode + {{{SINGLE-QUOTE}}}){{{SINGLE-QUOTE}}} from CV3CareProvider cp with (nolock)
+ inner join cv3user u with (nolock) on cp.guid = u.guid
+ where cp.guid = " || sql(this_communication.UserGUID) };
+ Provider_verified := false;
+ if(BC_SelectProvider) then
+ void := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "Please cancel out of this OrderSet and select the Requesting Physician responsible for obtaining Informed Consent from the patient."
+ ,"Order By Required for Blood Consent ", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ BB_Consent_Provider_Required_fld.Control_Mandatory := true;
+ else
+ if(ER_Consent and ((Physician) or (PA_CRNP)))
+ or (InPat_Consent) then
+
+ if(BB_Consent_Provider_fld.Control_Visible and BB_Consent_Provider_fld.Value <> "" and BB_Consent_Provider_fld.Value is not null) then
+ provider_verified := true;
+ elseif(BB_Consent_Provider_fld.Control_Visible and (BB_Consent_Provider_fld.Value = "" or BB_Consent_Provider_fld.Value is not null)) then
+ provider_verified := false;
+ else
+ /* dlg_result := call Custom_Msg_Box with ("I have discussed the appropriate risks and benefits of blood transfusion with this patient or the patient{{{SINGLE-QUOTE}}}s representative."
+ || "\n\n*****In Emergency Situations ONLY*****\nPress cancel to by-pass patient consent.","Blood Consent Requirement",MsgBoxButtons);
+ */
+ /*--STH 6/28/2018 - ADD IN IF STATEMENT IF INPATIENT OR OBSERVATIONS CALL CUSTOM MESSAGE BOX WITH 4 OPTIONS ELSE CALL REGUALR FOR ED*/
+ if(ER_Consent) then
+ //dlg_result := call Custom_Msg_Box with (ERMsgBoxDetails,ERMsgBoxTitleBar,ERMsgBoxButtons,MsgBoxHeight,MsbBoxWidth);
+ dlg_result := call Custom_Msg_Box with (AlertWindowHeight,AlertWindowWidth,ERMsgBoxContent,MB_VAlign,MB_HAlign,ERMsgBoxButtons,AdditionalInfoBox,ADINFO_VAlign,ADINFO_HAlign);
+ elseif(InPat_Consent) then
+ //dlg_result := call Custom_Msg_Box with (InPatMsgBoxDetails,InPatMsgBoxTitleBar,InPatMsgBoxButtons,MsgBoxHeight,MsbBoxWidth);
+ dlg_result := call Custom_Msg_Box with (AlertWindowHeight,AlertWindowWidth,InPatMsgBoxContent,MB_VAlign,MB_HAlign,InPatMsgBoxButtons,AdditionalInfoBox,ADINFO_VAlign,ADINFO_HAlign);
+ if(WSRequestedBySource = "Telephone"
+ or WSRequestedBySource = "Telephone Read Back Alerts") then
+ Active_Provider := Active_Provider || " - {" || WSRequestedBySource || "}";
+ endif;
+ endif;
+ /* dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "I have discussed the appropriate risks and benefits of blood transfusion with this patient or the patient{{{SINGLE-QUOTE}}}s representative."
+ || "\n\n*****In Emergency Situations ONLY*****\nPress cancel to by-pass patient consent."
+ ,"Blood Consent Requirement ", "YesNoCancel" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ */
+ if(trim((dlg_result as string)) = "YES") then
+ provider_verified := true;
+ if(PA_CRNP) then
+ BB_Consent_Provider_fld.Value := Requesting_User || " / " || Active_Provider;
+ else
+ BB_Consent_Provider_fld.Value := Active_Provider;
+ endif;
+ Consent_Order_fld.Value.IsSelected := true;
+ elseif(trim((dlg_result as string)) = "EMERGENCY") then
+ Provider_verified := true;
+ BB_Consent_Provider_fld.Value := "Emergency situation. No patient consent obtained.";
+ elseif(trim((dlg_result as string)) = "SURGICAL") then
+ Provider_verified := true;
+ BB_Consent_Provider_fld.Value := "Consent not required for transfusion need caused by surgery.";
+
+ else
+ Provider_verified := false;
+ endif;
+ endif;
+ else
+ /*--STH 6/28/2018 - IF ORDER SOURCE IS TELEPHONE ADD TELEPHONE VERBIAGE (MARIA TO PROVIDE) TO ACTIVE_PROVIDER, OTHERWISE JUST INCLUDE USE ACTIVE_PROVIDER AS/IS*/
+ Provider_verified := true;
+ Consent_Order_fld.Value.IsSelected := true;
+ BB_Consent_Provider_fld.Value := Active_Provider;
+ endif;
+ endif;
+ endif;
+ endif;
+
+ if((Provider_verified) and (OrderConsent)) then
+ BB_Consent_Provider_fld.Control_Visible := true;
+ BB_Consent_Provider_fld.Control_Mandatory := true;
+ else
+ Consent_Order_fld.Value.IsSelected := false;
+ //Product_Transfusion_fld.Value.IsSelected := false;
+ BB_Consent_Provider_fld.Control_Visible := BB_Consent_Provider_Required_fld.Control_Mandatory;
+ BB_Consent_Provider_fld.Control_Mandatory := BB_Consent_Provider_Required_fld.Control_Mandatory;
+ endif;
+
+ if((OrderConsent) and (Provider_verified = false)) then
+ Product_Transfusion_fld.Value.IsSelected := false;
+ else
+ Transfusion_Indication_fld.Control_Mandatory := true;
+ if(Order2Transfuse) then
+ Infusion_Rate_fld.Control_Mandatory := true;
+ endif;
+ //Infusion_Rate_fld.Control_Mandatory := true;
+ Transfusion_Date_fld.Control_Mandatory := true;
+ Transfusion_Date_fld.Control_Visible := true;
+ Transfusion_Date_fld.Value := "t";
+ Transfusion_Indication_fld.Control_Visible := true;
+ //Infusion_Rate_fld.Control_Visible := true;
+ if(Order2Transfuse) then
+ Infusion_Rate_fld.Control_Visible := true;
+ endif;
+ if (this_form.Name in ("Lab BB RBCs","Lab BB FFP")) then
+ if (Order2Transfuse = true) then
+ transfuse_product_Grid_fld.Value[1].IsSelected := true;
+ endif;
+ Hidden_Units_for_Transfusion_fld.Control_Mandatory := true;
+ Hidden_Units_for_Transfusion_fld.Control_Visible := true;
+ Hidden_Units_for_Transfusion_fld.Value := 1;
+ else
+ if (Order2Transfuse = true) then
+ transfuse_product_Grid_fld.Value.IsSelected := Product_Transfusion_fld.Value.IsSelected;
+ endif;
+ endif;
+ ENDIF;
+ else
+ Transfusion_Indication_fld.Control_Mandatory := false;
+ Infusion_Rate_fld.Control_Mandatory := false;
+ Transfusion_Date_fld.Control_Mandatory := false;
+ Transfusion_Date_fld.Control_Visible := false;
+ Hidden_Units_for_Transfusion_fld.Control_Visible := false;
+ Hidden_Units_for_Transfusion_fld.Control_Mandatory := false;
+ Transfusion_Date_fld.Value := null;
+ Transfusion_Indication_fld.Control_Visible := false;
+ Infusion_Rate_fld.Control_Visible := false;
+ transfuse_product_Grid_fld.Value.IsSelected := false;
+ if((ER_Consent) or (InPat_Consent)) then
+ BB_Consent_Provider_fld.Control_Visible := false;
+ BB_Consent_Provider_fld.Control_Mandatory := false;
+ BB_Consent_Provider_fld.Value := "";
+ Consent_Order_fld.Value.IsSelected := false;
+ BB_Consent_Provider_Required_fld.Control_Mandatory := false;
+ endif;
+ endif;
+ endif;
+ //END - SHOW/HIDE TRANSFUSION FIELDS BASED ON TRANSFUSION ORDER SELECTION STATUS
+
+
+ //END - TRANSFUSION ORDER GRID CHANGE
+
+ //-------------------------------------------------------------------------------------------------------/
+ IF (this_communication.CallingFieldName = Surgery_order_grid) then
+ //BEGIN - SHOW/HIDE SURGERY FIELDS BASED ON SURGERY ORDER SELECTION STATUS
+ if (surgery) then
+ Surgical_Procedure_fld.Control_Visible := true;
+ Surgery_date_fld.Control_Visible := true;
+ Surgery_date_fld.Control_Mandatory := true;
+ Surgical_Procedure_fld.Control_Mandatory := surgprocreq;
+ if (occcode in ("MD","DO","DMD","DPM","CRNP","PA","PA-C","IT"))then
+ //Surgical_Procedure_fld.Control_Mandatory := false;
+ Hidden_Units_for_Surgery_fld.Control_Visible := true;
+ Hidden_Units_for_Surgery_fld.Control_Mandatory := true;
+ else
+ //Surgical_Procedure_fld.Control_Mandatory := true;
+ if(this_form.Name <> "Lab BB RBCs") then
+ Hidden_Units_for_Surgery_fld.Control_Visible := true;
+ Hidden_Units_for_Surgery_fld.Control_Mandatory := true;
+ endif;
+ endif;
+
+
+
+ else
+ Surgery_date_fld.Control_Mandatory := false;
+ Surgical_Procedure_fld.Control_Mandatory := false;
+ Surgery_date_fld.Value := null;
+ Surgery_date_fld.Control_Visible := false;
+ Hidden_Units_for_Surgery_fld.Value := "";
+ Hidden_Units_for_Surgery_fld.Control_Visible := false;
+ Hidden_Units_for_Surgery_fld.Control_Mandatory := false;
+ Surgical_Procedure_fld.Control_Visible := false;
+ Surgical_Procedure_fld.Value := "";
+ endif;
+ //BEGIN - SHOW/HIDE SURGERY FIELDS BASED ON SURGERY ORDER SELECTION STATUS
+ endif;
+
+ //END - CELLS FOR SURGERY ORDER SELECTION CHANGE
+
+ //-------------------------------------------------------------------------------------------------------/
+
+ //BEGIN - POPULATE NUMBER OF UNITS BASED ON SELECTION OF SURGICAL PROCEDURE
+
+
+ if ((this_communication.CallingFieldName = Surgical_Procedure) and (this_form.Name in("Lab BB RBCs","Lab BB FFP")))then
+ Selected_Surgical_Procedure := Surgical_Procedure_fld.Value;
+ if ((length(Selected_Surgical_Procedure) > 0)) then
+ Hidden_Units_for_Surgery_fld.Control_Visible := true;
+ Hidden_Units_for_Surgery_fld.Control_Mandatory := true;
+ elseif (occcode in ("MD","DO","DMD","DPM","CRNP","PA","PA-C","IT")) then
+ Hidden_Units_for_Surgery_fld.Control_Visible := true;
+ Hidden_Units_for_Surgery_fld.Control_Mandatory := true;
+ Hidden_Units_for_Surgery_fld.Value := "";
+ else
+ Hidden_Units_for_Surgery_fld.Value := "";
+ Hidden_Units_for_Surgery_fld.Control_Visible := false;
+ Hidden_Units_for_Surgery_fld.Control_Mandatory := false;
+ endif;
+ startpos := find "(" IN STRING Selected_Surgical_Procedure;
+ endpos := find ")" IN STRING Selected_Surgical_Procedure;
+ if (startpos > 0 and endpos > 0) then
+ Hidden_Units_for_Surgery_fld.Value := "";
+ unit_len := (endpos - startpos) - 1;
+ number_of_units := substring unit_len characters starting at (startpos + 1) from Selected_Surgical_Procedure;
+ Hidden_Units_for_Surgery_fld.Value := (number_of_units as number);
+ else
+ Hidden_Units_for_Surgery_fld.Value := "";
+ endif;
+ endif;
+ //END - POPULATE NUMBER OF UNITS BASED ON SELECTION OF SURGICAL PROCEDURE
+
+ //BEGIN - SELECT ORDER TO TRANSFUSE ORDERS
+ if ((this_communication.CallingFieldName = Hidden_Units_for_Transfusion) and (Order2Transfuse)) then
+ transfuse_product_Grid_fld.Value.IsSelected := false;
+ unitsforT := (Hidden_Units_for_Transfusion_fld.Value as number);
+ //if ((unitsforT > 0) and (unitsforT < 10)) then
+ for x in (1 seqto unitsforT) do
+ transfuse_product_Grid_fld.Value[x].IsSelected := true;
+ enddo;
+
+ //elseif ((unitsforT as number) >= 4) then
+ // transfuse_product_Grid_fld.Value.IsSelected := true;
+
+ //endif;
+ endif;
+
+
+ TypeScreen_Date_BasedOn := "";
+ if (this_communication.CallingFieldName in (transfusion_order_grid,surgery_order_grid,Transfusion_Date,Surgery_date,Selected_Priority)) then
+
+ //BEGIN - SET DATE VALUES NEEDED FOR DETERMINING IF TYPE AND SCREEN REQUIRED OR NOT
+ todaysdate := ((extract year(now) || "-" ||extract month(now) || "-" || extract day(now) || " 07:00:00") as time);
+ tomorrowsdate := todaysdate + 1 day;
+ if (Surgery_date_fld.Value matches pattern "t%") then
+ testdays := "step1";
+ tdays := find "+" in string Surgery_date_fld.Value;
+ if (tdays > 0) then
+ testdays := "step2";
+ length_days := ((length Surgery_date_fld.Value) - (tdays)) + 1;
+ add_days := substring (length_days) characters starting at tdays from Surgery_date_fld.Value;
+ surgerydate := ((extract year(now) || "-" ||extract month(now) || "-" || extract day(now) || " 07:00:00") as time);
+ surgerydate := surgerydate + add_days days;
+ else
+ testdays := "step3";
+ surgerydate := ((extract year(now) || "-" ||extract month(now) || "-" || extract day(now) || " 07:00:00") as time);
+ endif;
+
+ elseif Surgery_date_fld.Value is not null and Surgery_date_fld.Value <> "" then
+ testdays := "step4";
+ surgerydate := ((extract year(Surgery_date_fld.Value) || "-" ||extract month(Surgery_date_fld.Value) || "-" || extract day(Surgery_date_fld.Value) || " 07:00:00") as time);
+ else
+ testdays := "step5";
+ surgerydate := "";
+ endif;
+
+
+ if (Transfusion_Date_fld.Value matches pattern "t%") then
+ testdays := "step1";
+ tdays := find "+" in string Transfusion_Date_fld.Value;
+ if (tdays > 0) then
+ testdays := "step2";
+ length_days := ((length Transfusion_Date_fld.Value) - (tdays)) + 1;
+ add_days := substring (length_days) characters starting at tdays from Transfusion_Date_fld.Value;
+ transfusiondate := ((extract year(now) || "-" ||extract month(now) || "-" || extract day(now) || " 07:00:00") as time);
+ transfusiondate := transfusiondate + add_days days;
+ else
+ testdays := "step3";
+ transfusiondate := ((extract year(now) || "-" ||extract month(now) || "-" || extract day(now) || " 07:00:00") as time);
+ endif;
+
+ elseif Transfusion_Date_fld.Value is not null and Transfusion_Date_fld.Value <> "" then
+ testdays := "step4";
+ transfusiondate := ((extract year(Transfusion_Date_fld.Value) || "-" ||extract month(Transfusion_Date_fld.Value) || "-" || extract day(Transfusion_Date_fld.Value) || " 07:00:00") as time);
+ else
+ testdays := "step5";
+ transfusiondate := "";
+ endif;
+
+ currenthour := extract hour(now);
+
+ if (current_speciemen_expiration is not null and current_speciemen_expiration <> "") then
+ abc123 := "step1";
+ if(transfusiondate = "" and surgerydate <> "") then
+ abc123 := "step2";
+ TypeScreen_Date_BasedOn := "Surgery";
+ elseif (transfusiondate <> "" and surgerydate = "") then
+ abc123 := "step3";
+ TypeScreen_Date_BasedOn := "Transfusion";
+ elseif((transfusiondate <> "" and surgerydate <> "")
+ and ((current_speciemen_expiration as time) >= (transfusiondate as time))
+ and ((current_speciemen_expiration as time) <= (surgerydate as time))) then
+ abc123 := "step4";
+ TypeScreen_Date_BasedOn := "Surgery";
+ else
+ abc123 := "step5";
+ TypeScreen_Date_BasedOn := "Transfusion";
+ endif;
+
+ else
+ abc123 := "step6";
+ if ((not transfusion) and (surgery)) then
+ abc123 := "step7";
+ TypeScreen_Date_BasedOn := "Surgery";
+ else
+ abc123 := "step8";
+ TypeScreen_Date_BasedOn := "Transfusion";
+ endif;
+
+ endif;
+
+ Order_TypeScreen := false;
+ TypeScreen_Order_Dttm := "";
+
+ if (current_speciemen_expiration is not null and current_speciemen_expiration <> "") then
+ def := "step1";
+ if((TypeScreen_Date_BasedOn = "Surgery") and ((this_form.Name in("Lab BB RBCs") or (infusionpatient)))
+ and (surgerydate <> "") and ((surgerydate as time) >= (current_speciemen_expiration as time))) then
+ def := "step2";
+ TypeScreen_Order_Dttm := (surgerydate as time);
+ Order_TypeScreen := true;
+ elseif ((TypeScreen_Date_BasedOn = "Transfusion") and ((this_form.Name in("Lab BB RBCs") or (infusionpatient)))
+ and (transfusiondate <> "") and ((transfusiondate as time) > (current_speciemen_expiration as time))) then
+ def := "step3";
+ TypeScreen_Order_Dttm := (transfusiondate as time);
+ Order_TypeScreen := true;
+ else
+ Order_TypeScreen := false;
+ endif;
+/*
+ endif;
+ if (this_form.Name in("Lab BB RBCs")) then
+ Order_TypeScreen := true;
+ else
+ Order_TypeScreen := false;
+ endif;
+*/
+ else
+ def := "step4";
+ Order_TypeScreen := true;
+ if(TypeScreen_Date_BasedOn = "Surgery") then
+ TypeScreen_Order_Dttm := (surgerydate as time);
+ elseif (TypeScreen_Date_BasedOn = "Transfusion") then
+ TypeScreen_Order_Dttm := (transfusiondate as time);
+ endif;
+ endif;
+
+ if(Order_TypeScreen) then
+ xyz := "step1";
+ if(outpatient) then
+ xyz := "step2";
+ TypeAndScreen_OP_Grid_fld.Value.IsSelected := true;
+ OutPatient_Pregnant_90days_fld.Control_Visible := true;
+ OutPatient_Transfused_90days_fld.Control_Visible := true;
+ OutPatient_Pregnant_90days_fld.Control_Mandatory := true;
+ OutPatient_Transfused_90days_fld.Control_Mandatory := true;
+ Hidden_Requested_Time_fld.Value.ReqTimeCode := "Today";
+ Hidden_Requested_date_fld.Value := "t";
+ else
+ TypeAndScreen_Order_Grid_fld.Value.IsSelected := true;
+ if (STAT_Collected) then // and (STATPriority)) then
+ Hidden_Requested_Time_fld.Value.ReqTimeCode := "STAT Collected Specimen";
+ Hidden_Requested_date_fld.Value := "t";
+ elseif ((Selected_Priority_fld.Value.ReqTimeCode = "STAT") or ((TypeScreen_Date_BasedOn = "surgery") and TypeScreen_Order_Dttm = todaysdate)) then
+ xyz := "step3";
+ Hidden_Requested_Time_fld.Value.ReqTimeCode := "STAT";
+ Hidden_Requested_date_fld.Value := "t";
+ elseif (TypeScreen_Order_Dttm > tomorrowsdate) then
+ xyz := "step4";
+ Hidden_Requested_Time_fld.Value.ReqTimeCode := "AM Rounds";
+ Hidden_Requested_date_fld.Value := (TypeScreen_Order_Dttm - 1 day);
+ else
+ xyz := "step5";
+ Hidden_Requested_Time_fld.Value.ReqTimeCode := "Today";
+ Hidden_Requested_date_fld.Value := "t";
+ endif;
+ OutPatient_Pregnant_90days_fld.Control_Visible := false;
+ OutPatient_Transfused_90days_fld.Control_Visible := false;
+ OutPatient_Pregnant_90days_fld.Control_Mandatory := false;
+ OutPatient_Transfused_90days_fld.Control_Mandatory := false;
+ endif;
+ Lab_LV_BB_Indication_fld.Value := TypeScreen_Date_BasedOn;
+
+ else
+ TypeAndScreen_OP_Grid_fld.Value.IsSelected := false;
+ TypeAndScreen_Order_Grid_fld.Value.IsSelected := false;
+ OutPatient_Pregnant_90days_fld.Control_Visible := false;
+ OutPatient_Transfused_90days_fld.Control_Visible := false;
+ OutPatient_Pregnant_90days_fld.Control_Mandatory := false;
+ OutPatient_Transfused_90days_fld.Control_Mandatory := false;
+ endif;
+
+ endif;
+
+
+ endif;
+
+/******************************************************************************************************/
+ //BEGIN - FORM CLOSE SECTION
+ if (CallingEvent = "FormClose") then
+ //THIS MLM NEEDS CALLED FIRST IN PRIORITY OR ELSE IT BREAKS FOR SOME UNKNOWN REASON. DONT PUT ANY CALLS TO MLMS BEFORE THIS ONE IN FORM CLOSE SECTION.
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ (this_communication, this_form) := call Teresas_MLM_for_special_requests WITH
+ this_communication, this_form, client_info_obj;
+
+ endif;
+ //END - FORM CLOSE SECTION
+
+ ;;
+ priority: 50
+ ;;
+ evoke: // No evoke statement
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TUBE_FEEDING_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TUBE_FEEDING_ORDERS.mlm
new file mode 100644
index 0000000..f1be097
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TUBE_FEEDING_ORDERS.mlm
@@ -0,0 +1,259 @@
+maintenance:
+
+ title: FORM_SET_TUBE_FEEDING_ORDERS;;
+ mlmname: FORM_SET_TUBE_FEEDING_ORDERS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Juliet Law, Allscripts Ext. 7461;;
+ specialist: Maria Pest, Allscripts Ext. 7443;;
+ date: 2012-01-20;;
+ validation: testing;;
+
+library:
+ purpose: Determines if a tube feeding order should be submitted as a supplement based on existence
+ of active diet order.
+ ;;
+ explanation: If an active diet order exists, then the user will be alerted that the tube feeding will be submitted
+ as a supplement to the active diet; otherwise the tube feeding order will be ordered as the active diet.
+
+ Change History
+
+ 01.20.2012 JMLaw CSR 25867: Created MLM
+ 09.02.2014 DW CSR# 32365 - Auto select orders when one is not present
+ 01.28.2015 JML WO# 1620448: modified the query that retrieves active diet orders to not include Completed (level num 100)
+ as an active diet order.
+ ;;
+ keywords: tube feeding, diet
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ //This MLM is passed three arguments of type
+ // communication_type, form_type, and client_info_obj respectively
+ (this_communication,
+ this_form,
+ client_info_obj) := argument;
+
+ //Obtain fields passed in from Form object
+ field_list := this_form.fields;
+
+ //Obtain attribute values from Communication Object
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Include .Net libraries
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Initialize local session object
+ local_session := cds_session.local;
+
+ //Declare and initialize boolean local variables
+ tubeFeedSelected := false;
+ sessionObjectExists := false;
+ dietOrderExists := false;
+
+ //Retrieve field list of Tube Feeding Nursing Order Grid
+ TubeFeedingOrder := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 2);
+ TubeFeedingOrder_List := TubeFeedingOrder.Value;
+
+ //Retrieve mapped field on Tube Feeding Order
+ DietOrderFld := first of (field_list where field_list.DataItemName = "DIET_DSD_Tube Feed Order" and field_list.Control_MultiFieldOccNum = 1);
+ DietSupplementFld := first of (field_list where field_list.DataItemName = "DIET_Tube Feed Diet or Supplement" and field_list.Control_MultiFieldOccNum = 1);
+
+ //Retrieve field list of NPO with Tube Feed Diet Grid
+ NPOTubeFeedOrder := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 4);
+ NPOTubeFeedOrder_List := NPOTubeFeedOrder.Value;
+
+ TubeFeedingFlush := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 3);
+ TubeFeedingFlush_List := TubeFeedingFlush.Value;
+
+ DietitianConsult := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 6);
+ DietitianConsult_List := DietitianConsult.Value;
+
+ Residuals := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_list.Control_MultiFieldOccNum = 5);
+ Residuals_List := Residuals.Value;
+
+ NursingInstruct := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_list.Control_MultiFieldOccNum = 1);
+ NursingInstruct_List := NursingInstruct.Value;
+
+
+
+
+ // FIELD CHANGE
+
+
+
+ //Only perform logic if a field change event has occurred on the Order Set
+
+ if (CallingEvent = "FieldChange") then
+
+ if (CallingField = "MultiOrderGrid|2") then
+
+ //Retrieve Nutritional Order Tube Feeding field; set boolean if selected or not
+ TubeFeedFld := first of (TubeFeedingOrder_List where TubeFeedingOrder_List.Name = "Tube Feeding");
+
+ if (TubeFeedFld.IsSelected = true) then
+ tubeFeedSelected := true;
+ else
+ tubeFeedSelected := false;
+ endif;
+ endif;
+
+ if (tubeFeedSelected = true) then
+ //If Nutritional Diet Tube Feeding was selected, check for unsubmitted or submitted active Diet order
+ if (local_session.SessionUnsubDietExists = true) then
+ //Unsubmitted Active Diet order determined by local session variable
+ //set in MLM SCH_ALERT_ON_NPO_TUBE_FEEDING_ORDERS
+ dietOrderExists := true;
+ sessionObjectExists := true;
+ else
+ //No unsubmitted, check database for Diet order
+ (orderName) := read {"SELECT o.Name, o.TouchedWhen"
+ || " FROM CV3Order as o with (nolock) JOIN"
+ || " (CV3OrderCatalogMasterItem AS ocmi with (nolock)"
+ || " JOIN CV3OrderReviewCategory AS orc with (nolock)"
+ || " ON ocmi.OrderReviewCategoryGUID = orc.GUID)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " WHERE o.ClientGUID = " || SQL(client_guid)
+ || " AND o.ClientVisitGUID = " || SQL(visit_guid)
+ || " AND o.ChartGUID = " || SQL(chart_guid)
+ || " AND ("
+ || " (o.Name = {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}}"
+ || " OR o.Name = {{{SINGLE-QUOTE}}}Liquids Only for Test{{{SINGLE-QUOTE}}}))"
+ || " AND"
+ || " ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
+ , primaryTime = touchedWhen};
+ orderCount := count(orderName) as number;
+ if (orderCount > 0) then
+ dietOrderExists := true;
+ endif;
+ endif;
+ endif;
+
+ //If Nutritional Diet Tube Feeding was selected and an active Diet order exists
+ //then alert that tube feed will be entered as supplement
+ //If user selects {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}, tube feed will be entered as only diet
+ if (tubeFeedSelected = true AND dietOrderExists = true) then
+ msg := "Patient has Active diet order."
+ || "\n\nThis tube feed order will be entered as a supplement to the existing tray diet."
+ || "\n\nIf this is correct, choose {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}."
+ || "\n\nIf this is not correct, choose {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} and remember to discontinue the Active diet order.";
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "Active Diet Found", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ //If user selects YES, tube feed will be entered as a supplement
+ if ((dialogRes as string) = "Yes") then
+ DietOrderFld.Value := "";
+ DietSupplementFld.Value := "Supplement";
+
+ if (true IN NPOTubeFeedOrder_List.IsSelected) then
+ NPOTubeFeedOrder_List.IsSelected := false;
+ endif;
+ NPOTubeFeedOrder_List.IsReadOnly := true;
+
+ elseif ((dialogRes as string) = "No") then
+ DietOrderFld.Value := "Tube Feeding";
+ DietSupplementFld.Value := "Diet";
+ endif;
+
+ //If Nutritional Diet Tube Feeding was selected and an active Diet order does not exists
+ //then alert that tube feed will be entered as only diet
+ //If user selects {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}, tube feed will be automatically unselected and alert
+ //will display to enter an active diet order first
+ elseif (tubeFeedSelected = true AND dietOrderExists = false) then
+ msg := "Patient DOES NOT have an Active diet.\n\nThis order will be entered as a tube feed only diet."
+ || " Patient will not receive a tray diet."
+ || "\n\nIf this is correct, choose {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}."
+ || "\n\nIf this is not correct and the patient is to receive this tube feed as a supplement, choose {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}.\n\n";
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "No Active Diet Found", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ((dialogRes as string) = "Yes") then
+ DietOrderFld.Value := "Tube Feeding";
+ DietSupplementFld.Value := "Diet";
+ elseif ((dialogRes as string) = "No") then
+ DietOrderFld.Value := "Tube Feeding";
+ DietSupplementFld.Value := "Supplement";
+
+ //Display additional messagebox to user
+ msg2 := "You MUST enter the tray diet order first, then enter the Tube Feeding order.";
+ dialogRes2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg2, "Information", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ TubeFeedingOrder_List.IsSelected := "false";
+ endif;
+
+ else
+ NPOTubeFeedOrder_List.IsReadOnly := "false";
+
+ endif;
+
+ endif; // Field Change
+
+
+
+
+ // FORM OPEN
+
+
+
+ if (CallingEvent = "FormOpen")
+
+ then
+
+ (DietOrders) := read {"Select o.Name, o.TouchedWhen, ocmi.name "
+ || " From CV3OrderCatalogMasterItem AS ocmi with (nolock) "
+ || " Join CV3Order o with (nolock) ON o.OrderCatalogMasterItemGUID = ocmi.GUID "
+ || " Where o.ClientGUID = " || SQL(client_guid) || " AND o.ClientVisitGUID = " || SQL(visit_guid) || " AND o.ChartGUID = " || SQL(chart_guid)
+ || " and o.name in ({{{SINGLE-QUOTE}}}Tube Feed Flush{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}NPO with Tube Feed Diet (nursing instruction only){{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Dietitian Consult for Tube Feed{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Tube Feed Residuals{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Tube Feed Nursing Instructions{{{SINGLE-QUOTE}}})"
+ || " and ((o.OrderStatusLevelNum > 15 AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))) "
+ };
+
+ // Initialize all orders to selected
+
+ TubeFeedingFlush_List.IsSelected := "true";
+ NPOTubeFeedOrder_List.IsSelected := "true";
+ DietitianConsult_List.IsSelected := "true";
+ Residuals_List.IsSelected:= "true";
+ NursingInstruct_List.IsSelected := "true";
+
+
+ // Parse out the current orders and deselect the order if it is already on file.
+
+ for i in 1 seqto count DietOrders do
+
+ DietOrder := DietOrders [i] ;
+
+
+ if DietOrder = "Tube Feed Flush" then TubeFeedingFlush_List.IsSelected := "false";
+ elseif DietOrder = "NPO with Tube Feed Diet (nursing instruction only)" then NPOTubeFeedOrder_List.IsSelected := "false";
+ elseif DietOrder = "Dietitian Consult for Tube Feed" then DietitianConsult_List.IsSelected := "false";
+ elseif DietOrder = "Tube Feed Residuals" then Residuals_List.IsSelected:= "false";
+ elseif DietOrder = "Tube Feed Nursing Instructions" then NursingInstruct_List.IsSelected := "false";
+ endif;
+
+ enddo;
+
+ endif; // Form Open
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+ //This MLM returns two parameters of type this_communication and this_form, respectively.
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_TXA_FOR_HEMORRHAGIC_SHOCK.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_TXA_FOR_HEMORRHAGIC_SHOCK.mlm
new file mode 100644
index 0000000..374378a
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_TXA_FOR_HEMORRHAGIC_SHOCK.mlm
@@ -0,0 +1,122 @@
+maintenance:
+
+ title: Tranexamic Acid for Hemorrhagic Shock;;
+ mlmname: FORM_Set_TXA_for_Hemorrhagic_Shock;;
+ arden: version 2.5;;
+ version: 16.30;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts ext 7448;;
+ specialist: Teresa Spicuzza, Allscripts ext 7448;;
+ date: 2018-05-15;;
+ validation: testing;;
+
+library:
+ purpose: Used to crate schedule for maintenance dose of TXA to immediately follow bolus dose.
+ ;;
+
+ explanation: This MLM is called from the Tranexamic Acid for Hemorrhagic Shock Order Set
+
+
+ Change history
+
+ 05.15.2018 TMS CSR 36442: Initial build
+
+
+ ;;
+ keywords: Called MLMs, tranexamic acid, ED, hemorrhagic shock
+ ;;
+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;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ //using "ObjectsPlusXA.SCM.Forms";
+ //using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ StartDate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 1);
+ StartTime:= last of (field_list where field_list.DataItemName = "RequestedTime"and field_List.Control_MultiFieldOccNum = 1);
+ StartTime_Value := StartTime.value;
+
+ EntryTime := (now as time) ;
+ GiveMinute := extract minute EntryTime;
+ GiveHour := extract hour EntryTime;
+
+ // Schedule maintenance dose for the next quarter hour
+
+ If Giveminute >= 0 and GiveMinute < 15 then
+ SchedMinute := "15";
+ SchedHour := GiveHour;
+ SchedDay := EntryTime;
+ Elseif Giveminute >= 15 and GiveMinute < 30 then
+ SchedMinute := "30";
+ SchedHour := GiveHour;
+ SchedDay := EntryTime;
+ Elseif Giveminute >= 30 and GiveMinute < 45 then
+ SchedMinute := "45";
+ SchedHour := GiveHour;
+ SchedDay := EntryTime;
+ Elseif Giveminute >= 45 and GiveMinute < 60 then
+ SchedMinute := "00";
+ SchedHour := GiveHour + 1;
+ If (Schedhour as number) = 24 then
+ Schedhour := "00";
+ endif;
+ SchedDay := EntryTime + 1 hour;
+ endif;
+
+ If Schedhour < 10 then
+ Schedhour := "0" || Schedhour;
+ endif;
+
+ SchedMon := extract month SchedDay;
+ If SchedMon < 10 then
+ SchedMon := "0"|| SchedMon;
+ endif;
+
+ schedDate := extract day SchedDay;
+ If SchedDate < 10 then
+ SchedDate := "0"|| SchedDate;
+ endif;
+
+ SchedYear := extract year SchedDay;
+
+ FormatDate := SchedMon ||"-" || SchedDate ||"-" || SchedYear;
+ FormatTime := SchedHour ||":" || SchedMinute ;
+ StartDate.Value := FormatDate;
+ StartTime_Value.ReqTimeCode := "Scheduled/Start Time";
+ StartTime_Value.ReqTimeValue := FormatTime;
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_URINARY_CATHETER.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_URINARY_CATHETER.mlm
new file mode 100644
index 0000000..3725999
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_URINARY_CATHETER.mlm
@@ -0,0 +1,121 @@
+maintenance:
+
+ title: FORM_SET_URINARY_CATHETER;;
+ mlmname: FORM_SET_URINARY_CATHETER;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Janet Nordin, Allscripts;;
+ date: 2016-01-26;;
+ validation: testing;;
+
+library:
+ purpose: Select / unselect nursing instruction orders based on Medical Necessity value for catheter order.
+ ;;
+
+ explanation: This MLM is called from the Urinary Catheter OS
+
+ Change history
+ 2016.01.26 JML CSR# 33953 Created; copied from FORM_SET_MOVIPREP
+ 2016.06.15 STH CSR#: 34700 Force selection of at least 1 Catheter item before exiting this order set. {Go-Live 6/21/2016}
+ ;;
+ keywords: Called MLMs, catheter
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Communication object Form object Arden ClientInfo object
+ (this_communication, this_form, client_info_obj) := argument;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := FALSE;
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ med_nec_invalid_values_lst := ("Placed by Urology/Urological Surgery",
+ "Hospice/Comfort Care",
+ "Chronic Urinary Catheter");
+
+ //Capture appropriate form fields
+ CatheterOrder := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 5);
+
+ CatheterMedNecessity := first of ( field_list WHERE field_list.DataItemName = "NUR_Catheter Medical Necessity"
+ AND field_list.Control_MultiFieldOccNum = 1);
+
+ CathNurseInstr_1 := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 6);
+ CathNurseInstr_1_Value := CathNurseInstr_1.Value;
+
+ CathNurseInstr_2 := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 7);
+ CathNurseInstr_2_Value := CathNurseInstr_2.Value;
+
+ if ( CallingEvent = "FieldChange" ) then
+ if ( CallingField = "NUR_Catheter Medical Necessity|1" ) then
+ CatheterMedNecessity_Value := CatheterMedNecessity.Value;
+
+ if ( CatheterMedNecessity_Value IN med_nec_invalid_values_lst ) then
+ CathNurseInstr_1_Value.IsSelected := ( true, false );
+ CathNurseInstr_2_Value.IsSelected := ( false, false, false );
+ else
+ CathNurseInstr_1_Value.IsSelected := ( true, true );
+ CathNurseInstr_2_Value.IsSelected := ( true, true, true );
+ endif;
+ endif;
+ endif;
+
+ IF (CallingEvent = "FormClose") then
+ CatheterField := first (field_list where field_list.Label = "Catheter");
+ tstval := CatheterField.Value.IsSelected;
+
+ ActiveCathOrder := read first { " declare @ClientGUID HVCIDDT
+ declare @ChartGUID HVCIDDT
+ declare @VisitGUID HVCIDDT
+
+ set @ClientGUID = " || sql(client_guid)
+ || " set @VisitGUID = " || sql(visit_guid)
+ || " set @ChartGUID = " || sql(chart_guid)
+ || " select name from cv3order
+ where clientguid = @ClientGUID
+ and ChartGUID = @ChartGUID
+ and ClientVisitGUID = @VisitGUID
+ and name IN ({{{SINGLE-QUOTE}}}Catheter: Foley{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Catheter: Indwelling Double Lumen{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Catheter: Indwelling Triple Lumen{{{SINGLE-QUOTE}}})
+ and orderstatuscode not in ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HISDP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}}) "};
+
+ if((true not in CatheterField.Value.IsSelected) and (ActiveCathOrder is null)) then
+ this_communication.DisplayForm := "yes";
+ this_communication.Message := "Please choose Catheter";
+ this_communication.MessageType := "Error";
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_VANCOMYCIN_TROUGH_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_VANCOMYCIN_TROUGH_ORDERS.mlm
new file mode 100644
index 0000000..b9918b8
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_VANCOMYCIN_TROUGH_ORDERS.mlm
@@ -0,0 +1,601 @@
+maintenance:
+
+ title: FORM_SET_VANCOMYCIN_TROUGH_ORDERS;;
+ mlmname: FORM_SET_VANCOMYCIN_TROUGH_ORDERS;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Bryan Berkeybile, Allscripts;;
+ date: 2014-04-28;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+
+ explanation: This MLM is called from Vancomycin Orders - Trough order set.
+
+ Change history
+ 2014.04.28 JML CSR 32241: Created
+ 2015.03.23 JML Moved to Production.
+ 2015.03.24 JML Issue found where STAT and NOW orders being pulled to calculate trough times, causing errors in calculation.
+
+
+
+ ;;
+ keywords: Called MLMs
+ ;;
+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";
+
+ //Local session object
+ local_session := cds_session.local;
+
+ // 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;
+
+ //Boolean to determine if first administration needs calculated
+ calc_first_admin := false;
+ //Boolean to determine if Trough order is selected
+ is_trough_selected := false;
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+ FormName := this_form.Name;
+ PrimaryObjDetail := this_communication.PrimaryObj;
+ OrderSetName := PrimaryObjDetail.OrderSetName;
+
+ //Retrieve Fields
+ Last_Admin_Date := last of (field_list WHERE field_list.DataItemName = "LAB_Chem_Date_TDM"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Last_Admin_Time := last of ( field_list WHERE field_list.DataItemName = "LAB_Chem_Time_TDM"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ First_Admin_Ckbx := last of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ and field_list.Control_MultiFieldOccNum = 1);
+ First_Admin_Date := last of ( field_list WHERE field_List.DataItemName = "LAB_Chem_Date_TDM"
+ and field_list.Control_MultiFieldOccNum = 2);
+ First_Admin_Time := last of ( field_list WHERE field_list.DataItemName = "LAB_Chem_Time_TDM"
+ and field_list.Control_MultiFieldOccNum = 2);
+
+ Second_Admin_Ckbx := last of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Second_Admin_Date := last of ( field_list WHERE field_list.DataItemName = "LAB_Chem_Date_TDM"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Second_Admin_Time := last of ( field_list WHERE field_list.DataItemName = "LAB_Chem_Time_TDM"
+ and field_list.Control_MultiFieldOccNum = 3);
+
+ Third_Admin_Ckbx := last of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Third_Admin_Date := last of ( field_list WHERE field_list.DataItemName = "LAB_Chem_Date_TDM"
+ and field_list.Control_MultiFieldOccNum = 4);
+ Third_Admin_Time := last of ( field_list WHERE field_list.DataItemName = "LAB_Chem_Time_TDM"
+ and field_list.Control_MultiFieldOccNum = 4);
+
+ Fourth_Admin_Ckbx := last of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1"
+ and field_list.Control_MultiFieldOccNum = 4);
+ Fourth_Admin_Date := last of ( field_list WHERE field_list.DataItemName = "LAB_Chem_Date_TDM"
+ and field_list.Control_MultiFieldOccNum = 5);
+ Fourth_Admin_Time := last of ( field_list WHERE field_list.DataItemName = "LAB_Chem_Time_TDM"
+ and field_list.Control_MultiFieldOccNum = 5);
+
+ Vanco_orders := last of ( field_list WHERE field_list.DataItemname = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Vanco_orders_List := Vanco_orders.Value;
+
+ Vanco_trough := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Vanco_trough_Val := Vanco_trough.Value;
+
+ Vanco_trough_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Vanco_trough_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ //Retrieve last administration time
+ ( OrderGUID,
+ adminDtm,
+ adminTime,
+ adminSchTime,
+ lastFreq,
+ orderCreated ) := read last {"SELECT TOP 1 o.GUID, CONVERT( varchar(10), ot.PerformedFromDtm, 110),"
+ || " CONVERT( varchar(5), ot.PerformedFromDtm, 14), CONVERT( varchar(5), ot.ScheduledDtm, 14), o.FrequencyCode,"
+ || " o.CreatedWhen"
+ || " 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 ot.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}}"
+ || " AND cv.ClientGUID = " || Sql(ClientGUID)
+ || " AND cv.GUID = " || Sql(ClientVisitGUID)
+ || " AND cv.ChartGUID = " || Sql(ChartGUID)
+ || " order by ot.ScheduledDtm desc"};
+
+ if ( CallingEvent = "FormOpen" ) then
+
+ //Update Fields
+ if ( exists orderGUID ) then
+ Last_Admin_Date.Value := adminDtm;
+ Last_Admin_Time.Value := adminTime;
+
+ endif;
+
+ Vanco_trough_ReqDate.Value := "T";
+
+ elseif ( CallingEvent = "FieldChange" ) then
+
+ if ( CallingField = "MultiOrderGrid|3" ) then
+
+ //Determine if the Vancomycin Trough lab was selected - if not, then no calculation is needed
+ is_trough_selected := first of ( vanco_trough_val.IsSelected
+ WHERE vanco_trough_val.Name = "Vancomycin Trough Plasma/Serum");
+
+ if ( is_trough_selected = true ) then
+
+ //Determine if any vancomycin order was selected
+ if ( NOT ( true IN Vanco_Orders_List.IsSelected ) ) then
+
+ //Check for unsubmitted vancomycin orders captured in event triggered MLM and set in session var.
+ if ( local_session.SessionUnsubVancoExists = true ) then
+
+ First_Admin_Date.Value := local_session.SessionVancoTroughScheduledDate;
+
+ //Need to format the time
+ temp_time := local_session.SessionVancoTroughScheduledTime as Time;
+ temp_time_hour := EXTRACT HOUR temp_time;
+ if ( length ( temp_time_hour as string ) = 1 ) then
+ temp_time_hour := "0" || temp_time_hour;
+ endif;
+
+ temp_time_min := EXTRACT MINUTE temp_time;
+ if ( length ( temp_time_min as string ) = 1 ) then
+ temp_time_min := "0" || temp_time_min;
+ endif;
+ First_Admin_Time.Value := temp_time_hour || ":" || temp_time_min;
+
+ VancoScheduledFrequency := local_session.SessionVancoTroughFrequency;
+
+ else
+
+ //No unsubmitted orders
+ //Check for existing vancomycin order that has NOT been administered - this
+ //would be different than the performed vancomycin order checked for at the beginning of this MLM
+ (newer_vanco_order,
+ newer_vanco_reqDate,
+ newer_vanco_reqTime,
+ newer_vanco_freq) := READ LAST {"SELECT o.NAME, o.RequestedDate, CONVERT(varchar(5), o.RequestedDtm, 14), o.FrequencyCode"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
+ || " ON cv.GUID = o.ClientVisitGUID"
+ || " AND cv.ClientGUID = o.ClientGUID"
+ || " AND cv.ChartGUID = o.ChartGUID"
+ || " WHERE cv.ClientGUID = " || Sql(ClientGUID)
+ || " AND cv.GUID = " || Sql(ClientVisitGUID)
+ || " AND cv.ChartGUID = " || Sql(ChartGUID)
+ || " AND o.Name = {{{SINGLE-QUOTE}}}Vancomycin:{{{SINGLE-QUOTE}}}"
+ || " AND o.GUID <> " || Sql(OrderGUID)
+ || " AND o.CreatedWhen > " || Sql(orderCreated)
+ || " AND o.FrequencyCode LIKE {{{SINGLE-QUOTE}}}Q%{{{SINGLE-QUOTE}}}"
+ || " AND ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
+
+ if ( exists ( newer_vanco_order ) ) then
+ First_Admin_Date.Value := newer_vanco_reqDate;
+ First_Admin_Time.Value := newer_vanco_reqTime;
+
+ VancoScheduledFrequency := newer_vanco_freq;
+
+ else
+ //No unsubmitted vanco orders exist and no newer vanco orders exist
+ //base the future admin calculations on the next scheduled dose not administered from last administered
+ calc_first_admin := true;
+ VancoScheduledFrequency := lastFreq;
+ endif;
+ endif;
+
+ else
+ //If vancomycin was selected, then the first future admin calculation is the first scheduled
+ //admin based on the antibiotic scheduling
+ First_Admin_Date.Value := local_session.SessionVancoTroughScheduledDate;
+
+ //Need to format the time
+ temp_time := local_session.SessionVancoTroughScheduledTime as Time;
+ temp_time_hour := EXTRACT HOUR temp_time;
+ if ( length ( temp_time_hour as string ) = 1 ) then
+ temp_time_hour := "0" || temp_time_hour;
+ endif;
+
+ temp_time_min := EXTRACT MINUTE temp_time;
+ if ( length ( temp_time_min as string ) = 1 ) then
+ temp_time_min := "0" || temp_time_min;
+ endif;
+ First_Admin_Time.Value := temp_time_hour || ":" || temp_time_min;
+
+ //Set the frequency to the selected vancomycin order for grid above
+ VancoScheduledFrequency := local_session.SessionVancoTroughFrequency;
+ endif;
+
+ //This MLM will only support Qx frequencies
+ if ( VancoScheduledFrequency matches pattern "Q%" ) then
+ ( frequencyNum,
+ frequencyUOM ) := read last {"SELECT f.TimeFromValue, f.TimeUOM"
+ || " FROM CV3Frequency f WITH (NOLOCK)"
+ || " WHERE f.Code = " || Sql(VancoScheduledFrequency) };
+ endif;
+
+ //************ Calculate First Admin Date and Time ****************************************
+ //Only calculate first admin IF no vancomycin order was selected from above grid
+ if ( calc_first_admin = true ) then
+ admin_Hour := (extract hour ( adminSchTime as Time ) ) as number;
+ admin_Min := ( extract minute ( adminSchTime as Time ) ) as number;
+ if ( admin_Min = 0 ) then
+ admin_Min := "00";
+ endif;
+
+ newFirstAdmin_Hour := admin_Hour + (frequencyNum as number);
+
+ new_admin_month := SUBSTRING 2 CHARACTERS From ( Last_Admin_Date.Value as string );
+ new_admin_day := Substring 2 Characters starting at 4 from ( Last_Admin_Date.Value as string );
+ new_admin_year := substring 4 characters starting at 7 from ( Last_Admin_Date.Value as string );
+ new_admin_dtm := new_admin_year || "-" || new_admin_month || "-" || new_admin_day || "T00:01:00";
+
+ new_admin := new_admin_dtm as Time;
+
+ if ( newFirstAdmin_Hour < 24 ) then
+ First_Admin_Date.Value := new_admin;
+ if ( newFirstAdmin_Hour >= 1 AND newFirstAdmin_Hour <= 9 ) then
+ First_Admin_Time.Value := "0" || newFirstAdmin_Hour || ":" || admin_Min;
+ else
+ First_Admin_Time.Value := newFirstAdmin_Hour || ":" || admin_Min;
+ endif;
+ elseif ( newFirstAdmin_Hour > 24 ) then
+
+
+ if ( frequencyNum > 24 ) then
+ newFirstAdmin_Hour := ( newFirstAdmin_Hour - ( frequencyNum as number ) ) as number;
+ First_Admin_Date.Value := new_admin + 2 days;
+ else
+ newFirstAdmin_Hour := ( newFirstAdmin_Hour - 24 ) as number;
+ First_Admin_Date.Value := new_admin + 1 day;
+ endif;
+
+ if ( newFirstAdmin_Hour >= 1 AND newFirstAdmin_Hour <= 9 ) then
+ First_Admin_Time.Value := "0" || newFirstAdmin_Hour || ":" || admin_Min;
+ else
+ First_Admin_Time.Value := newFirstAdmin_Hour || ":" || admin_Min;
+ endif;
+
+ elseif ( newFirstAdmin_Hour = 24 ) then
+ First_Admin_Date.Value := new_admin + 1 day;
+ First_Admin_Time.Value := "00:" || admin_Min;
+ endif;
+ endif;
+
+ //************ Calculate Second Admin Date and Time ****************************************
+ firstAdmin_Hour := (extract hour ( First_Admin_Time.Value as Time ) ) as number;
+ secondAdmin_Min := ( extract minute ( First_Admin_Time.Value as Time ) ) as number;
+ if ( secondAdmin_Min = 0 ) then
+ secondAdmin_Min := "00";
+ endif;
+
+ secondAdmin_Hour := firstAdmin_Hour + (frequencyNum as number);
+
+ sec_admin_month := SUBSTRING 2 CHARACTERS From ( First_Admin_Date.Value as string );
+ sec_admin_day := Substring 2 Characters starting at 4 from ( First_Admin_Date.Value as string );
+ sec_admin_year := substring 4 characters starting at 7 from ( First_Admin_Date.Value as string );
+ sec_admin_dtm := sec_admin_year || "-" || sec_admin_month || "-" || sec_admin_day || "T00:01:00";
+
+ sec_admin := sec_admin_dtm as Time;
+
+ if ( secondAdmin_Hour < 24 ) then
+ Second_Admin_Date.Value := sec_admin;
+ if ( secondAdmin_Hour >= 1 AND secondAdmin_Hour <= 9 ) then
+ Second_Admin_Time.Value := "0" || secondAdmin_Hour || ":" || secondAdmin_Min;
+ else
+ Second_Admin_Time.Value := secondAdmin_Hour || ":" || secondAdmin_Min;
+ endif;
+ elseif ( secondAdmin_Hour > 24 ) then
+
+
+ if ( frequencyNum > 24 ) then
+ secondAdmin_Hour := ( secondAdmin_Hour - ( frequencyNum as number ) ) as number;
+ Second_Admin_Date.Value := sec_admin + 2 days;
+ else
+ secondAdmin_Hour := ( secondAdmin_Hour - 24 ) as number;
+ Second_Admin_Date.Value := sec_admin + 1 day;
+ endif;
+
+ if ( secondAdmin_Hour >= 1 AND secondAdmin_Hour <= 9 ) then
+ Second_Admin_Time.Value := "0" || secondAdmin_Hour || ":" || secondAdmin_Min;
+ else
+ Second_Admin_Time.Value := secondAdmin_Hour || ":" || secondAdmin_Min;
+ endif;
+
+ elseif ( secondAdmin_Hour = 24 ) then
+ Second_Admin_Date.Value := sec_admin + 1 day;
+ Second_Admin_Time.Value := "00:" || secondAdmin_Min;
+ endif;
+
+
+ //********************* Calculate Third Admin Date and Time **********************************
+ //thirdAdmin_Hour := secondAdmin_Hour + (frequencyNum as number);
+
+ if ( secondAdmin_Hour = 24 ) then
+ hour_value := 0;
+ else
+ hour_value := secondAdmin_Hour;
+ endif;
+ thirdAdmin_Hour := hour_value + ( frequencyNum as number );
+
+ thirdAdmin_Min := secondAdmin_Min;
+
+ third_admin_month := Substring 2 Characters From ( Second_Admin_Date.Value as string );
+ third_admin_day := Substring 2 Characters Starting at 4 From ( Second_Admin_Date.Value as string );
+ third_admin_year := Substring 4 Characters Starting at 7 From ( Second_Admin_Date.Value as string );
+
+ third_admin_dtm := third_admin_year || "-" || third_admin_month || "-" || third_admin_day || "T00:01:00";
+
+ third_admin := third_admin_dtm as Time;
+
+ if ( thirdAdmin_Hour < 24 ) then
+ Third_Admin_Date.Value := Second_Admin_Date.Value;
+ if ( thirdAdmin_Hour >= 1 AND thirdAdmin_Hour <= 9 ) then
+ Third_Admin_Time.Value := "0" || thirdAdmin_Hour || ":" || thirdAdmin_Min;
+ else
+ Third_Admin_Time.Value := thirdAdmin_Hour || ":" || thirdAdmin_Min;
+ endif;
+
+ elseif ( thirdAdmin_Hour > 24 ) then
+
+ if ( frequencyNum > 24 ) then
+ thirdAdmin_Hour := ( thirdAdmin_Hour - ( frequencyNum as number ) ) as number;
+ Third_Admin_Date.Value := third_admin + 2 days;
+ else
+ thirdAdmin_Hour := ( thirdAdmin_Hour - 24 ) as number;
+ Third_Admin_Date.Value := third_admin + 1 day;
+
+ endif;
+
+ if ( thirdAdmin_Hour >= 1 AND thirdAdmin_Hour <= 9 ) then
+ Third_Admin_Time.Value := "0" || thirdAdmin_Hour || ":" || thirdAdmin_Min;
+ else
+ Third_Admin_Time.Value := thirdAdmin_Hour || ":" || thirdAdmin_Min;
+ endif;
+ elseif ( thirdAdmin_Hour = 24 ) then
+ Third_Admin_Date.Value := third_admin + 1 day;
+ Third_Admin_Time.Value := "00:" || thirdAdmin_Min;
+ endif;
+
+
+
+ //*********** Calculate Fourth Admin Date and Time ****************************
+ if ( thirdAdmin_Hour = 24 ) then
+ hour_value := 0;
+ else
+ hour_value := thirdAdmin_Hour;
+ endif;
+ fourthAdmin_Hour := hour_value + ( frequencyNum as number );
+
+ fourthAdmin_Min := secondAdmin_Min;
+
+ fourth_admin_month := Substring 2 Characters From ( Third_Admin_Date.Value as string );
+ fourth_admin_day := Substring 2 Characters Starting at 4 From ( Third_Admin_Date.Value as string );
+ fourth_admin_year := Substring 4 Characters Starting at 7 From ( Third_Admin_Date.Value as string );
+
+ fourth_admin_dtm := fourth_admin_year || "-" || fourth_admin_month || "-" || fourth_admin_day || "T00:01:00";
+
+ fourth_admin := fourth_admin_dtm as Time;
+
+ if ( fourthAdmin_Hour < 24 ) then
+ Fourth_Admin_Date.Value := fourth_admin;
+ if ( fourthAdmin_Hour >= 1 AND fourthAdmin_Hour <= 9 ) then
+ Fourth_Admin_Time.Value := "0" || fourthAdmin_Hour || ":" || fourthAdmin_Min;
+ else
+ Fourth_Admin_Time.Value := fourthAdmin_Hour || ":" || fourthAdmin_Min;
+ endif;
+
+ elseif ( fourthAdmin_Hour > 24 ) then
+
+ if ( frequencyNum > 24 ) then
+ fourthAdmin_Hour := ( fourthAdmin_Hour - ( frequencyNum as number ) ) as number;
+ Fourth_Admin_Date.Value := fourth_admin + 2 days;
+ else
+ fourthAdmin_Hour := ( fourthAdmin_Hour - 24 ) as number;
+ Fourth_Admin_Date.Value := fourth_admin + 1 day;
+ endif;
+
+ if ( fourthAdmin_Hour >= 1 AND fourthAdmin_Hour <= 9 ) then
+ Fourth_Admin_Time.Value := "0" || fourthAdmin_Hour || ":" || fourthAdmin_Min;
+ else
+ Fourth_Admin_Time.Value := fourthAdmin_Hour || ":" || fourthAdmin_Min;
+ endif;
+ elseif ( fourthAdmin_Hour = 24 ) then
+ Fourth_Admin_Date.Value := fourth_admin + 1 day;
+ Fourth_Admin_Time.Value := "00:" || fourthAdmin_Min;
+ endif;
+
+ endif;
+ elseif ( CallingField = "MultiOrderGrid|2" ) then
+
+ Vanco_trough_Val.IsSelected := false;
+
+ First_Admin_Date.Value := null;
+ First_Admin_Time.Value := "";
+ First_Admin_Ckbx.Value := false;
+
+ Second_Admin_Date.Value := null;
+ Second_Admin_Time.Value := "";
+ Second_Admin_Ckbx.Value := false;
+
+ Third_Admin_Date.Value := null;
+ Third_Admin_Time.Value := "";
+ Third_Admin_Ckbx.Value := false;
+
+ Fourth_Admin_Date.Value := null;
+ Fourth_Admin_Time.Value := "";
+ Fourth_Admin_Ckbx.Value := false;
+
+ elseif ( CallingField = "PRX_Checkbox1|1" ) then
+
+ if ( First_Admin_ckbx.Value = true ) then
+ //Toggle checkboxes
+ Second_Admin_ckbx.Value := false;
+ Third_Admin_ckbx.Value := false;
+ Fourth_Admin_ckbx.Value := false;
+
+ if ( First_Admin_Date.Value is not null ) then
+ Vanco_trough_ReqDate.Value := First_Admin_Date.Value;
+
+ a := ( First_Admin_Time.Value as Time ) - 30 minutes;
+ b := extract hour a;
+ if ( b >= 1 AND b <= 9 ) then
+ b := "0" || b;
+ endif;
+ c := b || ":" || extract minute a;
+
+ //Set the Requested Time Priority
+ Vanco_trough_ReqTime_Val := Vanco_trough_ReqTime.Value;
+ Vanco_trough_ReqTime_Val.ReqTimeCode := "Scheduled Time";
+
+ Vanco_trough_ReqTime_Val.ReqTimeValue := c;
+
+ else
+ First_Admin_ckbx.Value := false;
+ endif;
+ endif;
+
+
+ elseif ( CallingField = "PRX_Checkbox1|2" ) then
+
+ if ( Second_Admin_Ckbx.Value = true ) then
+
+ //Toggle Checkboxes
+ First_Admin_ckbx.Value := false;
+ Third_Admin_ckbx.Value := false;
+ Fourth_Admin_ckbx.Value := false;
+
+ if ( Second_Admin_Date.Value is not null ) then
+ Vanco_trough_ReqDate.Value := Second_Admin_Date.Value;
+
+ a := ( Second_Admin_Time.Value as Time ) - 30 minutes;
+ b := extract hour a;
+ if ( b >= 1 AND b <= 9 ) then
+ b := "0" || b;
+ endif;
+ c := b || ":" || extract minute a;
+
+ //Set the Requested Time Priority
+ Vanco_trough_ReqTime_Val := Vanco_trough_ReqTime.Value;
+ Vanco_trough_ReqTime_Val.ReqTimeCode := "Scheduled Time";
+
+ Vanco_trough_ReqTime_Val.ReqTimeValue := c;
+ else
+ Second_Admin_Ckbx.Value := false;
+ endif;
+ endif;
+
+ elseif ( CallingField = "PRX_Checkbox1|3" ) then
+
+ if ( Third_Admin_Ckbx.Value = true ) then
+ //Toggle checkboxes
+ First_Admin_Ckbx.Value := false;
+ Second_Admin_Ckbx.Value := false;
+ Fourth_Admin_Ckbx.Value := false;
+
+ if ( Third_Admin_Date.Value is not null ) then
+
+ Vanco_trough_ReqDate.Value := Third_Admin_Date.Value;
+
+ a := ( Third_Admin_Time.Value as Time ) - 30 minutes;
+ b := extract hour a;
+ if ( b >= 1 AND b <= 9 ) then
+ b := "0" || b;
+ endif;
+ c := b || ":" || extract minute a;
+
+ //Set the Requested Time Priority
+ Vanco_trough_ReqTime_Val := Vanco_trough_ReqTime.Value;
+ Vanco_trough_ReqTime_Val.ReqTimeCode := "Scheduled Time";
+
+ Vanco_trough_ReqTime_Val.ReqTimeValue := c;
+ else
+ Third_Admin_Ckbx.Value := false;
+ endif;
+ endif;
+
+ elseif ( CallingField = "PRX_Checkbox1|4" ) then
+
+ if ( Fourth_Admin_Ckbx.Value = true ) then
+
+ //Toggle Checkboxes
+ First_Admin_Ckbx.Value := false;
+ Second_Admin_Ckbx.Value := false;
+ Third_Admin_Ckbx.Value := false;
+
+ if ( Fourth_Admin_Date.Value is not null ) then
+
+ Vanco_trough_ReqDate.Value := Fourth_Admin_Date.Value;
+
+ a := ( Fourth_Admin_Time.Value as Time ) - 30 minutes;
+ b := extract hour a;
+ if ( b >= 1 AND b <= 9 ) then
+ b := "0" || b;
+ endif;
+ c := b || ":" || extract minute a;
+
+ //Set the Requested Time Priority
+ Vanco_trough_ReqTime_Val := Vanco_trough_ReqTime.Value;
+ Vanco_trough_ReqTime_Val.ReqTimeCode := "Scheduled Time";
+
+ Vanco_trough_ReqTime_Val.ReqTimeValue := c;
+ else
+ Fourth_Admin_Ckbx.Value := false;
+ endif;
+ endif;
+ endif; //End MultiOrderGrid|3 Calling Field
+ endif; //End Calling Event
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_VASCULAR_SURGERY_POST_OP.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_VASCULAR_SURGERY_POST_OP.mlm
new file mode 100644
index 0000000..387c5fc
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_VASCULAR_SURGERY_POST_OP.mlm
@@ -0,0 +1,295 @@
+maintenance:
+
+ title: FORM_SET_VASCULAR_SURGERY_POST_OP;;
+ mlmname: FORM_SET_VASCULAR_SURGERY_POST_OP;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law;;
+ specialist: Michele Carter-Payne, Shawn Head;;
+ date: 2011-09-30;;
+ validation: testing;;
+
+library:
+ purpose: Used for the Vascular Surgery Post Op Order Set.
+ ;;
+ explanation: Used for the Vascular Surgery Post Op Order Set.
+
+ Change history
+
+ 09.30.2011 JMLaw Created.
+ ;;
+ keywords: Vascular, Post Op, Called MLMs
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (
+ this_communication,
+ this_form,
+ client_info_obj
+ ) := argument;
+
+ error_message := "";
+
+ field_list := this_form.fields;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGUID;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ //Retrieve field list of Activity/Positioning Grid
+ Activities := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 3);
+ Activities_List := Activities.Value;
+
+ //Retrieve field list of Pain Management Grid
+ //PainManagement := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ // AND field_list.Control_MultiFieldOccNum = 28);
+ //PainManagement_List := PainManagement.Value;
+
+ //Retrieve field list of After DC of Opioid Analgesics Grid
+ OpioidAnalgesics := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 5);
+ OpioidAnalgesics_List := OpioidAnalgesics.Value;
+
+ //Retrieve field list of Pharmacy: Other Grid
+ PharmacyOther := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 8);
+ PharmacyOther_List := PharmacyOther.Value;
+
+ //Retrieve field list of Pharmacy: Antibiotic Grid
+ PharmacyAntibiotics := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = 11);
+ PharmacyAntibiotics_List := PharmacyAntibiotics.Value;
+
+ //Retrieve field list of Pain Management grids
+ if (CallingField = "MultiOrderGrid|28") then
+ OccNumA := 28;
+ OccNumB := 33;
+ OccNumC := 34;
+ OccNumD := 35;
+ elseif (CallingField = "MultiOrderGrid|33") then
+ OccNumA := 33;
+ OccNumB := 28;
+ OccNumC := 34;
+ OccNumD := 35;
+ elseif (CallingField = "MultiOrderGrid|34") then
+ OccNumA := 34;
+ OccNumB := 28;
+ OccNumC := 33;
+ OccNumD := 35;
+ elseif (CallingField = "MultiOrderGrid|35") then
+ OccNumA := 35;
+ OccNumB := 28;
+ OccNumC := 33;
+ OccNumD := 34;
+ endif;
+
+ if (CallingEvent = "FieldChange") then
+ if ((CallingField = "MultiOrderGrid|28") OR (CallingField = "MultiOrderGrid|33") OR (CallingField = "MultiOrderGrid|34")
+ OR (CallingField = "MultiOrderGrid|35")) then
+ GridFldA := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = OccNumA);
+ Grid_listA := GridFldA.Value;
+
+ Grid_FldB := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = OccNumB);
+ Grid_listB := Grid_FldB.Value;
+ FalseListB := ();
+ TrueListB := ();
+ for i IN (1 seqto (count Grid_listB.IsSelected)) do
+ FalseListB := FalseListB, false;
+ TrueListB := TrueListB, true;
+ enddo;
+
+ Grid_FldC := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = OccNumC);
+ Grid_listC := Grid_FldC.Value;
+ FalseListC := ();
+ TrueListC := ();
+ for j IN (1 seqto (count Grid_listC.IsSelected)) do
+ FalseListC := FalseListC, false;
+ TrueListC := TrueListC, true;
+ enddo;
+
+ Grid_FldD := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ AND field_list.Control_MultiFieldOccNum = OccNumD);
+ Grid_listD := Grid_FldD.Value;
+ FalseListD := ();
+ TrueListD := ();
+ for k IN (1 seqto (count Grid_listD.IsSelected)) do
+ FalseListD := FalseListD, false;
+ TrueListD := TrueListD, true;
+ enddo;
+
+ if (true IN Grid_listA.IsSelected) then
+ Grid_listB.IsReadOnly := TrueListB;
+ Grid_listC.IsReadOnly := TrueListC;
+ Grid_listD.IsReadOnly := TrueListD;
+ else
+ Grid_listB.IsReadOnly := FalseListB;
+ Grid_ListC.IsReadOnly := FalseListC;
+ Grid_ListD.IsReadonly := FalseListD;
+ endif;
+
+ elseif (CallingField = "MultiOrderGrid|3") then
+ bedRest_fld := last of (Activities_List where Activities_List.Name = "Activity: Bedrest Continuous");
+ oob_fld := first of (Activities_List where Activities_List.Name = "Activity: OOB");
+
+ if (bedRest_fld.IsSelected = true) then
+ oob_fld.IsSelected := true;
+ elseif (bedRest_fld.IsSelected = false) then
+ oob_fld.IsSelected := false;
+ else
+ bedRest_fld.IsSelected := false;
+ oob_fld.IsSelected := false;
+ endif;
+
+ elseif (CallingField = "MultiOrderGrid|5") then
+ if (true IN OpioidAnalgesics_List.IsSelected) then
+ if (true IN (OpioidAnalgesics_List.IsSelected[1],OpioidAnalgesics_List[2])) then
+ OpioidAnalgesics_List.IsReadOnly := (false, false, true, true);
+ OpioidAnalgesics_List.IsSelected := (OpioidAnalgesics_List.IsSelected[1], OpioidAnalgesics_List.IsSelected[2],
+ false, false);
+ elseif (true IN (OpioidAnalgesics_List.IsSelected[3],OpioidAnalgesics_List.IsSelected[4])) then
+ OpioidAnalgesics_List.IsReadOnly := (true, true, false, false);
+ OpioidAnalgesics_List.IsSelected := (false, false,
+ OpioidAnalgesics_List.IsSelected[3], OpioidAnalgesics_List.IsSelected[4]);
+ else
+ OpioidAnalgesics_List.IsReadOnly := (OpioidAnalgesics_List.IsReadOnly[1], OpioidAnalgesics_List.IsReadOnly[2],
+ OpioidAnalgesics_List.IsReadOnly[3], OpioidAnalgesics_List.IsReadONly[4]);
+ OpioidAnalgesics_List.IsSelected := (OpioidAnalgesics_List.IsSelected[1], OpioidAnalgesics_List.IsSelected[2],
+ OpioidAnalgesics_List.IsSelected[3],OpioidAnalgesics_List.IsSelected[4]);
+ endif;
+ else
+ OpioidAnalgesics_List.IsReadOnly := (false, false, false, false);
+ OpioidAnalgesics_List.IsSelected := (false, false, false, false);
+ endif;
+
+ elseif (CallingField = "MultiOrderGrid|8") then
+ FirstThree := (PharmacyOther_List.IsSelected[1],
+ PharmacyOther_List.IsSelected[2],
+ PharmacyOther_List.IsSelected[3]);
+ LastTwo := (PharmacyOther_List.IsSelected[4],
+ PharmacyOther_List.IsSelected[5]);
+
+ if (true IN FirstThree) then
+ NewReadOnly := ();
+ NewSelected := ();
+ for k IN (1 seqto (count PharmacyOther_List.IsSelected)) do
+ if (k <= 3) then
+ if (PharmacyOther_List.IsSelected[k] = true) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ endif;
+ else
+ NewReadOnly := NewReadOnly, PharmacyOther_List.IsReadOnly[k];
+ NewSelected := NewSelected, PharmacyOther_List.IsSelected[k];
+ endif;
+ enddo;
+ PharmacyOther_List.IsReadOnly := NewReadOnly;
+ PharmacyOther_List.IsSelected := NewSelected;
+ else
+ NewReadOnly := ();
+ DeSelectAll := ();
+ for k IN (1 seqto (count PharmacyOther_List.IsSelected)) do
+ if (k <= 3) then
+ NewReadOnly := NewReadOnly, false;
+ DeSelectAll := DeSelectAll, false;
+ else
+ NewReadOnly := NewReadOnly, PharmacyOther_List.IsReadOnly[k];
+ DeSelectAll := DeSelectAll, PharmacyOther_List.IsSelected[k];
+ endif;
+ enddo;
+ PharmacyOther_List.IsReadOnly := NewReadOnly;
+ PharmacyOther_List.IsSelected := DeSelectAll;
+ endif;
+
+ if (true IN LastTwo) then
+ NewReadOnly := ();
+ NewSelected := ();
+
+ for k IN (1 seqto (count PharmacyOther_List.IsSelected)) do
+ if (k > 3 AND k <=5) then
+ if (PharmacyOther_List.IsSelected[k] = true) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ endif;
+ else
+ NewReadOnly := NewReadOnly, PharmacyOther_List.IsReadOnly[k];
+ NewSelected := NewSelected, PharmacyOther_List.IsSelected[k];
+ endif;
+ enddo;
+ PharmacyOther_List.IsReadOnly := NewReadOnly;
+ PharmacyOther_List.IsSelected := NewSelected;
+ else
+ NewReadOnly := ();
+ DeSelectAll := ();
+ for k IN (1 seqto (count PharmacyOther_List.IsSelected)) do
+ if (k > 3 AND k <= 5) then
+ NewReadOnly := NewReadOnly, false;
+ DeSelectAll := DeSelectAll, false;
+ else
+ NewReadOnly := NewReadOnly, PharmacyOther_List.IsReadOnly[k];
+ DeSelectAll := DeSelectAll, PharmacyOther_List.IsSelected[k];
+ endif;
+ enddo;
+ PharmacyOther_List.IsReadOnly := NewReadOnly;
+ PharmacyOther_List.IsSelected := DeSelectAll;
+ endif;
+
+ elseif (CallingField = "MultiOrderGrid|11") then
+ if (true IN PharmacyAntibiotics_List.IsSelected) then
+ NewReadOnly := ();
+ NewSelected := ();
+ for k IN (1 seqto (count PharmacyAntibiotics_List.IsSelected)) do
+ if (PharmacyAntibiotics_List.IsSelected[k] = true) then
+ NewReadOnly := NewReadOnly, false;
+ NewSelected := NewSelected, true;
+ else
+ NewReadOnly := NewReadOnly, true;
+ NewSelected := NewSelected, false;
+ endif;
+ enddo;
+ PharmacyAntibiotics_List.IsReadOnly := NewReadOnly;
+ PharmacyAntibiotics_List.IsSelected := NewSelected;
+ else
+ NewReadOnly := ();
+ DeSelectAll := ();
+ for k IN (1 seqto (count PharmacyAntibiotics_List.IsSelected)) do
+ NewReadOnly := NewReadOnly, false;
+ DeSelectAll := DeSelectAll, false;
+ enddo;
+ PharmacyAntibiotics_List.IsReadOnly := NewReadOnly;
+ PharmacyAntibiotics_List.IsSelected := DeSelectAll;
+ endif;
+ endif;
+ endif;
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_VTE_PROPHYLAXIS.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_VTE_PROPHYLAXIS.mlm
new file mode 100644
index 0000000..ff018e3
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_VTE_PROPHYLAXIS.mlm
@@ -0,0 +1,714 @@
+maintenance:
+
+ title: VTE Prothylaxis;;
+ mlmname: FORM_Set_VTE_Prophylaxis;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clairs;;
+ author: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ specialist: Don Warnick, Eclipsys Corp Ext 7463;;
+ date: 2009-08-05;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds heparin and performs other in VTE Prothylaxis order set
+ ;;
+
+ explanation: This MLM is called from the VTE Prothylaxis order set
+
+
+Change history
+
+ 08.05.2009 DW Copied from FORM_Set_Heparin_SQ
+ 08.02.2010 TMS Added Renal, CMP, and BMP panels to creatinine search
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 06.02.2011 TMS Added logic to auto select IPC if contranindication to anticoagulants
+ exists. Uncheck daily lab orders when anticoagulant orders are unchecked.
+ If patient risk score is >=3, stops user from leaving order set without
+ addressing either an order for anticoagulants or a contraindication to
+ anticoagulants.
+ 03.28.2012 JML Added call to functional MLM that will perform a check for existing or unsubmitted
+ anticoagulant orders and whether they conflict with the current anticoagulant selection.
+ 04.23.2012 TMS Changed {{{SINGLE-QUOTE}}}elseif{{{SINGLE-QUOTE}}} for form close to {{{SINGLE-QUOTE}}}if{{{SINGLE-QUOTE}}} to eliminate baseline orders not being checked.
+ 05.16.2012 JML Changed Heparin duplicate medication alert to soft stop.
+ 08.14.2012 TMS Optimized SQL for VTE risk Assessment(for FP1 CUR vs ARC)
+ 04.02.2013 JML CSR #31182: Autocheck the IPC order if: a) risk score is 1 or 2; b) contraindications exist;
+ stop user from leaving order set without addressing either an order for anticoagulants or a
+ contraindication to anticoagulants if risk score is >= 3 (previously >= 2)
+ 06.06.2014 STH CSR #: 31893: Added logic so a physician can override the VTE score that is pulled from the A/I flowsheet.
+ I also updated sections of the code to use the new "override" score when approriate and still follow all
+ support VTE CDS already added to this MLM. The new logic will provide physicians with an Objects Plus
+ window to override the score. Once the physician overrides the score the information will be populated on hidden fields
+ on the order set and mapped back to the VTE Drug Therapy Evalution order item for future reference.
+ If there is an override then an MLM added to the A/I flowsheet will prompt any nurse that they need to re-evalute the score
+ based on the override. Last there is a physician override observation added to the A/I Flowsheet VTE section to allow
+ the override details to be automatically pulled from the physician override field added to the VTE Drug Therapy Evaluation order item.
+ 07.08.2014 STH Trackit Ticket #: 166658 Issue was identified where ED physicians are unable to order the IPC order on the order set when no VTE score has
+ been created. Per Teresa and Peggy it is OK for the ED physicians to order the IPC outright through this order set with no offical VTE
+ socre on the patient. Updated logic to allow the IPC order to be entered through this orderset when there is no VTE score.
+ 12.03.2015 STH Update to allow deselecting the IPC order {Go-Live 12/15/2015}
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ 04.03.2019 JML 18.4 Upgrade Issue - columns added to CV3ClientDocumentCUR/ARC tables were causing "FormOpen" query to fail.
+
+ ;;
+ keywords: Called MLMs, VTE Prothylaxis
+ ;;
+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;
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Anticoagulant Conflict Check MLM
+ anticoagulant_conflict := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ user_guid := this_communication.UserGUID;
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+ occcode := read last {" select OccupationCode from CV3USER U "
+ || " where guid = " || sql(user_guid) };
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ local_session := cds_session.local;
+ test123 := "test";
+
+ Guidelines := last of (field_list where field_list.DataItemName = "MultiOrderInline" and field_List.Control_MultiFieldOccNum = 1);
+ Guidelines_List := Guidelines.Value;
+
+ DrugTherapyEval := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 5);
+ DrugTherapyEval_List := DrugTherapyEval.Value;
+
+ DrugOrders := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 7);
+ DrugOrders_List := DrugOrders.Value;
+
+ Found_Hep_Inj1:= first of (DrugOrders_List where DrugOrders_List.Name = "Heparin Inj");
+ Found_Hep_Inj2:= last of (DrugOrders_List where DrugOrders_List.Name = "Heparin Inj");
+ Found_Eno_Inj1:= first of (DrugOrders_List where DrugOrders_List.Name = "Enoxaparin Inj");
+ Found_Eno_Inj2:= last of (DrugOrders_List where DrugOrders_List.Name = "Enoxaparin Inj");
+
+
+ IPC := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 4);
+ IPC_List := IPC.Value;
+
+ vtescore := last of (field_list where field_list.DataItemName = "VTE Prophylaxis Risk Factor Score" and field_List.Control_MultiFieldOccNum = 1);
+ //added by STH
+ vteoverrideobj := last of (field_list where field_list.DataItemName = "Obj_Plus_Lab" and field_List.Control_MultiFieldOccNum = 1);
+ vteoverridescore := last of (field_list where field_list.DataItemName = "VTE Prophylaxis Risk Factor Score" and field_List.Control_MultiFieldOccNum = 2);
+ vteoverridereason := last of (field_list where field_list.DataItemName = "OS_Information1"and field_List.Control_MultiFieldOccNum = 2);
+ vtescoreby := last of (field_list where field_list.DataItemName = "VTE Risk Assessed By");
+ vtescoredate:= last of (field_list where field_list.DataItemName = "VTE Risk Assessed Date");
+ physicianoverridedetails := last of (field_list where field_list.DataItemName = "OS_Information1" and field_List.Control_MultiFieldOccNum = 1);
+ vtescoredetails := last of (field_list where field_list.DataItemName = "OS_Information2");
+ StopOrderBox := last of (field_list where field_list.DataItemName = "MLM Generic Free Text" and field_List.Control_MultiFieldOccNum = 1);
+ StopOrderBoxValue:= StopOrderBox.value;
+ Hardstop := "";
+ ReasonMessage := "This patient has a Risk Factor Score of 3 or greater. Please choose an anticoagulant order or identify why VTE prophylaxis is not indicated or why anticoagulants are contraindicated. ";
+ Labs_fld := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 1);
+ Labs_List := Labs_fld.Value;
+ Found_Base_CBC:= first of (Labs_list where Labs_list.Name = "CBC No Diff (Hemogram Only)");
+ Found_Base_Creatinine:= first of (Labs_list where Labs_list.Name = "Creatinine");
+
+ CheckCBC:=False;
+ CheckCreatinine:=False;
+
+ Lab_Daily := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_List := Lab_Daily.Value;
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 5);
+
+ ED_Loc:= last of (field_list where field_list.DataItemName = "ED Location");
+
+ //////////////
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Lab_Rem_List := Lab_Rem.Value;
+ Fnd_Daily := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+ ///////////////////////
+ Heps_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Heps_List :=Heps_Grid.Value;
+ Fnd_Hep_Inj:= first of (Heps_List where Heps_List.Name = "Heparin Inj");
+ /////////////
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+ ////////////
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+ fromordersetmlm := "true";
+
+
+ if CallingEvent = "FormOpen" then
+
+ flowsheet_score_details := read last { " SELECT cdc.GUID, cdc.AuthoredDtm, cdc.ArcType, cdc.ClientGUID, cdc.DocumentName, cdc.Active"
+ || " INTO #tmp_clientdocument"
+ || " FROM CV3ClientDocumentCUR cdc WITH (NOLOCK)"
+ || " WHERE cdc.ClientGUID = " || SQL(client_guid)
+ || " AND cdc.ClientVisitGUID = " || SQL(visit_guid)
+ || " AND cdc.ChartGUID = " || SQL(chart_guid)
+ || " AND (cdc.DocumentName LIKE {{{SINGLE-QUOTE}}}%Adult Assessment/Intervention%{{{SINGLE-QUOTE}}}"
+ || " OR cdc.DocumentName LIKE {{{SINGLE-QUOTE}}}%ED Adult Assessment Intervention flowsheet%{{{SINGLE-QUOTE}}}"
+ || " OR cdc.documentname LIKE {{{SINGLE-QUOTE}}}%OB Assessment Intervention flowsheet%{{{SINGLE-QUOTE}}})"
+ || " UNION"
+ || " SELECT cda.GUID, cda.AuthoredDtm, cda.ArcType, cda.ClientGUID, cda.DocumentName, cda.Active"
+ || " FROM CV3ClientDocumentARC cda WITH (NOLOCK)"
+ || " WHERE cda.ClientGUID = " || SQL(client_guid)
+ || " AND cda.ClientVisitGUID = " || SQL(visit_guid)
+ || " AND cda.ChartGUID = " || SQL(chart_guid)
+ || " AND (cda.DocumentName LIKE {{{SINGLE-QUOTE}}}%Adult Assessment/Intervention%{{{SINGLE-QUOTE}}}"
+ || " OR cda.DocumentName LIKE {{{SINGLE-QUOTE}}}%ED Adult Assessment Intervention flowsheet%{{{SINGLE-QUOTE}}}"
+ || " OR cda.documentname LIKE {{{SINGLE-QUOTE}}}%OB Assessment Intervention flowsheet%{{{SINGLE-QUOTE}}})"
+ || ""
+ || " SELECT odc.ObsMasterItemGUID, odc.displaysequence, odc.ObservationDocumentguid, odc.OwnerGUID, odc.Arctype"
+ || " ,odc.ObservationGUID, odc.ParameterGUID, odc.Active"
+ || " INTO #tmp_obsdocument"
+ || " FROM CV3ObservationDocumentcur odc WITH (NOLOCK) JOIN #tmp_clientdocument tcd"
+ || " ON odc.OwnerGUID = tcd.GUID"
+ || " UNION"
+ || " SELECT oda.ObsMasterItemGUID , oda.displaysequence, oda.ObservationDocumentguid, oda.OwnerGUID"
+ || " ,oda.Arctype, oda.ObservationGUID, oda.ParameterGUID, oda.Active"
+ || " FROM CV3ObservationDocumentarc oda WITH (NOLOCK) JOIN #tmp_clientdocument tcd"
+ || " ON oda.OwnerGUID = tcd.GUID"
+ || ""
+ || " SELECT DISTINCT OCMI.Name, CD.AuthoredDtm"
+ || " ,COALESCE( Obs.valuetext, ( dbo.sxaGetFSListValsFn( OD.ObservationDocumentguid, CD.clientGuid ) ) ) AS {{{SINGLE-QUOTE}}}obs_value{{{SINGLE-QUOTE}}}"
+ || " ,OCMI.LeftJustifiedLabel, OCMI.RightJustifiedLabel, CD.DocumentName, OD.DisplaySequence, OXI.InValue"
+ || " ,OXI.OutValue, OXI.IOSubtype, Obs.SHIFTDAILYHOURLYTOTAL"
+ || " INTO #tmp_obsvalues"
+ || " FROM #tmp_clientdocument CD JOIN #tmp_obsdocument OD"
+ || " ON OD.OwnerGUID = CD.GUID"
+ || " AND OD.Arctype = CD.Arctype"
+ || " JOIN CV3Observation Obs WITH (NOLOCK)"
+ || " ON OD.ObservationGUID = Obs.GUID"
+ || " AND OD.Arctype = Obs.Arctype"
+ || " LEFT JOIN CV3ObservationXInfo OXI WITH (NOLOCK)"
+ || " ON obs.GUID = OXI.observationXInfoGUID"
+ || " AND obs.Arctype = OXI.Arctype"
+ || " LEFT JOIN CV3ObservationEntryItem OEI WITH (NOLOCK)"
+ || " ON OEI.GUID = OD.ParameterGUID"
+ || " JOIN CV3ObsCatalogMasterItem OCMI WITH (NOLOCK)"
+ || " ON OCMI.GUID = OD.ObsMasterItemGUID"
+ || " WHERE OCMI.Name LIKE {{{SINGLE-QUOTE}}}%vte%{{{SINGLE-QUOTE}}}"
+ || " AND OD.Active = 1"
+ || " AND CD.Active = 1"
+ || " AND CD.AuthoredDtm > {{{SINGLE-QUOTE}}}2013-05-01{{{SINGLE-QUOTE}}}"
+ || ""
+ || " DECLARE @maxauthdtm AS DATETIME"
+ || " SET @maxauthdtm = ( SELECT MAX(AuthoredDtm) FROM #tmp_obsvalues )"
+ || " SELECT TOP 1 {{{SINGLE-QUOTE}}}Most Recent {{{SINGLE-QUOTE}}} +"
+ || " ( SELECT ( RightJustifiedLabel + {{{SINGLE-QUOTE}}}: {{{SINGLE-QUOTE}}} + obs_value + {{{SINGLE-QUOTE}}}. {{{SINGLE-QUOTE}}} ) AS {{{SINGLE-QUOTE}}}data(){{{SINGLE-QUOTE}}}"
+ || " FROM #tmp_obsvalues"
+ || " WHERE AuthoredDtm = @maxauthdtm"
+ || " AND obs_value NOT LIKE {{{SINGLE-QUOTE}}}%(0)%{{{SINGLE-QUOTE}}}"
+ || " AND Name = {{{SINGLE-QUOTE}}}AS SC vte score CAL{{{SINGLE-QUOTE}}}"
+ || " AND Name <> {{{SINGLE-QUOTE}}}AS SC vte physician override{{{SINGLE-QUOTE}}} for xml path({{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) )"
+ || " + {{{SINGLE-QUOTE}}}The score was determined by: {{{SINGLE-QUOTE}}}"
+ || " + replace( replace( replace( replace( replace( replace( replace("
+ || " ( SELECT ( RightJustifiedLabel + {{{SINGLE-QUOTE}}}: {{{SINGLE-QUOTE}}} + obs_value + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} ) AS {{{SINGLE-QUOTE}}}data(){{{SINGLE-QUOTE}}}"
+ || " FROM #tmp_obsvalues"
+ || " WHERE AuthoredDtm = @maxauthdtm"
+ || " AND obs_value NOT LIKE {{{SINGLE-QUOTE}}}%(0)%{{{SINGLE-QUOTE}}}"
+ || " AND Name <> {{{SINGLE-QUOTE}}}AS SC vte score CAL{{{SINGLE-QUOTE}}}"
+ || " AND Name <> {{{SINGLE-QUOTE}}}AS SC vte physician override{{{SINGLE-QUOTE}}} for xml path({{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) )"
+ || " ,{{{SINGLE-QUOTE}}}<{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}<{{{SINGLE-QUOTE}}} )"
+ || " ,{{{SINGLE-QUOTE}}}>{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}>{{{SINGLE-QUOTE}}} )"
+ || " ,{{{SINGLE-QUOTE}}}(1){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}= 1 point(s){{{SINGLE-QUOTE}}} )"
+ || " ,{{{SINGLE-QUOTE}}}(2){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}= 2 point(s){{{SINGLE-QUOTE}}} )"
+ || " ,{{{SINGLE-QUOTE}}}(3){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}= 3 point(s){{{SINGLE-QUOTE}}} )"
+ || " ,{{{SINGLE-QUOTE}}}(5){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}= 5 point(s){{{SINGLE-QUOTE}}} )"
+ || " ,{{{SINGLE-QUOTE}}}; {{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} )"
+ || " FROM #tmp_obsvalues"
+ || " WHERE AuthoredDtm = @maxauthdtm"
+ || ""
+ || " DROP TABLE #tmp_obsvalues, #tmp_obsdocument, #tmp_clientdocument" };
+
+
+ vtescoredetails.value := flowsheet_score_details;
+
+
+ //determine if the physician override field should be available to the user or not.
+ if occcode in ("MD","DO","DMD","DPM","CRNP","PA","PA-C","IT") then
+ vteoverridereason.Control_Visible := TRUE;
+ vteoverridescore.Control_Visible := TRUE;
+ vteoverrideobj.Control_Visible := TRUE;
+ else
+ vteoverridereason.Control_Visible := FALSE;
+ vteoverridescore.Control_Visible := FALSE;
+ vteoverrideobj.Control_Visible := FALSE;
+ endif;
+
+ Guidelines_List.IsReadOnly := (True,True);
+ Lab_Daily_List.IsReadOnly := (True,True,True,True,True);
+ local_session.SessionVTEScore := "none entered";
+ local_session.SessionVTEContraindication := "none entered";
+ local_session.SessionVTENotIndicated := "none entered";
+ local_session.SessionVTENotOrdered := "none entered";
+ tstlocalsession := local_session.SessionVTENotOrdered;
+
+ //Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then
+ primreqdate.value := (now as time);
+ endif;
+
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+ (vtescorefound, vtescorebyfound) := read last
+ {" set concat_null_yields_null off "
+ || " Select top 1 o.ValueText, "
+ || " u.DisplayName + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + u.OccupationCode + {{{SINGLE-QUOTE}}} ({{{SINGLE-QUOTE}}} + convert(char(8), cd.authoreddtm,1) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + convert(char(5), cd.authoreddtm,14) + {{{SINGLE-QUOTE}}}){{{SINGLE-QUOTE}}} "
+ || " from CV3ClientDocumentCUR cd "
+ || " join CV3ClientDocDetailCUR cdd (nolock) "
+ || " on (cdd.ClientDocumentGUID = cd.GUID "
+ || " AND cdd.ClientGUID = " || SQL(client_guid) || ")"
+ || " join CV3ObservationDocumentCUR od (nolock) "
+ || " on cdd.CLientDocumentGUID = od.OwnerGUID "
+ || " AND od.active = 1 "
+ || " join CV3ObsCatalogMasterItem (nolock) "
+ || " on od.ObsMasterItemGUID = CV3ObsCatalogMasterItem.GUID "
+ || " join CV3ObservationCUR o (nolock) "
+ || " on o.GUID = od.ObservationGUID "
+ || " LEFT OUTER JOIN CV3User u (nolock) "
+ || " ON o.UserGUID = u.GUID "
+ || " join cv3obscatalogitem oci (nolock) "
+ || " on oci.guid = o.obsitemguid "
+ || " AND oci.name = {{{SINGLE-QUOTE}}}as sc vte score cal{{{SINGLE-QUOTE}}} "
+ || " where cd.clientguid = " || SQL(client_guid)
+ || " and cd.chartguid = " || SQL(chart_guid)
+ || " order by cd.authoreddtm desc "};
+
+
+ vtescore.value:= vtescorefound;
+ vtescoreby.value:= vtescorebyfound;
+ if vtescore.value <> "none entered" then
+ local_session.SessionVTEScore := vtescore.value;
+ //JML CSR #31182: Auto check IPC if user enters vte risk score of 1 or 2
+ if ((vtescore.value = "1" OR vtescore.value = "2") and (local_session.SessionVTENotOrdered = "none entered")) then
+ IPC_List.IsSelected := true;
+ endif;
+ endif;
+ endif; //added by tms
+
+
+ //If CallingEvent = "FieldChange" Then
+ If ((CallingEvent in ("FieldChange", "FormClose")) and (CallingField <> "MultiOrderGrid|4")) Then
+
+ // check for the session object value for the contraindiation field and if filled, grey out Rx orders
+ //added by sth for physician manual override of VTE score.
+ if (vteoverridescore.Value is not null and vteoverridescore.value <> "") then
+ if vtescore.value is null or vtescore.value <> vteoverridescore.Value then
+ manualscore := vteoverridescore.Value;
+ vteoverridereason.control_mandatory := TRUE;
+ ELSE
+ manualscore := local_session.SessionVTEScore;
+ vteoverridereason.value := "";
+ vteoverridereason.control_mandatory := FALSE;
+ endif;
+ else
+ vteoverridereason.value := "";
+ vteoverridereason.control_mandatory := FALSE;
+ endif;
+
+ //manualscore := local_session.SessionVTEScore; --removed by STH 12-17-2013
+ contrasessionobject.value:= local_session.SessionVTEContraindication;
+ notindicatedobject.value := local_session.SessionVTENotIndicated;
+ if local_session.SessionVTEContraindication = "none entered"
+ and local_session.SessionVTENotIndicated = "none entered" then
+ DrugOrders_List.IsReadOnly := (False,False,False,False) ;
+ endif;
+
+ if local_session.SessionVTENotIndicated <> "none entered"
+ or local_session.SessionVTEContraindication <> "none entered" then
+ DrugOrders_List.IsReadOnly := (True,True,True,True);
+ tstdrugorders := "set drugorders_list readonly";
+ DrugOrders_List.IsSelected := (False,False,False,False);
+ Lab_Daily_List.IsSelected := (False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ if (local_session.SessionVTENotOrdered = "none entered") then
+ if vtescore.value >= 3 or local_session.SessionVTEScore >= 3 or (manualscore.value as number) >= 3 then
+ IPC_List.IsSelected := False;
+ else
+ IPC_List.IsSelected := TRUE;
+ endif;
+ endif;
+ endif;
+
+ if local_session.SessionVTENotOrdered <> "none entered" then
+ IPC_List.IsSelected := False;
+ IPC_List.IsReadOnly := true;
+ else
+ IPC_List.IsReadOnly := false;
+ endif;
+ /*
+ if local_session.SessionVTEContraindication <> "none entered" then
+ DrugOrders_List.IsReadOnly := (True,True,True,True) ;
+ DrugOrders_List.IsSelected := (False,False,False,False);
+ Lab_Daily_List.IsSelected := (False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+
+ if vtescore.value >= 3 or local_session.SessionVTEScore >= 3 or manualscore.value >= 3 then
+ IPC_List.IsSelected := True;
+ endif;
+ endif;
+ */
+ //JML CSR #31182: Auto check IPC if user enters vte risk score of 1 or 2
+ //STH modified for IPC selecting for CSR #:
+ if (local_session.SessionVTENotOrdered = "none entered") then
+ if ((manualscore as number) in (1,2)) then
+ IPC_List.IsSelected := True;
+ elseif ((local_session.SessionVTEScore in (1,2) or vtescore.value in (1,2))
+ and ((manualscore is null) or (manualscore = ""))) then
+ IPC_List.IsSelected := True;
+ elseif (((manualscore as number) >= 3) and (local_session.SessionVTEContraindication <> "none entered" )) then
+ IPC_List.IsSelected := True;
+ elseif ((local_session.SessionVTEScore >= 3 or vtescore.value >= 3)
+ and ((manualscore is null) or (manualscore = ""))
+ and (local_session.SessionVTEContraindication <> "none entered" ))then
+ IPC_List.IsSelected := True;
+ // [STH 07.08.2014 - ALLOW IPC ORDER WHEN NO VTE SCORE EXISTS
+ elseif (((local_session.SessionVTEScore is null) or (local_session.SessionVTEScore = "") or (local_session.SessionVTEScore = "none entered"))
+ and ((vtescore.value is null) or (vtescore.value = ""))
+ and ((manualscore is null) or (manualscore = ""))) then
+ IPC_List.IsSelected := IPC_List.IsSelected;
+ else
+ IPC_List.IsSelected := false;
+ endif;
+ endif;
+
+ If CallingField = "MultiOrderGrid|7" or CallingField = "MultiOrderGrid|5" or CallingField = "StopOrderBox|1" then
+ If (Found_Hep_Inj1.IsSelected = True) then
+
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Found_Hep_Inj1.Name);
+
+ if (stop = true) then
+ if (severity = "high") then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ DrugOrders_List.IsSelected := (False, False, False, False);
+ DrugOrders_List.IsReadOnly := (False, False, False, False);
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ((dialogRes as String) = "No") then
+ DrugOrders_List.IsSelected := (False, False, False, False);
+ DrugOrders_List.IsReadOnly := (False, False, False, False);
+ else
+ DrugOrders_List.IsReadOnly := (False, True, True, True);
+ endif;
+ endif;
+ else
+ DrugOrders_List.IsReadOnly := (False,True,True,True);
+ endif;
+
+ elseIf (Found_Hep_Inj2.IsSelected = True) then
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Found_Hep_Inj2.Name);
+
+ if (stop = true) then
+ if (severity = "high") then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ DrugOrders_List.IsSelected := (False, False, False, False);
+ DrugOrders_List.IsReadOnly := (False, False, False, False);
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ((dialogRes as String) = "No") then
+ DrugOrders_List.IsSelected := (False, False, False, False);
+ DrugOrders_List.IsReadOnly := (False, False, False, False);
+ else
+ DrugOrders_List.IsReadOnly := (True, False, True, True);
+ endif;
+ endif;
+ else
+ DrugOrders_List.IsReadOnly := (True,False,True,True);
+ endif;
+ elseIf (Found_Eno_Inj1.IsSelected = True) then
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Found_Eno_Inj1.Name);
+
+ if (stop = true) then
+ if (severity = "high") then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ DrugOrders_List.IsSelected := (False, False, False, False);
+ DrugOrders_List.IsReadOnly := (False, False, False, False);
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ((dialogRes as string) = "No") then
+ DrugOrders_List.IsSelected := (False, False, False, False);
+ DrugOrders_List.IsReadOnly := (False, False, False, False);
+ else
+ DrugOrders_List.IsReadOnly := (True, True, False, True);
+ endif;
+ endif;
+ else
+ DrugOrders_List.IsReadOnly := (True,True,False,True);
+ endif;
+ elseIf (Found_Eno_Inj2.IsSelected = True) then
+ (stop, stop_message, severity) := call anticoagulant_conflict WITH (this_communication, this_form, client_info_obj, Found_Eno_Inj2.Name);
+
+ if (stop = true) then
+ if (severity = "high") then
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ DrugOrders_List.IsSelected := (False, False, False, False);
+ DrugOrders_List.IsReadOnly := (False, False, False, False);
+ else
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with stop_message, "Anticoagulant Order Conflict", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ if ((dialogRes as string) = "No") then
+ DrugOrders_List.IsSelected := (False, False, False, False);
+ DrugOrders_List.IsReadOnly := (False, False, False, False);
+ else
+ DrugOrders_List.IsReadOnly := (True, True, True, False);
+ endif;
+ endif;
+ else
+ DrugOrders_List.IsReadOnly := (True,True,True,False);
+ endif;
+ else
+ DrugOrders_List.IsReadOnly := (False,False,False,False);
+ endif;
+ endif; // multiordergrid 7
+
+ If CallingField = "MultiOrderGrid|7" or CallingField = "MultiOrderGrid|5" or CallingField = "StopOrderBox|1" then
+ If (Found_Hep_Inj1.IsSelected = True or Found_Hep_Inj2.IsSelected = True or Found_Eno_Inj1.IsSelected = True or Found_Eno_Inj2.IsSelected = True) then
+ Lab_Daily_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_List.IsSelected := (True,True,True,True,True);
+ Fnd_Daily.IsReadOnly := True;
+ Fnd_Daily.IsSelected := True;
+ IPC_List.IsSelected := False;
+ else
+ Lab_Daily_List.IsSelected := (False,False,False,False,False);
+ Fnd_Daily.IsSelected := False;
+ endif;
+ ElseIf CallingField = "RequestedDate|1" then
+ //Set the four remaining order set date fields based on the starting date
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")";
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 2 days;
+ thirdreqdate.value := startdate + 4 days;
+ fourthreqdate.value := startdate + 6 days;
+ fifthreqdate.value := startdate + 8 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ endif; // multiodergrid 7
+
+ endif;
+ // elseif CallingEvent = "FormClose" then
+ If CallingEvent = "FormClose" then
+ If (Found_Hep_Inj1.IsSelected = True or Found_Hep_Inj2.IsSelected = True or Found_Eno_Inj1.IsSelected = True
+ or Found_Eno_Inj2.IsSelected = True) then
+ If (Found_Base_CBC.IsSelected =false) then
+ CBC_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "};
+ If exists CBC_Val then
+ CheckCBC:=False;
+ else
+ CheckCBC:=True;
+ Found_Base_CBC.ISSelected :=True;
+ endif;
+ endif;
+ endif;
+ If (Found_Eno_Inj1.IsSelected = True or Found_Eno_Inj2.IsSelected = True) then
+ If (Found_Base_Creatinine.IsSelected =false) then
+ Creatinine_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Creatinine{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Renal Panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Comprehensive Metabolic Panel Fasting{{{SINGLE-QUOTE}}}, "
+ || " {{{SINGLE-QUOTE}}}Basic Metabolic Panel Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Panel Fasting{{{SINGLE-QUOTE}}}) "
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "};
+ If exists Creatinine_Val then
+ CheckCreatinine:=False;
+ else
+ CheckCreatinine:=True;
+ Found_Base_Creatinine.ISSelected :=True;
+ endif;
+ endif;
+
+ //////////////////////
+ // Now find if there are already CBC{{{SINGLE-QUOTE}}}s ordered in the future...
+ // Reset the check boxes if they are.
+ formlist := call str_parse with prx_comment.value, ",";
+ end_date := fifthreqdate.value + 1 day;
+ CBC_daily_dates :=();
+ CBC_daily_dates := read
+ {"Select distinct top 20 "
+ || " convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC No Diff (Hemogram Only){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(CBC_daily_dates) then
+ Reset_CBC_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+ for J in index_list do
+ singledate := formlist[J];
+ Reset_CBC_Grid:= Reset_CBC_Grid, singledate not in CBC_daily_dates;
+ enddo;
+
+ Lab_Daily_List.IsSelected := (Reset_CBC_Grid);
+ endif; //If exist
+ endif; // 1 of 2 heparin boxes checked
+ endif;
+
+ // Stop from closing form if no anticoagulant has been ordered, contraindication or not indicated reason has been documented.
+ If CallingEvent = "FormClose" then
+
+
+ if (vteoverridereason.value is not null
+ and vteoverridereason.value <> ""
+ and vteoverridescore.Value is not null
+ and vteoverridescore.Value <> "") then
+ physicianoverridedetails.value := "Physician override score = " || vteoverridescore.Value || ". Reason = " || vteoverridereason.value || ".";
+ physicianoverridedetails.value := physicianoverridedetails.value || " Created By: " || this_communication.CareProviderDisplayName || " (" || OccCode || ")";
+ endif;
+
+ If (Found_Hep_Inj1.IsSelected = false and Found_Hep_Inj2.IsSelected = false and Found_Eno_Inj1.IsSelected = false
+ and Found_Eno_Inj2.IsSelected = false and local_session.SessionVTEContraindication = "none entered"
+ and local_session.SessionVTENotIndicated = "none entered"
+ and (((vtescore.value >= 3 or local_session.SessionVTEScore >= 3) and (manualscore is null or manualscore = ""))
+ or ((manualscore as number) >= 3))) then
+ hardstop := "yes";
+ else
+ hardstop := "no";
+ endif;
+ If exists StopOrderBox then
+ If hardstop = "yes" then
+ this_communication.DisplayForm := "yes";
+ this_communication.Message := ReasonMessage;
+ this_communication.MessageType := "Error";
+ StopOrderBoxValue.control_mandatory := TRUE;
+ else
+ StopOrderBoxValue.control_mandatory := FALSE;
+ endif;
+ endif;
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+ endif;
+
+ If ((CallingEvent = "FieldChange") and (CallingField = "MultiOrderGrid|4")) Then
+ if local_session.SessionVTENotOrdered <> "none entered" then
+ IPC_List.IsSelected := False;
+ IPC_List.IsReadOnly := true;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_VTE_PROPHYLAXIS_SET_SESSION_OBJECT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_VTE_PROPHYLAXIS_SET_SESSION_OBJECT.mlm
new file mode 100644
index 0000000..aab09af
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_VTE_PROPHYLAXIS_SET_SESSION_OBJECT.mlm
@@ -0,0 +1,116 @@
+maintenance:
+
+ title: FORM_Set_VTE_Prophylaxis_Set_Session_Object;;
+ mlmname: FORM_Set_VTE_Prophylaxis_Set_Session_Object;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Memorial Hospital;;
+ author: Teresa Spicuzza;;
+ specialist: Don Warnick;;
+ date: 2009-08-12;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+
+ explanation: This MLM is called when a VTE Prophylaxis Evaluation order is entered. It interrogates the Contraindication field
+ and passes the value in a session object OS_VTE_Prophylaxis_Order_Set which uses will grey out the Heparin & Enoxaparin
+ order selections
+
+
+ Change history
+
+ 08.12.2009 DW Initial Build
+ 06.02.2011 TMS Added VTE score and not indicated reason as local session object.
+ 12.03.2015 STH Added VTE Not Ordered as local session object. {Go-Live 12/15/2015}
+ ;;
+ keywords:
+ ;;
+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;
+
+
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField :=this_communication.CallingFieldName;
+ ClientVisitGuid := this_communication.ClientVisitGuid;
+ ClientGuid := this_communication.ClientGuid;
+ requesting_user_guid := this_communication.CareProviderGUID;
+ orderroletype:= this_communication.primaryobj.enterrole;
+ user_guid:= this_communication.userguid;
+ ordername:= this_communication.primaryobj.name;
+
+
+ local_session := cds_session.local;
+
+
+ contraindication := last of (field_list where field_list.DataItemName = "VTE Prophylaxis Contraindication" );
+ riskfactor := last of (field_list where field_list.DataItemName = "VTE Prophylaxis Risk Factor Score" );
+ notindicated := last of (field_list where field_list.DataItemName = "VTE Prophylaxis Not Indicated");
+ notordered := last of (field_list where field_list.DataItemName = "VTE Mech Prophylaxis");
+
+// populate the session objects
+
+ // if contraindication.value is null then xxx := "True" ; else xxx := "False"; endif;
+ // local_session.SessionVTEContraindication := contraindication.value;
+ if contraindication.value is null then
+ local_session.SessionVTEContraindication := "none entered";
+ else
+ local_session.SessionVTEContraindication := contraindication.value;
+ endif;
+
+ if riskfactor.value is null then
+ local_session.SessionVTEScore := "none entered";
+
+ else
+ local_session.SessionVTEScore := riskfactor.value;
+ endif;
+
+ if notindicated.value is null then
+ local_session.SessionVTENotIndicated := "none entered";
+
+ else
+ local_session.SessionVTENotIndicated := notindicated.value;
+ endif;
+ if notordered.value is null then
+ local_session.SessionVTENotOrdered := "none entered";
+
+ else
+ local_session.SessionVTENotOrdered := notordered.value;
+ endif;
+
+
+// this_communication.DisplayForm := "Yes"; this_communication.Message := " - " || xxx || local_session.SessionVTEContraindication ; this_communication.MessageType := "Error";
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_WARFARIN_ORDERS_SLIDING_SCALE.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_WARFARIN_ORDERS_SLIDING_SCALE.mlm
new file mode 100644
index 0000000..635c553
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_WARFARIN_ORDERS_SLIDING_SCALE.mlm
@@ -0,0 +1,340 @@
+maintenance:
+
+ title: Set Warfarin Nurse Orders Sliding Scale;;
+ mlmname: FORM_Set_Warfarin_Orders_Sliding_Scale;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Don Warnick, Eclipsys Corp Ext 7463;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-09-22;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds warfarin order set
+ ;;
+
+ explanation: This MLM is called from the warfarin order set, form: PRX_OSIJBnWarfnSS
+
+
+ Change history
+
+ 09.16.2008 DW Initial build - derived from FORM_SET_HEPARIN_WEIGHT_BASED_INIT
+ 12.11.2008 DW Revised to check for current time and change the priority to stat if after specified time of day
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 11.17.2014 TMS Added error box if less than two orders selected for sliding scale. HD# 1476066
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ ;;
+ keywords: Called MLMs, warfarin
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Find the baseline order checkbox that may need to be ordered with this protocol
+
+ Labs_Baseline_field := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 1);
+ Labs_Baseline_List := Labs_Baseline_field.Value;
+ Baseline_INR:= first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Prothrombin/INR");
+
+ //Find the daily order that may needs to accompany this protocol
+
+ Lab_Daily_Order_field := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_Order_List := Lab_Daily_Order_field.Value;
+// Daily_Order_INR := first of (Lab_Daily_Order_List where Lab_Daily_Order_List.Name = "Prothrombin/INR");
+
+
+ // Find the 5 Requested Date fields - #1 is visible, #2 - #5 are hidden
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 5);
+
+ //Find the daily reminder that may need to be ordered with this protocol
+
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Lab_Rem_List := Lab_Rem.Value;
+ Daily_Reminder := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+ //Find if any of the med boxes are checked...if so, set Med_Was_Selected to "yes"
+
+ Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Med_List :=Med_Grid.Value;
+ Med_SelList := Med_List.IsSelected;
+ Med_Selected := true in Med_SelList;
+ If Med_Selected = True then Med_Was_Selected := "yes"; else Med_Was_Selected := "no" ; endif;
+
+ //Find Sliding Scale Master Order
+
+ Med_GridB := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 4);
+ Med_ListB := Med_GridB.Value;
+ Med_ListB.IsReadOnly := True;
+
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+ If CallingEvent = "FieldChange" Then
+
+ If CallingField = "MultiOrderGrid|1" then
+
+ If Med_Was_Selected = "yes"
+ then
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_Order_List.IsSelected := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+ Daily_Reminder.IsSelected := True;
+ else
+ Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
+ Daily_Reminder.IsSelected := False;
+ endif;
+
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")";
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 1 days;
+ thirdreqdate.value := startdate + 2 days;
+ fourthreqdate.value := startdate + 3 days;
+ fifthreqdate.value := startdate + 4 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ endif;
+
+ elseif CallingEvent = "FormOpen" then
+
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+ // Daily_Reminder.IsSelected := True;
+
+ // Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 1 days;
+ thirdreqdate.value := startdate + 2 days;
+ fourthreqdate.value := startdate + 3 days;
+ fifthreqdate.value := startdate + 4 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ elseif CallingEvent = "FormClose" then
+
+
+// DW 12.11.2008 Check for cutoff time and change priorty of Baseline order to Today if before. Leave as Stat if after
+
+ modifiedstarttime := last of (field_list where field_list.DataItemName = "requestedtime" and field_List.Control_MultiFieldOccNum = 2);
+ modifiedstarttimevalue :=modifiedstarttime.Value;
+
+ hr := extract hour now; if hr < 10 then hr := "0" || hr; endif;
+ mi := extract minute now; if mi < 10 then mi := "0" || mi; endif;
+
+ currtime := hr || mi;
+ cutofftime := "1900";
+
+ if (currtime as number) > (cutofftime as number)
+ then modifiedstarttimevalue.ReqTimeCode := "Stat"; /* it is after the cutoff time */
+ else modifiedstarttimevalue.ReqTimeCode := "Today"; /* it is before the cutoff time */
+ endif;
+/*
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "THIS MESSAGE IS FOR TESTING PURPOSES ONLY \n\n\n\n" ||
+ "the cutoff time is " || cutofftime || "\n\n\n" ||
+ "the current time is " || currtime || "\n\n\n" ||
+ " " || "\n\n\n"
+ ;
+ this_communication.MessageType := "Informational";
+*/
+ // DW 12.11.2008 End of new code
+
+ // TMS 11.17.2014 Alert user they are ordering from the sliding scale if only 1 order checked
+
+ If Med_Was_Selected = "yes" then
+ countords := 0;
+ for r in 1 seqto (count Med_List) do
+ If Med_list.isselected [r] = true then
+ countords := countords +1;
+ endif;
+ enddo;
+
+ If countords < 2 then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "This order set is for Warfarin Sliding Scale orders only. Please enter at least 2 Warfarin Orders with INR parameters to continue.\n\n" ||
+ "Please use the Warfarin Orders Order Set for all other Warfarin Orders." ;
+ this_communication.MessageType := "Error";
+ endif;
+
+ // Find if there is a baseline INR in the past 24 hours and if one is not found, check the baseline box
+
+ If Baseline_INR.IsSelected = false then
+
+ INR_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If not exists INR_Val then Baseline_INR.ISSelected :=True; endif;
+
+ endif;
+
+ // Now find if there are already INR{{{SINGLE-QUOTE}}}S ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ INR_daily_dates :=();
+ INR_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name = {{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}"
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(INR_daily_dates) then
+ Reset_INR_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+
+ for J in index_list do
+ singledate := formlist[J];
+ Reset_INR_Grid:= Reset_INR_Grid, singledate not in INR_daily_dates;
+ enddo;
+
+ Lab_Daily_Order_List.IsSelected := (Reset_INR_Grid);
+
+/*
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "THIS MESSAGE IS FOR TESTING PURPOSES ONLY \n\n\n\n" ||
+ "Did you see any changes to the INR Grid check boxes? \n\n" ||
+ "SQL returned dates for INRS: " || INR_daily_dates || "\n\n" ||
+ "GRID INR orders with these dates should have been unchecked by this MLM!!!" || "\n\n\n"
+ ;
+ this_communication.MessageType := "Informational";
+
+*/
+ endif; //If exist
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please enter a Warfarin Order.\n\n" ;
+ this_communication.MessageType := "Error";
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_WARFARIN_ORDERS_TABLET.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_WARFARIN_ORDERS_TABLET.mlm
new file mode 100644
index 0000000..b3606f5
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_WARFARIN_ORDERS_TABLET.mlm
@@ -0,0 +1,1522 @@
+maintenance:
+
+ title: Set Warfarin Nurse Orders Tablet;;
+ mlmname: FORM_Set_Warfarin_Orders_Tablet;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Don Warnick, Eclipsys Corp Ext 7463;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-09-22;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds warfarin order set
+ ;;
+
+ explanation: This MLM is called from the warfarin order set, form: PRX_OSWarfarin
+
+
+ Change history
+
+ 09.16.2008 DW Initial build - derived from FORM_SET_HEPARIN_WEIGHT_BASED_INIT
+ 12.11.2008 DW Revised to check for current time and change the priority to stat if after specified time of day
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 10.06.2014 TMS New logic added for supporting Warfarin alternating dose orders needing user schedule CSR 32392
+ 10.10.2014 TMS Added message to select dose and frequency from selection boxes instead of grid when user tries to select
+ dose from grid. CSR 32392
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+
+ ;;
+ keywords: Called MLMs, warfarin
+ ;;
+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;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ //using "ObjectsPlusXA.SCM.Forms";
+ //using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Find the baseline order checkbox that may need to be ordered with this protocol
+
+ Labs_Baseline_field := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 1);
+ Labs_Baseline_List := Labs_Baseline_field.Value;
+ Baseline_INR:= first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Prothrombin/INR");
+ DoseA := last of (field_list where field_list.DataItemName = "WarfarinDose1" and field_List.Control_MultiFieldOccNum = 1);
+ DoseA_value := DoseA.value;
+ AltDaysDoseA := last of (field_list where field_list.DataItemName = "PRX_AltSchedule1" and field_List.Control_MultiFieldOccNum = 1);
+ AltDaysDoseA_list := AltDaysDoseA.value;
+ DoseADays := last of (field_list where field_list.DataItemName = "PRX_Scheddays1" and field_List.Control_MultiFieldOccNum = 1);
+ DoseBDays := last of (field_list where field_list.DataItemName = "PRX_Scheddays1" and field_List.Control_MultiFieldOccNum = 2);
+ DoseB := last of (field_list where field_list.DataItemName = "WarfarinDose1" and field_List.Control_MultiFieldOccNum = 2);
+ DoseB_value := DoseB.value;
+ DoseA_GiveWith := first of (field_list where field_list.DataItemName = "PRX_ADMINS_GiveWith" and field_List.Control_MultiFieldOccNum = 1);
+ DoseB_GiveWith := first of (field_list where field_list.DataItemName = "PRX_ADMINS_GiveWith" and field_List.Control_MultiFieldOccNum = 2);
+ AltCB := last of (field_list where field_list.DataItemName = "PRX_Generic_CB" and field_List.Control_MultiFieldOccNum = 1);
+ AltCB_value := AltCB.value;
+ AltDaysDoseB := last of (field_list where field_list.DataItemName = "PRX_AltSchedule2" and field_List.Control_MultiFieldOccNum = 1);
+ AltDaysDoseB_list := AltDaysDoseB.value;
+ Frequency := last of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = 1);
+ Frequency_val := Frequency.value;
+ Frequency2 := last of (field_list where field_list.DataItemName = "FrequencyCode" and field_List.Control_MultiFieldOccNum = 2);
+ Frequency2_val := Frequency2.value;
+ DailyFreq := last of (field_list where field_list.DataItemName = "PRX_Std_Schedule" and field_List.Control_MultiFieldOccNum = 1);
+ DailyFreq2 := last of (field_list where field_list.DataItemName = "PRX_Std_Schedule" and field_List.Control_MultiFieldOccNum = 2);
+ DailyFreq_value := DailyFreq.value;
+ DailyFreq2_value := DailyFreq2.value;
+ //Find the daily order that may needs to accompany this protocol
+ Grid1Orders_field := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Grid1Orders_List := Grid1Orders_field.value;
+ Grid2Orders_field := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 4);
+ Grid2Orders_List := Grid2Orders_field.value;
+ Lab_Daily_Order_field := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_Order_List := Lab_Daily_Order_field.Value;
+// Daily_Order_INR := first of (Lab_Daily_Order_List where Lab_Daily_Order_List.Name = "Prothrombin/INR");
+
+
+ // Find the 5 Requested Date fields - #1 is visible, #2 - #5 are hidden
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 5);
+ DoseAStartdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 6);
+ DoseBStartdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 7);
+ //Find the daily reminder that may need to be ordered with this protocol
+
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Lab_Rem_List := Lab_Rem.Value;
+ Daily_Reminder := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+ WarfarinA_0_5 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 0.5mg (1/2 of 1mg) Tab");
+ WarfarinA_1_25 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 1.25mg (1/2 of 2.5mg) Tab");
+ WarfarinA_1_5 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 1.5mg (1/2 of3mg) Tab");
+ WarfarinA_1 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 1mg Tab");
+ WarfarinA_2 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 2 mg Tab");
+ WarfarinA_2_5 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 2.5mg Tab");
+ WarfarinA_3 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 3mg Tab");
+ WarfarinA_4 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 4mg Tab");
+ WarfarinA_5 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 5mg Tab");
+ WarfarinA_6 := last of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 3mg Tab");
+ WarfarinA_7_5 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 7.5mg Tab");
+ WarfarinA_8 := last of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 4mg Tab");
+ WarfarinA_10 := first of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 10mg Tab");
+ WarfarinA_15 := last of (Grid1Orders_List where Grid1Orders_List.Name = "Warfarin 7.5mg Tab");
+
+ WarfarinB_0_5 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 0.5mg (1/2 of 1mg) Tab");
+ WarfarinB_1_25 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 1.25mg (1/2 of 2.5mg) Tab");
+ WarfarinB_1_5 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 1.5mg (1/2 of3mg) Tab");
+ WarfarinB_1 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 1mg Tab");
+ WarfarinB_2 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 2 mg Tab");
+ WarfarinB_2_5 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 2.5mg Tab");
+ WarfarinB_3 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 3mg Tab");
+ WarfarinB_4 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 4mg Tab");
+ WarfarinB_5 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 5mg Tab");
+ WarfarinB_6 := last of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 3mg Tab");
+ WarfarinB_7_5 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 7.5mg Tab");
+ WarfarinB_10 := first of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 10mg Tab");
+ WarfarinB_8 := last of (Grid2Orders_List where Grid2Orders_List.Name = "Warfarin 4mg Tab");
+ WarfarinB_15 := last of (Grid2Orders_List where Grid1Orders_List.Name = "Warfarin 7.5mg Tab");
+
+
+
+
+ //Find if any of the med boxes are checked...if so, set Med_Was_Selected to "yes"
+
+ Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Med_List :=Med_Grid.Value;
+ Med_SelList := Med_List.IsSelected;
+ Med_Selected := true in Med_SelList;
+ Med_Grid2 := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 4);
+ Med_List2 :=Med_Grid2.Value;
+ Med_SelList2 := Med_List2.IsSelected;
+ Med_Selected2 := true in Med_SelList2;
+
+
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+ If (Med_Selected = True or Med_Selected2 = True) then Med_Was_Selected := "yes"; else Med_Was_Selected := "no" ; endif;
+
+ If CallingEvent = "FieldChange" Then
+ If CallingField = "PRX_Generic_CB|1" then
+
+ If AltCB.Value = True then
+ AltDaysDoseA.control_visible := TRUE;
+ AltDaysDoseB.control_visible := TRUE;
+ DoseB.control_visible := TRUE;
+ Frequency_val.frequencysummary := Null;
+ Frequency2_val.frequencysummary := Null;
+ DailyFreq.value := "None";
+ DailyFreq2.value := "None";
+ Frequency.Control_read_only:= true;
+ Frequency2.Control_read_only:= true;
+
+
+ elseif AltCB_Value = False then
+ AltDaysDoseA.value := Null;
+ AltDaysDoseB.value := Null;
+ AltDaysDoseA.control_visible := FALSE;
+ AltDaysDoseB.control_visible := FALSE;
+ DoseB.control_visible := true;
+ Frequency_val.frequencysummary := "QHS";
+ Frequency2_val.frequencysummary := "Once";
+ DailyFreq.value := "QHS";
+ DailyFreq2.value := "Once";
+ DoseADays.value := "None";
+ DoseBDays.value := "None";
+ DoseA.value := Null;
+ DoseB.value := Null;
+ Frequency.Control_read_only:= false;
+ Frequency2.Control_read_only:= false;
+ Grid1Orders_List.IsSelected := (False, False, False, False, False, False, False, False, False, False, False, False, False, False);
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, True);
+ Grid2Orders_List.IsSelected := (False, False, False, False, False, False, False, False, False, False, False, False, False, False);
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, True);
+ endif;
+ endif;
+
+ ThisTime := (now as time) ;
+ FormatDate := extract month ThisTime ||"-" || extract day ThisTime ||"-" ||extract year ThisTime;
+ //Thattime := thistime + 1 day;
+ ThisDay := extract year ThisTime || "-" || extract month ThisTime ||"-" || extract day ThisTime;
+ DayofWeek1 := read last {"SELECT DATENAME(dw, GETDATE ())"};
+ DayofWeek2 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,1,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek3 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,2,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek4 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,3,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek5 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,4,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek6 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,5,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+ DayofWeek7 := read last {"SELECT DATENAME(dw, dateadd (WEEKDAY,6,{{{SINGLE-QUOTE}}}" || ThisTime || "{{{SINGLE-QUOTE}}}))"};
+
+
+ If CallingField = "FrequencyCode|1" then
+ DailyFreq.value := Frequency_val.frequencysummary;
+ endif;
+
+ If CallingField = "FrequencyCode|2" then
+ DailyFreq2.value := Frequency2_val.frequencysummary;
+ endif;
+
+ If CallingField = "MultiOrderGrid|1" and DoseA_value is Null then
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Please select Dose of Warfarin and Frequency from selection options to the left. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, True);
+ Grid1Orders_List.IsSelected := (False, False, False, False, False, False, False, False, False, False, False, False, False, False);
+ endif;
+
+ If CallingField = "MultiOrderGrid|4" and DoseB_value is Null then
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Please select Dose of Warfarin and Frequency from selection options to the left. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, True);
+ Grid2Orders_List.IsSelected := (False, False, False, False, False, False, False, False, False, False, False, False, False, False);
+ endif;
+
+
+ If CallingField = "WarfarinDose1|1" then
+ If DoseA_value = "0.5mg" then
+ WarfarinA_0_5.IsSelected := True;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (False, True, True, True, True, True, True, True, True, True, True, True, True, True);
+
+
+ elseif DoseA_value = "1mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := True;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, False, True, True, True, True, True, True, True, True, True, True, True, True);
+
+ elseif DoseA_value = "1.25mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := True;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, True);
+
+ elseif DoseA_value = "1.5mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := True;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, False, True, True, True, True, True, True, True, True, True, True);
+
+ elseif DoseA_value = "2mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := True;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True,True, False, True, True, True, True, True, True, True, True, True);
+
+ elseif DoseA_value = "2.5mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := True;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, False, True, True, True, True, True, True, True, True);
+
+
+ elseif DoseA_value = "3mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := True;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, False, True, True, True, True, True, True, True);
+
+ elseif DoseA_value = "3.5mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := True;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := True;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "Give 1mg tablet and 2.5mg tablet for total dose of 3.5mg";
+ Grid1Orders_List.IsReadOnly := (True, False, True, True, True, False, True, True, True, True, True, True, True, True);
+
+ elseif DoseA_value = "4mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := True;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, False, True, True, True, True, True, True);
+
+ elseif DoseA_value = "4.5mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := True;
+ WarfarinA_2_5.IsSelected := True;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "Give 2mg tablet and 2.5mg tablet for total dose of 4.5mg";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, False, False, True, True, True, True, True, True, True, True);
+
+ elseif DoseA_value = "5mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := True;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, False, True, True, True, True, True);
+
+ elseif DoseA_value = "6mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := True;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, False, True, True, True, True);
+
+ elseif DoseA_value = "7mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := True;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := True;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "Give 2mg tablet and 5mg tablet for total dose of 7mg";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, False, True, True, True, False, True, True, True, True, True);
+
+ elseif DoseA_value = "7.5mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := True;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, False, True, True, True);
+
+ elseif DoseA_value = "8mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := True;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, False, True, True);
+
+ elseif DoseA_value = "9mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := True;
+ WarfarinA_5.IsSelected := True;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "Give 4mg tablet and 5mg tablet for total dose of 9mg";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, False, False, True, True, True, True, True);
+
+ elseif DoseA_value = "10mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := True;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, False, True);
+
+ elseif DoseA_value = "11mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := True;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := True;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "Give 10mg tablet and 1mg tablet for total dose of 11mg";
+ Grid1Orders_List.IsReadOnly := (True, False, True, True, True, True, True, True, True, True, True, True, False, True);
+
+ elseif DoseA_value = "12mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := True;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := True;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "Give 10mg tablet and 2mg tablet for total dose of 12mg";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, False, True, True, True, True, True, True, True, False, True);
+
+ elseif DoseA_value = "12.5mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := True;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := True;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "Give 10mg tablet and 2.5mg tablet for total dose of 12.5mg";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, False, True, True, True, True, True, True, False, True);
+
+ elseif DoseA_value = "15mg" then
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := True;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, False);
+
+ else
+ WarfarinA_0_5.IsSelected := False;
+ WarfarinA_1.IsSelected := False;
+ WarfarinA_1_25.IsSelected := False;
+ WarfarinA_1_5.IsSelected := False;
+ WarfarinA_2.IsSelected := False;
+ WarfarinA_2_5.IsSelected := False;
+ WarfarinA_3.IsSelected := False;
+ WarfarinA_4.IsSelected := False;
+ WarfarinA_5.IsSelected := False;
+ WarfarinA_6.IsSelected := False;
+ WarfarinA_7_5.IsSelected := False;
+ WarfarinA_8.IsSelected := False;
+ WarfarinA_10.IsSelected := False;
+ WarfarinA_15.IsSelected := False;
+ DoseA_GiveWith.value := "";
+ Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, True);
+ // Grid1Orders_List.IsReadOnly := (False, False, False, False, False, False, False, False, False, False, False, False, False, False);
+
+ endif;
+ endif;
+
+
+ If CallingField = "WarfarinDose1|2" then
+ If DoseB_value = "0.5mg" then
+ WarfarinB_0_5.IsSelected := True;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (False, True, True, True, True, True, True, True, True, True, True, True, True, True);
+
+ elseif DoseB_value = "1mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := True;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, False, True, True, True, True, True, True, True, True, True, True, True, True);
+
+ elseif DoseB_value = "1.25mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := True;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, False, True, True, True, True, True, True, True, True, True, True, True);
+
+ elseif DoseB_value = "1.5mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := True;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, False, True, True, True, True, True, True, True, True, True, True);
+
+
+ elseif DoseB_value = "2mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := True;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, False, True, True, True, True, True, True, True, True, True);
+
+ elseif DoseB_value = "2.5mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := True;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, False, True, True, True, True, True, True, True, True);
+
+ elseif DoseB_value = "3mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := True;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, False, True, True, True, True, True, True, True);
+
+ elseif DoseB_value = "3.5mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := True;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := True;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "Give 1mg tablet and 2.5mg tablet for total dose of 3.5mg";
+ Grid2Orders_List.IsReadOnly := (True, False, True, True, True, False, True, True, True, True, True, True, True, True);
+
+
+ elseif DoseB_value = "4mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := True;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, False, True, True, True, True, True, True);
+
+ elseif DoseB_value = "4.5mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := True;
+ WarfarinB_2_5.IsSelected := True;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "Give 2mg tablet and 2.5mg tablet for total dose of 4.5mg";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, False, False, True, True, True, True, True, True, True, True);
+
+ elseif DoseB_value = "5mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := True;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, False, True, True, True, True, True);
+
+ elseif DoseB_value = "6mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := True;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, False, True, True, True, True);
+
+ elseif DoseB_value = "7mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := True;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := True;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "Give 2mg tablet and 5mg tablet for total dose of 7mg";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, False, True, True, True, False, True, True, True, True, True);
+
+ elseif DoseB_value = "7.5mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := True;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, False, True, True, True);
+
+ elseif DoseB_value = "8mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := True;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, False, True, True);
+
+ elseif DoseB_value = "9mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := True;
+ WarfarinB_5.IsSelected := True;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "Give 4mg tablet and 5mg tablet for total dose of 9mg";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, False, False, True, True, True, True, True);
+
+ elseif DoseB_value = "10mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := True;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, False, True);
+
+ elseif DoseB_value = "11mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := True;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := True;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "Give 10mg tablet and 1mg tablet for total dose of 11mg";
+ Grid2Orders_List.IsReadOnly := (True, False, True, True, True, True, True, True, True, True, True, True, False, True);
+
+ elseif DoseB_value = "12mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := True;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := True;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "Give 10mg tablet and 2mg tablet for total dose of 12mg";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, False, True, True, True, True, True, True, True, False, True);
+
+ elseif DoseB_value = "12.5mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := True;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := True;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "Give 10mg tablet and 2.5mg tablet for total dose of 12.5mg";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, False, True, True, True, True, True, True, False, True);
+
+ elseif DoseB_value = "15mg" then
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := True;
+ DoseB_GiveWith.value := "";
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, False);
+
+ else
+ WarfarinB_0_5.IsSelected := False;
+ WarfarinB_1.IsSelected := False;
+ WarfarinB_1_25.IsSelected := False;
+ WarfarinB_1_5.IsSelected := False;
+ WarfarinB_2.IsSelected := False;
+ WarfarinB_2_5.IsSelected := False;
+ WarfarinB_3.IsSelected := False;
+ WarfarinB_4.IsSelected := False;
+ WarfarinB_5.IsSelected := False;
+ WarfarinB_6.IsSelected := False;
+ WarfarinB_7_5.IsSelected := False;
+ WarfarinB_8.IsSelected := False;
+ WarfarinB_10.IsSelected := False;
+ WarfarinB_15.IsSelected := False;
+ DoseB_GiveWith.value := "";
+ // Grid2Orders_List.IsReadOnly := (False, False, False, False, False, False, False, False, False, False, False, False, False, False);
+ Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, True);
+
+ endif;
+ endif;
+
+ if AltDaysDoseA.value is not null then
+ DoseADays.value := AltDaysDoseA_list;
+ StartDay1A := "NO";
+ StartDay2A := "NO";
+ StartDay3A := "NO";
+ StartDay4A := "NO";
+ StartDay5A := "NO";
+ StartDay6A := "NO";
+ StartDay7A := "NO";
+ ListOfDaysA := call str_parse with DoseADays.value, ",";
+ for r in 1 seqto (count ListOfDaysA) do
+
+ If DayofWeek1 = ListOfDaysA [r] then
+ StartDay1A := "YES";
+ elseif DayofWeek2 = ListOfDaysA [r] then
+ StartDay2A := "Yes";
+ elseif DayofWeek3 = ListOfDaysA [r] then
+ StartDay3A := "Yes";
+ elseif DayofWeek4 = ListOfDaysA [r] then
+ StartDay4A := "Yes";
+ elseif DayofWeek5 = ListOfDaysA [r] then
+ StartDay5A := "Yes";
+ elseif DayofWeek6 = ListOfDaysA [r] then
+ StartDay6A := "Yes";
+ elseif DayofWeek7 = ListOfDaysA [r] then
+ StartDay7A := "Yes";
+ endif;
+ enddo;
+ endif;
+
+
+ if AltDaysDoseB.value is not null then
+ DoseBDays.value := AltDaysDoseB_list;
+ StartDay1B := "NO";
+ StartDay2B := "NO";
+ StartDay3B := "NO";
+ StartDay4B := "NO";
+ StartDay5B := "NO";
+ StartDay6B := "NO";
+ StartDay7B := "NO";
+
+ ListOfDaysB := call str_parse with DoseBDays.value, ",";
+
+ for r in 1 seqto (count ListOfDaysB) do
+
+ If DayofWeek1 = ListOfDaysB [r] then
+ StartDay1B := "Yes";
+ elseif DayofWeek2 = ListOfDaysB [r] then
+ StartDay2B := "Yes";
+ elseif DayofWeek3 = ListOfDaysB [r] then
+ StartDay3B := "Yes";
+ elseif DayofWeek4 = ListOfDaysB [r] then
+ StartDay4B := "Yes";
+ elseif DayofWeek5 = ListOfDaysB [r] then
+ StartDay5B := "Yes";
+ elseif DayofWeek6 = ListOfDaysB [r] then
+ StartDay6B := "Yes";
+ elseif DayofWeek7 = ListOfDaysB [r] then
+ StartDay7B := "Yes";
+ endif;
+ enddo;
+
+ else
+ DoseBDays.value := "None";
+ endif;
+
+
+ If StartDay1A = "Yes" then
+ DoseAStartDate.value := Thistime;
+ elseif StartDay2A = "Yes" then
+ DoseAStartDate.value := Thistime + 1 day;
+ elseif StartDay3A = "Yes" then
+ DoseAStartDate.value := Thistime + 2 day;
+ elseif StartDay4A = "Yes" then
+ DoseAStartDate.value := Thistime + 3 day;
+ elseif StartDay5A = "Yes" then
+ DoseAStartDate.value := Thistime + 4 day;
+ elseif StartDay6A = "Yes" then
+ DoseAStartDate.value := Thistime + 5 day;
+ elseif StartDay7A = "Yes" then
+ DoseAStartDate.value := Thistime + 6 day;
+ endif;
+
+
+
+ If StartDay1B = "Yes" then
+ DoseBStartDate.value := Thistime;
+ elseif StartDay2B = "Yes" then
+ DoseBStartDate.value := Thistime + 1 day;
+ elseif StartDay3B = "Yes" then
+ DoseBStartDate.value := Thistime + 2 day;
+ elseif StartDay4B = "Yes" then
+ DoseBStartDate.value := Thistime + 3 day;
+ elseif StartDay5B = "Yes" then
+ DoseBStartDate.value := Thistime + 4 day;
+ elseif StartDay6B = "Yes" then
+ DoseBStartDate.value := Thistime + 5 day;
+ elseif StartDay7B = "Yes" then
+ DoseBStartDate.value := Thistime + 6 day;
+ endif;
+
+// If (AltDaysDoseB.value is null and AltDaysDoseA.value is null and Med_Selected = True and Med_Selected2 = True) then
+ If (AltDaysDoseB.value is null and AltDaysDoseA.value is null and Frequency_val.FrequencySummary is not null
+ and Frequency2_val.FrequencySummary is not null and DoseA.Value is not null and DoseB.Value is not null) then
+
+ If DailyFreq.value = "QHS" and DailyFreq2.value = "Once" then
+ DoseAStartDate.value := Thistime + 1 day;
+ DoseBStartDate.value := Thistime;
+ DoseAStartDateFmt := (extract month DoseAStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseAStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseAStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq2.value ||" and then " || DailyFreq.value ||" starting on " || DoseAStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq.value ||" order today." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseAStartDate.value := Thistime;
+ endif;
+ Elseif
+ DailyFreq.value = "QHS" and DailyFreq2.value = "STAT" then
+ DoseAStartDate.value := Thistime + 1 day;
+ DoseBStartDate.value := Thistime;
+ DoseAStartDateFmt := (extract month DoseAStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseAStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseAStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq2.value ||" and then " || DailyFreq.value ||" starting on " || DoseAStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq.value ||" order today." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseAStartDate.value := Thistime;
+ endif;
+ Elseif
+ DailyFreq.value = "QHS" and DailyFreq2.value = "Now" then
+ DoseAStartDate.value := Thistime + 1 day;
+ DoseBStartDate.value := Thistime;
+ DoseAStartDateFmt := (extract month DoseAStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseAStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseAStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq2.value ||" and then " || DailyFreq.value ||" starting on " || DoseAStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq.value ||" order today." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseAStartDate.value := Thistime;
+ endif;
+ Elseif
+ DailyFreq.value = "Every Other Day" and DailyFreq2.value = "Once" then
+ DoseAStartDate.value := Thistime + 2 day;
+ DoseBStartDate.value := Thistime;
+ DoseAStartDateFmt := (extract month DoseBStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseBStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseBStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq2.value ||" and then " || DailyFreq.value ||" starting on " || DoseBStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq.value ||" order tomorrow." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseAStartDate.value := Thistime + 1 day;
+ endif;
+ Elseif
+ DailyFreq.value = "Every Other Day" and DailyFreq2.value = "STAT" then
+ DoseAStartDate.value := Thistime + 2 day;
+ DoseBStartDate.value := Thistime;
+ DoseAStartDateFmt := (extract month DoseBStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseBStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseBStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq2.value ||" and then " || DailyFreq.value ||" starting on " || DoseBStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq.value ||" order tomorrow." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseAStartDate.value := Thistime + 1 day;
+ endif;
+ Elseif
+ DailyFreq.value = "Every Other Day" and DailyFreq2.value = "Now" then
+ DoseAStartDate.value := Thistime + 2 day;
+ DoseBStartDate.value := Thistime;
+ DoseAStartDateFmt := (extract month DoseBStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseBStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseBStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq2.value ||" and then " || DailyFreq.value ||" starting on " || DoseBStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq.value ||" order tomorrow." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseAStartDate.value := Thistime + 1 day;
+ endif;
+
+ Elseif
+ DailyFreq.value = "STAT" and DailyFreq2.value = "QHS" then
+ DoseAStartDate.value := Thistime;
+ DoseBStartDate.value := Thistime + 1 day;
+ DoseBStartDateFmt := (extract month DoseBStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseBStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseBStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq.value ||" and then " || DailyFreq2.value ||" starting on " || DoseBStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq2.value ||" order today." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseBStartDate.value := Thistime;
+ endif;
+ Elseif
+ DailyFreq.value = "Now" and DailyFreq2.value = "QHS" then
+ DoseAStartDate.value := Thistime;
+ DoseBStartDate.value := Thistime + 1 day;
+ DoseBStartDateFmt := (extract month DoseBStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseBStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseBStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq.value ||" and then " || DailyFreq2.value ||" starting on " || DoseBStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq2.value ||" order today." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseBStartDate.value := Thistime;
+ endif;
+ Elseif
+ DailyFreq.value = "Once" and DailyFreq2.value = "QHS" then
+ DoseAStartDate.value := Thistime;
+ DoseBStartDate.value := Thistime + 1 day;
+ DoseBStartDateFmt := (extract month DoseBStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseBStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseBStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq.value ||" and then " || DailyFreq2.value ||" starting on " || DoseBStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq2.value ||" order today." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseBStartDate.value := Thistime;
+ endif;
+ Elseif
+ DailyFreq.value = "STAT" and DailyFreq2.value = "Every Other Day" then
+ DoseAStartDate.value := Thistime;
+ DoseBStartDate.value := Thistime + 2 day;
+ DoseBStartDateFmt := (extract month DoseBStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseBStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseBStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq.value ||" and then " || DailyFreq2.value ||" starting on " || DoseBStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq2.value ||" order tomorrow." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseBStartDate.value := Thistime + 1 day;
+ endif;
+ Elseif
+ DailyFreq.value = "Now" and DailyFreq2.value = "Every Other Day" then
+ DoseAStartDate.value := Thistime;
+ DoseBStartDate.value := Thistime + 2 day;
+ DoseBStartDateFmt := (extract month DoseBStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseBStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseBStartDate.value) formatted with "%04d" ;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq.value ||" and then " || DailyFreq2.value ||" starting on " || DoseBStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq2.value ||" order tomorrow." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseBStartDate.value := Thistime + 1 day;
+ endif;
+ Elseif
+ DailyFreq.value = "Once" and DailyFreq2.value = "Every Other Day" then
+ DoseAStartDate.value := Thistime;
+ DoseBStartDate.value := Thistime + 2 day;
+ DoseBStartDateFmt := (extract month DoseBStartDate.value) formatted with "%02d"
+ || "-" || (extract day DoseBStartDate.value) formatted with "%02d" || "-"
+ || (extract year DoseBStartDate.value) formatted with "%04d" ;
+ // breakmsg := DoseAStartDate.value || " and " || DoseBStartDateFmt; break;
+ dialogmsg := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Warfarin scheduled to be given "||DailyFreq.value ||" and then " || DailyFreq2.value ||" starting on " || DoseBStartDateFmt
+ ||".\n\n Select {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to accept this schedule. \n\n Select {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} to start the "||DailyFreq2.value ||" order tomorrow." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ if((dialogmsg as string) = "No") then
+ DoseBStartDate.value := Thistime + 1 day;
+ endif;
+ Else
+
+ DoseAStartDate.value := Thistime;
+ DoseBStartDate.value := Thistime;
+ Endif;
+ Endif;
+ // If DoseA_value is not null then
+ If (CallingField = "MultiOrderGrid|1" or Callingfield = "MultiOrderGrid|4" or CallingField = "WarfarinDose1|1" or CallingField = "WarfarinDose1|2") then
+
+ If Med_Was_Selected = "yes" or DoseA.value is not null or DoseB.value is not null
+
+ then
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_Order_List.IsSelected := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+ Daily_Reminder.IsSelected := True;
+
+ else
+ Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
+ Daily_Reminder.IsSelected := False;
+ endif;
+ endif;
+
+
+ If CallingField = "RequestedDate|1" then
+ //Set the four remaining order set date fields based on the starting date
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")";
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 1 days;
+ thirdreqdate.value := startdate + 2 days;
+ fourthreqdate.value := startdate + 3 days;
+ fifthreqdate.value := startdate + 4 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ endif;
+
+ elseif CallingEvent = "FormOpen" then
+// Grid1Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, True);
+// Grid2Orders_List.IsReadOnly := (True, True, True, True, True, True, True, True, True, True, True, True, True, True);
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+
+// Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 1 days;
+ thirdreqdate.value := startdate + 2 days;
+ fourthreqdate.value := startdate + 3 days;
+ fifthreqdate.value := startdate + 4 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+ elseif CallingEvent = "FormClose" then
+
+
+// DW 12.11.2008 Check for cutoff time and change priorty of Baseline order to Today if before. Leave as Stat if after
+
+ modifiedstarttime := last of (field_list where field_list.DataItemName = "requestedtime" and field_List.Control_MultiFieldOccNum = 2);
+ modifiedstarttimevalue :=modifiedstarttime.Value;
+
+ hr := extract hour now; if hr < 10 then hr := "0" || hr; endif;
+ mi := extract minute now; if mi < 10 then mi := "0" || mi; endif;
+
+ currtime := hr || mi;
+ cutofftime := "1900";
+ if (currtime as number) > (cutofftime as number)
+ then modifiedstarttimevalue.ReqTimeCode := "Stat"; /* it is after the cutoff time */
+ else modifiedstarttimevalue.ReqTimeCode := "Today"; /* it is before the cutoff time */
+ endif;
+/*
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "THIS MESSAGE IS FOR TESTING PURPOSES ONLY \n\n\n\n" ||
+ "the cutoff time is " || cutofftime || "\n\n\n" ||
+ "the current time is " || currtime || "\n\n\n" ||
+ " " || "\n\n\n"
+ ;
+ this_communication.MessageType := "Informational";
+*/
+ // DW 12.11.2008 End of new code
+
+
+ If Med_Was_Selected = "yes" then
+
+ // Find if there is a baseline INR in the past 24 hours and if one is not found, check the baseline box
+
+ If Baseline_INR.IsSelected = false then
+
+ INR_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If not(exists(INR_Val)) then Baseline_INR.ISSelected :=True; endif;
+
+ endif;
+
+ // Now find if there are already INR{{{SINGLE-QUOTE}}}S ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+ end_date := fifthreqdate.value + 1 day;
+
+ INR_daily_dates :=();
+ INR_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name = {{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}"
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(INR_daily_dates) then
+
+ Reset_INR_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+
+
+ for J in index_list do
+ singledate := formlist[J];
+ Reset_INR_Grid:= Reset_INR_Grid, singledate not in INR_daily_dates;
+ enddo;
+
+ Lab_Daily_Order_List.IsSelected := (Reset_INR_Grid);
+
+/*
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "THIS MESSAGE IS FOR TESTING PURPOSES ONLY \n\n\n\n" ||
+ "Did you see any changes to the INR Grid check boxes? \n\n" ||
+ "SQL returned dates for INRS: " || INR_daily_dates || "\n\n" ||
+ "GRID INR orders with these dates should have been unchecked by this MLM!!!" || "\n\n\n"
+ ;
+ this_communication.MessageType := "Informational";
+*/
+
+ endif; //If exist
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please enter a Warfarin Order.\n\n" ;
+ this_communication.MessageType := "Error";
+
+ endif; // 1 of 2 heparin boxes checked
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_WARFARIN_ORDERS_VIAL_INJ.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_WARFARIN_ORDERS_VIAL_INJ.mlm
new file mode 100644
index 0000000..d7c2861
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_WARFARIN_ORDERS_VIAL_INJ.mlm
@@ -0,0 +1,328 @@
+maintenance:
+
+ title: Set Warfarin Nurse Orders Vial Injections;;
+ mlmname: FORM_Set_Warfarin_Orders_Vial_Inj;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Don Warnick, Eclipsys Corp Ext 7463;;
+ specialist: Teresa Spicuzza, Eclipsys Corp ext 7448;;
+ date: 2008-09-22;;
+ validation: testing;;
+
+library:
+ purpose: Used for medication grids that holds warfarin order set
+ ;;
+
+ explanation: This MLM is called from the warfarin order set, form: PRX_OSWarfarin_Inj
+
+
+ Change history
+
+ 09.16.2008 DW Initial build - derived from FORM_SET_HEPARIN_WEIGHT_BASED_INIT
+ 12.10.2008 DW Revised to check for current time and change the priority to stat if after specified time of day
+ 09.27.2010 TMS Added routine for Hold session date handling
+ 04.26.2016 TMS Add call on form Close to Medication Order Management MLM CSR 33465
+ ;;
+ keywords: Called MLMs, warfarin
+ ;;
+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;
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Find the baseline order checkbox that may need to be ordered with this protocol
+
+ Labs_Baseline_field := last of (field_list where field_list.DataItemName = "MultiOrderCheckBox" and field_List.Control_MultiFieldOccNum = 1);
+ Labs_Baseline_List := Labs_Baseline_field.Value;
+ Baseline_INR:= first of (Labs_Baseline_list where Labs_Baseline_list.Name = "Prothrombin/INR");
+
+ //Find the daily order that may needs to accompany this protocol
+
+ Lab_Daily_Order_field := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2);
+ Lab_Daily_Order_List := Lab_Daily_Order_field.Value;
+// Daily_Order_INR := first of (Lab_Daily_Order_List where Lab_Daily_Order_List.Name = "Prothrombin/INR");
+
+
+ // Find the 5 Requested Date fields - #1 is visible, #2 - #5 are hidden
+
+ primreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1);
+ secreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2);
+ thirdreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3);
+ fourthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 4);
+ fifthreqdate:= last of (field_list where field_list.DataItemName = "RequestedDate"and field_List.Control_MultiFieldOccNum = 5);
+
+ //Find the daily reminder that may need to be ordered with this protocol
+
+ Lab_Rem := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 3);
+ Lab_Rem_List := Lab_Rem.Value;
+ Daily_Reminder := first of (Lab_Rem_List where Lab_Rem_List.Name = "Daily Orders:");
+
+
+ //Find if any of the med boxes are checked...if so, set Med_Was_Selected to "yes"
+
+ Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1);
+ Med_List :=Med_Grid.Value;
+ Med_SelList := Med_List.IsSelected;
+ Med_Selected := true in Med_SelList;
+ If Med_Selected = True then Med_Was_Selected := "yes"; else Med_Was_Selected := "no" ; endif;
+
+ // ListMembs:= count Med_SelList;
+ // FalseList := ();
+ // for k in (1 seqto (ListMembs)) do
+ // FalseList := FalseList,False;
+ // enddo;
+
+ prx_comment := last of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+
+ Order_From := last of (field_list where field_list.DataItemName = "NUR_DateField");
+ Order_To := last of (field_list where field_list.DataItemName = "NUR_ToDate");
+
+
+ If CallingEvent = "FieldChange" Then
+
+
+ If CallingField = "MultiOrderGrid|1" then
+
+ If Med_Was_Selected = "yes"
+ then
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_Order_List.IsSelected := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+ Daily_Reminder.IsSelected := True;
+ else
+ Lab_Daily_Order_List.IsSelected := (False,False,False,False,False);
+ Daily_Reminder.IsSelected := False;
+ endif;
+
+ ElseIf CallingField = "RequestedDate|1" then
+
+ //Set the four remaining order set date fields based on the starting date
+
+ yr := extract year now;
+ mn := extract month now; if mn < 10 then mn := "0" || mn; endif;
+ dd := extract day now; if dd < 10 then dd := "0" || dd; endif;
+ today:= yr || "-" || mn || "-" || dd || "T00:00:00";
+
+ tomorrow := (today as time) +1 day;
+ tom_list := call str_parse with tomorrow, " ";
+ tom_dte := first(tom_list);
+ lesstomorrow := primreqdate.value < tomorrow;
+
+ If lesstomorrow = true then
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You may not enter a date earlier than tomorrow (" || tom_dte || ")";
+ this_communication.MessageType := "Error";
+
+ primreqdate.value := tomorrow;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 1 days;
+ thirdreqdate.value := startdate + 2 days;
+ fourthreqdate.value := startdate + 3 days;
+ fifthreqdate.value := startdate + 4 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+ endif;
+
+ elseif CallingEvent = "FormOpen" then
+
+ Lab_Daily_Order_List.IsReadOnly := (True,True,True,True,True);
+ Lab_Daily_Order_List.IsSelected := (True,True,True,True,True);
+ Daily_Reminder.IsReadOnly := True;
+ Daily_Reminder.IsSelected := True;
+
+ // Hold Session - Date handling. Instead of date (T is found) or(T+(#) is found)
+ PlusLocation := FIND "+" IN STRING primreqdate.value;
+ TLocation := FIND "T" IN STRING primreqdate.value;
+ If TLocation = 1 and PlusLocation = 0 then primreqdate.value := (now as time); endif;
+ If PlusLocation > 0 then
+ PlusDays := SUBSTRING 1 CHARACTERS STARTING AT LENGTH OF primreqdate.value FROM primreqdate.value ;
+ primreqdate.value := (now as time) +(PlusDays as number) day;
+ endif;
+
+ startdate:= primreqdate.value;
+ Order_From.value := primreqdate.value;
+ secreqdate.value := startdate + 1 days;
+ thirdreqdate.value := startdate + 2 days;
+ fourthreqdate.value := startdate + 3 days;
+ fifthreqdate.value := startdate + 4 days;
+ Order_To.value := fifthreqdate.value;
+
+ prx_comment.value:= primreqdate.value || "," || secreqdate.value || "," || thirdreqdate.value || "," ||
+ fourthreqdate.value || "," || fifthreqdate.value;
+
+
+
+
+ elseif CallingEvent = "FormClose" then
+
+
+// DW 12.11.2008 Check for cutoff time and change priorty of Baseline order to Today if before. Leave as Stat if after
+
+ modifiedstarttime := last of (field_list where field_list.DataItemName = "requestedtime" and field_List.Control_MultiFieldOccNum = 2);
+ modifiedstarttimevalue :=modifiedstarttime.Value;
+
+ hr := extract hour now; if hr < 10 then hr := "0" || hr; endif;
+ mi := extract minute now; if mi < 10 then mi := "0" || mi; endif;
+
+ currtime := hr || mi;
+ cutofftime := "1900";
+
+ if (currtime as number) > (cutofftime as number)
+ then modifiedstarttimevalue.ReqTimeCode := "Stat"; /* it is after the cutoff time */
+ else modifiedstarttimevalue.ReqTimeCode := "Today"; /* it is before the cutoff time */
+ endif;
+/*
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "THIS MESSAGE IS FOR TESTING PURPOSES ONLY \n\n\n\n" ||
+ "the cutoff time is " || cutofftime || "\n\n\n" ||
+ "the current time is " || currtime || "\n\n\n" ||
+ " " || "\n\n\n"
+ ;
+ this_communication.MessageType := "Informational";
+*/
+ // DW 12.11.2008 End of new code
+
+
+
+ If Med_Was_Selected = "yes" then
+
+ // Find if there is a baseline INR in the past 24 hours and if one is not found, check the baseline box
+
+ If Baseline_INR.IsSelected = false then
+
+ INR_Val := read last
+ {"Select top 1 o.Name"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name in ({{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and o.requesteddtm <= getdate() "
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " order by o.requesteddtm desc "
+ };
+
+ If not exists INR_Val then Baseline_INR.ISSelected :=True; endif;
+
+ endif;
+
+ // Now find if there are already INR{{{SINGLE-QUOTE}}}S ordered in the future...
+ // Reset the check boxes if they are.
+
+ formlist := call str_parse with prx_comment.value, ",";
+
+ end_date := fifthreqdate.value + 1 day;
+
+ INR_daily_dates :=();
+ INR_daily_dates := read
+
+ {"Select distinct top 20 convert(char(6),o.requesteddtm,110) +convert(char(4), o.requesteddtm,20) + {{{SINGLE-QUOTE}}} 00:00:00{{{SINGLE-QUOTE}}}"
+ || " From cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.active = 1 "
+ || " and ocmi.name = {{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}"
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.requesteddtm >= " || SQL(primreqdate.value)
+ || " and o.requesteddtm < " || SQL(end_date)
+ || " and o.OrderStatusLevelNum > 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.orderstatuscode <> {{{SINGLE-QUOTE}}}MASTR{{{SINGLE-QUOTE}}} "};
+
+ If exist(INR_daily_dates) then
+ Reset_INR_Grid:= ();
+ singledate := "";
+ index_list := 1 seqto (count formlist) ;
+
+ for J in index_list do
+ singledate := formlist[J];
+ Reset_INR_Grid:= Reset_INR_Grid, singledate not in INR_daily_dates;
+ enddo;
+
+ Lab_Daily_Order_List.IsSelected := (Reset_INR_Grid);
+
+/*
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "THIS MESSAGE IS FOR TESTING PURPOSES ONLY \n\n\n\n" ||
+ "Did you see any changes to the INR Grid check boxes? \n\n" ||
+ "SQL returned dates for INRS: " || INR_daily_dates || "\n\n" ||
+ "GRID INR orders with these dates should have been unchecked by this MLM!!!" || "\n\n\n"
+ ;
+ this_communication.MessageType := "Informational";
+
+*/
+ endif; //If exist
+
+ else
+
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "Please enter a Warfarin Order.\n\n" ;
+ this_communication.MessageType := "Error";
+
+ endif; // 1 of 2 heparin boxes checked
+
+ Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}};
+ (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj;
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_WOUND_CARE.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_WOUND_CARE.mlm
new file mode 100644
index 0000000..6f4c9cc
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_WOUND_CARE.mlm
@@ -0,0 +1,211 @@
+maintenance:
+
+ title: Generic Form Control for Order Sets;;
+ mlmname: FORM_Set_Wound_Care;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair;;
+ author: Shawn Head, Eclipsys Corp ext 7468;;
+ specialist: Peggy Karish, Eclipsys Corp ext 7441;;
+ date: 2012-08-01;;
+ validation: testing;;
+
+library:
+ purpose: Used to select grid items on order set forms.
+ ;;
+
+ explanation: Following this strategy to improve CPOE turnaround
+
+Change history
+
+ 5-22-2012 STH - Copied MLM "FORM_Set_Generic_Item_Control" to use as template.
+
+ ;;
+ keywords: Generic, FormOpen, Item select, update items, CPOE, CPOE updates, CPOE items
+ ;;
+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;
+
+ field_list:= this_form.fields;
+ dressingorders := ();
+ positionorders := ();
+ SkinCareorders := ();
+ equipmentorders := ();
+ Nursingorders := ();
+ Precautionorders := ();
+ Medicationorders := ();
+ consultorders := ();
+ Notifyorders := ();
+
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := FALSE;
+
+
+ callinggdataitemname := "NUR_Checkbox";
+
+ //create a list of items that are added to MOG(38) which is the grid that holds all dressing orders
+ dressingorders := last of (field_list.Value where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = (38));
+
+ //create a list of items that are added to MOG(40) which is the grid that holds all SkinCareorders
+ SkinCareorders := last of (field_list.Value where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = (40));
+
+ //create a list of items that are added to MOG(46) which is the grid that holds all equipmentorders
+ equipmentorders := last of (field_list.Value where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = (46));
+
+ //create a list of items that are added to MOG(45) which is the grid that holds all Nursingorders
+ Nursingorders := last of (field_list.Value where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = (45));
+
+ //create a list of items that are added to MOG(49) which is the grid that holds all Medicationorders
+ Medicationorders := last of (field_list.Value where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = (49));
+
+ //create a list of items that are added to MOG(48) which is the grid that holds all consultorders
+ consultorders := last of (field_list.Value where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = (48));
+
+ //create a list of items that are added to MOG(50) which is the grid that holds all Notifyorders
+ Notifyorders := last of (field_list.Value where field_list.DataItemName = "MultiOrderGrid"
+ and field_List.Control_MultiFieldOccNum = (50));
+
+
+ /***************************************************************************************/
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; //used to parse string data into a list
+
+ list_false_true := mlm {{{SINGLE-QUOTE}}}UTIL_LIST_FALSE_TRUE{{{SINGLE-QUOTE}}}; //used to disable/enable the update grid item(s) to the value passed in
+ //to the MLM. If yous end true all items are disabled if you send false all items
+ //are enabled. Originally developed by robert spence
+
+ setreadonly := mlm {{{SINGLE-QUOTE}}}UTIL_ITEMS_READONLY{{{SINGLE-QUOTE}}}; //used to control item specific disable/enable "readonly" option for items inside calling grid
+
+
+ // Initialize error message
+ error_message:="";
+
+ // get the list of configured items to be updates based on the form item MLMGenericItemControl
+
+
+ dressingorderstf := ();
+ SkinCareorderstf := ();
+ equipmentorderstf := ();
+ Nursingorderstf := ();
+ Medicationorderstf := ();
+ consultorderstf := ();
+ Notifyorderstf := ();
+
+ dressingorderstf := call list_false_true with dressingorders.IsSelected, false;
+ SkinCareorderstf := call list_false_true with SkinCareorders.IsSelected, false;
+ equipmentorderstf := call list_false_true with equipmentorders.IsSelected, false;
+ Nursingorderstf := call list_false_true with Nursingorders.IsSelected, false;
+ Medicationorderstf := call list_false_true with Medicationorders.IsSelected, false;
+ consultorderstf := call list_false_true with consultorders.IsSelected, false;
+ Notifyorderstf := call list_false_true with Notifyorders.IsSelected, false;
+
+
+ itemselected := ();
+ itemsname := ();
+ itemselected := (field_list.Value where field_list.DataItemName = callinggdataitemname);
+ itemsname := (field_list.Label where field_list.DataItemName = callinggdataitemname);
+
+
+ frmfieldvalues := ();
+ frmfieldlist := ();
+ frmfieldlistselected := ();
+ frmfieldlistname1 := ();
+ frmfieldlabel := ();
+ frmfieldoccnum := ();
+
+ frmfieldlist := (field_list where field_list.DataItemName = "MultiOrderGrid") ;
+ frmfieldoccnum := (field_List.Control_MultiFieldOccNum where field_list.DataItemName = "MultiOrderGrid") ;
+ frmfieldvalues := frmfieldlist.Value;
+ frmfieldlabel := frmfieldlist.Label;
+ frmfieldlistselected := frmfieldvalues.IsSelected;
+ frmfieldlistname1 := frmfieldvalues.name;
+
+ checked := ();
+ unchecked := ();
+
+ for x in (1 seqto count itemselected) do
+ if itemselected[x] = true then
+ checked := checked, itemsname[x];
+ else
+ unchecked := unchecked, itemsname[x];
+ endif;
+ enddo;
+
+
+
+
+
+ for x in (1 seqto count checked) do
+
+ if trim(checked[x]) = "Deep Tissue Injury" then
+ dressingorderstf[1] := true;
+ endif;
+
+ if trim(checked[x]) = "Stage 1 (Pressure Ulcer)" then
+ dressingorderstf[2] := true;
+ endif;
+
+ if trim(checked[x]) = "Stage 2 (Pressure Ulcer)" then
+ dressingorderstf[3] := true;
+ endif;
+
+ if trim(checked[x]) = "Stage 3 or 4 (Pressure Ulcer)" then
+ dressingorderstf[4] := true;
+ Medicationorderstf[1] := true;
+ endif;
+
+ if trim(checked[x]) is in ("Stage 1 (Pressure Ulcer)","Stage 2 (Pressure Ulcer)", "Stage 3 or 4 (Pressure Ulcer)","Deep Tissue Injury") then
+ SkinCareorderstf[1] := true;
+ consultorderstf[2] := true;
+ Notifyorderstf[1] := true;
+ Nursingorderstf[1] := true;
+ endif;
+
+ if trim(checked[x]) is in ("Stage 2 (Pressure Ulcer)", "Stage 3 or 4 (Pressure Ulcer)") then
+ equipmentorderstf[2] := true;
+ consultorderstf[1] := true;
+ Medicationorderstf[3] := true;
+ endif;
+
+ enddo;
+
+
+ dressingorders.IsSelected := dressingorderstf;
+ Medicationorders.IsSelected := Medicationorderstf;
+ SkinCareorders.IsSelected := SkinCareorderstf;
+ equipmentorders.IsSelected := equipmentorderstf;
+ Nursingorders.IsSelected := Nursingorderstf;
+ consultorders.IsSelected := consultorderstf;
+ Notifyorders.IsSelected := Notifyorderstf;
+
+;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SET_ZOSYN_EXTENDED_INFUSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SET_ZOSYN_EXTENDED_INFUSION.mlm
new file mode 100644
index 0000000..d0fbbd4
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SET_ZOSYN_EXTENDED_INFUSION.mlm
@@ -0,0 +1,635 @@
+maintenance:
+
+ title: FORM_SET_Zosyn_Extended_Infusion;;
+ mlmname: FORM_SET_Zosyn_Extended_Infusion;;
+ arden: version 2.5;;
+ version: 15.1;;
+ institution: St Clair Hospital;;
+ author: Teresa Spicuzza, Allscripts Corp;;
+ specialist: Teresa Spicuzza;;
+ date: 2016-09-15;;
+ validation: testing;;
+
+library:
+ purpose: To select the appropriate Zosyn maintenace dose based off of the Creatinine Clearance lab result.
+ ;;
+ explanation: The Zosyn loading dose is 4.5gm infused over 30 minutes, then the maintenance dose is infused for 4 hours and scheduled 6 hours after
+ the loading dose, if the CrCl is >= 20ml/min. Otherwise the 4 hour infused maintenance dose will be scheduled 8 hours after the loading
+ dose, if the CrCl is < 20ml/min
+
+ Change History
+ 2017.03.13 TMS CSR# 34822: Placed into production
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+
+
+ log_execution_info := FALSE;
+ DiscontinueOrder := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_DISCONTINUE_BY_ORDERGUID{{{SINGLE-QUOTE}}};
+
+ if Called_By_Editor Then
+ (ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID};
+ Else
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+ ClientGuid := this_communication.ClientGUID;
+ endif;
+
+ field_list:= this_form.fields;
+ CallingField := this_communication.CallingFieldName;
+ CallingEvent := this_communication.CallingEvent;
+
+ FormName := this_form.Name;
+ order_source := primary_Obj.SourceCode;
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+
+
+ Override_ABX_Sched := last of (field_list WHERE field_list.DataItemName = "PRX_Override_Abx_Scheduling"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Override_EXT_Sched := last of (field_list WHERE field_list.DataItemName = "PRX_Generic_CB"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Zosyn_dosage_info := last of (field_list WHERE field_list.DataItemName = "NUR_GenAdditionalTxt"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Zosyn_dosage_info.Value := "For CrCl greater than or equal to 20 ml/min: "||Tab|| "Zosyn 3.375 gm IV, Q8H, starting 6 hours after loading dose. Each dose is infused over 4 hours."
+ || CRLF || CRLF
+ || "For CrCl less than 20 ml/min: "||Tab||Tab||Tab|| "Zosyn 3.375 gm IV, Q12H, starting 8 hours after loading dose. Each dose is infused over 4 hours.";
+
+ Load_Zosyn := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Load_Zosyn_List := Load_Zosyn.Value;
+
+
+ Maint_Zosyn := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Maint_Zosyn_List := Maint_Zosyn.Value;
+
+
+ Alternate_Zosyn := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Alternate_Zosyn_List := Alternate_Zosyn.Value;
+
+ AltLoad_Zosyn := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 4);
+ AltLoad_Zosyn_List := AltLoad_Zosyn.Value;
+
+
+ Load_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Load_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 3);
+ Load_ReqDate_Val := Load_ReqDate.Value;
+ Load_ReqTime_Val := Load_ReqTime.Value;
+
+
+ Maint_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Maint_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 1);
+ Maint_ReqDate_Val := Maint_ReqDate.Value;
+ Maint_ReqTime_Val := Maint_ReqTime.Value;
+
+ AltLoad_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 5);
+ AltLoad_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 5);
+ AltLoad_ReqDate_Val := AltLoad_ReqDate.Value;
+ AltLoad_ReqTime_Val := AltLoad_ReqTime.Value;
+
+ AltMaint_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
+ and field_list.Control_MultiFieldOccNum = 4);
+ AltMaint_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
+ and field_list.Control_MultiFieldOccNum = 4);
+ AltMaint_ReqDate_Val := AltMaint_ReqDate.Value;
+ AltMaint_ReqTime_Val := AltMaint_ReqTime.Value;
+
+
+ CrCl_Value := last of ( field_list WHERE field_list.DataItemName = "PRX_CrCL_Estimated"
+ and field_list.Control_MultiFieldOccNum = 1);
+
+ Zosyn_Freq := last of ( field_list WHERE field_list.DataItemName = "FrequencyCode"
+ and field_list.Control_MultiFieldOccNum = 1);
+ FreqValue := Zosyn_Freq.Value;
+
+ AltZosyn_Freq := last of ( field_list WHERE field_list.DataItemName = "FrequencyCode"
+ and field_list.Control_MultiFieldOccNum = 2);
+ AltFreqValue := AltZosyn_Freq.Value;
+
+ Override:= last of ( field_list WHERE field_list.DataItemName = "PRX_Generic_CB"
+ and field_list.Control_MultiFieldOccNum = 2);
+ Zosyn_Freq_Dictionary := last of ( field_list WHERE field_list.DataItemName = "PRX_Zosyn_Ext_Inf_Freq"
+ and field_list.Control_MultiFieldOccNum = 1);
+ NoLoad := false;
+
+ Creatinine_Clearance := mlm {{{SINGLE-QUOTE}}}FORM_MLM_CREATININE_CLEARANCE{{{SINGLE-QUOTE}}};
+
+ (this_communication, this_form, EstCrClval) := call Creatinine_Clearance with (this_communication, this_form, client_info_obj);
+
+ 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}}} "};
+
+ Maint_ReqTime.Control_Read_Only := true;
+ Maint_ReqDate.Control_Read_Only := true;
+ Load_ReqTime.Control_Read_Only := true;
+ Load_ReqDate.Control_Read_Only := true;
+ Zosyn_Freq.Control_Read_Only := true;
+ Zosyn_Freq_Dictionary.Control_Read_Only := true;
+
+ If CallingEvent = "FormOpen" then
+ Alternate_Zosyn_List.IsReadOnly:= True;
+ AltLoad_Zosyn_List.IsReadOnly:= True;
+ endif;
+
+ If CallingEvent = "Fieldchange" AND CallingField = "PRX_Generic_CB|3" THEN
+ IF Override_EXT_Sched.value = True then
+ Maint_Zosyn_List.IsSelected := False;
+ Alternate_Zosyn_List.IsSelected := True;
+ Load_Zosyn_List.IsSelected := False;
+ Load_Zosyn_List.IsReadOnly:= True;
+ Maint_Zosyn_List.IsReadOnly:= True;
+ Alternate_Zosyn_List.IsReadOnly:= False;
+ AltLoad_Zosyn_List.IsReadOnly:= False;
+ else
+ Maint_Zosyn_List.IsSelected := True;
+ Alternate_Zosyn_List.IsSelected := False;
+ AltLoad_Zosyn_List.IsSelected := False;
+ Alternate_Zosyn_List.IsReadOnly:= True;
+ AltLoad_Zosyn_List.IsReadOnly:= True;
+ Load_Zosyn_List.IsReadOnly:= False;
+ Maint_Zosyn_List.IsReadOnly:= False;
+ endif;
+ endif;
+
+ If CallingEvent = "Fieldchange" AND (CallingField = "MultiOrderGrid|4" or CallingField = "FrequencyCode|2" or CallingField = "RequestedTime|5") THEN
+
+ (FrequencyInterval,FrequencyTimeUOM) := read last
+ {
+ " select timefromvalue,TimeUom from CV3Frequency with (nolock) "
+ || " where code = {{{SINGLE-QUOTE}}}" || AltFreqValue.FrequencySummary || "{{{SINGLE-QUOTE}}}"
+ };
+
+ If AltLoad_Zosyn_List.IsSelected [1] = True then
+
+ Override_ABX_Sched.value := True;
+ AltMaint_ReqDate.value := null;
+ AltMaint_ReqTime_Val.ReqTimeCode := null;
+ AltMaint_ReqTime_Val.ReqTimeValue := null;
+
+ elseif AltLoad_Zosyn_List.IsSelected [1] = False then
+
+ AltLoad_ReqDate.value := null;
+ AltLoad_ReqTime_Val.ReqTimeCode := null;
+ AltLoad_ReqTime_Val.ReqTimeValue := null;
+ Override_ABX_Sched.value := False;
+ endif;
+
+ If CallingField = "RequestedTime|5" and AltMaint_ReqTime_Val.ReqTimeValue is not null THEN
+ newaltmm := extract month AltLoad_ReqDate.Value ;
+ newaltdd := extract day AltLoad_ReqDate.Value ;
+ newaltyyyy := extract year AltLoad_ReqDate.Value ;
+ FmtAltLoadDate := newaltmm formatted with "%2.2d"||"-" ||newaltdd formatted with "%2.2d" ||"-" ||newaltyyyy ||" " ||AltLoad_ReqTime_Val.ReqTimeValue||":00" ;
+ AltLoadDoseDTM := FmtAltLoadDate as time;
+ AltStartDTM := FmtLoadDate as time;
+ else
+ AltStartDTM := now ;
+ AltStartMin := extract minute now;
+
+ If (AltStartMin as number) >= 45 then
+ AltLoadDoseDTM := AltStartDTM + 2 hour;
+ else AltLoadDoseDTM := AltStartDTM + 1 hour;
+ endif;
+ endif;
+
+ AltMaintDose := (AltLoadDoseDTM as time) + FrequencyInterval hour;
+ Altloadhour := extract hour AltLoadDoseDTM;
+ Altloadmon := extract month AltLoadDoseDTM;
+ Altloadday := extract day AltLoadDoseDTM;
+ Altloadyear := extract year AltLoadDoseDTM;
+
+ AltMainthour := extract hour AltMaintDose;
+ AltMaintmon := extract month AltMaintDose;
+ AltMaintday := extract day AltMaintDose;
+ AltMaintyear := extract year AltMaintDose;
+
+
+ AltFmtLoadTime := Altloadhour formatted with "%2.2d" || ":00";
+ AltFmtLoadDate := Altloadmon formatted with "%2.2d"||"-" ||Altloadday formatted with "%2.2d" ||"-" ||Altloadyear ;
+
+ AltFmtMaintTime := AltMainthour formatted with "%2.2d" || ":00";
+ AltFmtMaintDate := AltMaintmon formatted with "%2.2d"||"-" ||AltMaintday formatted with "%2.2d" ||"-" ||AltMaintyear ;
+
+ If Override_ABX_Sched.value = True then
+
+ AltLoad_ReqDate.value := AltFmtLoadDate;
+ AltLoad_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
+ AltLoad_ReqTime_Val.ReqTimeValue := AltFmtLoadTime;
+ AltMaint_ReqDate.value := AltFmtMaintDate;
+ AltMaint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
+ AltMaint_ReqTime_Val.ReqTimeValue := AltFmtMaintTime;
+ Endif;
+ endif;
+
+ If override.value = true then
+
+ // Maint_ReqTime.Control_Read_Only := false;
+ // Maint_ReqDate.Control_Read_Only := false;
+ // Load_ReqTime.Control_Read_Only := false;
+ // Load_ReqDate.Control_Read_Only := false;
+ Zosyn_Freq.Control_Read_Only := false;
+ Zosyn_Freq_Dictionary.Control_Read_Only := false;
+
+ endif;
+
+ If CallingEvent = "Fieldchange" and CallingField = "RequestedTime|3" and override.value = true then
+ newmm := extract month Load_ReqDate.Value ;
+ newdd := extract day Load_ReqDate.Value ;
+ newyyyy := extract year Load_ReqDate.Value ;
+ FmtLoadDate := newmm formatted with "%2.2d"||"-" ||newdd formatted with "%2.2d" ||"-" ||newyyyy ||" " ||Load_ReqTime_Val.ReqTimeValue||":00" ;
+ LoadDoseDTM := fmtLoadDate as time;
+ StartDTM := FmtLoadDate as time;
+ MaintDose6HR := (FmtLoadDate as time) + 6 hour;
+ MaintDose8HR := (FmtLoadDate as time) + 8 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;
+
+ 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 ;
+
+ If Zosyn_Freq_Dictionary.Value = "Q8H" then
+
+ FreqValue.FrequencySummary := "Q8H";
+ Maint_ReqDate.value := Fmt6HRDate;
+ Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
+ Maint_ReqTime_Val.ReqTimeValue := Fmt6HRTime;
+ elseif Zosyn_Freq_Dictionary.value = "Q12H" then
+ FreqValue.FrequencySummary := "Q12H";
+ Maint_ReqDate.value := Fmt8HRDate;
+ Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
+ Maint_ReqTime_Val.ReqTimeValue := Fmt8HRTime;
+
+ endif;
+ endif;
+
+ IF Override_EXT_Sched.value = False or (CallingEvent = "Fieldchange" and CallingField = "PRX_Zosyn_Ext_Inf_Freq|1") THEN
+
+ 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.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"};
+
+
+ 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.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;
+
+ 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 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.ScheduledDtm < DATEadd (HH, 12, 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;
+
+ 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
+ Load_Zosyn_List.IsSelected := False;
+ Maint_Zosyn_List.IsSelected := true;
+
+ if (LoadOrderHoursSinceGiven > 6 and (EstCrClval is null or EstCrClval >=20) and override.value = false)
+ or (LoadOrderHoursSinceGiven > 8 and EstCrClval < 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;
+ Load_Zosyn_List.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 LoadOrderHoursSinceScheduled <= 2 then
+ Load_Zosyn_List.IsSelected := False;
+ Maint_Zosyn_List.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
+ LoadGuid,
+ this_communication.CareProviderGUID,
+ ClientVisitGUID,
+ Reason,
+ Source;
+
+ StartDTM := now ;
+ StartMin := extract minute now;
+ Load_Zosyn_List.IsSelected := True;
+ Maint_Zosyn_List.IsSelected := True;
+
+ If (StartMin as number) >= 45 then
+ LoadDoseDTM := StartDTM + 2 hour;
+ else LoadDoseDTM := StartDTM + 1 hour;
+ endif;
+ endif;
+
+ elseif
+
+ ((HoursSinceGiven as number) > 9 and override.value = false and (EstCrClval >= 20 or EstCrClval is null)) or
+ ((HoursSinceGiven as number) > 13 and override.value = false and EstCrClval < 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
+
+ Load_Zosyn_List.IsSelected := True;
+ NoLoad := False;
+ FmtLoadDate := null;
+ FmtLoadTime := null;
+ Maint_Zosyn_List.IsSelected := True;
+ StartDTM := Now ;
+ StartMin := extract minute Now;
+ If (StartMin as number) >= 45 then
+ LoadDoseDTM := StartDTM + 2 hour;
+ else LoadDoseDTM := StartDTM + 1 hour;
+
+ endif;
+ elseif
+
+ ((HoursSinceGiven as number) <= 9 and override.value = false and (EstCrClval >= 20 or EstCrClval is null)) or
+ ((HoursSinceGiven as number) <= 13 and override.value = false and EstCrClval < 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
+
+ Load_Zosyn_List.IsSelected := False;
+ NoLoad := True;
+ Maint_Zosyn_List.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
+
+ Load_Zosyn_List.IsSelected := True;
+ Maint_Zosyn_List.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;
+
+ 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;
+
+ If ((EstCrClval >= 20 or EstCrClval is null or CrCl_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 (EstCrClval < 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 ((EstCrClval >= 20 or EstCrClval is null or CrCl_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 (EstCrClval < 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;
+
+ endif;
+
+
+ ;;
+
+ evoke:
+
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+
+
+ return this_communication, this_form;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SPECIAL_CARE_NURSERY_ADMISSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_SPECIAL_CARE_NURSERY_ADMISSION.mlm
new file mode 100644
index 0000000..4ff8e85
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SPECIAL_CARE_NURSERY_ADMISSION.mlm
@@ -0,0 +1,84 @@
+maintenance:
+
+ title: FORM_SPECIAL_CARE_NURSERY_ADMISSION;;
+ mlmname: FORM_SPECIAL_CARE_NURSERY_ADMISSION;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-03-04;;
+ validation: testing;;
+
+library:
+ purpose: 13-03-2015 CSR-22071 : Created
+
+ Scenario 1 : When oxgen aerosol therapy is selected,then oxygen therapy should not be available for selection. .
+
+ Scenario 2 : When oxgen therapy is selected,then oxygen aerosol therapy should not be available for selection;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ ( this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+
+ Respiratory1 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 51 );
+ Respiratory2 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ and field_list.Control_MultiFieldOccNum = 62 );
+ //Medication_Pharmacy := last of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid"
+ // and field_list.Control_MultiFieldOccNum = 49 );
+
+
+ Respiratory1_Value := Respiratory1.Value ;
+ Respiratory2_Value := Respiratory2.Value;
+
+// *********** Objects for first flow *************
+
+
+ Oxygen_Aerosol := first of (Respiratory1_Value where Respiratory1_Value.Name = "Oxygen Aerosol Therapy");
+
+ Oxygen_Therapy := first of (Respiratory2_Value where Respiratory2_Value.Name = "Oxygen Therapy"); // D5W 1000ml
+
+
+ If Oxygen_Aerosol.IsSelected = True Then
+ Oxygen_Therapy.IsReadonly := True;
+
+ Endif;
+ If Oxygen_Therapy.IsSelected = True Then
+ Oxygen_Aerosol.IsReadonly := True;
+
+ Endif;
+ If Oxygen_Aerosol.IsSelected = False And Oxygen_Therapy.IsSelected = False Then
+
+ Oxygen_Aerosol.IsReadonly := False;
+ Oxygen_Therapy.IsReadonly := False;
+
+ EndIf;
+
+
+
+;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_STRESS_TEST_CLOSE.mlm b/MLMStripper/bin/Debug/FORM/FORM_STRESS_TEST_CLOSE.mlm
new file mode 100644
index 0000000..d8be6e5
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_STRESS_TEST_CLOSE.mlm
@@ -0,0 +1,304 @@
+maintenance:
+
+ title: Form_Stress_test_close;;
+ mlmname: Form_Stress_test_close;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: SCH ;;
+ author: Deepty Singh/ Shivprasad Jadhav;;
+ specialist: Shubha Rai;;
+ date: 2015-11-18;;
+ validation: testing;;
+
+library:
+ purpose: When user orders Stress test item for today and the time for breakfast
+ has passed then the OS should auto uncheck Stress Thallium Diet for breakfast
+ so that it doesnot give warning at the end of order submission
+ ;;
+ explanation:
+ Change History
+ -----------------------------------
+ 18.11.2015 GOS CSR-32398 : MLM Created
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj //Arden ClientInfo object
+ ) := argument;
+ field_list:= this_form.Fields;
+ // find pt{{{SINGLE-QUOTE}}}s details
+ Client_GUID := this_communication.ClientGUID;
+ ClientVisit_GUID := this_communication.ClientVisitGUID;
+ Chart_GUID := this_communication.ChartGUID;
+ form_name := this_form.Name;
+
+ if form_name = "NUR_MINucleMedPrepN7" AND this_communication.FormType = "OrderSet" THEN
+ mlmImaging := MLM {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING{{{SINGLE-QUOTE}}};
+ this_communication := CALL mlmImaging WITH this_communication;
+ ENDIF;
+
+ if form_name = "MI Nuc Med Prep Card" AND this_communication.FormType = "OrderSet" THEN
+ mlmImaging := MLM {{{SINGLE-QUOTE}}}FORM_MEDICAL_IMAGING{{{SINGLE-QUOTE}}};
+ this_communication := CALL mlmImaging WITH this_communication;
+ ENDIF;
+
+ If this_communication.CallingFieldName matches Pattern "MultiOrderGrid%" THEN // this_communication.CallingFieldLabel = "Dietary" AND
+ If form_name = "NUR_MINucleMedPrepN7" then
+
+ MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" );
+ Grid_list := MulitOrderGrid_field2.Value;
+ Found_Diet:= Grid_list[2];// breakfast Order
+ Found_lunch:= Grid_list[3]; // lunch order
+
+ ELSE
+
+ MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Dietary");
+ Grid_list := MulitOrderGrid_field2.Value;
+ Found_Diet:= Grid_list[1];// breakfast Order
+ Found_lunch:= Grid_list[2]; // lunch order
+
+ ENDIF;
+ IF Found_Diet.IsSelected = True THEN
+ Found_lunch.IsSelected := False ;
+ Found_lunch.IsReadOnly := True ;
+
+ ELSEIF Found_lunch.IsSelected = True THEN
+ Found_Diet.IsSelected := False ;
+ Found_Diet.IsReadOnly := True ;
+ ELSE
+ Found_Diet.IsReadOnly := False ;
+ Found_lunch.IsReadOnly := False ;
+ ENDIF;
+
+ ELSEif this_communication.CallingEvent = "FormClose" THEN
+
+ if form_name = "NUR_MINucleMedPrepN7" then
+ MulitOrderGrid_field := first of (field_list where field_list.DataItemName = "MultiOrderGrid" );
+ Grid_list := MulitOrderGrid_field.Value;
+ Found_Ord3:= first of (Grid_list where Grid_list.Name = "Nursing Instructions - Place an Order for a Stress Test");// continue sepsis orders
+ //Found_Diet:= first of (Grid_list where Grid_list.Name = "Stress Thallium Diet");// continue sepsis orders
+ Found_Diet:= Grid_list[2];// breakfast Order
+ Found_lunch:= Grid_list[3]; // lunch order
+ ENDIF;
+ if form_name = "MI Nuc Med Prep Card" THEN
+ MulitOrderGrid_field := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Medical Imaging Order");
+ MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Dietary");
+ // MulitOrderGrid_field3 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Nursing - Test Prep");
+ If exists MulitOrderGrid_field then
+ Grid_list := MulitOrderGrid_field.Value;
+ Grid_list2 := MulitOrderGrid_field2.Value;
+ // Grid_list3 := MulitOrderGrid_field3.Value;
+
+ Found_Diet:= Grid_list2[1];// breakfast Order
+ Found_lunch:= Grid_list2[2]; // lunch order
+ Found_Ord1:= first of (Grid_list where Grid_list.Name = "Exercise Radionuclide Stress");// continue sepsis orders
+ Found_Ord2:= first of (Grid_list where Grid_list.Name = "RSTED- Radionuc. Stress Exercise Data");// continue sepsis orders
+ Found_Ord4:= first of (Grid_list where Grid_list.Name = "Outpt Exercise Radionuclide Stress");// continue sepsis orders
+
+
+ ENDIF;
+ ENDIF;
+ if form_name = "MI Nuc Med Pre N8/12" THEN
+ MulitOrderGrid_field := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Medical Imaging Order");
+ MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label matches pattern "Dietary%");
+ If exists MulitOrderGrid_field then
+ Grid_list := MulitOrderGrid_field.Value;
+ Grid_list2 := MulitOrderGrid_field2.Value;
+ Found_Diet:= Grid_list2[1];// breakfast Order
+ Found_lunch:= Grid_list2[2]; // lunch order
+ Found_Ord5:= first of (Grid_list where Grid_list.Name = "Outpt Pharmaceutical Radionuc Stress");// continue sepsis orders
+ Found_Ord2:= first of (Grid_list where Grid_list.Name = "RSTED- Radionuc. Stress Exercise Data");// continue sepsis orders
+ Found_Ord6:= first of (Grid_list where Grid_list.Name = "Pharmaceutical Radionuc Stress");// continue sepsis orders
+ ENDIF;
+ ENDIF;
+ if (form_name = "Cardiolo Str Test 2" or form_name = "Cardiolo Stress Test" ) THEN // added New form Name By Shivprasad
+ MulitOrderGrid_field := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Cardiology");
+ MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Dietary");
+ If exists MulitOrderGrid_field then
+ Grid_list := MulitOrderGrid_field.Value;
+ Grid_list2 := MulitOrderGrid_field2.Value;
+ //Found_Diet:= first of (Grid_list2 where Grid_list2.Name = "Stress Thallium Diet");// continue sepsis orders
+ Found_Diet:= Grid_list2[1];// breakfast Order
+ Found_lunch:= Grid_list2[2]; // lunch order
+ Found_Ord7:= first of (Grid_list where Grid_list.Name = "Stress Echo");// continue sepsis orders
+ ENDIF;
+ ENDIF;
+ if form_name = "Card Stress Test 2" THEN
+ MulitOrderGrid_field := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Cardiology");
+ MulitOrderGrid_field2 := first of (field_list where field_list.DataItemName = "MultiOrderGrid" AND field_list.label = "Dietary");
+ If exists MulitOrderGrid_field then
+ Grid_list := MulitOrderGrid_field.Value;
+ Grid_list2 := MulitOrderGrid_field2.Value;
+ //Found_Diet:= first of (Grid_list2 where Grid_list2.Name = "Stress Thallium Diet");// continue sepsis orders
+ Found_Diet:= Grid_list2[1];// breakfast Order
+ Found_lunch:= Grid_list2[2]; // lunch order
+ Found_Ord8:= first of (Grid_list where Grid_list.Name = "Treadmill Stress Test");// continue sepsis orders
+ ENDIF;
+ ENDIF;
+
+ Ord_dt := first of (field_list where field_list.DataItemName = "RequestedDate");
+
+ ord_dt_val := Ord_dt.value;
+ dt := day of ord_dt_val;
+ dt1 := day of now;
+
+ mt := month of ord_dt_val;
+ mt1 := month of now;
+
+ yr := year of ord_dt_val;
+ yr1 := year of now;
+
+ if dt = dt1 AND mt = mt1 AND yr = yr1 THEN
+ hh, mins := Read Last{"select datepart(hh,getdate()), datepart(minute,getdate())"};
+ hh := hh as number;
+ mins := mins as number;
+
+ //hh:= 15;
+ //mins:= 32;
+
+
+
+ IF (Found_Ord1.IsSelected = TRUE OR Found_Ord2.IsSelected = TRUE OR Found_Ord3.IsSelected = TRUE OR Found_Ord4.IsSelected = TRUE OR
+ Found_Ord5.IsSelected = TRUE OR Found_Ord6.IsSelected = TRUE OR Found_Ord7.IsSelected = TRUE OR Found_Ord8.IsSelected = TRUE ) AND
+ (Found_Diet.IsSelected = TRUE) AND (Found_lunch.IsSelected = False) THEN
+
+ IF ((hh >= 7 AND mins >= 31) OR (hh > 7)OR (hh = 7 AND mins >= 31)) AND ((hh <= 13 AND mins <= 45) OR (hh < 13)OR (hh = 13 AND mins <= 45)) THEN
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show
+ with "Breakfast Time has passed for today. Do you want to proceed with the Stress Test today? Yes, will schedule the Stress Test With Lunch Diet Order. No, will schedule the Stress Test for tomorrow",
+ "Stress Test Alert",
+ "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ dialogResult := dialogResult As string;
+
+ IF dialogResult = "Yes" Then
+ Found_lunch.IsSelected := True;
+ Found_Diet.IsSelected := False;
+ ELSE
+ Ord_dt.value := now + 1 day;
+ ENDIF;
+ ENDIF;
+ IF ((hh >= 13 AND mins >= 45) OR (hh > 13)OR (hh = 13 AND mins >= 45))
+ And ((hh <= 15 AND mins <= 30) OR (hh < 15)OR (hh = 15 AND mins <= 30)) // Condition Added By Shivprasad As per Rob{{{SINGLE-QUOTE}}}s Request
+ THEN
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show
+ with "Lunch Time has passed for today. Do you want to proceed with the Stress Test today? No, will schedule the Stress Test with Breakfast Diet Order tomorrow",
+ "Stress Test Alert",
+ "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ dialogResult := dialogResult As string;
+
+ IF dialogResult = "Yes" Then
+ Found_lunch.IsSelected := False;
+ Found_Diet.IsSelected := False;
+ ELSE
+ Ord_dt.value := now + 1 day;
+ Found_lunch.IsSelected := False;
+ Found_Diet.IsSelected := True;
+ ENDIF;
+ ElseIf ((hh >= 15 AND mins >= 30) OR (hh > 15)OR (hh = 15 AND mins >= 30))
+ // And ((hh <= 7 AND mins <= 30) OR (hh < 7) OR (hh = 7 AND mins <= 30))
+ Then // {{{SINGLE-QUOTE}}}ElseIf{{{SINGLE-QUOTE}}} Condition Added By Shivprasad As per Rob{{{SINGLE-QUOTE}}}s Request
+ Ord_dt.value := now + 1 day;
+ Found_lunch.IsSelected := False;
+ Found_Diet.IsSelected := True;
+
+ ENDIF;
+ ENDIF;
+
+ IF (Found_Ord1.IsSelected = TRUE OR Found_Ord2.IsSelected = TRUE OR Found_Ord3.IsSelected = TRUE OR Found_Ord4.IsSelected = TRUE OR
+ Found_Ord5.IsSelected = TRUE OR Found_Ord6.IsSelected = TRUE OR Found_Ord7.IsSelected = TRUE OR Found_Ord8.IsSelected = TRUE ) AND
+ (Found_Diet.IsSelected = FALSE) AND(Found_lunch.IsSelected = TRUE) THEN
+
+ IF ((hh >= 13 AND mins >= 45) OR (hh > 13)OR (hh = 13 AND mins >= 45))
+ And ((hh <= 15 AND mins <= 30) OR (hh < 15)OR (hh = 15 AND mins <= 30)) // Condition Added By Shivprasad As per Rob{{{SINGLE-QUOTE}}}s Request
+ THEN
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show
+ with "Lunch Time has passed for today. Do you want to proceed with the Stress Test today? No, will schedule the Stress Test with Breakfast Diet Order tomorrow",
+ "Stress Test Alert",
+ "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ dialogResult := dialogResult As string;
+
+ IF dialogResult = "Yes" Then
+ Found_lunch.IsSelected := False;
+ ELSE
+ Ord_dt.value := now + 1 day;
+ Found_lunch.IsSelected := False;
+ Found_Diet.IsSelected := True;
+ ENDIF;
+ ElseIf ((hh >= 15 AND mins >= 30) OR (hh > 15)OR (hh = 15 AND mins >= 30))
+ // And ((hh <= 7 AND mins <= 30) OR (hh < 7) OR (hh = 7 AND mins <= 30))
+ Then // {{{SINGLE-QUOTE}}}ElseIf{{{SINGLE-QUOTE}}} Condition Added By Shivprasad As per Rob{{{SINGLE-QUOTE}}}s Request
+ Ord_dt.value := now + 1 day;
+ Found_lunch.IsSelected := False;
+ Found_Diet.IsSelected := True;
+
+ ENDIF;
+ ENDIF;
+ /* IF (Found_Ord1.IsSelected = TRUE OR Found_Ord2.IsSelected = TRUE OR Found_Ord3.IsSelected = TRUE OR Found_Ord4.IsSelected = TRUE OR
+ Found_Ord5.IsSelected = TRUE OR Found_Ord6.IsSelected = TRUE OR Found_Ord7.IsSelected = TRUE OR Found_Ord8.IsSelected = TRUE ) AND
+ (Found_Diet.IsSelected = TRUE) AND(Found_lunch.IsSelected = TRUE) THEN
+
+ IF ((hh >= 7 AND mins >= 31) OR (hh > 7)OR (hh = 7 AND mins >= 31)) AND ((hh <= 9 AND mins >= 16) OR (hh < 9)OR (hh = 9 AND mins <= 16)) THEN
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show
+ with "Breakfast Time has passed for today. Do you want to proceed with the Stress Test today? Yes, will schedule the Stress Test With Lunch Diet Order. No, will schedule the Stress Test for tomorrow",
+ "Stress Test Alert",
+ "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ dialogResult := dialogResult As string;
+
+ IF dialogResult = "Yes" Then
+ Found_lunch.IsSelected := True;
+ Found_Diet.IsSelected := False;
+ ELSE
+ Ord_dt.value := now + 1 day;
+ ENDIF;
+ ENDIF;
+ IF ((hh >= 9 AND mins >= 16) OR (hh > 9)OR (hh = 9 AND mins >= 16)) THEN
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show
+ with "Lunch Time has passed for today. Do you want to proceed with the Stress Test today? No, will schedule the Stress Test with Breakfast Diet Order tomorrow",
+ "Stress Test Alert",
+ "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ dialogResult := dialogResult As string;
+
+ IF dialogResult = "Yes" Then
+ Found_lunch.IsSelected := False;
+ Found_Diet.IsSelected := False;
+ ELSE
+ Ord_dt.value := now + 1 day;
+ Found_lunch.IsSelected := False;
+ Found_Diet.IsSelected := True;
+ ENDIF;
+ ENDIF;
+ ENDIF;*/
+ ENDIF;
+ ENDIF;
+//break;
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_SWITCH_DILUENT.mlm b/MLMStripper/bin/Debug/FORM/FORM_SWITCH_DILUENT.mlm
new file mode 100644
index 0000000..ff27133
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_SWITCH_DILUENT.mlm
@@ -0,0 +1,142 @@
+maintenance:
+
+ title: Form_Switch_Diluent;;
+ mlmname: Form_Switch_Diluent;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St. Clair Hospital;;
+ author: Teresa M. Spicuzza ;;
+ specialist: Teresa M. Spicuzza ;;
+ date: 2017-08-07;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+
+ Change history
+
+ 08.07.2017 TMS Initial build MLM allows user to switch between D5W and NSS by selecting checkbox on form. CSR 33563
+
+
+ ;;
+ keywords:
+ Diluent, Base Solution;
+ ;;
+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;
+
+
+
+ comm_obj := this_communication.primaryobj;
+ called_by := this_communication.CallingEvent;
+ call_field := this_communication.CallingFieldName;
+
+ 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;
+
+
+
+ // Define fields
+ 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;
+
+ MLMfromOrderSet := last of (field_list where field_list.DataItemName = "MLM_From Order Set");
+ SwapDiluent := first of (field_list where field_list.DataItemName = "PRX_ResetDiluent");
+
+
+ if (call_field = "PRX_ResetDiluent" and called_by = "FieldChange") then
+
+ solution_map_list :=(
+ // Old Base Soln|New Base Solution|Vol|UOM
+ "D5W 50ml .|0.9% NaCl 50ml .|50|mL",
+ "D5W 100ml .|0.9% NaCl 100ml .|100|mL",
+ "D5W 250ml .|0.9% NaCl 250ml .|250|mL",
+ "D5W 500ml .|0.9% NaCl 500ml|500|mL",
+// "D5W 500ml .|0.9% NaCl 500ml .|500|mL",
+ "D5W .|0.9% NaCl .||",
+ "0.9% NaCl 50ml .|D5W 50ml .|50|mL",
+ "0.9% NaCl 100ml .|D5W 100ml .|100|mL",
+ "0.9% NaCl 250ml .|D5W 250ml .|250|mL",
+ "0.9% NaCl 500ml|D5W 500ml .|500|mL",
+ "0.9% NaCl 500ml .|D5W 500ml .|500|mL",
+ "0.9% NaCl .|D5W .||"
+ );
+
+ for m in 1 seqto count solution_map_list do
+ soln_element_list := call str_parse with solution_map_list[m], "|";
+ Old_Soln := soln_element_list[1];
+ New_Soln := soln_element_list[2];
+ New_Vol := soln_element_list[3];
+ New_UOM := soln_element_list[4];
+ New_Vol_value := (New_Vol as number);
+
+ If BaseSolution_value.name = Old_Soln then
+ If BaseSolution_value.dose is null then
+ New_Solution_Dose := New_Vol_value;
+ New_Solution_UOM := New_Uom;
+ else
+ New_Solution_Dose := BaseSolution_value.dose;
+ New_Solution_UOM := BaseSolution_value.UOM ;
+ endif;
+
+ New_Solution_Value := new_soln;
+
+ endif;
+
+ enddo; /* for i in 1 seqto count solution_map_list do */
+
+ BaseSolution_value.name := New_Solution_Value;
+ BaseSolution_value.dose := New_Solution_Dose as number;
+ BaseSolution_value.UOM := New_Solution_UOM;
+ SwapDiluent.value := False;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_TEMPLATE.mlm b/MLMStripper/bin/Debug/FORM/FORM_TEMPLATE.mlm
new file mode 100644
index 0000000..bda5c60
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_TEMPLATE.mlm
@@ -0,0 +1,66 @@
+maintenance:
+
+ title: FORM_TEMPLATE;;
+ filename: FORM_TEMPLATE;;
+ arden: version 2;;
+ version: 1.00;;
+ institution: Eclipsys Corp;;
+ author: Eclipsys Corp;;
+ specialist: ;;
+ date: 2004-08-16;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+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;
+
+ /**********************************************************************************************/
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ /****** Place all your reading and updating here **********/
+
+ IV_additive := last of (field_list where field_list.DataItemName = "IVAdditive" );
+ PRX_additive := last of (field_list where field_list.DataItemName = "PRX_IV Additive" );
+ PR_No_additive := last of (field_list where field_list.DataItemName = "PRX_NOIVAdditive" );
+ Drug_ID := last of (field_list where field_list.DataItemName = "PRX_DRUGIDCODE" );
+
+ IF exist IV_additive then
+ Drug_ID.value := PRX_additive.Value;
+ else
+ Drug_ID.value := PR_No_additive.Value;
+ endif;
+
+ ;;
+ evoke: // No evoke statement
+ ;;
+ logic:
+ // always concludes TRUE
+ conclude true;
+ ;;
+ action:
+ // This MLM returns two parameters, of types communication_type and form_type respectively.
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_TEST_MLM_HC.mlm b/MLMStripper/bin/Debug/FORM/FORM_TEST_MLM_HC.mlm
new file mode 100644
index 0000000..0f79e44
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_TEST_MLM_HC.mlm
@@ -0,0 +1,437 @@
+maintenance:
+
+ title: HOME CARE MLM;;
+ mlmname: FORM_TEST_MLM_HC;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair HomeCaseMLM;;
+ author: Robert Spence, Eclipsys Corp;;
+ specialist: ;;
+ date: 2006-06-15;;
+ validation: testing;;
+
+library:
+ purpose: This MLM displays boxes per a check box being checked / unchecked
+
+ ;;
+ explanation: This MLM displays boxes per a check box being checked / unchecked
+
+ A Banner message is presented to the user to remind them that these fields must be
+ completed.
+
+
+
+ ;;
+ keywords: Called MLMs, Form fields,Home Care, displays
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingField :=this_communication.CallingFieldName;
+ CallingEvent :=this_communication.CallingEvent;
+
+ // This sets the visible control on the field dataitem - FrequencyCode
+ HOrder_Field := first of (field_list
+ where field_list.DataItemName = "HH_Personnel" );
+
+ HService_field := first of (field_list
+ where field_list.DataItemName = "HH_Services" );
+
+ HDiscipline_field := first of (field_list
+ where field_list.DataItemName = "HH_Discipline" );
+
+ HFreq_Field := first of (field_list
+ where field_list.DataItemName = "HH_Home Care Frequency" );
+
+ DOrder_Field := first of (field_list
+ where field_list.DataItemName = "HH_Durable Medical Equip" );
+
+ DEquipNeed_Field := first of (field_list
+ where field_list.DataItemName = "HH Equipment" );
+
+ EFeedingOrder_Field:= first of (field_list
+ where field_list.DataItemName = "HH_Enteral Feedings" );
+
+ EFormEquiv_Field := first of (field_list
+ where field_list.DataItemName = "HH_Formula/Equivelant");
+
+ EAmountCC_Field := first of (field_list
+ where field_list.DataItemName = "HH_cc/hr" );
+
+ EFlowRate_Field:= first of (field_list
+ where field_list.DataItemName = "HH_Hours per day" );
+
+ EModeAmin_Field := first of (field_list
+ where field_list.DataItemName = "HH_Mode of Administration" );
+
+ EFlushWith_Field := first of (field_list
+ where field_list.DataItemName = "HH_Flushes" );
+
+ EAmountCC2_Field := first of (field_list
+ where field_list.DataItemName = "HH_Amount in CC{{{SINGLE-QUOTE}}}s" );
+
+ EFreeWater_Field := first of (field_list
+ where field_list.DataItemName = "HH_Free water amount" );
+
+ EFlushFreq_Field := first of (field_list
+ where field_list.DataItemName = "HH_FlushFrequency" );
+
+ EPegTube_Field := first of (field_list
+ where field_list.DataItemName = "HH_Peg Tube Present" );
+
+ InfusionOrder_Field := first of (field_list
+ where field_list.DataItemName = "HH_Infusion Order" );
+
+ IBenCheck_Field := first of (field_list
+ where field_list.DataItemName = "HH_Home Infusion Benefit Check" );
+
+ IDrug_Field := first of (field_list
+ where field_list.DataItemName = "HH_Drug" );
+
+ IVSolution_Field:= first of (field_list
+ where field_list.DataItemName = "HH_IV Solution" );
+
+ IccPerHr_Field :=first of (field_list
+ where field_list.DataItemName = "HH_cc/hour" );
+
+ IqPerHr_Field:=first of (field_list
+ where field_list.DataItemName = "HH_q/hours" );
+
+ IPRN_Field := first of (field_list
+ where field_list.DataItemName = "HH_PRN" );
+
+ IFlush_Field:=first of (field_list
+ where field_list.DataItemName = "HH_Flush" );
+
+ IRoute_Field:=first of (field_list
+ where field_list.DataItemName = "HH_Route:" );
+
+ IVAccess_Field:=first of (field_list
+ where field_list.DataItemName = "HH_IV Access:" );
+
+ POrder_Field := first of (field_list
+ where field_list.DataItemName = "HH_Pharmaceutical Order" );
+
+ PBenCheck_Field := first of (field_list
+ where field_list.DataItemName = "HH_Rx Benefits Check" );
+
+ PDrugDose_Field:= first of (field_list
+ where field_list.DataItemName = "HH_Drug&Dose" );
+
+ PFreqRoute_Field:=first of (field_list
+ where field_list.DataItemName = "HH_Frequency& Route" );
+
+ PDurationDose_Field:=first of (field_list
+ where field_list.DataItemName = "HH_Duration/#doses" );
+
+ RespOrder_Field := first of (field_list
+ where field_list.DataItemName = "HH_Respiratory Order" );
+
+ REquip_Field:= first of (field_list
+ where field_list.DataItemName = "HH_Respiratory Equipment" );
+
+ RAPMonitorAl_Field:= first of (field_list
+ where field_list.DataItemName = "HH_A Monitor Alarem Settings" );
+
+ RAPnMonitor_Field := first of (field_list
+ where field_list.DataItemName = "HH_Apnea Monitor Settings" );
+
+ RInfantCPR_Field := first of (field_list
+ where field_list.DataItemName = "HH_Infant CPR Training" );
+
+ RBIBAP_Field := first of (field_list
+ where field_list.DataItemName = "HH_BIPAP" );
+
+ RCPAP_Field:= first of (field_list
+ where field_list.DataItemName = "HH_CPAP" );
+
+ REPAP_Field := first of (field_list
+ where field_list.DataItemName = "HH_EPAP" );
+
+ RIPAP_Field := first of (field_list
+ where field_list.DataItemName = "HH_IPAP" );
+
+ RNumBreaths_Field := first of (field_list
+ where field_list.DataItemName = "HH_Number of Breaths");
+
+ RFIO2_Field := first of (field_list
+ where field_list.DataItemName = "HH_FIO2" );
+
+ RLPM_Field := first of (field_list
+ where field_list.DataItemName = "HH_LPM" );
+
+ RHumidifier_Field := first of (field_list
+ where field_list.DataItemName = "HH_Humidifier" );
+
+ RHeated_Field := first of (field_list
+ where field_list.DataItemName = "HH_Heated" );
+
+ RNebulizer_Field := first of (field_list
+ where field_list.DataItemName = "HH_Nebulizer Medication" );
+
+ RNebFreq_Field := first of (field_list
+ where field_list.DataItemName = "HH_Neb Frequency" );
+
+ ROxygen_Field:= first of (field_list
+ where field_list.DataItemName = "HH_Oxygen");
+
+ RO2LPM := first of (field_list
+ where field_list.DataItemName = "HH_O2 LPM");
+
+ RO2Mode := first of (field_list
+ where field_list.DataItemName = "HH_O2 Mode");
+
+ RO2Frequency := first of (field_list
+ where field_list.DataItemName = "HH_O2 Frequency");
+
+ RTest:= first of (field_list
+ where field_list.DataItemName = "HH_Testing");
+
+ RO2Sat := first of (field_list
+ where field_list.DataItemName = "HH_O2 Sat");
+
+ RO2SatT := first of (field_list
+ where field_list.DataItemName = "HH_O2 Sat Testing");
+
+
+
+
+
+
+
+ Others:=0;
+
+ If (CallingField="HH_Personnel")
+ then
+ If HOrder_Field.value = True
+ then
+ //MARKER
+ HService_field.Control_Visible:= TRUE;
+ HDiscipline_field.Control_Visible:=True;
+ HFreq_Field.Control_Visible:=True;
+ elseif HOrder_Field.Value = False
+ then
+ HService_Field.Value := "";
+ HService_Field.Control_Visible :=False;
+ HDiscipline_Field.Value:="";
+ HDiscipline_field.Control_Visible := False;
+ HFreq_Field.Value:="";
+ HFreq_Field.Control_Visible :=False;
+ endif;
+ elseif (CallingField = "HH_Durable Medical Equip")
+ then
+ IF DOrder_Field.Value=True
+ then
+ DEquipNeed_Field.Control_Visible:=True;
+ elseif DOrder_Field.Value=False
+ then
+ DEquipNeed_Field.Value:="";
+ DEquipNeed_Field.Control_Visible:=False;
+ endif;
+ elseif (CallingField = "HH_Enteral Feedings")
+ then
+ IF EFeedingOrder_Field.Value=True
+ then
+ EFormEquiv_Field.Control_Visible:=True;
+ EAmountCC_Field.Control_Visible:=True;
+ EFlowRate_Field.Control_Visible:=True;
+ EModeAmin_Field.Control_Visible:=True;
+ EFlushWith_Field.Control_Visible:=True;
+ EAmountCC2_Field.Control_Visible:=True;
+ EFreeWater_Field.Control_Visible:=True;
+ EFlushFreq_Field.Control_Visible:=True;
+ EPegTube_Field.Control_Visible:=True;
+ elseif EFeedingOrder_Field.Value=False
+ then
+ EFormEquiv_Field.Value:="";
+ EFormEquiv_Field.Control_Visible:=False;
+ EAmountCC_Field.Value:="";
+ EAmountCC_Field.Control_Visible:=False;
+ EFlowRate_Field.Value:="";
+ EFlowRate_Field.Control_Visible:=False;
+ EModeAmin_Field.Value:="";
+ EModeAmin_Field.Control_Visible:=False;
+ EFlushWith_Field.Value:="";
+ EFlushWith_Field.Control_Visible:=False;
+ EAmountCC2_Field.Value:="";
+ EAmountCC2_Field.Control_Visible:=False;
+ EFreeWater_Field.Value:="";
+ EFreeWater_Field.Control_Visible:=False;
+ EFlushFreq_Field.Value:="";
+ EFlushFreq_Field.Control_Visible:=False;
+ EPegTube_Field.Value:="";
+ EPegTube_Field.Control_Visible:=False;
+ endif;
+ elseif (CallingField = "HH_Infusion Order")
+ then
+ If InfusionOrder_Field.Value = True
+ then
+ IBenCheck_Field.Control_Visible:= True;
+ IDrug_Field.Control_Visible:= True;
+ IVSolution_Field.Control_Visible:= True;
+ IccPerHr_Field.Control_Visible:= True;
+ IqPerHr_Field.Control_Visible:= True;
+ IPRN_Field.Control_Visible:= True;
+ IFlush_Field.Control_Visible:= True;
+ IRoute_Field.Control_Visible:= True;
+ IVAccess_Field.Control_Visible:= True;
+ elseif InfusionOrder_Field.Value=False
+ then
+ IBenCheck_Field.Value:="";
+ IBenCheck_Field.Control_Visible:= False;
+ IDrug_Field.Value:="";
+ IDrug_Field.Control_Visible:= False;
+ IVSolution_Field.Value:="";
+ IVSolution_Field.Control_Visible:= False;
+ IccPerHr_Field.Value:="";
+ IccPerHr_Field.Control_Visible:= False;
+ IqPerHr_Field.Value:="";
+ IqPerHr_Field.Control_Visible:= False;
+ IPRN_Field.Value:="";
+ IPRN_Field.Control_Visible:= False;
+ IFlush_Field.Value:="";
+ IFlush_Field.Control_Visible:= False;
+ IRoute_Field.Value:="";
+ IRoute_Field.Control_Visible:=False;
+ IVAccess_Field.Value:="";
+ IVAccess_Field.Control_Visible:= False;
+ endif;
+ elseif (CallingField = "HH_Pharmaceutical Order")
+ then
+ If POrder_Field.Value = True
+ then
+ PBenCheck_Field.Control_Visible := True;
+ PDrugDose_Field.Control_Visible := True;
+ PFreqRoute_Field.Control_Visible := True;
+ PDurationDose_Field.Control_Visible := True;
+ elseif POrder_Field.Value = false
+ then
+ PBenCheck_Field.Value:="";
+ PBenCheck_Field.Control_Visible :=False;
+ PDrugDose_Field.Value:="";
+ PDrugDose_Field.Control_Visible :=False;
+ PFreqRoute_Field.Value:="";
+ PFreqRoute_Field.Control_Visible :=False;
+ PDurationDose_Field.Value:="";
+ PDurationDose_Field.Control_Visible :=False;
+ endif;
+ elseif (CallingField = "HH_Respiratory Order")
+ then
+ If RespOrder_Field.Value = True
+ then
+ REquip_Field.Control_Visible := True;
+ RAPMonitorAl_Field.Control_Visible := True;
+ RAPnMonitor_Field.Control_Visible := True;
+ RInfantCPR_Field.Control_Visible := True;
+ RBIBAP_Field.Control_Visible := True;
+ RCPAP_Field.Control_Visible := True;
+ REPAP_Field.Control_Visible := True;
+ RIPAP_Field.Control_Visible := True;
+ RNumBreaths_Field.Control_Visible := True;
+ RFIO2_Field.Control_Visible := True;
+ RLPM_Field.Control_Visible := True;
+ RHumidifier_Field.Control_Visible := True;
+ RHeated_Field.Control_Visible := True;
+ RNebulizer_Field.Control_Visible := True;
+ RNebFreq_Field.Control_Visible := True;
+ ROxygen_Field.Control_Visible := True;
+ RO2LPM.Control_Visible := True;
+ RO2Mode.Control_Visible := True;
+ RO2Frequency.Control_Visible := True;
+ RTest.Control_Visible := True;
+ RO2Sat.Control_Visible := True;
+ RO2SatT.Control_Visible := True;
+ elseif RespOrder_Field.Value = false
+ then
+ REquip_Field.Value :="";
+ REquip_Field.Control_Visible := False;
+
+ //Do not change AP Monitor Notes
+ RAPMonitorAl_Field.Control_Visible := False;
+
+ RAPnMonitor_Field.Value :="";
+ RAPnMonitor_Field.Control_Visible := False;
+ RInfantCPR_Field.Value :="";
+ RInfantCPR_Field.Control_Visible := False;
+ RBIBAP_Field.Value :="";
+ RBIBAP_Field.Control_Visible := False;
+ RCPAP_Field.Value :="";
+ RCPAP_Field.Control_Visible := False;
+ REPAP_Field.Value :="";
+ REPAP_Field.Control_Visible := False;
+ RIPAP_Field.Value :="";
+ RIPAP_Field.Control_Visible := False;
+ RNumBreaths_Field.Value :="";
+ RNumBreaths_Field.Control_Visible := False;
+ RFIO2_Field.Value :="";
+ RFIO2_Field.Control_Visible := False;
+ RLPM_Field.Value :="";
+ RLPM_Field.Control_Visible := False;
+ RHumidifier_Field.Value :="";
+ RHumidifier_Field.Control_Visible := False;
+ RHeated_Field.Value :="";
+ RHeated_Field.Control_Visible := False;
+ RNebulizer_Field.Value :="";
+ RNebulizer_Field.Control_Visible := False;
+ RNebFreq_Field.Value :="";
+ RNebFreq_Field.Control_Visible := False;
+
+ ROxygen_Field.Control_Visible := False;
+
+ RO2LPM.Value :="";
+ RO2LPM.Control_Visible := False;
+ RO2Mode.Value :="";
+ RO2Mode.Control_Visible := False;
+ RO2Frequency.Value :="";
+ RO2Frequency.Control_Visible := False;
+
+ RTest.Control_Visible := False;
+ RO2Sat.Control_Visible := False;
+
+ RO2SatT.Value :="";
+ RO2SatT.Control_Visible := False;
+ endif;
+ endif;
+ // this_communication.DisplayForm := "Yes";
+ // this_communication.Message := "The Frequency is: " || In_Frequency_field || "\n" || "Freq defined as: "|| Freq
+ // || "\n" || "Calling event is: " || CallingEvent
+ // || "\n" || "Calling field is : " || CallingField;
+ // this_communication.MessageType := "Error";
+
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_TOTAL_HIP_DCINST.mlm b/MLMStripper/bin/Debug/FORM/FORM_TOTAL_HIP_DCINST.mlm
new file mode 100644
index 0000000..c523558
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_TOTAL_HIP_DCINST.mlm
@@ -0,0 +1,150 @@
+maintenance:
+
+ title: Total Hip Replacement Discharge Instructions;;
+ mlmname: FORM_TOTAL_HIP_DCINST;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St. Clair Hospital;;
+ author: Shawn Head x7468;;
+ specialist: Robert Stewart;;
+ date: 2015-04-20;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will auto populate certain fields on the order form based on the selected Discharge type
+ ;;
+ explanation: This MLM will populate fields on the order form based on the selected discharge type.
+ ;;
+ keywords: total, knee, replacement, discharge, instructions
+ ;;
+ citations:
+ 4.20.2015 - STH - CSR#: 33149 - PROD 5.19.2015 - Auto select data on form based on selected template.
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ //start here
+
+ // 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*******************/
+
+
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField :=this_communication.CallingFieldName;
+ ClientVisitGuid := this_communication.ClientVisitGuid;
+
+
+ //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;
+
+ CallingEvent := this_communication.CallingEvent;
+ Visit_Guid := this_communication.ClientVisitGuid;
+ Chart_Guid := this_communication.ChartGuid;
+ Client_Guid := this_communication.ClientGuid;
+ comm_obj := this_communication.primaryobj;
+ call_field := this_communication.CallingFieldName;
+
+
+ DC_Type1 := first of (field_list where field_list.DataItemName = "DC_Home_Standard");
+ DC_Type2 := first of (field_list where field_list.DataItemName = "DC_Home_Standard 2");
+ Incision_Dressing_instruct := first of (field_list where field_list.DataItemName = "DC_Home_Dressing_Knee");
+ WeightBearing_instruct := first of (field_list where field_list.DataitemName = "DC_Home_Weight_Bearing");
+ Interventions := first of (field_list where field_list.DataitemName = "DISC_Total_Knee_Replacement");
+ Precautions := first of (field_list where field_list.DataitemName = "DISC_Total_Knee_Precautions");
+ PT_PW := first of (field_list where field_list.DataitemName = "DC_Home_PT_PerWeek");
+ RN_PW := first of (field_list where field_list.DataitemName = "DC_Home_RN_PerWeek");
+ Versamode := first of (field_list where field_list.DataitemName = "DC_Home_CPM_Versamode");
+
+
+
+ if this_communication.CallingFieldName = "DC_Home_Standard" then
+ if DC_Type1.Value = true then
+ DC_Type2.Control_read_only := true;
+ Incision_Dressing_instruct.value := "Remove Aquacel dressing after 7 days; After Aquacel dressing is removed, apply dry dressing.; Change dressing daily.; NO creams or lotions on incision.";
+ WeightBearing_instruct.Value := "Weight Bearing as Tolerated";
+ Interventions.Value := "Wear ted hose until directed at follow up appointment. Remove at bedtime and reapply in AM.; Inspect heel for redness. Notify physician if blister occurs.; "
+ || "OK to shower.; Take over the counter stool softener while on pain medications.; Use incentive spirometer every 2 hours while awake for 2 weeks post discharge.; "
+ || "NO driving until follow up appointment.; NO tub baths.; DO NOT place pillow beneath knee joint.; "
+ || "Use assistive device for ambulation until otherwise instructed by Physician or Physical Therapist; NO additional Advil, Aleve, Ibuprofen or Aspirin until permitted by surgeon.; "
+ || "Posterior surgical approach hip precautions:; Avoid hip flexion greater than 90 degrees; Avoid moving hip out to the side (crossing the operative leg past the midline); "
+ || "Avoid turning foot inward";
+ Precautions.Value := "Call Your Surgeons Office: If incision becomes red, if drainage occurs, if excessive swelling develops, fever of 101 or above, nausea and vomiting, diarrhea.; "
+ || "If you had a joint replacement you should be on a prophylactic medication to help avoid blood clots. If you were discharged without a medication please contact your surgeon.; "
+ || "Call 911 if you develop sudden shortness of breath or develop chest pain.";
+ PT_PW.Value := "2 - 3";
+ RN_PW.Value := "2 - 3";
+ Versamode.Value := true;
+ else
+ DC_Type2.Control_read_only := false;
+ Incision_Dressing_instruct.value := "";
+ WeightBearing_instruct.Value := "";
+ Interventions.Value := "";
+ Precautions.Value := "";
+ PT_PW.Value := "";
+ RN_PW.Value := "";
+ Versamode.Value := false;
+ endif;
+ endif;
+ if this_communication.CallingFieldName = "DC_Home_Standard 2" then
+
+ if DC_Type2.Value = true then
+ DC_Type1.Control_read_only := true;
+ Incision_Dressing_instruct.value := "Leave incision open to air.; Apply bandage if incision has drainage present.";
+ WeightBearing_instruct.Value := "Weight Bearing as Tolerated";
+ Interventions.Value := "Inspect heel for redness. Notify physician if blister occurs.; OK to shower.; Take over the counter stool softener while on pain medications.; "
+ || "Use incentive spirometer every 2 hours while awake for 2 weeks post discharge.; DO NOT place pillow beneath knee joint.; NO tub baths.; "
+ || "Use assistive device for ambulation until otherwise instructed by Physician or Physical Therapist; Resume normal activity as tolerated.; "
+ || "NO driving until narcotics are discontinued.; NO driving until leg control is regained; NO additional Advil, Aleve, Ibuprofen or Aspirin until permitted by surgeon.; "
+ || "When resting at night, keep knee at full extention , use brace if needed.; Avoid turning knee inward.";
+ Precautions.Value := "Call Your Surgeons Office: If incision becomes red, if drainage occurs, if excessive swelling develops, fever of 101 or above, nausea and vomiting, diarrhea.; "
+ || "If you had a joint replacement you should be on a prophylactic medication to help avoid blood clots. If you were discharged without a medication please contact your surgeon.; "
+ || "Call 911 if you develop sudden shortness of breath or develop chest pain.";
+ PT_PW.Value := "2 - 3";
+ RN_PW.Value := "2 - 3";
+ Versamode.Value := true;
+ else
+ DC_Type1.Control_read_only := false;
+ Incision_Dressing_instruct.value := "";
+ WeightBearing_instruct.Value := "";
+ Interventions.Value := "";
+ Precautions.Value := "";
+ PT_PW.Value := "";
+ RN_PW.Value := "";
+ Versamode.Value := false;
+ endif;
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_TOTAL_KNEE_DCINST.mlm b/MLMStripper/bin/Debug/FORM/FORM_TOTAL_KNEE_DCINST.mlm
new file mode 100644
index 0000000..0b8bb74
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_TOTAL_KNEE_DCINST.mlm
@@ -0,0 +1,185 @@
+maintenance:
+
+ title: Total Knee Replacement Discharge Instructions;;
+ mlmname: FORM_TOTAL_KNEE_DCINST;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St. Clair Hospital;;
+ author: Shawn Head x7468;;
+ specialist: Robert Stewart;;
+ date: 2015-04-20;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will auto populate certain fields on the order form based on the selected Discharge type
+ ;;
+ explanation: This MLM will populate fields on the order form based on the selected discharge type.
+ ;;
+ keywords: total, knee, replacement, discharge, instructions
+ ;;
+ citations:
+ 4.20.2015 - STH - CSR#: 33148 - PROD 5.19.2015 - Auto select data on form based on selected template.
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ //start here
+
+ // 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*******************/
+
+
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField :=this_communication.CallingFieldName;
+ ClientVisitGuid := this_communication.ClientVisitGuid;
+
+
+ //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;
+
+ CallingEvent := this_communication.CallingEvent;
+ Visit_Guid := this_communication.ClientVisitGuid;
+ Chart_Guid := this_communication.ChartGuid;
+ Client_Guid := this_communication.ClientGuid;
+ comm_obj := this_communication.primaryobj;
+ call_field := this_communication.CallingFieldName;
+
+ discharge_type1_dressing := ("Remove Aquacel dressing after 7 days",
+ "After Aquacel dressing is removed, apply dry dressing.",
+ "Change dressing daily.",
+ "NO creams or lotions on incision.");
+ discharge_type2_dressing := "";
+
+ DC_Type1 := first of (field_list where field_list.DataItemName = "DC_Home_Standard");
+ DC_Type2 := first of (field_list where field_list.DataItemName = "DC_Home_Standard 2");
+ Incision_Dressing_instruct := first of (field_list where field_list.DataItemName = "DC_Home_Dressing_Knee");
+ WeightBearing_instruct := first of (field_list where field_list.DataitemName = "DC_Home_Weight_Bearing");
+ Interventions := first of (field_list where field_list.DataitemName = "DISC_Total_Knee_Replacement");
+ Precautions := first of (field_list where field_list.DataitemName = "DISC_Total_Knee_Precautions");
+ PT_PW := first of (field_list where field_list.DataitemName = "DC_Home_PT_PerWeek");
+ RN_PW := first of (field_list where field_list.DataitemName = "DC_Home_RN_PerWeek");
+ Start_Ext := first of (field_list where field_list.DataitemName = "DC_Home_CPM_StartExt");
+ Start_Flex := first of (field_list where field_list.DataitemName = "DC_Home_CPM_StartFlex");
+ Freq_Machine := first of (field_list where field_list.DataitemName = "DC_Home_CPM_Freq");
+ Max_Flex := first of (field_list where field_list.DataitemName = "DC_Home_CPM_MaxFlexion");
+ Time_on_machine := first of (field_list where field_list.DataitemName = "DC_Home_CPM_Time");
+ CPM_Tolerated := first of (field_list where field_list.DataitemName = "DC_Home_CPM_IncCPMFlex");
+ Progress_2weeks := first of (field_list where field_list.DataitemName = "DC_Home_CPM_ProgressFlex");
+//2 - 3
+
+
+ if this_communication.CallingFieldName = "DC_Home_Standard" then
+ if DC_Type1.Value = true then
+ DC_Type2.Control_read_only := true;
+ Incision_Dressing_instruct.value := "Remove Aquacel dressing after 7 days; After Aquacel dressing is removed, apply dry dressing.; Change dressing daily.; NO creams or lotions on incision.";
+ WeightBearing_instruct.Value := "Weight Bearing as Tolerated";
+ Interventions.Value := "Wear ted hose until directed at follow up appointment. Remove at bedtime and reapply in AM.; Inspect heel for redness. Notify physician if blister occurs.; OK to shower.; "
+ || "Take over the counter stool softener while on pain medications.; "
+ || "Use incentive spirometer every 2 hours while awake for 2 weeks post discharge.; NO driving until follow up appointment.; NO tub baths.; DO NOT place pillow beneath knee joint.; "
+ || "Use assistive device for ambulation until otherwise instructed by Physician or Physical Therapist; NO additional Advil, Aleve, Ibuprofen or Aspirin until permitted by surgeon.";
+ Precautions.Value := "Call Your Surgeons Office: If incision becomes red, if drainage occurs, if excessive swelling develops, fever of 101 or above, nausea and vomiting, diarrhea.; "
+ || "If you had a joint replacement you should be on a prophylactic medication to help avoid blood clots. If you were discharged without a medication please contact your surgeon.; "
+ || "Call 911 if you develop sudden shortness of breath or develop chest pain.";
+ PT_PW.Value := "2 - 3";
+ RN_PW.Value := "2 - 3";
+ else
+ DC_Type2.Control_read_only := false;
+ Incision_Dressing_instruct.value := "";
+ WeightBearing_instruct.Value := "";
+ Interventions.Value := "";
+ Precautions.Value := "";
+ PT_PW.Value := "";
+ RN_PW.Value := "";
+ endif;
+ endif;
+ if this_communication.CallingFieldName = "DC_Home_Standard 2" then
+
+ if DC_Type2.Value = true then
+ DC_Type1.Control_read_only := true;
+ Incision_Dressing_instruct.value := "Leave incision open to air.; Apply bandage if incision has drainage present.";
+ WeightBearing_instruct.Value := "Weight Bearing as Tolerated";
+ Interventions.Value := "Inspect heel for redness. Notify physician if blister occurs.; OK to shower.; Take over the counter stool softener while on pain medications.; "
+ || "Use incentive spirometer every 2 hours while awake for 2 weeks post discharge.; NO tub baths.; DO NOT place pillow beneath knee joint.; "
+ || "Use assistive device for ambulation until otherwise instructed by Physician or Physical Therapist; Resume normal activity as tolerated.; "
+ || "NO driving until narcotics are discontinued.; NO driving until leg control is regained; NO additional Advil, Aleve, Ibuprofen or Aspirin until permitted by surgeon.; "
+ || "When resting at night, keep knee at full extention , use brace if needed.";
+ Precautions.Value := "Call Your Surgeons Office: If incision becomes red, if drainage occurs, if excessive swelling develops, fever of 101 or above, nausea and vomiting, diarrhea.; "
+ || "If you had a joint replacement you should be on a prophylactic medication to help avoid blood clots. If you were discharged without a medication please contact your surgeon.; "
+ || "Call 911 if you develop sudden shortness of breath or develop chest pain.";
+ PT_PW.Value := "2 - 3";
+ RN_PW.Value := "2 - 3";
+ Start_Ext.value := "0";
+ Start_Flex.value := "90";
+ Freq_Machine.value := "1 to 2 times per day";
+ Max_Flex.value := "110 degrees";
+ Time_on_machine.value := "30 to 60 minutes";
+ CPM_Tolerated.value := true;
+ Progress_2weeks.value := true;
+ else
+ DC_Type1.Control_read_only := false;
+ Incision_Dressing_instruct.value := "";
+ WeightBearing_instruct.Value := "";
+ Interventions.Value := "";
+ Precautions.Value := "";
+ PT_PW.Value := "";
+ RN_PW.Value := "";
+ Start_Ext.value := "";
+ Start_Flex.value := "";
+ Freq_Machine.value := "";
+ Max_Flex.value := "";
+ Time_on_machine.value := "";
+ CPM_Tolerated.value := false;
+ Progress_2weeks.value := false;
+ endif;
+ endif;
+
+/*
+ if this_communication.CallingFieldName = "DC_Home_Standard2" then
+ abc := "";
+
+ endif;
+ for x in (1 seqto count(discharge_type1_dressing)) do
+ if x = 1 then
+ selected_value := discharge_type1_dressing[x];
+ else
+ selected_value := selected_value || "; " || discharge_type1_dressing[x];
+ endif;
+ enddo;
+ Incision_Dressing_instruct.Value := selected_value;
+*/
+
+
+ //end here
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_TPA_INCLUSION_EXCLUSION.mlm b/MLMStripper/bin/Debug/FORM/FORM_TPA_INCLUSION_EXCLUSION.mlm
new file mode 100644
index 0000000..f082237
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_TPA_INCLUSION_EXCLUSION.mlm
@@ -0,0 +1,400 @@
+maintenance:
+
+ title: FORM_TPA_INCLUSION_EXCLUSION;;
+ mlmname: FORM_TPA_INCLUSION_EXCLUSION;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Admissions;;
+ author: Juliet M. Law, Allscripts, Inc ext 7461;;
+ specialist: Maria Pest, Allscripts, Inc ext 7443;;
+ date: 2012-09-24;;
+ validation: testing;;
+
+library:
+ purpose: Used for TPA Inclusion/Exclusion Criteria Order for Acute Ishemic Stroke
+ ;;
+
+ explanation: This MLM is called from the TPA Inclusion/Exclusion Order, form: CPOE_Inc/Exc Crit
+
+ This MLM will collect the answers on the TPA Inclusion/Exclusion Order to determine if the
+ inclusion/exclusion criteria is met before ordering a TPA for Acute Ishemic Stroke.
+
+ Change History:
+ 2012.09.24 JML CSR 30685: Created - copied from FORM_SET_TPA_ACUTE_ISHEMIC_STROKE MLM.
+ 2014.09.10 JML CSR 32550: Modify existing TPA Inclusion/Exclusion form.
+
+ ;;
+ keywords: Called MLMs, TPA, Inclusion/Exclusion
+ ;;
+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;
+
+ // RS ADD Message box
+ 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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ client_guid := this_communication.ClientGUID;
+ visit_guid := this_communication.ClientVisitGUID;
+ chart_guid := this_communication.ChartGuid;
+
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ //Formatting
+ TAB := 9 FORMATTED WITH "%C";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+
+ NIHSS_Score_Fld := last of (field_list WHERE field_list.DataItemName = "CPOE_NIHSS score");
+
+ Stroke_Onset_Date_Fld := last of (field_list WHERE field_list.DataItemName = "CPOE_Symptom Onset Date");
+ Stroke_Onset_Time_Fld := last of (field_list WHERE field_list.DataItemName = "CPOE_Symptom Onset");
+
+ BP_Fld := last of (field_list WHERE field_list.DataItemName = "CPOE_BP");
+
+ Age_18_Response_Fld := last of (field_list WHERE field_list.DataItemName = "CPOE_Inc/Exc Response");
+ Age_80_Response_Fld := last of (field_list WHERE field_list.DataItemName = "CPOE_Inc/Exc Response23");
+
+ Clinical_Diagnosis_Stroke_Response_Fld := last of (field_list WHERE field_list.DataItemName = "CPOE_Inc/Exc Response2");
+ NIHSS_25_Score_Fld := last of (field_list WHERE field_list.DataItemName = "CPOE_Inc/Exc Response21");
+
+ Exclusion_Statement_Fld1 := last of (field_list WHERE field_list.DataItemName = "CPOE_Inc/Exc_Statement1");
+ Exclusion_Statement_Fld1.Value := "";
+ Exclusion_Statement_Fld2 := last of (field_list WHERE field_list.DataItemName = "CPOE_Inc/Exc_Statement2");
+ Exclusion_Statement_Fld2.Value := "";
+ Exclusion_Statement_Fld3 := last of (field_list WHERE field_list.DataItemName = "CPOE_Inc/Exc_Statement3");
+ Exclusion_Statement_Fld3.Value := "";
+ Exclusion_Statement_Fld4 := last of (field_list WHERE field_list.DataItemName = "CPOE_Inc/Exc_Statement4");
+ Exclusion_Statement_Fld4.Value := "";
+
+ if (CallingEvent = "FormOpen") then
+ //Get NIHSS Score
+ NIHSS_Score := read last {"SELECT o.ValueText"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocument cd WITH (NOLOCK)"
+ || " ON cv.GUID = cd.ClientVisitGUID"
+ || " AND cv.ClientGUID = cd.ClientGUID"
+ || " AND cv.ChartGUID = cd.ChartGUID"
+ || " JOIN CV3ClientDocDetail cdd WITH (NOLOCK)"
+ || " ON cd.GUID = cdd.ClientDocumentGUID"
+ || " AND cd.ClientGUID = cdd.ClientGUID"
+ || " JOIN CV3ObservationDocument od WITH (NOLOCK)"
+ || " ON cdd.ClientDocumentGUID = od.OwnerGUID"
+ || " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON od.ObsMasterItemGUID = ocmi.GUID"
+ || " JOIN CV3Observation o WITH (NOLOCK)"
+ || " ON od.ObservationGUID = o.GUID"
+ || " JOIN CV3ObsCatalogItem oci WITH (NOLOCK)"
+ || " ON o.ObsItemGUID = oci.GUID"
+ || " WHERE cd.DocumentName like {{{SINGLE-QUOTE}}}%Assessment/Intervention%{{{SINGLE-QUOTE}}}"
+ || " AND cdd.Active = 1"
+ || " AND od.Active = 1"
+ || " AND cv.ClientGUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)
+ || " AND cv.ChartGUID = " || Sql(chart_guid)
+ || " AND oci.Name = {{{SINGLE-QUOTE}}}AS SC NIH SS TOTAL CAL{{{SINGLE-QUOTE}}}"};
+
+ if (exists NIHSS_Score) then
+ NIHSS_Score_Fld.Value := NIHSS_Score;
+
+ //Answer #2: NIHSS score >= 4 and NIHSS score <= 22 = YES
+ // NIHSS score > 22 = NO
+ //Answer #21: NIHSS score > 25 = YES; NIHSS score <= 25 = NO
+/*
+ if (((NIHSS_Score as number) >= 4) AND ((NIHSS_Score as number) <= 22)) then
+ Clinical_Diagnosis_Stroke_Response_Fld.Value := "Yes";
+ elseif ((NIHSS_Score as number) > 22) then
+ Clinical_Diagnosis_Stroke_Response_Fld.Value := "No";
+
+ else //NIHSS_Score < 4
+ Clinical_Diagnosis_Stroke_Response_Fld.Value := "No";
+ endif;
+ if ((NIHSS_Score as number) > 25) then
+ NIHSS_25_Score_Fld.Value := "Yes";
+ else //NIHSS_Score <= 25
+ NIHSS_25_Score_Fld.Value := "No";
+ endif;
+*/
+ endif;
+
+ //Retrieve Stroke Last Known Well Date
+ (Stroke_Onset_Date,
+ Stroke_Onset_Time) := read last {"SELECT "
+ || " CASE WHEN Len(DatePart(mm, o.ValueText)) = 1 THEN"
+ || " {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} + Convert(varchar(2), DatePart(MM, o.ValueText))"
+ || " ELSE"
+ || " Convert(varchar(2), DatePart(MM, o.ValueText))"
+ || " END"
+ || " + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} +"
+ || " CASE WHEN Len(DatePart(dd, o.ValueText)) = 1 THEN"
+ || " {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} + Convert(varchar(2), DatePart(DD, o.ValueText))"
+ || " ELSE"
+ || " Convert(varchar(2), DatePart(DD, o.ValueText))"
+ || " END"
+ || " + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + Convert(varchar(4), DatePart(YY, o.ValueText)),"
+ || " CASE WHEN Len(DatePart(HOUR, o.ValueText)) = 1 THEN"
+ || " {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} + Convert(varchar(2), DatePart(HOUR, o.ValueText))"
+ || " ELSE"
+ || " Convert(varchar(2), DatePart(HOUR, o.ValueText))"
+ || " END"
+ || " + {{{SINGLE-QUOTE}}}:{{{SINGLE-QUOTE}}} +"
+ || " CASE WHEN Len(DatePart(MINUTE, o.ValueText)) = 1 THEN"
+ || " {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} + Convert(varchar(2), DatePart(MINUTE, o.ValueText))"
+ || " ELSE"
+ || " Convert(varchar(2), DatePart(MINUTE, o.ValueText))"
+ || " END"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocument cd WITH (NOLOCK)"
+ || " ON cv.GUID = cd.ClientVisitGUID"
+ || " AND cv.ClientGUID = cd.ClientGUID"
+ || " AND cv.ChartGUID = cd.ChartGUID"
+ || " JOIN CV3ClientDocDetail cdd WITH (NOLOCK)"
+ || " ON cd.GUID = cdd.ClientDocumentGUID"
+ || " AND cd.ClientGUID = cdd.ClientGUID"
+ || " JOIN CV3ObservationDocument od WITH (NOLOCK)"
+ || " ON cdd.ClientDocumentGUID = od.OwnerGUID"
+ || " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON od.ObsMasterItemGUID = ocmi.GUID"
+ || " JOIN CV3Observation o WITH (NOLOCK)"
+ || " ON od.ObservationGUID = o.GUID"
+ || " JOIN CV3ObsCatalogItem oci WITH (NOLOCK)"
+ || " ON o.ObsItemGUID = oci.GUID"
+ || " WHERE cd.DocumentName like {{{SINGLE-QUOTE}}}%triage%{{{SINGLE-QUOTE}}}"
+ || " AND cdd.Active = 1"
+ || " AND od.Active = 1"
+ || " AND cv.ClientGUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)
+ || " AND cv.ChartGUID = " || Sql(chart_guid)
+ || " AND oci.Name = {{{SINGLE-QUOTE}}}sch_edtriage_stroke date and time{{{SINGLE-QUOTE}}}"};
+
+
+ if (exists Stroke_Onset_Date) then
+ Stroke_Onset_Date_Fld.Value := Stroke_Onset_Date;
+ Stroke_Onset_Time_Fld.Value := Stroke_Onset_Time;
+ endif;
+
+ //Retrieve BP
+ (BP_Systolic,
+ BP_Recorded_Dtm) := read {"SELECT o.ValueText, od.RecordedDtm"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocument cd WITH (NOLOCK)"
+ || " ON cv.GUID = cd.ClientVisitGUID"
+ || " AND cv.ClientGUID = cd.ClientGUID"
+ || " AND cv.ChartGUID = cd.ChartGUID"
+ || " JOIN CV3ClientDocDetail cdd WITH (NOLOCK) "
+ || " ON cd.GUID = cdd.ClientDocumentGUID"
+ || " AND cd.ClientGUID = cdd.ClientGUID"
+ || " JOIN CV3ObservationDocument od WITH (NOLOCK)"
+ || " ON cdd.ClientDocumentGUID = od.OwnerGUID"
+ || " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON od.ObsMasterItemGUID = ocmi.GUID"
+ || " JOIN CV3Observation o WITH (NOLOCK)"
+ || " ON od.ObservationGUID = o.GUID"
+ || " JOIN CV3ObsCatalogItem oci WITH (NOLOCK)"
+ || " ON o.ObsItemGUID = oci.GUID"
+ || " WHERE cd.DocumentName like {{{SINGLE-QUOTE}}}%vital%sign%{{{SINGLE-QUOTE}}}"
+ || " AND cdd.Active = 1"
+ || " AND od.Active = 1"
+ || " AND cv.ClientGUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)
+ || " AND cv.ChartGUID = " || Sql(chart_guid)
+ || " AND (oci.Name = {{{SINGLE-QUOTE}}}sch_edtriage_noninvasive systolic bp{{{SINGLE-QUOTE}}}"
+ || " OR oci.Name = {{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}})"
+ || " ORDER BY od.RecordedDtm DESC"};
+
+ BP_Diastolic := read {"SELECT o.ValueText, od.RecordedDtm"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocument cd WITH (NOLOCK)"
+ || " ON cv.GUID = cd.ClientVisitGUID"
+ || " AND cv.ClientGUID = cd.ClientGUID"
+ || " AND cv.ChartGUID = cv.ChartGUID"
+ || " JOIN CV3ClientDocDetail cdd WITH (NOLOCK)"
+ || " ON cd.GUID = cdd.ClientDocumentGUID"
+ || " AND cd.ClientGUID = cdd.ClientGUID"
+ || " JOIN CV3ObservationDocument od WITH (NOLOCK)"
+ || " ON cdd.ClientDocumentGUID = od.OwnerGUID"
+ || " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON od.ObsMasterItemGUID = ocmi.GUID"
+ || " JOIN CV3Observation o WITH (NOLOCK)"
+ || " ON od.ObservationGUID = o.GUID"
+ || " JOIN CV3ObsCatalogItem oci WITH (NOLOCK)"
+ || " ON o.ObsItemGUID = oci.GUID"
+ || " WHERE cd.DocumentName like {{{SINGLE-QUOTE}}}%vital%sign%{{{SINGLE-QUOTE}}} AND cdd.Active = 1 AND od.Active = 1"
+ || " AND cv.ClientGUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)
+ || " AND cv.ChartGUID = " || Sql(chart_guid)
+ || " AND (oci.Name = {{{SINGLE-QUOTE}}}sch_edtriage_noninvasive diastolic bp{{{SINGLE-QUOTE}}}"
+ || " OR oci.Name = {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}})"
+ || " ORDER BY od.RecordedDtm DESC"};
+
+ if (exists BP_Systolic) then
+ BP_Fld.Value := first of (BP_Systolic);
+ endif;
+
+ if (exists BP_Diastolic) then
+ bp_value := BP_Fld.Value || "/" || first of (BP_Diastolic) || CR || LF || first of (BP_Recorded_Dtm);
+ BP_Fld.Value := bp_value;
+ endif;
+
+ //Patient{{{SINGLE-QUOTE}}}s Age Question
+ //Question #1: Patient Age >= 18 = YES; Patient Age < 18 = NO
+ //Question #18: Patient Age > 80 = YES; Patient Age <= 80 = NO
+ if (exists client_info_obj) then
+ (birthDate) := read last {ClientInfo: BirthDate REFERENCING client_info_obj};
+
+ patientAge := (NOW - birthDate) / (1 year);
+
+ if (patientAge > 17.99) then
+ Age_18_Response_Fld.Value := "Yes";
+ else
+ Age_18_Response_Fld.Value := "No";
+ endif;
+
+ if (patientAge > 80.99) then
+ Age_80_Response_Fld.Value := "Yes";
+ else
+ Age_80_Response_Fld.Value := "No";
+ endif;
+ endif;
+
+ elseif (CallingEvent = "FormClose") then
+
+ responseIndex := 1;
+ answeredCount := 0;
+ exclusionCount := 0;
+ exclusionStatement := "";
+ statementFld := 1;
+
+ for i in 1 seqto (count field_list) do
+ item := field_list.DataItemName[i];
+ responseField := "CPOE_Inc/Exc Response" || responseIndex;
+ questionField := "CPOE_Inc/Exc Question" || responseIndex;
+
+ if ((item = "CPOE_Inc/Exc Response") OR (item = responseField)) then
+ responseValue := last of (field_list WHERE field_list.DataItemName = item);
+ questionValue := last of (field_list WHERE field_list.DataItemName = questionField);
+
+// if ((responseIndex >= 1 AND responseIndex <= 3) AND responseValue.Value IS NOT NULL) then
+ if ((( responseIndex >= 1 AND responseIndex <= 3 ) OR ( responseIndex >= 21 AND responseIndex <= 22 ))
+ AND responseValue.Value IS NOT NULL ) then
+
+ if (responseValue.Value = "No") then
+ exclusionCount := exclusionCount + 1;
+
+ //exclusionStatement := exclusionStatementList[responseIndex];
+ exclusionStatement := exclusionCount || ". " || questionValue.Value;
+
+ if (Exclusion_Statement_Fld1.Value = "") then
+ Exclusion_Statement_Fld1.Value := "Response to following question(s) indicates Exclusion:" || CR || LF;
+ endif;
+
+ Exclusion_Statement_Fld1.Value := Exclusion_Statement_Fld1.Value || CR || LF || exclusionStatement;
+
+ if (length Exclusion_Statement_Fld1.Value >= 2000) then
+ statementFld := statementFld + 1;
+ endif;
+
+ endif;
+
+ answeredCount := answeredCount + 1;
+
+// elseif ((responseIndex > 3) AND (responseValue.Value IS NOT NULL)) then
+ elseif ((( responseIndex >= 4 AND responseIndex <= 20 ) OR ( responseIndex >= 23 AND responseIndex <= 27 ))
+ AND responseValue.Value IS NOT NULL ) then
+
+ if (responseValue.Value = "Yes") then
+ exclusionCount := exclusionCount + 1;
+
+ //exclusionStatement := exclusionStatementList[responseIndex] || "\n";
+ exclusionStatement := exclusionCount || ". " || questionValue.Value;
+
+ if (statementFld = 1) then
+ if (Exclusion_Statement_Fld1.Value = "") then
+ Exclusion_Statement_Fld1.Value := "Response to following question(s) indicates Exclusion:" || CR || LF;
+ endif;
+
+ totalFieldLength := ((length exclusionStatement) + (length Exclusion_Statement_Fld1.Value));
+ if (totalFieldLength <= 2000) then
+ Exclusion_Statement_Fld1.Value := Exclusion_Statement_Fld1.Value || CR || LF || exclusionStatement;
+ else
+ statementFld := statemekntFld + 1;
+ endif;
+ endif;
+ if (statementFld = 2) then
+ totalFieldLength2 := ((length exclusionStatement) + (length Exclusion_Statement_Fld2.Value));
+ if (totalFieldLength2 <= 2000) then
+ Exclusion_Statement_Fld2.Value := Exclusion_Statement_Fld2.Value || CR || LF || exclusionStatement;
+ else
+ statementFld := statementFld + 1;
+ endif;
+ endif;
+ if (statementFld = 3) then
+ totalFieldLength3 := ((length exclusionStatement) + (length Exclusion_Statement_Fld3.Value));
+ if(totalFieldLength3 <= 2000) then
+ Exclusion_Statement_Fld3.Value := Exclusion_Statement_Fld3.Value || CR || LF || exclusionStatement;
+ else
+ statementFld := statementFld + 1;
+ endif;
+ endif;
+ if (statementFld = 4) then
+ totalFieldLength4 := ((length exclusionStatement) + (length Exclusion_Statement_Fld4.Value));
+ if (totalFieldLength4 <= 2000) then
+ Exclusion_Statement_Fld4.Value := Exclusion_Statement_Fld4.Value || CR || LF || exclusionStatement;
+ else
+ statementFld := statementFld + 1;
+ endif;
+ endif;
+
+ endif;
+
+ answeredCount := answeredCount + 1;
+
+ endif;
+
+ responseIndex := responseIndex + 1;
+ endif;
+ enddo;
+
+ percentageUnanswered := 27 - answeredCount;
+ percentageUnanswered := percentageUnanswered / 27;
+ percentageUnanswered := percentageUnanswered * 100;
+
+ if (percentageUnanswered = 0 AND exclusionCount = 0) then
+ Exclusion_Statement_Fld1.Value := "No Exclusions" || CR || LF || "Questions unanswered = "
+ || percentageUnanswered formatted with "%.0f" || "%";
+ else
+ Exclusion_Statement_Fld4.Value := Exclusion_Statement_Fld4.Value || CR || LF || "Questions unanswered = "
+ || percentageUnanswered formatted with "%.0f" || "%";
+ endif;
+
+ endif; //CallingEvent
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_UNKNOWNLASTDOSE_TDM.mlm b/MLMStripper/bin/Debug/FORM/FORM_UNKNOWNLASTDOSE_TDM.mlm
new file mode 100644
index 0000000..6686feb
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_UNKNOWNLASTDOSE_TDM.mlm
@@ -0,0 +1,124 @@
+maintenance:
+
+ title: if Dose Unknown the last dose and time no longer mandatory;;
+ filename: FORM_UnknownLastDose_TDM;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: Eclipsys, System MLM;;
+ author: Beth Hilty and Teresa Spicuzza;;
+ specialist: ;;
+ date: 2006-03-14;;
+ validation: testing;;
+library:
+ purpose: This MLM sets the date and time of the last dose fields to not mandatory when
+ last dose unknown is checked on form.
+
+ ;;
+ explanation: This MLM sets the date and time of the last dose fields to not mandatory when
+ last dose unknown is checked on form.
+
+ The MLM is not run from a trigger event, but rather is called by the application.
+
+Change History
+ 11.01.2010 TMS Added logic for hold session - if priority is scheduled time make field not mandatory
+ allowing the order to be placed in hold without time entered. This forces the time to
+ be entered upon release.
+
+
+ ;;
+ keywords: Called MLMs, Form fields, Dose last given unknown
+ ;;
+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:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ comm_obj := this_communication.primaryobj;
+ called_by := this_communication.CallingEvent;
+ call_field := this_communication.CallingFieldName;
+
+
+ // This sets the visible control on the field dataitem - PRX_PRN_Reason
+ Unknown_Dose_field := last of (field_list
+ where field_list.DataItemName = "LAB_Chem_CB_TDM" );
+ Date_field := first of (field_list
+ where field_list.DataItemName = "LAB_Chem_Date_TDM");
+ Time_field := first of (field_list
+ where field_list.DataItemName = "LAB_Chem_Time_TDM");
+ If exists Unknown_Dose_field and Unknown_Dose_field.value=true
+
+ then
+
+ Date_field.control_mandatory := FALSE;
+
+ Time_field.control_mandatory := FALSE;
+
+ // populate the fields that can be modified on the communication object
+ // DisplayForm can be "Yes", "No", or "No Change"
+ // Message is free text
+ // MessageType can be Informational, Error, or Banner
+
+ //this_communication.DisplayForm := "Yes";
+ //this_communication.Message := "The field {{{SINGLE-QUOTE}}}"
+ // || Date_label ||"{{{SINGLE-QUOTE}}} must be completed.";
+ //this_communication.MessageType := "Banner";
+
+ else
+
+
+ Date_field.control_mandatory := TRUE;
+
+ Time_field.control_mandatory := TRUE;
+
+ endif;
+ //added for hold orders
+ requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" );
+ requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" );
+ requested_time_value := requested_time.value;
+ session_type := comm_obj.internalprocessingtype;
+
+ If (called_by = "FormOpen") or (called_by = "FieldChange") and (session_type = "Hold") then
+ If exists (requested_time) and (requested_time_value.ReqTimeCode = "Scheduled Time") then
+ requested_time.Control_mandatory := false;
+ else requested_time.Control_mandatory := true;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_URINE_CULTURE_REFLEX.mlm b/MLMStripper/bin/Debug/FORM/FORM_URINE_CULTURE_REFLEX.mlm
new file mode 100644
index 0000000..a5ab0d5
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_URINE_CULTURE_REFLEX.mlm
@@ -0,0 +1,85 @@
+maintenance:
+
+ title: Form_Urine_Culture_reflex;;
+ mlmname: Form_Urine_Culture_reflex;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St. Clair Hospital;;
+ author: Jignesh Dhandhukia;;
+ specialist: Jignesh Dhandhukia, Allscripts Corporation;;
+ date: 2011-03-08;;
+ validation: testing;;
+
+library:
+ purpose:
+ If user chooses ‘Catheter Urine’ from the first mandatory field, the next 2 fields become mandatory.
+ If user chooses ‘Clean Catch Urine’ from the first mandatory field, the next 2 fields are grayed out.
+ ;;
+ explanation:
+ An MLM is needed on this form to do the following:
+ If user chooses ‘Catheter Urine’ from the first mandatory field, the next 2 fields become mandatory.
+ If user chooses ‘Clean Catch Urine’ from the first mandatory field, the next 2 fields are grayed out.
+
+ ;;
+ keywords:
+ urine, reflex;
+
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+/**************************************************************************************/
+
+ // This MLM receives three arguments from system
+ (this_communication, // Communication object
+ this_form, // Form object
+ client_info_obj // Arden ClientInfo object
+ ) := argument;
+
+ // get calling event values from communication object
+ calling_event := this_communication.CallingEvent;
+ calling_field := this_communication.CallingFieldName;
+
+ // Assign pointer to the Field object, get field values
+ field_list := this_form.fields;
+
+
+ dependent_field1 := first of
+ (field_list where field_list.DataItemName = "LAB_SREQ_VO_CathQuestion" );
+
+
+
+ Option_field := first of
+ (field_list where field_list.DataItemName = "LAB_RC_SDES_MicroSource_UrineCulture" );
+ if exists Option_field then
+ opt_chosen := Option_field.Value;
+ endif;
+
+
+ if opt_chosen = "Urine Catheter (CATH)" then
+ dependent_field1.Control_Mandatory := true;
+ dependent_field1.Control_Read_Only := false;
+ else
+ dependent_field1.value := "";
+ dependent_field1.Control_Mandatory := false;
+ dependent_field1.Control_Read_Only := true;
+ endif;
+
+
+ ;;
+ evoke:
+
+ ;;
+ logic:
+ Conclude true;
+
+ ;;
+ action:
+ // This MLM returns communication_type and form_type parameters.
+ return this_communication, this_form;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_VALUE_IVF_IDCODE.mlm b/MLMStripper/bin/Debug/FORM/FORM_VALUE_IVF_IDCODE.mlm
new file mode 100644
index 0000000..bfbda3d
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_VALUE_IVF_IDCODE.mlm
@@ -0,0 +1,359 @@
+maintenance:
+
+ title: FORM_VALUE_IVF_IDCODE;;
+ mlmname: FORM_VALUE_IVF_IDCODE;;
+ arden: version 2;;
+ version: 4.50 ;;
+ institution: St. Clair Hospital;;
+ author: Teresa Spicuzza, St Clair Hospital ;;
+ specialist: Josue Lopez, Eclipsys Corp. ;;
+ date: 2007-01-05;;
+ validation: testing;;
+
+library:
+ purpose:
+ This MLM will evaluate the IV additive field
+ If the IV additive field is valued it will send the correct ancillary code to
+ the pharmacy system.
+ If the IV additive field is not valued the ancillary code will be valued with
+ the floorstock item number.
+ ;;
+ explanation:
+ Fields used:
+ IVAdditive - system defined compound field
+ PRX_NOIVAdditive – user defined data item -free format text
+ PRX_IV Additive – user defined data item - free format text (note space between IV and Additive)
+ PRX_DRUGIDCODE – SIM defined data item - free format text
+
+ AdminInstructions - system defined - free format text
+ PRX_NOTECOMMENT0 - user defined - free format text
+
+ Logic
+ If IVAdditive is null
+ Then PRX_DRUGIDCODE equals value of PRX_NOIVAdditive
+ Else if IVAdditive is valued
+ Then PRX_DRUGIDCODE equals vaule of PRX_IV Additive
+
+ Modification history
+ Date Author Change(s) / Notes
+ 01/05/2007 JLopez Updated maintenance slot information
+ JLopez added new required field (AdminInstructions)
+ JLopez added code for additional logic:
+ If any IV Additive description field contains "(HZ)" then
+ insert warning message into AdminInstructions field
+
+ JLopez MLM assigned to
+ OEF: PRX_IvW/Add
+ Event: FieldChange
+ Field: IVAdditive
+
+ 01/08/2007 JLopez Changed target field for message to (new field) PRX_NOTECOMMENT0.
+ Added code to capture PRX_NOTECOMMENT0 string and restore orignal
+ when no hazardous med found.
+
+ 04/27/2007 RSpence Added logic to trap for Non formulary additives, if found display
+ Information message and make medication mandatory
+
+ 06/12/2008 DWarnick Added logic display Beta Blocker message in PRX_NOTECOMMENT0 field
+ 08/05/2014 TSpicuzza Added logic to display Hazardous Waste disposal info to hidden field
+ on form. This will only display with the task and on the special notes
+ tab on veriscan to provide user administering medication with instructions
+ for Stericycle disposal method. CSR 31995
+ 03.03.2016 TMS Added call for duplicate order checking if additives added. CSR 33465
+ 07.23.2019 TMS CSR 37676 - Change log_execution_info to false per upgrade analysis.
+
+
+ ;;
+ keywords: PRX_DRUGIDCODE, Hazardous Medication
+ ;;
+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;
+
+
+
+
+ // 06.12.08 DW - created hazard and betablocker flags and initialized them to "no"
+ // - changed the initial value of the haz_med_warning from the hazardous med warning note (commented out) to a single blank.
+ // the len of this field this is used for blanking out when an additive is removed
+
+ hazardfound := "no";
+ betafound := "no";
+ BKCfound := "no";
+ SPfound := "no";
+ SPPMfound := "no";
+ Disposalfound := "no";
+ Dup_Order_Mgt_MLM := mlm {{{SINGLE-QUOTE}}}FORM_RX_MEDICATION_RETRIEVAL{{{SINGLE-QUOTE}}};
+
+ BKC_Note := "If any medication remains dispose of container in BLACK Waste Bin - NO Empty Containers";
+ SP_Note := "If any medication remains dispose of container in BLUE Waste Bin - NO Empty Containers";
+ SPPM_Note := "Dispose of container/wrapper in Blue Waste Bin - Partial and Empty container/wrapper";
+
+ haz_med_warning := " ";
+
+ // haz_med_warning := "Hazardous Drug - Precautions required - "
+ // || "Administration by Credentialed RN ONLY";
+
+
+
+
+ /***************************************************************************************/
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ /****** Place all your reading and updating here **********/
+ CallingEvent := this_communication.CallingEvent;
+ If CallingEvent="FormClose"
+ then
+ SpecialRate := last of (field_list where field_list.DataItemName = "FrequencyCode" );
+ SpecialRate_Val := SpecialRate.Value;
+ Freq_Sum := SpecialRate_Val.FrequencySummary;
+ Rate := last of (field_list where field_list.DataItemName = "OrderIVRate" );
+ Rate_Val := Rate.Value;
+ Instructions_field := last of (field_list where field_list.DataItemName = "PRX_HazDisposalMessage");
+ Instructions_value := Instructions_field.value;
+
+ If (Freq_Sum is Null)
+ then
+ Rate.Control_mandatory := True;
+ endif;
+ endif;
+
+
+ // obtain each of the possibly required fields
+ IV_additive := last of (field_list where field_list.DataItemName = "IVAdditive" );
+ PRX_additive := last of (field_list where field_list.DataItemName = "PRX_IV Additive" );
+ PRX_No_additive := last of (field_list where field_list.DataItemName = "PRX_NOIVAdditive" );
+ Drug_ID := last of (field_list where field_list.DataItemName = "PRX_DRUGIDCODE" );
+
+ Admin_Inst := first of (field_list where field_list.DataItemName = "AdminInstructions");
+
+ NF_AddName := last of (field_list where field_list.DataItemName = "PRX_NFADDNAME" ); //RS
+
+ /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+ /* added 01-08-07 JLopez - checking PRX_NOTECOMMENT0 */
+ /* for haz_med_warning message, extracting original */
+ /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+ PRX_Comment := first of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0");
+ if exists PRX_Comment then
+ found_comment := PRX_Comment.Value;
+ add_len := count(extract characters haz_med_warning);
+ if found_comment is null then
+ tot_len := 0;
+ else
+ tot_len := count(extract characters found_comment);
+ if tot_len >= add_len then
+ comment_tail := string reverse (reverse extract characters found_comment)[1 seqto add_len];
+ if comment_tail matches pattern haz_med_warning then
+ if add_len = tot_len then
+ sans_warn := null;
+ else
+ orig_len := tot_len - add_len;
+ sans_warn := string(extract characters found_comment)[1 seqto orig_len];
+ endif; // add_len = tot_len
+ endif; // comment_tail matches pattern
+ else
+ sans_warn := found_comment;
+ endif; // tot_len >= add_len
+ endif; // exists PRX_Comment
+ endif; // exists PRX_Comment
+
+ /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+ /* end of new code */
+ /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+ // if there is an IVAdditive field then obtain it{{{SINGLE-QUOTE}}}s values
+ if exists IV_additive then
+ additives_list := IV_additive.value;
+
+ // if there is any additive in the field then use PRX_additive value
+ // otherwise use the PRX_No_additive value
+ IF count additives_list > 0 then
+ Drug_ID.value := PRX_additive.Value;
+ (this_communication, this_form) := call Dup_Order_Mgt_MLM
+ with (this_communication, this_form, client_info_obj);
+ else
+ Drug_ID.value := PRX_No_additive.Value;
+ endif;
+
+ /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+ /* added 01-05-07 JLopez - checking Additives list */
+ /* for identifier "(HZ)", inserting warning message */
+ /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+ if (exist additives_list) and (count(additives_list) > 0) then
+ haz_med_found := false;
+ haz_med_names := "";
+
+ /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+ /* added 04-27-2007 RSpence - Check for NF also */
+ /* If exists, pop up reminder that NF_AddNameName */
+ /* Is becoming Mandatory, if not already filled in */
+ /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+ non_form_found := false; // RS
+
+
+
+ // examine IV additives for "(HZ)" identifier // or (NF) RS
+ for this_add in additives_list do
+ addv_guid := this_add.OrderCatalogMasterItemGUID;
+ this_add_desc := read last {"Select Description from "
+ || "CV3OrderCatalogMasterItem "
+ || "where GUID = " || SQL(addv_guid)
+ };
+
+
+
+ // 06.12.08 DW - added these routines to check for presence of of HZ and BB and present one of three possilbe messages
+
+
+ if (this_add_desc matches pattern "%(HZ)") then hazardfound := "yes"; endif;
+ if (this_add_desc matches pattern "%(BB)") then betafound := "yes"; endif;
+ if (this_add_desc matches pattern "%(BKC)") then
+ disposalfound := "yes";
+ waste_note := bkc_note;
+ endif;
+ if (this_add_desc matches pattern "%(SPPM)") then
+ disposalfound := "yes";
+ waste_note := sppm_note;
+ endif;
+ if (this_add_desc matches pattern "%(SP)") then
+ disposalfound := "yes";
+ waste_note := sp_note;
+ endif;
+
+
+
+ if (hazardfound = "yes") and (betafound = "yes") then
+ haz_med_warning := "Hazardous Drug - Precautions required - "
+ || "Administration by Credentialed RN ONLY "
+ || " "
+ || " "
+ || " **Beta Blocker";
+ endif;
+
+ if (hazardfound = "yes") and (betafound = "no") then
+ haz_med_warning := "Hazardous Drug - Precautions required - "
+ || "Administration by Credentialed RN ONLY";
+ endif;
+
+
+ if (hazardfound = "no") and (betafound = "yes") then
+ haz_med_warning := "**Beta Blocker";
+ endif;
+
+ if (disposalfound = "yes") then
+ Instructions_field.value := waste_note;
+ endif;
+
+
+// 06.12.08 DW - altered this statement to also search for BB when determining whether to populate the comments field
+
+ if (this_add_desc matches pattern "%(HZ)") or (this_add_desc matches pattern "%(BB)")
+ or (this_add_desc matches pattern "%(SP)") or (this_add_desc matches pattern "%(SPPM)")
+ or (this_add_desc matches pattern "%(BKC)")
+ then
+ haz_med_found := true;
+ if haz_med_names = "" then
+ haz_med_names := this_add.Name;
+ else
+ haz_med_names := haz_med_names || ", " || this_add.Name;
+ endif;
+ endif;
+
+
+
+ if this_add_desc matches pattern "%(NF)" then //RS
+ non_form_found := true; //RS
+ endif; //RS
+
+ enddo;
+
+ // insert warning into PRX_Comment if "(HZ)" found
+ PRX_Comment.Control_Read_Only := false;
+ if haz_med_found then
+ haz_med_names := "(" || haz_med_names || ")";
+ if sans_warn is null then
+ PRX_Comment.Value := haz_med_warning;
+ else
+ PRX_Comment.Value := sans_warn || haz_med_warning;
+ endif;
+ else
+ haz_med_names := null;
+ PRX_Comment.Value := sans_warn;
+ endif;
+
+
+ // 04-27-2007 RS, Make NF_AddName Mandatory or not, also pop up message
+
+ If non_form_found = True
+ then
+ If (NF_AddName.Value Is Null) or (NF_AddName.Value = "")
+ then
+ this_communication.DisplayForm := "Yes";
+ this_communication.Message := "You have selected a non-formulary IV additive. "||
+ "Use only for additives not found within the listing " || "\n\n" ||
+ "Verify Medication availability with Pharmacy before " ||
+ "continuing with order." || "\n\n" ||
+ "Include the name of the non-formulary Additive in the Medication " ||
+ "field on the form";
+ this_communication.MessageType := "Informational";
+ endif;
+
+ NF_AddName.control_mandatory := True;
+ NF_AddName.control_visible := TRUE;
+
+ Else
+ NF_AddName.value:="";
+ NF_AddName.control_mandatory := False;
+ NF_AddName.control_visible := False;
+ endif; // Non form
+
+
+ PRX_Comment.Control_Read_Only := true;
+
+ else // no additives in list
+
+ haz_med_found := null;
+ haz_med_names := null;
+ PRX_Comment.Control_Read_Only := false;
+ PRX_Comment.Value := sans_warn;
+ PRX_Comment.Control_Read_Only := true;
+
+ NF_AddName.value:="";
+ NF_AddName.control_mandatory := False;
+ NF_AddName.control_visible := False;
+
+
+ endif; // exist additives_list
+ /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+ /* end of new code */
+ /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+ endif;
+
+ ;;
+ evoke: // No evoke statement
+ ;;
+ logic:
+ // always concludes TRUE
+ conclude true;
+ ;;
+ action:
+ // This MLM returns two parameters, of types communication_type and form_type respectively.
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_VANCOMYCIN_AUTOSCHEDULING_TROUGH_ORDERS.mlm b/MLMStripper/bin/Debug/FORM/FORM_VANCOMYCIN_AUTOSCHEDULING_TROUGH_ORDERS.mlm
new file mode 100644
index 0000000..5a05a2d
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_VANCOMYCIN_AUTOSCHEDULING_TROUGH_ORDERS.mlm
@@ -0,0 +1,715 @@
+maintenance:
+
+ title: FORM_VANCOMYCIN_AUTOSCHEDULING_TROUGH_ORDER;;
+ mlmname: FORM_VANCOMYCIN_AUTOSCHEDULING_TROUGH_ORDERS;;
+ arden: version 2.5;;
+ version: 15.10;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law, Allscripts ;;
+ specialist: Peggy Leschak, Allscripts;;
+ date: 2016-05-05;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+
+ explanation: This MLM is called from Vancomycin Orders - Trough order set.
+
+ Change history
+ 2016.05.05 JML CSR 34155: Created
+
+ ;;
+ keywords: Called MLMs
+ ;;
+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";
+
+ // 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;
+
+ //Called MLMs
+ display_field_mlm := MLM {{{SINGLE-QUOTE}}}FORM_FUNC_DISPLAY_FORM_FIELD{{{SINGLE-QUOTE}}};
+
+ //Local session object
+ local_session := cds_session.local;
+
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := FALSE;
+
+ //Boolean to determine if first administration needs calculated
+ calc_first_admin := false;
+ //Boolean to determine if Trough order is selected
+ is_trough_selected := false;
+ admin_to_autoSched := 0;
+ is_disc_trough_next := false;
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+ ClientGuid := this_communication.ClientGUID;
+ ClientVisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGUID;
+ FormName := this_form.Name;
+ PrimaryObjDetail := this_communication.PrimaryObj;
+ OrderSetName := PrimaryObjDetail.OrderSetName;
+ isHoldSession := PrimaryObjDetail.InitialSessionTypeCode;
+
+ //Define fields
+ Trough_Requested_Date := first of ( field_list WHERE field_list.DataItemName = "RequestedDate" );
+ Trough_Requested_Time := first of ( field_list WHERE field_list.DataItemName = "RequestedTime" );
+ Trough_ReqTime_Value := Trough_Requested_Time.Value;
+ Trough_ReqTime_Value.ReqTimeCode := "Scheduled Time";
+
+ First_Admin_Chk := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_1st_Admin_CB" );
+ First_Admin_Date := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_1st_Admin_Date_TDM" );
+ First_Admin_Time := first of ( field_list WHERE field_list.DataItemname = "Lab_Chem_Dose_1st_Admin_Time_TDM" );
+
+ Second_Admin_Chk := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_2nd_Admin_CB" );
+ Second_Admin_Date := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_2nd_Admin_Date_TDM" );
+ Second_Admin_Time := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_2nd_Admin_Time_TDM" );
+
+ Third_Admin_Chk := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_3rd_Admin_CB" );
+ Third_Admin_Date := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_3rd_Admin_Date_TDM" );
+ Third_Admin_Time := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_3rd_Admin_Time_TDM" );
+
+ Fourth_Admin_Chk := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_4th_Admin_CB" );
+ Fourth_Admin_Date := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_4th_Admin_Date_TDM" );
+ Fourth_Admin_Time := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_4th_Admin_Time_TDM" );
+
+ Fifth_Admin_Chk := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_5th_Admin_CB" );
+ Fifth_Admin_Date := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_5th_Admin_Date_TDM" );
+ Fifth_Admin_Time := first of ( field_list WHERE field_list.DataItemName = "Lab_Chem_Dose_5th_Admin_Time_TDM" );
+
+ fieldLst := ( First_Admin_Chk, First_Admin_Date, First_Admin_Time,
+ Second_Admin_Chk, Second_Admin_Date, Second_Admin_Time,
+ Third_Admin_Chk, Third_Admin_Date, Third_Admin_Time,
+ Fourth_Admin_Chk, Fourth_Admin_Date, Fourth_Admin_Time,
+ Fifth_Admin_Chk, Fifth_Admin_Date, Fifth_Admin_Time
+ );
+
+ rtnValue := call display_field_mlm WITH this_communication, this_form, client_info_obj, fieldLst, true;
+
+ if ( CallingEvent = "FormOpen" OR ( CallingEvent = "FieldChange" AND NOT ( CallingField matches pattern "Lab_Chem_Dose%" ) ) ) then
+
+ //Retrieve session variable values for requested date and time on vanco ordered
+ vanco_session_date := local_session.SessionVancoTroughScheduledDate;
+ vanco_session_time_var := local_session.SessionVancoTroughScheduledTime;
+ vanco_session_time_priority := vanco_session_time_var.ReqTimeCode;
+ vanco_session_time_value := vanco_session_time_var.ReqTimeValue;
+ vanco_session_frequency := local_session.SessionVancoTroughFrequency;
+
+ if ( vanco_session_time_value IS NOT NULL ) then
+
+ //Determine if a loading dose of Vanco has been administered less than 12 hours ago
+ ( load_exists,
+ load_given,
+ load_oAdminDtm,
+ load_admin ) := READ LAST {"SELECT 1, ot.TaskStatusCode, CASE WHEN ot.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} THEN ot.PerformedFromDtm"
+ || " ELSE o.RequestedDtm END,"
+ || " CASE WHEN ot.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} THEN DateDiff(hour, ot.PerformedFromDtm, GETDATE())"
+ || " ELSE DATEDIFF(HOUR, o.RequestedDtm, GETDATE()) END"
+ || " 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 ( not exists load_exists ) then
+ //Ordering load with order set
+ //Make load the 1st administration
+ spanhourfromnow := ( ( now as Time ) + 30 minute );
+ newstarttime := ( spanhourfromnow as time );
+
+ newhr := extract hour newstarttime;
+ newhr := newhr formatted with "%2.2d";
+ newyr := extract year newstarttime;
+ newmn := extract month newstarttime;
+ newmn := newmn formatted with "%2.2d";
+ newdd := extract day newstarttime;
+ newdd := newdd formatted with "%2.2d";
+
+ filldate := ( newyr ||"-" || newmn || "-" || newdd || " 00:00" ) as time;
+ filltime := newhr || ":00";
+
+ vanco_session_date := filldate;
+ vanco_session_time_value := filltime;
+
+ elseif ( exists load_exists AND ( load_given <> "Performed" AND ( load_admin as number ) <= 8 ) OR ( load_given = "Performed" AND ( load_admin as number ) <= 12 ) ) then
+
+ spanhourfromnow := ( ( load_oAdminDtm as Time ) + 30 minute );
+ newstarttime := ( spanhourfromnow as time );
+
+ newhr := extract hour newstarttime;
+ newhr := newhr formatted with "%2.2d";
+ newyr := extract year newstarttime;
+ newmn := extract month newstarttime;
+ newmn := newmn formatted with "%2.2d";
+ newdd := extract day newstarttime;
+ newdd := newdd formatted with "%2.2d";
+
+ filldate := (newyr || "-" || newmn || "-" || newdd || " 00:00") as time;
+ filltime := newhr || ":00";
+
+ vanco_session_date := filldate;
+ vanco_session_time_value := filltime;
+ else
+
+ //No Load
+ //Determine if a Vanco has been DC{{{SINGLE-QUOTE}}}d in last 3 hours
+ ( disc_oGUID,
+ disc_osGUID ) := READ LAST {"SELECT o.GUID, o.OrderSetGUID"
+ || " 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 CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " WHERE o.NAME LIKE {{{SINGLE-QUOTE}}}VANCOMYCIN:%{{{SINGLE-QUOTE}}}"
+ || " AND o.FrequencyCode NOT IN ({{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}})"
+ || " AND o.OrderStatusCode = {{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}}"
+ || " AND cv.ClientGUID = " || SQL(ClientGUID)
+ || " AND cv.GUID = " || SQL(ClientVisitGUID)
+ || " AND cv.ChartGUID = " || SQL(ChartGUID)
+ || " AND DateDiff(HOUR, o.StopDtm, GETDATE()) <= 3"
+ || " ORDER BY o.StopDtm" };
+
+
+ if ( exists disc_oGUID ) then
+ //Retrieve old dose & frequency
+ ( disc_freq,
+ disc_dose,
+ disc_dose_uom,
+ disc_req_date,
+ disc_req_time,
+ disc_next_sched_admin) := READ LAST {"SELECT o.FrequencyCode, ot.OrderDosageLow, ot.OrderUOM, o.RequestedDate, o.RequestedTime"
+ || " , oto.ScheduledDtm"
+ || " FROM CV3Order o WITH (NOLOCK) JOIN CV3OrderTaskOccurrence oto WITH (NOLOCK)"
+ || " ON o.GUID = oto.OrderGUID"
+ || " AND o.ClientGUID = oto.ClientGUID"
+ || " JOIN CV3OrderTask ot WITH (NOLOCK)"
+ || " ON oto.OrderTaskGUID = ot.GUID"
+ || " AND oto.ClientGUID = ot.ClientGUID"
+ || " WHERE o.GUID = " || SQL(disc_oGUID)
+ || " and oto.TaskStatusCode = {{{SINGLE-QUOTE}}}canceled{{{SINGLE-QUOTE}}}"
+ ||" order by oto.ScheduledDtm" };
+
+ curr_dose := local_session.SessionVancoTroughDose;
+ curr_dose_uom := local_session.SessionVancoTroughUOM;
+ curr_freq := local_session.SessionVancoTroughFrequency;
+
+ //Check for Dose & Freq match with old v new
+ if ( ( disc_dose as string ) = ( curr_dose as string )
+ AND ( disc_dose_uom as string ) = ( curr_dose_uom as string )
+ AND ( disc_freq as string ) =( vanco_session_frequency as string ) ) then
+
+ //Retrieve trough associated with this order
+ ( disc_trough_oGUID,
+ disc_trough_req_date,
+ disc_trough_req_time,
+ disc_trough_req_dtm) := READ LAST {" SELECT o.GUID, o.RequestedDate, o.RequestedTime, o.RequestedDtm"
+ || " 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 CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " WHERE o.NAME LIKE {{{SINGLE-QUOTE}}}Vancomycin Trough Plasma/Serum%{{{SINGLE-QUOTE}}}"
+ || " AND o.OrderStatusCode = {{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}}"
+ || " AND cv.ClientGUID = " || SQL(ClientGUID)
+ || " AND cv.GUID = " || SQL(ClientVisitGUID)
+ || " AND cv.ChartGUID = " || SQL(ChartGUID)
+ || " AND o.OrderSetGUID = " || SQL(disc_osGUID) };
+
+ disc_trough_draw := ( disc_trough_req_dtm as Time ) + 30 minutes;
+ disc_vanco_next_admin := ( disc_next_sched_admin as Time );
+
+ if ( disc_trough_draw = disc_vanco_next_admin ) then
+ is_disc_trough_next := true;
+
+ //Subtract old dosing time
+ disc_time_hour := extract hour disc_next_sched_admin;
+ curr_time_hour := SUBSTRING 2 CHARACTERS FROM vanco_session_time_value;
+
+ admin_time_diff := ( ( curr_time_hour as number ) - ( disc_time_hour as number ) ) ;
+ if ( admin_time_diff < 0 ) then
+ admin_time_diff := admin_time_diff * (-1);
+ endif;
+
+ if ( admin_time_diff <= 2 ) then
+ admin_to_autosched := 1;
+ else
+ admin_to_autosched := 2;
+ endif;
+ else
+ is_disc_trough_next := false;
+
+ //Set to same admin as previous
+ (same_admin) := READ LAST { "SELECT oud.UserDataCode"
+ || " 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 CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " JOIN CV3OrderUserData oud WITH (NOLOCK)"
+ || " ON o.GUID = oud.OrderGUID"
+ || " AND o.ClientGUID = oud.ClientGUID"
+ || " WHERE o.GUID = " || SQL(disc_trough_oGUID)
+ || " AND oud.UserDataCode in ({{{SINGLE-QUOTE}}}Lab_Chem_Dose_1st_Admin_CB{{{SINGLE-QUOTE}}}"
+ || " , {{{SINGLE-QUOTE}}}Lab_Chem_Dose_2nd_Admin_CB{{{SINGLE-QUOTE}}}"
+ || " , {{{SINGLE-QUOTE}}}Lab_Chem_Dose_3rd_Admin_CB{{{SINGLE-QUOTE}}}"
+ || " , {{{SINGLE-QUOTE}}}Lab_Chem_Dose_4th_Admin_CB{{{SINGLE-QUOTE}}}"
+ || " , {{{SINGLE-QUOTE}}}Lab_Chem_Dose_5th_Admin_CB{{{SINGLE-QUOTE}}})"
+ || " AND oud.Value = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}"};
+
+ if ( same_admin = "Lab_Chem_Dose_1st_Admin_CB" ) then
+ admin_to_autoSched := 1;
+ elseif ( same_admin = "Lab_Chem_Dose_2nd_Admin_CB" ) then
+ admin_to_autoSched := 2;
+ elseif ( same_admin = "Lab_Chem_Dose_3rd_Admin_CB" ) then
+ admin_to_autoSched := 3;
+ elseif ( same_admin = "Lab_Chem_Dose_4th_Admin_CB" ) then
+ admin_to_autoSched := 4;
+ elseif ( same_admin = "Lab_Chem_Dose_5th_Admin_CB" ) then
+ admin_to_autoSched := 5;
+ else
+ admin_to_autoSched := 0;
+ endif;
+
+ endif; //Determine admin to schedule
+ endif; //Dose & Freq match on disc. vanco
+ endif; //Disc. Vanco exists
+ endif; //Vanco load exists
+
+ //***** 1ST ADMIN DATE + TIME *****
+ First_Admin_Date.Value := ( vanco_session_date as Time );
+ First_Admin_Time.Value := vanco_session_time_value;
+
+ //***** 2ND ADMIN DATE + TIME *****
+ x_num := SUBSTRING 2 CHARACTERS STARTING AT 2 FROM ( vanco_session_frequency as String );
+ frequencyNum := ( x_num as number );
+
+ firstAdmin_Hour := (extract hour ( First_Admin_Time.Value as Time ) ) as number;
+ secondAdmin_Min := ( extract minute ( First_Admin_Time.Value as Time ) ) as number;
+ if ( secondAdmin_Min = 0 ) then
+ secondAdmin_Min := "00";
+ endif;
+
+ secondAdmin_Hour := firstAdmin_Hour + (frequencyNum as number);
+
+ firstDate_converted := ( First_Admin_Date.Value as Time );
+ sec_admin_month := SUBSTRING 2 CHARACTERS From ( firstDate_converted as string );
+ sec_admin_day := Substring 2 Characters starting at 4 from ( firstDate_converted as string );
+ sec_admin_year := substring 4 characters starting at 7 from ( firstDate_converted as string );
+ sec_admin_dtm := sec_admin_year || "-" || sec_admin_month || "-" || sec_admin_day || "T00:01:00";
+
+ sec_admin := sec_admin_dtm as Time;
+
+ if ( secondAdmin_Hour < 24 ) then
+ Second_Admin_Date.Value := sec_admin;
+ if ( secondAdmin_Hour >= 1 AND secondAdmin_Hour <= 9 ) then
+ Second_Admin_Time.Value := "0" || secondAdmin_Hour || ":" || secondAdmin_Min;
+ else
+ Second_Admin_Time.Value := secondAdmin_Hour || ":" || secondAdmin_Min;
+ endif;
+ elseif ( secondAdmin_Hour > 24 ) then
+
+ if ( frequencyNum > 24 ) then
+ secondAdmin_Hour := ( secondAdmin_Hour - ( frequencyNum as number ) ) as number;
+ Second_Admin_Date.Value := sec_admin + 2 days;
+ else
+ secondAdmin_Hour := ( secondAdmin_Hour - 24 ) as number;
+ Second_Admin_Date.Value := sec_admin + 1 day;
+ endif;
+
+ if ( secondAdmin_Hour >= 1 AND secondAdmin_Hour <= 9 ) then
+ Second_Admin_Time.Value := "0" || secondAdmin_Hour || ":" || secondAdmin_Min;
+ else
+ Second_Admin_Time.Value := secondAdmin_Hour || ":" || secondAdmin_Min;
+ endif;
+
+ elseif ( secondAdmin_Hour = 24 ) then
+ Second_Admin_Date.Value := sec_admin + 1 day;
+ Second_Admin_Time.Value := "00:" || secondAdmin_Min;
+ endif;
+
+ //***** 3RD ADMIN DATE + TIME *****
+ if ( secondAdmin_Hour = 24 ) then
+ hour_value := 0;
+ else
+ hour_value := secondAdmin_Hour;
+ endif;
+ thirdAdmin_Hour := hour_value + ( frequencyNum as number );
+
+ thirdAdmin_Min := secondAdmin_Min;
+
+ secondDate_converted := ( Second_Admin_Date.Value as Time );
+ third_admin_month := Substring 2 Characters From ( secondDate_converted as string );
+ third_admin_day := Substring 2 Characters Starting at 4 From ( secondDate_converted as string );
+ third_admin_year := Substring 4 Characters Starting at 7 From ( secondDate_converted as string );
+
+ third_admin_dtm := third_admin_year || "-" || third_admin_month || "-" || third_admin_day || "T00:01:00";
+
+ third_admin := third_admin_dtm as Time;
+
+ if ( thirdAdmin_Hour < 24 ) then
+ Third_Admin_Date.Value := Second_Admin_Date.Value;
+ if ( thirdAdmin_Hour >= 1 AND thirdAdmin_Hour <= 9 ) then
+ Third_Admin_Time.Value := "0" || thirdAdmin_Hour || ":" || thirdAdmin_Min;
+ else
+ Third_Admin_Time.Value := thirdAdmin_Hour || ":" || thirdAdmin_Min;
+ endif;
+
+ elseif ( thirdAdmin_Hour > 24 ) then
+
+ if ( frequencyNum > 24 ) then
+ thirdAdmin_Hour := ( thirdAdmin_Hour - ( frequencyNum as number ) ) as number;
+ Third_Admin_Date.Value := third_admin + 2 days;
+ else
+ thirdAdmin_Hour := ( thirdAdmin_Hour - 24 ) as number;
+ Third_Admin_Date.Value := third_admin + 1 day;
+
+ endif;
+
+ if ( thirdAdmin_Hour >= 1 AND thirdAdmin_Hour <= 9 ) then
+ Third_Admin_Time.Value := "0" || thirdAdmin_Hour || ":" || thirdAdmin_Min;
+ else
+ Third_Admin_Time.Value := thirdAdmin_Hour || ":" || thirdAdmin_Min;
+ endif;
+ elseif ( thirdAdmin_Hour = 24 ) then
+ Third_Admin_Date.Value := third_admin + 1 day;
+ Third_Admin_Time.Value := "00:" || thirdAdmin_Min;
+ endif;
+
+ //***** 4TH ADMIN DATE + TIME *****
+ if ( thirdAdmin_Hour = 24 ) then
+ hour_value := 0;
+ else
+ hour_value := thirdAdmin_Hour;
+ endif;
+
+ fourthAdmin_Hour := hour_value + ( frequencyNum as number );
+
+ fourthAdmin_Min := secondAdmin_Min;
+
+ thirdDate_converted := ( Third_Admin_Date.Value as Time );
+ fourth_admin_month := Substring 2 Characters From ( thirdDate_converted as string );
+ fourth_admin_day := Substring 2 Characters Starting at 4 From ( thirdDate_converted as string );
+ fourth_admin_year := Substring 4 Characters Starting at 7 From ( thirdDate_converted as string );
+
+ fourth_admin_dtm := fourth_admin_year || "-" || fourth_admin_month || "-" || fourth_admin_day || "T00:01:00";
+
+ fourth_admin := fourth_admin_dtm as Time;
+
+ if ( fourthAdmin_Hour < 24 ) then
+ Fourth_Admin_Date.Value := fourth_admin;
+ if ( fourthAdmin_Hour >= 1 AND fourthAdmin_Hour <= 9 ) then
+ Fourth_Admin_Time.Value := "0" || fourthAdmin_Hour || ":" || fourthAdmin_Min;
+ else
+ Fourth_Admin_Time.Value := fourthAdmin_Hour || ":" || fourthAdmin_Min;
+ endif;
+
+ elseif ( fourthAdmin_Hour > 24 ) then
+
+ if ( frequencyNum > 24 ) then
+ fourthAdmin_Hour := ( fourthAdmin_Hour - ( frequencyNum as number ) ) as number;
+ Fourth_Admin_Date.Value := fourth_admin + 2 days;
+ else
+ fourthAdmin_Hour := ( fourthAdmin_Hour - 24 ) as number;
+ Fourth_Admin_Date.Value := fourth_admin + 1 day;
+ endif;
+
+ if ( fourthAdmin_Hour >= 1 AND fourthAdmin_Hour <= 9 ) then
+ Fourth_Admin_Time.Value := "0" || fourthAdmin_Hour || ":" || fourthAdmin_Min;
+ else
+ Fourth_Admin_Time.Value := fourthAdmin_Hour || ":" || fourthAdmin_Min;
+ endif;
+ elseif ( fourthAdmin_Hour = 24 ) then
+ Fourth_Admin_Date.Value := fourth_admin + 1 day;
+ Fourth_Admin_Time.Value := "00:" || fourthAdmin_Min;
+ endif;
+
+ //Logic to handle autoscheduling 4th administration
+ if ( admin_to_autoSched = 0 ) then
+ if ( ( ( fourthAdmin_Hour as number ) >= 5 AND ( fourthAdmin_Hour as number ) <= 18 ) OR ( frequencyNum >= 24 ) ) then
+ admin_to_autoSched := 4;
+ else
+ admin_to_autoSched := 5;
+ endif;
+ endif;
+
+ //***** 5TH ADMIN DATE + TIME *****
+ if ( fourthAdmin_Hour = 24 ) then
+ hour_value := 0;
+ else
+ hour_value := fourthAdmin_Hour;
+ endif;
+
+ fifthAdmin_Hour := hour_value + ( frequencyNum as number );
+
+ fifthAdmin_Min := secondAdmin_Min;
+
+ fourthDate_converted := ( Fourth_Admin_Date.Value as Time );
+ fifth_admin_month := Substring 2 Characters From ( fourthDate_converted as string );
+ fifth_admin_day := Substring 2 Characters Starting at 4 From ( fourthDate_converted as string );
+ fifth_admin_year := Substring 4 Characters Starting at 7 From ( fourthDate_converted as string );
+
+ fifth_admin_dtm := fifth_admin_year || "-" || fifth_admin_month || "-" || fifth_admin_day || "T00:01:00";
+
+ fifth_admin := fifth_admin_dtm as Time;
+
+ if ( fifthAdmin_Hour < 24 ) then
+ Fifth_Admin_Date.Value := fifth_admin;
+ if ( fifthAdmin_Hour >= 1 AND fifthAdmin_Hour <= 9 ) then
+ Fifth_Admin_Time.Value := "0" || fifthAdmin_Hour || ":" || fifthAdmin_Min;
+ else
+ Fifth_Admin_Time.Value := fifthAdmin_Hour || ":" || fifthAdmin_Min;
+ endif;
+
+ elseif ( fifthAdmin_Hour > 24 ) then
+
+ if ( frequencyNum > 24 ) then
+ fifthAdmin_Hour := ( fifthAdmin_Hour - ( frequencyNum as number ) ) as number;
+ Fifth_Admin_Date.Value := fifth_admin + 2 days;
+ else
+ fifthAdmin_Hour := ( fifthAdmin_Hour - 24 ) as number;
+ Fifth_Admin_Date.Value := fifth_admin + 1 day;
+ endif;
+
+ if ( fifthAdmin_Hour >= 1 AND fifthAdmin_Hour <= 9 ) then
+ Fifth_Admin_Time.Value := "0" || fifthAdmin_Hour || ":" || fifthAdmin_Min;
+ else
+ Fifth_Admin_Time.Value := fifthAdmin_Hour || ":" || fifthAdmin_Min;
+ endif;
+ elseif ( fifthAdmin_Hour = 24 ) then
+ Fifth_Admin_Date.Value := fifth_admin + 1 day;
+ Fifth_Admin_Time.Value := "00:" || fifthAdmin_Min;
+ endif;
+
+ //Logic to autoselect trough time
+ if ( admin_to_autoSched = 1 ) then
+ First_Admin_Chk.Value := true;
+
+ Second_Admin_Chk.Value := false;
+ Third_Admin_Chk.Value := false;
+ Fourth_Admin_Chk.Value := false;
+ Fifth_Admin_Chk.Value := false;
+
+ dynamic_field_date := First_Admin_Date.Value;
+ dynamic_field_time := First_Admin_Time.Value;
+ elseif ( admin_to_autoSched = 2 ) then
+ Second_Admin_Chk.Value := true;
+
+ First_Admin_Chk.Value := false;
+ Third_Admin_Chk.Value := false;
+ Fourth_Admin_Chk.Value := false;
+ Fifth_Admin_Chk.Value := false;
+
+ dynamic_field_date := Second_Admin_Date.Value;
+ dynamic_field_time := Second_Admin_Time.Value;
+ elseif ( admin_to_autoSched = 3 ) then
+ Third_Admin_Chk.Value := true;
+
+ First_Admin_Chk.Value := false;
+ Second_Admin_Chk.Value := false;
+ Fourth_Admin_Chk.Value := false;
+ Fifth_Admin_Chk.Value := false;
+
+ dynamic_field_date := Third_Admin_Date.Value;
+ dynamic_field_time := Third_Admin_Time.Value;
+ elseif ( admin_to_autoSched = 4 ) then
+ Fourth_Admin_Chk.Value := true;
+
+ First_Admin_Chk.Value := false;
+ Second_Admin_Chk.Value := false;
+ Third_Admin_Chk.Value := false;
+ Fifth_Admin_Chk.Value := false;
+
+ dynamic_field_date := Fourth_Admin_Date.Value;
+ dynamic_field_time := Fourth_Admin_Time.Value;
+ elseif ( admin_to_autoSched = 5 ) then
+ Fifth_Admin_Chk.Value := true;
+
+ First_Admin_Chk.Value := false;
+ Second_Admin_Chk.Value := false;
+ Third_Admin_Chk.Value := false;
+ Fourth_Admin_Chk.Value := false;
+
+ dynamic_field_date := Fifth_Admin_Date.Value;
+ dynamic_field_time := Fifth_Admin_Time.Value;
+ endif;
+
+ Trough_Requested_Date.Value := dynamic_field_date;
+ if ( isHoldSession = "Hold" ) then
+ Trough_ReqTime_Value.ReqTimeValue := "";
+ else
+ a := ( dynamic_field_time as Time ) - 30 minutes;
+ b := extract hour a;
+ if ( b >= 1 AND b <= 9 ) then
+ b := "0" || b;
+ endif;
+ c := b || ":" || extract minute a;
+ Trough_ReqTime_Value.ReqTimeValue := c;
+ endif;
+
+ endif; //End Scheduled Time is null
+ endif; //End CallingEvent
+
+ //Handle user changing selected administration time
+ if ( CallingEvent = "FieldChange" ) then
+ uncheck_fields_lst := ( First_Admin_Chk, Second_Admin_Chk, Third_Admin_Chk,
+ Fourth_Admin_Chk, Fifth_Admin_Chk
+ );
+
+ if ( CallingField = "Lab_Chem_Dose_1st_Admin_CB" ) then
+
+ if ( First_Admin_Chk.Value = true ) then
+
+ for i IN 1 seqto count uncheck_fields_lst do
+ if ( uncheck_fields_lst[i].DataItemName <> CallingField ) then
+ uncheck_fields_lst[i].Value := false;
+ endif;
+ enddo;
+
+ Trough_Requested_Date.Value := First_Admin_Date.Value;
+ a := ( First_Admin_Time.Value as Time ) - 30 minutes;
+ b := extract hour a;
+ if ( b >= 1 and b <= 9 ) then
+ b := "0" || b;
+ endif;
+ c := b || ":" || extract minute a;
+
+ Trough_ReqTime_Value.ReqTimeValue := c;
+ endif;
+ endif;
+
+ if ( CallingField = "Lab_Chem_Dose_2nd_Admin_CB" ) then
+ if ( Second_Admin_Chk.Value = true ) then
+
+ for i IN 1 seqto count uncheck_fields_lst do
+ if ( uncheck_fields_lst[i].DataItemName <> CallingField ) then
+ uncheck_fields_lst[i].Value := false;
+ endif;
+ enddo;
+
+ Trough_Requested_Date.Value := Second_Admin_Date.Value;
+ a := ( Second_Admin_Time.Value as Time ) - 30 minutes;
+ b := extract hour a;
+ if ( b >= 1 and b <= 9 ) then
+ b := "0" || b;
+ endif;
+ c := b || ":" || extract minute a;
+
+ Trough_ReqTime_Value.ReqTimeValue := c;
+ endif;
+ endif;
+
+ if ( CallingField = "Lab_Chem_Dose_3rd_Admin_CB" ) then
+ if ( Third_Admin_Chk.Value = true ) then
+
+ for i IN 1 seqto count uncheck_fields_lst do
+ if ( uncheck_fields_lst[i].DataItemName <> CallingField ) then
+ uncheck_fields_lst[i].Value := false;
+ endif;
+ enddo;
+
+ Trough_Requested_Date.Value := Third_Admin_Date.Value;
+ a := ( Third_Admin_Time.Value as Time ) - 30 minutes;
+ b := extract hour a;
+ if ( b >= 1 and b <= 9 ) then
+ b := "0" || b;
+ endif;
+ c := b || ":" || extract minute a;
+
+ Trough_ReqTime_Value.ReqTimeValue := c;
+ endif;
+ endif;
+
+ if ( CallingField = "Lab_Chem_Dose_4th_Admin_CB" ) then
+ if ( Fourth_Admin_Chk.Value = true ) then
+
+ for i IN 1 seqto count uncheck_fields_lst do
+ if ( uncheck_fields_lst[i].DataItemName <> CallingField ) then
+ uncheck_fields_lst[i].Value := false;
+ endif;
+ enddo;
+
+ Trough_Requested_Date.Value := Fourth_Admin_Date.Value;
+ a := ( Fourth_Admin_Time.Value as Time ) - 30 minutes;
+ b := extract hour a;
+ if ( b >= 1 and b <= 9 ) then
+ b := "0" || b;
+ endif;
+ c := b || ":" || extract minute a;
+
+ Trough_ReqTime_Value.ReqTimeValue := c;
+ endif;
+ endif;
+
+ if ( CallingField = "Lab_Chem_Dose_5th_Admin_CB" ) then
+ if ( Fifth_Admin_Chk.Value = true ) then
+
+ for i IN 1 seqto count uncheck_fields_lst do
+ if ( uncheck_fields_lst[i].DataItemName <> CallingField ) then
+ uncheck_fields_lst[i].Value := false;
+ endif;
+ enddo;
+
+ Trough_Requested_Date.Value := Fifth_Admin_Date.Value;
+ a := ( Fifth_Admin_Time.Value as Time ) - 30 minutes;
+ b := extract hour a;
+ if ( b >= 1 and b <= 9 ) then
+ b := "0" || b;
+ endif;
+ c := b || ":" || extract minute a;
+
+ Trough_ReqTime_Value.ReqTimeValue := c;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_VANCOMYCIN_PEAK_PLASMA_CONDITIONAL.mlm b/MLMStripper/bin/Debug/FORM/FORM_VANCOMYCIN_PEAK_PLASMA_CONDITIONAL.mlm
new file mode 100644
index 0000000..6de9f8f
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_VANCOMYCIN_PEAK_PLASMA_CONDITIONAL.mlm
@@ -0,0 +1,109 @@
+maintenance:
+
+ title: FORM_VANCOMYCIN_PEAK_PLASMA_CONDITIONAL ;;
+ mlmname: FORM_VANCOMYCIN_PEAK_PLASMA_CONDITIONAL ;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Shivprasad Jadhav, Allscripts ;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-03-24;;
+ validation: testing;;
+
+library:
+ purpose: 24-03-2015 csr:32240 - Created
+ ;;
+
+ explanation: MLM is attached to Conditional Order Check to Manipulate Mandatory property of Priority/Scheduled Time.
+
+
+
+
+ ;;
+ keywords: Called MLMs
+ ;;
+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";
+
+ HoldOrder_RequestedTime := mlm {{{SINGLE-QUOTE}}}FORM_HOLDORDER_REQUESTEDTIME{{{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;
+
+ comm_obj := this_communication.primaryobj;
+ called_by := this_communication.CallingEvent;
+ call_field := this_communication.CallingFieldName;
+
+ /* Set to true if a decision.log is needed.*/
+ log_execution_info := FALSE;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+ (this_parameters) := this_communication.ParametersList;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ FormName := this_form.Name;
+
+ Prm_Conditional := First of (field_list where field_list.DataItemName = "ConditionalOrder" );
+ Prm_PriorityTime_New := First of (field_list where field_list.DataItemName = "LAB_Order Priorities" );
+ Prm_PriorityTime := First of (field_list where field_list.DataItemName = "RequestedTime" );
+
+
+// Prm_Conditional.Value.Reason := "2 hr Post Transfusion, Post Transfusion, Following Heparin Rate Change, Following Medication Administration" ;
+// Prm_Conditional.Value.Number := 1 ;
+
+
+
+ If this_form.Name ="LAB Chemistry Peak" Then
+ if comm_obj.Name in ( "Vancomycin Peak Plasma/Serum" ,"Tobramycin Peak Plasma/Serum","Gentamicin Peak Plasma/Serum" ) Then //comm_obj.Modifier = -Conditional order
+
+ If Prm_Conditional.Value.IsConditional = True Then
+ If comm_obj.Modifier = "-RN to Schedule" Then
+ Prm_PriorityTime.Control_Mandatory := False;
+ Prm_PriorityTime_New.Control_Mandatory := False;
+ Prm_Conditional.Value.Number := 2 ;
+ Endif;
+ Prm_Conditional.Value.Reason := "Recommended Collection Protocol: Peak- Collect 30 Minutes Post IV or 60 Minutes Post IM Injection" ;
+ //Prm_Conditional.Value.Number := ;
+
+
+ Else
+ If comm_obj.Modifier = "-RN to Schedule" Then
+ Prm_PriorityTime.Control_Mandatory := True; //Prm_PriorityTime.Control_Mandatory
+ Prm_PriorityTime_New.Control_Mandatory := True ;
+ Endif;
+ Prm_Conditional.Value.Reason := "Recommended Collection Protocol: Peak- Collect 30 Minutes Post IV or 60 Minutes Post IM Injection";
+ //Prm_Conditional.Value.Number := 1 ;
+
+ EndIf;
+ EndIf;
+ EndIf;
+
+ ;;
+ evoke: // No evoke statement
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+ return this_communication, this_form;
+
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_VANCOMYCIN_WTBASED.mlm b/MLMStripper/bin/Debug/FORM/FORM_VANCOMYCIN_WTBASED.mlm
new file mode 100644
index 0000000..c109e7d
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_VANCOMYCIN_WTBASED.mlm
@@ -0,0 +1,664 @@
+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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_VITAL_SIGN_FREQUENCY.mlm b/MLMStripper/bin/Debug/FORM/FORM_VITAL_SIGN_FREQUENCY.mlm
new file mode 100644
index 0000000..15954b8
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_VITAL_SIGN_FREQUENCY.mlm
@@ -0,0 +1,91 @@
+maintenance:
+
+ title: ;;
+ mlmname: FORM_VITAL_SIGN_FREQUENCY;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St.Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: Janet Nordin ;;
+ date: 2017-07-14;;
+ validation: testing;;
+
+library:
+ purpose: Send the value {{{SINGLE-QUOTE}}}Routine{{{SINGLE-QUOTE}}} to the column {{{SINGLE-QUOTE}}}VS Frequency{{{SINGLE-QUOTE}}} in Patient list Department: IMC and view: IMC CNA. If the order selected is {{{SINGLE-QUOTE}}}Vital Signs: Routine{{{SINGLE-QUOTE}}} then send the value {{{SINGLE-QUOTE}}}Routine{{{SINGLE-QUOTE}}} to the column.
+ This lets the CNA know to routinely monitor the patient{{{SINGLE-QUOTE}}}s vital sign.
+ ;;
+ explanation:
+
+ Change History
+
+ 07.14.2017 SZ CSR#35481 - MEWS Score Column Update - lumped into same project on status boards
+
+ ;;
+ keywords: vital signs frequency, vital signs order, VS frequency column
+ ;;
+ citations: Model: DOC_SEPSIS_STATUS_BOARD_COLUMN_ED
+ ;;
+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";
+
+ // 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;
+
+ // grab relevant guids
+ ClientGuid := this_communication.ClientGUID;
+ ChartGuid := this_Communication.ChartGUID;
+ UserGuid := this_communication.UserGUID;
+ VisitGuid := this_communication.ClientVisitGUID;
+ comm_obj := this_communication.primaryobj;
+
+ form_fields := this_form.Fields;
+
+ (frequency_field) := first(form_fields where form_fields.label = "Frequency");
+ (frequency_field_value) := first(frequency_field.value.FrequencySummary where frequency_field.label = "Frequency");
+
+ // if the order selected is {{{SINGLE-QUOTE}}}Vital Signs: Routine{{{SINGLE-QUOTE}}} then send the value {{{SINGLE-QUOTE}}}Routine{{{SINGLE-QUOTE}}} to the column
+ if (comm_obj.Name = "Vital Signs: Routine") then
+ frequency_field_value := "Routine";
+ endif;
+
+ IF(frequency_field_value is not NULL OR frequency_field_value Is nOt "") THEN // added By Shami
+ // send the total MEWS score to the column
+ create_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}}; // MLM that creates the Enterprise Defined Column in the "Action" section of the MLM
+ EDCObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
+
+ VS_frequency_column:= NEW EDCObj WITH
+ [
+ column_name := "Vital Signs Frequency",
+ column_value := frequency_field_value,
+ client_guid := ClientGUID,
+ chart_guid := ChartGUID,
+ client_visit_guid := VisitGuid
+ ];
+
+ return_value := call create_column with ( VS_frequency_column );
+ ENDIF;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_VTE_SCHEDULING.mlm b/MLMStripper/bin/Debug/FORM/FORM_VTE_SCHEDULING.mlm
new file mode 100644
index 0000000..cd2b975
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_VTE_SCHEDULING.mlm
@@ -0,0 +1,545 @@
+maintenance:
+
+ title: FORM_VTE_SCHEDULING ;;
+ mlmname: FORM_VTE_SCHEDULING;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: St.Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: ;;
+ date: 2017-10-26;;
+ validation: testing;;
+
+library:
+ purpose: Automatic scheduling of VTE Prophylaxis Meds (enoxaparin 30mg Q12 and Q24, enoxaparin 40mg Q24H, heparin, and rivaroxaban 10mg)
+ ;;
+ explanation:
+
+ Change history
+ 10.26.2017 SZ Created for CSR #33689 - CPOE-VTE auto schedule
+
+ ;;
+ keywords: Automatic Medication Scheduling, VTE Scheduling
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ (this_communication,this_form,client_info_obj) := argument;
+
+
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+
+ error_message:="";
+ field_list := this_form.fields;
+
+ comm_primary_obj := this_communication.PrimaryObj;
+ order_set_name := comm_primary_obj.OrderSetName;
+ order_name := comm_primary_obj.Name;
+ continue_processing := false;
+
+ // Restrict who sees the "valdation" alerts
+ userguid := this_communication.userguid;
+ useridcode:= read last {" Select idcode from cv3user with (nolock) where guid = " || SQL(userguid)};
+ FireOnUser:= ("tspicuzzatest","dwarnicktest","ageorgulistest","dbellissimotest");
+
+
+ ClientGuid := this_communication.ClientGUID;
+ VisitGuid := this_communication.ClientVisitGUID;
+ ChartGuid := this_communication.ChartGuid;
+ CallingEvent := this_communication.CallingEvent;
+ CallingField := this_communication.CallingFieldName;
+
+ CurrentMinute:= extract minute NOW;
+ CurrentHour := extract hour NOW;
+ NextHour := extract hour NOW + 1;
+ HourAfterNext:= extract hour NOW + 2;
+
+ Included_Orders := ("Heparin Inj", "Enoxaparin Inj", "Rivaroxaban 10mg Tab");
+
+
+
+ // GATHER INFORMATION ABOUT THIS ORDER
+ Frequency := last of (field_list where field_list.DataItemName = "frequencycode");
+ FrequencyValue := Frequency.Value;
+ Route := last of (field_list where field_list.DataItemName = "orderroutecode");
+ RouteValue := Route.Value;
+ RequestedTime:= last of (field_list where field_list.DataItemName = "RequestedTime");
+ RequestedTimeValue := RequestedTime.value;
+ RequestedDate:= last of (field_list where field_list.DataItemName = "RequestedDate");
+ Dose:= last of (field_list where field_list.DataItemName = "DosageLow");
+ UOM:= last of (field_list where field_list.DataItemName = "Uom");
+
+ if (order_name = "Heparin Inj") and (Route.Value = "SQ") and (FrequencyValue.FrequencySummary = "Q8H" or FrequencyValue.FrequencySummary = "Q12H" or FrequencyValue.FrequencySummary = "Q6H") and (uom.Value = "units") then
+ continue_processing := true;
+ found_heparin := "yay we found heparin SQ 5000 units Q8 or Q12";
+ endif;
+
+ if (order_name = "Enoxaparin Inj") and (Route.Value = "SQ") and (FrequencyValue.FrequencySummary = "Q24H") and (dose.Value = 40) and (uom.Value = "mg") then
+ continue_processing := true;
+ found_enoxaparin_40 := "yay we found enoxaparin SQ 40mg Q24";
+ endif;
+
+ if (order_name = "Enoxaparin Inj") and (Route.Value = "SQ") and (FrequencyValue.FrequencySummary = "Q12H" or FrequencyValue.FrequencySummary = "Q24H") and (dose.Value = 30) and (uom.Value = "mg") then
+ continue_processing := true;
+ found_enoxaparin_30 := "yay we found enoxaparin SQ 30mg Q12 or Q24";
+ endif;
+
+ if (order_name = "Rivaroxaban 10mg Tab") and (FrequencyValue.FrequencySummary = "Q24H") then
+ continue_processing := true;
+ found_rivaroxaban_10 := "yay we found rivaroxaban 10mg Q24";
+ endif;
+
+
+
+
+
+if ( continue_processing = true ) then
+
+ checkpoint_1 := "continue_processing = true";
+
+ // insert time when form is closing and there{{{SINGLE-QUOTE}}}s NO scheduled time
+ If (CallingEvent = "FormClose") and (not exist RequestedTimeValue.ReqTimeValue) then
+
+ checkpoint_2 := "form is closing and there{{{SINGLE-QUOTE}}}s NO scheduled time";
+
+
+ // Gather information about the drug
+ (DrugKey, TherapeuticCategory, ExcludedClassType, PrimaryTherapeuticCategory) := read last
+ {
+ " select dm.DrugKey, ocmi.TherapeuticCategory , "
+ || " ( select top 1 ctv.Value "
+ || " from cv3catalogclasstypevalue ctv with (nolock) "
+ || " join CV3ClassType ct on ct.guid = ctv.ClassTypeGUID and ct.code = {{{SINGLE-QUOTE}}}PRX_AutoSched_Exclude_for_MLM{{{SINGLE-QUOTE}}} and ct.UserDictionaryCode = {{{SINGLE-QUOTE}}}Medication_Auto_Scheduling{{{SINGLE-QUOTE}}} "
+ || " where ctv.Value = {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} and ctv.catalogmasterguid = " || this_communication.ItemID || " ) "
+ || " ,case when CHARINDEX ({{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}},ocmi.TherapeuticCategory) > 0 "
+ || " then substring (ocmi.TherapeuticCategory, 1, CHARINDEX ({{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}},ocmi.TherapeuticCategory)-2)"
+ || " else ocmi.TherapeuticCategory "
+ || " end "
+ || " from CV3OrderCatalogMasterItem ocmi with (nolock) "
+ || " join cv3drugmapping dm with (nolock) on dm.catalogitemguid = ocmi.guid "
+ || " where ocmi.guid = " || this_communication.ItemID || " "
+ };
+
+
+ // Gather information about the frequency
+ // Determine Frequency Interval ( "Q3H" = "3" & "hr(s)" )
+ (FrequencyInterval,FrequencyTimeUOM) := read last
+ {
+ " select timefromvalue,TimeUom from CV3Frequency with (nolock) "
+ || " where code = {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "{{{SINGLE-QUOTE}}}"
+ };
+
+ // Determine if it is a QxH Frequency
+ If FrequencyValue.FrequencySummary matches pattern "Q%H" then
+ FrequencyQxH := "Yes";
+ else
+ FrequencyQxH := "No";
+ endif;
+
+ // Determine Schedule Type ("A" = "Fixed" start time...BID,QHS etc... "S" = "Variable" start time....Q4H, Q8H etc...)
+ ScheduleType := read last
+ {
+ " select case when SUBSTRING(value,CHARINDEX({{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}},Value)+1,LEN(1)) = {{{SINGLE-QUOTE}}}A{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Fixed{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}Variable{{{SINGLE-QUOTE}}} end "
+ || " from CV3UserDictionaryValue with (nolock) "
+ || " WHERE UserDictionaryCode = {{{SINGLE-QUOTE}}}PRX_Dosing Frequency{{{SINGLE-QUOTE}}} AND Active = 1 AND Value like {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "%{{{SINGLE-QUOTE}}} "
+ };
+
+ // Convert the Frequency Code to Doses Per Day
+ (DosesPerDay) := read last
+ {
+ " select count (fsd.ScheduledTime) from CV3CodedFreqTranslation cft with (nolock) "
+ || " join CV3FixedScheduleDefinition fsd with (nolock) on fsd.ParentGUID = cft.guid "
+ || " where cft.FrequencyCode = {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "{{{SINGLE-QUOTE}}} and "
+ || " FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.active = 1 "
+ };
+
+ // For the selected Frequency, find the first dose of the day and next scheduled dose today
+ (NextScheduledDoseTomorrow,NextScheduledDoseToday) := read last
+ {
+ " select top 1 "
+ || " (select top 1 fsdx.ScheduledTime from CV3FixedScheduleDefinition fsdx with (nolock) where fsdx.ParentGUID = cft.guid "
+ || " order by fsdx.ScheduledTime), "
+ || " (select top 1 fsdy.ScheduledTime from CV3FixedScheduleDefinition fsdy with (nolock) where fsdy.ParentGUID = cft.guid "
+ || " and fsdy.ScheduledTime > REPLACE(CONVERT(VARCHAR(5), GETDATE(), 108), {{{SINGLE-QUOTE}}}:{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) "
+ || " order by fsdy.ScheduledTime ) "
+ || " from CV3CodedFreqTranslation cft with (nolock) "
+ || " join CV3FixedScheduleDefinition fsd with (nolock) on fsd.ParentGUID = cft.guid "
+ || " where cft.FrequencyCode = {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "{{{SINGLE-QUOTE}}} and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.active = 1 "
+ };
+
+ // If there are no more scheduled doses for today, use the first scheduled dose tomorrow
+ If NextScheduledDoseToday is not null then
+ NextScheduledDoseTime:= NextScheduledDoseToday;
+ NextScheduledDoseDay := "today";
+ NextScheduledDoseDate:= (Now) FORMATTED WITH "%.2t";
+ else
+ NextScheduledDoseTime:= NextScheduledDoseTomorrow;
+ NextScheduledDoseDay := "tomorrow";
+ NextScheduledDoseDate:= (Now + 1 day) FORMATTED WITH "%.2t";
+ endif;
+
+ // format from 1600 to 16:00 and 900 to 09:00
+ NextScheduledDoseTime:= NextScheduledDoseTime formatted with "%4.4d"; // Zero Pad to 4 characters (900 becomes 0900)
+ NextScheduledDoseTime:= (SUBSTRING 2 CHARACTERS STARTING AT 1 FROM NextScheduledDoseTime) || ":" || // hours
+ (SUBSTRING 2 CHARACTERS STARTING AT 3 FROM NextScheduledDoseTime); // minutes
+
+
+
+// -------------------------------------## Main Algorithm ##--------------------------------------------------
+ // ------------------ CHECK #1 ------------------
+ // Proceed if this is not a "one-time" order and not in a Hold session
+ If (FrequencyInterval is not null and
+ ScheduleType is not null and
+ worksheetinfo.sessiontype <> "Hold" ) then
+
+ checkpoint_3 := "order is not a one-time order and not in a Hold session";
+
+ // GATHER INFORMATION ABOUT MOST RECENTLY ADMINISTERED ORDER (past 1 days) OF THE SAME CATEGORY
+ (ExistingOrderLastGiven, ExistingOrderFrequency, ExistingOrderHoursSinceGiven,
+ ExistingOrderName, ExistingOrderTherapeuticCategory, ExistingOrderDrugKey,
+ ExistingRoute, ExistingNextTaskPending, ExistingNextTaskCanceled, ExistingOrderDose, ExistingOrderDoseUOM) := read last
+ {
+ " select oto.performedfromdtm, o.FrequencyCode, datediff (HH, oto.performedfromdtm, getdate()), "
+ || " o.name, ocmi.TherapeuticCategory, dm.DrugKey, ot.OrderRoute "
+ || " ,(select top 1 oto2.SignificantDtm from cv3ordertaskoccurrence oto2 with (nolock) "
+ || " where oto2.clientguid = ot.clientguid and oto2.orderguid = o.guid and oto2.ordertaskguid = ot.guid "
+ || " and oto2.SignificantDtm > getdate()-1 and oto2.taskstatuscode = {{{SINGLE-QUOTE}}}Pending{{{SINGLE-QUOTE}}}) "
+ || " ,(select top 1 oto2.SignificantDtm from cv3ordertaskoccurrence oto2 with (nolock) "
+ || " where oto2.clientguid = ot.clientguid and oto2.orderguid = o.guid and oto2.ordertaskguid = ot.guid "
+ || " and oto2.SignificantDtm > getdate()-1 and oto2.taskstatuscode = {{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}}), oto.TaskDose, oto.TaskUom "
+ || " from cv3ordercatalogmasteritem ocmi with (nolock) "
+ || " join cv3drugmapping dm with (nolock) on dm.catalogitemguid = ocmi.guid "
+ || " join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " and o.ClientGUID = " || ClientGuid || " "
+ || " and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}" || TherapeuticCategory || "{{{SINGLE-QUOTE}}} "
+ || " 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 oto.SignificantDtm > getdate()-1 and oto.taskstatuscode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
+ || " order by oto.performedfromdtm "
+ };
+
+ ExistingOrderDose := ExistingOrderDose as number;
+
+ (ExistingOrderInterval) := read last {"select timefromvalue from CV3Frequency with (nolock) where code = {{{SINGLE-QUOTE}}}" || ExistingOrderFrequency || "{{{SINGLE-QUOTE}}}"};
+
+ ExistingNextTaskPendingDate:= ExistingNextTaskPending FORMATTED WITH "%.2t";
+ ExistingNextTaskPendingTime:= extract hour ExistingNextTaskPending || ":" || extract minute ExistingNextTaskPending;
+
+ ExistingNextTaskCanceledDate:= ExistingNextTaskCanceled FORMATTED WITH "%.2t";
+ ExistingNextTaskCanceledTime:= extract hour ExistingNextTaskCanceled || ":" || extract minute ExistingNextTaskCanceled;
+
+ // Determine how the order compares to the most recently charted order of the same therapeutic category
+ DrugMatch := "No";
+ FrequencyMatch:= "No";
+ RouteMatch := "No";
+ DoseMatch := "No";
+ UOMMatch := "No";
+ matching_drug_cluster := "No";
+
+
+
+
+ // ------------------ CHECK #2 ------------------
+ // Searches patient chart for an order that matches the "Included_Orders" list
+ index_list_included_orders := 1 seqto (count Included_Orders);
+ matching_drug_list := ();
+
+ // loops existing orders for patient to see if there{{{SINGLE-QUOTE}}}s a match to "Included_Orders" list
+ for J in index_list_included_orders do
+
+ current_order_lookup := Included_Orders[J];
+
+ // looks back 1 day to see if there{{{SINGLE-QUOTE}}}s a previous order that was administered and matches the drug cluster list.
+ name_of_matching_drug := read last
+ {
+ "select ocmi.Name
+ from cv3ordercatalogmasteritem ocmi with (nolock)
+ join cv3drugmapping dm with (nolock) on dm.catalogitemguid = ocmi.guid
+ join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid
+ 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 oto.SignificantDtm > getdate()-1 and oto.taskstatuscode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}}
+ where o.ClientGUID = " || sql(ClientGuid) ||
+ "and o.chartguid = " || sql(ChartGuid) ||
+ "and o.clientvisitguid = " || sql(VisitGuid) ||
+ "and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}" || TherapeuticCategory || "{{{SINGLE-QUOTE}}}
+ and ocmi.Name like {{{SINGLE-QUOTE}}}%" || current_order_lookup || "%{{{SINGLE-QUOTE}}}"
+ };
+
+ if (exist name_of_matching_drug) then
+ check_2 := "Yes";
+ matching_drug_list := matching_drug_list || name_of_matching_drug;
+ endif;
+ enddo;
+
+ if (exist matching_drug_list) then
+ matching_drug_cluster := "Yes"; // move on to check #3
+ endif;
+
+
+ if (matching_drug_cluster = "No") then
+ Scenario := "1"; // move to scheduling routine
+
+ If ScheduleType = "Variable" then // variable is example: Q8H BID = Fixed
+ TargetHour := NextHour; // move to scheduling routine
+ TargetDate := NOW;
+ else
+ // Fixed Start Time = BID, QD, QHS
+ RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime;
+ RequestedDate.Value := NextScheduledDoseDate;
+ endif;
+
+ endif; //if (matching_drug_cluster = "No") then
+
+ // ------------------ end of CHECK #2 ------------------
+
+
+
+
+ // current Drug{{{SINGLE-QUOTE}}}s key matches existing order{{{SINGLE-QUOTE}}}s drug key
+ if (DrugKey = ExistingOrderDrugKey) or (order_name = ExistingOrderName) then
+ DrugMatch := "Yes";
+ endif;
+
+ if FrequencyValue.FrequencySummary = ExistingOrderFrequency then
+ FrequencyMatch := "Yes";
+ endif;
+
+ if RouteValue = ExistingRoute then
+ RouteMatch := "Yes";
+ endif;
+
+ if dose.Value = ExistingOrderDose then
+ DoseMatch := "Yes";
+ endif;
+
+ if uom.Value = ExistingOrderDoseUOM then
+ UOMMatch := "Yes";
+ endif;
+
+
+
+
+ if (matching_drug_cluster = "Yes") then // carried over from check #2
+ // potential issue here is that SQL
+ // ------------------ CHECK #3 ------------------
+ if (DrugMatch = "Yes") then
+ check_3 := "yes";
+
+ // ------------------ CHECK #4 ------------------
+ if (FrequencyMatch = "Yes") then
+
+ check_4 := "No - Continue new order where previous order left off";
+ Scenario := "2";
+
+ // Same Drug / Same Frequency
+ // continue new order with same schedule as old order
+ If ExistingNextTaskPending is not null then
+ TargetHour := extract hour ExistingNextTaskPending; // this is the next scheduled dose
+ TargetDate := ExistingNextTaskPending;
+ else
+ TargetHour := extract hour ExistingNextTaskCanceled;
+ TargetDate := ExistingNextTaskCanceled;
+ endif;
+
+ // if targethour is null then take lastgiven + frequencyinterval
+ if (not exist TargetHour) then
+ TargetHour := extract hour ExistingOrderLastGiven + FrequencyInterval;
+ TargetDate := ExistingOrderLastGiven;
+ endif;
+
+ else // Yes path for part of CHECK #4
+ // schedule new order for last charted DTM + duration of new frequency
+ check_4 := "Yes - Schedule new order for last charted DTM + Duration of new frequency";
+ Scenario := "3";
+
+ // Same Drug / Different Frequency / QxH
+ TargetHour := extract hour ExistingOrderLastGiven + FrequencyInterval;
+ TargetDate := ExistingOrderLastGiven;
+
+ endif;// end of CHECK #4 // if (FrequencyMatch = "Yes") then
+ else // part of CHECK #3 // if (DrugMatch = "Yes") then
+ check_3 := "No";
+
+ // see if previous order (not-matching current order) was a "one time" order
+
+
+ // ------------------ CHECK #5 ------------------
+ // Different Drug // One-Time Dose??
+ If (ExistingOrderInterval is null) then // For Q12H, ExistingOrderInterval = 12. For BID, ExistingOrderInterval = 2. For Now, STAT, Once, ExistingOrderInterval = NULL
+ // Different Drug / One-Time Dose - Yes
+ check_5 := "Yes";
+
+
+ // ------------------ CHECK #6 ------------------
+ // check if last dose charted was heparin
+ if (ExistingOrderName = "Heparin Inj") then
+ check_6 := "Yes";
+ Scenario := "4";
+ // schedule new order 8 hour after last charted DTM
+ TargetHour := extract hour ExistingOrderLastGiven + 8;
+ TargetDate := ExistingOrderLastGiven;
+
+ else
+ check_6 := "No";
+ Scenario := "5";
+ // schedule new order 24 hour after last charted DTM
+ TargetHour := extract hour ExistingOrderLastGiven + 24;
+ TargetDate := ExistingOrderLastGiven;
+ endif; //if (ExistingOrderName = "Heparin Inj")
+ // ------------------ end of CHECK #6 ------------------
+
+ else // part of Check #5 // If (ExistingOrderInterval is null) then previous order{{{SINGLE-QUOTE}}}s last charted dose is a one-time order
+ // For Now, STAT, Once, ExistingOrderInterval = NULL
+ // Different Drug / One-Time Dose - No
+ check_5 := "No";
+
+
+ // ------------------ CHECK #7 ------------------
+ If (ExistingOrderHoursSinceGiven > ExistingOrderInterval) then
+ // Different Drug / Not One-Time Dose / Outside the Span
+ check_7 := "No";
+ Scenario := "7";
+
+ If ScheduleType = "Variable" then
+ // Variable Start Time
+ TargetHour := NextHour;
+ TargetDate := NOW;
+ else
+ // Fixed Start Time
+ RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime;
+ RequestedDate.Value := NextScheduledDoseDate;
+ endif;
+
+ else // within span
+ check_7 := "Yes";
+ Scenario := "6";
+ // Different Drug / Not One-Time Dose / Within the Span
+
+ If ExistingNextTaskPending is not null then
+ ExistingNextTaskTime := ExistingNextTaskPendingTime;
+ ExistingNextTaskDate := ExistingNextTaskPendingDate;
+ ExistingNextTaskDTM := ExistingNextTaskPending FORMATTED WITH "%.4t";
+ CalculatedHour:= extract hour ExistingNextTaskPending;
+
+ RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ RequestedTimeValue.ReqTimeValue := ExistingNextTaskTime;
+ RequestedDate.Value := ExistingNextTaskDate;
+
+ elseif ExistingNextTaskCanceledDate is not null then
+ ExistingNextTaskTime := ExistingNextTaskCanceledTime;
+ ExistingNextTaskDate := ExistingNextTaskCanceledDate;
+ ExistingNextTaskDTM := ExistingNextTaskCanceled FORMATTED WITH "%.4t";
+ CalculatedHour:= extract hour ExistingNextTaskCanceled;
+
+ RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ RequestedTimeValue.ReqTimeValue := ExistingNextTaskTime;
+ RequestedDate.Value := ExistingNextTaskDate;
+
+ else
+ TargetHour := extract hour ExistingOrderLastGiven + ExistingOrderInterval;
+ TargetDate := ExistingOrderLastGiven;
+ endif; // Is there a Pending task (if not use next Canceled task)
+
+
+ endif; // Check #7 //If (ExistingOrderHoursSinceGiven > ExistingOrderInterval) then
+ endif; // Check #5 // If (ExistingOrderInterval is null) then
+ // ------------------ end of CHECK #5 ------------------
+
+ // is last dose charted a "one time" order?
+
+
+ endif;// end of CHECK #3 // if (DrugMatch = "Yes") then
+ endif; // if (matching_drug_cluster = "Yes") then // carried over from check #2
+
+ endif; // CHECK #1 // If (FrequencyInterval is not null and
+// -------------------------------------## end of Main Algorithm ##--------------------------------------------------
+
+
+
+
+
+// -------------------------------------## Scheduling Routine ##--------------------------------------------------
+// SCHEDULED TIME ADJUSTMENTS - for variable start time frequencies
+ If TargetHour is not null and FrequencyTimeUOM = "hr(s)" then
+ // Adjust for Calculated Dose Hour greater than 24 (next dose falls after midnight today)
+
+ If (TargetHour < 24) then
+
+ // CalculatedHour := TargetHour formatted with "%2.2d"; 09.22.2017 DW HD# 2763521 This formatting introduced on 6/1/2015 created an issue with the top of the hour >=45 scheuling programming.
+ CalculatedHour := TargetHour;
+
+ ElseIf (TargetHour >= 24 and TargetHour < 48) then
+ CalculatedHour := TargetHour - 24;
+ TargetDate := TargetDate + 1 day;
+ ElseIf (TargetHour >= 48) then
+ CalculatedHour := TargetHour - 48;
+ TargetDate := TargetDate + 2 day;
+ endif;
+
+ // Adjust for Calculated Dose Time that is in the past...begin now (existing med has missed recent doses)
+ TimeNow := (extract year NOW) FORMATTED WITH "%2.2d" || (extract month NOW) FORMATTED WITH "%2.2d" ||
+ (extract day NOW) FORMATTED WITH "%2.2d" || (extract hour NOW) FORMATTED WITH "%2.2d" ||
+ (extract minute NOW) FORMATTED WITH "%2.2d";
+
+ TimeScheduled:= (extract year TargetDate) FORMATTED WITH "%2.2d" || (extract month TargetDate) FORMATTED WITH "%2.2d" ||
+ (extract day TargetDate) FORMATTED WITH "%2.2d" || CalculatedHour FORMATTED WITH "%2.2d" || "00";
+
+ if TimeScheduled < TimeNow then
+ CalculatedHour :=NextHour;
+ TargetDate := NOW;
+ endif;
+
+ // Adjust for Administration time calculated for < 15 minutes...offset the time by an hour
+ If CurrentMinute >= 45 and CalculatedHour = (EXTRACT HOUR Now) +1 then
+ CalculatedHour := CalculatedHour + 1; Scenario := Scenario || " B";
+ else
+ CalculatedHour := CalculatedHour ; Scenario := Scenario || " A";
+ endif;
+
+ // The Adjustments could have placed the start time to after midnight....if so, adjust date and hour
+ If CalculatedHour >= 24 then
+ CalculatedHour := CalculatedHour - 24;
+ a := "in calc hour";
+ TargetDate := TargetDate + 1 day;
+ endif;
+
+ // Format the date and time as required by the form fields
+ CalculatedTime := CalculatedHour || ":00";
+ CalculatedDate := TargetDate FORMATTED WITH "%.2t";
+
+ // Send the calculated time to the order form field
+ RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time";
+ RequestedTimeValue.ReqTimeValue := CalculatedTime;
+ RequestedDate.Value := CalculatedDate;
+
+
+
+ endif; // Target Time (variable hourly shedules)
+// -------------------------------------## end of Scheduling Routine ##--------------------------------------------------
+
+
+ endif; // If (CallingEvent = "FormClose") and (not exist RequestedTimeValue.ReqTimeValue) then
+endif; // if ( continue_processing = true ) then
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: // no evoke
+ ;;
+ logic: conclude true;
+ ;;
+ action: return this_communication, this_form;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_WORX_ITEM_CODE_PER_DOSE.mlm b/MLMStripper/bin/Debug/FORM/FORM_WORX_ITEM_CODE_PER_DOSE.mlm
new file mode 100644
index 0000000..4f4f5a0
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_WORX_ITEM_CODE_PER_DOSE.mlm
@@ -0,0 +1,212 @@
+maintenance:
+
+ title: Form_Worx_Item_code_Per_Dose;;
+ mlmname: Form_Worx_Item_code_Per_Dose;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St. Clair Hospital;;
+ author: Robert Spence;;
+ specialist: Teresa Spizucca;;
+ date: 2009-12-08;;
+ validation: testing;;
+
+library:
+ purpose: Populate Worx order code based on dose of the item in the lists below.
+ ;;
+ explanation: This checks the ordered dose
+ of drug and populates the worx product code with
+ corresponding value.
+
+ Value is based on high dose if present
+ Else low dose (mandatory on form) is used
+
+ Also populates WORx route code as a secondary function (combining MLMs to one form close)
+ Change history
+
+ 12.08.2010 TS Changed to remove 8mg vial size of morphine
+ 06.17.2015 TS Corrected low dose dexamethosone entry, changed hydrocortisone to remove
+ codes 05524 and 05525 (no longer stocked). Reviewed hydromorphone codes
+ for activation. CSR 30997
+ 03.12.2018 TS Added Zosyn Codes for Zosyn Alternate Dosing. CSR 34822
+ 05.02.2018 TS Added new code for hydromorphone 0.5mg CSR 36639
+
+ ;;
+ keywords:
+ Drug generic MLM, dose, worx code;
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+/********************Make Changes To Spelling And Flags In This Section*********************/
+
+
+/****************************************************************************************/
+
+ // 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;
+ CallingField :=this_communication.CallingFieldName;
+ CallingEvent := this_communication.CallingEvent;
+
+ // Assigns fields passed in the Form object to the Field object
+ field_list:= this_form.fields;
+
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ // Set the parameters here
+ // DRUG NAME|Bottom of Range Dose|Top Of Range Dose|Ancillary Code
+ // If Top of Range Dose = INFINITY not exist it will be treated as >Bottom of range dose
+ // If Route is populated, if this line is selected due to parameters, the user will be forced to choose this Route
+
+
+
+
+ drug_dose_list :=
+ ("FUROSEMIDE|0|20|04941"
+ ,"FUROSEMIDE|20|40|04942"
+ ,"FUROSEMIDE|40|INFINITY|04943"
+ ,"METHYLPREDNISOLONE|0|40|04058"
+ ,"METHYLPREDNISOLONE|40|250|04059"
+ ,"METHYLPREDNISOLONE|250|500|04060"
+ ,"METHYLPREDNISOLONE|500|INFINITY|04061"
+ ,"DEXAMETHASONE|0|8|04745"
+ ,"DEXAMETHASONE|8|INFINITY|04744"
+ ,"HYDROCORTISONE|0|100|05522"
+ ,"HYDROCORTISONE|100|INFINITY|05523"
+// ,"HYDROCORTISONE|250|500|05524"
+// ,"HYDROCORTISONE|500|INFINITY|05525"
+ ,"MEPERIDINE|0|50|04472"
+ ,"MEPERIDINE|50|75|04473"
+ ,"MEPERIDINE|75|INFINITY|04474"
+ ,"MORPHINE|0|2|07001"
+ ,"MORPHINE|2|4|07131"
+ //,"MORPHINE|4|8|05076"
+ ,"MORPHINE|4|INFINITY|05077"
+ ,"HYDROMORPHONE|0|0.5|08826"
+ ,"HYDROMORPHONE|0.5|1|07615"
+ ,"HYDROMORPHONE|1|INFINITY|04778"
+ ,"Piperacillin-Tazobactam|0|2.24|00115P"
+ ,"Piperacillin-Tazobactam|2.24|2.25|08603P"
+ ,"Piperacillin-Tazobactam|2.25|3.374|00115P"
+ ,"Piperacillin-Tazobactam|3.374|3.375|08602P"
+ ,"Piperacillin-Tazobactam|3.375|4.4|00115P"
+ ,"Piperacillin-Tazobactam|4.4|4.5|08604P"
+ ,"Piperacillin-Tazobactam|4.5|INFINITY|00115P"
+ );
+
+
+
+ // Set Field Associations
+
+ // first set parameter associations
+ // drug to look for
+ form_drug_field := first of (field_list where field_list.DataItemName = "PRX_DrugNameforMLM");
+
+ // low and high dose from form (high superceeds low)
+ lodose_field := first of
+ (field_list where field_list.DataItemName = "dosagelow");
+ hidose_field := first of
+ (field_list where field_list.DataItemName = "dosagehigh");
+
+ if callingField = "dosagelow" or callingfield = "dosagehigh" or callingevent = "FormClose" then
+
+ if (exists hidose_field) and (hidose_field.Value > 0) then
+ dose_value := hidose_field.value;
+ else
+ dose_value := lodose_field.value;
+ endif;
+
+ // route from form
+ route_field := first of (field_list where field_list.DataItemName = "OrderRouteCode" );
+
+
+
+ // now associate the fields we will be setting based on our criteria
+
+
+ // Worx Drug code
+ worx_prod_code_field := first of
+ (field_list where field_list.DataItemName = "PRX_DRUGIDCODE");
+
+
+ found_drg :=false;
+ counter := count drug_dose_list;
+
+ i := 0;
+
+ while (found_drg = false) do
+ i:=i+1;
+
+ if i = counter then
+ found_drg := true;
+ endif;
+
+ singleelement:= call str_parse with drug_dose_list[i], "|"; //makes string i in list into its own list
+ sing_drug := singleelement[1];
+
+
+
+ if (sing_drug = form_drug_field.value) then
+
+
+ sing_doselow := singleelement[2];
+ sing_dosehigh := singleelement[3];
+
+ if (sing_doselow as number) = 0 then
+ if (dose_value as number) <= (sing_dosehigh as number) then
+ MessageDisp:= "\n\nWrote at lowest range " || singleelement[4];
+ worx_prod_code_field.value := singleelement[4];
+ found_drg :=true;
+ endif;
+
+ elseif sing_dosehigh = "INFINITY" then
+ if (dose_value as number) > (sing_doselow as number) then
+ MessageDisp:= "\n\nWrote at highest range " || singleelement[4];
+ worx_prod_code_field.value := singleelement[4];
+ found_drg :=true;
+ endif;
+
+ elseif ((dose_value as number) > (sing_doselow as number)) and ((dose_value as number) <= (sing_dosehigh as number)) then
+ MessageDisp:= "\n\nWrote mid range (" || sing_doselow || " to " || sing_dosehigh || ") " || singleelement[4];
+ worx_prod_code_field.value := singleelement[4];
+ found_drg :=true;
+ endif;
+ endif; //(sing_drug = form_drug_field.value)
+
+
+ test:=1;
+
+ enddo;
+
+ endif; //callingField = "dosagelow" or callingfield = "dosagehigh" or callingevent = "FormClose" then
+
+/* // FOR DEBUGGING PURPOSES: display a message to the user
+ this_communication.Message :=
+ "Search for Drug Code = " || form_drug_field.value ||
+ "\nDose to search for = " || dose_value ||
+ "\nRoute from field = " || route_field.value ||
+ "\nworxroute_field = "|| worxroute_field.value ||
+ "\nworx prod code = " || worx_prod_code_field.value || "\n" ||
+ MessageDisp;
+
+
+ this_communication.MessageType := "Informational";
+*/
+
+ ;;
+ 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:
diff --git a/MLMStripper/bin/Debug/FORM/FORM_WOUND_CARE.mlm b/MLMStripper/bin/Debug/FORM/FORM_WOUND_CARE.mlm
new file mode 100644
index 0000000..8cfc7c6
--- /dev/null
+++ b/MLMStripper/bin/Debug/FORM/FORM_WOUND_CARE.mlm
@@ -0,0 +1,88 @@
+maintenance:
+
+ title: FORM_WOUND_CARE;;
+ mlmname: FORM_WOUND_CARE;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Hospital;;
+ author: Courtney Carr Allscripts Corp;;
+ specialist: Don Warnick Allscripts Corp ;;
+ date: 2016-04-26;;
+ validation: testing;;
+
+library:
+ purpose: Wound Care Form Logic
+
+ ;;
+
+ explanation: This MLM is called from the Wound Care Form
+
+
+ Change history
+
+ 04.26.2016 DW CSR# 34286 Created
+
+
+ ;;
+ keywords: Called MLMs
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (this_communication, this_form, client_info_obj) := argument;
+ error_message:="";
+
+ field_list:= this_form.fields;
+ CallingEvent:= this_communication.CallingEvent;
+ Visit_Guid := this_communication.ClientVisitGuid;
+ Chart_Guid := this_communication.ChartGuid;
+ Client_Guid := this_communication.ClientGuid;
+
+ ApplyDressing:= last of (field_list where field_list.DataItemName = "DISC_Dressing Apply" );
+ Instructions := last of (field_list where field_list.DataItemName = "Disc_DressWndInstruct" );
+
+
+ MeplexApplyLocation:= find "apply Mepilex protective dressing to coccyx for hip fracture patient" in string ApplyDressing.Value;
+ MeplexInstrLocation:= find "Change Mepilex dressing every 3 days as needed and remove at discharge" in string Instructions.value;
+
+
+
+ if MeplexInstrLocation = 0 or MeplexInstrLocation is null
+
+ then // If the Meplex Instruction box is not already checked, then proceed
+
+ if MeplexApplyLocation > 0 and MeplexApplyLocation is not null
+
+ then // If the Meplex Apply box is checked, then proceed
+
+ if Instructions.value is null
+
+ then // If there are no other Instruction boxes checked, then simply check the Meplex Instructions box
+
+ Instructions.value := "Change Mepilex dressing every 3 days as needed and remove at discharge";
+
+ else // If there are other Instruction boxes checked, then re-check them and check the Meplex Instructions box
+
+ Instructions.value := Instructions.value || "; Change Mepilex dressing every 3 days as needed and remove at discharge";
+
+ endif;
+
+ endif;
+
+ endif;
+
+
+ ;;
+ evoke: // No evoke statement
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+ return this_communication, this_form;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/FUNC/FUNC_ACS_ALLERGY_SUPPRESS_ALERT.mlm b/MLMStripper/bin/Debug/FUNC/FUNC_ACS_ALLERGY_SUPPRESS_ALERT.mlm
new file mode 100644
index 0000000..45480e0
--- /dev/null
+++ b/MLMStripper/bin/Debug/FUNC/FUNC_ACS_ALLERGY_SUPPRESS_ALERT.mlm
@@ -0,0 +1,472 @@
+maintenance:
+
+ title: Check Allergy Already Alerted;;
+ mlmname: FUNC_ACS_ALLERGY_SUPPRESS_ALERT;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: Allscripts, Standard MLM;;
+ author: Allscripts Healthcare Solutions, Inc.;;
+ specialist: ;;
+ date: 2016-12-20;;
+ validation: testing;;
+
+/* P r o p r i e t a r y N o t i c e */
+/* Unpublished (c) 2013 - 2015 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
+
+P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
+Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
+valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is
+protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
+disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
+written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
+This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
+
+All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
+*/
+/* P r o p r i e t a r y N o t i c e */
+
+library:
+ purpose: In keeping with alert reduction efforts, work out a way in SCM that when an allergy override has been addressed once,
+ SCM retains that information and no alert is fired again.
+ ;;
+ explanation:
+
+ If an allergy alert exists in the CV3AlertDeclaration table for this patient, this visit,
+ and the ingredients of the triggering order are the same and the allergen is the same and
+ the ordering provider has an OrderRoleType like {{{SINGLE-QUOTE}}}%physician%{{{SINGLE-QUOTE}}} or OrderRoleType = {{{SINGLE-QUOTE}}}CRNP{{{SINGLE-QUOTE}}} or
+ OrderRoleType = {{{SINGLE-QUOTE}}}PA-C{{{SINGLE-QUOTE}}} the allergy alert should be supressed.
+
+ Code changes such that if the physician’s decide to only alert once per visit, regardless
+ of who receives the first alert (%physician%, CRNP, or PA-C) the change can be made by changing
+ a parameter in the MLM.
+
+ All other providers (non-physician, non-physician extenders) will continue to receive allergy alerts as they are currently presented to the end user.
+
+ Change History:
+ 12.14.2017 JBickley Created CSR 35068
+ 05.21.2018 TSpicuzza Add logic to only suppress alerts for appropriate users when they are members of the Emergency Department
+ which is being used as the pilot unit beginning on 5/21/2018. CSR 35068
+
+
+ ;;
+ keywords: allergy; ;;
+
+ citations:
+
+ ;;
+
+
+knowledge:
+ type: data-driven;;
+ data:
+
+ (EvokingObject) := argument;
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ // Set to true if logging is needed.
+ log_execution_info := false;
+
+ //***************Make Changes To Spelling And Flags In This Section*************
+
+ SuppressAlertOnlyIfCurrentUserHasSeen := true;
+ SuppressAlertOnlyIfCurrentUserHasAcknowledged := true;
+ SuppressAlertOnlyIfAlertProceeded := true;
+ SuppressAlertOnlyIfAlertAcknowledged := true;
+
+ SuppressCrossDrugKey := true;
+ SuppressCrossDrugComponents := true;
+
+ PilotDepartment := read last { "select GUID from CV3OrganizationalUnit where name = {{{SINGLE-QUOTE}}}Emergency Department{{{SINGLE-QUOTE}}}"};
+
+ // OrderRoleTypesToSuppressSecondaryAlert := read {"select Code from CV3OrderRoleType where Active = 1 and (Code like {{{SINGLE-QUOTE}}}%physician%{{{SINGLE-QUOTE}}} or Code = {{{SINGLE-QUOTE}}}CRNP{{{SINGLE-QUOTE}}} or Code = {{{SINGLE-QUOTE}}}PA-C{{{SINGLE-QUOTE}}})"};
+ OrderRoleTypesToSuppressSecondaryAlert := read {"select Code from CV3OrderRoleType where Active = 1 and (Code like {{{SINGLE-QUOTE}}}%ed physician%{{{SINGLE-QUOTE}}} or Code = {{{SINGLE-QUOTE}}}CRNP{{{SINGLE-QUOTE}}} or Code = {{{SINGLE-QUOTE}}}PA-C{{{SINGLE-QUOTE}}})"};
+
+
+ //assume the default is to alert the user
+ SuppressAlert := false;
+ SuppressAlertReason := "";
+
+ /* Get the current user info*/
+ (user_id,userguid) := read last {UserInfo: idcode, guid};
+
+ (ClientGUID, ChartGUID, ClientVisitGUID) := read last {StateInfo: ClientGUID, ChartGUID, VisitGUID};
+
+
+ OrderRoleType := read last
+ {"Select OrderRoleType "
+ ||" From cv3user with (nolock) "
+ ||" Where Guid = " || SQL(userguid)
+ ||" and OrgUnitGUID = " || PilotDepartment };
+
+/* OrderRoleType := read last
+ {"Select OrderRoleType "
+ ||" From cv3user with (nolock) "
+ ||" Where Guid = " || SQL(userguid) };
+
+*/
+
+ if(called_by_editor)then
+ //ClientGUID := 3400200;
+ //ChartGUID := 3400170;
+ //ClientVisitGUID := 3400270;
+
+ // Define object choice "Order", or "ClientPrescription"
+ Object_Choice :=
+ //"ClientPrescription";
+ //"Allergy";
+ "Order";
+
+ if (object_choice = "Order") then
+ EvokingObject:= read last
+ {Order: This
+ WHERE TypeCode = "Medication"
+ //AND Name = "Acetaminophen 650 mg suppository"
+ //AND Name = "Tylenol Caplet 500 mg - Oral"
+ //AND Name = "Acetaminophen-Codeine #3"
+ //AND Name = "ibuprofen"//"Acetaminophen"
+ AND Name = "acetaminophen + oxyCODONE 325 mg-5 mg"
+ };
+ //EvokingEventType := entered_order.type;
+ elseif (object_choice = "Allergy") then
+ EvokingObject:= read last
+
+ {Allergy: This};
+
+ //EvokingEventType := entered_allergy.type;
+ else
+ EvokingObject:= read last
+ {ClientPrescription: This
+ WHERE PrescriptionTypeDescription in ("Rx", "Hx")
+ };
+ //EvokingEventType := prescription_enter.Type;
+ endif;
+
+ endif;
+
+ AlertObj := OBJECT [UserGUID
+ ,Status
+ ,AcknowledgedUserName
+ ,AcknowledgedUserGUID
+ ,PObjectName
+ ,PObjectGUID
+ ,AlertRepositoryGUID
+ ,PrimaryProviderGUID
+ ,Abstract
+ ,TriggeringInfo
+ ,OrderName ];
+
+ query := "select alert.UserGUID
+ ,alert.Status
+ ,alert.AcknowledgedUserName
+ ,alert.AcknowledgedUserGUID
+ ,alert.PObjectName
+ ,alert.PObjectGUID
+ ,alert.GUID
+ ,alert.PrimaryProviderGUID
+ ,alert.Abstract
+ ,alert.TriggeringInfo
+ ,o.Name
+ from CV3AlertRepository alert
+ left outer join CV3Order o on o.ClientGUID = alert.ClientGUID and o.ChartGUID = alert.ChartGUID and o.GUID = alert.PObjectGUID
+ left outer join SXAAMBClientPrescription cp on cp.ClientGUID = alert.ClientGUID and cp.ClientVisitGUID = alert.ClientVisitGUID and cp.CDSUniqueIDGUID = alert.PObjectGUID
+ where alert.MLMName = {{{SINGLE-QUOTE}}}STD_ALLERGY{{{SINGLE-QUOTE}}}
+ and alert.ClientGUID = " || ClientGUID
+ //|| " and alert.ChartGUID = " || ChartGUID
+ || " and alert.ClientVisitGUID = " || ClientVisitGUID;
+
+ Alerts := read as AlertObj {""||query};
+
+ if(SuppressAlertOnlyIfCurrentUserHasSeen)then
+ Alerts := Alerts Where Alerts.UserGUID = userguid;
+ endif;
+
+ if(SuppressAlertOnlyIfCurrentUserHasAcknowledged)then
+ Alerts := Alerts Where Alerts.AcknowledgedUserGUID = userguid;
+ endif;
+
+ if(SuppressAlertOnlyIfAlertProceeded)then
+ Alerts := Alerts Where Alerts.OrderName is not null;
+ endif;
+
+ if(SuppressAlertOnlyIfAlertAcknowledged)then
+ Alerts := Alerts Where Alerts.Status = "Ack";
+ endif;
+
+ if(count(Alerts) > 0)then
+
+ if (EvokingObject IS ClientPrescription) then
+ evoked_from_prescriptions := true;
+ display_alert_types := display_prescription_alert_other_types,
+ allergen_type_string;
+ (evoking_prescription_description,
+ evoking_prescription_name,
+ evoking_prescription_NameID,
+ alert_on_demand_source,
+ client_guid
+ ) := read last
+ { ClientPrescription: PrescriptionTypeDescription, DrugName, GenericNameID, AlertOnDemandSource,
+ ClientGUID
+ REFERENCING EvokingObject };
+
+ elseif (EvokingObject IS Order) then
+ evoked_from_prescriptions := false;
+ display_alert_types:= display_order_alert_other_types,
+ allergen_type_string;
+ // Get the order component object associated with the evoking order
+ (evoking_order_name,
+ evoking_cat_item_guid,
+ order_type,
+ OrdComponentObj,
+ PharmOrderObj,
+ evoking_complex_order_type,
+ OrderVariableComponentObj,
+ alert_on_demand_source,
+ client_guid,
+ alternate_order_type,
+ AdditionalInfoObj,
+ BackupObj
+ ) := read last
+ { Order: Name, OrderCatalogMasterItemGUID, TypeCode, OrderComponent,
+ PharmacyOrder, ComplexOrderType, OrderVariableComponent,
+ AlertOnDemandSource, ClientGUID,
+ AlternateOrderType, OrderAdditionalInfo, Backup
+ REFERENCING EvokingObject };
+ endif;
+
+ DrugMappingObj := OBJECT [ocmi_GUID,ocmi_Name,ocmi_TherapeuticCategoryID,TherapeuticCategory,DBStatus,DrugKey,DrugName,DrugSynonymID,function_id,OriginalTouchedWhen,DrugMappingTouchedWhen,GenericName,MMDC,AlternateMappingName,DrugMappingXrefTouchedWhen,IsObsolete];
+
+ DrugMappingComponentObj := OBJECT [ocmi_GUID, ocmi_Name, Multum_drug_id, Multum_drug_name ];
+
+ ThisOrderDrugMappingDataSQL :=
+ "DECLARE @OrderName varchar(200) = " || SQL(evoking_order_name) || "
+
+ SELECT
+ ocmi.GUID,
+ ocmi.Name,
+ ocmi.TherapeuticCategoryID,
+ TherapeuticCategory = CASE
+ WHEN ocmi.TherapeuticCategoryID > 0 THEN
+ (SELECT category_name FROM SXAMTDrugCategoriesVW
+ WHERE multum_category_id = ocmi.TherapeuticCategoryID)
+ ELSE {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}
+ END,
+ DBStatus = CASE
+ WHEN DrugKey IS NOT NULL THEN {{{SINGLE-QUOTE}}}M{{{SINGLE-QUOTE}}}
+ WHEN DrugKey IS NULL AND ISNULL(IsIgnored,0) = 1 THEN {{{SINGLE-QUOTE}}}I{{{SINGLE-QUOTE}}}
+ ELSE {{{SINGLE-QUOTE}}}U{{{SINGLE-QUOTE}}}
+ END,
+ DrugKey = ISNULL(dm.DrugKey,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}),
+ DrugName = ISNULL(dnv.drug_name,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}),
+ xref.DrugSynonymID,
+ function_id =
+ (SELECT MIN(function_id)
+ FROM SXAMTDrugNameMapVw AS dnm
+ WHERE dnv.drug_synonym_id = dnm.drug_synonym_id
+ AND function_id <> 29 ),
+ OriginalTouchedWhen = ocmi.TouchedWhen,
+ DrugMappingTouchedWhen = dm.TouchedWhen,
+ GenericName = CASE
+ WHEN DrugKey IS NOT NULL THEN
+ (SELECT drug_name FROM SXAMTDrugNameVW vw
+ INNER JOIN SXAMTDrugNameMapVW map ON (vw.drug_synonym_id = map.drug_synonym_id)
+ WHERE function_id = 16 AND drug_id = DrugKey)
+ ELSE {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}
+ END,
+ MMDC = CASE
+ WHEN xref.DrugSynonymID IS NOT NULL THEN
+ (SELECT top 1
+ mmdcXRef.MainMultumDrugCode
+ FROM SXAMTDrugNameVW AS mtDN
+ INNER JOIN SXAAMBDrugName AS dn ON dn.DrugCatalogKey = mtDN.drug_synonym_id
+ INNER JOIN SXAAMBDrugNameMMDCXRef AS mmdcXRef ON mmdcXRef.DrugNameID = dn.DrugNameID
+ INNER JOIN SXAMTNdcMainMultumDrugCodeVW AS mtMMDC ON mtMMDC.main_multum_drug_code = mmdcXRef.MainMultumDrugCode
+ INNER JOIN SXAAMBClinicalDataFunctionType AS ft ON ft.FunctionTypeID = mmdcXRef.FunctionTypeID
+ WHERE mtDN.drug_synonym_id = DrugSynonymID AND ft.DrugCatalogKey IN (59,60) )
+ ELSE NULL
+ END,
+ AlternateMappingName = ISNULL(ocmi.AlternateMappingName, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}),
+ DrugMappingXrefTouchedWhen = xref.TouchedWhen,
+ IsObsolete = dnv.is_obsolete
+ from
+ Cv3OrderCatalogMasterItem AS ocmi
+ INNER JOIN CV3OrderEntryForm oef ON (ocmi.EntryFormGUID = oef.GUID AND OrderTypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}})
+ LEFT OUTER JOIN CV3DrugMapping AS dm ON (ocmi.GUID = dm.CatalogItemGUID)
+ LEFT OUTER JOIN CV3DrugMappingXref AS xref ON (ocmi.GUID = xref.CatalogItemGUID AND xref.IsDefaultSynonym = 1)
+ LEFT OUTER JOIN SXAMTDrugNameVw AS dnv ON (xref.DrugSynonymID = dnv.drug_synonym_id)
+ AND dnv.is_obsolete = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}}
+ WHERE
+ ocmi.Name = @OrderName";
+
+ ThisOrderDrugMapping := read AS DrugMappingObj last {"" || ThisOrderDrugMappingDataSQL};
+
+ if(SuppressCrossDrugKey)then
+ OtherOrderDrugMappingDataByDrugKeySQL :=
+ "SELECT
+ ocmi.GUID,
+ ocmi.Name,
+ ocmi.TherapeuticCategoryID,
+ TherapeuticCategory = CASE
+ WHEN ocmi.TherapeuticCategoryID > 0 THEN
+ (SELECT category_name FROM SXAMTDrugCategoriesVW
+ WHERE multum_category_id = ocmi.TherapeuticCategoryID)
+ ELSE {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}
+ END,
+ DBStatus = CASE
+ WHEN DrugKey IS NOT NULL THEN {{{SINGLE-QUOTE}}}M{{{SINGLE-QUOTE}}}
+ WHEN DrugKey IS NULL AND ISNULL(IsIgnored,0) = 1 THEN {{{SINGLE-QUOTE}}}I{{{SINGLE-QUOTE}}}
+ ELSE {{{SINGLE-QUOTE}}}U{{{SINGLE-QUOTE}}}
+ END,
+ DrugKey = ISNULL(dm.DrugKey,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}),
+ DrugName = ISNULL(dnv.drug_name,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}),
+ xref.DrugSynonymID,
+ function_id =
+ (SELECT MIN(function_id)
+ FROM SXAMTDrugNameMapVw AS dnm
+ WHERE dnv.drug_synonym_id = dnm.drug_synonym_id
+ AND function_id <> 29 ),
+ OriginalTouchedWhen = ocmi.TouchedWhen,
+ DrugMappingTouchedWhen = dm.TouchedWhen,
+ GenericName = CASE
+ WHEN DrugKey IS NOT NULL THEN
+ (SELECT drug_name FROM SXAMTDrugNameVW vw
+ INNER JOIN SXAMTDrugNameMapVW map ON (vw.drug_synonym_id = map.drug_synonym_id)
+ WHERE function_id = 16 AND drug_id = DrugKey)
+ ELSE {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}
+ END,
+ MMDC = CASE
+ WHEN xref.DrugSynonymID IS NOT NULL THEN
+ (SELECT top 1
+ mmdcXRef.MainMultumDrugCode
+ FROM SXAMTDrugNameVW AS mtDN
+ INNER JOIN SXAAMBDrugName AS dn ON dn.DrugCatalogKey = mtDN.drug_synonym_id
+ INNER JOIN SXAAMBDrugNameMMDCXRef AS mmdcXRef ON mmdcXRef.DrugNameID = dn.DrugNameID
+ INNER JOIN SXAMTNdcMainMultumDrugCodeVW AS mtMMDC ON mtMMDC.main_multum_drug_code = mmdcXRef.MainMultumDrugCode
+ INNER JOIN SXAAMBClinicalDataFunctionType AS ft ON ft.FunctionTypeID = mmdcXRef.FunctionTypeID
+ WHERE mtDN.drug_synonym_id = DrugSynonymID AND ft.DrugCatalogKey IN (59,60) )
+ ELSE NULL
+ END,
+ AlternateMappingName = ISNULL(ocmi.AlternateMappingName, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}),
+ DrugMappingXrefTouchedWhen = xref.TouchedWhen,
+ IsObsolete = dnv.is_obsolete
+ FROM
+ CV3DrugMapping AS dm
+ INNER JOIN Cv3OrderCatalogMasterItem AS ocmi ON (ocmi.GUID = dm.CatalogItemGUID)
+ INNER JOIN CV3OrderEntryForm oef ON (ocmi.EntryFormGUID = oef.GUID AND OrderTypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}})
+ LEFT OUTER JOIN CV3DrugMappingXref AS xref ON (ocmi.GUID = xref.CatalogItemGUID AND xref.IsDefaultSynonym = 1)
+ LEFT OUTER JOIN SXAMTDrugNameVw AS dnv ON (xref.DrugSynonymID = dnv.drug_synonym_id)
+ AND dnv.is_obsolete = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}}
+ WHERE
+ dm.DrugKey = " || SQL(ThisOrderDrugMapping.DrugKey);
+
+ OtherOrdersDrugMappingsByDrugKey := read AS DrugMappingObj {"" || OtherOrderDrugMappingDataByDrugKeySQL};
+ endif;
+
+
+ if(SuppressCrossDrugComponents)then
+ SVR,DB := read last {"SELECT @@SERVERNAME,DB_NAME()"};
+ OtherOrderDrugMappingDataByComponentSQL := "select "
+ || " ocmi.GUID, ocmi.Name, mdi.drug_id, mdn.drug_name "
+ || " from [" || DB || "_MT].[dbo].multum_drug_id mdi "
+ || " join [" || DB || "_MT].[dbo].multum_drug_name mdn "
+ || " on mdn.drug_synonym_id = mdi.drug_synonym_id "
+ || " join CV3DrugMapping AS dm on dm.DrugKey = mdi.drug_id"
+ || " JOIN Cv3OrderCatalogMasterItem AS ocmi ON (ocmi.GUID = dm.CatalogItemGUID) "
+ || " where mdi.drug_id in "
+ || " (select member_drug_id from [" || DB || "_MT].[dbo].multum_combination_drug mcd "
+ || " where mcd.drug_id = " || SQL(ThisOrderDrugMapping.DrugKey) || ")";
+
+ OtherOrdersDrugMappingsByComponent := read AS DrugMappingComponentObj {"" || OtherOrderDrugMappingDataByComponentSQL};
+
+ OtherOrderDrugMappingDataContainingThisComponentSQL := "select "
+ || " ocmi.GUID, ocmi.Name, mdi.drug_id, mdn.drug_name "
+ || " from [" || DB || "_MT].[dbo].multum_drug_id mdi "
+ || " join [" || DB || "_MT].[dbo].multum_drug_name mdn "
+ || " on mdn.drug_synonym_id = mdi.drug_synonym_id "
+ || " join CV3DrugMapping AS dm on dm.DrugKey = mdi.drug_id"
+ || " JOIN Cv3OrderCatalogMasterItem AS ocmi ON (ocmi.GUID = dm.CatalogItemGUID) "
+ || " where mdi.drug_id in "
+ || " (select mcd.drug_id from [" || DB || "_MT].[dbo].multum_combination_drug mcd "
+ || " where member_drug_id = " || SQL(ThisOrderDrugMapping.DrugKey) || ")";
+
+ OtherOrderDrugMappingDataContainingThisComponent := read AS DrugMappingComponentObj {"" || OtherOrderDrugMappingDataContainingThisComponentSQL};
+
+
+ endif;
+
+ endif;
+
+
+ ;;
+
+ evoke:
+
+ ;;
+
+ logic:
+
+ if(count(Alerts) = 0)then
+ SuppressAlert := false;
+ conclude true;
+ endif;
+
+ If OrderRoleType not in OrderRoleTypesToSuppressSecondaryAlert then
+ if(user_id <> "services")then
+ SuppressAlert := false;
+ conclude true;
+ endif;
+ endif;
+
+ //if (count(Alerts Where Alerts.OrderName = evoking_order_name) > 0) then
+ if (count(Alerts Where Alerts.TriggeringInfo = evoking_order_name) > 0) then
+ SuppressAlert := true;
+ SuppressAlertReason := "Alert Has Been Triggered For THIS Drug.";
+ conclude true;
+ endif;
+
+ if(SuppressCrossDrugKey and (count(Alerts Where Alerts.TriggeringInfo in (OtherOrdersDrugMappingsByDrugKey.ocmi_Name)) > 0))then
+ SuppressAlert := true;
+ crossDrugName := (first of (Alerts Where Alerts.TriggeringInfo in (OtherOrdersDrugMappingsByDrugKey.ocmi_Name))).TriggeringInfo;
+ SuppressAlertReason := "Alert Has Been Triggered For a Drug by CrossKey. - " || crossDrugName;
+ conclude true;
+ endif;
+
+ if(SuppressCrossDrugComponents)then// and (count(Alerts Where Alerts.TriggeringInfo in (OtherOrdersDrugMappingsByComponent.ocmi_Name)) > 0))then
+ //if all components have been alerted
+ if(count(OtherOrdersDrugMappingsByComponent) > 0)then
+ CountAlertsFoundForComponents := 0;
+ for DrugComponent in OtherOrdersDrugMappingsByComponent do
+ if(count(Alerts Where Alerts.TriggeringInfo in (DrugComponent.ocmi_Name)) > 0)then
+ CountAlertsFoundForComponents := CountAlertsFoundForComponents + 1;
+ endif;
+ enddo;
+ if(CountAlertsFoundForComponents = count(OtherOrdersDrugMappingsByComponent))then
+ SuppressAlert := true;
+ SuppressAlertReason := "Alert Has Been Triggered For all containing Drugs.";
+ conclude true;
+ endif;
+ endif;
+ //END if all components have been alerted
+
+ //if this drug is a component that has been alerted
+ if(count(Alerts Where Alerts.TriggeringInfo in (OtherOrderDrugMappingDataContainingThisComponent.ocmi_Name)) > 0)then
+ SuppressAlert := true;
+ containingDrugName := (first of (Alerts Where Alerts.TriggeringInfo in (OtherOrderDrugMappingDataContainingThisComponent.ocmi_Name))).TriggeringInfo;
+ SuppressAlertReason := "Alert Has Been Triggered For a Drug containing this Drug - " || containingDrugName;
+ conclude true;
+ endif;
+ //END if this drug is a component that has been alerted
+ endif;
+
+ conclude true;
+
+
+ ;;
+ action:
+
+ return SuppressAlert;
+ ;;
+Urgency: 90;;
+end:
diff --git a/MLMStripper/bin/Debug/MLM/MLM_CONFIG_TOOL_READER.mlm b/MLMStripper/bin/Debug/MLM/MLM_CONFIG_TOOL_READER.mlm
new file mode 100644
index 0000000..9c05df2
--- /dev/null
+++ b/MLMStripper/bin/Debug/MLM/MLM_CONFIG_TOOL_READER.mlm
@@ -0,0 +1,49 @@
+maintenance:
+
+ title: MLM_config_tool_reader;;
+ mlmname: MLM_config_tool_reader;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: ;;
+ author: Allscripts Custom Services;;
+ specialist: ACS;;
+ date: 2011-08-11;;
+ validation: testing;;
+
+library:
+ purpose: read the MLM Configuration Tool Tables and return site data.
+ ;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (MLM_name) := argument;
+
+ // pull all config data for this mlm
+ (var_id, mlm_var_list, site_config_name_list) := read
+ {"select c.var_id, c.MLMvar, "
+ ||" case "
+ ||" when l.allowmult = 0 then " //remove the beginning end quotes
+ ||" substring(SiteConfigName, 2, datalength(SiteConfigName) - 2 ) "
+ ||" else SiteConfigName " //leave quotes
+ ||" end "
+ ||" from ACSMLMLocalConfig c "
+ ||" join AcsMLMlibrary l on c.var_id = l.var_id "
+ ||" where c.MLMname like " || sql(MLM_Name)
+ ||" and c.active = 1 "
+ ||" and l.active = 1 "
+ };
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic: conclude true;
+ ;;
+ action: return var_id, mlm_var_list, site_config_name_list;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/MLMStripper.exe b/MLMStripper/bin/Debug/MLMStripper.exe
index fe46b43..36fcbd3 100644
Binary files a/MLMStripper/bin/Debug/MLMStripper.exe and b/MLMStripper/bin/Debug/MLMStripper.exe differ
diff --git a/MLMStripper/bin/Debug/MLMStripper.pdb b/MLMStripper/bin/Debug/MLMStripper.pdb
index fc65cbb..1640b48 100644
Binary files a/MLMStripper/bin/Debug/MLMStripper.pdb and b/MLMStripper/bin/Debug/MLMStripper.pdb differ
diff --git a/MLMStripper/bin/Debug/OVERDUE/OVERDUE_REQ_TIME.mlm b/MLMStripper/bin/Debug/OVERDUE/OVERDUE_REQ_TIME.mlm
new file mode 100644
index 0000000..fd6d6de
--- /dev/null
+++ b/MLMStripper/bin/Debug/OVERDUE/OVERDUE_REQ_TIME.mlm
@@ -0,0 +1,77 @@
+maintenance:
+
+ title: Check for overdue requested time;;
+ mlmname: overdue_req_time;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St. Clair Hospital;;
+ author: Eclipsys Corporation;;
+ specialist: Eclipsys Corporation;;
+ date: 2006-10-17;;
+ validation: testing;;
+
+library:
+ purpose:
+ Based on the time specified in a specified field (argument), this will compare it
+ to the present time to see if it is passed. If a coded time is requested, this
+ looks up the high limit on the coded time, before comparing it to the present time.
+ ;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ ( time_value,
+ time_type
+ ) := ARGUMENT;
+
+ // initialize return var:
+ rtn_var := FALSE;
+
+ // Get current time and convert to HHMM:
+ curr_hr := extract hour now;
+ curr_mn := extract minute now;
+ curr_time := curr_hr || curr_mn;
+
+ if called_by_editor then
+ time_value := "11:22";
+ time_type := "scheduled";
+ endif;
+
+ if time_type = "coded" then
+ // lookup configured start and end times
+ (cfg_name, t_limit, cfg_priority, curr_time_2) := read last
+ {" select name, endtime, prioritycode, "
+ ||" convert(varchar(2),datepart(hh,getdate())) "
+ ||" + convert(varchar(2),datepart(mm,getdate())) "
+ ||" from cv3codedtime "
+ ||" where name = " || sql(time_value)
+ ||" and active = 1 " };
+
+ elseif time_type = "scheduled" then
+ // remove the {{{SINGLE-QUOTE}}}:{{{SINGLE-QUOTE}}} from the hh:mm
+ (t_limit, curr_time_2) := read last
+ {" select stuff(" || sql (time_value) || ", patindex({{{SINGLE-QUOTE}}}%:%{{{SINGLE-QUOTE}}},"
+ || sql (time_value) || " ),1,null), "
+ ||" convert(varchar(2),datepart(hh,getdate())) "
+ ||" + convert(varchar(2),datepart(mm,getdate())) "};
+ endif;
+ ;;
+ evoke: /* Call MLM */
+ ;;
+ logic:
+
+ if (curr_time as number) > (t_limit as number) then // delivery time has passed
+ rtn_val := TRUE;
+ endif;
+
+ conclude true;
+ ;;
+ action:
+
+ return rtn_val ;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SC/SC_ORDERSETS_CORRECT_SESSION.mlm b/MLMStripper/bin/Debug/SC/SC_ORDERSETS_CORRECT_SESSION.mlm
new file mode 100644
index 0000000..b83971f
--- /dev/null
+++ b/MLMStripper/bin/Debug/SC/SC_ORDERSETS_CORRECT_SESSION.mlm
@@ -0,0 +1,135 @@
+maintenance:
+
+ title: SCH Order Sets Correct Session;;
+ filename: SC_Ordersets_Correct_Session;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair;;
+ author: Robert Spence;;
+ specialist: Robert Spence;;
+ date: 2010-05-07;;
+ validation: testing;;
+
+library:
+ purpose: Check to see if ordersets in list are in the correct session, if not alert with appropriate information
+ ;;
+ explanation: Same as purpose.
+
+ Change History
+ Robert 05.07.2010 - Original Coding.
+ DW 08.29.2014 - CSR# 32551 - Added ED location override code for the "Acute Ischemic Stroke/TIA Admission" OS
+ JML 03.21.2016 - CSR# 34077 - Added Transition Orders to Hold session.
+ DW 05.25.2017 - CSR# 35320 - Added Discharge Order Set - Outpatient{{{SINGLE-QUOTE}}} to Discharge session.
+
+
+ ;;
+ keywords: Order set, admission, discharge, session type, worksheetinfo
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ log_execution_info:= false;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ send_alert := "DoNotSend";
+
+ location := read last {ClientVisit : CurrentLocation};
+
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+
+ order_sess_alert:= destination { Alert: warning, "Order Session Type", high, chart, "Order Session Type", 15042, send_alert, "No Override Allowed" };
+
+
+ event_var:= Event {OrderSetInit User OrderSet: WHERE OrderSetName Matches pattern "Admission Orders%"
+ or OrderSetName Matches pattern "Discharge Orders%"
+ or OrderSetName Matches pattern "Pediatric -%Admission"
+ or OrderSetName Matches pattern "Transition Orders%"
+ or OrderSetName = "Discharge Order Set - Outpatient"
+ };
+
+ MessageOut := "";
+
+
+ (order_name,order_status) := read last {OrderSet: OrderSetName, OrderSetStatusCode REFERENCING EvokingObject };
+ stoporder:= false;
+
+
+ // Discharge OS handling
+
+ if (order_name matches pattern "Discharge Orders%" or order_name = "Discharge Order Set - Outpatient") and worksheetinfo.sessiontype <> "Discharge"
+
+ then
+
+ if worksheetInfo.UnsubmittedOrdersCount = 0
+
+ then
+ void := call worksheetInfo.SetSessionType with ("Discharge", "Discharge Orders");
+
+ else
+ stoporder := true;
+ MessageOut := "ALERT: Discharge Order Session Type is Required for Discharge Orders." || "\n\n"
+ || "Please Select ""Go Back"" and Re-Select a Session Type of ""Discharge""\n\n"
+ || " on the Order Entry Worksheet";
+ endif;
+
+
+
+ // Admission OS handling
+
+
+ elseif (
+ (order_name matches pattern "Admission Orders%" or order_name matches pattern "Pediatric -%Admission")
+ and worksheetinfo.sessiontype <> "Hold" and (location matches pattern "ER%" or location = "Pre-Admit" )
+ )
+
+ then
+ if worksheetInfo.UnsubmittedOrdersCount = 0
+
+ then
+ void := call worksheetInfo.SetSessionType with ("Hold", "Hold Orders");
+
+ else
+ stoporder := true;
+ MessageOut := "ALERT: Hold Order Session Type is Required for Admission Orders. " || "\n\n"
+ || "Please Select ""Go Back"" and Re-Select a Session Type of ""Hold"" "
+ || "on the Order Entry Worksheet";
+ endif;
+
+ //JML CSR 34077 Change
+ elseif ( order_name matches pattern "Transition Orders%" AND worksheetInfo.sessiontype <> "Hold"
+ AND ( location matches pattern "ER%" OR location = "Pre-Admit" ) ) then
+
+ if ( worksheetInfo.UnsubmittedOrdersCount = 0 ) then
+ void := call worksheetInfo.SetSessionType WITH ("Hold", "Hold Orders" );
+
+ else
+
+ stoporder := true;
+ MessageOut := "ALERT: Hold Order Session Type is required for Transition Orders." || "\n\n"
+ || "Please select ""Go Back"" and re-select a session type of ""Hold"" "
+ || "on the Order Entry Worksheet.";
+ endif;
+
+ endif;
+
+
+;;
+ evoke: event_var;
+ ;;
+ logic:
+ conclude stoporder;
+
+ if( worksheetInfo is NOT NULL ) then
+ void := call worksheetInfo.Dispose;
+ worksheetInfo:= null;
+ endif;
+
+ ;;
+ action:
+ write MessageOut at order_sess_alert;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SC/SC_VISIT_DISCHARGE.mlm b/MLMStripper/bin/Debug/SC/SC_VISIT_DISCHARGE.mlm
new file mode 100644
index 0000000..7db1ff2
--- /dev/null
+++ b/MLMStripper/bin/Debug/SC/SC_VISIT_DISCHARGE.mlm
@@ -0,0 +1,617 @@
+maintenance:
+
+ title: SC Visit Discharge ;;
+ filename: SC_Visit_Discharge;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair;;
+ author: Kathy Kennedy, Eclipsys;;
+ specialist: Robert Spence;;
+ date: 2006-11-06;;
+ validation: testing;;
+
+library:
+ purpose: Do not allow a patient to be discharged via the SCM application
+ if there is no {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} order active on the patient.
+ ;;
+ explanation: When a user selects {{{SINGLE-QUOTE}}}Discharge Visit{{{SINGLE-QUOTE}}} in the SCM application
+ and contiues to discharge the patient when they click the {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} button
+ a hard stop alert will display if the patient does not have an active
+ (i.e. not cancelled or discontinued) {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} order on that particular visit.
+ change history
+
+ 02.22.2008 DJW added logic for additional "registration is incomplete" warning messeage
+ 05.22.2008 RS added logic for 93952 to insure disposition = order type
+ 12.02.2008 DJW altered logic for additional "registration is incomplete" logic (look for clerk initials instead of print location)
+ 07.28.2010 DJW altered logic for presence of date and time stamp requirement on observation orders
+ 12.19.2012 DJW CSR# 25244 Call the Discharge Report which is interfaced back in as a document.
+ 06.12.2014 DJW CSR# 31688 - MU2 Transport CCDA to Manor Care SNFs
+ 07.08.2014 DW CSR# 31688 - MU2 Suppress print for behavioral health patients
+ 08.25.2014 DW CSR# 31688 - Added Concordia as a recipient
+ 09.24.2014 DW CSR# 31688 - Added Family Home Health as a recipient
+ 05.15.2015 DW CSR# 32359 - Physician CPT codes - (build alternate charge when a patient is discharged)
+ 06.22.2015 DW CSR# 32359 - Address the PA / CRNP who enters on behalf of a physician
+ 06.19.2015 SH CSR# 32070 - Discharge Summary requirements - need to make sure Discharge Order Rec is completed if patient here greater than 48 hours AND not deceased.
+ Also patient type changes require the ability to discharge for a date that equals > 48 hours because the system will not allow you discharge with a prior date.
+ 08.18.2015 DW CSR# 26006 - Transport CCDA to CCHIE via XDS protocol
+ 12.01.2016 DW CSR# 35130 - Upgrade SCM to version 16.3
+ 08.22.2017 DW CSR# 36214 - SCM AM Registration - Changed criteria for determining incomplete registration to "iscompleteregistration" flag
+ 04.09.2018 DW CSR# 36624 - Exclude Recurring patients from discharge order requirement
+ 04.19.2018 DW CSR# 36577 - Concordia Visiting Nurses office in South Hills - request for change in direct messaging destination (temporary changed MLM to also send to prior address)
+ 05.24.2018 DW CSR# 36577 - Concordia Visiting Nurses office in South Hills - request for change in direct messaging destination (removed temporary change to also send to prior address)
+ 04.25.2019 DW CSR# 36767 - 18.4 - Discharges in Dev were taking 1 minute. Believe that it was associated with the Environment line. ClientOID "4" = "Test" changed to ClientOID "4" = "Development"
+ 09.20.2019 DW CSR# 35638 - MU3 - Transmit to physician direct address (redisign....pass direct address to create and transport MLM instead of discharge location)
+ 10.07.2019 DW CSR# 38769 - Discharge Opsu, Endo, MLSC (Temporarily override the requirmement to enter a discharge order for SCD patients
+ 11.13.2019 DW CSR# 35638 - MU3 - File Patient Discharge CCDA on ED patients and transmit to Baptist/Providence Point
+
+ ;;
+ keywords: discharge
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+ /* Set to true if logging is needed.*/
+ log_execution_info:= false;
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ DCSummmary_Print_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_DCSUMMARY_PRINT{{{SINGLE-QUOTE}}};
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+
+ // Set the text for this variable to indicate whether to send the message or not.
+ send_alert := "DoNotSend";
+
+ discharge_order := "Discharge";
+ discharge_observation_order := "Discharge-Observation";
+ expired_order := "Expired";
+
+ // 12/2/08 DW changed criteria for identifying incomplete registration
+ // print_location := "print location";
+ reg_initials := "reg initials";
+
+ order_entered := " ";
+ complete_registration := " ";
+ obs_disch_message := " ";
+ msg_Missing_DCRec := " ";
+
+
+ Report_Print_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PRINT{{{SINGLE-QUOTE}}};
+
+
+ /* Change the message within the quotes if a different short-message is needed.*/
+ visit_alert:= destination { Alert: warning, "Visit Discharge", high, chart,
+ "Visit Discharge", 4005, send_alert, "No Override Allowed" };
+
+ visit_discharge := EVENT{ClientVisitDischarge User ClientVisit };
+
+
+ /***************************************************************************************/
+
+ /* This block executes only when this MLM is called by the editor */
+ if called_by_editor then
+ visit_obj := read last
+ { ClientVisit: THIS };
+ EvokingObject := visit_obj;
+ EvokingObject.dischargedtm := "12-26-2012 14:07:00" as time;
+ Bk_Loc_Name := "ER-2401";
+ Bk_Loc_GUid := "4000001081061001";
+ Bk_VisitStatus := "ADM";
+ Bk_TypeCode := "Inpatient";
+ else
+ /* Get the backup Object */
+ (backup_obj) := read last {ClientVisit: Backup REFERENCING EvokingObject};
+ (Bk_VisitStatus) :=
+ read last {ClientVisit: VisitStatus REFERENCING backup_obj};
+ endif;
+
+ /* Get the Client GUID */
+
+ /* Get the ended with data */
+
+ //(visit_guid, chart_guid, client_guid,disch_disp,visit_status,current_location,visit_type) :=
+ // read last {ClientVisit: GUID, ChartGUID, ClientGUID, DischargeDisposition,VisitStatus,CurrentLocation,TypeCode REFERENCING EvokingObject};
+ (visit_guid, chart_guid, client_guid,disch_disp,visit_status,current_location,visit_type,DischargeDtm, AdmitDtm) :=
+ read last {ClientVisit: GUID, ChartGUID, ClientGUID, DischargeDisposition,VisitStatus,CurrentLocation,TypeCode,DischargeDtm,AdmitDtm REFERENCING EvokingObject};
+
+ LOShours := (((DischargeDtm - AdmitDtm) / 60 seconds) / 60) formatted with "%.2f";
+
+
+ patient_type_change_post_discharge_guid := read last {"select o.guid from cv3clientvisit cv with (nolock) "
+ || " inner join cv3order o with (nolock) on cv.clientguid = o.clientguid "
+ || " and cv.chartguid = o.chartguid and cv.guid = o.clientvisitguid and o.name = {{{SINGLE-QUOTE}}}Patient Type Change Post Discharge{{{SINGLE-QUOTE}}} "
+ || " where cv.ClientGUID = " || sql(client_guid)
+ || " and cv.ChartGUID = " || sql(chart_guid)
+ || " and cv.GUID = " || sql(visit_guid)
+ || " and o.OrderStatusCode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} "};
+
+
+ exist_order := read last {"select name from Cv3Order where (name = " || SQL(discharge_order)
+ || " or name = " || SQL(expired_order) || "or name = " || SQL(discharge_observation_order) || ")"
+ || " and ClientGUID = " || SQL(client_guid)
+ || " and ChartGUID = " || SQL(chart_guid)
+ || " and ClientVisitGUID= " || SQL(visit_guid)
+ || " and active = 1 "
+ || " and OrderStatusLevelNum > 15 "
+ || " and OrderStatusLevelNum not in (69, 70) "
+ };
+ order_bad := false;
+
+
+ dc_orderrec_GUID := read last {"select guid from CV3OrderReconcile with (nolock) "
+ || " where clientguid = " || sql(client_guid)
+ || " and chartguid = " || sql(chart_guid)
+ || " and ClientVisitGUID = " || sql(visit_guid)
+ || " and reconciletypecode = {{{SINGLE-QUOTE}}}discharge{{{SINGLE-QUOTE}}} "
+ || " and ReconcileStatusType = 2 "};
+
+
+ // 2008-07-10 RS Added to override order checking if patient is already discharged. Note we use the backup object in this scenario
+ // 2018-04-09 DW Also exclude recurring patients from this "discarge order" logic
+
+ If Bk_VisitStatus = "DSC" or visit_type = "recurring" then
+ order_bad := false;
+ else
+ if exist exist_order then
+ Is_Exp := read last {" Select isexpired from CV3DischargeDisposition "
+ || " where code = " || SQL(disch_disp)
+ || " and active = 1 "
+ };
+
+
+
+
+ If (exist_order = discharge_order) and (Is_Exp = true) then
+ order_entered := "\n" || "\n" || " You are discharging this patient as: {{{SINGLE-QUOTE}}}" || disch_disp || "{{{SINGLE-QUOTE}}}"
+ || "\n No {{{SINGLE-QUOTE}}}Expired{{{SINGLE-QUOTE}}} order has been placed for this visit. "
+ || "\n\n There is, however, an active {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} order for this visit "
+ ;
+ order_bad := true;
+ elseif (exist_order = expired_order) and (Is_Exp = False) then
+ order_entered := "\n" || "\n" ||" You are discharging this patient to: {{{SINGLE-QUOTE}}}" || disch_disp || "{{{SINGLE-QUOTE}}}"
+ || "\n No {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} order has been placed for this visit."
+ || "\n\n There is, however, an active {{{SINGLE-QUOTE}}}Expired{{{SINGLE-QUOTE}}} order for this visit ";
+ order_bad := true;
+
+ else
+ order_entered := " ";
+ order_bad := false;
+ endif;
+ else
+ order_entered := "\n" || "\n" || " No {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}Expired{{{SINGLE-QUOTE}}} order has been placed for the visit. ";
+ order_bad := true;
+
+ endif;
+ endif;
+
+
+
+ // 12/2/08 DW changed criteria for identifying incomplete registration from print location to reg clerk initials
+ // 08/22/17 DW changed criterai to utilize the "iscompleteregistration" flag
+/*
+ reg_complete := read last {"select typecode from cv3commentdeclaration where typecode = " || SQL(reg_initials)
+ || " and ClientGUID = " || SQL(client_guid)
+ || " and ChartGUID = " || SQL(chart_guid)
+ || " and ClientVisitGUID= " || SQL(visit_guid)
+ || " and active = 1 "
+ };
+*/
+ reg_complete := read last {"
+ select vr.IsCompleteRegistration
+ from SXAAMVisitRegistration vr with (nolock)
+ where vr.IsCompleteRegistration = 1 and vr.ClientVisitGUID = " || visit_guid || " "
+ };
+
+
+ if exist reg_complete then complete_registration := " ";
+ else complete_registration := "\n" || "\n" || " The registration was not completed by the registrar. ";
+ endif;
+
+
+
+
+ // 07/28/2010 DW added criteria to look for missing discharge time
+
+ obs_disch_incomplete_flag :=false;
+ obs_disch_miss_date,obs_disch_miss_time := read last {"select top 1 isnull (requesteddate,{{{SINGLE-QUOTE}}}date missing{{{SINGLE-QUOTE}}}), isnull (requestedtime,{{{SINGLE-QUOTE}}}time missing{{{SINGLE-QUOTE}}}) "
+ || " from cv3order with (nolock)"
+ || " where name = {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} "
+ || " and ClientGUID = " || SQL(client_guid)
+ || " and ChartGUID = " || SQL(chart_guid)
+ || " and ClientVisitGUID= " || SQL(visit_guid)
+ || " and active = 1 and orderstatuscode <> {{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}} and orderstatuscode <> {{{SINGLE-QUOTE}}}COMP{{{SINGLE-QUOTE}}} and orderstatuscode <> {{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}} "
+ || " order by requesteddtm desc "
+ };
+
+ if (obs_disch_miss_date = "date missing" or obs_disch_miss_time = "time missing")
+ and visit_type = "Observation" and current_location matches pattern "4B-%"
+
+ then obs_disch_incomplete_flag :=true;
+ obs_disch_message := "\n" || "\n" || " The {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} order does not have an effective date / time. "
+ || "\n Please modify this order with the appropriate date and time. ";
+
+ else obs_disch_message := " ";
+ endif;
+/*
+ if (order_bad = false) and exist reg_complete and (obs_disch_incomplete_flag = false) then
+ reportname := "PatDischargeInst_MLM"; logicalprinter := ""; physicalprinter:= "PDF_RAS";
+ void := call Report_Print_MLM with(reportname, logicalprinter, physicalprinter);
+ else
+ break;
+ endif;
+*/
+
+
+ // 10.07.2019 DW CSR# 38769 - Discharge Opsu, Endo, MLSC (Temporarily override the requirmement to enter a discharge order for SCD patients
+
+ sdc_patient := read {"
+ select typecode
+ from CV3ActiveVisitList with (nolock)
+ where typecode = {{{SINGLE-QUOTE}}}sdc{{{SINGLE-QUOTE}}} and CurrentLocation in ({{{SINGLE-QUOTE}}}MTLSC{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}ENDO{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}St. Clair Hospital Anc{{{SINGLE-QUOTE}}})
+ and ClientGUID = " || client_guid || " and ChartGUID = " || chart_guid || " and GUID= " || visit_guid || "
+ "};
+
+ if exist sdc_patient then order_bad := false; endif;
+
+
+
+
+
+
+ // CCDA TRANSMISSION SECTION
+
+
+
+
+ // Gather some information for all CCDA document processing
+
+ SCMEnvironment := read last
+ { " SELECT "
+ ||" case when substring (value, 28,1) = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Production{{{SINGLE-QUOTE}}} "
+ ||" when substring (value, 28,1) = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Test{{{SINGLE-QUOTE}}} "
+ ||" when substring (value, 28,1) = {{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Training{{{SINGLE-QUOTE}}} "
+ ||" when substring (value, 28,1) = {{{SINGLE-QUOTE}}}4{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Development{{{SINGLE-QUOTE}}} "
+ ||" else {{{SINGLE-QUOTE}}}Other{{{SINGLE-QUOTE}}} "
+ ||" end "
+ ||" FROM HVCEnvProfile with (nolock) "
+ ||" WHERE Code = {{{SINGLE-QUOTE}}}ClientOID{{{SINGLE-QUOTE}}} "
+ ||" AND HierarchyCode = {{{SINGLE-QUOTE}}}Documents|Continuity of Care{{{SINGLE-QUOTE}}}"};
+
+
+// 04.25.2019 DW CSR# 36767 - 18.4
+// This code was introduced on 04/19/2018 when Train and Dev were swapped (originally Train was 4 and Dev was 3). Was it a mistake?
+// ||" when substring (value, 28,1) = {{{SINGLE-QUOTE}}}4{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Test{{{SINGLE-QUOTE}}} "
+
+
+
+ PsychPatient := read
+ {
+ " Select currentlocation from cv3clientvisit with (nolock) "
+ || " Where ClientGUID = " || sql(client_guid) || " AND ChartGUID = " || SQL(chart_guid)
+ || " AND GUID = " || SQL(visit_guid) || " and currentlocation like {{{SINGLE-QUOTE}}}Psy%{{{SINGLE-QUOTE}}} "
+ };
+
+
+ DischargeLocation := EVOKINGOBJECT.DischargeLocation;
+
+
+ // CCDA tranmission to nursing homes
+
+
+ // If (visit_type = "Inpatient" or visit_type = "Observation") and (SCMEnvironment = "Production" or SCMEnvironment = "Test") and order_bad = false // updated 11/13/2019
+
+ If (visit_type = "Inpatient" or visit_type = "Observation" or visit_type = "Emergency" )and order_bad = false
+
+ then
+
+ If DischargeLocation matches pattern "Manor Care%" or
+ DischargeLocation = "Concordia" or
+ DischargeLocation = "Home with Family Home Health" or
+ DischargeLocation = "Baptist Home" or
+ DischargeLocation = "Baptist Home PCH" or
+ DischargeLocation = "Providence Point"
+
+ then
+
+ If DischargeLocation = "Manor Care Bethel Park" then DirectAddress := "BethelPark@hcr-manorcaredirect.com";
+ ElseIf DischargeLocation = "Manor Care Greentree" then DirectAddress := "Greentree@hcr-manorcaredirect.com";
+ ElseIf DischargeLocation = "Manor Care Peters Township" then DirectAddress := "PetersTownship@hcr-manorcaredirect.com";
+ ElseIf DischargeLocation = "Manor Care Whitehall Borough" then DirectAddress := "WhitehallBorough@hcr-manorcaredirect.com";
+ ElseIf DischargeLocation = "Concordia" then DirectAddress := "CCSNClinical@cabot.netsmartdirect.net";
+ ElseIf DischargeLocation = "Home with Family Home Health" then DirectAddress := "familyhomehealthservices@direct.medalliesmail.com";
+ ElseIf DischargeLocation = "Baptist Home" then DirectAddress := "baptisthomessociety@sch.allscriptsdirect.net";
+ ElseIf DischargeLocation = "Baptist Home PCH" then DirectAddress := "baptisthomessociety@sch.allscriptsdirect.net";
+ ElseIf DischargeLocation = "Providence Point" then DirectAddress := "providencepoint@sch.allscriptsdirect.net";
+ endif;
+
+ Transport := TRUE;
+ TransportType := "DIRECT";
+ CCDAReport := "CCDA Summary of Care";
+
+ CCD_MLM := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CCDA_CREATE_AND_TRANSPORT{{{SINGLE-QUOTE}}};
+ void := call CCD_MLM with client_guid,chart_guid,visit_guid,CCDAReport,Transport,SCMEnvironment,DirectAddress,TransportType;
+
+ endif;
+
+ endif;
+
+
+
+ // CCDA tranmission to individual physician
+
+
+ If (SCMEnvironment = "Production" or SCMEnvironment = "Test") and order_bad = false
+
+ then
+
+ direct_address := read {"
+ select oud.value
+ from cv3ordercatalogmasteritem ocmi with (nolock)
+ join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.ClientGUID = " || client_guid || " and o.ChartGUID = " || chart_guid || " and o.ClientVisitGUID = " || visit_guid || "
+ join CV3OrderUserData oud with (nolock) on o.ClientGUID = oud.ClientGUID and o.GUID = oud.OrderGUID and oud.UserDataCode like {{{SINGLE-QUOTE}}}SCH_DI_DirectAddress%{{{SINGLE-QUOTE}}}
+ where ocmi.name = {{{SINGLE-QUOTE}}}Discharge Follow-Up Visits{{{SINGLE-QUOTE}}} and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}})
+ order by o.CreatedWhen desc
+ "};
+
+ If exist direct_address
+
+ then
+
+ Transport := TRUE;
+ TransportType := "DIRECT";
+ CCDAReport := "CCDA Summary of Care";
+
+ for i in 1 seqto count (direct_address) do
+
+ DirectAddress := direct_address[i];
+
+ CCD_MLM := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CCDA_CREATE_AND_TRANSPORT{{{SINGLE-QUOTE}}};
+ void := call CCD_MLM with client_guid,chart_guid,visit_guid,CCDAReport,Transport,SCMEnvironment,DirectAddress,TransportType;
+
+ enddo;
+ endif;
+
+ endif;
+
+
+ // Vistit Discharge Document generation
+
+
+ If (visit_type = "Inpatient" or visit_type = "Observation" or visit_type = "Emergency" ) and not exist PsychPatient and order_bad = false
+
+ then
+ Transport := FALSE;
+ TransportType := "NA";
+ CCDAReport := "CCDA Patient Discharge";
+
+ CCD_MLM := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CCDA_CREATE_AND_TRANSPORT{{{SINGLE-QUOTE}}};
+ void := call CCD_MLM with client_guid,chart_guid,visit_guid,CCDAReport,Transport,SCMEnvironment,DirectAddress,TransportType;
+
+
+ endif;
+
+
+ // CCHIE transmission
+
+
+ If (SCMEnvironment = "Production" or SCMEnvironment = "Development") and not exist PsychPatient and order_bad = false
+
+ then
+ Transport := TRUE;
+ TransportType := "XDS";
+ CCDAReport := "CCDA Post Discharge for CCHIE";
+
+ CCD_MLM := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CCDA_CREATE_AND_TRANSPORT{{{SINGLE-QUOTE}}};
+ void := call CCD_MLM with client_guid,chart_guid,visit_guid,CCDAReport,Transport,SCMEnvironment,DirectAddress,TransportType;
+ endif;
+
+
+
+
+ // Look for Physician "Conditional Discharge" charges
+
+
+
+
+
+if (order_bad = false) and exist reg_complete and (obs_disch_incomplete_flag = false)
+
+ then
+
+ // Find conditional orders entered today
+
+ (ordername1, orderguid1, charge1, charge_date, user_guid,ordername2, diagnosislist, cosigner ) := read last {"select "
+ || " o.name, o.guid, an.Name, substring (convert(char(10), o.entered,110),7,4) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + substring (convert(char(10), o.entered,110),0,6), "
+ || " o.UserGUID, substring (oud.value, 6, len(oud.value)-5) , "
+ || " (select top 1 oud2.value from CV3OrderUserData oud2 with (nolock) where oud2.orderguid = o.guid and oud2.UserDataCode = {{{SINGLE-QUOTE}}}CHG_MDBill_Dx{{{SINGLE-QUOTE}}}),"
+ || " isnull ((select top 1 oud3.value from CV3OrderUserData oud3 with (nolock) where oud3.orderguid = o.guid and oud3.UserDataCode = {{{SINGLE-QUOTE}}}CHG_Cosigner{{{SINGLE-QUOTE}}}), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) "
+ || " from cv3ordercatalogmasteritem ocmi with (nolock) "
+ || " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " join cv3organizationalunit ou with (nolock) on ou.guid = ocmi.orgunitguid "
+ || " join CV3AncillaryName an with (nolock) on an.MainCatItemGUID = ocmi.GUID "
+ || " join CV3OrderUserData oud with (nolock) ON oud.orderguid = o.guid "
+ || " where o.ClientGUID = " || SQL(client_guid) || " and o.ChartGUID= " || SQL(chart_guid) || " and o.ClientVisitGUID = " || SQL(visit_guid) || " and "
+ || " o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.typecode = {{{SINGLE-QUOTE}}}other{{{SINGLE-QUOTE}}} and ou.Description = {{{SINGLE-QUOTE}}}physician{{{SINGLE-QUOTE}}} and CodingStd = {{{SINGLE-QUOTE}}}CHGMD{{{SINGLE-QUOTE}}} "
+ || " and oud.UserDataCode = {{{SINGLE-QUOTE}}}CHG_MDBill_Comment{{{SINGLE-QUOTE}}} "
+ || " and convert(char(10), getdate(),20) = convert(char(10), o.entered,20) "
+ || " order by o.entered desc "
+ };
+
+
+ locationGuid := read last {"SELECT CurrentLocationGUID, touchedWhen"
+ || " FROM CV3ClientVisit with (nolock) "
+ || " WHERE GUID = " || Sql(visit_guid) || " AND ClientGUID = " || Sql(client_guid)
+ , primaryTime = touchedWhen};
+
+
+ // if exists ordername2 and not exists ordername2onfile
+
+ if exists ordername2
+
+ then
+ orderplaced := "false";
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ care_provider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((user_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((locationGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ order_catalog_obj := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with (ordername2);
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}CommonData: {{-R}}\n" || ex.Message || "\n\n";
+
+ if order_catalog_obj is NOT Null then void := call order_catalog_obj.Dispose; order_catalog_obj := null; endif;
+ if location_obj IS NOT Null then void := call location_obj.Dispose; location_obj := null; endif;
+ if care_provider_obj IS NOT Null then void := call care_provider_obj.Dispose; care_provider_obj := null; endif;
+ if client_visit_obj IS NOT Null then void := call client_visit_obj.Dispose; client_visit_obj := null; endif;
+ endcatch;
+
+ try
+ Order_Creation_Reason := "Physician Charge";
+ RequestingSource := "";
+ SessionType := "Standard";
+ SessionReason := "";
+
+ Order_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with client_visit_obj,
+ order_catalog_obj,
+ Order_Creation_Reason,
+ care_provider_obj,
+ RequestingSource,
+ SessionType,
+ SessionReason,
+ location_obj,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
+
+ orderplaced := "true";
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}New Other Order: {{-R}}\n" || ex.Message || "\n\n";
+ if Order_Obj IS NOT Null then void := call Order_Obj.Dispose; Order_Obj := null; endif;
+ endcatch;
+
+ diagnosis_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "CHG_MDBill_Dx","ICD09 " || diagnosislist;
+
+ // 35130 Upgrade SCM to version 16.3
+ // dateofsvc_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue>{{{SINGLE-QUOTE}}} with "CHG_SVC_DATE",charge_date as time;
+ dateofsvc_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue>{{{SINGLE-QUOTE}}} with "CHG_SVC_DATE",(charge_date as time)as{{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}};
+
+ cosigner_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "CHG_Cosigner",cosigner;
+
+ void := call Order_Obj.Save;
+
+ if order_catalog_obj IS NOT Null then void := call order_catalog_obj.Dispose; order_catalog_obj := null; endif;
+ if location_obj IS NOT Null then void := call location_obj.Dispose; location_obj := null; endif;
+ if care_provider_obj IS NOT Null then void := call care_provider_obj.Dispose; care_provider_obj := null; endif;
+ if client_visit_obj IS NOT Null then void := call client_visit_obj.Dispose; client_visit_obj := null; endif;
+
+
+
+ // If the order was successfully placed, launch the Charge Builder App which will delete the conditional order
+
+
+ if orderplaced = "true"
+
+ then
+
+ problemlist := "SCM-Discharge01-01-2015#" || orderguid1 || "#" || user_guid ; // Upon discarge, we send GUIDS
+
+ using "PhysicianChargeBuilder";
+ test:= new net_object {{{SINGLE-QUOTE}}}PhysicianChargeBuilder.PhysicianChargeBuilderForm{{{SINGLE-QUOTE}}} with (problemlist);
+
+ endif;
+
+
+ endif;
+
+
+ endif; // Physician "Conditional Discharge" charges section
+
+
+
+
+ ;;
+ evoke: visit_discharge ;
+ ;;
+ logic:
+
+
+// Launch the Charge Builder App which will delete the conditional order (it will be reported as a credit to the physician billing system)
+
+ if orderplaced = "true"
+ then
+ oeUnsigned:=CALL test.ShowDialog;
+ return_string:= test.text;
+
+ endif;
+
+
+
+// Determine whether to generate a Discharge Instructions PDF
+
+ if (order_bad = false) and exist reg_complete and (obs_disch_incomplete_flag = false)
+ and Bk_VisitStatus = "ADM" and disch_disp <> "DECEASED"
+ and (visit_type = "Inpatient" or visit_type = "Observation")
+ and EvokingObject.dischargedtm IS WITHIN past 24 hours then
+ reportname := "PatDischargeInst_MLM"; logicalprinter := "PDFHL7"; physicalprinter:= "";
+ void := call Report_Print_MLM with(reportname, logicalprinter, physicalprinter);
+ endif;
+
+ missingDCRec := false;
+
+// Determine if Order Rec needs completed and also print DC Summary if exists
+ if (patient_type_change_post_discharge_guid is null
+ and ((LOShours as number) >= 48) and (visit_type = "Inpatient" or visit_type = "Observation")
+ and ((current_location matches pattern "infus%") = false))
+ then
+ if disch_disp = "DECEASED" or disch_disp = "Against Medical Advice" then
+
+ void := CALL DCSummmary_Print_MLM with (client_guid,chart_guid,visit_guid,"Day of Discharge%",null);
+ else
+
+
+ if dc_orderrec_GUID is null or dc_orderrec_GUID = "" then
+ missingDCRec := true;
+ msg_Missing_DCRec := "\n" || "\n" || " {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} Order Reconiliation is incomplete. ";
+
+
+ else
+ missingDCRec := false;
+ msg_Missing_DCRec := " ";
+ void := CALL DCSummmary_Print_MLM with (client_guid,chart_guid,visit_guid,"Day of Discharge%",null);
+ endif;
+
+
+ endif;
+ endif;
+
+
+
+// Determine whether to generate an alert
+
+ if (order_bad = false) and exist reg_complete and (obs_disch_incomplete_flag = false) /*and missingDCRec = false*/ then
+ conclude false;
+ else
+ conclude true;
+
+
+
+ endif;
+ conclude true;
+
+
+ ;;
+ action:
+ write "This visit cannot be discharged for the following reason(s)" || order_entered || complete_registration || obs_disch_message || msg_Missing_DCRec at visit_alert;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SC/SC_VISIT_TRANSFER.mlm b/MLMStripper/bin/Debug/SC/SC_VISIT_TRANSFER.mlm
new file mode 100644
index 0000000..5305d2a
--- /dev/null
+++ b/MLMStripper/bin/Debug/SC/SC_VISIT_TRANSFER.mlm
@@ -0,0 +1,412 @@
+maintenance:
+
+maintenance:
+ title: SC Visit Transfer ;;
+ filename: SC_Visit_Transfer;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair;;
+ author: Robert Spence;;
+ specialist: Robert Spence;;
+ date: 2007-03-22;;
+ validation: testing;;
+
+library:
+ purpose: Do not allow a patient to be transfered via the SCM application
+ if the starting location is not valid
+ ;;
+ explanation: When a user selects {{{SINGLE-QUOTE}}}OK{{{SINGLE-QUOTE}}} in change location (Confirm Transfer) in the SCM application
+ and the patient is not already in house,
+ a hard stop alert will display
+
+ Change History
+ Robert 03.29.2007 - Added logic to allow ER to Psych or ER to IRU
+ 03.29.2007 - Also logic for Psych to ER and IRU to ER
+ 03.02.2010 - Addded logic to trap for release of temp and change to new bed
+ DW 12.16.2010 - Added logic for MRSA ordering
+ JML 05.24.2013 - WO #158012 - Restrict transfer from Infusion, OR, and FBC.
+ STH 04.14.2016 - CSR#: 31256 - Update to allow SDC patients to be transfered to/from all units except IRU and PSYE (there is already logic to handle IRU and PSYE locations).
+ I just commented out the SDC visittype from checking the "bad patient" logic to prevent transfering to/from most locations. {Go-Live 4/25/2016}.
+ JML 02.01.2017 - WO #2545984 - Cancel Discharge events now evoke ClientVisitModify event. Added logic to not process this MLM
+ if previous VisitStatus = DSC.
+ DW 08.29.2017 - CSR# 36214 - SCM AM Registration
+ - Commented out IRU sections
+ - Changed the logic to only fire the "from / to bedded unit" logic on non (clinic or preclinic) patients.
+ - Cleaned up formatting for readability (Ultra edit compare will show many diffreneced even though the differences are harmless formatting changes)
+ - Some routines will not be processed for users other than in the Registration, HIS, and Laboratory departments
+ JML 01.29.2018 - CSR# 26413 - Modified code based on process changes for REG / SCHED activation:
+ - Allow nurses to Check In / Arrive Infusion patients based on a pre-admit location of {{{SINGLE-QUOTE}}}Infusion{{{SINGLE-QUOTE}}}.
+ - Move OR code logic to allow nurses to Check in / Arrive SSOP & Outpatient Surgical patients, using pre-admit location = "OR" and
+ "St. Clair Hospital Anc"
+ JML 02.19.2018 - CSR# 26413 - Modified code to accommodate SDC patient types now registered as OBS patients. Conditionally checking for service type = SSOP to allow nursing to arrive patients into
+ an OR bed.
+
+ ;;
+ keywords: Transfer
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ log_execution_info:= false;
+ send_alert := "DoNotSend";
+ stop_Message := "Test";
+ Hard_Stop:=False;
+
+
+ visit_alert := destination { Alert: warning, "Visit Transfer", high, chart,"Visit Transfer", 4005, send_alert, "No Override Allowed" };
+ visit_transfer:= event{ClientVisitModify User ClientVisit}; // where LocationStatusChange = "Confirm Transfer"};
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+
+ /* This block executes only when this MLM is called by the editor */
+ if called_by_editor then
+ visit_obj := read last { ClientVisit: THIS };
+ EvokingObject := visit_obj;
+ Bk_Loc_Name := "ER-2401";
+ Bk_Loc_GUid := "4000001081061001";
+ Bk_VisitStatus := "ADM";
+ Bk_TypeCode := "Inpatient";
+ else
+ /* Get the backup Object */
+ (backup_obj) := read last {ClientVisit: Backup REFERENCING EvokingObject};
+ (Bk_Loc_Name, Bk_Loc_GUID, Bk_VisitStatus,Bk_TypeCode,Bk_TemporaryLocation, Bk_ServiceGuid) := read last {ClientVisit: CurrentLocation,CurrentLocationGUID,VisitStatus,TypeCode, TemporaryLocation, ServiceGUID REFERENCING backup_obj};
+ endif;
+
+ /* Get the ended with data */
+ (To_Loc_Name,To_Loc_GUID,To_VisitStatus,To_TypeCode,To_TemporaryLocation,VisitGuid) := read last {ClientVisit: CurrentLocation,CurrentLocationGUID,VisitStatus,TypeCode,TemporaryLocation,guid REFERENCING EvokingObject};
+
+ Temp_Loc_Prob:=False;
+ badPatient := False;
+
+ (UserGUID ) := read last { UserInfo: GUID };
+
+
+ // Determine if the user is from Registration, HIS, or Laboratory. These users will not recieve the hard stop related to some sections of the MLM.
+ (UserDepartment) := read last {"
+ select ou.name
+ from CV3User u with (nolock)
+ join cv3organizationalunit ou on ou.guid = u.orgunitguid
+ where " || UserGuid || " = u.guid
+ "
+ };
+
+ (PatientRegistration_Service) := read last { "SELECT s.Description FROM CV3Service s WITH (NOLOCK) where s.GUID = " || SQL(Bk_ServiceGuid) };
+
+ if (UserDepartment = "Registration Department" or UserDepartment = "Laboratory" or UserDepartment = "Eclipsys Corporation") then
+ UserDepartmentAlertOverride := true;
+ else
+ UserDepartmentAlertOverride := false;
+ endif;
+
+ //If ((Bk_Loc_Name = To_Loc_Name) OR (Bk_VisitStatus = "DSC"))// or (To_Loc_Name matches pattern "Room%"))
+ If ( ( Bk_Loc_Name = To_Loc_Name ) OR ( Bk_VisitStatus = "DSC" ) ) then
+ Hard_Stop := False; // This insures that the location is the only change here.
+
+ else
+
+ // Gather Room Lists
+// IRU_Room_List := read {"select name from Cv3Location where name like {{{SINGLE-QUOTE}}}IRU%{{{SINGLE-QUOTE}}} and IsClientLocation = 1 and TypeCode = {{{SINGLE-QUOTE}}}Bed{{{SINGLE-QUOTE}}} order by name "};
+ Psych_Room_List := read {"select name from Cv3Location where name like {{{SINGLE-QUOTE}}}Psy%{{{SINGLE-QUOTE}}} and IsClientLocation = 1 and TypeCode = {{{SINGLE-QUOTE}}}Bed{{{SINGLE-QUOTE}}} order by name "};
+ ER_Room_List := read {"select name from Cv3Location where name like {{{SINGLE-QUOTE}}}ER-%{{{SINGLE-QUOTE}}} and IsClientLocation = 1 and TypeCode = {{{SINGLE-QUOTE}}}Bed{{{SINGLE-QUOTE}}} order by name "};
+ FBC_Room_List := read {"SELECT Name FROM CV3Location WHERE Name LIKE {{{SINGLE-QUOTE}}}FBC-%{{{SINGLE-QUOTE}}} AND IsClientLocation = 1 AND TypeCode = {{{SINGLE-QUOTE}}}Bed{{{SINGLE-QUOTE}}} ORDER BY Name"};
+ INFUSION_Room_List := read {"SELECT Name FROM CV3Location WHERE Name LIKE {{{SINGLE-QUOTE}}}INFUS-%{{{SINGLE-QUOTE}}}AND IsClientLocation = 1 AND TypeCode = {{{SINGLE-QUOTE}}}Bed{{{SINGLE-QUOTE}}} ORDER BY Name "};
+ OR_Room_List := read {"SELECT Name FROM CV3Location WHERE Name LIKE {{{SINGLE-QUOTE}}}OR-%{{{SINGLE-QUOTE}}} AND IsClientLocation = 1 AND TypeCode = {{{SINGLE-QUOTE}}}Bed{{{SINGLE-QUOTE}}} ORDER BY Name "};
+
+ // Determine backup (prior) visit status
+ If Bk_VisitStatus = "PRE" then
+ Bk_VisitStatus := "Pre-Admit";
+ elseif Bk_VisitStatus = "DSC" then
+ Bk_VisitStatus := "Discharged";
+ elseif Bk_VisitStatus = "CLS" then
+ Bk_VisitStatus := "Closed";
+ elseif Bk_VisitStatus = "ADM" then
+ Bk_VisitStatus := "Admitted";
+ endif;
+
+/*
+ // Keep IRU In IRU (Except ED)
+ If (Bk_Loc_Name in IRU_Room_List) and (To_Loc_Name not in IRU_Room_List) and (To_Loc_Name Not in ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "directly from an IRU bed to another unit" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ endif;
+
+ If (Bk_Loc_Name Not in IRU_Room_List) and (To_Loc_Name in IRU_Room_List) and (Bk_Loc_Name Not in ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "directly from this unit to an IRU bed" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ endif;
+*/
+
+
+ // Keep Psych In Psych (Except ED)
+ // From Psych
+ If (Bk_Loc_Name in Psych_Room_List) and (To_Loc_Name not in Psych_Room_List) and (To_Loc_Name Not in ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "directly from a Behavioral Health bed to another unit" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ endif;
+
+ // To Psych
+ If (Bk_Loc_Name Not in Psych_Room_List) and (To_Loc_Name in Psych_Room_List) and (Bk_Loc_Name Not in ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "directly from this unit to a Behavioral Health bed" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ endif;
+
+ If (Bk_TypeCode = "Clinic" OR To_Typecode = "Clinic") then
+ badPatient := True;
+ endif;
+
+ If (Bk_TypeCode = "Pre Clinic" or To_Typecode = "Pre Clinic") then
+ badPatient := True;
+ endif;
+
+
+
+ // Clinic or Pre Clinic patients
+ If (badPatient = True) then
+
+ // Keep FBC In FBC (Except ED)
+ // From FBC
+ If (Bk_Loc_Name IN FBC_Room_List) AND (To_Loc_Name NOT IN FBC_Room_List) and (To_Loc_Name NOT IN ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "as a " || Bk_Typecode || " patient directly from an FBC bed to another unit" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ endif;
+
+ // To FBC
+ If (Bk_Loc_Name NOT IN FBC_Room_List) AND (To_Loc_Name IN FBC_Room_List) AND (Bk_Loc_Name NOT IN ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "as a " || To_Typecode || " patient directly from this unit to an FBC bed" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ endif;
+
+
+ // Keep Infusion In Infusion (Except ED)
+ // From Infusion
+ If (Bk_Loc_Name IN INFUSION_Room_List) AND (To_Loc_Name NOT IN INFUSION_Room_List) AND (To_Loc_Name NOT IN ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "as a " || Bk_Typecode || " patient directly from an Infusion bed to another unit" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ Endif;
+
+ // To Infusion
+ If (Bk_Loc_Name NOT IN INFUSION_Room_List) AND (Bk_Loc_Name <> "Infusion") AND (To_Loc_Name IN INFUSION_Room_List) AND (Bk_Loc_Name NOT IN ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "as a " || Bk_Typecode || " patient directly from this unit to an Infusion bed" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ Endif;
+
+
+ // Do not allow Clinic or Pre Clinic patients transferred out of ED to any bed
+ If (Bk_Loc_Name IN ER_Room_List) AND (To_Loc_Name NOT IN ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "as a " || Bk_Typecode || " patient directly from an ER inpatient bed to another unit" || "\n" ||
+ "Please contact Registration." || "\n\n" || "Current Patient Location is:- " || Bk_Loc_Name|| "\nYou are attempting to transfer to:- " || To_Loc_Name;
+ Endif;
+
+ //Do not allow Clinic or Pre Clinic patients transferred in and out of OR
+ If (Bk_Loc_Name IN OR_Room_List) AND (To_Loc_Name NOT IN OR_Room_List) AND (To_Loc_Name NOT IN ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "as a " || Bk_Typecode || " patient directly from an OR bed to another unit" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ Endif;
+
+ If (Bk_Loc_Name NOT IN OR_Room_List) AND ( Bk_Loc_Name <> "OR" AND Bk_Loc_Name <> "St. Clair Hospital Anc" ) AND (To_Loc_Name IN OR_Room_List) AND (Bk_Loc_Name NOT IN ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "as a " || Bk_Typecode || " patient directly from this unit to an OR bed" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ Endif;
+
+ else // Not a clinic or pre clinic
+
+ //CSR 26413: Build in exception case for SDC and outpatient surgical
+ //TypeCode = SDC, VisitStatus = PRE, Bk_Loc_Name = OR
+ //TypeCode = SDC, VisitStatus = PRE, Bk_Loc_Name = St. Clair Hospital Anc
+ if ( Bk_TypeCode = "SDC" OR PatientRegistration_Service = "SSOP" OR ( Bk_TypeCode = "Inpatient" AND Bk_Loc_Name = "OR" ) ) then
+
+ // Keep OR In OR (Except ED)
+ // To OR
+ If (Bk_Loc_Name NOT IN OR_Room_List) AND ( Bk_Loc_Name <> "OR" AND Bk_Loc_Name <> "St. Clair Hospital Anc" ) AND (To_Loc_Name IN OR_Room_List) AND (Bk_Loc_Name NOT IN ER_Room_List) then
+ Hard_Stop := True;
+ Stop_Message := "as a " || Bk_Typecode || " patient directly from this unit to an OR bed" || "\n" || "You must discharge and readmit the patient " || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name|| "\n" || "You are attempting to transfer to:- " || To_Loc_Name;
+ Endif;
+
+ //All other cases where TypeCode <> Clinic or Pre-Clinic
+ else
+
+ // Is the FROM location a bed?
+ exist_bedded := read last {"select name from Cv3Location where LocnGrpGUID= " || SQL(Bk_Loc_GUID) || " and TypeCode = {{{SINGLE-QUOTE}}}Bed{{{SINGLE-QUOTE}}} and IsClientLocation = 1 and Name= " || SQL(Bk_Loc_Name) };
+
+ If exist exist_bedded then
+ test:=True;
+ else
+ Hard_Stop := True;
+ Stop_Message := "because this patient is not currently assigned to a bed" || "\n" || "Please verify you have selected the correct visit" || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name || "\n" || "Current patient type is:- " || Bk_TypeCode;
+
+ endif;
+
+ // Is the TO location a bed?
+ To_exist_bedded := read last {"select name from Cv3Location where LocnGrpGUID= " || SQL(To_Loc_GUID) || " and TypeCode = {{{SINGLE-QUOTE}}}Bed{{{SINGLE-QUOTE}}} and IsClientLocation = 1 and Name= " || SQL(To_Loc_Name) };
+
+ If exist To_exist_bedded then
+ test:=True;
+ else
+ Hard_Stop := True;
+ Stop_Message := "to an invalid location" || "\n\n" || "You are attempting to transfer to:- " || To_Loc_Name ;
+ endif;
+
+ endif; //Exception case for Surgical Patients (OPSU)
+ Endif; // Is this a clinic or preclinic ?
+
+ // Is the Patient Admitted?
+/*
+ If BK_VisitStatus <> "Admitted" then
+ Hard_Stop :=True;
+ Stop_Message := "because this patient is not currently admitted to the hospital" || "\n" || "Please verify you have selected the correct visit" || "\n\n" ||
+ "Current Patient Location is:- " || Bk_Loc_Name || "\n" || "Current Visit Status is:- " || Bk_VisitStatus ;
+ endif;
+*/
+
+ // Now add the extra for temporary location issue with 5.0 SP3 03/02/2010
+ if Hard_Stop = false then
+ if Bk_TemporaryLocation is null then
+ Hard_Stop := false;
+ else
+ Hard_Stop := true;
+ Stop_Message := "{{+R}}You may not clear the Temporary Location {{+B}}" || "AND{{-B}} transfer to a New Location Bed Assignment in one step" ||
+ "\n\n" || "Please remove the New Location Bed Assignment and Click OK. Then " || "come back and transfer to the New Location Bed Assignment" ;
+ Temp_Loc_Prob:=True;
+ endif;
+ endif;
+
+ endif; // If ((Bk_Loc_Name = To_Loc_Name) OR (Bk_VisitStatus = "DSC"))
+
+ if Temp_Loc_Prob = False then
+ Stop_Message:= "You may not transfer this patient " || Stop_Message ;
+ endif;
+
+ // Added for MRSA Project
+ (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, VisitStatus) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, VisitStatus };
+ (UserGUID ) := read last { UserInfo: GUID };
+
+ MRSA_Rules_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_MRSA_Order{{{SINGLE-QUOTE}}};
+ (ScreeningUnit, OrderedToday, OrderedWithin3, Positivescreen, SignificantDTM, StatusCode, ResultValue, MRSAHistory, NursingHomeResidency, AntiInfectivewithin7)
+ := call MRSA_Rules_MLM with (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation);
+
+ If AntiInfectivewithin7 = "Yes" then
+ ModifierVariable := "Ordered Per Protocol";
+ else
+ ModifierVariable := "MRSA Screen Antibiotics";
+ endif;
+
+ FromUnit:= Substring (find "-" in string Bk_Loc_Name)-1 CHARACTERS From Bk_Loc_Name;
+ ToUnit := Substring (find "-" in string To_Loc_Name)-1 CHARACTERS From To_Loc_Name;
+
+ If FromUnit in ("ICU","CVSU","IRU","5A","5E","6E","5G") then
+ FromScreeningUnit := "Yes";
+ else
+ FromScreeningUnit := "No";
+ endif;
+
+ // Override the ScreeningUnit value attained from the called MLM which is not the "to unit" but is the "from unit"
+ If ToUnit in ("ICU","CVSU","IRU","5A","5E","6E","5G") then
+ ScreeningUnit := "Yes";
+ else
+ ScreeningUnit := "No";
+ endif;
+
+ If VisitStatus = "Adm" and (ScreeningUnit = "Yes" or FromScreeningUnit = "Yes") and FromUnit <> ToUnit and orderedtoday = "No" and Positivescreen = "No" and orderedwithin3 = "No" then
+ Proceed := "Yes";
+ else
+ Proceed := "No";
+ endif;
+
+ SessionType := "Standard";
+ SessionReason := "";
+ RequestingSource := "";
+ user_IDType := "Edstan Number (physician)";
+ order_Creation_Reason := "From Protocol";
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ // user_IDCode := read last {"SELECT IDCode FROM CV3User " || " where GUID = " || UserGUID};
+ user_IDCode := "infectioncontrol";
+ RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
+ location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || ClientGUID};
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ ;;
+ evoke: visit_transfer ;
+ ;;
+ logic:
+ // conclude Hard_Stop;
+ conclude true;
+
+ ;;
+ action:
+
+
+ // MRSA Ordering Change
+ if Hard_Stop = true and UserDepartmentAlertOverride = false then
+ write Stop_Message at visit_alert;
+ else
+ if Proceed = "Yes" then
+
+ try
+ Catalog_Item_Name := "Nasal Screen for MRSA (Infection Control)";
+ Catalog_Item_Modifier := ModifierVariable;
+ Catalog_Item_Version := "";
+ Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
+ Parent_DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
+ with client_visit_obj, // ClientVisit ObjectsPlus object
+ Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ Catalog_Item_Modifier, // string ItemNameModifier
+ Catalog_Item_Version, // string ItemNameModifierVersion
+ order_Creation_Reason, // string CreateReason
+ RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
+ RequestingSource, // string RequestedBySource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+
+ if ( Laboratory_catalog_item is NOT NULL ) then
+ void := call Parent_DiagnosticOrder_obj.Save;
+ void := call Parent_DiagnosticOrder_obj.Dispose;
+ void:= call Laboratory_catalog_item.Dispose;
+ Laboratory_catalog_item:= null;
+ endif;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true; error_message := "{{+R}}New Parent Diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( Laboratory_catalog_item is NOT NULL ) then
+ void:= call Laboratory_catalog_item.Dispose;
+ Laboratory_catalog_item:= null;
+ endif;
+
+ if ( Parent_DiagnosticOrder_obj is NOT NULL ) then
+ void:= call Parent_DiagnosticOrder_obj.Dispose;
+ Parent_DiagnosticOrder_obj:= null;
+ endif;
+
+ Parent_DiagnosticOrder_dest := null;
+
+ endcatch;
+ endif;
+ endif;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_48_HOUR_ANTIBIOTIC_REVIEW_COLUMN_UPDATE.mlm b/MLMStripper/bin/Debug/SCH/SCH_48_HOUR_ANTIBIOTIC_REVIEW_COLUMN_UPDATE.mlm
new file mode 100644
index 0000000..70eea88
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_48_HOUR_ANTIBIOTIC_REVIEW_COLUMN_UPDATE.mlm
@@ -0,0 +1,162 @@
+maintenance:
+
+ title: SCH_48_HOUR_ANTIBIOTIC_REVIEW_COLUMN_UDPATE;;
+ mlmname: SCH_48_HOUR_ANTIBIOTIC_REVIEW_COLUMN_UPDATE;;
+ arden: version 2.50;;
+ version: 16.30;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Peggy Karish, Allscripts Corp, x7441;;
+ date: 2018-02-20;;
+ validation: testing;;
+
+library:
+ purpose: Add value to Enterprise Defined Column on 48 Hour Antibiotic Review Patient List when an ID Consult Order is entered on a patient.
+
+ ;;
+
+ explanation: The pharmacy maintains a custom visit list that contains patients that are currently admitted for a minimum of 48 hours and
+ are being administered a subset of antibiotic medications. This MLM will update an Enterprised Defined Column with "YES"
+ or "NO" based on the existence of an ID Consult order on the patient{{{SINGLE-QUOTE}}}s chart.
+ Valid Values:
+ "YES" = active ID Consult order.
+ "NO" = completed / discontinued ID consult order.
+ Blank = No ID Consult order.
+
+
+ Change history
+
+ 02.20.2018 JML CSR 35297 Created
+
+ ;;
+ keywords: ObjectsPlus/XA, Infectious, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ //str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ log_execution_info := false;
+ update_column := false;
+ consult_doctor := "";
+ excess_chars := 0;
+ trimmed_doc := "";
+ ID_Col_Value := "";
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ consult_order_enter := EVENT { OrderEnter User Order : WHERE Name = "Physician Consult" };
+ consult_order_dc := EVENT { OrderDiscontinue User Order : WHERE Name = "Physician Consult" };
+ consult_order_complete := EVENT { OrderComplete User Order : WHERE Name = "Physician Consult" };
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last { Order : THIS };
+ endif;
+
+
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.ClientVisitGUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ //Retrieve additional data items entered on Order
+ OrderUserData_Obj := read last { Order : OrderUserData REFERENCING EvokingObject };
+
+ //Retrieve physician to be consulted
+ consult_doctor := read last { OrderUserData : Value REFERENCING OrderUserData_Obj WHERE UserDataCode = "Obj_Plus_Consult" };
+
+ //Format physician name
+ excess_chars := FIND "(" IN STRING ( consult_doctor as string );
+ trimmed_doc := TRIM( SUBSTRING ( excess_chars - 1 ) CHARACTERS STARTING AT 1 FROM ( consult_doctor as string ) );
+
+ //Is physician to be consulted an ID doc?
+ ID_Physician := read last { "SELECT 1 FROM CV3CareProvider cp WITH (NOLOCK) WHERE cp.TypeCode = {{{SINGLE-QUOTE}}}Physician{{{SINGLE-QUOTE}}} "
+ || " AND ( cp.Discipline = {{{SINGLE-QUOTE}}}Infectious Disease{{{SINGLE-QUOTE}}} OR cp.Discipline = {{{SINGLE-QUOTE}}}Infectious Diseases{{{SINGLE-QUOTE}}} ) "
+ || " AND cp.DisplayName = " || SQL(trimmed_doc) };
+
+ if ( exists ID_Physician ) then
+ update_column := true;
+
+ if ( EvokingEvent = consult_order_enter ) then
+ ID_Col_Value := "YES";
+ elseif ( EvokingEvent = consult_order_dc OR EvokingEvent = consult_order_complete ) then
+ ID_Col_Value := "";
+ else
+ ID_Col_Value := "";
+ endif;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ consult_order_enter;
+ consult_order_dc;
+ consult_order_complete;
+ ;;
+ logic:
+
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+
+ if ( update_column = true AND ( EvokingEvent = consult_order_enter OR EvokingEvent = consult_order_dc OR EvokingEvent = consult_order_complete ) ) then
+
+ ID_Consult_Col := NEW EDCObj WITH [
+ column_name := "ID Consult",
+ column_value := ID_Col_Value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ return_value := call create_ED_column with ( ID_Consult_Col );
+ conclude true;
+/*
+ elseif ( update_column = true AND EvokingEvent = user_logon ) then
+
+ //Loop through the Infectious Disease column values and update
+ for j IN 1 seqto ( count infect_col_value ) do
+
+ Infect_Col := NEW EDCObj WITH [
+ column_name := "Infectious Disease",
+ column_value := infect_col_value[j],
+ client_guid := infect_client_guid[j],
+ chart_guid := "",
+ client_visit_guid := infect_visit_guid[j]
+ ];
+
+ return_value := call create_ED_column WITH ( Infect_Col );
+ enddo;
+
+ conclude true;
+*/
+ endif;
+
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_COLUMN_UPDATE.mlm b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_COLUMN_UPDATE.mlm
new file mode 100644
index 0000000..fcbdce5
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_COLUMN_UPDATE.mlm
@@ -0,0 +1,208 @@
+maintenance:
+
+ title: SCH_Access_Manager_Column_Update;;
+ mlmname: SCH_Access_Manager_Column_Update;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Eclipsys, Test MLM;;
+ author: Dan Bredl;;
+ specialist: Don Warnick;;
+ date: 2017-10-05;;
+ validation: testing;;
+
+
+library:
+ purpose: This MLM will Enterprise Defined Columns created for the SER system
+
+
+ ;;
+ explanation: The columns will be updated by various registration triggers, client visit enter, client visit modify etc...
+
+
+ Change history
+
+ 10.05.2017 DW CSR# 26413 Access Manager - Created
+ 01/16/2018 BB CSR# 26413 Access Manager - modififed the authorization search, as it changed locations in the database.
+ 08/17/2018 DW HD#3341738 Incomplete registration flag is set to "complete" by incoming "blood refusal" interface message (we should not be sending in interfaced ADT, but we are)
+ 09/27/2018 BB CSR# 36624 Access Manager Phase II - Added new entry for Consent Indicator, which returns if Conditions of Admission or Important Message from Medicare (IMM)
+ or Emergency Medicine Consent to Treat has been filled out in Signature Capture and signed.
+ 10/15/2018 DW CSR# 37522 Optimize timed MLM{{{SINGLE-QUOTE}}}s - Modified the MLM for optimization.
+ 05/10/2019 BB CSR#37676 18.4 Upgrade resolution. Interfaces UserDisplayName is no longer used in this version, has now become {{{SINGLE-QUOTE}}}NPSCMServices{{{SINGLE-QUOTE}}}
+
+
+ ;;
+ keywords: ObjectsPlus, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+ error_destination := destination { Alert } with [alert_type := "Warning",short_message := "ObjectsPlus Error from MLM",priority := "low",scope := "chart",Rule_group := "ObjectsPlus Error from MLM",Rule_number := 1003,Rule_subgroup := "",Send_alert_with_order := "", Alert_dialog_settings := "",Display_alert := true ];
+
+ If called_by_editor then EvokingObject := read last { ClientVisit: This }; endif; // If called by the editor
+
+ SigCaptureFlagFormatted := " "; //[BB] Addition
+
+ // Evoking Events (Note: The ClientVisitModify is not evoked by all Access Manager updates.)
+
+ visit_enter_event := event{ClientVisitEnter Any ClientVisit};
+ visit_modify_event:= event{ClientVisitModify Any ClientVisit};
+
+ (UserDisplayaName ) := read last { UserInfo: Displayname };
+
+
+ if EvokingEventType = "ClientVisitEnter" or EvokingEventType = "ClientVisitModify"
+ then
+ (client_guid, chart_guid, client_visit_guid,New_Location) := read last {ClientVisit: clientguid, chartguid, guid,CurrentLocation REFERENCING EvokingObject};
+ endif;
+
+ if EvokingEventType = "ClientVisitEnter" OR ( UserDisplayaName <> "Interface" AND evokingEventType = "ClientVisitModify" )
+ THEN
+
+ CompleteRegistrationFlag := read last
+ {"
+ select case when vr.IsCompleteRegistration = 0
+ or (avl.CurrentLocation = {{{SINGLE-QUOTE}}}er major{{{SINGLE-QUOTE}}} and vr.ModeOfArrivalID is null) or (avl.CurrentLocation <> {{{SINGLE-QUOTE}}}er major{{{SINGLE-QUOTE}}} and vr.AdmitSourceID is null)
+ then {{{SINGLE-QUOTE}}} * {{{SINGLE-QUOTE}}}else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end
+ from CV3ActiveVisitList avl with (nolock)
+ join SXAAMVisitRegistration vr with (nolock) on vr.ClientVisitGUID = avl.GUID
+ where avl.GUID = " || client_visit_guid || " AND avl.ClientGUID = " || client_guid || " and avl.ChartGUID = " || chart_guid || " "
+ };
+
+ If not exists CompleteRegistrationFlag then CompleteRegistrationFlag := " "; endif; // If for some reason the 4 second delay is not enough
+
+
+ InsuranceAuthorizationFlag := read last
+ {"
+
+ select
+ a.AuthNumber
+ from SXAEDIAuthorization a with (nolock)
+ JOIN SXAEDIAuthorizationPatientVisitXRef avp with (nolock) ON a.AuthorizationID = avp.AuthorizationID
+ where avp.VisitGUID = " || client_visit_guid || " "
+ };
+
+
+ If not exists InsuranceAuthorizationFlag then InsuranceAuthorizationFlag := " "; endif; // If for some reason the 4 second delay is not enough
+
+
+ // Create a Column Object for the Generic Enterprise Defined Column Creator MLM
+
+
+ CreateColumnMLM := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}}; // MLM that creates the Enterprise Defined Column in the "Action" section of the MLM
+ ColumnObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
+
+
+ // Update the Insurance Authorization Column
+
+ Auth_Column := NEW ColumnObj WITH
+ [
+ column_name := "Authorization",
+ column_value := InsuranceAuthorizationFlag,
+ client_guid := client_guid,
+ chart_guid := chart_guid,
+ client_visit_guid := client_visit_guid
+ ];
+ return_value := call CreateColumnMLM with ( Auth_Column );
+
+
+ // Update the Incomplete Registration Column
+
+ IncompleteRegistration_Column := NEW ColumnObj WITH
+ [
+ column_name := "Incomplete Registration",
+ column_value := CompleteRegistrationFlag,
+ client_guid := client_guid,
+ chart_guid := chart_guid,
+ client_visit_guid := client_visit_guid
+ ];
+ return_value := call CreateColumnMLM with ( IncompleteRegistration_Column );
+
+ Endif;
+
+
+ //If UserDisplayaName = "Interface" AND evokingEventType = "ClientVisitModify" //[BB] Interfaces userdisplayanme has changed for 18.4
+ If UserDisplayaName matches pattern "%SCMServices%" AND evokingEventType = "ClientVisitModify"
+ then
+
+ SigCaptureFlag := read
+ {"
+ select case when cd.documentname = {{{SINGLE-QUOTE}}}Conditions of Admission{{{SINGLE-QUOTE}}} Then {{{SINGLE-QUOTE}}}COA{{{SINGLE-QUOTE}}}
+ WHEN cd.documentname = {{{SINGLE-QUOTE}}}Important Message from Medicare (IMM){{{SINGLE-QUOTE}}} Then {{{SINGLE-QUOTE}}}IMM{{{SINGLE-QUOTE}}}
+ WHEN cd.documentname = {{{SINGLE-QUOTE}}}Emergency Medicine Consent to Treat{{{SINGLE-QUOTE}}} Then {{{SINGLE-QUOTE}}}EMCT{{{SINGLE-QUOTE}}}
+ End
+ from cv3clientdocumentCUR cd with (nolock)
+ where cd.Active=1
+ and cd.DocumentName in ({{{SINGLE-QUOTE}}}Conditions of Admission{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Important Message from Medicare (IMM){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Emergency Medicine Consent to Treat{{{SINGLE-QUOTE}}})
+ AND cd.ClientVisitGUID = " || client_visit_guid || " AND cd.ClientGUID = " || client_guid || " AND cd.chartguid = " || chart_guid || " "
+ };
+ if exists SigCaptureFlag then
+
+
+
+ for i in 1 seqto count SigCaptureFlag DO
+ SigCaptureFlagFormatted := SigCaptureFlagFormatted || SigCaptureFlag[i] || " / ";
+ enddo;
+ endif;
+
+ // Update the Admission Column
+ CreateColumnMLM := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}}; // MLM that creates the Enterprise Defined Column in the "Action" section of the MLM
+ ColumnObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
+
+
+ SigCap_Column := NEW ColumnObj WITH
+ [
+ column_name := "Consent Indicator",
+ column_value := SigCaptureFlagFormatted,
+ client_guid := client_guid,
+ chart_guid := chart_guid,
+ client_visit_guid := client_visit_guid
+ ];
+ return_value := call CreateColumnMLM with ( SigCap_Column );
+
+ If not exists SigCaptureFlag then SigCaptureFlag := " "; endif; // If for some reason the 4 second delay is not enough
+
+ endif;
+
+
+ ;;
+
+ priority: 50
+
+ ;;
+
+ evoke:
+
+ // Note: Delays were added because the MLM was sometimes presdeing the creation or modification of the patient record. No data or the piror data was being returned.
+
+ 4 seconds after time of visit_enter_event;
+ 4 seconds after time of visit_modify_event;
+
+
+ ;;
+
+ logic:
+
+ conclude true;
+
+ ;;
+
+ action:
+
+ if Error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}SCH_Access_Manager_Incomplete_Registration_Collumn_Update{{-B}} Please notify your System Administrators that an error message has occurred for this patient. They will review the following error message: \n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_CREATE_ADMITTINGDX_HEALTHISSUE.mlm b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_CREATE_ADMITTINGDX_HEALTHISSUE.mlm
new file mode 100644
index 0000000..82cb89d
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_CREATE_ADMITTINGDX_HEALTHISSUE.mlm
@@ -0,0 +1,165 @@
+maintenance:
+
+ title: SCH_Access_Manager_Create_AdmittingDx_HealthIssue;;
+ mlmname: SCH_Access_Manager_Create_AdmittingDx_HealthIssue;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Dan Bredl ;;
+ specialist: Don Warnick;;
+ date: 2018-01-17;;
+ validation: testing;;
+
+library:
+ purpose: Called from registraion event
+ ;;
+ explanation: This MLM will create or replace an Admitting DX Health Issue each time a Compaint_ECLP health issue is created or replaced.
+
+ Change history
+
+ 01.17.2018 DW CSR# 26413 Access Manager - Created
+ 02.02.2078 DW CSR# 26413 Access Manager - Adjusted the code to only discontinue/create the Admitting DX if the Compaint_ECLP text is different from that of the
+
+ ;;
+ keywords: Regsitration Event MLM
+ ;;
+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";
+ error_occurred := false;
+ send_alert:= "DoNotSend";
+
+ mlm_alert := destination { Alert: warning, "MLM Alert", high, chart, "Registration Issue", 15042, send_alert, "" };
+
+ NewHealthIssue_dest := destination { ObjectsPlus } with [ alert_type := "Warning", short_message := "Object created by MLM", priority := "low", scope := "chart", rule_group := "Health Issue Object", rule_number := 2010 ];
+ Discontinue_HealthIssue_dest := destination { ObjectsPlus } with [ alert_type := "Warning", short_message := "Object deleted by MLM", priority := "low", scope := "chart", rule_group := "Health Issue Object",rule_number := 2040 ];
+
+ alert_dest := destination { Alert: warning, "AdmDxCreateDiagnostics", high, chart, "AdmDxCreateDiagnostics", 15042, send_alert, "" };
+
+
+ If called_by_editor then EvokingObject := read last { ClientVisit: This }; endif; // If called by the editor
+
+ visit_enter_event := event{ClientVisitEnter Any ClientVisit};
+ visit_modify_event:= event{ClientVisitModify Any ClientVisit};
+ (ClientGUID, ChartGUID, ClientVisitGUID) := read last {ClientVisit: clientguid, chartguid, guid REFERENCING EvokingObject};
+
+ // Gather the current Admitting Dx
+
+ (AdmittingDxguid,AdmittingDxText ) := read last
+ {"
+ select
+ hid.guid , hid.shortname
+ from CV3HealthIssueDeclaration as hid with (nolock)
+ where hid.TypeCode = {{{SINGLE-QUOTE}}}Admitting DX{{{SINGLE-QUOTE}}} AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
+ and hid.ClientGUID = " || ClientGUID || " and hid.ChartGUID = " || ChartGUID || " and hid.ClientVisitGUID = " || ClientVisitGUID ||
+ " "} ;
+
+ // Gather the newly filed Complaint_ECLP Dx
+
+ (ComplaintECLPText) := read last
+ {"
+ select
+ hid.Description
+ from CV3HealthIssueDeclaration as hid with (nolock)
+ where hid.TypeCode = {{{SINGLE-QUOTE}}}Complaint_ECLP{{{SINGLE-QUOTE}}} and hid.Description is not null AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
+ and hid.ClientGUID = " || ClientGUID || " and hid.ChartGUID = " || ChartGUID || " and hid.ClientVisitGUID = " || ClientVisitGUID ||
+ " "} ;
+
+
+ // Proceed if the new Complaint_ECLP Health Issue has filed
+
+ // if exists ComplaintECLPText ( DW 02.02.2018 - added qualifiers to only proceed if the Compaint_ECLP HI value has changed (different from current Admitting DX) or this is the initial registration (no Admitting DX))
+
+ if exists ComplaintECLPText and (ComplaintECLPText <> AdmittingDxText or not exists AdmittingDxText)
+
+ then
+
+ // Delete the existing Admitting Dx if it exists (visit modification)
+
+ if exists AdmittingDxguid
+ then
+ Discontinue_HealthIssue_Obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( (AdmittingDxguid as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ empty := call Discontinue_HealthIssue_Obj.Discontinue;
+ Discontinue_HealthIssue_dest.ObjectsPlus := Discontinue_HealthIssue_Obj;
+ endif;
+
+
+ // Create the Admitting Dx health issue using the Complaint_ECLP health issue verbiage
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ endtry;
+
+ catch Exception ex
+ error_occurred:= true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif;
+ endcatch;
+
+ try
+ New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateNonCodedHealthIssue with (client_visit_obj, "Admitting Dx");
+ New_HealthIssue_obj.Name := ComplaintECLPText;
+ New_HealthIssue_obj.Text := ComplaintECLPText;
+ NewHealthIssue_dest.ObjectsPlus := New_HealthIssue_obj;
+ endtry;
+ catch exception ex
+ error_occurred := true;
+ if ( New_HealthIssue_obj is NOT NULL ) then void:= call New_HealthIssue_obj.Dispose; New_HealthIssue_obj:= null; endif;
+ NewHealthIssue_dest := null;
+ endcatch;
+
+
+ endif;
+
+ ;;
+
+
+ evoke:
+
+ // Note: Delay to allow the Complaint_ECLP HI to file
+
+ 4 seconds after time of visit_enter_event;
+ 4 seconds after time of visit_modify_event;
+
+ ;;
+
+ logic:
+ Conclude true ;
+ ;;
+
+ action:
+
+/*
+ write " Messages " || " version 11 "
+ || "\n Evoking Event Type: " || EvokingEventType
+ || "\n Existing AdmittingDx Text: " || AdmittingDxText
+ || "\n New ComplaintECLP Text: " || ComplaintECLPText
+ at alert_dest;
+*/
+
+ if error_occurred
+ then
+ write "An error has occured in the MLM {{+B}} SCH_Access_Manager_Create_AdmittingDx_HealthIssue {{-B}} Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
+ write error_message at mlm_alert;
+ endif;
+
+
+ if exists NewHealthIssue_dest
+ then
+ write TRUE at NewHealthIssue_dest;
+ endif;
+
+ if exists Discontinue_HealthIssue_Dest
+ then
+ write TRUE at Discontinue_HealthIssue_Dest;
+ endif;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_INSURANCEID_FORMATTING.mlm b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_INSURANCEID_FORMATTING.mlm
new file mode 100644
index 0000000..1e0d6df
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_INSURANCEID_FORMATTING.mlm
@@ -0,0 +1,178 @@
+maintenance:
+
+ title: SCH_Access_Manager_InsuranceID_Formatting;;
+ mlmname: SCH_Access_Manager_InsuranceID_Formatting;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Dan Bredl ;;
+ specialist: Don Warnick;;
+ date: 2017-06-05;;
+ validation: testing;;
+
+library:
+ purpose: Called from registraion event
+ ;;
+ explanation: This MLM will check the format of Insurance IDs
+
+ Change history
+
+ 06.05.2017 DW CSR# 26413 Access Manager - Created
+ 01.30.2018 JML CSR# 26413 Access Manager - Modified to accept additional Medicare Insurance Number Formats
+ 02.14.2018 DW CSR# 26413 Access Manager - Modified to accept additional an additional 12 digit pattern
+ 03.28.2018 DW CSR# 36475 AMPFM upgrade - Comment out Medicare rules as new complex ones were introuduced on April 1. The registration department decided to remove all Medicare formatting edits for now
+
+
+ ;;
+ keywords: Regsitration Event MLM
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+
+ send_alert:= "DoNotSend";
+ mlm_alert := destination { Alert: warning, "Insurance Number Formatting Problem", high, chart, "Insurance Formatting MLM", 15042, send_alert, "No Override Allowed" };
+
+ insurance_enter_event := Event {InsuranceEnter ANY ClientVisit};
+ insurance_modify_event:= Event {InsuranceModify ANY ClientVisit};
+
+ ClientUserData_Obj := read last { Insurance: ClientUserData REFERENCING EvokingObject };
+ (CUD_User_Data_Code, CUD_Value ) := read last { ClientUserData: UserDataCode, Value REFERENCING ClientUserData_Obj };
+
+ InsuranceType := EVOKINGOBJECT.FRPName;
+ InsuranceNumber := ClientUserData_Obj.value;
+ InsuranceNumberLength := length (ClientUserData_Obj.value);
+ InsuranceNumberPattern := "";
+ MessageText := "OK";
+ errormessage := " ";
+ GenerateAlert := false;
+
+ // Medicaid Insurance
+
+ If InsuranceNumberLength < 10 and InsuranceType = "MEDICAID"
+ then
+ MessageText := " must be 10 characters in length. The number has " || InsuranceNumberLength || " characters.";
+ else
+ MessageText := "OK";
+
+ endif; // Medicaid
+
+/*
+ // Medicare Insurance
+
+
+ If InsuranceType = "MEDICARE"
+ then
+
+ for x in 1 seqto InsuranceNumberLength do
+
+ InsuranceCharacter := substring 1 characters starting at x from InsuranceNumber ;
+
+ if (InsuranceCharacter as number) is null
+ then InsuranceCharacterType := "X";
+ else InsuranceCharacterType := "9";
+ endif;
+
+ InsuranceNumberPattern := InsuranceNumberPattern || InsuranceCharacterType ;
+
+ enddo;
+
+ If InsuranceNumberLength < 6 or InsuranceNumberLength > 12
+ then
+ MessageText := " must be between 6 and 12 characters in length. The number has " || InsuranceNumberLength || " characters.";
+ elseif
+ InsuranceNumberLength = 6
+ then
+ if InsuranceNumberPattern = "X99999"
+ then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
+ endif;
+ elseif
+ InsuranceNumberLength = 7
+ then
+ if InsuranceNumberPattern = "X999999" or InsuranceNumberPattern = "XX99999"
+ then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
+ endif;
+ elseif
+ InsuranceNumberLength = 8
+ then
+ if InsuranceNumberPattern = "X9999999" or InsuranceNumberPattern = "XX999999"
+ then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
+ endif;
+ elseif
+ InsuranceNumberLength = 9
+ then
+ if InsuranceNumberPattern = "X99999999" or InsuranceNumberPattern = "XX9999999"
+ then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
+ endif;
+ elseif
+ InsuranceNumberLength = 10
+ then
+ if InsuranceNumberPattern = "X999999999" or InsuranceNumberPattern = "XX99999999" or InsuranceNumberPattern = "999999999X" or InsuranceNumberPattern = "9999999999"
+ then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
+ endif;
+ elseif
+ InsuranceNumberLength = 11
+ then
+ // JML : Added insurance number patterns
+ if InsuranceNumberPattern = "X9999999999" or InsuranceNumberPattern = "XX999999999" OR InsuranceNumberPattern = "999999999XX" OR InsuranceNumberPattern = "999999999X9"
+ then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
+ endif;
+ elseif
+ InsuranceNumberLength = 12
+ then
+ // JML : Added insurance number patterns 02/14/2018 DW : added pattern InsuranceNumberPattern = XXX999999999
+ if InsuranceNumberPattern = "X99999999999" or InsuranceNumberPattern = "XX9999999999" or InsuranceNumberPattern = "XXX999999999" or InsuranceNumberPattern = "99999999999X" OR InsuranceNumberPattern = "9999999999XX"
+ then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
+ endif;
+ else
+ MessageText := "OK";
+ endif;
+
+ endif; // Medicare
+
+*/
+
+
+ // Format the error message if necessary
+
+
+ If MessageText <> "OK"
+ then
+ GenerateAlert := true;
+ errormessage := "The " || InsuranceType || " number" || MessageText || " Please correct this.";
+ endif;
+
+
+ ;;
+ evoke:
+
+ insurance_enter_event;
+ insurance_modify_event;
+
+
+ ;;
+ logic:
+ Conclude true ;
+ ;;
+ action:
+
+
+ if GenerateAlert = true
+ then
+ write errormessage at mlm_alert;
+ endif;
+
+
+
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}}SCH_Access_Manager_InsuranceID_Formatting {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
+ write messageText at mlm_alert;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_INSURANCE_CARRIER_B_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_INSURANCE_CARRIER_B_ALERT.mlm
new file mode 100644
index 0000000..c704ca5
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_INSURANCE_CARRIER_B_ALERT.mlm
@@ -0,0 +1,147 @@
+maintenance:
+
+ title: SCH_Access_Manager_Insurance_Carrier_B_Alert;;
+ mlmname: SCH_Access_Manager_Insurance_Carrier_B_Alert;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Eclipsys, Test MLM;;
+ author: Dan Bredl;;
+ specialist: Don Warnick;;
+ date: 2017-10-09;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will alert the user when the visit level incsurance carrier name does not end in (B)
+
+
+ ;;
+ explanation: The MLM will trigger when visit level insurance is modified. This MLM will only affect visits created prior to the SCM migration.
+
+
+ Change history
+
+ 10.09.2017 DW CSR# 26413 Access Manager - Created
+
+ ;;
+
+ keywords: ObjectsPlus, Orders
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+ send_alert := "DoNotSend";
+
+ local_session := cds_session.local;
+
+ error_destination := destination { Alert } with [alert_type := "Warning",short_message := "ObjectsPlus Error from MLM",priority := "low",scope := "chart",Rule_group := "ObjectsPlus Error from MLM",Rule_number := 1003,Rule_subgroup := "",Send_alert_with_order := "", Alert_dialog_settings := "",Display_alert := true ];
+ mlm_alert := destination { Alert: warning, "Insurance Data Alert", high, chart, "Registration Issue", 15042, send_alert, "" };
+
+
+ insurance_modify_event := event{InsuranceModify User ClientVisit};
+ (ClientGuid, ClientVisitGuid) := read last {Insurance: ClientGuid, ClientVisitGUID REFERENCING EvokingObject};
+
+
+ // Only alert registration department users....and HIS
+
+ (UserGUID ) := read last { UserInfo: GUID };
+
+ (UserDepartment) := read last {"
+ select ou.name
+ from CV3User u with (nolock)
+ join cv3organizationalunit ou on ou.guid = u.orgunitguid
+ where " || UserGuid || " = u.guid
+ "
+ };
+
+ if (UserDepartment = "Registration Department" or UserDepartment = "Eclipsys Corporation")
+
+ then
+
+ // Search for visit level insurance that isn{{{SINGLE-QUOTE}}}t suffixed with "(B)"
+
+ InsuranceCarrierNonBGuid := read last
+ {"
+ select fc.guid
+ from CV3FRPContract fc with (nolock)
+ join CV3FRP f with (nolock) on f.GUID = fc.FRPGUID
+ join SXAAMInsuranceCarrier ic with (nolock) on ic.InsuranceCarrierID = f.InsuranceCarrierID
+ where fc.ClientGUID = " || ClientGuid || " and fc.ClientVisitGUID = " || ClientVisitGuid || " and
+ fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and charindex({{{SINGLE-QUOTE}}}(B){{{SINGLE-QUOTE}}},ic.name) = 0 "
+ };
+
+ if EVOKINGOBJECT.GUID = InsuranceCarrierNonBGuid and EVOKINGOBJECT.Status = "Inactive"
+ then
+ local_session.SessionInsurancePlanBIssueCorrected := true;
+ endif;
+
+
+ // Evidence Box for MLM validation
+/*
+ MessageWillDisplay := " "; if exists InsuranceCarrierNonBGuid and EVOKINGOBJECT.Status <> "Inactive" and local_session.SessionService is null then MessageWillDisplay:= " (display error message)"; endif;
+ ThisIsTheBadInsurance:= " "; if EVOKINGOBJECT.GUID = InsuranceCarrierNonBGuid then ThisIsTheBadInsurance:= " *"; endif;
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n\n This Insurance :" || EVOKINGOBJECT.FRPName || MessageWillDisplay ||
+ "\n\n This Status :" || EVOKINGOBJECT.Status ||
+ "\n\n (NonB)Plan Guid :" || InsuranceCarrierNonBGuid ||
+ "\n\n This GUID :" || EVOKINGOBJECT.GUID || ThisIsTheBadInsurance ||
+ "\n\n Issue Resolved :" || local_session.SessionInsurancePlanBIssueCorrected ||
+ " " , "Evidence","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+*/
+
+ If exists InsuranceCarrierNonBGuid and EVOKINGOBJECT.Status <> "Inactive" and local_session.SessionInsurancePlanBIssueCorrected is null
+ then
+ GenerateAlert:= true;
+ errormessage := " This Account contains one or more insurances that need to be updated. " ||
+ " \n\n All insurances should have a name ending with a suffix of (B) example: Medicaid PA(B) " ||
+ " \n\n Please change insurance carrier. " ||
+ " " ;
+ endif;
+
+
+ endif; // Is the user from the Registration or HIS department?
+
+
+
+ ;;
+
+ priority: 50
+ ;;
+
+ evoke:
+
+ insurance_modify_event;
+ ;;
+
+ logic:
+
+ conclude true;
+
+ ;;
+
+ action:
+
+
+ if GenerateAlert = true
+ then
+ write errormessage at mlm_alert;
+ endif;
+
+
+ if Error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}SCH_Access_Manager_Insurance_Carrier_B_Alert {{-B}} Please notify your System Administrators that an error message has occurred for this patient. They will review the following error message: \n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_PATIENT_SELECTION_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_PATIENT_SELECTION_ALERT.mlm
new file mode 100644
index 0000000..112fcc1
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_PATIENT_SELECTION_ALERT.mlm
@@ -0,0 +1,121 @@
+maintenance:
+
+ title: SCH_Access_Manager_Patient_Selection_Alert;;
+ mlmname: SCH_Access_Manager_Patient_Selection_Alert;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Dan Bredl ;;
+ specialist: Don Warnick;;
+ date: 2017-09-27;;
+ validation: testing;;
+
+library:
+ purpose: Called from registraion event
+ ;;
+ explanation: This MLM will check for the combined mrn flag
+
+ Change history
+
+ 09.27.2017 DW CSR# 26413 Access Manager - Created
+ 01.30.2018 JML CSR# 26413 Access Manager - Modified Combined MRN SQL to filter out Inactive comments
+
+ ;;
+ keywords: Regsitration Event MLM
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+ send_alert:= "DoNotSend";
+
+ CombinedMRN_ErrorMessage:= "";
+ SecondAdmit_ErrorMessage:= "";
+
+ mlm_alert := destination { Alert: warning, "MLM Alert", high, chart, "MLM Issue", 15042, send_alert, "No Override Allowed" };
+
+ combinedmrn_alert := destination { Alert: warning, "Combined MRN Alert", high, chart, "Registration Issue", 15042, send_alert, "No Override Allowed" };
+ twovisits_alert := destination { Alert: warning, "2nd Vist Same Day Alert", high, chart, "Registration Issue", 15042, send_alert, "" };
+
+ clientvisit_enter_event := Event {ClientVisitEnter ANY ClientVisit};
+
+ (ClientGuid, ChartGuid, ClientVisitGuid, VisitAdmitDtm) := read last {ClientVisit: clientguid, chartguid,guid,AdmitDtm REFERENCING EvokingObject};
+
+
+
+ // Generate error message if Combined MRN Comment is found
+
+
+ CombinedMRNComment := read last
+ {"
+ select text from CV3CommentDeclaration with (nolock)
+ where typecode = {{{SINGLE-QUOTE}}}MRN{{{SINGLE-QUOTE}}} and text like {{{SINGLE-QUOTE}}}additional%{{{SINGLE-QUOTE}}}
+ and ClientGUID = " || ClientGuid || "
+ AND Active = 1
+ AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
+ "};
+
+ PrimaryMRN := substring 7 characters starting at (length(CombinedMRNComment)-10) from CombinedMRNComment ;
+
+ If exists CombinedMRNComment
+ then
+ CombinedMRN_ErrorMessage := "You have selected the patients secondary medical record number." || " \n\n Please create the account using " || PrimaryMRN || " ";
+ endif;
+
+
+
+ // Generate error message if other visists are scheduled for the same day
+
+
+ VisitAdmitDtmString := VisitAdmitDtm as string;
+ VisitAdmitDtmStringDate:= substring 10 characters from VisitAdmitDtmString; // date only
+
+ OtherVisitAdmitDates := read last
+ {"
+ select substring (VisitIDCode,1,7)
+ from cv3clientvisit
+ where ClientGUID = " || ClientGuid || " and convert(char (10),AdmitDtm,110) = {{{SINGLE-QUOTE}}}" || VisitAdmitDtmStringDate || "{{{SINGLE-QUOTE}}} and VisitStatus <> {{{SINGLE-QUOTE}}}CAN{{{SINGLE-QUOTE}}} "
+ };
+
+ If exists OtherVisitAdmitDates
+ then
+ SecondAdmit_ErrorMessage := " A visit for this day already exists. Please review visit number " || OtherVisitAdmitDates || " and cancel duplicate account if need. ";
+ endif;
+
+
+ ;;
+ evoke:
+
+ clientvisit_enter_event;
+
+ ;;
+ logic:
+ Conclude true ;
+ ;;
+ action:
+
+
+ if CombinedMRN_ErrorMessage <> ""
+ then
+ write CombinedMRN_ErrorMessage at combinedmrn_alert;
+ endif;
+
+
+ if SecondAdmit_ErrorMessage <> ""
+ then
+ write SecondAdmit_ErrorMessage at twovisits_alert;
+ endif;
+
+
+
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}}SCH_Access_Manager_Patient_Selection_Alert {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
+ write messageText at mlm_alert;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_PATIENT_TYPE_CHANGE_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_PATIENT_TYPE_CHANGE_ALERT.mlm
new file mode 100644
index 0000000..830911f
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_PATIENT_TYPE_CHANGE_ALERT.mlm
@@ -0,0 +1,98 @@
+maintenance:
+
+ title: SCH_Access_Manager_Patient_Type_Change_Alert;;
+ mlmname: SCH_Access_Manager_Patient_Type_Change_Alert;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Dan Bredl ;;
+ specialist: Don Warnick;;
+ date: 2017-09-27;;
+ validation: testing;;
+
+library:
+ purpose: Called from registraion event
+ ;;
+ explanation: This MLM will check for the combined mrn flag
+
+ Change history
+
+ 12.19.2017 DW CSR# 26413 Access Manager - Created
+
+ ;;
+ keywords: Regsitration Event MLM
+ ;;
+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";
+ error_occurred := false;
+ send_alert:= "DoNotSend";
+
+ Transfer_ErrorMessage:= "";
+
+ mlm_alert := destination { Alert: warning, "MLM Alert", high, chart, "MLM Issue", 15042, send_alert, "No Override Allowed" };
+ type_change_alert:= destination { Alert: warning, "Patient Type Change Alert", high, chart, "Registration Issue", 15042, send_alert, "" };
+
+ visit_modify:= event{ClientVisitModify User ClientVisit};
+
+ (ClientGuid, ChartGuid, ClientVisitGuid, VisitAdmitDtm) := read last {ClientVisit: clientguid, chartguid,guid,AdmitDtm REFERENCING EvokingObject};
+
+
+ if called_by_editor
+ then
+ visit_obj := read last { ClientVisit: THIS }; EvokingObject := visit_obj; Bk_Loc_Name := "ER-2401"; Bk_Loc_GUid := "4000001081061001"; Bk_VisitStatus := "ADM"; Bk_TypeCode := "Inpatient";
+ else
+
+ // Get the prior data
+
+ (backup_obj) := read last {ClientVisit: Backup REFERENCING EvokingObject};
+ (Bk_Loc_Name, Bk_Loc_GUID, Bk_VisitStatus,Bk_TypeCode,Bk_TemporaryLocation) := read last {ClientVisit: CurrentLocation,CurrentLocationGUID,VisitStatus,TypeCode, TemporaryLocation REFERENCING backup_obj};
+
+ endif;
+
+ // Get the new data
+
+ (To_Loc_Name,To_Loc_GUID,To_VisitStatus,To_TypeCode,To_TemporaryLocation,VisitGuid, CurrentLocationGUID) := read last {ClientVisit: CurrentLocation,CurrentLocationGUID,VisitStatus,TypeCode,TemporaryLocation,guid, CurrentLocationGUID REFERENCING EvokingObject};
+
+ DashPostitionInLocationName := find "-" in string To_Loc_Name;
+
+
+ // If the patient arrival is being cancelled, the location cannot be a bed (...location name has a dash)
+
+ If Bk_VisitStatus = "ADM" and To_VisitStatus = "PRE" and DashPostitionInLocationName <> 0
+ then
+ Transfer_ErrorMessage := "Patient is in a PRE Status - Please Select the Nursing Unit without a Room Number";
+ endif;
+
+
+ ;;
+
+ evoke:
+ visit_modify;
+ ;;
+
+ logic:
+ Conclude true ;
+ ;;
+
+ action:
+
+ If Transfer_ErrorMessage <> ""
+ then
+ write Transfer_ErrorMessage at type_change_alert;
+ endif;
+
+
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}}SCH_Access_Manager_Patient_Type_Change_Alert {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
+ write messageText at mlm_alert;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_REGISTRATION_DATA_COMPATIBILITY_CHECK.mlm b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_REGISTRATION_DATA_COMPATIBILITY_CHECK.mlm
new file mode 100644
index 0000000..d2eb0ea
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_REGISTRATION_DATA_COMPATIBILITY_CHECK.mlm
@@ -0,0 +1,101 @@
+maintenance:
+
+ title: SCH_Access_Manager_Registration_Data_Compatibility_Check;;
+ mlmname: SCH_Access_Manager_Registration_Data_Compatibility_Check;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Dan Bredl ;;
+ specialist: Don Warnick;;
+ date: 2017-12-04;;
+ validation: testing;;
+
+library:
+ purpose: Called from registraion event
+ ;;
+ explanation: This MLM will check for compatibility of registration data
+
+ Change history
+
+ 12.04.2017 DW CSR# 26413 Access Manager - Created
+ 02.06.2018 DW CSR# 26413 Access Manager - Limit Hospice Compatibilty to only Inpatients
+
+ ;;
+ keywords: Regsitration Event MLM
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+
+ local_session := cds_session.local;
+
+ send_alert:= "DoNotSend";
+ mlm_alert := destination { Alert: warning, "Service / Insurance Compatibility Problem", high, chart, "Registration Issue", 15042, send_alert, "No Override Allowed" };
+
+ clientvisit_enter_event:= Event {ClientVisitEnter ANY ClientVisit};
+ insurance_enter_event := Event {InsuranceEnter ANY ClientVisit};
+
+
+ // Hospice Insurance/Service Edit Section
+
+
+ if EvokingEventType = "ClientVisitEnter"
+ then
+ (ClientGuid, ChartGuid, ClientVisitGuid) := read last {ClientVisit: clientguid, chartguid,guid REFERENCING EvokingObject};
+ service := read last {ClientVisit: serviceguid REFERENCING EvokingObject};
+ ServiceDescription := read last {"select Description from CV3Service with (nolock) where guid = " || service || " " };
+ local_session.SessionService := ServiceDescription;
+ local_session.SessionPatientType := EVOKINGOBJECT.TypeCode;
+ GenerateAlert := false;
+ endif;
+
+
+ if EvokingEventType = "InsuranceEnter"
+ then
+ (client_guid, client_visit_guid) := read last {Insurance: ClientGuid, ClientVisitGUID REFERENCING EvokingObject};
+
+ ClientUserData_Obj := read last { Insurance: ClientUserData REFERENCING EvokingObject };
+ errormessage := " ";
+ GenerateAlert := false;
+
+
+
+ If EVOKINGOBJECT.FRPName = "HOSPICE" and EVOKINGOBJECT.Status = "Active" and local_session.SessionService <> "HOSPICE" and local_session.SessionPatientType = "Inpatient" then GenerateAlert := true; errormessage := "\n\nThe patient has been registered with a Hospice insurance plan, but is not registered for Hospice service. Please correct this."; endif;
+ If EVOKINGOBJECT.FRPName <> "HOSPICE" and EVOKINGOBJECT.Status = "Active" and local_session.SessionService = "HOSPICE" and local_session.SessionPatientType = "Inpatient" then GenerateAlert := true; errormessage := "\n\nThe patient is registered for Hospice Service but does not have a Hospice insurance plan. Please correct this."; endif;
+
+ endif;
+
+
+ ;;
+ evoke:
+
+ clientvisit_enter_event;
+ insurance_enter_event;
+
+ ;;
+ logic:
+
+ Conclude true ;
+
+ ;;
+ action:
+
+ if GenerateAlert = true
+ then
+ write errormessage at mlm_alert;
+ endif;
+
+
+ if error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}SCH_Access_Manager_Registration_Data_Compatibility_Check {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
+ endif
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_SUICIDAL_OR_VIOLENT.mlm b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_SUICIDAL_OR_VIOLENT.mlm
new file mode 100644
index 0000000..a2dcaba
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ACCESS_MANAGER_SUICIDAL_OR_VIOLENT.mlm
@@ -0,0 +1,302 @@
+maintenance:
+
+ title: SCH_ACCESS_MANAGER_SUICIDAL_OR_VIOLENT;;
+ mlmname: SCH_ACCESS_MANAGER_SUICIDAL_OR_VIOLENT;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Peggy Karish;;
+ specialist: Don Warnick;;
+ date: 2018-05-01;;
+ validation: testing;;
+
+library:
+ purpose: Called from registraion event
+ ;;
+ explanation: When a quick registration is entered, this MLM will present an alert when Suicide or Violence risk information is found in the chart.
+ It will also update the Suicide Violence status board column
+
+ Change history
+
+ 05.01.2018 DW CSR# 36510 Harm to Self or Others - Created
+ 07.03.2018 DW CSR# 36510 added this response which is configured in the Paient Profile "NA under 12 years of age". There is no comma after the "NA" as there is in the ED Triage Note.
+ 08.14.2018 DW CSR# 36510 Harm to Self or Others - Changes required for inpatient processes
+
+ ;;
+ keywords: Regsitration Event MLM
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+/*
+ // Return break to a single user
+ UserGUID := read last { UserInfo: GUID };
+ UserName := read last {"select displayname from CV3User u with (nolock) where " || UserGuid || " = u.guid and displayname like {{{SINGLE-QUOTE}}}%warnick%{{{SINGLE-QUOTE}}} "};
+ if exists username then break; endif;
+*/
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+ send_alert:= "DoNotSend";
+
+ // Alert Destinations
+
+ mlm_alert := destination { Alert: warning, "MLM Alert", high, chart, "MLM Issue", 15042, send_alert, "No Override Allowed" };
+ harm_alert:= destination { Alert: warning,"HARM / VIOLENCE ALERT", high, chart, "Registration Issue", 15042, send_alert, "" };
+
+ // Evoking Events
+
+ clientvisit_enter_event := event {ClientVisitEnter ANY ClientVisit};
+ client_visit_modify := event {ClientVisitModify User ClientVisit};
+ /*
+ order_discontinue_event := event {OrderDiscontinue User Order: where Name = "SCO"};
+ order_submit_event := event {OrderWorksheetSubmit User };
+
+ if EvokingEventType = "OrderWorksheetSubmit"
+ then
+ UnsubmittedSCO := read last { UNSUBMITTED Order: Name where Name = "SCO"}; // Determine if an SCO is amongst the orders
+ endif;
+*/
+
+
+
+ // Visit Enter/Modify Section
+
+
+ If EvokingEventType = "ClientVisitEnter" or EvokingEventType = "ClientVisitModify"
+
+ then
+
+ PtArrival := "";
+ (ClientGuid, ChartGuid, ClientVisitGuid) := read last {ClientVisit: clientguid, chartguid,guid REFERENCING EvokingObject};
+ VisitRegistration_Obj := read last { ClientVisit: VisitRegistration REFERENCING EvokingObject };
+
+ // Determine it the Modify Event is a Patient Arrival
+
+ If EvokingEventType = "ClientVisitModify"
+ then
+ (backup_obj) := read last {ClientVisit: Backup REFERENCING EvokingObject};
+ (Bk_VisitStatus) := read last {ClientVisit: VisitStatus REFERENCING backup_obj}; // Get the prior data
+ (To_VisitStatus) := read last {ClientVisit: VisitStatus REFERENCING EvokingObject}; // Get the new data
+
+ if Bk_VisitStatus = "PRE" and To_VisitStatus = "ADM" then PtArrival:= "True"; endif;
+ endif;
+
+
+ // Proceed if Quick ED / Inpatient Registration / Observation Registration / Patient Arrival
+
+
+ if (EvokingEventType = "ClientVisitEnter" and EVOKINGOBJECT.TypeCode = "Emergency" and VisitRegistration_Obj.IsCompleteRegistration = false) or
+ (EvokingEventType = "ClientVisitEnter" and EVOKINGOBJECT.TypeCode = "Inpatient" and EVOKINGOBJECT.VisitStatus = "ADM") or
+ (EvokingEventType = "ClientVisitEnter" and EVOKINGOBJECT.TypeCode = "Observation" and EVOKINGOBJECT.VisitStatus = "ADM") or
+ (EvokingEventType = "ClientVisitModify" and EVOKINGOBJECT.TypeCode = "Inpatient" and PtArrival = "True") or
+ (EvokingEventType = "ClientVisitModify" and EVOKINGOBJECT.TypeCode = "Observation" and PtArrival = "True")
+
+ then
+
+
+ // Gather past history
+
+
+ SignificantEvent := read
+ {"
+ select
+ case when (c.OnsetYearNum is null and c.OnsetMonthNum is null) or (c.OnsetYearNum = 0 and c.OnsetMonthNum = 0) then cast (convert(char(10), c.CreatedWhen,20)as varchar)
+ when c.OnsetYearNum is not null and c.OnsetYearNum <> 0 and c.OnsetMonthNum is not null and c.OnsetMonthNum <> 0 and c.OnsetDayNum is not null and c.OnsetDayNum <> 0 then cast (c.OnsetYearNum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + cast (c.OnsetMonthNum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + cast (c.OnsetDayNum as varchar)
+ else
+ case
+ when c.OnsetYearNum is not null and c.OnsetMonthNum = 0 then cast (c.OnsetYearNum as varchar)
+ when c.OnsetYearNum is not null and c.OnsetMonthNum > 0 then cast (c.OnsetYearNum as varchar) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + cast (c.OnsetMonthNum as varchar)
+ end
+ end +
+ case when c.TypeCode = {{{SINGLE-QUOTE}}}Violence-Clinical Support Team{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}} - Flagged for Violence Caution by the Clinical Support Team (see significant event){{{SINGLE-QUOTE}}}
+ when c.TypeCode = {{{SINGLE-QUOTE}}}Behavioral Health{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}} - Flagged by Mental Health for {{{SINGLE-QUOTE}}} + c.Description + {{{SINGLE-QUOTE}}} (see significant event){{{SINGLE-QUOTE}}}
+ end
+ + {{{SINGLE-QUOTE}}}\n{{{SINGLE-QUOTE}}}
+ from CV3ClientEventDeclaration c with (nolock)
+ where c.TypeCode in ({{{SINGLE-QUOTE}}}Violence-Clinical Support Team{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Behavioral Health{{{SINGLE-QUOTE}}}) and c.status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and c.ClientGUID = " || ClientGuid || "
+ order by c.CreatedWhen
+ "};
+
+
+ SuidcideObservation := read
+ {"
+ SET CONCAT_NULL_YIELDS_NULL off
+ select cast (convert(char(10), obsparam.RecordedDtm,20)as varchar) + {{{SINGLE-QUOTE}}} - {{{SINGLE-QUOTE}}} +
+ case when ocmi.name = {{{SINGLE-QUOTE}}}SCH_PSY_Wish to be Dead{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Have you wished you were dead or wished you could sleep and not wake up?{{{SINGLE-QUOTE}}}
+ when ocmi.name = {{{SINGLE-QUOTE}}}SCH_PSY_Suicidal Thoughts{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Have you actually had any thoughts of killing yourself?{{{SINGLE-QUOTE}}}
+ when ocmi.name = {{{SINGLE-QUOTE}}}SCH_PSY_Suicide Behavior Question{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Have you ever done, started, prepared to end your life?{{{SINGLE-QUOTE}}}
+ else ocmi.LeftJustifiedLabel + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + ocmi.RightJustifiedLabel
+ end
+ + {{{SINGLE-QUOTE}}} - {{{SINGLE-QUOTE}}} + {{{SINGLE-QUOTE}}} ({{{SINGLE-QUOTE}}} + fs.Value + obsparam.ValueText +{{{SINGLE-QUOTE}}}){{{SINGLE-QUOTE}}}
+ + {{{SINGLE-QUOTE}}}\n{{{SINGLE-QUOTE}}}
+ from CV3ObsCatalogMasterItem ocmi with (nolock)
+ inner join SXACDObservationParameter obsparam with (nolock) on " || ClientGuid || " = obsparam.ClientGUID and obsparam.ObsMasterItemGUID = ocmi.GUID and obsparam.IsCanceled = 0
+ left outer join SCMObsFSListValues fs with (nolock) on fs.ClientGUID = " || ClientGuid || " and ObsParam.ObservationDocumentGUID = fs.ParentGUID
+ where
+ (
+ (
+ ocmi.name like ({{{SINGLE-QUOTE}}}%hurt%{{{SINGLE-QUOTE}}}) or ocmi.name in ({{{SINGLE-QUOTE}}}SCH_PSY_Wish to be Dead{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_PSY_Suicidal Thoughts{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_PSY_Suicide Behavior Question{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CAS psych suicide homicide ideation{{{SINGLE-QUOTE}}})
+ )
+ and fs.value not in ({{{SINGLE-QUOTE}}}no{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Not at all{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Unable to answer due to clinical condition{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}NA, under 12 years of age{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}NA under 12 years of age{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Unable to respond or under 12 years of age{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}neither{{{SINGLE-QUOTE}}})
+ )
+ or ocmi.name = {{{SINGLE-QUOTE}}}SCH_PSY_Columbia Risk Score{{{SINGLE-QUOTE}}} and obsparam.ValueText <> {{{SINGLE-QUOTE}}}No Risk{{{SINGLE-QUOTE}}}
+
+ order by obsparam.RecordedDtm desc
+ "};
+
+
+
+ // Prepare the alert message
+
+
+ Harm_ErrorMessage:= "";
+ HarmText := "";
+
+
+ // Concatenate the individual significant event items into a text variable (removes the commas)
+
+ If exists SignificantEvent
+ then
+ SignificantEventText:= "";
+ for i in 1 seqto count SignificantEvent do
+ SignificantEventText := SignificantEventText || SignificantEvent[i];
+ enddo;
+
+ HarmText:= SignificantEventText;
+ endif;
+
+
+
+ // Concatenate the individual suicide list items into a text variable (removes the commas)
+
+ If exists SuidcideObservation
+ then
+ SuidcideObservationText:= "";
+ for i in 1 seqto count SuidcideObservation do
+ SuidcideObservationText := SuidcideObservationText || SuidcideObservation[i];
+ enddo;
+
+ if harmtext = ""
+ then
+ HarmText := SuidcideObservationText;
+ else
+ HarmText := HarmText || SuidcideObservationText;
+ endif;
+ endif;
+
+
+
+ // Return the alert and update the enterprise defined column
+
+
+ If HarmText <> ""
+
+ then
+
+
+ // Return the Alert
+
+
+ Harm_ErrorMessage := "{{+B}}{{+R}} CAUTION {{-B}} {{-R}} " ||
+ "\n\n{{+B}}{{+R}}The patient has a history of (or has expressed thoughts of) committing harm to self or others during past visits{{-B}}{{-R}}\n\n" || HarmText || " " ;
+
+
+ // Update the Column
+
+
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}}; // MLM that creates the Enterprise Defined Column
+ EDCObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
+
+ if exists SuidcideObservation or exists SignificantEvent then columnvalue := "Yes"; // Past History
+ else columnvalue := "."; // No Past History
+ endif;
+
+ SuicideViolence_Column := NEW EDCObj WITH
+ [
+ column_name := "Suicide Violence Risk",
+ column_value := columnvalue,
+ client_guid := ClientGUID,
+ chart_guid := ChartGUID,
+ client_visit_guid := ClientVisitGUID
+ ];
+
+ return_value := call create_ED_column with ( SuicideViolence_Column );
+
+ endif;
+
+
+ endif; // Quick ED registtration evoke
+
+
+/*
+
+ // SCO Order Section
+
+
+
+
+ elseif EvokingEventType = "OrderDiscontinue" or (EvokingEventType = "OrderWorksheetSubmit" and exists UnsubmittedSCO)
+
+
+ then
+
+ (ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID};
+
+ // Update the Column
+
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}}; // MLM that creates the Enterprise Defined Column
+ EDCObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
+
+ if EvokingEventType = "OrderWorksheetSubmit" then columnvalue := "Yes"; // New Order
+ else columnvalue := "."; // D/C Order
+ endif;
+
+ SuicideViolence_Column := NEW EDCObj WITH
+ [
+ column_name := "Suicide Violence Risk",
+ column_value := columnvalue,
+ client_guid := ClientGUID,
+ chart_guid := ChartGUID,
+ client_visit_guid := ClientVisitGUID
+ ];
+
+ return_value := call create_ED_column with ( SuicideViolence_Column );
+*/
+ endif;
+
+
+
+ ;;
+ evoke:
+
+ clientvisit_enter_event;
+ client_visit_modify;
+/*
+ order_submit_event;
+ order_discontinue_event;
+*/
+ ;;
+ logic:
+
+ Conclude true ;
+ ;;
+ action:
+
+
+ if Harm_ErrorMessage <> ""
+ then
+ write Harm_ErrorMessage at harm_alert;
+ endif;
+
+
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}} SCH_ACCESS_MANAGER_SUICIDAL_OR_VIOLENT {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
+ write messageText at mlm_alert;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ADMITDISCHARGEEXPIRE_ORDER_GENERATE_MRSA_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_ADMITDISCHARGEEXPIRE_ORDER_GENERATE_MRSA_ORDER.mlm
new file mode 100644
index 0000000..cd78e16
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ADMITDISCHARGEEXPIRE_ORDER_GENERATE_MRSA_ORDER.mlm
@@ -0,0 +1,171 @@
+maintenance:
+
+ title: Ordering: Generate MRSA order upon entry of Admit (for ED admits), Discharge, or Expire order;;
+ mlmname: SCH_AdmitDischargeExpire_Order_Generate_MRSA_Order;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair;;
+ author: Don Warnick, Allscripts Corp;;
+ specialist: Teresa Spicuzza;;
+ date: 2010-12-13;;
+ validation: testing;;
+
+library:
+ purpose: Generate a MRSA order under certain conditions when a patient is discharged, expired, or admited from the ED
+ ;;
+ explanation: When the patient is discharged or expired or admitted from the ED (if certain criteria are met) a MRSA test is required.
+
+ Change history
+
+ 12.16.2010 DW Created
+ 07.07.2016 DW HD# 1744944 - Create a new order only if this the first admit (or discharge order)
+ 10.03.2016 STH CSR#: 35095 - Issue identified where patients that have an admit to inpatient or place in observation order entered days after their admission the logic
+ was creating a new MRSA screen if the previous one was more than 24 hours in the past. The logic has been updated to not create a new MRSA screen
+ if there is any active MRSA screen order already on the patients account.
+ ;;
+ keywords: MRSA
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+(ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, VisitStatus) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, VisitStatus };
+(UserGUID ) := read last { UserInfo: GUID };
+
+
+discharge_expire_event := EVENT {OrderEnter User Order: WHERE Name in ("Discharge","Expired")};
+admit_event := EVENT {OrderEnter User Order: WHERE Name in ("Admit to Inpatient","Place in Observation")};
+
+
+ // Retrieve Current Admit Orders
+
+ (admit_order) := read last
+ {
+ " select ocmi.name "
+ || " from cv3ordercatalogmasteritem ocmi with (nolock) "
+ || " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " where "
+ || " o.clientguid = " || SQL (ClientGuid) || " and o.chartguid = " || SQL (ChartGuid) || " and o.clientvisitguid = " || SQL (ClientVisitGuid) || " and "
+ || " o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) and ocmi.name in ({{{SINGLE-QUOTE}}}Admit to Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Place in Observation{{{SINGLE-QUOTE}}}) "
+ };
+
+ // Retrieve Current Discharge Orders
+
+ (discharge_order) := read last
+ {
+ " select ocmi.name "
+ || " from cv3ordercatalogmasteritem ocmi with (nolock) "
+ || " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " where "
+ || " o.clientguid = " || SQL (ClientGuid) || " and o.chartguid = " || SQL (ChartGuid) || " and o.clientvisitguid = " || SQL (ClientVisitGuid) || " and "
+ || " o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) and ocmi.name in ({{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Expired{{{SINGLE-QUOTE}}}) "
+ };
+
+
+
+MRSA_Rules_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_MRSA_Order{{{SINGLE-QUOTE}}};
+(ScreeningUnit, OrderedToday, OrderedWithin3, Positivescreen, SignificantDTM, StatusCode, ResultValue, MRSAHistory, NursingHomeResidency, AntiInfectivewithin7)
+ := call MRSA_Rules_MLM with (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation);
+
+
+
+If AntiInfectivewithin7 = "Yes" then ModifierVariable := "Ordered Per Protocol"; else ModifierVariable := "MRSA Screen Antibiotics"; endif;
+
+
+// This order is entered on an ED patient to be admitted
+
+if EvokingEvent = admit_event then
+
+ if ((not exist admit_order) and (StatusCode is null) and (VisitStatus = "Adm") and ((NursingHomeResidency = "Yes") or (MRSAHistory = "Yes")))
+ then Proceed := "Yes"; else Proceed := "No";
+ endif;
+
+
+endif;
+
+
+// This order is entered on an inpatients to be discharged or expired
+
+if EvokingEvent = discharge_expire_event then
+
+ if VisitStatus = "Adm" and ScreeningUnit = "Yes" and orderedtoday = "No" and Positivescreen = "No" and orderedwithin3 = "No" and not exist discharge_order
+ then Proceed := "Yes"; else Proceed := "No";
+ endif;
+
+endif;
+
+ SessionType := "Standard";
+ SessionReason := "";
+ RequestingSource := "";
+ user_IDType := "Edstan Number (physician)";
+ order_Creation_Reason := "From Protocol";
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ // user_IDCode := read last {"SELECT IDCode FROM CV3User " || " where GUID = " || UserGUID};
+ user_IDCode := "infectioncontrol";
+ RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
+ location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || ClientGUID};
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+
+ ;;
+ evoke: admit_event or discharge_expire_event
+
+ ;;
+ logic:
+
+ if proceed = "Yes" then conclude true; else conclude false; endif;
+
+ ;;
+ action:
+
+ if Proceed = "Yes" then
+
+ try
+ Catalog_Item_Name := "Nasal Screen for MRSA (Infection Control)";
+ Catalog_Item_Modifier := ModifierVariable;
+ Catalog_Item_Version := "";
+ Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
+ Parent_DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ Catalog_Item_Modifier, // string ItemNameModifier
+ Catalog_Item_Version, // string ItemNameModifierVersion
+ order_Creation_Reason, // string CreateReason
+ RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
+ RequestingSource, // string RequestedBySource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+
+
+ if ( Laboratory_catalog_item is NOT NULL ) then
+ void := call Parent_DiagnosticOrder_obj.Save;
+ void := call Parent_DiagnosticOrder_obj.Dispose;
+ void:= call Laboratory_catalog_item.Dispose;
+ Laboratory_catalog_item:= null;
+ endif;
+
+ endtry;
+
+ catch Exception ex error_occurred := true; error_message := "{{+R}}New Parent Diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( Laboratory_catalog_item is NOT NULL ) then void:= call Laboratory_catalog_item.Dispose; Laboratory_catalog_item:= null; endif;
+ if ( Parent_DiagnosticOrder_obj is NOT NULL ) then void:= call Parent_DiagnosticOrder_obj.Dispose; Parent_DiagnosticOrder_obj:= null; endif;
+
+ Parent_DiagnosticOrder_dest := null;
+
+ endcatch;
+
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_ANTICOAGULANT_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_ANTICOAGULANT_ORDERS.mlm
new file mode 100644
index 0000000..c338976
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_ANTICOAGULANT_ORDERS.mlm
@@ -0,0 +1,933 @@
+maintenance:
+
+ title: SCH_ALERT_ON_ANTICOAGULANT_ORDERS;;
+ mlmname: SCH_ALERT_ON_ANTICOAGULANT_ORDERS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Allscripts;;
+ author: Juliet M. Law;;
+ specialist: Teresa Spicuzza;;
+ date: 2011-07-25;;
+ validation: testing;;
+
+library:
+ purpose: Generate alert if an anticoagulant order exists that conflicts with anticoagulant medication
+ being ordered.
+ ;;
+ explanation: When an order for an anticoagulant is requested, the MLM will check for an existing anticoagulant order.
+ If one exists, then an alert will be generated informing the user that these two orders cannot coexist.
+ The following anticoagulant medications report a conflict and generate a hard or soft stop alert:
+ Soft Stop Alerts
+ ---------------------
+ Lovenox -> Heparin IV
+ Xarelto -> Warfarin
+
+ Hard Stop Alerts
+ ------------------------
+ Lovenox -> Heparin SQ
+ Lovenox -> Pradaxa
+ Lovenox -> Xarelto
+ Heparin IV -> Pradaxa
+ Heparin IV -> Xarelto
+ Heparin SQ -> Pradaxa
+ Heparin SQ -> Xarelto
+ Xarelto -> Pradaxa
+ Pradaxa -> Xarelto
+ Warfarin -> Xarelto
+
+ Change History:
+ 2012.08.19 JML Created
+ 2012.04.04 JML Added logic to capture unsubmitted anticoagulant orders and save to session variable
+ so it can be checked on a Form called MLM
+ 2012.04.26 JML Added logic to include alerts for duplicate orders of Heparin IV, Heparin SQ, and Lovenox.
+ 2012.05.09 JML Changed Lovenox duplicate med alert to soft stop
+ 2012.05.16 JML Changed Heparin duplicate med alert to soft stop
+ 2013.04.09 JML Changed Heparin IV -> Pradaxa & Xarelto from a hard stop to a soft stop
+ 2013.05.01 JML CSR #31334: Added alerts for anticoagulant med additions Arixtra, Argatroban,
+ and Eliquis
+ 2014.10.07 TMS CSR #32392: Added "Warfarin Orders" to the Warfarin_Orderset_Event declaration.
+ 2015.02.03 TMS Corrected name of Dabigatran order set to match catalog name. Ticket 1628100
+ 2015.09.24 TMS Added low intesity heparin protocol to logic. CSR 33670
+ 2016.03.21 JML CSR 33801: Added alert support for Post Op Cardiac Arrest Induced Hypothermia and
+ Non-Formulary Orders order sets.
+ 2017.10.05 SZ CSR #35039: requested changes cause unnecessary alert fatigue in ordersets “Rivaroxaban” and “Apixaban”.
+ I have added child orders to both ordersets with modifier "- Initial Dose" and "- Maintenance Dose"
+ and inserted code in this MLM to prevent orders with those modifiers from firing.
+ 2018.05.31 JML CSR # 35994: Remove pradaxa, xarelto, and apixaban reorder events. This is to remove duplicate anticoagulant
+ alerts that are firing when entering certain orders.
+ 2018.09.11 JML CSR # 37062, 36317: Include functional call to anticoagulant conflict check MLM
+ 2018.11.16 JML CSR # 37344/37345/37346: Added new DVT Anticoagulant Orders- Ortho Procedures order set; called from some
+ ortho post op order sets.
+ 2019.02.12 JML WO# 3622425: Modified Heparin IV duplicate alert to display both order name and order set name for tPA for Pulmonary
+ Embolism due to alert verbiage confusion.
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ //.Net libraries
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Local session object
+ local_session := cds_session.local;
+
+
+ //Include MLM to create Alert On Action object
+ create_alert_on_action_obj := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_ALERT_ACTION_OBJECT{{{SINGLE-QUOTE}}};
+
+ /*******************************************************************/
+ //Set to true if logging needed
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+
+ //Set the stop message
+ stop_message := false;
+ soft_message := false;
+
+ //Set stop
+ hard_stop := false;
+ found_unsubmitted_orders := false;
+ existing_orders := ();
+ alert_priority := "High";
+ include_generic_msg := true;
+ include_trans_msg := false;
+
+ //Destination Object Properties
+ alert_dialog := "Must Acknowledge";
+ alert_message := "";
+ alert_override_msg := "";
+ ok_to_show_aoa := false;
+
+
+ //Define list of anticoagulant medications
+ (anticoagulant_meds) := READ {"SELECT ocmi.Name"
+ || " FROM CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " WHERE ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}coagulation modifiers | anticoagulants{{{SINGLE-QUOTE}}}"
+ || " and ocmi.Name not like {{{SINGLE-QUOTE}}}zz%{{{SINGLE-QUOTE}}}"
+ || " ORDER BY ocmi.Name"};
+
+ (heparin_inj_meds) := (anticoagulant_meds WHERE anticoagulant_meds IN ("Heparin Inj",
+ "Heparin Inj -",
+ "Heparin Inj-",
+ "Heparin Inj.") );
+
+ (heparin_iv_meds) := (anticoagulant_meds WHERE anticoagulant_meds matches pattern "Heparin%25,000%"
+ OR anticoagulant_meds MATCHES PATTERN "Heparin%Infusion%");
+
+ (lovenox_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Enoxaparin%");
+
+ (pradaxa_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Dabigatran%");
+
+ (xarelto_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Rivaroxaban%");
+
+ (warfarin_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Warfarin%");
+
+ //CSR #31334: Leapfrog changes
+ (arixtra_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Fondaparinux%");
+
+ (argatroban_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Argatroban%");
+
+ (apixaban_meds) := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Apixaban%");
+
+
+ //Define Event Triggers for anticoagulant orders and order sets
+ pradaxa_orderset_event := event{OrderSetInit User OrderSet :
+ WHERE OrderSetName = "Dabigatran Orders"};
+
+//******** CSR 35994: Remove reorder events JML ****************************************
+ //Pradaxa Order to prevent reordering
+ //pradaxa_reorder_event := event{OrderInit User Order :
+ // WHERE Name matches pattern "Dabigatran%"};
+ //pradaxa_reorder_event2 := event{OrderEnter User Order :
+ // WHERE Name matches pattern "Dabigatran%"};
+
+
+ lovenox_orderset_event := event{OrderSetInit User OrderSet :
+ WHERE OrderSetName IN ("Enoxaparin"
+ , "Blood Formation/Coagulation"
+ , "Enoxaparin Inj - (Lovenox) 40mg, SQ Q24H"
+ , "Enoxaparin Inj Orders - Post Op Shoulder"
+ , "Enoxaparin Inj Orders - Post Op Hip"
+ , "Enoxaparin Inj Orders - Post Op Knee"
+ , "Enoxaparin Orders - Calculated Dose with CrCl (CPOE Only)")};
+
+ heparin_orderset_event := event{OrderSetInit User OrderSet :
+ WHERE OrderSetName IN ("Weight Based Heparin Protocol (Initial)"
+ ,"Weight Based Heparin Protocol (Maint.)"
+ ,"Post Op Vascular Heparin (Initial)"
+ ,"Post Op Vascular Heparin (Maintenance)"
+ ,"Cardiac/CCM Heparin Protocol (Initial)"
+ ,"Cardiac/CCM Heparin Protocol (Maint)"
+ ,"Low Intensity Heparin Protocol (Init)"
+ ,"Low Intensity Heparin Protocol (Maint)"
+ ,"Retavase Therapy for AMI."
+ ,"Heparin (Vascular Orders) -"
+ ,"Hemodialysis Medications"
+ ,"Heparin IV Bolus (One Time Order Only)"
+ ,"Heparin Inj - SQ"
+ ,"ACS Orders"
+ ,"Blood Formation/Coagulation")};
+
+ xarelto_orderset_event := event{OrderSetInit User OrderSet :
+ WHERE OrderSetName = "Rivaroxaban"};
+
+//******** CSR 35994: Remove reorder events JML ****************************************
+ //Xarelto Order to prevent reordering
+ //xarelto_reorder_event := event{OrderInit User Order :
+ // WHERE Name matches pattern "Rivaroxaban%"};
+ //xarelto_reorder_event2 := event{OrderEnter User Order :
+ // WHERE Name matches pattern "Rivaroxaban%"};
+
+
+ warfarin_orderset_event := event{OrderSetInit User OrderSet :
+ WHERE OrderSetName IN ("Warfarin Sliding Scale"
+ ,"Warfarin Tablet"
+ ,"Warfarin Orders"
+ ,"Warfarin Vial Injection")};
+
+ heparin_nonprotocol_event := event{OrderInit User Order :
+ where typecode="Medication" and Name = "Heparin 25,000 Units + D5W 500ml"};
+ heparin_nonprotocol_event2 := event{OrderEnter User Order :
+ WHERE typecode = "Medication" and Name = "Heparin 25,000 Units + D5W 500ml"};
+
+ //CSR #31334: Leapfrog changes
+ argatroban_order_event := event {OrderInit User Order :
+ WHERE Name matches pattern "Argatroban%"};
+
+ apixaban_orderset_event := event {OrderSetInit User OrderSet :
+ WHERE OrderSetName = "Apixaban"};
+
+//******** CSR 35994: Remove reorder events JML ****************************************
+ //apixaban_reorder_event := event {OrderInit User Order :
+ // WHERE Name matches pattern "Apixaban%"};
+ //apixaban_reorder_event2 := event {OrderEnter User Order :
+ // WHERE Name matches pattern "Apixaban%"};
+
+
+
+ //These are the OS event triggers - secondary MLM FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK interacts with these events
+ //within the OS themselves
+ anticoag_os_event := event{OrderSetInit User OrderSet :
+ WHERE OrderSetName matches pattern "VTE Prophylaxis%"
+ OR OrderSetName IN ("CCM Admission Orders"
+ ,"Non Formulary Medications - Order Set"
+ ,"Total Knee Replacement Post Op Orders"
+ ,"Total Hip Replacement Post Op Orders"
+ ,"Fractured Hip Post Op Orders"
+ ,"Post Op Cardiac Arrest Induced Hypothermia"
+ ,"Post Op Shoulder"
+ ,"tPA (Alteplase) for the Treatment of Pulmonary Embolism (PE)"
+ , "DVT Anticoagulant Orders- Ortho Procedures")};
+
+ //Destination
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "Anticoagulant Order Conflict",
+ priority := alert_priority,
+ scope := Chart,
+ rule_group := "Anticoagulant Conflict Group",
+ rule_number := 8000,
+ send_with_order := send_alert,
+ alert_dialog_settings := alert_dialog,
+ display_alert := true];
+
+
+ /*******************************************************************/
+
+ //Unit testing
+ if called_by_editor then
+ evokingobject := read last {OrderSet : THIS where OrderSetName matches pattern "Heparin Inj%"};
+ endif;
+
+ //Capture current patient
+ (clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
+ clientVisitGuid := read last {ClientVisit : GUID};
+ chartGuid := read last {ClientVisit : ChartGUID};
+
+ //Determine evoking event - grab order or order set object
+ if (EvokingEvent = heparin_nonprotocol_event
+ OR EvokingEvent = heparin_nonprotocol_event2
+ //OR EvokingEvent = pradaxa_reorder_event
+ //OR EvokingEvent = pradaxa_reorder_event2
+ //OR EvokingEvent = xarelto_reorder_event
+ //OR EvokingEvent = xarelto_reorder_event2
+ //OR EvokingEvent = apixaban_reorder_event
+ //OR EvokingEvent = apixaban_reorder_event2
+ OR EvokingEvent = argatroban_order_event) then
+
+ (this_order_id, this_order) := read last {Order : GUID, Name Referencing EvokingObject};
+ else
+ (this_order_id, this_order) := read last {OrderSet : GUID, OrderSetName Referencing EvokingObject};
+ endif;
+
+ //Check for unsubmitted anticoagulant orders
+ (existing_orders, origOrderSet) := READ { UnsubmittedOrders: Name, OrderSetName
+ WHERE Name matches pattern "Heparin Inj%"
+ OR Name matches pattern "Heparin 25%"
+ OR Name matches pattern "Heparin 25%"
+ OR Name matches pattern "Enoxaparin%"
+ OR Name matches pattern "Dabigatran%"
+ OR Name matches pattern "Rivaroxaban%"
+ OR Name matches pattern "Warfarin%"
+ OR Name matches pattern "Fondaparinux%"
+ OR Name matches pattern "Argatroban%"
+ OR Name matches pattern "Apixaban%" };
+
+ //If triggering on unsubmitted orders, set boolean to true for logic to configure alert destination and
+ // set local session var to the list of unsubmitted orders - local session var will be checked
+ // in the OS conflict check
+
+ if ((exists (existing_orders)) AND (count(existing_orders) > 0)) then
+ hard_stop := true;
+
+ if (EvokingEvent = anticoag_os_event) then
+ local_session.SessionUnsubmittedAnticoagulantOrders := existing_orders;
+ endif;
+
+ else
+ //No unsubmitted anticoagulant order - check for existing anticoagulant active orders
+ (existing_orders,
+ origOrderSet) := read {"SELECT o.Name, o.OrderSetName, o.TouchedWhen"
+ || " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " WHERE o.ClientGUID = " || clientGuid
+ || " AND o.ClientVisitGUID = " || clientVisitGuid
+ || " AND o.ChartGUID = " || chartGuid
+ || " AND (o.Name like {{{SINGLE-QUOTE}}}Enoxaparin%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Heparin%25,000%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Heparin Inj%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Dabigatran%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Rivaroxaban%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Warfarin%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Fondaparinux%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Argatroban%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Apixaban%{{{SINGLE-QUOTE}}})"
+ || " AND"
+ || " ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
+ , primarytime = touchedWhen};
+
+ order_count := count(existing_orders) as number;
+
+ if (order_count > 0) then
+ hard_stop := true;
+ endif;
+ endif;
+
+ if (hard_stop) then
+ //Keep counter in case other anticoagulant order exist that are not in conflict
+ i := 0;
+
+ //loop through existing, active patient orders
+ for orderItem in existing_orders do
+ i := i + 1;
+
+ //LOVENOX CHECK (trying to order)
+ if ((EvokingEvent = lovenox_orderset_event)) then
+
+ //LOVENOX -> HEPARIN IV, ARGATROBAN
+ if ((orderItem in heparin_iv_meds)
+ OR (orderItem in argatroban_meds)) then
+ soft_message := true;
+ order_name := orderItem;
+ alert_priority := "Low";
+ alert_dialog := "Must Acknowledge";
+
+ include_trans_msg := true;
+
+ //ARGATROBAN custom message
+ if (orderItem in argatroban_meds) then
+ alert_override_msg := "\n \n Start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} when {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} infusion is stopped.";
+
+ //HEAPRIN IV custom message
+ elseif (orderItem in heparin_iv_meds) then
+ alert_override_msg := "\n \n Start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} 2 hours before to 2 hours after {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} infusion is stopped based on last aPTT.";
+ endif;
+
+ //LOVENOX -> HEPARIN SQ, PRADAXA, XARELTO, ARIXTRA, APIXABAN
+ elseif ((orderItem in heparin_inj_meds)
+ OR (orderItem in pradaxa_meds)
+ OR (orderItem in xarelto_meds)
+ OR (orderItem in arixtra_meds)
+ OR (orderItem in apixaban_meds)) then
+ stop_message := true;
+ order_name := orderItem;
+ alert_dialog := "No Override Allowed";
+
+ //APIXABAN custom message
+ if (orderItem in apixaban_meds) then
+ alert_override_msg := "\n \n Discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} when the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose would have been due.";
+
+ //XARELTO custom message
+ elseif (orderItem IN xarelto_meds) then
+ alert_override_msg := "\n When switching from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and give {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} when the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose would have been due.";
+
+ //PRADAXA custom message
+ elseif (orderItem IN pradaxa_meds) then
+ alert_override_msg := "\n If CrCl is greater than or equal to 30 ml/min, begin {{+B}}{{+R}}"
+ || this_order
+ || "{{-R}}{{-B}} 12 hours after last {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose."
+ || "\n\nIf CrCl is less than 30 ml/min, begin {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} 24 hours after last {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose.";
+ endif;
+
+ //LOVENOX -> LOVENOX (duplicate)
+ elseif ((orderItem IN lovenox_meds)) then
+ soft_message := true;
+ order_name := orderItem;
+ alert_priority := "Low";
+ alert_dialog := "Must Acknowledge";
+
+ include_generic_msg := false;
+ alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Enoxaparin{{-R}}."
+ || " You MUST discontinue the previous {{+R}}Enoxaparin{{-R}} "
+ || "order before placing a new {{+R}}Enoxaparin{{-R}} order, UNLESS the therapies will not be overlapping."
+ || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
+ endif;
+
+ //PRADAXA CHECK (trying to order)
+ elseif (EvokingEvent = pradaxa_orderset_event ) then
+// OR EvokingEvent = pradaxa_reorder_event
+// OR EvokingEvent = pradaxa_reorder_event2) then
+
+ //PRADAXA -> HEPARIN SQ, LOVENOX, XARELTO, WARFARIN, ARIXTRA, APIXABAN
+ if ((orderItem in heparin_inj_meds)
+ OR (orderItem in lovenox_meds)
+ OR (orderItem in xarelto_meds)
+ OR (orderItem in warfarin_meds)
+ OR (orderItem in arixtra_meds)
+ OR (orderItem in apixaban_meds)) then
+
+ stop_message := true;
+ order_name := orderItem;
+ alert_dialog := "No Override Allowed";
+
+ //WARFARIN custom message
+ if (orderItem in warfarin_meds) then
+ alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} when INR {{+B}}is less than{{-B}} 2.0";
+
+ //ARIXTRA custom message
+ elseif (orderItem in arixtra_meds) then
+ alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} 0-2 hours before the next {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} dose would have been due.";
+
+ //APIXABAN custom message
+ elseif (orderItem in apixaban_meds) then
+ alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} when the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose would have been due.";
+
+ //LOVENOX custom message
+ elseif (orderItem in lovenox_meds) then
+ alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} 0-2 hours before the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose would have been due.";
+ endif;
+
+ //PRADAXA -> HEPARIN IV, ARGATROBAN
+ elseif ((orderItem in heparin_iv_meds)
+ OR (orderItem in argatroban_meds)) then
+
+ soft_message := true;
+ order_name := orderItem;
+ alert_priority := "Low";
+ alert_dialog := "Must Acknowledge";
+ include_generic_msg := false;
+
+ alert_override_msg := "{{+B}}{{+R}}" || this_order || "{{-R}} and {{+R}}" || order_name
+ || "{{-R}} should not be used together due to increased bleeding risk"
+ || " except when transitioning from {{+R}}" || order_name || "{{-R}} to {{+R}}"
+ || this_order || "{{-R}}{{-B}}."
+ || "\n\nStart {{+B}}{{+R}}" || this_order || "{{-R}}{{-B}}"
+ || " when {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}}"
+ || " infusion is stopped.";
+
+ //PRADAXA -> PRADAXA (duplicate)
+ elseif ( orderItem IN pradaxa_meds ) then
+ soft_message := true;
+ order_name := orderItem;
+ alert_priority := "Low";
+ alert_dialog := "Must Acknowledge";
+ include_generic_msg := false;
+
+ alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Pradaxa{{-R}}."
+ || " You MUST discontinue the previous {{+R}}Pradaxa{{-R}} "
+ || "order before placing a new {{+R}}Pradaxa{{-R}} order, UNLESS the therapies will not be overlapping."
+ || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
+ endif;
+
+ //XARELTO CHECK (trying to order)
+ elseif (EvokingEvent = xarelto_orderset_event ) then
+// OR EvokingEvent = xarelto_reorder_event
+// OR EvokingEvent = xarelto_reorder_event2) then
+
+ //XARELTO -> HEPARIN SQ, LOVENOX, PRADAXA, WARFARIN, ARIXTRA, APIXABAN
+ if ((orderItem in heparin_inj_meds)
+ OR (orderItem in lovenox_meds)
+ OR (orderItem in pradaxa_meds)
+ OR (orderItem in warfarin_meds)
+ OR (orderItem in arixtra_meds)
+ OR (orderItem in apixaban_meds)) then
+
+ stop_message := true;
+ order_name := orderItem;
+ alert_dialog := "No Override Allowed";
+
+ //WARFARIN custom message
+ if (orderItem in warfarin_meds) then
+ alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} when INR {{+B}}is less than{{-B}} 3.0";
+
+ //ARIXTRA custom message
+ elseif (orderItem in arixtra_meds) then
+ alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} 0-2 hours before the next {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}} dose would have been due.";
+
+ //APIXABAN custom message
+ elseif (orderItem in apixaban_meds) then
+ alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} when the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose would have been due.";
+
+ //LOVENOX custom message
+ elseif (orderItem in lovenox_meds) then
+ alert_override_msg := "\n \n When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} 0-2 hours before the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose would have been due.";
+ endif;
+
+ //XARELTO -> HEPARIN IV, ARGATROBAN
+ elseif ((orderItem in heparin_iv_meds)
+ OR (orderItem in argatroban_meds)) then
+ soft_message := true;
+ order_name := orderItem;
+ alert_priority := "High";
+ alert_dialog := "Must Acknowledge";
+ include_generic_msg := false;
+
+ alert_override_msg := "{{+B}}{{+R}}" || this_order || "{{-R}} and {{+R}}" || order_name
+ || "{{-R}} should not be used together due to increased bleeding risk"
+ || " except when transitioning from {{+R}}" || order_name || "{{-R}} to {{+R}}"
+ || this_order || "{{-R}}{{-B}}."
+ || "\n\nStart {{+B}}{{+R}}" || this_order || "{{-R}}{{-B}}"
+ || " when {{+B}}{{+R}}" || order_name || "{{-R}}{{-B}}"
+ || " infusion is stopped.";
+
+
+ //XARELTO -> XARELTO (duplicate)
+ elseif ( orderItem IN xarelto_meds ) and (EVOKINGOBJECT.Modifier <> "- Initial Dose") and (EVOKINGOBJECT.Modifier <> "- Maintenance Dose") then //CSR #35039 SZ
+
+ soft_message := true;
+ order_name := orderItem;
+ alert_priority := "Low";
+ alert_dialog := "Must Acknowledge";
+ include_generic_msg := false;
+
+ alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Xarelto{{-R}}."
+ || " You MUST discontinue the previous {{+R}}Xarelto{{-R}} "
+ || "order before placing a new {{+R}}Xarelto{{-R}} order, UNLESS the therapies will not be overlapping."
+ || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
+
+ endif;
+ //WARFARIN CHECK (trying to order)
+ elseif (EvokingEvent = warfarin_orderset_event) then
+
+ //WARFARIN -> XARELTO, APIXABAN
+ if ((orderItem in xarelto_meds)
+ OR (orderItem in apixaban_meds)) then
+
+ soft_message := true;
+ order_name := orderItem;
+ alert_priority := "Low";
+ alert_dialog := "Must Acknowledge";
+
+ //APIXABAN custom message
+ if (orderItem in apixaban_meds) then
+ alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} because it affects the INR."
+ || "\n \n Use Heparin or Lovenox with {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} as bridge therapy while waiting for the INR to rise"
+ || " if therapeutic levels are needed immediately.";
+
+ //XARELTO custom message
+ elseif (orderItem in xarelto_meds) then
+ alert_override_msg := "\n When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} because {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} affects the INR."
+ || "\n\nUse Heparin or Lovenox with {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} as bridge therapy while waiting for the INR to rise"
+ || " if therapeutic levels are needed immediately.";
+
+ //GENERIC message
+ else
+ alert_override_msg := "{{+B}}{{+R}}" || this_order || "{{-R}} and {{+R}}" || order_name
+ || "{{-R}} should not be used together due to increased bleeding risk"
+ || " except when transitioning from {{+R}}" || order_name || "{{-R}} to {{+R}}"
+ || this_order || "{{-R}}{{-B}}.";
+ endif;
+ endif;
+
+ //HEPARIN CHECK (trying to order)
+ elseif ((EvokingEvent = heparin_orderset_event)
+ OR (EvokingEvent = heparin_nonprotocol_event)
+ OR (EvokingEvent = heparin_nonprotocol_event2)) then
+
+ //HEPARIN SQ CHECK (trying to order)
+ if (this_order = "Heparin Inj - SQ") then
+
+ //HEPARIN SQ -> LOVENOX, PRADAXA, XARELTO, HEPARIN IV, ARIXTRA, ARGATROBAN, APIXABAN
+ if ((orderItem in lovenox_meds)
+ OR (orderItem in pradaxa_meds)
+ OR (orderItem in xarelto_meds)
+ OR (orderItem in heparin_iv_meds)
+ OR (orderItem in arixtra_meds)
+ OR (orderItem in argatroban_meds)
+ OR (orderItem in apixaban_meds)) then
+
+ stop_message := true;
+ order_name := orderItem;
+ alert_dialog := "No Override Allowed";
+
+ //HEPARIN SQ -> HEPARIN SQ (duplicate)
+ elseif (orderItem in heparin_inj_meds) then
+ soft_message := true;
+ order_name := orderItem;
+ alert_priority := "Low";
+ alert_dialog := "Must Acknowledge";
+
+ include_generic_msg := false;
+ alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Heparin SQ{{-R}}."
+ || " You MUST discontinue the previous {{+R}}Heparin SQ{{-R}} "
+ || "order before placing a new {{+R}}Heparin SQ{{-R}} order, UNLESS the therapies will not be overlapping."
+ || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
+ endif;
+
+ //HEPARIN IV CHECK (trying to order)
+ else
+
+ //HEPARIN IV -> PRADAXA, XARELTO, LOVENOX, ARIXTRA, ARGATROBAN, APIXABAN
+ if ((orderItem in pradaxa_meds)
+ OR (orderItem in xarelto_meds)
+ OR (orderItem in lovenox_meds)
+ OR (orderItem in arixtra_meds)
+ OR (orderItem in argatroban_meds)
+ OR (orderItem in apixaban_meds)) then
+ stop_message := true;
+ order_name := orderItem;
+ alert_dialog := "No Override Allowed";
+
+ //APIXABAN custom message
+ if (orderItem in apixaban_meds) then
+ alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} infusion when the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose would have been due.";
+
+ //XARELTO custom message
+ elseif (orderItem in xarelto_meds) then
+ alert_override_msg := "\n When switching from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue the {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} infusion when the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose whould have been due.";
+
+ //PRADAXA custom message
+ elseif (orderItem in pradaxa_meds) then
+ alert_override_msg := "If CrCl is greater than or equal to 30 ml/min, begin {{+B}}{{+R}}"
+ || this_order || "{{-R}}{{-B}} 12 hours after last {{+B}}{{+R}}"
+ || order_name || "{{-R}}{{-B}} dose."
+ || "\n\nIf CrCl is less than 30 ml/min, begin {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} 24 hours after last {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose.";
+ endif;
+
+ //HEPARIN IV -> HEPARIN SQ
+ elseif (orderItem IN heparin_inj_meds) then
+ stop_message := true;
+ order_name := orderItem;
+ alert_dialog := "No Override Allowed";
+ include_generic_msg := false;
+
+ alert_override_msg := "{{+B}}Avoid concurrent use of {{+R}}" || this_order || "{{-R}} and {{+R}}" || order_name
+ || " SQ{{-R}} due to increased bleeding risk.{{-B}}"
+ || "\nContact physician to adjust orders.";
+
+ //HEPARIN IV -> HEPARIN IV (duplicate)
+ elseif (orderItem in heparin_iv_meds) then
+ soft_message := true;
+ order_name := orderItem;
+ alert_dialog := "Must Acknowledge";
+ alert_priority := "Low";
+
+ include_generic_msg := false;
+
+ if ( origOrderSet[i] = "tPA (Alteplase) for the Treatment of Pulmonary Embolism (PE)" ) then
+ alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}"
+ || order_name || "{{-R}} from {{+B}}" || origOrderSet[i] || ". Please discontinue the {{+R}}" || order_name
+ || "{{-R}} before placing an order";
+ else
+ alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}"
+ || origOrderSet[i] || "{{-R}}. Please discontinue the {{+R}}" || origOrderSet[i]
+ || "{{-R}} before placing an order";
+ endif;
+
+ //HEPARIN NON PROTOCOL ORDER handling
+ if ((EvokingEvent = heparin_nonprotocol_event)
+ OR (EvokingEvent = heparin_nonprotocol_event2)) then
+ alert_override_msg := alert_override_msg || " for {{+R}}" || this_order || "{{-R}}.{{-B}}";
+ else
+ alert_override_msg := alert_override_msg || " from the {{+R}}" || this_order || "{{-R}}.{{-B}}";
+ endif; //end EvokingEvent = heparin_nonprotocol_event
+ endif; //End orderItem IN pradaxa_meds...elseif...
+ endif; //End this_order = Heparin_Inj = SQ....else....
+
+ //ARGATROBAN CHECK (trying to order)
+ elseif (EvokingEvent = argatroban_order_event) then
+
+ //ARGATROBAN -> LOVENOX, ARIXTRA, HEPARIN SQ, HEPARIN IV, PRADAXA, XARELTO, APIXABAN
+ if ((orderItem IN lovenox_meds)
+ OR (orderItem IN arixtra_meds)
+ OR (orderItem IN heparin_inj_meds)
+ OR (orderItem IN heparin_iv_meds)
+ OR (orderItem IN pradaxa_meds)
+ OR (orderItem IN xarelto_meds)
+ OR (orderItem IN apixaban_meds)) then
+
+ stop_message := true;
+ order_name := orderItem;
+ alert_dialog := "No Override Allowed";
+
+ //PRADAXA custom message
+ if (orderItem IN pradaxa_meds) then
+ alert_override_msg := "If CrCl is greater than or equal to 30 ml/min, begin {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} infusion 12 hours after last {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose."
+ || "\n \n If CrCl is less than 30 ml/min, begin {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} infusion 24 hours after last {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose.";
+
+ //XARELTO custom message
+ elseif (orderItem IN xarelto_meds) then
+ alert_override_msg := "When switching from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} , discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} infusion when the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose would have been due.";
+
+ //APIXABAN custom message
+ elseif (orderItem IN apixaban_meds) then
+ alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} infusion when the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose would have been due.";
+ endif;
+
+ //ARGATROBAN -> ARGATROBAN (duplicate)
+ elseif (orderItem IN argatroban_meds) then
+ soft_message := true;
+ order_name := orderItem;
+ alert_dialog := "Must Acknowledge";
+ alert_priority := "Low";
+
+ include_generic_msg := false;
+ alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Argatroban{{-R}}."
+ || " You MUST discontinue the previous {{+R}}Argatroban{{-R}} "
+ || "order before placing a new {{+R}}Argatroban{{-R}} order, UNLESS the therapies will not be overlapping."
+ || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
+ endif;
+
+ //APIXABAN CHECK (trying to order)
+ elseif (EvokingEvent = apixaban_orderset_event ) then
+// OR EvokingEvent = apixaban_reorder_event
+// OR EvokingEvent = apixaban_reorder_event2) then
+
+ //APIXABAN -> LOVENOX, ARIXTRA, HEPARIN SQ, WARFARIN, PRADAXA, XARELTO
+ if ((orderItem IN lovenox_meds)
+ OR (orderItem IN arixtra_meds)
+ OR (orderItem IN heparin_inj_meds)
+ OR (orderItem IN warfarin_meds)
+ OR (orderItem IN pradaxa_meds)
+ OR (orderItem IN xarelto_meds)) then
+
+ stop_message := true;
+ order_name := orderItem;
+ alert_dialog := "No Override Allowed";
+
+ //LOVENOX, ARIXTRA, PRADAXA, XARELTO custom message
+ if ((orderItem IN lovenox_meds)
+ OR (orderItem IN arixtra_meds)
+ OR (orderItem IN pradaxa_meds)
+ OR (orderItem IN xarelto_meds)) then
+ alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} when the next {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} dose would have been due.";
+
+ //WARFARIN custom message
+ elseif (orderItem IN warfarin_meds) then
+ alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} when INR less then 2.0.";
+ endif;
+
+ //APIXABAN -> HEPARIN IV, ARGATROBAN
+ elseif ((orderItem IN heparin_iv_meds)
+ OR (orderItem IN argatroban_meds)) then
+
+ soft_message := true;
+ order_name := orderItem;
+ alert_priority := "Low";
+ alert_dialog := "Must Acknowledge";
+ include_trans_msg := true;
+
+ alert_override_msg := "When converting from {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}}, discontinue {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} and start {{+B}}{{+R}}" || this_order
+ || "{{-R}}{{-B}} when {{+B}}{{+R}}" || order_name
+ || "{{-R}}{{-B}} infusion is stopped.";
+
+ //APIXABAN -> APIXABAN (duplicate)
+ elseif (orderItem IN apixaban_meds) and (EVOKINGOBJECT.Modifier <> "- Initial Dose") and (EVOKINGOBJECT.Modifier <> "- Maintenance Dose") then //CSR #35039 SZ
+ soft_message := true;
+ order_name := orderItem;
+ alert_priority := "Low";
+ alert_dialog := "Must Acknowledge";
+
+ include_generic_msg := false;
+ alert_override_msg := "{{+B}}Duplicate Medication Alert! This patient already has an order for {{+R}}Apixaban{{-R}}."
+ || " You MUST discontinue the previous {{+R}}Apixaban{{-R}} "
+ || "order before placing a new {{+R}}Apixaban{{-R}} order, UNLESS the therapies will not be overlapping."
+ || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Proceed{{{SINGLE-QUOTE}}}{{-B}}";
+ endif;
+ endif; //End EvokingEvent = heparin_orderset_event...elseif...else
+ enddo; //End looping through existing, active patient anticoagulant orders
+ endif; // End hard_stop = true
+
+ //Set alert priority and dialog settings based on CONFLICT
+ order_alert_dest.Priority := alert_priority;
+ order_alert_dest.Alert_Dialog_Settings := alert_dialog;
+
+ //Configure message based on alert and custom settings
+ if ((stop_message and soft_message) OR (stop_message and not(soft_message))) then
+ alert_message := "{{+B}}Avoid concurrent use of {{+R}}" || this_order || "{{-R}} and {{+R}}"
+ || order_name || "{{-R}} due to increased bleeding risk.{{-B}} Contact physician to adjust orders.";
+
+ //Determine if we display an override message along with or in place of the generic message
+ if (alert_override_msg <> "") then
+ if (include_generic_msg) then
+ alert_message := alert_message || "\n\n" || alert_override_msg;
+ else
+ alert_message := alert_override_msg;
+ endif;
+ endif;
+ elseif (soft_message) then
+ alert_message := "{{+B}}{{+R}}" || this_order || "{{-R}} and {{+R}}" || order_name || "{{-R}} "
+ || " should not be used together due to increased bleeding risk";
+
+ if (include_trans_msg) then
+ alert_message := alert_message || " except when transitioning from {{+R}}" || order_name
+ || "{{-R}} to {{+R}}" || this_order || "{{-R}}{{-B}}.";
+ else
+ alert_message := alert_message || ".{{-B}} Contact physician to adjust orders";
+ endif;
+
+ if (alert_override_msg <> "") then
+ if (include_generic_msg) then
+ alert_message := alert_message || "\n\n" || alert_override_msg;
+ else
+ alert_message := alert_override_msg;
+ endif;
+ endif;
+
+
+ else
+ hard_stop := false;
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+
+ pradaxa_orderset_event;
+ xarelto_orderset_event;
+ lovenox_orderset_event;
+ heparin_orderset_event;
+ heparin_nonprotocol_event;
+ heparin_nonprotocol_event2;
+ warfarin_orderset_event;
+ //pradaxa_reorder_event;
+ //pradaxa_reorder_event2;
+ //xarelto_reorder_event;
+ //xarelto_reorder_event2;
+ argatroban_order_event;
+ apixaban_orderset_event;
+ //apixaban_reorder_event;
+ //apixaban_reorder_event2;
+ anticoag_os_event
+
+ ;;
+
+ logic:
+ conclude hard_stop
+ ;;
+ action:
+ write alert_message at order_alert_dest;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_CODEINE_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_CODEINE_ORDERS.mlm
new file mode 100644
index 0000000..b501b65
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_CODEINE_ORDERS.mlm
@@ -0,0 +1,114 @@
+maintenance:
+
+ title: SCH_ALERT_ON_CODEINE_ORDERS ;;
+ mlmname: SCH_ALERT_ON_CODEINE_ORDERS;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: St.Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: Amy Georgulis ;;
+ date: 2018-08-27;;
+ validation: testing;;
+
+library:
+ purpose: If the patient is a child under 18 years old (1 - 17) then present a hard stop alert when the user attempts to order codeine, codeine combo, or tramadol products for the patient.
+ No ability to proceed with hard stops.
+ ;;
+ explanation:
+
+ Change History
+
+ 08.27.2018 SZ CSR 36725: codeine and tramadol alert for children < 18 yo
+ ;;
+ keywords: codeine, tramadol, pediatric alert
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // MLM evoked on Fentanyl Patch orders
+ codeine_tramadol_order_event := event{OrderInit User Order :
+ WHERE Name matches pattern "%codeine%" or Name matches pattern "%tramadol%" };
+
+ // grab relevant guids
+ ClientGuid := EVOKINGOBJECT.ClientGUID;
+ ChartGuid := EVOKINGOBJECT.ChartGUID;
+ userguid := EVOKINGOBJECT.UserGUID;
+ VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
+
+
+ /************************* check 1 *****************************************/
+ // only proceed with alert if patient is 0 to 18 years old
+ if (EvokingEventType = "OrderInit") then
+ (Client_g, Client_dn, birthdate, Client_birthyearnum) := read last {ClientInfo: GUID, DisplayName, birthdate, birthyearnum};
+ endif;
+
+ patient_age := (NOW - birthdate) / (1 year);
+
+ if patient_age >= 0 and patient_age < 18 then
+ show_alert := true;
+ else
+ show_alert := false;
+ endif;
+
+
+ /************************* Alert Details *****************************************/
+
+ // Set the med name for use in alert text/message
+ if EVOKINGOBJECT.Name matches pattern "%codeine%" then
+ med_name_codeine := true;
+ med_name := "Codeine";
+ elseif EVOKINGOBJECT.Name matches pattern "%Tramadol%" then
+ med_name_tramadol := true;
+ med_name := "Tramadol";
+ else
+ med_name_either := true;
+ med_name := "Codeine/Tramadol";
+ endif;
+
+
+
+ // alert message content
+ if (med_name_codeine = true) then
+ alert_message := "\n Use of codeine in ultra-rapid metabolizers causes life-threatening , high levels of morphine that has led to respiratory depression and fatalities in children. Per the FDA, Codeine is contraindicated in children under 12 years old for ALL indications and in patients 12-18 years old for cough or pain following tonsillectomy or adenoidectomy. Codeine is also not recommended for pain in children 12-18 years of age who are obese, or have severe lung disease or obstructive sleep apnea." ||
+ "\n ";
+ endif;
+
+
+ if (med_name_tramadol = true) then
+ alert_message := "\n Use of tramadol in ultra-rapid metabolizers causes life-threatening , high levels of the active ingredients that has led to respiratory depression and fatalities in children. Per the FDA, tramadol is contraindicated in all children under 12 years old and in patients 12-18 years old for pain following tonsillectomy or adenoidectomy. Tramadol is also not recommended for pain in children 12-18 years of age who are obese, or have severe lung disease or obstructive sleep apnea. " ||
+ "\n ";
+ endif;
+
+ if (med_name_either = true) then
+ alert_message := "\n" || med_name || " is contraindicated in pediatric patients (0-17 yo) due to a significant risk of respiratory depression which has led to fatalities." ||
+ "\n ";
+ endif;
+
+ // alert destination
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := med_name || " Pediatric Alert",
+ priority := "High",
+ scope := Chart,
+ rule_group := "Codeine/Tramadol Pediatric Alert",
+ rule_number := 8000,
+ send_with_order := "DoNotSend",
+ alert_dialog_settings := "No Override Allowed",
+ display_alert := true];
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: codeine_tramadol_order_event;
+ ;;
+ logic: conclude show_alert;
+ ;;
+ action:
+ write alert_message at order_alert_dest;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_CPK_ISOENZYMES.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_CPK_ISOENZYMES.mlm
new file mode 100644
index 0000000..c46284b
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_CPK_ISOENZYMES.mlm
@@ -0,0 +1,61 @@
+maintenance:
+
+ title: SCH_ALERT_ON_CPK_ISOENZYMES;;
+ mlmname: SCH_ALERT_ON_CPK_ISOENZYMES;;
+ arden: version 2.5;;
+ version: 15.3;;
+ institution: ;;
+ author: Maria Pest;;
+ specialist: Shawn Head x7468;;
+ date: 2018-04-17;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+
+
+ Change history
+
+ 04.17.2018 STH CSR# 36392 - Created
+
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ Order_Event_Init := event{OrderInit User Order : WHERE Name = "CPK Isoenzymes" };
+
+ ClientGuid := EVOKINGOBJECT.ClientGUID;
+ ChartGuid := EVOKINGOBJECT.ChartGUID;
+ VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
+
+ send_alert:= "DoNotSend";
+ alert_dest:= destination { Alert: warning, "CPK Isoenzymes Alert", high, chart, "CPK Isoenzymes Alert MLM", 15042, send_alert, "" };
+
+ alert_message := "The American College of Cardiology recognizes Troponin as the biomarker of choice due to its nearly absolute specificity and high clinical sensitivity for myocardial injury. \n\nCK-MB provides no incremental value to patient care. \n\n{{+B}}{{+R}}Do you wish to proceed with this order?{{-B}}{{-R}}";
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: Order_Event_Init;
+ ;;
+ logic:
+ Conclude True;
+ ;;
+ action:
+
+
+ If alert_message <> "" then write alert_message at alert_dest; endif;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_DIABETIC_STEROID_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_DIABETIC_STEROID_ORDER.mlm
new file mode 100644
index 0000000..b465498
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_DIABETIC_STEROID_ORDER.mlm
@@ -0,0 +1,149 @@
+maintenance:
+
+ title: SCH_Alert_On_Diabetic_Steroid_Order ;;
+ mlmname: SCH_Alert_On_Diabetic_Steroid_Order;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: St.Clair Hospital ;;
+ author: Sandy Zhang & Kathy Baumgarten;;
+ specialist: Sandy Zhang & Kathy Baumgarten;;
+ date: 2018-01-22;;
+ validation: testing;;
+
+library:
+ purpose: Provides an alert to inpatient physicians when a patient is diabetic and is ordered an oral or injectable steroid.
+ ;;
+ explanation:
+
+ Change history
+ 01.22.2018 SZ CSR #36170 - Steroid alert. Created to alert physicians to evaluate the diabetic patient{{{SINGLE-QUOTE}}}s med regimen when ordering an oral or injectable steroid.
+
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+ true_false_flag := true;
+ /***************************************************************************************/
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Capture current patient
+ (clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
+ clientVisitGuid := read last {ClientVisit : GUID};
+ chartGuid := read last {ClientVisit : ChartGUID};
+
+ // alert physicians only if patient is diabetic (based on ICD codes) and if medication being ordered is:
+ // 1) prednisone (all - oral & inj)
+ // 2) methylprednisolone (all - oral & inj)
+ // 3) prednisolone (tab, solution) (exclude ophth)
+ // 4) budesonide (tab, cap)
+ // 5) dexamethasone (all - oral & inj)
+ // 6) hydrocortisone (tab, inj, IV, PB)
+ // We were told to alert on all steroids oral and injectable.
+ // At the writing of this MLM (1/29/2018), the above options were the most logical based on Order Catalog Item Configurations.
+
+ // 1) prednisone (all)
+ prednisone_order_event := EVENT {OrderEnter User Order:
+ where name matches pattern "%prednisone%"};
+
+ // 2) methylprednisolone (all)
+ methylprenisolone_order_event := EVENT {OrderEnter User Order:
+ where name matches pattern "%methylprednisolone%"};
+
+ // 3) prednisolone (tab, solution) (exclude ophth)
+ prednisolone_order_event := EVENT {OrderEnter User Order:
+ where name matches pattern "%prednisolone%"};
+
+ // 4) budesonide (tab, cap)
+ budesonide_order_event := EVENT {OrderEnter User Order:
+ where name matches pattern "%budesonide%"};
+
+ // 5) dexamethasone (all)
+ dexamethasone_order_event := EVENT {OrderEnter User Order:
+ where name matches pattern "%dexamethasone%"};
+
+ // 6) hydrocortisone (tab, inj, IV, PB) - filtering below
+ hydrocortisone_order_event := EVENT {OrderEnter User Order:
+ where name matches pattern "%hydrocortisone%"};
+
+
+ order_name := read last {Order: name Referencing EvokingObject};
+
+
+ // filters hydrocortisone to alert user if it{{{SINGLE-QUOTE}}}s a (tab, inj, IV, PB)
+ if (EvokingEvent = prednisone_order_event) or
+ (EvokingEvent = methylprenisolone_order_event) or
+ (EvokingEvent = prednisolone_order_event) or
+ (EvokingEvent = budesonide_order_event) or
+ (EvokingEvent = dexamethasone_order_event) or
+ (EvokingEvent = hydrocortisone_order_event)
+ then
+ // turns flag true if order is IVPB, inj, or tab
+ if (EVOKINGOBJECT.Modifier matches pattern "%pb%" or
+ EVOKINGOBJECT.Modifier matches pattern "%iv%" or
+ order_name matches pattern "%inj%" or
+ order_name matches pattern "%tab%" or
+ order_name matches pattern "%cap%" or
+ order_name matches pattern "%soln%" or
+ order_name matches pattern "%solution%")
+ then
+ true_false_flag := true;
+ if (order_name matches pattern "%ophth%" or order_name matches pattern "%otic%") then true_false_flag := false; endif;
+ else
+ true_false_flag := false;
+ endif;
+ endif;
+
+
+ /*********************************BEGIN HEALTH ISSUE SECTION**********************************************/
+ // if patient has ICD-10 health issue of diabetes then fire the alert
+
+ HealthIssue := read last {" select distinct hi.ShortName
+ from cv3healthissuedeclaration hi with (nolock)
+ inner join cv3codedhealthissue chi with (nolock) on hi.CodedHealthIssueGUID = chi.guid and chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})
+ where Clientguid = " || SQL (clientguid)
+ || " and hi.active = 1
+ and Status in ({{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chronic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Retired Code{{{SINGLE-QUOTE}}})
+ and (((ICD10Code like {{{SINGLE-QUOTE}}}E10%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}}))
+ or ((ICD9Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
+ or ((ICD9Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
+ or ((chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})) and ((chi.Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}}))
+ or ((chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}}) and ((chi.Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}})))"};
+
+ // if health issue = diabetes and order qualifies then fire alert
+ if (exist HealthIssue) and (true_false_flag = true) then
+ // start of alert dialogue
+ MsgText := "\n\nSince you have prescribed systemic steroids for a diabetic patient, please review the patient’s meds and blood sugar.\n\nAdjust meds as needed.\n";
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " " || MsgText, "Diabetic Steroid Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ endif;
+
+ /*********************************END HEALTH ISSUE SECTION**********************************************/
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+
+ prednisone_order_event;
+ methylprenisolone_order_event;
+ prednisolone_order_event;
+ budesonide_order_event;
+ dexamethasone_order_event;
+ hydrocortisone_order_event;
+
+ ;;
+ logic:
+ conclude true
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_DUPLICATE_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_DUPLICATE_ORDERS.mlm
new file mode 100644
index 0000000..f38ab90
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_DUPLICATE_ORDERS.mlm
@@ -0,0 +1,167 @@
+maintenance:
+
+ title: SCH_ALERT_ON_DUPLICATE_ORDERS;;
+ mlmname: SCH_ALERT_ON_DUPLICATE_ORDERS;;
+ arden: version 2.5;;
+ version: 16.30;;
+ institution: St. Clair;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2017-04-12;;
+ validation: testing;;
+
+library:
+ purpose: Generate an informational alert for pharmacy listing duplicate orders managed via the orders management window.
+
+ ;;
+ explanation: When an potential therapeutic duplicate has been addressed via the orders management window, create
+ an informational alert that is not presented to the user, but able to be viewed from the order or viewed with all alerts on the pt info tab.
+
+ Change History:
+ 2017.04.12 TMS Created as an informational alert, not presented to user but viewable as a reference to what
+ actions were taken from the order management window. CSR 33465
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (client_visit_guid, chart_guid, client_guid, OrderName) := ARGUMENT;
+
+
+ //.Net libraries
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ /*******************************************************************/
+ //Set to true if logging needed
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+ //Destination Object Properties
+ alert_dialog := "";
+ alert_message := "";
+ alert_override_msg := "";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+ continueprocessing := false;
+
+
+ //Destination
+
+ duplicated_medication_order := event {OrderEnter User Order:
+ WHERE TypeCode = "Medication"
+ AND OrderStatusLevelNum >= 0
+ AND OrderStatusLevelNum <= 50
+ // AND IsHeld = FALSE
+ AND IsSuspended = FALSE };
+
+
+
+ /* Get the OrderUserData object pointer */
+ OrderUserDataObj := read last
+ { Order: OrderUserData
+ REFERENCING EvokingObject };
+
+ ( ActionUserDataCode, ActionValue ) := read first
+ { OrderUserData: UserDataCode, Value
+ REFERENCING OrderUserDataObj where
+ UserDataCode = "PRX_Duplicate_Order_Action_Text" };
+
+ ( InfoUserDataCode, DupOrderGuidList ) := read first
+ { OrderUserData: UserDataCode, Value
+ REFERENCING OrderUserDataObj where
+ UserDataCode = "PRX_Order_Guids" };
+
+ numguids := count (duporderguidlist);
+
+ if actionvalue is not null then
+ continueprocessing := true;
+ DupGuidsFromOrder := ();
+ GuidCount := count (DupOrderGuidList);
+
+ DupGuidsFromOrder := call str_parse with DupOrderGuidList,",";
+ finalcount := count (DupGuidsFromOrder);
+
+ for s in 1 seqto finalcount do
+ if s = 1 then
+ FinalList := dupguidsfromorder [s] as number;
+ else
+ FinalList := FinalList, dupguidsfromorder [s] as number;
+ endif;
+ enddo;
+
+ newnumguids := count (DupGuidsFromOrder);
+
+ if finalcount >= 1 then
+
+ (dupordername, dupordersummary, duporderstatus) := read {"select o.name, Replace (o.summaryline, CHAR(13) + CHAR(10), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}), os.Description from cv3order o "
+ || "join CV3OrderStatus os on os.code = o.orderstatuscode "
+ || "where o.guid in ("|| SQL (finallist) || ")" };
+
+ endif;
+ endif;
+
+ duplicate_orderset_alert:= DESTINATION {Alert} WITH
+
+ [ alert_type:= "Informational",
+ short_message:= "Potential Therapeutic Duplicate Information",
+ priority:= low,
+ scope:= chart,
+ rule_group:= "Therapeutic Med Duplicate Info",
+ rule_number:= 3095,
+ send_with_order := send_alert,
+ alert_dialog_settings := alert_dialog,
+ display_alert := false];
+
+
+ bodytext := CRLF;
+
+ for r in 1 seqto count(duporderstatus) do
+ bodytext := bodytext || duporderstatus[r] || Tab || dupordername [r] || CRLF || TAB || TAB || dupordersummary [r] || CRLF;
+ enddo;
+
+ alert_message := "The order for {{+B}}" ||EvokingObject.Name || " {{-B}}was presented as a potential therapeutic duplicate with: " || CRLF || bodytext;
+
+ /*******************************************************************/
+
+ //Unit testing
+ if called_by_editor then
+ OrderName := "Codeine 15mg Tab";
+ endif;
+
+
+ ;;
+ priority: 99
+ ;;
+ evoke:
+ duplicated_medication_order;
+ ;;
+
+ logic:
+ if exists OrderName then
+ duplicate_addressed := true;
+ alert_message := "Issue with " || OrderName || " has been addressed.";
+ alert_status := true;
+ endif;
+ If continueprocessing = true then
+
+ conclude true;
+ else
+ conclude false;
+ endif;
+ ;;
+ action:
+ write alert_message at duplicate_orderset_alert;
+ return alert_status;
+
+ ;;
+Urgency: 90;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_ED_BUPRENORPHINE_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_ED_BUPRENORPHINE_ORDERS.mlm
new file mode 100644
index 0000000..d786969
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_ED_BUPRENORPHINE_ORDERS.mlm
@@ -0,0 +1,300 @@
+maintenance:
+
+ title: SCH_ALERT_ON_ED_BUPRENORPHINE_ORDERS ;;
+ mlmname: SCH_ALERT_ON_ED_BUPRENORPHINE_ORDERS;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: St.Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: Amy Georgulis ;;
+ date: 2019-02-05;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+
+ Change History
+
+ 02.05.2019 SZ CSR 37650: Buprenorphine alert on patients treated in the ED for withdrawal
+
+ ;;
+ keywords: Buprenorphine, naloxone, suboxone, subutex
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ // MLM evoked on Buprenorphine orders
+ buprenorphine_order_event := event{OrderInit User Order :
+ WHERE Name matches pattern "%buprenorphine%"};
+
+ (CurrentLocation, LocationGuid, VisitStatus, AdmitDtm) := read last {ClientVisit: CurrentLocation, CurrentLocationGUID, VisitStatus, AdmitDtm };
+
+ // grab relevant guids
+ ClientGuid := EVOKINGOBJECT.ClientGUID;
+ ChartGuid := EVOKINGOBJECT.ChartGUID;
+ userguid := EVOKINGOBJECT.UserGUID;
+ VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
+
+ show_alert := false;
+
+ x_waivered_physicians := ("Biggs, Jason", "DAlo, Julia M", "Hinds, Jennifer M", "Coyle, Andrew", "Friend, Kevin", "Traynor, Owen T");
+
+ /************************* decision 1 *****************************************/
+ /* 1) Only proceed to alert if patient has (historic data):
+ a) current location of ER Major
+ b) at least one prior ED visit without admission (visit with a currentlocation of {{{SINGLE-QUOTE}}}ER Major{{{SINGLE-QUOTE}}})
+ and
+ c) in that visit, buprenorphine was administered
+ */
+
+
+ if (CurrentLocation = "ER Major") then
+/*
+ // sql for finding all prior charted orders of buprenorphine (of which the patient was not admitted, only ER)
+ (performed_date, drug_name, location_name, ordering_provider) := read {
+ "CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), transferdate datetime, locationname varchar(100), visitstatus varchar (50), clientguid numeric(16, 0) , transferoutdate datetime, visitguid numeric(16, 0), admitted varchar(50))"
+ ||" INSERT INTO #tmp_aaa (transferdate, locationname, visitstatus, clientguid, transferoutdate, visitguid, admitted)"
+ ||" select cvl.TransferRequestDtm, l.shortname, v.VisitStatus, v.ClientGUID, GETDATE(), v.GUID, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}"
+ ||" from cv3clientvisitlocation cvl "
+ ||" join cv3location l on l.guid = cvl.locationguid "
+ ||" join cv3clientvisit v on v.guid = cvl.ClientVisitGUID"
+ ||" where v.ClientGUID = " || sql(ClientGuid)
+ ||" update t1 set transferoutdate = t2.transferdate from #tmp_aaa t1 "
+ ||" inner join #tmp_aaa t2 on t2.id = t1.id +1 "
+ ||" and t1.clientguid = t2.clientguid "
+ ||" update a set admitted = o.Name from #tmp_aaa a"
+ ||" left join CV3Order o on o.ClientVisitGUID = a.visitguid "
+ ||" and o.Name in ({{{SINGLE-QUOTE}}}Admit to Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Place in Observation Status{{{SINGLE-QUOTE}}})"
+ ||" delete from #tmp_aaa where admitted is not null"
+ ||" select otc.PerformedFromDtm, TaskName, a.locationname, cp.DisplayName"
+ ||" from CV3OrderTaskOccurrence otc"
+ ||" join #tmp_aaa a on a.clientguid = otc.ClientGUID"
+ ||" join cv3order o with (nolock)on o.GUID = otc.OrderGUID"
+ ||" join CV3OrderStatusHistory osh with (nolock) on osh.OrderGUID = o.GUID"
+ ||" join CV3CareProvider cp with (nolock) on cp.GUID = osh.RequestedByGUID"
+ ||" where " || sql(ClientGuid) || " = otc.ClientGUID and taskname like {{{SINGLE-QUOTE}}}%buprenorphine%{{{SINGLE-QUOTE}}} and TaskStatusCode = {{{SINGLE-QUOTE}}}performed{{{SINGLE-QUOTE}}}"
+ ||" and TaskStatusCode = {{{SINGLE-QUOTE}}}performed{{{SINGLE-QUOTE}}}"
+ ||" and otc.PerformedFromDtm > a.transferdate "
+ ||" and otc.PerformedFromDtm < a.transferoutdate"
+ ||" drop table #tmp_aaa"
+ };
+*/
+
+ // sql for finding all prior charted orders of buprenorphine (of which the patient was not admitted, only ER)
+ // revised on 5/7/2019 - works faster and better
+ (performed_date, drug_name, location_name, ordering_provider) := read {
+ "CREATE TABLE #tmp_aaa (ID int IDENTITY(1, 1),transferdate datetime, locationname varchar(100), visitstatus varchar (50), clientguid numeric(16, 0) , transferoutdate datetime, visitguid numeric(16, 0), visittype varchar(50))"
+ ||" INSERT INTO #tmp_aaa "
+ ||" select distinct v.AdmitDtm, l.Name, v.VisitStatus,v.ClientGUID, GETDATE(), v.GUID , v.TypeCode"
+ ||" from cv3clientvisitlocation cvl "
+ ||" join cv3location l on l.guid = cvl.locationguid"
+ ||" join cv3clientvisit v on v.guid = cvl.ClientVisitGUID and (v.ClientGUID = " || sql(ClientGuid) || ")"
+ ||" order by v.AdmitDtm"
+ ||" update t1 "
+ ||" set transferoutdate = t2.transferdate from #tmp_aaa t1"
+ ||" join #tmp_aaa t2 on t2.id = t1.id +1 and (t1.clientguid = t2.clientguid)"
+ ||" delete from #tmp_aaa where visittype <> {{{SINGLE-QUOTE}}}Emergency{{{SINGLE-QUOTE}}}"
+ ||" select distinct otc.PerformedFromDtm, otc.TaskName, a.locationname, cp.DisplayName"
+ ||" from #tmp_aaa a"
+ ||" join CV3OrderTaskOccurrence otc on a.clientguid = otc.ClientGUID "
+ ||" and (otc.ClientGUID = " || sql(ClientGuid) || ") "
+ ||" and (otc.TaskName like {{{SINGLE-QUOTE}}}%buprenorphine%tab%{{{SINGLE-QUOTE}}})"
+ ||" and (otc.TaskStatusCode = {{{SINGLE-QUOTE}}}performed{{{SINGLE-QUOTE}}})"
+ ||" and (otc.PerformedFromDtm > a.transferdate)"
+ ||" and (otc.PerformedFromDtm < a.transferoutdate)"
+ ||" join cv3order o with (nolock)on o.GUID = otc.OrderGUID"
+ ||" join CV3OrderStatusHistory osh with (nolock) on osh.OrderGUID = o.GUID"
+ ||" join CV3CareProvider cp with (nolock) on cp.GUID = osh.RequestedByGUID"
+ ||" drop table #tmp_aaa"
+ };
+
+ items_in_sql := count drug_name;
+
+
+ if (items_in_sql = 0) then
+ scenario := "1a";
+ else
+ scenario := "1b";
+ show_alert := true;
+
+ /************************* decision 2 *****************************************/
+ // Is current buprenorphine is being ordered by an x-waivered doctor?
+ // if yes, -> then present all prior buprenorphine administrations from all MDs
+ // if no, -> then continue onto next decision
+
+ // grab the ordering provider guid
+ if (EvokingEventType = "OrderInit") then
+ (OrderingProviderGuid) := read last {Order: CareProviderGuid REFERENCING EvokingObject};
+ endif;
+
+
+ // SQL to get the discipline/specialty of the ordering provider
+ (ordering_provider_discipline, ordering_provider_name) := read last {
+ "select cp.Discipline, cp.displayname"
+ ||" from CV3User u"
+ ||" join CV3OrganizationalUnit ou on ou.GUID = u.OrgUnitGUID"
+ ||" join CV3CareProvider cp on cp.GUID = u.GUID"
+ ||" where u.Active = 1"
+ ||" and u.GUID = " || sql(OrderingProviderGuid)
+ };
+
+
+ // if current buprenorphine is being ordered by an x-waivered MD,
+ // then present all prior charted orders of buprenorphine
+ if (ordering_provider_name is in x_waivered_physicians) then
+
+ scenario := "2b";
+
+ alert_med_details := ();
+
+ // build alert order lines (alert body content)
+ // alert 1
+ for i in (1 seqto items_in_sql) do
+ add_line := "Order " || i || ": {{+R}}" || drug_name[i] || "{{-R}}\n Performed at: " || performed_date[i] || "\n Location: {{+B}}" || location_name[i] || "{{-B}}" || "\n Ordering Provider: " || ordering_provider[i] || "\n";
+ alert_med_details := alert_med_details , add_line;
+
+ if (i = 1) then
+ alert_lines := alert_med_details[i] || "\n " ;
+ else
+ alert_lines := alert_lines || alert_med_details[i] || "\n " ;
+ endif;
+
+ enddo;
+
+
+ // Main alert message content
+ alert_message := "\nThese are all prior ED charted Buprenorphine orders for this patient: " ||
+ "\n " ||
+ "\n{{+B}}Total Buprenorphine orders charted: " || items_in_sql || "{{-B}}" ||
+ "\n " ||
+ "\n"|| alert_lines ||
+ "\n ";
+
+
+ else // scenario 2a, proceeds to Decision 3
+ scenario := "2a";
+
+
+ /************************* decision 3 *****************************************/
+ // Is current buprenorphine is being ordered by an x-waivered doctor?
+ // if yes, -> then present all prior buprenorphine administrations from all MDs
+ //-> if no, -> then was all prior buprenorphine orders placed by an x-waivered physician?
+ // (loop through each prior order and see if ordering physician matches up completely to XW md list
+ // if yes, -> then present all prior buprenorphine administrations from all MDs (along with message of:
+ // (message content: All doses were administed by x-waivered physician
+ // if no, -> then present this alert message:
+ // (message content: This patient was administered buprenorphine in the ED at least once by a non-x-waivered physician....
+
+ scenario_list := ();
+
+ for k in (1 seqto count ordering_provider) do
+
+ if (ordering_provider[k] is in x_waivered_physicians) then
+ scenario_list := scenario_list, "in";
+ else
+ scenario_list := scenario_list, "out";
+ endif;
+ enddo;
+
+
+ if ("out" is in scenario_list) then
+ scenario := "3a";
+ else
+ scenario := "3b";
+ endif;
+
+
+ // Building the body content for alerts in both scenarios 3a and 3b
+ // Body content is the order details for charted buprenorphine, in which the patient was NOT admitted to inpatient
+ alert_med_details := ();
+ // build alert order lines (alert body content)
+ for i in (1 seqto items_in_sql) do
+ add_line := "Order " || i || ": {{+R}}" || drug_name[i] || "{{-R}}\n Performed at: " || performed_date[i] || "\n Location: {{+B}}" || location_name[i] || "{{-B}}" || "\n Ordering Provider: " || ordering_provider[i] || "\n";
+ alert_med_details := alert_med_details , add_line;
+
+ if (i = 1) then
+ alert_lines := alert_med_details[i] || "\n " ;
+ else
+ alert_lines := alert_lines || alert_med_details[i] || "\n " ;
+ endif;
+
+ enddo;
+
+
+ if scenario = "3b" then
+
+ // alert message content
+ // alert 2
+ alert_message := "\nThese are all prior ED charted Buprenorphine orders for this patient: " ||
+ "\n " ||
+ "\n{{+B}}All doses were ordered by X-Waivered physicians.{{-B}} " ||
+ "\n " ||
+ "\n{{+B}}Total Buprenorphine orders charted: " || items_in_sql || "{{-B}}" ||
+ "\n " ||
+ "\n"|| alert_lines ||
+ "\n ";
+
+ endif; // if scenario = "3b" then
+
+
+ // scenario 3a, show dialogue alert first, then show second alert with charted buprenorphine orders
+ if scenario = "3a" then
+
+ // dialogue alert message content
+ // alert 3
+ alert_message_dialogue := "\nThis patient was administered buprenorphine in the ED at least once by a non-X-Waivered physician. If this visit is for treatment of opioid use disorder only, this patient may not be eligible for additional buprenorphine treatment. Please review patient history." ||
+ "\n ";
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " " || alert_message_dialogue, "ED Buprenorphine Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ // Main alert message content
+ // alert 3
+ alert_message := "\nThese are all prior ED charted Buprenorphine orders for this patient: " ||
+ "\n " ||
+ "\n{{+B}}Total Buprenorphine orders charted: " || items_in_sql || "{{-B}}" ||
+ "\n " ||
+ "\n"|| alert_lines ||
+ "\n ";
+ endif;
+
+
+ endif; // if (ordering_provider_name is in x_waivered_physicians) then
+
+ endif; // if (items_in_sql = 0) then
+
+ endif; // if (CurrentLocation = "ER Major") then
+
+
+ // alert destination
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "ED Buprenorphine Alert",
+ priority := "High",
+ scope := Chart,
+ rule_group := "ED Buprenorphine Alert",
+ rule_number := 8000,
+ send_with_order := "DoNotSend",
+ alert_dialog_settings := "Must Acknowledge",
+ display_alert := show_alert];
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: buprenorphine_order_event;
+ ;;
+ logic: conclude show_alert;
+ ;;
+ action: write alert_message at order_alert_dest;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_FENTANYL_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_FENTANYL_ORDERS.mlm
new file mode 100644
index 0000000..156df28
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_FENTANYL_ORDERS.mlm
@@ -0,0 +1,201 @@
+maintenance:
+
+ title: SCH_ALERT_ON_FENTANYL_ORDERS ;;
+ mlmname: SCH_ALERT_ON_FENTANYL_ORDERS;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: St.Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: Rob Stewart ;;
+ date: 2017-06-21;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+
+ Change History
+
+ 06.19.2017 SZ CSR 35469: Fentanyl/Duragesic Patch Indication Alert
+ ;;
+ keywords: fentanyl transdermal patch, duragesic, alert
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // MLM evoked on these Fentanyl order sets
+ fentanyl_orderset_event := event{OrderSetInit User OrderSet :
+ WHERE OrderSetName IN ("Fentanyl 125mcg Patch"
+ , "Fentanyl Patch"
+ , "Fentanyl Other Orders")};
+
+ // MLM evoked on Fentanyl Patch orders
+ fentanyl_order_event := event{OrderInit User Order :
+ WHERE Name matches pattern "%Fentanyl%" and Name matches pattern "%patch%" };
+
+ // MLM evoked on Duragesic Patch orders
+ //duragesic_order_event := event{OrderInit User Order :
+ // WHERE Name matches pattern "%Duragesic%" and Name matches pattern "%patch%" };
+
+
+
+ // grab relevant guids
+ ClientGuid := EVOKINGOBJECT.ClientGUID;
+ ChartGuid := EVOKINGOBJECT.ChartGUID;
+ userguid := read last {UserInfo: GUID};
+ VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
+
+ // By default, the Fentanyl patch/duragesic alert IS displayed to user upon FormOpen of fentanyl patch/duragesic order
+ // If it meets any of these 3 exceptions then the alert is not shown:
+ // 1) User is a pain management or palliative care specialist
+ // 2) If patient was already prescribed fentanyl patch/duragesic during this visit
+ // 3) If fentanyl patch/duragesic is a home med and listed in their OMR
+
+ show_alert := "Yes";
+
+ //med_extension := EVOKINGOBJECT.MedicationExtension;
+ //order_user_data := EVOKINGOBJECT.OrderUserData;
+
+
+ /************************* exception 1 *****************************************/
+ // grab the ordering provider guid
+ if (EvokingEventType = "OrderInit") then
+ (OrderingProviderGuid) := read last {Order: CareProviderGuid REFERENCING EvokingObject};
+ endif;
+
+ // For ordersets, CareProviderGuid doesn{{{SINGLE-QUOTE}}}t exist so we{{{SINGLE-QUOTE}}}ll use userguid instead since that{{{SINGLE-QUOTE}}}s the best we can do
+ if (EvokingEventType = "OrderSetInit") then
+ (OrderingProviderGuid) := userguid;
+ endif;
+
+
+ exception_discpline := ("pain management", "palliative care", "palliative care/internal med");
+ exception_physicians := ("Erlanger, Daniel B","Platto, Michael J");
+
+
+ // SQL to get the discipline/specialty of the ordering provider
+ (ordering_provider_discipline, ordering_provider_name) := read last {
+ "select cp.Discipline, cp.displayname"
+ ||" from CV3User u"
+ ||" join CV3OrganizationalUnit ou on ou.GUID = u.OrgUnitGUID"
+ ||" join CV3CareProvider cp on cp.GUID = u.GUID"
+ ||" where u.Active = 1"
+ ||" and u.GUID = " || sql(OrderingProviderGuid)
+ };
+
+ // if the ordering provider is a pain management or palliative care specialist then don{{{SINGLE-QUOTE}}}t show the alert
+ if (ordering_provider_discipline is in exception_discpline) then
+ show_alert := "No";
+ discipline_bypassed := "yay the provider{{{SINGLE-QUOTE}}}s DISCIPLINE has bypassed this alert";
+ endif;
+
+
+ if (ordering_provider_name is in exception_physicians) then
+ show_alert := "No";
+ provider_bypassed := "yay the provider has bypassed this alert";
+ endif;
+
+
+
+ /************************* exception 2 *****************************************/
+ // SQL to see if patient was already ordered Fentanyl during this visit
+ existing_fentanyl_order := read last {
+ "select ocmi.Name"
+ ||" from cv3ordercatalogmasteritem ocmi with (nolock)"
+ ||" join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid"
+ ||" where"
+ ||" o.clientguid = " || sql(ClientGuid)
+ ||" and o.chartguid = " || sql(ChartGuid)
+ ||" and o.clientvisitguid = " || sql(VisitGuid)
+ ||" and ocmi.Name like {{{SINGLE-QUOTE}}}%fentanyl%{{{SINGLE-QUOTE}}}"
+ ||" and ocmi.Name like {{{SINGLE-QUOTE}}}%patch%{{{SINGLE-QUOTE}}}"
+ };
+
+ // if fentanyl patch order exists from this visit then don{{{SINGLE-QUOTE}}}t show alert
+ if exist existing_fentanyl_order then
+ show_alert := "No";
+ endif;
+
+
+ /************************* exception 3 *****************************************/
+ // SQL to see if fentanyl patch/duragesic is a home med and already in OMR
+ existing_fentanyl_omr := read last {
+ "SELECT p.DrugName"
+ ||" FROM SXAAMBClientPrescription p with (nolock) JOIN SXAAMBDrugCategoryXRef xr with (nolock)"
+ ||" ON p.GenericNameID = xr.GenericNameID"
+ ||" JOIN SXAAMBDrugCategory dc with (nolock)"
+ ||" ON xr.DrugCategoryID = dc.DrugCategoryID"
+ ||" WHERE p.ClientGUID = " || sql(ClientGuid)
+ ||" and ((p.DrugName like {{{SINGLE-QUOTE}}}%fentanyl%{{{SINGLE-QUOTE}}} and p.DrugName like {{{SINGLE-QUOTE}}}%transdermal%{{{SINGLE-QUOTE}}}) "
+ ||" or (p.DrugName like {{{SINGLE-QUOTE}}}%duragesic%{{{SINGLE-QUOTE}}}))"
+ };
+
+ // if fentanyl patch/duragesic is a home med and exists in OMR then don{{{SINGLE-QUOTE}}}t show alert
+ if exist existing_fentanyl_omr then
+ show_alert := "No";
+ endif;
+
+ /************************* other exceptions *****************************************/
+ // Don{{{SINGLE-QUOTE}}}t fire on fentanyl patch removal orders
+ if (EVOKINGOBJECT.Name matches pattern "%removal%") then
+ show_alert := "No";
+ endif;
+
+ // don{{{SINGLE-QUOTE}}}t fire on fentanyl patch orders that are part of an order set
+ if exists EVOKINGOBJECT.OrderSet then
+ show_alert := "No";
+ endif;
+
+
+
+
+ // alert message content
+ alert_message := "\nFentanyl Transdermal Patch (Duragesic®) is used ONLY in patients with: " ||
+ "\n " ||
+ "\n1) {{+B}}CHRONIC{{-B}}, severe PAIN requiring long-term, around-the-clock analgesia." ||
+ "\n " ||
+ "\n{{+R}}AND{{-R}}" ||
+ "\n " ||
+ "\n2) {{+B}}OPIOID-TOLERANCE{{-B}}:" ||
+ "\ntaking AT LEAST 60 mg PO morphine OR 30 mg oxycodone OR 8 mg PO hydromorphone OR an equianalgesic-dose of another opioid for 7 DAYS OR MORE" ||
+ "\n ";
+
+
+ // alert destination
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "Fentanyl Transdermal Patch (Duragesic®)",
+ priority := "High",
+ scope := Chart,
+ rule_group := "Fentanyl patch",
+ rule_number := 8000,
+ send_with_order := "DoNotSend",
+ alert_dialog_settings := "Must Acknowledge",
+ display_alert := true];
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: fentanyl_orderset_event;
+ fentanyl_order_event;
+ ;;
+ logic:
+
+ /************************* Main Rule *****************************************/
+ // if no exceptions stopped the alert from showing then proceed with alert
+ if (show_alert = "Yes") then
+ conclude true;
+ else
+ conclude false;
+ endif;
+ ;;
+ action:
+ write alert_message at order_alert_dest;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_IFEX_MESNA_OS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_IFEX_MESNA_OS.mlm
new file mode 100644
index 0000000..7b2191b
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_IFEX_MESNA_OS.mlm
@@ -0,0 +1,94 @@
+maintenance:
+
+ title: SCH_Alert_on_Ifex_Mesna_OS ;;
+ mlmname: SCH_Alert_on_Ifex_Mesna_OS ;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St.Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: Shawn Roberts;;
+ date: 2019-02-13;;
+ validation: testing;;
+
+library:
+ purpose: Hard stop to force users to select a mesna order when ordering ifex on order set "Ifosfamide and Mesna orders (Standard)"
+ ;;
+ explanation:
+
+ Change History:
+ 2019.02.13 SZ CSR #37916 - Update Ifex/Mesna Order Set
+
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ // initiation of nitroglycerin ointment order
+ ifex_mesna_OS_event:= event{OrderSetEnter User Order :
+ WHERE OrderSetName IN ("Ifosfamide and Mesna orders (Standard)")};
+
+ //Check for unsubmitted nitroglycerin orders
+ (unsubmitted_mesna, origOrderSet) := READ { UnsubmittedOrders: Name, OrderSetName
+ WHERE Name matches pattern "%mesna%"};
+
+ (unsubmitted_ifex, origOrderSet) := READ { UnsubmittedOrders: Name, OrderSetName
+ WHERE Name matches pattern "%ifosfamide%"};
+
+
+ // we want a hard stop when Ifex exists and NO mesna order exists
+ if (exist unsubmitted_ifex) and (NOT exist unsubmitted_mesna) then
+ unsubmitted_order_break_message := "no unbsubmitted mesna order was found :( ";
+ stop_message := true;
+ else
+ unsubmitted_order_break_message := "unbsubmitted order for mesna was found :) ";
+ endif;
+
+ hard_stop := false;
+
+ /************************************** Declare Alert Details ********************************/
+
+ // If stop message is true then set the alert message and fire hard stop alert
+ if (stop_message) then
+
+ // alert destination
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "Mesna must be ordered with Ifex(Ifosfamide)",
+ priority := "High",
+ scope := Chart,
+ rule_group := "Mesna Conflict Group",
+ rule_number := 8050,
+ send_with_order := "DoNotSend",
+ alert_dialog_settings := "No Override Allowed",
+ display_alert := true];
+
+ // alert message
+ alert_message := "{{+B}}Mesna must be ordered with Ifex (Ifosfamide). Please go back and select a Mesna order.{{-B}} ";
+
+ hard_stop := true;
+
+ endif;
+
+ /*******************************************************************************************/
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: ifex_mesna_OS_event;
+
+ ;;
+ logic: conclude hard_stop;
+ ;;
+ action:
+
+ write alert_message at order_alert_dest;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_NITROGLYCERIN_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_NITROGLYCERIN_ORDERS.mlm
new file mode 100644
index 0000000..432a13a
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_NITROGLYCERIN_ORDERS.mlm
@@ -0,0 +1,234 @@
+maintenance:
+
+ title: SCH_ALERT_ON_NITROGLYCERIN_ORDERS ;;
+ mlmname: SCH_ALERT_ON_NITROGLYCERIN_ORDERS;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: ;;
+ author: Sandy Zhang ;;
+ specialist: Sandy Zhang ;;
+ date: 2017-07-28;;
+ validation: testing;;
+
+library:
+ purpose: Generate a hard stop alert if nitroglycerin ointment or patch order exists and another is attempting to be ordered.
+ ;;
+ explanation:
+
+ Change History:
+ 2017.07.28 SZ CSR #33082 - Custom duplicate alert for nitroglycerin ointment and topical patch
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ //.Net libraries
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Set the stop message
+ stop_message := false;
+ hard_stop := false;
+
+ //Capture current patient data
+ (clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
+ clientVisitGuid := read last {ClientVisit : GUID};
+ chartGuid := read last {ClientVisit : ChartGUID};
+
+
+ //Set med lists for later
+ (nitro_patch_meds) := ("Nitroglycerin 0.1mg/hr Patch", "Nitroglycerin 0.2mg/hr Patch", "Nitroglycerin 0.3mg/hr Patch"
+ , "Nitroglycerin 0.4mg/hr Patch", "Nitroglycerin 0.6mg/hr Patch");
+
+ (nitro_oint_meds) := ("Nitroglycerin 2% Oint");
+
+
+
+ /*************************** Possible Evoking Events ************************************/
+
+ // initiation of nitroglycerin ointment order
+ nitro_oint_event:= event{OrderInit User Order :
+ WHERE Name = "Nitroglycerin 2% Oint"};
+
+ // initiation of nitroglycerin patch order
+ nitro_patch_event := event{OrderInit User Order :
+ WHERE Name IN ("Nitroglycerin 0.1mg/hr Patch"
+ , "Nitroglycerin 0.2mg/hr Patch"
+ , "Nitroglycerin 0.3mg/hr Patch"
+ , "Nitroglycerin 0.4mg/hr Patch"
+ , "Nitroglycerin 0.6mg/hr Patch")};
+
+ // initiation of nitroglycerin ointment orderset
+ nitro_oint_orderset_event := event{OrderSetInit User OrderSet :
+ WHERE OrderSetName IN ("Nitroglycerin Ointment","Nitroglycerin Ointment")};
+
+
+ // initiation of nitroglycerin patch orderset
+ nitro_patch_orderset_event := event{OrderSetInit User OrderSet :
+ WHERE OrderSetName IN ("Nitroglycerin Patch")};
+
+
+ /******************************************************************************/
+
+
+
+
+
+ //Determine evoking event -
+ if (EvokingEvent = nitro_patch_event OR EvokingEvent = nitro_oint_event) then
+
+ (this_order_id, this_order) := read last {Order : GUID, Name Referencing EvokingObject};
+ else
+ (this_order_id, this_order) := read last {OrderSet : GUID, OrderSetName Referencing EvokingObject};
+ endif;
+
+
+ //Check for unsubmitted nitroglycerin orders
+ (existing_orders, origOrderSet) := READ { UnsubmittedOrders: Name, OrderSetName
+ WHERE Name matches pattern "Nitroglycerin 0.1mg/hr Patch%"
+ OR Name matches pattern "Nitroglycerin 0.2mg/hr Patch%"
+ OR Name matches pattern "Nitroglycerin 0.3mg/hr Patch%"
+ OR Name matches pattern "Nitroglycerin 0.4mg/hr Patch%"
+ OR Name matches pattern "Nitroglycerin 0.6mg/hr Patch%"
+ OR Name matches pattern "Nitroglycerin 2% Oint%"};
+
+ if (exist existing_orders) then
+ found_unsubmitted_order := "unbsubmitted orders were found :) ";
+
+ else
+ no_unsubmitted_order := "no unbsubmitted orders were found :( ";
+
+ //No unsubmitted nitroglycerin order - check for existing nitroglycerin active orders
+ (existing_orders,
+ origOrderSet) := read {"SELECT o.Name, o.OrderSetName, o.TouchedWhen"
+ || " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " WHERE o.ClientGUID = " || clientGuid
+ || " AND o.ClientVisitGUID = " || clientVisitGuid
+ || " AND o.ChartGUID = " || chartGuid
+ || " AND (o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 2% Oint%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.1mg/hr Patch%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.2mg/hr Patch%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.3mg/hr Patch%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.4mg/hr Patch%{{{SINGLE-QUOTE}}}"
+ || " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.6mg/hr Patch%{{{SINGLE-QUOTE}}})"
+ || " AND"
+ || " ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
+ , primarytime = touchedWhen};
+
+ endif;
+
+
+ // if an existing order was detected
+ if (exist existing_orders) then
+ //Keep counter in case other nitroglycerin order exist that are not in conflict
+ i := 0;
+
+ //loop through existing, active patient orders
+ for orderItem in existing_orders do
+ i := i + 1;
+
+ // if ordering nitro ointment
+ if (EvokingEvent = nitro_oint_event) then
+ // and existing order is nitro patch then send alert
+ if ((orderItem in nitro_patch_meds)) then
+ stop_message := true;
+ existing_order_name := orderItem;
+ situation_1 := "ordering nitro ointment and existing order is nitro patch";
+ endif;
+
+
+
+ // if ordering nitro ointment from orderset
+ elseif (EvokingEvent = nitro_oint_orderset_event) then
+ // and existing order is nitro patch then send alert
+ if (orderItem in nitro_patch_meds) then
+ stop_message := true;
+ existing_order_name := orderItem;
+ situation_2 := "ordering nitro ointment from orderset and existing order is nitro patch ";
+ endif;
+
+
+
+ // if ordering nitro patch
+ elseif (EvokingEvent = nitro_patch_event) then
+ // and existing order is nitro ointment then send alert
+ if ((orderItem in nitro_oint_meds)) then
+ stop_message := true;
+ existing_order_name := orderItem;
+ situation_3 := "ordering nitro patch and existing order is nitro ointment";
+ endif;
+
+
+
+ // if ordering patch orderset
+ elseif (EvokingEvent = nitro_patch_orderset_event) then
+ // and existing order is nitro ointment then send alert
+ if ((orderItem in nitro_oint_meds)) then
+ stop_message := true;
+ existing_order_name := orderItem;
+ situation_4 := "ordering patch orderset and existing order is nitro ointment ";
+ endif;
+ endif;
+ enddo; //End loop through existing, active nitroglycerin patch/topical orders
+ endif; // End - if (exist existing_orders)
+
+
+
+ /************************************** Declare Alert Details ********************************/
+
+ // If stop message is true then set the alert message and fire hard stop alert
+ if (stop_message) then
+
+ // alert destination
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "Nitroglycerin topical/patch Order Conflict",
+ priority := "High",
+ scope := Chart,
+ rule_group := "Nitroglycerin Conflict Group",
+ rule_number := 8050,
+ send_with_order := "DoNotSend",
+ alert_dialog_settings := "No Override Allowed",
+ display_alert := true];
+
+ // alert message
+ alert_message := "{{+B}}Avoid concurrent use of {{+R}}" || this_order || "{{-R}} and {{+R}}"
+ || existing_order_name || "{{-R}}. Contact physician to adjust orders. {{-B}} ";
+
+ hard_stop := true;
+
+ endif;
+
+ /*******************************************************************************************/
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+
+ nitro_patch_event;
+ nitro_oint_event;
+ nitro_patch_orderset_event;
+ nitro_oint_orderset_event;
+
+ ;;
+ logic:
+ conclude hard_stop;
+
+
+ ;;
+ action:
+
+ write alert_message at order_alert_dest;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_NPO_TUBE_FEEDING_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_NPO_TUBE_FEEDING_ORDERS.mlm
new file mode 100644
index 0000000..bb614f9
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_NPO_TUBE_FEEDING_ORDERS.mlm
@@ -0,0 +1,133 @@
+maintenance:
+
+ title: SCH_ALERT_ON_NPO_TUBE_FEEDING_ORDERS;;
+ mlmname: SCH_ALERT_ON_NPO_TUBE_FEEDING_ORDERS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Allscripts;;
+ author: Juliet M. Law;;
+ specialist: Maria Pest;;
+ date: 2012-01-17;;
+ validation: testing;;
+
+library:
+ purpose: Generate an alert if a Tube Feeding order exists when ordering an NPO diet.
+ ;;
+ explanation: If user attempts to order NPO (Form name = Diet_NPO), MLM will look for active Tube Feeding order.
+ If exists, form cannot be accessed. Pop up alert will state "Patient has active Tube Feed Order."
+ ;;
+ keywords: NPO, Tube Feed, Diet
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ //.Net libraries
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ local_session := cds_session.local;
+
+ /*****************************************************************************************************************/
+ //Set to true if logging needed
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+ //Set the stop message
+ stop_message := false;
+
+ //Set Stop
+ hard_stop := false;
+ found_unsubmitted_orders := false;
+ existing_orders := ();
+ alert_priority := "High";
+
+ alert_dialog := "No Override Allowed";
+ alert_message := "{{+B}}Patient has active {{+R}}Tube Feed{{-R}} order.{{-B}}";
+
+ //Define events
+ npo_order_event := event{OrderInit User Order :
+ where name = "NPO"};
+ diet_order_event := event{OrderEnter User Order :
+ where name = "Diet"};
+
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "NPO Order Conflict",
+ priority := alert_priority,
+ scope := Chart,
+ rule_group := "NPO Conflict Group",
+ rule_number := 9000,
+ send_with_order := send_alert,
+ alert_dialog_settings := alert_dialog,
+ display_alert := true];
+
+/************************************************************************************************************/
+
+ if called_by_editor then
+ evokingobject := read last {Order : THIS where Name = "NPO"};
+ endif;
+
+ //Capture current patient
+ (clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
+ clientVisitGuid := read last {ClientVisit : GUID};
+ chartGuid := read last {ClientVisit : ChartGUID};
+
+ this_order := read last {Order : Name Referencing EvokingObject};
+
+ (existing_orders) := Read {UnsubmittedOrders : Name
+ WHERE Name matches pattern "Tube Feed%"};
+
+ local_session.SessionUnsubDietExists := false;
+ if (EvokingObject.Name = "Diet") then
+ local_session.SessionUnsubDietExists := true;
+ else
+ local_session.SessionUnsubDietExists := false;
+ endif;
+
+ if (EvokingEvent = npo_order_event) then
+ if ((exists (existing_orders)) AND (count(existing_orders) > 0 )) then
+ hard_stop := true;
+ else
+ (existing_orders) := read {"SELECT o.Name, o.TouchedWhen"
+ || " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " WHERE o.ClientGUID = " || clientGuid
+ || " AND o.ClientVisitGUID = " || clientVisitGuid
+ || " AND o.ChartGUID = " || chartGuid
+ || " AND (o.Name IN ({{{SINGLE-QUOTE}}}Tube Feeding{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}Tube Feeding (No other Diet Order).{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}Tube Feeding(Supplements Existing Diet).{{{SINGLE-QUOTE}}}))"
+ || " AND"
+ || " ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
+ , primarytime = touchedWhen};
+
+ order_count := count(existing_orders) as number;
+
+ if (order_count > 0) then
+ hard_stop := true;
+ endif;
+ endif;
+ else
+ hard_stop := false;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ npo_order_event;
+ diet_order_event;
+ ;;
+ logic:
+ conclude hard_stop
+ ;;
+ action:
+ write alert_message at order_alert_dest;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_SPECIALTY_COAGULATION.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_SPECIALTY_COAGULATION.mlm
new file mode 100644
index 0000000..a77ccb3
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_SPECIALTY_COAGULATION.mlm
@@ -0,0 +1,120 @@
+maintenance:
+
+ title: SCH_ALERT_ON_SPECIALTY_COAGULATION;;
+ mlmname: SCH_ALERT_ON_SPECIALTY_COAGULATION;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Allscripts;;
+ author: Shawn Head;;
+ specialist: Maria Pest;;
+ date: 2018-04-24;;
+ validation: testing;;
+
+library:
+ purpose: Generate an alert on Inpatient, Observation, and Emergency patients if specialty coaguation orders being entered (HARD STOP).
+ ;;
+ explanation: If user attempts to order a specialty coagulation order on an inpatient, observation, or emergency patient present a hard stop.
+ These orders should be entered for outpatient and physician office orders only.
+
+ 04-25-2018 STH CSR#: 36394 - Created
+ 08-01-2018 STH CSR#: 36394 - Added logic to alert only once every 20 minutes per patient. This is due to the fact that the alert was
+ presented multiple times when entering the orders through an order set.
+ ;;
+ keywords: Thrombotic Risk Profile (ITxM), Antithrombin III Activity (ITxM), APC Resistance (ITxM), Protein C Activity Plasma (ITxM)
+ Factor V Leiden Mutation (ITxM), Factor X (ITxM), Protein S Activity Plasma (ITxM), Prothrombin Gene Variant (ITxM)
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ //.Net libraries
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ /*****************************************************************************************************************/
+ //Set to true if logging needed
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+ //Set the stop message
+ stop_message := false;
+
+ //Set Stop
+ hard_stop := false;
+ found_unsubmitted_orders := false;
+ existing_orders := ();
+ alert_priority := "High";
+
+ alert_dialog := "Must Comment";
+ alert_message := "Hypercoaguable Profiles/Component testing on Inpatients is not appropriate in a setting of acute thrombosis or current anticoagulant usage. \n\n{{+B}}Please consult Hematology with any questions.{{-B}}\nOffice phone: 412-831-1320";
+
+ //Define events
+ coag_orderinit_event := event{OrderInit User Order :
+ where name in ("Thrombotic Risk Profile (ITxM)","Antithrombin III Activity (ITxM)","APC Resistance (ITxM)","Protein C Activity Plasma (ITxM)","Factor V Leiden Mutation (ITxM)","Factor X (ITxM)","Protein S Activity Plasma (ITxM)","Prothrombin Gene Variant (ITxM)")};
+ //coag_orderenter_event := event{OrderEnter User Order :
+ // where name in ("Thrombotic Risk Profile (ITxM)","Antithrombin III Activity (ITxM)","APC Resistance (ITxM)","Protein C Activity Plasma (ITxM)","Factor V Leiden Mutation (ITxM)","Factor X (ITxM)","Protein S Activity Plasma (ITxM)","Prothrombin Gene Variant (ITxM)")};
+
+ order_alert_dest := destination {alert} with
+ [alert_type := "WARNING",
+ short_message := "Specialty Coagulation Conflict",
+ priority := alert_priority,
+ scope := Chart,
+ rule_group := "Specialty Coagulation Conflict Group",
+ rule_number := 9000,
+ send_with_order := send_alert,
+ display_alert := true,
+ alert_dialog_settings := alert_dialog,
+ async_alert_dialog_settings := async_alert_dialog,
+ document_name := "",
+ document_conditional_text := (),
+ ack_comment_UDDD := "Lab_Hypercoag Alert",
+ ack_comment_UDDD_is_restricted := true];
+
+
+/************************************************************************************************************/
+
+ if called_by_editor then
+ evokingobject := read last {Order : THIS where Name = "Thrombotic Risk Profile (ITxM)"};
+ endif;
+
+ //Capture current patient
+ (clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
+ (clientVisitGuid, chartGuid, TypeCode) := read last {ClientVisit : GUID, ChartGUID, TypeCode};
+
+ this_order := read last {Order : Name Referencing EvokingObject};
+
+ comm_obj := this_communication.primaryobj;
+ Order_set_name := comm_obj.OrderSetName;
+
+ //Only alert on patients that are currently listed as inpatient, observation, or emergency visit types.
+ if (TypeCode in ("Inpatient","Observation","Emergency")) then
+ AlertAlreadyFired := read last {" select guid From CV3AlertRepository with (nolock)
+ where CreatedWhen >= dateadd(minute,-20,getdate())
+ and status = {{{SINGLE-QUOTE}}}ack{{{SINGLE-QUOTE}}}
+ and AlertComments is not null
+ and UserGUID = " || EVOKINGOBJECT.UserGUID || "
+ and ClientGUID = " ||EVOKINGOBJECT.ClientGUID || "
+ and ClientVisitGUID = " ||EVOKINGOBJECT.ClientVisitGUID };
+
+ if((count(AlertAlreadyFired) = 0) or (AlertAlreadyFired is null))then
+ hard_stop := true;
+ endif;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ coag_orderinit_event;
+ //COAG_orderenter_event;
+
+ ;;
+ logic:
+ conclude hard_stop
+ ;;
+ action:
+ write alert_message at order_alert_dest;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_TPA_EXCLUSION_FOR_STROKE.mlm b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_TPA_EXCLUSION_FOR_STROKE.mlm
new file mode 100644
index 0000000..1f1993f
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_TPA_EXCLUSION_FOR_STROKE.mlm
@@ -0,0 +1,146 @@
+maintenance:
+
+ title: SCH_ALERT_ON_TPA_EXCLUSION_FOR_STROKE;;
+ mlmname: SCH_ALERT_ON_TPA_EXCLUSION_FOR_STROKE;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Allscripts;;
+ author: Juliet M. Law;;
+ specialist: Maria Pest;;
+ date: 2012-09-24;;
+ validation: testing;;
+
+library:
+ purpose: Generate an alert if an order exists or not for TPA Inclusion/Exclusion.
+ ;;
+ explanation: When user attempts to enter Acute Ischemic Stroke order set, this MLM will check for the existence of a TPA
+ Inclusion/Exclusion order. If one exists, but no exclusions have been identified, then this MLM will do
+ nothing. If an order exists with identified exclusions, then an alert will display to the user and
+ display the exclusions. If an no order exists, then an alert will display to the user requesting an
+ order be created.
+
+ Change History
+ 2012.09.24 MLM CSR 30685: Created.
+ ;;
+ keywords: TPA, Inclusion/Exclusion, stroke
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ //.Net libraries
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ local_session := cds_session.local;
+
+ /*****************************************************************************************************************/
+ //Set to true if logging needed
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+ //Set the stop message
+ hard_stop := false;
+ hard_stop_message := "";
+ tpaOrderCount := 0;
+ alertDialogSettings := "";
+ alertPriority := "High";
+
+ stroke_order_event := event {OrderSetInit User Order :
+ WHERE OrderSetName = "TPA for Acute Ischemic Stroke"};
+
+ order_alert_dest := destination {Alert} WITH
+ [alert_type := "Warning",
+ short_message := "TPA for Acute Ischemic Stroke Alert",
+ scope := "Chart",
+ rule_group := "TPA for Acute Ischemic Stroke Alert Group",
+ rule_number := 9020,
+ send_with_order := send_alert,
+ display_alert := true,
+ alert_abstract := "",
+ asynch_alert_dialog_settings := "",
+ document_name := "",
+ document_conditional_text := (),
+ ack_comment_UDDD := "",
+ ack_comment_UDDD_is_restricted := False];
+
+ /*********************************************************************************************************************************/
+
+ if called_by_editor then
+ evokingobject := read last {OrderSet : THIS where OrderSetName = "TPA for Acute Ischemic Stroke"};
+ endif;
+
+ //Capture current patient
+ (clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
+ clientVisitGuid := read last {ClientVisit : GUID};
+ chartGuid := read last {ClientVisit : ChartGUID};
+
+ this_order := read last {OrderSet : OrderSetName Referencing EvokingObject};
+
+ //Check for unsubmitted tpa Inclusion/Exclusion orders first
+ (existing_tpa_order, tpaOrderSummaryLine) := read {UnsubmittedOrders : Name, SummaryLine
+ WHERE Name = "tPA Inclusion/ Exclusion Criteria"};
+
+ if (exists existing_tpa_order) then
+ tpaOrderCount := 1;
+ else
+ //Check for existence of TPA Inclusion/Exclusion Order
+ (tpaOrder, tpaOrderSummaryLine) := read {"SELECT o.Name, o.SummaryLine"
+ || " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " WHERE o.ClientGUID = " || Sql(clientGuid)
+ || " AND o.ClientVisitGUID = " || Sql(clientVisitGuid)
+ || " AND o.ChartGUID = " || Sql(chartGuid)
+ || " AND o.Name = {{{SINGLE-QUOTE}}}tPA Inclusion/ Exclusion Criteria{{{SINGLE-QUOTE}}}"
+ || " AND"
+ || " ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
+
+ tpaOrderCount := (count tpaOrder) as number;
+ endif;
+
+ if (tpaOrderCount = 0) then
+ hard_stop := true;
+ alertDialogSettings := "No Override Allowed";
+ alertPriority := "High";
+ hard_stop_message := "tPA Inclusion/Exclusion Order has not been completed electronically.\n\nYou must electronically enter a tPA Inclusion/Exclusion Order before you can Proceed.";
+ elseif (tpaOrderCount > 0) then
+ if ((first of (tpaOrderSummaryLine) matches pattern "%No Exclusions%") AND (first of (tpaOrderSummaryLine) matches pattern "%Questions unanswered = 0%%")) then
+ hard_stop := false;
+ else
+ if (NOT (first of (tpaOrderSummaryLine) matches pattern "%Questions unanswered = 0%%")) then
+ hard_stop := true;
+ alertDialogSettings := "No Override Allowed";
+ alertPriority := "High";
+ hard_stop_message := "{{+B}}tPA Inclusion/Exclusion Criteria - {{-B}}\n"
+ || "The tPA Inclusion/Exclusion Criteria Order contains unanswered questions. You MUST answer"
+ || " all questions before you can continue.";
+ else
+ hard_stop := true;
+ alertDialogSettings := "Must Acknowledge, Must Comment";
+ alertPriority := "Low";
+ hard_stop_message := "{{+B}}tPA Inclusion/Exclusion Criteria - {{-B}}\n" || first of (tpaOrderSummaryLine)
+ || "\n\n{{+B}}If you wish to override, enter Comment and Proceed.{{-B}}";
+ endif;
+ endif;
+ endif;
+ order_alert_dest.Priority := alertPriority;
+ order_alert_dest.Alert_Dialog_Settings := alertDialogSettings;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ //stroke_order_event;
+ ;;
+ logic:
+ conclude hard_stop;
+ ;;
+ action:
+ write hard_stop_message at order_alert_dest;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_AUTO_GENERATE_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_AUTO_GENERATE_ORDERS.mlm
new file mode 100644
index 0000000..15d1360
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_AUTO_GENERATE_ORDERS.mlm
@@ -0,0 +1,233 @@
+maintenance:
+
+ title: SCH_Auto_Generate_Orders ;;
+ mlmname: SCH_Auto_Generate_Orders ;;
+ arden: version 16.3;;
+ version: 16.3;;
+ institution: SCH;;
+ author: Shubhang Acharya;;
+ specialist: ;;
+ date: 2017-08-01;;
+ validation: testing;;
+
+library:
+ purpose: Create order through MLM.
+
+ Argument Required ::
+ 1) Client visit GUID
+ 2) client_guid
+ 3) user_GUID
+ 4) location_guid
+ 5) Order_Type ( Pass anyone from below three value based on performing operation )
+ A. GeneralOrder
+ B. MedicationOrder
+ C. DiagnosticOrder
+ 6) orderItemName ( Pass Name of Order )
+ 7) order_Creation_Reason ( Pass reason for order creation. )
+ 8) RequestingSource ( Pass RequestedBySource (must be in dictionary) )
+ 9) SessionType ( Pass SessionType )
+ 10) SessionReason ( Pass SessionReason )
+
+ NOTE: There is commented code in MLM in case developer wants to set custom form field values.
+
+ Sample Argument ::
+
+ MLM_Name := MLM {{{SINGLE-QUOTE}}}SCH_Auto_Generate_Orders{{{SINGLE-QUOTE}}}; // MLM name
+
+ orderItemName := orderItemName; //"CBC W/O Differential"; // "Activity" // Gen_Order ;// "Dietician Consult";
+ //orderItemModifier := ".";
+ //orderItemVersion := "";
+ order_Creation_Reason := "From MLM";
+ RequestingSource := "";
+ SessionType := "Standard";
+ SessionReason := ""; //SessionReason should be blank for Session Type "Standard Orders"
+
+ //user_GUID := 9000010934301190;
+
+
+ location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit " ||
+ " where ClientGUID = " || ClientGUID};
+ //Filed_1 := "NUR_PatientStatus"; // set Consult Call field on order
+ //Val_1 := "Inpatient";
+
+ Order_Type := "DiagnosticOrder";
+
+ Status := call MLM_Name with ClientVisitGUID,ClientGUID,user_GUID,location_guid,Order_Type,orderItemName
+ ,order_Creation_Reason,RequestingSource,SessionType,SessionReason;//,Filed_1,Val_1;
+
+
+ Return Type ::
+ MLM will return Success if Order created Successfully.
+ MLM will return error_message if any error generate while creating Orders.
+
+
+ Modification History:
+ --------------------------------------------------
+ 08.01.2017 SAcharya - CSR# 35187: MLM Created.
+ ;;
+ explanation:
+
+ ;;
+ keywords: Physician Documenation, Default date
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ //(this_documentcommunication) := argument;
+
+ (client_visit_guid,client_guid,user_GUID,location_guid,Order_Type,orderItemName,Catalog_Item_Modifier
+ ,order_Creation_Reason,RequestingSource,SessionType,SessionReason
+ ) := argument;
+
+ log_execution_info := FALSE;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ mlm_name := "SCH_Auto_Generate_Orders";
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ If Not Called_By_Editor Then
+ try
+ // Get the Client Visit object.
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((client_visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ; //OK
+
+ // get CatalogMasterItem ObjectsPlus object
+ catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName //OK
+ with orderItemName;
+
+ RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ( (user_GUID as Number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+
+ // get the location object
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ if Order_Type = "GeneralOrder" then
+ // Create the prefilled General order
+ Catalog_Item_Version := "";
+ Order_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ catalog_item, // CatalogMasterItem ObjectsPlus
+ //object
+ //Catalog_Item_Modifier, // string ItemNameModifier
+ //Catalog_Item_Version, // string ItemNameModifierVersion
+ order_Creation_Reason, // CreateReason
+ RequestingCareProvider_obj, // RequestingProvider
+ //ObjectsPlus object
+ RequestingSource, // string requestingSource
+ //(must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
+
+ void := call Order_obj.Save; // Create the order
+ void := call Order_obj.Dispose;
+
+ endif;
+
+ if Order_Type = "MedicationOrder" then
+
+ Order_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ catalog_item, // CatalogMasterItem ObjectsPlus object
+ //Catalog_Item_Modifier, // string ItemNameModifier
+ //Catalog_Item_Version, // string ItemNameModifierVersion
+ order_Creation_Reason, // string CreateReason
+ RequestingCareProvider_obj, // RequestedBy ObjectsPlus object
+ RequestingSource, // string RequestedBySource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+ //"SignOnSubmit" as {{{SINGLE-QUOTE}}}SuppressNotificationOptions{{{SINGLE-QUOTE}}} ;
+
+ void := call Order_obj.Save; // Create the order
+ void := call Order_obj.Dispose;
+
+ endif;
+
+ if Order_Type = "DiagnosticOrder" then
+
+ Order_obj := call {{{SINGLE-QUOTE}}} DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ catalog_item, // CatalogMasterItem ObjectsPlus object
+ //Catalog_Item_Modifier, // string ItemNameModifier
+ //Catalog_Item_Version, // string ItemNameModifierVersion
+ order_Creation_Reason, // string CreateReason
+ RequestingCareProvider_obj, // RequestedBy ObjectsPlus object
+ RequestingSource, // string RequestedBySource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+ //"SignOnSubmit" as {{{SINGLE-QUOTE}}}SuppressNotificationOptions{{{SINGLE-QUOTE}}} ;
+
+
+ void := call Order_obj.Save; // Create the order
+ void := call Order_obj.Dispose;
+
+ endif;
+
+ endtry;
+ catch Exception ex
+
+ error_occurred := true;
+ error_message := error_message ||
+ "{{+R}} Order {{-R}}\n" ||
+ ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+ if ( Order_obj is NOT NULL ) then
+ void:= call Order_obj.Dispose;
+ Order_obj:= null;
+ endif;
+ endcatch;
+ endif;
+
+ conclude true;
+ ;;
+ action:
+ if Error_occurred then
+ write "An error has occured in the MLM "
+ || "{{+B}}" || mlm_name || "{{-B}} "
+ ||"Please notify your System Administrators that an error message has "
+ ||"occurred for this patient. They will review the following error "
+ ||"message: \n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+ if Error_occurred then
+ return error_message;
+ else
+ return "Success";
+ endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_AVL_ACO.mlm b/MLMStripper/bin/Debug/SCH/SCH_AVL_ACO.mlm
new file mode 100644
index 0000000..5c61e54
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_AVL_ACO.mlm
@@ -0,0 +1,233 @@
+maintenance:
+
+ title: SCH_AVL_ACO;;
+ mlmname: SCH_AVL_ACO;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Cair Hospital;;
+ author: Janet Nordin;;
+ specialist: Don Warnick;;
+ date: 2018-08-03;;
+ validation: Testing;;
+
+library:
+ purpose: Maintains ACO patients Advanced Visit List data
+ ;;
+
+ explanation: This MLM maintains the ACO Advanced Visit List
+
+
+ Change history
+
+ 08.15.2018 DW CSR# 37090 - Create and AVL of ACO patients for Care Director staff and Navicare representative
+ 02.04.2018 DW HD#3609427 - The large batch ACO updates affect currently admitted patients more than expected. To better update these patients, I added a new trigger for "A&I flowsheet update" which occurs once per shift.
+
+ ;;
+
+ keywords: ObjectsPlus, Advanced Visit List Data, ACO
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+ // Advanced Visit List Item Names
+
+ AVL_Name := "ACO Patients";
+ AVL_External_ID := "009";
+ AVL_1 := "ACOProgram";
+ AVL_2 := "ACOInsurances";
+ AVL_3 := "ACODischargeDispositions";
+ AVL_4 := "ACODischargeLocations";
+
+ continue_processing:= true;
+ record_remove := false;
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+
+ // Triggers
+
+ trig_event_enter := event {ClientDocumentEnter User ClientDocument: where (documentname matches pattern "%Profile%") or (documentname = "ED Triage Note") or documentname in ("2. Adult Assessment/Intervention" )};
+ trig_event_modify:= event {ClientDocumentModify User ClientDocument: where (documentname matches pattern "%Profile%") or (documentname = "ED Triage Note") or documentname in ("2. Adult Assessment/Intervention" )};
+
+
+ (VisitGUID, ChartGUID, ClientGUID, docguid) := read last {ClientDocument: ClientVisitGuid, ChartGUID, ClientGUID, guid REFERENCING EvokingObject};
+
+
+ // Destinations
+
+
+ objects_plus_destination := destination {ObjectsPlus} with [ alert_type:= "Warning",short_message:= "Object created by MLM",priority := "low",scope:= "chart",rule_group:= "Advanced Visit List Data Object",rule_number:= 2010];
+ send_alert := "DoNotSend";
+ alert_dest := destination { Alert: warning, "Order Session Type", high, chart, "Order Session Type", 15042, send_alert, "No Override Allowed" };
+
+
+ // Gather ACO information
+
+ ACOFlag := read first {"select text from CV3CommentDeclaration with (nolock) where typecode = {{{SINGLE-QUOTE}}}ACO Flags{{{SINGLE-QUOTE}}} and status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}}
+ and ClientGUID = " || ClientGUID || " "
+ };
+
+ if not exists ACOFlag
+
+ then
+
+ // Check for Existing Record to Remove
+
+ ExistingRecord := read last {"
+ select avld.AdvancedVisitListDataGUID
+ from CV3AdvancedVisitListData avld with (nolock)
+ where avld.ClientVisitGUID = " || VisitGUID || " and avld.ExternalID = " || AVL_External_ID || " "
+ };
+
+ if exists ExistingRecord
+ then
+ record_remove := true;
+ else
+ continue_processing := false; // No processing necessary
+ endif;
+
+
+ else
+
+ // Gather Prior Discharge information
+
+
+ (ACODischLoc, ACODischDisp) := read last {"
+ select isnull (dischargelocation, {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), isnull (DischargeDisposition, {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}})
+ from cv3clientvisit with (nolock) where ClientGUID = " || ClientGUID || "
+ and visitstatus = {{{SINGLE-QUOTE}}}dsc{{{SINGLE-QUOTE}}} order by DischargeDtm desc
+ "};
+
+ if not exists ACODischLoc then ACODischLoc:= " "; endif;
+ if not exists ACODischDisp then ACODischDisp:= " "; endif;
+
+
+ // Gather Visit Insurance plan information
+
+
+ InsurancePlan := read {"
+ select ic.name
+ from CV3FRPContract fc with (nolock)
+ join CV3FRP f with (nolock) on f.GUID = fc.FRPGUID
+ join SXAAMInsuranceCarrier ic with (nolock) on ic.InsuranceCarrierID = f.InsuranceCarrierID
+ where fc.ClientGUID = " || ClientGUID || " and fc.ClientVisitGUID = " || VisitGUID || " and fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
+ order by fc.SequenceNum
+ "};
+
+ If exists InsurancePlan
+ then
+ for i in 1 seqto count InsurancePlan do
+ if i = 1 then InsurancePlanList := InsurancePlan[i];
+ else InsurancePlanList := InsurancePlanList || " / " || InsurancePlan[i];
+ endif;
+ enddo;
+ else
+ InsurancePlanList := " ";
+ endif;
+
+
+ endif;
+
+
+
+ if continue_processing
+
+ then
+
+ // Create Objecs for Add, Update, or Removal of a record
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((VisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData with (client_visit_obj, AVL_Name, AVL_External_ID) ;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
+ if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ endcatch;
+ endif;
+
+
+ ;;
+
+ priority: 50
+ ;;
+
+ evoke:
+
+ trig_event_enter;
+ trig_event_modify;
+ ;;
+
+ logic:
+
+ if continue_processing = false
+
+ then
+
+ conclude false;
+
+ else
+
+
+ try
+
+ if record_remove = true
+
+ then
+ // Remove - Update the Advance Visit List Object for purge
+
+ void := call advanced_visit_list_data_obj.Deactivate;
+ void := call advanced_visit_list_data_obj.Purge;
+ objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
+ else
+ // Add or Update - Update the Advance Visit List Object with data
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with AVL_1 , ACOFlag ;
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with AVL_2 , InsurancePlanList ;
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with AVL_3 , ACODischDisp ;
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with AVL_4 , ACODischLoc ;
+ objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
+
+ endif;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
+ if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+
+ conclude true;
+
+
+ endif;
+
+ ;;
+
+ action:
+
+ if error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}MLM SCH_AVL_ACO {{-B}} Please notify your System Administrators that an error message has occurred for this patient. They will review the following error message: \n" at alert_dest;
+ write error_message at alert_dest;
+ endif;
+
+ if exists objects_plus_destination then write true at objects_plus_destination; endif;
+
+ ;;
+
+urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_AVL_COPD.mlm b/MLMStripper/bin/Debug/SCH/SCH_AVL_COPD.mlm
new file mode 100644
index 0000000..8c18d56
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_AVL_COPD.mlm
@@ -0,0 +1,413 @@
+maintenance:
+
+ title: SCH_AVL_COPD;;
+ mlmname: SCH_AVL_COPD;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Juliet Law, Allscripts;;
+ specialist: Dean Miklavic, Allscripts;;
+ date: 2012-06-26;;
+ validation: Testing;;
+
+library:
+ purpose: Maintains COPD Advanced Visit List data
+ ;;
+
+ explanation: This MLM maintains the COPD Advanced Visit List
+
+ ;;
+
+ keywords: ObjectsPlus, Advanced Visit List Data, Potential Heart Failure
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+
+ //****************Make Changes To Spelling And Flags In This Section****************
+
+
+// Advanced Visit List Item Names
+ AVL_Name := "AVL Potential COPD Patients";
+ AVL_External_ID := "004";
+ AVL_HI_GUID_Coded := "HealthIssue_GUID_Coded";
+ AVL_HI_OnsetDate := "HealthIssue_OnsetDate";
+ AVL_HI_GUID_Patient := "HealthIssue_GUID_Patient";
+
+// Triggers
+ clientvisit_enter_event := Event {ClientVisitEnter ANY ClientVisit :
+ WHERE TypeCode = "Inpatient" OR TypeCode = "Observation"};
+
+ clientvisit_modify_event := Event {ClientVisitModify ANY ClientVisit :
+ WHERE TypeCode = "Inpatient" OR TypeCode = "Observation"};
+
+ healthissue_enter_event := Event {HealthIssueEnter ANY HealthIssue :
+ WHERE TypeCode IN ("Admitting DX","AMB Med History","Problem-Chronic",
+ "Problem-Proced","Problem-Visit") AND
+ (ShortName matches pattern "%COPD%" OR Text matches pattern "%COPD%") };
+
+ healthissue_modify_event := Event {HealthIssueModify ANY HealthIssue :
+ WHERE TypeCode IN ("Admitting DX","AMB Med History","Problem-Chronic",
+ "Problem-Proced","Problem-Visit") AND
+ (ShortName matches pattern "%COPD%" OR Text matches pattern "%COPD%") };
+
+ healthissue_delete_event := Event {HealthIssueDelete ANY HealthIssue :
+ WHERE TypeCode IN ("Admitting DX","AMB Med History","Problem-Chronic",
+ "Problem-Proced","Problem-Visit") AND
+ (ShortName matches pattern "%COPD%" OR Text matches pattern "%COPD%") };
+
+ healthissue_discontinue_event := Event {HealthIssueDiscontinue ANY HealthIssue :
+ WHERE TypeCode IN ("Admitting DX","AMB Med History","Problem-Chronic",
+ "Problem_Proced","Problem-Visit") AND
+ (ShortName matches pattern "%COPD%" OR Text matches pattern "%COPD%") };
+
+ //Destinations
+ objects_plus_destination := Destination { ObjectsPlus } WITH
+ [alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Advanced Visit List Data Object",
+ rule_number := 2011];
+
+ send_alert := "DoNotSend";
+
+ alert_dest := Destination { alert } WITH
+ [alert_type := "warning",
+ short_message := "Order Session Type",
+ priority := "high",
+ scope := "chart",
+ rule_group := "Order Session Type",
+ rule_number := 15042,
+ send_with_order := send_alert,
+ alert_dialog_settings := "No Override Allowed",
+ display_alert := true];
+
+ //******************Do Not Make Changes Below This Section*******************
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ if called_by_editor then
+ EvokingObject := read last { HealthIssue : This };
+ endif;
+
+// DETERMINE IF PROCESSING SHOULD CONTINUE SECTION
+
+ If EvokingEventType = healthissue_enter_event.type then
+ evokevent := "Health Issue Enter Event";
+ (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID
+ REFERENCING EvokingObject };
+ endif;
+
+ If EvokingEventType = healthissue_modify_event.type then
+ evokevent := "Health Issue Modify Event";
+ (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID
+ REFERENCING EvokingObject };
+ endif;
+
+ If EvokingEventType = healthissue_delete_event.type then
+ evokevent := "Health Issue Delete Event";
+ (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID
+ REFERENCING EvokingObject };
+ endif;
+
+ If EvokingEventType = healthissue_discontinue_event.type then
+ evokevent := "Health Issue Discontinue Event";
+ (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID
+ REFERENCING EvokingObject };
+ endif;
+
+ IF EvokingEventType = clientvisit_enter_event.type then
+ evokevent := "New Visit Event";
+ (VisitGUID, ChartGUID, ClientGUID) := read last {ClientVisit: GUID, ChartGUID, ClientGUID
+ REFERENCING EvokingObject};
+ endif;
+
+ IF EvokingEventType = clientvisit_modify_event.type then
+ evokevent := "Change to Inpatient Event";
+ (VisitGUID, ChartGUID, ClientGUID) := read last {ClientVisit: GUID, ChartGUID, ClientGUID
+ REFERENCING EvokingObject};
+ endif;
+
+ PatientType := read last {"SELECT TypeCode "
+ || "FROM CV3ClientVisit with (nolock) "
+ || "WHERE TypeCode IN ({{{SINGLE-QUOTE}}}Inpatient{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Observation{{{SINGLE-QUOTE}}}) "
+ || " AND ClientGUID = " || Sql(ClientGUID)
+ || " AND ChartGUID = " || Sql(ChartGUID)
+ || " AND guid = " || Sql(VisitGUID) };
+
+ NonCOPDAdmittingDx := read last {"SELECT Description "
+ || "FROM CV3HealthIssueDeclaration with (nolock) "
+ || "WHERE TypeCode = {{{SINGLE-QUOTE}}}ADMITTING DX{{{SINGLE-QUOTE}}} "
+ || " AND Active = 1 "
+ || " AND ShortName not like {{{SINGLE-QUOTE}}}%COPD%{{{SINGLE-QUOTE}}} "
+ || " AND Text not like {{{SINGLE-QUOTE}}}%COPD%{{{SINGLE-QUOTE}}} "
+ || " AND ClientGuid = " || Sql(ClientGuid)
+ || " AND ChartGuid = " || Sql(ChartGuid)
+ || " AND ClientVisitGUID = " || Sql(VisitGUID) };
+
+ PastCOPDAdmittingDx := read last {"SELECT Description "
+ || " FROM CV3HealthIssueDeclaration with (nolock) "
+ || " WHERE Active = 1 "
+ || " AND TypeCode <> {{{SINGLE-QUOTE}}}Admitting DX{{{SINGLE-QUOTE}}} "
+ || " AND ShortName like ({{{SINGLE-QUOTE}}}%COPD%{{{SINGLE-QUOTE}}}) "
+ || " AND ClientGuid = " || Sql(ClientGuid) };
+
+ WasBeddedPriorToModify := read last {"SELECT l.shortname "
+ || " FROM CV3ClientVisitLocation cvl with (nolock) JOIN CV3Location l with (nolock) "
+ || " ON l.guid = cvl.locationguid "
+ || " WHERE l.typecode = {{{SINGLE-QUOTE}}}bed{{{SINGLE-QUOTE}}} "
+ || " AND cvl.status <> {{{SINGLE-QUOTE}}}cur{{{SINGLE-QUOTE}}} "
+ || " AND cvl.clientguid = " || Sql(ClientGuid)
+ || " AND cvl.clientvisitguid = " || Sql(VisitGUID) };
+
+ If ((EvokingEventType = healthissue_enter_event.type
+ or EvokingEventType = healthissue_modify_event.type
+ or EvokingEventType = healthissue_delete_event.type
+ or EvokingEventType = healthissue_discontinue_event.type )
+ and PatientType is not null)
+ or ((EvokingEventType = clientvisit_modify_event.type
+ or clientvisit_enter_event.type)
+ and (not exists NonCOPDAdmittingDx
+ and not exists WasBeddedPriorToModify
+ and (exists PastCOPDAdmittingDx) ) )
+ then
+
+ //INPATIENT/OBSERVATION PATIENT PROCEED SECTION
+ //VISIT EVENT SECTION
+ If (EvokingEventType = clientvisit_enter_event.type or EvokingEventType = clientvisit_modify_event.type) then
+ //Attain the patient{{{SINGLE-QUOTE}}}s admitting dx guid for use as patient health issue guid
+ current_health_issue_id := read last{"SELECT GUID "
+ || " FROM CV3HealthIssueDeclaration with (nolock) "
+ || " WHERE TypeCode = {{{SINGLE-QUOTE}}}Admitting Dx{{{SINGLE-QUOTE}}} "
+ || " AND ClientVisitGUID = " || Sql(VisitGuid) };
+
+ //HEALTH ISSUE EVENT SECTION
+ else
+ //Get data from the evoking Health Issue
+ (current_coded_health_issue_id,
+ current_onset_day_num,
+ current_onset_month_num,
+ current_onset_year_num,
+ current_health_issue_id,
+ current_status,
+ existing_health_issue_obj) := read last { HealthIssue: CodedHealthIssueGUID, OnsetDayNum, OnsetMonthNum,
+ OnsetYearNum, GUID, Status, Backup
+ REFERENCING EvokingObject };
+
+ endif; // If Patient Type or Health Issue event
+
+ error_occurred := false;
+ error_message := "";
+ continue_processing:= true;
+ log_execution_info := false;
+ is_closed := false;
+ is_active := false;
+
+ //HEALTH HEALTH ISSUE MODIFY SECTION
+ if( EvokingEventType = healthissue_modify_event.type ) then
+ if(existing_health_issue_obj is not null) then
+ health_issue_onset_date_obj := existing_health_issue_obj.OnsetDate;
+
+ // processing only continues if status or onset date changes
+ if( existing_health_issue_obj.Status = current_status AND
+ ( health_issue_onset_date_obj.Day = current_onset_day_num AND
+ health_issue_onset_date_obj.Month = current_onset_month_num AND
+ health_issue_onset_date_obj.Year = current_onset_year_num ) ) then
+
+ continue_processing:= false;
+
+ elseif (existing_health_issue_obj.Status <> current_status ) then
+
+ ( is_closed, is_active ) := read { "EXEC SCMGetHealthIssueStatusSelPr " || SQL(current_status) };
+
+ endif;
+ endif;
+ endif;
+
+ //CONTINUE PROCESSING (except for Health Issue Modify event where something other than status or onset date changed)
+ if continue_processing then
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((VisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ // Create the AdvancedVisitListData object.
+ advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData
+ with (client_visit_obj, AVL_Name, AVL_External_ID) ;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( advanced_visit_list_data_obj is NOT NULL ) then
+ void:= call advanced_visit_list_data_obj.Dispose;
+ advanced_visit_list_data_obj:= null;
+ endif;
+
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ endcatch;
+ endif;
+
+ //End of INPATIENT/OBSERVATION PATIENT PROCEED SECTION
+ else
+ //DO NOT PROCEED SECTION
+ continue_processing:= false;
+ endif; // If PatientType
+
+ ;;
+
+ priority: 50
+ ;;
+
+ evoke:
+
+
+ 1 minutes after time of clientvisit_enter_event;
+ 1 minutes after time of clientvisit_modify_event;
+ 0 minutes after time of healthissue_enter_event;
+ 0 minutes after time of healthissue_modify_event;
+ 0 minutes after time of healthissue_delete_event;
+ 0 minutes after time of healthissue_discontinue_event;
+
+ ;;
+
+ logic:
+
+ if( EvokingObject is null or continue_processing = false ) then
+ conclude false;
+ endif;
+
+ try
+ if( is_closed AND is_active ) then
+ void := call advanced_visit_list_data_obj.Deactivate;
+ // don{{{SINGLE-QUOTE}}}t conclude false as we still need to return true to OP destination
+ continue_processing:= false;
+ endif;
+
+ if( continue_processing ) then
+
+ //HEALTH ISSUE ENTER OR HEALTH ISSUE MODIFY SECTION
+ // Client Visit Event
+ if (EvokingEventType = clientvisit_enter_event.type or EvokingEventType = clientvisit_modify_event.type) then
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_GUID_Patient, (current_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
+
+ else
+
+
+ // Health Issue Enter or Modify Event
+ if( EvokingEventType = healthissue_enter_event.type or EvokingEventType = healthissue_modify_event.type) then
+
+ // Set the Patient Health Issue GUID.
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_GUID_Patient, (current_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // Set the Coded Health Issue.
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_GUID_Coded,(current_coded_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // Set the Onset Date if available.
+ if( current_onset_year_num is not null and current_onset_year_num > 0 ) then
+ if( current_onset_month_num is null or current_onset_month_num <= 0 ) then
+ current_onset_month_num:= 1;
+ else
+ if ( current_onset_day_num is null or current_onset_day_num <= 0 ) then
+ current_onset_day_num:= 1;
+ endif;
+ endif;
+
+ onset_date_string := (current_onset_year_num as String) || "-" || (current_onset_month_num as String) || "-" || (current_onset_day_num as String);
+ onset_date := onset_date_string as time;
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_OnsetDate, onset_date as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}});
+ endif;
+
+
+ //HEALTH ISSUE DELETE SECTION
+ // Deactivate then delete the Advanced Visit List Data
+ elseif ( EvokingEventType = healthissue_delete_event.type ) then
+ void := call advanced_visit_list_data_obj.Deactivate;
+ void := call advanced_visit_list_data_obj.Purge;
+ //HEALTH ISSUE DISCONTINUE SECTION
+ // Deactivate the Advanced Visit List Data
+ elseif ( EvokingEventType = healthissue_discontinue_event.type ) then
+ void := call advanced_visit_list_data_obj.Deactivate;
+ // note: since Deactivate and Delete both permenantly remove the HI from the list,
+ // we will treat them the same and purge the row
+ void := call advanced_visit_list_data_obj.Purge;
+ endif; // if( EvokingEventType = health_issue_enter_event.type or health_issue_modify_event.type )
+ objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
+
+ endif; // If Health Issue Enter etc...
+
+ endif; // if( continue_processing )
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( advanced_visit_list_data_obj is NOT NULL ) then
+ void:= call advanced_visit_list_data_obj.Dispose;
+ advanced_visit_list_data_obj:= null;
+ endif;
+
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ conclude true;
+ ;;
+
+ action:
+
+ if error_occurred then
+
+ write "An error has occured in the MLM " ||
+ "{{+B}}MLM SC_AVL_POTENTIAL_COPD {{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at alert_dest;
+
+ write error_message at alert_dest;
+ endif;
+
+ if exists objects_plus_destination then
+ write true at objects_plus_destination;
+ endif;
+/*
+ write " Messages " || " List Name.: " || AVL_Name
+ || " Evoking Event: " || evokevent
+ || " ObjectGUID1: " || current_health_issue_id
+ || " ObjectGUID2: " || current_coded_health_issue_id
+ || " onset_date: " || onset_date
+ || " ClientVisitGUID: " || VisitGUID
+ || " PatientType: " || PatientType
+ || " NonCHFAdmittingDx: " || NonCOPDAdmittingDx
+ || " PastCHFAdmittingDx: " || PastCOPDAdmittingDx
+ || " WasBeddedPriorToModify: " || WasBeddedPriorToModify
+ || " continue_processing : " || continue_processing
+ at alert_dest;
+*/
+ ;;
+
+urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_AVL_DIABETES_ONSET.mlm b/MLMStripper/bin/Debug/SCH/SCH_AVL_DIABETES_ONSET.mlm
new file mode 100644
index 0000000..7ffd355
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_AVL_DIABETES_ONSET.mlm
@@ -0,0 +1,257 @@
+maintenance:
+
+ title: Maintain Advanced Visit List of patients with onset of diabetes;;
+ mlmname: SCH_AVL_DIABETES_ONSET;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St.Clair Hospital;;
+ author: Debbie Eiler;;
+ specialist: Don Warnick;;
+ date: 2013-07-01;;
+ validation: Testing;;
+
+library:
+ purpose: Maintains Diabetes Onset Visit List data
+ ;;
+
+ explanation: This MLM maintains the Diabetes Onset Advanced Visit List
+ Change history
+
+ 07.01.2013 DW CSR# 31622 Created from the Potential Heart Failure Advance Visit List
+ 10.07.2013 JL 6.1 upgrade - Corrected ambibuous code field in Health Issue query
+
+ ;;
+
+ keywords: ObjectsPlus, Advanced Visit List Data, Diabetes Onset
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+
+
+// Advanced Visit List Item Names
+
+ AVL_Name := "Potential Diabetes Onset";
+ AVL_External_ID := "003";
+ AVL_Result := "ResultValue" ;
+
+// Triggers
+
+ clientvisit_modify_event := Event {ClientVisitModify BATCH ClientVisit: where typecode = "Inpatient" or typecode = "Observation"};
+ lab_result_enter_event := EVENT {ObservationEnter ANY Observation: WHERE Itemname matches pattern "%A1C%"};
+
+// Destinations
+
+ objects_plus_destination := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Advanced Visit List Data Object",
+ rule_number := 2010];
+
+ send_alert := "DoNotSend";
+ alert_dest := destination { Alert: warning, "Order Session Type", high, chart, "Order Session Type", 15042, send_alert, "No Override Allowed" };
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ if called_by_editor then
+ EvokingObject := read last {HealthIssue: THIS };
+ endif;
+
+
+// DETERMINE IF PROCESSING SHOULD CONTINUE SECTION
+
+ If EvokingEventType = lab_result_enter_event.type
+ then
+ evokevent := "Lab Event";
+ (VisitGUID, ChartGUID, ClientGUID) := read last { Observation: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject };
+ endif;
+
+ IF EvokingEventType = clientvisit_modify_event.type
+ then
+ evokevent := "Change to Inpatient Event";
+ (VisitGUID, ChartGUID, ClientGUID) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject};
+ endif;
+
+
+ PatientType := read last {"select typecode from CV3ClientVisit with (nolock) where typecode in ({{{SINGLE-QUOTE}}}inpatient{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}observation{{{SINGLE-QUOTE}}}) and
+ ClientGUID = " || ClientGUID || " and ChartGUID = " || ChartGUID || " and guid = " || VisitGUID || " "};
+
+ (Lab_Value, abnormalitycode, ArrivalDtm) := read last {"select bo.value, bo.abnormalitycode, convert(varchar(10), bo.ArrivalDtm,101)
+ from cv3order o with (nolock)
+ join cv3basicobservation as bo with (nolock) on bo.ClientGUID = o.ClientGUID and bo.ChartGUID = o.ChartGUID and bo.clientvisitguid = o.clientvisitguid and bo.orderguid = o.guid and bo.ishistory = 0
+ where o.ClientGUID = " || ClientGUID || " and o.ChartGUID = " || ChartGUID || " and o.clientvisitguid = " || VisitGUID || " and o.name = {{{SINGLE-QUOTE}}}Hemoglobin A1C{{{SINGLE-QUOTE}}} and bo.ItemName = {{{SINGLE-QUOTE}}}Hemoglobin A1C Percent{{{SINGLE-QUOTE}}}
+ and CAST (bo.value as float) >= 6.5"};
+
+ (DiabeticHealthIssue) := read last {"select hi.description
+ from CV3HealthIssueDeclaration hi with (nolock)
+ join CV3CodedHealthIssue h with (nolock) on h.GUID = hi.CodedHealthIssueGUID
+ where hi.Active = 1
+ and (case when h.typecode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} then substring(h.code, 5, 20) when h.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} then h.code end) > {{{SINGLE-QUOTE}}}250.0{{{SINGLE-QUOTE}}}
+ and (case when h.typecode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} then substring(h.code, 5, 20) when h.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} then h.code end) < {{{SINGLE-QUOTE}}}250.93{{{SINGLE-QUOTE}}}
+ and ClientGuid = " || ClientGUID || " "};
+
+
+// If Criteria are met Proceed
+
+ If (EvokingEventType = lab_result_enter_event.type and PatientType is not null and exists Lab_Value and not exists DiabeticHealthIssue)
+ or
+ (EvokingEventType = clientvisit_modify_event.type and exists Lab_Value and not exists DiabeticHealthIssue)
+
+ then
+
+
+// Lab event section
+
+
+ If EvokingEventType = lab_result_enter_event.type
+
+ then
+ LabValue, abnormalitycode, ArrivalDtm := read last { Observation: value, abnormalitycode, ArrivalDtm REFERENCING EvokingObject };
+
+ // Reformat the Result Date
+ ResultMonth:= EXTRACT Month ArrivalDtm;
+ ResultDay:= EXTRACT Day ArrivalDtm;
+ if ResultMonth < 10 then ResultMonth:= "0" || ResultMonth; endif;
+ if ResultDay < 10 then ResultDay:= "0" || ResultDay; endif;
+ ResultDate := ResultMonth || "/" || ResultDay || "/" || EXTRACT YEAR ArrivalDtm;
+
+ if abnormalitycode = "H" then Lab_Value := LabValue || " (H) " || ResultDate;
+ else Lab_Value := LabValue || " " || ResultDate;
+ endif;
+
+// Attain patient{{{SINGLE-QUOTE}}}s existing Advanced Visit List Data for re-entry
+
+ (ClientVisitGUID):= read last{"select ClientVisitGUID from CV3AdvancedVisitListData with (nolock)
+ where externalid = " || AVL_External_ID || " and ClientVisitGUID = " || VisitGUID || " "};
+
+
+// Visit event section
+
+ ElseIf (EvokingEventType = clientvisit_modify_event.type) then
+
+// Populate Lab data found in the patient record
+
+ if exists Lab_Value then
+ if abnormalitycode = "H" then Lab_Value := Lab_Value || " (H) " || ArrivalDtm ; else Lab_Value := Lab_Value || " " || ArrivalDtm ; endif;
+ else Lab_Value := " ";
+ endif;
+
+ endif; // If Proceed
+
+
+ error_occurred := false;
+ error_message := "";
+ continue_processing:= true;
+ log_execution_info := false;
+ is_closed := false;
+ is_active := false;
+
+// CONTINUE PROCESSING (except for Health Issue Modify event where something other than status or onset date changed)
+
+ if continue_processing
+ then
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((VisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ // Create the AdvancedVisitListData object.
+
+ advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData
+ with (client_visit_obj, AVL_Name, AVL_External_ID) ;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
+ if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ endcatch;
+ endif;
+
+
+// End of INPATIENT/OBSERVATION PATIENT PROCEED SECTION
+
+
+ else
+
+// DO NOT PROCEED SECTION
+
+ continue_processing:= false;
+
+
+ endif; // If PatientType
+
+ ;;
+
+ priority: 50
+ ;;
+
+ evoke:
+
+ 1 minutes after time of lab_result_enter_event;
+ 1 minutes after time of clientvisit_modify_event;
+ ;;
+
+ logic:
+
+
+ if( EvokingObject is null or continue_processing = false ) then conclude false; endif;
+
+ try
+ if( is_closed AND is_active )
+ then
+ void := call advanced_visit_list_data_obj.Deactivate;
+ // don{{{SINGLE-QUOTE}}}t conclude false as we still need to return true to OP destination
+ continue_processing:= false;
+ endif;
+
+ if( continue_processing )
+ then
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with AVL_Result , Lab_Value ;
+ objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
+ endif;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
+ if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+
+
+ conclude true;
+
+ ;;
+
+ action:
+
+ if error_occurred
+ then
+
+ write "An error has occured in the MLM " ||
+ "{{+B}}MLM SCH_AVL_DIABETES_ONSET {{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at alert_dest;
+ write error_message at alert_dest;
+ endif;
+
+ if exists objects_plus_destination then write true at objects_plus_destination; endif;
+
+ write " Messages " || " Version 1.. List Name : " || AVL_Name
+ || " Evoking Event: " || evokevent
+ || " Lab Value: " || Lab_Value
+ || " ClientVisitGUID: " || ClientVisitGUID
+ || " PatientType: " || PatientType
+ || " DiabetesHI: " || DiabeticHealthIssue
+ || " continue_processing : " || continue_processing
+ at alert_dest;
+
+ ;;
+
+urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_AVL_HIGHMARK_GATEWAY.mlm b/MLMStripper/bin/Debug/SCH/SCH_AVL_HIGHMARK_GATEWAY.mlm
new file mode 100644
index 0000000..f0c8a39
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_AVL_HIGHMARK_GATEWAY.mlm
@@ -0,0 +1,211 @@
+maintenance:
+
+ title: SCH_AVL_HIGHMARK_GATEWAY;;
+ mlmname: SCH_AVL_HIGHMARK_GATEWAY;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St. Cair Hospital;;
+ author: Janet Nordin;;
+ specialist: Don Warnick;;
+ date: 2018-08-03;;
+ validation: Testing;;
+
+library:
+ purpose: Maintains ACO patients Advanced Visit List data
+ ;;
+
+ explanation: This MLM maintains the ACO Advanced Visit List
+
+
+ Change history
+
+ 12.10.2018 DW CSR# 37677 - Create and AVL of Highmark and Gateway paients for Care Director users
+ 01.08.2019 DW CSR# 37677 - User requested us to exclude insurance 119B post activation
+ 01.16.2019 DW HD#3582632 - Needed to add insurance 786B
+
+ ;;
+
+ keywords: ObjectsPlus, Advanced Visit List Data
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ // Advanced Visit List Item Names
+
+ AVL_Name := "Insurance Plans";
+ AVL_External_ID := "010";
+ AVL_1 := "InsuranceTypes";
+ AVL_2 := "InsurancePlans";
+
+ continue_processing:= true;
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+ // Trigger
+
+ clientvisit_enter_event := event {ClientVisitEnter ANY ClientVisit: where typecode in ("Inpatient", "Observation", "Emergency") };
+
+ insurance_enter_event := event{InsuranceEnter ANY ClientVisit};
+ insurance_modify_event:= event{InsuranceModify ANY ClientVisit};
+
+ if EvokingEventType = "ClientVisitEnter"
+ then
+ (clientguid, visitguid, visittype) := read last {ClientVisit: clientguid, guid, typecode REFERENCING EvokingObject};
+ else
+ (ClientGuid, visitguid) := read last {Insurance: ClientGuid, ClientVisitGUID REFERENCING EvokingObject};
+ EvokingInsuranceType:= EVOKINGOBJECT.FRPName;
+ visittype := read last { " select typecode from cv3clientvisit with (nolock) where clientguid = " || clientguid || " and guid = " || visitguid || " " };
+ endif;
+
+
+ // Destinations
+
+
+ objects_plus_destination := destination {ObjectsPlus} with [ alert_type:= "Warning",short_message:= "Object created by MLM",priority := "low",scope:= "chart",rule_group:= "Advanced Visit List Data Object",rule_number:= 2010];
+
+ send_alert := "DoNotSend";
+ alert_dest := destination { Alert: Informational, "Diagnostic", low, chart, "Diagnostic", 15042, send_alert, "No Override Allowed" };
+
+
+ // Check for Existing Record to Remove
+
+ ExistingRecord := read last {"
+ select avld.AdvancedVisitListDataGUID
+ from CV3AdvancedVisitListData avld with (nolock)
+ where avld.ClientVisitGUID = " || VisitGUID || " and avld.ExternalID = " || AVL_External_ID || " "
+ };
+
+
+ if exists ExistingRecord or EvokingInsuranceType not in ("BLUE CROSS","GATEWAY" ) or visittype not in ("Inpatient", "Observation", "Emergency")
+
+ then
+
+ // Stop processing if the patient is already on the list of if the insurance type is not one of interest
+
+ continue_processing := false;
+
+
+ else
+
+
+ // Gather Visit Insurance plan information
+
+
+ InsuranceType, InsurancePlan := read first {"
+ select f.Name, ic.name
+ from CV3FRPContract fc with (nolock)
+ join CV3FRP f with (nolock) on f.GUID = fc.FRPGUID
+ join SXAAMInsuranceCarrier ic with (nolock) on ic.InsuranceCarrierID = f.InsuranceCarrierID
+ where fc.ClientGUID = " || ClientGUID || " and fc.ClientVisitGUID = " || VisitGUID || "
+ and fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and ic.CarrierCode in ({{{SINGLE-QUOTE}}}709B{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}753B{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}141B{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}786B{{{SINGLE-QUOTE}}})
+ order by fc.SequenceNum
+ "};
+
+
+ // Stop processing if the insurance plan is not one of interest
+
+
+ if not exists InsuranceType then continue_processing := false; endif;
+
+
+ endif;
+
+
+
+ if continue_processing
+
+ then
+
+ // Create Objecs for Add, Update, or Removal of a record
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((VisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData with (client_visit_obj, AVL_Name, AVL_External_ID) ;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
+ if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ endcatch;
+ endif;
+
+
+ ;;
+
+ priority: 50
+ ;;
+
+ evoke:
+
+ 4 seconds after time of insurance_enter_event;
+ 4 seconds after time of insurance_modify_event;
+
+
+ ;;
+
+ logic:
+
+ if continue_processing = false
+
+ then
+ conclude false;
+ else
+
+ try
+ // Add or Update - Update the Advance Visit List Object with data
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with AVL_1 , InsuranceType ;
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with AVL_2 , InsurancePlan ;
+ objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
+ if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+
+ conclude true;
+
+ endif;
+
+ ;;
+
+ action:
+
+ if error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}MLM SCH_AVL_HIGHMARK_GATEWAY {{-B}} Please notify your System Administrators that an error message has occurred for this patient. They will review the following error message: \n" at alert_dest;
+ write error_message at alert_dest;
+ endif;
+
+ if exists objects_plus_destination then write true at objects_plus_destination; endif;
+
+
+ // Write Diagnostic Alert Message in PatientIfo/Alerts (remove prior to Production deployment)
+/*
+ write " Messages "
+ || " List Name.: " || AVL_Name
+ || " Evoking Event: " || EvokingEventType
+ || " Evoking Insurance Type: " || EvokingInsuranceType
+ || " InsuranceType: " || InsuranceType
+ || " InsurancePlan: " || InsurancePlan
+ || " ExistingRecord: " || ExistingRecord
+ || " continue_processing : " || continue_processing
+ at alert_dest;
+*/
+
+
+ ;;
+
+urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_AVL_POTENTIAL_HEART_FAILURE.mlm b/MLMStripper/bin/Debug/SCH/SCH_AVL_POTENTIAL_HEART_FAILURE.mlm
new file mode 100644
index 0000000..da52b28
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_AVL_POTENTIAL_HEART_FAILURE.mlm
@@ -0,0 +1,490 @@
+maintenance:
+
+ title: Maintain Advanced Visit List Potential Heart Failure;;
+ mlmname: SCH_AVL_POTENTIAL_HEART_FAILURE;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Eclipsys, Sample MLM;;
+ author: Eclipsys Corporation;;
+ specialist: ;;
+ date: 2011-06-01;;
+ validation: Testing;;
+
+library:
+ purpose: Maintains Potential Heart Failure Advanced Visit List data
+ ;;
+
+ explanation: This MLM maintains the Potential Heart Failure Advanced Visit List
+
+ ;;
+
+ keywords: ObjectsPlus, Advanced Visit List Data, Potential Heart Failure
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+
+ //****************Make Changes To Spelling And Flags In This Section****************
+
+
+// Advanced Visit List Item Names
+
+ AVL_Name := "Potential Heart Failure";
+ AVL_External_ID := "001";
+ AVL_HI_GUID_Coded := "HealthIssue_GUID_Coded";
+ AVL_HI_OnsetDate := "HealthIssue_OnsetDate";
+ AVL_HI_GUID_Patient:= "HealthIssue_GUID_Patient";
+ AVL_Result := "ResultValue" ;
+
+
+// Triggers
+
+ clientvisit_enter_event := Event {ClientVisitEnter ANY ClientVisit: where typecode = "Inpatient" or typecode = "Observation"};
+
+ clientvisit_modify_event := Event {ClientVisitModify BATCH ClientVisit: where typecode = "Inpatient" or typecode = "Observation"};
+
+ bnp_result_enter_event:= EVENT {ObservationEnter ANY Observation: WHERE Itemname matches pattern "%BNP%"};
+
+ health_issue_enter_event:= event { HealthIssueEnter Any HealthIssue:
+ where typecode = "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart%") or text matches pattern ("%CHF%") or text matches pattern ("%Heart%"))
+ or typecode <> "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart Failure%"))};
+
+ health_issue_modify_event:= event { HealthIssueModify Any HealthIssue:
+ where typecode = "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart%") or text matches pattern ("%CHF%") or text matches pattern ("%Heart%"))
+ or typecode <> "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart Failure%"))};
+
+
+ health_issue_delete_event:= event { HealthIssueDelete Any HealthIssue:
+ where typecode = "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart%") or text matches pattern ("%CHF%") or text matches pattern ("%Heart%"))
+ or typecode <> "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart Failure%"))};
+
+
+ health_issue_discontinue_event:= event { HealthIssueDiscontinue Any HealthIssue:
+ where typecode = "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart%") or text matches pattern ("%CHF%") or text matches pattern ("%Heart%"))
+ or typecode <> "Admitting DX" and (ShortName matches pattern ("%CHF%") or ShortName matches pattern ("%Heart Failure%"))};
+
+
+// Destinations
+
+
+ objects_plus_destination := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Advanced Visit List Data Object",
+ rule_number := 2010];
+
+ send_alert := "DoNotSend";
+ alert_dest := destination { Alert: warning, "Order Session Type", high, chart, "Order Session Type", 15042, send_alert, "No Override Allowed" };
+
+
+ //******************Do Not Make Changes Below This Section*******************
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ if called_by_editor then EvokingObject := read last {HealthIssue: THIS }; endif;
+
+
+// DETERMINE IF PROCESSING SHOULD CONTINUE SECTION
+
+If EvokingEventType = bnp_result_enter_event.type then evokevent := "BNP Event"; (VisitGUID, ChartGUID, ClientGUID) := read last { Observation: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
+If EvokingEventType = health_issue_enter_event.type then evokevent := "Health Issue Enter Event"; (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
+If EvokingEventType = health_issue_modify_event.type then evokevent := "Health Issue Modify Event"; (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
+If EvokingEventType = health_issue_delete_event.type then evokevent := "Health Issue Delete Event"; (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
+If EvokingEventType = health_issue_discontinue_event.type then evokevent := "Health Issue Discontinue Event"; (VisitGUID, ChartGUID, ClientGUID) := read last { HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
+IF EvokingEventType = clientvisit_enter_event.type then evokevent := "New Visit Event"; (VisitGUID, ChartGUID, ClientGUID) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject}; endif;
+IF EvokingEventType = clientvisit_modify_event.type then evokevent := "Change to Inpatient Event"; (VisitGUID, ChartGUID, ClientGUID) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject}; endif;
+
+
+PatientType := read last {"select typecode from CV3ClientVisit with (nolock) where typecode in ({{{SINGLE-QUOTE}}}inpatient{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}observation{{{SINGLE-QUOTE}}}) and
+ ClientGUID = " || ClientGUID || " and ChartGUID = " || ChartGUID || " and guid = " || VisitGUID || " "};
+
+NonCHFAdmittingDx := read last {"Select description from CV3HealthIssueDeclaration with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}} and Active = 1
+ and ShortName not like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} and ShortName not like {{{SINGLE-QUOTE}}}%Heart%{{{SINGLE-QUOTE}}} and text not like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} and text not like {{{SINGLE-QUOTE}}}%Heart%{{{SINGLE-QUOTE}}}
+ and ClientGuid = " || ClientGuid || " and ChartGuid = " || ChartGuid || " and ClientVisitGUID = " || VisitGUID};
+
+PastCHFAdmittingDx := read last {"Select description from CV3HealthIssueDeclaration with (nolock) where Active = 1
+ and typecode <> {{{SINGLE-QUOTE}}}Admitting DX{{{SINGLE-QUOTE}}} and (ShortName like ({{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}}) or ShortName like({{{SINGLE-QUOTE}}}%Heart Failure%{{{SINGLE-QUOTE}}}))
+ and ClientGuid = " || ClientGuid};
+
+WasBeddedPriorToModify := read last {"Select l.shortname from cv3clientvisitlocation cvl with (nolock)
+ join cv3location l with (nolock) on l.guid = cvl.locationguid
+ where l.typecode = {{{SINGLE-QUOTE}}}bed{{{SINGLE-QUOTE}}} and cvl.status <> {{{SINGLE-QUOTE}}}cur{{{SINGLE-QUOTE}}} and
+ cvl.clientguid = " || ClientGuid || " and cvl.clientvisitguid = " || VisitGUID};
+
+(BNP_Value, abnormalitycode, ArrivalDtm) := read last {"select bo.value, bo.abnormalitycode, convert(varchar(10), bo.ArrivalDtm,101)
+ from cv3order o with (nolock)
+ join cv3basicobservation as bo with (nolock) on bo.ClientGUID = o.ClientGUID and bo.ChartGUID = o.ChartGUID and bo.clientvisitguid = o.clientvisitguid and bo.orderguid = o.guid and bo.ishistory = 0
+ where o.ClientGUID = " || ClientGUID || " and o.ChartGUID = " || ChartGUID || " and o.clientvisitguid = " || VisitGUID || " and o.name like {{{SINGLE-QUOTE}}}%NT Pro BNP%{{{SINGLE-QUOTE}}}"};
+
+
+ If ((EvokingEventType = bnp_result_enter_event.type or EvokingEventType = health_issue_enter_event.type or EvokingEventType = health_issue_modify_event.type or
+ EvokingEventType = health_issue_delete_event.type or EvokingEventType = health_issue_discontinue_event.type )
+ and PatientType is not null)
+
+ or ((EvokingEventType = clientvisit_modify_event.type or clientvisit_enter_event.type)
+ and (not exists NonCHFAdmittingDx and not exists WasBeddedPriorToModify and (exists PastCHFAdmittingDx or exists BNP_Value) ) )
+
+ then
+
+
+
+// INPATIENT/OBSERVATION PATIENT PROCEED SECTION
+
+
+
+// BNP EVENT SECTION
+
+
+ If EvokingEventType = bnp_result_enter_event.type
+
+ then
+
+ BNPValue, abnormalitycode, ArrivalDtm := read last { Observation: value, abnormalitycode, ArrivalDtm REFERENCING EvokingObject };
+
+ ResultMonth:= EXTRACT Month ArrivalDtm;
+ if ResultMonth < 10 then ResultMonth:= "0" || ResultMonth; endif;
+
+ ResultDay:= EXTRACT Day ArrivalDtm;
+ if ResultDay < 10 then ResultDay:= "0" || ResultDay; endif;
+
+ ResultDate := ResultMonth || "/" || ResultDay || "/" || EXTRACT YEAR ArrivalDtm;
+
+ if abnormalitycode = "H" then BNP_Value := BNPValue || " (H) " || ResultDate;
+ else BNP_Value := BNPValue || " " || ResultDate;
+ endif;
+
+// Attain patient{{{SINGLE-QUOTE}}}s existing Advanced Visit List Data for re-entry
+
+ (onset_date,current_coded_health_issue_id,ObjectGUID2Text, current_health_issue_id,ObjectGUID1Text,ClientVisitGUID)
+ := read last{"select Date2, ObjectGUID2, ObjectGUID2Text, ObjectGUID1, ObjectGUID1Text,ClientVisitGUID
+ from CV3AdvancedVisitListData with (nolock)
+ where externalid = " || AVL_External_ID || " and ClientVisitGUID = " || VisitGUID || " "};
+
+// Attain the patient{{{SINGLE-QUOTE}}}s admitting dx guid for use as patient health issue guid when there is no existing relavent health issue
+
+ (current_health_issue_id_admitting)
+ := read last{" select guid from CV3HealthIssueDeclaration with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}Admitting Dx{{{SINGLE-QUOTE}}} and ClientVisitGUID = " || VisitGUID || " "};
+
+ if not exists current_health_issue_id then current_health_issue_id := current_health_issue_id_admitting; endif;
+
+
+
+// VISIT EVENT SECTION
+
+
+ ElseIf (EvokingEventType = clientvisit_enter_event.type or EvokingEventType = clientvisit_modify_event.type) then
+
+
+// Populate BNP data found in the patient record
+
+ if exists BNP_Value then
+ if abnormalitycode = "H" then BNP_Value := BNP_Value || " (H) " || ArrivalDtm ; else BNP_Value := BNP_Value || " " || ArrivalDtm ; endif;
+ else BNP_Value := " "; endif;
+
+// Attain the patient{{{SINGLE-QUOTE}}}s admitting dx guid for use as patient health issue guid
+
+ current_health_issue_id := read last{" select guid from CV3HealthIssueDeclaration with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}Admitting Dx{{{SINGLE-QUOTE}}} and ClientVisitGUID = " || VisitGuid || " "};
+
+
+
+// HEALTH ISSUE EVENT SECTION
+
+
+ else
+
+
+// Get data from the evoking Health Issue
+
+
+ (current_coded_health_issue_id, current_onset_day_num, current_onset_month_num, current_onset_year_num, current_health_issue_id, current_status, existing_health_issue_obj)
+ := read last { HealthIssue: CodedHealthIssueGUID, OnsetDayNum, OnsetMonthNum, OnsetYearNum, GUID, Status, Backup REFERENCING EvokingObject };
+
+// Populate BNP data found in the patient record
+
+ if exists BNP_Value then
+ if abnormalitycode = "H" then BNP_Value := BNP_Value || " (H) " || ArrivalDtm ; else BNP_Value := BNP_Value || " " || ArrivalDtm ; endif;
+ else BNP_Value := " "; endif;
+
+
+
+
+ endif; // If BNP or Patient Type or Health Issue event
+
+
+
+ error_occurred := false;
+ error_message := "";
+ continue_processing:= true;
+ log_execution_info := false;
+ is_closed := false;
+ is_active := false;
+
+
+// HEALTH HEALTH ISSUE MODIFY SECTION
+
+
+ if( EvokingEventType = health_issue_modify_event.type )
+ then
+ if(existing_health_issue_obj is not null)
+ then
+ health_issue_onset_date_obj:= existing_health_issue_data_obj.OnsetDate;
+ // processing only continues if status or onset date changes
+ if( existing_health_issue_data_obj.Status = current_status AND
+ ( health_issue_onset_date_obj.Day = current_onset_day_num AND
+ health_issue_onset_date_obj.Month = current_onset_month_num AND
+ health_issue_onset_date_obj.Year = current_onset_year_num ) )
+ then
+ continue_processing:= false;
+ elseif (existing_health_issue_data_obj.Status <> current_status )
+ then
+ ( is_closed, is_active ) := read { "EXEC SCMGetHealthIssueStatusSelPr " || SQL(current_status) };
+ endif;
+ endif;
+ endif;
+
+
+// CONTINUE PROCESSING (except for Health Issue Modify event where something other than status or onset date changed)
+
+
+ if continue_processing
+ then
+ try
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((VisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ // Create the AdvancedVisitListData object.
+
+ advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData
+ with (client_visit_obj, AVL_Name, AVL_External_ID) ;
+ // with (client_visit_obj, AVL_Name, current_health_issue_id) ; /*permits mult of each patient on this list */
+
+ endtry;
+
+ catch Exception ex
+
+ error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+
+ endcatch;
+
+ endif;
+
+
+// End of INPATIENT/OBSERVATION PATIENT PROCEED SECTION
+
+
+else
+
+
+// DO NOT PROCEED SECTION
+
+ continue_processing:= false;
+
+
+
+endif; // If PatientType
+
+ ;;
+
+ priority: 50
+ ;;
+
+ evoke:
+
+ 1 minutes after time of bnp_result_enter_event;
+ 1 minutes after time of clientvisit_enter_event;
+ 1 minutes after time of clientvisit_modify_event;
+ 0 minutes after time of health_issue_enter_event;
+ 0 minutes after time of health_issue_modify_event;
+ 0 minutes after time of health_issue_delete_event;
+ 0 minutes after time of health_issue_discontinue_event;
+
+ ;;
+
+ logic:
+
+
+ if( EvokingObject is null or continue_processing = false ) then conclude false; endif;
+
+ try
+ if( is_closed AND is_active )
+ then
+ void := call advanced_visit_list_data_obj.Deactivate;
+ // don{{{SINGLE-QUOTE}}}t conclude false as we still need to return true to OP destination
+ continue_processing:= false;
+ endif;
+
+ if( continue_processing )
+ then
+
+
+// BNP Enter or HEALTH ISSUE ENTER OR HEALTH ISSUE MODIFY SECTION
+
+ // BNP Enter Event
+
+ If EvokingEventType = bnp_result_enter_event.type then
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_GUID_Patient, (current_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_GUID_Coded,(current_coded_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}}
+ with AVL_Result , BNP_Value ;
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_OnsetDate, onset_date as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}});
+
+ objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
+
+
+
+ // Client Visit Event
+
+ elseif (EvokingEventType = clientvisit_enter_event.type or EvokingEventType = clientvisit_modify_event.type)then
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_GUID_Patient, (current_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}}
+ with AVL_Result , BNP_Value ;
+
+ objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
+
+
+ else
+
+
+ // Health Issue Enter or Modify Event
+
+ if( EvokingEventType = health_issue_enter_event.type or EvokingEventType = health_issue_modify_event.type)
+
+ then
+
+ // Set the Patient Health Issue GUID.
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_GUID_Patient, (current_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // Set the Coded Health Issue.
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_GUID_Coded,(current_coded_health_issue_id as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // Set the BNP Value.
+
+ void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}}
+ with AVL_Result , BNP_Value ;
+
+ // Set the Onset Date if available.
+
+ if( current_onset_year_num is not null and current_onset_year_num > 0 )
+ then
+ if( current_onset_month_num is null or current_onset_month_num <= 0 ) then current_onset_month_num:= 1;
+ else if ( current_onset_day_num is null or current_onset_day_num <= 0 ) then current_onset_day_num:= 1;
+ endif;
+ endif;
+
+ onset_date_string := (current_onset_year_num as String) || "-" || (current_onset_month_num as String) || "-" || (current_onset_day_num as String);
+ onset_date := onset_date_string as time;
+
+ void := call
+ advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue>{{{SINGLE-QUOTE}}}
+ with (AVL_HI_OnsetDate, onset_date as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}});
+ endif;
+
+
+
+// HEALTH ISSUE DELETE SECTION
+
+
+ // Deactivate then delete the Advanced Visit List Data
+
+ elseif ( EvokingEventType = health_issue_delete_event.type )
+ then
+ void := call advanced_visit_list_data_obj.Deactivate;
+ void := call advanced_visit_list_data_obj.Purge;
+
+
+// HEALTH ISSUE DISCONTINUE SECTION
+
+
+ // Deactivate the Advanced Visit List Data
+
+ elseif ( EvokingEventType = health_issue_discontinue_event.type )
+ then
+ void := call advanced_visit_list_data_obj.Deactivate;
+// note: since Deactivate and Delete both permenantly remove the HI from the list, we will treat them the same and purge the row
+ void := call advanced_visit_list_data_obj.Purge;
+
+ endif; // if( EvokingEventType = health_issue_enter_event.type or health_issue_modify_event.type )
+
+
+ objects_plus_destination.ObjectsPlus := advanced_visit_list_data_obj;
+
+
+ endif; // If BNP Result/Health Issue Enter etc...
+
+ endif; // if( continue_processing )
+
+
+
+ endtry;
+
+
+ catch Exception ex
+ error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+
+ conclude true;
+
+ ;;
+
+ action:
+
+ if error_occurred
+ then
+
+ write "An error has occured in the MLM " ||
+ "{{+B}}MLM SC_AVL_POTENTIAL_HEART_FAILURE {{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at alert_dest;
+ write error_message at alert_dest;
+ endif;
+
+ if exists objects_plus_destination then write true at objects_plus_destination; endif;
+
+ write " Messages " || " List Name.: " || AVL_Name
+ || " Evoking Event: " || evokevent
+ || " ObjectGUID1: " || current_health_issue_id
+ || " ObjectGUID1Text: " || ObjectGUID1Text
+ || " ObjectGUID2: " || current_coded_health_issue_id
+ || " ObjectGUID2Text: " || ObjectGUID1Text
+ || " onset_date: " || onset_date
+ || " BNP Value: " || BNP_Value
+ || " ClientVisitGUID: " || ClientVisitGUID
+ || " PatientType: " || PatientType
+ || " NonCHFAdmittingDx: " || NonCHFAdmittingDx
+ || " PastCHFAdmittingDx: " || PastCHFAdmittingDx
+ || " WasBeddedPriorToModify: " || WasBeddedPriorToModify
+ || " continue_processing : " || continue_processing
+ at alert_dest;
+
+ ;;
+
+urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_BASAL_INSULIN_CHECK.mlm b/MLMStripper/bin/Debug/SCH/SCH_BASAL_INSULIN_CHECK.mlm
new file mode 100644
index 0000000..8105dc6
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_BASAL_INSULIN_CHECK.mlm
@@ -0,0 +1,267 @@
+maintenance:
+
+ title: SCH_BASAL_INSULIN_CHECK;;
+ mlmname: SCH_BASAL_INSULIN_CHECK;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair Hospital;;
+ author: Shawn Head;;
+ specialist: Janet Nordin;;
+ date: 2016-06-27;;
+ validation: testing;;
+
+library:
+ purpose: Check to see if Basal Insulin alert needs to present to physicians
+ ;;
+ explanation:
+ 06.21.2016 - STH - CSR#: 34335 - created {Go-Live Scheduled 9/13/2016}
+ 10.20.2016 - STH - CSR#: 34335 - Needed to make a few more modifications so the MLM was backed out and re-loaded on 10/20/2016
+ 11.10.2016 - STH - CSR#: 34335 - Need to supress the alert for the ER Major patients also per PRISM. loaded on 11/10/2016
+ 03.06.2017 - DW - CSR#: 34335 - Remove from production status per requrest of the physicians
+ 06.13.2018 - STH - CSR#: 35114 - Update to include new BGM result/item Glucose, BGM confirmation {Go-Live 6/20/2018}
+ 10.05.2018 - STH - CSR#: 37415 - Additional updates requested by Dr. Lou. Change the wording, Add new selection options
+ , remove selection option, add last dose administered, moved active orders to right of result values. {Go-Live 10-17-2018}
+ ;;
+ keywords: Objects+, Care Provider Visit Role, Auto create care provider, auto DC care provider
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /* Set to true if logging is needed.*/
+ log_execution_info:= FALSE;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ on_order_enter := event {OrderWorksheetSubmit User } ;
+ suggest_ordering := false;
+
+ (ClientVisitGuid, ChartGuid, ClientGuid, VisitType, CurrentLoc):=read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode, CurrentLocation};
+ BasalInsulin_alert:= destination { Alert } WITH
+ [alert_type := "Warning",
+ short_message :="Basal Insulin Suggested",
+ Priority :="HIGH",
+ Scope := "chart",
+ Rule_group :="BASALINSULIN",
+ rule_number := 1005,
+ send_with_order := "",
+ display_alert := TRUE,
+ alert_abstract:= "",
+ alert_dialog_settings := "Must Comment",
+ async_alert_dialog_settings := "",
+ document_name := "",
+ document_conditional_text :=
+ (),
+ ack_comment_UDDD := "BasalAckComment",
+ ack_comment_UDDD_is_restricted := true ];
+
+ userguid,user_id :=read last {UserInfo: guid,idcode};
+
+ if(((substring 3 characters from CurrentLoc) = "ICU") or ((substring 4 characters from CurrentLoc) = "CVSU") or (CurrentLoc = "ER Major")) then
+ SupressAlert := true;
+ else
+ SupressAlert := false;
+ endif;
+
+ //SupressAlert := false;
+
+ occcode := read last {" select OccupationCode from CV3USER U with (nolock)"
+ || " where guid = " || sql(userguid) };
+ if ((SupressAlert = false) and (occcode in ("MD","DO","DMD","DPM","CRNP","PA","PA-C","IT"))) then
+
+ (Basal_OCMI_GUIDs, Basal_OCMI_Names) := read { " select distinct OCMI.guid, ocmi.Name as {{{SINGLE-QUOTE}}}OrderName{{{SINGLE-QUOTE}}}
+ from CV3OrderCatalogMasterItem OCMI
+ join cv3drugmapping dm on ocmi.guid = dm.catalogitemguid
+ join SXAMultumLevelsForDupMedTherapy dup on dup.DrugId = dm.DrugKey
+
+ where dup.LevelOne_Name = {{{SINGLE-QUOTE}}}intermediate- and long-acting insulins{{{SINGLE-QUOTE}}}
+ and ExpiryDate is null " };
+
+ (existing_Basal_orders) := Read {UnsubmittedOrders : Name
+ WHERE Name in (sql(Basal_OCMI_Names)) };
+
+ if(count(existing_Basal_orders)=0) then
+ (glucose_results,Result_Entered, Result_value) := read { " select guid into #tmp_Glucoseitems from CV3ResultCatalogItem with(nolock)
+ where itemname in ({{{SINGLE-QUOTE}}}Glucose, BGM confirmation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Non-Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Bedside{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Bedside.{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Fasting from Blood Gas{{{SINGLE-QUOTE}}}"
+ || ",{{{SINGLE-QUOTE}}}Glucose from Blood Gas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose, ABG, POC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose, VBG, POC{{{SINGLE-QUOTE}}})
+ select bo.value
+ , BO.ENTERED
+ into #tmp_GlucoseResults
+ from #tmp_Glucoseitems tg
+ inner join CV3BasicObservation bo with (nolock)
+ on tg.GUID = bo.ResultItemGUID
+ and bo.ClientGUID = " || sql(ClientGuid) || "
+ and bo.ChartGUID = " || sql(ChartGuid) || "
+ and bo.ClientVisitGUID = " || sql(ClientVisitGuid) || "
+
+
+ select top 2 (CASE WHEN ISNULL(BO.VALUE,{{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}}) >= 200 then {{{SINGLE-QUOTE}}}yes{{{SINGLE-QUOTE}}}
+ when isnull(bo.value,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) like {{{SINGLE-QUOTE}}}>%{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}yes{{{SINGLE-QUOTE}}}
+ else {{{SINGLE-QUOTE}}}no{{{SINGLE-QUOTE}}} end) as {{{SINGLE-QUOTE}}}high_result{{{SINGLE-QUOTE}}}
+ , bo.entered
+ , case when isnull(bo.value,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}N/A{{{SINGLE-QUOTE}}} else bo.value end as {{{SINGLE-QUOTE}}}ResultValue{{{SINGLE-QUOTE}}}
+ from #tmp_GlucoseResults bo with(nolock)
+ where bo.Entered >= dateadd(hh,-24,getdate())
+ order by bo.Entered desc
+
+ DROP TABLE #tmp_Glucoseresults, #tmp_Glucoseitems "};
+
+ // //this needs added into the above statement before go-live
+ // where bo.Entered >= dateadd(hh,-24,getdate())
+ ResultDTTM1 := Result_Entered[1];
+ ResultDTTM2 := Result_Entered[2];
+ ctgl := count(glucose_results);
+
+
+ if((count(glucose_results)>=2) and ("no" not in glucose_results)) then
+ //GlucoseResultsMessage := "{{+B}}Last 2 Glucose Results:{{-B}}\n " || ResultDTTM1 || " - {{+B}}{{+R}}" || Result_value[1] || "{{-R}}{{-B}}\n " || ResultDTTM2 || " - {{+B}}{{+R}}" || Result_value[2] || "{{-R}}{{-B}}";
+
+ abc123 := "step1";
+ (Alert_Previous_Fired,Alert_Fired_Dttm,Suppress) := read { " select {{{SINGLE-QUOTE}}}true{{{SINGLE-QUOTE}}}, Entered, (case when alertcomments in ({{{SINGLE-QUOTE}}}Clinical Adjustments Made{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Patient not a candidate for tight glycemic control.{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}I have consulted PCP/Endocrinologist.{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}} end) as {{{SINGLE-QUOTE}}}full_suppress{{{SINGLE-QUOTE}}} from CV3AlertDeclaration WITH (NOLOCK)
+ where ClientGUID = " || sql(ClientGuid) || "
+ and ChartGUID = " || sql(ChartGuid) || "
+ and ClientVisitGUID = " || sql(ClientVisitGuid) || "
+ and description like {{{SINGLE-QUOTE}}}%BASAL INSULIN SUGGESTED%{{{SINGLE-QUOTE}}}
+ and userguid = " || sql(userguid) || "
+ order by entered desc "};
+ /*--REMOVED BECAUSE WE RESTRICTED THE ALERT COMMENT SELECTION TO BE DROP DOWN LIST ONLY, NO FREETEXT ENTRY ALLOWED.
+ and ((alertcomments like {{{SINGLE-QUOTE}}}%Observe for another 24 hours to see if sugars improve%{{{SINGLE-QUOTE}}})
+ or (alertcomments like {{{SINGLE-QUOTE}}}%Fear of hypoglycemia%{{{SINGLE-QUOTE}}}))
+ */
+
+ if((count(Alert_Previous_Fired)=0) or (("YES" not in Suppress) and ((Result_Entered[1] > Alert_Fired_Dttm[1]) and (Result_Entered[2] > Alert_Fired_Dttm[1])))) then
+ abc123 := "step2";
+ active_basal_insulin_orders := ();
+ Basal_summary_line := ();
+ Basal_Requested_dttm := ();
+ Basal_Administered_dttm := ();
+ Basal_Administered_name := ();
+ Basal_Administered_summaryline := ();
+ (Basal_Requested_dttm, active_basal_insulin_orders, Basal_summary_line
+ ,Basal_Administered_dttm, Basal_Administered_name, Basal_Administered_summaryline) := read { "
+
+ select distinct OCMI.guid, ocmi.Name as {{{SINGLE-QUOTE}}}OrderName{{{SINGLE-QUOTE}}}
+ into #tmp_OCMI
+ from CV3OrderCatalogMasterItem OCMI
+ join cv3drugmapping dm on ocmi.guid = dm.catalogitemguid
+ join SXAMultumLevelsForDupMedTherapy dup on dup.DrugId = dm.DrugKey
+
+ where dup.LevelOne_Name = {{{SINGLE-QUOTE}}}intermediate- and long-acting insulins{{{SINGLE-QUOTE}}}
+ and ExpiryDate is null
+ ;with orders as (
+ select distinct o.* from #tmp_OCMI ocmi with (nolock)
+ inner join cv3order o with (nolock) on ocmi.GUID = o.OrderCatalogMasterItemGUID
+ and o.ClientGUID = " || sql(ClientGuid) || "
+ and o.ChartGUID = " || sql(ChartGuid) || "
+ and o.ClientVisitGUID = " || sql(ClientVisitGuid) || "
+ ),
+ activeorders as (
+ select distinct o.clientguid, o.requestedDtm, o.name, replace(o.summaryline,char(13)+char(10),{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}summaryline{{{SINGLE-QUOTE}}} from orders o with (Nolock)
+ where o.OrderStatusLevelNum > {{{SINGLE-QUOTE}}}15{{{SINGLE-QUOTE}}}
+ and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}})
+ ),
+ lastadmin as (
+ select TOP 1 o.clientguid, isnull(oto.PerformedFromDtm,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}PerformedFromDtm{{{SINGLE-QUOTE}}} , isnull(o.name,{{{SINGLE-QUOTE}}}NO ADMINISTRATION{{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}name{{{SINGLE-QUOTE}}}, isnull(replace(o.summaryline,char(13)+char(10),{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}),{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}summaryline{{{SINGLE-QUOTE}}} from orders o
+ inner join CV3OrderTaskOccurrence oto
+ on o.ClientGUID = oto.ClientGUID
+ and o.GUID = oto.OrderGUID
+ and oto.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}}
+ order by oto.PerformedFromDtm
+ )
+ select ao.RequestedDtm, ao.Name, ao.summaryline, la.PerformedFromDtm,la.name, la.summaryline from activeorders ao
+ left join lastadmin la on ao.ClientGUID = la.ClientGUID
+ order by ao.Name
+
+ drop table #tmp_OCMI
+
+"};
+/*
+ (Basal_Requested_dttm, active_basal_insulin_orders, Basal_summary_line) := read { "
+
+
+ select distinct OCMI.guid, ocmi.Name as {{{SINGLE-QUOTE}}}OrderName{{{SINGLE-QUOTE}}}
+ into #tmp_OCMI
+ from CV3OrderCatalogMasterItem OCMI
+ join cv3drugmapping dm on ocmi.guid = dm.catalogitemguid
+ join SXAMultumLevelsForDupMedTherapy dup on dup.DrugId = dm.DrugKey
+
+ where dup.LevelOne_Name = {{{SINGLE-QUOTE}}}intermediate- and long-acting insulins{{{SINGLE-QUOTE}}}
+ and ExpiryDate is null
+
+ select distinct o.requestedDtm, o.name, replace(o.summaryline,char(13)+char(10),{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) from #tmp_OCMI ocmi with (nolock)
+ inner join cv3order o with (nolock) on ocmi.GUID = o.OrderCatalogMasterItemGUID
+ and o.ClientGUID = " || sql(ClientGuid) || "
+ and o.ChartGUID = " || sql(ChartGuid) || "
+ and o.ClientVisitGUID = " || sql(ClientVisitGuid) || "
+ where o.OrderStatusLevelNum > {{{SINGLE-QUOTE}}}15{{{SINGLE-QUOTE}}}
+ and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}})
+ order by o.Name
+ " };
+ */
+ BasalOrderNames := "";
+ BasalOrderMessage := "";
+ for x in (1 seqto count(active_basal_insulin_orders)) do
+ if(((Basal_Requested_dttm[x] as time) < (ResultDTTM1 as time))
+ and ((Basal_Requested_dttm[x] as time) < (ResultDTTM2 as time))) then
+ suggest_ordering := true;
+ endif;
+ if (count(BasalOrderNames) <= 0) then
+ BasalOrderNames := Basal_Requested_dttm[x] || " - " || active_basal_insulin_orders[x] || "\n {" || Basal_summary_line[x] || "}\n";
+ else
+ BasalOrderNames := BasalOrderNames || Basal_Requested_dttm[x] || " - " || active_basal_insulin_orders[x] || "\n {" || Basal_summary_line[x] || "}\n";
+ endif;
+ enddo;
+ if(count(active_basal_insulin_orders) = 0) then
+ suggest_ordering := true;
+ BasalOrderMessage := "{{+B}}{{+R}}THERE ARE CURRENTLY NO ACTIVE BASAL ORDERS{{-B}}{{-R}}\n " || BasalOrderNames;
+ else
+ BasalOrderMessage := "{{+B}}Active Basal Order Names:{{-B}}\n " || BasalOrderNames;
+ endif;
+ if(count(Basal_Administered_name) <= 0) then
+ Basal_Administered_dttm := "";
+ Basal_Administered_name := "";
+ Basal_Administered_summaryline := "";
+ Basal_Administered_Header := "{{+R}}No Basal Insulin Administered{{-R}}";
+ else
+ Basal_Administered_Header := "Most Recent Administration of Basal";
+ endif;
+ //GlucoseResultsMessage := "{{+B}}Last 2 Glucose Results:{{-B}}\n " || ResultDTTM1 || " - {{+B}}{{+R}}" || Result_value[1] || "{{-R}}{{-B}}\n " || ResultDTTM2 || " - {{+B}}{{+R}}" || Result_value[2] || "{{-R}}{{-B}}";
+
+
+
+ FinalMessageDetails := "{{+B}}Last 2 Glucose Results: " || Basal_Administered_Header || "{{-B}}\n"
+ || ResultDTTM1 || " - {{+B}}{{+R}}" || Result_value[1] || "{{-R}}{{-B}} "
+ || Basal_Administered_dttm[1] || " " || Basal_Administered_name[1] || "\n"
+ || ResultDTTM2 || " - {{+B}}{{+R}}" || Result_value[2] || "{{-R}}{{-B}} " || Basal_Administered_summaryline[1]
+ || "\n " || BasalOrderMessage|| "\n";
+
+
+ endif;
+ endif;
+ endif;
+ endif;
+
+;;
+ evoke: on_order_enter;
+
+ ;;
+ logic:
+
+ conclude true;
+
+ ;;
+ action:
+ if(suggest_ordering) then
+
+ error_destination.short_message := "BASAL INSULIN SUGGESTED";
+ alert_message := "Patient has had {{+B}}2 or more Glucose Levels >200mg/dl in the last 24 hours {{-B}}Please consider initiating or adjusting Basal Insulin.\n\n "
+ || /*"\n\nConsider ordering ""Diabetic Management Protocol"".\n\n" || */FinalMessageDetails; //GlucoseResultsMessage || "\n\n" || BasalOrderMessage;
+ write alert_message at BasalInsulin_alert;
+ //write error_message at error_destination;
+ endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_BGM_FREQ_TICU_COLUMN_UPDATE.mlm b/MLMStripper/bin/Debug/SCH/SCH_BGM_FREQ_TICU_COLUMN_UPDATE.mlm
new file mode 100644
index 0000000..f51b84a
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_BGM_FREQ_TICU_COLUMN_UPDATE.mlm
@@ -0,0 +1,263 @@
+maintenance:
+
+ title: SCH_BGM_FREQ_TICU_COLUMN_UPDATE;;
+ mlmname: SCH_BGM_FREQ_TICU_COLUMN_UPDATE;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp;;
+ specialist: Dean Miklavic;;
+ date: 2012-07-27;;
+ validation: testing;;
+
+library:
+ purpose:
+
+ ;;
+
+ explanation:
+
+
+ Change history
+
+ 07.27.2012 JML CSR #26414 Created
+ 05.24.2013 JML WO #158336 - BGM frequency enterprise defined column not updating
+ due to order of new POC orders entered and old POC order being discontinued /
+ completed.
+
+ ;;
+ keywords: ObjectsPlus/XA, Order
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Error Handling vars for ObjectsPlus Method calls
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {Order: THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+
+ //Event Triggers
+ bgmOrderEnter := Event { OrderEnter User Order :
+ WHERE Name = "POC Testing: Blood Glucose Monitor" };
+
+ /* -- Commented By Shami --bgmOrderDiscontinue := Event { OrderDiscontinue User Order :
+ WHERE Name = "POC Testing: Blood Glucose Monitor" };
+
+ bgmOrderComplete := Event { OrderComplete User Order :
+ WHERE Name = "POC Testing: Blood Glucose Monitor" };
+
+ bgmOrderCancel := Event { OrderCancel User Order :
+ WHERE Name = "POC Testing: Blood Glucose Monitor" }; -- Commented By SHAMI */
+
+ bgmOrderRelease := Event { OrderRelease User Order :
+ WHERE Name = "POC Testing: Blood Glucose Monitor" };
+ //------------------------------------------------------------
+ // Define the ObjectsPlus destinations
+ //------------------------------------------------------------
+
+ BGMColumn_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "EnterprisePatientListColumn Object",
+ rule_number := 2020 ];
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ //Retrieve Client Visit GUID
+ ActiveClientVisit_GUID := EvokingObject.ClientVisitGUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ if (EvokingEvent = bgmOrderEnter) then
+ //Retrieve Frequency Entered on POC Testing: Blood Glucose Monitor order
+ (name, frequency, sessionType) := read last {Order : Name, FrequencyCode, InitialSessionTypeCode
+ REFERENCING EvokingObject};
+
+
+ //Frequency exists, set boolean true to update TICU status board column and store frequency value
+ if (exists frequency) then
+ if (sessionType = "Standard") then
+ bgmFreq := first of (frequency);
+ colUpdate := true;
+ else
+ bgmFreq := "";
+ colUpdate := false;
+ endif;
+ else
+ bgmFreq := "";
+ colUpdate := false;
+ endif;
+
+ //POC Testing: Blood Glucose Monitor order removal; remove TICU status board column value
+ /* -- commemnted by SHAMI-- elseif (EvokingEvent = bgmOrderDiscontinue OR EvokingEvent = bgmOrderCancel OR EvokingEvent = bgmOrderComplete) then
+ //WO #158336 - BGM frequency column not updating due to the order in which users are dc{{{SINGLE-QUOTE}}}ing / completing POC
+ // orders and creating new ones. When a patient is transferred to a new unit, users are entering POC
+ // orders coinciding with the new unit assignment first and completing / dc{{{SINGLE-QUOTE}}}ing POC orders
+ // from previous unit second. This is causing the BGM freq enterprise defined column to lose the latest
+ // freq from the new order.
+
+ //Adding logic to check for existing active (newest) POC order
+
+ curr_BGMFreq := read {"SELECT TOP 1 o.FrequencyCode "
+ || " FROM CV3Order o "
+ || " WHERE o.Name = {{{SINGLE-QUOTE}}}POC Testing: Blood Glucose Monitor{{{SINGLE-QUOTE}}} "
+ || " AND ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}})) "
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}}) "
+ || " AND o.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND o.ClientVisitGUID = " || Sql(ActiveClientVisit_GUID)
+ || " AND o.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " ORDER BY o.CreatedWhen DESC"};
+
+
+ if (exists curr_BGMFreq) then
+ bgmFreq := curr_BGMFreq;
+ colUpdate := true;
+ else
+ bgmFreq := "";
+ colUpdate := false;
+ endif; ---END Commenting */
+ elseif (EvokingEvent = bgmOrderRelease) then
+ (name, frequency) := read last {Order : Name, FrequencyCode REFERENCING EvokingObject };
+ if (exists frequency) then
+ bgmFreq := first of (frequency);
+ colUpdate := true;
+ else
+ bgmFreq := "";
+ colUpdate := false;
+ endif;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ bgmOrderEnter;
+ //bgmOrderDiscontinue;
+ //bgmOrderCancel;
+ //bgmOrderComplete;
+ bgmOrderRelease;
+
+ ;;
+ logic:
+
+ if (EvokingObject is null) then
+ conclude false;
+ endif;
+
+ //Boolean to update TICU Status Board column true, continue with logic
+ if (colUpdate = true) then
+
+ try
+ //Retrieve ClientVisit object
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ActiveClientVisit_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ endtry;
+
+ //Error Handling
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n"
+ || ex.Message || "\n\n";
+
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ conclude true;
+ endcatch;
+
+ try
+ //Set Column name and value
+ BgmColumnName := "BGM Frequency";
+ BgmNewColumnValue := bgmFreq;
+
+ //Retrieve column name and set value
+ BGMFreqDefinedColumn_obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
+ with (client_visit_obj, BgmColumnName);
+
+ colValue := BGMFreqDefinedColumn_obj.Value;
+
+
+ if (colValue <> BgmNewColumnValue) then
+ BGMFreqDefinedColumn_obj.Value := BgmNewColumnValue;
+ BGMColumn_Dest.ObjectsPlus := BGMFreqDefinedColumn_obj;
+ endif;
+ endtry;
+
+ //Error Handling
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}Enterprise Patient List Column{{-R}}\n"
+ || ex.message || "\n\n";
+
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if (BGMFreqDefinedColumn_obj is not null) then
+ void := call BGMFreqDefinedColumn_obj.Dispose;
+ BGMFreqDefinedColumn_obj := null;
+ endif;
+
+ BGMColumn_Dest := null;
+
+ endcatch;
+
+ //Destroy client visit object
+ if (client_visit_obj is not null) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj := null;
+ endif;
+ endif;
+
+ conclude true;
+ ;;
+ action:
+
+ //Error Handling
+ if error_occurred then
+ write "An error occurred in the MLM {{+B}}SCH_BGM_FREQ_TICU_COLUMN_UPDATE{{-B}} "
+ || " Please notify your system administrator that an error message has "
+ || " occurred for this patient. They will review the following error "
+ || "message:\n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+ //Evoke ObjectsPlus destination
+ if exists BGMColumn_dest then
+ write true at BGMColumn_dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_BGM_FREQ_TICU_COLUMN_UPDATE_TEST.mlm b/MLMStripper/bin/Debug/SCH/SCH_BGM_FREQ_TICU_COLUMN_UPDATE_TEST.mlm
new file mode 100644
index 0000000..2788635
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_BGM_FREQ_TICU_COLUMN_UPDATE_TEST.mlm
@@ -0,0 +1,235 @@
+maintenance:
+
+ title: SCH_BGM_FREQ_TICU_COLUMN_UPDATE_TEST;;
+ mlmname: SCH_BGM_FREQ_TICU_COLUMN_UPDATE_TEST;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp;;
+ specialist: Dean Miklavic;;
+ date: 2012-07-27;;
+ validation: testing;;
+
+library:
+ purpose:
+
+ ;;
+
+ explanation:
+
+
+ Change history
+
+ 07.27.2012 JML CSR #26414 Created
+ 05.24.2013 JML WO #158336 - BGM frequency enterprise defined column not updating
+ due to order of new POC orders entered and old POC order being discontinued /
+ completed.
+ 12.01.2017 JML WO #2975746 - Was not filtering out completed POC orders, which were still displaying
+ as the frequency in the status board. Updated the SQL below to filter out Completed
+ (aka OrderStatusLevelNum = 100) order statuses.
+
+ ;;
+ keywords: ObjectsPlus/XA, Order
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Error Handling vars for ObjectsPlus Method calls
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {Order: THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+
+ //Event Triggers
+
+ bgmOrderDiscontinue := Event { OrderDiscontinue User Order :
+ WHERE Name = "POC Testing: Blood Glucose Monitor" };
+
+ bgmOrderComplete := Event { OrderComplete User Order :
+ WHERE Name = "POC Testing: Blood Glucose Monitor" };
+
+ bgmOrderCancel := Event { OrderCancel User Order :
+ WHERE Name = "POC Testing: Blood Glucose Monitor" };
+
+
+ //------------------------------------------------------------
+ // Define the ObjectsPlus destinations
+ //------------------------------------------------------------
+
+ BGMColumn_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "EnterprisePatientListColumn Object",
+ rule_number := 2020 ];
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ //Retrieve Client Visit GUID
+ ActiveClientVisit_GUID := EvokingObject.ClientVisitGUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+
+ //WO #158336 - BGM frequency column not updating due to the order in which users are dc{{{SINGLE-QUOTE}}}ing / completing POC
+ // orders and creating new ones. When a patient is transferred to a new unit, users are entering POC
+ // orders coinciding with the new unit assignment first and completing / dc{{{SINGLE-QUOTE}}}ing POC orders
+ // from previous unit second. This is causing the BGM freq enterprise defined column to lose the latest
+ // freq from the new order.
+
+ //Adding logic to check for existing active (newest) POC order
+
+ curr_BGMFreq := read last {"SELECT TOP 1 o.FrequencyCode "
+ || " FROM CV3Order o "
+ || " WHERE o.Name = {{{SINGLE-QUOTE}}}POC Testing: Blood Glucose Monitor{{{SINGLE-QUOTE}}} "
+ || " AND ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}})) "
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}}) "
+ || " AND o.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND o.ClientVisitGUID = " || Sql(ActiveClientVisit_GUID)
+ || " AND o.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " ORDER BY o.CreatedWhen DESC "};
+
+
+
+
+
+ if (exists curr_BGMFreq) then
+ bgmFreq := curr_BGMFreq;
+ colUpdate := true;
+ endif;
+ If (curr_BGMFreq ="" OR curr_BGMFreq is null) THEN
+ bgmFreq := "";
+ colUpdate := true;
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 1 seconds after time of bgmOrderDiscontinue;
+ 1 seconds after time of bgmOrderCancel;
+ 1 seconds after time of bgmOrderComplete;
+
+ ;;
+ logic:
+
+ if (EvokingObject is null) then
+ conclude false;
+ endif;
+
+ //Boolean to update TICU Status Board column true, continue with logic
+ if (colUpdate = true) then
+
+ try
+ //Retrieve ClientVisit object
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ActiveClientVisit_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ endtry;
+
+ //Error Handling
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n"
+ || ex.Message || "\n\n";
+
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ conclude true;
+ endcatch;
+
+ try
+ //Set Column name and value
+ BgmColumnName := "BGM Frequency";
+ BgmNewColumnValue := bgmFreq;
+
+ //Retrieve column name and set value
+ BGMFreqDefinedColumn_obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
+ with (client_visit_obj, BgmColumnName);
+
+ colValue := BGMFreqDefinedColumn_obj.Value;
+
+
+ if (colValue <> BgmNewColumnValue) then
+ BGMFreqDefinedColumn_obj.Value := BgmNewColumnValue;
+ BGMColumn_Dest.ObjectsPlus := BGMFreqDefinedColumn_obj;
+ endif;
+ endtry;
+
+ //Error Handling
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}Enterprise Patient List Column{{-R}}\n"
+ || ex.message || "\n\n";
+
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if (BGMFreqDefinedColumn_obj is not null) then
+ void := call BGMFreqDefinedColumn_obj.Dispose;
+ BGMFreqDefinedColumn_obj := null;
+ endif;
+
+ BGMColumn_Dest := null;
+
+ endcatch;
+
+ //Destroy client visit object
+ if (client_visit_obj is not null) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj := null;
+ endif;
+ endif;
+
+ conclude true;
+ ;;
+ action:
+
+ //Error Handling
+ if error_occurred then
+ write "An error occurred in the MLM {{+B}}SCH_BGM_FREQ_TICU_COLUMN_UPDATE{{-B}} "
+ || " Please notify your system administrator that an error message has "
+ || " occurred for this patient. They will review the following error "
+ || "message:\n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+ //Evoke ObjectsPlus destination
+ if exists BGMColumn_dest then
+ write true at BGMColumn_dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_BLOOD_REFUSAL_ALERT_ON_ORDER_ENTRY.mlm b/MLMStripper/bin/Debug/SCH/SCH_BLOOD_REFUSAL_ALERT_ON_ORDER_ENTRY.mlm
new file mode 100644
index 0000000..3b59298
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_BLOOD_REFUSAL_ALERT_ON_ORDER_ENTRY.mlm
@@ -0,0 +1,118 @@
+maintenance:
+
+ title: SCH_BLOOD_REFUSAL_ALERT_ON_ORDER_ENTRY;;
+ filename: SCH_BLOOD_REFUSAL_ALERT_ON_ORDER_ENTRY;;
+ arden: version 2.50;;
+ version: 15.10;;
+ institution: St Clair Hospital;;
+ author: Juliet M. Law;;
+ specialist: Peggy Leschak;;
+ date: 2016-06-17;;
+ validation: testing;;
+
+library:
+ purpose: Check to see if patient has a health issue for blood refusal OR comment from AMPFM
+ ;;
+ explanation: If patient has a health issue for {{{SINGLE-QUOTE}}}Refusal of blood product{{{SINGLE-QUOTE}}} OR {{{SINGLE-QUOTE}}}Transfusion of blood product refused for religious reason{{{SINGLE-QUOTE}}}, then display a soft stop alert
+ when user tries to enter into the following order sets: Red Cell Product Orders, Platelet Orders, FFP Orders, Cryo Orders.
+
+ Change History
+ 06.17.2016 JML CSR 33898 - Original Coding.
+
+ ;;
+ keywords: blood refusal, alert
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+ /* Set to true if logging is needed.*/
+ log_execution_info:= false;
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ // Set the text for this variable to indicate whether to send the message or not.
+ send_alert := "DoNotSend";
+ bloodHIExists := false;
+ bloodCommentExists := false;
+ displayAlert := false;
+
+ /* Change the message within the quotes if a different short-message is needed. */
+
+ event_var := Event {OrderSetInit User OrderSet :
+ WHERE OrderSetName IN ("Red Cell Product Orders", "Platelet Orders", "FFP Orders", "Cryo Orders") };
+
+ blood_refusal_dest := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "Blood Refusal Alert",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "Blood Refusal Alert Group",
+ Rule_number := 9002,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ ClientGuid := EvokingObject.ClientGUID;
+ VisitGuid := EvokingObject.ClientVisitGUID;
+ ChartGuid := EvokingObject.ChartGUID;
+ /***************************************************************************************/
+
+
+ //Check for blood refusal HI
+ blood_hi_exists := READ LAST { "SELECT 1"
+ || " FROM CV3HealthIssueDeclaration hi WITH (NOLOCK) JOIN CV3CodedHealthIssue chi WITH (NOLOCK)"
+ || " ON hi.CodedHealthIssueGUID = chi.GUID"
+ || " WHERE hi.ClientGUID = " || SQL(ClientGuid)
+ || " AND hi.ClientVisitGUID = " || SQL(VisitGuid)
+ || " AND hi.Active = 1"
+ || " AND hi.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ || " AND hi.ICD10Code is Not null "
+ || " AND hi.TypeCode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}"
+ || " AND ( hi.Text IN ({{{SINGLE-QUOTE}}}Refusal of blood product{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Transfusion of blood product refused for religious reason{{{SINGLE-QUOTE}}})"
+ || " OR hi.ShortName IN ({{{SINGLE-QUOTE}}}Refusal of blood product{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Transfusion of blood product refused for religious reason{{{SINGLE-QUOTE}}}) )" };
+
+ if ( exists blood_hi_exists ) then
+ bloodHIExists := true;
+ endif;
+
+ //Check for Blood Refusal AMPFM comment
+ blood_comm_exists := READ LAST { "SELECT 1"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3CommentDeclaration cd WITH (NOLOCK)"
+ || " ON cv.GUID = cd.ClientVisitGUID"
+ || " AND cv.ClientGUID = cd.ClientGUID"
+ || " AND cv.ChartGUID = cd.ChartGUID"
+ || " WHERE cv.ClientGUID = " || SQL(ClientGuid)
+ || " AND cv.GUID = " || SQL(VisitGuid)
+ || " AND cv.ChartGUID = " || SQL(ChartGuid)
+ || " AND cd.TypeCode = {{{SINGLE-QUOTE}}}Blood Refusal{{{SINGLE-QUOTE}}}"
+ || " AND cd.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}" };
+
+ if ( exists blood_comm_exists ) then
+ bloodCommentExists := true;
+ endif;
+
+ if ( bloodHIExists OR bloodCommentExists ) then
+ displayAlert := true;
+ endif;
+
+ ;;
+ evoke:
+ event_var;
+ ;;
+ logic:
+ conclude displayAlert;
+
+ ;;
+ action:
+
+ //Display Alert to user
+ if ( displayAlert ) then
+ write "Patient has {{+B}}refused {{+R}}Blood Transfusions{{-R}}{{-B}}" at blood_refusal_dest;
+ endif;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CALLED_AUTO_ORDER_GENERAL.mlm b/MLMStripper/bin/Debug/SCH/SCH_CALLED_AUTO_ORDER_GENERAL.mlm
new file mode 100644
index 0000000..5d3118d
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CALLED_AUTO_ORDER_GENERAL.mlm
@@ -0,0 +1,247 @@
+maintenance:
+
+ title: SCH_Called_Auto_Order_General;;
+ mlmname: SCH_Called_Auto_Order_General;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: ;;
+ author: Shubhang Acharya;;
+ specialist: ;;
+ date: 2015-02-18;;
+ validation: testing;;
+
+library:
+ purpose: This MLM is being called from other MLMs to automatically place the order based on the input parameters.
+
+ History
+ 09.24.2019 TMS CSR # 38444 Add 2 new additional observations.
+
+ ;;
+ explanation: This MLM is being called from other MLMs to automatically place the order based on the input parameters.
+
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (
+ ClientVisitGuid,
+ ChartGuid,
+ ClientGuid,
+ UserGuid,
+ LocationGuid,
+ CatalogItemName,
+ OrderDataItem1,
+ OrderDataItemValue1,
+ OrderDataItem2,
+ OrderDataItemValue2,
+ OrderDataItem3,
+ OrderDataItemValue3,
+ OrderDataItem4,
+ OrderDataItemValue4,
+ OrderDataItem5,
+ OrderDataItemValue5,
+ OrderDataItem6,
+ OrderDataItemValue6,
+ OrderDataItem7,
+ OrderDataItemValue7,
+ OrderDataItem8,
+ OrderDataItemValue8,
+ OrderDataItem9,
+ OrderDataItemValue9,
+ OrderDataItem10,
+ OrderDataItemValue10
+ ) := argument;
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_destination := destination { IntermediateMessage } with [
+ alert_type := "Warning",
+ short_message := "Auto Order MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "Auto Order MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+ user_IDType := "PRIMARY";
+ order_Creation_Reason := "Order Created Form MLM";
+
+ User_IdCode := read last{" select cid.IDCode from CV3User u "
+ ||" join CV3CareProvider cp on u.GUID =cp.guid "
+ ||" join CV3CareProviderID cid on cp.guid = cid.ProviderGuid "
+ ||" where u.Guid = "||sql (UserGuid)};
+// ||" and cid.ProviderIDTypeCode = {{{SINGLE-QUOTE}}}PRIMARY{{{SINGLE-QUOTE}}}"};
+
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ WSSessionType := "Standard";
+ WSSessionReason := "";
+ WSRequestedBySource := "";
+ WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ( (userGUID as Number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+//call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById
+// with ( user_IDType, user_IDCode );
+ WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((LocationGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ if ( WSRequestedBy_obj is NOT NULL ) then
+ void:= call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ if ( WSlocation_obj is NOT NULL ) then
+ void:= call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+ endcatch;
+
+
+
+
+ try
+ // get OrderCatalogMasterItem ObjectsPlus object
+ general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with CatalogItemName;
+
+ // Create the prefilled General order
+ GeneralOrder2_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ general_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // CreateReason
+ wsRequestedBy_obj, // RequestedBy ObjectsPlus object
+ wsRequestedBySource, // string RequestedBySource (must be in dictionary)
+ wsSessionType, // string SessionType
+ wsSessionReason, // string SessionReason
+ wslocation_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
+
+ IF (EXISTS OrderDataItem1 AND OrderDataItem1 IS NOT NULL AND OrderDataItem1 <> "") THEN
+ Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ OrderDataItem1 , OrderDataItemValue1 ;
+ ENDIF;
+
+ IF (EXISTS OrderDataItem2 AND OrderDataItem2 IS NOT NULL AND OrderDataItem2 <> "") THEN
+ Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ OrderDataItem2 , OrderDataItemValue2 ;
+ ENDIF;
+
+ IF (EXISTS OrderDataItem3 AND OrderDataItem3 IS NOT NULL AND OrderDataItem3 <> "") THEN
+ Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ OrderDataItem3 , OrderDataItemValue3 ;
+ ENDIF;
+
+ IF (EXISTS OrderDataItem4 AND OrderDataItem4 IS NOT NULL AND OrderDataItem4 <> "") THEN
+ Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ OrderDataItem4 , OrderDataItemValue4 ;
+ ENDIF;
+
+ IF (EXISTS OrderDataItem5 AND OrderDataItem5 IS NOT NULL AND OrderDataItem5 <> "") THEN
+ Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ OrderDataItem5 , OrderDataItemValue5 ;
+ ENDIF;
+
+
+ IF (EXISTS OrderDataItem6 AND OrderDataItem6 IS NOT NULL AND OrderDataItem6 <> "") THEN
+ Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ OrderDataItem6 , OrderDataItemValue6 ;
+ ENDIF;
+
+ IF (EXISTS OrderDataItem7 AND OrderDataItem7 IS NOT NULL AND OrderDataItem7 <> "") THEN
+ Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ OrderDataItem7 , OrderDataItemValue7 ;
+ ENDIF;
+
+ IF (EXISTS OrderDataItem8 AND OrderDataItem8 IS NOT NULL AND OrderDataItem8 <> "") THEN
+ Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ OrderDataItem8 , OrderDataItemValue8 ;
+ ENDIF;
+
+ IF (EXISTS OrderDataItem9 AND OrderDataItem9 IS NOT NULL AND OrderDataItem9 <> "") THEN
+ Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ OrderDataItem9 , OrderDataItemValue9 ;
+ ENDIF;
+
+ IF (EXISTS OrderDataItem10 AND OrderDataItem10 IS NOT NULL AND OrderDataItem10 <> "") THEN
+ Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ OrderDataItem10 , OrderDataItemValue10 ;
+ ENDIF;
+
+ if ( general_catalog_item is NOT NULL ) then
+ void:= call general_catalog_item.Dispose;
+ general_catalog_item:= null;
+ endif;
+
+ //GeneralOrder2_dest.ObjectsPlus := GeneralOrder2_obj;
+ empty := Call GeneralOrder2_obj.save;
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New general order:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( general_catalog_item is NOT NULL ) then
+ void:= call general_catalog_item.Dispose;
+ general_catalog_item:= null;
+ endif;
+
+ if ( GeneralOrder2_obj is NOT NULL ) then
+ void:= call GeneralOrder2_obj.Dispose;
+ GeneralOrder2_obj:= null;
+ endif;
+
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+ if ( WSRequestedBy_obj is NOT NULL ) then
+ void:= call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+ if ( WSlocation_obj is NOT NULL ) then
+ void:= call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ CONCLUDE true;
+ ;;
+ action:
+ if Error_occurred then
+ return ex.Message;
+ else
+ return "1";
+ endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CANCEL_ACCOUNT_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_CANCEL_ACCOUNT_ORDER.mlm
new file mode 100644
index 0000000..e422d73
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CANCEL_ACCOUNT_ORDER.mlm
@@ -0,0 +1,127 @@
+maintenance:
+
+ title: Ordering: Check for complete registration when entering a discharge or expire order;;
+ mlmname: SCH_Cancel_Account_Order;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair Cancel Account Order MLM;;
+ author: Dean Miklavic, Allscripts Corp;;
+ specialist: Kathy Egal;;
+ date: 2010-09-28;;
+ validation: testing;;
+
+library:
+ purpose: Prevent the Cancel Account Order from being entered if the patient visit contains Orders, Results or Documents.
+ ;;
+ explanation: When a user selects the Cancel Account order item and the patients account contains non-cancelled Orders, Results or Documents a hard stop
+ alert will display and not allow the user to proceed with submitting the order.
+
+ Change history
+
+ ;;
+ keywords: Cancel Account
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+/* Get the Chart GUID */
+
+(ClientVisitGuid, ChartGuid, ClientGuid) :=
+ read last {ClientVisit: GUID, ChartGUID, ClientGUID };
+
+
+
+ // Set the text for this variable to indicate whether to send the message or not.
+ send_alert := "DoNotSend";
+
+ order_evoke1:= EVENT {OrderEnter User Order:
+ WHERE Name Matches Pattern "cancel account%"};
+
+ // SQL Code to check for Non-Cancelled Orders, Lab Results, and or Documents.
+
+ ExistingActiveOrders := read last
+ { " Select top 1 Name"
+ || " from cv3order "
+ || " where OrderStatusCode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid)
+ || " and name <> {{{SINGLE-QUOTE}}}RODS{{{SINGLE-QUOTE}}}"};
+
+ ExistingOtherOrders := read last
+ { " Select top 1 Name"
+ || " from cv3order "
+ || " where OrderStatusCode not in ({{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}}) and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid) };
+
+ ExistingLabs := read last
+ { " Select top 1 ItemName"
+ || " from cv3basicobservation "
+ || " where Status is not null and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid) };
+
+ ExistingDocuments := read last
+ { " Select top 1 DocumentName"
+ || " from cv3clientdocument "
+ || " where IsCanceled is not null and clientguid = " || SQL(ClientGuid) || " and chartguid = " || SQL(ChartGuid) || " and clientvisitguid = " || SQL(ClientVisitGuid) };
+
+
+ // Code to create cumulative message that is displayed in Alert.
+ Message_Accumulator :=" ";
+ Orders_Message := " ";
+
+
+ If exists (ExistingOtherOrders) then Message_Accumulator := Message_Accumulator || " Non-Active Orders, " ;Message_Action := "alert"; endif;
+
+ If exists (ExistingLabs) then Message_Accumulator := Message_Accumulator || " Results, " ;Message_Action := "alert"; endif;
+
+ If exists (ExistingDocuments) then Message_Accumulator := Message_Accumulator || " Documents, " ;Message_Action := "alert" ; endif;
+
+ If exists (ExistingActiveOrders) then Message_Accumulator := Message_Accumulator || " Active Orders, " ;Message_Action := "stop"; endif;
+
+// Code for messages , alerts
+
+ Orders_Message:= "You have entered a Cancel order on an account that has " ||Message_Accumulator ||
+ "\n\nContact your manager for further direction." ||
+ "\n\nOnce the above have been re-entered on the correct account or have been cancelled, RE-ENTER the Cancel order. .";
+
+ Orders_Message2:= "You have entered a Cancel order on an account that has " ||Message_Accumulator ||
+ "\n\nContact your manager for further direction." ;
+
+
+ alert_details:= destination { Alert: warning, "Not cleared for cancel", high, chart,
+ "Cannot Place Cancel Order", 14005, send_alert, "No Override Allowed" };
+
+// New second alert 09122011
+
+ alert2_details:= destination { Alert: warning, "Must acknowledege alert", high, chart,
+ "Warning orders exist for patient", 14005, send_alert, "Must Acknowledge" };
+
+
+ ;;
+ evoke: order_evoke1;
+ ;;
+ logic:
+ If Message_Accumulator <> " " then conclude true ; else conclude false ; endif;
+ ;;
+ action:
+
+// code to determine if user gets a hard stop or warning
+
+// Warning Message
+
+ If Message_Action = "alert" then write "This patient has {{+B}}{{+R}}" || Message_Accumulator ||
+ "{{-B}}{{-R}} on the account. \n\n {{+B}}{{+R}}" || Orders_Message2 || "{{-B}}{{-R}}" ||
+ " " at alert2_details; endif;
+
+// Hard Stop Message
+ If Message_Action = "stop" then write "This patient has {{+B}}{{+R}}" || Message_Accumulator ||
+ "{{-B}}{{-R}} on the account and the Cancel order cannot be placed. \n\n {{+B}}{{+R}}" || Orders_Message || "{{-B}}{{-R}}" ||
+ " " at alert_details; endif;
+
+
+ // write "This patient has {{+B}}{{+R}}" || Message_Accumulator ||
+ // "{{-B}}{{-R}} on the account and the Cancel order cannot be placed. \n\n {{+B}}{{+R}}" || Orders_Message || "{{-B}}{{-R}}" ||
+ // " " at alert_details;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CDIFF_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_CDIFF_ALERT.mlm
new file mode 100644
index 0000000..39d51fb
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CDIFF_ALERT.mlm
@@ -0,0 +1,155 @@
+maintenance:
+
+ title: SCH_CDiff_Alert;;
+ mlmname: SCH_CDiff_Alert;;
+ arden: version 2.5;;
+ version: 15.3;;
+ institution: ;;
+ author: Shami Sharma;;
+ specialist: ;;
+ date: 2016-06-27;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation: Show alert on placing C-Diff order if positive result comes for Toxigenic C Difficile result item for the save visit
+
+
+ Change history
+
+ 04.16.2018 DJW CSR# 36594 - Altered to check for existing positive CDiff result in the last 90 days
+ 07/10/2019 JML CSR# 38386: Modified logic to auto-check lab test based on ED vs. Inpatient location.
+
+
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ Order_Event_Init := event{OrderSetInit User OrderSet : WHERE OrderSetName IN ("Physician Clostridium Difficile Order Set", "Clostridium Difficile Nursing Standing Order") };
+
+ ClientGuid := EVOKINGOBJECT.ClientGUID;
+ ChartGuid := EVOKINGOBJECT.ChartGUID;
+ userguid := read last {UserInfo: GUID};
+ VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
+ OSName := EvokingObject.OrderSetName;
+ //(this_order_id, this_order) := read last {OrderSet : GUID, OrderSetName Referencing EvokingObject};
+
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "Physician Clostridium Difficile Order Set",
+ priority := "High",
+ scope := Chart,
+ rule_group := "Laxatives Order",
+ rule_number := 8050,
+ send_with_order := "DoNotSend",
+ alert_dialog_settings := "Must Comment",
+ display_alert := true];
+
+
+ send_alert:= "DoNotSend";
+ cdiff_alert_dest:= destination { Alert: warning, "C Diff Result Alert", high, chart, "Physician Clostridium Difficile Order Set MLM", 15042, send_alert, "No Override Allowed" };
+
+
+ // Determine if the patient has positive cdiff result in the past 90 days
+ CDiffResult := read last
+ { " Select tol.text + {{{SINGLE-QUOTE}}} - {{{SINGLE-QUOTE}}} + cast (convert(char(10), bo.TouchedWhen,110) as varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast (convert(char(5), bo.TouchedWhen,114) as varchar) "
+ || " from cv3BasicObservation bo with (nolock) "
+ || " left outer join CV3TextualObservationLine tol with (nolock) on bo.clientguid = tol.clientguid and bo.GUID = tol.ObservationGUID "
+ || " where bo.TouchedWhen > Convert(date,dateadd(day, -90, getdate())) and "
+ || " bo.itemname IN ( {{{SINGLE-QUOTE}}}Toxigenic Clostridium Difficile by PCR{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Clostridium Difficile Screening{{{SINGLE-QUOTE}}} ) and tol.Text like {{{SINGLE-QUOTE}}}%positive%{{{SINGLE-QUOTE}}} and bo.IsHistory = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} and "
+ || " bo.clientguid = " || SQL(ClientGuid) || " "
+ || " order by bo.TouchedWhen desc "
+ };
+
+ If exists CDiffResult then
+
+ cdiff_alert_message := "This patient was postitive for C.diff within the last 90 days. In a symptomatic patient best practice is to isolate and treat with oral Vancomycin and to not re-test the patient."
+ ||" \n\n Please call Infection Prevention at 412-942-2230 with questions."; // \n\n C.diff value = " || CDiffResult || " ";
+
+ else
+
+ DOC := read last { " select count(1) from CV3User U (NOLOCK) "
+ ||" INNER JOIN SXAAMCareProviderSpecialtyXREF s (nolock) ON s.CareProviderGUID=u.GUID "
+ ||" INNER JOIN CV3Discipline d (nolock) on d.GUID=s.DisciplineGUID "
+ ||" WHERE CODE = {{{SINGLE-QUOTE}}}Infectious Diseases{{{SINGLE-QUOTE}}} AND U.GUID = " || SQL(userguid)
+ };
+
+ IF ( DOC = 0 AND OSName = "Physician Clostridium Difficile Order Set" ) THEN
+
+ Result := read last { " SELECT TOP 1 O.Name "
+ ||" FROM Cv3Order (NOLOCK) O "
+ ||" INNER JOIN CV3OrderTaskOccurrence ot on ot.ClientGUID=O.ClientGUID and ot.OrderGUID=O.GUID and ot.TaskStatusCode={{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
+ ||" WHERE ot.PerformedFromDtm >= DATEADD(HOUR, -48, GETDATE())"
+ ||" AND O.Status= {{{SINGLE-QUOTE}}}ACTIVE{{{SINGLE-QUOTE}}} AND O.ActivateStatus={{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} "
+ ||" AND (NAME LIKE {{{SINGLE-QUOTE}}}%BISACODYL%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%CALCIUM POLYCARBOPHIL%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%DOCUSATE CALCIUM%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%DOCUSATE SODIUM%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%GLYCERIN SUPPOSITORY%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%MAGNESIUM CITRATE%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%MAGNESIUM HYDROXIDE%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%MINERAL OIL%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%POLYETHYLENE GLYCOL%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%PSYLLIUM%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%SENNA%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%SENNA/DOCUSATE SODIUM%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%SODIUM BIPHOSPHATE/SODIUM PHOSPHATE%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Dulcolax%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Fibercon%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Surfak%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Colace%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Milk of Magnesia%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%CoLyte%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%GoLYTELY%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%NuLytely%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%OCL Solution%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%MiraLax%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%MoviPrep%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Hydrocil Instant%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Senokot%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Peri-Colace%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Senokot S%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Fleets Enema%{{{SINGLE-QUOTE}}} ) "
+ ||" AND O.ClientGUID = " || SQL(ClientGuid)
+ ||" AND O.ChartGUID = " || SQL(ChartGuid)
+ ||" AND O.ClientVisitGUID = " || SQL(VisitGuid)
+ };
+
+
+ alert_message := "This patient has received laxatives in the last 48 hours. "
+ || "C-diff testing is not recommended in this setting. "
+ || "If you have valid clinical rationale for ordering C-diff in this context please note your rationale in the box below. ";
+
+ ENDIF; // Doc Exist
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: Order_Event_Init;
+ ;;
+ logic:
+
+ Conclude True;
+ ;;
+ action:
+ IF(EXISTS Result ) THEN
+ write alert_message at order_alert_dest;
+ ENDIF;
+
+ IF(EXISTS CDiffResult ) THEN
+ write cdiff_alert_message at cdiff_alert_dest;
+ ENDIF;
+
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CDIFF_VANCOMYCIN_ORAL_AUTO_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_CDIFF_VANCOMYCIN_ORAL_AUTO_ORDER.mlm
new file mode 100644
index 0000000..9d0aa66
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CDIFF_VANCOMYCIN_ORAL_AUTO_ORDER.mlm
@@ -0,0 +1,361 @@
+maintenance:
+
+ title: SCH_CDiff_Vancomycin_Oral_Auto_Order;;
+ mlmname: SCH_CDiff_Vancomycin_Oral_Auto_Order;;
+ arden: version 2;;
+ version: 1;;
+ institution: St Clair;;
+ author: Amy Georgolis, Shawn Roberts;;
+ specialist: Sandy Zhang;;
+ date: 2018-05-09;;
+ validation: testing;;
+
+library:
+ purpose: Auto-order Vancomycin 125mg PO Q12H for patients with history of C Diff. This MLM applies to antibiotic ORDERS ONLY, not order sets. The order set version is "SCH_CDiff_Vancomycin_Oral_Auto_Order_Order_Sets".
+ Problem: Patients with history of C Diff were not ordered vancomycin oral to prevent recurrent infection with C Diff.
+ Solution: This MLM will increase the number of patients who are ordered prophylactic Vancomycin 125mg BID when they{{{SINGLE-QUOTE}}}ve had a history of C Diff.
+ ;;
+
+ explanation: The MLM will create an order for Vancomycin 125mg PO Q12H and add it to the worksheet if a patient is being ordered an antibiotic and they have a history of C. Diff as a problem-chronic.
+
+ Change history
+ 05.09.2018 SZ CSR#35839 - Created
+ 01.22.2019 SZ Added Fidaxomicin to the list of exempted meds (it{{{SINGLE-QUOTE}}}s used as C Diff treatment)
+ ;;
+ keywords: Auto-order Vancomycin 125mg PO Q12H
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+ if called_by_editor
+ then EvokingObject := read last {OrderSet: THIS where Name="intraabdominal antibiotics" };
+ endif;
+
+
+ // this MLM is evoked by the ordering of any antibiotic that falls into our inclusion criteria set forth by project spec
+ order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"
+ and InitialSessionTypeCode <> "Discharge"
+ and OrderSetName is null
+ and not (Name matches pattern "%ipro") //excludes ipro meds
+ and not (Name matches pattern "%metronidazole%")
+ and not (Name matches pattern "%vancomycin%soln%")
+ and not (Name matches pattern "%vancomycin%oral%")
+ and not (Name matches pattern "%doxycycline%intrapleural%")
+ and not (Name matches pattern "%vancomycin%enema%")
+ and not (Name matches pattern "%methenamine%")
+ and not (Name matches pattern "%methylene%blue%")
+ and not (Name matches pattern "%sulfasalazine%")
+ and not (Name matches pattern "%fidaxomicin%")
+ };
+
+ medication_extension := EVOKINGOBJECT.MedicationExtension;
+ order_component_types := EVOKINGOBJECT.OrderComponentAllTypes;
+ user_data := EVOKINGOBJECT.OrderUserData;
+
+ // get guids
+ order_additional_info := EVOKINGOBJECT.OrderAdditionalInfo;
+ (CatalogItemObj, FrequencyValue) := read last {Order: OrderCatalogMasterItem, FrequencyCode REFERENCING EvokingObject};
+ (ClientVisitGuid, ChartGuid, ClientGuid, VisitType) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode};
+ userguid := read last {UserInfo: guid};
+ create_order := true;
+
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter # 1 - Checks for med orders matching therapeutic category
+ ////////////////////////////////////////////////////////////////////////////
+ // Proceed if this is an inpatient/observation patient and the drug is not of certain classes
+ // start of med order inclusion criteria
+ If (VisitType = "inpatient" or VisitType = "observation" or VisitType = "emergency")
+ and CatalogItemObj.TherapeuticCategory matches pattern "anti-infective%"
+ and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antiviral agents"
+ and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antifungals"
+ and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antimalarial agents"
+ and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antituberculosis agents"
+ and CatalogItemObj.TherapeuticCategory <> "anti-infectives | anthelmintics"
+ then
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #2 - Checks for presence of C Diff health issue
+ ////////////////////////////////////////////////////////////////////////////
+ // Does patient have problem-chronic of C Diff w/ entered date of last 12 months?
+ (Healthissue, HI_Created_When, HI_Onset_day, HI_Onset_Month, HI_Onset_Year) := read last {
+ "select distinct hid.shortname, hid.CreatedWhen, hid.OnsetDayNum, hid.OnsetMonthNum, hid.OnsetYearNum"
+ ||" from cv3healthissuedeclaration hid with (nolock) "
+ ||" join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
+ ||" where hid.clientguid = " || ClientGuid
+ ||" and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
+ ||" and (chi.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}} or hid.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}})"
+ ||" and ( chi.Description LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}} OR chi.ShortName LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}} OR Hid.ShortName LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}})"
+ ||" and hid.CreatedWhen > DATEADD(YEAR,-1,GETDATE())"
+ };
+
+
+ //if Onset Date for health issue was not within past year, then end and do not add order
+ //if NO onset date then proceed
+ HI_Onset_Date := HI_Onset_Year formatted with "%0.4d" || HI_Onset_Month formatted with "%0.2d" || HI_Onset_day formatted with "%0.2d";
+ HI_Onset_Date_Number := HI_Onset_Date as number;
+
+ if (HI_Onset_Date_Number <> 0) then
+
+ one_year_back := NOW - 1 year;
+ one_year_back_formatted := ( extract year one_year_back ) || (extract month one_year_back ) formatted with "%0.2d" || (extract day one_year_back ) formatted with "%0.2d";
+ one_year_back_number := one_year_back_formatted as number;
+
+ if (one_year_back_number > HI_Onset_Date_Number) then
+ create_order := false;
+ check_0_HI := "health issue onset was not within past year, order was not created";
+ endif;
+ endif; // if (HI_Onset_Date_Number <> 0) then
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #3 - Stop after and frequency filters
+ ////////////////////////////////////////////////////////////////////////////
+ // only proceed if C Diff health issue exists and no other condition stops order creation
+ if (exist Healthissue) and (create_order = true) then
+
+ // check if stop date/time (of abx order) is 24 hours or less from NOW
+ // if so, then end without creating worksheet order
+ twenty_four_hour_time := EVOKINGOBJECT.RequestedDtm + 24 Hour;
+ if (twenty_four_hour_time >= EVOKINGOBJECT.StopDtm) then
+ create_order := false;
+ Check_1_24_hours := "current order has stop date within 24 hours, order was not created";
+ endif; // if (twenty_four_hour_time >= EVOKINGOBJECT.StopDtm) then
+
+ // check stop after fields to evaluate if <= 24 hours
+ // if so, then end without creating worksheet order
+ // stopaftervalue of 1 = "Days"
+ if (order_additional_info.StopAfterOption = 1) then
+ if (order_additional_info.StopAfterValue <= 1) then
+ create_order := false;
+ endif;
+ endif;
+
+ // stopaftervalue of 2 = "Hours"
+ if (order_additional_info.StopAfterOption = 2) then
+ if (order_additional_info.StopAfterValue <= 24) then
+ create_order := false;
+ endif;
+ endif;
+
+ // stopaftervalue of 3 = "Minutes"
+ if (order_additional_info.StopAfterOption = 3) then
+ if (order_additional_info.StopAfterValue <= 1440) then
+ create_order := false;
+ endif;
+ endif;
+
+ // stopaftervalue of 4 = "Times"
+ if (order_additional_info.StopAfterOption = 4) then
+
+ if (order_additional_info.FreqSummaryLine matches pattern "%q1h%") and (order_additional_info.StopAfterValue <= 24) then
+ create_order := false;
+ endif;
+
+ if (order_additional_info.FreqSummaryLine matches pattern "%q2h%") and (order_additional_info.StopAfterValue <= 12) then
+ create_order := false;
+ endif;
+
+ if (order_additional_info.FreqSummaryLine matches pattern "%q4h%") and (order_additional_info.StopAfterValue <= 6) then
+ create_order := false;
+ endif;
+
+ if (order_additional_info.FreqSummaryLine matches pattern "%q6h%") and (order_additional_info.StopAfterValue <= 4) then
+ create_order := false;
+ endif;
+
+ if (order_additional_info.FreqSummaryLine matches pattern "%q8h%") and (order_additional_info.StopAfterValue <= 3) then
+ create_order := false;
+ endif;
+
+
+ if (order_additional_info.FreqSummaryLine matches pattern "%bid%") and (order_additional_info.StopAfterValue <= 2) then
+ create_order := false;
+ endif;
+
+ if (order_additional_info.FreqSummaryLine matches pattern "%q12h%") and (order_additional_info.StopAfterValue <= 2) then
+ create_order := false;
+ endif;
+
+
+ if (order_additional_info.FreqSummaryLine matches pattern "%q24h%") and (order_additional_info.StopAfterValue <= 1) then
+ create_order := false;
+ endif;
+
+ endif;
+
+ // if frequencies are one-time doses then do not create order
+ if (order_additional_info.FreqSummaryLine matches pattern "%now%"
+ or order_additional_info.FreqSummaryLine matches pattern "%once%"
+ or order_additional_info.FreqSummaryLine matches pattern "%stat%"
+ or order_additional_info.FreqSummaryLine matches pattern "%pre op%"
+ or order_additional_info.FreqSummaryLine matches pattern "%post op%"
+ or order_additional_info.FreqSummaryLine matches pattern "%pre-Procedure%"
+ or order_additional_info.FreqSummaryLine matches pattern "%post-Procedure%"
+ or order_additional_info.FreqSummaryLine matches pattern "%Post Hemodialysis%"
+ or order_additional_info.FreqSummaryLine matches pattern "%With Dialysis Treatment%"
+ or order_additional_info.FreqSummaryLine matches pattern "%today%"
+ ) then
+ create_order := false;
+ endif;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #4 - Active order for vanc/metro filter
+ ////////////////////////////////////////////////////////////////////////////
+ // checks for active vancomycin soln/enema or metronidazole IV or PO order during this visit
+ // If exist, then end without creating worksheet order
+ (ActiveOrderPresent, OrderGuid) := read last {
+ " select o.name, o.guid "
+ || " from cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
+ || " and (o.name like {{{SINGLE-QUOTE}}}%vancomycin%soln%{{{SINGLE-QUOTE}}} OR o.name like {{{SINGLE-QUOTE}}}%vancomycin%enema%{{{SINGLE-QUOTE}}} OR o.name like {{{SINGLE-QUOTE}}}%metronidazole%tab%{{{SINGLE-QUOTE}}} OR o.Name like {{{SINGLE-QUOTE}}}%metronidazole:%{{{SINGLE-QUOTE}}}) "
+ || " and o.OrderStatusLevelNum >= 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ };
+ if (exist ActiveOrderPresent) then
+ create_order := false;
+ Check_2_active_order := "active order for vanc soln was detected, order was not created";
+ endif;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #5 - Unsubmitted order for vanc/metro filter
+ ////////////////////////////////////////////////////////////////////////////
+ // check for unsubmitted order of metronidazole PO
+ // If exist, then end without creating worksheet order
+ (unsubmitted_metron_vanc) := READ {UnsubmittedOrders: Name WHERE (Name MATCHES PATTERN "Metronidazole:%"
+ or Name MATCHES PATTERN "%vancomycin%enema%"
+ or Name MATCHES PATTERN "%Metronidazole%tab%"
+ or Name MATCHES PATTERN "%Vancomycin%Soln%"
+ )} ;
+ number_unsub_metro_vanc := count (unsubmitted_metron_vanc);
+
+ if (number_unsub_metro_vanc >= 1) then
+ create_order := false;
+ Check_3_unsub_order := "unsubmitted order for metronidazole or vancomycin was detected, order was not created";
+ endif;
+
+
+ if (create_order = true) then
+
+ // If the user selects another careprovider (Nurse or US entry), pass the requestors user ID
+ if userguid <> EVOKINGOBJECT.CareProviderGUID then
+ userguid := EVOKINGOBJECT.CareProviderGUID;
+ endif;
+
+
+ /********************* create the order here *******************************/
+ // Inform the user of the order to be created using a dialogue box
+
+
+ // if (onset date exists) then
+ // use onset date
+ // else
+ // use entered date
+ if (HI_Onset_Date <> "00000000") then
+ HI_Onset_Date_formatted := HI_Onset_Month formatted with "%0.2d" || "-" || HI_Onset_day formatted with "%0.2d" || "-" || HI_Onset_Year formatted with "%0.4d";
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\nThis patient has met the criteria for prophylactic Oral Vancomycin due to history of C. Diff. within the past 12 months."
+ || "\n\nHealth issue of {{{SINGLE-QUOTE}}}" || HealthIssue || "{{{SINGLE-QUOTE}}} has an onset date of {{{SINGLE-QUOTE}}}" || HI_Onset_Date_formatted || "{{{SINGLE-QUOTE}}}. Please confirm the illness actually occurred within the past 12 months."
+ || "\n\nAn order for Vancomycin 125 mg PO BID(09-21) will be automatically added to worksheet. "
+ ,"C Diff Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ else
+ HI_Entered_Month := extract month HI_Created_When;
+ HI_Entered_Day := extract day HI_Created_When;
+ HI_Entered_Year := extract year HI_Created_When;
+
+ HI_Entered_Date_formatted := HI_Entered_Month formatted with "%0.2d" || "-" || HI_Entered_Day formatted with "%0.2d" || "-" || HI_Entered_Year formatted with "%0.4d";
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\nThis patient has met the criteria for prophylactic Oral Vancomycin due to history of C. Diff. within the past 12 months."
+ || "\n\nHealth issue of {{{SINGLE-QUOTE}}}" || HealthIssue || "{{{SINGLE-QUOTE}}} was ENTERED on {{{SINGLE-QUOTE}}}" || HI_Entered_Date_formatted || "{{{SINGLE-QUOTE}}}. Please confirm the illness actually occurred within the past 12 months."
+ || "\n\nAn order for Vancomycin 125 mg PO BID(09-21) will be automatically added to worksheet. "
+ ,"C Diff Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ endif;
+
+
+
+ // gather guids for creating order
+ //Active_ClientVisitGUID := this_communication.ClientVisitGUID;
+ Active_OrderGUID:= PrimaryObjdetail.GUID;
+ location_guid := read last {"select CurrentLocationGUID from CV3ClientVisit where GUID=" || SQL(ClientVisitGuid)};
+
+ // declare MLM that will generate order into worksheet
+ SCH_FUNC_CREATE_MED_ORDER_WORKSHEET := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_MED_ORDER_WORKSHEET{{{SINGLE-QUOTE}}};
+
+ // declare vancomycin order details/variable
+ OrderName := "Vancomycin Soln";
+ ItemModifier := "125mg - C Diff Protocol";
+ ItemVersion := "";
+ creation_reason := "from C Diff Protocol";
+ OrderFrequency := "BID (09-21)";
+ special_instructions_value_Mod := "";
+
+ // call MLM that to generate worksheet order
+ Create_Worksheet_Order := call SCH_FUNC_CREATE_MED_ORDER_WORKSHEET with
+ OrderName,
+ ItemModifier,
+ ItemVersion,
+ creation_reason,
+ OrderFrequency,
+ Active_OrderGUID,
+ ClientVisitGuid,
+ location_guid,
+ UserGuid,
+ special_instructions_value_Mod;
+
+ /*********************************************************/
+
+
+ endif; //if (create_order = true) then
+ endif; //if (exist Healthissue) and (create_order = true) then
+
+ endif; // If (VisitType = "inpatient" or VisitType = "observation" or VisitType = "emergency")
+
+
+/*
+ if (Called_By_Editor = false) and (userguid = "9000342919401190") then
+ break;
+ endif;
+
+*/
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+
+ order_enter_event;
+
+ ;;
+ logic:
+
+ if (called_by_editor) then
+ conclude false;
+ endif;
+
+ if (EvokingObject is null) then
+ conclude false;
+ endif;
+
+
+ conclude true;
+
+ ;;
+ action:
+ return this_communication, this_form;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CDIFF_VANCOMYCIN_ORAL_AUTO_ORDER_ORDER_SETS.mlm b/MLMStripper/bin/Debug/SCH/SCH_CDIFF_VANCOMYCIN_ORAL_AUTO_ORDER_ORDER_SETS.mlm
new file mode 100644
index 0000000..ad83718
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CDIFF_VANCOMYCIN_ORAL_AUTO_ORDER_ORDER_SETS.mlm
@@ -0,0 +1,578 @@
+maintenance:
+
+ title: SCH_CDiff_Vancomycin_Oral_Auto_Order_Order_Sets ;;
+ mlmname: SCH_CDiff_Vancomycin_Oral_Auto_Order_Order_Sets;;
+ arden: version 2.5;;
+ version: 1;;
+ institution: St Clair;;
+ author: Amy Georgolis, Shawn Roberts;;
+ specialist: Sandy Zhang;;
+ date: 2018-05-09;;
+ validation: testing;;
+
+library:
+ purpose: Auto-order Vancomycin 125mg PO Q12H for patients with history of C Diff. This MLM applies to antibiotic ORDER SETS ONLY, not orders(catalog items). The order version is "SCH_CDiff_Vancomycin_Oral_Auto_Order".
+ Problem: Patients with history of C Diff were not ordered vancomycin oral to prevent recurrent infection with C Diff.
+ Solution: This MLM will increase the number of patients who are ordered prophylactic Vancomycin 125mg BID when they{{{SINGLE-QUOTE}}}ve had a history of C Diff.
+ ;;
+ explanation: The MLM will create an order for Vancomycin 125mg PO Q12H and add it to the worksheet if a patient is being ordered an antibiotic and they have a history of C. Diff as a problem-chronic.
+
+ Change history
+ 05.09.2018 SZ CSR#35839 - Created
+ 01.22.2019 SZ Added Fidaxomicin to the list of exempted meds (it{{{SINGLE-QUOTE}}}s used as C Diff treatment)
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ // evoking event is all order sets
+ order_set_enter_event := event {OrderSetEnter User OrderSet};
+ // order_set_enter_event := event {OrderSetEnter User OrderSet : where OrderSetName matches pattern "%antibiotic%"};
+
+ // get guids
+ order_additional_info := EVOKINGOBJECT.OrderAdditionalInfo;
+ (CatalogItemObj, FrequencyValue) := read last {OrderSet: OrderCatalogSet REFERENCING EvokingObject};
+ (ClientVisitGuid, ChartGuid, ClientGuid, VisitType) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode};
+ userguid := read last {UserInfo: guid};
+ create_order := true;
+ qualified_abx_list := ();
+
+ medication_extension := EVOKINGOBJECT.MedicationExtension;
+ order_component_types := EVOKINGOBJECT.OrderComponentAllTypes;
+ user_data := EVOKINGOBJECT.OrderUserData;
+
+ // Does patient have problem-chronic of C Diff w/ entered date of last 12 months?
+ (Healthissue, HI_Created_When, HI_Onset_day, HI_Onset_Month, HI_Onset_Year) := read last {
+ "select distinct hid.shortname, hid.CreatedWhen, hid.OnsetDayNum, hid.OnsetMonthNum, hid.OnsetYearNum"
+ ||" from cv3healthissuedeclaration hid with (nolock) "
+ ||" join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
+ ||" where hid.clientguid = " || ClientGuid
+ ||" and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
+ ||" and (chi.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}} or hid.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}})"
+ ||" and ( chi.Description LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}} OR chi.ShortName LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}} OR Hid.ShortName LIKE {{{SINGLE-QUOTE}}}%c%difficile%{{{SINGLE-QUOTE}}})"
+ ||" and hid.CreatedWhen > DATEADD(YEAR,-1,GETDATE())"
+ };
+
+ //if Onset Date for health issue was not within past year, then end and do not add order
+ //if NO onset date then proceed
+ HI_Onset_Date := HI_Onset_Year formatted with "%0.4d" || HI_Onset_Month formatted with "%0.2d" || HI_Onset_day formatted with "%0.2d";
+ HI_Onset_Date_Number := HI_Onset_Date as number;
+
+ if (HI_Onset_Date_Number <> 0) then
+
+ one_year_back := NOW - 1 year;
+ one_year_back_formatted := ( extract year one_year_back ) || (extract month one_year_back ) formatted with "%0.2d" || (extract day one_year_back ) formatted with "%0.2d";
+ one_year_back_number := one_year_back_formatted as number;
+
+ if (one_year_back_number > HI_Onset_Date_Number) then
+ create_order := false;
+ check_0_HI := "health issue onset was not within past year, order was not created";
+ endif;
+ endif;
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #1 - Checks for presence of C Diff health issue
+ ////////////////////////////////////////////////////////////////////////////
+ if (exist Healthissue and create_order = true) then
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter # 2 - Checks for med orders matching therapeutic category
+ ////////////////////////////////////////////////////////////////////////////
+ // get names of unsubmitted med orders from order set that is being submitted
+ recent_order_name := READ { UnsubmittedOrders : Name WHERE TypeCode = "Medication" };
+
+ recent_order_count := 1 seqto (count recent_order_name);
+
+ // for every recent order, SQL order name to see if it fits our inclusion/exclusioin criteria
+ // if not excluded, then generate order for Vanc 125mg PO Q12H
+ for k in recent_order_count do
+
+ order_sql_name := recent_order_name[k] as string;
+
+ found_qualifying_antibiotic := read last {
+ "Select Name"
+ ||" from CV3OrderCatalogMasterItem ocmi (nolock) "
+ ||" Where ocmi.TherapeuticCategory Like {{{SINGLE-QUOTE}}}%Anti-infectives%{{{SINGLE-QUOTE}}}"
+ ||" and ( ocmi.TherapeuticCategory NOT LIKE {{{SINGLE-QUOTE}}}%anthelmintics%{{{SINGLE-QUOTE}}}"
+ ||" and ocmi.TherapeuticCategory not like {{{SINGLE-QUOTE}}}%antifungals%{{{SINGLE-QUOTE}}}"
+ ||" and ocmi.TherapeuticCategory not like {{{SINGLE-QUOTE}}}%antiviral agents%{{{SINGLE-QUOTE}}}"
+ ||" and ocmi.TherapeuticCategory not like {{{SINGLE-QUOTE}}}%antimalarial agents%{{{SINGLE-QUOTE}}}"
+ ||" and ocmi.TherapeuticCategory not like {{{SINGLE-QUOTE}}}%antituberculosis agents%{{{SINGLE-QUOTE}}} "
+ ||" and ocmi.TherapeuticCategory not like {{{SINGLE-QUOTE}}}%anthelmintics%{{{SINGLE-QUOTE}}} )"
+ ||" and (name not like {{{SINGLE-QUOTE}}}%ipro{{{SINGLE-QUOTE}}} "
+ ||" and name not like {{{SINGLE-QUOTE}}}%metronidazole%{{{SINGLE-QUOTE}}} "
+ ||" and name not like {{{SINGLE-QUOTE}}}%vancomycin%soln%{{{SINGLE-QUOTE}}} "
+ ||" and name not like {{{SINGLE-QUOTE}}}%vancomycin%oral%{{{SINGLE-QUOTE}}} "
+ ||" and name not like {{{SINGLE-QUOTE}}}%doxycycline%intrapleural%{{{SINGLE-QUOTE}}}"
+ ||" and name not like {{{SINGLE-QUOTE}}}%vancomycin%enema%{{{SINGLE-QUOTE}}}"
+ ||" and name not like {{{SINGLE-QUOTE}}}%methenamine%{{{SINGLE-QUOTE}}} "
+ ||" and name not like {{{SINGLE-QUOTE}}}%methylene%blue%{{{SINGLE-QUOTE}}} "
+ ||" and name not like {{{SINGLE-QUOTE}}}%sulfasalazine%{{{SINGLE-QUOTE}}}"
+ ||" and name not like {{{SINGLE-QUOTE}}}%fidaxomicin%{{{SINGLE-QUOTE}}})"
+ ||" and name = " || "{{{SINGLE-QUOTE}}}" || order_sql_name || "{{{SINGLE-QUOTE}}}"
+ };
+
+ if (exist found_qualifying_antibiotic) then
+ qualified_abx_list := qualified_abx_list , found_qualifying_antibiotic;
+ endif;
+
+
+ // if any of order is vanc PO/enema or Metronidazole IV/PO then do not continue to creating order
+ if (order_sql_name matches pattern "%vancomycin%enema%") or
+ (order_sql_name matches pattern "metronidazole%tab%") or
+ (order_sql_name matches pattern "%vancomycin%soln%") or
+ (order_sql_name matches pattern "metronidazole:%")
+ then
+ create_order := false;
+ check_vanc_metro := "found metro IV/PO or vanc enema/PO, do not generate order";
+ endif;
+
+ enddo; // for k in recent_order_count do
+
+ // filter #2 - if no qualifying antibiotics were found, then end
+ if (not exist qualified_abx_list) then
+ create_order := false;
+ check_abx_found := "no qualifying antibiotics were found";
+ endif;
+ // end of Filter # 2 - Checks for med orders matching therapeutic category
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #3 - Stop after and frequency filters
+ ////////////////////////////////////////////////////////////////////////////
+
+ if (create_order = true) then
+
+ all_one_time_doses := ();
+ stop_after_true_false_list := (); // a list to keep track of all QXH items, if there are any false items then do not create order
+ qualified_abx_count := 1 seqto (count qualified_abx_list);
+
+ // loop through all frequency codes OF QUALIFIED ABX to see if they are all one-time doses, if so, then end and do not create vanc order
+ for k in qualified_abx_count do
+
+ qualified_abx_order_name := qualified_abx_list[k];
+
+ qualified_order_name, frequency_code, stop_date, summary_line_info := READ { UnsubmittedOrders : Name, FrequencyCode, StopDtm, SummaryLine WHERE TypeCode = "Medication" and Name = qualified_abx_order_name };
+ //summary_line_info := READ { UnsubmittedOrders : SummaryLine WHERE TypeCode = "Medication" };
+
+ // check for one-time doses, if present then add false, else true is added (if it fits criteria) to stop_after_true_false_list
+ // this list allows an order to generate if a true is added (and no create_order := false, which is a hard stop)
+ if (frequency_code[k] matches pattern "%now%"
+ or frequency_code[k] matches pattern "%once%"
+ or frequency_code[k] matches pattern "%stat%"
+ or frequency_code[k] matches pattern "%pre op%"
+ or frequency_code[k] matches pattern "%post op%"
+ or frequency_code[k] matches pattern "%pre-Procedure%"
+ or frequency_code[k] matches pattern "%post-Procedure%"
+ or frequency_code[k] matches pattern "%Post Hemodialysis%"
+ or frequency_code[k] matches pattern "%With Dialysis Treatment%"
+ or frequency_code[k] matches pattern "%today%"
+ ) then
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ check_one_time_dose := "one time dose frequency detected";
+ else
+
+
+ // search for position of X, used in several substring statements below
+ position_of_x := FIND "X" IN STRING summary_line_info[k];
+
+
+ // if stopaftervalue of "Minutes" is used
+ // substring 3, because only 3 digits max allowed in stop after field
+ if (summary_line_info[k] matches pattern "%X%Minutes%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%M%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 1440) then
+ //create_order := false;
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ check_minutes := "order had a stop after of <= 1440 minutes";
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+
+ endif; //if (summary_line_info[k] matches pattern "%X%Minutes%") then
+
+
+
+ // if stopaftervalue of "Hours" is used
+ // substring 3, because only 3 digits max allowed in stop after field
+ if (summary_line_info[k] matches pattern "%X%Hours%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%H%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 24) then
+ //create_order := false;
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ check_hours := "order had a stop after of <= 24 hours";
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+
+ endif; //if (summary_line_info[k] matches pattern "%X%Hours%") then
+
+
+ // if stopaftervalue of "Days" is used
+ // substring 3, because only 3 digits max allowed in stop after field
+ if (summary_line_info[k] matches pattern "%X%Days%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%D%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 1) then
+ //create_order := false;
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ check_days := "order had a stop after of <= 1 day";
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+
+ endif; // if (summary_line_info[k] matches pattern "%X%Days%") then
+
+
+ // if stopaftervalue of "Times" is used
+ if (summary_line_info[k] matches pattern "%X%Times%") then
+ summary_line_pattern_found := "X%Times pattern found for summary line";
+
+
+ if (frequency_code[k] matches pattern "%q1h%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%T%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+
+ if ((summary_substring_number as number) <= 24) then
+ //create_order := false;
+ check_Times_Q1H := "order had a stop after of <= 1 day";
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+ endif; // if (frequency_code[k] matches pattern "%q1h%"
+
+
+
+ if (frequency_code[k] matches pattern "%q2h%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%T%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 12) then
+ //create_order := false;
+ check_Times_Q2H := "order had a stop after of <= 1 day";
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+ endif; // if (frequency_code[k] matches pattern "%q2h%"
+
+
+ if (frequency_code[k] matches pattern "%q3h%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%T%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 8) then
+ //create_order := false;
+ check_Times_Q3H := "order had a stop after of <= 1 day";
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+ endif; // if (frequency_code[k] matches pattern "%q3h%") then
+
+
+
+ if (frequency_code[k] matches pattern "%q4h%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%T%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 6) then
+ //create_order := false;
+ check_Times_Q4H := "order had a stop after of <= 1 day";
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+ endif; // if (frequency_code[k] matches pattern "%q4h%"
+
+
+
+ if (frequency_code[k] matches pattern "%q6h%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%T%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 4) then
+ //create_order := false;
+ check_Times_Q6H := "order had a stop after of <= 1 day";
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+ endif; // if (frequency_code[k] matches pattern "%q6h%"
+
+
+
+ if (frequency_code[k] matches pattern "%q8h%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%T%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 3) then
+ //create_order := false;
+ check_Times_Q8H := "order had a stop after of <= 1 day";
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+ endif; // if (frequency_code[k] matches pattern "%q8h%"
+
+
+
+ if (frequency_code[k] matches pattern "%bid%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%T%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 2) then
+ //create_order := false;
+ check_Times_BID := "order had a stop after of <= 1 day";
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+ endif; // if (frequency_code[k] matches pattern "%bid%"
+
+
+
+ if (frequency_code[k] matches pattern "%q12h%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%T%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 2) then
+ //create_order := false;
+ check_Times_Q12H := "order had a stop after of <= 1 day";
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+ endif; // if (frequency_code[k] matches pattern "%bid%"
+
+
+
+ if (frequency_code[k] matches pattern "%q24h%") then
+ summary_substring_number := SUBSTRING 3 CHARACTERS STARTING AT (position_of_x + 1) FROM summary_line_info[k];
+
+ if (summary_substring_number matches pattern "%T%") then
+ summary_substring_number := SUBSTRING 2 CHARACTERS FROM summary_substring_number;
+ endif;
+
+ if ((summary_substring_number as number) <= 1) then
+ //create_order := false;
+ check_Times_Q24H := "order had a stop after of <= 1 day";
+ stop_after_true_false_list := stop_after_true_false_list , false;
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true;
+ endif;
+ endif; // if (frequency_code[k] matches pattern "%q24h%"
+
+ else
+ stop_after_true_false_list := stop_after_true_false_list , true; // if the med order had QXH and no stop after settings used, that would trigger this line
+ check_QXH_no_stop_after := "no stop after settings were detected and order is likely QXH";
+ endif; // if (summary_line_info[k] matches pattern "%X%Times%"
+
+ endif; // if (frequency_code[k] matches pattern "%now%"
+
+ enddo; //for k in qualified_abx_count do
+
+ // if there is no true in the list, then do not create order (this means no orders passed the frequency/stopafter criteria to qualify in creating an order)
+ // each true is added when a qualified order is found in the unsubmitted list
+ if (true is not in stop_after_true_false_list) then
+ create_order := false;
+ check_stop_after_true_false:= "no qualified orders have flagged a true to proceed, so create_order := false";
+ endif;
+ // end of filter #3 - Stop after and frequency filters
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #4 - Active order for vanc/metro filter
+ ////////////////////////////////////////////////////////////////////////////
+ /*********************************************************************************************************************************/
+ // checks for active vancomycin soln/metronidazole IV or PO order during this visit
+ // If exist, then end without creating worksheet order
+ (ActiveOrderPresent, OrderGuid) := read last {
+ " select o.name, o.guid "
+ || " from cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
+ || " and (o.name like {{{SINGLE-QUOTE}}}%vancomycin%soln%{{{SINGLE-QUOTE}}} OR o.name like {{{SINGLE-QUOTE}}}%vancomycin%enema%{{{SINGLE-QUOTE}}} OR o.name like {{{SINGLE-QUOTE}}}%metronidazole%tab%{{{SINGLE-QUOTE}}} OR o.Name like {{{SINGLE-QUOTE}}}%metronidazole:%{{{SINGLE-QUOTE}}}) "
+ || " and o.OrderStatusLevelNum >= 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ };
+ if (exist ActiveOrderPresent) then
+ create_order := false;
+ Check_active_order := "active order for vanc soln was detected, order was not created, so create_order := false";
+ endif;
+
+
+ /*********************************************************************************************************************************/
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #5 - Unsubmitted order for vanc/metro filter
+ ////////////////////////////////////////////////////////////////////////////
+ // check for unsubmitted order of metronidazole PO
+ // If exist, then end without creating worksheet order
+ (unsubmitted_metron_vanc) := READ {UnsubmittedOrders: Name WHERE (Name MATCHES PATTERN "Metronidazole:%"
+ or Name MATCHES PATTERN "%vancomycin%enema%"
+ or Name MATCHES PATTERN "%Metronidazole%tab%"
+ or Name MATCHES PATTERN "%Vancomycin%Soln%"
+ )} ;
+ number_unsub_metro_vanc := count (unsubmitted_metron_vanc);
+ if (number_unsub_metro_vanc >= 1) then
+ create_order := false;
+ Check_unsub_order := "unsubmitted order for metronidazole or vancomycin was detected, order was not created, so create_order := false";
+ endif;
+
+ /*********************************************************************************************************************************/
+ ////////////////////////////////////////////////////////////////////////////
+ // order creation
+ ////////////////////////////////////////////////////////////////////////////
+
+ if (create_order = true) then
+
+ // If the user selects another careprovider (Nurse or US entry), pass the requestors user ID
+ if userguid <> EVOKINGOBJECT.CareProviderGUID then
+ userguid := EVOKINGOBJECT.CareProviderGUID;
+ endif;
+
+
+ /********************* create the order here *******************************/
+
+ // Inform the user of the order to be created using a dialogue box
+
+ // if (onset date exists) then
+ // use onset date
+ // else
+ // use entered date
+ if (HI_Onset_Date <> "00000000") then
+ HI_Onset_Date_formatted := HI_Onset_Month formatted with "%0.2d" || "-" || HI_Onset_day formatted with "%0.2d" || "-" || HI_Onset_Year formatted with "%0.4d";
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\nThis patient has met the criteria for prophylactic Oral Vancomycin due to history of C. Diff. within the past 12 months."
+ || "\n\nHealth issue of {{{SINGLE-QUOTE}}}" || HealthIssue || "{{{SINGLE-QUOTE}}} has an onset date of {{{SINGLE-QUOTE}}}" || HI_Onset_Date_formatted || "{{{SINGLE-QUOTE}}}. Please confirm the illness actually occurred within the past 12 months."
+ || "\n\nAn order for Vancomycin 125 mg PO BID(09-21) will be automatically added to worksheet. "
+ ,"C Diff Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ else
+ HI_Entered_Month := extract month HI_Created_When;
+ HI_Entered_Day := extract day HI_Created_When;
+ HI_Entered_Year := extract year HI_Created_When;
+
+ HI_Entered_Date_formatted := HI_Entered_Month formatted with "%0.2d" || "-" || HI_Entered_Day formatted with "%0.2d" || "-" || HI_Entered_Year formatted with "%0.4d";
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\nThis patient has met the criteria for prophylactic Oral Vancomycin due to history of C. Diff. within the past 12 months."
+ || "\n\nHealth issue of {{{SINGLE-QUOTE}}}" || HealthIssue || "{{{SINGLE-QUOTE}}} was ENTERED on {{{SINGLE-QUOTE}}}" || HI_Entered_Date_formatted || "{{{SINGLE-QUOTE}}}, please confirm it occured within the past 12 months. "
+ || "\n\nAn order for Vancomycin 125 mg PO BID(09-21) will be automatically added to worksheet. "
+ ,"C Diff Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ endif;
+
+
+
+/*
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\nThis patient has met the criteria for prophylactic Oral Vancomycin due to history of C. Diff. "
+ || "\n\nAn order for Vancomycin 125 mg PO BID (09-21) will be automatically added to worksheet. "
+ ,"C Diff Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+*/
+
+ // gather guids for creating order
+ //Active_ClientVisitGUID := this_communication.ClientVisitGUID;
+ Active_OrderGUID:= PrimaryObjdetail.GUID;
+ location_guid := read last {"select CurrentLocationGUID from CV3ClientVisit where GUID=" || SQL(ClientVisitGuid)};
+
+ // declare MLM that will generate order into worksheet
+ SCH_FUNC_CREATE_MED_ORDER_WORKSHEET := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_MED_ORDER_WORKSHEET{{{SINGLE-QUOTE}}};
+
+ // declare vancomycin order details/variable
+ OrderName := "Vancomycin Soln";
+ ItemModifier := "125mg - C Diff Protocol";
+ ItemVersion := "";
+ creation_reason := "from C Diff Protocol";
+ OrderFrequency := "BID (09-21)";
+ special_instructions_value_Mod := "";
+
+ // call MLM that to generate worksheet order
+ Create_Worksheet_Order := call SCH_FUNC_CREATE_MED_ORDER_WORKSHEET with
+ OrderName,
+ ItemModifier,
+ ItemVersion,
+ creation_reason,
+ OrderFrequency,
+ Active_OrderGUID,
+ ClientVisitGuid,
+ location_guid,
+ UserGuid,
+ special_instructions_value_Mod;
+
+ /*********************************************************/
+
+ endif; //if (create_order = true) then
+
+ endif; // if (create_order = true) then (starts in filter #3)
+
+ endif; // if (exist Healthissue and create_order = true) then
+ // end of Filter #1 - Checks for presence of C Diff health issue
+
+
+/*
+ if (Called_By_Editor = false) and (userguid = "9000004416201190") then
+ break;
+ endif;
+*/
+
+
+
+ ;;
+ priority: 40
+ ;;
+ evoke: order_set_enter_event;
+ ;;
+ logic: conclude true;
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CHARTED_HALDOL_24HRS.mlm b/MLMStripper/bin/Debug/SCH/SCH_CHARTED_HALDOL_24HRS.mlm
new file mode 100644
index 0000000..4d98c45
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CHARTED_HALDOL_24HRS.mlm
@@ -0,0 +1,373 @@
+maintenance:
+
+ title: SCH_CHARTED_HALDOL_24HRS;;
+ mlmname: SCH_CHARTED_HALDOL_24HRS;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Shawn Head, Allscripts Corp;;
+ specialist: Dean Miklavic;;
+ date: 2016-04-07;;
+ validation: testing;;
+
+library:
+ purpose:
+
+ ;;
+
+ explanation:
+
+
+ Change history
+
+ 04.07.2016 STH CSR #33207 Created to update the IV Haldol dosage given over the last 24 hours from last time IV Haldol was given. {Go-Live 6/1/2016}
+ 06.02.2016 STH CSR #33207 CA service desk #: 2192254 - Correct issue so the MLM only updates the columns when IV haldol is being charted. There was logic that was still updating the columns
+ even if the task that was give was for a route of PO. Added an qulaifying IF statement to look at route first, and only when the route being given contains IV will the
+ MLM fire now.
+
+ ;;
+ keywords: ObjectsPlus/XA, Order
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Error Handling vars for ObjectsPlus Method calls
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+/*
+ //--------------------------------------------------------------------
+ if called_by_editor then
+ EvokingObject := read last {OrderTaskOccurrence: THIS
+ where TaskName Matches Pattern "%Haloperidol%" and orderguid = "9001409616300680"};
+ endif;
+*/
+ //Event Triggers
+ any_modified_task:= event {OrderTaskOccurrenceModify
+ Any OrderTaskOccurrence:
+ WHERE TaskName Matches Pattern "%Haloperidol%" };
+
+ userguid :=read last {UserInfo: guid};
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ TS := 9 FORMATTED WITH "%c";
+ CRLF:= CR||LF;
+
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+
+ //Retrieve Client Visit GUID
+
+ TaskName,TaskDose, TaskStatusCode,orderguid ,significantdtm,taskoccuranceguid ,taskguid, routecode := read last {OrderTaskOccurrence: TaskName,TaskDose, TaskStatusCode,OrderGUID, SignificantDtm, guid, OrderTaskGUID, TaskRouteCode REFERENCING EvokingObject};
+
+ colUpdate := false;
+ if(routecode matches pattern "%IV%") then
+
+ (ClientVisitGUID, ClientGUID, ChartGUID, LocationGUID) := read last { " select cv.guid, cv.clientguid, cv.chartguid, cv.CurrentLocationGUID from cv3clientvisit cv with (nolock)
+ inner join cv3order o with (nolock) on cv.ClientGUID = o.clientguid and cv.ChartGUID = o.chartguid
+ and cv.guid = o.clientvisitguid where o.guid = " || SQL(orderguid)};
+
+ (ProviderGUID) := read last { " select ProviderGUID from CV3CareProviderVisitRole
+ where clientguid = " || sql(ClientGUID)
+ || " and ClientVisitGUID = " || sql(ClientVisitGUID)
+ || " and rolecode = {{{SINGLE-QUOTE}}}Attending{{{SINGLE-QUOTE}}}
+ and status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} " };
+
+
+ Unit := read last { " select name from cv3location where guid = " || sql(LocationGUID) };
+
+ Haldol_24hr_Dosage := read last { " select *
+ into #tmp_orders
+ from cv3order o with (nolock)
+ where o.ClientGUID = " || sql(ClientGUID)
+ || " and o.chartguid = " || sql(chartGUID)
+ || " and o.clientvisitguid = " || sql(ClientVisitGUID)
+ || " and o.name like {{{SINGLE-QUOTE}}}%Haloperidol%{{{SINGLE-QUOTE}}}
+
+ select isnull(sum(cast(isnull(oto.taskdose,0) as float)),0) as {{{SINGLE-QUOTE}}}total_dosage_24hrs{{{SINGLE-QUOTE}}} from #tmp_orders o with (nolock)
+ inner join CV3OrderTaskOccurrence oto with (nolock)
+ on o.clientguid = oto.clientguid and o.guid = oto.OrderGUID
+ where oto.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}}
+ and oto.TaskRouteCode like {{{SINGLE-QUOTE}}}%IV%{{{SINGLE-QUOTE}}}
+ and oto.PerformedFromDtm >= DATEADD(hh,-24,GETDATE()) " };
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ WSSessionType := "Standard";
+ WSSessionReason := "";
+ WSRequestedBySource := "Protocol Order";
+
+ EntDefinedColumn_obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
+ with ( client_visit_obj, "Haldol Total");
+
+ WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ProviderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+
+ WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((LocationGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ if ( WSRequestedBy_obj is NOT NULL ) then
+ void:= call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ if ( WSlocation_obj is NOT NULL ) then
+ void:= call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+
+ if ( EntDefinedColumn_obj is NOT NULL) then
+ void := call EntDefinedColumn_obj.Dispose;
+ EntDefinedColumn_obj := null;
+ endif;
+ endcatch;
+
+ reset_taskdose := 0;
+
+ if((Haldol_24hr_Dosage is null) or Haldol_24hr_Dosage = "" or Haldol_24hr_Dosage = 0) then
+ if(taskstatuscode = "Performed") then
+ abcxyz := "step1";
+ Haldol_24hr_Dosage := (taskdose as number);
+ else
+ abcxyz := "step2";
+ Haldol_24hr_Dosage := 0;
+ endif;
+ else
+ if(taskstatuscode = "Performed") then
+ abcxyz := "step3";
+ Haldol_24hr_Dosage := (Haldol_24hr_Dosage as number) + (taskdose as number);
+ else
+ abcxyz := "step4";
+ reset_taskdose := read last { " select taskdose from CV3OrderTaskOccurrence with (nolock)
+ where
+ clientguid = " || sql(ClientGUID)
+ || " and orderguid = " || sql(orderguid)
+ || " and OrderTaskGUID = " || sql(taskguid)
+ || " and guid = " || sql(taskoccuranceguid) };
+ Haldol_24hr_Dosage := (Haldol_24hr_Dosage as number) - (reset_taskdose as number);
+ endif;
+ endif;
+ Haldol_24hr_Dosage := Haldol_24hr_Dosage formatted with "%.2f";
+ ColUpdateValue := "";
+ colUpdate := false;
+ createorders := ();
+ CreateMonitorOrder := false;
+ CreateTransferOrder := false;
+ currentvalue := EntDefinedColumn_obj.Value;
+ FindAstrick := find "*" in string currentvalue;
+ testvale := read last { " select replace(" || sql(currentvalue) || ",char(9),{{{SINGLE-QUOTE}}}--{{{SINGLE-QUOTE}}}) " };
+ FindTS := find "--" in string testvale;
+
+ if((Haldol_24hr_dosage as number) >= 0.00) then
+ colUpdate := true;
+ CurVal := Haldol_24hr_dosage;
+ if((FindAstrick>0) and (taskstatuscode="Performed"))then
+ ColUpdateValue := (CurVal as string) || "*";
+ elseif(FindTS>0) then
+ ColUpdateValue := (CurVal as string) || TS;
+ elseif(((Haldol_24hr_dosage as number) >= 2.00)) then
+ ColUpdateValue := (CurVal as string) || "*";
+ else
+ ColUpdateValue := (CurVal as string);
+ endif;
+
+ if((Haldol_24hr_dosage as number) >= 2.00) then
+
+ (MonitorOrderGUID, TransferOrderGUID) := read last { " select (select guid from cv3order o with (nolock)
+ where o.ClientGUID = " || sql(ClientGUID)
+ || " and o.chartguid = " || sql(ChartGUID)
+ || " and o.clientvisitguid = " || sql(ClientVisitGUID)
+ || " and o.name = ({{{SINGLE-QUOTE}}}Monitor: Cardiac{{{SINGLE-QUOTE}}})
+ and o.orderstatuscode not in ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HISDP{{{SINGLE-QUOTE}}}))
+ ,
+ (select guid from cv3order o with (nolock)
+ where o.ClientGUID = " || sql(ClientGUID)
+ || " and o.chartguid = " || sql(ChartGUID)
+ || " and o.clientvisitguid = " || sql(ClientVisitGUID)
+ || " and o.name = ({{{SINGLE-QUOTE}}}Transfer-Monitored Bed{{{SINGLE-QUOTE}}})
+ and o.orderstatuscode not in ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HISDP{{{SINGLE-QUOTE}}})) " };
+
+ if(MonitorOrderGUID is null) then
+ createorders := createorders, "Monitor: Cardiac";
+ if(Unit in ("5F","5A","5G") and TransferOrderGUID is null) then
+ //void := call create_order with (ClientVisitGUID,UserGuid,ClientGUID,"Standard","Protocol Order","Transfer-Monitored Bed","IV Haloperidol Protocol","Other");
+ createorders := createorders, "Transfer-Monitored Bed";
+ endif;
+ endif;
+ endif;
+ endif;
+
+
+
+
+
+ for x in (1 seqto(count(createorders))) do
+ //order_Name := createorders[x];
+ order_Creation_Reason := "Protocol Order" ;
+ WSRequestedBySource := "Protocol Order";
+ order_Name := createorders[x];
+ try
+ Catalog_Item_Name := createorders[x];
+ order_type := "other";
+ modifier := "";
+ modversion := "";
+
+
+ order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with Catalog_Item_Name;
+
+ GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with client_visit_obj,
+ order_catalog_item,
+ order_Creation_Reason,
+ WSRequestedBy_obj,
+ WSRequestedBySource,
+ WSSessionType,
+ WSSessionReason,
+ WSlocation_obj,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
+
+
+
+ if (Order_catalog_item.Name in ("Monitor: Cardiac","Transfer-Monitored Bed")) then
+ GeneralOrder_obj.SpecialInstructions := "IV Haldol Protocol";
+ GeneralOrder_obj.RequestedTime := "Now";
+ endif;
+
+ if( GeneralOrder_obj is NOT NULL ) then
+ void := call GeneralOrder_Obj.Save;
+ void := call GeneralOrder_Obj.Dispose;
+ endif;
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}New General order:{{-R}}\n" ||
+ ex.Message || "\n\n";
+ endcatch;
+
+ if ( Order_catalog_item is NOT NULL ) then
+ void:= call Order_catalog_item.Dispose;
+ Order_catalog_item:= null;
+ endif;
+ enddo;
+
+ endif;
+ ;;
+ priority: 50
+ ;;
+ evoke:
+
+ any_modified_task;
+ ;;
+ logic:
+
+ if (EvokingObject is null) then
+ conclude false;
+ endif;
+
+ //Boolean to update TICU Status Board column true, continue with logic
+
+ if (colUpdate = true) then
+ try
+
+
+ EntDefinedColumn_obj.Value := ColUpdateValue;
+ void := call EntDefinedColumn_obj.Save;
+ void := call EntDefinedColumn_obj.Dispose;
+ EntDefinedColumn_obj := null;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}Enterprise Patient List Column{{-R}}\n"
+ || ex.message || "\n\n";
+
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+ if (EntDefinedColumn_obj is not null) then
+ void := call EntDefinedColumn_obj.Dispose;
+ EntDefinedColumn_obj := null;
+ endif;
+
+ EDColumn_Dest := null;
+ endcatch;
+
+
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ if ( WSRequestedBy_obj is NOT NULL ) then
+ void:= call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ if ( WSlocation_obj is NOT NULL ) then
+ void:= call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+
+ if ( EntDefinedColumn_obj is NOT NULL) then
+ void := call EntDefinedColumn_obj.Dispose;
+ EntDefinedColumn_obj := null;
+ endif;
+
+ endif;
+
+
+ conclude true;
+
+ ;;
+ action:
+
+ //Error Handling
+ if error_occurred then
+ write "An error occurred in the MLM {{+B}}SCH_CHARTED_HALDOL_24HRS{{-B}} "
+ || " Please notify your system administrator that an error message has "
+ || " occurred for this patient. They will review the following error "
+ || "message:\n" at error_destination;
+ write error_message at error_destination;
+ endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CHART_TASK_CREATE_HEALTHISSUE.mlm b/MLMStripper/bin/Debug/SCH/SCH_CHART_TASK_CREATE_HEALTHISSUE.mlm
new file mode 100644
index 0000000..b9aa4d7
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CHART_TASK_CREATE_HEALTHISSUE.mlm
@@ -0,0 +1,324 @@
+maintenance:
+
+ title: SCH_CHART_TASK_CREATE_HEALTHISSUE;;
+ mlmname: SCH_CHART_TASK_CREATE_HEALTHISSUE;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair Hospital;;
+ author: Eclipsys;;
+ specialist: ;;
+ date: 2010-03-12;;
+ validation: testing;;
+
+library:
+ purpose: Chart a Health Issue Of Pneumococcal When Pneumococcal Vaccine Is Charted
+ Either by the interface (batch) or by the user.
+ Remove a health issue if a task on the same day is reset.
+ ;;
+ explanation: Pneumococcal Initiative
+ Change history
+
+ 09.01.2010 TS Added logic to chart and remove variable vaccines - Diphtheria/Tetanus Toxid, HIB, Hep B,
+ Influenza, Meningococcal, Rubella, and TDAP
+
+ 08.22.2011 DW Major rewrite CSR#26269 - changed Pneumococcal HI code from "2" to "V03.82"
+ 09.20.2011 DW Major rewrite CSR#26486 - changed Influenza HI code from "1" to "V04.81"
+ 01.24.2012 TS Change made to evoke statement to remove the time delay statement that was causing reset of a task
+ or changing a previously charted task to not given to not remove the health issue. HD Ticket 146109
+ 02.08.2012 DW CSR# 26307 - changed TDAP HI code from "4" to "V06.1"
+ 04.04.2012 DW CSR# 26307 - Àdded new Health Issues for ED TDAP project
+ 09.16.2014 TMS CSR# 32748 - Àdded new Catalog Name for Influenza
+ 10.28.2014 STH CSR#: 32776 - Modify the "issuename" to pull from the health manager configuration to match the immunization history
+ name when the ordered item/task is setup to write to health manager and send to state for immunization tracking.
+ 12.16.2015 - CSR #:33655 - Update for Prevnar 13 {Loaded 1.13.2016 ahead of the target go-live date of the product being available}
+ 03.08.2016 - STH CSR#: 33655/ Helpdesk ticket #: - There was a section added to this MLM by GMS that must have been abandoned because it was never moved live.
+ The section was allowing the health issues to create in DEV durning testing; however additional configuration is
+ required in other enviornments for this same logic to work in those enviornments. Reverted the section back to the
+ original logic and the MLM works in all enviornments. Believe the section was a proof of concept for ICD10 that got abandoned.
+ 05.31.2019 - DW CSR# 37676 - 18.4 Changed Interface user logic to Services
+
+ ;;
+ keywords: Charting, Create Health Issue, Remove HealthIssues;
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /* Set to true if logging is needed.*/
+ log_execution_info:= FALSE;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ WhatAmIDoing := "";
+
+
+ any_modified_task:= event {OrderTaskOccurrenceModify
+ Any OrderTaskOccurrence:
+ WHERE TaskName Matches Pattern "Pneumococcal Vaccine Inj (Pneumovax)%"
+ or TaskName Matches Pattern "Pneumococcal 13-Valent Vaccine Inj%"
+ or TaskName Matches Pattern "Influenza Virus Trivalent Vaccine%"
+ or TaskName Matches Pattern "Influenza Virus Vaccine%"
+ or TaskName Matches Pattern "Hepatitis B Virus Vaccine Inj%"
+ or TaskName Matches Pattern "Haemophilus B Conj%"
+ or TaskName Matches Pattern "Diphtheria/Tetanus Toxoid%"
+ or TaskName Matches Pattern "Rubella Vaccine Inj%"
+ or TaskName Matches Pattern "Meningococcal Vaccine Inj%"
+ or TaskName Matches Pattern "Diphtheria, Pertussis, Tetanus Vaccine%" };
+
+/*
+ if called_by_editor then
+ EvokingObject := read last {OrderTaskOccurrence: THIS
+ where TaskName Matches Pattern "Pneumococcal Vaccine Inj (Pneumovax)%" };
+ endif;
+*/
+ NewHealthIssue_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Health Issue Object",
+ rule_number := 2010 ];
+
+ Discontinue_HealthIssue_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object deleted by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Health Issue Object",
+ rule_number := 2040 ];
+
+ client_GUID := read last { ClientInfo: GUID };
+ userguid,user_id :=read last {UserInfo: guid,idcode};
+
+ // obtain the location info
+ TaskName,TaskStatusCode,orderguid ,significantdtm:= read last {OrderTaskOccurrence: TaskName,TaskStatusCode,OrderGUID,SignificantDtm REFERENCING EvokingObject};
+
+ Client_Visit_Guid := read last { " select clientvisitguid from cv3order with (nolock) where guid = " || SQL(orderguid)};
+ (backup_obj) := read last {OrderTaskOccurrence: Backup REFERENCING EvokingObject};
+// new logic to support variable vaccine orders/tasks
+ issuename := "";
+ issuecode := "";
+ if ((taskname matches pattern "Pneumococcal Vaccine Inj%") or (taskname matches pattern "Pneumococcal 13-Valent Vaccine Inj%")) then
+ issuename := "Pneumococcal Vaccine";
+ issuecode := "V03.82";
+ endif;
+ if taskname matches pattern "Influenza Virus Trivalent Vaccine%" then
+ issuename := "Influenza Vaccine";
+ issuecode := "V04.81";
+ endif;
+ if taskname matches pattern "Influenza Virus Vaccine%" then
+ issuename := "Influenza Vaccine";
+ issuecode := "V04.81";
+ endif;
+ if taskname matches pattern "Diphtheria, Pertussis, Tetanus Vaccine%" then
+ issuename := "TDAP- Tetanus,Diptheria, Acellular Pertussis";
+ issuecode := "V06.1";
+ endif;
+ if taskname matches pattern "Hepatitis B Virus Vaccine Inj%" then
+ issuename := "Hepatitis B Vaccine";
+ issuecode := "V05.3";
+ endif;
+ if taskname matches pattern "Rubella Vaccine Inj%" then
+ issuename := "Rubella Vaccine";
+ issuecode := "V04.3";
+ endif;
+ if taskname matches pattern "Haemophilus B Conj%" then
+ issuename := "Haemophilus B Conjugate (HIB) Vaccine";
+ issuecode := "V03.81";
+ endif;
+ if taskname matches pattern "Meningococcal Vaccine Inj%" then
+ issuename := "Meningococcal Vaccine";
+ issuecode := "V03.89";
+ endif;
+ if taskname matches pattern "Diphtheria/Tetanus Toxoid%" then
+ issuename := "Diphtheria/Tetanus Toxoid";
+ issuecode := "V06.5";
+ endif;
+ //Added by STH 10/28/2014 to pull the Immunization Name from Health Manager when there is a CVX Coded added to create the health manager entry for sending to the state.
+ //This same code/logic is used in the SCH_HM_MARK_AS_DONE for creating the health manager entry for the vaccine name given.
+ CodingCVXCode := "HM CVXCode";
+ catalogItemGUID := EvokingObject.CatalogItemTaskGUID;
+ ImmunizationCVXCode := read last {"Select an.Name from CV3AncillaryName an with (nolock) " ||
+ "Where an.MainCatItemGUID = " || SQL(catalogItemGUID) ||
+ " AND an.Active = 1 AND an.CodingStd = " || SQL(CodingCVXCode) };
+
+ if ImmunizationCVXCode is not null and ImmunizationCVXCode <> "" then
+ HMCVXCodeName := read last {"select name from SXAHMVaccineCatalogItem with (nolock) " ||
+ " Where cvxcode = " || sql(ImmunizationCVXCode) ||
+ " and active = 1 " };
+ if HMCVXCodeName is not null and HMCVXCodeName <> "" then
+ issuename := HMCVXCodeName;
+ endif;
+ endif;
+
+
+
+ (bk_TaskName,bk_TaskStatusCode,bk_TouchedBy,bk_TouchedWhen,bk_LatestScheduledDtm,
+ bk_EnteredProviderGUID,bk_PerformedProviderGUID,bk_EnteredDtm,bk_PerformedFromDtm,
+ bk_SignificantDtm,bk_TaskReason,bk_TaskComment,bk_BodySite) :=
+ read last {OrderTaskOccurrence: TaskName,TaskStatusCode,TouchedBy,TouchedWhen,
+ LatestScheduledDtm,EnteredProviderGUID,PerformedProviderGUID,EnteredDtm,
+ PerformedFromDtm,SignificantDtm,TaskReason,TaskComment,BodySite REFERENCING backup_obj};
+ if taskstatuscode = "Performed"
+ then
+ yr := extract year significantdtm;
+ mn := extract month significantdtm;
+ dd := extract day significantdtm;
+ else
+ yr := extract year bk_SignificantDtm;
+ mn := extract month bk_SignificantDtm;
+ dd := extract day bk_SignificantDtm;
+ endif;
+
+ HealthIssueTypeCode := "Vaccine History";
+ delete_healthIssue_GUID, delete_ShortName, delete_dd,delete_mn,delete_yr:= read last
+ { " select GUID,ShortName,OnsetDayNum,OnSetMonthNum,OnSetYearNum from CV3HealthIssueDeclaration with (nolock) " ||
+ " where TypeCode = " || SQL(HealthIssueTypeCode) ||
+ " AND ShortName = " || SQL(issuename) ||
+ " AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} AND ClientGUID = " ||
+ SQL(client_GUID) ||
+ " AND OnSetDayNum = " || SQL(dd) ||
+ " AND OnsetMonthNum = " || SQL(mn) ||
+ " AND OnsetYearNum = " || SQL(yr)
+ } ;
+
+
+
+ ;;
+// evoke: 0 minutes after time of any_modified_task;
+ evoke: any_modified_task;
+
+
+ ;;
+ logic:
+
+ if bk_TaskStatusCode = TaskStatusCode // I.e the status of the task has not changed. So do nothing
+ then
+ conclude false;
+ else // else, let{{{SINGLE-QUOTE}}}s create or remove some health issues.
+
+ /* dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "So the Task Status Code is Changing"
+ || "\nYour task is going from " || bk_TaskStatusCode
+ || "\nTo " || TaskStatusCode
+ ,"Tester","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+*/
+ try
+ //get the .NET version of the Client Visit object. Needed to create new
+ //ObjectsPlus objects
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((Client_Visit_Guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" ||
+ ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ // If the client object cannot be retrieved, do not attempt
+ // to create any ObjectsPlus objects.
+ conclude true;
+ endcatch;
+
+ if ((TaskStatusCode = "Performed") and (not (exists delete_healthIssue_GUID))) // marked as performed
+ // but if already a HI, do nothing.
+ then
+ try
+ //---------------------------------------------------------
+ // New HealthIssue Example
+ //---------------------------------------------------------
+
+ // Type and Code information for creating a new HealthIssue
+ NewHealthIssueHIType := "Vaccine History";
+ NewHealthIssueHICode := issuecode;
+ NewHealthIssueHIScheme := "Vaccine History";
+
+ // Create an instance of a HealthIssue
+ New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue
+ with
+ (client_visit_obj, //ClientVisit
+ NewHealthIssueHIType, // HI Type
+ NewHealthIssueHIScheme, // HI Coding Scheme
+ NewHealthIssueHICode ); // HI Code
+
+ // Set some properties of the healthIssue
+ PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (
+ yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, // Year
+ mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, // Month
+ dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} ); // Day
+
+ New_HealthIssue_obj.OnsetDate := PartialDate_obj;
+
+ extratext := "";
+ if user_id matches pattern "%services"
+ then
+ extratext := "VeriScan";
+ else
+ extratext := "the eMAR";
+ endif;
+
+ New_HealthIssue_obj.Text := "Created via {{{SINGLE-QUOTE}}}Marked as Done{{{SINGLE-QUOTE}}} from " || extratext;
+
+ New_HealthIssue_obj.Name := issuename;
+ NewHealthIssue_dest.ObjectsPlus := New_HealthIssue_obj;
+ endtry;
+ catch exception ex
+ error_occurred := true;
+
+ if ( New_HealthIssue_obj is NOT NULL ) then
+ void:= call New_HealthIssue_obj.Dispose;
+ New_HealthIssue_obj:= null;
+ endif;
+
+ NewHealthIssue_dest := null;
+ endcatch;
+ elseif bk_TaskStatusCode = "Performed"
+ then
+
+ // else you are resting the task that was performed, so take away the Health Issue
+ // Note we already found the related HI by the delete_healthIssue_GUID in the SQL in the Data element
+ try
+ if exists delete_healthIssue_GUID
+ then
+ Discontinue_HealthIssue_Obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ( (delete_healthIssue_GUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ empty := call Discontinue_HealthIssue_Obj.Discontinue;
+ Discontinue_HealthIssue_dest.ObjectsPlus := Discontinue_HealthIssue_Obj;
+ endif;
+ endtry;
+ catch exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}Discontinue HI {{-R}} \n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if (Discontinue_HealthIssue_Obj is not null) then
+ void := call Discontinue_HealthIssue_Obj.Dispose;
+ Discontinue_HealthIssue_Obj := null;
+ endif;
+ Discontinue_HealthIssue_dest := null;
+ endcatch;
+
+ endif;
+ conclude true;
+endif;
+ ;;
+ action:
+ if exists NewHealthIssue_dest then
+ write TRUE at NewHealthIssue_dest;
+ endif;
+
+ if exists Discontinue_HealthIssue_Dest then
+ write TRUE at Discontinue_HealthIssue_Dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CHECK_LAB_ORDERS_HISTORY.mlm b/MLMStripper/bin/Debug/SCH/SCH_CHECK_LAB_ORDERS_HISTORY.mlm
new file mode 100644
index 0000000..3de71b9
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CHECK_LAB_ORDERS_HISTORY.mlm
@@ -0,0 +1,210 @@
+maintenance:
+
+ title: SCH_CHECK_LAB_ORDERS_HISTORY ;;
+ mlmname: SCH_CHECK_LAB_ORDERS_HISTORY ;;
+ arden: version 2.5;;
+ version: 15.3;;
+ institution: ALLSCRIPTS;;
+ author: ANKIT MISTRY;;
+ specialist: ;;
+ date: 2017-09-06;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ enter_order_event_hemoglobin := EVENT { OrderEnter User Order: WHERE NAME = "Hemoglobin A1C" };
+ enter_order_event_LipidPanel := EVENT { OrderEnter User Order: WHERE NAME = "Lipid Panel"};
+ enter_order_event_Hepaptitis_Mayo := EVENT { OrderEnter User Order: WHERE NAME = "Hepatitis C Antibody (Mayo)"};
+ enter_order_event_Hepaptitis_IgG := EVENT { OrderEnter User Order: WHERE NAME = "Hepatitis C Antibody IgG"};
+
+ init_order_event_hemoglobin := EVENT { OrderInit User Order: WHERE NAME = "Hemoglobin A1C" };
+ init_order_event_LipidPanel := EVENT { OrderInit User Order: WHERE NAME = "Lipid Panel"};
+ init_order_event_Hepaptitis_Mayo := EVENT { OrderInit User Order: WHERE NAME = "Hepatitis C Antibody (Mayo)"};
+ init_order_event_Hepaptitis_IgG := EVENT { OrderInit User Order: WHERE NAME = "Hepatitis C Antibody IgG"};
+
+ // Start Modified: 09/25/2017 Keyur
+ Is_Order_Set :=0;
+ Event_Type:=EvokingEventType;
+ IF EXISTS (EVOKINGOBJECT.OrderSetName) THEN
+ Is_Order_Set :=1;
+ ENDIF;
+ // End Modified: 09/25/2017 Keyur
+
+ HemoglobinA1C_OrderName := "Hemoglobin A1C";
+ LipidPanel_OrderName := "Lipid Panel";
+ Hepaptitis_Mayo_OrderName := "Hepatitis C Antibody (Mayo)";
+ Hepaptitis_IgG_OrderName := "Hepatitis C Antibody IgG";
+
+ ClientGUID := EVOKINGOBJECT.ClientGUID;
+ ClientVisitGUID := EVOKINGOBJECT.ClientVisitGUID;
+
+ If EVOKINGOBJECT.Name = HemoglobinA1C_OrderName then
+ // STart Modified: 09/26/2017
+ /*(HemoglobinA1C_EnteredDate,
+ HemoglobinA1C_ResultComponent,
+ HemoglobinA1C_ResultValue) := READ FIRST {" SELECT TOP 1 CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE
+ FROM CV3Order O WITH (NOLOCK)
+ INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.OrderGUID = O.GUID AND BO.ItemName = {{{SINGLE-QUOTE}}}Hemoglobin A1C Percent{{{SINGLE-QUOTE}}}
+ WHERE (O.Entered > GETDATE()-60) AND O.NAME = " || SQL(HemoglobinA1C_OrderName) || " AND O.ClientGUID = " || SQL(ClientGUID) || "
+ ORDER BY O.CreatedWhen DESC "};*/
+ (HemoglobinA1C_EnteredDate,
+ HemoglobinA1C_ResultComponent,
+ HemoglobinA1C_ResultValue) := READ FIRST {" SELECT TOP 1 CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE +{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+BO.UnitOfMeasure "
+ || " FROM CV3CLIENTVISIT CV WITH (NOLOCK) "
+ || " INNER JOIN CV3Order O WITH (NOLOCK) ON O.CLIENTGUID = CV.CLIENTGUID AND O.CHARTGUID = CV.CHARTGUID AND O.ClientVisitGUID = CV.GUID AND O.NAME = {{{SINGLE-QUOTE}}}Hemoglobin A1C{{{SINGLE-QUOTE}}} AND (O.Entered > GETDATE()-60) "
+ || " INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.ClientGUID = O.ClientGUID AND BO.ChartGUID = O.ChartGUID AND BO.OrderGUID = O.GUID AND BO.ItemName = {{{SINGLE-QUOTE}}}Hemoglobin A1C Percent{{{SINGLE-QUOTE}}} "
+ || " WHERE O.ClientGUID = " || SQL(ClientGUID)
+ || " ORDER BY O.CreatedWhen DESC "};
+ // End Modified: 09/26/2017
+ If EXISTS HemoglobinA1C_EnteredDate THEN
+ Hemoglobin_msg := "{{+B}}" || HemoglobinA1C_OrderName || "{{-B}}" || " performed on "|| HemoglobinA1C_EnteredDate ||" with result of {{+R}}"|| HemoglobinA1C_ResultValue ||"{{-R}}.\n"
+ || "60 day interval between testing recommended. If additional testing required, please call Pathology Office at x3800.";
+ HemoglobinExists := 1;
+ ENDIF;
+ EndIf;
+
+ If EVOKINGOBJECT.Name = LipidPanel_OrderName then
+ // Start Modified: 09/26/2017
+ /*(LipidPanel_Entered,LipidPanel_Cholesterol,
+ LipidPanel_Triglycerides,LipidPanel_HDL,
+ LipidPanel_LDL_Calculated,
+ LipidPanel_VLDL_Calculated) := READ FIRST {" SELECT CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE
+ INTO #DATA
+ FROM CV3Order O WITH (NOLOCK)
+ INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.OrderGUID = O.GUID
+ WHERE O.NAME = " || SQL(LipidPanel_OrderName) || " AND O.ClientVisitGUID = " || SQL(ClientVisitGUID) || "
+ ORDER BY O.CreatedWhen DESC
+ SELECT TOP 1 ENTERED,[Cholesterol],[Triglycerides],[HDL],[LDL Calculated],[VLDL Calculated]
+ FROM (SELECT * FROM #DATA) AS [RESULT]
+ PIVOT
+ (
+ MAX(VALUE)
+ FOR ITEMNAME IN ([Cholesterol],[Triglycerides],[HDL],[LDL Calculated],[VLDL Calculated])
+ ) AS PVT
+ ORDER BY ENTERED DESC
+ DROP TABLE #DATA "};*/
+ (LipidPanel_Entered,LipidPanel_Cholesterol,
+ LipidPanel_Triglycerides,LipidPanel_HDL,
+ LipidPanel_LDL_Calculated,
+ LipidPanel_VLDL_Calculated) := READ FIRST {" IF OBJECT_ID({{{SINGLE-QUOTE}}}tempdb.dbo.#DATA{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}U{{{SINGLE-QUOTE}}}) IS NOT NULL DROP TABLE #DATA "
+ || " SELECT CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE,BO.UnitOfMeasure "
+ || " INTO #DATA "
+ || " FROM CV3CLIENTVISIT CV WITH (NOLOCK) "
+ || " INNER JOIN CV3Order O WITH (NOLOCK) ON O.CLIENTGUID = CV.CLIENTGUID AND O.CHARTGUID = CV.CHARTGUID AND O.ClientVisitGUID = CV.GUID AND O.NAME = {{{SINGLE-QUOTE}}}Lipid Panel{{{SINGLE-QUOTE}}} "
+ || " INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.ClientGUID = O.ClientGUID AND BO.ChartGUID = O.ChartGUID AND BO.OrderGUID = O.GUID "
+ || " WHERE CV.GUID = " || SQL(ClientVisitGUID)
+ || " ORDER BY O.CreatedWhen DESC "
+ || " SELECT TOP 1 ENTERED,[Cholesterol]+{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+UnitOfMeasure,[Triglycerides]+{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+UnitOfMeasure,[HDL]+{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+UnitOfMeasure, "
+ || " [LDL Calculated]+{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+UnitOfMeasure,[VLDL Calculated]+{{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}+UnitOfMeasure "
+ || " FROM (SELECT * FROM #DATA) AS [RESULT] "
+ || " PIVOT "
+ || " ( "
+ || " MAX(VALUE) "
+ || " FOR ITEMNAME IN ([Cholesterol],[Triglycerides],[HDL],[LDL Calculated],[VLDL Calculated]) "
+ || " ) AS PVT "
+ || " ORDER BY ENTERED DESC "};
+ // End Modified: 09/26/2017
+
+ If EXISTS LipidPanel_Entered THEN
+ LipidPanel_msg := "{{+B}}" || LipidPanel_OrderName || "{{-B}}" || " already performed this admission " || LipidPanel_Entered ||"\n"
+ || "Cholesterol {{+R}}" || LipidPanel_Cholesterol || "{{-R}}\n"
+ || "Triglycerides {{+R}}" || LipidPanel_Triglycerides || "{{-R}}\n"
+ || "HDL {{+R}}" || LipidPanel_HDL || "{{-R}}\n"
+ || "LDL Calculated {{+R}}" || LipidPanel_LDL_Calculated || "{{-R}}\n"
+ || "VLDL Calculated {{+R}}" || LipidPanel_VLDL_Calculated || "{{-R}}";
+ LipidPanelExists := 1;
+ ENDIF;
+ EndIf;
+
+ If EVOKINGOBJECT.Name IN (Hepaptitis_Mayo_OrderName,Hepaptitis_IgG_OrderName) then
+ (Hepatitis_C_Antibody_Mayo_Entered,
+ Hepatitis_C_Antibody_Mayo_ResultComponent,
+ Hepatitis_C_Antibody_Mayo_ResultValue) := READ FIRST {" SELECT TOP 1 CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE "
+ || " FROM CV3ClientVisit CV WITH (NOLOCK) "
+ || " INNER JOIN CV3Order O WITH (NOLOCK) ON O.ClientGUID = CV.ClientGUID AND O.ChartGUID = CV.ChartGUID AND O.ClientVisitGUID = CV.GUID AND O.NAME = {{{SINGLE-QUOTE}}}Hepatitis C Antibody (Mayo){{{SINGLE-QUOTE}}} "
+ || " INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.ClientGUID = O.ClientGUID AND BO.ChartGUID = O.ChartGUID AND BO.OrderGUID = O.GUID AND BO.ItemName = {{{SINGLE-QUOTE}}}Hepatitis C Antibody Mayo{{{SINGLE-QUOTE}}} "
+ || " WHERE CV.ClientGUID = " || SQL(ClientGUID)
+ || " ORDER BY O.CreatedWhen DESC "};
+//SELECT CONVERT(VARCHAR(20),GETDATE(),110)
+ (Hepatitis_C_Antibody_IgG_Entered,
+ Hepatitis_C_Antibody_IgG_ResultComponent,
+ Hepatitis_C_Antibody_IgG_ResultValue) := READ FIRST {" SELECT TOP 1 CONVERT(VARCHAR(12),O.Entered,110) AS ENTERED,BO.ITEMNAME,BO.VALUE "
+ || " FROM CV3ClientVisit CV WITH (NOLOCK) "
+ || " INNER JOIN CV3Order O WITH (NOLOCK) ON O.ClientGUID = CV.ClientGUID AND O.ChartGUID = CV.ChartGUID AND O.ClientVisitGUID = CV.GUID AND O.NAME = {{{SINGLE-QUOTE}}}Hepatitis C Antibody IgG{{{SINGLE-QUOTE}}} "
+ || " INNER JOIN CV3BasicObservation BO WITH (NOLOCK) ON BO.ClientGUID = O.ClientGUID AND BO.ChartGUID = O.ChartGUID AND BO.OrderGUID = O.GUID AND BO.ItemName = {{{SINGLE-QUOTE}}}Hepatitis C Antibody IgG{{{SINGLE-QUOTE}}} "
+ || " WHERE CV.ClientGUID = " || SQL(ClientGUID)
+ || " ORDER BY O.CreatedWhen DESC "};
+ If EXISTS Hepatitis_C_Antibody_Mayo_Entered then
+ Hepatitis_msg := "{{+B}}" || Hepaptitis_Mayo_OrderName || "{{-B}}" || " performed on " || Hepatitis_C_Antibody_Mayo_Entered || " with result of {{+R}}" || Hepatitis_C_Antibody_Mayo_ResultValue || "{{-R}}.\n"
+ || "If additional Hepatitis C Screening is required, please call Pathology Office at x3800.";
+ HepatitisExists := 1;
+ ElseIf EXISTS Hepatitis_C_Antibody_IgG_Entered then
+ Hepatitis_msg := "{{+B}}" || Hepaptitis_IgG_OrderName || "{{-B}}" || " performed on " || Hepatitis_C_Antibody_IgG_Entered || " with result of {{+R}}" || Hepatitis_C_Antibody_IgG_ResultValue || "{{-R}}.\n"
+ || "If additional Hepatitis C Screening is required, please call Pathology Office at x3800.";
+ HepatitisExists := 1;
+ EndIf;
+ EndIf;
+
+ Order_Alert := DESTINATION {Alert} WITH
+ [
+ alert_type := "WARNING",
+ Short_Message := "Duplicate Order",
+ Priority := "High",
+ send_with_order := "",
+ Alert_Dialog_Settings := "No Override Allowed"
+ ];
+
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ enter_order_event_hemoglobin;
+ enter_order_event_LipidPanel;
+ enter_order_event_Hepaptitis_Mayo;
+ enter_order_event_Hepaptitis_IgG;
+
+ init_order_event_hemoglobin;
+ init_order_event_LipidPanel;
+ init_order_event_Hepaptitis_Mayo;
+ init_order_event_Hepaptitis_IgG;
+ ;;
+ logic:
+ // Start Modified: 09/25/2017
+ //CONCLUDE TRUE;
+ if Is_Order_Set=1 and Event_Type="OrderEnter" then
+ CONCLUDE TRUE;
+ endif;
+ if Is_Order_Set=0 and Event_Type="OrderInit" then
+ CONCLUDE TRUE;
+ endif;
+ // End Modified: 09/25/2017
+ ;;
+ action:
+ IF HemoglobinExists = 1 THEN
+ WRITE Hemoglobin_msg AT Order_Alert;
+ ENDIF;
+
+ IF LipidPanelExists = 1 THEN
+ WRITE LipidPanel_msg AT Order_Alert;
+ ENDIF;
+
+ IF HepatitisExists = 1 THEN
+ WRITE Hepatitis_msg AT Order_Alert;
+ ENDIF;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CHF_HEALTHISSUE_NURSING_ORDER_WEIGHT.mlm b/MLMStripper/bin/Debug/SCH/SCH_CHF_HEALTHISSUE_NURSING_ORDER_WEIGHT.mlm
new file mode 100644
index 0000000..96c7abf
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CHF_HEALTHISSUE_NURSING_ORDER_WEIGHT.mlm
@@ -0,0 +1,168 @@
+maintenance:
+
+ title: SCH_CHF_HealthIssue_Nursing_Order_Weight ;;
+ filename: SCH_CHF_HealthIssue_Nursing_Order_Weight ;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair;;
+ author: Shivprasad Jadhav;;
+ specialist: Shivprasad Jadhav, Allscripts Corp.;;
+ date: 2015-10-05;;
+ validation: testing;;
+
+library:
+ purpose: Automate order for a daily weight whenever a diagnosis or health issue of heart failure is noted on chart at any time.
+ On Admission if patient has a diagnosis of Heart Failure or Congestive Heart Failure ( or listed as CHF) or the same as a listing in health issues at any time,
+ create an automatic order "Weight" with the schedule of daily._
+ ;;
+ explanation: Do not allow a user, unless they are a doctor to enter non coded health issue
+
+ Change History
+
+ 10.05.2015 SJ CSR# 33556 - Created MLM
+ 12.03.2019 DW CSR# 38825 - Update Nursing View on Inpatient Status Board (change Weight order to Daily Weight)
+
+ ;;
+ keywords: Transfer
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ /* Change the message within the quotes if a different short-message is needed.*/
+ //health_alert:= destination { Alert: warning, "Health Issue Entered", high, chart,
+ // "Health Issue", 7005, send_alert, "No Override Allowed" };
+
+ Health_Issue:= event{HealthIssueEnter Any HealthIssue: Where (ShortName matches pattern "%CHF%" OR ShortName matches pattern "%Heart Failure%") };
+ /***************************************************************************************/
+
+ (guid, shortname):= read last {HealthIssue: codedhealthissueguid , shortname REFERENCING EvokingObject};
+ ( careProvider_obj ) := read last{ UserInfo: careProvider };
+ ( careProvider_Actaul ) := read last{ UserInfo: This };
+
+ Care_Provider := careprovider_obj.GUID ; //EVOKINGOBJECT.AuthoredProviderGUID;
+ visitGuid := EVOKINGOBJECT.ClientVisitGUID ;
+ (Typecode, Username ) := Read first {" Select Typecode, DisplayName from CV3CareProvider Where GUID = " || Care_Provider || " "} ;
+ location_guid := Read First {" Select CurrentLocationGUID from CV3ClientVisit Where GUID = " || visitGuid || " "} ;
+
+
+
+ GeneralOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ order_Creation_Reason := "Created by MLM";
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+
+ IF(visitGuid IS NOT NULL) THEN
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ WSSessionType := "Standard";//"Inpatient Orders";//Standard";//"
+ WSSessionReason := "";
+ WSRequestedBySource := "";//"1 Standard";
+ WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( Care_Provider as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+ WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ if ( WSRequestedBy_obj is NOT NULL ) then
+ void:= call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ if ( WSlocation_obj is NOT NULL ) then
+ void:= call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+
+ endcatch;
+ ENDIF;
+
+ if (client_visit_obj is not null) then
+ try
+
+ Catalog_Item_Name := "Weight Daily";
+ order_Creation_Reason := "Order Created From MLM";
+
+ // get OrderCatalogMasterItem ObjectsPlus object
+ General_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
+ GeneralOrder_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ General_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // CreateReason
+ wsRequestedBy_obj, // RequestedBy ObjectsPlus object
+ wsRequestedBySource, // string RequestedBySource (must be in dictionary)
+ wsSessionType, // string SessionType
+ wsSessionReason, // string SessionReason
+ wslocation_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
+
+ // GeneralOrder_obj.Frequency:= "Daily" ; /* removed 12/03/2019 */
+ //local_session.SessionRequestBed := Null ;
+ //void := DiagnosticOrder_obj.save;
+
+ GeneralOrder_dest.ObjectsPlus := GeneralOrder_obj;
+ void := call GeneralOrder_obj.save; ///To Save The Order To SCM
+
+ endtry;
+ catch Exception ex
+
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New general order:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( Catalog_Item_Name is NOT NULL ) then
+ void:= call Catalog_Item_Name.Dispose;
+ Catalog_Item_Name:= null;
+ endif;
+
+ if ( GeneralOrder_obj is NOT NULL ) then
+ void:= call GeneralOrder_obj.Dispose;
+ GeneralOrder_obj:= null;
+ endif;
+
+ endcatch;
+ ENDIF;
+
+ ;;
+ evoke: Health_Issue;
+ ;;
+ logic:
+ // conclude true;
+ conclude True;
+
+ ;;
+ action:
+ //write Stop_Message at health_alert;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CITALOPRAM_MEDICATION_ALERTS.mlm b/MLMStripper/bin/Debug/SCH/SCH_CITALOPRAM_MEDICATION_ALERTS.mlm
new file mode 100644
index 0000000..a2f25d3
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CITALOPRAM_MEDICATION_ALERTS.mlm
@@ -0,0 +1,508 @@
+maintenance:
+
+ title: SCH_CITALOPRAM_MEDICATION_ALERTS;;
+ mlmname: SCH_CITALOPRAM_MEDICATION_ALERTS;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: St Clair;;
+ author: Juliet M. Johns, Allscripts Corp;;
+ specialist: Juliet M. Johns;;
+ date: 2015-11-10;;
+ validation: testing;;
+
+library:
+ purpose: Statin Medication Alerts
+ ;;
+
+ explanation: MLM will read user dictionary table and display alerts based on citalopram drug interaction conflicts.
+
+ Change history
+ 11.10.2015 JML CSR 33122: Created.
+ 12.22.2015 JML Moved to Production.
+
+ ;;
+ keywords: citalopram, drug, alerts
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Additional include MLMs
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ create_aoa_object := MLM {{{SINGLE-QUOTE}}}STD_Func_Create_Alert_Action_Object{{{SINGLE-QUOTE}}};
+
+ //Formatting constants
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+ messageA := SP;
+ messageB := SP;
+ messageC := SP;
+
+ //Variable Declaration
+ send_alert := "DoNotSend"; //Send message or not
+ error_occurred := false; //Error handler
+ error_message := ""; //Error message
+
+ log_execution_info := false;
+
+ rule_matches := false;
+ do_alert := false;
+ found_unsubmitted_meds := false;
+ found_existing_meds := false;
+ ordered_citalopram := false;
+ aa_lst := ();
+ msg_string := "";
+ alert_msg_lst := ();
+
+ //Debug via MLM editor
+ if called_by_editor then
+ EvokingObject := read last {Order: THIS
+ where Name="Esomeprazole 20mg DR Cap" };
+ endif;
+
+ //Citalopram list of drug interactions to alert on
+ citalopram_conflict_list := ("A|Citalopram|20|mg|>|esomeprazole|mg",
+ "A|Citalopram|20|mg|>|omeprazole|mg",
+ "A|Citalopram|20|mg|>|lansoprazole|mg",
+ "B|Citalopram|20|mg|>|oxcarbazepine|mg",
+ "B|Citalopram|20|mg|>|letrozole|mg",
+ "C|Citalopram|20|mg|>|fluconazole|mg",
+ "C|Citalopram|20|mg|>|voriconazole|mg",
+ "D|Citalopram|20|mg|>|modafinil|mg",
+ "D|Citalopram|20|mg|>|fluvoxamine|mg",
+ "D|Citalopram|20|mg|>|isoniazid|mg");
+
+ citalopram_order_enter := event { OrderEnter User Order : where TypeCode = "Medication" };
+
+ citalopram_alert_dest := destination {alert} with
+ [alert_type := "Warning",
+ short_message := "Citalopram Medication Alert",
+ priority := "low",
+ scope := "Chart",
+ rule_group := "Citalopram Meds",
+ rule_number := 4056,
+ send_with_order := send_alert,
+ alert_dialog_settings := "",
+ display_alert := true];
+
+ //Retrieve values from evoking object
+ (client_guid, chart_guid, visit_guid,
+ evoking_orderName, evoking_orderGUID,
+ evoking_significantDtm, catalog_item_obj,
+ ordered_uomValue, ordered_doseValue) := READ LAST { Order : ClientGUID, ChartGUID, ClientVisitGUID, Name, GUID, SignificantDtm,
+ OrderCatalogMasterItem, UOM, DosageLow
+ REFERENCING EvokingObject };
+
+ (catalog_classTypeValueObj,
+ evoking_orderCatalogMasterItemGUID) := READ LAST { OrderCatalogMasterItem : CatalogClassTypeValue, GUID
+ REFERENCING catalog_item_obj };
+
+ //Retrieve initial medications involved in citalopram custom user list
+ (classTypeValue_codeList, classTypeValue_valueList) := read { CatalogClassTypeValue : Code, Value
+ REFERENCING catalog_classTypeValueObj WHERE code = "PRX_Citalopram_Medications" };
+
+ //Parse the medications involved in the citalopram custom user list
+ class_valueList := call str_parse WITH classTypeValue_valueList[1], ",";
+ class_value := class_valueList[1];
+
+ //Ordered med exists in the citalopram custom user list
+ if ( class_value is not null ) then
+
+ //Citalopram ordered
+ if ( class_value matches pattern "citalopram%" ) then
+
+ ordered_citalopram := true;
+
+ //Retrieve list of unsubmitted orders that conflict with citalopram
+ (unsub_med_list,
+ unsub_med_dose,
+ unsub_med_uom,
+ unsub_oGUID,
+ unsub_oCatGUID) := READ { Unsubmitted Order : Name, DosageLow, UOM, GUID, OrderCatalogMasterItemGUID
+ WHERE ( ( Name matches pattern "esomeprazole%" AND UOM = "mg" )
+ OR ( Name matches pattern "omeprazole%" AND UOM = "mg" )
+ OR ( Name matches pattern "lansoprazole%" AND UOM = "mg" )
+ OR ( Name matches pattern "oxcarbazepine%" AND UOM = "mg" )
+ OR ( Name matches pattern "letrozole%" AND UOM = "mg" )
+ OR ( Name matches pattern "fluconazole%" AND UOM = "mg" )
+ OR ( Name matches pattern "voriconazole%" AND UOM = "mg" )
+ OR ( Name matches pattern "modafinil%" AND UOM = "mg" )
+ OR ( Name matches pattern "fluvoxamine%" AND UOM = "mg" )
+ OR ( Name matches pattern "isoniazid%" AND UOM = "mg" ) ) };
+
+ if ( exists unsub_med_list ) then
+ found_unsubmitted_meds := true;
+ endif;
+
+ //Now check for existing meds
+ (existing_meds_list,
+ existing_meds_name,
+ existing_meds_dose,
+ existing_meds_UOM,
+ existing_order_guid,
+ existing_order_oCat_guid ) := READ {"SELECT CASE WHEN CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) = 0 THEN LEFT(o.NAME, LEN(o.NAME) - 1)"
+ || " WHEN CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) > 0 THEN LEFT(o.Name, (CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) - 1))"
+ || " ELSE o.Name END, o.Name, ot.OrderDosageLow, ot.OrderUom, o.GUID, o.OrderCatalogMasterItemGUID"
+ || " 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 CV3OrderAddnlInfo oai WITH (NOLOCK)"
+ || " ON o.GUID = oai.GUID"
+ || " JOIN CV3OrderTask ot WITH (NOLOCK)"
+ || " ON o.GUID = ot.OrderGUID"
+ || " WHERE cv.ClientGUID = " || SQL(EvokingObject.ClientGUID)
+ || " AND cv.GUID = " || SQL(EvokingObject.ClientVisitGUID)
+ || " AND cv.ChartGUID = " || SQL(EvokingObject.ChartGUID)
+ || " AND ((o.Name LIKE {{{SINGLE-QUOTE}}}esomeprazole%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
+ || " OR (o.Name like {{{SINGLE-QUOTE}}}omeprazole%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
+ || " OR (o.Name LIKE {{{SINGLE-QUOTE}}}lansoprazole%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
+ || " OR (o.Name LIKE {{{SINGLE-QUOTE}}}oxcarbazepine%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
+ || " OR (o.Name LIKE {{{SINGLE-QUOTE}}}letrozole%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
+ || " OR ( o.Name LIKE {{{SINGLE-QUOTE}}}fluconazole%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
+ || " OR (o.Name LIKE {{{SINGLE-QUOTE}}}voriconazole%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
+ || " OR (o.Name LIKE {{{SINGLE-QUOTE}}}modafinil%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
+ || " OR (o.Name LIKE {{{SINGLE-QUOTE}}}fluvoxamine%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
+ || " OR (o.Name LIKE {{{SINGLE-QUOTE}}}isoniazid%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}}))"
+ || " AND ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
+
+ if ( exists existing_meds_list ) then
+ found_existing_meds := true;
+ endif;
+
+ if ( exists existing_meds_list OR exists unsub_med_list ) then
+ rule_matches := true;
+ endif;
+
+ else
+ //Ordered med was not citalopram; look for unsubmitted order
+ (unsub_citalopram_list,
+ unsub_citalopram_dose,
+ unsub_citalopram_uom,
+ unsub_citalopram_oGuid,
+ unsub_citalopram_oCatGuid) := READ { Unsubmitted Order : Name, DosageLow, UOM, Guid, OrderCatalogMasterItemGUID
+ WHERE Name matches pattern "citalopram%" AND UOM = "mg" };
+
+ if ( exists unsub_citalopram_list ) then
+ found_unsubmitted_meds := true;
+ endif;
+
+ //Check patient{{{SINGLE-QUOTE}}}s chart for existing citalopram order
+ (existing_citalopram_list,
+ existing_citalopram_med,
+ existing_citalopram_dose,
+ existing_citalopram_uom,
+ existing_citalopram_oGuid,
+ existing_citalopram_oCatGuid) := READ {"SELECT LEFT(o.Name, (CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) - 1)), o.Name, ot.OrderDosageLow, ot.OrderUom, o.GUID, o.OrderCatalogMasterItemGUID"
+ || " 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 CV3OrderAddnlInfo oai WITH (NOLOCK)"
+ || " ON o.GUID = oai.GUID"
+ || " JOIN CV3OrderTask ot WITH (NOLOCK)"
+ || " ON o.GUID = ot.OrderGUID"
+ || " WHERE cv.ClientGUID = " || SQL(EvokingObject.ClientGUID)
+ || " AND cv.GUID = " || SQL(EvokingObject.ClientVisitGUID)
+ || " AND cv.ChartGUID = " || SQL(EvokingObject.ChartGUID)
+ || " AND (o.Name LIKE {{{SINGLE-QUOTE}}}citalopram%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
+ || " AND ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
+
+ if ( exists existing_citalopram_list ) then
+ found_existing_meds := true;
+ endif;
+
+ if ( exists existing_citalopram_list OR exists unsub_citalopram_list ) then
+ rule_matches := true;
+ endif;
+
+ endif; //End ordered med = citalopram
+
+ if ( rule_matches ) then
+
+ //Loop through citalopram conflict list
+ for i in ( 1 seqto ( count citalopram_conflict_list ) ) do
+ citalopram_rule := call str_parse with citalopram_conflict_list[i], "|";
+
+ rule_class_type := citalopram_rule[1]; //Class Type
+ rule_med := citalopram_rule[2]; //Citalopram med
+ rule_dose := citalopram_rule[3]; //Citalopram dose
+ rule_uom := citalopram_rule[4]; //citalopram uom
+ rule_op := citalopram_rule[5]; //operation for citalopram
+ rule_conflict := citalopram_rule[6]; //Med that conflicts with citalopram
+ rule_conflict_uom := citalopram_rule[7]; //Med uom that conflicts with citalopram
+
+ //Ordered med = citalopram
+ if ( ordered_citalopram ) then
+
+ //does ordered med = appropriate rule
+ if ( rule_med = class_value ) then
+ if ( rule_op = ">" ) then
+ rule_matches := ( (ordered_doseValue as number) > (rule_dose as number) );
+ rule_matches := ( rule_matches AND ( (ordered_uomValue as string) = (rule_uom as string) ) );
+ else
+ rule_matches := false;
+ endif;
+
+ if ( rule_matches ) then
+
+ if ( found_unsubmitted_meds ) then
+ //Conflict med in my unsubmitted order list
+ for k in (1 seqto ( count unsub_med_list )) do
+ found := FIND LOWERCASE rule_conflict IN STRING LOWERCASE unsub_med_list[k] STARTING AT 1;
+
+ if ( (found as number) = 1 ) then
+ if ( rule_conflict_uom = unsub_med_uom[k] ) then
+ do_alert := true;
+
+ msg_string := "Due to increased risk of QT prolongation, please lower {{+B}}{{+R}}" || rule_med
+ || "{{-R}}{{-B}} to " || rule_dose || rule_uom || " or change {{+B}}{{+R}}" || rule_conflict
+ || "{{-R}}{{-B}}";
+
+ if ( rule_class_type = "A" ) then
+ msg_string := msg_string || " to another PPI such as pantoprazole.";
+ elseif ( rule_class_type = "B" ) then
+ msg_string := msg_string || " to an alternative agent, if clinically appropriate.";
+ elseif ( rule_class_type = "C" ) then
+ msg_string := msg_string || " to an alternative antifungal.";
+ elseif ( rule_class_type = "D" ) then
+ msg_string := msg_string || " to an alternative agent.";
+ endif;
+
+ alert_msg_lst := alert_msg_lst, msg_string;
+
+ alert_action := call create_aoa_object WITH "CV3Order", "CV3Order";
+ alert_action.EvokingEnterpriseItemID := evoking_orderCatalogMasterItemGUID;
+ alert_action.EvokingObjectID := evoking_orderGUID;
+ alert_action.ObjectName := evoking_orderName;
+ alert_action.ActionItemStatus := "Unsubmitted";
+ alert_action.ActionEvent := "DC-Cancel";
+ alert_action.ActionItemID := unsub_oGuid[k];
+ alert_action.ActionItemName := unsub_med_list[k];
+ alert_action.ActionEnterpriseItemID := unsub_oCatGUID[k];
+ alert_action.MLMName := "SCH_CITALOPRAM_MEDICATION_ALERTS";
+ alert_action.ShortMessage := "This is the UNSUBMITTED Medication to DC-Cancel. This medication conflicts with the Citalopram you are trying to order.";
+
+ aa_lst := aa_lst, alert_action;
+ endif;
+ endif;
+ enddo;
+ endif;
+
+ if ( found_existing_meds ) then
+ //Conflict med in existing med list
+ if ( rule_conflict IN existing_meds_list AND rule_conflict_uom IN existing_meds_uom ) then
+
+ //Loop through existing conflict medications
+ for j IN ( 1 seqto ( count existing_meds_list ) ) do
+ if ( rule_conflict = existing_meds_list[j] ) then
+ do_alert := true;
+
+ msg_string := "Due to increased risk of QT prolongation, please lower {{+B}}{{+R}}" || rule_med
+ || "{{-R}}{{-B}} to " || rule_dose || rule_uom || " or change {{+B}}{{+R}}" || rule_conflict
+ || "{{-R}}{{-B}}";
+
+ if ( rule_class_type = "A" ) then
+ msg_string := msg_string || " to another PPI such as pantoprazole.";
+ elseif ( rule_class_type = "B" ) then
+ msg_string := msg_string || " to an alternative agent, if clinically appropriate.";
+ elseif ( rule_class_type = "C" ) then
+ msg_string := msg_string || " to an alternative antifungal.";
+ elseif ( rule_class_type = "D" ) then
+ msg_string := msg_string || " to an alternative agent.";
+ endif;
+
+ alert_msg_lst := alert_msg_lst, msg_string;
+
+ alert_action := call create_aoa_object WITH "CV3Order","CV3Order";
+ alert_action.EvokingEnterpriseItemID := evoking_orderCatalogMasterItemGUID;
+ alert_action.EvokingItemID := evoking_orderGUID;
+ alert_action.ObjectName := evoking_orderName;
+ alert_action.ActionItemStatus := "Existing";
+ alert_action.ActionEvent := "DC-Cancel";
+ alert_action.ActionItemID := existing_order_guid[j];
+ alert_action.ItemName := existing_meds_name[j];
+ alert_action.ActionEnterpriseItemID := existing_order_oCat_guid[j];
+ alert_action.MLMName := "SCH_CITALOPRAM_MEDICATION_ALERTS";
+ alert_action.ShortMessage := "This is the EXISTING Medication to DC-Cancel. This medication conflicts with the Citalopram you are trying to order.";
+
+ aa_lst := aa_lst, alert_action;
+ endif;
+ enddo;
+ endif;
+
+ endif; //end found_unsubmitted_meds = true
+ endif;
+
+ endif; // end rule_med = class_value
+
+ //Ordered med NOT citalopram
+ else
+
+ if ( rule_conflict = class_value AND rule_conflict_uom = ordered_uomValue ) then
+
+ if ( found_unsubmitted_meds ) then
+
+ for m IN ( 1 seqto (count unsub_citalopram_list) ) do
+
+ found := FIND LOWERCASE rule_med IN STRING LOWERCASE unsub_citalopram_list[m] STARTING AT 1;
+
+ if ( (found as number) <> 0 ) then
+
+ if ( rule_op = ">" ) then
+ rule_matches := ( (unsub_citalopram_dose[m] as number) > (rule_dose as number) );
+ rule_matches := ( rule_matches AND ( (unsub_citalopram_uom[m] as string) = (rule_uom as string) ) );
+ else
+ rule_matches := false;
+ endif;
+
+ if ( rule_matches ) then
+
+ do_alert := true;
+
+ msg_string := "Due to increased risk of QT prolongation, please lower {{+B}}{{+R}}" || rule_med
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || rule_dose || rule_uom
+ || "{{-R}}{{-B}} or change {{+B}}{{+R}}" || rule_conflict || "{{-R}}{{-B}}";
+
+ if ( rule_class_type = "A" ) then
+ msg_string := msg_string || " to another PPI such as pantoprazole.";
+ elseif ( rule_class_type = "B" ) then
+ msg_string := msg_string || " to an alternative agent, if clinically appropriate.";
+ elseif ( rule_class_type = "C" ) then
+ msg_string := msg_string || " to an alternative antifungal.";
+ elseif ( rule_class_type = "D" ) then
+ msg_string := msg_string || " to an alternative agent.";
+ endif;
+
+ alert_msg_lst := alert_msg_lst, msg_string;
+
+ alert_action := call create_aoa_object WITH "CV3Order","CV3Order";
+ alert_action.EvokingEnterpriseItemID := evoking_orderCatalogMasterItemGUID;
+ alert_action.EvokingObjectID := evoking_orderGUID;
+ alert_action.EvokingObjectName := evoking_orderName;
+ alert_action.ActionItemStatus := "Unsubmitted";
+ alert_action.ActionEvent := "DC-Cancel";
+ alert_action.ActionItemID := unsub_citalopram_oGuid[m];
+ alert_action.ActionItemName := unsub_citalopram_list[m];
+ alert_action.ActionEnterpriseItemID := unsub_citalopram_oCatGuid[m];
+ alert_action.MLMName := "SCH_CITALOPRAM_MEDICATION_ALERTS";
+ alert_action.ShortMessage := "This is the UNSUBMITTED citalopram order to DC-Cancel. Citalopram conflicts with the medication that you are trying to order.";
+
+ aa_lst := aa_lst, alert_action;
+
+ endif;
+
+ endif;
+
+ enddo;
+
+ endif;
+
+ if ( found_existing_meds ) then
+
+ //No unsubmitted citalopram; check patient{{{SINGLE-QUOTE}}}s chart
+ if ( rule_med IN existing_citalopram_list ) then
+
+ for l IN ( 1 seqto (count existing_citalopram_list) ) do
+
+ if ( rule_op = ">" ) then
+ rule_matches := ( (existing_citalopram_dose[l] as number) > (rule_dose as number) );
+ rule_matches := ( rule_matches AND ( (existing_citalopram_uom[l] as string) = (rule_uom as string) ) );
+ else
+ rule_matches := false;
+ endif;
+
+ if (rule_matches) then
+ do_alert := true;
+
+ msg_string := "Due to increased risk of QT prolongation, please lower {{+B}}{{+R}}" || rule_med
+ || "{{-R}}{{-B}} to {{+B}}{{+R}}" || rule_dose || rule_uom
+ || "{{-R}}{{-B}} or change {{+B}}{{+R}}" || rule_conflict || "{{-R}}{{-B}}";
+
+ if ( rule_class_type = "A" ) then
+ msg_string := msg_string || " to another PPI such as pantoprazole.";
+ elseif ( rule_class_type = "B" ) then
+ msg_string := msg_string || " to an alternative agent, if clinically appropriate.";
+ elseif ( rule_class_type = "C" ) then
+ msg_string := msg_string || " to an alternative antifungal.";
+ elseif ( rule_class_type = "D" ) then
+ msg_string := msg_string || " to an alternative agent.";
+ endif;
+
+ alert_msg_lst := alert_msg_lst, msg_string;
+
+ alert_action := call create_aoa_object WITH "CV3Order","CV3Order";
+ alert_action.EvokingEnterpriseItemID := evoking_orderCatalogMasterItemGUID;
+ alert_action.EvokingItemID := evoking_orderGUID;
+ alert_action.EvokingObjectName := evoking_orderName;
+ alert_action.ActionItemStatus := "Existing";
+ alert_action.ActionEvent := "DC-Cancel";
+ alert_action.ActionItemID := existing_citalopram_oGuid[l];
+ alert_action.ActionItemName := existing_citalopram_med[l];
+ alert_action.ActionEnterpriseItemID := existing_citalopram_oCatGUID[l];
+ alert_action.MLMName := "SCH_CITALOPRAM_MEDICATION_ALERTS";
+ alert_action.ShortMessage := "This is the EXISTING citalopram medication to DC-Cancel. Citalopram conflicts with the medication that you are trying to order.";
+
+ aa_lst := aa_lst, alert_action;
+
+ endif;
+
+ enddo;
+
+ endif;
+
+ endif;
+
+ endif; //End rule_conflict = class_value
+
+ endif; //End ordered_citalopram = true
+ enddo; //End looping through existing meds
+ endif; //end rule_matches
+
+ endif; //End class_value is not null
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ citalopram_order_enter;
+ ;;
+ logic:
+ conclude do_alert;
+ ;;
+ action:
+
+ if ( do_alert ) then
+
+ final_msg := "";
+
+ for i IN (1 seqto count alert_msg_lst ) do
+ if ( final_msg = "" ) then
+ final_msg := alert_msg_lst[i];
+ else
+ final_msg := final_msg || "\n\n" || alert_msg_lst[i];
+ endif;
+ enddo;
+
+ write final_msg at citalopram_alert_dest;
+
+ attach aa_lst to citalopram_alert_dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CODE_STATUS_DEFAULT_COMMENT.mlm b/MLMStripper/bin/Debug/SCH/SCH_CODE_STATUS_DEFAULT_COMMENT.mlm
new file mode 100644
index 0000000..af1bfd4
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CODE_STATUS_DEFAULT_COMMENT.mlm
@@ -0,0 +1,174 @@
+maintenance:
+
+ title: SCH_CODE_STATUS_DEFAULT_COMMENT;;
+ filename: SCH_CODE_STATUS_DEFAULT_COMMENT;;
+ arden: version 2.50;;
+ version: 16.3;;
+ institution: St. Clair Hospital;;
+ author: Juliet Law;;
+ specialist: Peggy Leschak;;
+ date: 2017-11-22;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will modify the Code Status comment IF "Ethically Unable to Determine" order exists on patient.
+
+ ;;
+ explanation: When a code status order is placed on a patient, the interface boomerangs a comment back into SCM so the CPR and Code Status
+ verbiage is visible in the patient header. If "Ethically Unable to Determine" order is included in the code status orders
+ for the patient, the patient header needs to display "(Default)" next to the code status verbiage so physicians have an
+ indicator that this order exists.
+
+ This MLM will trigger when the interface enters the Code Status comment and update the verbiage if the "Ethically Unable to Determine"
+ order exists.
+
+ Change History
+
+ 11.22.2017 JML CSR 26413: Created
+
+ ;;
+ keywords: Code Status, Patient Comment
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ log_execution_info:= false;
+ continueProcessing := false;
+
+ order_enter_event := EVENT { OrderEnter User Order : WHERE Name = "Code Status: Ethically unable to determine" };
+ order_dc_event := EVENT { OrderDiscontinue User Order : WHERE Name = "Code Status: Ethically unable to determine" };
+
+ ( ClientVisitGUID, ChartGUID, ClientGUID ):= read last { Order : ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject };
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1003,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ if ( EvokingEvent = order_dc_event ) then
+
+ //Retrieve GUID for patient header comment
+ discontinueCommentTypeCode := "Code Status Default";
+ discontinue_Comment_GUID := read last { "select GUID from CV3CommentDeclaration "
+ || "where TypeCode = " || SQL(discontinueCommentTypeCode)
+ || " AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} AND ClientGUID = " || SQL(ClientGUID) } ;
+ endif;
+ ;;
+ evoke:
+ order_enter_event;
+ order_dc_event;
+ ;;
+ logic:
+
+ try
+ if ( EvokingEvent = order_enter_event ) then
+
+ ClientVisit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( ClientVisitGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+
+ CodeStatus_Comment_obj := call {{{SINGLE-QUOTE}}}PatientComment{{{SINGLE-QUOTE}}}.CreatePatientComment WITH ( ClientVisit_obj, "Code Status Default" );
+
+ CodeStatus_Comment_obj.Text := "(Default)";
+
+ void := call CodeStatus_Comment_obj.Save;
+ endif;
+
+ //Destroy object
+ if ( CodeStatus_Comment_obj is NOT NULL ) then
+ void := call CodeStatus_Comment_obj.Dispose;
+ CodeStatus_Comment_obj := null;
+ endif;
+
+ if ( ClientVisit_obj IS NOT NULL ) then
+ void := call ClientVisit_obj.Dispose;
+ ClientVisit_obj := null;
+ endif;
+
+ endtry;
+
+ catch exception ex
+
+ error_occurred := true;
+ error_message := "{{+R}}New Comment:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if (CodeStatus_Comment_obj is NOT NULL ) then
+ void:= call CodeStatus_Comment_obj.Dispose;
+ CodeStatus_Comment_obj:= null;
+ endif;
+
+ if ( ClientVisit_obj IS NOT NULL ) then
+ void := call ClientVisit_obj.Dispose;
+ ClientVisit_obj := null;
+ endif;
+
+ endcatch;
+
+ try
+ if ( EvokingEvent = order_dc_event AND exists discontinue_Comment_GUID ) then
+
+ CodeStatus_DiscontinueComment_obj := call {{{SINGLE-QUOTE}}}PatientComment{{{SINGLE-QUOTE}}}.FindByPrimaryKey WITH ( ( discontinue_Comment_GUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+
+ void := call CodeStatus_DiscontinueComment_obj.Discontinue;
+
+ void := call CodeStatus_DiscontinueComment_obj.Save;
+
+ endif;
+
+ //Destroy object
+ if ( CodeStatus_DiscontinueComment_obj IS NOT NULL ) then
+ void := call CodeStatus_DiscontinueComment_obj.Dispose;
+ CodeStatus_DiscontinueComment_obj := null;
+ endif;
+
+ endtry;
+
+ catch exception ex
+
+ error_occurred := true;
+
+ error_message := "{{+R}}New Comment:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if ( CodeStatus_DiscontinueComment_obj IS NOT NULL ) then
+ void := call CodeStatus_DiscontinueComment_obj.Dispose;
+ CodeStatus_DiscontinueComment_obj := null;
+ endif;
+
+ endcatch;
+
+ conclude true;
+ ;;
+ action:
+
+ // write " Messages version 1.2 " at alert_dest;
+
+ if Error_occurred then
+
+ write "An error has occured in the MLM {{+B}}SCH_CODE_STATUS_DEFAULT_COMMENT{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+
+ write error_message at error_destination;
+
+ endif;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_COSIGNATURE_WARNING_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_COSIGNATURE_WARNING_ALERT.mlm
new file mode 100644
index 0000000..343a89f
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_COSIGNATURE_WARNING_ALERT.mlm
@@ -0,0 +1,172 @@
+maintenance:
+
+ title: SCH_CoSignature Warning Alert ;;
+ FileName: SCH_CoSignature_Warning_Alert ;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: SCH ;;
+ author: Shivprasad Jadhav;;
+ specialist: ;;
+ date: 2015-03-25;;
+ validation: testing;;
+
+library:
+ purpose: 25-03-2015 CSR :33292 - PA CNRP MLM Created.
+ MLM fires a warning alert if note author is PA,PA-C or CRNP .
+ ;;
+ explanation:
+ This MLM is evoked on entering a new document in an Outpatient Visit .
+ This MLM checks to see if a Cosignature has been requested for the document.
+ The Phsician progress, eConsult, History and Physical and Discharge Summary e Note note when done by a PA, PA-C or and ust be signed by a physician.
+ If they select save and there is not a doctor selected under authored by other or co-signer then fire and alert.
+ The Alert will state: “A physician must be selected to save this document: Please click the Document Info tab and select your physician.”
+
+
+ Change history
+
+DEV 02.19.2018 DW CSR# 35320 SSC - Added "IntraOp Nursing Note" to the documents list and "RN" to the occupation type list
+
+ ;;
+ keywords: ClientDocument; CoSignature; Outpatient;
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+ /* Place the triggering event which is the entry of a new Document"Clinic Note"*/
+
+ Document_Enter := event { ClientDocumentEnter User ClientDocument :
+ WHERE DocumentName = "Physician Progress Note"
+ or DocumentName = "Consult eNote"
+ or DocumentName = "History and Physical"
+ or DocumentName = "Discharge Summary eNote"
+ Or DocumentName = "Physician Progress Note - CCM"
+ Or DocumentName = "Physician Progress Note by System-Enhanced"
+ Or DocumentName = "Physician Progress Note- Cardiology"
+ Or DocumentName = "Physician Progress Note- Rehab"
+ Or DocumentName = "Post Procedure Note- Brief"
+ Or DocumentName = "Hospitalist Intervention Note"
+ or DocumentName = "IntraOp Nursing Note"
+
+ };
+
+ //Document_Enter := event {ClientDocumentEnter User ClientDocument: where documentname in ("Readmission Risk Assessment","Adult Patient Profile")};
+ //Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Readmission Risk Assessment","Adult Patient Profile")};
+
+
+
+ Document_Modify := event { ClientDocumentModify User ClientDocument:
+ WHERE DocumentName = "Physician Progress Note"
+ or DocumentName = "Consult eNote"
+ or DocumentName = "History and Physical"
+ or DocumentName = "Discharge Summary eNote"
+ Or DocumentName = "Physician Progress Note - CCM"
+ Or DocumentName = "Physician Progress Note by System-Enhanced"
+ Or DocumentName = "Physician Progress Note- Cardiology"
+ Or DocumentName = "Physician Progress Note- Rehab"
+ Or DocumentName = "Post Procedure Note- Brief"
+ Or DocumentName = "Hospitalist Intervention Note"
+ or DocumentName = "IntraOp Nursing Note"
+ };
+
+ alert_destination := destination { Alert: Warning, "Reminder: select co-signature box & enter attending MD name",
+ low, chart,"CoSignature",1050,"","No Override Allowed" };
+
+ /* This block executes only when this MLM is called by the editor */
+ if called_by_editor
+ then
+ client_guid:= read last{ClientInfo: GUID};
+ EvokingObject := read last {ClientDocument : THIS
+ WHERE ( DocumentName = "Physician Progress Note"
+ or DocumentName = "Consult eNote"
+ or DocumentName = "History and Physical"
+ or DocumentName = "Discharge Summary eNote"
+ Or DocumentName = "Physician Progress Note - CCM"
+ Or DocumentName = "Physician Progress Note by System-Enhanced"
+ Or DocumentName = "Physician Progress Note- Cardiology"
+ Or DocumentName = "Physician Progress Note- Rehab"
+ Or DocumentName = "Post Procedure Note- Brief"
+ Or DocumentName ="Hospitalist Intervention Note"
+ or DocumentName = "IntraOp Nursing Note"
+ ) AND ClientGUID = client_guid AND entrytype = 4};
+
+ endif;
+
+ ToBeSigned_Flag:= read last{ClientDocument: ToBeSigned referencing EvokingObject};
+
+ /* Get the received document{{{SINGLE-QUOTE}}}s name, clientGUID and clientVisitGUID from the evoking or calling object */
+
+ (client_visit_guid,
+ client_guid,
+ Cur_Doc_ToBeSigned,
+ Cur_Doc_AuthoredDateTime) := read Last
+ {ClientDocument : ClientVisitGUID, ClientGUID,ToBeSigned, AuthoredDtm REFERENCING EvokingObject };
+
+ //Get the user name from the object layer
+ (User_GUID, user_name, occupation_code, orderrole_type) := read last { UserInfo: GUID, DisplayName, OccupationCode, OrderRoleType };
+
+/*
+isAttending := READ last {"select count(*) from CV3CareProviderVisitRole " ||
+" where ProviderGUID = " || SQL(User_GUID) ||
+" and RoleTypeGUID in (select GUID from CV3CareProviderRoleType where TypeCode = {{{SINGLE-QUOTE}}}Physician{{{SINGLE-QUOTE}}} and RoleCode = {{{SINGLE-QUOTE}}}Attending{{{SINGLE-QUOTE}}})"
+} ;
+*/
+
+ OrderRole_List := ("CRNP", "PA", "PA-C" , "RN" );
+ //, "Nurse Aid", "Nurse Manager", "Nursing technician", "Physician Therapy", "Physician Assistant", "Medical Assistant", "Medical Student") ;
+
+
+ IF (occupation_code IN OrderRole_List) AND ToBeSigned_Flag = False THEN
+ ReqCoSignature := TRUE;
+ ELSE
+ ReqCoSignature := FALSE;
+ ENDIF;
+
+;;
+ evoke: Document_Enter ; //or Document_Modify;
+
+ ;;
+ LOGIC:
+
+// IF ReqCoSignature OR ToBeSigned_Flag = False THEN
+ IF ReqCoSignature = True THEN
+ msg := "\n\n\n {{+B}}{{+R}} A physician must be selected to save this document: {{-B}}{{-R}}"
+ || " \n\n INSTRUCTIONS: Please click the Document Info tab and select your physician. " ;
+ // || " \n\n Please click the Document Info tab and select your physician. " ;
+//|| "\n" ||
+//"isAttending: " || isAttending || "\n" ||
+//"User_GUID: " || User_GUID ;
+//|| "ToBeSigned_Flag: "|| (ToBeSigned_Flag as string) || "orderrole_type: " || orderrole_type ;
+
+
+ conclude TRUE;
+ ELSE
+ conclude FALSE;
+ ENDIF;
+
+
+ ;;
+
+ action:
+ /*---------------------------------------------------*/
+ /* Send messsage to user - cannot enter note as is */
+ /*---------------------------------------------------*/
+
+ //IF ReqCoSignature OR ToBeSigned_Flag = False THEN
+ IF ReqCoSignature = True THEN
+ write "\n"
+ || msg
+ || "\n\n" at alert_destination;
+ ENDIF;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_ADMISSION_ORDER_CONFIRMATION.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_ADMISSION_ORDER_CONFIRMATION.mlm
new file mode 100644
index 0000000..439a887
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_ADMISSION_ORDER_CONFIRMATION.mlm
@@ -0,0 +1,203 @@
+maintenance:
+
+ title: SCH_CREATE_ADMISSION_ORDER_CONFIRMATION;;
+ mlmname: SCH_CREATE_ADMISSION_ORDER_CONFIRMATION ;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: SCH ;;
+ author: Juliet M. Law ;;
+ specialist: Janet Nordin;;
+ date: 2019-01-22;;
+ validation: testing;;
+
+library:
+ purpose: Creates {{{SINGLE-QUOTE}}}Admission Order Confirmation{{{SINGLE-QUOTE}}} order when {{{SINGLE-QUOTE}}}Admit to Inpatient{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}Place in Observation{{{SINGLE-QUOTE}}} order is entered
+
+ ;;
+ explanation: The Admission Order Confirmation order will be created by this MLM upon submittal of the order worksheet
+
+ Change History:
+ 2019.01.22 JML CSR 37770 - Created
+
+ ;;
+ keywords: ObjectsPlus, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+
+ local_session := cds_session.local; // for local_session.SessionRequestBed
+
+ log_execution_info := false;
+ stopProcessing := false;
+
+
+ GeneralOrder_dest := destination { ObjectsPlus } with [
+ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ order_Creation_Reason := "Created by MLM";
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ Order_Submit := event {OrderWorksheetSubmit User ClientVisit } ; //Order : WHERE Name Matches pattern "Place in Observation%" } ;//Order: where Name in ("Place in Observation")};
+
+ (OrdersOnWorksheet,
+ WSOrderGUID) := read { UNSUBMITTED ORDER : Name, GUID WHERE Name IN ( "Place in Observation", "Admit to Inpatient" ) };
+
+ if ( ( "Place in Observation" IN OrdersOnWorksheet ) OR ( "Admit to Inpatient" IN OrdersOnWorksheet ) ) then
+
+ //Get CareProvider object of user entering the order
+ userIDType := "Edstan Number (physician)";
+ ( CareProvider_obj ) := read last{ UserInfo : CareProvider };
+ (CareProviderID_Obj ) := read last { CareProvider : CareProviderID REFERENCING CareProvider_obj };
+ CareProviderEdstan := read last { CareProviderID : IDCode REFERENCING CareProviderID_Obj WHERE ProviderIDTypeCode = userIDType };
+
+ //Retrieve Edstan of Attending Physician specified when entering Admission Order
+ AttendingPhysician := local_session.SessionAdmissionOrderAttendingPhysician;
+ AttendingEdstan := SUBSTRING ( ( LENGTH OF AttendingPhysician ) - ( FIND "(" IN STRING AttendingPhysician ) ) CHARACTERS STARTING AT ( FIND "(" IN STRING AttendingPhysician ) FROM AttendingPhysician;
+ AttendingEdstan := Call ( ( AttendingEdstan as string ) as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace WITH "(" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, " " as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
+
+ stopProcessing := ( ( ( TRIM CareProviderEdstan ) as string ) = ( ( TRIM AttendingEdstan ) as string ) );
+
+ if ( stopProcessing = FALSE ) then
+
+ LocationGUID := EvokingObject.CurrentLocationGUID;
+ ClientVisitGUID := EvokingObject.GUID;
+ ClientGUID := EvokingObject.ClientGUID;
+
+ try
+
+ ClientVisit_OBJ := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( ClientVisitGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+ WSSessionType := "Standard";
+ WSSessionReason := "";
+ WSRequestedBySource := "Protocol Order";
+
+ WSRequestedCareProvider_OBJ := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByID with ( UserIDType, ( ( TRIM AttendingEdstan ) as STRING ) );
+
+ WSLocation_OBJ := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( LocationGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+
+ endtry;
+
+ catch Exception ex
+
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( ClientVisit_OBJ IS NOT NULL ) then
+ void := call ClientVisit_OBJ.Dispose;
+ ClientVisit_OBJ := null;
+ endif;
+
+ if ( WSRequestedCareProvider_OBJ IS NOT NULL ) then
+ void:= call WSRequestedCareProvider_OBJ.Dispose;
+ WSRequestedCareProvider_OBJ := null;
+ endif;
+
+ if ( WSLocation_OBJ IS NOT NULL ) then
+ void := call WSLocation_OBJ.Dispose;
+ WSLocation_OBJ := null;
+ endif;
+
+ endcatch;
+
+ try
+
+ CatalogItemName := "Admission Order Confirmation";
+ OrderCreationReason := "Order Created from MLM";
+
+ GeneralOrderItem_OBJ := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with CatalogItemName;
+ GeneralOrder_OBJ := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder with
+ ClientVisit_OBJ,
+ GeneralOrderItem_OBJ,
+ OrderCreationReason,
+ WSRequestedCareProvider_OBJ,
+ WSRequestedBySource,
+ WSSessionType,
+ WSSessionReason,
+ WSLocation_OBJ,
+ "Always" AS {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
+
+ //GeneralOrder_OBJ.SpecialInstructions := "\n\n" || local_session.SessionAdmissionOrderConfirmation || "\nAdmit Date/Time: " || AdmitDateTime;
+ dataItemValue := call GeneralOrder_OBJ.{{{SINGLE-QUOTE}}}GetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "Free Text";
+
+ stringValue := dataItemValue || " " || local_session.SessionAdmissionOrderConfirmation || " Admit Date/Time: " || local_session.SessionAdmissionOrderEffectiveDate ;
+ retValue := call GeneralOrder_OBJ.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "Free Text", stringValue;
+
+ local_session.SessionAdmissionOrderConfirmation := "";
+
+ GeneralOrder_dest.ObjectsPlus := GeneralOrder_OBJ;
+ void := call GeneralOrder_OBJ.Save;
+
+ endtry;
+
+ catch Exception ex
+
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New General Order:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( GeneralOrderItem_OBJ IS NOT NULL ) then
+ void := call GeneralOrderItem_OBJ.Dispose;
+ GeneralOrderItem_OBJ := null;
+ endif;
+
+ if ( GeneralOrder_OBJ IS NOT NULL ) then
+ void := call GeneralOrder_OBJ.Dispose;
+ GeneralOrder_OBJ := null;
+ endif;
+
+ endcatch;
+
+ endif;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ Order_Submit;
+
+ ;;
+ logic:
+
+ if EvokingObject is null
+ then
+ conclude false;
+ endif;
+
+ conclude true;
+
+ ;;
+ action:
+
+ if error_occurred then
+
+ write "An error has occurred in the MLM {{+B}}SCH_CREATE_ADMISSION_ORDER_CONFIRMATION{{-B}} " || "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error(s) " || "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_AEROCHAMBER.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_AEROCHAMBER.mlm
new file mode 100644
index 0000000..64bbebd
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_AEROCHAMBER.mlm
@@ -0,0 +1,168 @@
+maintenance:
+
+ title: SCH_CREATE_AEROCHAMBER;;
+ mlmname: SCH_CREATE_AEROCHAMBER;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair Hospital;;
+ author: Shawn Head;;
+ specialist: Robert Steward;;
+ date: 2016-05-21;;
+ validation: testing;;
+
+library:
+ purpose: Create Aerochamber order when the aerochamber checkbox is selected on an order item that uses one of the 2 forms PRX_IhBnDr orPRX_IhBn
+ ;;
+ explanation:
+ 06.15.2016 - STH - CSR#: 34074 - created {Go-Live 6/28/2016}
+ ;;
+ keywords: Objects+, Aerochamber, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /* Set to true if logging is needed.*/
+ log_execution_info:= FALSE;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ on_order_enter := event {OrderWorksheetSubmit User } ;
+ from_order_name := "";
+ CreateAerochamberOrder := false;
+ UnSub_AeroOrder := read last { UNSUBMITTED Order: Name where name in ("Aerochamber") };
+ if(UnSub_AeroOrder is null) then
+ userguid,user_id :=read last {UserInfo: guid,idcode};
+ AeroOrderNames := read { " select ocmi.name from cv3ordercatalogmasteritem ocmi with (nolock)
+ inner join cv3orderentryform oef with (nolock) on ocmi.EntryFormGUID = oef.GUID
+ where oef.Name in ({{{SINGLE-QUOTE}}}PRX_IhBnDr{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRX_IhBn{{{SINGLE-QUOTE}}})
+ and ocmi.Active = 1
+ and ocmi.ExpiryDate is null " };
+ (ReadUnSub_AeroUD, CP_GUID, OrderName, sessiontype) := read { UNSUBMITTED Order: OrderUserData , careproviderguid , name , InitialSessionTypeCode where name in (AeroOrderNames)};
+ if(count(ReadUnSub_AeroUD) > 0) then
+ (clientGUID, chartGUID, ClientVisitGUID, LocationGUID) := read last { ClientVisit: ClientGUID, ChartGUID, GUID, CurrentLocationGUID };
+ (AeroOrderGUID) := read last { " select guid from cv3order o with (nolock)
+ where o.ClientGUID = " || sql(ClientGUID)
+ || " and o.chartguid = " || sql(chartGUID)
+ || " and o.clientvisitguid = " || sql(ClientVisitGUID)
+ || " and o.name = ({{{SINGLE-QUOTE}}}Aerochamber{{{SINGLE-QUOTE}}})
+ and o.orderstatuscode not in ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HISDP{{{SINGLE-QUOTE}}}) " };
+ if(AeroOrderGUID is nulL) then
+ for y in (1 seqto(count(ReadUnSub_AeroUD))) do
+ CurOrder_UserDataFields := ReadUnSub_AeroUD[y];
+ (userdatacode, value ) := read last { OrderUserData: UserDataCode, Value REFERENCING CurOrder_UserDataFields where UserDataCode = "PRX_Aerochamber"} ;
+ if(value = "1") then
+ CreateAerochamberOrder := true;
+ from_order_name := OrderName[y];
+ endif;
+
+ enddo;
+ endif;
+ endif;
+ endif;
+
+
+ if(CreateAerochamberOrder) then
+ try
+ CV_Obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ WSSessionType := trim(sessiontype[1]);
+ if(sessiontype[1] = "Hold") then
+ WSSessionReason := "Hold Orders";
+ else
+ WSSessionReason := "";
+ endif;
+ WSRequestedBySource := "";
+
+
+ RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((CP_GUID[1] as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((LocationGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( CV_Obj is NOT NULL ) then
+ void:= call CV_Obj.Dispose;
+ CV_Obj:= null;
+ endif;
+
+ if ( RequestedBy_obj is NOT NULL ) then
+ void:= call RequestedBy_obj.Dispose;
+ RequestedBy_obj:= null;
+ endif;
+
+ if ( location_obj is NOT NULL ) then
+ void:= call location_obj.Dispose;
+ location_obj:= null;
+ endif;
+
+ endcatch;
+
+
+ try
+ Catalog_Item_Name := "Aerochamber";
+ order_type := "other";
+ modifier := "";
+ modversion := "";
+ order_Creation_Reason := from_order_name || " ordered with Aerochamber request.";
+
+
+ order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with Catalog_Item_Name;
+
+ GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with CV_Obj,
+ order_catalog_item,
+ order_Creation_Reason,
+ RequestedBy_obj,
+ WSRequestedBySource,
+ WSSessionType,
+ WSSessionReason,
+ location_obj,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
+
+
+ if (Order_catalog_item.Name in ("Aerochamber")) then
+ GeneralOrder_obj.SpecialInstructions := order_Creation_Reason;
+ //GeneralOrder_obj.RequestedTime := "Now";
+ endif;
+ if( GeneralOrder_obj is NOT NULL ) then
+ void := call GeneralOrder_Obj.Save;
+ void := call GeneralOrder_Obj.Dispose;
+ endif;
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}New General order:{{-R}}\n" ||
+ ex.Message || "\n\n";
+ endcatch;
+
+ if ( Order_catalog_item is NOT NULL ) then
+ void:= call Order_catalog_item.Dispose;
+ Order_catalog_item:= null;
+ endif;
+ endif;
+
+;;
+ evoke: on_order_enter;
+
+ ;;
+ logic:
+
+ conclude true;
+
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_CARDIACMONITOR_FROM_ADMIT.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_CARDIACMONITOR_FROM_ADMIT.mlm
new file mode 100644
index 0000000..4bc0cc7
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_CARDIACMONITOR_FROM_ADMIT.mlm
@@ -0,0 +1,168 @@
+maintenance:
+
+ title: SCH_CREATE_CARDIACMONITOR_FROM_ADMIT;;
+ mlmname: SCH_CREATE_CARDIACMONITOR_FROM_ADMIT;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair Hospital;;
+ author: Shawn Head;;
+ specialist: Peggy Karish;;
+ date: 2016-05-10;;
+ validation: testing;;
+
+library:
+ purpose: Create cardiac monitor order when the admit to inpatient order has the monitored bed selected
+ ;;
+ explanation:
+ 05.10.2016 - STH - CSR#: 34074 - created {Go-Live 5/17/2016}
+ ;;
+ keywords: Objects+, Care Provider Visit Role, Auto create care provider, auto DC care provider
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /* Set to true if logging is needed.*/
+ log_execution_info:= FALSE;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ on_order_enter := event {OrderWorksheetSubmit User } ;
+ from_order_name := "";
+ CreateMonitorOrder := false;
+ UnSub_CardMonOrd := read last { UNSUBMITTED Order: Name where name in ("Monitor: Cardiac") };
+ if(UnSub_CardMonOrd is null) then
+ userguid,user_id :=read last {UserInfo: guid,idcode};
+ (ReadUnSub_AdmitUD, CP_GUID, OrderName, sessiontype) := read { UNSUBMITTED Order: OrderUserData , careproviderguid , name , InitialSessionTypeCode where name in ("Admit to Inpatient","Place in Observation")};
+ if(count(ReadUnSub_AdmitUD) > 0) then
+ (clientGUID, chartGUID, ClientVisitGUID, LocationGUID) := read last { ClientVisit: ClientGUID, ChartGUID, GUID, CurrentLocationGUID };
+ (MonitorOrderGUID) := read last { " select guid from cv3order o with (nolock)
+ where o.ClientGUID = " || sql(ClientGUID)
+ || " and o.chartguid = " || sql(chartGUID)
+ || " and o.clientvisitguid = " || sql(ClientVisitGUID)
+ || " and o.name = ({{{SINGLE-QUOTE}}}Monitor: Cardiac{{{SINGLE-QUOTE}}})
+ and o.orderstatuscode not in ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HISDP{{{SINGLE-QUOTE}}}) " };
+ if(MonitorOrderGUID is nulL) then
+ for y in (1 seqto(count(ReadUnSub_AdmitUD))) do
+ CurOrder_UserDataFields := ReadUnSub_AdmitUD[y];
+ (userdatacode, value ) := read last { OrderUserData: UserDataCode, Value REFERENCING CurOrder_UserDataFields where UserDataCode = "NUR_ADTMonitoredBedCBx"} ;
+ if(value = "1") then
+ CreateMonitorOrder := true;
+ from_order_name := OrderName[y];
+ endif;
+
+ enddo;
+ endif;
+ endif;
+ endif;
+
+/*
+ if called_by_editor then
+ EvokingObject := read last {Order: THIS
+ WHERE Name in ("Admit to Inpatient","Place in Observation")};
+ endif;
+*/
+ if(CreateMonitorOrder) then
+ try
+ CV_Obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ WSSessionType := trim(sessiontype[1]);
+ if(sessiontype[1] = "Hold") then
+ WSSessionReason := "Hold Orders";
+ else
+ WSSessionReason := "";
+ endif;
+ WSRequestedBySource := "";
+
+
+ RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((CP_GUID[1] as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((LocationGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( CV_Obj is NOT NULL ) then
+ void:= call CV_Obj.Dispose;
+ CV_Obj:= null;
+ endif;
+
+ if ( RequestedBy_obj is NOT NULL ) then
+ void:= call RequestedBy_obj.Dispose;
+ RequestedBy_obj:= null;
+ endif;
+
+ if ( location_obj is NOT NULL ) then
+ void:= call location_obj.Dispose;
+ location_obj:= null;
+ endif;
+
+ endcatch;
+
+
+ try
+ Catalog_Item_Name := "Monitor: Cardiac";
+ order_type := "other";
+ modifier := "";
+ modversion := "";
+ order_Creation_Reason := from_order_name || " ordered with Monitor Bed request.";
+
+
+ order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with Catalog_Item_Name;
+
+ GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with CV_Obj,
+ order_catalog_item,
+ order_Creation_Reason,
+ RequestedBy_obj,
+ WSRequestedBySource,
+ WSSessionType,
+ WSSessionReason,
+ location_obj,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
+
+
+ if (Order_catalog_item.Name in ("Monitor: Cardiac")) then
+ GeneralOrder_obj.SpecialInstructions := order_Creation_Reason;
+ //GeneralOrder_obj.RequestedTime := "Now";
+ endif;
+ if( GeneralOrder_obj is NOT NULL ) then
+ void := call GeneralOrder_Obj.Save;
+ void := call GeneralOrder_Obj.Dispose;
+ endif;
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}New General order:{{-R}}\n" ||
+ ex.Message || "\n\n";
+ endcatch;
+
+ if ( Order_catalog_item is NOT NULL ) then
+ void:= call Order_catalog_item.Dispose;
+ Order_catalog_item:= null;
+ endif;
+ endif;
+
+;;
+ evoke: on_order_enter;
+
+ ;;
+ logic:
+
+ conclude true;
+
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_CONSULT_FROM_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_CONSULT_FROM_ORDER.mlm
new file mode 100644
index 0000000..e6a9ba2
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_CONSULT_FROM_ORDER.mlm
@@ -0,0 +1,194 @@
+maintenance:
+
+ title: SCH_CREATE_CONSULT_FROM_ORDER;;
+ mlmname: SCH_CREATE_CONSULT_FROM_ORDER;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair Hospital;;
+ author: Eclipsys;;
+ specialist: ;;
+ date: 2010-03-12;;
+ validation: testing;;
+
+library:
+ purpose: Create a consult careprovider when entered (either on hold or active)
+ Discontinue / delete careprovider when order DC{{{SINGLE-QUOTE}}}d
+ ;;
+ explanation: Med Rec introduction of orders as hold session
+
+
+ Change history
+
+ 06.19.2017 DW CSR# 35742 MLM - Introduce Palliative Care Consult form orders
+
+
+ ;;
+ keywords: Objects+, Care Provider Visit Role, Auto create care provider, auto DC care provider
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /* Set to true if logging is needed.*/
+ log_execution_info:= FALSE;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ /* link_value := "CrClCalc.exe";
+ shell_to_win := INTERFACE
+ {long shell32:ShellExecuteA(long, char*, char*, char*, char*, char*)};
+ x := call shell_to_win with 0, "open",
+ link_value,NULL, NULL, "SW_SHOWNORMAL";
+*/
+ WhatAmIDoing := "";
+
+ on_order_enter:= event {OrderEnter User Order:
+ WHERE Name in ("Physician Consult", "Anesthesia Consult","Rehabilitation Consult","Palliative Care Consult")};
+
+ on_order_DC := event {OrderDiscontinue User Order:
+ WHERE Name in ("Physician Consult", "Anesthesia Consult","Rehabilitation Consult","Palliative Care Consult")};
+
+ if called_by_editor then
+ EvokingObject := read last {Order: THIS
+ WHERE Name in ("Physician Consult", "Anesthesia Consult","Rehabilitation Consult","Palliative Care Consult")};
+ endif;
+
+ NewConsult_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "CareProviderVisitRole Object",
+ rule_number := 2010 ];
+
+ Discontinue_Consult_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object deleted by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "CareProviderVisitRole Object",
+ rule_number := 2040 ];
+
+ dose_exceeded_alert := destination { Alert: Warning, "Daily Dosage Exceeded", high,
+ chart, "Dosage Administration Alert", 5010,"DoNotSend" };
+
+ client_GUID := read last { ClientInfo: GUID };
+ userguid,user_id :=read last {UserInfo: guid,idcode};
+
+ (order_name,
+ order_summaryline,client_visit_guid
+ ) := read last
+ {Order: Name, summaryline,clientvisitguid REFERENCING EvokingObject };
+
+ substring_mlm := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_BETWEEN{{{SINGLE-QUOTE}}};
+ link_value:=CALL substring_mlm with (order_summaryline,"(",")");
+
+ if EvokingEvent = on_order_DC
+ then
+
+ removeprovvisitrole_guid :=
+ read last { " select cpvr.guid from cv3careproviderid as cpi with (nolock) "
+ ||" join cv3careprovidervisitrole as cpvr with (nolock) "
+ ||" on cpvr.clientguid = " || sql(client_GUID)
+ ||" and cpvr.clientvisitguid = " ||sql(client_visit_guid)
+ ||" and cpvr.providerguid = cpi.providerguid "
+ ||" and cpvr.active = 1 "
+ ||" and cpvr.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ ||" and cpvr.fromdtm <= getdate() "
+ ||" and (cpvr.todtm is null or cpvr.todtm >= getdate()) "
+ ||" and cpvr.rolecode = {{{SINGLE-QUOTE}}}Consulting{{{SINGLE-QUOTE}}} "
+ ||" where cpi.IDCode = " ||sql(link_value)
+ ||" and cpi.ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}} "
+ };
+ endif;
+
+
+ ;;
+ evoke: on_order_enter
+ or
+ on_order_DC ;
+// on_order_modify;
+// visit_enter;
+ ;;
+ logic:
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((Client_Visit_Guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ if EvokingEvent = on_order_enter
+ then
+ try
+
+
+ careprovider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById
+ with ("Edstan Number (physician)",link_value);
+
+ careprovidername := careprovider_obj.PrimaryID;
+
+ New_CareProvVisitRole_obj := call {{{SINGLE-QUOTE}}}CareProviderVisitRole{{{SINGLE-QUOTE}}}.CreateCareProviderVisitRole
+ with
+ (client_visit_obj, //ClientVisit
+ careprovider_obj, // provider
+ "Consulting" // Consulting type
+ );
+
+ NewConsult_dest.ObjectsPlus := New_CareProvVisitRole_obj ;
+ endtry;
+ catch exception ex
+ error_occurred := true;
+
+ if ( New_CareProvVisitRole_obj is NOT NULL ) then
+ void:= call New_CareProvVisitRole_obj.Dispose;
+ New_CareProvVisitRole_obj := null;
+ endif;
+
+ NewConsult_dest:= null;
+ endcatch;
+
+elseif EvokingEvent = on_order_DC
+then
+
+try
+ if exists removeprovvisitrole_guid
+ then
+ Discontinue_Consult_Obj := call {{{SINGLE-QUOTE}}}CareProviderVisitRole{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ( (removeprovvisitrole_guid as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ empty := call Discontinue_Consult_Obj.Discontinue;
+ Discontinue_Consult_dest.ObjectsPlus := Discontinue_Consult_Obj;
+ endif;
+ endtry;
+ catch exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}Discontinue HI {{-R}} \n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if (Discontinue_Consult_Obj is not null) then
+ void := call Discontinue_Consult_Obj.Dispose;
+ Discontinue_Consult_Obj := null;
+ endif;
+ Discontinue_Consult_dest := null;
+ endcatch;
+
+endif;
+
+ conclude true;
+
+ ;;
+ action:
+ if exists NewConsult_dest then
+ write TRUE at NewConsult_dest ;
+ endif;
+
+ if exists Discontinue_Consult_dest then
+ write TRUE at Discontinue_Consult_dest ;
+ endif;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS.mlm
new file mode 100644
index 0000000..d7d68d4
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS.mlm
@@ -0,0 +1,520 @@
+maintenance:
+
+ title: SCH_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS;;
+ mlmname: SCH_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Allscripts;;
+ author: SHAMI SHARMA ;;
+ specialist: ;;
+ date: 2017-12-06;;
+ validation: testing;;
+
+library:
+ purpose: Generate a Dressing Change order following PICC/Midline Procedure Note.
+ ;;
+ explanation: When charting the location of picc Insertion and MidLine insertion then
+ a dressing change order must be created to ensure the infusion team is scheduled for the dressing change.
+ The following Structure Note are affected by this:
+ * PICC/Midline Procedure Note
+
+ The following observations and values are affected by this,
+ generating the following orders:
+ * PICC Insertion and/or Midline Insertion
+ - PICC Line Dressing Change
+ -SCH_PICC Location and SCH_Insert date
+ - Midline Dressing Change
+ - SCH_Midline location and SCH_Midline insert
+
+
+ ;;
+ keywords: Structure Note
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // .Net assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+
+
+ error_occurred := false;
+ error_message := "";
+
+ bln_createOrder := 0;
+
+ log_execution_info := false;
+
+
+ // Called MLM declaration section
+ // Utility function to parse strings
+ str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ set_cds_vars := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_DEFINITION_MLM{{{SINGLE-QUOTE}}};
+ read_obs_value := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_OBS_VALUE_MLM{{{SINGLE-QUOTE}}};
+ // Default values when creating orders
+ SessionType := "Standard";
+ SessionReason := "";
+ RequestingSource := "";
+ user_IDType := "Primary";
+ order_creation_reason := "From MLM";
+
+ orderPlacedMessage := "";
+
+ orderItemName := NULL;
+ canPlaceOrder := false;
+ chartedDateTime := NULL;
+ triggerValueExists := false;
+ pedsExists := false;
+ cancelProcessing := false;
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1003,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ Document_Enter := event {ClientDocumentEnter ANY ClientDocument: where DocumentName = "PICC/Midline Procedure Note"};
+ Document_Modify := event {ClientDocumentModify ANY ClientDocument: where DocumentName = "PICC/Midline Procedure Note"};
+
+
+ ( ClientDocument_GUID, ClientVisit_GUID, client_guid, Chart_GUID ,USER_GUID) := Read Last { ClientDocument: GUID, ClientVisitGUID, ClientGUID , ChartGUID, USERGUID REFERENCING EvokingObject }; /* Get the ClientObservation object pointer */
+
+ (Client_Observation_Document_Obj, GUID,Document_Name):= read last { ClientDocument: ClientObservationDocument, GUID,DocumentName REFERENCING EvokingObject };
+
+ (Client_Observation_Obj) := read last{ ClientObservationDocument: ClientObservation REFERENCING Client_Observation_Document_Obj };
+
+ //********************** End of USER CONFIGURED CONSTANTS section *********************************
+ (PICCobs_value, PICCobs_Name,PICC_Created) := read last { ClientObservationDocument: ClientObservation, Name ,CREATEDWHEN
+ REFERENCING Client_Observation_Document_Obj
+ Where Name in ("SCH_Insert date" ) };
+
+ (Midlineobs_value, Midlineobs_Name,ML_Created) := read last{ ClientObservationDocument: ClientObservation, Name ,CREATEDWHEN
+ REFERENCING Client_Observation_Document_Obj
+ Where Name in ("SCH_Midline insert" ) };
+
+
+ (PICCloc_value,pcobsvalue, PICCloc_Name,Picclocdate) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
+ REFERENCING Client_Observation_Document_Obj
+ Where Name in ("SCH_PICC Location" ) };
+
+
+ (Midlineloc_value,mlobvalue, Midlineloc_Name,mllocdate) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
+ REFERENCING Client_Observation_Document_Obj
+ Where Name in ("SCH_Midline location" ) };
+ (PICC_obsDate) := PICCobs_value.ValueText;
+ //(PICCFisrtEnetrTime):=PICCobs_value.RecordedDtm;
+ (PICCEnterrTime):= PICC_Created ;
+ //(PiccDisplayName) := PICCobs_value.Name;
+ //(PiccObsName) := PICCobs_Name;
+
+ (PICCloc_ValueText) := pcobsvalue.Value;
+ //(PICClocFisrtEnetrTime):= PICCloc_value.RecordedDtm;
+ (PICClocEnterrTime):= Picclocdate;
+ //(PicclocDisplayName) := PICCloc_value.Name;
+ //(PicclocObsName) := PICCloc_Name;
+
+ (ML_obsDate) := Midlineobs_value.ValueText;
+ //(MLFisrtEnetrTime):=Midlineobs_value.RecordedDtm;
+ (MLEnterrTime):=ML_Created;
+ //(MLDisplayName) := Midlineobs_value.Name;
+ //(MLObsName) := Midlineobs_Name;
+
+ (ML_locValueText):= mlobvalue.Value;
+ //(MLlocFisrtEnetrTime):= Midlineloc_value.RecordedDtm;
+ (MLlocEnterrTime):= mllocdate;
+ //(MLlocDisplayName) := Midlineloc_value.Name;
+ //(MLlocObsName) := Midlineloc_Name;
+
+ IF(EXISTS PICC_obsDate) OR ( EXISTS PICCloc_ValueText) THEN
+ IF( EXISTS PICC_obsDate ) THEN
+ chartedDateTime := PICC_Created;
+ ENDIF;
+ IF(EXISTS PICCloc_ValueText ) THEN
+ chartedDateTime := Picclocdate;
+ ENDIF;
+
+ greaterChartDateTime := chartedDateTime + 1 hour;
+ lessChartDateTime := chartedDateTime - 1 hour;
+ requestYear := year of chartedDateTime as string;
+ if ((month of chartedDateTime >= 1) and (month of chartedDatetime <= 9)) then
+ requestMonth := ("0" || month of chartedDateTime) as string;
+ else
+ requestMonth := month of chartedDateTime as string;
+ endif;
+ if ((day of chartedDateTime >= 1) and (day of chartedDateTime <= 9)) then
+ requestDay := ("0" || day of chartedDateTime) as string;
+ else
+ requestDay := day of chartedDateTime as string;
+ endif;
+ requestDateCheck := (requestMonth || "-" || requestDay || "-" || requestYear) as string;
+ orderRequestDate := (requestYear || "-" || requestMonth || "-" || requestDay) as string;
+
+ //Locate Order
+ orderItemName := "PICC Line Dressing Change";
+ orderSpecInstr := ();
+ existingOrderName := ();
+ (existingOrderName, orderSpecInstr) := read {"SELECT o.Name, oai.SpecialInstructions, o.TouchedWhen"
+ || " FROM CV3Order as o with (nolock) JOIN"
+ || " (CV3OrderCatalogMasterItem AS ocmi with (nolock)"
+ || " JOIN CV3OrderReviewCategory AS orc with (nolock)"
+ || " ON ocmi.OrderReviewCategoryGUID = orc.GUID)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " JOIN CV3OrderAddnlInfo as oai with (nolock)"
+ || " ON o.GUID = oai.GUID"
+ || " WHERE o.ClientGUID = " || client_guid
+ || " AND o.ClientVisitGUID = " || ClientVisit_GUID
+ || " AND o.ChartGUID = " || chart_guid
+ || " AND ("
+ || " (o.Name = {{{SINGLE-QUOTE}}}" || orderItemName || "{{{SINGLE-QUOTE}}})"
+ || " )"
+ || " AND"
+ || " ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
+ || " AND ((o.CreatedWhen >= {{{SINGLE-QUOTE}}}" || lessChartDateTime || "{{{SINGLE-QUOTE}}}"
+ || " and o.CreatedWhen < {{{SINGLE-QUOTE}}}" || greaterChartDateTime || "{{{SINGLE-QUOTE}}})"
+ || " OR o.RequestedDate = {{{SINGLE-QUOTE}}}" || orderRequestDate || "{{{SINGLE-QUOTE}}}"
+ || " OR oai.SpecialInstructions LIKE {{{SINGLE-QUOTE}}}%" || PICC_obsDate || "%{{{SINGLE-QUOTE}}})"
+ , primaryTime = touchedWhen};
+ if ((count existingOrderName) = 0) then
+ canPlaceOrder := true;
+ ENDIF;
+ if (canPlaceOrder) then
+ specialInstructions := "";
+ ( PICC_len1,PICC_Len2 ) := read last { ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
+ REFERENCING Client_Observation_Document_Obj
+ Where Name in ("SCH_PICC Len ins" ) };
+
+
+ ( PICC_Ext1,PICC_Ext2 ) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
+ REFERENCING Client_Observation_Document_Obj
+ Where Name in ("SCH_PICC Ext Len" ) };
+
+
+ ( PICC_Size1,Picc_Size2 ) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
+ REFERENCING Client_Observation_Document_Obj
+ Where Name in ("SCH_Size" ) };
+ (insertLength1) := PICC_len1.ValueText;
+ (externalLength1) := PICC_Ext1.ValueText;
+ (piccDevice1):= Picc_Size2.Value;
+
+
+
+ If(EXISTS PICC_obsDate) THEN
+ PICCObsDt := "insertion date " || PICC_obsDate || "; " ;
+ ELSE
+ PICCObsDt := "";
+ ENDIF;
+
+ If(EXISTS PICCloc_ValueText) THEN
+ PICCloc_ValueText := PICCloc_ValueText || "; " ;
+ ELSE
+ PICCloc_ValueText:= "";
+ ENDIF;
+
+ If(EXISTS piccDevice1 ) THEN
+ piccDevice1 := piccDevice1 || "; " ;
+ ELSE
+ piccDevice1 := "";
+ ENDIF;
+
+ If(EXISTS insertLength1 ) THEN
+ insertLength := "Insert Length " || insertLength1 || "; " ;
+ ELSE
+ insertLength :="";
+ ENDIF;
+
+ If(EXISTS externalLength1) THEN
+ externalLength := "External Length " || externalLength1;
+ ELSE
+ externalLength :="";
+ ENDIF;
+
+ specialInstructions := "PICC: " || PICCObsDt || "" || PICCloc_ValueText || "" || piccDevice1
+ || "" || insertLength || "" || externalLength;
+
+ // Create a GENERAL order from a catalog item
+ try
+
+ // ClientVisit object
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisit_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // GENERAL catalog item object
+ general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with orderItemName;
+
+ // CareProvider Object
+ requesting_care_provider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((user_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // Location Object
+ location_guid := read last {"SELECT CurrentLocationGuid FROM CV3ClientVisit "
+ || " WHERE ClientGuid = " || client_guid};
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // Create GENERAL order
+ GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with client_visit_obj,
+ general_catalog_item,
+ order_creation_reason,
+ requesting_care_provider_obj,
+ RequestingSource,
+ SessionType,
+ SessionReason,
+ location_obj,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
+
+ GeneralOrder_Obj.RequestedDate := orderRequestDate;
+ GeneralOrder_Obj.SpecialInstructions := specialInstructions;
+
+ void := call GeneralOrder_Obj.Save;
+ void := call GeneralOrder_Obj.Dispose;
+
+ orderPlacedMessage := orderPlacedMessage || "\n" || orderItemName;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Error in saving prefilled auto order :{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ endcatch;
+
+ // Clean UP
+ if (location_obj IS NOT NULL) then
+ void := call location_obj.Dispose;
+ location_obj := NULL;
+ endif;
+
+ if (requesting_care_provider_obj IS NOT NULL) then
+ void := call requesting_care_provider_obj.Dispose;
+ requesting_care_provider_obj := NULL;
+ endif;
+
+ if (general_catalog_item IS NOT NULL) then
+ void := call general_catalog_item.Dispose;
+ general_catalog_item := NULL;
+ endif;
+
+ if (client_visit_obj IS NOT NULL) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj := NULL;
+ endif;
+ endif; //canPlaceOrder = True
+
+ endif; //canPlaceOrder = True
+
+ IF(EXISTS ML_obsDate) OR ( EXISTS ML_locValueText) THEN
+ IF( EXISTS ML_obsDate ) THEN
+ chartedDateTime := MLEnterrTime;
+ ENDIF;
+ IF(EXISTS ML_locValueText ) THEN
+ chartedDateTime := MLlocEnterrTime;
+ ENDIF;
+
+ greaterChartDateTime := chartedDateTime + 1 hour;
+ lessChartDateTime := chartedDateTime - 1 hour;
+ requestYear := year of chartedDateTime as string;
+ if ((month of chartedDateTime >= 1) and (month of chartedDatetime <= 9)) then
+ requestMonth := ("0" || month of chartedDateTime) as string;
+ else
+ requestMonth := month of chartedDateTime as string;
+ endif;
+ if ((day of chartedDateTime >= 1) and (day of chartedDateTime <= 9)) then
+ requestDay := ("0" || day of chartedDateTime) as string;
+ else
+ requestDay := day of chartedDateTime as string;
+ endif;
+ requestDateCheck := (requestMonth || "-" || requestDay || "-" || requestYear) as string;
+ orderRequestDate := (requestYear || "-" || requestMonth || "-" || requestDay) as string;
+
+ //Locate Order
+ orderItemName := "Midline Dressing Change";
+ orderSpecInstr := ();
+ existingOrderName := ();
+ (existingOrderName, orderSpecInstr) := read {"SELECT o.Name, oai.SpecialInstructions, o.TouchedWhen"
+ || " FROM CV3Order as o with (nolock) JOIN"
+ || " (CV3OrderCatalogMasterItem AS ocmi with (nolock)"
+ || " JOIN CV3OrderReviewCategory AS orc with (nolock)"
+ || " ON ocmi.OrderReviewCategoryGUID = orc.GUID)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " JOIN CV3OrderAddnlInfo as oai with (nolock)"
+ || " ON o.GUID = oai.GUID"
+ || " WHERE o.ClientGUID = " || client_guid
+ || " AND o.ClientVisitGUID = " || ClientVisit_GUID
+ || " AND o.ChartGUID = " || chart_guid
+ || " AND ("
+ || " (o.Name = {{{SINGLE-QUOTE}}}" || orderItemName || "{{{SINGLE-QUOTE}}})"
+ || " )"
+ || " AND"
+ || " ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
+ || " AND ((o.CreatedWhen >= {{{SINGLE-QUOTE}}}" || lessChartDateTime || "{{{SINGLE-QUOTE}}}"
+ || " and o.CreatedWhen < {{{SINGLE-QUOTE}}}" || greaterChartDateTime || "{{{SINGLE-QUOTE}}})"
+ || " OR o.RequestedDate = {{{SINGLE-QUOTE}}}" || orderRequestDate || "{{{SINGLE-QUOTE}}}"
+ || " OR oai.SpecialInstructions LIKE {{{SINGLE-QUOTE}}}%" || ML_obsDate || "%{{{SINGLE-QUOTE}}})"
+ , primaryTime = touchedWhen};
+ if ((count existingOrderName) = 0) then
+ canPlaceOrder := true;
+ ENDIF;
+ if (canPlaceOrder) then
+ specialInstructions := "";
+ ( ML_len1,ML_Len2 ) := read last { ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
+ REFERENCING Client_Observation_Document_Obj
+ Where Name in ("SCH_Midline Len ins" ) };
+
+
+ ( ML_Ext1,ML_Ext2 ) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
+ REFERENCING Client_Observation_Document_Obj
+ Where Name in ("SCh_Midline Ext len" ) };
+
+
+ ( ML_Size1,ML_Size2 ) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name ,CREATEDWHEN
+ REFERENCING Client_Observation_Document_Obj
+ Where Name in ("SCH_Mid line_" ) };
+
+ (MLinsertLength1) := ML_len1.ValueText;
+ (MLexternalLength1) := ML_Ext1.ValueText;
+ (MLpiccDevice1):= ML_Size2.Value;
+
+
+ IF(EXISTS MLexternalLength1)THEN
+ MLexternalLength := "External Length " || MLexternalLength1;
+ ELSE
+ MLexternalLength :="";
+ ENDIF;
+
+ IF(EXISTS MLinsertLength1)THEN
+ MLinsertLength := "Insert Length " || MLinsertLength1 || "; ";
+ ELSE
+ MLinsertLength :="";
+ ENDIF;
+
+ IF(EXISTS ML_obsDate)THEN
+ MLObsdate:= "insertion date " || ML_obsDate || "; ";
+ ELSE
+ MLObsdate:= "";
+ ENDIF;
+
+ IF(EXISTS ML_locValueText)THEN
+ ML_locValueText := ML_locValueText || "; ";
+ ELSE
+ ML_locValueText := "";
+ ENDIF;
+
+ IF(EXISTS MLpiccDevice1)THEN
+ MLpiccDevice1 := MLpiccDevice1 || "; ";
+ ELSE
+ MLpiccDevice1 :="";
+ ENDIF;
+
+ specialInstructions := "MIDLINE: " || MLObsdate || "" || ML_locValueText || "" || MLpiccDevice1
+ || "" || MLinsertLength || "" || MLexternalLength;
+
+ // Create a GENERAL order from a catalog item
+ try
+
+ // ClientVisit object
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisit_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // GENERAL catalog item object
+ general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with orderItemName;
+
+ // CareProvider Object
+ requesting_care_provider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((user_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // Location Object
+ location_guid := read last {"SELECT CurrentLocationGuid FROM CV3ClientVisit "
+ || " WHERE ClientGuid = " || client_guid};
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // Create GENERAL order
+ GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with client_visit_obj,
+ general_catalog_item,
+ order_creation_reason,
+ requesting_care_provider_obj,
+ RequestingSource,
+ SessionType,
+ SessionReason,
+ location_obj,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
+
+ GeneralOrder_Obj.RequestedDate := orderRequestDate;
+ GeneralOrder_Obj.SpecialInstructions := specialInstructions;
+
+ void := call GeneralOrder_Obj.Save;
+ void := call GeneralOrder_Obj.Dispose;
+
+ orderPlacedMessage := orderPlacedMessage || "\n" || orderItemName;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Error in saving prefilled auto order :{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ endcatch;
+
+ // Clean UP
+ if (location_obj IS NOT NULL) then
+ void := call location_obj.Dispose;
+ location_obj := NULL;
+ endif;
+
+ if (requesting_care_provider_obj IS NOT NULL) then
+ void := call requesting_care_provider_obj.Dispose;
+ requesting_care_provider_obj := NULL;
+ endif;
+
+ if (general_catalog_item IS NOT NULL) then
+ void := call general_catalog_item.Dispose;
+ general_catalog_item := NULL;
+ endif;
+
+ if (client_visit_obj IS NOT NULL) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj := NULL;
+ endif;
+ endif; //canPlaceOrder = True
+
+ endif; //canPlaceOrder = True
+
+ ;;
+ priority: 50
+ ;;
+ evoke: Document_Enter;Document_Modify;
+ ;;
+ logic: conclude true;
+ ;;
+ action:
+ if Error_occurred
+ then
+
+ write "An error has occured in the MLM {{+B}}SNCH_CREATE_SOCIAL_WORK_REFERRAL_ORDER{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_ESCORT_ORDER_FROM_ED_CT.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_ESCORT_ORDER_FROM_ED_CT.mlm
new file mode 100644
index 0000000..7ab6963
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_ESCORT_ORDER_FROM_ED_CT.mlm
@@ -0,0 +1,124 @@
+maintenance:
+
+ title: SCH_CREATE_ESCORT_ORDER_FROM_ED_CT;;
+ mlmname: SCH_CREATE_ESCORT_ORDER_FROM_ED_CT;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Juliet M Law, Allscripts;;
+ specialist: Peggy Leschak, Allscripts;;
+ date: 2016-02-03;;
+ validation: testing;;
+
+library:
+ purpose: Create a request escort order when an ED Physician enters a CT order that has an Escort class type.
+
+ ;;
+ explanation: When an ED physician enters a CT (non-hold) order, this MLM will determine if the order has a ED_Escort Request class type.
+ This MLM will automatically create the Request Escort order and place it on the Order Entry worksheet.
+
+ Change History
+ 02.03.2016 JML CSR 33934: Created.
+ 04.20.2016 JML Moved to Production.
+ ;;
+ keywords: ED, CT, escort
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /* Set to true if logging is needed.*/
+ log_execution_info:= FALSE;
+
+ ct_order_enter := EVENT { OrderEnter User Order : WHERE Name matches pattern "CT%" AND TypeCode = "Diagnostic" };
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ if ( called_by_editor ) then
+ EvokingObject := read last { Order : THIS WHERE Name matches pattern "CT%" };
+ endif;
+
+ //Assign GUIDs
+ client_guid := EvokingObject.ClientGUID;
+ visit_guid := EvokingObject.ClientVisitGUID;
+ chart_guid := EvokingObject.ChartGUID;
+
+ //Object to create an order to add to Order Entry Worksheet
+ UnsubmittedOrder_obj := OBJECT [order_type,
+ item_name,
+ item_modifier,
+ item_version,
+ coded_time,
+ requested_time_hour,
+ requested_time_min,
+ order_field_name,
+ order_field_value];
+
+ //MLM call to create order to add to Order Entry Worksheet
+ create_escort_order := MLM {{{SINGLE-QUOTE}}}SCH_Func_Create_Unsubmitted_Order{{{SINGLE-QUOTE}}};
+
+ //Retrieve user occupation
+ ( orderRoleType, user_guid ) := READ LAST { UserInfo : OrderRoleType, GUID };
+
+ //if ( ( classTypeValue IN ("CT", "yes") ) AND ( orderRoleType IN ("ED Physician", ".none") ) ) then
+ if ( orderRoleType IN ("ED Physician", ".none", "CRNP", "PA", "PA-C" ) ) then
+ //Retrieve order class type
+ ( ocmi, orderSessionType, orderSource ) := READ LAST { Order : OrderCatalogMasterItem, InitialSessionTypeCode, SourceCode REFERENCING EvokingObject };
+ ( order_classTypeValue ) := READ LAST { OrderCatalogMasterItem : CatalogClassTypeValue REFERENCING ocmi };
+ ( classTypeValueCode, classTypeValue ) := READ LAST { CatalogClassTypeValue : Code, Value REFERENCING order_classTypeValue
+ WHERE code = "ED_Escort Request" };
+ if ( ( classTypeValue IN ( "CT", "yes" ) ) AND ( orderSessionType <> "Hold" ) ) then
+
+ //Retrieve client visit information
+ (er_patient) := READ LAST {"SELECT a.ColumnNewValue"
+ || " FROM CV3Client c WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
+ || " ON c.GUID = cv.ClientGUID"
+ || " JOIN SXAEDLOCATIONAUDIT a WITH (NOLOCK)"
+ || " ON cv.GUID = a.ClientVisitGUID"
+ || " WHERE c.GUID = " || Sql(client_guid)
+ || " AND cv.GUID = " || Sql(visit_guid)
+ || " AND cv.ChartGUID = " || Sql(chart_guid)
+ || " AND cv.CurrentLocation = {{{SINGLE-QUOTE}}}ER Major{{{SINGLE-QUOTE}}}"
+ || " AND a.ColumnName = {{{SINGLE-QUOTE}}}location{{{SINGLE-QUOTE}}}"
+ || " ORDER BY a.TouchedWhen"};
+
+ if ( exists er_patient ) then
+
+ //Check unsubmitted orders for existing escort request (avoid duplicates)
+ existingEscortOrder := READ LAST { UnsubmittedOrders : Name WHERE Name = "Request Escort" };
+
+ if ( NOT ( exists existingEscortOrder ) ) then
+ //Construct Object to pass to Unsubmitted Order Creation MLM
+ edCTOrder := NEW UnsubmittedOrder_obj WITH
+ [order_type := "Diagnostic",
+ item_name := "Request Escort",
+ item_modifier := "",
+ item_version := "",
+ coded_time := "STAT",
+ requested_time_hour := "",
+ requested_time_min := "",
+ order_field_name := ("NUR_Origin","Obj_Plus_EscortDestination"),
+ order_field_value := (er_patient, "CT")];
+
+ return_value := call create_escort_order WITH (visit_guid, user_guid, client_guid, orderSessionType, "", edCTOrder);
+ endif;
+ endif;
+ endif;
+ endif;
+ ;;
+ evoke:
+
+ ct_order_enter;
+
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_GENERAL_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_GENERAL_ORDER.mlm
new file mode 100644
index 0000000..c95d620
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_GENERAL_ORDER.mlm
@@ -0,0 +1,251 @@
+maintenance:
+
+ title: SCH_Create_General_Order ;;
+ mlmname: SCH_Create_General_Order ;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: SCH ;;
+ author: Saurabh patel;;
+ specialist: ;;
+ date: 2012-09-12;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+ Change History
+ --------------
+ 01.13.2014 JML CSR 31748: Modify to allow Requested Date and Time values to be passed in
+ 01.06.2015 DW CSR# 31899 Infusion Center Consult MLM Change
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ (
+ order_type,
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ Order_catalog_item, // CatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // string CreateReason
+ WSRequestedBy_obj, // RequestingProvider ObjectsPlus object
+ WSRequestedBySource, // string requestingSource(must be in dict)
+ WSSessionType, // string SessionType
+ WSSessionReason, // string SessionReason
+ WSLocation_obj,
+ RequestedDate, //Requested Date (CSR 31748 change)
+ RequestedTime //Requested Time (CSR 31748 change)
+
+ ) := argument;
+
+
+ //break;
+
+ mlm_name := "SCH_Create_General_Order";
+
+ local_session := CDS_SESSION.local;
+
+ error_occurred := false;
+ error_message := "";
+
+ GeneralOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ DiagnosticOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1003,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ try
+
+ if Order_type = "Diagnostic" then
+ DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ Order_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // Create Reason
+ WSRequestedBy_obj, // RequestedBy ObjectsPlus object
+ WSRequestedBySource, // Requesting Source
+ WSSessionType, // Session type
+ WSSessionReason, // Session reason
+ WSlocation_obj, // Location ReleaseLocGrpID
+ "Never" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+
+ DiagnosticOrder_Obj.RequestedDate := RequestedDate; //CSR 31748
+ DiagnosticOrder_Obj.RequestedTime := RequestedTime; //CSR 31748
+
+ DiagnosticOrder_dest.ObjectsPlus := DiagnosticOrder_obj;
+
+ elseif Order_type = "other" then
+ // Create the prefilled General order
+ GeneralOrder_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ Order_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // Create Reason
+ WSRequestedBy_obj, // RequestedBy ObjectsPlus object
+ WSRequestedBySource, // Requesting Source
+ WSSessionType, // Session type
+ WSSessionReason, // Session reason
+ WSlocation_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+
+ if (Order_catalog_item.Name = "Catheter: Foley") then
+ val := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "NUR_Catheter Medical Necessity","Device present on admission, EDand OR" ;
+ GeneralOrder_obj.SpecialInstructions := "Device(s) present on admission, ED, and OR";
+ endif;
+
+ if (Order_catalog_item.Name = "Catheter: Port") then
+ GeneralOrder_obj.SpecialInstructions := "Device(s) present on admission, ED, and OR";
+ endif;
+
+ if (Order_catalog_item.Name = "Catheter: IV") then
+ GeneralOrder_obj.SpecialInstructions := "Device(s) present on admission, ED, and OR";
+ endif;
+
+ if (Order_catalog_item.Name = "Catheter: Central Line") then
+ GeneralOrder_obj.SpecialInstructions := "Device(s) present on admission, ED, and OR";
+ endif;
+
+ if (Order_catalog_item.Name = "Catheter: PICC Line") then
+ GeneralOrder_obj.SpecialInstructions := "Device(s) present on admission, ED, and OR";
+ endif;
+
+ if (Order_catalog_item.Name = "Dietitian Consult") then
+ val1 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "NUTR_Consult Reasons","New Onset Diabetes" ;
+ endif;
+
+ if (Order_catalog_item.Name = "Infusion Center Consult") then
+ val2 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "INF_Consult Reason","Device(s) present on admission, ED, OR" ;
+
+ // Changes by Shivprasad Jadhav On 06 Jan 2015
+
+ val9 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "INF_Reason","Device(s) present on admission, ED, OR" ;
+ Val9.Control_Mandatory := true;
+
+
+ endif;
+
+ if (Order_catalog_item.Name = "Daily Orders:") then
+
+ val3 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "NUR_DailyOrder","Prealbumin" ;
+
+ val4 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "NUR_DailySchedule","Every Monday and Thursday" ;
+
+ FromDate := now as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}};
+ val5 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue>{{{SINGLE-QUOTE}}} with
+ "NUR_DateField",FromDate ;
+
+ ToDate := (now + 1 days) as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}};
+ val6 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue>{{{SINGLE-QUOTE}}} with
+ "NUR_ToDate",ToDate ;
+
+ GeneralOrder_obj.SpecialInstructions := "if results are less than 19.";
+
+ endif;
+
+ if (Order_catalog_item.Name = "Pulmonary Health Education Consult") then
+
+ if ( local_session.SessionReadmissionOrder = "Patient uses Tobacco" ) then
+ val7 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "RESP Pulmonary Health Education","Smoking Cessation" ;
+ elseif ( local_session.SessionReadmissionOrder = "Quit Tobacco Use in the Last 12 months" ) then
+ val8 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "RESP Pulmonary Health Education","Quit Smoking in Last 12 Months" ;
+ endif;
+
+ endif;
+
+ GeneralOrder_dest.ObjectsPlus := GeneralOrder_obj;
+ //VOID := GeneralOrder_obj.Save ;
+ endif;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New" || order_type || " order:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( Order_catalog_item is NOT NULL ) then
+ void:= call Order_catalog_item.Dispose;
+ Order_catalog_item:= null;
+ endif;
+
+ if ( DiagnosticOrder_obj is NOT NULL ) then
+ void:= call DiagnosticOrder_obj.Dispose;
+ DiagnosticOrder_obj:= null;
+ endif;
+
+ if ( GeneralOrder_obj is NOT NULL ) then
+ void:= call GeneralOrder_obj.Dispose;
+ GeneralOrder_obj:= null;
+ endif;
+
+ GeneralOrder_dest := null;
+ DiagnosticOrder_dest := null;
+
+ endcatch;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ Conclude true;
+ ;;
+ action:
+ if Error_occurred
+ then
+
+ write "An error has occured in the MLM {{+B}}SCH_Create_General_Order{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+ if EXISTS GeneralOrder_dest then
+ write true at GeneralOrder_dest;
+ endif;
+
+ if EXISTS DiagnosticOrder_dest then
+ write true at DiagnosticOrder_dest;
+ endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_HEALTH_ISSUE_FROM_ORDER_FORM.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_HEALTH_ISSUE_FROM_ORDER_FORM.mlm
new file mode 100644
index 0000000..3fb193f
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_HEALTH_ISSUE_FROM_ORDER_FORM.mlm
@@ -0,0 +1,201 @@
+maintenance:
+
+ title: SCH_Create_Health_Issue_From_Order_Form;;
+ mlmname: SCH_Create_Health_Issue_From_Order_Form;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair Hospital;;
+ author: Eclipsys;;
+ specialist: ;;
+ date: 2011-03-23;;
+ validation: testing;;
+
+library:
+ purpose: Create a Health Issue from an Order Form selection.
+
+ ;;
+ explanation: Create a Health Issue from an order form
+
+ Change history
+
+ 03.23.2011 DW Created
+ 07.07.2011 DW Added logic to stop processing early in the MLM when there is no health issue found in the message
+ 06.03.2014 DW CSR# 31688 Changes for MU2
+ 03.11.2016 DW CSR# 34077 Transitional Care order set (updated the programming for ICD10, as it was unused since before the 10.1.2015 cutover from ICD09)
+
+ ;;
+ keywords: Order, Create Health Issue
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /* Set to true if logging is needed.*/
+ log_execution_info:= FALSE;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ admit_order_enter_event := EVENT {OrderEnter User Order: WHERE Name in ("Admit to Inpatient","Place in Observation")};
+
+ NewHealthIssue_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Health Issue Object",
+ rule_number := 2010 ];
+
+
+ client_GUID := read last { ClientInfo: GUID };
+ chart_GUID := read last { ClientVisit: chartGUID };
+ Client_Visit_Guid := read last { ClientVisit: GUID };
+ userguid,user_id :=read last {UserInfo: guid,idcode};
+
+ // obtain the location info
+ order, Summary:= read last {Order: Name,Summaryline REFERENCING EvokingObject};
+
+ HealthIssueEntered := Summary matches pattern "%[%" ;
+
+If HealthIssueEntered = true then
+
+// Parse the Health Issue selection entered by the user
+
+
+// Parse out the Name
+
+ substring_mlm := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_BETWEEN{{{SINGLE-QUOTE}}};
+ EnteredNameNumber :=CALL substring_mlm with (Summary,"[","]");
+
+ EndOfName := find "..." in string EnteredNameNumber;
+ EnteredName := SUBSTRING (EndOfName-1) CHARACTERS FROM EnteredNameNumber;
+
+// Parse out the Number
+
+ EndOfNumber := find "..." in string EnteredNameNumber;
+ DotsandNumber:= SUBSTRING 10 CHARACTERS STARTING AT EndOfNumber from EnteredNameNumber;
+ ICDCode := SUBSTRING 10 CHARACTERS STARTING AT 4 from DotsandNumber;
+
+ Proceed := "Yes";
+
+ HI_Present := read
+ { " select hi.ICD10Code "
+ || " from cv3healthissuedeclaration hi with (nolock) "
+ || " where hi.ICD10Code = {{{SINGLE-QUOTE}}}" || ICDCode || "{{{SINGLE-QUOTE}}} "
+ || " and hi.clientguid = " || client_GUID || " and hi.ChartGUID = " || chart_GUID || " and hi.ClientVisitGUID = " || Client_Visit_Guid || " "
+ || " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and hi.TypeCode = {{{SINGLE-QUOTE}}}Admit Diag{{{SINGLE-QUOTE}}} "
+ };
+
+ else
+
+ Proceed := "No";
+
+ endif;
+
+
+ ;;
+ evoke: admit_order_enter_event;
+
+
+ ;;
+ logic:
+
+
+ If Proceed = "Yes" and not exists HI_Present then
+
+ try
+ //get the .NET version of the Client Visit object. Needed to create new
+ //ObjectsPlus objects
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((Client_Visit_Guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" ||
+ ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ // If the client object cannot be retrieved, do not attempt
+ // to create any ObjectsPlus objects.
+ conclude true;
+ endcatch;
+
+ try
+ //---------------------------------------------------------
+ // New HealthIssue Example
+ //---------------------------------------------------------
+
+ // Type and Code information for creating a new HealthIssue
+
+
+ issuename := EnteredName;
+ issuecode := ICDCode;
+
+ NewHealthIssueHIType := "Admit Diag";
+ NewHealthIssueHICode := issuecode;
+ NewHealthIssueHIScheme := "ICD10";
+
+
+ Terms := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindIMOTerms with (NewHealthIssueHIScheme,NewHealthIssueHICode);
+ FOR i IN 1 SEQTO (Terms.Count as Number ) DO
+ HI_obj := Terms[i];
+ HI_Name := HI_obj.TermName as string;
+ If HI_Name = issuename then
+ HI_NO := i ;
+ Endif;
+ ENDDO;
+ If HI_NO is Null Then
+ HI_NO :=1 ;
+ Endif;
+ New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, Terms[HI_NO]);
+
+ // Set some properties of the healthIssue
+
+ dd := EXTRACT Day now;
+ mn := EXTRACT Month now;
+ yr := EXTRACT Year now;
+
+ PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} );
+ New_HealthIssue_obj.OnsetDate := PartialDate_obj;
+ New_HealthIssue_obj.Text := "Created via order set entry " ;
+ New_HealthIssue_obj.Name := issuename;
+ NewHealthIssue_dest.ObjectsPlus := New_HealthIssue_obj;
+
+
+ endtry;
+ catch exception ex
+ error_occurred := true;
+
+ if ( New_HealthIssue_obj is NOT NULL ) then
+ void:= call New_HealthIssue_obj.Dispose;
+ New_HealthIssue_obj:= null;
+ endif;
+
+ NewHealthIssue_dest := null;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+
+
+ conclude true;
+
+else
+
+conclude false;
+
+endif;
+
+ ;;
+ action:
+ if exists NewHealthIssue_dest then
+ write TRUE at NewHealthIssue_dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_LACTIC_ACID_FROM_RESULT.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_LACTIC_ACID_FROM_RESULT.mlm
new file mode 100644
index 0000000..ad24535
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_LACTIC_ACID_FROM_RESULT.mlm
@@ -0,0 +1,315 @@
+maintenance:
+
+ title: SCH_CREATE_LACTIC_ACID_FROM_RESULT;;
+ mlmname: SCH_CREATE_LACTIC_ACID_FROM_RESULT;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Eclipsys, Test MLM;;
+ author: Dean Miklavic;;
+ specialist: Shawn Head;;
+ date: 2015-11-24;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will create a Lactic Acid order when the first Lactic Acid result of the visit has a value greater than 2
+
+
+ ;;
+ explanation: This orders created by this MLM will by-pass the order entry worksheet
+ and will write directly to the database once the evoking object is saved.
+
+
+ Change history
+
+ 11.24.2015 STH CSR#: 33871 created (copied from the CPK MLM which is similar) {Go-Live 12/9/2015}
+ 01.08.2015 DW CSR#: 33901 Most Wired - add Lactic Acid result to the status board by updating an Enterprise Defined Collumn
+ 01.15.2016 STH CSR#: 34007 Updated to ALWAYS create Lactic Acid Venous order, and added new field that will identify that the Order was Repeat per sepsis protocol.
+ 02.02.2016 STH CSR#: 34060 New Lactic Acid result Lactate, VBG, POC needs added
+ 02.25.2016 STH Ticket#: 2058705 Issue with >20 result value
+ 03.20.2017 STH Ticket #: 2520675 Repeat lab orders getting entered on outpatient visit. Added logic to only order on Inpatient, Emergency, and Outpatient in a bed (based on visit type "clinic" and bedlocation like "INFUS-%")
+ ;;
+ keywords: ObjectsPlus, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+
+ ////// Added on 01.08.2015 by DW for CSR#: 33901 //////
+
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}}; // MLM that creates the Enterprise Defined Column in the "Action" section of the MLM
+ EDCObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
+
+ ////// Added on 01.08.2015 by DW for CSR#: 33901 //////
+
+
+
+ observation_enter_event := event { ObservationEnter Any Observation: where (itemname in ("Lactate, VBG, POC","Lactate, ABG, POC","LACTATE, ABG POC","Lactic Acid Venous","Lactic Acid Arterial","Lactic Acid Arterial from Blood Gas") AND (IsHistory = FALSE AND Active = TRUE))};
+
+ // If called by the editor
+
+ If called_by_editor then EvokingObject := read last { Observation: This }; endif;
+//
+
+ // Gather data
+
+ ( OrderGUID, resultValue ) := read last { Observation: OrderGUID, Value REFERENCING EvokingObject};
+
+ (ClientVisitGUID, ChartGUID, ClientGUID, ReqByGUID, CodedTime, location_guid, OrderName, currentlocation, visittype) := Read Last {" Select
+ a.ClientVisitGUID, a.ChartGUID, a.ClientGUID, a.CareProviderGUID, a.RequestedTime, b.CurrentLocationGUID, a.name, b.currentlocation, b.typecode
+ from CV3Order a with (nolock) Join CV3ClientVisit b with(nolock) on
+ a.ClientVisitGUID = b.GUID and a.ClientGUID = b.ClientGUID and a.ChartGUID = b.ChartGUID and a.GUID = " || SQL(OrderGUID) };
+
+
+ HighLacticAcidValueEntered := false;
+ if (resultValue = ">20.0") then
+ resultValueNumeric := 3;
+ else
+ resultValueNumeric := resultValue as number;
+ endif;
+
+ if(visittype in ("Inpatient","Emergency","Observation")) then
+ validpatient := true;
+ else
+ validpatient := false;
+ endif;
+
+ if ((resultValueNumeric > 2) and (validpatient)) then
+
+
+ (InitResultGUID_lt2, InitSignificantdtm, OrderDTTM_rnd2wholehr, OrderDTTM_exact4hours) := Read Last {" declare @labresult char (10) set @labresult = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}}
+ select top 1 o.GUID
+ ,o.significantdtm , dateadd(hour, 4 + datediff(hour, 0, o.SignificantDtm), 0) as {{{SINGLE-QUOTE}}}orderdate_tohour{{{SINGLE-QUOTE}}}, DATEADD(hh,4,o.significantdtm) as {{{SINGLE-QUOTE}}}orderdate _exact4hours{{{SINGLE-QUOTE}}}
+ from CV3BasicObservation ob with (nolock)
+ inner join CV3Order o with (nolock) on o.GUID = ob.OrderGUID and o.ClientGUID = ob.ClientGUID
+ and o.ChartGUID = ob.ChartGUID and o.ClientVisitGUID = ob.ClientVisitGUID
+ where ob.clientguid = " || sql(ClientGUID) || "
+ and ob.chartguid = " || sql(ChartGUID) || "
+ and ob.clientvisitguid = " || sql(ClientVisitGUID) || "
+ and ob.ishistory = 0
+ and ob.ItemName in ({{{SINGLE-QUOTE}}}Lactate, VBG, POC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactate, ABG, POC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Arterial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Arterial from Blood Gas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Venous{{{SINGLE-QUOTE}}})
+ and (ob.value > @labresult or ob.value = {{{SINGLE-QUOTE}}}>20.0{{{SINGLE-QUOTE}}})
+ order by o.SignificantDtm, o.TouchedWhen, o.Entered asc "};
+
+ //check to see if the result trigger MLM is the same as the oldest result saved to the database with a value > 2.
+ if InitResultGUID_lt2 = OrderGUID then
+
+ //check to see if there is already an active order for lactic acid with a requested date in-side the 4 hour window of the significant date/time of the result that filed.
+ Chk4ValidOrder := Read Last {" select top 1 o.guid from CV3Order o with (nolock)
+ where o.clientguid = " || sql(ClientGUID) || "
+ and o.chartguid = " || sql(ChartGUID) || "
+ and o.clientvisitguid = " || sql(ClientVisitGUID) || "
+ and o.GUID <> " || sql(OrderGUID) || "
+ and o.name in ({{{SINGLE-QUOTE}}}Blood Gas Venous, Point of Care{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Arterial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Venous{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lactic Acid Arterial from Blood Gas{{{SINGLE-QUOTE}}})
+ and o.Requesteddtm >= " || sql(InitSignificantdtm) || "
+ and o.RequestedDtm <= " || sql(OrderDTTM_exact4hours) || "
+ and o.orderstatuscode not like {{{SINGLE-QUOTE}}}can%{{{SINGLE-QUOTE}}} and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "};
+
+ if ((Chk4ValidOrder is null) and (OrderDTTM_rnd2wholehr > now)) then
+ /*--removed 1-15-2016 so Lactic Acid Venous is always ordered no matter what
+ if OrderName matches pattern "%Arterial%" then
+ reordername := "Lactic Acid Arterial";
+ reorderpiority := "Collected Specimen Time";
+ else
+ reordername := "Lactic Acid Venous";
+ reorderpiority := "Scheduled Time";
+ endif;
+ */
+ reordername := "Lactic Acid Venous";
+ reorderpiority := "Scheduled Time";
+ reqdate := (extract year OrderDTTM_rnd2wholehr) || "-" || ((extract month OrderDTTM_rnd2wholehr) formatted with "%0.2d")
+ || "-" || ((extract day OrderDTTM_rnd2wholehr) formatted with "%0.2d");
+
+ ReqTimeHR := (extract hour OrderDTTM_rnd2wholehr);
+ ReqTimeMin := ((extract minute OrderDTTM_rnd2wholehr) formatted with "%0.2d");
+ HighLacticAcidValueEntered := true;
+ endif;
+ endif;
+
+ //END OF RESULTVALUENUMERIC > 2 IF STATEMENT
+ endif;
+
+
+
+
+ // Order and Error Destinations
+
+ DiagnosticOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1003,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+ // Build some preliminary objects
+ if ((HighLacticAcidValueEntered = true) and (validpatient)) then
+ try
+ SessionType := "Standard";
+ SessionReason := "";
+ RequestedBySource := "";
+ OrderCreationReason := "Automatically created by MLM";
+ RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( ReqByGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} ); //Int64
+ Location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ ClientVisit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ endtry;
+
+ // Failed to build preliminary objects - Dispose
+
+ catch Exception ex
+ error_occurred:= true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( ClientVisit_obj is NOT NULL ) then void:= call ClientVisit_obj.Dispose; ClientVisit_obj:= null; endif;
+ if ( RequestedBy_obj is NOT NULL) then void:= call RequestedBy_obj.Dispose; RequestedBy_obj:= null; endif;
+ if ( Location_obj is NOT NULL ) then void:= call Location_obj.Dispose; Location_obj:= null; endif;
+ endcatch;
+
+ // Build the order object
+
+ try
+ //Catalog_Item_Name := "CPK Isoenzymes";
+ diagnostic_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with reordername;
+
+ DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
+ with
+ ClientVisit_obj, // ClientVisit ObjectsPlus object
+ diagnostic_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ OrderCreationReason, // CreateReason
+ RequestedBy_obj, // RequestedBy ObjectsPlus object
+ RequestedBySource, // string RequestedBySource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ Location_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+
+ // Populate the Requested Time field
+
+
+ DiagnosticOrder_obj.RequestedDate := reqdate;
+ ReqTime_obj := new net_object {{{SINGLE-QUOTE}}}RequestedTime{{{SINGLE-QUOTE}}};
+ ReqTime_obj.CodedTime := reorderpiority;
+ time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} with (ReqTimeHR As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, (ReqTimeMin As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
+ ReqTime_obj.time := time_obj;
+
+ if (reordername = "Lactic Acid Venous") then
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldMandatory{{{SINGLE-QUOTE}}} with "LAB_Order Priorities",false;
+ endif;
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldVisible{{{SINGLE-QUOTE}}} with "RequestedTime",true;
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "RequestedTime",false;
+ DiagnosticOrder_obj.RequestedTime := ReqTime_obj;
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "LAB_Info Summary",false;
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "LAB_Info Summary", "Repeat per sepsis protocol" ;
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "LAB_Info Summary",true;
+
+ DiagnosticOrder_dest.ObjectsPlus := DiagnosticOrder_obj;
+ endtry;
+
+ // Failed to build the order object and make the order - Return error and dispose
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( diagnostic_catalog_item is NOT NULL ) then void:= call diagnostic_catalog_item.Dispose; diagnostic_catalog_item:= null; endif;
+ if ( DiagnosticOrder_obj is NOT NULL ) then void:= call DiagnosticOrder_obj.Dispose; DiagnosticOrder_obj:= null; endif;
+ DiagnosticOrder_dest := null;
+ endcatch;
+
+ // Dispose
+
+ if ( ClientVisit_obj is NOT NULL ) then void:= call ClientVisit_obj.Dispose; ClientVisit_obj:= null; endif;
+ if ( RequestedBy_obj is NOT NULL ) then void:= call RequestedBy_obj.Dispose; RequestedBy_obj:= null; endif;
+ if ( Location_obj is NOT NULL ) then void:= call Location_obj.Dispose; Location_obj:= null; endif;
+ endif;
+
+ ;;
+
+ priority: 90
+ ;;
+ evoke:
+ 5 seconds after time of observation_enter_event;
+ ;;
+ logic:
+
+
+ ////// Added on 01.08.2015 by DW for CSR#: 33901 //////
+ if(validpatient) then
+ if resultValueNumeric > 2
+ then col_value := "Elevated";
+ else col_value := "";
+ endif;
+
+ Lactic_Collumn:= NEW EDCObj WITH
+ [
+ column_name := "Lactic Acid Result",
+ column_value := col_value,
+ client_guid := ClientGUID,
+ chart_guid := ChartGUID,
+ client_visit_guid := ClientVisitGUID
+ ];
+
+ return_value := call create_ED_column with ( Lactic_Collumn );
+
+ conclude true;
+ else
+ conclude false;
+ endif;
+
+ ////// Added on 01.08.2015 by DW for CSR#: 33901 //////
+
+
+
+/*
+ if HighLacticAcidValueEntered = true
+ then conclude true;
+ conclusion := "true";
+
+ else
+ conclude false;
+ conclusion := "false";
+
+ endif;
+*/
+ ;;
+ action:
+
+ if Error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}SCH_CREATE_LACTIC_ACID_FROM_RESULT{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+
+ write "1. " || error_message at error_destination;
+
+ endif;
+
+ if EXISTS DiagnosticOrder_dest then
+ write true at DiagnosticOrder_dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_MEDICARE44.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_MEDICARE44.mlm
new file mode 100644
index 0000000..927f3b8
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_MEDICARE44.mlm
@@ -0,0 +1,208 @@
+maintenance:
+
+ title: SCH_CREATE_MEDICARE44;;
+ mlmname: SCH_CREATE_MEDICARE44;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St. Clair Hospital ;;
+ author: Shawn Head, Allscripts/St. Clair Hospital x7468;;
+ specialist: Peggy Karish, Allscripts/St. Clair Hospital ;;
+ date: 2017-05-26;;
+ validation: testing;;
+
+library:
+ purpose: Automatically create a duplicate Code 44 order to be sent to Physician Advison
+ ;;
+ explanation: When patients are being changed to a Medicare Code status of 44 Medidare requires 2 signoff{{{SINGLE-QUOTE}}}s (Physician advisor and attending physician).
+
+***********************CHANGE HISTORY************************
+ 05-27-2017 - STH - CSR#: 32795 - created
+
+*************************************************************
+
+ ;;
+ keywords: Create Order, Medicare, Status 44
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ /*------------------------------BEGIN USER EDIT SECTION------------------------------*/
+
+
+ (UpdateStringFields) := ("NUR_GenAdditionalTxt","CM_Rationale");
+ (UpdateDateFields) := ("CM_ Communcation Date");
+ (UpdateCheckBoxFields) := ("CM_Observation CB");
+
+
+ /*------------------------------END USER EDIT SECTION------------------------------*/
+
+ log_execution_info:= FALSE;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ on_order_enter := event {OrderWorksheetSubmit User } ;
+ from_order_name := "Code 44 - Attending";
+ CreateCode44Order := false;
+ UnSub_Code44_Attending_order := read last { UNSUBMITTED Order: Name where name = "Code 44 - Physician Advisor" };
+ if(UnSub_Code44_Attending_order is null) then
+ userguid,user_id :=read last {UserInfo: guid,idcode};
+ (ReadUnSub_Code44_AdvisorUD, CP_GUID, OrderName, sessiontype, requesteddate, requestedtime) := read last { UNSUBMITTED Order: OrderUserData , careproviderguid , name , InitialSessionTypeCode, RequestedDate, RequestedTime where name = "Code 44 - Attending"};
+ if(count(ReadUnSub_Code44_AdvisorUD) > 0) then
+ (clientGUID, chartGUID, ClientVisitGUID, LocationGUID) := read last { ClientVisit: ClientGUID, ChartGUID, GUID, CurrentLocationGUID };
+ (Code44_Advisor) := read last { " select guid from cv3order o with (nolock)
+ where o.ClientGUID = " || sql(ClientGUID)
+ || " and o.chartguid = " || sql(chartGUID)
+ || " and o.clientvisitguid = " || sql(ClientVisitGUID)
+ || " and o.name = ({{{SINGLE-QUOTE}}}Code 44 - Physician Advisor{{{SINGLE-QUOTE}}})
+ and o.orderstatuscode not in ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HISDP{{{SINGLE-QUOTE}}}) " };
+ if(Code44_Advisor is null) then
+ (userdatacode, value ) := read { OrderUserData: UserDataCode, Value REFERENCING ReadUnSub_Code44_AdvisorUD } ;
+ CreateCode44Order := true;
+ endif;
+ endif;
+ endif;
+
+ if(CreateCode44Order) then
+
+ try
+ CV_Obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ WSSessionType := trim(sessiontype[1]);
+ if(sessiontype[1] = "Hold") then
+ WSSessionReason := "Hold Orders";
+ else
+ WSSessionReason := "";
+ endif;
+
+
+ //This will find the care provider GUID for the "Physician Advisor" user to be used for the auto creatd order.
+ CP_GUID := read last { " select cp.GUID from CV3CareProvider cp with (nolock)
+ inner join cv3user u with (nolock)
+ on cp.guid = u.GUID
+ and u.IDCode = {{{SINGLE-QUOTE}}}zzzpacm{{{SINGLE-QUOTE}}} " };
+
+ RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((CP_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((LocationGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( CV_Obj is NOT NULL ) then
+ void:= call CV_Obj.Dispose;
+ CV_Obj:= null;
+ endif;
+
+ if ( RequestedBy_obj is NOT NULL ) then
+ void:= call RequestedBy_obj.Dispose;
+ RequestedBy_obj:= null;
+ endif;
+
+ if ( location_obj is NOT NULL ) then
+ void:= call location_obj.Dispose;
+ location_obj:= null;
+ endif;
+
+ endcatch;
+
+
+ try
+
+ Catalog_Item_Name := "Code 44 - Physician Advisor";
+ order_type := "other";
+ modifier := "";
+ modversion := "";
+ WSRequestedBySource := "Protocol Order";
+ order_Creation_Reason := from_order_name || " order.";
+
+
+ order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with Catalog_Item_Name;
+
+ GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with CV_Obj,
+ order_catalog_item,
+ order_Creation_Reason,
+ RequestedBy_obj,
+ WSRequestedBySource,
+ WSSessionType,
+ WSSessionReason,
+ location_obj,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
+ test2 := (extract year requesteddate) formatted with "%04d" || "-" ||
+ (extract month requesteddate) formatted with "%02d" || "-" ||
+ (extract day requesteddate) formatted with "%02d";
+
+ GeneralOrder_obj.RequestedTime := requestedtime;
+
+ RequestedDate := (RequestedDate as time);
+ ModReqDate := (extract year RequestedDate) formatted with "%04d" || "-" ||
+ (extract month RequestedDate) formatted with "%02d" || "-" ||
+ (extract day RequestedDate) formatted with "%02d";
+ ModReqDate := ModReqDate as string;
+
+
+ GeneralOrder_obj.RequestedDate := ModReqDate;
+
+
+ for x in (1 seqto(count(userdatacode))) do
+ ud1 := userdatacode[x];
+ v1 := value[x];
+ if(userdatacode[x] in (UpdateStringFields)) then
+ retval := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ userdatacode[x], value[x] ;
+ endif;
+ if(userdatacode[x] in (UpdateDateFields)) then
+ PatientCommunicationDate := ((value[x] as time) as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}});
+ val6 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue>{{{SINGLE-QUOTE}}} with
+ userdatacode[x],PatientCommunicationDate ;
+ endif;
+ if(userdatacode[x] in (UpdateCheckBoxFields)) then
+ AttendingOrdObsCB := (value[x] as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}});
+ retval := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ userdatacode[x], AttendingOrdObsCB;
+ endif;
+ enddo;
+
+ if( GeneralOrder_obj is NOT NULL ) then
+ void := call GeneralOrder_Obj.Save;
+ void := call GeneralOrder_Obj.Dispose;
+ endif;
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}New General order:{{-R}}\n" ||
+ ex.Message || "\n\n";
+ endcatch;
+
+ if ( Order_catalog_item is NOT NULL ) then
+ void:= call Order_catalog_item.Dispose;
+ Order_catalog_item:= null;
+ endif;
+
+ endif;
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ on_order_enter;
+ ;;
+ logic:
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_OMP_DISCHARGE_MED_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_OMP_DISCHARGE_MED_ORDER.mlm
new file mode 100644
index 0000000..6a4a591
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_OMP_DISCHARGE_MED_ORDER.mlm
@@ -0,0 +1,135 @@
+maintenance:
+
+ title: ;;
+ mlmname: SCH_Create_OMP_Discharge_Med_Order;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: ;;
+ author: Don Warnick ;;
+ specialist: ;;
+ date: 2011-06-09;;
+ validation: testing;;
+
+library:
+ purpose: Generate a Discharge Medication order at the time discharge
+ ;;
+ explanation: When a discharge occurs, an order is created for each therapeutic class of order found in in the patient{{{SINGLE-QUOTE}}}s
+ OMP. The therapeutic class associated with the order is found in the class type field of the UDDI.
+ Only UDDI{{{SINGLE-QUOTE}}}s with the name beginning with the letters "Dicharge Medications - "
+
+ Change history
+
+ 06.09.2011 DW Created
+ 07.24.2013 DW HD #159442 Filtered out all but the discharge omp meds and changed from a discharge to a standard session
+ 05.31.2019 JML 18.4 SCM Upgrade - changed username {{{SINGLE-QUOTE}}}interfaces{{{SINGLE-QUOTE}}} to {{{SINGLE-QUOTE}}}%services{{{SINGLE-QUOTE}}} as user that enters order.
+
+ ;;
+ keywords: OMP Discharge Orders, Meaningful Use
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+
+
+ clientvisit_enter_event := EVENT{ClientVisitDischarge User ClientVisit };
+
+ (ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject};
+ // (UserGUID ) := read last { UserInfo: GUID };
+ (UserGUID ) := read last {select guid from CV3User with (nolock) where IDCode like {{{SINGLE-QUOTE}}}%services{{{SINGLE-QUOTE}}}};
+
+ Func_Discharge_Med_Order_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_OMP_Discharge_Med_Order{{{SINGLE-QUOTE}}};
+
+
+ (Order_Names, Order_Classes) := read {"select mi.Name, ctv.value from CV3OrderCatalogMasterItem mi with (nolock)
+ join cv3catalogclasstypevalue ctv with (nolock) on ctv.catalogmasterguid = mi.guid
+ join cv3classtype ct with (nolock) on ct.guid = ctv.classtypeguid and ct.code = {{{SINGLE-QUOTE}}}DI_Med Therapeutic Classes{{{SINGLE-QUOTE}}}
+ where mi.Name like {{{SINGLE-QUOTE}}}discharge medication - %{{{SINGLE-QUOTE}}}"};
+
+
+ (Sub_Order_Names, Sub_Order_Classes) := read {"select mi.Name, ctv.value from CV3OrderCatalogMasterItem mi with (nolock)
+ join cv3catalogclasstypevalue ctv with (nolock) on ctv.catalogmasterguid = mi.guid
+ join cv3classtype ct with (nolock) on ct.guid = ctv.classtypeguid and ct.code = {{{SINGLE-QUOTE}}}DI_Med Therapeutic Classes{{{SINGLE-QUOTE}}}
+ where mi.Name like {{{SINGLE-QUOTE}}}discharge medication --%{{{SINGLE-QUOTE}}}"};
+
+
+
+ Order_Accumulator:= " ";
+
+ for i in 1 seqto count Order_Names do
+ ThisOrder_Name := Order_Names [i];
+ Order_Class := Order_Classes[i];
+
+
+ (OMP_Meds) := read {" SET CONCAT_NULL_YIELDS_NULL off select distinct
+ p.DrugName + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast (p.DoseAmount AS varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + p.Instructions
+ from sxaambclientprescription p with (nolock)
+ join SXAAMBDrugCategoryXRef xr with (nolock) on xr.GenericNameID = p.GenericNameID
+ join SXAAMBDrugCategory dc with (nolock) on xr.drugcategoryid = dc.DrugCategoryID
+ join SXAAMBDrugCategory dc2 with (nolock) on dc.ParentDrugCategoryID = dc2.DrugCategoryID
+ where p.ClientGuid = " || ClientGuid || " and p.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ and dc2.CategoryName = {{{SINGLE-QUOTE}}}" || Order_Class || "{{{SINGLE-QUOTE}}}"};
+
+ ThisOMP_Med:= " ";
+ SpecialInstructions:= " ";
+
+ for i in 1 seqto count OMP_Meds do
+ ThisOMP_Med := OMP_Meds [i];
+ SpecialInstructions := SpecialInstructions || " \n " || ThisOMP_Med ;
+ enddo;
+
+ If SpecialInstructions <> " " then
+ void := call Func_Discharge_Med_Order_MLM with (ClientVisitGuid, ChartGuid, ClientGuid, UserGUID, SpecialInstructions, ThisOrder_Name);
+ endif;
+
+ enddo;
+
+
+
+ Order_Accumulator:= " ";
+
+ for i in 1 seqto count Sub_Order_Names do
+ ThisOrder_Name := Sub_Order_Names [i];
+ Order_Class := Sub_Order_Classes[i];
+
+
+ (OMP_Meds) := read {" SET CONCAT_NULL_YIELDS_NULL off select distinct
+ p.DrugName + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast (p.DoseAmount AS varchar) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + p.Instructions
+ from sxaambclientprescription p with (nolock)
+ join SXAAMBDrugCategoryXRef xr with (nolock) on xr.GenericNameID = p.GenericNameID
+ join SXAAMBDrugCategory dc with (nolock) on xr.drugcategoryid = dc.DrugCategoryID
+ where p.ClientGuid = " || ClientGuid || "
+ and dc.CategoryName = {{{SINGLE-QUOTE}}}" || Order_Class || "{{{SINGLE-QUOTE}}}"};
+
+ ThisOMP_Med:= " ";
+ SpecialInstructions:= " ";
+
+ for i in 1 seqto count OMP_Meds do
+ ThisOMP_Med := OMP_Meds [i];
+ SpecialInstructions := SpecialInstructions || " \n " || ThisOMP_Med ;
+ enddo;
+
+ If SpecialInstructions <> " " then
+ void := call Func_Discharge_Med_Order_MLM with (ClientVisitGuid, ChartGuid, ClientGuid, UserGUID, SpecialInstructions, ThisOrder_Name);
+ endif;
+ enddo;
+
+
+
+ ;;
+ evoke: 0 minutes after time of clientvisit_enter_event;
+ // clientvisit_enter_event ;
+
+ ;;
+ logic:
+ Conclude true ;
+ ;;
+ action:
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_RECON_RQMT_MAIN.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_RECON_RQMT_MAIN.mlm
new file mode 100644
index 0000000..9d261d4
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_RECON_RQMT_MAIN.mlm
@@ -0,0 +1,562 @@
+maintenance:
+
+ title: Create Order Reconcile Requirement Main MLM;;
+ mlmname: SCH_CREATE_RECON_RQMT_MAIN;;
+ arden: version 2.5;;
+ version: 5.00;; // SP1
+ institution: Eclipsys, Standard MLM;;
+ author: Eclipsys Corporation;;
+ specialist: ;;
+ date: 2008-04-23;;
+ validation: testing;;
+
+library:
+ purpose:
+ This MLM creates Requirements for Order Reconciliation based on site defined policies.
+ ;;
+ explanation:
+ This MLM creates Order Reconciliation Requirements based on site policies that the site
+ defines in the functional MLMs called by this MLM. Once created these Requirements are
+ used to set a flag on the Patient List to indicate whether Order Reconciliation is due
+ or overdue.
+ When Orders are reconciled, the Reconciliation is linked to the Requirement.
+
+ Note : the Order Reconciliation can occur before the Requirement is created. If this is
+ the case, the application links the Requirement to the Order Reconciliation
+ using the data stored for each requirement created by the MLM.
+
+
+ The CDS Trigger Events where this MLM will be evoked are as follows:
+ . Admit a patient to a specific Facility, Location Function Group or a particular
+ Location Group
+ . Transfer patient from a specific Facility, Location Function Group or a particular
+ Location Group to a specific Facility, Location Function Group or a
+ particular Location Group
+ . Transfer patient to a specific VisitType\Care Level\Service
+ . Transfer patient to a specific Provider on particular units
+ . Discharge a patient from a specific Facility, Location Function Group or a
+ particular Location Group
+ . Enter a ?discharge? order from a specific Facility, Location Function Group or
+ a particular Location Group
+ . Enter a ?transfer? order from a specific Facility, Location Function Group or a
+ particular Location Group to a specific Facility, Location Function Group or
+ a particular Location Group
+
+ This MLM writes to the Destination only when the MLM
+ concludes TRUE to ensure that the Requirement is only created when the user has
+ proceeded beyond any possible Alerts to save the data to the database.
+
+
+ Based on ?rules? defined in this MLM, the logic will determine:
+ . When a Reconciliation Requirement is to be created
+ . What type of Reconciliation can be linked to the Requirement being created
+ . What the time frame is used for linking an Order Reconciliation to a Requirement
+ . When the Reconciliation is to be considered overdue
+ . The locations, Location Function Groups, and Facilities that use a given rule
+ . The various VisitType/CareLevel/Service changes that use a given rule
+ . The various Provider Type and Role changes that use a given rule
+ . Various Orders for transfer and discharge that use a given rule bases on the
+ class associated with the item in the Item Catalog
+
+ To support their own site policies for when Order Reconciliation should be performed,
+ sites must code their preferences for these {{{SINGLE-QUOTE}}}rules{{{SINGLE-QUOTE}}} in the supporting Functional MLMs.
+ The order - class associations must be configured in the Item Catalog.
+ The MLM will create the Requirement using these site policy definitions.
+
+
+ In order to populate the Reconciliation Requirement, the MLM will pass the following
+ information to the Eclipsys function.
+ . The ClientGUID
+ . The ChartGUID
+ . The ClientVisitGUID from the Evoking Object
+ . Type of the reconciliation requirement. Seven types are supported:
+ - Admission,
+ - Location Change
+ - Care Provider Change,
+ - Visit Type\Care Level\Service Change
+ - Discharge
+ - Transfer
+ - Transfer Order
+ - Discharge Order
+ . List of facility defined Reconciliation types.
+ . Precedence for this Requirement.
+ . Timeframe in which this Requirement should be linked.
+ . DateTime after which the Requirement becomes inactive.
+ . Timeframe in which the Requirement and a previous Order Reconciliation can be
+ auto-linked.
+ . DateTime after which the requirement will become overdue.
+ . GUID of the Order that was for a Transfer or Discharge
+ . FromGUID1 and ToGUID1
+ - For Location Change or Transfer Order, this is the LOcationGUID from the
+ backup ClientVisit and the LocationGUID for the Current
+ ClientVisit.
+ - For Care Provider Change, this is the backup CareProviderVisitRoleGUID
+ and the current CareProviderVisitRoleGUID
+ - For Visit Type/Care Level/Service Change, this is the GUID of the
+ VisitType\Care Level\Service for the backup Clientvisit
+ and the GUID of the VisitType\Care Level\Service for the
+ current ClientVisit.
+;;
+
+ keywords: Order Reconciliation; Policy
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ 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 logging is needed.
+ log_execution_info := false;
+
+ // ----------------------------------------------------------------------------------
+ // Event Statements
+ // ---------------------------------------------------------------------------------
+
+ // To enhance efficiency add filtering clauses where ever possible. For example add a
+ // WHERE clause limiting the Event to match the data configured in the supporting
+ // MLM policy definitions.
+
+
+ //Transfer - add the locations defined in the transfer policy to enhance efficiency
+ //Visit Type, Care Level or Service - add various VistTypes to enhance efficiency
+ client_visit_modify_event := EVENT { ClientVisitModify Any ClientVisit};
+ //WHERE TypeCode in ( "Inpatient" )};
+
+ //Discharge - add locations that are defined in the discharge policy.
+ client_visit_discharge_event := EVENT { ClientVisitDischarge Any ClientVisit};
+ //WHERE TypeCode in ( "Inpatient" )};
+
+ order_enter_event := EVENT {OrderEnter Any Order:
+ WHERE first of ( OrderCatalogMasterItem.CatalogClassTypeValue.Records__
+ WHERE
+ OrderCatalogMasterItem.CatalogClassTypeValue.Records__.Code ="ECLP-Reconciliation Order Type" AND
+ OrderCatalogMasterItem.CatalogClassTypeValue.Records__.Value = "Discharge Order"
+ ) is not null
+ };
+
+ order_modify_event := EVENT {OrderModify Any Order:
+ WHERE first of ( OrderCatalogMasterItem.CatalogClassTypeValue.Records__
+ WHERE
+ OrderCatalogMasterItem.CatalogClassTypeValue.Records__.Code ="ECLP-Reconciliation Order Type" AND
+ OrderCatalogMasterItem.CatalogClassTypeValue.Records__.Value = "Discharge Order"
+ ) is not null
+ };
+
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+
+
+
+ // Flag on how to handle multiple occurences of the same provider role type
+ // (This flag is only applicable when SCMCareProviderRoleType is configured to allow multiple)
+ // (If SCMCareProviderRoleType does not allow multiple, check for valid policy always happen)
+ // If TRUE - check for valid policy for first occurrence only
+ // If FALSE - check for valid policy for all occurrences
+ handle_first_multi_provider_occurrence_flag := TRUE;
+
+ // Error message text can be editted as needed
+ error_destination := destination { Alert: reminder,
+ "Error in order reconciliation", medium, chart };
+
+ /**************************Do not make changes below this Section**********************/
+
+
+ //A variable used to check if a policy record is found
+ policy_record_found := false;
+
+ //A variable used to store order reconciliation requirement
+ my_req := Null;
+ my_req_list := ();
+
+ //A variable used to store policy definition
+ policy_def := null;
+ policydef_list := ();
+
+ // Used when running from the editor
+ if called_by_editor then
+ EvokingObject := read last { ClientVisit: This};
+ //EvokingEvent := client_visit_enter_event; // Admission Event
+ //EvokingEvent := client_visit_modify_event; // Transfer Event, Service Change Event
+ //EvokingEvent := client_visit_discharge_event; // Discharge Event
+
+ //EvokingObject := read last { Order: This};
+ //EvokingEvent := order_enter_event; // Order Transfer, Order Discharge Event
+ //EvokingEvent := order_modify_event; // Order Transfer, Order Discharge Event
+ //EvokingEvent := order_enter_no_iv_additives_event; // Order Transfer Event
+ //EvokingEvent := order_init_event; // Order Discharge Event
+
+ //EvokingObject := read last { CareProviderVisitRole: This};
+ //EvokingEvent := provider_enter_event; // Care Provider Change
+ endif; // if called_by_editor
+
+ // Declare policy specific MLMs that can be called
+ AdmissionPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_ADMISSIONPOLICY{{{SINGLE-QUOTE}}};
+ // TransferPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_TRANSFERPOLICY{{{SINGLE-QUOTE}}};
+ // DischargePolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_DISCHARGEPOLICY{{{SINGLE-QUOTE}}};
+// CareProviderChangePolicy_MLM
+// := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_CAREPROVIDERCHANGEPOLICY{{{SINGLE-QUOTE}}};
+ OrderDischargePolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_ORDERDISCHARGEPOLICY{{{SINGLE-QUOTE}}};
+// OrderTransferPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_ORDERTRANSFERPOLICY{{{SINGLE-QUOTE}}};
+// VisitTypeCareLevelServicePolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_VISITTYPECARELEVELSERVICEPOLICY{{{SINGLE-QUOTE}}};
+
+ SelectPatientLocPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_SelectPatientLocPolicy{{{SINGLE-QUOTE}}};
+// SelectTransferPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_SelectTransferPolicy{{{SINGLE-QUOTE}}};
+// SelectCareProviderPolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_SelectCareProviderPolicy{{{SINGLE-QUOTE}}};
+// SelectServicePolicy_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_SelectServicePolicy{{{SINGLE-QUOTE}}};
+
+ SetDefault_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CREATE_RECON_RQMT_SET_POLICY_DEFAULT{{{SINGLE-QUOTE}}};
+
+ error_occured := false;
+ overridebyloc := false;
+ //Determine the type of event and perform logic for that event
+
+// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 1"
+// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ //**************************//
+ // //
+ // Admission Event SCH changed to transfer from ER Major only //
+ // //
+ //**************************//
+ if EvokingEvent = client_visit_modify_event
+ then
+ // RS 05/10/2010 Added to find previous location
+ (backup_obj) := read last {ClientVisit: Backup REFERENCING EvokingObject};
+ (Bk_Loc_Name, Bk_Loc_GUID, Bk_VisitStatus,Bk_TypeCode,Bk_TemporaryLocation) :=
+ read last {ClientVisit: CurrentLocation,CurrentLocationGUID,VisitStatus,TypeCode, TemporaryLocation REFERENCING backup_obj};
+ // RS 05/10/2010 end of addition
+
+ //Get Required parameters from the evoking object
+ ( visit_client_guid,
+ visit_guid,
+ visit_chart_guid,
+ visit_location_guid,
+ alternate_visit_location_guid,
+ visit_loc_name) := read last
+ {ClientVisit: ClientGUID, GUID, ChartGUID,
+ BusinessRuleLocationGUID, CurrentLocationGUID, currentlocation
+ REFERENCING EvokingObject} ;
+ // RS added to insure that to location is an inpatient bed
+ counter := 0;
+// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "From Location " || Bk_Loc_Name || "\n\n To Location " || visit_loc_name
+// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ counter := read last {" select count(*) from Cv3Location with (nolock) "
+ || " where locngrpguid = " || alternate_visit_location_guid
+ || " and name = " || sql(visit_loc_name)
+ || " and typecode = {{{SINGLE-QUOTE}}}Bed{{{SINGLE-QUOTE}}} "
+ || " and active = 1 "
+ };
+// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 2"
+// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if ((Bk_Loc_Name <> "ER Major") or (counter =0)) then
+ overridebyloc := true;
+// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "I should not create a flag as from loc is " || Bk_Loc_Name || "\n\n and to bed is " || counter
+// ,"Tester","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ else
+// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 3"
+ // ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "I should create a flag as from loc is " || Bk_Loc_Name || "\n\n and to bed is " || counter
+// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ // RS 05/10/2010 added to here, note the extra if above
+ // Will only fire if coming from ER Major and going to a bed
+
+
+ //Ensure location guid value is filled in, if not, use alternate value
+ if (visit_location_guid is NULL)
+ then
+ visit_location_guid := alternate_visit_location_guid;
+ endif;
+
+
+ //Check for existing policy definition
+ (AdmissionPolicyListDef, AdmissionPolicyDefaults):= call AdmissionPolicy_MLM;
+
+// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 4"
+ // ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ //When a patient is admitted, determine if
+ //order reconciliation requirement needs to be created.
+ policy_def := call SelectPatientLocPolicy_MLM with
+ visit_location_guid,
+ AdmissionPolicyListDef;
+
+
+
+ //check for default values
+ policy_def:= call SetDefault_MLM with
+ policy_def,AdmissionPolicyDefaults;
+
+// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 5"
+ // ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+
+//Intentionally left for support purposes
+//eventName:= "Admission";
+//break;
+
+ if (policy_def is NOT NULL)
+ then
+ policy_record_found := true;
+ try
+ reconcileList := policy_def.ReconcileType;
+
+ reconcileTypeColl:= new net_object {{{SINGLE-QUOTE}}}ReconcileTypeCollection{{{SINGLE-QUOTE}}};
+//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 6"
+// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ index_list := 1 seqto (count reconcileList);
+ for ind in index_list do
+ void := call reconcileTypeColl.Add with ( reconcileList[ind] as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
+
+ enddo; //ind in index_list do
+//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 7"
+// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+ // create ObjectsPlus OrderReconciliationRequirement object
+ my_req := call
+ {{{SINGLE-QUOTE}}}OrderReconciliationRequirement{{{SINGLE-QUOTE}}}.CreateAdmissionRequirement
+ with ((visit_client_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}),
+ ((visit_chart_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}),
+ ((visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}),
+ reconcileTypeColl;
+
+// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Marker 8"
+// ,"Tester","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ my_req_list := my_req,my_req_list;
+ policydef_list := policy_def,policydef_list;
+
+ endtry;
+ catch exception ex
+ my_exception := ex;
+ error_occured := True;
+
+ endcatch;
+ endif; // override location change
+ endif; // if(policy_def is NOT NULL)
+
+
+
+ //**************************//
+ // //
+ // Discharge Order Event //
+ // //
+ //**************************//
+ elseif ( (EvokingEvent = order_enter_event)
+ OR (EvokingEvent = order_modify_event)
+ )
+ then
+
+ //Gets information from the evoking Order
+ (visit_guid,
+ order_guid,
+ Ord) := read last
+ {Order: ClientVisitGUID,
+ GUID,
+ This
+ REFERENCING EvokingObject};
+
+ transfer_to_location := Ord.OrderAdditionalInfo.TransferToLocnGUID;
+
+ //Get Required parameters from the ClientVisitObject object
+ ( type_code) := read last
+ {ClientVisit: TypeCode
+ Where GUID = visit_guid } ;
+
+ ( visit_client_guid,
+ visit_chart_guid,
+ visit_location_guid,
+ alternate_visit_location_guid,
+ new_visit_location_guid) := read last
+ {ClientVisit: ClientGUID, ChartGUID,
+ BusinessRuleLocationGUID, CurrentLocationGUID,
+ NextLocnGrpGUID,
+ Where GUID = visit_guid } ;
+
+ //Ensure location guid value is filled in, if not, use alternate value
+ if (visit_location_guid is NULL)
+ then
+ visit_location_guid := alternate_visit_location_guid;
+ endif;
+
+ //Get Order Class Type
+ ocmi := Read last {Order: OrderCatalogMasterItem referencing Ord};
+
+ orderRecCatalogClassTypeValue := first of (ocmi.CatalogClassTypeValue.Records__ where ocmi.CatalogClassTypeValue.Records__.code = "ECLP-Reconciliation Order Type" );
+ classTypeValue := orderRecCatalogClassTypeValue.value;
+
+ if (classTypeValue="Discharge Order")
+ then
+ //Check for existing policy definition
+ (OrderDischargePolicyListDef, OrderDischargePolicyDefaults):= call OrderDischargePolicy_MLM;
+
+ //When a discharge order is placed, determine if
+ //order reconciliation requirement needs to be created.
+ policy_def := call SelectPatientLocPolicy_MLM with
+ visit_location_guid,
+ OrderDischargePolicyListDef;
+
+ //check for default values
+ policy_def:= call SetDefault_MLM with
+ policy_def,OrderDischargePolicyDefaults;
+
+//Intentionally left for support purposes
+//eventName:= "Order Discharge";
+//break;
+ endif;
+
+ if (policy_def is NOT NULL)
+ then
+ policy_record_found := true;
+ try
+
+ // get current client visit object
+ client_visit := call
+ {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ reconcileTypeColl:= new net_object {{{SINGLE-QUOTE}}}ReconcileTypeCollection{{{SINGLE-QUOTE}}};
+
+ reconcileList := policy_def.ReconcileType;
+
+ index_list := 1 seqto (count reconcileList);
+ for ind in index_list do
+ void := call reconcileTypeColl.Add with ( reconcileList[ind] as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
+ enddo; //ind in index_list do
+
+ if (classTypeValue = "Transfer Order")
+ then
+ my_req := call {{{SINGLE-QUOTE}}}OrderReconciliationRequirement{{{SINGLE-QUOTE}}}.CreateTransferOrderRequirement
+ with client_visit,
+ reconcileTypeColl,
+ ((order_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}),
+ ((visit_location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}),
+ ((transfer_to_location as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ elseif (classTypeValue="Discharge Order")
+ then
+ my_req := call {{{SINGLE-QUOTE}}}OrderReconciliationRequirement{{{SINGLE-QUOTE}}}.CreateDischargeOrderRequirement
+ with client_visit,
+ reconcileTypeColl,
+ ((order_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ endif;
+
+ if ( client_visit is NOT NULL ) then
+ void:= call client_visit.Dispose;
+ client_visit:= null;
+ endif;
+
+ my_req_list := my_req,my_req_list;
+ policydef_list := policy_def,policydef_list;
+
+ endtry;
+ catch exception ex
+ my_exception := ex;
+
+ if ( client_visit is NOT NULL ) then
+ void:= call client_visit.Dispose;
+ client_visit:= null;
+ endif;
+
+ index_list := 1 seqto (count my_req_list);
+ for ind in index_list do
+ req_obj := my_req_list[ind];
+ if ( req_obj is NOT NULL ) then
+ void:= call req_obj.Dispose;
+ req_obj:= null;
+ endif;
+ enddo;
+ endcatch;
+
+ endif; // if(policy_def is NOT NULL)
+
+ endif; //if EvokingEvent = client_visit_enter_event
+
+ //******************************//
+ // //
+ // Populate Requirement //
+ // //
+ //******************************//
+ //populate order reconciliation requirement with values
+ if (policy_record_found)
+ then
+ index_list := 1 seqto count(my_req_list);
+ for ind in index_list do
+ req := my_req_list[ind];
+ def := policydef_list[ind];
+
+ if (def.AutoLinkTimeFrame is not Null)
+ then
+ req.AutoLinkTimeframeHours := def.AutoLinkTimeFrame as {{{SINGLE-QUOTE}}}System.Int32{{{SINGLE-QUOTE}}};
+ endif;
+
+ if (def.RequirementPrecedence is not Null)
+ then
+ req.Precedence := def.RequirementPrecedence as {{{SINGLE-QUOTE}}}System.Int32{{{SINGLE-QUOTE}}};
+ endif;
+
+ if (def.RequirementPrecedenceTime is not Null)
+ then
+ req.PrecedenceTimeframeHours := def.RequirementPrecedenceTime
+ as {{{SINGLE-QUOTE}}}System.Int32{{{SINGLE-QUOTE}}};
+ endif;
+
+ if (def.OverDueDtmHours is not Null)
+ then
+ req.OverdueAfter := (NOW + (def.OverDueDtmHours hours))
+ as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}};
+ endif;
+
+ if (def.RequirementCleanupDtmHours is not Null)
+ then
+ req.InactivateAfter := (NOW + (def.RequirementCleanupDtmHours hours))
+ as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}};
+ endif;
+
+ //Define the XA Object Destination for Requirement
+ Reqt_Destination:= destination { XAObject } with [xaobject := req];
+
+ enddo; // ind in index_list do
+ endif; //if(policy_record_found)
+
+
+ ;;
+ evoke:
+
+// client_visit_modify_event OR
+ //client_visit_discharge_event OR
+ order_enter_event OR
+ order_modify_event
+
+ ;;
+
+ logic:
+ if (policy_record_found) and (overridebyloc = false)
+ then
+ conclude TRUE;
+ else
+ conclude FALSE;
+ endif //(policy_record_found)
+ ;;
+ action:
+
+ if (error_occured)
+ then
+ write my_exception at error_destination;
+ else
+ Write true at Reqt_Destination ;
+
+ endif; //(error_occured)
+
+ ;;
+
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_REQUEST_BED_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_REQUEST_BED_ORDER.mlm
new file mode 100644
index 0000000..84c2e99
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_REQUEST_BED_ORDER.mlm
@@ -0,0 +1,236 @@
+maintenance:
+
+ title: SCH_Create_Request_Bed_Order ;;
+ mlmname: SCH_Create_Request_Bed_Order ;;
+ arden: version 2.5;;
+ version: 5.50;; // FP1
+ institution: SCH ;;
+ author: Shivprasad Jadhav ;;
+ specialist: ;;
+ date: 2014-03-13;;
+ validation: testing;;
+
+library:
+ purpose: Creates and saves prefilled and standard orders using ObjectsPlus.
+ Each order will be saved directly to the database once the order on the
+ worksheet is saved.
+
+ ;;
+ explanation: This orders created by this MLM will by-pass the order entry worksheet
+ and will write directly to the database once the evoking object is saved.
+
+ ;;
+ keywords: ObjectsPlus, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+
+//-------------------------------------------------------------------------------
+ // References the LOCAL SESSION object
+ local_session := cds_session.local; // for local_session.SessionRequestBed
+
+//-------------------------------------------------------------------------------
+
+ log_execution_info := false;
+
+ Order_Submit := event {OrderWorksheetSubmit User } ; //Order : WHERE Name Matches pattern "Place in Observation%" } ;//Order: where Name in ("Place in Observation")};
+ onames := read { UNSUBMITTED ORDER: Name};
+ //Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Pediatric Patient Profile")};
+
+
+
+ ( careProvider_obj ) := read last{ UserInfo: careProvider };
+ ( careProvider_Actaul ) := read last{ UserInfo: This };
+
+ /*user_IDType := "Primary";
+
+ CareProviderIDs_obj := read last
+ { CareProvider: CareProviderID
+ REFERENCING careProvider_obj };
+
+ user_IDCode := read last
+ { CareProviderID: IDCode
+ REFERENCING CareProviderIDs_obj
+ where ProviderIDTypeCode = user_IDType }; */
+
+
+ (location_guid, Active_ClientVisitGUID, client_guid) := read last
+ { ClientVisit: CurrentLocationGUID, GUID, clientguid };
+
+ Care_Provider := local_session.SessionRequestedGUID; // careprovider_obj.GUID ; //EVOKINGOBJECT.AuthoredProviderGUID;
+ visitGuid := EVOKINGOBJECT.GUID ;
+
+
+(LocationLevelCode) := read last { "select Top 1 case when cc.typecode = {{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then cc.levelcode when b.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then b.levelcode when a.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then a.levelcode "
+|| " when cv3l.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then cv3l.levelcode else null end as Unit From CV3ClientVisit CV With (nolock) "
+|| " Inner Join Cv3Location L With (nolock) On L.Guid=CV.CurrentLocationGUID AND CV.Active=1 AND CV.VisitStatus={{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}} "
+|| " Left Join Cv3ClientVisitLocation CVL With (nolock) ON CVL.ClientVisitGUID=CV.GUID Left Join CV3Location CV3L On CV3L.GUID=CVL.LocationGUID "
+|| " Left Join CV3Location a With (nolock) on CV3L.parentguid= a.guid Left Join CV3Location b With (nolock) on a.parentguid = b.guid "
+|| " left join cv3location cc With (nolock) on b.parentguid = cc.guid "
+|| " WHERE CVL.Status={{{SINGLE-QUOTE}}}CUR{{{SINGLE-QUOTE}}} and CV.GUID = " || visitGuid || " " };
+
+
+ //If (EVOKINGOBJECT.TypeCode = "EMERGENCY" or EVOKINGOBJECT.TypeCode = "Observation" ) Then
+ If LocationLevelCode In ("5","6","ER") Then
+ If ( "Place in Observation" In onames ) or ( "Admit to Inpatient" In onames ) Then
+
+
+ (Typecode, Username ) := Read first {" Select Typecode, DisplayName from CV3CareProvider With (nolock) Where GUID = " || Care_Provider || " "} ;
+ location_guid := Read First {" Select CurrentLocationGUID from CV3ClientVisit With (nolock) Where GUID = " || visitGuid || " "} ;
+
+ If Typecode is Not in ("PA","CRNP") Then
+ CareProvider_GUID := Care_Provider ;
+ Else
+ CareProvider_GUID := Read First {" Select GUID from CV3CareProvider With (nolock) Where DisplayName = {{{SINGLE-QUOTE}}}Biggs, Jason {{{SINGLE-QUOTE}}} "} ;
+ Endif;
+
+
+
+ DiagnosticOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ order_Creation_Reason := "Created by MLM";
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+
+ IF(visitGuid IS NOT NULL) THEN
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ WSSessionType := "Standard";//"Inpatient Orders";//Standard";//"
+ WSSessionReason := "";
+ WSRequestedBySource := "";//"1 Standard";
+
+ WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( CareProvider_GUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+
+ WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ if ( WSRequestedBy_obj is NOT NULL ) then
+ void:= call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ if ( WSlocation_obj is NOT NULL ) then
+ void:= call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+
+ endcatch;
+ ENDIF;
+
+ if (client_visit_obj is not null) then
+ try
+
+ Catalog_Item_Name := "Request Bed";
+ order_Creation_Reason := "Order Created From MLM";
+
+ // get OrderCatalogMasterItem ObjectsPlus object
+ diagnostic_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
+ DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ diagnostic_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // CreateReason
+ wsRequestedBy_obj, // RequestedBy ObjectsPlus object
+ wsRequestedBySource, // string RequestedBySource (must be in dictionary)
+ wsSessionType, // string SessionType
+ wsSessionReason, // string SessionReason
+ wslocation_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
+
+
+
+ DiagnosticOrder_obj.SpecialInstructions := local_session.SessionRequestBed ; //"ABCD" ; //StrFinal ; //"Instruction text from MLM";
+ local_session.SessionRequestBed := Null ;
+ //void := DiagnosticOrder_obj.save;
+
+ DiagnosticOrder_dest.ObjectsPlus := DiagnosticOrder_obj;
+ void := call DiagnosticOrder_obj.save; ///To Save The Order To SCM
+
+
+ endtry;
+ catch Exception ex
+
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New general order:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( Catalog_Item_Name is NOT NULL ) then
+ void:= call Catalog_Item_Name.Dispose;
+ Catalog_Item_Name:= null;
+ endif;
+
+ if ( DiagnosticOrder_obj is NOT NULL ) then
+ void:= call DiagnosticOrder_obj.Dispose;
+ DiagnosticOrder_obj:= null;
+ endif;
+
+ endcatch;
+ ENDIF;
+
+ Endif;
+ //Else
+
+ //dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " We Cannot Place the {{{SINGLE-QUOTE}}}Request Bed{{{SINGLE-QUOTE}}} order in "|| EVOKINGOBJECT.TypeCode || " Visit type ", "Important Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ Endif;
+
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: Order_Submit;
+ //Document_Modify;
+ ;;
+ logic:
+
+ if EvokingObject is null
+ then
+ conclude false;
+ endif;
+
+ conclude true;
+
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_RODS_ORDER_FROM_ED_REGISTRATION_EVENT.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_RODS_ORDER_FROM_ED_REGISTRATION_EVENT.mlm
new file mode 100644
index 0000000..3015b6f
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_RODS_ORDER_FROM_ED_REGISTRATION_EVENT.mlm
@@ -0,0 +1,157 @@
+maintenance:
+
+ title: SCH_Create_RODS_Order_From_ED_Registration_Event;;
+ mlmname: SCH_Create_RODS_Order_From_ED_Registration_Event;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Cancel Account Order MLM;;
+ author: Don Warnick, Allscripts Corp;;
+ specialist: Don Warnick;;
+ date: 2011-05-19;;
+ validation: testing;;
+
+library:
+ purpose: purpose: Generate a RODS order at the time of an ED registration
+ ;;
+ explanation: When an ED Registration occurs, a RODS order is created
+
+ Change history
+
+ 05.19.2011 DW Created
+
+ ;;
+ keywords: RODS Order, HL7, Asynchronous Alert
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+
+ (ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject};
+ (UserGUID ) := read last { UserInfo: GUID };
+
+ send_alert := "DoNotSend";
+
+
+ clientvisit_enter_event := Event {ClientVisitEnter ANY ClientVisit: where TypeCode = "emergency"};
+
+ rods_alert := destination { Alert: warning, "RODS Order Created", high, chart, "RODS Order Created", 15042, send_alert, "No Override Allowed" };
+
+
+ GeneralOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+
+ orderItemName := "RODS";
+
+ IF exists orderItemName THEN
+
+ try
+
+ SessionType := "Standard";
+ SessionReason := "";
+ RequestingSource := "";
+ user_IDType := "Edstan Number (physician)";
+ order_Creation_Reason := "From Test MLM";
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ user_IDCode := read last {"SELECT IDCode FROM CV3User with (nolock) " || " where GUID = " || UserGUID};
+ RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
+ location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit with (nolock) where ClientGUID = " || ClientGUID};
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ AdmittingDx := read last {"Select text from CV3HealthIssueDeclaration with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}} and Active = 1
+ and ClientGuid = " || ClientGuid || " and ChartGuid = " || ChartGuid || " and ClientVisitGuid = " || ClientVisitGuid};
+
+ EmployerZip := read last {"Select a.postalcode from SXAAMClientEmployment ce with (nolock)
+ join SXAAMEmployer e with (nolock) on e.employerid = ce.employerid
+ join SXAAMEmployerAddress ea with (nolock) on ea.employerid = e.employerid
+ join cv3Address a with (nolock) on a.guid = ea.AddressGUID
+ where ce.clientvisitguid = " || ClientVisitGuid || " and a.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}}"};
+
+ PatientZip := read last {"select postalcode from cv3Address with (nolock)
+ where ParentGUID = " || ClientGuid || " and Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}}"};
+
+ SpecialInstructions := AdmittingDx || "...." || PatientZip || "...." || EmployerZip;
+
+
+ general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with orderItemName;
+
+ GeneralOrder_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ general_catalog_item, // CatalogMasterItem ObjectsPlus
+ //object
+ order_Creation_Reason, // CreateReason
+ RequestingCareProvider_obj, // RequestingProvider
+ //ObjectsPlus object
+ RequestingSource, // string requestingSource
+ //(must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj, // Location ReleaseLocGrpID
+ "Never" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
+ //"NoOverride" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
+ //AvailabilityOverride eAvailabilityOverride
+
+ // Set standard fields on the order entry form
+ GeneralOrder_obj.RequestedDate := "T";
+ GeneralOrder_obj.SpecialInstructions := SpecialInstructions;
+
+ GeneralOrder_dest.ObjectsPlus := GeneralOrder_obj;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ debugFlag := TRUE;
+ messageText := messageText || "New general order:\n" ||
+ ex.Message || "\n\n";
+
+ if ( general_catalog_item is NOT NULL ) then void:= call general_catalog_item.Dispose; general_catalog_item:= null; endif;
+ if ( GeneralOrder_obj is NOT NULL ) then void:= call GeneralOrder_obj.Dispose; GeneralOrder_obj:= null; endif;
+ GeneralOrder_dest := null;
+ endcatch;
+
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
+ if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
+
+
+ ENDIF; // end of orderItemName
+
+
+ ;;
+ evoke: 1 minutes after time of clientvisit_enter_event;
+ ;;
+ logic:
+ Conclude true ;
+ ;;
+ action:
+
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}}SCH_Create_RODS_Order_From_ED_Registration_Event{{-B}} " ||
+ "Please notify your System Administrators that an error message has occurred " ||
+ "message: \n" at rods_alert;
+ write messageText at rods_alert;
+ endif;
+
+ if EXISTS GeneralOrder_dest then
+ write true at GeneralOrder_dest;
+ endif;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_SIGNIFICANT_EVENT_FROM_TRANSFUSE_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_SIGNIFICANT_EVENT_FROM_TRANSFUSE_ORDER.mlm
new file mode 100644
index 0000000..6b6df2c
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_SIGNIFICANT_EVENT_FROM_TRANSFUSE_ORDER.mlm
@@ -0,0 +1,495 @@
+maintenance:
+
+ title: SCH_CREATE_SIGNIFICANT_EVENT_FROM_TRANSFUSE_ORDER;;
+ mlmname: SCH_CREATE_SIGNIFICANT_EVENT_FROM_TRANSFUSE_ORDER;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Eclipsys;;
+ specialist: ;;
+ date: 2011-12-13;;
+ validation: testing;;
+
+library:
+ purpose: Chart a Significant Event when an order is initiated for transfusion with attributes.
+ ;;
+ explanation: Transfusion Attributes
+ Change history
+
+ 12.14.2011 TS Created for CSR 26619
+ 2.26.2016 STH CSR#: 32165 - Update Order name, remove CMV code, and test with new order sets
+
+ ;;
+ keywords: Create Significant Event, Transfusion Attributes;
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /* Set to true if logging is needed.*/
+ log_execution_info:= FALSE;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ // Use String parse
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ any_transfusion_order:= event { OrderEnter User Order:
+ WHERE Name in ("Nursing Transfusion Order", "Platelet Products","Red Cell Products")};
+
+ (order_name,order_summaryline) := read last
+ {Order: Name, summaryline REFERENCING EvokingObject };
+
+ leuk_att := "Leukocyte Reduction Filter";
+ //cmv_att := "CMV Negative";
+ hemo_att := "Hemoglobin S Negative";
+ irr_att := "Irradiated";
+ Unsub_HemoSNegative := False;
+ //Unsub_CMV_NegProInd := False;
+ Unsub_IrradiatedInd := False;
+ Unsub_LeukReduction :=False;
+
+
+
+ if called_by_editor then
+ ClientGuid := 9000001923700200;
+ ClientVisitGuid := 9000002931500270;
+ //EvokingObject := read last {Order: THIS
+ // WHERE Name = ("Nursing Transfusion Order") };
+ endif;
+
+
+ //------------------------------------------------------------
+ // Define the ObjectsPlus destinations
+ //------------------------------------------------------------
+
+ LeukRedSignificantEvent_dest:= destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "General",
+ rule_group := "Significant Event Object",
+ rule_number := 2010 ];
+
+ HemSNegSignificantEvent_dest:= destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "General",
+ rule_group := "Significant Event Object",
+ rule_number := 2011 ];
+
+
+ IrradSignificantEvent_dest:= destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "General",
+ rule_group := "Significant Event Object",
+ rule_number := 2012 ];
+
+/*
+ CMVNegSignificantEvent_dest:= destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "General",
+ rule_group := "Significant Event Object",
+ rule_number := 2013 ];
+*/
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+ clientGUID := read last { ClientInfo: GUID };
+ ClientVisitGuid := read last { ClientVisit: GUID };
+
+
+ (ProductIndList) := read
+ {
+ " select description "
+ || "from cv3ClientEventDeclaration with (nolock) "
+ || "where clientguid = " || ClientGuid || " and status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ || "and typecode = {{{SINGLE-QUOTE}}}Blood Transfusion{{{SINGLE-QUOTE}}} "
+ };
+
+
+/* Get the list of UNSUBMITTED ORDERS */
+( order_name_list, unsub_summaryline) := read
+{ UNSUBMITTED Order: Name, SummaryLine };
+
+/* check for presence of attributes in current order summary line */
+ If order_summaryline Matches Pattern "%-Leukocyte Reduction Filter%" then
+ LeukReduction := True;
+ Else LeukReduction := False;
+ Endif;
+
+ If order_summaryline Matches Pattern "%-Irradiated%" then
+ IrradiatedInd := True;
+ Else IrradiatedInd := False;
+ Endif;
+/*
+ If order_summaryline Matches Pattern "%-CMV Negative%" then
+ CMV_NegProInd := True;
+ Else CMV_NegProInd := False;
+ Endif;
+*/
+ If order_summaryline Matches Pattern "%-Hemoglobin S Negative%" then
+ HemoSNegative := True;
+ Else HemoSNegative := False;
+ Endif;
+
+/* check for presence of attributes in unsubmitted orders summary line */
+
+ findleuk := FIND leuk_att IN STRING unsub_summaryline;
+ //findcmv := FIND cmv_att IN STRING unsub_summaryline;
+ findhemo := FIND hemo_att IN STRING unsub_summaryline;
+ findirr := FIND irr_att IN STRING unsub_summaryline;
+
+
+ for j in 1 seqto count findleuk do
+ If findleuk [j] > 0 then
+ Unsub_LeukReduction := True;
+ endif;
+ enddo;
+
+ for r in 1 seqto count findhemo do
+ If findhemo [r] > 0 then
+ Unsub_HemoSNegative := True;
+ endif;
+ enddo;
+
+ for s in 1 seqto count findirr do
+ If findirr [s] > 0 then
+ Unsub_IrradiatedInd := True;
+ endif;
+ enddo;
+/*
+ for l in 1 seqto count findcmv do
+ If findcmv [l] > 0 then
+ Unsub_CMV_NegProInd := True;
+ endif;
+ enddo;
+*/
+
+//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Unsub_IrradiatedInd : " || Unsub_IrradiatedInd || "\n Unsub_HemoSNegative : " || Unsub_HemoSNegative || "\n Unsub_LeukReduction : " || Unsub_LeukReduction || "\n Unsub_CMV_NegProInd: " || Unsub_CMV_NegProInd ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+/*check for attributes already listed as significant events */
+
+ If "Leukoreduced Products Indicated" in ProductIndList then
+ SE_LeukReduction := True;
+ Else SE_LeukReduction := False;
+ endif;
+
+ If "Hemoglobin S Negative Products Indicated" in ProductIndList then
+ SE_HemoSNegative := True;
+ Else SE_HemoSNegative := False;
+ endif;
+
+ If "Irradiated Products Indicated" in ProductIndList then
+ SE_IrradiatedInd := True;
+ Else SE_IrradiatedInd := False;
+ endif;
+/*
+ If "CMV Negative Products Indicated" in ProductIndList then
+ SE_CMV_NegProInd := True;
+ Else SE_CMV_NegProInd := False;
+ endif;
+*/
+/* Set flag to create attribute for current order only if no exisiting significant event exists and previous unsubmitted order did not set flag */
+/*
+ If (CMV_NegProInd = True and SE_CMV_NegProInd = False and Unsub_CMV_NegProInd = False) then
+ Create_CMV_NegProInd := True;
+ Else Create_CMV_NegProInd := False;
+ Endif;
+*/
+ If (HemoSNegative = True and SE_HemoSNegative = False and Unsub_HemoSNegative = False) then
+ Create_HemoSNegative := True;
+ Else Create_HemoSNegative := False;
+ Endif;
+
+ If (IrradiatedInd = True and SE_IrradiatedInd = False and Unsub_IrradiatedInd = False) then
+ Create_IrradiatedInd := True;
+ Else Create_IrradiatedInd := false;
+ Endif;
+
+ If (LeukReduction = True and SE_LeukReduction = False and Unsub_LeukReduction = False) then
+ Create_LeukReduction:= True;
+ Else Create_LeukReduction := false;
+ Endif;
+
+
+
+ ;;
+ evoke: any_transfusion_order;
+
+
+
+ ;;
+ logic:
+
+
+ if called_by_editor then
+ conclude false;
+ endif;
+
+ try
+
+ //get the .NET version of the Client Visit object. Needed to create new ObjectsPlus objects
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((EvokingObject.ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" ||
+ ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ // If the client object cannot be retrieved, do not attempt
+ // to create any ObjectsPlus objects.
+ endcatch;
+
+
+ if ((Create_HemoSNegative = False) and (Create_IrradiatedInd = False) and
+ /*(Create_CMV_NegProInd = False) and */(Create_LeukReduction = False))
+ then
+ conclude false;
+ else
+ TimeOfEntry := now ;
+
+ yr := extract year TimeOfEntry;
+ mn := extract month TimeOfEntry;
+ dd := extract day TimeOfEntry;
+
+ PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (
+ yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, // Year
+ mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, // Month
+ dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} ); // Day
+
+ BBEventTypeCode := "Blood Transfusion";
+ BBEventText := "Entered from Transfuse Order";
+
+ endif;
+
+ //-------------------------------------------------------------
+ // New Significant Event for Leukoreduced Products
+ //-------------------------------------------------------------
+ try
+ If Create_LeukReduction = True then
+ LeukRedEventText := "Leukoreduced Products Indicated";
+
+ // Create an Instance for Significant Event
+ LeukRedEvent_obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.CreateSignificantEvent
+ with
+ (client_visit_obj, //ClientVisit
+ BBEventTypeCode, //TypeCode
+ LeukRedEventText); //Event
+
+ // Add more to the data to be inserted
+ LeukRedEvent_obj.Text := BBEventText;
+ LeukRedEvent_obj.OnsetDate := PartialDate_obj;
+ LeukRedSignificantEvent_dest.ObjectsPlus := LeukRedEvent_obj;
+ endif;
+ endtry;
+
+ catch exception ex
+ error_occurred := true;
+ error_message := error_message ||
+ "{{+R}}New Significant Event{{-R}}\n" ||
+ ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if ( LeukRedEvent_obj is NOT NULL ) then
+ void:= call LeukRedEvent_obj.Dispose;
+ LeukRedEvent_obj:= null;
+ endif;
+
+ LeukRedSignificantEvent_dest := null;
+ endcatch;
+
+ //-------------------------------------------------------------
+ // New Significant Event for Hemoglobin S Negative
+ //-------------------------------------------------------------
+ try
+ If Create_HemoSNegative = True then
+
+ HemSNegEventText := "Hemoglobin S Negative Products Indicated";
+
+ // Create an Instance for Significant Event
+ HemSNegEvent_obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.CreateSignificantEvent
+ with
+ (client_visit_obj, //ClientVisit
+ BBEventTypeCode, //TypeCode
+ HemSNegEventText); //Event
+
+ // Add more to the data to be inserted
+ HemSNegEvent_obj.Text := BBEventText;
+ HemSNegEvent_obj.OnsetDate := PartialDate_obj;
+ HemSNegSignificantEvent_dest.ObjectsPlus := HemSNegEvent_obj;
+ endif;
+ endtry;
+
+ catch exception ex
+ error_occurred := true;
+ error_message := error_message ||
+ "{{+R}}New Significant Event{{-R}}\n" ||
+ ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if ( HemSNegEvent_obj is NOT NULL ) then
+ void:= call HemSNegEvent_obj.Dispose;
+ HemSNegEvent_obj:= null;
+ endif;
+
+ HemSNegSignificantEvent_dest := null;
+ endcatch;
+
+
+ //-------------------------------------------------------------
+ // New Significant Event for Irradiated Products
+ //-------------------------------------------------------------
+
+ try
+ If Create_IrradiatedInd = True then
+ IrradEventText := "Irradiated Products Indicated";
+
+ // Create an Instance for Significant Event
+ IrradEvent_obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.CreateSignificantEvent
+ with
+ (client_visit_obj, //ClientVisit
+ BBEventTypeCode, //TypeCode
+ IrradEventText); //Event
+
+
+ // Add more to the data to be inserted
+ IrradEvent_obj.Text := BBEventText;
+ IrradEvent_obj.OnsetDate := PartialDate_obj;
+ IrradSignificantEvent_dest.ObjectsPlus := IrradEvent_obj;
+ endif;
+ endtry;
+
+ catch exception ex
+ error_occurred := true;
+ error_message := error_message ||
+ "{{+R}}New Significant Event{{-R}}\n" ||
+ ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if ( IrradEvent_obj is NOT NULL ) then
+ void:= call IrradEvent_obj.Dispose;
+ IrradEvent_obj:= null;
+ endif;
+
+ IrradSignificantEvent_dest := null;
+ endcatch;
+/*
+ try
+ if Create_CMV_NegProInd = true then
+
+ //-------------------------------------------------------------
+ // New Significant Event for CMV Negative Products
+ //-------------------------------------------------------------
+
+ CMVNegEventText := "CMV Negative Products Indicated";
+
+ // Create an Instance for Significant Event
+ CMVNegEvent_obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.CreateSignificantEvent
+ with
+ (client_visit_obj, //ClientVisit
+ BBEventTypeCode, //TypeCode
+ CMVNegEventText); //Event
+
+ // Add more to the data to be inserted
+ CMVNegEvent_obj.Text := BBEventText;
+ CMVNegEvent_obj.OnsetDate := PartialDate_obj;
+ CMVNegSignificantEvent_dest.ObjectsPlus := CMVNegEvent_obj;
+
+ endif;
+ endtry;
+
+ catch exception ex
+ error_occurred := true;
+ error_message := error_message ||
+ "{{+R}}New Significant Event{{-R}}\n" ||
+ ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if ( CMVNegEvent_obj is NOT NULL ) then
+ void:= call CMVNegEvent_obj.Dispose;
+ CMVNegEvent_obj:= null;
+ endif;
+
+ CMVNegSignificantEvent_dest := null;
+ endcatch;
+*/
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+ conclude true;
+
+ ;;
+ action:
+
+ if Error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}SCH_CREATE_SIGNIFICANT_EVENT_FROM_ORDER{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+
+ if EXISTS LeukRedSignificantEvent_dest then
+ write true at LeukRedSignificantEvent_dest;
+ endif;
+
+ if EXISTS HemSNegSignificantEvent_dest then
+ write true at HemSNegSignificantEvent_dest;
+ endif;
+
+ if EXISTS IrradSignificantEvent_dest then
+ write true at IrradSignificantEvent_dest;
+ endif;
+/*
+ if EXISTS CMVNegSignificantEvent_dest then
+ write true at CMVNegSignificantEvent_dest;
+ endif;
+*/
+ ;;
+
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CREATE_SODIUM_FROM_RESULT.mlm b/MLMStripper/bin/Debug/SCH/SCH_CREATE_SODIUM_FROM_RESULT.mlm
new file mode 100644
index 0000000..2b2b8dc
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CREATE_SODIUM_FROM_RESULT.mlm
@@ -0,0 +1,253 @@
+maintenance:
+
+ title: SCH_CREATE_SODIUM_FROM_RESULT;;
+ mlmname: SCH_CREATE_SODIUM_FROM_RESULT;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Eclipsys, Test MLM;;
+ author: Dean Miklavic;;
+ specialist: Shawn Head;;
+ date: 2017-11-20;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will create a Sodium order when a low sodium level is received.
+
+ ;;
+ explanation: This orders created by this MLM will by-pass the order entry worksheet
+ and will write directly to the database once the evoking object is saved.
+
+
+ Change history
+
+ 11.20.2017 STH CSR#: 36015 created (copied from the SCH_CREATE_LACTIC_ACID_FROM_RESULT which is similar) {Go-Live 07/03/2018}
+ ;;
+ keywords: ObjectsPlus, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+
+ ////// Added on 01.08.2015 by DW for CSR#: 33901 //////
+ /*
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}}; // MLM that creates the Enterprise Defined Column in the "Action" section of the MLM
+ EDCObj := OBJECT [column_name,column_value,client_guid,chart_guid,client_visit_guid]; // Create Enterprise Defined Column Obj
+ */
+ ////// Added on 01.08.2015 by DW for CSR#: 33901 //////
+
+
+
+ observation_enter_event := event { ObservationEnter Any Observation: where (itemname in ("Sodium from Blood Gas","Sodium Plasma/Serum","Sodium, ABG, POC","Sodium, VBG, POC") AND (IsHistory = FALSE AND Active = TRUE))};
+
+ // If called by the editor
+
+ If called_by_editor then EvokingObject := read last { Observation: This where (itemname in ("Sodium from Blood Gas","Sodium Plasma/Serum","Sodium, ABG, POC","Sodium, VBG, POC") AND (IsHistory = FALSE AND Active = TRUE)) }; endif;
+//
+
+ // Gather data
+
+ ( OrderGUID, resultValue ) := read last { Observation: OrderGUID, Value REFERENCING EvokingObject};
+
+ (ClientVisitGUID, ChartGUID, ClientGUID, ReqByGUID, CodedTime, location_guid, OrderName, currentlocation, visittype) := Read Last {" Select
+ a.ClientVisitGUID, a.ChartGUID, a.ClientGUID, a.CareProviderGUID, a.RequestedTime, b.CurrentLocationGUID, a.name, b.currentlocation, b.typecode
+ from CV3Order a with (nolock) Join CV3ClientVisit b with(nolock) on
+ a.ClientVisitGUID = b.GUID and a.ClientGUID = b.ClientGUID and a.ChartGUID = b.ChartGUID and a.GUID = " || SQL(OrderGUID) };
+
+
+ LowSodiumValueEntered := false;
+ if (resultValue = "<8") then
+ resultValueNumeric := 1; //sets the value less than 120 to trigger re-order when lower limit reached
+ else
+ resultValueNumeric := resultValue as number;
+ endif;
+
+ if(visittype in ("Inpatient","Emergency","Observation")) then
+ validpatient := true;
+ else
+ validpatient := false;
+ endif;
+
+ if ((resultValueNumeric < 120) and (validpatient)) then
+ PerformedDTTM := EVOKINGOBJECT.PerformedDtm;
+ PerformedDTTM_4hrsRound2wholehr := read last { " select dateadd(hour, 4 + datediff(hour, 0," || sql(PerformedDTTM) || " ), 0) " };
+ //check to see if the result trigger MLM is the same as the oldest result saved to the database with a value > 2.
+ if PerformedDTTM_4hrsRound2wholehr is not null then
+
+ //check to see if there is already an active order for lactic acid with a requested date in-side the 4 hour window of the significant date/time of the result that filed.
+ Chk4ValidOrder := Read Last {" select top 1 o.guid from CV3Order o with (nolock)
+ where o.clientguid = " || sql(ClientGUID) || "
+ and o.chartguid = " || sql(ChartGUID) || "
+ and o.clientvisitguid = " || sql(ClientVisitGUID) || "
+ and o.GUID <> " || sql(OrderGUID) || "
+ and o.name in ({{{SINGLE-QUOTE}}}Sodium Plasma/Serum{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Sodium from Blood Gas{{{SINGLE-QUOTE}}})
+ and o.Requesteddtm >= " || sql(PerformedDTTM) || "
+ and o.RequestedDtm <= " || sql(PerformedDTTM_4hrsRound2wholehr) || "
+ and o.orderstatuscode not like {{{SINGLE-QUOTE}}}can%{{{SINGLE-QUOTE}}} and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "};
+
+ if ((Chk4ValidOrder is null) and (PerformedDTTM_4hrsRound2wholehr > now)) then
+
+ reordername := "Sodium Plasma/Serum";
+ reorderpiority := "Scheduled Time";
+ reqdate := (extract year PerformedDTTM_4hrsRound2wholehr) || "-" || ((extract month PerformedDTTM_4hrsRound2wholehr) formatted with "%0.2d")
+ || "-" || ((extract day PerformedDTTM_4hrsRound2wholehr) formatted with "%0.2d");
+
+ ReqTimeHR := (extract hour PerformedDTTM_4hrsRound2wholehr);
+ ReqTimeMin := ((extract minute PerformedDTTM_4hrsRound2wholehr) formatted with "%0.2d");
+ LowSodiumValueEntered := true;
+ endif;
+ endif;
+
+ //END OF RESULTVALUENUMERIC > 2 IF STATEMENT
+ endif;
+
+
+
+
+ // Order and Error Destinations
+
+ DiagnosticOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1003,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+ // Build some preliminary objects
+ if ((LowSodiumValueEntered = true) and (validpatient)) then
+ try
+ SessionType := "Standard";
+ SessionReason := "";
+ RequestedBySource := "Standing Order";
+ OrderCreationReason := "Automatically created by MLM";
+ RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( ReqByGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} ); //Int64
+ Location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ ClientVisit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ endtry;
+
+ // Failed to build preliminary objects - Dispose
+
+ catch Exception ex
+ error_occurred:= true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( ClientVisit_obj is NOT NULL ) then void:= call ClientVisit_obj.Dispose; ClientVisit_obj:= null; endif;
+ if ( RequestedBy_obj is NOT NULL) then void:= call RequestedBy_obj.Dispose; RequestedBy_obj:= null; endif;
+ if ( Location_obj is NOT NULL ) then void:= call Location_obj.Dispose; Location_obj:= null; endif;
+ endcatch;
+
+ // Build the order object
+
+ try
+ //Catalog_Item_Name := "CPK Isoenzymes";
+ diagnostic_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with reordername;
+
+ DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
+ with
+ ClientVisit_obj, // ClientVisit ObjectsPlus object
+ diagnostic_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ OrderCreationReason, // CreateReason
+ RequestedBy_obj, // RequestedBy ObjectsPlus object
+ RequestedBySource, // string RequestedBySource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ Location_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+
+ // Populate the Requested Time field
+
+
+ DiagnosticOrder_obj.RequestedDate := reqdate;
+ ReqTime_obj := new net_object {{{SINGLE-QUOTE}}}RequestedTime{{{SINGLE-QUOTE}}};
+ ReqTime_obj.CodedTime := reorderpiority;
+ time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} with (ReqTimeHR As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, (ReqTimeMin As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
+ ReqTime_obj.time := time_obj;
+
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldVisible{{{SINGLE-QUOTE}}} with "RequestedTime",true;
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "RequestedTime",false;
+ DiagnosticOrder_obj.RequestedTime := ReqTime_obj;
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "LAB_Info Summary",false;
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "LAB_Info Summary", "Repeat Per Sodium Protocol" ;
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "LAB_Info Summary",true;
+
+ DiagnosticOrder_dest.ObjectsPlus := DiagnosticOrder_obj;
+ endtry;
+
+ // Failed to build the order object and make the order - Return error and dispose
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( diagnostic_catalog_item is NOT NULL ) then void:= call diagnostic_catalog_item.Dispose; diagnostic_catalog_item:= null; endif;
+ if ( DiagnosticOrder_obj is NOT NULL ) then void:= call DiagnosticOrder_obj.Dispose; DiagnosticOrder_obj:= null; endif;
+ DiagnosticOrder_dest := null;
+ endcatch;
+
+ // Dispose
+
+ if ( ClientVisit_obj is NOT NULL ) then void:= call ClientVisit_obj.Dispose; ClientVisit_obj:= null; endif;
+ if ( RequestedBy_obj is NOT NULL ) then void:= call RequestedBy_obj.Dispose; RequestedBy_obj:= null; endif;
+ if ( Location_obj is NOT NULL ) then void:= call Location_obj.Dispose; Location_obj:= null; endif;
+ endif;
+
+ ;;
+
+ priority: 90
+ ;;
+ evoke:
+ 5 seconds after time of observation_enter_event;
+ ;;
+ logic:
+
+
+ if(validpatient) then
+
+ conclude true;
+ else
+ conclude false;
+ endif;
+
+ ;;
+ action:
+
+ if Error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}SCH_CREATE_SODIUM_FROM_RESULT{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+
+ write "1. " || error_message at error_destination;
+
+ endif;
+
+ if EXISTS DiagnosticOrder_dest then
+ write true at DiagnosticOrder_dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_CRP_ESR_LIPASE_AMYLASE_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_CRP_ESR_LIPASE_AMYLASE_ALERT.mlm
new file mode 100644
index 0000000..c962087
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_CRP_ESR_LIPASE_AMYLASE_ALERT.mlm
@@ -0,0 +1,138 @@
+maintenance:
+
+ title: SCH_CRP_ESR_Lipase_Amylase_Alert;;
+ mlmname: SCH_CRP_ESR_Lipase_Amylase_Alert;;
+ arden: version 2.5;;
+ version: 15.3;;
+ institution: ;;
+ author: Maria Pest;;
+ specialist: ;;
+ date: 2018-04-17;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+
+
+ Change history
+
+ 04.17.2018 DJW CSR# 36318 - Created
+
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ Order_Event_Init := event{OrderInit User Order : WHERE Name IN ("Sedimentation Rate","Amylase Plasma/Serum") };
+
+ ClientGuid := EVOKINGOBJECT.ClientGUID;
+ ChartGuid := EVOKINGOBJECT.ChartGUID;
+ VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
+
+ send_alert:= "DoNotSend";
+ alert_dest:= destination { Alert: warning, "Test Utilization Alert", high, chart, "CRP ESR Lipase Amylase Alert MLM", 15042, send_alert, "" };
+
+ alert_prefix := "";
+
+
+ // Look for current orders on file
+
+ CurrentOrderOnFile:= read
+ { "
+ select ocmi.Description
+ from CV3OrderCatalogMasterItem ocmi with (nolock)
+ join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = ocmi.guid
+ where ocmi.Description in ({{{SINGLE-QUOTE}}}C-Reactive Protein, Acute Phase{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Lipase{{{SINGLE-QUOTE}}})
+ and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) and
+ o.ClientGUID = " || ClientGuid || " and o.chartguid = " || ChartGuid || " and o.clientvisitguid = " || VisitGuid || "
+ "};
+
+// and convert(char(10), o.createdwhen ,20) = convert(char(10), getdate(),20)
+
+ CreactiveFound := "no";
+ AcutephaseFound:= "no";
+
+ for i in 1 seqto count (CurrentOrderOnFile) do
+ ordername := CurrentOrderOnFile[i];
+ if ordername = "C-Reactive Protein, Acute Phase" then CreactiveFound := "yes"; endif;
+ if ordername = "Lipase" then AcutephaseFound := "yes"; endif;
+ enddo;
+
+ // Look for unsubmitted orders
+
+ UnsubmittedCreactiveOrder:= READ {UnsubmittedOrders: Name WHERE Name = "C-Reactive Protein, Acute Phase"};
+ UnsubmittedLipaseOrder := READ {UnsubmittedOrders: Name WHERE Name = "Lipase"};
+
+
+ if EVOKINGOBJECT.Name = "Sedimentation Rate"
+
+
+ then // Sedimentation Rate order was entered
+
+
+
+ // Customize the first sentence
+ If CreactiveFound = "yes" then alert_prefix := "A CRP order has already been placed on this patient.\n\n"; endif;
+ If exists UnsubmittedCreactiveOrder then alert_prefix := "A CRP order has been found amongst your unsubmitted orders.\n\n"; endif;
+ If CreactiveFound = "yes" and exists UnsubmittedCreactiveOrder then alert_prefix := "A CRP order has already been placed on this patient and has been found amongst your unsubmitted orders .\n\n"; endif;
+
+
+ // Append the rest of the message
+ If alert_prefix <> ""
+
+ then
+
+ alert_message := alert_prefix
+ || "CRP is the preferred marker as it is more sensitive and specific in the acute phase of inflammation.\n\n"
+ || "Also CRP returns to normal if the source of inflammation is removed while the ESR will remain elevated for several days.\n\n"
+ || "Do you wish to proceed with the ESR order?";
+ endif;
+
+
+
+ else // Amylase Plasma/Serum order was entered
+
+
+ // Customize the first sentence
+ If AcutephaseFound = "yes" then alert_prefix := "A Lipase order has already been placed on this patient.\n\n"; endif;
+ If exists UnsubmittedLipaseOrder then alert_prefix := "A Lipase order has been found amongst your unsubmitted orders.\n\n"; endif;
+ If AcutephaseFound = "yes" and exists UnsubmittedLipaseOrder then alert_prefix := "A Lipase order has already been placed on this patient and has been found amongst your unsubmitted orders .\n\n"; endif;
+
+
+ // Append the rest of the message
+ If alert_prefix <> ""
+
+ then
+
+ alert_message := alert_prefix
+ || "Lipase is now the preferred test due to its improved sensitivity and its wider diagnostic window.\n\n"
+ || "Testing for both of these enzymes only marginally improves diagnostic efficiency.\n\n"
+ || "Do you wish to proceed with the Amylase order?";
+ endif;
+
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: Order_Event_Init;
+ ;;
+ logic:
+ Conclude True;
+ ;;
+ action:
+
+
+ If alert_prefix <> "" then write alert_message at alert_dest; endif;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_C_DIFFICILE_ORDERDISCONTINUE.mlm b/MLMStripper/bin/Debug/SCH/SCH_C_DIFFICILE_ORDERDISCONTINUE.mlm
new file mode 100644
index 0000000..a603561
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_C_DIFFICILE_ORDERDISCONTINUE.mlm
@@ -0,0 +1,219 @@
+maintenance:
+
+ title: SCH_C_Difficile_OrderDiscontinue ;;
+ mlmname: SCH_C_Difficile_OrderDiscontinue ;;
+ arden: version 2.5;;
+ version: 5.50;; // FP1
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav ;;
+ specialist: ;;
+ date: 2015-10-01;;
+ validation: testing;;
+
+library:
+ purpose: Discontinue the Earlier {{{SINGLE-QUOTE}}}Clostridium Difficile Toxin Gene Testing by PCR{{{SINGLE-QUOTE}}} order
+ When difference between [C Diff order Placed Time] and [Current Time ] is greter than 24 hours and Order status is [pending Collection].
+
+ ;;
+ explanation:
+ Change History
+ ---------------------------------------------------------------------------------
+ 12/06/2016 SSJ - CSR 35200 - C Diff Order Cancellation Created.
+ 06/12/2017 AM - CA# 2712873 - Added Order Release Event.
+ 08/07/2019 JML - CSR 38386 - New inpatient lab order created.
+ ;;
+ keywords: ObjectsPlus, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ using "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "ObjectsPlusXA.SCM";
+ using "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "SCMLib";
+
+ using namespace "System";
+ using namespace "System.Exception";
+ using namespace "System.Windows.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager";
+ using namespace "SCMLib.PObj";
+ using namespace "SCMLib.PObj.OrderPObj";
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+
+ if called_by_editor then
+ evokingobject := read last {Order : THIS where Name = "Clostridium Difficile Toxin Gene Testing by PCR"};
+ endif;
+
+ log_execution_info := false;
+ Order_Submit := event {OrderEnter User Order: WHERE Name IN ( "Clostridium Difficile Toxin Gene Testing by PCR", "Clostridium Difficile Screening" ) };
+ Order_Release := event {OrderRelease User Order: WHERE Name IN ( "Clostridium Difficile Toxin Gene Testing by PCR", "Clostridium Difficile Screening" ) };
+
+ idest:= destination{IntermediateMessage: Warning, "ColValue",high, chart, "RuleGroupHere1", 1001, "", "" };
+ ( careProvider_obj ) := read last{ UserInfo: careProvider };
+ ( careProvider_Actaul ) := read last{ UserInfo: This };
+
+ //Capture current patient
+ (clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
+ visitGuid := read last {ClientVisit : GUID};
+ chartGuid := read last {ClientVisit : ChartGUID};
+ VisitType := read last {ClientVisit : Typecode };
+
+//Clostridium Difficile Toxin Gene Testing by PCR
+
+ If (VisitType Matches Pattern "%Inpatient%") or (VisitType Matches Pattern "%Observation%") Then
+
+ (location_guid, Active_ClientVisitGUID, client_guid) := read last { ClientVisit: CurrentLocationGUID, GUID, clientguid };
+ // To Retrive Order Guid from placed order data
+ OrderGuid := Read First {" SELECT o.Guid
+ FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)
+ ON cv.GUID = o.ClientVisitGUID
+ AND cv.ClientGUID = o.ClientGUID
+ AND cv.ChartGUID = o.ChartGUID
+ WHERE cv.GUID = " || visitGuid || "
+ AND o.Name In ( {{{SINGLE-QUOTE}}}Clostridium Difficile Toxin Gene Testing by PCR{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Clostridium Difficile Screening{{{SINGLE-QUOTE}}} )
+ And DATEDIFF(Minute, o.ARRIVALDTM, GetDate()) >= 1440
+ And o.OrderStatusCode in ({{{SINGLE-QUOTE}}}PCOL{{{SINGLE-QUOTE}}})
+ And o.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} Order By o.CreatedWhen Desc "};
+
+
+
+ // If Order Present With difference between order placed time and Current Time
+ // with greater than 24 Hrs and Status is {{{SINGLE-QUOTE}}}pending Collection{{{SINGLE-QUOTE}}} Then Discontinue the order
+ If exist OrderGuid Then
+ //(Typecode, Username ) := Read first {" Select Typecode, DisplayName from CV3CareProvider Where GUID = " || Care_Provider || " "} ;
+ location_guid := Read First {" Select CurrentLocationGUID from CV3ClientVisit Where GUID = " || visitGuid || " "} ;
+
+ order_Creation_Reason := "Created by MLM";
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+
+ RequestedByGUID:= "" ;
+ RequestedByGUID:= READ LAST {" select top 1 RequestedByGUID from CV3OrderStatusHistory (nolock)
+ Where OrderGUID = " || SQL(OrderGuid) ||" order by CreatedWhen "};
+
+ // Common data
+ Try
+ // .Net version of Client Visit Object
+ ClientVisit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((RequestedByGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ error_occurred := false;
+ Endtry;
+
+ Catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+ If ClientVisit_obj IS NOT NULL then
+ void := call ClientVisit_obj.Dispose;
+ ClientVisit_obj := NULL;
+ Endif;
+ If RequestedBy_obj IS NOT NULL then
+ void := call RequestedBy_obj.Dispose;
+ RequestedBy_obj := NULL;
+ Endif;
+
+ Endcatch;
+
+
+ Try
+
+ //RequestedBySource := ".Per Electronic Order";
+ //OrderDiscontinuationReason := "Cancelled by MLM as duplicate Diets order.";
+ RequestedBySource := "per hospital policy";
+ OrderDiscontinuationReason := "24 Hours completed after order entry.";
+ order_obj := new net_object {{{SINGLE-QUOTE}}}SCMLib.PObj.OrderPObj{{{SINGLE-QUOTE}}} with OrderGuid;
+
+ order_obj.SuppressSignOnSubmit := true;
+ order_obj.ToBeSigned := false;
+
+ now_dtm := now + 1 minute;
+ date_str := ((extract year now_dtm) as string) || "-" ||
+ (extract month now_dtm) formatted with "%0.2d" || "-" ||
+ (extract day now_dtm) formatted with "%0.2d";
+ time_str := (extract hour now_dtm) formatted with "%0.2d" || ":" ||
+ (extract minute now_dtm) formatted with "%0.2d" || ":" ||
+ (extract second now_dtm) formatted with "%0.2d";
+
+ care_provider_guid_str :=(RequestedBy_obj.PrimaryKey as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) as string;
+
+ dc_order := call order_obj.Discontinue with OrderDiscontinuationReason,
+ date_str,
+ time_str,
+ RequestedBySource,
+ care_provider_guid_str;
+
+
+ Endtry;
+ Catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Discontinuing order:{{-R}}\n" || ex.Message || "\n\n";
+ DiscontinueOrder := True ;
+ EndCatch;
+
+ DiscontinueOrder := False ;
+
+ Endif;
+ Endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: 1440 Minute After Time of Order_Submit;
+ 1440 Minute After Time of Order_Release;
+
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+ // To Write error in Table
+ If error_message <> "" Then
+ write error_message at idest;
+ Else
+ Void:= Void ;
+ EndIf;
+
+ If error_occurred = true then
+
+ If error_message MATCHES PATTERN "%update you requested has been canceled due%"
+ or error_message MATCHES PATTERN "%Failed to Store Alert to database%" then
+ error_destination.short_message := " C Diff Not Entered";
+ alert_message := "{{+B}}Sedation Protocol: C Diff not entered into SCM" || "\n" ||
+ "Due to a response (GO-BACK) to a Clinical Alert{{-B}}";
+ write alert_message at error_destination;
+ Else
+ write "An error has occured in the MLM {{+B}} SCH_C_Diff_OrderDiscontinue {{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+
+ write error_message at error_destination;
+ Endif;
+ Else
+ order_discontinued_no_error := true;
+ return order_discontinued_no_error;
+ Endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_DAY_OF_DISCHARGE_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_DAY_OF_DISCHARGE_ALERT.mlm
new file mode 100644
index 0000000..8ea053e
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_DAY_OF_DISCHARGE_ALERT.mlm
@@ -0,0 +1,325 @@
+maintenance:
+
+ title: SCH_DAY_OF_DISCHARGE_ALERT;;
+ mlmname: SCH_DAY_OF_DISCHARGE_ALERT;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law;;
+ specialist: Peggy Leschak;;
+ date: 2019-04-12;;
+ validation: testing;;
+
+library:
+ purpose: Alert the physician to missing DOH required information on Day of Discharge Summary eNote
+ ;;
+ explanation: When filling out the Day of Discharge Summary eNote, the following fields are required by the DOH to contain values:
+ * Hospital Course and Significant History
+ * Results, Testing, Findings
+ * Procedures and Treatments
+
+ If one or more of these fields are empty at time of document save, then the physician will receive an alert.
+
+ Change History
+ ---------------
+ 2019.04.12 JML CSR 38075: Created
+
+ ;;
+ keywords: ClientDocument; Day of Discharge; DOH;
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+ /* Set to true if logging is needed.*/
+ log_execution_info := false;
+
+ /* What is the name of the Flowsheet (Clinical Document)? */
+ /* If the name is changed here, it must also be changed in the EVENT statement */
+ clinical_document_name := "Day of Discharge Summary eNote";
+
+ /* What is the name of the Observation that will be used to chart Suspected Abuse? */
+ DOD_HospCourse_observation := "SCH_MDPN_DS_HospCourse";
+ DOD_ReasonHosp_observation := "SCH_MDPN_DS_ReasonHospital";
+ DOD_ResultReview_observation := "SCH_MDPN_Review";
+ DOD_OtherResults_observation := "SCH_MDPN_Other Results";
+ DOD_ProcTxReason_observation := "SCH_MDPN_DS_Proc Tx Reason";
+ DOD_ProcTxFT_observation := "SCH_MDPN_DS_Proc Tx FT";
+
+ /* What will the user chart to indicate a positive response? */
+ display_alert := false;
+ check_hospital_course := false;
+ check_results := false;
+ check_procedures := false;
+ alert_msg := "According to hospital bylaws charting is required in the following sections:";
+
+
+ Day_of_Discharge_doc_enter := event { ClientDocumentEnter User ClientDocument:
+ WHERE DocumentName = "Day of Discharge Summary eNote"};
+ Day_of_Discharge_doc_modify := event { ClientDocumentModify User ClientDocument:
+ WHERE DocumentName = "Day of Discharge Summary eNote"};
+
+ day_of_discharge_alert := destination { Alert: Warning, "Day of Discharge Alert",
+ High, chart, "Day of Discharge Missing Information", 7500 };
+
+
+ /***************************************************************************************/
+
+ /* This block executes only when this MLM is called by the editor */
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientDocument : THIS};
+ endif;
+
+ /* Get the patient{{{SINGLE-QUOTE}}}s name*/
+ pat_name := read last
+ {ClientInfo: DisplayName };
+
+ /* Get the patient{{{SINGLE-QUOTE}}}s current location and ClientVisitGUID */
+ (pat_location,
+ pat_visit_guid ) := read last
+ {ClientVisit: CurrentLocation, GUID };
+
+ /* Get the received document{{{SINGLE-QUOTE}}}s name, and the pointers to the PatientCareDocument, */
+ /* to the flowsheet, and to the ClientObservation object */
+ (received_doc_name,
+ PatientCareDocObj,
+ ChartFlowsheetObj,
+ ClientObservationDocumentObj ) := read last
+ {ClientDocument : DocumentName, PatientCareDocument, ChartFlowsheet, ClientObservationDocument
+ REFERENCING EvokingObject };
+
+ /* Get the name of the results review observation and the pointer to */
+ /* the object that has the patient{{{SINGLE-QUOTE}}}s answer to the results review */
+ ( HospReason_ObservationObj ) := read last { ClientObservationDocument : ClientObservation
+ REFERENCING ClientObservationDocumentObj
+ Where Name = DOD_ReasonHosp_observation };
+
+ (hosp_course_obs_display_name,
+ Hosp_Course_FSListValues_obj) := read last
+ {ClientObservationDocument: Name, ObsFSListValues
+ REFERENCING ClientObservationDocumentObj
+ WHERE Name = DOD_HospCourse_observation
+ };
+
+ ( Other_Results_ObservationObj ) := read last { ClientObservationDocument : ClientObservation
+ REFERENCING ClientObservationDocumentObj
+ Where Name = DOD_OtherResults_observation
+ };
+
+ (results_review_obs_display_name,
+ Results_Review_FSListValues_obj):= read last
+ {ClientObservationDocument: Name, ObsFSListValues
+ REFERENCING ClientObservationDocumentObj
+ Where Name = DOD_ResultReview_observation
+ };
+
+ (ProcTreatment_ObservationObj ) := read last { ClientObservationDocument : ClientObservation
+ REFERENCING ClientObservationDocumentObj
+ Where Name = DOD_ProcTxFT_observation };
+
+ (proc_reason_obs_display_name,
+ Proc_Reason_FSListValues_obj) := read last
+ {ClientObservationDocument : Name, ObsFSListValues
+ REFERENCING ClientObservationDocumentObj
+ WHERE Name = DOD_ProcTxReason_observation
+ };
+
+
+ hosp_course_list := read
+ {ObsFSListValues : Value
+ REFERENCING Hosp_Course_FSListValues_obj };
+
+ hosp_reason_value := read last { ClientObservation : ValueText
+ REFERENCING HospReason_ObservationObj };
+
+ result_review_list := read
+ {ObsFSListValues: Value
+ REFERENCING Results_Review_FSListValues_obj };
+
+ other_results_value := read last { ClientObservation : ValueText
+ REFERENCING Other_Results_ObservationObj };
+
+ proc_reason_list := read
+ {ObsFSListValues : Value
+ REFERENCING Proc_Reason_FSListValues_obj };
+
+ proc_treatment_value := read last { ClientObservation : ValueText
+ REFERENCING ProcTreatment_ObservationObj };
+
+ if ( EvokingEventType = "ClientDocumentEnter" ) then
+
+ if ( ( count hosp_course_list = 0 ) AND ( hosp_reason_value IS NULL ) ) then
+ display_alert := true;
+ alert_msg := alert_msg || "\n\nHospital Course and Significant History";
+ endif;
+
+ if ( ( count result_review_list = 0 ) AND ( other_results_value IS NULL ) ) then
+ display_alert := true;
+ alert_msg := alert_msg || "\n\nResults, Tests, Finding";
+ endif;
+
+ if ( ( count proc_reason_list = 0 ) AND ( proc_treatment_value IS NULL ) ) then
+ display_alert := true;
+ alert_msg := alert_msg || "\n\nProcedures and Treatments";
+ endif;
+
+ elseif ( EvokingEventType = "ClientDocumentModify" ) then
+
+ //Determine which required observations have already been charted
+ ( obsName,
+ obsValueText,
+ obsValueList ) := read { " SELECT ocmi.Name, obsparam.ValueText, SOBS.Value"
+ || " FROM CV3ClientDocumentCUR cd WITH (NOLOCK) JOIN CV3OBSERVATIONDOCUMENTCUR od WITH (NOLOCK)"
+ || " ON cd.GUID = od.OWNERGUID"
+ || " AND cd.ArcType = od.ArcType"
+ || " AND cd.ArcType = 0"
+ || " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON od.ObsMasterItemGUID = ocmi.GUID"
+ || " JOIN SXACDObservationParameter obsparam WITH (NOLOCK)"
+ || " ON cd.GUID = obsparam.OwnerGUID"
+ || " AND od.ObservationDocumentGUID = obsparam.ObservationDocumentGUID"
+ || " AND ocmi.GUID = obsparam.ObsMasterItemGUID"
+ || " LEFT JOIN SCMObsFSListValues SOBS WITH (NOLOCK)"
+ || " ON obsparam.ObservationDocumentGUID = SOBS.ParentGUID"
+ || " AND obsparam.ClientGUID = SOBS.ClientGUID"
+ || " WHERE cd.GUID = " || SQL(EVOKINGOBJECT.GUID)
+ || " AND ocmi.Name IN ({{{SINGLE-QUOTE}}}SCH_MDPN_DS_HospCourse{{{SINGLE-QUOTE}}}"
+ || " ,{{{SINGLE-QUOTE}}}SCH_MDPN_DS_ReasonHospital{{{SINGLE-QUOTE}}}"
+ || " ,{{{SINGLE-QUOTE}}}SCH_MDPN_Review{{{SINGLE-QUOTE}}}"
+ || " ,{{{SINGLE-QUOTE}}}SCH_MDPN_Other Results{{{SINGLE-QUOTE}}}"
+ || " ,{{{SINGLE-QUOTE}}}SCH_MDPN_DS_Proc Tx Reason{{{SINGLE-QUOTE}}}"
+ || " ,{{{SINGLE-QUOTE}}}SCH_MDPN_DS_Proc Tx FT{{{SINGLE-QUOTE}}}) "};
+
+ if ( ( NOT DOD_HospCourse_observation IN obsName ) AND ( NOT DOD_ReasonHosp_observation IN obsName ) ) then
+ check_hospital_course := true;
+ else
+
+ hosp_course_unanswered := false;
+ reason_hosp_unanswered := false;
+
+ for i IN 1 seqto count obsName do
+ if ( obsName[i] = DOD_HospCourse_observation ) then
+ if ( obsValueList[i] IS NULL ) then
+ hosp_course_unanswered := true;
+ endif;
+ endif;
+ if ( obsName[i] = DOD_ReasonHosp_observation ) then
+ if ( obsValueText[i] IS NULL ) then
+ reason_hosp_unanswered := true;
+ endif;
+ endif;
+ enddo;
+
+ if ( ( hosp_course_unanswered = true ) AND ( reason_hosp_unanswered = true ) ) then
+ check_hospital_course := true;
+ endif;
+
+ endif;
+
+ if ( ( NOT DOD_ResultReview_observation IN obsName ) AND ( NOT DOD_OtherResults_observation IN obsName ) ) then
+ check_results := true;
+ else
+
+ result_review_unanswered := false;
+ other_result_unanswered := false;
+
+ for j IN 1 seqto count obsName do
+ if ( obsName[j] = DOD_ResultReview_observation ) then
+ if ( obsValueList[j] IS NULL ) then
+ result_review_unanswered := true;
+ endif;
+ endif;
+ if ( obsName[j] = DOD_OtherResults_observation ) then
+ if ( obsValueText[j] IS NULL ) then
+ other_result_unanswered := true;
+ endif;
+ endif;
+ enddo;
+
+ if ( ( result_review_unanswered = true ) AND ( other_result_unanswered = true ) ) then
+ check_results := true;
+ endif;
+ endif;
+
+ if ( ( NOT DOD_ProcTxReason_observation IN obsName ) AND ( NOT DOD_ProcTxFT_observation IN obsName ) ) then
+ check_procedures := true;
+ else
+
+ proc_tx_reason_unanswered := false;
+ proc_tx_ft_unanswered := false;
+
+ for k IN 1 seqto count obsName do
+ if ( obsName[k] = DOD_ProcTxReason_observation ) then
+ if ( obsValueList[k] IS NULL ) then
+ proc_tx_reason_unanswered := true;
+ endif;
+ endif;
+ if ( obsName[k] = DOD_ProcTxFT_observation ) then
+ if ( obsValueText[k] IS NULL ) then
+ proc_tx_ft_unanswered := true;
+ endif;
+ endif;
+ enddo;
+
+ if ( ( proc_tx_reason_unanswered = true ) AND ( proc_tx_ft_unanswered = true ) ) then
+ check_procedures := true;
+ endif;
+ endif;
+
+ //If Observation was not previously charted, check to see if it was charted this time
+ if ( check_hospital_course = true ) then
+
+ if ( ( count hosp_course_list = 0 ) AND ( hosp_reason_value IS NULL ) ) then
+ display_alert := true;
+ alert_msg := alert_msg || "\n\nHospital Course and Significant History";
+ endif;
+
+ endif;
+
+ if ( check_results = true ) then
+
+ if ( ( count result_review_list = 0 ) AND ( other_results_value IS NULL ) ) then
+ display_alert := true;
+ alert_msg := alert_msg || "\n\nResults, Tests, Finding";
+ endif;
+
+ endif;
+
+ if ( check_procedures = true ) then
+
+ if ( ( count proc_reason_list = 0 ) AND ( proc_treatment_value IS NULL ) ) then
+ display_alert := true;
+ alert_msg := alert_msg || "\n\nProcedures and Treatments";
+ endif;
+
+ endif;
+
+
+ endif;
+
+
+ ;;
+
+ evoke: Day_of_Discharge_doc_enter ;
+ Day_of_Discharge_doc_modify;
+ ;;
+
+ logic: conclude true;
+ ;;
+
+ action:
+ /*---------------------------------------------------*/
+ /* Always write an asynchronous alert to the chart */
+ /*---------------------------------------------------*/
+ if ( display_alert = true ) then
+ write alert_msg
+ at day_of_discharge_alert;
+ endif;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_DIAG_WRITE_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_DIAG_WRITE_ORDER.mlm
new file mode 100644
index 0000000..6aefb55
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_DIAG_WRITE_ORDER.mlm
@@ -0,0 +1,198 @@
+maintenance:
+
+ title: Writes a repeating lab order to the worksheet ;;
+ mlmname: SCH_DIAG_WRITE_ORDER;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: SCH ;;
+ author: ;;
+ specialist: ;;
+ date: 2012-06-15;;
+ validation: testing;;
+
+library:
+ purpose: Receive destination and write it.
+ Makes for multiple calls and hence writes on the order submit button.
+ ;;
+
+ explanation:
+ Called from FORM_SET_REPEAT_LAB_ORDERS to create diagnostic order and place on worksheet.
+ Change history
+ 06.15.2012 TMS Created in DEV
+ 11.26.2012 TMS Moved to Production
+ 02.25.2013 TMS Added logic to look for heparin orders for APTT heparin status
+ Missing from first repeat order, identified during AM Rounds project. HD Ticket 156616
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+
+
+ type: data-driven;;
+ data:
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ local_session := CDS_SESSION.local;
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+ (ordername, modname,vername, worksheetInfo, stime1, stimehr, stimemin, hepstatus,
+ //Active_OrderGUID,
+ //Active_SignificiantDtm,
+ client_visit_obj
+ ) := argument;
+
+
+
+ DiagnosticOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM, placed on worksheet",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010
+ ];
+
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with
+ [ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true
+ ];
+
+
+;;
+ priority: 50
+ ;;
+ evoke:
+
+ ;;
+ logic:
+
+
+ //---------------------------------------------------------------
+ // Create a new Laboratory order from a Pre-Filled item
+ // Place the order onto the order entry worksheet
+ //---------------------------------------------------------------
+ try
+
+ Catalog_Item_Name := (ordername as String);
+ Catalog_Item_Modifier := (modname as String);
+ Catalog_Item_Version := (vername as String);
+ order_Creation_Reason := "Repeat Lab Orders";
+
+ // get OrderCatalogMasterItem ObjectsPlus object
+ Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with Catalog_Item_Name;
+
+ // Create the prefilled Medication order
+ // Session information has been retrieved from the current worksheet if there
+ // already exists unsubmitted orders.
+ // AvailabilityOverride is set to Always.
+ DiagnosticOrder_obj := call worksheetInfo.CreateDiagnosticOrder
+ with
+ Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ Catalog_Item_Modifier, // string Name Modifier for prefill
+ Catalog_Item_Version, // string Name modifier version for prefill
+ order_Creation_Reason, // string Create Reason
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
+ false, // suppress messages
+ (Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Companion order primary key
+ false; // Mandatory on Worksheet
+
+
+
+ if( Laboratory_catalog_item is NOT NULL ) then
+ void := call Laboratory_catalog_item.Dispose;
+ Laboratory_catalog_item:= null;
+ endif;
+
+ // answer heparin questions on order form
+ if OrderName = "APTT" then
+
+ If hepstatus = true then
+ heparinstatus:= "Yes";
+ heparinlabinfo:= "Continuous Heparin";
+ else heparinstatus:= "No";
+ heparinlabinfo:= "";
+ endif;
+
+ LabHepStatus := call DiagnosticOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "LAB_VO_DI_Coag_Heparin Status",( heparinlabinfo AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ LabHepQuestion := call DiagnosticOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "Lab_ContHep_Question",( heparinstatus AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+
+ endif;
+
+ requestedTime_obj := new net_object {{{SINGLE-QUOTE}}}RequestedTime{{{SINGLE-QUOTE}}};
+ requestedTime_obj.CodedTime := stime1;
+
+ if stime1 <> "AM Rounds" then
+ time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} with (stimehr As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, (stimemin As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
+ requestedTime_obj.Time := time_obj;
+ DiagnosticOrder_obj.RequestedTime := requestedTime_obj;
+ endif;
+
+
+ void := call DiagnosticOrder_Obj.Save;
+ void := call DiagnosticOrder_Obj.Dispose;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ if( Laboratory_catalog_item is NOT NULL ) then
+ void := call Laboratory_catalog_item.Dispose;
+ Laboratory_catalog_item:= null;
+ endif;
+
+ if( DiagnosticOrder_obj is NOT NULL ) then
+ void := call DiagnosticOrder_obj.Dispose;
+ DiagnosticOrder_obj:= null;
+ endif;
+
+ DiagnosticOrder_dest := null;
+ endcatch;
+
+ conclude true;
+
+
+
+ ;;
+ action:
+
+ if error_occurred
+ then
+
+ write "An error has occurred in the MLM {{+B}}SCH_DIAG_WRITE_ORDER{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error(s) " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+
+
+ if EXISTS DiagnosticOrder_dest then
+ write true at DiagnosticOrder_dest;
+ endif;
+
+ return error_occurred;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_DIALOG_OPERATIONS.mlm b/MLMStripper/bin/Debug/SCH/SCH_DIALOG_OPERATIONS.mlm
new file mode 100644
index 0000000..89603c4
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_DIALOG_OPERATIONS.mlm
@@ -0,0 +1,212 @@
+maintenance:
+
+ title: SCH_Dialog_Operations;;
+ mlmname: SCH_Dialog_Operations;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: SCH ;;
+ author: Shivprasad Jadhav(Allscripts);;
+ specialist: ;;
+ date: 2015-05-12;;
+ validation: testing;;
+
+library:
+ purpose: To Launch Different Dialogbox.
+
+ Argument Required ::
+ 1) Client visit GUID
+ 2) Operations ( Pass anyone from below three value based on performing operation )
+ A. SignatureManager
+ B. ExitCare
+ C. OrderReconciliationManager
+ D. HealthIssueManager
+ E. OrderEntry
+
+
+ Sample Argument ::
+ MLM_Name := MLM {{{SINGLE-QUOTE}}}GMS_Dialog_Operations{{{SINGLE-QUOTE}}}; // MLM name
+ 1) SignatureManager
+ Status := call MLM_Name with ClientVisitGUID,"SignatureManager";
+ 2) ExitCare
+ Status := call MLM_Name with ClientVisitGUID,"ExitCare";
+ 3) OrderReconciliationManager
+ Status := call MLM_Name with ClientVisitGUID,"OrderReconciliationManager";
+ 4) HealthIssueManager
+ Status := call MLM_Name with ClientVisitGUID,"HealthIssueManager";
+ 5) OrderEntry
+ Status := call MLM_Name with ClientVisitGUID,"OrderEntry";
+
+ Return Type ::
+ MLM wil return Success if operation performs Successfully.
+ MLM wil return error_message if any error generate while performing operation Insert/Discontinue/Delete.
+
+ ;;
+ explanation:
+
+ ;;
+ keywords: ObjectsPlus, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ //Set to true if a decision.log is needed.
+ log_execution_info:= FALSE; //Set to FALSE for Production
+
+ (ClientVisitGUID,Dialog_Name // ClientVisit ObjectsPlus object
+ ):= argument;
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Common";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Common";
+ using namespace "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+ using "SXA.Framework" ;
+ using "SCMLib";
+ using namespace "SCMLib.Dialogs";
+ using namespace "SCMLib.Context";
+ using namespace "Eclipsys.SunriseXA.Framework.SCMSXAInterop";
+
+ If Not Called_By_Editor Then
+
+ mlm_name := "GMS_Dialog_Operations";
+ error_occurred := false;
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ try
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ if Dialog_Name = "SignatureManager" then
+ sxaDialog := new NET_OBJECT {{{SINGLE-QUOTE}}}SXADialog{{{SINGLE-QUOTE}}};
+ void := call sxaDialog.ShowSXADialog with "SXADialogType_SignatureManager" as {{{SINGLE-QUOTE}}}SXADialogType{{{SINGLE-QUOTE}}};
+ endif;
+
+ if Dialog_Name = "ExitCare" then
+ try
+ using "SCMLib";
+ using namespace "SCMLib.HVCLogon";
+ using "SXA.ED.DischargeInstructions";
+ using namespace "SXA.ED.DischargeInstructions";
+
+ using "SXA.Framework" ;
+ using Namespace "Eclipsys.SunriseXA.Framework.WinClient" ;
+ shellinterface := new NET_OBJECT {{{SINGLE-QUOTE}}}XAShellInterface{{{SINGLE-QUOTE}}} ;
+ shellinterface := new NET_OBJECT {{{SINGLE-QUOTE}}}XAShellInterface{{{SINGLE-QUOTE}}} ;
+ connstring := call {{{SINGLE-QUOTE}}}HVCLogonObj{{{SINGLE-QUOTE}}}.GetConnectionString;
+ dis_instr := new NET_OBJECT {{{SINGLE-QUOTE}}}DischargeInstructions{{{SINGLE-QUOTE}}} ;
+ Exit_Care_Diaglog := call dis_instr.LaunchDischargeInstructions
+ with (shellinterface, true) ;
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Cannot start ExitCare Application: {{-R}}\n"
+ || ex.Message || "\n\n";
+ msg := error_message || msg;
+
+ if ( dis_instr is NOT NULL ) then
+ void:= call dis_instr.Dispose;
+ dis_instr:= null;
+ endif;
+ endcatch;
+ endif;
+
+ if Dialog_Name = "OrderReconciliationManager" then
+ try
+ // Create the Order Reconciliation Manager object
+ order_rec_mgr_obj:= new NET_OBJECT {{{SINGLE-QUOTE}}}OrderReconciliationManager{{{SINGLE-QUOTE}}};
+ order_rec_mgr_obj.ClientVisitPrimaryKey := ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ void := call order_rec_mgr_obj.ShowDialog;
+ endtry;
+ catch exception ex
+ if ( order_rec_mgr_obj is NOT NULL ) then
+ void:= call order_rec_mgr_obj.Dispose;
+ order_rec_mgr_obj:= NULL;
+ endif;
+ endcatch;
+ endif;
+
+ if Dialog_Name = "HealthIssueManager" then
+ try
+ // Create the Order Reconciliation Manager object
+ order_rec_mgr_obj:= new NET_OBJECT {{{SINGLE-QUOTE}}}HealthIssueManager{{{SINGLE-QUOTE}}};
+ order_rec_mgr_obj.ClientVisitPrimaryKey := ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ void := call order_rec_mgr_obj.ShowDialog;
+ endtry;
+ catch exception ex
+ if ( order_rec_mgr_obj is NOT NULL ) then
+ void:= call order_rec_mgr_obj.Dispose;
+ order_rec_mgr_obj:= NULL;
+ endif;
+ endcatch;
+ endif;
+
+ if Dialog_Name = "OrderEntry" then
+ try
+ using "OpenDialogBoxManager";
+ using namespace "OpenDialogBoxManager";
+ DialogBox_obj:= new NET_OBJECT {{{SINGLE-QUOTE}}}OpenDialogBoxManager.OpenDialogBoxManager{{{SINGLE-QUOTE}}} With 1 as {{{SINGLE-QUOTE}}}System.Int64{{{SINGLE-QUOTE}}};
+ endtry;
+ catch exception ex
+ if ( DialogBox_obj is NOT NULL ) then
+ void:= call DialogBox_obj.Dispose;
+ DialogBox_obj := NULL;
+ endif;
+ endcatch;
+ endif;
+
+ endtry;
+ catch exception ex
+ error_occurred := true;
+ error_message := error_message ||
+ "{{+R}} Dialog Box {{-R}}\n" ||
+ ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+ endcatch;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ if Error_occurred then
+ write "An error has occured in the MLM "
+ || "{{+B}}" || mlm_name || "{{-B}} "
+ ||"Please notify your System Administrators that an error message has "
+ ||"occurred for this patient. They will review the following error "
+ ||"message: \n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+ if Error_occurred then
+ return error_message;
+ else
+ return "Success";
+ endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_DIET_NPO_HARD_STOP_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_DIET_NPO_HARD_STOP_ALERT.mlm
new file mode 100644
index 0000000..500552c
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_DIET_NPO_HARD_STOP_ALERT.mlm
@@ -0,0 +1,110 @@
+maintenance:
+
+ title: SCH_Diet_NPO_Hard_Stop_Alert;;
+ mlmname: SCH_Diet_NPO_Hard_Stop_Alert;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: St Clair Hospital;;
+ author: Shivprasad Jadhav, Allscripts ;;
+ specialist: Shivprasad Jadhav, Allscripts;;
+ date: 2015-11-17;;
+ validation: testing;;
+
+library:
+ purpose: This MLM is called from [Diet-Add to Current Diet] Orders as Event Based Order forms to Restrict the User to place order who have Active NPO Order on Patient
+ ;;
+
+ explanation:
+ Change History
+ --------------------------------------
+ 2015-11-06 CSR-32228 : Created MLM
+ ;;
+ keywords: Called MLMs
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+
+ event_OSInit := event{OrderInit User Order: WHERE Name = "Diet" And Modifier = "(Add to current diet)" }; //
+
+ /* Executes only when this MLM is called by the editor */
+
+ if called_by_editor then
+ if eventName = "OrderSetInit" Then
+ order_obj:= read last {Order: This };
+ EvokingObject:= order_obj;
+ EndIf;
+ endif;
+
+ (clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
+ VisitGuid := read last {ClientVisit : GUID};
+
+ /*****************************************************************************************************************/
+ //Set to true if logging needed
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+ //Set the stop message
+ stop_message := false;
+
+ //Set Stop
+ hard_stop := false;
+ found_unsubmitted_orders := false;
+ existing_orders := ();
+ alert_priority := "High";
+
+ alert_dialog := "No Override Allowed";
+ alert_message := "{{+B}}Patient has Active {{+R}} NPO {{-R}} order.{{-B}}";
+
+
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "Patient has Active NPO order",
+ priority := alert_priority,
+ scope := Chart,
+ rule_group := "Patient has Active NPO order",
+ rule_number := 9000,
+ send_with_order := send_alert,
+ alert_dialog_settings := alert_dialog,
+ display_alert := true];
+
+/************************************************************************************************************/
+
+
+ NPOGuid := Read first{" Select Top 1 o1.guid from cv3ClientVisit cv with (nolock) Join Cv3Order o1 With (Nolock) "
+ || " on cv.guid=o1.ClientVisitGUID And cv.ClientGUID=o1.ClientGUID And cv.ChartGUID=o1.ChartGUID And o1.name = {{{SINGLE-QUOTE}}}NPO{{{SINGLE-QUOTE}}} "
+ || " And o1.OrderStatusLevelNum = 50 And cv.guid = " || VisitGuid || " Order By O1.CreatedWhen Desc "} ;
+
+
+
+ If exists NPOGuid Then
+
+ hard_stop := True;
+ Else
+ hard_stop := False;
+
+ Endif;
+
+
+
+
+ ;;
+ evoke: event_OSInit; // No evoke statement
+ ;;
+ logic:
+
+ conclude hard_stop;
+ ;;
+ action:
+ write alert_message at order_alert_dest;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_DIET_SECLUSION_TRAY.mlm b/MLMStripper/bin/Debug/SCH/SCH_DIET_SECLUSION_TRAY.mlm
new file mode 100644
index 0000000..81f3e38
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_DIET_SECLUSION_TRAY.mlm
@@ -0,0 +1,203 @@
+maintenance:
+
+ title: SCH_Diet_Seclusion_Tray ;;
+ mlmname: SCH_Diet_Seclusion_Tray ;;
+ arden: version 2.5;;
+ version: 5.50;; // FP1
+ institution: St. Clair Hospital ;;
+ author: Shivprasad Jadhav ;;
+ specialist: ;;
+ date: 2015-11-17;;
+ validation: testing;;
+
+library:
+ purpose: Discontinue the Earlier Active and Latest {{{SINGLE-QUOTE}}}Diet Order{{{SINGLE-QUOTE}}} from Standard Session while creating new Diet order [Diet- Add to current ]
+ ;;
+ explanation:
+ Change History
+ ----------------------------------------------------
+ 17.11.2015 GOS CSR-32228 : Created MLM.
+
+ ;;
+ keywords: ObjectsPlus, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ using "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "ObjectsPlusXA.SCM";
+ using "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "SCMLib";
+
+ using namespace "System";
+ using namespace "System.Exception";
+ using namespace "System.Windows.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager";
+ using namespace "SCMLib.PObj";
+ using namespace "SCMLib.PObj.OrderPObj";
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+ Order_Submit := event {OrderWorksheetSubmit User } ; //Order : WHERE Name Matches pattern "Place in Observation%" } ;//Order: where Name in ("Place in Observation")};
+ onames, Mod := read Last { UNSUBMITTED ORDER: Name , Modifier };
+
+ ( careProvider_obj ) := read last{ UserInfo: careProvider };
+ ( careProvider_Actaul ) := read last{ UserInfo: This };
+
+
+ (location_guid, Active_ClientVisitGUID, client_guid) := read last { ClientVisit: CurrentLocationGUID, GUID, clientguid };
+
+ visitGuid := EVOKINGOBJECT.GUID ;
+
+
+ OrderGuid := Read first{" Select Top 1 o1.guid from cv3ClientVisit cv with (nolock) Join Cv3Order o1 With (Nolock) "
+ || " on cv.guid=o1.ClientVisitGUID And cv.ClientGUID=o1.ClientGUID And cv.ChartGUID=o1.ChartGUID And o1.name = {{{SINGLE-QUOTE}}}Diet{{{SINGLE-QUOTE}}} "
+ || " And o1.OrderStatusLevelNum = 50 And o1.InitialSessionTypeCode <> {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} And cv.guid = " || visitGuid || " Order By O1.CreatedWhen Desc "} ;
+
+
+ If ( "Diet" In onames) And ("(Add to current diet)" In Mod ) Then //And ("(Add to current diet)" In Mod
+ If exist OrderGuid Then
+
+ //(Typecode, Username ) := Read first {" Select Typecode, DisplayName from CV3CareProvider Where GUID = " || Care_Provider || " "} ;
+ location_guid := Read First {" Select CurrentLocationGUID from CV3ClientVisit Where GUID = " || visitGuid || " "} ;
+
+
+ order_Creation_Reason := "Created by MLM";
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ RequestedByGUID:= "" ;
+ RequestedByGUID:= READ LAST {" select top 1 RequestedByGUID from CV3OrderStatusHistory (nolock)
+ Where OrderGUID = " || SQL(OrderGuid) ||" order by CreatedWhen "};
+
+
+ If order_guid IS NULL then
+ DiscontinueOrder := False ;
+ Endif;
+
+ // Common data
+ Try
+ // .Net version of Client Visit Object
+ ClientVisit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ // Get the current user as the default care provider
+ // RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with (user_id_type, user_id_code);
+ /* Added by Vishal Modi on 07/27/2015 */
+ //RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((care_provider_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((RequestedByGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ error_occurred := false;
+ Endtry;
+
+ Catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+ If ClientVisit_obj IS NOT NULL then
+ void := call ClientVisit_obj.Dispose;
+ ClientVisit_obj := NULL;
+ Endif;
+ If RequestedBy_obj IS NOT NULL then
+ void := call RequestedBy_obj.Dispose;
+ RequestedBy_obj := NULL;
+ Endif;
+ // Cannot continue with order discontinuation
+ DiscontinueOrder := True ;
+ Endcatch;
+ // END Common Data
+
+ Try
+
+ //RequestedBySource := ".Per Electronic Order";
+ //OrderDiscontinuationReason := "Cancelled by MLM as duplicate Diets order.";
+ RequestedBySource := "per hospital policy";
+ OrderDiscontinuationReason := "New diet ordered.";
+ order_obj := new net_object {{{SINGLE-QUOTE}}}SCMLib.PObj.OrderPObj{{{SINGLE-QUOTE}}} with OrderGuid;
+
+ order_obj.SuppressSignOnSubmit := true;
+ order_obj.ToBeSigned := false;
+
+ now_dtm := now + 1 minute;
+ date_str := ((extract year now_dtm) as string) || "-" ||
+ (extract month now_dtm) formatted with "%0.2d" || "-" ||
+ (extract day now_dtm) formatted with "%0.2d";
+ time_str := (extract hour now_dtm) formatted with "%0.2d" || ":" ||
+ (extract minute now_dtm) formatted with "%0.2d" || ":" ||
+ (extract second now_dtm) formatted with "%0.2d";
+
+
+
+ care_provider_guid_str := (RequestedBy_obj.PrimaryKey as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) as string;
+
+ dc_order := call order_obj.Discontinue with OrderDiscontinuationReason,
+ date_str,
+ time_str,
+ RequestedBySource,
+ care_provider_guid_str;
+
+
+ Endtry;
+ Catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Discontinuing order:{{-R}}\n" || ex.Message || "\n\n";
+ DiscontinueOrder := True ;
+ EndCatch;
+
+ DiscontinueOrder := True ;
+ Endif;
+ Endif;
+ ;;
+ priority: 50
+ ;;
+ evoke: Order_Submit; ;;
+ logic:
+
+ if DiscontinueOrder = False
+ then
+ conclude false;
+ endif;
+
+ conclude true;
+
+ ;;
+ action:
+ order_discontinued_no_error := false;
+ If error_occurred = true then
+ If error_message MATCHES PATTERN "%update you requested has been canceled due%"
+ or error_message MATCHES PATTERN "%Failed to Store Alert to database%" then
+ error_destination.short_message := " Diet Not Entered";
+ alert_message := "{{+B}}Sedation Protocol: Diet not entered into SCM" || "\n" ||
+ "Due to a response (GO-BACK) to a Clinical Alert{{-B}}";
+ write alert_message at error_destination;
+ write error_message at error_destination;
+ Else
+ write "An error has occured in the MLM {{+B}} SCH_Diet_Seclusion_Tray {{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+
+ write error_message at error_destination;
+ Endif;
+ Else
+ order_discontinued_no_error := true;
+ return order_discontinued_no_error;
+ Endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_DISCONTINUE_HELD_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_DISCONTINUE_HELD_ORDERS.mlm
new file mode 100644
index 0000000..ef80864
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_DISCONTINUE_HELD_ORDERS.mlm
@@ -0,0 +1,94 @@
+maintenance:
+
+ title: Discontinue of held ordersRelease check for orders without schedules;;
+ filename: SCH_Discontinue_Held_Orders;;
+ arden: version 4.5;;
+ version: 2.00;;
+ institution: St Clair;;
+ author: Teresa Spicuzza;;
+ specialist: Don Warnick;;
+ date: 2010-10-19;;
+ validation: testing;;
+
+library:
+ purpose: When discontinuing a held order, alert the user
+ ;;
+ explanation: Returns a message box to the user when a held order is discontinued.
+
+ change history
+
+ 10.19.2010 DW Created
+ 08.27.2018 TMS HD #3351839 Added logic to ignore alert if order being discontinued is part of the Anesthesia Post Op Orders.
+
+ ;;
+ keywords: Discontinue, hold, order
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+ /* Set to true if logging is needed.*/
+ log_execution_info:= false;
+
+ // Set the text for this variable to indicate whether to send the message or not.
+ send_alert := "DoNotSend";
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+
+//--------------------------------------------------------------------------
+// local_session := cds_session.local;
+//--------------------------------------------------------------------------
+
+ visit_alert:= destination { Alert: Warning, "DC/Cancel Held Order", high, chart, "DC/Cancel Held Order", 14005, send_alert};
+
+ on_order_Cancel := event { OrderCancel Any Order };
+ on_order_DC := event { OrderDiscontinue Any Order };
+
+ (backup_obj) := read last {Order: Backup REFERENCING EvokingObject};
+ (Bk_VisitStatus) := read last {Order: OrderStatusCode REFERENCING backup_obj};
+
+ if Bk_VisitStatus = "HOLD" then
+
+ SurgOrder:= read last {" Select uod.value from CV3Order o
+ join CV3OrderUserData uod on uod.OrderGUID = o.GUID
+ where o.guid = " || evokingobject.guid ||" and o.ClientGUID = " ||EVOKINGOBJECT.ClientGUID ||" and o.ClientVisitGuid = " || EVOKINGOBJECT.ClientVisitGUID || "
+ and ((uod.UserDataCode = {{{SINGLE-QUOTE}}}MLM_OpsuOrderfor AutoDC{{{SINGLE-QUOTE}}} or uod.UserDataCode = {{{SINGLE-QUOTE}}}MLM_SurgOrderfor AutoDC{{{SINGLE-QUOTE}}}) and uod.Value = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}})
+ and o.TypeCode in ({{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Other{{{SINGLE-QUOTE}}})
+ and o.OrderStatusCode not in ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}COMP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}})"};
+
+ endif;
+
+ ;;
+ evoke: on_order_DC or on_order_Cancel ;
+ ;;
+ logic:
+/*
+ if local_session.SessionReleseOrderAlertFired is null then
+ local_session.SessionReleseOrderAlertFired := "has fired";
+ conclude true;
+ endif;
+
+*/
+ if Bk_VisitStatus = "HOLD" and SurgOrder is null then
+
+ conclude true;
+
+ endif;
+
+ ;;
+ action:
+
+
+
+ write "You are discontinuing a held order. \n\n {{+B}}Go Back:{{-B}} This is a held order that needs an administration date/ time change; select Go Back and use the Release and Change Date function. \n\n {{+B}}Proceed:{{-B}} If the intention is to discontinue this order for example it is a duplicate order; select Proceed. " at visit_alert;
+ // dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You are discontinuing a held order." ,"Discontinue Held Order Reminder","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ ;;
+
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_DRUGLEVELMONITORING.mlm b/MLMStripper/bin/Debug/SCH/SCH_DRUGLEVELMONITORING.mlm
new file mode 100644
index 0000000..a97746a
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_DRUGLEVELMONITORING.mlm
@@ -0,0 +1,315 @@
+maintenance:
+
+ title: Drug Level Monitoring Alerts for Select Drugs;;
+ mlmname: SCH_DrugLevelMonitoring;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair;;
+ author: Teresa Spicuzza, Allscripts Corp;;
+ specialist: Teresa Spicuzza;;
+ date: 2012-08-20;;
+ validation: testing;;
+
+library:
+ purpose: Recommendations for Drug Level Monitoring Alerts for Select Drugs
+ ;;
+
+ explanation: MLM will alert user to monitor patient for therapeutic drug levels for select medications
+ identified with a class type of PRX_DrugMonitoring.
+
+ Change history
+ 06.10.2013 TMS Created CSR CSR 31334
+ 01.07.2016 TMS Update call to SCH_Func_Creatinine_Clearance to include 5 parameters in the argument
+ being returned. Changed from CrCl_Message, Crcl_Value, wt, patientage to
+ CrCl_Message, Crcl_Value, SCRfromMLM, wt, patientage HD Ticket: 1994073
+ 06.07.2016 TMS Update to change Valproic Acid and Phenytoin and add Carbamazepine to not alert
+ if levels done during this admission, not only past 48 hours. CSR 34690
+ 09.30.2019 TMS Updated alert to require reason when alert presented to user not in physician/physician extender
+ group. CSR 37977
+
+ ;;
+ keywords: Monitoring
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ CrCl_info:= mlm {{{SINGLE-QUOTE}}}SCH_Func_Creatinine_Clearance{{{SINGLE-QUOTE}}};
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {Order: THIS
+ where Name="Metformin 500mg Tab" };
+ endif;
+
+ doalert := false;
+ order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"};
+
+ (CatalogItemObj, FrequencyValue, UOMValue, DoseValue, OrderName, AdminIns, UserSchedType ,UserSchedDays, UserSchedDoses) := read last {Order: OrderCatalogMasterItem, FrequencyCode, UOM, DosageLow, Name, AdminInstructions, Interval, DaysInInterval, DoseMultiplier
+ REFERENCING EvokingObject};
+
+ CatalogClassTypeValueObj := read last {OrderCatalogMasterItem: CatalogClassTypeValue,
+ REFERENCING CatalogItemObj};
+
+ ClassTypeValue_code_list, ClassTypeValue_value_list := read last {CatalogClassTypeValue: Code, Value
+ REFERENCING CatalogClassTypeValueObj where code = "PRX_DrugMonitoring"};
+
+ fire_on_UserCPOE := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT");
+ fire_on_User := ("RN","RPh");
+
+ /* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
+ (user_id,userguid) :=read last {UserInfo: idcode, guid};
+
+ UserCode := read last
+ {"Select occupationcode "
+ ||" From cv3user with (nolock) "
+ ||" Where Guid = " || SQL(userguid) };
+
+ If usercode in fire_on_UserCPOE then
+ alert_settings := "";
+ UDDD_dictionary_name := "";
+ UDDD_is_restricted := FALSE;
+ continue_processing := true;
+ elseif usercode in fire_on_User then
+ alert_settings := "Must Comment";
+ UDDD_dictionary_name := "AlertAckComment";
+ UDDD_is_restricted := TRUE;
+ continue_processing := true;
+ else continue_processing := false;
+ endif;
+
+
+ dose_alert_dest := destination {alert} with
+ [alert_type := "Warning",
+ short_message := "Monitoring Recommendation",
+ priority := "Low",
+ scope := "Chart",
+ rule_group := "Drug Monitoring",
+ rule_number := 4080,
+ send_with_order := send_alert,
+ alert_dialog_settings :=alert_settings,
+ ack_comment_UDDD := UDDD_dictionary_name,
+ ack_comment_UDDD_is_restricted := UDDD_is_restricted,
+ display_alert := true];
+
+
+// continue_processing:= user_id in fire_on_User;
+// continue_processing:= usercode in fire_on_User;
+
+ if EvokingEvent = order_enter_event and continue_processing = true and "PRX_DrugMonitoring" in ClassTypeValue_code_list then
+
+ (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus, AdmitDtm) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus, AdmitDtm };
+
+ (UserGUID ) := read last { UserInfo: GUID };
+
+ patientgender := read last { ClientInfo: Gendercode };
+
+ Creatinine, Creatdtm := read last
+ {"Select top 1 bo.value, o.performeddtm "
+ || " 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(clientguid)
+// || " and o.chartguid = " || SQL(chartguid)
+ || " and o.performeddtm >= " || SQL(AdmitDtm)
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Creatinine Plasma/Serum{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ if ClassTypeValue_value_list = "Digoxin" and Creatinine is not Null then
+ (CrCl_Message, Crcl_Value, SCRfromMLM, wt, patientage) := call CrCl_info with (ClientVisitGuid, ChartGuid, ClientGuid, Creatinine);
+ endif;
+
+ Digoxin := 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(clientguid)
+// || " and o.chartguid = " || SQL(chartguid)
+ || " and o.performeddtm >= (DATEADD(hour, -48, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Digoxin Plasma/Serum{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ Phenytoin := 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(clientguid)
+ || " and o.performeddtm >= " || SQL(AdmitDtm)
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Dilantin Serum (Phenytoin){{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ Theophylline := 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(clientguid)
+// || " and o.chartguid = " || SQL(chartguid)
+ || " and o.performeddtm >= (DATEADD(hour, -48, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Theophylline Plasma/Serum{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ Valproic := 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(clientguid)
+ || " and o.performeddtm >= " || SQL(AdmitDtm)
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Valproic Acid Plasma (Depakote Plasma){{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ Carbamazepine := 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(clientguid)
+ || " and o.performeddtm >= " || SQL(AdmitDtm)
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Carbamazepine Serum (Tegretol){{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+
+ If ClassTypeValue_value_list = "Phenytoin" then
+ If Phenytoin is Null then
+ // alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n Last Phenytoin level was > 48 hours ago. Monitor phenytoin levels closely especially when changing the dose or frequency. {{-B}}";
+ alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n No Phenytoin levels available for this admission. Monitor phenytoin levels closely especially when changing the dose or frequency. {{-B}}";
+ doalert := true;
+ endif;
+ endif;
+ If ClassTypeValue_value_list = "Theophylline" then
+ If Theophylline is Null then
+ alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n Last Theophylline level was > 48 hours ago. Monitor theophylline levels closely especially when changing the dose or frequency. {{-B}}";
+ doalert := true;
+ endif;
+ endif;
+ If ClassTypeValue_value_list = "Valproic" then
+ If Valproic is Null then
+ // alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n Last Valproic Acid level was > 48 hours ago. Monitor valproic acid levels closely especially when changing the dose or frequency. {{-B}}";
+ alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n No Valproic Acid levels available for this admission. Monitor valproic acid levels closely especially when changing the dose or frequency. {{-B}}";
+ doalert := true;
+ endif;
+ endif;
+ If ClassTypeValue_value_list = "Carbamazepine" then
+ If Carbamazepine is Null then
+ alert_message := "{{+B}}{{+R}}Ordered: " || OrderName || "{{-R}} \n\n No Carbamazepine levels available for this admission. Monitor carbamazepine levels closely especially when changing the dose or frequency. {{-B}}";
+ doalert := true;
+ endif;
+ endif;
+ If ClassTypeValue_value_list = "Digoxin" then
+
+ If Digoxin is Null and ((CRCL_Value as number) < 50) then
+ alert_message := "{{+B}} This patient{{{SINGLE-QUOTE}}}s estimated CrCl is " || CrCl_Value || "ml/min. "
+ || " \n Calculated with a Serum Creatinine of: " || Creatinine || "mg/dl "
+ || " \n\n {{+R}} Ordered: " || OrderName || "{{-R}} \n\n Last Digoxin level was > 48 hours ago. Monitor digoxin levels closely in patients with renal dysfunction escpecially when changing the dose or frequency. {{-B}}"
+ || "\n\n\n Calculation Information: " || CrCl_Message;
+ doalert := true;
+ endif;
+ endif;
+
+
+
+
+ else
+ doalert := false;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke: order_enter_event;
+
+ ;;
+ logic:
+
+ if called_by_editor
+ then
+ conclude false;
+ endif;
+
+ //----------------------------------------------------------------
+ // If there is no evoking object then do nothing, this can
+ // only be true for the MLM Editor
+ //----------------------------------------------------------------
+ if EvokingObject is null
+ then
+ conclude false;
+ endif;
+ if continue_processing = false
+ then
+ conclude false;
+ endif;
+
+
+ conclude doalert;
+
+ ;;
+ action:
+ write alert_message at dose_alert_dest
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_DRUG_LAB_ALERTS.mlm b/MLMStripper/bin/Debug/SCH/SCH_DRUG_LAB_ALERTS.mlm
new file mode 100644
index 0000000..2e1e2f8
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_DRUG_LAB_ALERTS.mlm
@@ -0,0 +1,652 @@
+maintenance:
+
+ title: Dosing alerts for out of range lab values;;
+ mlmname: SCH_Drug_Lab_Alerts;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair;;
+ author: Teresa Spicuzza, Allscripts Corp;;
+ specialist: Teresa Spicuzza;;
+ date: 2012-07-02;;
+ validation: testing;;
+
+library:
+ purpose: Renal Dosing Recommendations
+ ;;
+
+ explanation: MLM will read table and provide dosing alerts based upon medication and specific lab values.
+
+ Change history
+ 06.06.2013 TMS Created for CSR 31334
+ 06.25.2014 TMS Modify retrieval of class type to correct issue with mlm not always firing.
+ 06.09.2015 TMS Added rules E, F, G, and H as well as retrievals for Argatroban
+ and potassium medications, active and unsubmitted. CSR 33467
+ 06.03.2016 TMS Added drug levels for Valproic Acid, Phenytoin, and Carbamazepine. CSR 34690
+ 04.18.2017 TMS added exclusion for Hi CPK with Statin Drugs if patient has diagnosis
+ of STEMI or NSTEM for this visit CSR 34043
+ 05.08.2017 TMS Updated with additional rules for potassium and products containing
+ trimethoprim. CSR 35636
+ 09.30.2019 TMS Updated alert to require reason when alert presented to user not in physician/physician extender
+ group. CSR 37977
+
+ ;;
+ keywords: Drug Lab Dosing
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {Order: THIS
+ where Name="Loratadine 10mg Tab" };
+ endif;
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+ messageA := SP;
+ messageB := SP;
+ messageC := SP;
+ doalert := false;
+ order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"};
+
+ (CatalogItemObj, FrequencyValue, UOMValue, DoseValue, OrderName, OrderRoute, AdminIns,
+ UserSchedType ,UserSchedDays, UserSchedDoses, PRN, OrderSummaryLine, OrdComponentObj, OrderGuid) := read last {Order: OrderCatalogMasterItem, FrequencyCode,
+ UOM, DosageLow, Name, OrderRouteCode, AdminInstructions, Interval, DaysInInterval, DoseMultiplier, IsPRN, SummaryLine, OrderComponent, Guid
+ REFERENCING EvokingObject};
+ ClassTypeGuid := read last
+ { " select guid from CV3ClassType where Code = {{{SINGLE-QUOTE}}}PRX_DrugLabAlerts{{{SINGLE-QUOTE}}}" };
+
+ ClassValue := read last { " select value from CV3CatalogClassTypeValue "
+ || " where CatalogMasterGuid = " || SQL (CatalogItemObj.GUID) || " and classtypeguid = " || SQL (classtypeguid) };
+
+
+ xComponentCatalogGuidList := read {OrderComponent: OrderCatalogMasterItemGUID
+ REFERENCING OrdComponentObj};
+ ComponentCatalogGuidList := (999);
+ for i in 1 seqto count xComponentCatalogGuidList do
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"," || xComponentCatalogGuidList [i];
+ enddo;
+
+ If count (ComponentCatalogGuidList) > 0 then
+
+ CompClassValue := read last
+ { " Select ctv.value from CV3CatalogClassTypeValue ctv "
+ || " join CV3OrderCatalogMasterItem ocmi on ocmi.GUID = ctv.CatalogMasterGUID "
+ || " where ctv.ClassTypeGUID = " || SQL(ClassTypeGuid) || " and ocmi.Guid in (" || ComponentCatalogGuidList ||")" };
+
+ endif;
+
+ If classvalue is null and compclassvalue is null then
+ continue := "no";
+ else
+ continue := "yes";
+ endif;
+
+ if continue = "yes" then
+ /* Get the OrderAdditionalInfo object pointer */
+ OrderAdditionalInfoObj := read last { Order: OrderAdditionalInfo
+ REFERENCING EvokingObject };
+
+ /* Get information from the OrderAdditionalInfo object */
+ (SummaryLine, FreqfromTime,FreqUOM ) := read last { OrderAdditionalInfo: FreqSummaryLine ,FreqFromTime, FreqUOM
+ REFERENCING OrderAdditionalInfoObj };
+
+
+
+ fire_on_UserCPOE := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT");
+ fire_on_User := ("RN","RPh");
+
+ /* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
+ (user_id,userguid) :=read last {UserInfo: idcode, guid};
+
+ UserCode := read last
+ {"Select occupationcode "
+ ||" From cv3user with (nolock) "
+ ||" Where Guid = " || SQL(userguid) };
+
+ If usercode in fire_on_UserCPOE then
+ alert_settings := "";
+ UDDD_dictionary_name := "";
+ UDDD_is_restricted := FALSE;
+ continue_processing := true;
+ elseif usercode in fire_on_User then
+ alert_settings := "Must Comment";
+ UDDD_dictionary_name := "AlertAckComment";
+ UDDD_is_restricted := TRUE;
+ continue_processing := true;
+ else continue_processing := false;
+ endif;
+
+ dose_alert_dest := destination {alert} with
+ [alert_type := "Warning",
+ short_message := "Dosing Recommendation",
+ priority := "Low",
+ scope := "Chart",
+ rule_group := "Adjust Dosing",
+ rule_number := 4052,
+ send_with_order := send_alert,
+ alert_dialog_settings := alert_settings,
+ ack_comment_UDDD := UDDD_dictionary_name,
+ ack_comment_UDDD_is_restricted := UDDD_is_restricted,
+ display_alert := true];
+
+
+
+ (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus, AdmitDtm) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus, AdmitDtm };
+ (UserGUID ) := read last { UserInfo: GUID };
+
+ //Check for existence of STEMI or NSTEMI health issue for this visit
+ Stemi_Nstemi := READ LAST {"SELECT 1 "
+ || " FROM CV3HealthIssueDeclaration hid WITH (NOLOCK) JOIN CV3CodedHealthIssue chi WITH (NOLOCK)"
+ || " ON hid.CodedHealthIssueGUID = chi.GUID"
+ || " WHERE hid.ClientGUID = " || SQL(ClientGUID)
+ || " AND hid.ClientVisitGUID = " || SQL(ClientVisitGuid)
+ || " AND hid.ChartGUID = " || SQL(ChartGUID)
+ || " AND hid.Active = 1"
+ || " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
+ || " AND hid.TypeCode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}"
+ || " AND ( ( chi.Description LIKE {{{SINGLE-QUOTE}}}%STEMI%{{{SINGLE-QUOTE}}} OR chi.ShortName LIKE {{{SINGLE-QUOTE}}}%STEMI%{{{SINGLE-QUOTE}}} ) "
+ || " OR ( chi.Description LIKE {{{SINGLE-QUOTE}}}%NSTEMI%{{{SINGLE-QUOTE}}} OR chi.ShortName LIKE {{{SINGLE-QUOTE}}}%NSTEMI%{{{SINGLE-QUOTE}}} ) )" };
+
+
+ KName, KValue, KUom, KDone, KAbn := read last
+ {"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Potassium Plasma/Serum{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ If (KValue as number) >= 5.0 or KAbn = "HH" then Hi_K := true; else Hi_K := false; endif;
+ If (KValue as number) > 4.5 and (KValue as number) < 5.0 then Mid_K := true; else Mid_K := false; endif;
+ If (KValue as number) < 3.5 or KAbn = "LL" then Lo_K := true; else Lo_K := false; endif;
+
+ NaName, NaValue, NaUom, NaDone, NaAbn := read last
+ {"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Sodium Plasma/Serum{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ If (NaValue as number) < 133.0 or NaAbn = "LL" then Lo_Na := true; else Lo_Na := false; endif;
+
+ AstName, AstValue, AstUom, AstDone := read last
+ {"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}AST/SGOT{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ If (ASTValue as number) > 150 or ASTValue = ">150.0" then Hi_AST := true; else Hi_AST := false; endif;
+
+ AltName, AltValue, AltUom, AltDone := read last
+ {"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}ALT/SGPT{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+
+ If (ALTValue as number) > 150 then Hi_ALT := true; else Hi_ALT := false; endif;
+
+
+ PhenytoinName, PhenytoinValue, PhenytoinUom, PhenytoinDone, PhenytoinAbn:= read last
+ {"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= " || SQL(AdmitDtm)
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Dilantin Serum (Phenytoin){{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+
+ If (PhenytoinValue as number) > 20 or PhenytoinAbn = "HH" then Hi_Phenytoin := true; else Hi_Phenytoin := false; endif;
+
+ CarbamazepineName, CarbamazepineValue, CarbamazepineUom, CarbamazepineDone, CarbamazepineAbn := read last
+ {"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= " || SQL(AdmitDtm)
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Carbamazepine Serum (Tegretol){{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+
+ If (CarbamazepineValue as number) > 15 or CarbamazepineAbn = "HH" then Hi_Carbamazepine := true; else Hi_Carbamazepine := false; endif;
+
+ ValproicName, ValproicValue, ValproicUom, ValproicDone, ValproicAbn := read last
+ {"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= " || SQL(AdmitDtm)
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Valproic Acid Plasma (Depakote Plasma){{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+
+ If (ValproicValue as number) > 125 or ValproicValue = ">150.0" then Hi_Valproic := true; else Hi_Valproic := false; endif;
+
+
+ DigName, DigValue, DigUom, DigDone, DigAbn := read last
+ {"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Digoxin Plasma/Serum{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ If (DigValue as number) > 2.2 or DigAbn = "HH" then Hi_Dig := true; else Hi_Dig := false; endif;
+ Digibind_Addendum := "**NOTE** Digibind can falsely elevate serum digoxin levels for several days or even longer in patients with renal dysfunction. "
+ || "If your patient has recently received digibind, digoxin levels cannot be reliably interpreted.";
+
+ CPKName, CPKValue, CPKUom, CPKDone, CPKAbn := read last
+ {"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}CPK Total{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ If CPKAbn = "H" or CPKABn = "HH" then Hi_CPK := true; else Hi_CPK := false; endif;
+
+
+ INRName, INRValue, INRDone, INRAbn := read last
+ {"Select top 1 bo.ItemName, bo.value, o.performeddtm, bo.AbnormalityCode "
+ || " 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(ClientGuid)
+ || " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}INR{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+ If (INRValue as number) >= 3.3 or INRAbn = "HH" then Hi_INR := true; else Hi_INR := false; endif;
+
+
+ If (Hi_ALT = true) or (Hi_AST = true) or (Hi_K = true) or (Mid_K = true) or (Lo_K = true) or (Lo_Na = true) or (Hi_Dig = true)
+ or (Hi_INR = true) or (Hi_CPK = true) or (Hi_Phenytoin = true) or (Hi_Carbamazepine = true) or (Hi_Valproic = true) then
+
+ continue := "Yes";
+
+ else continue := "No";
+ endif;
+
+
+ KSupplement := read last
+ {"Select top 1 o.name "
+ || " From cv3order as o with (nolock) "
+ || " where (o.name like {{{SINGLE-QUOTE}}}%Potassium Chloride%{{{SINGLE-QUOTE}}} "
+ || " or o.name = {{{SINGLE-QUOTE}}}Phosphorous Supplement 1.25gm Packet{{{SINGLE-QUOTE}}} "
+ || " or o.name like {{{SINGLE-QUOTE}}}%Potassium Phosphate%{{{SINGLE-QUOTE}}}) "
+ || " and ClientGUID = " || SQL(ClientGuid)
+ || " and ClientVisitGUID= " || SQL(ClientVisitGuid)
+ || " and OrderStatusLevelNum > 15 "
+ || " and OrderStatusLevelNum not in (69, 70) "
+ };
+ Argatroban := read last
+ {"Select top 1 o.name "
+ || " From cv3order as o with (nolock) "
+ || " where o.name like {{{SINGLE-QUOTE}}}%Argatroban%{{{SINGLE-QUOTE}}} "
+ || " and ClientGUID = " || SQL(ClientGuid)
+ || " and ClientVisitGUID= " || SQL(ClientVisitGuid)
+ || " and OrderStatusLevelNum > 15 "
+ || " and OrderStatusLevelNum not in (69, 70) "
+ };
+
+ (unsubmitted_KCL) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%potassium chloride%"};
+ (unsubmitted_KCL_IV) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "% KCl %"};
+ (unsubmitted_KPhos) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%Phosphorous Supplement 1.25gm Packet%"};
+ (unsubmitted_KPhos_IV) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%Potassium Phosphate%"};
+ (unsubmitted_Argatroban) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%Argatroban %"};
+ KCL_Ordered := count (unsubmitted_KCL) + count (unsubmitted_KCL_IV) + count (unsubmitted_KPhos) + count (unsubmitted_KPhos_IV);
+ Argatroban_Ordered := count (unsubmitted_Argatroban);
+
+ If ((KCL_Ordered as number) > 0 ) or (KSupplement is not null) then
+
+ Pt_on_KCL := "yes";
+ else
+ Pt_on_KCL := "no";
+ endif;
+
+ If ((Argatroban_Ordered as number) > 0 ) or (Argatroban is not null) then
+
+ Pt_On_Argatroban := "yes";
+ else
+ Pt_on_Argatroban := "no";
+ endif;
+ else continue := "No";
+ endif;
+
+ if continue = "yes" then
+
+ alert_message := "";
+ medlist := ();
+ medlist := read { "select value from cv3userdictionaryvalue v with (nolock)"
+ || " where userdictionarycode = {{{SINGLE-QUOTE}}}PRX_DrugLabAlerts{{{SINGLE-QUOTE}}} "
+ || " and active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
+ };
+
+
+
+ NumRules:= count medlist;
+ for k in (1 seqto (NumRules)) do
+ rules := call str_parse with medlist[k],"|";
+
+ RuleClass := rules[1];
+ RuleType := rules[2];
+ RuleTestName := rules[3];
+ RuleParam := rules[4];
+ RuleLabValue := rules[5];
+ RuleLabUom := rules[6];
+ RuleMsg := rules[7];
+
+
+
+
+ If (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "A" and Lo_Na = true then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||NaName ||" on " || NaDone || " is " || NaValue || SP || NaUom
+ || " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ doalert := true;
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "B" and Hi_K = true then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||KName ||" on " || KDone || " is " || KValue || SP || KUom
+ || " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ doalert := true;
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "C" and (Hi_AST = true or Hi_ALT = true) and Stemi_NStemi is null then
+
+ If Hi_AST = true and Hi_ALT = false then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
+ || " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ elseif Hi_AST = false and Hi_ALT = true then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
+ || " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ elseif Hi_AST = true and Hi_ALT = true then
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
+ || " and " || AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
+ || " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+
+
+ else
+ alert_message := " ";
+ endif;
+
+ doalert := true;
+
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "D" and (Hi_AST = true or Hi_ALT = true) then
+
+ If Hi_AST = true and Hi_ALT = false then
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
+ || " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ elseif Hi_AST = false and Hi_ALT = true then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
+ || " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ elseif Hi_AST = true and Hi_ALT = true then
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
+ || " and " || AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
+ || " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ else
+ alert_message := " ";
+ endif;
+
+ doalert := true;
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "E" and Lo_K = true and Pt_on_KCL = "no" then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||KName ||" on " || KDone || " is " || KValue || SP || KUom
+ || " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ doalert := true;
+
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "F" and Hi_CPK = true and Stemi_NStemi is null then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||CPKName ||" on " || CPKDone || " is " || CPKValue || SP || CPKUom
+ || " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ doalert := true;
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "G" and Hi_Dig = true then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||DigName ||" on " || DigDone || " is " || DigValue || SP || DigUom
+ || " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" || CRLF || Digibind_Addendum ;
+
+ doalert := true;
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "H" and Hi_INR = true and Pt_On_Argatroban = "no" then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||INRName ||" on " || INRDone || " is " || INRValue || SP
+ || " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
+ || "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ doalert := true;
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "I" and Hi_Phenytoin = true then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||PhenytoinName ||" on " || PhenytoinDone || " is " || PhenytoinValue || SP || PhenytoinUOM
+ || " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
+ || "\n\n " || PhenytoinName || " " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ doalert := true;
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "J" and Hi_Carbamazepine = true then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||CarbamazepineName ||" on " || CarbamazepineDone || " is " || CarbamazepineValue || SP || CarbamazepineUOM
+ || " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
+ || "\n\n " || CarbamazepineName || " " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ doalert := true;
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "K" and Hi_Valproic = true then
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||ValproicName ||" on " || ValproicDone || " is " || ValproicValue || SP || ValproicUOM
+ || " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
+ || "\n\n " || ValproicName || " " || Rulemsg || "{{-R}} {{-B}}" ;
+
+ doalert := true;
+
+ elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "L" and Mid_K = true then
+ If classvalue = "Trimethoprim" or classvalue = "Sulfamethoxazole/trimethoprim" then AddtoMsg := "Consider alternative antibiotic therapy OR use with caution and monitor potassium levels closely "
+ || "ESPECIALLY if the patient is also ordered other medications that increase potassium levels such as an ACEI, ARB, spironolactone, or potassium supplements.";
+ else AddtoMsg := " ";
+ endif;
+
+ alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||KName ||" on " || KDone || " is " || KValue || SP || KUom
+ || " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
+ || "\n\n " || Rulemsg ||" "||AddtoMsg|| "{{-R}} {{-B}}" ;
+
+ doalert := true;
+
+
+
+
+ else
+
+ nomessage := "";
+ endif;
+
+
+ enddo;
+
+
+
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: order_enter_event;
+
+ ;;
+ logic:
+
+ if called_by_editor
+ then
+ conclude false;
+ endif;
+
+ //----------------------------------------------------------------
+ // If there is no evoking object then do nothing, this can
+ // only be true for the MLM Editor
+ //----------------------------------------------------------------
+ if EvokingObject is null
+ then
+ conclude false;
+ endif;
+ if continue = "no"
+ then
+ conclude false;
+ endif;
+
+
+ conclude doalert;
+
+ ;;
+ action:
+
+ write alert_message at dose_alert_dest
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_DUP_CODE_STATUS_STOP.mlm b/MLMStripper/bin/Debug/SCH/SCH_DUP_CODE_STATUS_STOP.mlm
new file mode 100644
index 0000000..5d17014
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_DUP_CODE_STATUS_STOP.mlm
@@ -0,0 +1,221 @@
+maintenance:
+
+ title: Duplicate Code Status Hard Stop;;
+ mlmname: SCH_dup_code_status_stop;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Hospital;;
+ author: Deborah Eiler, Debbie.Eiler@stclair.org, 866-248-4500 ext. 1318, Robert Spence Ext 1034;;
+ specialist: Eclipsys Corporation;;
+ date: 2006-12-07;;
+ validation: testing;;
+
+library:
+ purpose:
+ If the patient has an existing code status I would like for an MLM to fire an
+ alert to stop the order entry. If the comment type of an existing Code Status
+ is active, fire an alert to Stop the order.
+ ;;
+ explanation:
+
+ IMPORTANT NOTE: Each time this MLM is updated, FORM_PREVENT_DUP_CODE_STATUS may also need to be updated
+
+ Change history
+
+ 11.09.2012 DJW CSR# 26830 - Simplification of Code Status classifications. Reduced from 7 to 3 choices
+ 07.30.2012 - DJW CSR# 30963 - Altered logic to prevent duplicate status order even if in Discharge Session
+ 10.05.2012 - DJW CSR# 30963 - Revert to prior logic - allow duplicate status order even if in Discharge Session
+ 12.18.2012 - DJW CSR# 31242 - Change "...Full Treatment" to "...Full Code". Remove CPR/DNR codes
+ 01.24.2013 - DJW CSR# 31242 - Altered code again {{{SINGLE-QUOTE}}}Code Status: DNR/Limited Interventions{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Code Status: DNR/Comfort Measures Only (CMO){{{SINGLE-QUOTE}}}
+ 02.09.2016 - DJW CSR# 33949 - Change to wording of Code Status and CPR orders
+ 09.27.2017 - JML CSR# 26413 - Modified evoking event to not fire on "Code Status: Ethically unable to determine" order
+
+ (D Eiler, 10-2-06): Code Status order is currently configured to display in the
+ Patient Header as a comment. I have added duplicate checking alerts. If the user
+ keeps the new order and discontinues the current order from the duplicate check
+ alert, the new order will overlay what is displayed in the Patient Header. This
+ is what we want to happen. But… if the user ignores the duplicate checking alert
+ and proceeds with the order entry, the new code status will overlay in the Patient
+ Header but there will be two code status orders on the order tab. If the user
+ discontinues one of these code status orders the code status in the Patient
+ Header is removed. This is a problem. We must be able to rely on the display of
+ the code status in the Patient Header. I have a warning message at the onset of
+ code status order entry but it does not stop the process.
+
+ THIS MLM:
+ - TRIGGERS ON CODE STATUS ORDER INITIALIZATION
+ - LOOKS UP ANY ACTIVE EXISTING or UNSUBMITTED CODE STATUS ORDERS
+ - IF EXISTING ORDER THEN PRESENTS THEM TO THE USER FOR DC{{{SINGLE-QUOTE}}}ING.
+ - IF UNSUBMITTED ORDERS THEN PRESENTS A HARD STOP
+
+ IT DOES NOT CREATE A "HARD STOP". THAT IS DONE BY ANOTHER MLM ATTACHED TO THE
+ FORM: FORM_RS_prevent_dup_code_status.MLM.
+
+
+
+ ;;
+ keywords: action on alerts, duplicate code status;
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /******************Make Changes To Spelling And Flags In This Section******************/
+
+ //Triggering event: duplicate order
+
+ // 11/30/2011 - Don Warnick - ok to have duplicate for discharge order reconcilliation
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+ if worksheetinfo.sessiontype = "Discharge" then sessiontype := "Discharge"; else sessiontype := "Other"; endif;
+/*
+ code_status_order := event{orderInit user order:
+ where typecode = "other"
+ and name in ("Code Status: DNR/Limited Interventions" , "Code Status: DNR/Comfort Measures Only (CMO)", "Code Status: Full Treatment" , "Code Status: Full Code",
+ "Code Status: Limited Interventions", "Code Status: Comfort Measures Only (CMO)")};
+
+ code_status_order_enter := event{orderEnter user order:
+ where typecode = "other"
+ and name in ("Code Status: DNR/Limited Interventions" , "Code Status: DNR/Comfort Measures Only (CMO)", "Code Status: Full Treatment" , "Code Status: Full Code",
+ "Code Status: Limited Interventions", "Code Status: Comfort Measures Only (CMO)")
+ };
+*/
+ code_status_order := event{orderInit user order: where typecode = "other" and ( ( Name matches pattern "Code Status: %" or Name matches pattern "CPR%" or Name matches pattern "DNR%" ) AND Name <> "Code Status: Ethically unable to determine" ) };
+ code_status_order_enter := event{orderEnter user order: where typecode = "other" and ( ( Name matches pattern "Code Status: %" or Name matches pattern "CPR%" or Name matches pattern "DNR%" ) AND Name <> "Code Status: Ethically unable to determine" ) };
+
+
+ //Popup destination with ACTIONS ON ALERTS:
+ dup_existing_alert := destination{alert: reminder, "Duplicate Active Code Status!", high, chart, "Code Status Rule Group", 1};
+
+ //Popup destination with HARD STOP:
+ dup_unsubmitted_alert := destination{alert: reminder, "Duplicate Active Code Status!", high, chart, "Code Status Rule Group", 1, "", "No Override Allowed"};
+
+ //Message to display to the user:
+ dup_existing_msg := "{{+B}}{{+R}}Sorry, but you cannot proceed while there is an existing active code status order.{{-R}}{{-B}}{{+C}}\n\n"
+ || "Please click the {{+B}}{{+U}}View Actions...{{-U}}{{-B}} button below, then dc the earlier Code Status order(s) or cancel this order, altogether." ;
+
+ dup_unsubmitted_msg := "{{+B}}{{+R}}Sorry, but only one patient code status order is permitted.{{-R}}{{-B}}{{+C}}\n\n"
+ || "You have already added a code staus order in this Order Entry Session. Please remove the Code Status order you already entered or do not add this order." ;
+
+
+ /***************************************************************************JAB********/
+
+ // Declare the MLM that can be called by this MLM
+ create_aa_object := MLM {{{SINGLE-QUOTE}}}STD_Func_Create_Alert_Action_Object{{{SINGLE-QUOTE}}};
+
+ if called_by_editor then
+ evokingobject := read last {order:this where typecode = "other" and name = "code status:"};
+ endif;
+
+ // Get the Client GUID and Evoking Object parameters:
+ (client_guid, chart_guid, visit_guid, evoking_order_name, evoking_order_guid, evoking_order_catalog_master_item_guid, evoking_significant_dtm )
+ := read last { Order: clientguid, chartguid, clientvisitguid, Name, GUID, OrderCatalogMasterItemGUID, SignificantDtm REFERENCING EvokingObject };
+
+
+ ordername_substring := SUBSTRING 12 CHARACTERS STARTING AT 1 FROM evoking_order_name;
+
+/*
+ // find unsubmitted code status orders rom this Order Entry Session
+ (unsub_name_list, unsub_guid_list, unsub_ocmi_guid_list ) := READ
+ {UnsubmittedOrders: Name, GUID, OrderCatalogMasterItemGUID WHERE TypeCode = "Other" AND (ClientGUID = client_guid)
+ and name in ("Code Status: DNR/Limited Interventions" , "Code Status: DNR/Comfort Measures Only (CMO)", "Code Status: Full Treatment" , "Code Status: Full Code",
+ "Code Status: Limited Interventions", "Code Status: Comfort Measures Only (CMO)"
+ )};
+*/
+
+
+ if ordername_substring = "Code Status:"
+
+ then
+
+ dup_lookup_items := " name like {{{SINGLE-QUOTE}}}Code Status: %{{{SINGLE-QUOTE}}} ";
+
+ // find unsubmitted code status orders rom this Order Entry Session
+ (unsub_name_list, unsub_guid_list, unsub_ocmi_guid_list ) := READ
+ {UnsubmittedOrders: Name, GUID, OrderCatalogMasterItemGUID WHERE TypeCode = "Other" AND (ClientGUID = client_guid) and name matches pattern "Code Status: %" };
+
+ else
+
+ dup_lookup_items := " ( name in ({{{SINGLE-QUOTE}}}Code Status: Full Code{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: DNR/Limited Interventions{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: DNR/Comfort Measures Only (CMO){{{SINGLE-QUOTE}}}) or name like {{{SINGLE-QUOTE}}}cpr%{{{SINGLE-QUOTE}}} or name like {{{SINGLE-QUOTE}}}dnr%{{{SINGLE-QUOTE}}} )";
+
+ // find unsubmitted code status orders rom this Order Entry Session
+ (unsub_name_list, unsub_guid_list, unsub_ocmi_guid_list ) := READ
+ {UnsubmittedOrders: Name, GUID, OrderCatalogMasterItemGUID WHERE TypeCode = "Other" AND (ClientGUID = client_guid) and (name matches pattern "CPR%" or name matches pattern "DNR%") };
+
+ endif;
+
+ // if found unsubmitted orders
+ if exist unsub_name_list then
+ found_unsubmitted_orders := true;
+ // if no unsubmitted orders then lets check database for existing orders
+ else
+ // check for existing active code status orders for the patient for this visit
+ (old_cs_lst, old_cs_ord_guid_lst, old_cs_ocmi_guid_lst ) := read
+ {" select name, GUID, OrderCatalogMasterItemGUID"
+ ||" from cv3order "
+ ||" where clientguid = " || sql(client_guid)
+ ||" and chartguid = " || sql(chart_guid)
+ ||" and clientvisitguid = " || sql(visit_guid)
+ ||" and ( name <> {{{SINGLE-QUOTE}}}Code Status: Ethically unable to determine{{{SINGLE-QUOTE}}} AND " || dup_lookup_items || ")"
+ ||" and typecode like {{{SINGLE-QUOTE}}}other{{{SINGLE-QUOTE}}} and status like {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and orderstatuslevelnum <= 50 and active = 1 "
+ , primarytime = significandtm};
+
+ // Create actionable object list and populate with old code status orders:
+ if exist old_cs_lst then
+ found_existing_orders := true;
+ aa_lst := ();
+
+ for i in 1 seqto count old_cs_lst do
+
+ //Create an AlertAction Object
+ alert_action := call create_aa_object with "CV3Order", "CV3Order";
+
+ // Set values for AlertAction Object
+ alert_action.EvokingEnterpriseItemID := evoking_order_catalog_master_item_guid;
+ alert_action.EvokingObjectID := evoking_order_guid;
+ alert_action.EvokingObjectName := evoking_order_name;
+ alert_action.ActionItemStatus := "Existing";
+ alert_action.ActionEvent := "DC-Cancel";
+ alert_action.ActionItemID := old_cs_ord_guid_lst[i];
+ alert_action.ActionItemName := old_cs_lst[i];
+ alert_action.ActionEnterpriseItemID := old_cs_ocmi_guid_lst[i] ;
+ alert_action.MLMName := "SCH_dup_code_status_stop";
+ alert_action.ShortMessage := "This is the EXISTING Code status Order to DC-Cancel";
+
+ aa_lst := aa_lst, alert_action;
+
+ enddo; //i in 1 seqto count old_cs_lst
+
+ endif; // exist old_cs_lst
+
+ endif; // if found unsubmitted
+
+
+ ;;
+ evoke:
+ code_status_order or code_status_order_enter ;
+ ;;
+ logic:
+
+// 11/30/2011 - Don Warnick - ok to have duplicate for discharge order reconcilliation
+// 07/30/2012 - Don Warnick - reversed the logic......now not ok to have a duplicate
+// 10/05/2012 - Don Warnick - reversed the reversal...now ok to have a duplicate in discharge session
+
+
+ // if found_existing_orders or found_unsubmitted_orders then
+ if (found_existing_orders or found_unsubmitted_orders) and sessiontype <> "Discharge" then
+
+ conclude true;
+ endif;
+ ;;
+ action:
+ if found_existing_orders then
+ write dup_existing_msg at dup_existing_alert;
+ attach aa_lst to dup_existing_alert;
+ elseif found_unsubmitted_orders then
+ write dup_unsubmitted_msg at dup_unsubmitted_alert;
+ endif;
+ ;;
+Urgency: 99;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ED_TAMIFLU_AUTO_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_ED_TAMIFLU_AUTO_ORDER.mlm
new file mode 100644
index 0000000..9c5f13c
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ED_TAMIFLU_AUTO_ORDER.mlm
@@ -0,0 +1,543 @@
+maintenance:
+
+ title: SCH_ED_TAMIFLU_AUTO_ORDER ;;
+ mlmname: SCH_ED_TAMIFLU_AUTO_ORDER;;
+ arden: version 2.5;;
+ version: 0.00;;
+ institution: St. Clair Hospital ;;
+ author: Sandy Zhang ;;
+ specialist: Amy Georgulis ;;
+ date: 2018-09-18;;
+ validation: testing;;
+
+library:
+ purpose: Patients who came through the ED with Flu would receive a STAT/Now/Once dose of Tamiflu and remaining doses would be neglected due to disconnect in transition of care.
+ This MLM will auto-order Tamiflu for a patient based on our algorithm below.
+
+ ;;
+ explanation:
+
+ Change History:
+ 09-18-2018 SZ CSR #36408 - Tamiflu transition orders
+
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ CrCl_info:= mlm {{{SINGLE-QUOTE}}}SCH_Func_Creatinine_Clearance{{{SINGLE-QUOTE}}};
+ log_execution_info := false;
+
+ // declare MLM that will generate order into worksheet
+ SCH_FUNC_CREATE_MED_ORDER_WORKSHEET := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_MED_ORDER_WORKSHEET{{{SINGLE-QUOTE}}};
+
+ // Can be evoked by any {{{SINGLE-QUOTE}}}transition orders{{{SINGLE-QUOTE}}} order sets, but not the hospitalist one
+ order_set_enter_event := event {OrderSetEnter User OrderSet : where OrderSetName matches pattern "%transition orders%"
+ and OrderSetName <> "Transition Orders- Hospitalist"
+ };
+
+ // get guids
+ userguid := read last {UserInfo: guid};
+ (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus, AdmitDtm) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus, AdmitDtm };
+ create_order := False;
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #1 - STAT/Now/Once order for Tamiflu
+ ////////////////////////////////////////////////////////////////////////////
+ /*********************************************************************************************************************************/
+ // checks for active oseltamivir (Tamiflu) STAT order during this visit
+ // If exist, then that means patient was given a treatment dose of Tamiflu for strong evidence of flu
+ (STAT_Order, STAT_Order_freq) := read last {
+ " select o.name, o.FrequencyCode"
+ || " from cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
+ || " and (o.name like {{{SINGLE-QUOTE}}}%oseltamivir%{{{SINGLE-QUOTE}}}) "
+ || " and (o.FrequencyCode = {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}}"
+ || " or o.FrequencyCode = {{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}}"
+ || " or o.FrequencyCode = {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}})"
+ || " and o.OrderStatusLevelNum >= 15 "
+ || " and o.SignificantDtm > getdate()-2"
+ // || " and o.OrderStatusLevelNum not in (69, 70) " // STAT order of Tamiflu does not need to be active, b/c it may be d/ced after it{{{SINGLE-QUOTE}}}s taken?
+ };
+
+ if (exist STAT_Order) then
+ create_order := True;
+ Check_active_STAT_order := "active STAT/Now/Once order for Tamiflu was detected, patient might need inpatient Tamiflu orders";
+ endif;
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #2 - If patient is < 18 years old, give alert to have user create the order
+ ////////////////////////////////////////////////////////////////////////////
+ /*********************************************************************************************************************************/
+ /* Get the patient{{{SINGLE-QUOTE}}}s age */
+ (client_birthdatetime):= read last { ClientInfo: Birthdatetime};
+
+ client_age_in_seconds:= Now - client_birthdatetime;
+ client_age:= truncate( client_age_in_seconds / (1 year) );
+
+ if (client_age < 18) and (create_order = true) then
+
+ // By this point we have decided an order needs to be created, give user the dialogue message to decide if they want the order
+ Messagetext := "This patient received a dose of oseltamivir (Tamiflu) while in the ED. Please order ongoing oseltamivir for this patient to prevent an interruption of antiviral therapy." ||
+ "\n\nPatient is " || client_age || " year(s) old, please manually place oseltamivir (Tamiflu) order based off weight and age."
+ ;
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with Messagetext ,"Oseltamivir (Tamiflu) Auto-order","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ create_order := False;
+
+ endif; //if (client_age < 18) and (create_order = true) and then
+
+ // if a stat order of Tamiflu exists, then continue
+ if (create_order = true) then
+ ////////////////////////////////////////////////////////////////////////////
+ // Filter #3 - Active nonSTAT order for Tamiflu
+ ////////////////////////////////////////////////////////////////////////////
+ /*********************************************************************************************************************************/
+ // Check for active non-stat order (anything with frequency that{{{SINGLE-QUOTE}}}s not STAT, Now, or Once) within past 2 days.
+ (Active_nonSTAT_Order, Active_nonSTAT_Order_freq) := read last {
+ " select o.name, o.FrequencyCode"
+ || " from cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
+ || " and (o.name like {{{SINGLE-QUOTE}}}%oseltamivir%{{{SINGLE-QUOTE}}}) "
+ || " and (o.FrequencyCode <> {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}})"
+ || " and (o.FrequencyCode <> {{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}})"
+ || " and (o.FrequencyCode <> {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}})"
+ || " and o.OrderStatusLevelNum >= 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ || " and o.SignificantDtm > getdate()-2"
+ };
+
+ if (exist Active_nonSTAT_Order) then
+ create_order := False;
+ Check_active_nonSTAT_order := "active STAT order for Tamiflu was detected, patient will need inpatient Tamiflu orders";
+ endif;
+
+ /*********************************************************************************************************************************/
+ ////////////////////////////////////////////////////////////////////////////
+ // order creation
+ ////////////////////////////////////////////////////////////////////////////
+ /*********************************************************************************************************************************/
+ if (create_order = true) then
+
+ // If the user selects another careprovider (Nurse or US entry), pass the requestors user ID
+ if userguid <> EVOKINGOBJECT.CareProviderGUID then
+ userguid := EVOKINGOBJECT.CareProviderGUID;
+ endif;
+
+ /***********************************************************/
+ // Version 1 from SCH_DrugLevelMonitoring
+ Creatinine, CreateDTM := read last
+ {"Select top 1 bo.value, o.performeddtm "
+ || " 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(clientguid)
+ || " and o.performeddtm >= " || SQL(AdmitDtm)
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Creatinine Plasma/Serum{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+
+ creatinine_number := Creatinine as number;
+
+ if Creatinine is not Null then
+ (CrCl_Message, Crcl_Value, SCRfromMLM, wt, patientage) := call CrCl_info with (ClientVisitGuid, ChartGuid, ClientGuid, creatinine_number);
+ // get doses of meds based off this CrCl dose
+ endif;
+
+ if (Crcl_Value > 60) or (Crcl_Value is null) then
+
+ // declare Tamiflu order details/variable
+ OrderName := "Oseltamivir 75mg Cap";
+ ItemModifier := "- CrCl > 60, Q12H, x 9 doses";
+ ItemVersion := "";
+ creation_reason := "from Tamiflu Protocol";
+ OrderFrequency := "Q12H";
+ special_instructions_value_Mod := "";
+
+ new_order_desc := "75mg Q12H x 9 doses";
+
+ // Default dosing is Q12H
+ DosesPerDay := 2;
+ FrequencyInterval := 12;
+ FrequencyTimeUOM := "hr(s)";
+
+ endif; // if (Crcl_Value > 60) or (Crcl_Value is null) then
+
+ if (Crcl_Value >= 30) and (Crcl_Value <= 60) then
+
+ // declare Tamiflu order details/variable
+ OrderName := "Oseltamivir 30mg Cap";
+ ItemModifier := "- CrCl 30-60, Q12H, x 9 doses";
+ ItemVersion := "";
+ creation_reason := "from Tamiflu Protocol";
+ OrderFrequency := "Q12H";
+ special_instructions_value_Mod := "";
+
+ new_order_desc := "30mg Q12H x 9 doses";
+
+ // Q12H frequency
+ DosesPerDay := 2;
+ FrequencyInterval := 12;
+ FrequencyTimeUOM := "hr(s)";
+
+ endif; // if (Crcl_Value >= 30) or (Crcl_Value <= 60) then
+
+
+ if (Crcl_Value >= 10) and (Crcl_Value <= 29.9) then
+
+ // declare Tamiflu order details/variable
+ OrderName := "Oseltamivir 30mg Cap";
+ ItemModifier := "- CrCl 10-29.9, Q24H, x 4 doses";
+ ItemVersion := "";
+ creation_reason := "from Tamiflu Protocol";
+ OrderFrequency := "Q24H";
+ special_instructions_value_Mod := "";
+
+ new_order_desc := "30mg Q24H x 4 doses";
+
+ // Q24H frequency
+ DosesPerDay := 1;
+ FrequencyInterval := 24;
+ FrequencyTimeUOM := "hr(s)";
+
+ endif; // if (Crcl_Value >= 10) or (Crcl_Value <= 29.9) then
+
+ if (Crcl_Value < 10) then
+
+ // declare Tamiflu order details/variable
+ OrderName := "Oseltamivir 30mg Cap";
+ ItemModifier := "- CrCl < 10, Q48H, x 2 doses";
+ ItemVersion := "";
+ creation_reason := "from Tamiflu Protocol";
+ OrderFrequency := "Q48H";
+ special_instructions_value_Mod := "";
+
+ new_order_desc := "30mg Q48H x 2 doses";
+
+ // Q48H frequency
+ DosesPerDay := 1;
+ FrequencyInterval := 48;
+ FrequencyTimeUOM := "hr(s)";
+
+ endif; // if (Crcl_Value < 10) then
+
+
+ // gather guids for creating order
+ //Active_ClientVisitGUID := this_communication.ClientVisitGUID;
+ Active_OrderGUID:= PrimaryObjdetail.GUID;
+ location_guid := read last {"select CurrentLocationGUID from CV3ClientVisit where GUID=" || SQL(ClientVisitGuid)};
+
+
+ // By this point we have decided an order needs to be created, give user the dialogue message to decide if they want the order
+ Messagetext := "This patient received a dose of oseltamivir (Tamiflu) while in the ED. Please order ongoing oseltamivir for this patient to prevent an interruption of antiviral therapy." ||
+ " Recommended oseltamivir dose for this patient based on renal function is " || new_order_desc ||
+ "\n\nDo you want to order oseltamivir " || new_order_desc || " ?" ||
+ "\n\nSelecting {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} will add it to the order worksheet."
+ ;
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with Messagetext ,"Oseltamivir (Tamiflu) Auto-order","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if((dialogResult as string) = "Yes") then
+
+
+ /*****************************************************************************************************/
+ /*****************************************************************************************************/
+ // Imported from FORM_Antibiotic_Scheduling
+ // Purpose: to auto-schedule tamiflu dose the same way other abx are being auto-scheduled
+ // example: if 14:46, then schedule for 16:00 start time
+ /*****************************************************************************************************/
+ /*****************************************************************************************************/
+
+ // GATHER INFORMATION ABOUT MOST RECENTLY ADMINISTERED ORDER (past 2 days) OF Tamiflu
+ (ExistingOrderLastGiven, ExistingOrderFrequency, ExistingOrderHoursSinceGiven,
+ ExistingOrderName, ExistingOrderTherapeuticCategory, ExistingOrderDrugKey,
+ ExistingRoute, ExistingNextTaskPending, ExistingNextTaskCanceled) := read last
+ {
+ " select oto.performedfromdtm, o.FrequencyCode, datediff (HH, oto.performedfromdtm, getdate()), "
+ || " o.name, ocmi.TherapeuticCategory, dm.DrugKey, ot.OrderRoute "
+ || " ,(select top 1 oto2.SignificantDtm from cv3ordertaskoccurrence oto2 with (nolock) "
+ || " where oto2.clientguid = ot.clientguid and oto2.orderguid = o.guid and oto2.ordertaskguid = ot.guid "
+ || " and oto2.SignificantDtm > getdate()-2 and oto2.taskstatuscode = {{{SINGLE-QUOTE}}}Pending{{{SINGLE-QUOTE}}}) "
+ || " ,(select top 1 oto2.SignificantDtm from cv3ordertaskoccurrence oto2 with (nolock) "
+ || " where oto2.clientguid = ot.clientguid and oto2.orderguid = o.guid and oto2.ordertaskguid = ot.guid "
+ || " and oto2.SignificantDtm > getdate()-2 and oto2.taskstatuscode = {{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}}) "
+ || " from cv3ordercatalogmasteritem ocmi with (nolock) "
+ || " join cv3drugmapping dm with (nolock) on dm.catalogitemguid = ocmi.guid "
+ || " join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " and o.ClientGUID = " || ClientGuid || " "
+ || " and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}anti-infectives | antiviral agents{{{SINGLE-QUOTE}}}"
+ || " and o.Name like {{{SINGLE-QUOTE}}}%oseltamivir%{{{SINGLE-QUOTE}}}"
+ || " 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 oto.SignificantDtm > getdate()-2 and oto.taskstatuscode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
+ || " order by oto.performedfromdtm "
+ };
+
+ CurrentMinute:= extract minute NOW;
+ CurrentHour := extract hour NOW;
+ NextHour := extract hour NOW + 1;
+ HourAfterNext:= extract hour NOW + 2;
+ CalculatedHour := NextHour;
+
+ yesterday := extract day NOW - 1;
+ today := extract day NOW;
+ tomorrow := extract day NOW + 1;
+ dayafter := extract day NOW + 2;
+
+ LastGivenMin := extract minute ExistingOrderLastGiven;
+ LastGivenHour := extract hour ExistingOrderLastGiven;
+ LastGivenDay := extract day ExistingOrderLastGiven;
+
+ TargetHour := extract hour ExistingOrderLastGiven + FrequencyInterval;
+
+ TargetDate := ExistingOrderLastGiven;
+
+
+ // SCHEDULED TIME ADJUSTMENTS - for variable start time frequencies
+ If TargetHour is not null and FrequencyTimeUOM = "hr(s)" then
+
+ If (LastGivenMin >= 45) then
+ TargetHour := TargetHour + 1;
+ endif;
+
+ // Adjust for Calculated Dose Hour greater than 24 (next dose falls after midnight today)
+ If TargetHour < 24 then
+ TargetHour := TargetHour;
+ ElseIf TargetHour >= 24 and TargetHour < 48 then
+ TargetHour := TargetHour - 24;
+ TargetDate := TargetDate + 1 day;
+ ElseIf TargetHour >= 48 then
+ TargetHour := TargetHour - 48;
+ TargetDate := TargetDate + 2 day;
+ endif;
+
+
+ // Adjust for Calculated Dose Time that is in the past...begin now (existing med has missed recent doses)
+ TimeNow := (extract year NOW) FORMATTED WITH "%2.2d" || (extract month NOW) FORMATTED WITH "%2.2d" ||
+ (extract day NOW) FORMATTED WITH "%2.2d" || (extract hour NOW) FORMATTED WITH "%2.2d" ||
+ (extract minute NOW) FORMATTED WITH "%2.2d";
+
+ TimeScheduled:= (extract year TargetDate) FORMATTED WITH "%2.2d" || (extract month TargetDate) FORMATTED WITH "%2.2d" ||
+ (extract day TargetDate) FORMATTED WITH "%2.2d" || TargetHour FORMATTED WITH "%2.2d" || "00";
+
+
+ // This means we are already past the time for which the dose should have been scheduled
+ // Set the dose to be scheduled ASAP to the nearest hour
+ if (TimeScheduled <= TimeNow) then
+
+ CalculatedHour := NextHour;
+ TargetDate := NOW;
+
+ if (CurrentMinute >= 45) then
+ CalculatedHour := CalculatedHour + 1;
+ endif;
+
+
+ If (CalculatedHour >= 24) then
+ CalculatedHour := CalculatedHour - 24;
+ TargetDate := TargetDate + 1 day;
+ endif;
+
+ checkpoint := "TimeScheduled <= TimeNow (This means we are already past the time for which the dose should have been scheduled, so schedule for next hour)";
+
+ // adjust hours if calculatedhour lands within the bedtime window of 0:00-05:59 or
+ If (CalculatedHour >= 0 and CalculatedHour <= 5) then
+ CalculatedHour := 06;
+ ElseIf (CalculatedHour >= 12 and CalculatedHour <= 17 and FrequencyInterval = 12) then
+ CalculatedHour := 18;
+ endif;
+
+
+ else // If TimeScheduled > TimeNow is true then (dose should be scheduled in future)
+ CalculatedHour := TargetHour;
+ TargetDate := TargetDate;
+ checkpoint := "TimeScheduled > TimeNow (dose should be scheduled in future)";
+
+ if (FrequencyInterval = 12) then
+
+ // adjust hours if calculatedhour lands within the bedtime window of 0:00-05:59 or 12:00-17:59 (b/c Q12H would cause subsequent doses to be in the bedtime window, ex. 14:30 -> 02:30)
+ If (TargetHour >= 0 and TargetHour <= 2) then
+ if (CurrentHour < 23) then
+ CalculatedHour := 23;
+ TargetDate := TargetDate - 1 day;
+ else
+ CalculatedHour := 06;
+ endif;
+ path := "A";
+ ElseIf (TargetHour >= 3 and TargetHour <= 5) then
+ CalculatedHour := 06;
+ path := "B";
+ ElseIf (TargetHour >= 12 and TargetHour <= 14) then
+ if (CurrentHour < 11) then
+ CalculatedHour := 11;
+ else
+ CalculatedHour := 18;
+ endif;
+ path := "C";
+ ElseIf (TargetHour >= 15 and TargetHour <= 17) then
+ CalculatedHour := 18;
+ path := "D";
+ endif; // If (TargetHour >= 0 and TargetHour <= 2) then
+
+ ElseIf (FrequencyInterval = 24 or FrequencyInterval = 48) then
+
+ // adjust hours if calculatedhour lands within the bedtime window of 0:00-05:59
+ If (TargetHour >= 0 and TargetHour <= 2) then
+ if (CurrentHour < 23) then
+ CalculatedHour := 23;
+ TargetDate := TargetDate - 1 day;
+ else
+ CalculatedHour := 06;
+ endif;
+ path := "A";
+ ElseIf (TargetHour >= 3 and TargetHour <= 5) then
+ CalculatedHour := 06;
+ path := "B";
+ endif; // If (TargetHour >= 0 and TargetHour <= 2) then
+
+ endif; // if (FrequencyInterval = 12) then
+
+ endif; //if (TimeScheduled <= TimeNow) then
+
+
+ // Format the date and time as required for worksheet order creation
+ CalculatedTime := CalculatedHour || ":00";
+ RequestedTime := CalculatedTime;
+
+ TargetDAY := extract day TargetDate;
+
+ // translate day to the right term for worksheet order creation
+ if (TargetDAY = today) then
+ RequestedDate := "T";
+ endif;
+
+ if (TargetDAY = tomorrow) then
+ RequestedDate := "T+1";
+ endif;
+
+ if (TargetDAY = dayafter) then
+ RequestedDate := "T+2";
+ endif;
+
+
+ // call MLM that to generate worksheet order
+ Create_Worksheet_Order := call SCH_FUNC_CREATE_MED_ORDER_WORKSHEET with
+ OrderName,
+ ItemModifier,
+ ItemVersion,
+ creation_reason,
+ OrderFrequency,
+ Active_OrderGUID,
+ ClientVisitGuid,
+ location_guid,
+ UserGuid,
+ special_instructions_value_Mod,
+ RequestedDate,
+ RequestedTime
+ ;
+ /*********************************************************/
+
+ else // If TargetHour is not null and FrequencyTimeUOM = "hr(s)" then
+ // This means TargetHour is null because our query did not find a lastgiven dose (Tamiflu stat order is on file for pt, but not charted as given)
+ // Action: default new order to next hour, make sure it{{{SINGLE-QUOTE}}}s not in bedtime dose range and adjust start time if needed
+
+ CalculatedHour := NextHour;
+ TargetDate := NOW;
+
+ if (CurrentMinute >= 45) then
+ CalculatedHour := CalculatedHour + 1;
+ endif;
+
+
+ If (CalculatedHour >= 24) then
+ CalculatedHour := CalculatedHour - 24;
+ TargetDate := TargetDate + 1 day;
+ endif;
+
+ // adjust hours if calculatedhour lands within the bedtime window of 0:00-05:59 or
+ If (CalculatedHour >= 0 and CalculatedHour <= 5) then
+ CalculatedHour := 06;
+ ElseIf (CalculatedHour >= 12 and CalculatedHour <= 17 and FrequencyInterval = 12) then
+ CalculatedHour := 18;
+ endif;
+
+
+ // Format the date and time as required for worksheet order creation
+ CalculatedTime := CalculatedHour || ":00";
+ RequestedTime := CalculatedTime;
+
+ TargetDAY := extract day TargetDate;
+
+ // translate day to the right term for worksheet order creation
+ if (TargetDAY = today) then
+ RequestedDate := "T";
+ endif;
+
+ if (TargetDAY = tomorrow) then
+ RequestedDate := "T+1";
+ endif;
+
+ if (TargetDAY = dayafter) then
+ RequestedDate := "T+2";
+ endif;
+
+
+ // call MLM that to generate worksheet order
+ Create_Worksheet_Order := call SCH_FUNC_CREATE_MED_ORDER_WORKSHEET with
+ OrderName,
+ ItemModifier,
+ ItemVersion,
+ creation_reason,
+ OrderFrequency,
+ Active_OrderGUID,
+ ClientVisitGuid,
+ location_guid,
+ UserGuid,
+ special_instructions_value_Mod,
+ RequestedDate,
+ RequestedTime
+ ;
+ /*********************************************************/
+
+ endif; // If TargetHour is not null and FrequencyTimeUOM = "hr(s)" then
+
+ endif; //if((dialogResult as string) = "Yes") then
+
+ endif; //if (create_order = true) then
+
+ endif; //if (create_order = true) then
+
+ ;;
+ priority: 50
+ ;;
+ evoke: order_set_enter_event;
+ ;;
+ logic: conclude true;
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CCDA_CREATE_AND_TRANSPORT.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CCDA_CREATE_AND_TRANSPORT.mlm
new file mode 100644
index 0000000..fb2d82b
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CCDA_CREATE_AND_TRANSPORT.mlm
@@ -0,0 +1,276 @@
+maintenance:
+
+ title: Test the creation of a CCD_for DirectID CCDA generation;;
+ mlmname: SCH_FUNC_CCDA_CREATE_AND_TRANSPORT;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: Allscripts, Standard MLM;;
+ author: Allscripts Healthcare Solutions, Inc.;;
+ specialist: ;;
+ date: 2014-06-11;;
+ validation: testing;;
+
+library:
+ purpose:
+ This called MLM creates and transports a CCD to an HIE or a File
+ ;;
+ explanation:
+ This MLM can create and then transport a CCD based on the supplied configuartion.
+
+ Change history
+
+ 06.11.2014 DW CSR# 31688 - MU2 The MLM was copied from SMP_Create_And_Tranport_CCDA_Autoprint
+ 08.25.2014 DW CSR# 31688 - Added Concordia as a recipient
+ 09.24.2014 DW CSR# 31688 - Added Family Home Health as a recipient
+ 08.14.2015 DW CSR# 33555 - SCM 15.1 Upgrade - Found that Test SCM was pointing to the Production Affinity domain which prevented transmission (boomerang back to our queue)
+ 08.18.2015 DW CSR# 26006 - Transport CCDA to CCHIE via XDS protocol
+ 12.18.2015 DW CSR# 26006 - Changed destination of CCHIE database from Stage to Prod
+ 04.19.2018 DW CSR# 36577 - Concordia Visiting Nurses office in South Hills - request for change in direct messaging destination (temporary changed MLM to also send to prior address)
+ 05.24.2018 DW CSR# 36577 - Concordia Visiting Nurses office in South Hills - request for change in direct messaging destination (removed temporary change to also send to prior address)
+ 09.20.2019 DW CSR# 35638 - MU3 - Transmit to physician direct address (redisign....pass direct address to create and transport MLM instead of discharge location)
+
+ ;;
+ keywords: CCD; HIE;
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ if called_by_editor then EvokingObject := read last { Order: This }; endif;
+ log_execution_info := false;
+
+
+ (ClientGuid,ChartGuid,VisitGuid,CCDAReport,Transport,SCMEnvironment,DirectAddress,TransportType) := ARGUMENT;
+
+ GENERATION_DOCUMENT_NAME := CCDAReport;
+ STORAGE_DOCUMENT_NAME := "";
+ AUTHOR_USER_NAME := "autocreateccda";
+ AFFINITY_DOMAIN := "Allscripts Community Direct Messaging";
+ PATIENT_IDENTIFIER_TYPE := "VisitIDCode";
+ FILE_PATH := "\\SC1EFS1\ClientData\CCDA documents\";
+ TRANSPORT_TYPE := TransportType;
+ RECIPIENT_DIRECT_IDS := DirectAddress;
+
+
+ if TRANSPORT_TYPE <> "DIRECT" and TRANSPORT_TYPE <> "XDS"
+ then
+ TRANSPORT_TYPE := "FILE";
+ endif;
+
+
+
+ // DIRECT TRANSPORT
+
+
+ if TRANSPORT_TYPE = "DIRECT"
+
+ then
+
+ If SCMEnvironment = "Test"
+ then
+ RECIPIENT_DIRECT_IDS := ("geraldsandidge@sch.direct.medalliesdirectstage.com");
+ AFFINITY_DOMAIN := "Test Allscripts Community Direct Messaging";
+
+ endif; // SCMEnvironment
+
+ endif; // TransportType = Direct
+
+
+ // XDS TRANSPORT
+
+
+ if TRANSPORT_TYPE = "XDS"
+
+
+ then
+
+ If SCMEnvironment = "Development"
+ then
+ AFFINITY_DOMAIN := "SC_Clinical Connect HIE Test";
+
+
+ Elseif SCMEnvironment = "Production"
+
+ then
+ AFFINITY_DOMAIN := "SC_Clinical Connect HIE Prod";
+
+ endif; // SCM Environment
+
+
+ endif; // TransportType = XDS
+
+
+
+ ASSIGNING_AUTHORITY_OID := read last {"SELECT Value FROM HVCEnvProfile WHERE Code = {{{SINGLE-QUOTE}}}AssigningAuthorityOID{{{SINGLE-QUOTE}}} AND HierarchyCode = {{{SINGLE-QUOTE}}}Documents|Continuity of Care{{{SINGLE-QUOTE}}}"};
+ AUTHOR_USER_GUID := read last {"SELECT GUID FROM CV3User WHERE IDCode = " || SQL(AUTHOR_USER_NAME)};
+ HAS_ERROR_OCCURRED := FALSE;
+ ERROR_MESSAGE := "";
+
+
+ IF NOT EXISTS AUTHOR_USER_GUID
+ THEN
+ HAS_ERROR_OCCURRED := TRUE;
+ ERROR_MESSAGE := ERROR_MESSAGE || "The supplied AUTHOR_USER_NAME of " || AUTHOR_USER_NAME || " is not a valid user.\n";
+ ENDIF; // Exists AUTHOR_USER_GUID
+
+
+
+ // CCDA Creation
+
+
+
+ USING "Sunrise.DocEx.API";
+
+ TRY
+ patientContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.PatientContext{{{SINGLE-QUOTE}}};
+
+ patientContext.ClientGuid:= (ClientGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}};
+ patientContext.ChartGuid := (ChartGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}};
+ patientContext.VisitGuid := (VisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}};
+
+ documentContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.DocumentContext{{{SINGLE-QUOTE}}};
+ documentContext.CreationDocumentName := GENERATION_DOCUMENT_NAME as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
+ documentContext.DocumentStorageName := STORAGE_DOCUMENT_NAME as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
+
+ authorContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.AuthorContext{{{SINGLE-QUOTE}}};
+ authorContext.AuthorGuid := (AUTHOR_USER_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}};
+ authorContext.AuthorUserName := AUTHOR_USER_NAME as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
+
+
+ // Gather the Transport_Patient_Identifier (ClientIDCode)
+
+
+ IF TRANSPORT_TYPE IN ("XDS", "DIRECT")
+
+ THEN
+
+ IF PATIENT_IDENTIFIER_TYPE = "VisitIDCode"
+ THEN TRANSPORT_PATIENT_IDENTIFIER := EvokingObject.VisitIDCode;
+
+ ELSEIF PATIENT_IDENTIFIER_TYPE = "ClientIDCode"
+ THEN TRANSPORT_PATIENT_IDENTIFIER := EvokingObject.IDCode;
+
+ ELSE TRANSPORT_PATIENT_IDENTIFIER := read last
+ {
+ "SELECT ClientIDCode FROM CV3ClientID "
+ ||"WHERE ClientGUID = " || SQL(ClientGUID) || " "
+ ||"AND TypeCode = " || SQL(PATIENT_IDENTIFIER_TYPE) || " "
+ ||"AND Active = 1 AND IDStatus = {{{SINGLE-QUOTE}}}ACT{{{SINGLE-QUOTE}}}"
+ };
+ ENDIF; // PATIENT_IDENTIFIER_TYPE
+
+
+ IF NOT EXISTS TRANSPORT_PATIENT_IDENTIFIER
+ THEN
+ HAS_ERROR_OCCURRED:= TRUE;
+ ERROR_MESSAGE := ERROR_MESSAGE || "Unable to obtain the patient identity for this patient. Cannot proceed with transporting the CCD via XDS.b.\n";
+ ENDIF; //EXISTS TRANSPORT_PATIENT_IDENTIFIER
+
+
+ IF NOT EXISTS ASSIGNING_AUTHORITY_OID
+ THEN
+ HAS_ERROR_OCCURRED:= TRUE;
+ ERROR_MESSAGE := ERROR_MESSAGE || "The ASSIGNING_AUTHORITY_OID value must be set in order to transport the CCD via XDS.b.\n";
+ ENDIF; // EXISTS ASSIGNING_AUTHORITY_OID
+
+
+
+
+ IF TRANSPORT_TYPE = "XDS"
+
+ THEN
+ transportContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.XdsTransportContext{{{SINGLE-QUOTE}}};
+
+
+ ELSEIF TRANSPORT_TYPE = "DIRECT"
+
+ THEN
+ transportContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.DirectTransportContext{{{SINGLE-QUOTE}}};
+ directIDCollection := new NET_OBJECT {{{SINGLE-QUOTE}}}System.Collections.ObjectModel.Collection{{{SINGLE-QUOTE}}};
+ index_list := 1 seqto (count RECIPIENT_DIRECT_IDS);
+
+ for ind in index_list do
+ void := call directIDCollection.Add with (RECIPIENT_DIRECT_IDS[ind] as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
+ enddo; //ind in index_list do
+
+ transportContext.RecipientDirectIDs := directIDCollection AS {{{SINGLE-QUOTE}}}System.Collections.ObjectModel.Collection{{{SINGLE-QUOTE}}};
+
+ Endif; // TRANSPORT_TYPE = "XDS" or "DIRECT"
+
+
+ transportContext.AffinityDomainName := AFFINITY_DOMAIN as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
+ transportContext.PatientAssigningAuthorityOid := ASSIGNING_AUTHORITY_OID as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
+ transportContext.PatientIdentifier := TRANSPORT_PATIENT_IDENTIFIER as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
+
+
+
+ ELSEIF TRANSPORT_TYPE = "FILE"
+
+ THEN
+
+ transportContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.FileTransportContext{{{SINGLE-QUOTE}}};
+ transportContext.FilePath := FILE_PATH as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
+
+ ELSE
+
+ transportContext := new NET_OBJECT {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.Context.NullTransportContext{{{SINGLE-QUOTE}}};
+
+
+
+ ENDIF; // TRANSPORT_TYPE
+
+
+
+ // TRANSPORT SECTION
+
+
+
+
+ IF NOT HAS_ERROR_OCCURRED THEN
+
+ void := CALL {{{SINGLE-QUOTE}}}Sunrise.DocEx.API.ContinuityOfCareDocument{{{SINGLE-QUOTE}}}.CreateAndTransportDocument WITH (
+ documentContext, patientContext, authorContext, transportContext);
+
+ ENDIF;
+
+ ENDTRY;
+
+ CATCH EXCEPTION ex
+
+ HAS_ERROR_OCCURRED:= TRUE;
+ ERROR_MESSAGE := ERROR_MESSAGE || "An error occurred using the Sunrise.DocEx.API:\n" || ex;
+
+
+
+ ENDCATCH;
+
+
+
+ // Diagnostic Alert - Can be enabled if needed
+ // send_alert := "DoNotSend";
+ // alert_dest := destination { Alert: warning, "Informational", high, chart, "Informational", 15042, send_alert, "No Override Allowed" };
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ IF (NOT HAS_ERROR_OCCURRED)
+ THEN
+ conclude TRUE;
+ ELSE
+ conclude FALSE;
+ ENDIF;
+ ;;
+ action:
+
+ // Diagnostic Alert - Can be enabled if needed
+ // write " Messages " || " Exectue the CREATE MLM - " || NOW || " " at alert_dest;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CCDA_PRINT.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CCDA_PRINT.mlm
new file mode 100644
index 0000000..9238eac
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CCDA_PRINT.mlm
@@ -0,0 +1,170 @@
+maintenance:
+
+ title: SCH_FUNC_CCDA_PRINT;;
+ mlmname: SCH_FUNC_CCDA_PRINT;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Allscripts;;
+ author: Renish Bhimani;;
+ specialist: ;;
+ date: 2014-05-21;;
+ validation: testing;;
+
+library:
+ purpose: print CCD-A document report from MLM
+
+ ;;
+ explanation: This called MLM uses ReportRequest class to print CCD-A document report.
+ It also set report{{{SINGLE-QUOTE}}}s parameter values and distribution information
+
+ Change history
+
+ 06.25.2014 DW CSR# 31688 - MU2 Created from ACS_CCDA_DocumentAutoPrint
+ 07.08.2014 DW CSR# 31688 - MU2 Corrected routing issue with code attained from JT Mather which updates destination info to the Report Request object
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "SCMLib";
+ using "SCM.Common.Interfaces";
+ using namespace "SCMLib";
+ using namespace "SCM.Common.Interfaces";
+
+
+ (ClientGuid,ChartGuid,VisitGuid,CCDAReport) := ARGUMENT;
+
+
+ ClientDocumentGUID := read first
+ {
+ " Select GUID from CV3ClientDocument with (nolock) WHERE DocumentName = " || SQL(CCDAReport)
+ || " AND ClientGUID = " || sql(ClientGUID) || " AND ChartGUID = " || SQL(ChartGuid)
+ || " AND ClientVisitGUID = " || SQL(VisitGuid)
+ || " ORDER BY TouchedWhen DESC"
+ };
+
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+ if (ClientDocumentGUID <> "" OR ClientDocumentGUID is not null)
+ then
+ try
+
+ report_request_obj := call {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.ReportRequest{{{SINGLE-QUOTE}}}.CreateReportRequest with ("ACS CCDA Document Auto Print" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
+
+ if (report_request_obj.Parameters is not null and report_request_obj.Parameters.Count > 0)
+ then
+ report_parameter_list := ();
+ for parameterIndex in (1 seqto report_request_obj.Parameters.Count)
+ do
+ report_parameter_list := report_parameter_list, report_request_obj.Parameters[parameterIndex];
+ enddo;
+ endif;
+
+ parameter0 := first (report_parameter_list where report_parameter_list.Name = "varClientDocumentGUID");
+ if parameter0.AllowModification then
+ void := call parameter0.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(ClientDocumentGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+ (user_workstation_name) := read last {StateInfo: WorkstationName};
+
+ print_job_destination := read last {"Select TOP(01) lpl.PrinterAddress
+ From CV3Workstation ws
+ JOIN CV3Location l on l.GUID = ws.LocationGUID
+ JOIN HVCLogicalPrintLocation lpl on lpl.LocnGUID = l.GUID
+ Where ws.IDCode = " || SQL(user_workstation_name) || "
+ AND ws.Active = 1
+ AND l.Active = 1
+ AND lpl.Active = 1
+ AND lpl.LogicalPrinter = {{{SINGLE-QUOTE}}}default report printer{{{SINGLE-QUOTE}}} "};
+
+ print_policy := "PhysicalPrinter";//"WorkstationLocation" ;
+ process_report_locally := true;//false;
+ print_job_destination := print_job_destination; // "\\sc1erp1\scmip"; "\\sc1erp1\PDF_HIS_DEV";
+
+ report_request_obj.PrintPolicy := print_policy as {{{SINGLE-QUOTE}}}PrintPolicy{{{SINGLE-QUOTE}}};
+ report_request_obj.ProcessReportLocally := process_report_locally ;
+ report_request_obj.PrintJobDestination := print_job_destination ;
+ reportRequest.PrintJobPriority := Print_job_priority as {{{SINGLE-QUOTE}}}PrintJobPriority{{{SINGLE-QUOTE}}};
+ report_request_obj.NumberOfCopies := 1;
+
+ // print the report
+ void := call report_request_obj.Save;
+
+ // Call Dispose on report_request_obj to clean it up
+ if report_request_obj is not null
+ then
+ void := call report_request_obj.Dispose;
+ report_request_obj := null;
+ endif;
+
+ endtry;
+
+ catch exception ex
+
+ error_occurred := true;
+ error_message := "{{+R}}Auto Print:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ // Call Dispose on report_request_obj to clean it up
+ if report_request_obj is not null
+ then
+ void := call report_request_obj.Dispose;
+ report_request_obj := null;
+ endif;
+
+ endcatch;
+
+ endif;
+
+
+ // Diagnostic Alert - Can be enabled if needed
+ // send_alert := "DoNotSend";
+ // alert_dest := destination { Alert: warning, "Informational", high, chart, "Informational", 15042, send_alert, "No Override Allowed" };
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ if Error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}ACS_CCDA_DocumentAutoPrint{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+ // Diagnostic Alert - Can be enabled if needed
+ // write " Messages " || " Execute the Called PRINT MLM - " || NOW || " " || ClientDocumentGUID at alert_dest;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN.mlm
new file mode 100644
index 0000000..8b43593
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN.mlm
@@ -0,0 +1,151 @@
+maintenance:
+
+ title: SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN;;
+ mlmname: SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN;;
+ arden: version 2.5;;
+ version: 6.10;;
+ institution: ;;
+ author: Juliet Law, Allscripts Corp, x7461;;
+ specialist: ;;
+ date: 2014-10-22;;
+ validation: testing;;
+
+library:
+ purpose: Creates an Enterprise Defined Column object to update with desired passed in value.
+ ;;
+ explanation: Called MLM that updates an enterprised defined column.
+
+ Change history
+
+ 10.22.2014 JML CSR #32720 Created
+ 01.28.2015 JML Moved to Production.
+ ;;
+ keywords: Called MLM, Generic, Enterprise Defined Column
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ (TriggerObj) := ARGUMENT;
+
+ //Error Handling vars for ObjectsPlus Method calls
+ error_occurred := false;
+ error_message := "";
+
+ //Destination Objects
+ EDColumn_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "EnterprisePatientListColumn Object",
+ rule_number := 2021 ];
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ //Create Client Visit Object
+ try
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with
+ ( ( TriggerObj.client_visit_guid as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} ) ;
+
+ endtry;
+
+ catch Exception ex
+
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( ex.InnerException is not null net_object ) then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ endcatch;
+
+ //Create Enterprise Defined Column based on parameter values
+
+ try
+
+ //Retrieve Enterprise Defined Column object
+ EntDefinedColumn_obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
+ with ( client_visit_obj, TriggerObj.column_name );
+
+ EntDefinedColumn_obj.Value := TriggerObj.column_value;
+ //EDColumn_Dest.ObjectsPlus := EntDefinedColumn_obj;
+ void := call EntDefinedColumn_obj.Save;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}Enterprise Patient List Column{{-R}}\n"
+ || ex.message || "\n\n";
+
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if (EntDefinedColumn_obj is not null) then
+ void := call EntDefinedColumn_obj.Dispose;
+ EntDefinedColumn_obj := null;
+ endif;
+
+ EDColumn_Dest := null;
+ endcatch;
+
+ //Destroy EDColumn Obj
+ if ( EntDefinedColumn_obj is not null ) then
+ void := call EntDefinedColumn_obj.Dispose;
+ EntDefinedColumn_obj := null;
+ endif;
+
+ //Destroy Client Visit Obj
+ if ( client_visit_obj is not null ) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj := null;
+ endif;
+
+ Conclude true ;
+ ;;
+ action:
+ //Error Handling
+ if error_occurred then
+ write "An error occurred in the MLM {{+B}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{-B}} "
+ || " Please notify your system administrator that an error message has "
+ || " occurred for this patient. They will review the following error "
+ || "message:\n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+ //Evoke ObjectsPlus destination
+ if exists EDColumn_Dest then
+ write true at EDColumn_Dest;
+ endif;
+
+ return error_occurred;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN_MULTIPLE.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN_MULTIPLE.mlm
new file mode 100644
index 0000000..48c48e0
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN_MULTIPLE.mlm
@@ -0,0 +1,209 @@
+maintenance:
+
+ title: SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN_MULTIPLE ;;
+ mlmname: SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN_MULTIPLE;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St. Clair Hospital;;
+ author: Courtney Carr;;
+ specialist: Don Warnick ;;
+ date: 2018-02-12;;
+ validation: testing;;
+
+
+library:
+ purpose:
+
+ This functional MLM will update case list or enterprise defined column.
+ ;;
+ explanation:
+
+ This MLM that will update a column evoked by a new entry in the CV3AlertDeclaration table.
+
+ It is a work-around for a system limitation that prevents multiple columns from being updated by a single MLM call. (also an issue... order + column and health issue + column in single MLM)
+
+ The limitation will be resolved in SCM release 17.3. At that time this MLM will not be needed and can be removed.
+
+
+ Change history
+
+ 02.12.2018 DW CSR# 35320 SSC - Created
+
+
+ ;;
+ keywords: Functional MLM, Column Creation
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ using "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "ObjectsPlusXA.Surgery";
+
+ using namespace "ObjectsPlusXA.Surgery";
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ log_execution_info := false;
+ error_occurred:= false;
+ error_message := "";
+
+ // Destinations and Evokes
+
+ error_destination := destination { Alert } with [alert_type := "Warning",short_message := "ObjectsPlus Error from MLM",priority := "low",scope := "chart",Rule_group := "ObjectsPlus Error from MLM",Rule_number := 1001,Rule_subgroup := "",Send_with_order := "",Alert_dialog_settings := "",Display_alert := true ];
+ alert_destination := destination { Alert }WITH [alert_type := "FUNCTIONAL_MLM_EVOKE", short_message:="Column Update", Priority:="high",scope:="chart",rule_group:="Call MLM Group",rule_number:=9050,send_with_order:= "DoNotSend",alert_abstract:= "",alert_dialog_settings:= ""];
+
+ alert_enter_event := EVENT {AlertEnter Any Alert: where TypeCode = "FUNCTIONAL_MLM_EVOKE" and Description = "Column Update"};
+
+ if called_by_editor then EvokingObject := read last { Alert: THIS }; endif;
+
+
+ // Process the entered CV3AlertDeclaration record
+
+
+ MessageString := EVOKINGOBJECT.Text; // contains the first 255 characters stored in CV3AlertDeclaration.Text
+
+
+ // If the text exceeds 255 characters, the overflow is stored in CV3AlertMessage.TextLine and must be suffixed to the MessageString
+
+
+ if EVOKINGOBJECT.HasLongText = true
+
+ then
+
+ ClientGUID := EVOKINGOBJECT.ClientGUID;
+ AlertGUID := EVOKINGOBJECT.GUID;
+
+ (AdditionalText) := read
+ {
+ "
+ select textline
+ from CV3AlertMessage with (nolock)
+ where ClientGUID = " || ClientGuid || " and parentguid = " || AlertGUID ||
+ " order by LineNumber "
+ };
+
+ // Suffix the Additional TextLine(s) to the MessageString
+
+ for i in 1 seqto count AdditionalText do
+ AdditionalTextRecords := AdditionalText[i];
+ MessageString := MessageString || AdditionalTextRecords;
+ enddo;
+
+ endif;
+
+
+ // Parse the first message from the rest of the string
+
+
+ FirstPipe := find "|" in string MessageString;
+ FirstMessage:= substring (FirstPipe -1) characters starting at 1 from MessageString; // First message - process immediately
+
+ if FirstPipe <> 0
+ then
+ SubsequentMessageString:= substring 5000 characters starting at (FirstPipe +1) from MessageString; // Susequent messages - write to CV3AlertDeclaration
+ endif;
+
+
+ // Process the First Message in the string
+
+
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ FirstMessageParsed:= call str_parse with FirstMessage,"^";
+
+ for i in 1 seqto count FirstMessageParsed do
+ MessageCompenent := FirstMessageParsed[i];
+ if i = 1 then column_type := MessageCompenent; // Case List or Visit List
+ elseif i = 2 then patient_id := MessageCompenent as number; // Case ID or Visit Guid
+ elseif i = 3 then column_name := MessageCompenent; // Column Name
+ elseif i = 4 then column_value:= MessageCompenent; // Column Value
+ endif;
+ enddo;
+
+
+ if exists column_type and exists patient_id and exists column_name and exists column_value // All components must be present
+
+ then
+
+ if column_type = "CL" // Column List processing
+ then
+ try
+ case_list_user_defined_column_value_object := call {{{SINGLE-QUOTE}}}CaseListUserDefinedBasicColumnValue{{{SINGLE-QUOTE}}}.FindByColumnName with (patient_id as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, column_name as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
+ case_list_user_defined_column_value_object.Value := column_value;
+ void := call case_list_user_defined_column_value_object.Save;
+ endtry;
+
+ catch exception ex
+ error_occurred:= true;
+ error_message := "{{+R}}Case List User Defined Column{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then error_message:= error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif;
+ if (case_list_user_defined_column_value_object is not null) then case_list_user_defined_column_value_object := null; endif;
+ endcatch;
+
+ elseif column_type = "VL" // Visit List processing
+
+ then
+
+ try
+ client_visit_object := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with (( patient_id as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ patient_list_column_object := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName with ( client_visit_object, column_name);
+ patient_list_column_object.Value := column_value;
+ void := call patient_list_column_object.Save;
+ endtry;
+
+ catch exception ex
+ error_occurred:= true;
+ error_message := "{{+R}}Case List User Defined Column{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then error_message:= error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif;
+ if patient_list_column_object is not null then patient_list_column_object:= null; void:= call patient_list_column_object.Dispose; endif;
+ if client_visit_object is not null then client_visit_object := null; void:= call client_visit_object.Dispose; endif;
+ endcatch;
+
+ endif;
+
+ // Dispose of objects
+
+ if patient_list_column_object is not null then patient_list_column_object:= null; void:= call patient_list_column_object.Dispose; endif;
+ if client_visit_object is not null then client_visit_object := null; void:= call client_visit_object.Dispose; endif;
+
+ endif;
+ ;;
+
+ priority: 50
+ ;;
+
+ evoke:
+
+ 1 seconds after time of alert_enter_event;
+
+ ;;
+
+ logic:
+
+ conclude true;
+ ;;
+
+ action:
+
+ if error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN_MULTIPLE {{-B}} " ||"Please notify your System Administrators that an error message has occurred for this patient. They will review the following error message: \n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+ // Create a new row for subsequent message string
+
+ if exists SubsequentMessageString and SubsequentMessageString <> ""
+ then
+ write SubsequentMessageString at alert_destination;
+ endif;
+
+ ;;
+
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_GENERAL_ORDER_ON_WORKSHEET.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_GENERAL_ORDER_ON_WORKSHEET.mlm
new file mode 100644
index 0000000..36f8dcd
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_GENERAL_ORDER_ON_WORKSHEET.mlm
@@ -0,0 +1,188 @@
+maintenance:
+
+ title: SCH_FUNC_CREATE_GENERAL_ORDER_ON_WORKSHEET;;
+ mlmname: SCH_FUNC_CREATE_GENERAL_ORDER_ON_WORKSHEET;;
+ arden: version 2.5;;
+ version: 16.3;;
+ institution: St. Clair Hospital ;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2018-01-11;;
+ validation: testing;;
+
+library:
+ purpose:
+ Creates General Order and adds it to the order worksheet.
+ ;;
+ explanation:
+ Called from Form_Haloperidol_IV_Orders to create a cardiac monitor order for doses over 2mg IV, but can be used generically
+ for other orders.
+
+ Change History
+ 01.11.2018 TMS CSR 37432 Created to add a cardiac monitor order to worksheet when haloperidol IV dose > 2mg added
+ from post anesthesia order sets.
+
+ ;;
+ keywords:
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+
+ (
+ order_type,
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ GenOrder_catalog_item, // CatalogMasterItem ObjectsPlus object
+ order_Create_Reason, // string CreateReason
+ worksheetInfo,
+ AdditionalInfo, // User Defined Data Item
+ WSRequestedBy_obj, // RequestingProvider ObjectsPlus object
+ WSRequestedBySource, // string requestingSource(must be in dict)
+ WSSessionType, // string SessionType
+ WSSessionReason, // string SessionReason
+ WSLocation_obj
+
+ ) := argument;
+
+ GeneralOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM, placed on worksheet",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2019 ];
+
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1019,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+ ;;
+ priority: 50
+
+ ;;
+
+ evoke:
+
+ ;;
+
+ logic:
+
+ //---------------------------------------------------------------
+ // Create a new GENERAL order from a catalog item
+ // Place the order onto the order entry worksheet
+ //---------------------------------------------------------------
+ try
+
+ Catalog_Item_Name := GenOrder_catalog_item;
+ Catalog_Item_Modifier := "";
+ Catalog_Item_Version := "";
+ order_Creation_Reason := order_Create_Reason;
+
+ // get OrderCatalogMasterItem ObjectsPlus object
+ Order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with Catalog_Item_Name;
+
+ // Create the order
+ // Session information has been retrieved from the current worksheet if there
+ // already exists unsubmitted orders.
+ // AvailabilityOverride is set to prompt. This can display a popup dialog if
+ // this order has an availability policy set that defines this item as not
+ // available in the current location. The user still needs to have the
+ // correct override right.
+
+ GeneralOrder_obj := call worksheetInfo.CreateGeneralOrder
+ with
+ Order_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // string Create Reason
+ "Prompt" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
+ false, // suppress messages
+ (Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Companion order primary key
+ false; // Mandatory on Worksheet
+
+
+ if( Order_catalog_item is NOT NULL ) then
+ void := call Order_catalog_item.Dispose;
+ Order_catalog_item:= null;
+ endif;
+
+ // Value User Defined Data Item on order with text sent from calling MLM.
+ If AdditionalInfo is not Null then
+
+ SetAdditionalInfo := call GeneralOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "NUR_NurIntervFreeText", (AdditionalInfo AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ endif;
+
+
+ GeneralOrder_obj.RequestedTime := "Routine";
+
+ void := call GeneralOrder_Obj.Save;
+ void := call GeneralOrder_Obj.Dispose;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New general order :{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ msg := "Exception #1"
+ || "\nerror = " || ex.Message;
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "Info", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if( Order_catalog_item is NOT NULL ) then
+ void := call Order_catalog_item.Dispose;
+ Order_catalog_item:= null;
+ endif;
+
+ if( GeneralOrder_obj is NOT NULL ) then
+ void := call GeneralOrder_obj.Dispose;
+ GeneralOrder_obj:= null;
+ endif;
+
+ GeneralOrder_dest := null;
+ endcatch;
+
+ conclude true;
+
+ ;;
+ action:
+
+ if error_occurred then
+
+ write "An error has occurred in the MLM {{+B}}SCH_FUNC_CREATE_GENERAL_ORDER_ON_WORKSHEET{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error(s) " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+ if EXISTS GeneralOrder_dest then
+ write true at GeneralOrder_dest;
+ endif;
+
+ return error_occurred;
+
+ ;;
+ Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_HEALTH_ISSUE.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_HEALTH_ISSUE.mlm
new file mode 100644
index 0000000..5dd3efc
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_HEALTH_ISSUE.mlm
@@ -0,0 +1,113 @@
+maintenance:
+
+ title: SCH_Func_Create_Health_Issue;;
+ mlmname: SCH_Func_Create_Health_Issue;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: ;;
+ author: Don Warnick ;;
+ specialist: ;;
+ date: 2012-04-05;;
+ validation: testing;;
+
+library:
+ purpose: Create a Health Issue using the information passed from the calling MLM.
+ ;;
+ explanation: Called MLM that builds health issues for a patient.
+
+ Change history
+
+ 04.05.2012 DW CSR# - Created
+ 04.30.2013 DW CSR# 31334 - Adjusted to be more generic, enabling it to be called from any MLMs
+ 09.30.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 HI Dynamic Creation with all details Like ICD10 Code, Snowmed Code etc .
+
+ ;;
+ keywords: Called MLM, Create Health Issue
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+
+ (visitGuid,issuename,issuecode,issuetext,issuetype,issuescheme) := ARGUMENT;
+
+ send_alert := "DoNotSend";
+ alert_dest := destination { Alert: warning, "Health Issue Create", high, chart, "Health Issue Create", 15042, send_alert, "No Override Allowed" };
+
+// Create the Client Visit Object
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ endcatch;
+
+// Create the Health Issue Object and Generate the Health Issue
+
+ try
+
+ NewHealthIssueHIType := issuetype;
+ NewHealthIssueHICode := issuecode;
+ NewHealthIssueHIScheme := issuescheme;
+
+ dd := EXTRACT Day now;
+ mn := EXTRACT Month now;
+ yr := EXTRACT Year now;
+
+//--Start: CSR 23359-ICD9-ICD10 HI Change Added By shivprasad
+ Terms := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindIMOTerms with (NewHealthIssueHIScheme,NewHealthIssueHICode);
+ FOR i IN 1 SEQTO (Terms.Count as Number ) DO
+ HI_obj := Terms[i];
+ HI_Name := HI_obj.TermName as string;
+ If HI_Name = issuename then
+ HI_NO := i ;
+ Endif;
+ ENDDO;
+ If HI_NO is Null Then
+ HI_NO :=1 ;
+ Endif;
+ New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, Terms[HI_NO]);
+
+//--End Added by Shivprasad
+
+ //New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, NewHealthIssueHIScheme, NewHealthIssueHICode );
+ PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} );
+ New_HealthIssue_obj.OnsetDate := PartialDate_obj;
+ New_HealthIssue_obj.Name := issuename;
+ New_HealthIssue_obj.Text := issuetext;
+
+ if ( New_HealthIssue_obj is NOT NULL ) then void := call New_HealthIssue_obj.Save; void := call New_HealthIssue_obj.Dispose; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+
+ endtry;
+
+ catch exception ex
+ error_occurred := true;
+ if ( New_HealthIssue_obj is NOT NULL ) then void:= call New_HealthIssue_obj.Dispose; New_HealthIssue_obj:= null; endif;
+ endcatch;
+
+ ;;
+ evoke:
+ ;;
+ logic:
+ Conclude true ;
+ ;;
+ action:
+
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}}SCH_Func_Create_Health_Issue{{-B}} " || "Please notify your System Administrators that an error message has occurred " ||
+ "message: \n" at alert_dest;
+ write messageText at alert_dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_MED_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_MED_ORDER.mlm
new file mode 100644
index 0000000..ff8020e
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_MED_ORDER.mlm
@@ -0,0 +1,143 @@
+maintenance:
+
+ title: SCH_Func_Create_Med_Order;;
+ mlmname: SCH_Func_Create_Med_Order;;
+ arden: version 2.5;;
+ version: 16.30;;
+ institution: ;;
+ author: Teresa Spicuzza;;
+ specialist: ;;
+ date: 2017-11-13;;
+ validation: testing;;
+
+library:
+ purpose: Create an Order using the information passed from the calling MLM.
+ ;;
+ explanation: Called MLM that builds orders for a patient.
+
+ Change history
+
+ 11.10.2017 TMS CSR# 35723 Created
+
+
+ ;;
+ keywords: Called MLM, Generic, Create Order
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+
+ (visitGuid,UserGuid,ClientGUID,SessionType,OrderSource,ItemName,ItemModifier,OrderType,CareProviderGuid,OrderFrequency) := ARGUMENT;
+
+ send_alert := "DoNotSend";
+ alert_dest := destination { Alert: warning, "Order Create", high, chart, "Order Create", 15042, send_alert, "No Override Allowed" };
+
+ user_IDType := "Edstan Number (physician)";
+ RequestingSource := OrderSource;
+ order_Creation_Reason := "Protocol Order";
+
+ If SessionType = "Hold"
+ then SessionReason := "Hold Orders";
+ Else SessionReason := ""; // Session type is Standard
+ endif;
+
+
+
+// Create Objects
+
+ try
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || CareProviderGuid
+ || " and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
+ RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
+ location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || ClientGUID};
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
+ if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj := null; endif;
+ endcatch;
+
+ try
+
+ Catalog_Item_Name := ItemName;
+ Catalog_Item_Modifier := ItemModifier;
+ Catalog_Item_Version := "";
+ Medication_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
+
+ PreFilled_MedicationOrder_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ Catalog_Item_Modifier, // string ItemNameModifier
+ Catalog_Item_Version, // string ItemNameModifierVersion
+ order_Creation_Reason, // string CreateReason
+ RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
+ RequestingSource, // string RequestedBySource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+
+ if (exists OrderFrequency) then
+
+ frequencyCode_obj := new net_object {{{SINGLE-QUOTE}}}Frequency{{{SINGLE-QUOTE}}};
+ frequencyCode_obj.code := OrderFrequency;
+ PreFilled_MedicationOrder_obj.frequency := frequencyCode_obj;
+ Endif;
+
+ if ( Medication_catalog_item is NOT NULL ) then
+ void := call PreFilled_MedicationOrder_obj.Save;
+ void := call PreFilled_MedicationOrder_obj.Dispose;
+ void:= call Medication_catalog_item.Dispose;
+ Medication_catalog_item:= null;
+ endif;
+
+ endtry;
+
+ catch Exception ex
+
+ error_occurred := true;
+ error_message := "{{+R}}New prefilled medication order:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( Medication_catalog_item is NOT NULL ) then void:= call Medication_catalog_item.Dispose; Medication_catalog_item:= null; endif;
+ if ( PreFilled_MedicationOrder_obj is NOT NULL ) then void:= call PreFilled_MedicationOrder_obj.Dispose; PreFilled_MedicationOrder_obj:= null; endif;
+
+ Prefilled_MedicationOrder_dest := null;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
+ if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
+
+ ;;
+ evoke:
+ ;;
+ logic:
+ Conclude true ;
+ ;;
+ action:
+
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}}SCH_Func_Create_Order{{-B}} " || "Please notify your System Administrators that an error message has occurred " ||
+ "message: \n" at alert_dest;
+ write messageText at alert_dest;
+ endif;
+
+ return error_occurred;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_MED_ORDER_WORKSHEET.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_MED_ORDER_WORKSHEET.mlm
new file mode 100644
index 0000000..26214e7
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_MED_ORDER_WORKSHEET.mlm
@@ -0,0 +1,270 @@
+maintenance:
+
+ title: SCH_FUNC_CREATE_MED_ORDER_WORKSHEET;;
+ mlmname: SCH_FUNC_CREATE_MED_ORDER_WORKSHEET;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: ;;
+ author: ;;
+ specialist: Sandy Zhang ;;
+ date: 2018-02-22;;
+ validation: testing;;
+
+library:
+ purpose:
+ Creates medication order that is added to worksheet. The worksheet is the queue of orders that are selected but not yet submitted.
+ ;;
+ explanation:
+
+ Change History
+ 02.22.2018 SZ CSR #35939 - Created
+ 09.18.2018 SZ CSR #36408 - Modified to fit the needs of project: Tamiflu transition orders
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+
+
+ (OrderName,
+ ItemModifier,
+ ItemVersion,
+ creation_reason,
+ OrderFrequency,
+ Active_OrderGUID,
+ Active_ClientVisitGUID,
+ location_guid,
+ UserGuid,
+ special_instructions,
+ RequestedDate,
+ RequestedTime,
+ RequestedTimeHour,
+ RequestedTimeMin
+ ) := argument;
+
+
+ //------------------------------------------------------------
+ // Define the ObjectsPlus destinations
+ //------------------------------------------------------------
+ Prefilled_MedicationOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM, placed on worksheet",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+
+
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+;;
+ priority: 50
+ ;;
+ evoke:
+
+ ;;
+ logic:
+
+ if (called_by_editor) then
+ conclude false;
+ endif;
+
+
+ try
+ //-----------------------------------------------------------
+ // Retrieve current order entry batch.
+ // The companion order can be added only if the parent order
+ // belongs to the order entry batch
+ // object owned by the OrderEntryWorksheet.
+ //-----------------------------------------------------------
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+
+
+ //------------------------------------------------------------
+ // Get the .NET version of the Client Visit object.
+ // Needed to create new ObjectsPlus object
+ //------------------------------------------------------------
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((Active_ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+
+ // Get the CareProviderInfo object for user and requested by
+ careProviderInfo_requestedBy_obj := call {{{SINGLE-QUOTE}}}CareProviderInfo{{{SINGLE-QUOTE}}}.FindByPrimaryKey with (UserGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}};
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if( worksheetInfo is NOT NULL ) then
+ void := call worksheetInfo.Dispose;
+ worksheetInfo:= null;
+ endif;
+
+ if( client_visit_obj is NOT NULL ) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ if( WSRequestedBy_obj is NOT NULL ) then
+ void := call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ if( WSlocation_obj is NOT NULL ) then
+ void := call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+
+ if ( order_form_obj is NOT NULL ) then
+ void:= call order_form_obj.Dispose;
+ order_form_obj := null;
+ endif;
+
+ // If unable to initialize starting data, do not continue
+ // with the creation of any orders.
+ // Still conclude true as the error message needs to
+ // be displayed as an error.
+ conclude true;
+
+ endcatch;
+
+ //---------------------------------------------------------------
+ // Create a new MEDICATION order from a Pre-Filled item
+ // Place the order onto the order entry worksheet
+ //---------------------------------------------------------------
+ try
+
+ Catalog_Item_Name := OrderName;
+ Catalog_Item_Modifier := ItemModifier;
+ Catalog_Item_Version := ItemVersion;
+ order_Creation_Reason := creation_reason;
+
+ // get OrderCatalogMasterItem ObjectsPlus object
+ Medication_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with Catalog_Item_Name;
+
+ // Create the prefilled Medication order
+ // Session information has been retrieved from the current worksheet if there
+ // already exists unsubmitted orders.
+ // AvailabilityOverride is set to prompt. This can display a popup dialog if
+ // this order has an availability policy set that defines this item as not
+ // available in the current location. The user still needs to have the
+ // correct override right.
+ PreFilled_MedicationOrder_obj := call worksheetInfo.CreateMedicationOrder
+ with
+ Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ Catalog_Item_Modifier, // string Name Modifier for prefill
+ Catalog_Item_Version, // string Name modifier version for prefill
+ order_Creation_Reason, // string Create Reason
+ "Prompt" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
+ false, // suppress messages
+ (Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Companion order primary key
+ false; // Mandatory on Worksheet
+
+ if( Medication_catalog_item is NOT NULL ) then
+ void := call Medication_catalog_item.Dispose;
+ Medication_catalog_item:= null;
+ endif;
+ //-----------------------------------------------------------------------------
+ // Change order frequency
+ //-----------------------------------------------------------------------------
+ freqCodeValue_obj := new net_object {{{SINGLE-QUOTE}}}Frequency{{{SINGLE-QUOTE}}};
+ freqCodeValue_Obj.Code := (OrderFrequency As string);
+ PreFilled_MedicationOrder_obj.Frequency := freqCodeValue_obj;
+
+if (exist RequestedDate) then
+ PreFilled_MedicationOrder_obj.RequestedDate := RequestedDate;
+endif;
+
+if (exist RequestedTime) then
+ PreFilled_MedicationOrder_obj.RequestedTime := RequestedTime;
+endif;
+
+
+ PreFilled_MedicationOrder_obj.AdministrationInstructions := special_instructions;
+
+ void := call PreFilled_MedicationOrder_obj.Save;
+
+ endtry;
+ catch Exception ex
+
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New prefilled medication order :{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if( Medication_catalog_item is NOT NULL ) then
+ void := call Medication_catalog_item.Dispose;
+ Medication_catalog_item:= null;
+ endif;
+
+ if( PreFilled_MedicationOrder_obj is NOT NULL ) then
+ void := call PreFilled_MedicationOrder_obj.Dispose;
+ PreFilled_MedicationOrder_obj:= null;
+ endif;
+
+ Prefilled_MedicationOrder_dest := null;
+ endcatch;
+
+
+ // Dispose client visit objects
+ if( client_visit_obj is NOT NULL ) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ // Dispose order entry batch object
+ if( worksheetInfo is NOT NULL ) then
+ void := call worksheetInfo.Dispose;
+ worksheetInfo:= null;
+ endif;
+
+//break;
+ conclude true;
+
+ ;;
+ action:
+/*
+ if error_occurred
+ then
+
+ write "An error has occurred in the MLM {{+B}}SCH_FUNC_CREATE_MED_ORDER_WORKSHEET{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error(s) " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+ return error_occurred;
+*/
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ORDER.mlm
new file mode 100644
index 0000000..99b9420
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_ORDER.mlm
@@ -0,0 +1,147 @@
+maintenance:
+
+ title: SCH_Func_Create_Order;;
+ mlmname: SCH_Func_Create_Order;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: ;;
+ author: Don Warnick ;;
+ specialist: ;;
+ date: 2012-04-05;;
+ validation: testing;;
+
+library:
+ purpose: Create an Order using the information passed from the calling MLM.
+ ;;
+ explanation: Called MLM that builds orders for a patient.
+
+ Change history
+
+ 04.12.2012 DW CSR# 26409 Created
+ 10.21.2013 DW CSR#31693 Altered the Order "Reason" from "From Test MLM" to "Protocol Order"
+ 10.24.2013 DW CSR# 31693 - Now the calling MLM supplies the session type
+ 11.11.2013 TMS CSR# 31693 Added qualifier to SQL to retrieve the UserIDCode to only
+ retrieve the last ProviderIDTypeCode for the Edstan Number.
+ 11.13.2013 DW CSR# 31693 Accept Order Source Value from calling MLM
+
+ ;;
+ keywords: Called MLM, Generic, Create Order
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+
+ (visitGuid,UserGuid,ClientGUID,SessionType,OrderSource,ItemName,ItemModifier,OrderType,OrderFrequency) := ARGUMENT;
+
+ send_alert := "DoNotSend";
+ alert_dest := destination { Alert: warning, "Order Create", high, chart, "Order Create", 15042, send_alert, "No Override Allowed" };
+
+ user_IDType := "Edstan Number (physician)";
+ RequestingSource := OrderSource;
+ order_Creation_Reason := "Protocol Order";
+
+ If SessionType = "Hold"
+ then SessionReason := "Hold Orders";
+ Else SessionReason := ""; // Session type is Standard
+ endif;
+
+
+
+// Create Objects
+
+ try
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || UserGUID
+ || " and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
+ RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
+ location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || ClientGUID};
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif;
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
+ if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj := null; endif;
+ endcatch;
+
+ try
+
+ Catalog_Item_Name := ItemName;
+ Catalog_Item_Modifier := ItemModifier;
+ Catalog_Item_Version := "";
+ Medication_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
+
+ PreFilled_MedicationOrder_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ Catalog_Item_Modifier, // string ItemNameModifier
+ Catalog_Item_Version, // string ItemNameModifierVersion
+ order_Creation_Reason, // string CreateReason
+ RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
+ RequestingSource, // string RequestedBySource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+
+ if (exists OrderFrequency) then
+
+ frequencyCode_obj := new net_object {{{SINGLE-QUOTE}}}Frequency{{{SINGLE-QUOTE}}};
+ frequencyCode_obj.code := OrderFrequency;
+ PreFilled_MedicationOrder_obj.frequency := frequencyCode_obj;
+ Endif;
+
+ if ( Medication_catalog_item is NOT NULL ) then
+ void := call PreFilled_MedicationOrder_obj.Save;
+ void := call PreFilled_MedicationOrder_obj.Dispose;
+ void:= call Medication_catalog_item.Dispose;
+ Medication_catalog_item:= null;
+ endif;
+
+ endtry;
+
+ catch Exception ex
+
+ error_occurred := true;
+ error_message := "{{+R}}New prefilled medication order:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( Medication_catalog_item is NOT NULL ) then void:= call Medication_catalog_item.Dispose; Medication_catalog_item:= null; endif;
+ if ( PreFilled_MedicationOrder_obj is NOT NULL ) then void:= call PreFilled_MedicationOrder_obj.Dispose; PreFilled_MedicationOrder_obj:= null; endif;
+
+ Prefilled_MedicationOrder_dest := null;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
+ if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
+
+ ;;
+ evoke:
+ ;;
+ logic:
+ Conclude true ;
+ ;;
+ action:
+
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}}SCH_Func_Create_Order{{-B}} " || "Please notify your System Administrators that an error message has occurred " ||
+ "message: \n" at alert_dest;
+ write messageText at alert_dest;
+ endif;
+
+ return error_occurred;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_UNSUBMITTED_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_UNSUBMITTED_ORDER.mlm
new file mode 100644
index 0000000..17506ca
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_UNSUBMITTED_ORDER.mlm
@@ -0,0 +1,208 @@
+maintenance:
+
+ title: SCH_Func_Create_Unsubmitted_Order;;
+ mlmname: SCH_Func_Create_Unsubmitted_Order;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: ;;
+ author: Don Warnick ;;
+ specialist: ;;
+ date: 2012-10-06;;
+ validation: testing;;
+
+library:
+ purpose: Create an Unsubmitted Order using the information passed from the calling MLM.
+ ;;
+ explanation: Called MLM that builds orders for a patient.
+
+ NOTE: This MLM is initially built to create Prefilled Medication Orders.
+ Additional routines (i.e. Diagnostic Orders etc...) may be added using the
+ Allscripts supplied MLM, "Test ObjectsPlus Orders Using A Worksheet" for reference.
+
+ Change history
+
+ 10.06.2014 DW CSR# 31964 Created
+ 02.03.2016 JML CSR# 33934: Created
+ 04.20.2016 JML Moved to Production
+
+ ;;
+ keywords: Called MLM, Generic, Create Order
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (visitGuid, userGuid, clientGuid, orderSessionType, orderSource, triggerObj) := ARGUMENT;
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+ user_IDType := "Edstan Number (physician)";
+
+ user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || userGUID
+ || " and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
+
+ location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || clientGUID};
+
+ TriggerObj_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM, placed on worksheet",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ ;;
+
+ priority: 50
+ ;;
+
+ evoke:
+ ;;
+ logic:
+
+
+ if called_by_editor
+ then
+ conclude false;
+ endif;
+
+ try
+
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+
+ if worksheetInfo is NULL OR "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String)
+ then
+ conclude false;
+ endif;
+
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ WSSessionType := orderSessionType;
+ WSSessionReason := "";
+ WSRequestedBySource := orderSource;
+ WSRequestedBy_obj := worksheetInfo.RequestedBy;
+ WSlocation_obj := worksheetInfo.ExpectedReleaseLocationGroup;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred:= true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+
+ // Dispose
+
+ if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif;
+ if( client_visit_obj is NOT NULL ) then void := call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if( WSRequestedBy_obj is NOT NULL ) then void := call WSRequestedBy_obj.Dispose; WSRequestedBy_obj:= null; endif;
+ if( WSlocation_obj is NOT NULL ) then void := call WSlocation_obj.Dispose; WSlocation_obj:= null; endif;
+
+ endcatch;
+
+ try
+
+ Catalog_Item_Name := triggerObj.item_name;
+ Catalog_Item_Modifier := triggerObj.item_modifier;
+ Catalog_Item_Version := triggerObj.item_version;
+ Order_Creation_Reason := "Protocol Order";
+
+ CatalogItem_obj := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName WITH ( Catalog_Item_Name as string ) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+
+ if ( triggerObj.order_type = "Diagnostic" ) then
+ DiagnosticOrder_obj := call worksheetInfo.CreateDiagnosticOrder WITH
+ CatalogItem_obj,
+ Order_Creation_Reason,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}},
+ false,
+ (Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}},
+ true;
+
+ if ( CatalogItem_obj IS NOT NULL ) then
+ void := call CatalogItem_obj.Dispose;
+ CatalogItem_obj := null;
+ endif;
+
+ RequestedTime_obj := new net_object "RequestedTime";
+ RequestedTime_obj.CodedTime := triggerObj.coded_time;
+
+ if ( triggerObj.coded_time <> "STAT" AND triggerObj.coded_time <> "AM Rounds" ) then
+ time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} WITH ( triggerObj.requested_time_hour as number ) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, ( triggerObj.requested_time_min as number ) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
+ RequestedTime_obj.Time := time_obj;
+ endif;
+
+ DiagnosticOrder_obj.RequestedTime := RequestedTime_obj;
+
+ if ( count triggerObj.order_field_name > 0 ) then
+
+ for i IN 1 seqto ( count triggerObj.order_field_name ) do
+ diagField_obj := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} WITH
+ triggerObj.order_field_name[i], ( triggerObj.order_field_value[i] as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}} );
+ enddo;
+
+ endif;
+
+ void := call DiagnosticOrder_obj.Save;
+ void := call DiagnosticOrder_obj.Dispose;
+ endif;
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New " || triggerObj.order_type || " order :{{-R}}\n" || ex.Message || "\n\n";
+
+ // Dispose
+ if( CatalogItem_obj is NOT NULL ) then void := call CatalogItem_obj.Dispose; CatalogItem_obj := null; endif;
+ if( DiagnosticOrder_obj is NOT NULL ) then void := call DiagnosticOrder_obj.Dispose; DiagnosticOrder_obj:= null; endif;
+ TriggerObj_dest := null;
+
+ endcatch;
+
+ // Dispose
+ if( client_visit_obj is NOT NULL ) then void := call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif;
+
+
+
+ Conclude true ;
+
+
+ ;;
+ action:
+
+ if Error_occurred
+ then
+
+ write "An error has occurred in the MLM {{+B}}TEST_OBJECTSPLUS_ORDERS_WITH_WORKSHEET{{-B}} " || "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error(s) " || "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+
+
+
+ if EXISTS TriggerObj_dest then write true at TriggerObj_dest; endif;
+
+ return Error_occurred;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_UNSUBMITTED_ORDER_DIAGNOSTIC_PREFILLED.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_UNSUBMITTED_ORDER_DIAGNOSTIC_PREFILLED.mlm
new file mode 100644
index 0000000..2c52c03
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_UNSUBMITTED_ORDER_DIAGNOSTIC_PREFILLED.mlm
@@ -0,0 +1,220 @@
+maintenance:
+
+ title: SCH_Func_Create_Unsubmitted_Order_Diagnostic_Prefilled;;
+ mlmname: SCH_Func_Create_Unsubmitted_Order_Diagnostic_Prefilled;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: ;;
+ author: Sandy Zhang ;;
+ specialist: ;;
+ date: 2018-09-13;;
+ validation: testing;;
+
+library:
+ purpose: Create an Unsubmitted Diagnostic/Lab Order that{{{SINGLE-QUOTE}}}s Pre-filled using the information passed from the calling MLM.
+ ;;
+ explanation: Called MLM that builds orders for a patient.
+
+ Change history
+
+ 09.13.2018 SZ CSR 36407 Created based off Don{{{SINGLE-QUOTE}}}s MLM: SCH_Func_Create_Unsubmitted_Order.
+ This one is slightly modified to fit the needs for a pre-filled diagnostic/lab order.
+ Don{{{SINGLE-QUOTE}}}s version was for non-prefilled diagnostic/lab orders.
+
+ ;;
+ keywords: Called MLM, Generic, Create Order
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (visitGuid, userGuid, clientGuid, orderSessionType, orderSource, triggerObj, requested_date) := ARGUMENT;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+ user_IDType := "Edstan Number (physician)";
+
+ user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || userGUID
+ || " and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
+
+ location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || clientGUID};
+
+ TriggerObj_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM, placed on worksheet",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ ;;
+
+ priority: 50
+ ;;
+
+ evoke:
+ ;;
+ logic:
+
+
+ if called_by_editor
+ then
+ conclude false;
+ endif;
+
+ try
+
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+
+ if worksheetInfo is NULL OR "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String)
+ then
+ conclude false;
+ endif;
+
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ WSSessionType := orderSessionType;
+ WSSessionReason := "";
+ WSRequestedBySource := orderSource;
+ WSRequestedBy_obj := worksheetInfo.RequestedBy;
+ WSlocation_obj := worksheetInfo.ExpectedReleaseLocationGroup;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred:= true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+
+ // Dispose
+
+ if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif;
+ if( client_visit_obj is NOT NULL ) then void := call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if( WSRequestedBy_obj is NOT NULL ) then void := call WSRequestedBy_obj.Dispose; WSRequestedBy_obj:= null; endif;
+ if( WSlocation_obj is NOT NULL ) then void := call WSlocation_obj.Dispose; WSlocation_obj:= null; endif;
+
+ endcatch;
+
+ try
+
+ Catalog_Item_Name := triggerObj.item_name;
+ Catalog_Item_Modifier := triggerObj.item_modifier;
+ Catalog_Item_Version := triggerObj.item_version;
+ Order_Creation_Reason := "Protocol Order";
+
+ CatalogItem_obj := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName WITH ( Catalog_Item_Name as string ) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+
+ if ( triggerObj.order_type = "Diagnostic" ) then
+ DiagnosticOrder_obj := call worksheetInfo.CreateDiagnosticOrder WITH
+ CatalogItem_obj,
+ Catalog_Item_Modifier, // Name Modifier for prefill
+ Catalog_Item_Version, // Name modifier version for prefill
+ Order_Creation_Reason,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}},
+ false,
+ (Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}},
+ true;
+
+ if ( CatalogItem_obj IS NOT NULL ) then
+ void := call CatalogItem_obj.Dispose;
+ CatalogItem_obj := null;
+ endif;
+
+ RequestedTime_obj := new net_object "RequestedTime";
+ RequestedTime_obj.CodedTime := triggerObj.coded_time;
+
+ if ( triggerObj.coded_time <> "STAT" AND triggerObj.coded_time <> "AM Rounds" ) then
+ time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} WITH ( triggerObj.requested_time_hour as number ) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, ( triggerObj.requested_time_min as number ) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
+ RequestedTime_obj.Time := time_obj;
+ endif;
+
+ DiagnosticOrder_obj.RequestedTime := RequestedTime_obj;
+
+ /**** Date must be in ISO Format or in format of "T + 1" etc.
+
+ Active_SignificiantDtm := requested_date;
+
+ //Active_Significant := (Active_SignificiantDtm);
+ Active_Significant := (extract year Active_SignificiantDtm) formatted with "%04d" || "-" ||
+ (extract month Active_SignificiantDtm) formatted with "%02d" || "-" ||
+ (extract day Active_SignificiantDtm) formatted with "%02d";
+ */
+
+ // Remove time portion for the Requested Date
+ DiagnosticOrder_obj.RequestedDate := requested_date;
+
+
+
+ if ( count triggerObj.order_field_name > 0 ) then
+
+ for i IN 1 seqto ( count triggerObj.order_field_name ) do
+ diagField_obj := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} WITH
+ triggerObj.order_field_name[i], ( triggerObj.order_field_value[i] as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}} );
+ enddo;
+
+ endif;
+
+ void := call DiagnosticOrder_obj.Save;
+ void := call DiagnosticOrder_obj.Dispose;
+ endif;
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New " || triggerObj.order_type || " order :{{-R}}\n" || ex.Message || "\n\n";
+
+ // Dispose
+ if( CatalogItem_obj is NOT NULL ) then void := call CatalogItem_obj.Dispose; CatalogItem_obj := null; endif;
+ if( DiagnosticOrder_obj is NOT NULL ) then void := call DiagnosticOrder_obj.Dispose; DiagnosticOrder_obj:= null; endif;
+ TriggerObj_dest := null;
+
+ endcatch;
+
+ // Dispose
+ if( client_visit_obj is NOT NULL ) then void := call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif;
+
+
+
+ Conclude true ;
+
+
+ ;;
+ action:
+
+ if Error_occurred
+ then
+
+ write "An error has occurred in the MLM {{+B}}SCH_Func_Create_Unsubmitted_Order_Diagnostic_Prefilled{{-B}} " || "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error(s) " || "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+
+
+
+ if EXISTS TriggerObj_dest then write true at TriggerObj_dest; endif;
+
+ return Error_occurred;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATININE_CLEARANCE.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATININE_CLEARANCE.mlm
new file mode 100644
index 0000000..3c2c022
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATININE_CLEARANCE.mlm
@@ -0,0 +1,215 @@
+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:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_CUSTOM_MSGBOX.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CUSTOM_MSGBOX.mlm
new file mode 100644
index 0000000..fdc78c6
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_CUSTOM_MSGBOX.mlm
@@ -0,0 +1,151 @@
+maintenance:
+
+ title: SCH_FUNC_CUSTOM_MSGBOX;;
+ mlmname: SCH_FUNC_CUSTOM_MSGBOX;;
+ arden: version 2;;
+ version: 4.00;;
+ institution: St Clair Memorial Hospital;;
+ author: Shawn Head;;
+ specialist: ;;
+ date: 2016-09-06;;
+ validation: testing;;
+
+library:
+ purpose: This MLM calls an Objects+ DLL (Custom_MsgBox.dll)which can dislay a custom SCM message box
+ ;;
+ explanation:
+
+Change history
+
+ 09.06.2016 STH Created {Go-Live 10/4/2016}
+ 10.6.2018 STH CSR#: 36715 & 35594 - Updated Objects+ to allow for resizing of window, positioning of font, added extra box for "relevant information" associated with alert, buttons resize based on font, center alert
+ on the screen, removed the title bar/min,max,close buttons. {Go-Live 11/7/2018}
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+/* TO USE THIS MLM YOU CAN ADD THE CODE BELOW TO ANY OTHER MLM. THEN USING THE dlg_result YOU CAN LOOK AT WHICH BUTTON THE USER SELECTED
+ //THIS CODE SHOULD BE PLACED TOWARDS THE TOP OF THE MLM IN THE USER EDIT SECTIONS
+ Custom_Msg_Box := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_CUSTOM_MSGBOX{{{SINGLE-QUOTE}}};
+
+ AlertWindowHeight := "250"; //This will be the hight of the window. Minimum is 250.
+ AlertWindowWidth := "500"; //This will be the width of the window. Minimum is 480;
+
+ MsgBoxButtons := ();
+ MsgBoxButtons := ("THE BUTTONS WILL", "GROW IN SIZE","BASED","ON TEXT IN BUTTON"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
+ MsgBoxContent := "This will populate the primary message window on the alert.\n\nThe windows is set to automatically wordwrap so if you have a really long sentance or message it will automatically word wrap for you.\n\n"
+ || "There is no scoll bar so if your information spans further than the message box available it will get cut off and not be visual to the user."
+ || "you must adjust the window size to accomidate the information you want to present to the user";
+ MB_VAlign := "CENTER"; //Options are TOP, BOTTOM, CENTER. This will vertically align the text in the primary message box.
+ MB_HAlign := "CENTER"; //Options are LEFT, RIGHT, CENTER. This will horizontially align the message box textual content in the primary message box.
+
+ AdditionalInfoBox := "This is an additional info box. There are times where there is supporting evidence related to the message box being show. Sometimes this could be orders, results, demographics, etc...."
+ || "\n\nIn the event you want to use this additional window you can set the AdditionalInfoBox to have information and the window will be automatically sized to 35% of the window size"
+ || "******you can pass empty string if you dont need this box";
+ ADINFO_VAlign := "CENTER"; //Options are TOP, BOTTOM, CENTER. This will vertically align the text in the additional info message box.
+ ADINFO_HAlign := "CENTER"; //Options are LEFT, RIGHT, CENTER. This will horizontially align the message box textual content in the additional info message box.
+ //THIS CODE CAN BE ENTERED INTO THE MLM WHERE YOU EXPECT THE MESSAGE BOX TO APPEAR. WHAT EVER THE LABEL/TEXT OF THE BUTTON IS CLICKED WILL BE RETURNED
+ //TO THE dlb_result FOR YOU TO CODE YOU MLM BASED ON THE USERS SELECTION.
+ dlg_result := call Custom_Msg_Box with (AlertWindowHeight,AlertWindowWidth,MsgBoxContent,MB_VAlign,MB_HAlign,MsgBoxButtons,AdditionalInfoBox,ADINFO_VAlign,ADINFO_HAlign);
+*/
+ log_execution_info:=FALSE;
+ (MSG_BOX_HEIGHT, MSG_BOX_WIDTH, MSG_BOX_CONTENT, MSG_BOX_V_ALIGN, MSG_BOX_H_ALIGN, MSG_BOX_BUTTON_LABELS, MSG_BOX_ADDITIONAL_INFO, MSG_BOX_ADDITIONAL_INFO_V_ALIGN, MSG_BOX_ADDITIONAL_INFO_H_ALIGN) := ARGUMENT;
+// (MESSAGE_BOX_DETAILED_MSG, MSG_BOX_LABEL , MSG_BOX_BUTTON_LABELS, MSG_BOX_HEIGHT, MSG_BOX_WIDTH, RTF_MSG_BOX_HEIGHT) := ARGUMENT;
+ if (Called_By_Editor = true) then
+ triggerme := false;
+ listvalues := ();
+ listvalues := ("THE BUTTONS WILL GROWN IN SIZE", "BASED","ON THE TEXT INCLUDED IN" ,"THE BUTTON"); //THESE LIST ITEMS WILL BE PASSSED TO THE THE MESSAGE BOX BUTTON LABEL/TEXT/CAPTION AS THE SELECTABLE BUTTON VALUE. YOU CAN HAVE UP TO 4 BUTTONS.
+
+ MSG_BOX_CONTENT := "This will populate the primary message window on the alert.\n\nThe windows is set to automatically wordwrap so if you have a really long sentance or message it will automatically word wrap for you.\n\n"
+ || "There is no scoll bar so if your information spans further than the message box available it will get cut off and not be visual to the user."
+ || "you must adjust the window size to accomidate the information you want to present to the user";
+ MSG_BOX_V_ALIGN := "TOP"; //TOP, CENTER BOTTOM
+ MSG_BOX_H_ALIGN := "LEFT"; //LEFT, RIGHT OR CENTER
+
+ MSG_BOX_ADDITIONAL_INFO := "This is an additional info box. There are times where there is supporting evidence related to the message box being shown. Sometimes this could be orders, results, demographics, etc...."
+ || "\n\nIn the event you want to use this additional window you can set the AdditionalInfoBox to have information and the window will be automatically sized to 35% of the window size"
+ || "******you can pass empty string if you dont need this box";
+ MSG_BOX_ADDITIONAL_INFO_V_ALIGN := "TOP";
+ MSG_BOX_ADDITIONAL_INFO_H_ALIGN := "LEFT";
+
+ MSG_BOX_BUTTON_LABELS := "" || listvalues;
+ //MINIMUM HEIGHT IS 250 -- try 500 height to make this sample look better
+ MSG_BOX_HEIGHT := "250";
+ //MINIMUM WIDTH IS 480 -- try 1000 width to make this sample look better
+ MSG_BOX_WIDTH := "480";
+
+ else
+ triggerme := true;
+ MSG_BOX_LABEL := "" || MSG_BOX_LABEL;
+ MESSAGE_BOX_DETAILED_MSG := "" || MESSAGE_BOX_DETAILED_MSG;
+ MSG_BOX_BUTTON_LABELS := "" || MSG_BOX_BUTTON_LABELS;
+ MSG_BOX_HEIGHT := "" || MSG_BOX_HEIGHT;
+ MSG_BOX_WIDTH := "" || MSG_BOX_WIDTH;
+
+ MSG_BOX_CONTENT := "" || MSG_BOX_CONTENT;
+ MSG_BOX_V_ALIGN := "" || MSG_BOX_V_ALIGN; //TOP, CENTER BOTTOM
+ MSG_BOX_H_ALIGN := "" || MSG_BOX_H_ALIGN; //LEFT, RIGHT OR CENTER
+
+ MSG_BOX_ADDITIONAL_INFO := "" || MSG_BOX_ADDITIONAL_INFO;
+ MSG_BOX_ADDITIONAL_INFO_V_ALIGN := "" || MSG_BOX_ADDITIONAL_INFO_V_ALIGN;
+ MSG_BOX_ADDITIONAL_INFO_H_ALIGN := "" || MSG_BOX_ADDITIONAL_INFO_H_ALIGN;
+ endif;
+
+
+
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ using "Custom_MsgBox"; /* DLL Name */
+ using namespace "wpfMsgBox"; /* Do not understand purpose...DLL funcional even if this is misspelled */
+ /* Namespace.Form */
+ //test:= new net_object {{{SINGLE-QUOTE}}}wpfMsgBox_sth.MsgBox_Load{{{SINGLE-QUOTE}}} with (MSG_BOX_LABEL , MESSAGE_BOX_DETAILED_MSG , MSG_BOX_BUTTON_LABELS, MSG_BOX_HEIGHT, MSG_BOX_WIDTH,RTF_MSG_BOX_HEIGHT);
+ test:= new net_object {{{SINGLE-QUOTE}}}wpfMsgBox.MsgBox_Load{{{SINGLE-QUOTE}}} with (MSG_BOX_HEIGHT, MSG_BOX_WIDTH, MSG_BOX_CONTENT, MSG_BOX_V_ALIGN, MSG_BOX_H_ALIGN, MSG_BOX_BUTTON_LABELS, MSG_BOX_ADDITIONAL_INFO, MSG_BOX_ADDITIONAL_INFO_V_ALIGN, MSG_BOX_ADDITIONAL_INFO_H_ALIGN);
+ ;;
+ evoke: /* Call MLM */
+ ;;
+ logic:
+try
+ oeUnsigned:=CALL test.ShowDialog;
+ MsgBoxAnswer := test.MsgBoxSelected;
+
+
+
+endtry;
+catch exception ex
+
+ debugFlag := true;
+ messageText := messageText || "New General Order:\n" || ex.Message || "\n\n";
+endcatch;
+if(messagetext is null) then
+
+ conclude true;
+else
+ conclude false;
+endif;
+ /*
+ if (triggerme = true)
+ then
+ oeUnsigned:=CALL test.ShowDialog;
+ // oeUnsigned:=CALL test.Show;
+ conclude true;
+ else
+ conclude false;
+ endif;
+*/
+
+ ;;
+ action:
+
+return(MsgBoxAnswer);//all of the action is done by the call to the FFI
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_DCSUMMARY_PRINT.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_DCSUMMARY_PRINT.mlm
new file mode 100644
index 0000000..50e80e9
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_DCSUMMARY_PRINT.mlm
@@ -0,0 +1,238 @@
+maintenance:
+
+ title: SCH_FUNC_DCSUMMARY_PRINT;;
+ mlmname: SCH_FUNC_DCSUMMARY_PRINT;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Allscripts;;
+ author: Shawn Head;;
+ specialist: ;;
+ date: 2015-05-11;;
+ validation: testing;;
+
+library:
+ purpose: print electronic DC Summary document report from MLM
+
+ ;;
+ explanation: This called MLM uses ReportRequest class to print discharge summary document report.
+ It also set report{{{SINGLE-QUOTE}}}s parameter values and distribution information
+
+ Change history
+
+ 05.11.2015 STH CSR# 32070 go-live 6/9/2015 - Create electronic Discharge Summary report that will be sent to PDF, then converted to interface message
+(DEV) 7.7.2015 STH CSR#: 32070 - Testing for missing reports.
+
+ ;;
+ keywords:
+ Discharge Summary, Day of Discharge Note, DC Summary
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "SCMLib";
+ using "SCM.Common.Interfaces";
+ using namespace "SCMLib";
+ using namespace "SCM.Common.Interfaces";
+
+
+ (ClientGuid,ChartGuid,VisitGuid,DCSummary,DCSummaryGUID) := ARGUMENT;
+
+
+ (VisitID, MRN) := read last { " select visitidcode, idcode from cv3clientvisit with (nolock) "
+ || " where clientguid = " || sql(ClientGuid)
+ || " and chartguid = " || sql(ChartGuid)
+ || " and guid = " || sql(VisitGuid) };
+ ClientDocumentGUID := ();
+ if DCSummaryGUID is null then
+ ClientDocumentGUID := read
+ { " Select cd.guid from CV3ClientDocument cd with (nolock) "
+ || " WHERE cd.ClientGUID = " || sql(ClientGuid)
+ || " AND cd.ChartGUID = " || sql(ChartGuid)
+ || " AND cd.ClientVisitGUID = " || sql(VisitGuid)
+ || " and cd.DocumentName like " || sql(DCSummary)
+ || " and cd.IsCanceled = 0 "
+ || " and cd.Active = 1 "
+ || " and cd.guid not in (select FillerDocumentID from CV3ClientDocument cd2 with (nolock) "
+ || " where cd2.ClientGUID = cd.ClientGUID and cd2.ChartGUID = cd.ChartGUID and cd2.ClientVisitGUID = cd.ClientVisitGUID "
+ || " and cd2.documentname like {{{SINGLE-QUOTE}}}discharge summary%{{{SINGLE-QUOTE}}} and cd2.Active = 1 and cd2.IsCanceled = 0 and cast(isnull(cd2.FillerDocumentID,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as varchar) = cast(cd.guid as varchar) "
+ || " and cd2.AuthoredDtm = cast(convert(varchar(19),cd.touchedwhen,20) as datetime)) "};
+ else
+ ClientDocumentGUID := DCSummaryGUID;
+ endif;
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+
+ PhoneNumber := read last {" set concat_null_yields_null off select p.AreaCode + p.PhoneNumber from CV3User u with (nolock) join Cv3Phone p with (nolock) on p.PersonGUID = u.GUID " ||
+ " where u.displayname = {{{SINGLE-QUOTE}}}SCM, Text Messaging{{{SINGLE-QUOTE}}} and p.PhoneNote = {{{SINGLE-QUOTE}}}HIS Test{{{SINGLE-QUOTE}}}"};
+
+ abc123 := abc123 || "\n\n" || "PRODUCTION";
+
+ for x in (1 seqto count(ClientDocumentGUID)) do
+ CD_GUID := ClientDocumentGUID[x];
+
+
+ if (CD_GUID <> "" OR CD_GUID is not null)
+ then
+ try
+ abc123 := abc123 || "\n\n" || "Enter Try";
+
+
+
+
+ report_request_obj := call {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.ReportRequest{{{SINGLE-QUOTE}}}.CreateReportRequest with ("DischargeSummary_PDF" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
+ abc123 := abc123 || "\n\n" || "Created Report Object";
+ if (report_request_obj.Parameters is not null and report_request_obj.Parameters.Count > 0)
+ then
+ abc123 := abc123 || "\n\n" || "Entered If parameters exists section";
+ report_parameter_list := ();
+ for parameterIndex in (1 seqto report_request_obj.Parameters.Count)
+ do
+ abc123 := abc123 || "\n\n" || "Entered for parameterindex loop count #:" || parameterIndex;
+ report_parameter_list := report_parameter_list, report_request_obj.Parameters[parameterIndex];
+ enddo;
+ endif;
+ abc123 := abc123 || "\n\n" || "set report parameter list";
+ param_ClientDocGUID := first (report_parameter_list where report_parameter_list.Label = "varClientDocumentGUID");
+ param_ClientGUID:= first (report_parameter_list where report_parameter_list.Label = "varClientGUID");
+ param_ChartGUID := first(report_parameter_list where report_parameter_list.Label = "varClientChartGUID");
+ param_VisitGUID := first(report_parameter_list where report_parameter_list.Label = "varClientVisitGUID");
+ param_VisitID := first(report_parameter_list where report_parameter_list.Label = "varVisitID");
+ param_VisitMRN := first(report_parameter_list where report_parameter_list.Label = "varVisitMRN");
+ abc123 := abc123 || "\n\n" || "set report parameter values";
+
+ if param_VisitID.AllowModification then
+ void := call param_VisitID.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(VisitID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+ if param_VisitMRN.AllowModification then
+ void := call param_VisitMRN.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(MRN) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+
+ if param_ClientDocGUID.AllowModification then
+ void := call param_ClientDocGUID.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(CD_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+ if param_ClientGUID.AllowModification then
+ void := call param_ClientGUID.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(ClientGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+ if param_ChartGUID.AllowModification then
+ void := call param_ChartGUID.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(ChartGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+ if param_VisitGUID.AllowModification then
+ void := call param_VisitGUID.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(VisitGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+ abc123 := abc123 || "\n\n" || "check parameters for modify and set them to desired values";
+ report_request_obj.PrintPolicy := "Broadcast" as {{{SINGLE-QUOTE}}}PrintPolicy{{{SINGLE-QUOTE}}};
+ report_request_obj.ProcessReportLocally := false;
+ report_request_obj.PrintJobDestination := "PDFHL7";
+ reportRequest.PrintJobPriority := "Normal" as {{{SINGLE-QUOTE}}}PrintJobPriority{{{SINGLE-QUOTE}}};
+ report_request_obj.NumberOfCopies := 1;
+
+ abc123 := abc123 || "\n\n" || "set other report vales";
+ // print the report
+ void := call report_request_obj.Save;
+ abc123 := abc123 || "\n\n" || "save and print report";
+ // Call Dispose on report_request_obj to clean it up
+ if report_request_obj is not null
+ then
+ void := call report_request_obj.Dispose;
+ report_request_obj := null;
+ endif;
+
+ endtry;
+
+ catch exception ex
+ abc123 := abc123 || "\n\n" || "entered catch error exception";
+ error_occurred := true;
+ error_message := "{{+R}}Auto Print:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+ abc123 := abc123 || "\n\n" || error_message;
+ // Send a Text Message Section
+
+ // Call Dispose on report_request_obj to clean it up
+ if report_request_obj is not null
+ then
+ void := call report_request_obj.Dispose;
+ report_request_obj := null;
+ endif;
+
+ endcatch;
+
+ endif;
+ enddo;
+ // Send a Text Message Section
+
+
+ Page_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PAGE{{{SINGLE-QUOTE}}};
+ MessageSubject:= "Discharge Summary MLM Alert";
+ MessageBody := " ClientGUID: " || ClientGuid || "\n\n "
+ || "ChartGUID: " || ChartGuid || "\n\n "
+ || "ClientVisitGUID: " || VisitGuid || "\n\n"
+ || "DCSummaryGUID: " || DCSummaryGUID || "\n\n"
+ || "DCSummary: " || DCSummary
+ || "ClientDocGUID: " || ClientDocumentGUID || "\n\n"
+ || "cd_guid: " || CD_GUID || "\n\n"
+/*
+ || "param_VisitID: " || param_VisitID.Value || "\n\n"
+ || "param_ClientGUID " || param_ClientGUID.Value || "\n\n"
+ || "param_ChartGUID: " || param_ChartGUID.Value || "\n\n"
+ || "param_ClientDocGUID: " || param_ClientDocGUID.Value || "\n\n"
+ || "report_request_obj.Parameters: " || report_request_obj.Parameters
+*/
+ || "abc123: " || abc123;
+ if error_occurred then
+ void := call Page_MLM with(PhoneNumber, MessageSubject, MessageBody);
+ endif;
+
+ // Diagnostic Alert - Can be enabled if needed
+ // send_alert := "DoNotSend";
+ // alert_dest := destination { Alert: warning, "Informational", high, chart, "Informational", 15042, send_alert, "No Override Allowed" };
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+ if Error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}SCH_FUNC_DCSUMMARY_PRINT{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+ // Diagnostic Alert - Can be enabled if needed
+ // write " Messages " || " Execute the Called PRINT MLM - " || NOW || " " || ClientDocumentGUID at alert_dest;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_DCSUMMARY_PRINT_STHTESTING.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_DCSUMMARY_PRINT_STHTESTING.mlm
new file mode 100644
index 0000000..60ca2a3
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_DCSUMMARY_PRINT_STHTESTING.mlm
@@ -0,0 +1,329 @@
+maintenance:
+
+ title: SCH_FUNC_DCSUMMARY_PRINT_STHTESTING;;
+ mlmname: SCH_FUNC_DCSUMMARY_PRINT_STHTESTING;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: Allscripts;;
+ author: Shawn Head;;
+ specialist: ;;
+ date: 2015-05-11;;
+ validation: testing;;
+
+library:
+ purpose: print electronic DC Summary document report from MLM
+
+ ;;
+ explanation: This called MLM uses ReportRequest class to print discharge summary document report.
+ It also set report{{{SINGLE-QUOTE}}}s parameter values and distribution information
+
+ Change history
+
+ 05.11.2015 STH CSR# 32070 go-live 6/9/2015 - Create electronic Discharge Summary report that will be sent to PDF, then converted to interface message
+(DEV) 7.7.2015 STH CSR#: 32070 - Testing for missing reports.
+
+ ;;
+ keywords:
+ Discharge Summary, Day of Discharge Note, DC Summary
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ using "SCMLib";
+ using "SCM.Common.Interfaces";
+ using namespace "SCMLib";
+ using namespace "SCM.Common.Interfaces";
+
+
+ //(ClientGuid,ChartGuid,VisitGuid,DCSummary,DCSummaryGUID) := ARGUMENT;
+/*
+ clientguid := "20526020001";
+ chartguid := "9000443888100170";
+ visitguid := "9000443888100270";
+ DCSummaryGUID := null;
+ dcSummary := "Day of Discharge%";
+ (VisitID, MRN) := read last { " select visitidcode, idcode from cv3clientvisit with (nolock) "
+ || " where clientguid = " || sql(ClientGuid)
+ || " and chartguid = " || sql(ChartGuid)
+ || " and guid = " || sql(VisitGuid) };
+*/
+/*
+ (idcode,visitidcode,clientguid,chartguid,visitguid,ClientDocumentGUID) := read { "
+ select
+ cv.ClientGUID
+ ,cv.ChartGUID
+ ,cv.GUID as {{{SINGLE-QUOTE}}}cv_guid{{{SINGLE-QUOTE}}}
+ ,cv.ClientDisplayName
+ ,cv.IDCode
+ ,cv.VisitIDCode
+ ,cv.TypeCode
+ ,cv.AdmitDtm
+ ,cv.DischargeDtm
+ ,(select name from CV3Location where guid = cv.CurrentLocationGUID) as {{{SINGLE-QUOTE}}}UNIT{{{SINGLE-QUOTE}}}
+ ,cv.DischargeDisposition
+ ,(select dbo.SXACalculateAgeByDatePartsFN(c.BirthDayNum,c.BirthMonthNum,c.BirthYearNum,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}},isnull(cv.dischargedtm,cv.admitdtm))) as {{{SINGLE-QUOTE}}}age{{{SINGLE-QUOTE}}}
+ ,DateDiff(hh,cv.AdmitDtm, isnull(cv.dischargedtm,getdate())) as {{{SINGLE-QUOTE}}}LOS_HOURS{{{SINGLE-QUOTE}}}
+ ,cv.VisitStatus
+ into #tmp_cv
+ from CV3ClientVisit cv with (Nolock)
+ inner join CV3Client c with (Nolock)
+ on cv.ClientGUID = c.GUID
+ where
+ (typecode in ({{{SINGLE-QUOTE}}}INPATIENT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}OBSERVATION{{{SINGLE-QUOTE}}})
+ and VisitStatus in ({{{SINGLE-QUOTE}}}adm{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}dsc{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CLS{{{SINGLE-QUOTE}}})
+ and isnull(DischargeDtm,admitdtm) >= {{{SINGLE-QUOTE}}}2019-01-01 00:00:00.000{{{SINGLE-QUOTE}}}
+ and (DischargeDtm <= getdate()
+ or DischargeDtm is null))
+
+
+
+ select distinct
+ cv.*
+ ,cd.GUID as {{{SINGLE-QUOTE}}}cd_guid{{{SINGLE-QUOTE}}}
+ ,cd.Entered
+ ,cd.CreatedWhen
+ ,cd.tobesigned
+ ,cdh.historydtm
+ ,cdh.historyreason
+ ,cdh.historytype
+ ,cu.displayname
+ ,cd.DocumentName
+ into #tmp_documents
+ from #tmp_cv cv
+ left join cv3clientdocument as cd
+ on cv.clientguid = cd.clientguid
+ and cv.chartguid = cd.chartguid
+ and cv.cv_guid = cd.clientvisitguid
+ and cd.PatCareDocGUID = {{{SINGLE-QUOTE}}}5000001002202001{{{SINGLE-QUOTE}}}
+ and cd.IsCanceled = 0
+
+
+ left join cv3clientdochistory as cdh
+ on cd.clientguid = cdh.clientguid
+ and cd.guid = cdh.clientdocguid
+ and cdh.historyType = 1
+
+ left join cv3user as cu
+ on cd.authoredproviderguid= cu.guid
+
+ left join cv3patientcaredocument as pcd
+ on cd.patcaredocguid = pcd.guid
+ left join cv3organizationalunit as ou
+ on pcd.orgunitguid = ou.guid
+ where cd.ToBeSigned = 1
+ or cd.GUID is null
+
+
+ select convert(varchar(5),DateDiff(s, cv.DischargeDtm,getdate())/86400) as {{{SINGLE-QUOTE}}}DC_Days{{{SINGLE-QUOTE}}},
+ convert(varchar(5),DateDiff(s,cv.DischargeDtm, getdate())%86400/3600) as {{{SINGLE-QUOTE}}}DC_hours{{{SINGLE-QUOTE}}},
+ convert(varchar(5),DateDiff(s, cv.DischargeDtm,getdate())%3600/60) as {{{SINGLE-QUOTE}}}DC_minutes{{{SINGLE-QUOTE}}},
+ case when d.DocumentName is null then {{{SINGLE-QUOTE}}}MISSING{{{SINGLE-QUOTE}}}
+ else {{{SINGLE-QUOTE}}}ON CHART{{{SINGLE-QUOTE}}} END as{{{SINGLE-QUOTE}}}DischargeSummary{{{SINGLE-QUOTE}}}
+ ,case when cd.DocumentName is null then {{{SINGLE-QUOTE}}}NO{{{SINGLE-QUOTE}}}
+ else {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} end as {{{SINGLE-QUOTE}}}SCM_DC_NOTE_PRESENT{{{SINGLE-QUOTE}}}
+ ,d.ToBeSigned
+ ,d.CreatedWhen
+ ,CD.ENTERED
+ ,cd.guid
+ ,cv.*
+ into #tmp_final
+ from #tmp_documents d with (nolock)
+ left join CV3ClientDocument cd with (Nolock)
+ on d.ClientGUID = cd.ClientGUID
+ and d.ChartGUID = cd.ChartGUID
+ and d.cv_guid = cd.ClientVisitGUID
+ and cd.PatCareDocGUID = {{{SINGLE-QUOTE}}}9000001101102020{{{SINGLE-QUOTE}}}
+ INNER JOIN #tmp_cv CV
+ ON d.CLIENTGUID = CV.CLIENTGUID
+ AND D.CHARTGUID = CV.CHARTGUID
+ AND D.cv_guid = CV.cv_guid
+
+ select top 1
+ idcode
+ ,visitidcode
+ ,clientguid
+ ,ChartGUID
+ ,cv_guid
+ ,GUID
+ from #tmp_final
+ where SCM_DC_NOTE_PRESENT = {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}}
+ AND ToBeSigned IS NULL
+
+ DROP TABLE #tmp_final,#tmp_cv, #tmp_documents "};
+*/
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+ PhoneNumber := read last {" set concat_null_yields_null off select p.AreaCode + p.PhoneNumber from CV3User u with (nolock) join Cv3Phone p with (nolock) on p.PersonGUID = u.GUID " ||
+ " where u.displayname = {{{SINGLE-QUOTE}}}SCM, Text Messaging{{{SINGLE-QUOTE}}} and p.PhoneNote = {{{SINGLE-QUOTE}}}HIS Test{{{SINGLE-QUOTE}}}"};
+
+ abc123 := abc123 || "\n\n" || "PRODUCTION";
+
+ for x in (1 seqto count(ClientDocumentGUID)) do
+ CD_GUID := ClientDocumentGUID[x];
+ CV_GUID := VisitGUID[x];
+ C_GUID := ClientGUID[x];
+ CT_GUID := ChartGUID[x];
+ acct := VisitIDCode[x];
+ MRN := IDCode[x];
+
+
+ if (CD_GUID <> "" OR CD_GUID is not null)
+ then
+ try
+ abc123 := abc123 || "\n\n" || "Enter Try";
+
+
+
+
+ report_request_obj := call {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.ReportRequest{{{SINGLE-QUOTE}}}.CreateReportRequest with ("DischargeSummary_PDF" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
+ abc123 := abc123 || "\n\n" || "Created Report Object";
+ if (report_request_obj.Parameters is not null and report_request_obj.Parameters.Count > 0)
+ then
+ abc123 := abc123 || "\n\n" || "Entered If parameters exists section";
+ report_parameter_list := ();
+ for parameterIndex in (1 seqto report_request_obj.Parameters.Count)
+ do
+ abc123 := abc123 || "\n\n" || "Entered for parameterindex loop count #:" || parameterIndex;
+ report_parameter_list := report_parameter_list, report_request_obj.Parameters[parameterIndex];
+ enddo;
+ endif;
+ abc123 := abc123 || "\n\n" || "set report parameter list";
+ param_ClientDocGUID := first (report_parameter_list where report_parameter_list.Label = "varClientDocumentGUID");
+ param_ClientGUID:= first (report_parameter_list where report_parameter_list.Label = "varClientGUID");
+ param_ChartGUID := first(report_parameter_list where report_parameter_list.Label = "varClientChartGUID");
+ param_VisitGUID := first(report_parameter_list where report_parameter_list.Label = "varClientVisitGUID");
+ param_VisitID := first(report_parameter_list where report_parameter_list.Label = "varVisitID");
+ param_VisitMRN := first(report_parameter_list where report_parameter_list.Label = "varVisitMRN");
+ abc123 := abc123 || "\n\n" || "set report parameter values";
+
+ if param_VisitID.AllowModification then
+ void := call param_VisitID.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(acct) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+ if param_VisitMRN.AllowModification then
+ void := call param_VisitMRN.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(MRN) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+
+ if param_ClientDocGUID.AllowModification then
+ void := call param_ClientDocGUID.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(CD_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+ if param_ClientGUID.AllowModification then
+ void := call param_ClientGUID.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(C_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+ if param_ChartGUID.AllowModification then
+ void := call param_ChartGUID.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(CT_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+
+ if param_VisitGUID.AllowModification then
+ void := call param_VisitGUID.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(CV_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
+ endif;
+ abc123 := abc123 || "\n\n" || "check parameters for modify and set them to desired values";
+ report_request_obj.PrintPolicy := "Broadcast" as {{{SINGLE-QUOTE}}}PrintPolicy{{{SINGLE-QUOTE}}};
+ report_request_obj.ProcessReportLocally := false;
+ report_request_obj.PrintJobDestination := "PDFHL7";
+ reportRequest.PrintJobPriority := "Normal" as {{{SINGLE-QUOTE}}}PrintJobPriority{{{SINGLE-QUOTE}}};
+ report_request_obj.NumberOfCopies := 1;
+
+ abc123 := abc123 || "\n\n" || "set other report vales";
+ // print the report
+
+ void := call report_request_obj.Save;
+ abc123 := abc123 || "\n\n" || "save and print report";
+ // Call Dispose on report_request_obj to clean it up
+ if report_request_obj is not null
+ then
+ void := call report_request_obj.Dispose;
+ report_request_obj := null;
+ endif;
+
+ endtry;
+
+ catch exception ex
+ abc123 := abc123 || "\n\n" || "entered catch error exception";
+ error_occurred := true;
+ error_message := "{{+R}}Auto Print:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ // Send a Text Message Section
+
+ // Call Dispose on report_request_obj to clean it up
+ if report_request_obj is not null
+ then
+ void := call report_request_obj.Dispose;
+ report_request_obj := null;
+ endif;
+
+ endcatch;
+
+ endif;
+ enddo;
+ // Send a Text Message Section
+
+
+ Page_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PAGE{{{SINGLE-QUOTE}}};
+ MessageSubject:= "Discharge Summary MLM Alert";
+ MessageBody := " ClientGUID: " || ClientGuid || "\n\n "
+ || "ChartGUID: " || ChartGuid || "\n\n "
+ || "ClientVisitGUID: " || VisitGuid || "\n\n"
+ || "DCSummaryGUID: " || DCSummaryGUID || "\n\n"
+ || "DCSummary: " || DCSummary
+ || "ClientDocGUID: " || ClientDocumentGUID || "\n\n"
+ || "cd_guid: " || CD_GUID || "\n\n"
+ || "abc123: " || abc123;
+
+ if error_occurred then
+ void := call Page_MLM with(PhoneNumber, MessageSubject, MessageBody);
+ endif;
+
+ // Diagnostic Alert - Can be enabled if needed
+ // send_alert := "DoNotSend";
+ // alert_dest := destination { Alert: warning, "Informational", high, chart, "Informational", 15042, send_alert, "No Override Allowed" };
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+
+ if Error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}SCH_FUNC_DCSUMMARY_PRINT{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+ // Diagnostic Alert - Can be enabled if needed
+ // write " Messages " || " Execute the Called PRINT MLM - " || NOW || " " || ClientDocumentGUID at alert_dest;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_DISCONTINUE_BY_ORDERGUID.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_DISCONTINUE_BY_ORDERGUID.mlm
new file mode 100644
index 0000000..d44cbbe
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_DISCONTINUE_BY_ORDERGUID.mlm
@@ -0,0 +1,191 @@
+maintenance:
+
+ title: SCH_Func_Discontinue_By_OrderGuid;;
+ mlmname: SCH_Func_Discontinue_By_OrderGuid;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: ;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2017-10-23;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will auto discontinue an order as identified by the order guid
+ sent by the calling MLM
+ ;;
+ explanation:
+ 12.20.2017 TMS CSR# 35886 Created using SCH_Func_Discontinue_Order as a reference
+ ;;
+ keywords:
+ ;;
+ citations:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ using "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "ObjectsPlusXA.SCM";
+ using "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "SCMLib";
+
+ using namespace "System";
+ using namespace "System.Exception";
+ using namespace "System.Windows.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager";
+ using namespace "SCMLib.PObj";
+ using namespace "SCMLib.PObj.OrderPObj";
+ include standard_libs;
+
+ local_session := CDS_SESSION.local;
+ error_occurred := false;
+ error_message := "";
+
+
+ log_execution_info := false;
+ ( OrderGuid,
+ RequestedByGUID,
+ visitguid,
+ Reason,
+ Source
+
+ ) := argument;
+
+ MedicationOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM ",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2017 ];
+
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1008,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ If exist OrderGuid Then
+
+ location_guid := Read First {" Select CurrentLocationGUID from CV3ClientVisit Where GUID = " || visitGuid || " "} ;
+
+ order_Creation_Reason := "Created by MLM";
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1008,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+ // Common data
+ Try
+ // .Net version of Client Visit Object
+ ClientVisit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((RequestedByGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ error_occurred := false;
+ Endtry;
+
+ Catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+ If ClientVisit_obj IS NOT NULL then
+ void := call ClientVisit_obj.Dispose;
+ ClientVisit_obj := NULL;
+ Endif;
+ If RequestedBy_obj IS NOT NULL then
+ void := call RequestedBy_obj.Dispose;
+ RequestedBy_obj := NULL;
+ Endif;
+
+ Endcatch;
+
+
+ Try
+
+ RequestedBySource := Source;
+ OrderDiscontinuationReason := Reason;
+ order_obj := new net_object {{{SINGLE-QUOTE}}}SCMLib.PObj.OrderPObj{{{SINGLE-QUOTE}}} with OrderGuid;
+
+ order_obj.SuppressSignOnSubmit := true;
+ order_obj.ToBeSigned := false;
+
+ now_dtm := now + 1 minute;
+ date_str := ((extract year now_dtm) as string) || "-" ||
+ (extract month now_dtm) formatted with "%0.2d" || "-" ||
+ (extract day now_dtm) formatted with "%0.2d";
+ time_str := (extract hour now_dtm) formatted with "%0.2d" || ":" ||
+ (extract minute now_dtm) formatted with "%0.2d" || ":" ||
+ (extract second now_dtm) formatted with "%0.2d";
+
+ care_provider_guid_str :=(RequestedBy_obj.PrimaryKey as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) as string;
+
+ dc_order := call order_obj.Discontinue with OrderDiscontinuationReason,
+ date_str,
+ time_str,
+ RequestedBySource,
+ care_provider_guid_str;
+
+
+ Endtry;
+
+ Catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Discontinuing order:{{-R}}\n" || ex.Message || "\n\n";
+ DiscontinueOrder := True ;
+ EndCatch;
+
+ DiscontinueOrder := False ;
+
+ Endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+ ;;
+ action:
+
+ if error_occurred
+ then
+
+ write "An error has occurred in the MLM {{+B}}SCH_Func_Discontinue_By_OrderGuid{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error(s) " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+
+
+ if EXISTS MedicationOrder_dest then
+ write true at MedicationOrder_dest;
+ endif;
+
+ return error_occurred;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_DISCONTINUE_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_DISCONTINUE_ORDER.mlm
new file mode 100644
index 0000000..02b76ee
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_DISCONTINUE_ORDER.mlm
@@ -0,0 +1,157 @@
+maintenance:
+
+ title: SCH_FUNC_DISCONTINUE_ORDER;;
+ mlmname: SCH_FUNC_DISCONTINUE_ORDER;;
+ arden: version 2.5;;
+ version: 16.30;;
+ institution: ;;
+ author: Juliet M. Law;;
+ specialist: St. Clair Hospital;;
+ date: 2017-09-25;;
+ validation: testing;;
+
+library:
+ purpose: Discontinue an Order using the information passed from the calling MLM.
+ ;;
+ explanation: Called MLM that discontinues orders for a patient. Copied from SCH_FUNC_CREATE_ORDER MLM.
+
+ Change history
+
+ 09.25.2017 JML CSR# 26413 Created
+
+ ;;
+ keywords: Called MLM, Generic, Discontinue Order
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ (visitGUID, userGUID, orderGUID, orderDCReason) := ARGUMENT;
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ using "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "ObjectsPlusXA.SCM";
+ using "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
+ using "SCMLib";
+
+ using namespace "System";
+ using namespace "System.Exception";
+ using namespace "System.Windows.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager";
+ using namespace "SCMLib.PObj";
+ using namespace "SCMLib.PObj.OrderPObj";
+
+ include standard_libs;
+
+ error_occurred := false;
+ error_msg := "";
+
+ //Error Destination Object
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ user_IDType := "Edstan Number (physician)";
+
+ user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || SQL(userGUID)
+ || " and ProviderIDTypeCode = " || SQL(user_IDType) };
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ if called_by_editor then
+ conclude false;
+ endif;
+
+ try
+
+ ClientVisit_OBJ := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with (( visitGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+ RequestedBy_OBJ := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
+
+ endtry;
+
+ catch exception ex
+
+ error_occurred := true;
+ error_msg := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( ClientVisit_OBJ IS NOT NULL ) then
+ void := call ClientVisit_OBJ.Dispose;
+ ClientVisit_OBJ := null;
+ endif;
+ if ( RequestedBy_OBJ IS NOT NULL ) then
+ void := call RequestedBy_OBJ.Dispose;
+ RequestedBy_OBJ := null;
+ endif;
+ endcatch;
+
+ try
+
+ RequestedBySource := "Per Hospital Policy";
+ OrderDiscontinueReason := orderDCReason;
+
+ Order_OBJ := new net_object {{{SINGLE-QUOTE}}}SCMLib.PObj.OrderPObj{{{SINGLE-QUOTE}}} with orderGUID;
+
+ Order_OBJ.SuppressSignOnSubmit := true;
+ Order_OBJ.ToBeSigned := false;
+
+ now_dtm := now + 1 minute;
+ date_str := ( ( extract year now_dtm ) as string ) || "-"
+ || (extract month now_dtm ) formatted with "%0.2d" || "-"
+ || (extract day now_dtm ) formatted with "%0.2d";
+
+ time_str := ( extract hour now_dtm ) formatted with "%0.2d" || ":"
+ || ( extract minute now_dtm ) formatted with "%0.2d" || ":"
+ || ( extract second now_dtm ) formatted with "%0.2d";
+
+ careProviderGUID := ( RequestedBy_OBJ.PrimaryKey as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} ) as string;
+
+ dcOrder_OBJ := call Order_OBJ.Discontinue with OrderDiscontinueReason, date_str, time_str, RequestedBySource, careProviderGUID;
+
+ endtry;
+ catch exception ex
+
+ error_occurred := true;
+ error_msg := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+
+ endcatch;
+
+ //Dispose
+ if ( ClientVisit_OBJ IS NOT NULL ) then
+ void := call ClientVisit_OBJ.Dispose;
+ ClientVisit_OBJ := null;
+ endif;
+ if ( RequestedBy_OBJ IS NOT NULL ) then
+ void := call RequestedBy_OBJ.Dispose;
+ RequestedBy_OBJ := null;
+ endif;
+ Conclude true;
+ ;;
+ action:
+
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}}SCH_FUNC_DISCONTINUE_ORDER{{-B}} " || "Please notify your System Administrators that an error message has occurred " ||
+ "message: \n" at error_destination;
+ write error_msg at error_destination;
+ endif;
+
+ return error_occurred;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_MRSA_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_MRSA_ORDER.mlm
new file mode 100644
index 0000000..beb3651
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_MRSA_ORDER.mlm
@@ -0,0 +1,152 @@
+maintenance:
+
+ title: Called MLM that determines if an MRSA order is to be placed ;;
+ mlmname: SCH_Func_MRSA_Order;;
+ arden: version 4.5;;
+ version: 2.00;;
+ institution: St. Clair Hospital;;
+ author: ;;
+ specialist: ;;
+ date: 2010-12-16;;
+ validation: testing;;
+
+library:
+ purpose:
+ Called from the MRSA related MLM{{{SINGLE-QUOTE}}}s. It analyzes the patient{{{SINGLE-QUOTE}}}s record and returns data points.
+
+ ;;
+ explanation: This MLM was written to be called from ED Order Set MLMs, but can be called from others as well.
+
+ Change history
+
+ 12.16.2010 DW Created
+ 05.04.2011 DW Logic to obtain result value split from order retrieval. Sort added to both on significant
+ date and time.
+ 04.26.2011 TMS Moved fsl.value like {{{SINGLE-QUOTE}}}yes%{{{SINGLE-QUOTE}}} from left join statement down to where clause when retrieving NursingHome
+ info to only get last yes value. Added clientvisit to only use information from current visit for
+ Nursing Home info. HD Ticket 149146
+
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation) := ARGUMENT;
+
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+// Determine if Patient is on a Screening Unit
+
+Unit:= Substring (find "-" in string CurrentLocation)-1 CHARACTERS From CurrentLocation;
+If Unit in ("ICU","CVSU","IRU","5A","5E","6E","5G") then ScreeningUnit := "Yes"; else ScreeningUnit := "No"; endif;
+
+
+// Attain MRSA Order History
+
+/*
+(OrderName, SignificantDTM, StatusCode, ResultValue) := read last
+{"SELECT o.name, o.significantdtm, o.orderstatuscode, tol.text "
+|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
+|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
+|| " and o.orderstatuscode Not In ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}}) "
+|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
+|| " left join cv3BasicObservation bo with (nolock) on bo.OrderGuid = o.guid and bo.clientguid = " || SQL(clientguid) || " and bo.chartguid = " || SQL(chartguid) || " and bo.clientvisitguid = " || SQL(clientvisitguid)
+|| " and bo.itemname = {{{SINGLE-QUOTE}}}culture{{{SINGLE-QUOTE}}} "
+|| " left join cv3textualobservationline tol with (nolock) on tol.observationguid = bo.guid and tol.clientguid = " || SQL(clientguid) };
+*/
+
+(OrderName, SignificantDTM, StatusCode) := read last
+{"SELECT o.name, o.significantdtm, o.orderstatuscode "
+|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
+|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
+|| " and o.orderstatuscode Not In ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}}) "
+|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
+|| " order by o.significantdtm " };
+
+// Attain MRSA Result History
+
+(ResultValue) := read last
+{"SELECT tol.text "
+|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
+|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || SQL(clientguid) || " and o.chartguid = " || SQL(chartguid) || " and o.clientvisitguid = " || SQL(clientvisitguid)
+|| " and o.orderstatuscode In ({{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESC{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}RESI{{{SINGLE-QUOTE}}}) "
+|| " and o.name = {{{SINGLE-QUOTE}}}Nasal Screen for MRSA (Infection Control){{{SINGLE-QUOTE}}} "
+|| " left join cv3BasicObservation bo with (nolock) on bo.OrderGuid = o.guid and bo.clientguid = " || SQL(clientguid) || " and bo.chartguid = " || SQL(chartguid) || " and bo.clientvisitguid = " || SQL(clientvisitguid)
+|| " and bo.itemname = {{{SINGLE-QUOTE}}}culture{{{SINGLE-QUOTE}}} "
+|| " left join cv3textualobservationline tol with (nolock) on tol.observationguid = bo.guid and tol.clientguid = " || SQL(clientguid)
+|| " order by o.significantdtm " };
+
+
+// Attain MRSA Flag History
+
+
+(MRSAHist) := read last
+{ " select case when EnterpriseClientcol8 in ({{{SINGLE-QUOTE}}}MRSA{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Both{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} end "
+|| " from cv3enterpriseclientdata where clientguid = " || SQL(clientguid) || " " };
+
+
+ if exist MRSAHist then MRSAHistory := "Yes"; else MRSAHistory := "No"; endif;
+
+
+// Attain patient nursing home residency status from patient profile
+
+
+(NursingHome) := read last
+{"select fsl.value "
+|| " from CV3ClientDocument cd with (nolock) "
+|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || SQL(clientguid) || " and cdd.active = 1) "
+|| " left join CV3ObservationDocument od with (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
+|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID and ocmi.name in ({{{SINGLE-QUOTE}}}SCHCK_MRSA nursing home{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}sch_edtriage_arrive nrsg home{{{SINGLE-QUOTE}}}) "
+|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL(clientguid) || ") "
+|| " where cd.clientguid = " || SQL(clientguid) || " and cd.clientvisitguid = " || SQL(clientvisitguid)
+|| " and fsl.value like {{{SINGLE-QUOTE}}}yes%{{{SINGLE-QUOTE}}} "
+|| " and cd.documentname in ({{{SINGLE-QUOTE}}}ED Triage Note{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}adult patient profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}OB Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pediatric Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Test{{{SINGLE-QUOTE}}}) " };
+
+if exist NursingHome then NursingHomeResidency := "Yes"; else NursingHomeResidency := "No"; endif;
+
+
+// Attain anti-infective charting within past 7 days
+
+
+(AntiInfectivedate) := read last
+{"select oto.performedfromdtm "
+|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
+|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid and o.ClientGUID = " || SQL(clientguid) || " "
+|| " join cv3ordertask as 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 oto.taskstatuscode ={{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
+|| " where ocmi.therapeuticcategory like {{{SINGLE-QUOTE}}}anti-infectives%{{{SINGLE-QUOTE}}} "
+|| " order by oto.performedfromdtm " };
+
+ if (AntiInfectivedate as time) is within the past 7 days then AntiInfectivewithin7 := "Yes"; else AntiInfectivewithin7 := "No"; endif;
+
+
+
+// Value the MRSA Order Rules Flags
+
+ if (SignificantDTM as time) is within the past 24 hours then orderedtoday := "Yes"; else orderedtoday := "No"; endif;
+ if (SignificantDTM as time) is within the past 72 hours then orderedwithin3 := "Yes"; else orderedwithin3 := "No"; endif;
+ if ResultValue = "METHICILLIN RESISTANT STAPHYLOCOCCUS AUREUS" then positivescreen := "Yes"; else positivescreen := "No"; endif;
+
+
+ ;;
+ evoke: /* Call MLM */
+ ;;
+ logic:
+
+ conclude true;
+ ;;
+ action:
+
+return (ScreeningUnit, OrderedToday, OrderedWithin3, Positivescreen, SignificantDTM, StatusCode, ResultValue, MRSAHistory, NursingHomeResidency, AntiInfectivewithin7) ;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_OMP_DISCHARGE_MED_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_OMP_DISCHARGE_MED_ORDER.mlm
new file mode 100644
index 0000000..74f8b44
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_OMP_DISCHARGE_MED_ORDER.mlm
@@ -0,0 +1,138 @@
+maintenance:
+
+ title: ;;
+ mlmname: SCH_Func_OMP_Discharge_Med_Order;;
+ arden: version 2.5;;
+ version: 5.50;;
+ institution: ;;
+ author: Don Warnick ;;
+ specialist: ;;
+ date: 2011-06-09;;
+ validation: testing;;
+
+
+library:
+ purpose: Generate a Discharge Medication order at the time discharge
+ ;;
+ explanation: When a discharge occurs, an order is created for each therapeutic class of order found in in the patient{{{SINGLE-QUOTE}}}s
+ OMP. The therapeutic class associated with the order is found in the class type field of the UDDI.
+ Only UDDI{{{SINGLE-QUOTE}}}s with the name beginning with the letters "Dicharge Medications - "
+
+
+ Change history
+
+ 06.09.2011 DW Created
+ 07.24.2013 DW HD #159442 Filtered out all but the discharge omp meds and changed from a discharge to a standard session
+
+
+ ;;
+ keywords: OMP Discharge Orders, Meaningful Use
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ error_occurred := false;
+
+
+ (ClientVisitGuid, ChartGuid, ClientGuid, UserGUID, SpecialInstructions, ThisOrder_Name) := ARGUMENT;
+
+ send_alert := "DoNotSend";
+
+ alert_dest := destination { Alert: warning, "Discharge Medication Order", high, chart, "Discharge Medication Order", 15042, send_alert, "No Override Allowed" };
+
+
+ GeneralOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+
+ orderItemName := ThisOrder_Name;
+
+ IF exists orderItemName THEN
+
+ try
+
+ SessionType := "Standard";
+ SessionReason := "";
+ RequestingSource := "";
+ user_IDType := "Edstan Number (physician)";
+ order_Creation_Reason := "From Test MLM";
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ user_IDCode := read last {"SELECT IDCode FROM CV3User with (nolock) " || " where GUID = " || UserGUID};
+ RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
+ location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit with (nolock) where ClientGUID = " || ClientGUID};
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with orderItemName;
+
+
+ GeneralOrder_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ general_catalog_item, // CatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // CreateReason
+ RequestingCareProvider_obj, // RequestingProvider ObjectsPlus object
+ RequestingSource, // string requestingSource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj, // Location ReleaseLocGrpID
+ "Never" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
+ // Set standard fields on the order entry form
+ GeneralOrder_obj.RequestedDate := "T";
+ GeneralOrder_obj.SpecialInstructions := SpecialInstructions;
+ GeneralOrder_dest.ObjectsPlus := GeneralOrder_obj;
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ debugFlag := TRUE;
+ messageText := messageText || "New general order:\n" ||
+ ex.Message || "\n\n";
+
+ if ( general_catalog_item is NOT NULL ) then void:= call general_catalog_item.Dispose; general_catalog_item:= null; endif;
+ if ( GeneralOrder_obj is NOT NULL ) then void:= call GeneralOrder_obj.Dispose; GeneralOrder_obj:= null; endif;
+ GeneralOrder_dest := null;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
+ if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
+
+
+ ENDIF; // end of orderItemName
+
+
+ ;;
+ evoke:
+
+ ;;
+ logic:
+ Conclude true ;
+
+
+ ;;
+ action:
+
+
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}}SCH_Func_OMP_Discharge_Med_Order{{-B}} " ||
+ "Please notify your System Administrators that an error message has occurred " ||
+ "message: \n" at alert_dest;
+ write messageText at alert_dest;
+ endif;
+
+ if EXISTS GeneralOrder_dest then write true at GeneralOrder_dest; endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_PAGE.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_PAGE.mlm
new file mode 100644
index 0000000..0e59220
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_PAGE.mlm
@@ -0,0 +1,68 @@
+maintenance:
+
+ title: SCH_FUNC_PAGE;;
+ mlmname: SCH_FUNC_PAGE;;
+ arden: version 2;;
+ version: 4.00;;
+ institution: St Clair Memorial Hospital;;
+ author: Don Warnick;;
+ specialist: Don Warnick;;
+ date: 2014-12-01;;
+ validation: testing;;
+
+library:
+ purpose: This MLM calls an Objects+ DLL (SCMPage.DLL)which processes SCM paging requests
+ ;;
+ explanation:
+
+Change history
+
+ 12.01.2014 DW CSR# 32793 - Foreign Travel Alert (created this new generic alert to be used for future SCM text messaging processess)
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ log_execution_info:=FALSE;
+ if (Called_By_Editor = true) then triggerme := false; else triggerme := true; endif;
+
+ (PhoneNumber, MessageSubject, MessageBody) := ARGUMENT;
+
+ PhoneNumber := "" || PhoneNumber;
+ MessageSubject:= "" || MessageSubject;
+ MessageBody := "" || MessageBody;
+
+ using "SCMPage"; /* DLL Name */
+ using namespace "ResultsQuickViewerx"; /* Do not understand purpose...DLL funcional even if this is misspelled */
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ /* Namespace.Form */
+ test:= new net_object {{{SINGLE-QUOTE}}}SCMPageFromMLM.SCMPageForm{{{SINGLE-QUOTE}}} with (PhoneNumber , MessageSubject , MessageBody);
+
+ ;;
+ evoke: /* Call MLM */
+ ;;
+ logic:
+
+ if (triggerme = true)
+ then
+ oeUnsigned:=CALL test.ShowDialog;
+ // oeUnsigned:=CALL test.Show;
+ conclude true;
+ else
+ conclude false;
+ endif;
+
+
+ ;;
+ action: //all of the action is done by the call to the FFI
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_FUNC_PRINT.mlm b/MLMStripper/bin/Debug/SCH/SCH_FUNC_PRINT.mlm
new file mode 100644
index 0000000..d04db9f
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_FUNC_PRINT.mlm
@@ -0,0 +1,70 @@
+maintenance:
+
+ title: SCH_FUNC_PRINT;;
+ mlmname: SCH_FUNC_PRINT;;
+ arden: version 2;;
+ version: 4.00;;
+ institution: St Clair Memorial Hospital;;
+ author: Don Warnick;;
+ specialist: ;;
+ date: 2012-10-25;;
+ validation: testing;;
+
+library:
+ purpose: This MLM calls an Objects+ DLL (SCMPRINT.DLL)which processes SCM report requests
+ ;;
+ explanation:
+
+Change history
+
+ 10.25.2012 DW Created
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ log_execution_info:=FALSE;
+ if (Called_By_Editor = true) then triggerme := false; else triggerme := true; endif;
+
+ (reportname, logicalprinter, physicalprinter) := ARGUMENT;
+
+ reportname := "" || reportname;
+ logicalprinter := "" || logicalprinter;
+ physicalprinter:= "" || physicalprinter;
+
+ if physicalprinter <> "" then physicalprinter:= "\\sc1drp1\" || physicalprinter; endif;
+
+ using "SCMPrint"; /* DLL Name */
+ using namespace "ResultsQuickViewerx"; /* Do not understand purpose...DLL funcional even if this is misspelled */
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ /* Namespace.Form */
+ test:= new net_object {{{SINGLE-QUOTE}}}SCMPrintFromMLM.SCMPrintForm{{{SINGLE-QUOTE}}} with (reportname , logicalprinter , physicalprinter);
+
+ ;;
+ evoke: /* Call MLM */
+ ;;
+ logic:
+
+ if (triggerme = true)
+ then
+ oeUnsigned:=CALL test.ShowDialog;
+ // oeUnsigned:=CALL test.Show;
+ conclude true;
+ else
+ conclude false;
+ endif;
+
+
+ ;;
+ action: //all of the action is done by the call to the FFI
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_HALOPERIDOL_HELD_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_HALOPERIDOL_HELD_ORDERS.mlm
new file mode 100644
index 0000000..e32b593
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_HALOPERIDOL_HELD_ORDERS.mlm
@@ -0,0 +1,122 @@
+maintenance:
+
+ title: Check for Release of Haloperidol IV orders;;
+ filename: SCH_Haloperidol_Held_Orders;;
+ arden: version 5.5;;
+ version: 2.00;;
+ institution: St Clair;;
+ author: Teresa Spicuzza;;
+ specialist: Teresa Spicuzza;;
+ date: 2012-06-05;;
+ validation: testing;;
+
+library:
+ purpose: When releasing a held order for haloperidol IV, check to see if patient in monitored bed/unit, if not alert the user
+ ;;
+ explanation: Returns a message box to the user when a held order for haloperidol iv is released for a patient in a non-moitored bed.
+
+ change history
+
+ 06.05.2012 TMS Created CSR 30783 To Production on 9/25/2012
+
+ ;;
+ keywords: Release, hold, order, Haloperidol, monitored bed
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+ /* Set to true if logging is needed.*/
+ log_execution_info:= false;
+
+ // Set the text for this variable to indicate whether to send the message or not.
+ send_alert := "DoNotSend";
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+
+
+ MonitoredBed := ("03 CCU","06 SP/Monitored","02 ICU","14 CVSU", "04 IMC");
+
+ (ClientVisitGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus) := read last
+ {ClientVisit: GUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus };
+
+
+
+ // Get patient current accomodation
+ CurrentAccom := read last
+ {"Select ac.Code "
+ ||" From CV3ClientVisitLocation cvl"
+ ||" Join SXAAMAccommodation ac on ac.AccommodationID = cvl.AccommodationID "
+ ||" Where ClientGuid = " || SQL(ClientGuid)
+ ||" and ClientVisitGuid = " || SQL(ClientVisitGuid)
+ ||" and cvl.Status = {{{SINGLE-QUOTE}}}CUR{{{SINGLE-QUOTE}}}" };
+
+
+
+ /* Set EvokingObject in editor */
+ If called_by_editor then
+ EvokingObject := read last { Order: This };
+ endif;
+
+ /* Get Order data and pointer to MedicationExtension object */
+ (Order_Name, HaldolReason, MedicationExtension_obj) := read last
+ {Order: Name, SummaryLine, MedicationExtension
+ REFERENCING EvokingObject };
+
+ /* Get data from the MedicationExtension object */
+ (HaldolRoute) := read last
+ {MedicationExtension: OrderRouteCode
+ REFERENCING MedicationExtension_obj };
+
+
+
+
+//--------------------------------------------------------------------------
+// local_session := cds_session.local;
+//--------------------------------------------------------------------------
+
+
+ drug_alert:= destination {Alert} with
+ [alert_type := "Warning",
+ short_message := "Drug Requiring Monitoring",
+ Priority := "HIGH",
+ Scope := "chart",
+ Rule_group := "Monitored Meds",
+ rule_number := 18005,
+ send_with_order := send_alert,
+ display_alert := TRUE,
+ alert_dialog_settings := "No Override Allowed" ];
+
+
+
+
+
+ Release_Haldol_trigger:= event {OrderRelease User Order:
+ where TypeCode = "Medication"
+ and Name = "Haloperidol Inj" or Name = "Haloperidol:"};
+
+
+ ;;
+ evoke: Release_Haldol_trigger;
+ ;;
+ logic:
+
+ If CurrentAccom in MonitoredBed or HaldolReason matches pattern "%End of Life%" or HaldolRoute = "IM" then
+ conclude false; else conclude true;
+ endif;
+
+
+ ;;
+ action:
+
+
+ write "You are releasing a held order for Haloperidol (Haldol) by IV Push or IVPB. Only orders for {{{SINGLE-QUOTE}}}End of Life{{{SINGLE-QUOTE}}} care may administered in a non-monitored bed. \n\n {{+B}}Go Back:{{-B}} Select Go Back and Verify patient has correct accommodation code or Indication for order is {{{SINGLE-QUOTE}}}End of Life Agitation{{{SINGLE-QUOTE}}} or Clarify order with Physician. " at drug_alert;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_HALOPERIDOL_ORDER_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_HALOPERIDOL_ORDER_ALERT.mlm
new file mode 100644
index 0000000..23b0e15
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_HALOPERIDOL_ORDER_ALERT.mlm
@@ -0,0 +1,157 @@
+maintenance:
+
+ title: SCH_HALOPERIDOL_ORDER_ALERT;;
+ mlmname: SCH_HALOPERIDOL_ORDER_ALERT;;
+ arden: version 2.50;;
+ version: 15.1;;
+ institution: St. Clair Hospital;;
+ author: Bryan Berkeybile, Allscripts Corp;;
+ specialist: Bryan Berkeybile;;
+ date: 2016-04-28;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation: Fire an alert to nurses and unit secretaries (in addition to prescribers
+ and pharmacists) when haloperidol is ordered for a patient with a health issue/diagnosis of
+ Parkinson{{{SINGLE-QUOTE}}}s Disease.
+
+ Change History
+
+ 08.02.2016 BB CSR#34186 Created CSR# 34186
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ //Logging level of execution information
+ log_execution_info:=FALSE;
+
+ // Set the text for this variable to indicate whether to send the message or not.
+ send_alert := "DoNotSend";
+
+ //BB
+
+ soft_message := false;
+
+
+
+
+
+ //Set stop
+ sync_alert_dialog := "Must Comment";
+ hard_stop := false;
+ found_unsubmitted_orders := false;
+ existing_orders := ();
+ alert_priority := "HIGH";
+ include_generic_msg := true;
+ include_trans_msg := false;
+
+ //Destination Object Properties
+ alert_dialog := "Must Acknowledge";
+ alert_message := "";
+ alert_override_msg := "";
+ ok_to_show_aoa := false;
+
+ //BB
+
+
+ (ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID};
+ (UserGUID ) := read last { UserInfo: GUID };
+
+
+
+
+ HealthIssue := read last
+ {"SELECT cv.ClientGuid " //,cv.IDCode,cv.VisitIDCode "
+// || " ,chi.Code,hid.ShortName,chi.TypeCode ,hid.TypeCode "
+ || " FROM CV3ClientVisit cv "
+ || " JOIN CV3HealthIssueDeclaration hid ON hid.ClientVisitGUID = cv.GUID "
+ || " left JOIN CV3CodedHealthIssue chi ON hid.CodedHealthIssueGUID = chi.GUID "
+ || " WHERE hid.ShortName like {{{SINGLE-QUOTE}}}%park%{{{SINGLE-QUOTE}}} AND hid.active=1 "
+ || " AND cv.clientGuid = " || SQL(ClientGuid)
+ };
+
+
+ //endif;
+
+ If healthissue is null then
+ continue := "no";
+ else
+ continue := "yes";
+ endif;
+
+ if continue = "yes" then
+
+
+
+ // Use String parse
+ // str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; ???? BB
+
+ //The evoking event for this MLM is OrderInit
+ evoking_event_order:=EVENT {OrderInit User Order:
+ Where Name Matches Pattern "Haloperidol%" };
+
+ // BB Added 5/2/16 : Used for testing
+ Haloperidol_Order_Event := event{ OrderInit User Order :
+ WHERE Name = "Haloperidol 1mg Tab"};
+
+
+ // BB Added 5/2/16
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "Haloperidol Order Conflict",
+ priority := alert_priority,
+ scope := Chart,
+ rule_group := "Haloperidol Order Group",
+ rule_number := 9010,
+ send_with_order := send_alert,
+// alert_dialog_settings := alert_dialog,
+ alert_dialog_settings := sync_alert_dialog,
+ display_alert := true];
+
+
+
+//if ((EvokingEvent = Haloperidol_Order_event)) then
+ // existing
+ if ((EvokingEvent = Haloperidol_Order_event)) then
+ soft_message := true;
+ order_name := orderItem;
+ //alert_dialog := "No Override Allowed";
+ endif;
+
+
+
+
+
+ order_alert_dest.Priority := alert_priority;
+ order_alert_dest.Alert_Dialog_Settings := sync_alert_dialog; //was: alert_dialog;
+
+
+//if (stop_message) then
+ order_alert_message := "Haloperidol is CONTRAINDICATED in Parkinsons Disease since it may cause a worsening of the patient’s Parkinsons symptoms. Recommend Quetiapine 25mg PO, NOW and QHS";
+
+
+Endif;
+ ;;
+ evoke: evoking_event_order // or Haloperidol_Order_Event
+
+
+ ;;
+ logic:
+ if continue = "no"
+ then
+ conclude false;
+ else conclude true ;
+ endif;
+
+
+ ;;
+ action:
+ Write order_alert_message at order_alert_dest;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_HEPARIN_MAINT_NO_INITIAL.mlm b/MLMStripper/bin/Debug/SCH/SCH_HEPARIN_MAINT_NO_INITIAL.mlm
new file mode 100644
index 0000000..83b4e7d
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_HEPARIN_MAINT_NO_INITIAL.mlm
@@ -0,0 +1,177 @@
+maintenance:
+
+ title: SCH_HEPARIN_MAINT_NO_INITIAL;;
+ mlmname: SCH_HEPARIN_MAINT_NO_INITIAL;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Memorial Hospital;;
+ author: Robert Spence;;
+ specialist: Teresa Spicuzza Ext 7448 ;;
+ date: 2009-06-01;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation: Stop any heparin maintenance order without an initial
+ First uses order set check, then by the orderable if like ordersets not found
+ If list order set and orderables not found, alert will fire
+
+ Change history
+
+ 07.13.2009 RS Added secondary list, must be same size and order as primary
+ If orderset is not found this secondary list is used.
+ Different ordersets if you started in the ED then went to the floor.
+ 09.24.2015 TMS Added new Low Intensity Heparin Protocol (Initial and Maintenance) to the logic. CSR 33670
+
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ //Logging level of execution information
+ log_execution_info:=FALSE;
+
+
+
+ //The evoking event for this MLM is OrderInit
+ evoking_event_order:=EVENT{OrderSetInit User Order:
+ where OrderSetName is in ("Weight Based Heparin Protocol (Maint.)",
+ "Cardiac/CCM Heparin Protocol (Maint)",
+ "Post Op Vascular Heparin (Maintenance)",
+ "Low Intensity Heparin Protocol (Maint)" )};
+
+ order_alert:= destination { Alert: Warning, "Heparin Maintenace No Intial", high, chart,
+ "Heparin Maintenace No Intial", 9005};
+
+
+
+ (order_set_name,
+ client_guid,
+ chart_guid,
+ clientvisit_guid ) := read last
+ {OrderSet: OrderSetName, ClientGUID, ChartGUID, ClientVisitGUID
+ REFERENCING EvokingObject};
+
+ //Retrieves additional information from the first order
+
+
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ should_fire := false;
+ MessageText:= "You have selected the {{+B}}" || order_set_name ||
+ "{{-B}} Order Set which is to be used to adjust and maintain heparin therapy." ||
+ "\n\nPlease choose the ";
+
+
+ initial_of_maint_list :=
+ (
+ "Weight Based Heparin Protocol (Maint.)|Weight Based Heparin Protocol (Initial)"
+ ,"Cardiac/CCM Heparin Protocol (Maint)|Cardiac/CCM Heparin Protocol (Initial)"
+ ,"Post Op Vascular Heparin (Maintenance)|Post Op Vascular Heparin (Initial)"
+ ,"Low Intensity Heparin Protocol (Maint)|Low Intensity Heparin Protocol (Init)"
+ );
+
+
+ secondary_List :=
+ (
+ "Weight Based Heparin Protocol (Maint.)|({{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 500ml{{{SINGLE-QUOTE}}})"
+ ,"Cardiac/CCM Heparin Protocol (Maint)|({{{SINGLE-QUOTE}}}Heparin 25,000 Units+ D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units+ 0.9% NaCl 500ml{{{SINGLE-QUOTE}}})"
+ ,"Post Op Vascular Heparin (Maintenance)|({{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 500ml{{{SINGLE-QUOTE}}})"
+ ,"Low Intensity Heparin Protocol (Maint)|({{{SINGLE-QUOTE}}}Heparin 25,000 Units + D5W 500ml{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heparin 25,000 Units + 0.9% NaCl 500ml{{{SINGLE-QUOTE}}})"
+ );
+
+
+
+
+
+ found_set :=false;
+ breakloop := false;
+ counter := count initial_of_maint_list;
+
+ i := 0;
+
+ while (breakloop= false) do
+ i:=i+1;
+
+
+ if i = counter then
+ breakloop := true;
+ endif;
+
+ singleelement:= call str_parse with initial_of_maint_list[i], "|"; //makes string i in list into its own list
+ sing_orderset:= singleelement[1];
+
+ singorderelement := call str_parse with secondary_list[i],"|";
+
+
+ if (sing_orderset = order_set_name) then
+ /// see if there was an initial order on this account
+ match_ordeset := singleelement[2];
+
+ match_orderable :=singorderelement[2];
+
+ stringmatch := call str_parse with match_ordeset, "(";
+
+ MessageText:= MessageText || "{{+B}}" || stringmatch[1] || "{{+R}}(" || stringmatch[2] ||
+ "{{-B}}{{-R}} Order Set to begin therapy.";
+
+ initial_count := 0;
+ initial_count := read last {" select count(*) "
+ || " from cv3orderset as os with (nolock) "
+ || " where os.clientguid = " || SQL(client_guid)
+ || " and os.chartguid = " || SQL(chart_guid)
+ || " and os.clientvisitguid = " || SQL(clientvisit_guid)
+ || " and os.ordersetname = " || SQL(match_ordeset)
+ } ;
+
+ tsql:= "select count(*) "
+ || " from cv3orderset as os with (nolock) "
+ || " where os.clientguid = " || SQL(client_guid)
+ || " and os.chartguid = " || SQL(chart_guid)
+ || " and os.clientvisitguid = " || SQL(clientvisit_guid)
+ || " and os.ordersetname = " || SQL(match_ordeset);
+ breakloop := true;
+ if (initial_count > 0) then
+ found_set := true;
+ endif;
+
+ endif;
+ enddo;
+
+ secondarycheck := false;
+
+ if (found_set = false) and (exists match_orderable) and (order_set_name <> "Post Op Vascular Heparin (Maintenance)") then
+ // do secondary check
+ orderable_count := read last {" select count(*) "
+ || " from cv3order as o with (nolock) "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid)
+ || " and o.clientvisitguid = " || SQL(clientvisit_guid)
+ || " and o.name in " || match_orderable
+ || " and o.summaryline like {{{SINGLE-QUOTE}}}%initial%{{{SINGLE-QUOTE}}} "
+ } ;
+ if (orderable_count >0) then
+ secondarycheck := true;
+ endif;
+ endif;
+
+ if (found_set = false) and (secondarycheck = false) then
+ should_fire := true;
+ endif;
+
+
+ ;;
+ evoke: evoking_event_order
+ ;;
+ logic:
+
+ conclude should_fire ;
+ ;;
+ action:
+ Write MessageText at order_alert
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_HEPARIN_ORDERED_NON_ORDERSET.mlm b/MLMStripper/bin/Debug/SCH/SCH_HEPARIN_ORDERED_NON_ORDERSET.mlm
new file mode 100644
index 0000000..d47d7fa
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_HEPARIN_ORDERED_NON_ORDERSET.mlm
@@ -0,0 +1,68 @@
+maintenance:
+
+ title: Check If Heparin Ordered Without OrderSet;;
+ mlmname: SCH_HEPARIN_ORDERED_NON_ORDERSET;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: SCH ;;
+ author: Robert Spence Ext 7461;;
+ specialist: Teresa Spicuzza Ext 7448 ;;
+ date: 2009-05-12;;
+ validation: testing;;
+
+library:
+ purpose: Stop users from using reorder of this order. Should be ordered from the orderset.
+ ;;
+ explanation: Stop users from using reorder of this order. Should be ordered from the orderset.
+ ;;
+ keywords: Heparin, reorder, Order set only
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+
+ // Set the text for this variable to indicate whether to send the message or not.
+ send_alert := "DoNotSend";
+
+ order_evoke1:= EVENT {OrderInit User Order:
+ WHERE TypeCode = "Medication"
+ And Name Matches Pattern "Heparin 25,000%"};
+
+ order_evoke2:= EVENT {OrderEnter User Order:
+ WHERE TypeCode = "Medication"
+ And Name Matches Pattern "Heparin 25,000%"};
+
+
+
+ heparin_alert:= destination { Alert: warning, "Heparin Reordered", high, chart,
+ "Heparin Reordered", 14005, send_alert, "No Override Allowed" };
+
+
+ Hard_Stop := false;
+
+ (orderset_guid, order_name) := read last
+ { Order: OrderSetGUID, name
+ REFERENCING EvokingObject };
+
+ if exists(orderset_guid)
+ then
+ Hard_Stop := false;
+ else
+ Hard_Stop := true;
+ endif;
+ ;;
+ evoke: order_evoke1 or order_evoke2;
+ ;;
+ logic:
+ conclude Hard_Stop ;
+ ;;
+ action:
+
+ write "You have selected the {{+B}}{{+R}}Reorder{{-B}}{{-R}} function for the {{+B}}{{+R}}" || order_name ||
+ "{{-B}}{{-R}} order. " ||
+ " \n\nDosing maintenance and rate adjustment calculations can only be made " ||
+ "within the appropriate Heparin Maintenance order set as a {{+B}}{{+R}}new {{-B}}{{-R}}order." at heparin_alert;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_HEPATITIS_C_SCREEN_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_HEPATITIS_C_SCREEN_ALERT.mlm
new file mode 100644
index 0000000..bea1fd6
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_HEPATITIS_C_SCREEN_ALERT.mlm
@@ -0,0 +1,383 @@
+maintenance:
+
+ title: SCH_Hepatitis_C_Screen_Alert;;
+ mlmname: SCH_Hepatitis_C_Screen_Alert;;
+ arden: version 2.5;;
+ version: 5.50;; // FP1
+ institution: SCH ;;
+ author: SHAMI SHARMA ;;
+ specialist: ;;
+ date: 2017-12-27;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+ ;;
+ keywords: ObjectsPlus, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ Observation_Name_list := "SCH_Hep C _Hep Education","SCH_Hep C _Hep Verbalize understanding","SCH_Hep C_Have you had prior screening","SCH_Hep C_Patient born between 1945-1965","SCH_Hep C _Testing NEW";
+ log_execution_info := false;
+
+ hepC_alert_dest := destination {alert} with
+ [alert_type := "Warning",
+ short_message := " Hepatitis C Screening/Education Alert",
+ priority := "Low",
+ scope := "Chart",
+ rule_group := "Hepatitis C Screening",
+ rule_number := 4065,
+ send_with_order := send_alert,
+ alert_dialog_settings := "",
+ display_alert := true];
+
+
+ Document_Enter := event {ClientDocumentEnter User ClientDocument: where documentname in
+ ("Adult Patient Profile", "Adult Patient Profile - Observation", "Adult Patient Profile - Behavioral Health","2. Adult Assessment/Intervention")};
+ Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in
+ ("Adult Patient Profile", "Adult Patient Profile - Observation", "Adult Patient Profile - Behavioral Health","2. Adult Assessment/Intervention")};
+
+
+ (ClientDocument_GUID, ClientVisit_GUID, client_guid, Chart_GUID ,USER_GUID) := Read Last { ClientDocument: GUID, ClientVisitGUID, ClientGUID , ChartGUID, USERGUID REFERENCING EvokingObject };
+ (Client_Observation_Document_Obj, GUID,Document_Name):= read last { ClientDocument: ClientObservationDocument, GUID,DocumentName REFERENCING EvokingObject };
+
+ (Client_Observation_Obj_List) := read last{ ClientObservationDocument: ClientObservation REFERENCING Client_Observation_Document_Obj};
+
+ (case_participants_list ) := Client_Observation_Document_Obj.records__;
+
+
+ IF(EvokingEventType = "ClientDocumentEnter") THEN
+ Obs1 := False;
+ Obs2 := False;
+ Obs3 := False;
+ Obs4 := False;
+ Obs5 := False;
+ for i in 1 seqto count case_participants_list do
+
+ IF(case_participants_list.Name [i] = "SCH_Hep C _Hep Education") THEN
+ Obs1 := true;
+ ENDIF;
+ IF(case_participants_list.Name [i] ="SCH_Hep C _Hep Verbalize understanding") THEN
+ Obs2 := true;
+ ENDIF;
+ IF(case_participants_list.Name [i] = "SCH_Hep C_Have you had prior screening") THEN
+ Obs3 := true;
+ ENDIF;
+ IF(case_participants_list.Name [i] = "SCH_Hep C_Patient born between 1945-1965") THEN
+ Obs4 := true;
+ ENDIF;
+ IF(case_participants_list.Name [i] = "SCH_Hep C _Testing NEW") THEN
+ Obs5 := true;
+ ENDIF;
+
+
+
+ enddo;
+ ComponentCatalogGuidList := "";
+ ComponentCatalogGuid := "";
+ IF Obs1= FALSE THEN
+ IF ComponentCatalogGuidList = "" then
+ ComponentCatalogGuidList := ". Education Given" ;
+ ELSE
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Education Given" ;
+ ENDIF;
+ ENDIF;
+ IF Obs2= FALSE THEN
+ IF ComponentCatalogGuidList = "" then
+ ComponentCatalogGuidList := ". Patient/SO verbalized understanding" ;
+ ELSE
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient/SO verbalized understanding" ;
+ ENDIF;
+ ENDIF;
+ IF Obs3= FALSE THEN
+ IF ComponentCatalogGuidList = "" then
+ ComponentCatalogGuidList := ". Have you had prior Hepatitis C Screening" ;
+ ELSE
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Have you had prior Hepatitis C Screening" ;
+ ENDIF;
+ ENDIF;
+ IF Obs4= FALSE THEN
+ IF ComponentCatalogGuidList = "" then
+ ComponentCatalogGuidList := ". Patient born between 1945-1965" ;
+ ELSE
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient born between 1945-1965" ;
+ ENDIF;
+ ENDIF;
+ IF Obs5= FALSE THEN
+ IF ComponentCatalogGuidList = "" then
+ ComponentCatalogGuidList := ". Patient agrees to testing?" ;
+ ELSE
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient agrees to testing?" ;
+ ENDIF;
+ ENDIF;
+
+ (BornValue,BornObs, BornName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C_Patient born between 1945-1965")};
+ (PriorValue,PriorObs, PriorName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C_Have you had prior screening")};
+ (EduValue,EduObs, EduName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C _Hep Education")};
+ (VerbValue,VerbObs, VerbName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C _Hep Verbalize understanding")};
+ (TestValue,TestObs, TestName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C _Testing NEW")};
+ (OrderValue,OrderObs, OrderName) := read last{ ClientObservationDocument: ClientObservation,ObsFSListValues, Name REFERENCING Client_Observation_Document_Obj Where Name in ("SCH_Hep C Screening Order")};
+ Born_Value := BornObs.Value;
+
+ Prior_Value := PriorObs.Value;
+
+ Edu_Value := EduObs.Value;
+
+ Verb_Value := VerbObs.Value;
+
+ Test_Value := TestObs.Value;
+
+ Order_Value := OrderObs.Value;
+
+
+ ENDIF;
+
+ IF(EvokingEventType = "ClientDocumentModify") THEN
+
+ (Born_Value1) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
+ Where Name = "SCH_Hep C_Patient born between 1945-1965" };
+ Born_Value:=Born_Value1.Value;
+ IF Born_Value IS null then
+ Born_Value:= read last {"select top 1 OFLV.Value
+ FROM CV3CLientVisit cv (NoLock)
+ INNER JOIN CV3ClientDocument cd (nolock)
+ ON CV.GUID = CD.CLientVIsitGUID
+ AND CV.ChartGUID = CD.ChartGUID
+ AND CV.ClientGUID = CD.ClientGUID
+ AND cd.GUID = " || sql(ClientDocument_GUID) || "
+ AND cv.clientguid = " || sql(client_guid) || "
+ and cv.ChartGUID = " || sql(Chart_GUID ) || "
+ and cv.GUID = " || sql(ClientVisit_GUID) || "
+ ANd cd.Active = 1
+ AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
+ INNER JOIN CV3PatientCareDocument PCD (NoLock)
+ ON CD.PatCareDocGUID = PCD.GUID
+ AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}})
+ INNER JOIN CV3ObservationDocument obd (nolock) ON
+ cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
+ AND obd.ArcType = cd.ArcType
+ inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
+ AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C_Patient born between 1945-1965{{{SINGLE-QUOTE}}}
+ inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
+ AND OFLV.ClientGUID = cv.CLientGUID
+ AND OFLV.Active = 1
+ order by OFLV.CreatedWhen desc"};
+ endif;
+
+ (Prior_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
+ Where Name = "SCH_Hep C_Have you had prior screening" };
+ Prior_Value:=Prior_Value2.Value;
+ IF Prior_Value IS null then
+ Prior_Value:= read last {"select top 1 OFLV.Value
+ FROM CV3CLientVisit cv (NoLock)
+ INNER JOIN CV3ClientDocument cd (nolock)
+ ON CV.GUID = CD.CLientVIsitGUID
+ AND CV.ChartGUID = CD.ChartGUID
+ AND CV.ClientGUID = CD.ClientGUID
+ AND cd.GUID = " || sql(ClientDocument_GUID) || "
+ AND cv.clientguid = " || sql(client_guid) || "
+ and cv.ChartGUID = " || sql(Chart_GUID ) || "
+ and cv.GUID = " || sql(ClientVisit_GUID) || "
+ ANd cd.Active = 1
+ AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
+ INNER JOIN CV3PatientCareDocument PCD (NoLock)
+ ON CD.PatCareDocGUID = PCD.GUID
+ AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
+ INNER JOIN CV3ObservationDocument obd (nolock) ON
+ cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
+ AND obd.ArcType = cd.ArcType
+ inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
+ AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C_Have you had prior screening{{{SINGLE-QUOTE}}}
+ inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
+ AND OFLV.ClientGUID = cv.CLientGUID
+ AND OFLV.Active = 1
+ order by OFLV.CreatedWhen desc"};
+ endif;
+ (Edu_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
+ Where Name = "SCH_Hep C _Hep Education" };
+ Edu_Value:=Edu_Value2.Value;
+ IF Edu_Value IS null then
+ Edu_Value:= read last {"select top 1 OFLV.Value
+ FROM CV3CLientVisit cv (NoLock)
+ INNER JOIN CV3ClientDocument cd (nolock)
+ ON CV.GUID = CD.CLientVIsitGUID
+ AND CV.ChartGUID = CD.ChartGUID
+ AND CV.ClientGUID = CD.ClientGUID
+ AND cd.GUID = " || sql(ClientDocument_GUID) || "
+ AND cv.clientguid = " || sql(client_guid) || "
+ and cv.ChartGUID = " || sql(Chart_GUID ) || "
+ and cv.GUID = " || sql(ClientVisit_GUID) || "
+ ANd cd.Active = 1
+ AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
+ INNER JOIN CV3PatientCareDocument PCD (NoLock)
+ ON CD.PatCareDocGUID = PCD.GUID
+ AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
+ INNER JOIN CV3ObservationDocument obd (nolock) ON
+ cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
+ AND obd.ArcType = cd.ArcType
+ inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
+ AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C _Hep Education{{{SINGLE-QUOTE}}}
+ inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
+ AND OFLV.ClientGUID = cv.CLientGUID
+ AND OFLV.Active = 1
+ order by OFLV.CreatedWhen desc"};
+ endif;
+ (Verb_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
+ Where Name = "SCH_Hep C _Hep Verbalize understanding" };
+ Verb_Value:=Verb_Value2.Value;
+ IF Verb_Value IS null then
+ Verb_Value:= read last {"select top 1 OFLV.Value
+ FROM CV3CLientVisit cv (NoLock)
+ INNER JOIN CV3ClientDocument cd (nolock)
+ ON CV.GUID = CD.CLientVIsitGUID
+ AND CV.ChartGUID = CD.ChartGUID
+ AND CV.ClientGUID = CD.ClientGUID
+ AND cd.GUID = " || sql(ClientDocument_GUID) || "
+ AND cv.clientguid = " || sql(client_guid) || "
+ and cv.ChartGUID = " || sql(Chart_GUID ) || "
+ and cv.GUID = " || sql(ClientVisit_GUID) || "
+ ANd cd.Active = 1
+ AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
+ INNER JOIN CV3PatientCareDocument PCD (NoLock)
+ ON CD.PatCareDocGUID = PCD.GUID
+ AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
+ INNER JOIN CV3ObservationDocument obd (nolock) ON
+ cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
+ AND obd.ArcType = cd.ArcType
+ inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
+ AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C _Hep Verbalize understanding{{{SINGLE-QUOTE}}}
+ inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
+ AND OFLV.ClientGUID = cv.CLientGUID
+ AND OFLV.Active = 1
+ order by OFLV.CreatedWhen desc"};
+ endif;
+ (Test_Value2) := read Last {ClientObservationDocument : ObsFSListValues referencing Client_Observation_Document_Obj
+ Where Name = "SCH_Hep C _Testing NEW" };
+ Test_Value:=Test_Value2.Value;
+ IF Test_Value IS null then
+ Test_Value:= read last {"select top 1 OFLV.Value
+ FROM CV3CLientVisit cv (NoLock)
+ INNER JOIN CV3ClientDocument cd (nolock)
+ ON CV.GUID = CD.CLientVIsitGUID
+ AND CV.ChartGUID = CD.ChartGUID
+ AND CV.ClientGUID = CD.ClientGUID
+ AND cd.GUID = " || sql(ClientDocument_GUID) || "
+ AND cv.clientguid = " || sql(client_guid) || "
+ and cv.ChartGUID = " || sql(Chart_GUID ) || "
+ and cv.GUID = " || sql(ClientVisit_GUID) || "
+ ANd cd.Active = 1
+ AND cd.ArcType = CASE WHEN CV.ArcType = 99 THEN 0 ELSE CV.ArcType END
+ INNER JOIN CV3PatientCareDocument PCD (NoLock)
+ ON CD.PatCareDocGUID = PCD.GUID
+ AND PCD.Name in ({{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Adult Patient Profile - Behavioral Health{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}})
+ INNER JOIN CV3ObservationDocument obd (nolock) ON
+ cd.GUID = obd.OwnerGUID AND obd.Active = 1 AND obd.OwnerType = 2
+ AND obd.ArcType = cd.ArcType
+ inner JOIN CV3ObsCatalogMasterItem omi (nolock) ON obd.ObsMasterItemGUID = omi.GUID AND omi.Active=1
+ AND omi.Name = {{{SINGLE-QUOTE}}}SCH_Hep C _Testing NEW{{{SINGLE-QUOTE}}}
+ inner JOIN SCMObsFSListValues OFLV (nolock) ON ObD.ObservationDocumentGUID = OFLV.ParentGUID
+ AND OFLV.ClientGUID = cv.CLientGUID
+ AND OFLV.Active = 1
+ order by OFLV.CreatedWhen desc"};
+ endif;
+ ComponentCatalogGuidList := "";
+ ComponentCatalogGuid := "";
+ IF Edu_Value is NULL THEN
+ IF ComponentCatalogGuidList = "" then
+ ComponentCatalogGuidList := ". Education Given" ;
+ ELSE
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Education Given" ;
+ ENDIF;
+ ENDIF;
+ IF Verb_Value is NULL THEN
+ IF ComponentCatalogGuidList = "" then
+ ComponentCatalogGuidList := ". Patient/SO verbalized understanding" ;
+ ELSE
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient/SO verbalized understanding" ;
+ ENDIF;
+ ENDIF;
+ IF Prior_Value is NULL THEN
+ IF ComponentCatalogGuidList = "" then
+ ComponentCatalogGuidList := ". Have you had prior Hepatitis C Screening" ;
+ ELSE
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Have you had prior Hepatitis C Screening" ;
+ ENDIF;
+ ENDIF;
+ IF Born_Value is NULL THEN
+ IF ComponentCatalogGuidList = "" then
+ ComponentCatalogGuidList := ". Patient born between 1945-1965" ;
+ ELSE
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient born between 1945-1965" ;
+ ENDIF;
+ ENDIF;
+ IF Test_Value is NULL THEN
+ IF ComponentCatalogGuidList = "" then
+ ComponentCatalogGuidList := ". Patient agrees to testing?" ;
+ ELSE
+ ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient agrees to testing?" ;
+ ENDIF;
+ ENDIF;
+
+
+ ENDIF;
+
+ BornValue1 :="";
+ PriorValue1:="";
+
+ for i in 1 seqto count Born_Value do
+ BornValue1 := Born_Value [i];
+ Enddo;
+ for i in 1 seqto count Prior_Value do
+ PriorValue1 := Prior_Value[i];
+ Enddo;
+
+
+ IF( BornValue1 ="Yes") THEN
+
+ IF( PriorValue1= "No/Unknown" OR PriorValue1= "No") THEN
+ IF(NOT EXISTS Edu_Value OR NOT EXISTS Verb_Value OR NOT EXISTS Test_Value ) THEN
+ alert_message := "Hepatitis C Screening/Education Reminder. \n"
+ ||"You have not completed the Hep C Risk Assessment: \n"
+ ||"The following questions need addressed. \n"
+ || ComponentCatalogGuidList ||"\n" ;
+ //|| ComponentCatalogGuid ||"\n" ;
+
+
+ Result:= TRUE;
+ ENDIF;
+ ENDIF;
+
+ ENDIF;
+
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: Document_Enter;
+ Document_Modify;
+ ;;
+ logic:
+
+ conclude true;
+
+ ;;
+ action:
+
+ IF( Result = TRUE) THEN
+ write alert_message at hepC_alert_dest;
+ ENDIF;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_HM_MARK_AS_DONE.mlm b/MLMStripper/bin/Debug/SCH/SCH_HM_MARK_AS_DONE.mlm
new file mode 100644
index 0000000..27454e4
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_HM_MARK_AS_DONE.mlm
@@ -0,0 +1,1015 @@
+maintenance:
+
+ title: Health Management Mark as Done;;
+ mlmname: SCH_HM_MARK_AS_DONE;;
+ arden: version 2.5;;
+ version: 5.50;; //FP1
+ institution: AllScripts;;
+ author: Allscripts Healthcare Solutions, Inc;;
+ specialist: Shawn Head x7468;;
+ date: 2014-06-20;;
+ validation: testing;;
+
+library:
+ purpose: Updates immunization and wellness events in the Health Management system when matching
+ data is updated on the Patient{{{SINGLE-QUOTE}}}s record.
+ ;;
+ explanation: NOTE: This MLM has a dependent MLM that must be loaded for this functionality to
+ work.
+
+ STD_FUNC_HM_MARKASDONE.MLM
+
+ This MLM is triggered when:
+
+ (1) an order is completed
+ (2) a task occurrence is marked as done
+ (3) a flowsheet or structured note document is entered or modified
+ (4) a final result item is received
+
+ Ancillary Mapping
+ -------------------------
+
+ When triggered, this MLM will look up the Evoking Object{{{SINGLE-QUOTE}}}s Ancillary Name
+ using a specified site defined coding standard. This name matches an
+ event name in the Health Management Event Catalog. If the client is
+ on a schedule that contains this event a new client event occurrence
+ will be created and marked as done using information extracted from
+ the evoking object and any mapped user defined data item (UDDI) fields.
+ The coding standard this MLM uses is "HM Event" but it can be changed to
+ suit any needs.
+ When looking up the event, the flags recordOnlyIfPatientAssignedEvent and
+ recordOnlyIfEventActive are used to determine what actions are to be taken
+ when the event is found. See the descriptions of the flags below
+ for details.
+
+ Exclude Patient Types
+ -----------------------------
+
+ The MLM can be configured to exclude any patient types (i.e., Inpatient) from
+ executing this MLM. The list patientVisitTypeList should contain a list
+ of codes from the visit type dictionary that correspond to types that are
+ to be excluded. This feature is then turned on by setting the flag
+ limitPatientVisitTypes to be true. By default the flag is false so all
+ visit types are allowed.
+
+ Alert Output
+ ------------------
+
+ When the MLM is executed it can be configured to attach an alert to the patient
+ record on different conditions. The minimal setting is to never create an
+ alert regardless of the final outcome; the Health Management event might still
+ be marked as done but there will be no alert linked to that event.
+
+ The next level is to only alert if at least one of the Mark as Done attempts
+ generates an error condition. Note, if the evoking object is mapped to several
+ events and only one generates an error, the alert will contain the successful
+ messages as well.
+
+ The third level is to alert on success and any failures.
+
+ The final level will alert on all attempts as long as the evoking object has
+ a mapped ancillary code. For example, this will generate alerts for order
+ items that are mapped to an event but the patient doesn{{{SINGLE-QUOTE}}}t have a schedule with
+ those events.
+
+ Creating a Health Management Immunization/Wellness Event
+ -----------------------------------------------------------------
+
+ In the Health Management system, Immunization and Wellness events have several properties
+ that can be set based on the data extracted from the evoking trigger event. This MLM
+ attempts to demonstrate how to extract a subset of this data from different sources.
+ There are 5 arden objects defined in this MLM that can be filled in and then passed to the
+ STD_FUNC_HM_MARKASDONE mlm; depending on the event type some of these objects are mandatory.
+
+ EventOccurrenceDef
+ This object defines the core details of an Immunization and Wellness event and is
+ required. The fields, eventName, actionDate and actionProviderId are manditory.
+
+ eventName
+ The name of the event as defined in HM Catalogs/Event and mapped via the
+ ancillary code.
+
+ actionDate
+ The date the event occurs.
+
+ actionProviderId
+ The ID of the person performing the event. This value depends on the evoking
+ object.
+ Order = CareProviderGUID
+ OrderTaskOccurrence = PerformedProviderGUID
+ ClientDocument = AuthoredProviderGUID
+ BasicObservation = actionProviderGUID
+
+ actionProviderDisplayName
+ The display name of the above user. If not set the STD_FUNC_MARKASDONE mlm
+ will retrieve it from the database based on the value of the ID.
+
+ Comment
+ The comment for the event occurrence.
+
+ SiteGivenCode
+ A code indicating where the event was given to the client. Only required
+ for events where this is used.
+
+ RouteCode
+ The route the event was administered. Only required for events where this
+ is used.
+
+ IsPartialDose
+ If true then the event occurrence was only partially completed.
+
+ ConsentDocumentDef
+ This object defines the consent document for both an immunization and wellness event.
+ It is not required if there is no consent information.
+
+ TypeCode
+ The consent type. Not mandatory but mapped to the HM Dictionary
+ "Consent Type".
+
+ ConsentDate
+ The date consent was given.
+
+ ConsentTime
+ The time consent was given. NOTE: Not supported at this time
+
+ ConsentBy
+ The name of the person giving consent.
+
+ RelationshipCode
+ The relationship of the person giving consent to the client.
+
+ DocumentType
+ The document type. 0 = consent, 1 = Exemption
+
+ EducationalMaterialsDef
+ This object defines the educational material for both an immunization and wellness event.
+ It is not required, however if used then the TypeCode must be included.
+
+ TypeCode
+ The educational material type code, must contain a value from the
+ HM Dictionary "Educational Material Type".
+
+ IsVis
+ Set to 1 if the document is a Vaccine Information Sheet.
+
+ PublishedDate
+ The date the document was published.
+
+ PresentedDate
+ The date the document was presented to the client.
+
+ ImmunizationDef
+ This object defines information only for an Immunization event. It must be include when
+ the mapped event is an immunization (ie MMR).
+
+ VaccineName
+ CVXCode
+ The name of the vaccine or CVX code. Only set one of these values, not both.
+
+ VaccineProductCode
+ The vaccine product code
+
+ VaccineManufacturerMVXCode
+ VaccineManufacturer
+ Information about the vaccine{{{SINGLE-QUOTE}}}s manufacturer. If MVX code is used then it must
+ contain a value from the HM Dictionary "Vaccine Manufacturer". If the MVX code
+ is not known then a name can be entered into VaccineManufacturer. Only one of these
+ two fields should be set.
+
+ VaccineBrandName
+ The brand name of the vaccine.
+
+ VaccineEligibilityCode
+ The vaccine eligibility code, if set then the value must come from the HM
+ Dictionary "Vaccine Eligibility code".
+
+
+ VaccineMedicationLotDef
+ This object defines information only for an Immunization event. Must be used when dose
+ and lot information is part of the vaccine.
+
+ LotNumber
+ The lot number of the vaccine
+
+ LotSourceCode
+ The source code for the vaccine. Must be mapped to values from the HM Dictionary
+ "Vaccine Lot Source".
+
+ LotExpirationDate
+ The date the lot expires.
+
+ LotDoseAmount
+ The amount of vaccine given to the patient.
+
+ LotDoseUom
+ The unit of measure for the current dose.
+
+ RemovedFromStorageDate
+ The date the vaccine was removed from storage.
+
+ LotWasteAmount
+ LotWasteUom
+ If any vaccine was wasted.
+
+
+ Order Complete
+ -------------------
+
+ This MLM will trigger on the event OrderComplete and will attempt
+ to find and mark as done a mapped wellness event.
+
+ The MLM extracts event data from the evoking object including
+ the actionDate from either the SignificantDtm or StopDtm and the
+ actionProviderId from the CareProviderGUID.
+
+ It will then try and create an educational Material object from
+ several UDDI field that were mapped when the order was first created.
+
+ It then finds the ancillary code for the HM Event and when found
+ calls the function MLM STD_FUNC_HM_MARKASDONE passing in all the
+ information it was able to gather.
+
+
+ Task Occurrence, Mark as Done
+ -------------------------------------
+
+ The MLM will trigger on OrderTaskOccurrence Modify when the TaskStatusCode
+ is changed from "Pending" to "Performed". It will attempt to find and
+ mark as done a mapped immunization event.
+
+ It extracts event data from the evoking object including the
+ actionDate from the PerformedFromDtm or PeformedToDtm and the actionProviderId
+ from the PeformedProviderGUID.
+
+ Other event occurrence fields are extracted from the evoking object.
+
+ To obtain vaccine information, UDDI fields extracted from the userDataList object
+ are checked. These include the vaccine name or CVX code, lot number and expire date.
+ Not all fields are mapped only a few to give an idea how it can be done.
+
+ It then finds the ancillary code for the HM Event and when found
+ calls the function MLM STD_FUNC_HM_MARKASDONE passing in all the
+ information is was able to gather.
+
+
+ Client Document, Enter or Modify
+ ----------------------------------------
+
+ This MLM will trigger on ClientDocumentEnter or ClientDocumentModify and will
+ attempt to find and mark as done a mapped Wellness event.
+
+ This portion of the MLM runs in two stages. The first checks to see if the
+ document itself has an ancillary mapping and extracts data from the evoking
+ object for the actionDate and actionProviderId.
+
+ The second stage does the same thing again but this time for any observation
+ that is linked as would be the case for a flowsheet or structured note. Again
+ information for the actionDate and providerId is extracted from these objects
+ and if the event is found to be mapped via an ancillary code the Mark as done
+ MLM is called.
+
+
+ Basic Observation(Result) Enter
+ --------------------------------------------
+
+ This MLM will trigger when a result item is received via the front end or interfaces.
+ It will attempt to find and mark as done a mapped wellness event.
+
+ The MLM extracts event data from the evoking object including
+ the actionDate from either Entered date and the actionProviderId from either
+ the parent orders{{{SINGLE-QUOTE}}}s careProviderGUID, UserGUID or if all else fails
+ the current logged on user.
+
+ It then finds the ancillary code for the HM Event and when found
+ calls the function MLM STD_FUNC_HM_MARKASDONE passing in all the
+ information it was able to gather.
+
+ 053113 - ALlscripts - updated to work with CH task form configuration
+ 062613 - Allscripts _added sql to get MVX code
+ 071213 - Allscripts - moved from Test into PROD
+ 062014 - Shawn Head - Modified and updated for use at St. Clair hospital for MU2.
+ 07.21.2015 - Shawn Head - 15.1 upgrade required update to pass additional arguement to the standard MLM STD_FUNC_HM_MARK_AS_DONE
+ 12.16.2015 - CSR #:33655 - Update for Prevnar 13 {Loaded 1.13.2016 ahead of the target go-live date of the product being available}
+ 11.09.2016 - BBerkeybile Ticket#2429879 - Update manufacturer user data code to include new Vaccine Manucafturer Flu.
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ mlmStatus := 0;
+ finalOutputMessage := "";
+ finalMlmStatus := 0;
+ updateDatabase := true;
+ MarkAsDone_MLM := MLM {{{SINGLE-QUOTE}}}STD_FUNC_HM_MARKASDONE{{{SINGLE-QUOTE}}};
+ eventOccurrenceFound := false;
+
+ // -----------------------------------------------------------------
+ // Site defined fields
+ // -----------------------------------------------------------------
+
+ log_execution_info := false;
+
+ // The coding standard used by the item catalog to map an item to a
+ // Health Management Event. [STH 6-20-2014] Added HM CVXCode to also be pulled from the
+ // task coding standard.
+ CodingStandard := "HM Event";
+ CodingCVXCode := "HM CVXCode";
+
+ // Display an alert depending on the status returned by the function MLM
+ // 1 = Alert on all messages including not found on schedule, successful mark as done
+ // and failure
+ // 2 = Alert if either a failure or successful mark as done occurs
+ // 3 = Alert if a failure occurs
+ // 4 = Never show an alert
+ AllowAlertOnStatusLevel := 3; // show alljust for testing - change back later
+
+ // If set to true then when an alert is displayed it will contain a listing
+ // of the objects passed to the Mark as Done function MLM. Should only be
+ // set to true during the testing of the MLM.
+ writeObjectDetails := false; //false;
+
+ // If set to true then the MLM will be limited to only run for the visit types
+ // NOT specified in patientVisitTypeList
+ limitPatientVisitTypes := false;
+
+ // The list of all possible visit types that will cause the MLM NOT to run.
+ // The values are found in the Client Info/Visit Type dictionary.
+ patientVisitTypeList := ( "Inpatient" );
+
+ // The following 2 flags determine when a record will get record to
+ // the database based on the status of the client event and if it
+ // must already be assigned first.
+
+ // If set to true then the client event must be active.
+ // Note: This flag can be reset based on business rules later in the MLM.
+ recordOnlyIfEventActive := true;
+
+ // If set to true then the mapped Event must be assigned to the patient;
+ // Active or Inactive depending on the flag recordOnlyIfEventActive.
+ // If false then the event will be added to the client regardless. The state of the
+ // flag recordOnlyIfEventActive will not be considered.
+ // Note: This flag can be reset based on business rules later in the MLM.
+ recordOnlyIfPatientAssignedEvent := false; //true;
+
+ // --------------------------------------------------------------------------
+ // The 5 object types that can be used to define a single wellness
+ // or immunization event.
+ // ** Do not make any changes to the object definitions. **
+ // --------------------------------------------------------------------------
+ EventOccurrenceDef := object
+ [
+ eventName,
+ actionDate,
+ actionProviderId,
+ actionProviderDisplayName,
+ Comment,
+ SiteGivenCode,
+ RouteCode,
+ IsPartialDose
+
+ ];
+
+ ImmunizationDef := object
+ [
+ VaccineName,
+ CVXCode,
+ VaccineProductCode,
+ VaccineManufacturerMVXCode,
+ VaccineManufacturer,
+ VaccineBrandName,
+ VaccineEligibilityCode
+ ];
+
+ VaccineMedicationLotDef := object
+ [
+ LotNumber,
+ LotSourceCode,
+ LotExpirationDate,
+ LotDoseAmount,
+ LotDoseUom,
+ RemovedFromStorageDate,
+ LotWasteAmount,
+ LotWasteUom
+ ];
+
+ ConsentDocumentDef := object
+ [
+ TypeCode,
+ ConsentDate,
+ ConsentTime,
+ ConsentBy,
+ RelationshipCode,
+ DocumentType // Consent=0, Exemption=1
+ ];
+
+ EducationalMaterialsDef := object
+ [
+ TypeCode,
+ IsVis,
+ PublishedDate,
+ PresentedDate
+ ];
+
+ // Initialize to Null
+ EventOccurrenceObj := null;
+ ImmunizationObj := null;
+ ConsentDocumentObj := null;
+ EducationalMaterialsObj := null;
+ VaccineMedicationLotObj := null;
+
+ if called_by_editor
+ then
+ // Only set to true when testing the logic of the MLMs
+ // from the editor. All logic is performed except the final
+ // mark as done code is skipped.
+ updateDatabase := false;
+
+ // Choices are "order", "orderTaskOccurrence", "observation", and "clientDocument"
+ // Specify which object you want to retrieve by customizing the WHERE clause of each
+ // READ statement.
+ objectChoice := "OrderTaskOccurrence";
+
+ if objectChoice = "Order"
+ then
+ EvokingObject := read last { order: this WHERE Name = "Blood Pressure" AND OrderStatusCode="COMP" };
+ elseif objectChoice = "OrderTaskOccurrence"
+ then
+ EvokingObject := read last { OrderTaskOccurrence: this WHERE TaskName MATCHES PATTERN "%influenza%" and TaskStatusCode="Performed" };
+ elseif objectChoice = "Observation"
+ then
+ EvokingObject := read last { Observation: this WHERE ItemName="BUN" AND Status="F" };
+ elseif objectChoice = "ClientDocument"
+ then
+ EvokingObject := read last { ClientDocument: this WHERE DocumentName="HM Notes Document" };
+ endif;
+ endif;
+
+ // -----------------------------------------------------------------
+ // Trigger Event Statements
+ // -----------------------------------------------------------------
+
+ // Order Complete Trigger
+ // To improve performance add a WHERE clause to filter on specific order name(s).
+ // ie:
+ // WHERE Name IN ("Blood Pressure Check", "Bone Density Test")
+
+ /* //NOT USING CURRENTLY
+ order_complete_event := EVENT { OrderComplete Any Order: where Backup.OrderStatusLevelNum < 100 };
+ */
+
+ // Order Task Occurrence Modify (Mark task as Done)
+ // Do not change the check of the TaskStatusCodes.
+ // To improve performance add to the where clause to filter on specific TaskNames
+ // ie:
+ // AND TaskName in ("Measles Immunization", "Mumps Immunization")
+ taskOcc_modify_event := EVENT { OrderTaskOccurrenceModify Any OrderTaskOccurrence:
+ WHERE (THIS.TaskStatusCode="Performed"
+ AND Backup.TaskStatusCode <> "Performed")
+ AND ( TaskName MATCHES PATTERN "Pneumococcal Vaccine Inj%"
+ OR TaskName MATCHES PATTERN "Influenza Virus Vaccine%"
+ OR TaskName MATCHES PATTERN "Influenza Virus Trivalent Vaccine%"
+ OR TaskName MATCHES PATTERN "Pneumococcal 13-Valent Vaccine Inj%")
+ };
+
+
+// AND Backup.TaskStatusCode <> "Performed"
+
+
+ // Result enter trigger
+ // To improve performance add conditions to the WHERE clause to filter on
+ // specific result item name(s)
+ // ie:
+ // AND ItemName in ("RBC", "HEMO")
+ /* //NOT USING CURRENTLY
+ observation_enter_event := EVENT { ObservationEnter ANY Observation:
+ WHERE PerformedDtm is not null AND
+ Status = "F" };
+ */
+
+ // Client Document enter and modify triggers
+ // To improve performance add a where clause to filter on
+ // specific document name(s).
+ // ie:
+ // AND DocumentName in ("Adult Wellness", "Child Wellness")
+
+ /* //NOT USING CURRENTLY
+ client_document_enter_event := EVENT { ClientDocumentEnter USER ClientDocument };
+ client_document_modify_event := EVENT { ClientDocumentModify USER ClientDocument };
+ */
+
+ // -----------------------------------------------------------------
+ // Alert destination
+ // Make any necessary changes to the properties as needed for
+ // your setup.
+ // -----------------------------------------------------------------
+ alert_destination := destination { Alert }
+ with [ display_alert := true,
+ alert_type := "reminder",
+ short_message := "Event Occurrence marked as done",
+ priority := "low",
+ Scope := "chart",
+ Rule_number := 1001,
+ Rule_group := "Mark as done" ];
+
+
+ clientVisitObj := read last { ClientVisit: this };
+ // --------------------------------------------------------------------------------
+ // First check to see if the current patient{{{SINGLE-QUOTE}}}s visit is of a type that is to
+ // be excluded from this MLM.
+ if limitPatientVisitTypes AND clientVisitObj.TypeCode in (patientVisitTypeList)
+ then
+
+ // Do nothing
+ finalMlmStatus := 0;
+ finalOutputMessage := "Patient type is excluded";
+
+ // -----------------------------------------------------------------
+ // Evoking Object is an order, linked to OrderComplete trigger event
+ /* NOT CURRENTLY USING THE ORDER SECTION FOR CHARTING
+ elseif ( EvokingObject is order ) then
+
+ eventOccurrenceObj := new eventOccurrenceDef;
+
+
+ clientGUID := EvokingObject.ClientGUID;
+ catalogItemGUID := EvokingObject.OrderCatalogMasterItemGUID;
+ linkedItemId := EvokingObject.GUID; // The Order{{{SINGLE-QUOTE}}}s GUID
+
+ if evokingObject.StopDtm = "" OR EvokingObject.StopDtm is null then
+ eventOccurrenceObj.actionDate := EvokingObject.SignificantDtm;
+ else
+ eventOccurrenceObj.actionDate := EvokingObject.StopDtm;
+ endif;
+
+ eventOccurrenceObj.actionProviderId := EvokingObject.CareProviderGUID;
+
+ eventOccurrenceObj.Comment := "Order " || EvokingObject.Name || " marked as completed.";
+
+ // The M.A.D. functionality requires the location group GUID from the
+ // evoking object. This is attached to the client visit object.
+ visitGuid := EvokingObject.ClientVisitGUID;
+ locationGroupGuid := read last { "select CurrentLocationGUID from CV3ClientVisit " ||
+ " where GUID=" || SQL(visitGuid) };
+
+
+ // ------------------------------------------------------------------------
+ // Get the data necessary for the educational Materials object from
+ // UDDI fields on the OrderUserData object
+ orderUserDataObj := read first{ Order: OrderUserData referencing EvokingObject };
+ userDataList := read { OrderUserData: this referencing orderUserDataObj };
+
+ // Type field is required; is not on the form or empty do not create an educational
+ // material object.
+ userDataObj := first of ( userDataList where userDataList.UserDataCode = "HM Ed Material Type");
+ if ( userDataObj is not null AND userDataObj.Value <> "" )
+ then
+ educationalMaterialsObj := new EducationalMaterialsDef;
+
+ educationalMaterialsObj.TypeCode := userDataObj.Value;
+ userDataObj := first of ( userDataList where userDataList.UserDataCode = "HM Ed Material IsVIS");
+ educationalMaterialsObj.IsVIS := userDataObj.Value;
+ userDataObj := first of ( userDataList where userDataList.UserDataCode = "HM Ed Material Published");
+ educationalMaterialsObj.PublishedDate := userDataObj.Value;
+ userDataObj := first of ( userDataList where userDataList.UserDataCode = "HM Ed Material Presented");
+ educationalMaterialsObj.PresentedDate := userDataObj.Value;
+ endif;
+
+ // Retrieve the EventNames from the Ancillary code using the catalog item GUID from
+ // the evoking object.
+ eventNameList := read {"Select an.Name from CV3AncillaryName an " ||
+ "Where an.MainCatItemGUID = " || SQL(catalogItemGUID) ||
+ " AND an.Active = 1 AND an.CodingStd = " || SQL(CodingStandard) };
+
+ for eventName in eventNameList do
+
+ // Each Event that is marked as done will have the same occurrence
+ // and educational Materials.
+ eventOccurrenceObj.eventName := eventName;
+
+ (mlmStatus,
+ outputMessage) := call MarkAsDone_MLM
+ with clientGUID,
+ locationGroupGuid,
+ linkedItemId,
+ 0, // Only order is supported
+ updateDatabase,
+ recordOnlyIfPatientAssignedEvent,
+ recordOnlyIfEventActive,
+ eventOccurrenceObj,
+ null,
+ null,
+ null,
+ educationalMaterialsObj;
+
+ if mlmStatus > finalMlmStatus then finalMlmStatus := mlmStatus; endif;
+ finalOutputMessage := finalOutputMessage || outputMessage || "\n";
+
+ enddo;
+
+ eventOccurrenceObj.eventName := eventName;
+ */
+ // ---------------------------------------------------------------------------
+ // Evoking object is an Order Task Occurrence. Linked to task modify (mark as done)
+ elseif ( EvokingObject is OrderTaskOccurrence ) then
+
+ // Create an object for each component that is needed by Mark As Done
+ eventOccurrenceObj := new eventOccurrenceDef;
+ immunizationObj := new ImmunizationDef;
+ vaccineMedicationLotObj := new VaccineMedicationLotDef;
+
+ // The M.A.D. functionality requires the location group GUID from the
+ // evoking object. This is attached to the client visit object.
+ visitGuid := clientVisitObj.GUID;
+ locationGroupGuid := read last { "select CurrentLocationGUID from CV3ClientVisit with (nolock)" ||
+ " where GUID=" || SQL(visitGuid) };
+
+ clientGUID := clientVisitObj.clientGUID;
+ chartGUID := clientVisitObj.ChartGUID;
+ linkedItemId := EvokingObject.Order.GUID; // The parent Order{{{SINGLE-QUOTE}}}s GUID
+
+ // Map properties from the EvokingObject and/or TaskUserData to the Event Occurrence
+ // data objects
+
+ if (EvokingObject.PerformedToDtm = "" OR EvokingObject.PerformedToDtm is null) then
+ eventOccurrenceObj.actionDate := EvokingObject.PerformedFromDtm;
+ else
+ eventOccurrenceObj.actionDate := EvokingObject.PerformedToDtm;
+ endif;
+
+ eventOccurrenceObj.actionProviderId := EvokingObject.PerformedProviderGUID;
+ eventOccurrenceObj.Comment := EvokingObject.TaskComment;
+
+ eventOccurrenceObj.SiteGivenCode := EvokingObject.BodySite;
+ eventOccurrenceObj.RouteCode := EvokingObject.TaskRouteCode;
+
+ // Get the action provider from the order, first check care Provider, then userGUID then
+ // finally current logged on user.
+ (UserID) := read last { "Select u.IDCode FROM CV3User u with (nolock) " ||
+ "where u.GUID=" || eventOccurrenceObj.actionProviderId };
+
+ // The following fields are user defined and are found on the TaskUserData object
+ taskUserDataObj := read first{ OrderTaskOccurrence: TaskUserData referencing EvokingObject };
+ userDataList := read { TaskUserData: this referencing taskUserDataObj };
+
+ // Vaccine name or CVX Code
+ userDataObj := first of ( userDataList where userDataList.UserDataCode = "VaccineName");
+
+ if ( userDataObj.Value is not null ) then
+ immunizationObj.VaccineName := userDataObj.Value;
+ else
+ userDataObj := first of ( userDataList where userDataList.UserDataCode = "VaccineCVXCode");
+ immunizationObj.CVXCode := userDataObj.Value;
+ endif;
+
+ /// manufacturer
+ // task_lot_manufact:= first of ( userDataList where userDataList.UserDataCode = "Vaccine Manufacturer"); //BB Removed 11/9/16
+ task_lot_manufact:= first of ( userDataList where userDataList.UserDataCode in ("Vaccine Manufacturer","Vaccine Manufacturer Flu")); //BB Added 11/9/16
+ //get the MVXCode from the configured UDDD. The configuration should have the name displayed to the users
+ //followed by (MVXCOde) in "(" & ")"
+ findmvxstart := find "(" in string task_lot_manufact.value;
+ if findmvxstart > 0 then
+
+ task_lot_mfg_mvxcode := substring 3 characters starting at (findmvxstart + 1) from task_lot_manufact.value;
+ a := length(task_lot_mfg_mvxcode);
+ if task_lot_mfg_mvxcode is not null and ((length(task_lot_mfg_mvxcode)) = 3) then
+ immunizationObj.VaccineManufacturerMVXCode := task_lot_mfg_mvxcode;
+ DB_Manufacturer_Name := read last
+ {"SELECT name FROM SXAHMVaccineManufacturer with (nolock) WHERE Active = 1 AND mvxcode = "
+ || SQL(immunizationObj.VaccineManufacturerMVXCode)};
+ immunizationObj.VaccineManufacturer := DB_Manufacturer_Name as string;
+
+ else
+ DB_Manufacturer_Name := trim(substring (findmvxstart - 1) characters from task_lot_manufact.value);
+ immunizationObj.VaccineManufacturer := DB_Manufacturer_Name as string;
+ endif;
+ else
+ immunizationObj.VaccineManufacturer := task_lot_manufact.value as string;
+ endif;
+
+ if immunizationObj.VaccineManufacturerMVXCode is null then
+ immunizationObj.VaccineManufacturerMVXCode := read last
+ {"SELECT MVXCode FROM SXAHMVaccineManufacturer with (nolock) WHERE Active = 1 AND Name = "
+ || SQL(immunizationObj.VaccineManufacturer)};
+ endif;
+
+ if immunizationObj.VaccineManufacturer is null then
+ immunizationObj.VaccineManufacturer := task_lot_manufact.value as string;
+ endif;
+
+
+ // Lot details
+ vaccineMedicationLotObj.LotDoseAmount := EvokingObject.TaskDose; // "TaskDose"
+ vaccineMedicationLotObj.LotDoseUOM := EvokingObject.TaskUOM; // "TaskUom"
+
+ //lot number
+ userDataObj := first of ( userDataList where userDataList.UserDataCode = "Vaccine Lot Number");
+ vaccineMedicationLotObj.LotNumber := userDataObj.Value;
+
+ //expiration date PER Debbie Eiler request she DOES NOT want to pass expiration date
+ //userDataObj := first of ( userDataList where userDataList.UserDataCode = "Vaccine Exp Date");
+ // vaccineMedicationLotObj.LotExpirationDate := userDataObj.Value AS TIME;
+
+ //manufacture
+ //userDataObj := first of ( userDataList where userDataList.UserDataCode = "Vaccine Manufacturer");
+ //immunizationObj.VaccineManufacturer := userDataObj.Value;
+
+ //HARD CODING ACTIVE FOR NOW
+ /// Immunization Registry Status
+ //userDataObj := first of ( userDataList where userDataList.UserDataCode = "Immunization Registry Status");
+ //ImmRegStatus := userDataObj.Value;
+ //userDataObj.Value := "Active";
+
+ // ------------------------------------------------------------------------
+ // Retrieve the mapped Event Name based on the Ancillary Coding standard
+ // ------------------------------------------------------------------------
+ catalogItemGUID := EvokingObject.CatalogItemTaskGUID; //read last { OrderTaskOccurrence: CatalogItemTaskGUID referencing EvokingObject };
+ // Retrieve the EventName from the Ancillary code
+ eventNameList := read {"Select an.Name from CV3AncillaryName an with (nolock) " ||
+ "Where an.MainCatItemGUID = " || SQL(catalogItemGUID) ||
+ " AND an.Active = 1 AND an.CodingStd = " || SQL(CodingStandard) };
+
+ ImmunizationCVXCode := read last {"Select an.Name from CV3AncillaryName an with (nolock) " ||
+ "Where an.MainCatItemGUID = " || SQL(catalogItemGUID) ||
+ " AND an.Active = 1 AND an.CodingStd = " || SQL(CodingCVXCode) };
+
+ immunizationObj.CVXCode := ImmunizationCVXCode;
+
+ // Mark each Client Event mapped with the same Event, Immunization and Vaccine information
+ for eventName in eventNameList do
+
+ eventOccurrenceObj.eventName := eventName;
+
+ (mlmStatus,
+ outputMessage) := call MarkAsDone_MLM
+ with clientGUID,
+ locationGroupGuid,
+ linkedItemId,
+ 0,
+ updateDatabase,
+ recordOnlyIfPatientAssignedEvent,
+ recordOnlyIfEventActive,
+ eventOccurrenceObj,
+ immunizationObj,
+ vaccineMedicationLotObj,
+ null, // ConsentDocumentObj,
+ null, //EducationalMaterialsObj;
+ false; //linkordertoeventoccurance;
+
+ ImmRegStatus := "Active";
+ eventPhysNoteDeclIns := read { "EXEC SCMPhysicalNoteDeclInsPr "
+ || sql(clientGUID) || ", "
+ || sql(chartguid) || ", "
+ || sql(visitguid)|| ", "
+ || sql(UserID) || ", "
+ || "{{{SINGLE-QUOTE}}}ImmRegStatus{{{SINGLE-QUOTE}}}, "
+ || sql(ImmRegStatus) || ", "
+ || NULL || ", "
+ || "{{{SINGLE-QUOTE}}}" || NOW || "{{{SINGLE-QUOTE}}}" };
+
+
+ if mlmStatus > finalMlmStatus then finalMlmStatus := mlmStatus; endif;
+ finalOutputMessage := finalOutputMessage || outputMessage || "\n";
+
+ enddo;
+
+
+ /* //NOT CURRENTLY USING CLIENTDOCUMENT ACTIONS
+ // ---------------------------------------------------------------------------
+ // Evoking object is a document, flowhseet or structured note. Linked to the
+ // new order or order modify events.
+ elseif (EvokingObject is ClientDocument )
+ then
+
+ clientGUID := EvokingObject.clientGUID;
+ catalogItemGUID := EvokingObject.PatCareDocGUID;
+
+ // The M.A.D. functionality requires the location group GUID from the
+ // evoking object. This is attached to the client visit object.
+ // The same location group guid is used for each of the client document
+ // observations as well.
+ visitGuid := EvokingObject.ClientVisitGUID;
+ locationGroupGuid := read last { "select CurrentLocationGUID from CV3ClientVisit " ||
+ " where GUID=" || SQL(visitGuid) };
+ eventOccurrenceObj := new eventOccurrenceDef;
+
+ eventOccurrenceObj.actionDate := EvokingObject.Entered;
+ eventOccurrenceObj.actionProviderId := EvokingObject.AuthoredProviderGUID;
+ eventOccurrenceObj.Comment := "Document " || EvokingObject.DocumentName || " entered/modified.";
+
+ // ------------------------------------------------------------------------
+ // Retrieve the mapped Event Name based on the Ancillary Coding standard
+ // ------------------------------------------------------------------------
+ catalogItemGUID := EvokingObject.PatCareDocGUID;
+
+ eventNameDocList := read {"Select an.Name from CV3AncillaryName an " ||
+ "Where an.MainCatItemGUID = " || SQL(catalogItemGUID) ||
+ " AND an.Active = 1 AND an.CodingStd = " || SQL(CodingStandard) };
+
+ for eventName in eventNameDocList do
+
+ // Document has an ancillary but it doesn{{{SINGLE-QUOTE}}}t mean that the
+ // patient{{{SINGLE-QUOTE}}}s schedule has the ClientEvent.
+
+ eventOccurrenceObj.EventName := eventName;
+
+ (mlmStatus,
+ outputMessage) := call MarkAsDone_MLM
+ with clientGUID,
+ locationGroupGuid,
+ null, null,
+ updateDatabase,
+ recordOnlyIfPatientAssignedEvent,
+ recordOnlyIfEventActive,
+ eventOccurrenceObj,
+ null,
+ null,
+ null,
+ null;
+
+ if mlmStatus > finalMlmStatus then finalMlmStatus := mlmStatus; endif;
+ finalOutputMessage := finalOutputMessage || outputMessage || "\n";
+
+ enddo;
+
+ // ----------------------------------------------------------------------------------------
+ // Now check each observation in the document
+ // ----------------------------------------------------------------------------------------
+
+ (clientDocObj, observationDocObj) := read last { ClientDocument: THIS, ClientObservationDocument
+ referencing EvokingObject };
+ observationDocsList := read { ClientObservationDocument: THIS referencing ObservationDocObj };
+
+ // For each observation linked to this document, see if it has a mapped Ancillary code
+ // and if found mark that client event as done.
+ for observationDocObj in ObservationDocsList do
+
+ itemGUID := observationDocObj.ObsMasterItemGUID;
+ eventOccurrenceObj.actionDate := observationDocObj.RecordedDTM;
+ eventOccurrenceObj.Comment := "Observation " || observationDocObj.Name || " Entered/Modified.";
+
+ // Find all the ClientEvents mapped via AncillaryCodes to this Observation.
+ // Call Mark as Done for each one.
+ eventNameObsList := read { "select cv.CodedValue from SCMObsCodedValue cv " ||
+ "where cv.ParentGUID = " || SQL(itemGUID) || " AND " ||
+ " cv.Active = 1 AND cv.CodingStandards = " || SQL(CodingStandard) };
+
+ for eventName in eventNameObsList do
+
+ eventOccurrenceObj.EventName := eventName;
+ (mlmStatus,
+ outputMessage) := call MarkAsDone_MLM
+ with clientGUID,
+ locationGroupGuid,
+ null, null,
+ updateDatabase,
+ recordOnlyIfPatientAssignedEvent,
+ recordOnlyIfEventActive,
+ eventOccurrenceObj,
+ null,
+ null,
+ null,
+ null;
+
+ if mlmStatus > finalMlmStatus then finalMlmStatus := mlmStatus; endif;
+ finalOutputMessage := finalOutputMessage || outputMessage || "\n";
+
+ enddo;
+
+ enddo;
+
+ // ---------------------------------------------------------------------------
+ // Evoking object is a basic observation (Result) Linked to a basic observation
+ // event.
+ */
+
+
+ /* //NOT CURRENTLY USING THE BASIC OBASERVATION
+ elseif (EvokingObject is BasicObservation)
+ then
+ eventOccurrenceObj := new eventOccurrenceDef;
+
+ clientGUID := EvokingObject.ClientGUID;
+ resultItemGUID := EvokingObject.ResultItemGUID;
+ orderGUID := EvokingObject.OrderGUID;
+
+ // The M.A.D. functionality requires the location group GUID from the
+ // evoking object. This is attached to the client visit object.
+ visitGuid := EvokingObject.ClientVisitGUID;
+ locationGroupGuid := read last { "select CurrentLocationGUID from CV3ClientVisit " ||
+ " where GUID=" || SQL(visitGuid) };
+
+ eventOccurrenceObj.actionDate := EvokingObject.Entered; // Is this the correct time?
+
+ // Get the action provider from the order, first check care Provider, then userGUID then
+ // finally current logged on user.
+ (careProviderGUID, UserGUID) := read last { "Select o.CareProviderGUID,UserGUID from CV3Order o " ||
+ "where o.GUID=" || SQL(orderGUID) };
+ if (careProviderGUID is null or careProviderGUID=0) then
+ if (userGUID is null or userGUID=0) then
+ actionProviderGUID := read last { User: GUID }; // use current user
+ else
+ actionProviderGUID := userGUID;
+ endif;
+ else
+ actionProviderGUID := careProviderGUID;
+ endif;
+
+ eventOccurrenceObj.actionProviderId := actionProviderGUID;
+
+ eventOccurrenceObj.Comment := "Final Result " || EvokingObject.ItemName || " received.";
+
+ // ------------------------------------------------------------------------
+ // Retrieve the mapped Event Name based on the Ancillary Coding standard.
+ // Check for Result Only (Type=3) or Order and Result (Type=2)
+ // ------------------------------------------------------------------------
+
+ eventNameList := read { "Select an.Name,an.* from CV3AncillaryName an " ||
+ " inner join CV3ResultCatalogItem rci on rci.GUID=an.MainCatItemGUID " ||
+ "where rci.GUID=" || SQL(resultItemGUID) || " AND " ||
+ " an.Active=1 AND an.CatalogType=3 AND an.CodingStd = " || SQL(CodingStandard) ||
+ " union " ||
+ "Select an.Name,an.* from CV3AncillaryName an " ||
+ " inner join CV3ResultCatalogItem rci on rci.GUID=an.AuxCatItemGUID " ||
+ "where rci.GUID=" || SQL(resultItemGUID) || " AND " ||
+ " an.Active=1 AND an.CatalogType=2 AND an.CodingStd = " || SQL(CodingStandard) };
+
+ for eventName in eventNameList do
+
+ eventOccurrenceObj.eventName := eventName;
+
+ (mlmStatus,
+ outputMessage) := call MarkAsDone_MLM
+ with clientGUID,
+ locationGroupGuid,
+ orderGUID, 0,
+ updateDatabase,
+ recordOnlyIfPatientAssignedEvent,
+ recordOnlyIfEventActive,
+ eventOccurrenceObj,
+ null,
+ null,
+ null,
+ null;
+
+ if mlmStatus > finalMlmStatus then finalMlmStatus := mlmStatus; endif;
+ finalOutputMessage := finalOutputMessage || outputMessage || "\n";
+
+ enddo;
+ */
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+
+ // Run the MLM in time delayed mode
+ //0 minutes after time of order_complete_event;
+ //0 minutes after time of
+ 1 seconds after time of taskOcc_modify_event;
+//taskOcc_modify_event;
+ //0 minutes after time of observation_enter_event;
+ //0 minutes after time of client_document_enter_event;
+ //0 minutes after time of client_document_modify_event;
+
+ ;;
+ logic:
+
+ // Only conclude true if an alert needs to be displayed
+ if ( finalMlmStatus >= AllowAlertOnStatusLevel )
+ then
+ conclude true;
+ else
+ conclude false;
+ endif;
+
+ ;;
+ action:
+
+ if finalOutputMessage is not null
+ then
+ write finalOutputMessage at alert_destination;
+ if not updateDatabase
+ then
+ write "{{+R}}Updates have not been made to the database. UpdateDatabase flag set to false.{{-R}}"
+ at alert_destination;
+ endif;
+ endif;
+
+ if writeObjectDetails
+ then
+ write "Object details:" at alert_destination;
+ write eventOccurrenceObj at alert_destination;
+ write ImmunizationObj at alert_destination;
+ write vaccineMedicationLotObj at alert_destination;
+ write ConsentDocumentObj at alert_destination;
+ write EducationalMaterialsObj at alert_destination;
+ write "task_lot_mfg_mvxcode =" || task_lot_mfg_mvxcode at alert_destination;
+ write "findmvxstart =" || findmvxstart at alert_destination;
+ write "task_lot_manufact =" || task_lot_manufact at alert_destination;
+ write a at alert_destination;
+ endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_INFECTIOUS_DISEASE_VISIT_COLUMN_UPDATE.mlm b/MLMStripper/bin/Debug/SCH/SCH_INFECTIOUS_DISEASE_VISIT_COLUMN_UPDATE.mlm
new file mode 100644
index 0000000..37dc620
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_INFECTIOUS_DISEASE_VISIT_COLUMN_UPDATE.mlm
@@ -0,0 +1,235 @@
+maintenance:
+
+ title: SCH_INFECTIOUS_DISEASE_VISIT_COLUMN_UDPATE;;
+ mlmname: SCH_INFECTIOUS_DISEASE_VISIT_COLUMN_UPDATE;;
+ arden: version 2.50;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Maria Pest, Allscripts Corp, x7443;;
+ date: 2015-04-23;;
+ validation: testing;;
+
+library:
+ purpose: Add value to Enterprise Defined Column on Infection Control Visit List when a document is entered on a patient.
+
+ ;;
+
+ explanation: When a user with a specialty of "Infectious Disease" saves a Consult eNote or Physician Progress Note document, update the Infection
+ Control Visit List "Infectious Disease" Enterprise Defined Column with the value "Patient Seen".
+
+
+ Change history
+
+ 04.23.2015 JML CSR #32980 Created
+ 06.11.2015 JML WO #1765855: Infectious Disease column was erroneously displaying value due to other EDC updating;
+ fixed to only display value when Infectious Disease document existed on patient{{{SINGLE-QUOTE}}}s chart
+ for current day.
+ 11.26.2018 JML WO #3528490: Remove logic for document updates due to date / time conflict.
+ 02.12.2019 JML WO #3565687: Removed ClientGUID filter from query of CV3EnterpriseVisitData table due to instances
+ where this value is not populated.
+ ;;
+ keywords: ObjectsPlus/XA, Infectious, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ //str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ log_execution_info := false;
+ update_column := false;
+ infect_col_value := "";
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ client_doc_enter := event {ClientDocumentEnter User ClientDocument :
+ WHERE DocumentName = "Physician Progress Note"
+ OR DocumentName = "Consult eNote"};
+ client_doc_modify := event {ClientDocumentModify User ClientDocument :
+ WHERE DocumentName = "Physician Progress Note"
+ OR DocumentName = "Consult eNote"};
+
+ user_logon := event { ActivateApplication User UserInfo :
+ WHERE CareProvider IS NOT NULL
+ AND OrderRoleType matches pattern "%Physician%" };
+
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last { UserInfo : THIS };
+ endif;
+
+
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.ClientVisitGUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ care_prov_obj := read last { UserInfo : CareProvider };
+
+ user_discipline := care_prov_obj.Discipline;
+
+ if ( user_discipline = "Infectious Disease" OR user_discipline = "Infectious Diseases" ) then
+ if ( EvokingEvent = user_logon ) then
+ //Retrieve a list of patient{{{SINGLE-QUOTE}}}s that have the Infectious Disease column value
+ (col_client_guid,
+ col_visit_guid) := read {"Declare @colName varchar(50)"
+ || ""
+ || "SELECT @colName = DataColumnName"
+ || " FROM CV3EnterpriseColumnDef ecd WITH (NOLOCK) JOIN CV3EnterpriseColumnData ecd2 WITH (NOLOCK)"
+ || " ON ecd.GUID = ecd2.ColumnDefinitionGUID"
+ || " WHERE ColumnLabel = {{{SINGLE-QUOTE}}}Infectious Disease{{{SINGLE-QUOTE}}}"
+ || ""
+ || " EXEC ({{{SINGLE-QUOTE}}}SELECT cv.ClientGUID, evd.VisitGUID{{{SINGLE-QUOTE}}} + "
+ || " {{{SINGLE-QUOTE}}} FROM CV3EnterpriseVisitData evd WITH (NOLOCK) JOIN CV3CLIENTVISIT cv WITH (NOLOCK){{{SINGLE-QUOTE}}} +"
+ || " {{{SINGLE-QUOTE}}} ON evd.VisitGUID = cv.GUID{{{SINGLE-QUOTE}}} +"
+ || " {{{SINGLE-QUOTE}}} WHERE {{{SINGLE-QUOTE}}} + @colName + {{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}Patient Seen{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}"
+ || " AND VisitGUID is not null"
+ || " ORDER BY evd.touchedWhen{{{SINGLE-QUOTE}}})"};
+
+ if ( ( count col_client_guid ) > 0 ) then
+
+ update_column := true;
+ infect_col_value := ();
+ infect_client_guid := ();
+ infect_visit_guid := ();
+
+ //Loop through patients that have Infectious Disease column value
+ for i IN 1 seqto ( count col_client_guid ) do
+ //Check for last time Infectious Disease column was valued
+ doc_client_guid := col_client_guid[i];
+ doc_visit_guid := col_visit_guid[i];
+
+ last_doc_update := read last {"SELECT cd.AuthoredDtm"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocumentCUR cd WITH (NOLOCK)"
+ || " ON cv.CLIENTGUID = cd.ClientGUID"
+ || " AND cv.GUID = cd.ClientVisitGUID"
+ || " AND cv.ChartGUID = cd.ChartGUID"
+ || " JOIN CV3ClientDocDetailCUR cdd WITH (NOLOCK)"
+ || " ON cd.GUID = cdd.ClientDocumentGUID"
+ || " AND cd.ClientGUID = cdd.ClientGUID"
+ || " WHERE cv.ClientGUID = " || Sql(doc_client_guid)
+ || " AND cv.GUID = " || Sql(doc_visit_guid)
+ || " AND ( cd.DocumentName IN ({{{SINGLE-QUOTE}}}Physician Progress Note-Infectious Diseases{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}Physician Progress Note-Infectious Disease{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}Consult eNote-Infectious Diseases{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}Consult eNote-Infectious Disease{{{SINGLE-QUOTE}}}))"
+ || " ORDER BY cd.AuthoredDtm ASC"};
+
+ //Format dates to strings for easier comparision cuz dates/time in Arden stink
+ //last_str_date := extract month last_col_update[i] || "-" || extract day last_col_update[i] || "-" || extract year last_col_update[i];
+ last_str_date := extract month last_doc_update || "-" || extract day last_doc_update || "-" || extract year last_doc_update;
+ curr_str_date := extract month now || "-" || extract day now || "-" || extract year now;
+
+ //If Infectious Disease document was entered today, then keep column value
+ //If Infectious Disease document was entered yesterday, then clear column value
+ if ( ( last_str_date as string ) = ( curr_str_date as string ) ) then
+ infect_col_value := (infect_col_value, "Patient Seen");
+ infect_client_guid := ( infect_client_guid, doc_client_guid);
+ infect_visit_guid := ( infect_visit_guid, doc_visit_guid);
+
+ elseif ( ( last_str_date as string ) <> ( curr_str_date as string ) ) then
+ infect_col_value := (infect_col_value, "");
+ infect_client_guid := ( infect_client_guid, doc_client_guid);
+ infect_visit_guid := ( infect_visit_guid, doc_visit_guid);
+ endif;
+
+ enddo;
+
+ else
+ update_column := false;
+ endif;
+ else
+
+ //WO #3528490: Add logic to only display Patient Seen IF authored Dtm = current day
+ if ( EvokingEvent = client_doc_modify ) then
+ //Extract authored DateTime from document currently being modified
+ curr_doc_authored := extract month EvokingObject.AuthoredDtm || "-" || extract day EvokingObject.AuthoredDtm || "-" || extract year EvokingObject.AuthoredDtm;
+ curr_str_date := extract month now || "-" || extract day now || "-" || extract year now;
+
+ if ( ( last_str_date as string ) = ( curr_str_date as string ) ) then
+ update_column := true;
+ infect_col_value := "Patient Seen";
+ elseif ( ( last_str_date as string ) <> ( curr_str_date as string ) ) then
+ update_column := false;
+ infect_col_value := "";
+ endif;
+
+ else
+ update_column := true;
+ infect_col_value := "Patient Seen";
+ endif;
+ endif;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ client_doc_enter;
+ client_doc_modify;
+ user_logon;
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+
+ if ( update_column = true AND ( EvokingEvent = client_doc_enter OR EvokingEvent = client_doc_modify ) ) then
+
+ Infect_Col := NEW EDCObj WITH [
+ column_name := "Infectious Disease",
+ column_value := infect_col_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ return_value := call create_ED_column with ( Infect_Col );
+ conclude true;
+
+ elseif ( update_column = true AND EvokingEvent = user_logon ) then
+
+ //Loop through the Infectious Disease column values and update
+ for j IN 1 seqto ( count infect_col_value ) do
+
+ Infect_Col := NEW EDCObj WITH [
+ column_name := "Infectious Disease",
+ column_value := infect_col_value[j],
+ client_guid := infect_client_guid[j],
+ chart_guid := "",
+ client_visit_guid := infect_visit_guid[j]
+ ];
+
+ return_value := call create_ED_column WITH ( Infect_Col );
+ enddo;
+
+ conclude true;
+ endif;
+
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_INFLUENZA_ORDER_CHECK_HEALTH_ISSUES.mlm b/MLMStripper/bin/Debug/SCH/SCH_INFLUENZA_ORDER_CHECK_HEALTH_ISSUES.mlm
new file mode 100644
index 0000000..a2b7d1b
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_INFLUENZA_ORDER_CHECK_HEALTH_ISSUES.mlm
@@ -0,0 +1,215 @@
+maintenance:
+
+ title: Check If there is a influenza vaccine coded health issue when Influenza Vaccine is ordered;;
+ mlmname: SCH_INFLUENZA_ORDER_CHECK_HEALTH_ISSUES;;
+ arden: version 2.5;;
+ version: 5.00;;
+ institution: SCH ;;
+ author: Teresa Spicuzza Ext 7448;;
+ specialist: Peggy Karish Ext 7441 ;;
+ date: 2010-09-16;;
+ validation: testing;;
+
+library:
+ purpose: Checks Influenza Vaccine History at Client Level when Influenza Vaccine is ordered
+ ;;
+ explanation: To close the loop on this last percent:
+ An MLM on the Influenza Vaccine that gives a hard stop if the patient has a Health Issue with an onset date that falls in the defined flu season.
+ This date will vary each year and will need updated each flu season. Copied from SCH_PNEUMOVAX_ORDER_CHECK_HEALTH_ISSUES.
+
+******* Remember to change DOC_FUNC_INFLUENZA
+
+ Change history
+
+ 09.20.2011 DW Major rewrite CSR#26486 - added pediatric Influenza order name to the evoke statement
+ 09.16.2014 TMS CSR# 32748 - Àdded new Catalog Name for Influenza
+ 09.11.2015 DW CSR# 23359 - ICD10
+ 09.14.2016 DW CSR# 34972 - Update the dates for the new flu season
+ 09.27.2017 DW CSR# 35845 - Update the dates for the new flu season
+ 09.05.2018 SZ CSR# 37150 - Update the dates for the new flu season
+
+ ;;
+ keywords: Influenza, Vaccine, Health Issue Check, Hard Stop, Soft Stop
+ ;;
+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";
+
+ // Set the text for this variable to indicate whether to send the message or not.
+ send_alert := "DoNotSend";
+
+ order_evoke1:= EVENT {OrderInit User Order:
+ WHERE TypeCode = "Medication"
+ And Name in ("Influenza Virus Trivalent Vaccine Inj", "Influenza Virus Trivalent Vaccine Pediatric Inj",
+ "Influenza Virus Vaccine Inj", "Influenza Virus Vaccine Pediatric Inj", "Influenza Virus Vaccine High Dose Inj")};
+
+ hardstop_alert:= destination { Alert: warning, "Influenza Health Issue Check", high, chart,
+ "Influenza", 14015, send_alert, "No Override Allowed" };
+
+ softstop_alert:= destination { Alert: warning, "Influenza Health Issue Check", high, chart,
+ "Influenza", 14015, send_alert};
+
+
+ // Also Adjust the Doc_Func_Influenza
+
+ FluSeasonStart := 2019-07-31T00:00:00;
+ FluSeasonEnd := 2020-03-31T12:59:59;
+
+ client_guid := read last {ClientInfo: GUID};
+ Hard_Stop := false;
+ Soft_Stop := false;
+
+ /* Replaced with ICD10 project
+
+ codeyear,codemonth,codeday := read last
+ { " select top 1 " ||
+ " hid.OnSetYearNum,hid.OnSetMonthNum,hid.OnSetDayNum " ||
+ " from CV3HealthIssueDeclaration as hid with (nolock) " ||
+ " join cv3codedhealthissue as chi with (nolock) " ||
+ "on chi.guid = hid.codedhealthissueGUID " ||
+ " and chi.code in ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V04.81{{{SINGLE-QUOTE}}}) " ||
+ " where hid.TypeCode = {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}} " ||
+ " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " ||
+ " AND hid.ClientGUID = " || SQL(client_guid) ||
+ " And hid.OnSetYearNum <> 0 " ||
+ " order by onsetyearnum desc,onsetmonthnum desc, onsetdaynum desc "
+ } ;
+ */
+
+
+ codeyear,codemonth,codeday := read last
+ { " select top 1 " ||
+ " hid.OnSetYearNum,hid.OnSetMonthNum,hid.OnSetDayNum " ||
+ " from CV3HealthIssueDeclaration as hid with (nolock) " ||
+ " join cv3codedhealthissue as chi with (nolock) " ||
+ "on chi.guid = hid.codedhealthissueGUID " ||
+ "and " ||
+ "( " ||
+ "(hid.ICD9Code is null and chi.code in ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V04.81{{{SINGLE-QUOTE}}}) ) " ||
+ "or " ||
+ "(hid.ICD9Code is not null and hid.ICD9Code in ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V04.81{{{SINGLE-QUOTE}}}) ) " ||
+ ") " ||
+ " where hid.TypeCode = {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}} " ||
+ " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " ||
+ " AND hid.ClientGUID = " || SQL(client_guid) ||
+ " And hid.OnSetYearNum <> 0 " ||
+ " order by onsetyearnum desc,onsetmonthnum desc, onsetdaynum desc "
+ } ;
+
+
+
+
+ if exists(codeyear)
+ then
+
+ cd := codeday as number;
+
+ if cd = 0
+ then
+ cd := 1;
+ endif;
+
+ if cd < 10 then cd := "0" || cd; endif;
+ cm:= codemonth as number;
+ if cm < 10 then cm := "0" || cm; endif;
+
+ vacctime := codeyear || "-" || cm || "-" || cd || "T00:00:00";
+ if ((vacctime as time) < (FluSeasonEnd as time)) = true then
+ if ((vacctime as time) > (FluSeasonstart as time)) = true
+ then
+ Hard_Stop := true;
+ RepMessage := "You cannot enter this order. " ||
+ "\n\n The patient has received a flu vaccine for the current flu season. "
+ || "\n\n Onset Date: " || cm || "/" || cd || "/" || codeyear;
+ endif;
+
+ endif;
+
+ else
+
+ /* Replaced with ICD10 project
+
+ numberofdaysentered,datetomessage := read last
+ { " select top 1 " ||
+ " hid.createdwhen " ||
+ " from CV3HealthIssueDeclaration as hid with (nolock) " ||
+ " join cv3codedhealthissue as chi with (nolock) " ||
+ "on chi.guid = hid.codedhealthissueGUID " ||
+ " and chi.code in ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V04.81{{{SINGLE-QUOTE}}})" ||
+ " where hid.TypeCode = {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}} " ||
+ " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " ||
+ " AND hid.ClientGUID = " || SQL(client_guid) ||
+ " order by onsetyearnum desc,onsetmonthnum desc, onsetdaynum desc "
+ } ;
+ */
+
+ numberofdaysentered,datetomessage := read last
+ { " select top 1 " ||
+ " hid.createdwhen " ||
+ " from CV3HealthIssueDeclaration as hid with (nolock) " ||
+ " join cv3codedhealthissue as chi with (nolock) " ||
+ "on chi.guid = hid.codedhealthissueGUID " ||
+ "and " ||
+ "( " ||
+ "(hid.ICD9Code is null and chi.code in ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V04.81{{{SINGLE-QUOTE}}}) ) " ||
+ "or " ||
+ "(hid.ICD9Code is not null and hid.ICD9Code in ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V04.81{{{SINGLE-QUOTE}}}) ) " ||
+ ") " ||
+ " where hid.TypeCode = {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}} " ||
+ " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " ||
+ " AND hid.ClientGUID = " || SQL(client_guid) ||
+ " order by onsetyearnum desc,onsetmonthnum desc, onsetdaynum desc "
+ } ;
+ if (exists(numberofdaysentered)) and ((numberofdaysentered as time) is within the past 5 years)
+ then
+ eyr := extract year (numberofdaysentered as time) ;
+ emn := extract month (numberofdaysentered as time) ; if emn < 10 then emn := "0" || emn; endif;
+ edd := extract day (numberofdaysentered as time) ; if edd < 10 then edd := "0" || edd; endif;
+ Soft_Stop := true;
+ RepMessage := "Caution: The patient’s Influenza Vaccine History on the Health Issues does not include an Onset Date." ||
+ "\n\n Recommend that the Onset Date is verified prior to placing this order." ||
+ "\n\n Health Issue Was Created On: " || emn || "/" || edd || "/" || eyr ;
+
+ endif;
+ endif;
+
+
+ FireMe := false;
+
+ If (Hard_Stop = true or Soft_Stop = true)
+ then
+ if Hard_Stop = true // Hard_Stop Outweighs Soft_Stop
+ then
+ Soft_Stop := false;
+ endif;
+
+ FireMe := true;
+ endif;
+;;
+
+
+ evoke: order_evoke1 ;//or order_evoke2;
+ ;;
+ logic:
+ conclude FireMe;
+ ;;
+ action:
+
+ If Hard_Stop = true
+ then
+ write RepMessage at hardstop_alert;
+ endif;
+
+ if Soft_Stop = true
+ then
+ write RepMessage at softstop_alert;
+ endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_INSULIN_PUMP_ORD_AND_HI.mlm b/MLMStripper/bin/Debug/SCH/SCH_INSULIN_PUMP_ORD_AND_HI.mlm
new file mode 100644
index 0000000..f09a819
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_INSULIN_PUMP_ORD_AND_HI.mlm
@@ -0,0 +1,229 @@
+maintenance:
+
+ title: SCH_INSULIN_PUMP_ORD_AND_HI;;
+ mlmname: SCH_INSULIN_PUMP_ORD_AND_HI;;
+ arden: version 5.0;;
+ version: 2.00;;
+ institution: St.Clair Hospital;;
+ author: Shawn Head;;
+ specialist: Dean Miklavic;;
+ date: 2014-08-26;;
+ validation: testing;;
+
+library:
+ purpose:
+ This MLM will create a "Patient has Insulin Pump" order when the observation "SCH_CK_Device(s) on admission, ED, and OR" on the one of the Patient Profile document(s)
+ OR the observration "sch_edtriage_devices on arrival" on the ED triage note has the value "Insulin Pump" selected.
+ This MLM will also create a health issue based on the Insulin Pump details provided in the Patient Profile.
+ ;;
+ explanation:
+ create for CSR #: 32128
+ 2015-04-23 - STH: HelpDesk Ticket#:1715478 - Updated the insulin pump health issues check to see if it already exists to search across entire patient chart (not just "this visit"). The
+ MLM was created multiple "Chronic" entries for the insulin pump on subsequent visits.
+ 09.30.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 HI Duplicate Check.
+ 10.12.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 Coding Scheme [ICD10] And Duplicate Check of HI .
+ ;;
+ keywords:
+ Insulin, Pump, Health Issue, Create order
+ ;;
+ citations:
+ ;;
+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";
+
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+
+ Document_Enter := event {ClientDocumentEnter User ClientDocument: where documentname in ("Pediatric Patient Profile","Adult Patient Profile","ED Triage Note","Adult Patient Profile - Behavioral Health","Adult Patient Profile - Observation","OB Patient Profile")};
+ Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Pediatric Patient Profile","Adult Patient Profile","ED Triage Note","Adult Patient Profile - Behavioral Health","Adult Patient Profile - Observation","OB Patient Profile")};
+
+
+ /*Get the ClientObservationDocument object pointer */
+ (location_guid, Active_ClientVisitGUID, client_guid) := read last
+ { ClientVisit: CurrentLocationGUID, GUID, clientguid };
+
+ Active_ClientVisitGUID := EvokingObject.ClientVisitGUID;
+
+ (Client_Observation_Document_Obj, GUID):= read last
+ { ClientDocument: ClientObservationDocument, GUID
+ REFERENCING EvokingObject };
+
+ (InsulinPumpOrder_Obj, IPObsName) := read Last
+ { ClientObservationDocument: ObsFSListValues, Name
+ REFERENCING Client_Observation_Document_Obj
+ where (Name = "SCH_CK_Device(s) on admission, ED, and OR"
+ or Name = "sch_edtriage_devices on arrival")};
+
+ (InsulinPumpObsVal) := read
+ { ObsFSListValues: Value
+ Referencing InsulinPumpOrder_Obj };
+
+ (InsulinType_Obj, IObsName) := read last
+ { ClientObservationDocument: ObsFSListValues, Name
+ REFERENCING Client_Observation_Document_Obj
+ where Name = "SCHCK Type of Insulin" };
+
+ InsulinTypeVal := InsulinType_Obj.Value;
+ if (InsulinTypeVal is not null) and (InsulinTypeVal <> "") then
+ (InsulinPumpHI) := read
+ { "select distinct hi.shortname "
+ || "from cv3healthissuedeclaration hi with (nolock) "
+ || "where hi.clientguid = " || sql(client_guid) || " "
+ || "and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} And hi.ICD10Code is not null " //Added By Shivprasad for CSR 23359-ICD9-10 On 30 Sept 2015
+ || "and hi.typecode = {{{SINGLE-QUOTE}}}problem-Chronic{{{SINGLE-QUOTE}}} and hi.shortname = {{{SINGLE-QUOTE}}}Insulin pump in place{{{SINGLE-QUOTE}}}"};
+
+ if not exists InsulinPumpHI then
+ hitype := "Problem-Chronic";
+ hiname := "Insulin pump in place";
+ hinumber:= "Z96.41" ; //"V45.85"; //CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad
+ hischeme:= "ICD10" ;//"ICD9"; //CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad
+ hitext := "Please see Patient Profile document for Insulin Pump Settings. *Created from Patient Profile information.* " ;
+
+ Func_Create_HI_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_Create_Health_Issue{{{SINGLE-QUOTE}}};
+ void := call Func_Create_HI_MLM with (Active_ClientVisitGUID,hiname,hinumber,hitext,hitype,hischeme);
+ endif;
+ endif;
+
+ x := 0;
+ createorder := false;
+ for i in 1 seqto count of InsulinPumpObsVal do
+ x := x + 1;
+ if InsulinPumpObsVal[i] = "Insulin Pump" then
+ createorder := true;
+ endif;
+ enddo;
+
+ order_Name := "Patient has Insulin Pump" ;
+
+ (dup_order_list) := read last
+ { " select name "
+ ||" from cv3order "
+ ||" where ClientGUID = " || sql(client_Guid)
+ ||" and ClientVisitGUID = " || sql(Active_ClientVisitGUID)
+ ||" and name = {{{SINGLE-QUOTE}}}" || order_Name || "{{{SINGLE-QUOTE}}}"
+ ||" and orderstatuslevelnum < 55 "
+ ||" and OrderStatusCode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} "
+ ||" and active = 1 " };
+
+ if ((createorder) and (not exists dup_order_list)) then
+ create_Insulin_Pump_order := mlm {{{SINGLE-QUOTE}}}SCH_Create_General_Order{{{SINGLE-QUOTE}}};
+
+ ( careProvider_obj ) := read last{ UserInfo: careProvider };
+
+ user_IDType := "Primary";
+
+ CareProviderIDs_obj := read last
+ { CareProvider: CareProviderID
+ REFERENCING careProvider_obj };
+
+ user_IDCode := read last
+ { CareProviderID: IDCode
+ REFERENCING CareProviderIDs_obj
+ where ProviderIDTypeCode = user_IDType };
+
+
+ Care_Provider := EVOKINGOBJECT.AuthoredProviderGUID;
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((Active_ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ WSSessionType := "Standard";
+ WSSessionReason := "";
+ WSRequestedBySource := "";
+ WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((Care_Provider as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if ( client_visit_obj is NOT NULL ) then
+ void:= call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ if ( WSRequestedBy_obj is NOT NULL ) then
+ void:= call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ if ( WSlocation_obj is NOT NULL ) then
+ void:= call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+ endcatch;
+
+ order_Creation_Reason := "Insulin Pump Documented on Patient Profile" ;
+ WSRequestedBySource := "";
+
+
+ order_type := "other";
+
+
+ try
+
+ Catalog_Item_Name := order_name ;
+ order_type := "other";
+ order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with Catalog_Item_Name;
+
+ Obj_Error_occurred, Obj_error_message := call create_Insulin_Pump_order with
+ order_type,
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ Order_catalog_item, // CatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // string CreateReason
+ WSRequestedBy_obj, // RequestingProvider ObjectsPlus object
+ WSRequestedBySource, // string requestingSource(must be in dict)
+ WSSessionType, // string SessionType
+ WSSessionReason, // string SessionReason
+ WSLocation_obj;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}New General order:{{-R}}\n" ||
+ ex.Message || "\n\n";
+ endcatch;
+
+ if ( Order_catalog_item is NOT NULL ) then
+ void:= call Order_catalog_item.Dispose;
+ Order_catalog_item:= null;
+ endif;
+
+
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: Document_Enter;
+ Document_Modify;
+ ;;
+ logic:
+ if EvokingObject is null
+ then
+ conclude false;
+ endif;
+
+ conclude true;
+ ;;
+ action:
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_LAB_PRIORITY_OPTIONS_CALLED.mlm b/MLMStripper/bin/Debug/SCH/SCH_LAB_PRIORITY_OPTIONS_CALLED.mlm
new file mode 100644
index 0000000..8f3e9b0
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_LAB_PRIORITY_OPTIONS_CALLED.mlm
@@ -0,0 +1,315 @@
+maintenance:
+
+ title: SCH_LAB_PRIORITY_OPTIONS_CALLED;;
+ mlmname: SCH_LAB_PRIORITY_OPTIONS_CALLED;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair Isolation Set MLM;;
+ author: Eclipsys Corp;;
+ specialist: Shawn Head;;
+ date: 2014-11-24;;
+ validation: testing;;
+
+library:
+ purpose: MLM will display either the custom priorities or system priorites and assign the proper schedule to the lab orders.
+
+ ;;
+
+ explanation: This MLM is called from several MLM{{{SINGLE-QUOTE}}}s. As of go-live for this MLM the following MLM{{{SINGLE-QUOTE}}}s call this MLM.
+ FORM_LAB_HOLDORDER_REQUESTEDTIME,FORM_GENERIC_EITHER_OR_MANDITORY,FORM_BB_Type_and_Screen,FORM_LAB_GENERIC_MANDITORY
+ Additional MLM{{{SINGLE-QUOTE}}}s may require calling this MLM in the future. Please see the MLM FORM_LAB_PRIORITY_OPTIONS for more details
+ or review the original CSR specs.
+
+ Change History
+
+ 2014.11.24 - STH CSR#: 32765 - Created MLM
+ 2015.03.09 - STH CSR#: 32765 - Issues addressed based on users feed back (showing the time field disabled instead of hidding it,adding section for
+ order set calling, and making sure all fields are working from both order entry and being called from Order Sets).
+ 2015.03.19 - STH CSR#: 32765 - Added logic for Order sets to be able to have multiple user friendly lab priority fields and still have the time disabled/enabled
+ approriately.
+
+ ;;
+ keywords: Called MLMs, Form fields, schedule
+ ;;
+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*******************/
+
+ /* These variables must containt he same wording as the options in the drop down list */
+
+ /***************************************************************************************/
+
+ // Initialize error message
+ error_message:="";
+
+ field_list:= this_form.fields;
+ clientguid := this_communication.ClientGUID;
+ clientvisitguid := this_communication.ClientVisitGUID;
+ chartguid := this_communication.ChartGUID;
+
+ // Obtain common fields passed in the Form object to the Field object
+ //commented out ones are just not being used; however left incase you need them.
+ system_lab_priority := last of (field_list where field_list.DataItemName = "RequestedTime" );
+ user_friendly_lab_priority := last of (field_list where field_list.DataItemName = "LAB_Order Priorities" );
+ user_friendly_lab_time := last of (field_list where field_list.DataItemName = "LAB_Phleb Draw Sched Time" );
+ Lab_Priority_to_summary_line := last of (field_list where field_list.DataItemName = "LAB_Order Priority Summ Line" );
+ Blood_in_lab_checkbox := last of (field_list where field_list.DataItemName = "LAB_CB_BIL");
+ OrderName := this_communication.PrimaryObj.name;
+ OrderGUID := this_communication.ItemID;
+ comm_obj := this_communication.primaryobj;
+ session_type := comm_obj.internalprocessingtype;
+
+
+ // References the LOCAL SESSION object
+ local_session := cds_session.local;
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+
+ if this_communication.FormType = "Order" then
+ DisplayNewScheduled := first of (field_list.Value
+ where field_list.DataItemName = "LAB_CB_Alternate Priorities");
+
+
+ //BEGIN - FORM OPEN SECTION
+ //if (this_communication.CallingEvent = "FormOpen") then
+
+ Order_Lab_ClassType_Value := read {"SELECT distinct cctv.Value "
+ || " from CV3OrderCatalogMasterItem (NOLOCK) "
+ || " inner join CV3CatalogClassTypeValue cctv (nolock) "
+ || " on CV3OrderCatalogMasterItem.GUID = cctv.CatalogMasterGUID "
+ || " Where cctv.ClassTypeGUID = (SELECT GUID FROM CV3CLASSTYPE WHERE CODE = {{{SINGLE-QUOTE}}}Lab_Specimentype{{{SINGLE-QUOTE}}}) "
+ || " and CV3OrderCatalogMasterItem.Name = " || sql(OrderName)};
+
+ if Order_Lab_ClassType_Value[1] is not null then
+ AllBloodInLabOrders := ();
+ for x in 1 seqto(count(Order_Lab_ClassType_Value)) do
+ classtype := Order_Lab_ClassType_Value[x];
+ BloodInLabOrders := read {"SELECT distinct cv3order.name "
+ || " from CV3Order with (nolock) "
+ || " left JOIN CV3OrderCatalogMasterItem (NOLOCK) "
+ || " on (CV3Order.OrderCatalogMasterItemGUID = CV3OrderCatalogMasterItem.guid) "
+ || " inner join CV3CatalogClassTypeValue cctv (nolock) "
+ || " on CV3OrderCatalogMasterItem.GUID = cctv.CatalogMasterGUID "
+ || " Where cv3order.clientguid = " || sql(ClientGuid)
+ || " and cv3order.chartguid = " || sql(chartguid)
+ || " and cv3order.clientvisitguid = " || sql(ClientVisitGuid)
+ || " and cctv.ClassTypeGUID = (SELECT GUID FROM CV3CLASSTYPE WHERE CODE = {{{SINGLE-QUOTE}}}Lab_Specimentype{{{SINGLE-QUOTE}}}) "
+ || " and cctv.Value = " || sql(classtype)
+ || " and cv3order.OrderStatusLevelNum in (60,80,83,85) "
+ || " and cv3order.SignificantDtm >= dateadd(hh,-2,getdate()) "};
+ AllBloodInLabOrders := AllBloodInLabOrders, BloodInLabOrders;
+ enddo;
+ endif;
+
+ endif;
+
+
+
+ //REQUESTEDTIME-END field logic. End of section.
+
+
+
+ ;;
+ evoke: // No evoke statement
+ ;;
+ logic:
+
+
+ //BEGIN - ORDER SET LOGIC FOR LAB PRIORITY OPTIONS
+ if this_communication.FormType = "OrderSet" then
+ OS_UserFriendly_LabPriority := (field_list where field_list.DataItemName = "LAB_Order Priorities" );
+ OS_UserFriendly_LabTimes := (field_list where field_list.DataItemName = "LAB_Phleb Draw Sched Time" );
+
+
+ for x in (1 seqto count(OS_UserFriendly_LabPriority)) do
+ if (this_communication.CallingEvent = "FormOpen") or (this_communication.CallingFieldName = "LAB_Order Priorities|" || x) then
+ if (OS_UserFriendly_LabPriority[x].Value = "Scheduled Time")then
+ OS_UserFriendly_LabTimes[x].Control_Read_Only := false;
+ OS_UserFriendly_LabTimes[x].Control_Visible := true;
+ OS_UserFriendly_LabTimes[x].Control_Mandatory := true;
+ else
+ OS_UserFriendly_LabTimes[x].Control_Read_Only := true;
+ OS_UserFriendly_LabTimes[x].Control_Mandatory := false;
+ OS_UserFriendly_LabTimes[x].Control_Visible := true;
+ OS_UserFriendly_LabTimes[x].value := "";
+ endif;
+ endif;
+ enddo;
+
+ endif;
+ //END - ORDER SET LOGIC FOR LAB PRIORITY OPTIONS
+
+
+ //BEGIN - ORDER FORM LOGIC
+ if this_communication.FormType = "Order" then
+ if (this_communication.CallingEvent = "FormOpen") then
+ user_friendly_lab_time.Control_Visible := true;
+ user_friendly_lab_time.Control_Read_Only := false;
+ testbilo := BloodInLabOrders[1];
+ testallbilo := AllBloodInLabOrders[1];
+ if BloodInLabOrders[1] is not null or AllBloodInLabOrders[1] is not null then
+ Blood_in_lab_checkbox.Control_Visible := true;
+ else
+ Blood_in_lab_checkbox.Control_Visible := false;
+ endif;
+
+ if (DisplayNewScheduled) then
+ system_lab_priority.Control_Visible := false;
+ user_friendly_lab_priority.Control_Visible := true;
+ user_friendly_lab_priority.Control_Mandatory := true;
+
+ if (user_friendly_lab_priority.Value = "Scheduled Time")then
+ user_friendly_lab_time.Control_Read_Only := false;
+ user_friendly_lab_time.Control_Visible := true;
+ user_friendly_lab_time.Control_Mandatory := true;
+ else
+ user_friendly_lab_time.Control_Read_Only := true;
+ user_friendly_lab_time.Control_Mandatory := false;
+ user_friendly_lab_time.value := "";
+ endif;
+ else
+ system_lab_priority.Control_Visible := true;
+ user_friendly_lab_priority.Control_Visible := false;
+ user_friendly_lab_priority.Control_Mandatory := false;
+ user_friendly_lab_time.Control_Visible := false;
+ user_friendly_lab_time.Control_Mandatory := false;
+ endif;
+
+ if user_friendly_lab_priority.Value is not null and user_friendly_lab_priority.Value <> "" then
+ if (user_friendly_lab_priority.Value = "AM Rounds") then
+ system_lab_priority.Value.ReqTimeCode := "AM Rounds";
+ Lab_Priority_to_summary_line.Value := "";
+ elseif (user_friendly_lab_priority.Value = "ROUTINE (Drawn next even hour)") then
+ system_lab_priority.Value.ReqTimeCode := "Today";
+ Lab_Priority_to_summary_line.Value := "";
+ elseif (user_friendly_lab_priority.Value = "STAT") then
+ system_lab_priority.Value.ReqTimeCode := "STAT";
+ Lab_Priority_to_summary_line.Value := "";
+ elseif (user_friendly_lab_priority.Value = "Scheduled Time") then
+ system_lab_priority.Value.ReqTimeCode := "Scheduled Time";
+ Lab_Priority_to_summary_line.Value := "";
+ elseif (user_friendly_lab_priority.Value = "Nurse Collect (Add Specimen Required)") then
+ system_lab_priority.Value.ReqTimeCode := "Routine Collected Specimen";
+ Lab_Priority_to_summary_line.Value := "Nurse Collect";
+ elseif (user_friendly_lab_priority.Value = "Blood in Lab") then
+ system_lab_priority.Value.ReqTimeCode := "Routine Collected Specimen";
+ Lab_Priority_to_summary_line.Value := "Blood in Lab";
+ elseif (user_friendly_lab_priority.Value = "Nurse Collect STAT (Add Specimen Required)") then
+ system_lab_priority.Value.ReqTimeCode := "STAT Collected Specimen";
+ Lab_Priority_to_summary_line.Value := "Nurse Collect STAT";
+ else
+ system_lab_priority.Value.ReqTimeCode := "";
+ user_friendly_lab_priority.Value := "";
+ Lab_Priority_to_summary_line.Value := "";
+ endif;
+ endif;
+ endif;
+
+ //END - FORM OPEN SECTION
+
+
+
+
+ //BEGIN - USER FRIENDLY PRIORITY CHANGED
+
+ if (this_communication.CallingFieldName = "LAB_Order Priorities") then
+ if (user_friendly_lab_priority.Value = "Scheduled Time") then
+ //user_friendly_lab_time.Control_Visible := true;
+ user_friendly_lab_time.Control_Read_Only := false;
+ user_friendly_lab_time.Control_Mandatory := true;
+ else
+ //user_friendly_lab_time.Control_Visible := false;
+ user_friendly_lab_time.Control_Read_Only := true;
+ user_friendly_lab_time.Control_Mandatory := false;
+ user_friendly_lab_time.Value := "";
+ endif;
+
+ if (user_friendly_lab_priority.Value = "") then
+ system_lab_priority.Value.ReqTimeCode := "";
+ Lab_Priority_to_summary_line.Value := "";
+ elseif (user_friendly_lab_priority.Value = "AM Rounds") then
+ system_lab_priority.Value.ReqTimeCode := "AM Rounds";
+ Lab_Priority_to_summary_line.Value := "";
+ elseif (user_friendly_lab_priority.Value = "ROUTINE (Drawn next even hour)") then
+ system_lab_priority.Value.ReqTimeCode := "Today";
+ Lab_Priority_to_summary_line.Value := "";
+ elseif (user_friendly_lab_priority.Value = "STAT") then
+ system_lab_priority.Value.ReqTimeCode := "STAT";
+ Lab_Priority_to_summary_line.Value := "";
+ elseif (user_friendly_lab_priority.Value = "Scheduled Time") then
+ system_lab_priority.Value.ReqTimeCode := "Scheduled Time";
+ Lab_Priority_to_summary_line.Value := "";
+ elseif (user_friendly_lab_priority.Value = "Nurse Collect (Add Specimen Required)") then
+ system_lab_priority.Value.ReqTimeCode := "Routine Collected Specimen";
+ Lab_Priority_to_summary_line.Value := "Nurse Collect";
+ elseif (user_friendly_lab_priority.Value = "Blood in Lab") then
+ system_lab_priority.Value.ReqTimeCode := "Routine Collected Specimen";
+ Lab_Priority_to_summary_line.Value := "Blood in Lab";
+ elseif (user_friendly_lab_priority.Value = "Nurse Collect STAT (Add Specimen Required)") then
+ system_lab_priority.Value.ReqTimeCode := "STAT Collected Specimen";
+ Lab_Priority_to_summary_line.Value := "Nurse Collect STAT";
+ else
+ system_lab_priority.Value.ReqTimeCode := "";
+ user_friendly_lab_priority.Value := "";
+ Lab_Priority_to_summary_line.Value := "";
+ endif;
+ endif;
+
+ //END - USER FRIENDLY PRIORITY CHANGED
+
+ //BEGIN - BLOOD IN LAB CHECKBOX CHANGE
+ if (this_communication.CallingFieldName = "LAB_CB_BIL") then
+ if Blood_in_lab_checkbox.Value = true then
+ user_friendly_lab_priority.Value := "";
+ user_friendly_lab_time.value := "";
+ user_friendly_lab_priority.Control_Mandatory := false;
+ user_friendly_lab_priority.Control_Read_Only := true;
+ user_friendly_lab_time.Control_Mandatory := false;
+ user_friendly_lab_time.Control_Read_Only := true;
+ system_lab_priority.Value.ReqTimeCode := "Routine Collected Specimen";
+ Lab_Priority_to_summary_line.Value := "Blood in Lab";
+
+ else
+ user_friendly_lab_priority.Control_Read_Only := false;
+ user_friendly_lab_priority.Control_Mandatory := true;
+ system_lab_priority.Value.ReqTimeCode := "";
+ Lab_Priority_to_summary_line.Value := "";
+ endif;
+
+ endif;
+
+ //END - BLOOD IN LAB CHECKBOX CHANGE
+
+
+ if (this_communication.CallingFieldName = "Lab_Phleb Draw Sched Time") then
+ if user_friendly_lab_time.Value is not null or user_friendly_lab_time.Value <> "" then
+ system_lab_priority.Value.ReqTimeValue := user_friendly_lab_time.Value;
+ endif;
+ endif;
+ //END - ORDER FORM LOGIC
+ endif;
+
+
+ if (session_type = "Hold") then
+ if ((user_friendly_lab_priority.Value = "Scheduled Time") or (system_lab_priority.Value.ReqTimeCode = "Scheduled Time"))then
+ system_lab_priority.Control_Mandatory := false;
+ user_friendly_lab_time.Control_Mandatory := false;
+ endif;
+ endif;
+ conclude true;
+ ;;
+ action:
+ // This MLM returns two parameters, of types communication_type and form_type respectively.
+ return this_communication, this_form;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_LAUNCH_ORDER_MANAGEMENT.mlm b/MLMStripper/bin/Debug/SCH/SCH_LAUNCH_ORDER_MANAGEMENT.mlm
new file mode 100644
index 0000000..9bed6ef
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_LAUNCH_ORDER_MANAGEMENT.mlm
@@ -0,0 +1,67 @@
+maintenance:
+
+ title: SCH_LAUNCH_ORDER_MANAGEMENT;;
+ mlmname: SCH_LAUNCH_ORDER_MANAGEMENT;;
+ arden: version 2;;
+ version: 4.00;;
+ institution: St Clair Memorial Hospital;;
+ author: Don Warnick;;
+ specialist: Don Warnick;;
+ date: 2015-10-05;;
+ validation: testing;;
+
+library:
+ purpose: This MLM calls an Objects+ DLL that permit users to delete orders
+ ;;
+ explanation:
+
+Change history
+
+DEV 10.05.2015 DW CSR# 33465 - Create an Objects+ application to permit users to delete orders
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ log_execution_info:=FALSE;
+ if (Called_By_Editor = true) then triggerme := false; else triggerme := true; endif;
+
+ (OrderInformation) := ARGUMENT;
+
+ // Sample OrderInformation - Codeine 30mg Tab|Q|{{{SINGLE-QUOTE}}}9001415601100680{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}9001415601100680{{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}}Per Written{{{SINGLE-QUOTE}}}|9000001090119001|Pharmacy|
+
+ // Fields Components This Order Name | Form Type | Conflicting Order GUIDS | Order Source | Requesting Provider GUID | Order Type |
+
+ if OrderInformation is null then OrderInformation := "||||||"; endif;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ using "OrderManagement"; /* DLL Name */
+ test:= new net_object {{{SINGLE-QUOTE}}}OrderManagement.OrderManagementForm{{{SINGLE-QUOTE}}} with (OrderInformation); /* Namespace.Form */
+ ;;
+ evoke:
+ ;;
+ logic:
+
+ if (triggerme = true)
+ then
+ oeUnsigned:=CALL test.ShowDialog;
+ return_string:= test.text;
+
+ conclude true;
+ else
+ conclude false;
+ endif;
+ ;;
+ action:
+ return (return_string);
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_LOGDOCTORASIN.mlm b/MLMStripper/bin/Debug/SCH/SCH_LOGDOCTORASIN.mlm
new file mode 100644
index 0000000..e3c3edd
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_LOGDOCTORASIN.mlm
@@ -0,0 +1,119 @@
+maintenance:
+
+ title: SCH_LOGDOCTORASIN;;
+ mlmname: SCH_LOGDOCTORASIN;;
+ arden: version 2;;
+ version: 4.00;;
+ institution: St Clair Memorial Hospital;;
+ author: Robert Spence;;
+ specialist: ;;
+ date: 2010-04-22;;
+ validation: testing;;
+
+library:
+ purpose: This MLM calls an Objects+ DLL which statuses doctors as "in house" on the Physician Directory.
+
+
+ IMPORTANT NOTE: THIS MLM SHOULD ONLY BE IN PRODUCTION STATUS IN THE PROD DATABASE.
+
+ IT WILL STATUS A DOCTOR AS IN HOUSE FROM ANY DATABASE, WHICH IS INAPPROPRIATE IN DEV OR TRAIN
+
+
+ ;;
+ explanation:
+
+
+Change history
+
+ 12.23.2010 DW Altered for 5.5. Change event UserLogon to ActivateApplication
+ 08.02.2016 DW H.D. ????? Physician login not working. - Updated this MLM in Prod with no change, just to see if perhaps it was corrupted and this would fix it
+
+
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ //Logging level of execution information
+ log_execution_info:=FALSE;
+
+ using "PhysicianIn";
+ using namespace "PhysicianIn";
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ using "ObjectsPlusXA.SCM.Forms";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
+
+ //The evoking event for this MLM is OrderInit
+ evoking_event_order:= EVENT {ActivateApplication User UserInfo:
+ WHERE CareProvider is NOT NULL
+ And OrderRoleType Matches Pattern "%Physician%"};
+
+ test:= new net_object {{{SINGLE-QUOTE}}}PhysicianIn.PhysicianForm{{{SINGLE-QUOTE}}};
+
+
+ (user_workstation_GUID ) := read last { StateInfo: WorkstationGUID };
+
+ loc := read last {" select l.name "
+ || " from cv3workstation ws with (nolock) "
+ || " join cv3location l with (nolock) on l.guid = ws.locationguid "
+ || " where ws.guid = " || SQL(user_workstation_GUID)
+ || " and (l.code like {{{SINGLE-QUOTE}}}%|Offices |%{{{SINGLE-QUOTE}}} or l.code like {{{SINGLE-QUOTE}}}%|Offsite(WAN) |%{{{SINGLE-QUOTE}}} "
+ || " or l.code like {{{SINGLE-QUOTE}}}%|FNA Offices |%{{{SINGLE-QUOTE}}} or ws.idcode like {{{SINGLE-QUOTE}}}schtermserv%{{{SINGLE-QUOTE}}}) "
+ || " and l.name <> {{{SINGLE-QUOTE}}}UPTCT Cancer Center{{{SINGLE-QUOTE}}} "};
+
+ // dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " " || wsname,"Test","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+
+ userguid :=read last {UserInfo: guid};
+
+ rettype := read last {" select typecode "
+ || " from cv3careprovider with (nolock) "
+ || " where guid = " || SQL(userguid)
+ || " and typecode not like {{{SINGLE-QUOTE}}}Non Staff%{{{SINGLE-QUOTE}}} "
+ || " and typecode like {{{SINGLE-QUOTE}}}%Physician%{{{SINGLE-QUOTE}}} "
+ };
+
+
+ if (rettype is null) or (not (exists rettype )) or (exists loc) then
+ triggerme := false;
+ else
+ triggerme := true;
+ endif;
+
+
+
+ ;;
+ evoke: evoking_event_order;
+ ;;
+ logic:
+
+ //provider list for the pilot
+ /* prov_list:= ("7000001175119001",//Spence, Robert
+ "6000001149119001",
+ "4000001091119001",
+ "9000002364101190",
+ "1000001064119001",
+ "7000001272119001",
+ "1000001032119001",
+ "3000001032119001",
+ "4000001244119001",
+ "6000001208119001");
+*/
+
+ if (triggerme = true)
+ then
+ oeUnsigned:=CALL test.ShowDialog;
+ conclude true;
+ else
+ conclude false;
+ endif;
+
+
+ ;;
+ action: //all of the action is done by the call to the FFI
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_MEDICARE_INSURANCE_AUDIT_COLUMN_UPDATE.mlm b/MLMStripper/bin/Debug/SCH/SCH_MEDICARE_INSURANCE_AUDIT_COLUMN_UPDATE.mlm
new file mode 100644
index 0000000..8a9b1ba
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_MEDICARE_INSURANCE_AUDIT_COLUMN_UPDATE.mlm
@@ -0,0 +1,218 @@
+maintenance:
+
+ title: SCH_MEDICARE_INSURANCE_AUDIT_COLUMN_UPDATE;;
+ mlmname: SCH_MEDICARE_INSURANCE_AUDIT_COLUMN_UPDATE;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp;;
+ specialist: Maria Pest, Allscripts Corp;;
+ date: 2013-05-30;;
+ validation: testing;;
+
+library:
+ purpose: Update an Enterprise Defined Patient List Column with name of patient{{{SINGLE-QUOTE}}}s Medicare Insurance Plan.
+
+ ;;
+
+ explanation: JAThomas Project - Displays the name of the eligible Medicare Plan that insures patient.
+
+ Eligible list of Medicare Insurance programs:
+ * AETNA MEDICARE
+ * BC 363 FREEDOM BLUE
+ * BC 363 SECURITY BLUE
+ * BRAVO HEALTH
+ * CARELINK ADVANTRA
+ * GATEWAY MED ASSURED
+ * HA ADVANTRA
+ * HUMANA MEDICARE
+ * MEDICARE
+ * MEDICARE HMO OTHER
+ * MEDICARE PFFS OTHER
+ * STERLING OPTION 1
+ * UH MEDICARE UNISON
+ * UPMC CONTEMPORARY
+ * UPMC FOR KIDS MA
+ * UPMC FOR LIFE
+ * UPMC FOR YOU MA
+ * UPMC HEALTH PLAN
+ * UPMC SPECIALTY PLAN
+
+ Change history
+
+ 09.30.2013 JML CSR 31735 - Created
+
+ ;;
+ keywords: ObjectsPlus/XA, Order
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Error Handling vars for ObjectsPlus Method calls
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit: THIS
+ where TypeCode = "Emergency"};
+ endif;
+
+ //Event Trigger
+ visit_enter := Event { ClientVisitEnter Any ClientVisit : WHERE TypeCode = "Inpatient" };
+ visit_modify := Event { ClientVisitModify Any ClientVisit : WHERE TypeCode = "Inpatient" };
+
+ MedicareColumn_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "EnterprisePatientListColumn Object",
+ rule_number := 2025 ];
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ updateColumn := false;
+
+ (ClientVisitGuid, ClientGuid, VisitType) := read last {ClientVisit : GUID, ClientGuid, TypeCode REFERENCING EvokingObject};
+
+ if (EvokingEventType = visit_enter.Type OR EvokingEventType = visit_modify.Type) then
+
+ //Check for Medicare Insurance
+ medicarePlan_Name := read {"SELECT ic.Name"
+ || " FROM CV3FRPContract fc WITH (NOLOCK) JOIN CV3FRP f WITH (NOLOCK)"
+ || " ON fc.FRPGUID = f.GUID"
+ || " JOIN SXAAMInsuranceCarrier ic WITH (NOLOCK)"
+ || " ON f.InsuranceCarrierID = ic.InsuranceCarrierID"
+ || " WHERE fc.ClientGUID = " || Sql(ClientGuid)
+ || " AND fc.ClientVisitGUID = " || Sql(ClientVisitGuid)
+ || " AND fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
+ || " AND f.Name IN ( {{{SINGLE-QUOTE}}}AETNA MEDICARE{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}BC 363 FREEDOM BLUE{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}BC 363 SECURITY BLUE{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}BRAVO HEALTH{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}CARELINK ADVANTRA{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}GATEWAY MED ASSURED{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}HA ADVANTRA{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HUMANA MEDICARE{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}MEDICARE{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}MEDICARE HMO OTHER{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}MEDICARE PFFS OTHER{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}STERLING OPTION 1{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}UH MEDICARE UNISON{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}UPMC CONTEMPORARY{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}UPMC FOR KIDS{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}UPMC FOR LIFE{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}UPMC FOR YOU{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}UPMC HEALTH PLAN{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}UPMC SPECIALTY PLAN{{{SINGLE-QUOTE}}})"};
+
+ if (exists medicarePlan_Name) then
+ updateColumn := true;
+ medColValue := last of (medicarePlan_Name);
+ else
+ updateColumn := true;
+ medColValue := "";
+ endif;
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 24 second after time of visit_enter;
+ 24 second after time of visit_modify;
+ ;;
+ logic:
+
+ if (EvokingObject is null) then
+ conclude false;
+ endif;
+
+ if (updateColumn = true) then
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" || ex.Message || "\n\n";
+
+ if (ex.InnerException is not null net_object) then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ conclude true;
+ endcatch;
+
+ try
+ eColumnName := "Medicare Insurance Audit";
+ eColumnValue := medColValue;
+
+ MedicareDefinedColumn_Obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
+ with (client_visit_obj, eColumnName);
+ colValue := MedicareDefinedColumn_Obj.Value;
+
+ if (colValue <> eColumnValue) then
+ MedicareDefinedColumn_Obj.Value := eColumnValue;
+ MedicareColumn_Dest.ObjectsPlus := MedicareDefinedColumn_Obj;
+ endif;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}Enterprise Patient List Column{{-R}}\n"
+ || ex.Message || "\n\n";
+
+ if (ex.InnerException is not null net_object) then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if (MedicareDefinedColumn_Obj is not null) then
+ void := call MedicareDefinedColumn_Obj.Dispose;
+ MedicareDefinedColumn_Obj := null;
+ endif;
+
+ MedicareColumn_Dest := null;
+ endcatch;
+
+ if (client_visit_obj is not null) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj := null;
+ endif;
+
+ endif;
+
+ conclude true;
+
+ ;;
+ action:
+
+ if (error_occurred) then
+ write "An error occurred in the MLM {{+B}}SCH_MEDICARE_PLAN_B_COLUMN_UPDATE{{-B}}. "
+ || " Please notify your system administrator that an error message has "
+ || " occurred for this patient. They will review the following error "
+ || " message:\n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+ if (exists MedicareColumn_Dest) then
+ write true at MedicareColumn_Dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_MEDICARE_PLAN_B_COLUMN_UPDATE.mlm b/MLMStripper/bin/Debug/SCH/SCH_MEDICARE_PLAN_B_COLUMN_UPDATE.mlm
new file mode 100644
index 0000000..a42fef2
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_MEDICARE_PLAN_B_COLUMN_UPDATE.mlm
@@ -0,0 +1,175 @@
+maintenance:
+
+ title: SCH_MEDICARE_PLAN_B_COLUMN_UPDATE;;
+ mlmname: SCH_MEDICARE_PLAN_B_COLUMN_UPDATE;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp;;
+ specialist: Maria Pest, Allscripts Corp;;
+ date: 2013-05-30;;
+ validation: testing;;
+
+library:
+ purpose: Update an Enterprise Defined Patient List Column with Medicare for eligible patients.
+
+ ;;
+
+ explanation: For patients that have Medicare Plan A and/or Medicare Plan B, display the word "Medicare" in an
+ Enterprise Defined Patient List Column name {{{SINGLE-QUOTE}}}Medicare{{{SINGLE-QUOTE}}}. For patients that have BCBS
+ Freedom or Security Blue (both Medicare plans), display the word "Highmark" in the same
+ Enterprise Defined Patient List Column.
+
+ AMPFM manages the insurance demographic,
+ thus, the values for Medicare-based insurance is passed from AMPFM into SCM and displays in SCM
+ as a Patient Comment.
+
+
+ Change history
+
+ 05.30.2013 JML CSR #31464 - Created
+ 07.09.2013 JML Moved to Production
+ 09.05.2013 JML Modified MLM to include Highmark requirement for reporting
+ G-codes.
+ 09.30.2013 JML Moved to Production
+ 10.03.2013 JML Modified Highmark logic to look in Financial/Employer Patient Information for
+ BC Security or Freedom Blue
+ 10.06.2015 JML WO # 1892807: change name of GCode Visit List Columns.
+ 11.07.2017 JML CSR# 35970: Initially deleted this MLM from PRD; user wanted the MLM / Column back,
+ so I modified the MLM with a new column name and adapted it to use
+ the generic SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN MLM and copied back to PRD
+ 01.08.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
+ that was previously read from comment created by AMPFM.
+ 10.25.2018 JML CSR# 37522: Optimization - removed the ClientVisitModify evoking event and replaced with
+ InsuranceModify evoking event. Trying to decrease the number of times that
+ this MLM is called when registration / visit changes occur.
+
+ ;;
+ keywords: ObjectsPlus/XA, Order
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Error Handling vars for ObjectsPlus Method calls
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit: THIS
+ where TypeCode = "Emergency"};
+ endif;
+
+ //Create Enterprise Defined Column Obj
+ MCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Include generic function to update enterprise defined column
+ create_MC_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ updateColumn := false;
+
+ //Event Trigger
+ medBVisit := Event { ClientVisitEnter Any ClientVisit };
+ medBInsuranceModify := Event { InsuranceModify Any ClientVisit };
+
+
+ if ( EvokingEventType = medBVisit.Type ) then
+ (ClientVisitGuid, ClientGuid, ChartGuid) := read last {ClientVisit : GUID, ClientGuid, ChartGuid REFERENCING EvokingObject};
+ elseif ( EvokingEventType = medBInsuranceModify.Type ) then
+ ( ClientVisitGuid, ClientGuid ) := read last { Insurance : ClientVisitGUID, ClientGUID REFERENCING EvokingObject };
+ ( ChartGUID ) := read last { ClientVisit : ChartGUID };
+ endif;
+
+ //Check for Highmark Insurance first
+ (medPlanHM_Val) := read {"SELECT ic.Name"
+ || " FROM CV3FRPContract fc WITH (NOLOCK) JOIN CV3FRP f WITH (NOLOCK)"
+ || " ON fc.FRPGUID = f.GUID"
+ || " JOIN SXAAMInsuranceCarrier ic WITH (NOLOCK)"
+ || " ON f.InsuranceCarrierID = ic.InsuranceCarrierID"
+ || " WHERE fc.ClientGUID = " || Sql(ClientGuid)
+ || " AND fc.ClientVisitGUID = " || Sql(ClientVisitGuid)
+ || " AND fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
+ || " AND (f.Name LIKE {{{SINGLE-QUOTE}}}BC%SECURITY%BLUE%{{{SINGLE-QUOTE}}}"
+ || " OR f.Name LIKE {{{SINGLE-QUOTE}}}BC%FREEDOM%BLUE%{{{SINGLE-QUOTE}}})"};
+
+ if (exists medPlanHM_Val) then
+ updateColumn := true;
+ medColValue := "Highmark";
+ else
+
+ //**** CSR 26413 CHANGE BEGIN (Modified SQL to use CV3ClientUserData)
+ //Check for patient comment Medicare Plan B
+ (medPlanB_Val) := read {"SELECT cud.Value"
+ || " FROM CV3Client c WITH (NOLOCK) JOIN CV3FRPContract fc WITH (NOLOCK)"
+ || " ON c.GUID = fc.ClientGUID"
+ || " JOIN CV3ClientUserData cud WITH (NOLOCK)"
+ || " ON c.GUID = cud.ClientGUID"
+ ||" AND fc.GUID = cud.ObjGUID"
+ || " WHERE c.GUID = " || SQL(ClientGuid)
+ || " AND cud.Active = 1"
+ || " AND cud.UserDataCode IN ( {{{SINGLE-QUOTE}}}PartA_ECLPI{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}PartB_ECLPI{{{SINGLE-QUOTE}}} ) "};
+
+ if (exists medPlanB_Val) then
+ if ( ( "-1" IN medPlanB_Val ) ) then
+ updateColumn := true;
+ medColValue := "Medicare";
+ else
+ updateColumn := true;
+ medColValue := "";
+ endif;
+ //**** CSR 26413 CHANGE END
+
+ endif;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+
+ 2 seconds after time of medBVisit;
+ 2 seconds after time of medBInsuranceModify;
+ ;;
+ logic:
+ if (EvokingObject is null) then
+ conclude false;
+ endif;
+
+ if (updateColumn = true) then
+ eColumnName := "Med B/Highmark";
+ eColumnValue := medColValue;
+
+ MedicareColUpdate := NEW MCObj WITH [
+ column_name := eColumnName,
+ column_value := eColumnValue,
+ client_guid := ClientGuid,
+ chart_guid := ChartGuid,
+ client_visit_guid := ClientVisitGuid
+ ];
+
+ return_value := call create_MC_column WITH ( MedicareColUpdate );
+ endif;
+
+ conclude true;
+ ;;
+ action:
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_METFORMINPRECAUTIONS.mlm b/MLMStripper/bin/Debug/SCH/SCH_METFORMINPRECAUTIONS.mlm
new file mode 100644
index 0000000..c977a06
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_METFORMINPRECAUTIONS.mlm
@@ -0,0 +1,206 @@
+maintenance:
+
+ title: Dosing Alerts for Metformin;;
+ mlmname: SCH_MetforminPrecautions;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair;;
+ author: Teresa Spicuzza, Allscripts Corp;;
+ specialist: Teresa Spicuzza;;
+ date: 2012-08-20;;
+ validation: testing;;
+
+library:
+ purpose: Metformin Dosing Recommendations
+ ;;
+
+ explanation: MLM will read table and suggest dosing based upon medication, dose and CrCl.
+
+ Change history
+ 08.20.2012 TMS Created CSR 30865
+ 08.31.2012 TMS Removed alert for users other than physicians, physician extenders, IT and Pharmacists.
+ This allows nursing dept staff to enter order for documentation. Pharmacist can override
+ by entering a comment.
+ 06.03.2019 TMS Removed statement from Creatinine retrieval to limit results to past 24 hours. Query will
+ now pull the most recent result for this chart (admission). CSR 38251
+ ;;
+ keywords: Dosing
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+ //CrCl_info:= mlm {{{SINGLE-QUOTE}}}SCH_Func_Creatinine_Clearance{{{SINGLE-QUOTE}}};
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {Order: THIS
+ where Name="Metformin 500mg Tab" };
+ endif;
+
+ doalert := false;
+ order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"};
+
+ (CatalogItemObj, FrequencyValue, UOMValue, DoseValue, OrderName, AdminIns, UserSchedType ,UserSchedDays, UserSchedDoses) := read last {Order: OrderCatalogMasterItem, FrequencyCode, UOM, DosageLow, Name, AdminInstructions, Interval, DaysInInterval, DoseMultiplier
+ REFERENCING EvokingObject};
+
+ CatalogClassTypeValueObj := read last {OrderCatalogMasterItem: CatalogClassTypeValue,
+ REFERENCING CatalogItemObj};
+
+ ClassTypeValue_code_list, ClassTypeValue_value_list := read {CatalogClassTypeValue: Code, Value
+ REFERENCING CatalogClassTypeValueObj where code = "PRX_MetforminMed"};
+
+
+
+ fire_on_User := ("IT","MD","DO","DDS","DPM","PA","PA-C","CRNP","RPh");
+ // fire_on_User := ("tspicuzza","deiler","shead","gfino","ccorbettit", "dwarnick",
+ // "dmiklavichis","ageorgulis","dbellissimo","kbaumgarte");
+
+ /* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
+ (user_id,userguid) :=read last {UserInfo: idcode, guid};
+
+ UserCode := read last
+ {"Select occupationcode "
+ ||" From cv3user with (nolock) "
+ ||" Where Guid = " || SQL(userguid) };
+
+ continue_processing:= usercode in fire_on_User;
+
+ If UserCode = "RPh" then
+ alert_setting := "Must Comment";
+ else
+ alert_setting := "No Override Allowed";
+ endif;
+
+ dose_alert_dest := destination {alert} with
+ [alert_type := "Warning",
+ short_message := "Dosing Recommendation",
+ priority := "Low",
+ scope := "Chart",
+ rule_group := "Renal Dosing",
+ rule_number := 4050,
+ send_with_order := send_alert,
+ alert_dialog_settings :=alert_setting,
+ display_alert := true];
+
+
+// continue_processing:= user_id in fire_on_User;
+ continue_processing:= usercode in fire_on_User;
+
+
+ If continue_processing = true then
+ (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus };
+ (UserGUID ) := read last { UserInfo: GUID };
+
+
+ patientgender := read last { ClientInfo: Gendercode };
+
+
+ Creatinine := 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(clientguid)
+// || " and o.performeddtm >= (DATEADD(hour, -24, getdate())) "
+ || " and bo.itemname = {{{SINGLE-QUOTE}}}Creatinine Plasma/Serum{{{SINGLE-QUOTE}}} "
+ || " order by o.performeddtm desc "
+ };
+
+
+
+/*
+ // added to use typed in creatinine level for testing only - Use in ***DEV ONLY ***
+ tempcreat := (adminins as number);
+ crentered := (tempcreat is number);
+
+
+ If crentered = false then tempcreat := null; endif;
+
+ If Creatinine is null then creatinine := tempcreat; endif;
+
+ // end of logic for ***DEV ONLY ***
+*/
+
+
+
+ If ((PatientGender = "Female") and ((Creatinine as number) > 1.4 )) then
+
+ alert_message := "{{+B}}{{+R}} Contraindicated in Women with SCr > 1.4 {{-R}} \n Please monitor SCr and resume metformin when renal function improves.{{-B}}";
+ doalert := true;
+
+ endif;
+
+ If ((PatientGender = "Male") and ((Creatinine as number) > 1.5 )) then
+
+ alert_message := "{{+B}}{{+R}} Contraindicated in Men with SCr > 1.5 {{-R}} \n Please monitor SCr and resume metformin when renal function improves.{{-B}}";
+ doalert := true;
+
+ endif;
+
+ else
+ doalert := false;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke: order_enter_event;
+
+ ;;
+ logic:
+
+ if called_by_editor
+ then
+ conclude false;
+ endif;
+
+ If "Yes" not in ClassTypeValue_value_list
+ then
+ conclude false;
+ endif;
+
+ //----------------------------------------------------------------
+ // If there is no evoking object then do nothing, this can
+ // only be true for the MLM Editor
+ //----------------------------------------------------------------
+ if EvokingObject is null
+ then
+ conclude false;
+ endif;
+ if continue_processing = false
+ then
+ conclude false;
+ endif;
+
+
+ conclude doalert;
+
+ ;;
+ action:
+ write alert_message at dose_alert_dest
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_MISC_DOSING_RECOMMENDATIONS.mlm b/MLMStripper/bin/Debug/SCH/SCH_MISC_DOSING_RECOMMENDATIONS.mlm
new file mode 100644
index 0000000..d110f6c
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_MISC_DOSING_RECOMMENDATIONS.mlm
@@ -0,0 +1,554 @@
+maintenance:
+
+ title: Dosing recommendations based on age, weight, or total dose;;
+ mlmname: SCH_Misc_Dosing_Recommendations;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair;;
+ author: Teresa Spicuzza, Allscripts Corp;;
+ specialist: Teresa Spicuzza;;
+ date: 2012-08-20;;
+ validation: testing;;
+
+library:
+ purpose: Dosing Recommendations and Warnings based on age or weight
+ ;;
+
+ explanation: MLM will read table and suggest dosing based upon medication, dose and patient age or weight.
+
+ Change history
+ 08.20.2012 TMS Created CSR 30865
+ 09.05.2012 TMS Added drug ordered information to dialog of alert CSR 30865
+ 06.05.2013 TMS Updated with additional rules to accommodate additional drugs. CSR 31334
+ 05.31.2017 TMS Updated with rule J for additional drugs. CSR 35636
+ 05.16.2018 TMS Add "With Dialysis Treatment" to Frequency retrievals that contain As Ordered. CSR 33940
+ 06.25.2018 TMS Add New Rule type "K" to present same drug/age alert as Rule D, except to suppress it for
+ users with an OrderRoleType of "Anesthesia Physician". CSR 36984
+ 09.30.2019 TMS Updated alert to require reason when alert presented to user not in physician/physician extender
+ group. CSR 37977
+
+ ;;
+ keywords: Dosing
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+ //alert_settings := "";
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {Order: THIS
+ where Name="Ketorolac Inj" };
+ endif;
+
+ doalert := false;
+ SupressAlertFlag := false;
+ order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"};
+
+ (CatalogItemObj, FrequencyValue, UOMValue, DoseValue, OrderName, AdminIns, UserSchedType ,UserSchedDays, UserSchedDoses, OrderingProviderGuid, StopDtm) := read last
+ {Order: OrderCatalogMasterItem, FrequencyCode, UOM, DosageLow, Name, AdminInstructions, Interval, DaysInInterval, DoseMultiplier, CareProviderGuid, StopDtm
+ REFERENCING EvokingObject};
+
+
+ CatalogClassTypeValueObj := read last {OrderCatalogMasterItem: CatalogClassTypeValue,
+ REFERENCING CatalogItemObj};
+
+ ClassTypeValue_code_list, ClassTypeValue_value_list := read {CatalogClassTypeValue: Code, Value
+ REFERENCING CatalogClassTypeValueObj where code = "PRX_MiscDosing"};
+
+ /* Get the OrderAdditionalInfo object pointer */
+ OrderAdditionalInfoObj := read last { Order: OrderAdditionalInfo
+ REFERENCING EvokingObject };
+
+ /* Get information from the OrderAdditionalInfo object */
+ (SummaryLine, FreqfromTime,FreqUOM, StopAfterValue, StopAfterOption) := read last { OrderAdditionalInfo: FreqSummaryLine, FreqFromTime, FreqUOM, StopAfterValue, StopAfterOption
+ REFERENCING OrderAdditionalInfoObj };
+// (Defintiontype, freqfromtime2, freqtimetovalue, frequom2) := read
+// { " select Definitiontype,timefromvalue, timetovalue, timeuom from CV3Frequency "
+// || " where Code = " || SQL(summaryline) };
+
+ /* Get the OrderUserData object pointer */
+ OrderUserDataObj := read last
+ { Order: OrderUserData
+ REFERENCING EvokingObject };
+
+ for r in (1 seqto(count(OrderUserDataObj))) do
+
+ CurOrder_UserDataFields := OrderUserDataObj[r];
+ (userdatacodelist, valuelist ) := read { OrderUserData: UserDataCode, Value REFERENCING CurOrder_UserDataFields } ;
+ for s in (1 seqto(count(userdatacodelist))) do
+ if ((userdatacodelist [s] = "PRX_Suppress_Alert_Flag") and valuelist [s] = "1" ) then
+ SupressAlertFlag := True;
+ endif;
+ enddo;
+ enddo;
+
+
+ PainMgtDoc := read
+ { " select Guid from CV3CareProvider "
+ || " where DisplayName = {{{SINGLE-QUOTE}}}Spicuzza, Teresa{{{SINGLE-QUOTE}}}"
+ || " or DisplayName = {{{SINGLE-QUOTE}}}Rivero-Becerra, Jorge N{{{SINGLE-QUOTE}}}"
+ };
+ If OrderingProviderGuid in PainMgtDoc then PainMgtOverride := True; else PainMgtOverride := False; endif;
+
+
+ // fire_on_User := ("IT","MD","DO","DDS","DPM","PA","PA-C","CRNP","RPh");
+ fire_on_UserCPOE := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT");
+ fire_on_User := ("RN","RPh");
+ // fire_on_User := ("tspicuzza","deiler","shead","gfino","ccorbettit", "dwarnick",
+ // "dmiklavichis","ageorgulis","dbellissimo","kbaumgarte");
+
+ /* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
+ (user_id,userguid) :=read last {UserInfo: idcode, guid};
+
+ UserCode, OrderRole := read last
+ {"Select occupationcode, orderroletype "
+ ||" From cv3user with (nolock) "
+ ||" Where Guid = " || SQL(userguid) };
+
+
+// continue_processing:= user_id in fire_on_User;
+// continue_processing:= usercode in fire_on_User;
+
+ If usercode in fire_on_UserCPOE then
+ alert_settings := "";
+ UDDD_dictionary_name := "";
+ UDDD_is_restricted := FALSE;
+ continue_processing := true;
+ elseif usercode in fire_on_User then
+ alert_settings := "Must Comment";
+ UDDD_dictionary_name := "AlertAckComment";
+ UDDD_is_restricted := TRUE;
+ continue_processing := true;
+ else continue_processing := false;
+ endif;
+
+ dose_alert_dest := destination {alert} with
+ [alert_type := "Warning",
+ short_message := "Dosing Recommendation",
+ priority := "High",
+ scope := "Chart",
+ rule_group := "Dosing Recommendations",
+ rule_number := 4080,
+ send_with_order := send_alert,
+ alert_dialog_settings := alert_settings,
+ ack_comment_UDDD := UDDD_dictionary_name,
+ ack_comment_UDDD_is_restricted := UDDD_is_restricted,
+ display_alert := true];
+
+
+ for r in (1 seqto 1) do
+ classvaluelist := call str_parse with ClassTypeValue_value_list [r],",";
+
+ classvalue := classvaluelist[1];
+ enddo;
+
+ if EvokingEvent = order_enter_event and continue_processing = true and SupressAlertFlag = False then
+
+ if "PRX_MiscDosing" in ClassTypeValue_code_list then
+ continue := "yes";
+ else
+ continue := "no";
+ endif;
+ endif;
+
+ If continue = "yes" then
+ (schedtime, freqcode, timefrom, timeuom) := read last
+ {" select fsd.ScheduledTime, cft.FrequencyCode, cft.TimeFromValue, cft.TimeUom from CV3CodedFreqTranslation cft"
+ || " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
+ || " where cft.FrequencyCode = " || sql(frequencyvalue) || " and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.Active = 1"
+ || " order by fsd.ScheduledTime "
+ };
+
+ (TimesPerDay) := read last {" select count (fsd.ScheduledTime) from CV3CodedFreqTranslation cft"
+ || " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
+ || " where cft.FrequencyCode = " || sql(frequencyvalue) || " and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.Active = 1"
+ };
+
+
+ Oncegroup := ("Now", "STAT", "Once", "One Time", "Today,", "Load", "Pre-procedure",
+ "Post-procedure","Pre-Transfusion", "Post-Transfusion","Between Blood",
+ "PRE OP,", "POST OP", "As Ordered", "As Directed", "Given in Infusion Center",
+ "Given in Delivery Room", "With Dialysis Treatment");
+
+
+
+ If frequencyvalue in Oncegroup then
+ frequencygroup := "OneTime";
+ else frequencygroup := "Other";
+ endif;
+
+ If frequencyvalue <> "" and frequencygroup <> "OneTime" then
+
+ If timefrom = 1 and timeuom = "day" then
+ If TimesPerDay = 1 then frequencygroup := "Q24H"; Freqfactor := 24; endif;
+ If TimesPerDay = 2 then frequencygroup := "Q12H"; Freqfactor := 12; endif;
+ If TimesPerDay = 3 then frequencygroup := "Q8H"; Freqfactor := 8; endif;
+ If TimesPerDay = 4 then frequencygroup := "Q6H"; Freqfactor := 6; endif;
+ If TimesPerDay = 6 then frequencygroup := "Q4H"; Freqfactor := 4; endif;
+ If TimesPerDay = 8 then frequencygroup := "Q3H"; Freqfactor := 3; endif;
+ If TimesPerDay = 12 then frequencygroup := "Q2H"; Freqfactor := 2; endif;
+ If TimesPerDay = 24 then frequencygroup := "Q1H"; Freqfactor := 1; endif;
+
+ elseif timefrom = 2 and timeuom = "day" then
+ If TimesPerDay = 1 then frequencygroup := "Q48H"; endif;
+
+ endif;
+ endif;
+
+ If frequencyvalue = "" then
+ If UserSchedType = "Weekly" then
+ If UserSchedDays <= 2 and UserSchedDoses = 1 then
+ frequencygroup := "Q7D";
+ endif;
+
+ elseif UserSchedType = "Daily" and UserSchedDays = 1 and FreqFromTime = 1 and FreqUom = "day" then
+ If UserSchedDoses = 1 then frequencygroup := "Q24H"; Freqfactor := 24; endif;
+ If UserSchedDoses = 2 then frequencygroup := "Q12H"; Freqfactor := 12; endif;
+ If UserSchedDoses = 3 then frequencygroup := "Q8H"; Freqfactor := 8; endif;
+ If UserSchedDoses = 4 then frequencygroup := "Q6H"; Freqfactor := 6; endif;
+ If UserSchedDoses = 6 then frequencygroup := "Q4H"; Freqfactor := 4; endif;
+ If UserSchedDoses = 8 then frequencygroup := "Q3H"; Freqfactor := 3; endif;
+ If UserSchedDoses = 12 then frequencygroup := "Q2H"; Freqfactor := 2; endif;
+ If UserSchedDoses = 24 then frequencygroup := "Q1H"; Freqfactor := 1; endif;
+
+ elseif UserSchedType = "Daily" and UserSchedDays = 1 and FreqFromTime = 2 and FreqUom = "day" then
+ If UserSchedDoses = 1 then frequencygroup := "Q48H"; endif;
+
+ endif;
+ endif; //If frequencyvalue = ""
+
+ DurationFactor := StopAfterValue;
+ If StopAfterOption = 2 then DurationType := "Hours"; endif;
+ If StopAfterOption = 3 then DurationType := "Mins"; endif;
+ If StopAfterOption = 4 then DurationType := "Times"; endif;
+ If StopAfterOption = 1 then DurationType := "Days"; endif;
+ If StopAfterOption = 0 then DurationFactor := 1; DurationType := "Days"; endif;
+
+// Calculate the Total Daily Dose //
+ If (DoseValue as number) > 0 then
+ If (UserSchedDoses as number) > 0 and UserSchedType = "Daily" and UserSchedDays = 1 then
+
+ If DurationType = "Days" then
+ TotalDailyDose := ((UserSchedDoses as number) * (DoseValue as number));
+
+ elseif DurationType = "Times" and (DurationFactor as number) < (UserSchedDoses as number) then
+ TotalDailyDose := ((DurationFactor as number) * (DoseValue as number));
+
+ elseif DurationType = "Hours" and (DurationFactor as number) <= 24 then
+ TotalDailyDose := (Int((DurationFactor as number)/(FreqFactor as number))) * (DoseValue as number);
+
+ elseif DurationType = "Mins" and (DurationFactor as number) <= 999 then
+ TotalDailyDose := (Int((DurationFactor as number) / 60)/(FreqFactor as number)) * (DoseValue as number);
+ endif;
+ elseif (TimesPerDay as number) > 0 then
+ TotalDailyDose := ((TimesPerDay as number) * (DoseValue as number));
+ If DurationType = "Days" then
+ TotalDailyDose := ((TimesPerDay as number) * (DoseValue as number));
+
+ elseif DurationType = "Times" and (DurationFactor as number) < (TimesPerDay as number) then
+ TotalDailyDose := ((DurationFactor as number) * (DoseValue as number));
+
+ elseif DurationType = "Hours" and (DurationFactor as number) <= 24 then
+ TotalDailyDose := (Int((DurationFactor as number)/(FreqFactor as number))) * (DoseValue as number);
+
+ elseif DurationType = "Mins" and (DurationFactor as number) <= 999 then
+ TotalDailyDose := (Int((DurationFactor as number) / 60)/(FreqFactor as number)) * (DoseValue as number);
+ endif;
+
+ else TotalDailyDose := "Unknown";
+
+ endif;
+ endif;
+
+
+ (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus };
+ (UserGUID ) := read last { UserInfo: GUID };
+
+// 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));
+
+// Get the patient weight
+ wtgm := read last
+ { " Select Text from CV3PhysicalNoteDeclaration "
+ || " where ClientGUID = " || SQL(ClientGuid)
+ || " and ClientVisitGUID = " || SQL(ClientVisitGuid)
+ || " and TypeCode = {{{SINGLE-QUOTE}}}weight{{{SINGLE-QUOTE}}} "
+ || " order by Entered asc "
+ };
+
+ patientwt := (wtgm as number) / 1000;
+
+
+// Loop through dictionary to parse fields needed to see if rule exists for ordered drug.
+if continue = "yes" then
+ medlist := ();
+ medlist := read { "select value from cv3userdictionaryvalue v with (nolock)"
+ || " where userdictionarycode = {{{SINGLE-QUOTE}}}PRX_Misc_Dosing_Rules{{{SINGLE-QUOTE}}} "
+ || " and active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
+ };
+
+
+ NumRules:= count medlist;
+ for k in (1 seqto (NumRules)) do
+ rules := call str_parse with medlist[k],"|";
+
+ RuleClass := rules[1];
+ RuleType := rules[2];
+ RuleMsgType := rules[3];
+ RuleOrder := rules[4];
+ RuleDose := rules[5];
+ RuleDoseTD := rules[6];
+ RuleUOM := rules[7];
+ RuleRoute := rules[8];
+ RuleFreqQual := rules[9];
+ RuleFreq := rules[10];
+ RuleAge := rules[11];
+ RuleWtLow := rules[12];
+ RuleWtHi := rules[13];
+ RuleMsg := rules[14];
+
+
+// Compare ordering info with rule info and process when match found.
+ If RuleClass = classvalue and ruletype = "A" then
+
+ If ((DoseValue as number)> (RuleDose as number)) and UOMValue = RuleUom then
+
+ If RuleFreqQual = "Is" and Frequencygroup = RuleFreq then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n\n {{+R}}" || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ elseif RuleFreqQual = "IsNot" and Frequencygroup <> RuleFreq then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || " \n\n {{+R}}" || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ endif;
+ endif;
+
+
+ elseif RuleClass = classvalue and ruletype = "B" then
+
+ If ((DoseValue as number)> (RuleDoseHi as number)) and UOMValue = RuleUom then
+
+ If RuleFreqQual = "Is" and Frequencygroup = RuleFreq then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n This patient is " || patientage || " years old."
+ || "\n\n {{+R}} " || Rulemsg || "{{-R}} {{-B}}";
+
+ doalert := true;
+
+ elseif RuleFreqQual = "IsNot" and Frequencygroup <> RuleFreq then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n\n {{+R}}" || Rulemsg || "{{-R}} {{-B}}";
+
+ doalert := true;
+
+ endif;
+ endif;
+
+ elseif RuleClass = classvalue and ruletype = "C" then
+
+ If ((PatientWt as number) < (RuleWtLow as number)) and ((DoseValue as number)>= (RuleDose as number)) and UOMValue = RuleUom then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n\n {{+R}}" || Rulemsg || "{{-R}} {{-B}}";
+
+ doalert := true;
+ endif;
+
+ elseif RuleClass = classvalue and ruletype = "D" then
+
+ If ((PatientAge as number) > (RuleAge as number)) then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n This patient is " || patientage || " years old."
+ || "\n\n {{+R}} " || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ endif;
+
+ elseif RuleClass = classvalue and ruletype = "E" then
+
+ If ((PatientAge as number) > (RuleAge as number)) and ((TotalDailyDose as number) > (RuleDoseTD as number)) then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n The total daily dose for this order is " || TotalDailyDose || UOMValue
+ || "\n\n {{+R}} " || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ endif;
+
+ elseif RuleClass = classvalue and ruletype = "F" then
+
+ If RuleMsgType = "PMO" and PainMgtOverride = false then
+
+ If ((DoseValue as number) > (RuleDose as number)) then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n\n {{+R}}" || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+
+ endif;
+ endif;
+
+ elseif RuleClass = classvalue and ruletype = "G" then
+
+ If RuleMsgType = "PMO" and PainMgtOverride = false then
+
+ If ((TotalDailyDose as number) > (RuleDoseTD as number)) then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n The total daily dose for this order is " || TotalDailyDose || UOMValue
+ || "\n\n {{+R}} " || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ endif;
+ endif;
+
+ elseif RuleClass = classvalue and ruletype = "H" then
+
+ If RuleUOM = "mg/kg/day" and UomValue = "mg" then
+ TotalDosePerWgt := (RuleDose as number) * (patientwt as number);
+
+ If ((TotalDailyDose as number) > (TotalDosePerWgt as number)) then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " " || UomValue|| ", " || SummaryLine
+ || "\n The total daily dose for this order is " || TotalDailyDose || UOMValue
+ || "\n\n {{+R}} " || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ endif;
+ endif;
+
+ elseif RuleClass = classvalue and ruletype = "J" then
+
+ If ((PatientAge as number) > (RuleAge as number)) and ((DoseValue as number) > (RuleDose as number)) then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n This patient is " || patientage || " years old."
+ || "\n\n {{+R}} " || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ endif;
+
+ elseif RuleClass = classvalue and ruletype = "K" and OrderRole <> "Anesthesia Physician" then
+
+ If ((PatientAge as number) > (RuleAge as number)) then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n This patient is " || patientage || " years old."
+ || "\n\n {{+R}} " || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ endif;
+
+ elseif RuleClass = classvalue and ruletype = "L" and (StopAfterOption = 0 and StopDtm is null) then
+
+
+ If RuleFreqQual = "Is" and Frequencygroup = RuleFreq then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n\n {{+R}} " || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ elseif RuleFreqQual = "IsNot" and Frequencygroup <> RuleFreq then
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n\n {{+R}} " || Rulemsg || "{{-R}} {{-B}}";
+
+ doalert := true;
+
+ endif;
+
+ elseif RuleClass = classvalue and ruletype = "M" and (StopAfterOption = 0 and StopDtm is null) then
+ //Digoxin alert only
+
+
+ If RuleFreqQual = "IsNot" and Frequencygroup not in ("Q24H","Q48H","OneTime") then
+ If UserCode = "RPh" then
+ alert_settings := "Must Comment";
+ else
+
+ alert_settings := "No Override Allowed";
+ endif;
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || " "|| UomValue|| ", " || SummaryLine
+ || "\n\n {{+R}} " || Rulemsg || "{{-R}} {{-B}}";
+
+ doalert := true;
+
+ endif;
+
+
+
+ else
+ nomessage := "";
+ endif;
+
+
+ enddo;
+ endif;
+
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: order_enter_event;
+
+ ;;
+ logic:
+
+ if called_by_editor
+ then
+ conclude false;
+ endif;
+
+ //----------------------------------------------------------------
+ // If there is no evoking object then do nothing, this can
+ // only be true for the MLM Editor
+ //----------------------------------------------------------------
+ if EvokingObject is null
+ then
+ conclude false;
+ endif;
+ if continue = "no"
+ then
+ conclude false;
+ endif;
+
+
+ conclude doalert;
+
+ ;;
+ action:
+ write alert_message at dose_alert_dest
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_NEW_ONSET_DIABETES_CREATE_A1C_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_NEW_ONSET_DIABETES_CREATE_A1C_ORDER.mlm
new file mode 100644
index 0000000..937feb3
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_NEW_ONSET_DIABETES_CREATE_A1C_ORDER.mlm
@@ -0,0 +1,382 @@
+maintenance:
+
+ title: SCH_NEW_ONSET_DIABETES_CREATE_A1C_ORDER;;
+ mlmname: SCH_NEW_ONSET_DIABETES_CREATE_A1C_ORDER;;
+ arden: version 2.5;;
+ version: 5.50;; // SP1
+ institution: St. Clair Hospital;;
+ author: Juliet Law, Allscripts;;
+ specialist: Debbie Eiler, Allscripts;;
+ date: 2013-07-08;;
+ validation: testing;;
+
+library:
+ purpose: Creates a A1C order if blood glucose or BGM result is greater than 180.
+
+
+ ;;
+ explanation: This MLM will automatically create an A1C order based on the following criteria and exclusions:
+
+ * Blood glucose or BGM result is greater than 180
+ * Patient is not on adrenal corticol steroid medication
+ * Patient has not had an A1C in the last 3 months at St. Clair Hospital
+ * Patient does not have an existing health issue for diabetes (ICD9 250.0 through 250.93)
+ * Patient is not on the behavioral health unit
+ * Patient is not in an IRU bed
+ * Patient is not in FBC
+ * Patient is not in an hospice bed (identified through patient comment in SCM)
+ * Patient is 18 years of age or older
+
+ Change history
+
+ 08.05.2013 TMS Included TypeCode and Visit Status with Client Visit retrieval to only create order for Inpatients,
+ Observation, and Emergency patient types.
+ 11.07.2014 JML CSR 31859: Modified ER-Inpatient location patients who meet criteria for A1C to enter order on HOLD
+ 11.12.2014 JML CSR 31859: Moved to Production
+ 10.12.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 Coding Scheme [ICD10] And Duplicate Check of HI .
+ 01.05.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
+ that was previously read from comment created by AMPFM.
+
+ ;;
+ keywords: ObjectsPlus, Orders
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+ createA1COrder := false;
+
+ // Order and Error Destinations
+ HemoglobinA1C_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1003,
+ Rule_subgroup := "",
+ Send_alert_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ bgm_obs_enter := event { ObservationEnter Any Observation: where ItemName IN ("Glucose Fasting","Glucose Non-Fasting",
+ "Glucose Bedside","Glucose Bedside.")
+ AND IsHistory = FALSE AND Active = TRUE};
+
+
+ If called_by_editor then
+ EvokingObject := read last { Observation : This };
+ endif;
+
+ // Gather data
+ ( OrderGUID, resultValue ) := read last { Observation: OrderGUID, Value REFERENCING EvokingObject};
+
+ (ClientVisitGUID, ChartGUID,
+ ClientGUID,
+ CodedTime, location_guid,
+ CurrentLocation,
+ VisitStatus, TypeCode) := Read Last { "SELECT o.ClientVisitGUID, o.ChartGUID, o.ClientGUID,"
+ || " o.RequestedTime, cv.CurrentLocationGUID, cv.CurrentLocation, cv.visitstatus, cv.typecode"
+ || " FROM CV3Order o Join CV3ClientVisit cv "
+ || " ON o.ClientVisitGUID = cv.GUID "
+ || " AND o.ClientGUID = cv.ClientGUID "
+ || " AND o.ChartGUID = cv.ChartGUID "
+ || " WHERE o.GUID = " || SQL(OrderGUID) };
+
+
+ //Retrieve the Attending provider guid
+ ReqByGUID := read last {"SELECT cpvr.ProviderGUID"
+ || " FROM CV3ClientVisit cv JOIN CV3CareProviderVisitRole cpvr"
+ || " ON cv.ClientGUID = cpvr.ClientGUID"
+ || " AND cv.GUID = cpvr.ClientVisitGUID"
+ || " AND cv.ChartGUID = cpvr.ChartGUID"
+ || " WHERE cpvr.RoleCode = {{{SINGLE-QUOTE}}}ATTENDING{{{SINGLE-QUOTE}}}"
+ || " AND cv.ClientGUID = " || SQL(ClientGUID)
+ || " AND cv.GUID = " || SQL(ClientVisitGUID)
+ || " AND cv.ChartGUID = " || SQL(ChartGUID) };
+
+ resultValueNumeric := resultValue as number;
+
+ if (resultValueNumeric >= 180) and VisitStatus = "ADM"
+ and (TypeCode = "Observation" or TypeCode = "Inpatient") then
+ createA1COrder := true;
+
+ //Check for exclusions
+ //Is Patient taking steroid?
+ (steroidOrder) := read last {"SELECT o.Name"
+ || " FROM CV3ORDER o WITH (NOLOCK) JOIN CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " WHERE ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}hormones/hormone modifiers | adrenal cortical steroids{{{SINGLE-QUOTE}}}"
+ || " AND o.ClientGUID = " || SQL(ClientGUID)
+ || " AND o.ClientVisitGUID = " || SQL(ClientVisitGUID)
+ || " AND o.ChartGUID = " || SQL(ChartGUID)
+ || " AND"
+ || " ((o.OrderStatusLevelNum > 15"
+ || " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
+
+ if (exists steroidOrder) then
+ createA1COrder := false;
+ endif;
+
+ if (createA1COrder) then
+
+ //Check for A1C in last 3 months
+ (pastA1COrder) := read last {"SELECT o.ArrivalDtm"
+ || " FROM CV3ORDER o WITH (NOLOCK) "
+ || " WHERE o.Name = {{{SINGLE-QUOTE}}}Hemoglobin A1C{{{SINGLE-QUOTE}}}"
+ || " AND o.ClientGUID = " || SQL(ClientGUID)
+ || " AND o.OrderStatusCode IN ({{{SINGLE-QUOTE}}}AVACT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PCOL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}COLL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PEND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SPRV{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}})"
+ || " AND o.ArrivalDtm >= (convert(varchar(4),year(dateadd(MM, -3, getdate()))) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} + "
+ || " right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + convert(varchar (2), month(dateadd(mm, -3, getdate())) ),2) + {{{SINGLE-QUOTE}}}-{{{SINGLE-QUOTE}}} +"
+ || " RIGHT({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + convert(varchar(2), Day(dateadd(MM, -3, getdate())) ),2) + {{{SINGLE-QUOTE}}} 00:00:00.000{{{SINGLE-QUOTE}}})"};
+
+ if (exists pastA1COrder) then
+ createA1COrder := false;
+ endif;
+ endif;
+
+ if (createA1COrder) then
+ //Check for existing Diabetes health issue
+ (diabetesHI) := read last {"SELECT hi.Description"
+ || " FROM CV3HealthIssueDeclaration hi WITH (NOLOCK) JOIN CV3CodedHealthIssue h WITH (NOLOCK)"
+ || " ON h.GUID = hi.CodedHealthIssueGUID"
+ || " WHERE hi.Active = 1 "
+ || " AND hi.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ || " AND hi.ICD10Code is not null " //Added By Shivprasad for CSR 23359-ICD9-10 On 30 Sept 2015
+ /* || " AND (((CASE "
+ || " WHEN h.TypeCode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} THEN substring(hi.code, 5, 20) "
+ || " WHEN h.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} THEN h.code END) > {{{SINGLE-QUOTE}}}250.0{{{SINGLE-QUOTE}}} "
+ || " AND (CASE "
+ || " WHEN h.TypeCode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} THEN substring(hi.code, 5, 20) "
+ || " WHEN h.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} THEN h.code END) < {{{SINGLE-QUOTE}}}250.93{{{SINGLE-QUOTE}}})"
+ || " OR (CASE"
+ || " WHEN h.TypeCode = {{{SINGLE-QUOTE}}}Pt-Stated hx{{{SINGLE-QUOTE}}} THEN hi.ShortName"
+ || " WHEN h.TypeCode = {{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}} THEN hi.ShortName END) LIKE {{{SINGLE-QUOTE}}}%diabetes%{{{SINGLE-QUOTE}}}"
+ || " OR (CASE"
+ || " WHEN h.TypeCode = {{{SINGLE-QUOTE}}}Pt-Stated hx{{{SINGLE-QUOTE}}} THEN hi.ShortName"
+ || " WHEN h.TypeCode = {{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}} THEN hi.ShortName END) LIKE {{{SINGLE-QUOTE}}}%diabetic%{{{SINGLE-QUOTE}}})" */
+ || " AND ( ( (hi.ICD9Code is null and h.code in ({{{SINGLE-QUOTE}}}250.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}250.93{{{SINGLE-QUOTE}}}) ) " //Added By Shivprasad for CSR 23359-ICD9-10 On 30 Sept 2015
+ || " or (hi.ICD9Code is not null and hi.ICD9Code in ({{{SINGLE-QUOTE}}}250.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}250.93{{{SINGLE-QUOTE}}}) ) "
+ || " or (hi.ICD10Code is not null and hi.ICD10Code in ({{{SINGLE-QUOTE}}}E11.9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}E10.8{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}E13.8{{{SINGLE-QUOTE}}}) ) " //CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad
+ || " ) "
+ || " or ( "
+ || " (CASE WHEN h.TypeCode = {{{SINGLE-QUOTE}}}Pt-Stated hx{{{SINGLE-QUOTE}}} THEN hi.ShortName "
+ || " WHEN h.TypeCode = {{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}} THEN hi.ShortName END) LIKE {{{SINGLE-QUOTE}}}%diabetes%{{{SINGLE-QUOTE}}} "
+ || " OR (CASE WHEN h.TypeCode = {{{SINGLE-QUOTE}}}Pt-Stated hx{{{SINGLE-QUOTE}}} THEN hi.ShortName "
+ || " WHEN h.TypeCode = {{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}} THEN hi.ShortName END) LIKE {{{SINGLE-QUOTE}}}%diabetic%{{{SINGLE-QUOTE}}} "
+ || " ) ) "
+ || " AND ClientGuid = " || SQL(ClientGUID)};
+
+ if (exists diabetesHI) then
+ createA1COrder := false;
+ endif;
+ endif;
+
+ if (createA1COrder) then
+ //Is Patient in behavioral health, IRU, or FBC?
+ (patientOKBed) := read last {"SELECT {{{SINGLE-QUOTE}}}true{{{SINGLE-QUOTE}}}"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK)"
+ || " WHERE cv.ClientGUID = " || SQL(ClientGUID)
+ || " AND cv.GUID = " || SQL(ClientVisitGUID)
+ || " AND (cv.CurrentLocation LIKE {{{SINGLE-QUOTE}}}PSY%{{{SINGLE-QUOTE}}}"
+ || " OR cv.CurrentLocation LIKE {{{SINGLE-QUOTE}}}IRU%{{{SINGLE-QUOTE}}}"
+ || " OR cv.CurrentLocation LIKE {{{SINGLE-QUOTE}}}FBC-%{{{SINGLE-QUOTE}}})" };
+
+ if (exists patientOKBed) then
+ createA1COrder := false;
+ endif;
+ endif;
+
+ if (createA1COrder) then
+
+ //CSR 26413 CHANGE: Modified SQL to use CV3ClientUsData
+ //Is Patient in Hospice?
+ (hospicePatient) := read last {"SELECT cud.Value"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientUserData cud WITH (NOLOCK)"
+ || " ON cv.ClientGUID = cud.ClientGUID"
+ || " WHERE cud.ClientGUID = " || SQL(ClientGUID)
+ || " AND cv.GUID = " || SQL(ClientVisitGUID)
+ || " AND cud.Active = 1"
+ || " AND cud.UserDataCode LIKE {{{SINGLE-QUOTE}}}INS%{{{SINGLE-QUOTE}}}"
+ || " AND cud.Value LIKE {{{SINGLE-QUOTE}}}%HOSPICE%{{{SINGLE-QUOTE}}}"};
+
+ if (exists hospicePatient) then
+ createA1COrder := false;
+ endif;
+ endif;
+
+ if (createA1COrder) then
+ //Get Patient Age
+ (patAge) := read last {"SELECT CASE"
+ || " WHEN ((c.BirthMonthNum > MONTH(getdate()))"
+ || " OR (c.BirthMonthNum = MONTH(getdate()) and c.BirthDayNum > DAY(getdate()))) then"
+ || " Convert(char(3),(YEAR(getdate()) - c.BirthYearNum) - 1)"
+ || " ELSE"
+ || " Convert(char(3),(YEAR(GETDATE()) - c.BirthYearNum))"
+ || " END"
+ || " FROM CV3Client c WITH (NOLOCK)"
+ || " WHERE c.GUID = " || SQL(ClientGUID)};
+ if ((patAge as number) < 18) then
+ createA1COrder := false;
+ endif;
+ endif;
+ endif;
+ ;;
+
+ priority: 90
+ ;;
+ evoke:
+ 5 seconds after time of bgm_obs_enter;
+ ;;
+ logic:
+
+ if (EvokingObject is null) then
+ conclude false;
+ endif;
+
+ if (createA1COrder) then
+ // Build ObjectsPlus objects required for Diagnostic Order Creation
+ try
+ if ( CurrentLocation matches pattern "ER-%" ) then
+ SessionType := "Hold";
+ SessionReason := "ED Inpatient";
+ else
+ SessionType := "Standard";
+ SessionReason := "";
+ endif;
+
+ RequestedBySource := "";
+ OrderCreationReason := "Automatically created by MLM";
+ RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( ReqByGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} ); //Int64
+ Location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ ClientVisit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ endtry;
+
+ // Failed to build preliminary objects - Dispose
+ catch Exception ex
+ error_occurred:= true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( ClientVisit_obj is NOT NULL ) then
+ void:= call ClientVisit_obj.Dispose;
+ ClientVisit_obj:= null;
+ endif;
+ if ( RequestedBy_obj is NOT NULL) then
+ void:= call RequestedBy_obj.Dispose;
+ RequestedBy_obj:= null;
+ endif;
+ if ( Location_obj is NOT NULL ) then
+ void:= call Location_obj.Dispose;
+ Location_obj:= null;
+ endif;
+ endcatch;
+
+ // Build the order object
+ try
+ Catalog_Item_Name := "Hemoglobin A1C";
+ diagnostic_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
+
+ DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
+ with
+ ClientVisit_obj, // ClientVisit ObjectsPlus object
+ diagnostic_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ OrderCreationReason, // CreateReason
+ RequestedBy_obj, // RequestedBy ObjectsPlus object
+ RequestedBySource, // string RequestedBySource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ Location_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+
+ // Populate the Requested Time field
+ DiagnosticOrder_obj.RequestedDate := "T+1";
+ retval := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "RequestedTime",false;
+ DiagnosticOrder_obj.RequestedTime := "AM Rounds";
+
+ // Make the order
+ if ( diagnostic_catalog_item is NOT NULL ) then
+ void:= call diagnostic_catalog_item.Dispose;
+ diagnostic_catalog_item:= null;
+ endif;
+ HemoglobinA1C_dest.ObjectsPlus := DiagnosticOrder_obj;
+
+ endtry;
+
+ // Failed to build the order object and make the order - Return error and dispose
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( diagnostic_catalog_item is NOT NULL ) then
+ void:= call diagnostic_catalog_item.Dispose;
+ diagnostic_catalog_item:= null;
+ endif;
+ if ( DiagnosticOrder_obj is NOT NULL ) then
+ void:= call DiagnosticOrder_obj.Dispose;
+ DiagnosticOrder_obj:= null;
+ endif;
+ HemoglobinA1C_dest := null;
+ endcatch;
+
+ // Dispose
+ if ( ClientVisit_obj is NOT NULL ) then
+ void:= call ClientVisit_obj.Dispose;
+ ClientVisit_obj:= null;
+ endif;
+ if ( RequestedBy_obj is NOT NULL ) then
+ void:= call RequestedBy_obj.Dispose;
+ RequestedBy_obj:= null;
+ endif;
+ if ( Location_obj is NOT NULL ) then
+ void:= call Location_obj.Dispose;
+ Location_obj:= null;
+ endif;
+ endif;
+ conclude true;
+ ;;
+ action:
+ if error_occurred then
+ write "An error has occured in the MLM {{+B}}SCH_NEW_ONSET_DIABETES_CREATE_A1C{{-B}} "
+ || "Please notify your System Administrators that an error message has "
+ || "occurred for this patient. They will review the following error "
+ || "message: \n" at error_destination;
+
+ write "1. " || error_message at error_destination;
+
+ endif;
+
+ if EXISTS HemoglobinA1C_dest then
+ write true at HemoglobinA1C_dest;
+ endif;
+
+/*
+ write " Message: "
+ || "\nOrder GUID = " || OrderGUID
+ || "\nresult Value = " || resultValue
+ || "\nsteriod Order = " || steroidOrder
+ || "\npast A1C = " || pastA1COrder
+ || "\ndiabetes HI = " || diabetesHI
+ || "\nBed = " || patientOKBed
+ || "\nhospice patient = " || hospicePatient
+ || "\n patient age = " || patAge
+ || "\ncreate order? " || createA1COrder at error_destination;
+*/
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_NOW_AND_THEN_GENERATE_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_NOW_AND_THEN_GENERATE_ORDER.mlm
new file mode 100644
index 0000000..37ed284
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_NOW_AND_THEN_GENERATE_ORDER.mlm
@@ -0,0 +1,548 @@
+maintenance:
+
+ title: SCH_NOW_AND_THEN_GENERATE_ORDER;;
+ mlmname: SCH_NOW_AND_THEN_GENERATE_ORDER;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: ;;
+ author: ;;
+ specialist: ;;
+ date: 2012-05-10;;
+ validation: testing;;
+
+library:
+ purpose:
+ Creates prefilled Now order for Now and Then Dosing.
+ ;;
+ explanation:
+ Called from FORM_NOW_AND_THEN. Creates copy of calling order with a now schedule and adds order to the
+ Order Entry Worksheet. Only fields appropriate to the now order are copied.
+
+ Change History
+ 01.30.2013 TMS Moved to Production
+ 02.21.2014 TMS Updated to include Stat/Then functionality. CSR 31883
+ 05.11.2015 TMS Added field for "physician requests NSS solution" to fields being sent from FORM_Now_and_Thne HD 1663579
+ 11.10.2015 TMS Added line in logic to use the standard Enoxaparin Inj order for the stat or now order if the request is
+ placed from the Enoxaparin Inj. order which is for CPOE orders with CrCl. Since the physician has already
+ received any alerts based on the frequency and dosing at the point of requesting the order to start now or stat.
+ HD 1936872
+ 09.28.2016 TMS Move logic to set Requested Time to STAT when frequency is STAT and make field read only. New MLM Form_Prx_Sched_Logic
+ was presenting the error message that Non Stat Frequency could not have STAT RequestedTime when the generated order
+ was requested from a child with a prepopulated frequency. Issue corrected by first setting the new frequency to STAT
+ when "Give a STAT Dose" selected on issuing order and then later in the logic setting the requested time to "STAT"
+ HD 1478552
+ 02.22.2017 TMS Added logic for Lovenox and Hypnotics that have {{{SINGLE-QUOTE}}}OS only Child{{{SINGLE-QUOTE}}} avail. policy to use the parent item for STAT or Now
+ created order. HD 2579788
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ local_session := CDS_SESSION.local;
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+ ( PCatalog_Item_Name,
+ PCatalog_Item_Modifier,
+ PFrequency,
+ PHour,
+ PDosageLow, PDosageHigh,
+ PUom, PRNBox,
+ PRoute,
+ worksheetInfo,
+ Active_OrderGUID,
+ Active_SignificiantDtm,
+ RxInstruct, UserInstruct, WorxRoute, WorxCode,
+//
+ Nonchemical_Restraint_Ind,
+ ADMINS_AppSite,
+ ADMINS_GiveWith,
+ AltPrintLocation,
+ BRANDNAME,
+ Concentration,
+ CONCSTRENGTHUOM,
+ CONCSTRVOLUMEUOM,
+ DrugNameforMLM,
+ NOTECOMMENT1,
+ NOTECOMMENT2,
+ NOTECOMMENT7,
+ NOTECOMMENT8,
+ OmitMessage,
+ PRNCONDITION,
+ TP_Application_Site,
+ Chemical_Restraint,
+ Not_Chemical_Restraint,
+ Aerochamber,
+ AutoVerify,
+ AWP,
+ Inspirese,
+ PrebuiltOrder,
+ Pt_to_Admin,
+ Resp_to_Admin,
+ CONCSTRENGTH,
+ CONCSTRVOLUME,
+ BaseSolutionName, BaseSolutionDose, BaseSolutionUom,
+ PhysReqNaCl,
+ client_visit_obj
+
+ ) := argument;
+
+
+
+ MedicationOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM, placed on worksheet",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+;;
+ priority: 50
+ ;;
+ evoke:
+
+ ;;
+ logic:
+
+ // If MLM called from Lovenox Order Calculated by CrCl - use Standard Lovenox order for the Stat or Now Order
+ If PCatalog_Item_Name = "Enoxaparin Inj" then PCatalog_Item_Name := "Enoxaparin Inj"; PCatalog_Item_Modifier := null; endif;
+ If PCatalog_Item_Name = "Enoxaparin Inj." then PCatalog_Item_Name := "Enoxaparin Inj"; PCatalog_Item_Modifier := null; endif;
+ If PCatalog_Item_Name matches pattern "Zolpidem%" or
+ PCatalog_Item_Name matches pattern "Eszopiclone%" or
+ PCatalog_Item_Name matches pattern "Temazepam%"
+ then PCatalog_Item_Modifier := null;
+ endif;
+
+ //---------------------------------------------------------------
+ // Create a new MEDICATION order from a Pre-Filled item
+ // Place the order onto the order entry worksheet
+ //---------------------------------------------------------------
+ try
+
+ Catalog_Item_Name := PCatalog_Item_Name;
+ Catalog_Item_Modifier := PCatalog_Item_Modifier;
+ Catalog_Item_Version := "";
+ order_Creation_Reason := "Now and Then Ordering";
+
+ // get OrderCatalogMasterItem ObjectsPlus object
+ Medication_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with Catalog_Item_Name;
+
+ // Create the prefilled Medication order
+ // Session information has been retrieved from the current worksheet if there
+ // already exists unsubmitted orders.
+ // AvailabilityOverride is set to prompt. This can display a popup dialog if
+ // this order has an availability policy set that defines this item as not
+ // available in the current location. The user still needs to have the
+ // correct override right.
+
+ // If called from order set with no child modifier available, use parent order
+
+ If PCatalog_Item_Modifier is null then
+ MedicationOrder_obj := call worksheetInfo.CreateMedicationOrder
+ with
+ Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // string Create Reason
+ "Prompt" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
+ false, // suppress messages
+ (Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Companion order primary key
+ false; // Mandatory on Worksheet
+
+ else
+ // If called from order set with child modifier available, use child order
+ MedicationOrder_obj := call worksheetInfo.CreateMedicationOrder
+ with
+ Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ Catalog_Item_Modifier, // string Name Modifier for prefill
+ Catalog_Item_Version, // string Name modifier version for prefill
+ order_Creation_Reason, // string Create Reason
+ "Prompt" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
+ false, // suppress messages
+ (Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Companion order primary key
+ false; // Mandatory on Worksheet
+ endif;
+
+ if( Medication_catalog_item is NOT NULL ) then
+ void := call Medication_catalog_item.Dispose;
+ Medication_catalog_item:= null;
+ endif;
+
+ // Change made to value RequestedTime field and set as read only later in logic to eliminate error message from "FORM_PRX_SCHED_LOGIC" - TMS 09.28.2016
+ freqCodeValue_obj := new net_object {{{SINGLE-QUOTE}}}Frequency{{{SINGLE-QUOTE}}};
+ If Pfrequency = "Now" then
+ freqCodeValue_Obj.Code := ("Now" As string);
+ // MedicationOrder_obj.RequestedTime := "Routine";
+ elseif Pfrequency = "Stat" then
+ freqCodeValue_Obj.Code := ("STAT" As string);
+ // MedicationOrder_obj.RequestedTime := "STAT";
+ else
+ freqCodeValue_Obj.Code := ("Now" As string);
+ // MedicationOrder_obj.RequestedTime := "Routine";
+ endif;
+
+
+
+// TimeSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "RequestedTime",true;
+ Active_SignificantPlusOneDtm := Now ;
+
+ // Extracts out date elements and formats date as YYYY-MM-DD
+ Active_SignificantPlusOneISODate := (extract year Active_SignificantPlusOneDtm) formatted with "%04d" || "-" ||
+ (extract month Active_SignificantPlusOneDtm) formatted with "%02d" || "-" ||
+ (extract day Active_SignificantPlusOneDtm) formatted with "%02d";
+
+
+
+
+ Doseset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "DosageLow",false;
+ HiDoseset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "DosageHigh",false;
+ Uomset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "UOM",false;
+ Routeset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "OrderRouteCode",false;
+ Freqset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "FrequencyCode",false;
+ RxInstSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT0",false;
+ AddlDoseOrdered := 1;
+
+// BaseSolset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "BaseSolution",false;
+
+
+ MedicationOrder_obj.DosageLow := (PDosageLow As Number);
+ MedicationOrder_obj.DosageHigh := (PDosageHigh As Number);
+ MedicationOrder_obj.Uom := (PUom As String);
+ MedicationOrder_Obj.Route := (PRoute As String);
+// MedicationOrder_Obj.BaseSolution := BaseSolutionValue_obj;
+
+
+ Doseset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "DosageLow",true;
+ HiDoseset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "DosageHigh",true;
+ UOMset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "UOM",true;
+ Routeset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "OrderRouteCode",true;
+
+ MedicationOrder_obj.RequestedDate := Active_SignificantPlusOneISODate;
+ // MedicationOrder_obj.RequestedTime := "Routine";
+ DateSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "RequestedDate",true;
+ // TimeSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "RequestedTime",true;
+
+ If PRNBox is not null then
+ PrnBoxSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "IsPRN",false;
+ MedicationOrder_Obj.IsPRN := (False As Boolean);
+ PrnSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "IsPRN",true;
+
+ endif;
+
+
+ If RxInstruct is not null then
+ NOTECOMMENT0 := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_NOTECOMMENT0",( RxInstruct AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ RxInstSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT0",true;
+ else
+ RxInstSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT0",true;
+ endif;
+
+ If UserInstruct is not null then
+ MedicationOrder_Obj.AdministrationInstructions := (Userinstruct As String);
+ UserInstSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "AdminInstructions",true;
+ else
+ UserInstSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "AdminInstructions",true;
+ endif;
+
+
+ Worxcodeset := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_DRUGIDCODE",( WorxCode AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+
+ if worxroute is not null then
+ WorxRouteset := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_Worx_Route",( WorxRoute AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ endif;
+
+ If Chemical_Restraint Is not Null then
+ NUR_Chemical_RestraintSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "NUR_Chemical Restraint", false;
+ NUR_Chemical_RestraintSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "NUR_Chemical Restraint", (Chemical_Restraint AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ NUR_Chemical_RestraintSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "NUR_Chemical Restraint", true;
+ endif;
+
+ If Not_Chemical_Restraint Is not Null then
+ NUR_Not_Chemical_RestraintSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "NUR_Not Chemical Restraint", false;
+ NUR_Not_Chemical_RestraintSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "NUR_Not Chemical Restraint", (Not_Chemical_Restraint AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ NUR_Not_Chemical_RestraintSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "NUR_Not Chemical Restraint",true;
+ endif;
+
+ If Nonchemical_Restraint_Ind is not Null then
+ NUR_Nonchemical_Restraint_IndSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "NUR_Nonchemical Restraint Ind",false;
+ NUR_Nonchemical_Restraint_IndSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "NUR_Nonchemical Restraint Ind", (Nonchemical_Restraint_Ind AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ NUR_Nonchemical_Restraint_IndSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "NUR_Nonchemical Restraint Ind",true;
+ endif;
+
+ If ADMINS_AppSite is not Null then
+ PRX_ADMINS_AppSiteSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_ADMINS_AppSite",false;
+ PRX_ADMINS_AppSiteSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_ADMINS_AppSite", (ADMINS_AppSite AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_ADMINS_AppSiteSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_ADMINS_AppSite",true;
+ endif;
+
+ If ADMINS_GiveWith is not Null then
+ PRX_ADMINS_GiveWithSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_ADMINS_GiveWith",false;
+ PRX_ADMINS_GiveWithSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_ADMINS_GiveWith", (ADMINS_GiveWith AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_ADMINS_GiveWithSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_ADMINS_GiveWith",true;
+ endif;
+
+ If AltPrintLocation is not Null then
+ PRX_AltPrintLocationSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_AltPrintLocation",false;
+ PRX_AltPrintLocationSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_AltPrintLocation", (AltPrintLocation AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_AltPrintLocationSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_AltPrintLocation",true;
+ endif;
+
+ If BRANDNAME is not Null then
+ PRX_BRANDNAMESet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_BRANDNAME",false;
+ PRX_BRANDNAMESet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_BRANDNAME", (BRANDNAME AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_BRANDNAMESet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_BRANDNAME",true;
+ endif;
+
+ If Concentration is not Null then
+ PRX_ConcentrationSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Concentration",false;
+ PRX_ConcentrationSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_Concentration", (Concentration AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_ConcentrationSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Concentration",true;
+ endif;
+
+ If CONCSTRENGTHUOM is not Null then
+ PRX_CONCSTRENGTHUOMSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_CONCSTRENGTHUOM",false;
+ PRX_CONCSTRENGTHUOMSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_CONCSTRENGTHUOM", (CONCSTRENGTHUOM AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_CONCSTRENGTHUOMSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_CONCSTRENGTHUOM",true;
+ endif;
+
+ If CONCSTRVOLUMEUOM is not Null then
+ PRX_CONCSTRVOLUMEUOMSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_CONCSTRVOLUMEUOM",false;
+ PRX_CONCSTRVOLUMEUOMSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_CONCSTRVOLUMEUOM", (CONCSTRVOLUMEUOM AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_CONCSTRVOLUMEUOMSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_CONCSTRVOLUMEUOM",true;
+ endif;
+
+ If DrugNameforMLM is not Null then
+ PRX_DrugNameforMLMSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_DrugNameforMLM",false;
+ PRX_DrugNameforMLMSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_DrugNameforMLM", (DrugNameforMLM AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_DrugNameforMLMSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_DrugNameforMLM",true;
+ endif;
+
+ If NOTECOMMENT1 is not Null then
+ PRX_NOTECOMMENT1Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT1",false;
+ PRX_NOTECOMMENT1Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_NOTECOMMENT1", (NOTECOMMENT1 AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_NOTECOMMENT1Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT1",true;
+ endif;
+
+ If NOTECOMMENT2 is not Null then
+ PRX_NOTECOMMENT2Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT2",false;
+ PRX_NOTECOMMENT2Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_NOTECOMMENT2", (NOTECOMMENT2 AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_NOTECOMMENT2Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT2",true;
+ endif;
+
+ If NOTECOMMENT7 is not Null then
+ PRX_NOTECOMMENT7Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT7",false;
+ PRX_NOTECOMMENT7Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_NOTECOMMENT7", (NOTECOMMENT7 AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_NOTECOMMENT7Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT7",true;
+ endif;
+
+ If NOTECOMMENT8 is not Null then
+ PRX_NOTECOMMENT8Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT8",false;
+ PRX_NOTECOMMENT8Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_NOTECOMMENT8", (NOTECOMMENT8 AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_NOTECOMMENT8Set := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_NOTECOMMENT8",true;
+ endif;
+
+ If OmitMessage is not Null then
+ PRX_OmitMessageSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_OmitMessage",false;
+ PRX_OmitMessageSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_OmitMessage", (OmitMessage AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_OmitMessageSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_OmitMessage",true;
+ endif;
+
+ If PRNCONDITION is not Null then
+ PRX_PRNCONDITIONSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_PRNCONDITION",false;
+ PRX_PRNCONDITIONSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_PRNCONDITION", (PRNCONDITION AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_PRNCONDITIONSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_PRNCONDITION",true;
+ else
+ PRX_PRNCONDITIONSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_PRNCONDITION",true;
+ endif;
+
+ If TP_Application_Site is not Null then
+ PRX_TP_Application_SiteSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_TP_Application_Site",false;
+ PRX_TP_Application_SiteSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ "PRX_TP_Application_Site", (TP_Application_Site AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+ PRX_TP_Application_SiteSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_TP_Application_Site",true;
+ endif;
+
+ If Aerochamber Is not Null then
+ PRX_AerochamberSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Aerochamber", false;
+ PRX_AerochamberSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_Aerochamber", (Aerochamber AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ PRX_AerochamberSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Aerochamber",true;
+ endif;
+
+ If AutoVerify Is not Null then
+ PRX_AutoVerifySet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_AutoVerify", false;
+ PRX_AutoVerifySet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_AutoVerify", (AutoVerify AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ PRX_AutoVerifySet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_AutoVerify",true;
+ endif;
+
+ If AWP Is not Null then
+ PRX_AWPSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_AWP", false;
+ PRX_AWPSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_AWP", (AWP AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ PRX_AWPSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_AWP",true;
+ endif;
+
+ If Inspirese Is not Null then
+ PRX_InspireseSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Inspirese", false;
+ PRX_InspireseSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_Inspirese", (Inspirese AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ PRX_InspireseSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Inspirese",true;
+ endif;
+
+ If PrebuiltOrder Is not Null then
+ PRX_PrebuiltOrderSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_PrebuiltOrder", false;
+ PRX_PrebuiltOrderSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_PrebuiltOrder", (PrebuiltOrder AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ PRX_PrebuiltOrderSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_PrebuiltOrder",true;
+ endif;
+
+ If Pt_to_Admin Is not Null then
+ PRX_Pt_to_AdminSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Pt_to_Admin", false;
+ PRX_Pt_to_AdminSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_Pt_to_Admin", (Pt_to_Admin AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ PRX_Pt_to_AdminSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Pt_to_Admin",true;
+ endif;
+
+ If Resp_to_Admin Is not Null then
+ PRX_Resp_to_AdminSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Resp_to_Admin", false;
+ PRX_Resp_to_AdminSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_Resp_to_Admin", (Resp_to_Admin AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ PRX_Resp_to_AdminSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Resp_to_Admin",true;
+ endif;
+
+ If CONCSTRENGTH Is not Null then
+ PRX_CONCSTRENGTHSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_CONCSTRENGTH", false;
+ PRX_CONCSTRENGTHSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_CONCSTRENGTH" , (CONCSTRENGTH AS {{{SINGLE-QUOTE}}}System.Double{{{SINGLE-QUOTE}}});
+ PRX_CONCSTRENGTHSet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_CONCSTRENGTH",true;
+ endif;
+
+ If CONCSTRVOLUME Is not Null then
+ PRX_CONCSTRVOLUMESet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_CONCSTRVOLUME", false;
+ PRX_CONCSTRVOLUMESet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_CONCSTRVOLUME", (CONCSTRVOLUME AS {{{SINGLE-QUOTE}}}System.Double{{{SINGLE-QUOTE}}});
+ PRX_CONCSTRVOLUMESet := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_CONCSTRVOLUME",true;
+ endif;
+
+ If PhysReqNaCl Is not Null then
+ PRX_ResetDiluent := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_ResetDiluent", false;
+ PRX_ResetDiluent := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_ResetDiluent", (PhysReqNaCl AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ PRX_ResetDiluent := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_ResetDiluent",true;
+ endif;
+
+ //Set to true to exclude from duplicate checking against main order
+
+ PRX_Dosing_Addl_Dose := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Dosing Addl Dose", false;
+ PRX_Dosing_Addl_Dose := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "PRX_Dosing Addl Dose", (AddlDoseOrdered AS {{{SINGLE-QUOTE}}}System.Boolean{{{SINGLE-QUOTE}}});
+ PRX_Dosing_Addl_Dose := call MedicationOrder_Obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "PRX_Dosing Addl Dose",true;
+
+ // Value RequestedTime field to STAT or Routine depending on Now or STAT frequency
+
+ If Pfrequency = "Now" then
+ MedicationOrder_obj.RequestedTime := "Routine";
+ elseif Pfrequency = "Stat" then
+ freqCodeValue_Obj.Code := ("STAT" As string);
+ MedicationOrder_obj.RequestedTime := "STAT";
+ else
+ MedicationOrder_obj.RequestedTime := "Routine";
+ endif;
+
+ TimeSet := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "RequestedTime",true;
+
+ Freqset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "FrequencyCode",false;
+ MedicationOrder_Obj.Frequency := freqCodeValue_obj;
+ Freqset := call MedicationOrder_obj.{{{SINGLE-QUOTE}}}SetFormFieldReadOnly{{{SINGLE-QUOTE}}} with "FrequencyCode",true;
+
+
+ //MedicationOrder_dest.ObjectsPlus := MedicationOrder_obj;
+ void := call MedicationOrder_Obj.Save;
+ void := call MedicationOrder_Obj.Dispose;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New prefilled medication order :{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ msg := "Exception #1"
+ || "\nerror = " || ex.Message;
+ dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "Info", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ if( Medication_catalog_item is NOT NULL ) then
+ void := call Medication_catalog_item.Dispose;
+ Medication_catalog_item:= null;
+ endif;
+
+ if( MedicationOrder_obj is NOT NULL ) then
+ void := call MedicationOrder_obj.Dispose;
+ MedicationOrder_obj:= null;
+ endif;
+
+ MedicationOrder_dest := null;
+ endcatch;
+
+conclude true;
+
+
+
+ ;;
+ action:
+
+if error_occurred
+ then
+
+ write "An error has occurred in the MLM {{+B}}SCH_NOW_AND_THEN_GENERATE_ORDER{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error(s) " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+
+
+ if EXISTS MedicationOrder_dest then
+ write true at MedicationOrder_dest;
+
+
+ endif;
+
+return error_occurred;
+
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OON_INSURANCE.mlm b/MLMStripper/bin/Debug/SCH/SCH_OON_INSURANCE.mlm
new file mode 100644
index 0000000..8819479
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OON_INSURANCE.mlm
@@ -0,0 +1,273 @@
+maintenance:
+
+ title: SCH_OON_INSURANCE;;
+ mlmname: SCH_OON_INSURANCE;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Shawn Head, Allscripts Corp;;
+ specialist: Peggy Karish, Allscripts Corp;;
+ date: 2016-05-26;;
+ validation: testing;;
+
+library:
+ purpose: Update an Enterprise Defined Patient List Column with UPMC Out of Network Coverage alert.
+
+ ;;
+
+ explanation: For patients that are currently on the UPCM Out Of Network coverage. The patient is covered in the ED; however if we admit them their plan will not cover any of the costs.
+ The column will be updated and flash/display in a color that alerts the users that the patient is not covered for admission.
+
+ Change history
+ 05.25.2016 STH CSR #34119 - Created from a copy of SCH_MEDICARE_PLAN_B_COLUMN_UPDATE {Go-Live 7/12/2016}
+ 10.15.2018 STH CSR#: 34119 & 37522/CA SERVICE DESK#: 3202435 - Issue identified post go-live of reg/sched where insurnace column was not consistently updating.
+ Made changes to fire on Insurance enter/modify instead of visit enter/modify {Go-Live 11/7/2018}
+
+ ;;
+ keywords: ObjectsPlus/XA, Order
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Error Handling vars for ObjectsPlus Method calls
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+ InsuranceColumn_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "EnterprisePatientListColumn Object",
+ rule_number := 2025 ];
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1001,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ send_alert := "DoNotSend";
+ alert_dialog := "Must Acknowledge";
+ alert_message := "{{+B}}Patient Primary Insurance is {{+R}}OUT OF NETWORK{{-R}}.{{-B}}";
+ alert_Priority := "High";
+ alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "Out Of Network Insurance",
+ priority := alert_Priority,
+ scope := Chart,
+ rule_group := "Out Of Network Insurance",
+ rule_number := 8000,
+ send_with_alert := send_alert,
+ alert_dialog_settings := alert_dialog,
+ display_alert := true];
+
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit: THIS
+ where TypeCode = "Emergency"};
+ endif;
+
+ //Event Trigger
+ //VisitEnter := Event { ClientVisitEnter Any ClientVisit : WHERE TypeCode = "Emergency" };
+ //VisitModify := Event { ClientVisitModify Any ClientVisit : WHERE TypeCode = "Emergency" };
+
+ InsuranceEnter := event{InsuranceEnter User ClientVisit};
+ InsuranceModify := event{InsuranceModify User ClientVisit};
+
+
+ OrdInit := EVENT {OrderInit User Order:
+ where Name in ("Admit to Inpatient","Place In Observation") };
+
+ OrdSetInit:= event{OrderSetInit User OrderSet:
+ WHERE OrderSetName matches pattern "Transition%"
+ or OrderSetName matches pattern "Admission%"
+ or OrderSetName matches pattern "Post Op%"
+ };
+
+ InsUpdate := false;
+
+ if(EvokingEventType = OrdInit.Type) then
+ (ClientVisitGuid, ClientGuid) := read last {Order : ClientVisitGuid, ClientGuid REFERENCING EvokingObject};
+ VisitType := read last { " select typecode from cv3clientvisit with (nolock) where clientguid = " || sql(ClientGuid) || " and guid = " || sql(ClientVisitGuid) || " " };
+ elseif(EvokingEventType = OrdSetInit.Type) then
+ (ClientVisitGuid, ClientGuid) := read last {OrderSet : ClientVisitGuid, ClientGuid REFERENCING EvokingObject};
+ VisitType := read last { " select typecode from cv3clientvisit with (nolock) where clientguid = " || sql(ClientGuid) || " and guid = " || sql(ClientVisitGuid) || " " };
+ //elseif ((EvokingEventType = VisitEnter.Type) or (EvokingEventType = VisitModify.type)) then
+ // (ClientVisitGuid, ClientGuid, VisitType) := read last {ClientVisit : GUID, ClientGuid, TypeCode REFERENCING EvokingObject};
+ elseif((EvokingEventType = InsuranceEnter.Type) or (EvokingEventType = InsuranceModify.Type)) then
+ ( FRP_Name, FRP_Code,Policy_Num, Subscriber_relationship,ClientVisitGuid, ClientGuid ) := read last
+ { Insurance: FRPName,FRPCode, PolicyNum, RelationshipCode,ClientVisitGuid, ClientGuid
+ REFERENCING EvokingObject };
+ VisitType := read last { " select typecode from cv3clientvisit with (nolock) where clientguid = " || sql(ClientGuid) || " and guid = " || sql(ClientVisitGuid) || " " };
+ InsuranceCarrierID := EVOKINGOBJECT.Insurer.InsuranceCarrierID;
+ InsuranceSequence := EVOKINGOBJECT.SequenceNum;
+ if(InsuranceSequence = 1) then
+ ICfromObj := read last {" select ic.Name
+ from SXAAMInsuranceCarrier ic with (nolock)
+ where ic.InsuranceCarrierID = " || sql(InsuranceCarrierID)
+ || " AND ((ic.Name like {{{SINGLE-QUOTE}}}%OUT OF NETWORK%{{{SINGLE-QUOTE}}})
+ OR (ic.name like {{{SINGLE-QUOTE}}}% OON %{{{SINGLE-QUOTE}}})) "};
+
+ endif;
+
+ endif;
+
+
+ if(trim(VisitType) = "Emergency") then
+ if(EvokingEventType not in (InsuranceEnter.Type,InsuranceModify.Type)) then
+ (UPMCOON_Val) := read {" SELECT ic.Name
+ FROM CV3FRPContract fc with (nolock)
+ JOIN CV3FRP f with (nolock)
+ ON fc.FRPGUID = f.GUID
+ JOIN SXAAMInsuranceCarrier ic with (nolock)
+ ON f.InsuranceCarrierID = ic.InsuranceCarrierID
+ WHERE fc.ClientGUID = " || Sql(ClientGuid) || "
+ AND fc.ClientVisitGUID = " || Sql(ClientVisitGuid) || "
+ AND FC.SequenceNum = 1
+ AND fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
+ AND ((ic.Name like {{{SINGLE-QUOTE}}}%OUT OF NETWORK%{{{SINGLE-QUOTE}}})
+ OR (ic.name like {{{SINGLE-QUOTE}}}% OON %{{{SINGLE-QUOTE}}})) "};
+ endif;
+ if ((exists UPMCOON_Val) or (ICfromObj <> "")) then
+ InsuranceValue := "Yes";
+ else
+ InsuranceValue := "";
+ endif;
+
+ if((EvokingEventType in (OrdInit.Type,OrdSetInit.Type)) AND (InsuranceValue = "Yes")) then
+ AlertFire := true;
+ else
+ AlertFire := false;
+ endif;
+ endif;
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ //22 second after time of VisitEnter;
+ //22 second after time of VisitModify;
+ InsuranceEnter;
+ InsuranceModify;
+ OrdInit;
+ OrdSetInit;
+ ;;
+ logic:
+
+ //BEGIN OF VISIT ENTER/VISIT MODIFIY SECTION
+ if (EvokingEventType in (/*VisitEnter.Type,VisitModify.Type,*/InsuranceEnter.Type,InsuranceModify.Type)) then
+
+ if (EvokingObject is null) then
+ conclude false;
+
+ else
+ //if (updateColumn = true) then
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" || ex.Message || "\n\n";
+
+ if (ex.InnerException is not null net_object) then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ conclude true;
+ endcatch;
+
+ try
+ eColumnValue := InsuranceValue;
+
+ InsuranceDefinedColumn_Obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
+ with (client_visit_obj, "Insurance OON");
+
+ colValue := InsuranceDefinedColumn_Obj.Value;
+
+ if ((colValue <> eColumnValue) and (InsuranceSequence=1)) then
+ //or (EvokingEventType in (VisitEnter.Type,VisitModify.Type))) then
+ InsuranceDefinedColumn_Obj.Value := eColumnValue;
+ //InsuranceColumn_dest.ObjectsPlus := InsuranceDefinedColumn_Obj;
+ void := call InsuranceDefinedColumn_Obj.Save;
+ void := call InsuranceDefinedColumn_Obj.Dispose;
+ InsuranceDefinedColumn_Obj := null;
+ endif;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}Enterprise Out Of Network Insurance column{{-R}}\n"
+ || ex.Message || "\n\n";
+
+ if (ex.InnerException is not null net_object) then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if (InsuranceDefinedColumn_Obj is not null) then
+ void := call InsuranceDefinedColumn_Obj.Dispose;
+ InsuranceDefinedColumn_Obj := null;
+ endif;
+
+ InsuranceColumn_dest := null;
+ endcatch;
+ if (client_visit_obj is not null) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj := null;
+ endif;
+ conclude true;
+ endif;
+ elseif ((EvokingEventType in (OrdInit.Type,OrdSetInit.Type)) and (AlertFire)) then
+ conclude true;
+ else
+ conclude false;
+ endif;
+
+ //END OF VISIT ENTER/VISIT MODIFIY SECTION
+ ;;
+ action:
+ //BEGIN OF VISIT ENTER/VISIT MODIFIY SECTION
+
+
+ if ((EvokingEventType in (InsuranceEnter.Type,InsuranceModify.Type))) then
+
+ if (error_occurred) then
+ write "An error occurred in the MLM {{+B}}SCH_OON_INSURANCE{{-B}}. "
+ || " Please notify your system administrator that an error message has "
+ || " occurred for this patient. They will review the following error "
+ || " message:\n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+ if (exists InsuranceColumn_dest) then
+ write true at InsuranceColumn_dest;
+
+ endif;
+ ENDIF;
+
+ if((EvokingEventType in (OrdInit.Type,OrdSetInit.Type)) and (AlertFire)) then
+ write alert_message at alert_dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ORAL_HYPOGLYCEMIC_ORDER_GENERATE_BGM_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_ORAL_HYPOGLYCEMIC_ORDER_GENERATE_BGM_ORDER.mlm
new file mode 100644
index 0000000..07b19cc
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ORAL_HYPOGLYCEMIC_ORDER_GENERATE_BGM_ORDER.mlm
@@ -0,0 +1,423 @@
+maintenance:
+
+ title: Ordering: Generate BGM order upon entry of an oral Hypyglycemic Med;;
+ mlmname: SCH_Oral_Hypoglycemic_Order_Generate_BGM_Order;;
+ arden: version 2;;
+ version: 5.00;;
+ institution: St Clair;;
+ author: Teresa Spicuzza, Allscripts Corp;;
+ specialist: Teresa Spicuzza;;
+ date: 2010-12-13;;
+ validation: testing;;
+
+library:
+ purpose: Creates a protocol BGM order if no active order exists when an order is placed for an oral hypoglycemic
+ medication per diabetes initiative using ObjectsPlus/XA.
+ Each order will be placed onto the worksheet.
+ ;;
+
+ explanation: Patients receiving Oral Hypoglycemic Medications required to blood glucose monitored.
+ Place order if no patient has no existing active order.
+ The orders created by this MLM will be added to the worksheet
+ and will require the current user to submit them.
+ Change history
+
+ 04.26.2011 TMS Created from copy of OBJECTSPLUS_ORDERS_WITH_WORKSHEET MLM
+
+ ;;
+ keywords: BGM Hypoglycemic Diabetes, ObjectsPlus/XA, Order
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+
+ log_execution_info := false;
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {Order: THIS
+ where Name="Glipizide ER 5mg Tab" };
+ endif;
+
+ // Trigger when an order is created or a comment modified
+ // NOTE: Do not trigger on any of the orders being created by this
+ // MLM or it will result in a recursive loop that will cause
+ // the local client application to stop responding.
+
+ order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"};
+
+ (CatalogItemObj, FrequencyValue) := read last {Order: OrderCatalogMasterItem, FrequencyCode
+ REFERENCING EvokingObject};
+
+ CatalogClassTypeValueObj := read last {OrderCatalogMasterItem: CatalogClassTypeValue,
+ REFERENCING CatalogItemObj};
+
+ ClassTypeValue_code_list, ClassTypeValue_value_list := read {CatalogClassTypeValue: Code, Value
+ REFERENCING CatalogClassTypeValueObj};
+
+
+ // OneTimeFrequency := ("Once", "Now", "STAT", "PRE OP", "POST OP", "Pre-procedure", "Post-procedure");
+
+
+ // Get the currently logged on user
+ ( careProvider_obj ) := read last{ UserInfo: careProvider };
+
+ (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus };
+ (UserGUID ) := read last { UserInfo: GUID };
+
+ // Requesting Care Provider information for the new orders
+ // Find the Primary ID for the current user. This information
+ // is then used to retrieve the default requesting care provider object
+ user_IDType := "Primary";
+
+ CareProviderIDs_obj := read last
+ { CareProvider: CareProviderID
+ REFERENCING careProvider_obj };
+
+ user_IDCode := read last { CareProviderID: IDCode
+ REFERENCING CareProviderIDs_obj
+ where ProviderIDTypeCode = user_IDType };
+
+ // Get LocationGUID, used to retrieve the location object
+ // used to create all the orders.
+ // location_guid := read last { ClientVisit: CurrentLocationGUID };
+
+ // Get the clientVisitGUID and Order GUID from the evoking
+ // object. If the trigger event is not order based then
+ // the order GUID will be 0.
+ Active_ClientVisitGUID := EvokingObject.ClientVisitGUID;
+
+ if (EvokingObject is Order) then
+ Active_OrderGUID := EvokingObject.GUID;
+ if EvokingEventType = order_enter_event.type then
+ Active_SignificiantDtm := EvokingObject.SignificantDtm;
+ else
+ Active_SignificiantDtm := NOW;
+ endif;
+ else
+ Active_OrderGUID := 0;
+ Active_SignificiantDtm := EvokingObject.TouchedWhen;
+ endif;
+
+//
+
+(OrderName, StatusCode) := read last
+{"SELECT o.name, o.orderstatuscode "
+|| " from cv3ordercatalogmasteritem ocmi with (nolock) "
+|| " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid and o.clientguid = " || clientguid || " and o.chartguid = " || chartguid || " and o.clientvisitguid = " || clientvisitguid
+|| " and o.orderstatuscode Not In ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}}) "
+|| " and o.name = {{{SINGLE-QUOTE}}}POC Testing: Blood Glucose Monitor{{{SINGLE-QUOTE}}} "
+|| " order by o.significantdtm " };
+
+
+// retrieve unsubmitted orders for existing BGM order
+
+(order_name_list, order_status_code_list) := read
+ {UNSUBMITTED Order: Name, Orderstatuscode};
+
+if EvokingEvent = order_enter_event then
+ if "PRX_OralHypoglycemic" in ClassTypeValue_code_list then continue := "yes";
+ else continue := "no";
+ endif;
+// if continue = "yes" and (FrequencyValue in OneTimeFrequency) then continue := "no"; else continue := "yes"; endif;
+ if continue = "yes" and (OrderName = "POC Testing: Blood Glucose Monitor" or "POC Testing: Blood Glucose Monitor" in order_name_list) then Proceed := "No"; else Proceed := "Yes";
+ endif;
+
+//dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n freq: "||Frequencyvalue|| "\n Classes: "|| ClassTypeValue_code_list ||"\n Continue Value: "|| continue ||"\n Proceed Value: "|| Proceed ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};//If OrderName is Null then ModifierVariable := "Ordered Per Protocol"; else ModifierVariable := "Ordered Per Protocol"; endif;
+endif;
+
+
+
+ //------------------------------------------------------------
+ // Define the ObjectsPlus destinations
+ //------------------------------------------------------------
+
+ GeneralOrder_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM, placed on worksheet",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Order Object",
+ rule_number := 2010 ];
+
+ //---------------------------------------------------------------
+ // Error destination
+ //---------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1004,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ ;;
+ priority: 50
+ ;;
+ evoke: order_enter_event;
+ //order_init_event;
+ // comment_modify_event;
+ ;;
+ logic:
+ //----------------------------------------------------------------
+ // OrderEntryWorksheet owned batch is part of Sunrise Clinical Manager.
+ // Running from MLM Editor, cannot retrieve OrderEntryWorksheet owned
+ // order entry batch.
+ // This MLM cannot be tested from MLM Editor.
+ //----------------------------------------------------------------
+ if called_by_editor
+ then
+ conclude false;
+ endif;
+
+ //----------------------------------------------------------------
+ // If there is no evoking object then do nothing, this can
+ // only be true for the MLM Editor
+ //----------------------------------------------------------------
+ if EvokingObject is null
+ then
+ conclude false;
+ endif;
+ if continue = "no"
+ then
+ conclude false;
+ endif;
+
+ try
+ //-----------------------------------------------------------
+ // Retrieve current order entry batch.
+ // The companion order can be added only if the parent order
+ // belongs to the order entry batch
+ // object owned by the OrderEntryWorksheet.
+ //-----------------------------------------------------------
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+
+ if worksheetInfo is NULL OR
+ "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String)
+ then
+ conclude false;
+ endif;
+
+ //------------------------------------------------------------
+ // Get the .NET version of the Client Visit object.
+ // Needed to create new ObjectsPlus object
+ //------------------------------------------------------------
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((Active_ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+
+ //-----------------------------------------------------------
+ // Check the order entry worksheet. If there are no entries
+ // already on the worksheet set the initial values for
+ // the worksheet.
+ //-----------------------------------------------------------
+ if worksheetInfo.UnsubmittedOrdersCount = 0
+ then
+ // If there are no orders on the worksheet set
+ // defaults that will be used to create the orders
+
+ WSSessionType := "Hold";
+ WSSessionReason := "Hold Orders";
+ WSRequestedBySource := "";
+
+ // Set the session type and reason on the worksheet
+ void := call worksheetInfo.SetSessionType with (WSSessionType, WSSessionReason);
+
+ // Set the requesting source string
+ worksheetInfo.RequestedBySource := WSRequestedBySource;
+
+ //Get the current user as the default care provider
+ WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById
+ with ( user_IDType, user_IDCode );
+
+ //Set the requesting provider
+ worksheetInfo.RequestedBy := WSRequestedBy_obj;
+
+ // Get the location that will be used for the orders.
+ WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((LocationGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ //Set the expected release location group
+ worksheetInfo.ExpectedReleaseLocationGroup := WSlocation_obj;
+
+ //Dispose RequestedBy CareProvider
+ if( WSRequestedBy_obj is NOT NULL ) then
+ void := call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ //Dispose ExpectedReleaseLocationGroup
+ if( WSlocation_obj is NOT NULL ) then
+ void := call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+
+ else
+ //If there are orders on the worksheet retrieve the default values
+ // on the worksheet.
+ // These values are not required for this sample MLM however they
+ // contain useful information that can be used in the logic of an
+ // MLM.
+ WSSessionType := worksheetInfo.SessionType;
+ WSSessionReason := worksheetInfo.SessionReason;
+ WSRequestedBySource := worksheetInfo.RequestedBySource;
+ WSRequestedBy_obj := worksheetInfo.RequestedBy;
+ WSlocation_obj := worksheetInfo.ExpectedReleaseLocationGroup;
+ endif;
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if( worksheetInfo is NOT NULL ) then
+ void := call worksheetInfo.Dispose;
+ worksheetInfo:= null;
+ endif;
+
+ if( client_visit_obj is NOT NULL ) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ if( WSRequestedBy_obj is NOT NULL ) then
+ void := call WSRequestedBy_obj.Dispose;
+ WSRequestedBy_obj:= null;
+ endif;
+
+ if( WSlocation_obj is NOT NULL ) then
+ void := call WSlocation_obj.Dispose;
+ WSlocation_obj:= null;
+ endif;
+
+ // If unable to initialize starting data, do not continue
+ // with the creation of any orders.
+ // Still conclude true as the error message needs to
+ // be displayed as an error.
+ conclude true;
+
+ endcatch;
+
+ //---------------------------------------------------------------
+ //
+ //
+ //---------------------------------------------------------------
+
+ //----------------------------------------------------------------------
+ // Create a new GENERAL order from a non-PreFilled item
+ // Place the order onto the order entry worksheet
+ //----------------------------------------------------------------------
+ If proceed = "yes" then
+ try
+
+ Catalog_Item_Name := "POC Testing: Blood Glucose Monitor";
+ order_Creation_Reason := "Patient ordered oral hypoglycemics";
+
+ // get OrderCatalogMasterItem ObjectsPlus object
+ general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with Catalog_Item_Name;
+
+ // Create the prefilled General order
+ // Session information has been retrieved from the current worksheet if there
+ // already exists unsubmitted orders.
+ // The AvailabilityOverride flag is set to AlwaysOverride which will override any
+ // availabilty policy defined for this order that defines
+ // this item as not available at this location. The user still need to have the
+ // correct override right.
+ GeneralOrder_obj := call worksheetInfo.CreateGeneralOrder
+ with
+ general_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ order_Creation_Reason, // Create Reason
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
+ false, // suppresss messages
+ (Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Created from order primary key
+ true; // Mandatory on Worksheet
+
+ if( general_catalog_item is NOT NULL ) then
+ void := call general_catalog_item.Dispose;
+ general_catalog_item:= null;
+ endif;
+
+ freqCodeValue_obj := new net_object {{{SINGLE-QUOTE}}}Frequency{{{SINGLE-QUOTE}}} with "QID (AC and HS)";
+
+ GeneralOrder_obj.RequestedDate := "T";
+ GeneralOrder_obj.RequestedTime := "Routine";
+ GeneralOrder_obj.Frequency := freqCodeValue_obj;
+ //GeneralOrder_obj.StopDate := "T+4";
+
+ Comment_UDDI := "NUR_NurIntervFreeText"; // Label reads Special Instructions
+ retval := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with
+ Comment_UDDI, "Diabetic Initiative Protocol Order";
+
+ GeneralOrder_dest.ObjectsPlus := GeneralOrder_obj;
+
+ endtry;
+ catch Exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New general order:{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ if( general_catalog_item is NOT NULL ) then
+ void := call general_catalog_item.Dispose;
+ general_catalog_item:= null;
+ endif;
+
+ if( GeneralOrder_obj is NOT NULL ) then
+ void := call GeneralOrder_obj.Dispose;
+ GeneralOrder_obj:= null;
+ endif;
+
+ GeneralOrder_dest := null;
+ endcatch;
+
+ endif;
+ //----------------------------------------------------------------------
+
+ // Dispose client visit objects
+ if( client_visit_obj is NOT NULL ) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj:= null;
+ endif;
+
+ // Dispose order entry batch object
+ if( worksheetInfo is NOT NULL ) then
+ void := call worksheetInfo.Dispose;
+ worksheetInfo:= null;
+ endif;
+
+ conclude true;
+
+ ;;
+ action:
+
+ if Error_occurred
+ then
+
+ write "An error has occurred in the MLM {{+B}}TEST_OBJECTSPLUS_ORDERS_WITH_WORKSHEET{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error(s) " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+ if EXISTS GeneralOrder_dest then
+ write true at GeneralOrder_dest;
+ endif;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_ADMISSION_HOME_MED_STATUS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_ADMISSION_HOME_MED_STATUS.mlm
new file mode 100644
index 0000000..dd64b29
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_ADMISSION_HOME_MED_STATUS.mlm
@@ -0,0 +1,136 @@
+maintenance:
+
+title: SCH_ORDER_REC_ADMISSION_HOME_MED_STATUS;;
+filename: SCH_ORDER_REC_ADMISSION_HOME_MED_STATUS;;
+arden: version 2.5;;
+version: 1.01;; //6.1 SU5+
+institution: Allscripts S2V Content;;
+author: Allscripts;;
+specialist: Allscripts;;
+date: 2014-02-11;;
+validation: testing;;
+
+library:
+purpose: This MLM will display an alert when Admission Reconciliation is opened, alerting the provider if the patient{{{SINGLE-QUOTE}}}s home medication collection status
+ (Outpatient Medication Review) is either incomplete or not started
+
+*** Allscripts Disclaimer:
+ Client is responsible for all decisions, acts, and omissions of any persons in connection with the delivery of medical care or other services to any patients.
+ Before any Licensed Materials are placed into a live production environment, it is Client’s responsibility to review and test all Licensed Materials and associated
+ workflows and other content, as implemented, make independent decisions about system settings and configuration based upon Client’s needs, practices, standards and
+ environment, and reach its own independent determination that they are appropriate for such live production use. Any such use by Client (or its Authorized Users)
+ will constitute Client’s representation that it has complied with the foregoing. Client shall ensure that all Authorized Users are appropriately trained in use of
+ the then-deployed release of the Software prior to their use of the Software in a live production environment. Clinical Materials are tools to assist Authorized
+ Users in the delivery of medical care, but should not be viewed as prescriptive or authoritative. Clinical Materials are not a substitute for, and Client shall
+ ensure that each Authorized User applies in conjunction with the use thereof, independent professional medical judgment. Clinical Materials are not designed for use,
+ and Client shall not use them, in any system that provides medical care without the participation of properly trained personnel. Any live production use of Clinical
+ Materials by Client (or its Authorized Users) will constitute Client’s acceptance of clinical responsibility for the use of such materials.
+
+ Modification History
+ ____________________________________________________________________________
+
+ 02/11/2014 Allscripts S2V New S2V MLM
+
+ ;;
+explanation:
+
+ Change History
+
+ DW 04.15.2014 - CSR# 31688 - Loaded (changed name. originally titled S2V_ORM_ADMISSION_HOME_MED_STATUS)
+ ;;
+keywords: ;;
+
+knowledge:
+type: data-driven;;
+data:
+
+
+ //Define Alert Destination variables
+ sync_alert_dialog := "Must Acknowledge";
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Define Alert Destination
+ ORM_alert := DESTINATION {Alert} WITH
+ [ alert_type:= "WARNING",
+ short_message:="Order Reconciliation Informational Alert",
+ priority:= "high",
+ scope:= "Chart",
+ rule_group:= "Alert",
+ rule_number:= 1255,
+ //send_with_order := send_alert,
+ alert_dialog_settings := sync_alert_dialog,
+ //async_alert_dialog_settings := async_alert_dialog,
+ //ack_comment_UDDD := UDDD_dictionary_name,
+ //ack_comment_UDDD_is_restricted := UDDD_is_restricted
+ ];
+
+ //Define Triggering Event
+ ORM_Admission := event {OrderReconciliationPerform User:
+ WHERE ReconcileTypeCode = "Admission"
+ };
+
+ //Set Variables
+ client_GUID := EVOKINGOBJECT.ClientGUID;
+ Chart_GUID := EVOKINGOBJECT.ChartGUID;
+ client_visit_GUID := EVOKINGOBJECT.ClientVisitGUID;
+ msg := "";
+ display_msg := TRUE;
+
+
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent; //Retrieve the current order session
+ currentLocation := read last {ClientVisit : CurrentLocation};
+
+ if (currentLocation matches pattern "ER-%" OR currentLocation = "ER Major")
+
+ then
+
+
+ //Retrieve the OMR Status
+ //OMR statuses
+ //Null or 0 is not started
+ //1 is incomplete
+ //2 is complete
+ (OMR_Status) := read last {
+ " Select OMR.ReviewStatusType "
+ || " FROM SXAAMBOrderMedRecReview OMR with (nolock) "
+ || " WHERE OMR.clientguid = " || sql(client_guid)
+ || " AND OMR.visitguid = " || sql(client_visit_guid)
+ // Chart_Guid is not used on this database table
+ };
+
+ if OMR_Status = 0 or OMR_status is NULL then
+ msg := "{{+B}}{{+R}}CAUTION!! The Home Medication List has not been collected or verified";
+ elseif OMR_Status = 1 then
+ msg := "{{+B}}{{+R}}CAUTION!! The Home Medication List is incomplete and requires additional follow up or verification";
+ elseif OMR_Status = 2 then
+ // msg := "{{+B}}{{+R}}The Outpatient Medication Review(Home Med Collection) has been completed.";
+ display_msg := FALSE;
+ endif;
+
+ else
+ display_msg := FALSE;
+
+ endif;
+
+ ;;
+ evoke:
+ ORM_Admission;
+
+ ;;
+ logic:
+
+ conclude TRUE;
+ //conclude display_msg;
+
+ ;;
+ action:
+ //Write Message
+
+ if display_msg = True then
+ write msg at ORM_alert;
+ endif;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_DISCHARGE_ADMISSION_ORM_STATUS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_DISCHARGE_ADMISSION_ORM_STATUS.mlm
new file mode 100644
index 0000000..b133521
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_DISCHARGE_ADMISSION_ORM_STATUS.mlm
@@ -0,0 +1,100 @@
+maintenance:
+
+title: SCH_ORDER_REC_DISCHARGE_ADMISSION_ORM_STATUS;;
+filename: SCH_ORDER_REC_DISCHARGE_ADMISSION_ORM_STATUS;;
+arden: version 2.5;;
+version: 1.01;;
+institution: St.Clair Hospital;;
+author: Debbie Eiler;;
+specialist: Don Warnick;;
+date: 2014-09-08;;
+validation: testing;;
+
+library:
+purpose: This MLM will display an alert when Discharge Reconciliation is opened, alerting the provider if the patient{{{SINGLE-QUOTE}}}s Admission Order Reconcillation
+ is either incomplete or not started
+ ;;
+explanation:
+
+ Change History
+
+ DW 09.08.2014 - CSR# 32630 - Initiative to ensure thatAdmission Order Reconciliation is completed for all inpatients
+ ;;
+keywords: ;;
+
+knowledge:
+type: data-driven;;
+data:
+
+
+ sync_alert_dialog := "Must Acknowledge";
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+ ORM_alert := DESTINATION {Alert} WITH
+ [alert_type:= "WARNING", short_message:="Order Reconciliation Informational Alert",
+ priority:= "high", scope:= "Chart", rule_group:= "Alert", rule_number:= 1255, alert_dialog_settings := sync_alert_dialog, ];
+
+ ORM_Admission := event {OrderReconciliationPerform User: WHERE ReconcileTypeCode = "Discharge"};
+
+
+ client_GUID := EVOKINGOBJECT.ClientGUID;
+ chart_GUID := EVOKINGOBJECT.ChartGUID;
+ client_visit_GUID := EVOKINGOBJECT.ClientVisitGUID;
+
+ msg := "";
+ display_msg := TRUE;
+
+ PatientType := read last {ClientVisit : TypeCode};
+
+ userguid :=read last {UserInfo: guid};
+
+ (usertype) := read last {" select typecode,displayname "
+ || " from cv3careprovider with (nolock) "
+ || " where guid = " || SQL(userguid)
+ || " and typecode not like {{{SINGLE-QUOTE}}}Non Staff%{{{SINGLE-QUOTE}}} "
+ || " and (typecode like {{{SINGLE-QUOTE}}}%Physician%{{{SINGLE-QUOTE}}} or typecode in ({{{SINGLE-QUOTE}}}PA{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PA-C{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CRNP{{{SINGLE-QUOTE}}})) "
+ };
+
+ If exists usertype and (PatientType = "inpatient" or PatientType = "observation")
+
+ then
+
+ (StatusType) := read last {
+ " Select ReconcileStatusType "
+ || " From CV3ORDERRECONCILE with (nolock) "
+ || " Where ReconcileTypeCode = {{{SINGLE-QUOTE}}}admission{{{SINGLE-QUOTE}}} "
+ || " and clientguid = " || sql(client_guid) || " and chartguid = " || sql(chart_guid) || " AND clientvisitguid = " || sql(client_visit_guid)
+ };
+
+ if exists StatusType and StatusType <> 2
+ then
+ msg := "{{+B}}{{+R}} You have selected Discharge ORM and the Admission ORM is not completed, do you want to proceed?";
+ elseif not exists StatusType
+ then
+ msg := "{{+B}}{{+R}} You have selected Discharge ORM and the Admission ORM has not been started, do you want to proceed?";
+ else
+ display_msg := FALSE;
+ endif;
+
+ else
+
+ display_msg := FALSE;
+
+ endif;
+
+ ;;
+ evoke:
+ ORM_Admission;
+ ;;
+ logic:
+ conclude TRUE;
+ ;;
+ action:
+ if display_msg = True then
+ write msg at ORM_alert;
+ endif;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_DISCHARGE_ANTIPSYCH_MEDS_ALERT.mlm b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_DISCHARGE_ANTIPSYCH_MEDS_ALERT.mlm
new file mode 100644
index 0000000..36cd472
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_DISCHARGE_ANTIPSYCH_MEDS_ALERT.mlm
@@ -0,0 +1,120 @@
+maintenance:
+
+title: SCH_ORDER_REC_DISCHARGE_ANTIPSYCH_MEDS_ALERT;;
+filename: SCH_ORDER_REC_DISCHARGE_ANTIPSYCH_MEDS_ALERT;;
+arden: version 2.50;;
+version: 15.01;;
+institution: St.Clair Hospital;;
+author: Juliet M. Law, Allscripts;;
+specialist: Dean Miklavic, Allscripts;;
+date: 2016-02-12;;
+validation: testing;;
+
+library:
+purpose: This MLM will display an alert when Discharge Reconciliation is saved, complete or incompete, and a psych patient has 2 or more
+ antipsych meds reconciled and the "Antipsychotic Discharge Medications" document has not been entered.
+ ;;
+explanation:
+
+ Change History
+ 02.12.2016 JML CSR 33822: Created.
+ 07.27.2018 JML CSR 35633: Modified to fire alert on Form Open (OrderSetInit) of the Discharge Orders order set
+
+ ;;
+keywords: ;;
+
+knowledge:
+type: data-driven;;
+data:
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ Discharge_OrderSet_Event := EVENT { OrderSetInit User OrderSet : WHERE OrderSetName IN ("Discharge Orders", "Discharge Order Set - Outpatient", "Discharge Orders - Additional", "Discharge Orders ED") };
+ Discharge_Order_Event := EVENT { OrderInit User Order : WHERE Name IN ( "Discharge", "Discharge if OK with", "OK to Discharge if" ) };
+
+ Antipsych_alert_dest := DESTINATION { alert } WITH
+ [ alert_type := warning,
+ short_message := "Antipsychotic Medication Alert",
+ priority := "Low",
+ scope := chart,
+ rule_group := "Antipsychotic Med Group",
+ rule_number := 8005,
+ send_with_order := "DoNotSend",
+ alert_dialog_settings := "No Override Allowed" ];
+
+
+ client_guid := EvokingObject.ClientGUID;
+ chart_guid := EvokingObject.ChartGUID;
+ visit_guid := EvokingObject.ClientVisitGUID;
+ user_guid := EvokingObject.UserGUID;
+ care_prov_guid := EvokingObject.CareProviderGUID;
+
+ display_alert := false;
+
+ //Determine patient{{{SINGLE-QUOTE}}}s location
+ pat_loc := READ LAST { ClientVisit : CurrentLocation };
+
+ //Determine logged on users occupation & discipline
+ ( occupation
+ , CareProvObj ) := READ LAST { UserInfo : OccupationCode, CareProvider };
+ discipline := CareProvObj.Discipline;
+
+ if ( occupation IN ("MD", "PA-C") AND discipline = "Psychiatry" AND pat_loc matches pattern "PSY%" ) then
+
+ //Retrieve medications reconciled on patient
+ anti_psych_med_cnt := read last { "SELECT COUNT(ord.OrderGUID)"
+ || " FROM CV3OrderReconcile orr WITH (NOLOCK) JOIN CV3OrderReconcileDtl ord WITH (NOLOCK)"
+ || " ON orr.GUID = ord.ReconcileGUID"
+ || " JOIN CV3Order o WITH (NOLOCK)"
+ || " ON ord.OrderGUID = o.GUID"
+ || " JOIN CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)"
+ || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
+ || " WHERE orr.ClientGUID = " || SQL(client_guid)
+ || " and orr.ClientVisitGUID = " || SQL(visit_guid)
+ || " and orr.ChartGUID = " || SQL(chart_guid)
+ || " and orr.ReconcileTypeCode = {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}}"
+ || " AND ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}psychotherapeutic agents | antipsychotics{{{SINGLE-QUOTE}}}"
+ || " AND ord.OrderVisitType = 2"
+ || " AND ( o.Name NOT LIKE {{{SINGLE-QUOTE}}}Lithium%{{{SINGLE-QUOTE}}} AND o.Name NOT LIKE {{{SINGLE-QUOTE}}}Prochlorperazine%{{{SINGLE-QUOTE}}} )" };
+
+ if ( ( anti_psych_med_cnt as number ) >= 2 ) then
+
+ //Retrieve documents entered on patient
+ antipsych_doc := READ { "SELECT 1 "
+ || " FROM CV3ClientDocumentCUR cd WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
+ || " ON cd.ClientGUID = cv.ClientGUID"
+ || " AND cd.ClientVisitGUID = cv.GUID"
+ || " AND cd.ChartGUID = cv.ChartGUID"
+ || " WHERE cd.ClientGUID = " || Sql(client_guid)
+ || " AND cd.ClientVisitGUID = " || Sql(visit_guid)
+ || " AND cd.ChartGUID = " || Sql(chart_guid)
+ || " AND cd.DocumentName = {{{SINGLE-QUOTE}}}Antipsychotic Discharge Medications{{{SINGLE-QUOTE}}}"
+ || " AND cd.IsCanceled = 0" };
+
+ if ( not exists antipsych_doc ) then
+ //Display alert
+ display_alert := true;
+ alert_msg := "Two or more Antipsychotic Discharge Medications have been reconciled for this patient.";
+ alert_msg := alert_msg || "\n\nPlease complete the {{+B}}{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}Antipsychotic Discharge Medications{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}{{-B}} document in SCM before creating a Discharge Order.";
+ endif;
+
+ endif;
+ endif;
+
+ ;;
+ evoke:
+
+ Discharge_OrderSet_Event;
+ Discharge_Order_Event;
+ ;;
+ logic:
+
+ conclude display_alert;
+
+ ;;
+ action:
+ write alert_msg at Antipsych_alert_dest;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_INSULIN_PROTOCOL.mlm b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_INSULIN_PROTOCOL.mlm
new file mode 100644
index 0000000..d65077f
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_INSULIN_PROTOCOL.mlm
@@ -0,0 +1,113 @@
+maintenance:
+
+title: SCH_ORDER_REC_INSULIN_PROTOCOL;;
+filename: SCH_ORDER_REC_INSULIN_PROTOCOL;;
+arden: version 2.5;;
+version: 1.01;;
+institution: St.Clair Hospital;;
+author: Shawn Head;;
+specialist: Shawn Head;;
+date: 2017-10-26;;
+validation: testing;;
+
+library:
+purpose: This MLM will display an alert when Admission Order Rec is opened if one of the "ED Insulin" order items from the Diabetic management protocol order set are still active on the patients chart.
+ Teresa created 3 new items that have a double space between the first name and second name of the drugs. As of 11/6/2017 the 3 unique ED insulin order names include....
+ Insulin Detemir, Insulin Glargine, Insulin (NPH) Isophane.
+ ;;
+explanation:
+
+ Change History
+
+ STH 11.6.2017 - CSR# 35723 - Diabetic Management Protocol MLM for alerting inpatient physicians when the Diabetic Management Protocol order has been placed on the patient. This MLM
+ may later be replaced with compass and SHM.
+ SZ 04.10.2018 - CSR #35545 - Therapeutic Substitution of Lantus/Levemir. Added {{{SINGLE-QUOTE}}}Insulin, Basal (Lantus/Levemir)%{{{SINGLE-QUOTE}}} to SQL statement.
+ ;;
+keywords: ;;
+
+knowledge:
+type: data-driven;;
+data:
+
+
+ sync_alert_dialog := "Must Acknowledge";
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+
+ ORM_alert := DESTINATION {Alert} WITH
+ [alert_type:= "WARNING", short_message:="Order Reconciliation Informational Alert",
+ priority:= "high", scope:= "Chart", rule_group:= "Alert", rule_number:= 1255, alert_dialog_settings := sync_alert_dialog, ];
+
+ ORM_Admission := event {OrderReconciliationPerform User: WHERE ReconcileTypeCode = "Admission"};
+
+
+ client_GUID := EVOKINGOBJECT.ClientGUID;
+ chart_GUID := EVOKINGOBJECT.ChartGUID;
+ client_visit_GUID := EVOKINGOBJECT.ClientVisitGUID;
+ currentLocation := read last {ClientVisit : CurrentLocation};
+
+ msg := "";
+ display_msg := TRUE;
+
+ PatientType := read last {ClientVisit : TypeCode};
+
+ userguid :=read last {UserInfo: guid};
+
+ (usertype) := read last {" select typecode,displayname "
+ || " from cv3careprovider with (nolock) "
+ || " where guid = " || SQL(userguid)
+ || " and typecode not like {{{SINGLE-QUOTE}}}Non Staff%{{{SINGLE-QUOTE}}} "
+ || " and (typecode like {{{SINGLE-QUOTE}}}%Physician%{{{SINGLE-QUOTE}}} or typecode in ({{{SINGLE-QUOTE}}}PA{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PA-C{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CRNP{{{SINGLE-QUOTE}}})) "
+ };
+
+
+ if (currentLocation matches pattern "ER-%" OR currentLocation = "ER Major") then
+ display_msg := FALSE;
+ elseIf ((exists usertype)
+ and (PatientType = "inpatient" or PatientType = "observation"))
+
+ then
+
+ (InsulinProtocolOrder) := read last {
+ " Select name from cv3order with (nolock) "
+ || " where clientguid = " || sql(client_GUID)
+ || " and chartguid = " || sql(chart_GUID)
+ || " and clientvisitguid = " || sql(client_visit_GUID)
+ || " and (name like {{{SINGLE-QUOTE}}}Insulin Detemir%{{{SINGLE-QUOTE}}}
+ or name like {{{SINGLE-QUOTE}}}Insulin, Basal (Lantus/Levemir)%{{{SINGLE-QUOTE}}}
+ or name like {{{SINGLE-QUOTE}}}Insulin Glargine%{{{SINGLE-QUOTE}}}
+ or name like {{{SINGLE-QUOTE}}}Insulin (NPH) Isophane%{{{SINGLE-QUOTE}}})
+ and OrderStatusLevelNum >= 15
+ and OrderStatusLevelNum not in (69, 70) "};
+
+ if exists InsulinProtocolOrder
+ then
+ msg := "{{+B}}This patient has interim orders entered to manage their diabetes until a full reconciliation can be completed. " || CRLF || CRLF
+ || "{{+R}}The admitting interim insulin orders may vary significantly from their home regimen.{{-R}}" || CRLF || CRLF
+ || "Please review all diabetic management orders to ensure the patient is receiving the regimen necessary to control their diabetes.";
+ else
+ display_msg := FALSE;
+ endif;
+
+ else
+ display_msg := FALSE;
+ endif;
+
+ ;;
+ evoke:
+ ORM_Admission;
+ ;;
+ logic:
+ conclude TRUE;
+ ;;
+ action:
+ if display_msg = True then
+ write msg at ORM_alert;
+ endif;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_SAVED_INCOMPLETE_CREATE_COMMENT.mlm b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_SAVED_INCOMPLETE_CREATE_COMMENT.mlm
new file mode 100644
index 0000000..3841cc4
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_SAVED_INCOMPLETE_CREATE_COMMENT.mlm
@@ -0,0 +1,195 @@
+maintenance:
+
+ title: SCH_ORDER_REC_SAVED_INCOMPLETE_CREATE_COMMENT ;;
+ filename: SCH_ORDER_REC_SAVED_INCOMPLETE_CREATE_COMMENT;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Debbie Eiler ;;
+ specialist: Don Warnick;;
+ date: 2014-08-07;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will create a patient comment when an Admission Order Reconciliaion is saved as incomplete.
+ It discontinues the comment when the Order Rec is saved as complete
+ ;;
+ explanation:
+
+ Change History
+
+ DW 08.07.2014 - CSR# 32630 - Order Rec Patient Header - Created
+
+ ;;
+ keywords: Order Reconciliation, Admission, Patient Comment
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ log_execution_info:= false;
+
+ send_alert := "DoNotSend";
+ alert_dest := destination { Alert: warning, "Order Session Type", high, chart, "Order Session Type", 15044, send_alert, "No Override Allowed" };
+
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ Msg:= " The MLM will \n";
+
+ order_rec_event := event{OrderReconciliationSave Any ORDERRECONCILE: Where ReconcileTypeCode = "Admission"};
+
+ (ClientVisitGuid, ChartGuid, ClientGuid, VisitType) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode};
+ (UserGUID ) := read last { UserInfo: GUID };
+
+
+
+ discontinue_comment_guid := read last
+ { " select GUID from CV3CommentDeclaration with (nolock) " ||
+ " where TypeCode = {{{SINGLE-QUOTE}}}AdmORM{{{SINGLE-QUOTE}}} and Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " ||
+ " AND ClientGUID = " || SQL(clientGUID) || " AND ChartGUID = " || SQL(ChartGUID) || " AND ClientVisitGUID = " || SQL(clientVisitGUID) || " " } ;
+
+
+ // DESTINATIONS
+
+ NewComment_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object created by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Comment Object",
+ rule_number := 2010 ];
+
+ DiscontinueComment_dest := destination { ObjectsPlus } with
+ [ alert_type := "Warning",
+ short_message := "Object discontinued by MLM",
+ priority := "low",
+ scope := "chart",
+ rule_group := "Comment Object",
+ rule_number := 2030 ];
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "ObjectsPlus Error from MLM",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "ObjectsPlus Error from MLM",
+ Rule_number := 1003,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+
+
+ // INCOMPLETE ADMISSION ORM
+
+
+
+ If EVOKINGOBJECT.ReconcileStatusTypeDescription = "Incomplete" and not exists discontinue_comment_guid
+
+
+ then // Create the Comment
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ New_Comment_obj := call {{{SINGLE-QUOTE}}}PatientComment{{{SINGLE-QUOTE}}}.CreatePatientComment with client_visit_obj,"AdmORM";
+
+ New_Comment_obj.Text := "Adm Med Rec Incomplete";
+ NewComment_dest.ObjectsPlus := New_Comment_obj;
+
+ endtry;
+
+ catch exception ex
+ error_occurred := true;
+ error_message := "{{+R}}New Comment:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object
+ then
+ error_message := error_message ||
+ "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if ( New_Comment_obj is NOT NULL )
+ then
+ void:= call New_Comment_obj.Dispose;
+ New_Comment_obj:= null;
+ endif;
+ NewComment_dest := null;
+
+ endcatch;
+
+ endif;
+
+
+
+ // COMPLETE ADMISSION ORM
+
+
+
+ If EVOKINGOBJECT.ReconcileStatusTypeDescription = "Complete" and exists discontinue_Comment_GUID
+
+
+ then // Delete the Comment
+
+ try
+ Discontinue_Comment_obj := call {{{SINGLE-QUOTE}}}PatientComment{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( (discontinue_Comment_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+ empty := call Discontinue_Comment_obj.Discontinue;
+ DiscontinueComment_dest.ObjectsPlus := Discontinue_Comment_obj;
+ endtry;
+
+
+ catch exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}Discontinue Comment:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ex.InnerException is not null net_object
+ then
+ error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
+ endif;
+
+ if ( Discontinue_Comment_obj is NOT NULL )
+ then
+ void:= call Discontinue_Comment_obj.Dispose;
+ Discontinue_Comment_obj:= null;
+ endif;
+
+ DiscontinueComment_dest := null;
+ endcatch;
+
+ endif;
+
+
+
+ ;;
+ evoke:
+ order_rec_event;
+ ;;
+ logic:
+ conclude true;
+ ;;
+ action:
+
+
+ if Error_occurred
+ then
+
+ write "An error has occured in the MLM {{+B}}SCH_ORDER_REC_SAVED_INCOMPLETE_CREATE_COMMENT{{-B}} " ||
+ "Please notify your System Administrators that an error message has " ||
+ "occurred for this patient. They will review the following error " ||
+ "message: \n" at error_destination;
+ write error_message at error_destination;
+
+ endif;
+
+ if EXISTS NewComment_dest then
+ write true at NewComment_dest;
+ endif;
+
+ if EXISTS DiscontinueComment_dest then
+ write true at DiscontinueComment_dest ;
+ endif;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_SET_SESSION_TYPE_TO_HOLD.mlm b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_SET_SESSION_TYPE_TO_HOLD.mlm
new file mode 100644
index 0000000..f6877b6
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_SET_SESSION_TYPE_TO_HOLD.mlm
@@ -0,0 +1,72 @@
+maintenance:
+
+ title: SCH_ORDER_REC_SET_SESSION_TYPE_TO_HOLD ;;
+ filename: SCH_ORDER_REC_SET_SESSION_TYPE_TO_HOLD;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Debbie Eiler ;;
+ specialist: Don Warnick;;
+ date: 2013-01-30;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will set the session type to hold clinicians perform an admission reconciliation
+ ;;
+ explanation:
+
+ Change History
+ DW 11.15.2012 - CSR# 31688 - Created
+ TMS 01.29.2019 - CSR# 37869 - Add OR- beds to locations where medication reconciliation orders are placed in
+ a hold session. This will cause the same day surgery admissions to have their
+ orders placed in a hold session where they can be released with the post op
+ orders by the receiving unit.
+ TMS 01.30.2019 - CSR# 37869 - Added St. Clair Hospital Anc, ENDO, and OR to accommodate any outpatient surgery
+ patients who may need to be admitted post op.
+
+ ;;
+ keywords: Order reconciliation, Admission, session type, worksheetinfo
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ log_execution_info:= false;
+
+ send_alert := "DoNotSend";
+ stopOrder := false;
+
+ order_rec_event := event{OrderReconciliationPerform User ORDERRECONCILE: Where ReconcileTypeCode = "Admission"};
+
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent; //Retrieve the current order session
+ currentLocation := read last {ClientVisit : CurrentLocation};
+
+ if (currentLocation matches pattern "ER-%" OR currentLocation = "ER Major" or currentLocation matches pattern "OR-%"
+ or currentLocation = "OR" or currentLocation = "St. Clair Hospital Anc" or currentLocation = "ENDO") then
+
+ if (worksheetInfo.UnsubmittedOrdersCount = 0) then
+ void := call worksheetInfo.SetSessionType with ("HOLD", "Hold Orders");
+ else
+ stopOrder := true;
+ endif;
+
+ endif;
+
+;;
+ evoke:
+ order_rec_event;
+ ;;
+ logic:
+ conclude stopOrder;
+
+ if (worksheetInfo IS NOT NULL) then
+ void := call worksheetInfo.Dispose;
+ worksheetInfo := null;
+ endif;
+ ;;
+ action:
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_STROKE_MEDICATIONS.mlm b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_STROKE_MEDICATIONS.mlm
new file mode 100644
index 0000000..b61be9f
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_ORDER_REC_STROKE_MEDICATIONS.mlm
@@ -0,0 +1,494 @@
+maintenance:
+
+ title: SCH_ORDER_REC_STROKE_MEDICATIONS ;;
+ filename: SCH_ORDER_REC_STROKE_MEDICATIONS;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Peggy Karish ;;
+ specialist: Don Warnick;;
+ date: 2017-05-04;;
+ validation: testing;;
+
+library:
+ purpose: This MLM will alert the physician when the patient does not have an appropriate med to be selected for discharge order reconciliation.
+ ;;
+ explanation:
+
+ Change History
+
+ DW 06.12.2017 - CSR# 35309 - Stroke Quality Measure - Created
+ DW 10.16.2017 - CSR# 35309 - Stroke Quality Measure - Disable pilot code
+ DW 10.17.2017 - CSR# 35309 - Corrected SQL issue with determining the strengths of the components of a combination drug. Issue converting text to float.
+ DW 11.02.2017 - CSR# 35309 - Corrected SQL issue with document names (was searching for contraindications in "physician progress note" w/o a suffix which is appended
+ DW 12.12.2017 - HD# 2995007 - Corrected issue regarding the patient classification by HI. To be classified as AFIB, the patient must also have a Stroke/TIA HI
+ DW 12.18.2017 - HD# 2995007 - Corrected issue regarding the patient classification by HI. Was missing the {{{SINGLE-QUOTE}}}Discharge Diag{{{SINGLE-QUOTE}}} type. Sandy found it in testing Beta Blocker MLM
+
+ ;;
+ keywords: Order Reconciliation, Discharge
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ // Intense Statins List
+
+ /*
+ Dnum Int Strngth Generic (Brand)
+
+ d05048 xx mg-40 mg amLODIPine-atorvastatin (Caduet)
+ d04105 40 mg atorvastatin (Lipator)
+ d08089 40 mg-xx mg atorvastatin-ezetimibe (Liptruzet)
+ d05348 xx mg-80 mg ezetimibe-simvastatin (Vytorin)
+ d04851 20 mg rosuvastatin (Crestor)
+ d00746 80 mg simvastatin (Zocor)
+ */
+
+ // Caduet Lipator Liptruzet Vytorin Crestor Zocor
+
+ IntenseStatinsID := "d05048" , "d04105" , "d08089" , "d05348" , "d04851" , "d00746" ; // DNUM
+ IntenseStatinsStrn := "40" , "40" , "40" , "80" , "20" , "80"; // Intense Strength Dosage
+ IntenseStatinsPosit:= "2" , "1" , "1" , "2" , "1" , "1"; // Which Medication in a combination drug is the Stroke Med (always 1 if not a combination)
+
+
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ log_execution_info:= false;
+
+ error_destination := destination { Alert } with [alert_type := "Warning", short_message := "ObjectsPlus Error from MLM", priority := "low", scope := "chart", Rule_group := "MLM Error", Rule_number := 1003, Rule_subgroup := "", Send_with_order := "", Alert_dialog_settings := "", Display_alert := true ];
+
+ order_rec_event := event{OrderReconciliationPerform Any ORDERRECONCILE: Where ReconcileTypeCode = "Discharge"};
+// doc_open_event := event{ClientDocumentEnter User ClientDocument: WHERE DocumentName = "Physician Progress Note" };
+
+ (ClientVisitGuid, ChartGuid, ClientGuid, VisitType) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode};
+
+ birthdate := read last { ClientInfo: BirthDate};
+ patientage:= int ((NOW - birthdate) / (1 year));
+
+/*
+ // Search for pilot Hospitalist user names
+
+
+ userguid :=read last {UserInfo: guid};
+
+
+ PiotDoctor := read last
+ { "
+ select u.IDCode
+ from CV3User u
+ join CV3CareProvider cp with (nolock) on cp.GUID = u.GUID
+ join CV3OrganizationalUnit ou with (nolock) on ou.guid = u.OrgUnitGUID
+ join CV3UserSecurityGroup usg with (nolock) on usg.UserGUID = u.GUID
+ join CV3SecurityGroup sg with (nolock) on sg.GUID = usg.SecurityGroupGUID
+ where ou.Description = {{{SINGLE-QUOTE}}}Medical Affairs{{{SINGLE-QUOTE}}} and sg.code = {{{SINGLE-QUOTE}}}OBS Physician{{{SINGLE-QUOTE}}} and u.Active = 1
+ and u.guid = " || userguid || "
+ order by u.DisplayName
+ "
+ };
+
+ If exist PiotDoctor
+
+ then
+
+*/
+
+
+/*
+ // Search for Arterial Fibulation and Stroke Problems (DW 12.12.2017 - HD# 2995007 replaced with individual stroke and afib hi lookups. patient only should be classified as "afib" if they also have a stroke hi)
+
+
+ CodedProblem := read last
+ { "
+ select
+ case when chi.code >= {{{SINGLE-QUOTE}}}I48{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}I48.91{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Afib{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}Stroke{{{SINGLE-QUOTE}}} end
+ from CV3HealthIssueDeclaration hid with (nolock)
+ join CV3CodedHealthIssue chi with (nolock) on chi.guid = hid.CodedHealthIssueGUID
+ where hid.typecode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}} and hid.CodingScheme = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} and hid.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}}
+ and hid.clientguid = " || ClientGuid || " and hid.ChartGUID = " || ChartGuid || " and hid.ClientVisitGUID = " || ClientVisitGuid || "
+ and
+ (
+ chi.code >= {{{SINGLE-QUOTE}}}G45.0{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}G45.2{{{SINGLE-QUOTE}}} or
+ chi.code >= {{{SINGLE-QUOTE}}}G45.8{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}G45.9{{{SINGLE-QUOTE}}} or
+ chi.code >= {{{SINGLE-QUOTE}}}O99.41{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}O99.413{{{SINGLE-QUOTE}}} or
+ chi.code = {{{SINGLE-QUOTE}}}O99.419{{{SINGLE-QUOTE}}}
+ or
+ chi.code >= {{{SINGLE-QUOTE}}}I60{{{SINGLE-QUOTE}}} and chi.code < {{{SINGLE-QUOTE}}}I64{{{SINGLE-QUOTE}}}
+ or
+ chi.code >= {{{SINGLE-QUOTE}}}I48{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}I48.91{{{SINGLE-QUOTE}}}
+ )
+ "
+ };
+
+ //hid.Description, hid.TypeCode, hid.CodingScheme, hid.Code,
+ */
+
+
+ // Search for Stroke Problems
+
+
+ CodedProblem_Stroke := read last
+ { "
+ select
+ chi.code
+ from CV3HealthIssueDeclaration hid with (nolock)
+ join CV3CodedHealthIssue chi with (nolock) on chi.guid = hid.CodedHealthIssueGUID
+ where (hid.typecode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}} or hid.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}} or hid.typecode = {{{SINGLE-QUOTE}}}Discharge Diag{{{SINGLE-QUOTE}}}) and hid.CodingScheme = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} and hid.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}}
+ and hid.clientguid = " || ClientGuid || " and hid.ChartGUID = " || ChartGuid || " and hid.ClientVisitGUID = " || ClientVisitGuid || "
+ and
+ (
+ chi.code >= {{{SINGLE-QUOTE}}}G45.0{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}G45.2{{{SINGLE-QUOTE}}} or
+ chi.code >= {{{SINGLE-QUOTE}}}G45.8{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}G45.9{{{SINGLE-QUOTE}}} or
+ chi.code >= {{{SINGLE-QUOTE}}}O99.41{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}O99.413{{{SINGLE-QUOTE}}} or
+ chi.code = {{{SINGLE-QUOTE}}}O99.419{{{SINGLE-QUOTE}}}
+ or
+ chi.code >= {{{SINGLE-QUOTE}}}I60{{{SINGLE-QUOTE}}} and chi.code < {{{SINGLE-QUOTE}}}I64{{{SINGLE-QUOTE}}}
+ )
+ "
+ };
+
+
+ // Search for Arterial Fibulation Problems
+
+
+ CodedProblem_Afib := read last
+ { "
+ select
+ chi.code
+ from CV3HealthIssueDeclaration hid with (nolock)
+ join CV3CodedHealthIssue chi with (nolock) on chi.guid = hid.CodedHealthIssueGUID
+ where
+ (
+ (hid.typecode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}} and hid.clientguid = " || ClientGuid || " and hid.ChartGUID = " || ChartGuid || " and hid.ClientVisitGUID = " || ClientVisitGuid || " )
+ or
+ (hid.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}} and hid.clientguid = " || ClientGuid || " )
+ )
+ and hid.CodingScheme = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} and hid.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}}
+ and
+ (
+ chi.code >= {{{SINGLE-QUOTE}}}I48{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}I48.91{{{SINGLE-QUOTE}}}
+ )
+ "
+ };
+
+
+ If exists CodedProblem_Stroke and not exist CodedProblem_Afib then CodedProblem := "Stroke"; endif;
+ If exists CodedProblem_Stroke and exist CodedProblem_Afib then CodedProblem := "Afib"; endif;
+
+
+
+
+
+ if CodedProblem = "Afib" or CodedProblem = "Stroke"
+
+
+ then
+
+
+ ComfortMeasuresOnlyOrder := read last
+ { "
+ select top 1 o.Name, cast( convert(char(16), o.CreatedWhen,120) as varchar)
+ from CV3OrderCatalogMasterItem ocmi with (nolock)
+ join CV3Order o with (nolock) on o.OrderCatalogMasterItemGUID = ocmi.GUID
+ where ocmi.name like {{{SINGLE-QUOTE}}}Code Status:%{{{SINGLE-QUOTE}}} and o.Name like {{{SINGLE-QUOTE}}}%Comfort Measures Only{{{SINGLE-QUOTE}}} and o.OrderStatusLevelNum >= 15 and o.OrderStatusCode not in ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}}) and
+ o.clientguid = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID = " || ClientVisitGuid || "
+ order by o.CreatedWhen desc
+ "
+ };
+
+
+ // If there are no "Comfort Measures" orders, proceed with further SQL queries
+
+
+ If not exists ComfortMeasuresOnlyOrder
+
+ then
+
+
+ // Return a list of relavant stroke medications
+
+
+ (Anticoagulants, Antiplatelets, Statins) := read
+ { "
+ select distinct
+ case when dc2.CategoryName = {{{SINGLE-QUOTE}}}anticoagulants{{{SINGLE-QUOTE}}} then gn.DrugCatalogKey else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end {{{SINGLE-QUOTE}}}Anticoagulant{{{SINGLE-QUOTE}}},
+ case when dc2.CategoryName = {{{SINGLE-QUOTE}}}antiplatelet agents{{{SINGLE-QUOTE}}} then gn.DrugCatalogKey else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end {{{SINGLE-QUOTE}}}Antiplatelet{{{SINGLE-QUOTE}}},
+ case when dc.CategoryName in ({{{SINGLE-QUOTE}}}antihyperlipidemic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HMG-CoA reductase inhibitors (statins){{{SINGLE-QUOTE}}}) then gn.DrugCatalogKey else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end {{{SINGLE-QUOTE}}}Statin{{{SINGLE-QUOTE}}}
+ from SXAAMBDrugName bn with (nolock)
+ join SXAAMBGenericNameDrugNameXRef dnx with (nolock) on dnx.DrugNameID = bn.DrugNameID
+ join SXARxGenericName gn with (nolock) on gn.GenericNameID = dnx.GenericNameID
+ join SXAMTCategoryDrugXREFVW cdx with (nolock) on cdx.drug_id = gn.DrugCatalogKey
+ join SXAMTDrugCategoriesVW cat with (nolock) on cat.multum_category_id = cdx.multum_category_id
+ join SXAAMBDrugCategoryXRef xr with (nolock) on gn.GenericNameID = xr.GenericNameID
+ join SXAAMBDrugCategory dc with (nolock) on xr.DrugCategoryID = dc.DrugCategoryID
+ join SXAAMBDrugCategory dc2 with (nolock) on dc.ParentDrugCategoryID = dc2.DrugCategoryID
+ left join SXAAMBDrugCategory dc3 with (nolock) on dc2.ParentDrugCategoryID = dc3.DrugCategoryID
+ where
+ dc2.CategoryName = {{{SINGLE-QUOTE}}}anticoagulants{{{SINGLE-QUOTE}}} or dc2.CategoryName = {{{SINGLE-QUOTE}}}antiplatelet agents{{{SINGLE-QUOTE}}} or dc.CategoryName in ({{{SINGLE-QUOTE}}}antihyperlipidemic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HMG-CoA reductase inhibitors (statins){{{SINGLE-QUOTE}}})
+ "};
+
+ // case when dc.CategoryName in ({{{SINGLE-QUOTE}}}antihyperlipidemic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HMG-CoA reductase inhibitors{{{SINGLE-QUOTE}}}) then gn.DrugCatalogKey else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end {{{SINGLE-QUOTE}}}Statin{{{SINGLE-QUOTE}}}
+ // dc2.CategoryName = {{{SINGLE-QUOTE}}}anticoagulants{{{SINGLE-QUOTE}}} or dc2.CategoryName = {{{SINGLE-QUOTE}}}antiplatelet agents{{{SINGLE-QUOTE}}} or dc.CategoryName in ({{{SINGLE-QUOTE}}}antihyperlipidemic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HMG-CoA reductase inhibitors{{{SINGLE-QUOTE}}})
+
+
+
+ // Search for Patient Medications
+
+
+ (PatientMedDrugID, PatientMedStrength1, PatientMedStrength2, PatientMedName ) := read
+ { "
+ select distinct dnm.drug_id
+ ,case when gi.StrengthDesc like {{{SINGLE-QUOTE}}}%mg%{{{SINGLE-QUOTE}}} then substring(gi.StrengthDesc,0,CHARINDEX({{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},gi.StrengthDesc)) else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end
+ ,case when LEN(gi.StrengthDesc) - LEN(REPLACE(gi.StrengthDesc,{{{SINGLE-QUOTE}}}mg-{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})) = 3 then replace (substring(gi.StrengthDesc,CHARINDEX({{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},gi.StrengthDesc)+3,9),{{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end
+ ,cp.DrugName
+ from SXAAMBClientPrescription cp with (nolock)
+ inner join SXAMTDrugNameMapVW dnm with (nolock) on dnm.drug_synonym_id = cp.FormularyBrandKey
+ join SXAMTCategoryDrugXREFVW cdx with (nolock) on cdx.drug_id = dnm.drug_id
+ join SXAMTDrugCategoriesVW cat with (nolock) on cat.multum_category_id = cdx.multum_category_id
+ join sxarxgenericitem gi with (nolock) on gi.GenericItemID = cp.GenericItemID and gi.DrugCatalogKey = cp.FormularyDrugKey
+ where cp.ClientGuid = " || ClientGuid || " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ union
+ select distinct dm.DrugKey, ot.OrderDosageLow, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}, ocmi.Name
+ from cv3ordercatalogmasteritem ocmi with (nolock)
+ join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = ocmi.guid
+ JOIN CV3DrugMapping dm with (nolock) on dm.CatalogItemGUID = ocmi.GUID
+ join CV3OrganizationalUnit ou with (nolock) on ou.GUID = ocmi.OrgUnitGUID
+ join CV3OrderTask ot with (nolock) on ot.OrderGUID = o.GUID
+ where ou.name ={{{SINGLE-QUOTE}}}Pharmacy Department{{{SINGLE-QUOTE}}} and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}) and
+ o.clientguid = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID = " || ClientVisitGuid || "
+ "};
+
+
+ // 10/17/2017 - Corrected Issue with drug strentgh pattern (some have text and can{{{SINGLE-QUOTE}}}t convert to float). Removed the cast and convert only the intense statins later which do not have text
+
+ // ,case when gi.StrengthDesc like {{{SINGLE-QUOTE}}}%mg%{{{SINGLE-QUOTE}}} then cast (substring(gi.StrengthDesc,0,CHARINDEX({{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},gi.StrengthDesc)) as float) else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end
+ // ,case when LEN(gi.StrengthDesc) - LEN(REPLACE(gi.StrengthDesc,{{{SINGLE-QUOTE}}}mg-{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})) = 3 then cast (replace (substring(gi.StrengthDesc,CHARINDEX({{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},gi.StrengthDesc)+3,9),{{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as float) else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end
+
+
+
+ // Check for Anticoagulant Medications
+
+ AnticoagulantFound:= "";
+ for x in 1 seqto count (PatientMedDrugID) do
+ if (PatientMedDrugID[x] is in Anticoagulants)
+ then AnticoagulantFound := AnticoagulantFound || " " || PatientMedName [x];
+ endif;
+ enddo;
+
+
+ // Check for Antiplatelet Medications
+
+ AntiplateletFound:= "";
+ for x in 1 seqto count (PatientMedDrugID) do
+ if (PatientMedDrugID[x] is in Antiplatelets)
+ then AntiplateletFound := AntiplateletFound || " " || PatientMedName [x];
+ endif;
+ enddo;
+
+
+ // Check for Statin Medications
+
+ StatinFound := "";
+ IntStatinFound := "";
+
+ for x in 1 seqto count (PatientMedDrugID) do
+
+ if (PatientMedDrugID[x] is in Statins)
+
+ then StatinFound := StatinFound || " " || PatientMedName [x];
+
+ // Compare the drug name to the Intense Statin Drug ID list at the top of the MLM
+
+ for y in 1 seqto count (IntenseStatinsID) do
+
+ If (PatientMedDrugID[x] = IntenseStatinsID[y])
+
+ then
+
+ // Determine which strength (combinations have 2)qualifies it as an Intense statin using the Intense Statin LR list at the top of the MLM
+
+ position := IntenseStatinsPosit[y];
+
+ if position = "1"
+ then intensestren:= PatientMedStrength1[x];
+ else intensestren:= PatientMedStrength2[x];
+ endif;
+
+ // Determine if this strength qualifies as an Intense statin using the Intense Statin Strength list at the top of the MLM
+
+ if (intensestren as number) >= (IntenseStatinsStrn[y] as number)
+ then
+ IntStatinFound := IntStatinFound || PatientMedName[x];
+ endif;
+
+ endif;
+
+ enddo;
+ endif;
+
+ enddo;
+
+
+
+
+ // Search for all Contraindications
+
+ ContraIndications := read
+ {"
+ select
+ case when ocmi.name = {{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra Statin4{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}StatinContraindicated{{{SINGLE-QUOTE}}}
+ when ocmi.name = {{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra INT Statin3{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}IntensiveStatinContraindicated{{{SINGLE-QUOTE}}}
+ when ocmi.name = {{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra Antith 2{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}AntiplateletContraindicated{{{SINGLE-QUOTE}}}
+ when ocmi.name = {{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra AntiCoag 1{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}AnticoagulantContraindicated{{{SINGLE-QUOTE}}}
+ end
+ from CV3ClientDocumentCUR cd with (nolock)
+ join CV3ClientDocDetailCUR cdd with (nolock) on cdd.ClientDocumentGUID = cd.GUID and cdd.ClientGUID = cd.clientguid and cdd.Active = 1 and cdd.ArcType = cd.ArcType
+ join CV3ObservationDocumentCUR od with (nolock) on od.OwnerGUID = cdd.ClientDocumentGUID and od.ArcType = cdd.ArcType
+ join CV3ObservationCUR o with (nolock) on o.GUID = od.ObservationGUID and o.ArcType = od.ArcType
+ join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID
+ join SCMObsFSListValues fsl with (nolock) on fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || ClientGuid || "
+ where cd.ClientGUID = " || ClientGuid || " and cd.ChartGUID = " || ChartGuid || " and cd.ClientVisitGUID = " || ClientVisitGuid || " and cd.IsCanceled = 0 and od.Active = 1
+ and (cd.DocumentName like {{{SINGLE-QUOTE}}}Physician Progress%{{{SINGLE-QUOTE}}} or cd.DocumentName like {{{SINGLE-QUOTE}}}Day of Discharge Summary eNote%{{{SINGLE-QUOTE}}} or cd.DocumentName like {{{SINGLE-QUOTE}}}History and Physical%{{{SINGLE-QUOTE}}})
+ and ocmi.Name in ({{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra INT Statin3{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra Antith 2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra AntiCoag 1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra Statin4{{{SINGLE-QUOTE}}})
+ "};
+
+// and cd.DocumentName in ({{{SINGLE-QUOTE}}}Physician Progress Note{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Day of Discharge Summary eNote{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}History and Physical{{{SINGLE-QUOTE}}}) 11/02 code wasn{{{SINGLE-QUOTE}}}t retruning the contraindications as these documents are all suffixed with discipline
+
+
+
+ if "StatinContraindicated" in ContraIndications then StatinContra:= "true"; else StatinContra:= "false"; endif;
+ if "IntensiveStatinContraindicated" in ContraIndications then InStatContra:= "true"; else InStatContra:= "false"; endif;
+ if "AntiplateletContraindicated" in ContraIndications then AntiplContra:= "true"; else AntiplContra:= "false"; endif;
+ if "AnticoagulantContraindicated" in ContraIndications then AnticgContra:= "true"; else AnticgContra:= "false"; endif;
+
+
+ AlertMsg:= "false";
+ PbmCount:= 0;
+ AntiplMissing := "";
+ AnticgMissing := "";
+ StatinMissing := "";
+ IntStatinMissing := "";
+ MsgText := "";
+
+ If CodedProblem = "Afib"
+
+ then
+
+ // Afib Section
+
+ If AntiplateletFound = "" and AnticoagulantFound = "" and AntiplContra = "false" then AntiplMissing := "true"; AlertMsg:= "true"; PbmCount := PbmCount +1; else AntiplMissing := "false"; endif;
+ If AnticoagulantFound = "" and AnticgContra = "false" then AnticgMissing := "true"; AlertMsg:= "true"; PbmCount := PbmCount +1; else AnticgMissing := "false"; endif;
+
+ If StatinFound = "" and StatinContra = "false"
+
+ then StatinMissing := "true"; AlertMsg:= "true"; PbmCount := PbmCount +1;
+
+ else
+ StatinMissing := "false";
+
+ If patientage < 76 and IntStatinFound = "" and InStatContra = "false"
+ then IntStatinMissing := "true"; PbmCount := PbmCount +1;
+ endif;
+
+ endif;
+
+ MsgProblem := "afib";
+
+
+ else
+
+
+ // Stroke Section
+
+ If AntiplateletFound = "" and AnticoagulantFound = "" and AntiplContra = "false" then AntiplMissing := "true"; AlertMsg:= "true"; PbmCount := PbmCount +1; else AntiplMissing := "false"; endif;
+
+ If StatinFound = "" and StatinContra = "false"
+
+ then StatinMissing := "true"; AlertMsg:= "true"; PbmCount := PbmCount +1;
+
+ else StatinMissing := "false";
+
+ If patientage < 75 and IntStatinFound = "" and InStatContra = "false"
+ then IntStatinMissing := "true"; PbmCount := PbmCount +1;
+ endif;
+
+
+ endif;
+
+ MsgProblem := "stroke";
+
+ endif;
+
+
+ If PbmCount > 0
+
+ then
+
+ If AntiplMissing = "true" then MsgText := MsgText || "\n\n - An antiplatelet medication is recommended for stroke or TIA. This medication or an appropriately documented contraindication is missing."; endif;
+ If AnticgMissing = "true" then MsgText := MsgText || "\n\n - Anticoagulation therapy is recommended in the setting of active or history of Afib or Aflutter. This medication or an appropriately documented contraindication is missing."; endif;
+ If StatinMissing = "true" then MsgText := MsgText || "\n\n - A statin is recommended for stroke or TIA. This medication or an appropriately documented contraindication is missing."; endif;
+ If IntStatinMissing = "true" then MsgText := MsgText || "\n\n - An intensive statin dose is recommended for stroke or TIA patients under 75. This medication or an appropriately documented contraindication is missing."; endif;
+/*
+ MsgText := "\nAs a Certified Primary Stroke Center, St. Clair Hospital is responsible for complying with American Stroke Association and Joint Commission guidelines for stroke and TIA patients. " ||
+ "Currently, your patient will be discharged without an evidence-based recommended medication or an appropriately documented contraindication. " ||
+ "Please address in the discharge medication reconciliation or in the Quality Core Measures section of the progress note. \n "
+
+ || MsgText || " \n\n\n\n ";
+*/
+
+ MsgText := "\nBest Practice Recommendations: \n\n "
+
+ || MsgText || "\n\n\n\n *These are American Stroke Association and Joint Commission recommendations for Primary Stroke Centers. \n\n\n\n ";
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " " || MsgText, "Discharge Medication Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+
+ endif;
+
+
+
+
+ endif; // Does patient have a Comfort Measures Only Code Status Order?
+/*
+
+ dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n\n Coded Problem_Stroke :" ||CodedProblem_Stroke ||
+ "\n\n Coded Problem_Afib :" ||CodedProblem_Afib ||
+ "\n\n Coded Problem :" ||CodedProblem ||
+ "\n\n Patient Age :" || patientage ||
+ "\n\n Comfort Meas Only :" || ComfortMeasuresOnlyOrder ||
+ "\n\n ContraIndications :" || ContraIndications ||
+ "\n\n Anticoagulant Found :" || AnticoagulantFound ||
+ "\n\n Antiplatelet Found:" || AntiplateletFound ||
+ "\n\n Statin Found :" || StatinFound ||
+ "\n\n Intense StatinFound :" || IntStatinFound ||
+ " " , ".Stroke Evidence","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
+*/
+
+ endif; // Does patient has a coded problem for Stroke or Arterial Fibrulation?
+
+
+// endif; // Pilot Doctor
+
+ ;;
+ evoke:
+ order_rec_event;
+ // doc_open_event;
+ ;;
+
+ logic:
+ conclude true;
+ ;;
+
+ action:
+
+
+ if Error_occurred
+ then
+ write "An error has occured in the MLM {{+B}}SCH_ORDER_REC_SAVED_STROKE_MEDICATIONS{{-B}} " ||
+ "Please notify your System Administrators that an error message has occurred for this patient. They will review the following error message: \n" at error_destination;
+ write error_message at error_destination;
+ endif;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OTHER_DOSING_RECOMMENDATIONS.mlm b/MLMStripper/bin/Debug/SCH/SCH_OTHER_DOSING_RECOMMENDATIONS.mlm
new file mode 100644
index 0000000..410ebf6
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OTHER_DOSING_RECOMMENDATIONS.mlm
@@ -0,0 +1,386 @@
+maintenance:
+
+ title: Dosing recommendations based on age, weight, or total dose;;
+ mlmname: SCH_Other_Dosing_Recommendations;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair;;
+ author: Teresa Spicuzza, Allscripts Corp;;
+ specialist: Teresa Spicuzza;;
+ date: 2012-08-20;;
+ validation: testing;;
+
+library:
+ purpose: Dosing Recommendations and Warnings for select medications
+ ;;
+
+ explanation: MLM will read table for drug and suggest dosing as stated in logic.
+
+ Change history
+ 06.12.2013 TMS Created CSR 31334
+ 06.09.2015 TMS Updated for allopurinol alert. CSR 33467
+ 05.16.2018 TMS Add "With Dialysis Treatment" to Frequency retrievals that contain As Ordered. CSR 33940
+
+ Drugs included in MLM: Methotrexate; Allopurinol
+
+ ;;
+ keywords: Dosing
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {Order: THIS
+ where Name="Ketorolac Inj" };
+ endif;
+
+ doalert := false;
+ order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"};
+
+ (CatalogItemObj, FrequencyValue, UOMValue, DoseValue, OrderName, AdminIns, UserSchedType ,UserSchedDays, UserSchedDoses, OrderingProviderGuid) := read last
+ {Order: OrderCatalogMasterItem, FrequencyCode, UOM, DosageLow, Name, AdminInstructions, Interval, DaysInInterval, DoseMultiplier, CareProviderGuid
+ REFERENCING EvokingObject};
+
+
+ CatalogClassTypeValueObj := read last {OrderCatalogMasterItem: CatalogClassTypeValue,
+ REFERENCING CatalogItemObj};
+
+ ClassTypeValue_code_list, ClassTypeValue_value_list := read {CatalogClassTypeValue: Code, Value
+ REFERENCING CatalogClassTypeValueObj where code = "PRX_DosingAlerts"};
+
+ /* Get the OrderAdditionalInfo object pointer */
+ OrderAdditionalInfoObj := read last { Order: OrderAdditionalInfo
+ REFERENCING EvokingObject };
+
+ /* Get information from the OrderAdditionalInfo object */
+ (SummaryLine, FreqfromTime,FreqUOM, StopAfterValue, StopAfterOption ) := read last { OrderAdditionalInfo: FreqSummaryLine, FreqFromTime, FreqUOM, StopAfterValue, StopAfterOption
+ REFERENCING OrderAdditionalInfoObj };
+
+
+
+ dose_alert_dest := destination {alert} with
+ [alert_type := "Warning",
+ short_message := "Dosing Recommendation",
+ priority := "Low",
+ scope := "Chart",
+ rule_group := "Dosing Recommendations",
+ rule_number := 4081,
+ send_with_order := send_alert,
+ alert_dialog_settings := "",
+ display_alert := true];
+
+ for r in (1 seqto 1) do
+ classvaluelist := call str_parse with ClassTypeValue_value_list [r],",";
+ classvalue := classvaluelist[1];
+ enddo;
+//
+ if EvokingEvent = order_enter_event then
+ if "PRX_DosingAlerts" in ClassTypeValue_code_list then
+ continue := "yes";
+ else
+ continue := "no";
+ endif;
+ endif;
+
+ If continue = "yes" then
+ (schedtime, freqcode, timefrom, timeuom) := read last
+ {" select fsd.ScheduledTime, cft.FrequencyCode, cft.TimeFromValue, cft.TimeUom from CV3CodedFreqTranslation cft"
+ || " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
+ || " where cft.FrequencyCode = " || sql(frequencyvalue) || " and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.Active = 1"
+ || " order by fsd.ScheduledTime "
+ };
+
+ (TimesPerDay) := read last {" select count (fsd.ScheduledTime) from CV3CodedFreqTranslation cft"
+ || " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
+ || " where cft.FrequencyCode = " || sql(frequencyvalue) || " and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.Active = 1"
+ };
+
+
+
+ Oncegroup := ("Now", "STAT", "Once", "One Time", "Today,", "Load", "Pre-procedure",
+ "Post-procedure","Pre-Transfusion", "Post-Transfusion","Between Blood",
+ "PRE OP,", "POST OP", "As Ordered", "As Directed", "Given in Infusion Center",
+ "Given in Delivery Room","With Dialysis Treatment");
+
+
+
+ If frequencyvalue in Oncegroup then
+ frequencygroup := "OneTime";
+ else frequencygroup := "Other";
+ endif;
+
+ If frequencyvalue <> "" and frequencygroup <> "OneTime" then
+
+ If timefrom = 1 and timeuom = "day" then
+ If TimesPerDay = 1 then frequencygroup := "Q24H"; Freqfactor := 24; Weeklydoses := 7; endif;
+ If TimesPerDay = 2 then frequencygroup := "Q12H"; Freqfactor := 12; Weeklydoses := 14; endif;
+ If TimesPerDay = 3 then frequencygroup := "Q8H"; Freqfactor := 8; Weeklydoses := 21; endif;
+ If TimesPerDay = 4 then frequencygroup := "Q6H"; Freqfactor := 6; Weeklydoses := 28; endif;
+ If TimesPerDay = 6 then frequencygroup := "Q4H"; Freqfactor := 4; Weeklydoses := 42; endif;
+ If TimesPerDay = 8 then frequencygroup := "Q3H"; Freqfactor := 3; Weeklydoses := 56; endif;
+ If TimesPerDay = 12 then frequencygroup := "Q2H"; Freqfactor := 2; Weeklydoses := 84; endif;
+ If TimesPerDay = 24 then frequencygroup := "Q1H"; Freqfactor := 1; Weeklydoses := 168; endif;
+
+ elseif timefrom = 2 and timeuom = "day" then
+ If TimesPerDay = 1 then frequencygroup := "Q48H"; Weeklydoses := 4; endif;
+
+ endif;
+ endif;
+
+ If frequencyvalue = "" then
+ If UserSchedType = "Weekly" then
+ If UserSchedDays <= 2 and UserSchedDoses = 1 then
+ frequencygroup := "Q7D";
+ elseif
+ UserSchedDays >2 or UserSchedDoses > 1 then
+ Weeklydoses := ((UserSchedDays as number) - 1) * (UserSchedDoses as number);
+ frequencygroup := "Other";
+ endif;
+
+ elseif UserSchedType = "Daily" and UserSchedDays = 1 and FreqFromTime = 1 and FreqUom = "day" then
+ If UserSchedDoses = 1 then frequencygroup := "Q24H"; Freqfactor := 24; Weeklydoses := 7; endif;
+ If UserSchedDoses = 2 then frequencygroup := "Q12H"; Freqfactor := 12; Weeklydoses := 14; endif;
+ If UserSchedDoses = 3 then frequencygroup := "Q8H"; Freqfactor := 8; Weeklydoses := 21; endif;
+ If UserSchedDoses = 4 then frequencygroup := "Q6H"; Freqfactor := 6; Weeklydoses := 27; endif;
+ If UserSchedDoses = 6 then frequencygroup := "Q4H"; Freqfactor := 4; Weeklydoses := 42; endif;
+ If UserSchedDoses = 8 then frequencygroup := "Q3H"; Freqfactor := 3; Weeklydoses := 56; endif;
+ If UserSchedDoses = 12 then frequencygroup := "Q2H"; Freqfactor := 2; Weeklydoses := 84; endif;
+ If UserSchedDoses = 24 then frequencygroup := "Q1H"; Freqfactor := 1; Weeklydoses := 168; endif;
+
+ elseif UserSchedType = "Daily" and UserSchedDays = 1 and FreqFromTime = 2 and FreqUom = "day" then
+ If UserSchedDoses = 1 then frequencygroup := "Q48H"; Weeklydoses := 4; endif;
+
+ endif;
+ endif; //If frequencyvalue = ""
+
+ DurationFactor := StopAfterValue;
+ If StopAfterOption = 2 then DurationType := "Hours"; OrderDuration := StopAfterValue || DurationType; endif;
+ If StopAfterOption = 3 then DurationType := "Mins"; OrderDuration := StopAfterValue || DurationType; endif;
+ If StopAfterOption = 4 then DurationType := "Times"; OrderDuration := StopAfterValue || DurationType; endif;
+ If StopAfterOption = 1 then DurationType := "Days"; OrderDuration := StopAfterValue || DurationType; endif;
+ If StopAfterOption = 0 then DurationFactor := 1; DurationType := "Days"; endif;
+
+
+// Calculate the Total Daily Dose //
+
+ If (DoseValue as number) > 0 then
+
+ If (UserSchedDoses as number) > 0 and UserSchedType = "Daily" and UserSchedDays = 1 then
+
+ If DurationType = "Days" and StopAfterOption = 0 then
+ TotalDailyDose := ((UserSchedDoses as number) * (DoseValue as number));
+ TotalWeeklyDose := ((TotalDailyDose as number) * 7);
+
+ elseif DurationType = "Days" and StopAfterOption = 1 then
+ // TotalDailyDose := ((UserSchedDoses as number) * (DoseValue as number));
+ If (DurationFactor as number) < 7 then
+ TotalWeeklyDose := ((TotalDailyDose as number) * (DurationFactor as number));
+ else
+ TotalWeeklyDose := ((TotalDailyDose as number) * 7);
+ endif;
+// elseif DurationType = "Times" and (DurationFactor as number) < (UserSchedDoses as number) then
+ TotalDailyDose := ((DurationFactor as number) * (DoseValue as number));
+ TotalWeeklyDose := TotalDailyDose;
+
+ elseif DurationType = "Times" and (DurationFactor as number) > (UserSchedDoses as number) then
+ If (DurationFactor as number) > (WeeklyDoses as number) then
+ TotalWeeklyDose := (DoseValue as number) * (WeeklyDoses as number);
+ else
+ TotalWeeklyDose := (DoseValue as number) * (DurationFactor as number);
+ endif;
+//
+ elseif DurationType = "Hours" and (DurationFactor as number) <= 24 then
+ TotalDailyDose := (Int((DurationFactor as number)/(FreqFactor as number))) * (DoseValue as number);
+
+ elseif DurationType = "Mins" and (DurationFactor as number) <= 999 then
+ TotalDailyDose := (Int((DurationFactor as number) / 60)/(FreqFactor as number)) * (DoseValue as number);
+ endif;
+
+ elseif UserSchedType = "Weekly" and frequencygroup = "Other" then
+ TotalWeeklyDose := ((DoseValue as number) * WeeklyDoses);
+
+ elseif (TimesPerDay as number) > 0 then
+ If DurationType = "Days" and StopAfterOption = 0 then
+ TotalDailyDose := ((TimesPerDay as number) * (DoseValue as number));
+ TotalWeeklyDose := ((TotalDailyDose as number) * 7);
+
+
+ elseif DurationType = "Days" and StopAfterOption = 1 then
+ TotalDailyDose := ((TimesPerDay as number) * (DoseValue as number));
+ If (DurationFactor as number) < 7 then
+ TotalWeeklyDose := ((TotalDailyDose as number) * (DurationFactor as number));
+ else
+ TotalWeeklyDose := ((TotalDailyDose as number) * 7);
+ endif;
+
+ elseif DurationType = "Times" and (DurationFactor as number) < (TimesPerDay as number) then
+ TotalDailyDose := ((DurationFactor as number) * (DoseValue as number));
+ TotalWeeklyDose := TotalDailyDose;
+
+ elseif DurationType = "Times" and (DurationFactor as number) > (TimesPerDay as number) then
+ If (DurationFactor as number) > (WeeklyDoses as number) then
+ TotalWeeklyDose := (DoseValue as number) * (WeeklyDoses as number);
+ else
+ TotalWeeklyDose := (DoseValue as number) * (DurationFactor as number);
+ endif;
+
+
+ elseif DurationType = "Hours" and (DurationFactor as number) <= 24 then
+ TotalDailyDose := (Int((DurationFactor as number)/(FreqFactor as number))) * (DoseValue as number);
+
+ elseif DurationType = "Mins" and (DurationFactor as number) <= 999 then
+ TotalDailyDose := (Int((DurationFactor as number) / 60)/(FreqFactor as number)) * (DoseValue as number);
+ endif;
+
+ else TotalDailyDose := "Unknown";
+
+ endif;
+ endif; //If (DoseValue as number) > 0
+
+
+ (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus };
+ (UserGUID ) := read last { UserInfo: GUID };
+
+// 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));
+
+// Get the patient weight
+ wtgm := read last
+ { " Select Text from CV3PhysicalNoteDeclaration "
+ || " where ClientGUID = " || SQL(ClientGuid)
+ || " and ClientVisitGUID = " || SQL(ClientVisitGuid)
+ || " and TypeCode = {{{SINGLE-QUOTE}}}weight{{{SINGLE-QUOTE}}} "
+ || " order by Entered asc "
+ };
+
+ patientwt := (wtgm as number) / 1000;
+
+ if continue = "yes" then
+
+
+
+// Compare ordering info with rule info and process when match found.
+ If Classvalue = "Methotrexate" then
+
+ If ((TotalWeeklyDose as number) < 25) and UOMValue = "mg" then
+
+ If (Frequencygroup <> "Q7D") then
+ if (Frequencygroup = "Q12H" and OrderDuration = "3Times")and TotalWeeklyDose <= 25 then
+ doalert := false;
+ else
+ Rulemsg := "For autoimmune indications, methotrexate is usually dosed weekly OR the weekly dose may be divided q12hr x 3 doses."
+ ||"\n Please review frequency, dosing, and indication carefully.";
+
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || UomValue|| ", " || SummaryLine
+ || "\n\n {{+R}}" || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+ endif;
+ endif;
+
+
+ elseIf (((DoseValue as number)> 25)or ((TotalWeeklyDose as number) > 25)) and UOMValue = "mg" then
+ If Frequencygroup = "Q7D" then
+ Rulemsg := "Methotrexate doses greater than 25mg PO weekly for autoimmune conditions"
+ || " are not usually recommended due to increased risk of toxicity.";
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || UomValue|| ", " || SummaryLine
+ || " \n\n {{+R}}" || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ else
+ Rulemsg := "Methotrexate doses >25 mg (or Total Weekly Dose > 25mg) PO are associated with increased toxicity and"
+ || " should be reviewed or prescribed by Hematology/Oncology.";
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || UomValue|| ", " || SummaryLine
+ || " \n\n {{+R}}" || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+ endif;
+
+
+ elseIf ((TotalWeeklyDose as number)> 25) and UOMValue = "mg" then
+ If Frequencygroup <> "Q7D" then
+
+ Rulemsg := "Methotrexate doses >25 mg (or Total Weekly Dose > 25mg) PO associated with increased toxicity and"
+ || " should be reviewed or prescribed by Hematology/Oncology.";
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || UomValue|| ", " || SummaryLine
+ || " \n\n {{+R}}" || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+
+ endif;
+ endif;
+
+ elseif Classvalue = "Allopurinol" then
+
+ if frequencygroup = "Q24H" and (DoseValue as number)> 300 then
+ Rulemsg := "Doses greater than 300mg/day should be administered in divided doses.";
+ alert_message := "{{+B}} Ordered: "||OrderName || " " || DoseValue || UomValue|| ", " || SummaryLine
+ || " \n\n {{+R}}" || Rulemsg || "{{-R}} {{-B}}";
+ doalert := true;
+ endif;
+
+
+
+ else
+ doalert := false;
+ endif;
+
+ // endif;
+
+ endif;
+
+ endif;
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: order_enter_event;
+
+ ;;
+ logic:
+
+ if called_by_editor
+ then
+ conclude false;
+ endif;
+
+ //----------------------------------------------------------------
+ // If there is no evoking object then do nothing, this can
+ // only be true for the MLM Editor
+ //----------------------------------------------------------------
+ if EvokingObject is null
+ then
+ conclude false;
+ endif;
+ if continue = "no"
+ then
+ conclude false;
+ endif;
+
+
+ conclude doalert;
+
+ ;;
+ action:
+ write alert_message at dose_alert_dest
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE.mlm b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE.mlm
new file mode 100644
index 0000000..7df367d
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE.mlm
@@ -0,0 +1,150 @@
+maintenance:
+
+ title: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE;;
+ mlmname: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE;;
+ arden: version 2.50;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Peggy Leschak, Allscripts Corp, x7441;;
+ date: 2014-10-21;;
+ validation: testing;;
+
+library:
+ purpose: Update columns on the outpatient Bethel Park status board based on their registered location in order to improve patient flow.
+
+ ;;
+
+ explanation: If a patient is registered at Bethel Park Outpatient Service to multiple locations (i.e. performing multiple services),
+ then update up to 4 columns on the status board with the service and time of service.
+
+ Modified MLM to include Peter{{{SINGLE-QUOTE}}}s Twp status board.
+
+
+ Change history
+
+ 10.21.2014 JML CSR #32720 Created
+ 01.28.2015 JML Moved to Production.
+ 11.16.2015 JML CSR 33832: Added Peter{{{SINGLE-QUOTE}}}s Twp to status board.
+ 01.05.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
+ that was previously read from comment created by AMPFM.
+ 10.04.2018 JML WO# 3377118: Removed call to ClientVisitModify event
+ ;;
+ keywords: ObjectsPlus/XA, Outpatient, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ updateStatusBoard := false;
+
+ log_execution_info := false;
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ client_visit_enter := event { ClientVisitEnter Any ClientVisit :
+ WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+
+ //client_visit_modify := event { ClientVisitModify Any ClientVisit :
+ // WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //--------------------------------------------------------------------
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "MLM Information Message",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "MLM Infor Group",
+ Rule_number := 1002,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit : THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.GUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ curr_loc := read last { ClientVisit : CurrentLocation REFERENCING EvokingObject };
+
+ //CSR 26413 CHANGE: Modified SQL to use CV3ClientUsData
+ //Retrieve Patient Comment values
+ ( Pt_Service_Val) := read last {"SELECT cud.UserDataCode + {{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}} + cud.Value"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientUserData cud WITH (NOLOCK)"
+ || " ON cv.ClientGUID = cud.ClientGUID"
+ || " AND cv.GUID = cud.ObjGUID"
+ || " WHERE cud.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND cv.GUID = " || Sql(ActiveClient_Visit_GUID)
+ || " AND cv.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " AND cud.UserDataCode = {{{SINGLE-QUOTE}}}SER-OP SERVICE 1{{{SINGLE-QUOTE}}}"
+ || " AND cud.Active = 1" };
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 20 seconds after time of client_visit_enter;
+ //20 seconds after time of client_visit_modify;
+ ;;
+ logic:
+
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ //Set Column Name and Value
+ patient_service_comment := call str_parse with Pt_Service_Val, "|";
+
+ ptSvc := patient_service_comment[1];
+ ptSvc_value := patient_service_comment[2];
+
+ if ( ptSvc_value IS NULL OR ptSvc_value = "" ) then
+ ptSvc_value := "";
+ endif;
+
+ SvcLoc_1 := NEW EDCObj WITH [
+ column_name := "Service 1",
+ column_value := ptSvc_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ //Call function to update enterprise defined column
+ return_value := call create_ED_column WITH ( SvcLoc_1 );
+
+ conclude true;
+ ;;
+ action:
+
+ write " New testing - added Peters Status Board."
+ at error_destination;
+
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_2.mlm b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_2.mlm
new file mode 100644
index 0000000..af170d1
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_2.mlm
@@ -0,0 +1,132 @@
+maintenance:
+
+ title: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_2;;
+ mlmname: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_2;;
+ arden: version 2.50;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Peggy Leschak, Allscripts Corp, x7441;;
+ date: 2014-10-21;;
+ validation: testing;;
+
+library:
+ purpose: Update columns on the outpatient Bethel Park status board based on their registered location in order to improve patient flow.
+
+ ;;
+
+ explanation: If a patient is registered at Bethel Park Outpatient Service to multiple locations (i.e. performing multiple services),
+ then update up to 4 columns on the status board with the service and time of service.
+
+ Modified to include Peters Twp Status Board.
+
+
+ Change history
+
+ 10.21.2014 JML CSR #32720 Created
+ 01.28.2015 JML Moved to Production.
+ 11.16.2015 JML CSR 33832: Added Peters Twp Status Board.
+ 01.05.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
+ that was previously read from comment created by AMPFM.
+ 10.04.2018 JML WO# 3377118: Removed call to ClientVisitModify event
+ ;;
+ keywords: ObjectsPlus/XA, Outpatient, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ updateStatusBoard := false;
+
+ log_execution_info := false;
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ client_visit_enter_2 := event {ClientVisitEnter Any ClientVisit :
+ WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //client_visit_modify_2 := event {ClientVisitModify Any ClientVisit :
+ // WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit : THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.GUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ //CSR 26413 CHANGE: Modified SQL to use CV3ClientUsData
+ //Retrieve Patient Comment values
+ ( Pt_Service_Val) := read last {"SELECT cud.UserDataCode + {{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}} + cud.Value"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientUserData cud WITH (NOLOCK)"
+ || " ON cv.ClientGUID = cud.ClientGUID"
+ || " AND cv.GUID = cud.ObjGUID"
+ || " WHERE cud.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND cv.GUID = " || Sql(ActiveClient_Visit_GUID)
+ || " AND cv.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " AND cud.UserDataCode = {{{SINGLE-QUOTE}}}SER-OP SERV TIME 1{{{SINGLE-QUOTE}}}"
+ || " AND cud.Active = 1"};
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 4 seconds after time of client_visit_enter_2;
+ //4 seconds after time of client_visit_modify_2;
+
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ //Set Column Name and Value
+ patient_service_comment := call str_parse with Pt_Service_Val, "|";
+
+ ptSvc := patient_service_comment[1];
+ ptSvc_value := patient_service_comment[2];
+
+ if ( ptSvc_value IS NULL OR ptSvc_value = "" ) then
+ ptSvc_value := "";
+ endif;
+
+ SvcTime_1 := NEW EDCObj WITH [
+ column_name := "Time 1",
+ column_value := ptSvc_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ //Call function to update enterprise defined column
+ return_value := call create_ED_column WITH ( SvcTime_1 );
+
+ conclude true;
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_3.mlm b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_3.mlm
new file mode 100644
index 0000000..478cedb
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_3.mlm
@@ -0,0 +1,149 @@
+maintenance:
+
+ title: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_3;;
+ mlmname: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_3;;
+ arden: version 2.50;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Peggy Leschak, Allscripts Corp, x7441;;
+ date: 2014-10-21;;
+ validation: testing;;
+
+library:
+ purpose: Update columns on the outpatient Bethel Park status board based on their registered location in order to improve patient flow.
+
+ ;;
+
+ explanation: If a patient is registered at Bethel Park Outpatient Service to multiple locations (i.e. performing multiple services),
+ then update up to 4 columns on the status board with the service and time of service.
+
+ Modified to include Peters Twp status board.
+
+
+ Change history
+
+ 10.21.2014 JML CSR #32720 Created
+ 01.28.2015 JML Moved to Production.
+ 11.16.2015 JML CSR 33832: Added Peters Twp Status Board.
+ 01.05.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
+ that was previously read from comment created by AMPFM.
+ 10.04.2018 JML WO# 3377118: Removed call to ClientVisitModify event
+
+ ;;
+ keywords: ObjectsPlus/XA, Outpatient, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ updateStatusBoard := false;
+
+ log_execution_info := false;
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ client_visit_enter_3 := event {ClientVisitEnter Any ClientVisit :
+ WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //client_visit_modify_3 := event {ClientVisitModify Any ClientVisit :
+ // WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //--------------------------------------------------------------------
+
+ error_destination := destination { Alert } with [
+ alert_type := "Warning",
+ short_message := "MLM Information Message",
+ priority := "low",
+ scope := "chart",
+ Rule_group := "MLM Infor Group",
+ Rule_number := 1002,
+ Rule_subgroup := "",
+ Send_with_order := "",
+ Alert_dialog_settings := "",
+ Display_alert := true ];
+
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit : THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.GUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ //CSR 26413 CHANGE: Modified SQL to use CV3ClientUsData
+ //Retrieve Patient Comment values
+ ( Pt_Service_Val) := read last {"SELECT cud.UserDataCode + {{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}} + cud.Value"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientUserData cud WITH (NOLOCK)"
+ || " ON cv.ClientGUID = cud.ClientGUID"
+ || " AND cv.GUID = cud.ObjGUID"
+ || " WHERE cud.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND cv.GUID = " || Sql(ActiveClient_Visit_GUID)
+ || " AND cv.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " AND cud.UserDataCode = {{{SINGLE-QUOTE}}}SER-OP SERVICE 2{{{SINGLE-QUOTE}}}"
+ || " AND cud.Active = 1"};
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 6 seconds after time of client_visit_enter_3;
+ //6 seconds after time of client_visit_modify_3;
+
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ //Set Column Name and Value
+ patient_service_comment := call str_parse with Pt_Service_Val, "|";
+
+ ptSvc := patient_service_comment[1];
+ ptSvc_value := patient_service_comment[2];
+
+ if ( ptSvc_value IS NULL OR ptSvc_value = "" ) then
+ ptSvc_value := "";
+ endif;
+
+ SvcLoc_2 := NEW EDCObj WITH [
+ column_name := "Service 2",
+ column_value := ptSvc_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ //Call function to update enterprise defined column
+ return_value := call create_ED_column WITH ( SvcLoc_2 );
+
+ conclude true;
+ ;;
+ action:
+
+ write "Firing service 2 column update."
+ at error_destination;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_4.mlm b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_4.mlm
new file mode 100644
index 0000000..e90ee7b
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_4.mlm
@@ -0,0 +1,133 @@
+maintenance:
+
+ title: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_4;;
+ mlmname: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_4;;
+ arden: version 2.50;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Peggy Leschak, Allscripts Corp, x7441;;
+ date: 2014-10-21;;
+ validation: testing;;
+
+library:
+ purpose: Update columns on the outpatient Bethel Park status board based on their registered location in order to improve patient flow.
+
+ ;;
+
+ explanation: If a patient is registered at Bethel Park Outpatient Service to multiple locations (i.e. performing multiple services),
+ then update up to 4 columns on the status board with the service and time of service.
+
+ Modified to include Peters Twp status board.
+
+
+ Change history
+
+ 10.21.2014 JML CSR #32720 Created
+ 01.28.2015 JML Moved to Production.
+ 11.16.2015 JML CSR 33832: Added Peters Twp status board.
+ 01.05.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
+ that was previously read from comment created by AMPFM.
+ 10.04.2018 JML WO# 3377118: Removed call to ClientVisitModify event
+
+ ;;
+ keywords: ObjectsPlus/XA, Outpatient, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ updateStatusBoard := false;
+
+ log_execution_info := false;
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ client_visit_enter_4 := event {ClientVisitEnter Any ClientVisit :
+ WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //client_visit_modify_4 := event {ClientVisitModify Any ClientVisit :
+ // WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit : THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.GUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ //CSR 26413 CHANGE: Modified SQL to use CV3ClientUsData
+ //Retrieve Patient Comment values
+ ( Pt_Service_Val) := read last {"SELECT cud.UserDataCode + {{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}} + cud.Value"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientUserData cud WITH (NOLOCK)"
+ || " ON cv.ClientGUID = cud.ClientGUID"
+ || " AND cv.GUID = cud.ObjGUID"
+ || " WHERE cud.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND cv.GUID = " || Sql(ActiveClient_Visit_GUID)
+ || " AND cv.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " AND cud.UserDataCode = {{{SINGLE-QUOTE}}}SER-OP SERV TIME 2{{{SINGLE-QUOTE}}}"
+ || " AND cud.Active = 1"};
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 8 seconds after time of client_visit_enter_4;
+ //8 seconds after time of client_visit_modify_4;
+
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ //Set Column Name and Value
+ patient_service_comment := call str_parse with Pt_Service_Val, "|";
+
+ ptSvc := patient_service_comment[1];
+ ptSvc_value := patient_service_comment[2];
+
+ if ( ptSvc_value IS NULL OR ptSvc_value = "" ) then
+ ptSvc_value := "";
+ endif;
+
+ SvcTime_2 := NEW EDCObj WITH [
+ column_name := "Time 2",
+ column_value := ptSvc_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ //Call function to update enterprise defined column
+ return_value := call create_ED_column WITH ( SvcTime_2 );
+
+ conclude true;
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_5.mlm b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_5.mlm
new file mode 100644
index 0000000..8571bf4
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_5.mlm
@@ -0,0 +1,134 @@
+maintenance:
+
+ title: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_5;;
+ mlmname: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_5;;
+ arden: version 2.50;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Peggy Leschak, Allscripts Corp, x7441;;
+ date: 2014-10-21;;
+ validation: testing;;
+
+library:
+ purpose: Update columns on the outpatient Bethel Park status board based on their registered location in order to improve patient flow.
+
+ ;;
+
+ explanation: If a patient is registered at Bethel Park Outpatient Service to multiple locations (i.e. performing multiple services),
+ then update up to 4 columns on the status board with the service and time of service.
+
+ Modified to include Peters Twp status board.
+
+
+ Change history
+
+ 10.21.2014 JML CSR #32720 Created
+ 01.28.2015 JML Moved to Production.
+ 11.16.2015 JML CSR 33832: Added Peters Twp status board.
+ 01.05.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
+ that was previously read from comment created by AMPFM.
+ 10.04.2018 JML WO# 3377118: Removed call to ClientVisitModify event
+
+ ;;
+ keywords: ObjectsPlus/XA, Outpatient, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ updateStatusBoard := false;
+
+ log_execution_info := false;
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ client_visit_enter_5 := event {ClientVisitEnter Any ClientVisit :
+ WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //client_visit_modify_5 := event {ClientVisitModify Any ClientVisit :
+ // WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit : THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.GUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ //CSR 26413 CHANGE: Modified SQL to use CV3ClientUsData
+ //Retrieve Patient Comment values
+ ( Pt_Service_Val) := read last {"SELECT cud.UserDataCode + {{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}} + cud.Value"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientUserData cud WITH (NOLOCK)"
+ || " ON cv.ClientGUID = cud.ClientGUID"
+ || " AND cv.GUID = cud.ObjGUID"
+ || " WHERE cud.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND cv.GUID = " || Sql(ActiveClient_Visit_GUID)
+ || " AND cv.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " AND cud.UserDataCode = {{{SINGLE-QUOTE}}}SER-OP SERVICE 3{{{SINGLE-QUOTE}}}"
+ || " AND cud.Active = 1"};
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 10 seconds after time of client_visit_enter_5;
+ //10 seconds after time of client_visit_modify_5;
+
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ //Set Column Name and Value
+ patient_service_comment := call str_parse with Pt_Service_Val, "|";
+
+ ptSvc := patient_service_comment[1];
+ ptSvc_value := patient_service_comment[2];
+
+
+ if ( ptSvc_value IS NULL OR ptSvc_value = "" ) then
+ ptSvc_value := "";
+ endif;
+
+ SvcLoc_3 := NEW EDCObj WITH [
+ column_name := "Service 3",
+ column_value := ptSvc_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ //Call function to update enterprise defined column
+ return_value := call create_ED_column WITH ( SvcLoc_3 );
+
+ conclude true;
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_6.mlm b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_6.mlm
new file mode 100644
index 0000000..e7b2b26
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_6.mlm
@@ -0,0 +1,133 @@
+maintenance:
+
+ title: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_6;;
+ mlmname: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_6;;
+ arden: version 2.50;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Peggy Leschak, Allscripts Corp, x7441;;
+ date: 2014-10-21;;
+ validation: testing;;
+
+library:
+ purpose: Update columns on the outpatient Bethel Park status board based on their registered location in order to improve patient flow.
+
+ ;;
+
+ explanation: If a patient is registered at Bethel Park Outpatient Service to multiple locations (i.e. performing multiple services),
+ then update up to 4 columns on the status board with the service and time of service.
+
+ Modified to include Peters Twp status board.
+
+
+ Change history
+
+ 10.21.2014 JML CSR #32720 Created
+ 01.28.2015 JML Moved to Production.
+ 11.16.2015 JML CSR 33832: Added Peters Twp status board.
+ 01.05.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
+ that was previously read from comment created by AMPFM.
+ 10.04.2018 JML WO# 3377118: Removed call to ClientVisitModify event
+
+ ;;
+ keywords: ObjectsPlus/XA, Outpatient, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ updateStatusBoard := false;
+
+ log_execution_info := false;
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ client_visit_enter_6 := event {ClientVisitEnter Any ClientVisit :
+ WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //client_visit_modify_6 := event {ClientVisitModify Any ClientVisit :
+ // WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit : THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.GUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ //CSR 26413 CHANGE: Modified SQL to use CV3ClientUsData
+ //Retrieve Patient Comment values
+ ( Pt_Service_Val) := read last {"SELECT cud.UserDataCode + {{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}} + cud.Value"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientUserData cud WITH (NOLOCK)"
+ || " ON cv.ClientGUID = cud.ClientGUID"
+ || " AND cv.GUID = cud.ObjGUID"
+ || " WHERE cud.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND cv.GUID = " || Sql(ActiveClient_Visit_GUID)
+ || " AND cv.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " AND cud.UserDataCode = {{{SINGLE-QUOTE}}}SER-OP SERV TIME 3{{{SINGLE-QUOTE}}}"
+ || " AND cud.Active = 1"};
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 12 seconds after time of client_visit_enter_6;
+ //12 seconds after time of client_visit_modify_6;
+
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ //Set Column Name and Value
+ patient_service_comment := call str_parse with Pt_Service_Val, "|";
+
+ ptSvc := patient_service_comment[1];
+ ptSvc_value := patient_service_comment[2];
+
+ if ( ptSvc_value IS NULL OR ptSvc_value = "" ) then
+ ptSvc_value := "";
+ endif;
+
+ SvcTime_3 := NEW EDCObj WITH [
+ column_name := "Time 3",
+ column_value := ptSvc_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ //Call function to update enterprise defined column
+ return_value := call create_ED_column WITH ( SvcTime_3 );
+
+ conclude true;
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_7.mlm b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_7.mlm
new file mode 100644
index 0000000..863cba1
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_7.mlm
@@ -0,0 +1,133 @@
+maintenance:
+
+ title: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_7;;
+ mlmname: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_7;;
+ arden: version 2.50;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Peggy Leschak, Allscripts Corp, x7441;;
+ date: 2014-10-21;;
+ validation: testing;;
+
+library:
+ purpose: Update columns on the outpatient Bethel Park status board based on their registered location in order to improve patient flow.
+
+ ;;
+
+ explanation: If a patient is registered at Bethel Park Outpatient Service to multiple locations (i.e. performing multiple services),
+ then update up to 4 columns on the status board with the service and time of service.
+
+ Modified to include Peters Twp status board.
+
+
+ Change history
+
+ 10.21.2014 JML CSR #32720 Created
+ 01.28.2015 JML Moved to Production.
+ 11.16.2015 JML CSR 33832: Added Peters Twp status board.
+ 01.05.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
+ that was previously read from comment created by AMPFM.
+ 10.04.2018 JML WO# 3377118: Removed call to ClientVisitModify event
+
+ ;;
+ keywords: ObjectsPlus/XA, Outpatient, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ updateStatusBoard := false;
+
+ log_execution_info := false;
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ client_visit_enter_7 := event {ClientVisitEnter Any ClientVisit :
+ WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //client_visit_modify_7 := event {ClientVisitModify Any ClientVisit :
+ // WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit : THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.GUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ //CSR 26413 CHANGE: Modified SQL to use CV3ClientUsData
+ //Retrieve Patient Comment values
+ ( Pt_Service_Val) := read last {"SELECT cud.UserDataCode + {{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}} + cud.Value"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientUserData cud WITH (NOLOCK)"
+ || " ON cv.ClientGUID = cud.ClientGUID"
+ || " AND cv.GUID = cud.ObjGUID"
+ || " WHERE cud.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND cv.GUID = " || Sql(ActiveClient_Visit_GUID)
+ || " AND cv.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " AND cud.UserDataCode = {{{SINGLE-QUOTE}}}SER-OP SERVICE 4{{{SINGLE-QUOTE}}}"
+ || " AND cud.Active = 1"};
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 14 seconds after time of client_visit_enter_7;
+ //14 seconds after time of client_visit_modify_7;
+
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ //Set Column Name and Value
+ patient_service_comment := call str_parse with Pt_Service_Val, "|";
+
+ ptSvc := patient_service_comment[1];
+ ptSvc_value := patient_service_comment[2];
+
+ if ( ptSvc_value IS NULL OR ptSvc_value = "" ) then
+ ptSvc_value := "";
+ endif;
+
+ SvcLoc_4 := NEW EDCObj WITH [
+ column_name := "Service 4",
+ column_value := ptSvc_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ //Call function to update enterprise defined column
+ return_value := call create_ED_column WITH ( SvcLoc_4 );
+
+ conclude true;
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_8.mlm b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_8.mlm
new file mode 100644
index 0000000..4f1b41e
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_8.mlm
@@ -0,0 +1,133 @@
+maintenance:
+
+ title: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_8;;
+ mlmname: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_8;;
+ arden: version 2.50;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Peggy Leschak, Allscripts Corp, x7441;;
+ date: 2014-10-21;;
+ validation: testing;;
+
+library:
+ purpose: Update columns on the outpatient Bethel Park status board based on their registered location in order to improve patient flow.
+
+ ;;
+
+ explanation: If a patient is registered at Bethel Park Outpatient Service to multiple locations (i.e. performing multiple services),
+ then update up to 4 columns on the status board with the service and time of service.
+
+ Modified to include Peters Twp status board.
+
+
+ Change history
+
+ 10.21.2014 JML CSR #32720 Created
+ 01.28.2015 JML Moved to Production.
+ 11.16.2015 JML CSR 33832: Added Peters Twp status board.
+ 01.05.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
+ that was previously read from comment created by AMPFM.
+ 10.04.2018 JML WO# 3377118: Removed call to ClientVisitModify event
+
+ ;;
+ keywords: ObjectsPlus/XA, Outpatient, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ updateStatusBoard := false;
+
+ log_execution_info := false;
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+
+ //Event Triggers
+ client_visit_enter_8 := event {ClientVisitEnter Any ClientVisit :
+ WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //client_visit_modify_8 := event {ClientVisitModify Any ClientVisit :
+ // WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit : THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.GUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ //CSR 26413 CHANGE: Modified SQL to use CV3ClientUsData
+ //Retrieve Patient Comment values
+ ( Pt_Service_Val) := read last {"SELECT cud.UserDataCode + {{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}} + cud.Value"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientUserData cud WITH (NOLOCK)"
+ || " ON cv.ClientGUID = cud.ClientGUID"
+ || " AND cv.GUID = cud.ObjGUID"
+ || " WHERE cud.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND cv.GUID = " || Sql(ActiveClient_Visit_GUID)
+ || " AND cv.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " AND cud.UserDataCode = {{{SINGLE-QUOTE}}}SER-OP SERV TIME 4{{{SINGLE-QUOTE}}}"
+ || " AND cud.Active = 1"};
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 16 seconds after time of client_visit_enter_8;
+ //16 seconds after time of client_visit_modify_8;
+
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ //Set Column Name and Value
+ patient_service_comment := call str_parse with Pt_Service_Val, "|";
+
+ ptSvc := patient_service_comment[1];
+
+ ptSvc_value := patient_service_comment[2];
+ if ( ptSvc_value IS NULL OR ptSvc_value = "" ) then
+ ptSvc_value := "";
+ endif;
+
+ SvcTime_4 := NEW EDCObj WITH [
+ column_name := "Time 4",
+ column_value := ptSvc_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ //Call function to update enterprise defined column
+ return_value := call create_ED_column WITH ( SvcTime_4 );
+
+ conclude true;
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_9.mlm b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_9.mlm
new file mode 100644
index 0000000..da23eac
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_9.mlm
@@ -0,0 +1,135 @@
+maintenance:
+
+ title: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_9;;
+ mlmname: SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_9;;
+ arden: version 2.50;;
+ version: 6.10;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Peggy Leschak, Allscripts Corp, x7441;;
+ date: 2014-10-21;;
+ validation: testing;;
+
+library:
+ purpose: Update columns on the outpatient Bethel Park status board based on their registered location in order to improve patient flow.
+
+ ;;
+
+ explanation: If a patient is registered at Bethel Park Outpatient Service to multiple locations (i.e. performing multiple services),
+ then update up to 4 columns on the status board with the service and time of service.
+
+ Modified to include Peters Twp status board.
+
+
+ Change history
+
+ 10.21.2014 JML CSR #32720 Created
+ 01.28.2015 JML Moved to Production.
+ 04.20.2015 JML CSR #33290: Update Arrival Time column on BP Status Board
+ 11.16.2015 JML CSR 33832: Added Peters Twp status board.
+ 10.04.2018 JML WO# 3377118: Removed call to ClientVisitModify event
+
+ ;;
+ keywords: ObjectsPlus/XA, Outpatient, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ updateStatusBoard := false;
+
+ log_execution_info := false;
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+
+ //Event Triggers
+ client_visit_enter_9 := event {ClientVisitEnter Any ClientVisit :
+ WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ client_visit_modify_9 := event {ClientVisitModify Any ClientVisit :
+ WHERE TypeCode = "Clinic" AND ( CurrentLocation = "Bethel Park" OR CurrentLocation = "Peters Twp" ) };
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last {ClientVisit : THIS
+ where Name="POC Testing: Blood Glucose Monitor" };
+ endif;
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.GUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ //Grab patient{{{SINGLE-QUOTE}}}s visit information
+ transfer_date := read last {"SELECT TOP 1 cvl.TransferRequestDtm"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientVisitLocation cvl WITH (NOLOCK)"
+ || " ON cv.GUID = cvl.ClientVisitGUID"
+ || " AND cv.ClientGUID = cvl.ClientGUID"
+ || " WHERE cv.ClientGUID = " || Sql(ActiveClient_GUID)
+ || " AND cv.GUID = " || Sql(ActiveClient_Visit_GUID)
+ || " AND cv.ChartGUID = " || Sql(ActiveChart_GUID)
+ || " ORDER BY cvl.TOUCHEDWHEN DESC"};
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ 18 seconds after time of client_visit_enter_9;
+ 18 seconds after time of client_visit_modify_9;
+
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ ptArr_hour := extract hour transfer_date;
+ if ( length ( ptArr_hour as string ) = 1 ) then
+ ptArr_hour := "0" || ptArr_hour;
+ endif;
+
+ ptArr_min := extract minute transfer_date;
+ if ( length ( ptArr_min as string ) = 1 ) then
+ ptArr_min := "0" || ptArr_min;
+ endif;
+
+ ptArr_value := ptArr_hour || ":" || ptArr_min;
+ if ( ptArr_value IS NULL OR ptArr_value = "" ) then
+ ptArr_value := "";
+ endif;
+
+ SvcTime_9 := NEW EDCObj WITH [
+ column_name := "Arrival Time",
+ column_value := ptArr_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ //Call function to update enterprise defined column
+ return_value := call create_ED_column WITH ( SvcTime_9 );
+
+ conclude true;
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_PARKINSONS_CREATE_CONSULT_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_PARKINSONS_CREATE_CONSULT_ORDER.mlm
new file mode 100644
index 0000000..71bdbdf
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_PARKINSONS_CREATE_CONSULT_ORDER.mlm
@@ -0,0 +1,334 @@
+maintenance:
+
+ title: SCH_PARKINSONS_CREATE_CONSULT_ORDER ;;
+ mlmname: SCH_PARKINSONS_CREATE_CONSULT_ORDER ;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: St Clair;;
+ author: Maria Pest;;
+ specialist: Don Warnick;;
+ date: 2016-08-24;;
+ validation: testing;;
+
+library:
+ purpose: Notify pharmacy when a Parkinson{{{SINGLE-QUOTE}}}s patient is in house.
+ ;;
+
+ explanation: This is one of several MLMs that creates a Parkinson{{{SINGLE-QUOTE}}}s consult order in the pharmacy. It creates the order when a Parkinson{{{SINGLE-QUOTE}}}s Health Issue is created.
+
+ Change History
+
+ 08.24.2016 DW CSR# 34277 - Created MLM.
+ 05/26/2017 DW CSR# 34277 - Adjusted the MLM several days after activation to evoke on Order Worksheet Submit rather than Order Enter
+ 12/08/2017 TMS CSR# 36024 - Updated to remove alert firing on amantadine and pramipexole they are most commonly ordered for reasons other
+ than parkinson{{{SINGLE-QUOTE}}}s. Request also for and rivastigmine but it currently does not fire since the therapeutic
+ category is not {{{SINGLE-QUOTE}}}dopaminergic antiparkinsonism agents{{{SINGLE-QUOTE}}}.
+ 12/8/2017 TMS HD# 2907243 - Updated to remove health issues listing Poisoning by anti-Parkinsonism drugs per the pharmacy.
+
+ ;;
+
+ keywords: Health Issue, Pharmacy Consult Order, Parkinson
+ ;;
+
+knowledge:
+ type: data-driven;;
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ Health_Issue_Enter := event {HealthIssueEnter Any HealthIssue: Where (ShortName matches pattern "%Parkinson%") and not(ShortName matches pattern "%Wolf%")
+ and not(CHICODE matches pattern "T42.%")};
+ Medication_Enter := event {OrderWorksheetSubmit User } ;
+ Client_Visit_Enter := event {ClientVisitEnter ANY ClientVisit: where TypeCode = "Inpatient" or typecode = "Observation"};
+ Client_Visit_Modify:= event {ClientVisitModify ANY ClientVisit: where typecode = "Inpatient" or typecode = "Observation"};
+
+ If EvokingEventType = Health_Issue_Enter.type then (visitGuid, ChartGuid, ClientGuid) := read last {HealthIssue: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject }; endif;
+ If EvokingEventType = Client_Visit_Enter.type then (visitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID REFERENCING EvokingObject}; endif;
+ If EvokingEventType = Client_Visit_Modify.type then (VisitGUID, ChartGUID, ClientGUID, TypeCode):= read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode REFERENCING EvokingObject}; endif;
+
+ VisitType := read last {ClientVisit: TypeCode};
+
+
+ // Proceed only for Inptatients and Observation patients
+
+
+ If (VisitType = "inpatient" or VisitType = "observation")
+
+ then
+
+ if EvokingEventType = "OrderWorksheetSubmit"
+
+
+ // Medication Order Evoke
+
+
+ then
+
+ // Gather all Parkinson Medication GUIDs
+
+ ParkinsonDrugIDs := read {" select distinct ocmi.guid
+ from SXAMTCategoryDrugXREFVW cdx
+ join SXAMTDrugCategoriesVW cat on cat.multum_category_id = cdx.multum_category_id
+ inner join CV3DrugMapping dm on cdx.drug_id = dm.drugkey
+ inner join cv3ordercatalogmasteritem ocmi on dm.catalogitemguid = ocmi.guid
+ where cat.category_name = {{{SINGLE-QUOTE}}}dopaminergic antiparkinsonism agents{{{SINGLE-QUOTE}}}
+ and dm.drugkey not in ({{{SINGLE-QUOTE}}}d04145{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}d00086{{{SINGLE-QUOTE}}})
+ "};
+
+ // Gather all Parkinson Medication GUIDs
+
+ ParkinsonOrderName := read last { UNSUBMITTED Order: Name where TypeCode = "Medication" and OrderCatalogMasterItemGUID is in ParkinsonDrugIDs };
+
+ If exists ParkinsonOrderName
+
+ then
+ (clientGUID, chartGUID, visitGuid) := read last { ClientVisit: ClientGUID, ChartGUID, GUID };
+ proceed := "yes";
+ OrderReason:= "Reason - order entered for " || ParkinsonOrderName;
+
+ else
+
+ proceed := "no";
+
+ endif; //anti-parkinson drug class ?
+
+
+ elseif (EvokingEventType = "ClientVisitEnter") or (EvokingEventType = "ClientVisitModify")
+
+ then
+
+
+
+ // Admission Evoke
+
+
+ Parkinson_Home_Meds_OnFile := read {" select distinct cp.DrugName
+ from SXAAMBClientPrescription cp with (nolock)
+ inner join SXAMTDrugNameMapVW dnm with (nolock) on dnm.drug_synonym_id = cp.FormularyBrandKey
+ join SXAMTCategoryDrugXREFVW cdx on cdx.drug_id = dnm.drug_id
+ join SXAMTDrugCategoriesVW cat on cat.multum_category_id = cdx.multum_category_id
+ where cp.ClientGuid = " || ClientGUID || " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ and cat.category_name = {{{SINGLE-QUOTE}}}dopaminergic antiparkinsonism agents{{{SINGLE-QUOTE}}}
+ and dnm.drug_id not in ({{{SINGLE-QUOTE}}}d04145{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}d00086{{{SINGLE-QUOTE}}}) "};
+
+ Parkinson_Problem_OnFile := read {" select hi.shortname
+ from CV3HealthIssueDeclaration hi with (nolock)
+ join CV3CodedHealthIssue h with (nolock) on h.GUID = hi.CodedHealthIssueGUID
+ where (hi.Active = 1 and status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and hi.shortname like {{{SINGLE-QUOTE}}}%parkinson%{{{SINGLE-QUOTE}}} and hi.shortname not like {{{SINGLE-QUOTE}}}%wolf%{{{SINGLE-QUOTE}}}
+ and h.code not like ({{{SINGLE-QUOTE}}}T42.%{{{SINGLE-QUOTE}}}))
+ and ClientGuid = " || ClientGUID || " "};
+
+
+ if (exists Parkinson_Home_Meds_OnFile or exists Parkinson_Problem_OnFile)
+
+ then
+
+ proceed := "yes"; // patient has anti-parkinson home med or parkinson problem on file
+ OrderReason := "Reason - admission with ";
+ HomeMedAlsoFound:= " ";
+
+ // Remove leading comma if only one item is found in the list
+ if count Parkinson_Problem_OnFile = 1 then Parkinson_Problem_OnFile:= Parkinson_Problem_OnFile[1]; endif;
+ if count Parkinson_Home_Meds_OnFile = 1 then Parkinson_Home_Meds_OnFile:= Parkinson_Home_Meds_OnFile[1]; endif;
+
+ if exists Parkinson_Home_Meds_OnFile
+ then
+ OrderReason := OrderReason || "home medication " || Parkinson_Home_Meds_OnFile || " on file";
+ HomeMedAlsoFound := " and ";
+ endif;
+
+ if exists Parkinson_Problem_OnFile
+ then
+ OrderReason := OrderReason || HomeMedAlsoFound || "health issue for " || Parkinson_Problem_OnFile || " on file";
+ endif;
+
+ else
+ proceed := "no"; // patient has no anti-parkinson home med or parkinson problem on file
+ endif; // level 1 class ?
+
+
+ elseif EvokingEventType = "HealthIssueEnter"
+
+
+ then
+
+
+ // Health Issue Evoke
+
+
+ proceed := "yes"; // only appropriate HI are evoked, so we automatically proceed for all HI entry
+ OrderReason:= "Reason - health issue for " ||EVOKINGOBJECT.ShortName || " entered";
+
+ else
+
+ proceed := "no"; // not a qualifying evoke type
+
+ endif; // qualifying evoke event?
+
+
+ else
+
+ proceed := "no"; // not a qualifying visit type
+
+
+ endif; // visit type ?
+
+
+
+ // Proceed if appropriate
+
+
+ if proceed = "yes"
+
+ then
+
+
+
+
+
+
+ Parkinson_Alert_OnFile := read last {"select o.name
+ from cv3ordercatalogmasteritem as ocmi with (nolock)
+ join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid
+ and o.ClientGUID = " || ClientGUID || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID = " || visitguid || "
+ and o.name = {{{SINGLE-QUOTE}}}Potential Parkinson Patient{{{SINGLE-QUOTE}}}
+ "};
+ // and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}) "};
+
+
+ if not exists Parkinson_Alert_OnFile
+
+ then
+
+ // Create the objects
+
+
+ careProvider_obj := read last{ UserInfo: careProvider };
+ careProvider_Actaul := read last{ UserInfo: This };
+
+ Care_Provider := careprovider_obj.GUID ;
+
+ (Typecode, Username ) := Read first {" Select Typecode, DisplayName from CV3CareProvider Where GUID = " || Care_Provider || " "} ;
+ location_guid := Read First {" Select CurrentLocationGUID from CV3ClientVisit Where GUID = " || visitGuid || " "} ;
+
+ log_execution_info := false;
+ order_Creation_Reason := "Created by MLM";
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ WSSessionType := "Standard";
+ WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( Care_Provider as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
+ WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Common Data:{{-R}}\n" ||ex.Message || "\n\n";
+
+ if client_visit_obj is NOT NULL then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if WSRequestedBy_obj is NOT NULL then void:= call WSRequestedBy_obj.Dispose; WSRequestedBy_obj:= null; endif;
+ if WSlocation_obj is NOT NULL then void:= call WSlocation_obj.Dispose; WSlocation_obj:= null; endif;
+ endcatch;
+
+
+
+ // Create the order
+
+
+ if client_visit_obj is not null
+
+ then
+
+
+ try
+
+
+ // Create a new MEDICATION order from a Pre-Filled item
+
+
+ user_IDType := "Edstan Number (physician)";
+ order_Creation_Reason := "Potential Parkinson Patient";
+
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ user_IDCode := read last {"SELECT IDCode FROM CV3User " || " where GUID = " || Care_Provider};
+ RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ SessionType := "Standard";
+ SessionReason := "";
+ RequestingSource := "Standing Order";
+ Catalog_Item_Name := "Potential Parkinson Patient";
+ Catalog_Item_Modifier := "-";
+ Catalog_Item_Version := "";
+ Medication_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
+ PreFilled_MedicationOrder_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
+ with
+ client_visit_obj, // ClientVisit ObjectsPlus object
+ Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
+ Catalog_Item_Modifier, // string ItemNameModifier
+ Catalog_Item_Version, // string ItemNameModifierVersion
+ order_Creation_Reason, // string CreateReason
+ RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
+ RequestingSource, // string RequestedBySource (must be in dictionary)
+ SessionType, // string SessionType
+ SessionReason, // string SessionReason
+ location_obj, // Location ReleaseLocGrpID
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
+
+ PreFilled_MedicationOrder_obj.AdministrationInstructions:= OrderReason;
+
+
+ if ( Medication_catalog_item is NOT NULL ) then
+ void := call PreFilled_MedicationOrder_obj.Save;
+ void := call PreFilled_MedicationOrder_obj.Dispose;
+ void:= call Medication_catalog_item.Dispose;
+ Medication_catalog_item:= null;
+ endif;
+
+
+ endtry;
+
+ catch Exception ex error_occurred := true; error_message := "{{+R}}New prefilled medication order:{{-R}}\n" || ex.Message || "\n\n";
+
+ if ( Medication_catalog_item is NOT NULL ) then void:= call Medication_catalog_item.Dispose; Medication_catalog_item:= null; endif;
+ if ( PreFilled_MedicationOrder_obj is NOT NULL ) then void:= call PreFilled_MedicationOrder_obj.Dispose; PreFilled_MedicationOrder_obj:= null; endif;
+
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+ if ( RequestingCareProvider_obj is NOT NULL ) then void:= call RequestingCareProvider_obj.Dispose; RequestingCareProvider_obj:= null; endif;
+ if ( location_obj is NOT NULL ) then void:= call location_obj.Dispose; location_obj:= null; endif;
+
+
+ endif; // Create the order ?
+
+
+ endif; // Parkinson order already on file ?
+
+
+ endif; // procced ?
+
+
+
+ ;;
+ evoke:
+
+ Health_Issue_Enter;
+ Medication_Enter;
+
+ 10 seconds after time of Client_Visit_Modify;
+ 10 seconds after time of Client_Visit_Enter;
+
+
+ ;;
+ logic:
+
+
+ conclude True;
+
+ ;;
+ action:
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_PDMP_SEARCH_FROM_ORDER_SESSION.mlm b/MLMStripper/bin/Debug/SCH/SCH_PDMP_SEARCH_FROM_ORDER_SESSION.mlm
new file mode 100644
index 0000000..8da8001
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_PDMP_SEARCH_FROM_ORDER_SESSION.mlm
@@ -0,0 +1,405 @@
+maintenance:
+
+ title: SCH_PDMP_SEARCH_FROM_ORDER_SESSION;;
+ mlmname: SCH_PDMP_SEARCH_FROM_ORDER_SESSION;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair;;
+ author: Peggy Karish;;
+ specialist: Don Warnick;;
+ date: 2018-09-19;;
+ validation: testing;;
+
+library:
+ purpose: Opiod ordering
+ ;;
+
+ explanation: The MLM will check for a significant event for a PDMP search upon selection of an opiod or benzodiazapine
+
+ Change history
+ 09.19.2018 DW CSR# 36715 Created - PDMP in order session
+
+ ;;
+ keywords: Probiotic Ordering
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+ send_alert := "DoNotSend";
+
+ local_session := cds_session.local;
+
+
+ if called_by_editor then EvokingObject := read last {Order: THIS where Name="Loratadine 10mg Tab" }; endif;
+
+
+ order_init_event := event { OrderInit User Order: where TypeCode = "Medication" or Name= "Discharge" };
+
+ SignificantEvent_dest:= destination { ObjectsPlus } with [ alert_type := "Warning", short_message := "Object created by MLM", priority := "low", scope := "General",rule_group := "Significant Event Object", rule_number := 2010 ];
+
+ (CatalogItemObj) := read last {Order: OrderCatalogMasterItem REFERENCING EvokingObject};
+ (ClientVisitGuid, ChartGuid, ClientGuid, VisitType) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode};
+ (userguid,orgunitguid,lastname,firstname,middlename,OccupationCode,OrderRoleType) :=read last {UserInfo: guid,orgunitguid,lastname,firstname,middlename,OccupationCode,OrderRoleType};
+
+ // ordersession:= EVOKINGOBJECT.InitialSessionTypeCode; (to exclude discharge order rec activity)
+
+ birthdate := read last { ClientInfo: BirthDate};
+ patientage := int ((NOW - birthdate) / (1 year));
+
+ user_orgunit:= read last {" select name from CV3OrganizationalUnit with (nolock) where guid = " || orgunitguid || " "};
+
+ If (OccupationCode in ("IT","CRNP","PA","PA-C") or (OrderRoleType matches pattern "%physician%" and OrderRoleType <> "Anesthesia Physician"))
+ then qualifyingrole:= "true";
+ else qualifyingrole:= "false";
+ endif;
+
+ // Halt processing if disqualifying factors are present
+
+
+ if patientage = 0 or user_orgunit = "Emergency Department" or local_session.SessionPDMPSearch = "has_been_prompted" or qualifyingrole = "false" // or ordersession = "Discharge"
+
+
+ then
+
+ continue := "no";
+
+ else
+
+ // Format the user{{{SINGLE-QUOTE}}}s name
+
+ if middlename is null
+ then user_name:= firstname || " " || lastname;
+ else user_name:= firstname || " " || middlename || " " || lastname;
+ endif;
+
+
+ // Gather Drug ID of all opiod and benzo medications
+
+
+ (Opiods_Benzos) := read
+ { "
+ select distinct gn.DrugCatalogKey
+ from SXAAMBDrugName bn with (nolock)
+ join SXAAMBGenericNameDrugNameXRef dnx with (nolock) on dnx.DrugNameID = bn.DrugNameID
+ join SXARxGenericName gn with (nolock) on gn.GenericNameID = dnx.GenericNameID
+ join SXAAMBDrugCategoryXRef xr with (nolock) on gn.GenericNameID = xr.GenericNameID
+ join SXAAMBDrugCategory dc with (nolock) on xr.DrugCategoryID = dc.DrugCategoryID
+ where dc.CategoryName in ({{{SINGLE-QUOTE}}}Benzodiazepines{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}narcotic analgesics{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}narcotic analgesic combinations{{{SINGLE-QUOTE}}})
+ "};
+
+
+ launchpdmp:= "false";
+
+
+ // Discharge Order Section
+
+
+
+ if EVOKINGOBJECT.Name = "Discharge"
+
+ then
+
+ SignificantEvent := read last
+ {"
+ select c.text
+ from CV3ClientEventDeclaration c with (nolock)
+ where c.TypeCode = {{{SINGLE-QUOTE}}}PDMP{{{SINGLE-QUOTE}}} and c.status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and c.text like {{{SINGLE-QUOTE}}}%:%{{{SINGLE-QUOTE}}}
+ and c.ClientGUID = " || ClientGuid || " and c.clientvisitguid = " || ClientVisitGuid || " and c.chartguid = " || ChartGuid || "
+ order by c.CreatedWhen
+ "};
+
+ (PatientMedDrugID, PatientMedName, PatientMedOrderInfo ) := read
+ { "
+ SET CONCAT_NULL_YIELDS_NULL off
+ select dm.DrugKey, ocmi.Name, convert(char(11),o.Entered,101) + convert(char(5),o.Entered,108) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + u.FirstName + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + u.lastname + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + u.OccupationCode
+ from cv3ordercatalogmasteritem ocmi with (nolock)
+ join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = ocmi.guid
+ JOIN CV3DrugMapping dm with (nolock) on dm.CatalogItemGUID = ocmi.GUID
+ join CV3OrganizationalUnit ou with (nolock) on ou.GUID = ocmi.OrgUnitGUID
+ left join cv3user u with (nolock) on u.guid = o.userguid
+ join CV3OrganizationalUnit uou with (nolock) on uou.guid = u.OrgUnitGUID
+ where
+ ou.name ={{{SINGLE-QUOTE}}}Pharmacy Department{{{SINGLE-QUOTE}}} and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}) and
+ u.OrderRoleType <> {{{SINGLE-QUOTE}}}anesthesia physician{{{SINGLE-QUOTE}}} and uou.Description <> {{{SINGLE-QUOTE}}}Emergency Department{{{SINGLE-QUOTE}}} and
+ o.clientguid = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID = " || ClientVisitGuid || "
+ "};
+
+ // Check for Opiod/Benzo Medications
+
+ Opiods_BenzosFound:= "";
+ for x in 1 seqto count (PatientMedDrugID) do
+ if (PatientMedDrugID[x] is in Opiods_Benzos)
+ then Opiods_BenzosFound := Opiods_BenzosFound || "\n A PDMP Search was required for - " || PatientMedName [x] || " " || PatientMedOrderInfo [x] ;
+ endif;
+ enddo;
+ if Opiods_BenzosFound <> "" and not exist SignificantEvent
+
+ then
+ Custom_Msg_Box := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_CUSTOM_MSGBOX{{{SINGLE-QUOTE}}};
+ AlertWindowHeight:= "400"; // Minimum is 250
+ AlertWindowWidth := "850"; // Minimum is 480
+ MsgBoxButtons := ();
+ MsgBoxButtons := ("Search PDMP (recommended)", "Proceed with Discharge");
+ MsgBoxContent := "PDMP SEARCH NEEDED"
+ ||"\n\n\nThis patient was ordered a drug requiring a search of the Prescription Drug Monitoring Program (PDMP) website."
+ || "\n\nThe PDMP search did not occur."
+ || "\n\nPlease search the PDMP at this time."
+ || "\n\n\nNON-COMPLIANT ORDER";
+ MB_VAlign := "TOP";
+ MB_HAlign := "CENTER";
+ AdditionalInfoBox:= " " || Opiods_BenzosFound || " ";
+ ADINFO_VAlign := "CENTER";
+ ADINFO_HAlign := "LEFT";
+
+ dlg_result := call Custom_Msg_Box with (AlertWindowHeight,AlertWindowWidth,MsgBoxContent,MB_VAlign,MB_HAlign,MsgBoxButtons,AdditionalInfoBox,ADINFO_VAlign,ADINFO_HAlign);
+
+ local_session.SessionPDMPSearch := "has_been_prompted";
+
+
+ // Optional Search Button is selected
+
+
+ if(trim((dlg_result as string)) = "Search PDMP (recommended)")
+
+ then
+ launchpdmp:= "true";
+ endif;
+
+ endif; // Opiod_Benzo found w/o a significant PDMP event
+
+
+ endif; // Discharge Order
+
+
+
+ // Medication Order Section
+
+
+ if EVOKINGOBJECT.TypeCode = "Medication"
+
+
+ then
+
+ PatientMedDrugID:= CatalogItemObj.DrugCatalogKey;
+
+ if PatientMedDrugID is in Opiods_Benzos
+
+
+ // Proceed. This is an opiod / benzo
+
+ then
+
+ // Look for past searches on the visit
+
+ SignificantEvent:= " ";
+ PossibleConcerns:= " ";
+ PossibleConcernsFormatted:= " ";
+
+ (SignificantEvent,PossibleConcerns) := read
+ {"
+ select
+ c.text,
+ case when CHARINDEX ({{{SINGLE-QUOTE}}}:{{{SINGLE-QUOTE}}}, c.text) > 0 and substring (c.text,CHARINDEX ({{{SINGLE-QUOTE}}}:{{{SINGLE-QUOTE}}}, c.text)+1,(len(c.text)) - (CHARINDEX ({{{SINGLE-QUOTE}}}:{{{SINGLE-QUOTE}}}, c.text))) like {{{SINGLE-QUOTE}}}%no concern{{{SINGLE-QUOTE}}}
+ then {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}}
+ else {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
+ end
+
+ from CV3ClientEventDeclaration c with (nolock)
+ where c.TypeCode = {{{SINGLE-QUOTE}}}PDMP{{{SINGLE-QUOTE}}} and c.status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and c.text like {{{SINGLE-QUOTE}}}%:%{{{SINGLE-QUOTE}}}
+ and c.ClientGUID = " || ClientGuid || " and c.clientvisitguid = " || ClientVisitGuid || " and c.chartguid = " || ChartGuid || "
+ order by c.CreatedWhen
+ "};
+
+
+
+ // Has there been a search on this visit?
+
+
+ If not exist SignificantEvent
+
+ then
+
+ launchpdmp:= "true";
+
+ else
+
+ ConcernCounter := 0;
+ OtherUserCounter:= 0;
+
+ for i in 1 seqto count SignificantEvent DO
+ if i = 1 then PossibleConcernsFormatted := PossibleConcernsFormatted || SignificantEvent[i];
+ else PossibleConcernsFormatted := PossibleConcernsFormatted || "\n " || SignificantEvent[i];
+ endif;
+
+ thisconcern := PossibleConcerns[i] as number;
+ ConcernCounter:= ConcernCounter + thisconcern;
+
+ entered_by_this_user := find user_name in string SignificantEvent[i];
+ if entered_by_this_user = 0 then OtherUserCounter := OtherUserCounter + 1;
+ endif;
+
+ enddo;
+
+
+ If ConcernCounter > 0 and OtherUserCounter > 0
+
+ then
+ Custom_Msg_Box := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_CUSTOM_MSGBOX{{{SINGLE-QUOTE}}};
+ AlertWindowHeight:= "400"; // Minimum is 250
+ AlertWindowWidth := "850"; // Minimum is 480
+ MsgBoxButtons := ();
+ MsgBoxButtons := (" Proceed ", "PDMP Search (optional)");
+ MsgBoxContent := "PDMP SEARCH INFORMATION"
+ ||"\n\n\nYou are about to enter an order for a drug requiring a search of the Prescription Drug Monitoring Program (PDMP) website."
+ || "\n\nThe PDMP was searched earlier in the visit."
+ || "\n\n\n\nSEARCHES THIS VISIT";
+ MB_VAlign := "TOP";
+ MB_HAlign := "CENTER";
+ AdditionalInfoBox:= " " || PossibleConcernsFormatted || " ";
+ ADINFO_VAlign := "CENTER";
+ ADINFO_HAlign := "LEFT";
+ dlg_result := call Custom_Msg_Box with (AlertWindowHeight,AlertWindowWidth,MsgBoxContent,MB_VAlign,MB_HAlign,MsgBoxButtons,AdditionalInfoBox,ADINFO_VAlign,ADINFO_HAlign);
+
+ local_session.SessionPDMPSearch := "has_been_prompted";
+
+
+ // Optional Search Button is selected
+
+
+ if(trim((dlg_result as string)) = "PDMP Search (optional)")
+ then
+ launchpdmp:= "true";
+ endif;
+
+ endif; // Concern Counter > 0
+
+
+ endif; // Significant Event is found ?
+
+
+ endif; // Is this an opiod_benzo?
+
+
+ endif; // Medication order ?
+
+
+
+ // Launch the PDMP
+
+
+
+ If launchpdmp = "true"
+
+ then
+
+ local_session.SessionPDMPSearch := "has_been_prompted";
+
+ using "LaunchPDMP";
+ test:= new net_object {{{SINGLE-QUOTE}}}LaunchPDMP.LaunchPDMPForm{{{SINGLE-QUOTE}}};
+
+ oeUnsigned:=CALL test.ShowDialog;
+ return_string:= test.text;
+
+
+ if return_string matches pattern "search completed%"
+
+ then
+
+ SearchAssessment := substring 80 characters starting at 17 from return_string ;
+ SearchInformation:= "PDMP Searched by " || user_name || " " || extract month now || "/" || extract day now || "/" || extract year now || " " || extract hour now || ":" || extract minute now || SearchAssessment;
+
+ try
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Retrieve client:{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif;
+ endcatch;
+
+ TimeOfEntry := now ;
+
+ yr := extract year TimeOfEntry;
+ mn := extract month TimeOfEntry;
+ dd := extract day TimeOfEntry;
+
+ PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} );
+
+ BBEventTypeCode := "PDMP";
+ BBEventText := SearchInformation;
+ LeukRedEventText := "Checked";
+
+ // Create Significant Event
+
+ try
+ SignificantEvent_obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.CreateSignificantEvent with (client_visit_obj, BBEventTypeCode, LeukRedEventText);
+ SignificantEvent_obj.Text := BBEventText;
+ SignificantEvent_obj.OnsetDate := PartialDate_obj;
+ SignificantEvent_dest.ObjectsPlus:= SignificantEvent_obj;
+ void := call SignificantEvent_obj.save;
+ endtry;
+
+ catch exception ex
+ error_occurred := true;
+ error_message := error_message || "{{+R}}New Significant Event{{-R}}\n" || ex.Message || "\n\n";
+ if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif;
+ if ( SignificantEvent_obj is NOT NULL ) then void:= call SignificantEvent_obj.Dispose; SignificantEvent_obj:= null; endif;
+ SignificantEvent_dest := null;
+ endcatch;
+
+ if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
+
+ endif; // Search Completed
+
+ endif; // Launch PDMP
+
+
+
+
+
+
+ endif; // halt for one of the exclusions
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: // order_enter_event;
+ order_init_event;
+
+ ;;
+ logic:
+
+ if called_by_editor
+ then
+ conclude false;
+ endif;
+
+ if EvokingObject is null
+ then
+ conclude false;
+ endif;
+
+ if continue = "no"
+ then
+ conclude false;
+ endif;
+
+ conclude doalert;
+
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_PLACE_INFECTION_PREVENTION_ORDER.mlm b/MLMStripper/bin/Debug/SCH/SCH_PLACE_INFECTION_PREVENTION_ORDER.mlm
new file mode 100644
index 0000000..fb68499
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_PLACE_INFECTION_PREVENTION_ORDER.mlm
@@ -0,0 +1,274 @@
+maintenance:
+
+ title: SCH_Place_Infection_Prevention_ORDER;;
+ mlmname: SCH_Place_Infection_Prevention_ORDER;;
+ arden: version 2.5;;
+ version: 1.00;;
+ institution: ;;
+ author: SHAMI SHARMA;;
+ specialist: ;;
+ date: 2017-12-19;;
+ validation: testing;;
+
+library:
+ purpose: Create
+
+ ;;
+ explanation:
+
+ Change history
+ 07/10/2019 JML CSR# 38386: Modified logic to auto-check lab test based on ED vs. Inpatient location.
+
+
+ ;;
+ keywords: ;;
+knowledge:
+ type: data-driven;;
+ data:
+ /* Set to true if logging is needed.*/
+ log_execution_info:= FALSE;
+
+ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+ SessionType := "Standard";
+ SessionReason := "";
+ RequestingSource := "";
+ user_IDType := "Primary";
+ order_creation_reason := "From MLM";
+
+ using "ObjectsPlusXA.SCM.Common";
+ using namespace "ObjectsPlusXA.SunriseClinicalManager.Common";
+ display_order_form := true;
+
+ PhysicianOrderSet:= event {OrderSetEnter User OrderSet : where OrderSetName = "Physician Clostridium Difficile Order Set"};
+ //InfectionPrevention:= event {OrderEnter User Order : where Name = "Infection Prevention Consult"};
+ //OrderEnter := event{OrderEnter User Order : where Name IN ("Urine Culture","Urine Culture (reflex)","Urinalysis with Reflex Culture","Routine/Microscopic Urinalysis") };
+ (clientGUID, chartGUID, ClientVisitGUID, LocationGUID,CName,IDcode,VisitIDcode) := read last { ClientVisit: ClientGUID, ChartGUID, GUID,
+ CurrentLocationGUID,ClientDisplayName, IDCode,VisitIDCode,AdmitDtm,CurrentLocation };
+ (userguid,user_id ,Username):=read last {UserInfo: guid,idcode,DisplayName};
+ (UNIT) := read last { "select Top 1 case when cc.typecode = {{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then cc.levelcode when b.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then b.levelcode when a.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then a.levelcode "
+ || " when cv3l.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then cv3l.levelcode else null end as Unit From CV3ClientVisit CV With (nolock) "
+ || " Inner Join Cv3Location L With (nolock) On L.Guid=CV.CurrentLocationGUID AND CV.Active=1 AND CV.VisitStatus={{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}} "
+ || " Left Join Cv3ClientVisitLocation CVL With (nolock) ON CVL.ClientVisitGUID=CV.GUID Left Join CV3Location CV3L On CV3L.GUID=CVL.LocationGUID "
+ || " Left Join CV3Location a With (nolock) on CV3L.parentguid= a.guid Left Join CV3Location b With (nolock) on a.parentguid = b.guid "
+ || " left join cv3location cc With (nolock) on b.parentguid = cc.guid "
+ || " WHERE CVL.Status={{{SINGLE-QUOTE}}}CUR{{{SINGLE-QUOTE}}} and CV.GUID = " || ClientVisitGUID || " " };
+
+ (ReadUnSub_PatchUD, CP_GUID, OrderName, Startdate, Starttime, sessiontype1) := read { UNSUBMITTED Order: OrderUserData , careproviderguid , name, requesteddate, requestedtime,
+ InitialSessionTypeCode where name IN ("Clostridium Difficile Toxin Gene Testing by PCR","Clostridium Difficile Screening") };
+ (unsub_mlm_name_list,ConReason1_List ):= read { UNSUBMITTED Alert: MLMName,AlertComments Where MLMName = "SCH_CDiff_Alert" };
+
+
+ for j in 1 seqto count ConReason1_List do
+ If EXISTS ConReason1_List[j] then
+ IndicationConsult := ConReason1_List[j];
+
+ Endif;
+ Enddo;
+
+
+ IF(EvokingEventType = "OrderSetEnter") THEN
+
+
+ if(count(ConReason1_List)>0) THEN
+ if(count(Ordername) > 0) then
+
+ orderItemName:="Infection Prevention Consult";
+ // Create a GENERAL order from a catalog item
+ try
+
+
+ // ClientVisit object
+ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // GENERAL catalog item object
+ general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
+ with orderItemName;
+
+ // CareProvider Object
+ requesting_care_provider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((userguid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // Location Object
+ location_guid := read last {"SELECT CurrentLocationGuid FROM CV3ClientVisit "
+ || " WHERE ClientGuid = " || clientGUID};
+ location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
+ with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
+
+ // Create GENERAL order
+ GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
+ with client_visit_obj,
+ general_catalog_item,
+ order_creation_reason,
+ requesting_care_provider_obj,
+ RequestingSource,
+ SessionType,
+ SessionReason,
+ location_obj,
+ "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
+
+ GeneralOrder_Obj.RequestedDate := "T";
+ void := call GeneralOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "C Diff Indication",( IndicationConsult AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
+
+ void := call GeneralOrder_Obj.Save;
+ void := call GeneralOrder_Obj.Dispose;
+
+
+ endtry;
+
+ catch Exception ex
+ error_occurred := true;
+ error_message := "{{+R}}Error in saving prefilled auto order :{{-R}}\n" ||
+ ex.Message || "\n\n";
+
+ endcatch;
+
+ // Clean UP
+ if (location_obj IS NOT NULL) then
+ void := call location_obj.Dispose;
+ location_obj := NULL;
+ endif;
+
+ if (requesting_care_provider_obj IS NOT NULL) then
+ void := call requesting_care_provider_obj.Dispose;
+ requesting_care_provider_obj := NULL;
+ endif;
+
+ if (general_catalog_item IS NOT NULL) then
+ void := call general_catalog_item.Dispose;
+ general_catalog_item := NULL;
+ endif;
+
+ if (client_visit_obj IS NOT NULL) then
+ void := call client_visit_obj.Dispose;
+ client_visit_obj := NULL;
+ endif;
+
+ //email_add:= "sharma.shami@stclair.org";
+ email_add:= "Julie.Fitzpatrick@stclair.org;Emily.Magee@stclair.org";
+ if exist email_add
+ then
+ primary_alert := destination { Email: reminder, "Email Alert - Infection Prevention Consult - C Diff", low, chart, email_add };
+ primary_alert_message := "Consult Infection Prevention Order is Placed. \n"
+ || "Date Ordered " ||Now||"\n"
+ || "MRN: " || IDcode ||"\n"
+ || "Visit ID No: " || VisitIDcode ||"\n"
+ || "Unit: " || Unit ||"\n"
+ || "Order Placed By: " || Username ||"\n"
+ || "Indication for Consult: " || IndicationConsult ||"\n"
+ || "Order Placed From: CDiff Orderset. \n";
+ else
+ primary_alert_dest := destination { Alert: Warning,"Provider/Email not found", high, chart, 7500 };
+ endif;
+ ENDIF; // Count>0
+ //email_add:= "#InfectionPreventionChampions@stclair.org";
+ ENDIF;
+
+
+ ENDIF; // IF ordersetenter
+ /*
+ IF(EvokingEventType = "OrderEnter") THEN
+
+ /*Result := read last { " SELECT TOP 1 O.Name "
+ ||" FROM Cv3Order (NOLOCK) O "
+ ||" INNER JOIN CV3OrderTaskOccurrence ot on ot.ClientGUID=O.ClientGUID and ot.OrderGUID=O.GUID and ot.TaskStatusCode={{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
+
+ ||" WHERE ot.PerformedFromDtm >= DATEADD(HOUR, -48, GETDATE())"
+ ||" AND O.Status= {{{SINGLE-QUOTE}}}ACTIVE{{{SINGLE-QUOTE}}} AND O.ActivateStatus={{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} "
+ ||" AND (NAME LIKE {{{SINGLE-QUOTE}}}%BISACODYL%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%CALCIUM POLYCARBOPHIL%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%DOCUSATE CALCIUM%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%DOCUSATE SODIUM%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%GLYCERIN SUPPOSITORY%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%MAGNESIUM CITRATE%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%MAGNESIUM HYDROXIDE%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%MINERAL OIL%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%POLYETHYLENE GLYCOL%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%PSYLLIUM%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%SENNA%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%SENNA/DOCUSATE SODIUM%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%SODIUM BIPHOSPHATE/SODIUM PHOSPHATE%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Dulcolax%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Fibercon%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Surfak%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Colace%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Milk of Magnesia%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%CoLyte%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%GoLYTELY%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%NuLytely%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%OCL Solution%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%MiraLax%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%MoviPrep%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Hydrocil Instant%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Senokot%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Peri-Colace%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Senokot S%{{{SINGLE-QUOTE}}} OR "
+ ||" NAME LIKE {{{SINGLE-QUOTE}}}%Fleets Enema%{{{SINGLE-QUOTE}}} ) "
+ ||" AND O.ClientGUID = " || SQL(ClientGuid)
+ ||" AND O.ChartGUID = " || SQL(ChartGuid)
+ ||" AND O.ClientVisitGUID = " || SQL(ClientVisitGUID)
+ }; */
+
+ /* this_order := read last {Order : Name Referencing EvokingObject};
+ (CatalogItemObj) := read last {Order: OrderCatalogMasterItem REFERENCING EvokingObject};
+ order, Summary:= read last {Order: Name,Summaryline REFERENCING EvokingObject};
+ //IF(EXISTS Result ) THEN
+ //email_add:= "#InfectionPreventionChampions@stclair.org";
+ //email_add:= "Janet.nordin@stclair.org";
+ email_add:= "sharma.shami@stclair.org";
+ IF(MLML = "SCH_URINE_Culture_Alert") THEN
+A:=1; Break;
+ if exist email_add then
+ primary_alert := destination { Email: reminder, "Email Alert - Infection Prevention Consult - URINE CULTURE", low, chart, email_add };
+ primary_alert_message := "Consult Infection Prevention Order is Placed. \n"
+ || "Date Ordered " ||Now||"\n"
+ || "MRN: " || IDcode ||"\n"
+ || "Visit ID No: " || VisitIDcode ||"\n"
+ || "Unit: " || Unit ||"\n"
+ || "Order Placed By: " || Username ||"\n"
+ || "Indication for Consult: " || IndicationConsult1 ||"\n"
+ || "Order Placed From: Urine Culture. \n";
+ else
+ primary_alert_dest := destination { Alert: Warning,"Provider/Email not found", high, chart, 7500 };
+ endif;
+
+ ELSE
+A:=2; Break;
+ if exist email_add then
+ primary_alert := destination { Email: reminder, "Email Alert for Placing Infection Prevention Order", low, chart, email_add };
+ primary_alert_message := "Consult Infection Prevention Order is Placed. \n"
+ || "Date Ordered " ||Now||"\n"
+ || "MRN: " || IDcode ||"\n"
+ || "Visit ID No: " || VisitIDcode ||"\n"
+ || "Unit: " || Unit ||"\n"
+ || "Order Placed By: " || Username ||"\n"
+ || "" || Summary ||"\n" ;
+
+ else
+ primary_alert_dest := destination { Alert: Warning,"Provider/Email not found", high, chart, 7500 };
+ endif;
+
+ ENDIF;
+
+ ENDIF;
+
+ */
+
+;;
+ evoke:
+ PhysicianOrderSet;
+ // InfectionPrevention;
+//OrderEnter;
+ ;;
+ logic:
+ conclude true;
+
+ ;;
+ action: IF exist email_add
+ then
+ write primary_alert_message at primary_alert;
+ ENDIF;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_PNEUMOCOCCAL_ORDER_CHECK_HEALTH_ISSUES.mlm b/MLMStripper/bin/Debug/SCH/SCH_PNEUMOCOCCAL_ORDER_CHECK_HEALTH_ISSUES.mlm
new file mode 100644
index 0000000..05eab32
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_PNEUMOCOCCAL_ORDER_CHECK_HEALTH_ISSUES.mlm
@@ -0,0 +1,225 @@
+maintenance:
+
+ title: Check If there is a Pneumococcal coded health issue when Pneumococcal is ordered;;
+ mlmname: SCH_PNEUMOCOCCAL_ORDER_CHECK_HEALTH_ISSUES;;
+ arden: version 2;;
+ version: 4.50;;
+ institution: SCH ;;
+ author: Robert Spence Ext 7461;;
+ specialist: Peggy Karish Ext 7441 ;;
+ date: 2010-03-16;;
+ validation: testing;;
+
+library:
+ purpose: Checks Pneumococcal Vaccine History at Client Level when Pneumococcal Vaccine is ordered
+ ;;
+ explanation: To close the loop on this last percent:
+ An MLM on the Pneumovax Vaccine that gives a hard stop if the patient has a Health Issue
+ With a date of less than 365 days and a soft stop for less than 5 years. Go with the onset date.
+
+ Change history
+
+ 09.11.2015 DW CSR# 23359 - ICD10
+
+
+ ;;
+ keywords: Pneumococcal, Vaccine, Health Issue Check, Hard Stop, Soft Stop
+ ;;
+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";
+
+ // Set the text for this variable to indicate whether to send the message or not.
+ send_alert := "DoNotSend";
+
+ order_evoke1:= EVENT {OrderInit User Order:
+ WHERE TypeCode = "Medication"
+ And Name = "Pneumococcal Vaccine Inj"};
+
+ /* order_evoke2:= EVENT {OrderEnter User Order:
+ WHERE TypeCode = "Medication"
+ And Name = "Pneumococcal Vaccine Inj"};
+ */
+
+ hardstop_alert:= destination { Alert: warning, "Pnuemococcal Health Issue Check", high, chart,
+ "Pneumococcal", 14005, send_alert, "No Override Allowed" };
+
+ softstop_alert:= destination { Alert: warning, "Pnuemococcal Health Issue Check", high, chart,
+ "Pneumococcal", 14005, send_alert};
+
+
+
+ client_guid := read last {ClientInfo: GUID};
+ Hard_Stop := false;
+ Soft_Stop := false;
+
+ /* Replaced with ICD10 project
+
+ codeyear,codemonth,codeday := read last
+ { " select top 1 " ||
+ " hid.OnSetYearNum,hid.OnSetMonthNum,hid.OnSetDayNum " ||
+ " from CV3HealthIssueDeclaration as hid with (nolock) " ||
+ " join cv3codedhealthissue as chi with (nolock) " ||
+ "on chi.guid = hid.codedhealthissueGUID " ||
+ " and chi.code in ({{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V03.82{{{SINGLE-QUOTE}}}) " ||
+ " where hid.TypeCode = {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}} " ||
+ " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " ||
+ " AND hid.ClientGUID = " || SQL(client_guid) ||
+ " And hid.OnSetYearNum <> 0 " ||
+ " order by onsetyearnum desc,onsetmonthnum desc, onsetdaynum desc "
+ } ;
+ */
+
+
+ codeyear,codemonth,codeday := read last
+ { " select top 1 " ||
+ " hid.OnSetYearNum,hid.OnSetMonthNum,hid.OnSetDayNum " ||
+ " from CV3HealthIssueDeclaration as hid with (nolock) " ||
+ " join cv3codedhealthissue as chi with (nolock) " ||
+ "on chi.guid = hid.codedhealthissueGUID " ||
+ "and " ||
+ "( " ||
+ "(hid.ICD9Code is null and chi.code in ({{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V03.82{{{SINGLE-QUOTE}}}) ) " ||
+ "or " ||
+ "(hid.ICD9Code is not null and hid.ICD9Code in ({{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V03.82{{{SINGLE-QUOTE}}}) ) " ||
+ ") " ||
+ " where hid.TypeCode = {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}} " ||
+ " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " ||
+ " AND hid.ClientGUID = " || SQL(client_guid) ||
+ " And hid.OnSetYearNum <> 0 " ||
+ " order by onsetyearnum desc,onsetmonthnum desc, onsetdaynum desc "
+ } ;
+
+
+ if exists(codeyear)
+ then
+
+ cd := codeday as number;
+
+ if cd = 0
+ then
+ cd := 1;
+ endif;
+
+ if cd < 10 then cd := "0" || cd; endif;
+ cm:= codemonth as number;
+ if cm < 10 then cm := "0" || cm; endif;
+
+ vacctime := codeyear || "-" || cm || "-" || cd || "T00:00:00";
+
+ if ((vacctime as time) is within the past 365 days) = true
+ then
+ Hard_Stop := true;
+ RepMessage := "You cannot enter this order. " ||
+ "\n\n The patient has received a pneumovax within the past 365 days. "
+ || "\n\n Onset Date: " || cm || "/" || cd || "/" || codeyear;
+ elseif ((vacctime as time) is within the past 5 years)
+ then
+ Soft_Stop := True;
+ RepMessage := "Caution: The patient has received a pneumovax within the past 5 years. " ||
+ "\n\n This order may not be appropriate for the patient. " ||
+ "\n\n Onset Date: " || cm || "/" || cd || "/" || codeyear;
+ endif;
+
+ else
+
+ /* Replaced with ICD10 project
+
+ numberofdaysentered,datetomessage := read last
+ { " select top 1 " ||
+ " hid.createdwhen " ||
+ " from CV3HealthIssueDeclaration as hid with (nolock) " ||
+ " join cv3codedhealthissue as chi with (nolock) " ||
+ "on chi.guid = hid.codedhealthissueGUID " ||
+ " and chi.code in ({{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V03.82{{{SINGLE-QUOTE}}}) " ||
+// " and chi.code = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} " ||
+ " where hid.TypeCode = {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}} " ||
+ " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " ||
+ " AND hid.ClientGUID = " || SQL(client_guid) ||
+ " order by onsetyearnum desc,onsetmonthnum desc, onsetdaynum desc "
+ } ;
+*/
+
+ numberofdaysentered,datetomessage := read last
+ { " select top 1 " ||
+ " hid.createdwhen " ||
+ " from CV3HealthIssueDeclaration as hid with (nolock) " ||
+ " join cv3codedhealthissue as chi with (nolock) " ||
+ "on chi.guid = hid.codedhealthissueGUID " ||
+ "and " ||
+ "( " ||
+ "(hid.ICD9Code is null and chi.code in ({{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V03.82{{{SINGLE-QUOTE}}}) ) " ||
+ "or " ||
+ "(hid.ICD9Code is not null and hid.ICD9Code in ({{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V03.82{{{SINGLE-QUOTE}}}) ) " ||
+ ") " ||
+ " where hid.TypeCode = {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}} " ||
+ " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " ||
+ " AND hid.ClientGUID = " || SQL(client_guid) ||
+ " order by onsetyearnum desc,onsetmonthnum desc, onsetdaynum desc "
+ } ;
+
+
+ if (exists(numberofdaysentered)) and ((numberofdaysentered as time) is within the past 5 years)
+ then
+ eyr := extract year (numberofdaysentered as time) ;
+ emn := extract month (numberofdaysentered as time) ; if emn < 10 then emn := "0" || emn; endif;
+ edd := extract day (numberofdaysentered as time) ; if edd < 10 then edd := "0" || edd; endif;
+ Soft_Stop := true;
+ RepMessage := "Caution: The patient’s Pneumovax Vaccine History on the Health Issues does not include an Onset Date." ||
+ "\n\n Recommend that the Onset Date is verified prior to placing this order." ||
+ "\n\n Health Issue Was Created On: " || emn || "/" || edd || "/" || eyr ;
+
+ endif;
+ endif;
+
+
+ FireMe := false;
+
+ If (Hard_Stop = true or Soft_Stop = true)
+ then
+ if Hard_Stop = true // Hard_Stop Outweighs Soft_Stop
+ then
+ Soft_Stop := false;
+ endif;
+
+ FireMe := true;
+ endif;
+
+/*
+ (orderset_guid, order_name) := read last
+ { Order: OrderSetGUID, name
+ REFERENCING EvokingObject };
+
+ if exists(orderset_guid)
+ then
+ Hard_Stop := false;
+ else
+ Hard_Stop := true;
+ endif;
+*/
+ ;;
+ evoke: order_evoke1 ;//or order_evoke2;
+ ;;
+ logic:
+ conclude FireMe;
+ ;;
+ action:
+
+ If Hard_Stop = true
+ then
+ write RepMessage at hardstop_alert;
+ endif;
+
+ if Soft_Stop = true
+ then
+ write RepMessage at softstop_alert;
+ endif;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_POST_HOSPITAL_CARE_ORDERS.mlm b/MLMStripper/bin/Debug/SCH/SCH_POST_HOSPITAL_CARE_ORDERS.mlm
new file mode 100644
index 0000000..639b3f3
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_POST_HOSPITAL_CARE_ORDERS.mlm
@@ -0,0 +1,120 @@
+maintenance:
+
+ title: SCH_POST_HOSPITAL_CARE_ORDERS;;
+ mlmname: SCH_POST_HOSPITAL_CARE_ORDERS;;
+ arden: version 2.5;;
+ version: 5.00;;
+ institution: St.Clair Hospital;;
+ author: Dan Bredl;;
+ specialist: Don Warnick ;;
+ date: 2012-02-16;;
+ validation: testing;;
+
+
+ library:
+ purpose: Hard stop when attempting to save the Post Hospital Care Orders Structured Note with past start/stop dates
+ ;;
+ explanation: Stops the nurse from saving the structured note when the discharge meds have the bad dates.
+
+
+ change history
+
+ 02.16.2012 DW CSR# 26841 - Created
+ 03.30.2012 DW CSR# 26841 - Made a few exceptions to the RN alert for nurses in non-inpatient departments
+ 04.24.2012 DW CSR# 30707 - Changed name of the document per Collaborative Care
+ 07.08.2015 STH CSR# 32070 - Updated statement that appears to user per Debbie Eiler{{{SINGLE-QUOTE}}}s request.
+ 07.14.2015 STH Ticket #: 1801808 - Update to allow saving Discharge Instructions with medications that have dates in the past
+ when the patients status is anything other than ADM (for admitted).
+ 06.19.2019 BB CSR# 38305 - Infusion Center went Live with with Enterprise Scheduling, and a subset of users began to receive an OMR alert when entering
+ Discahrge Instructions (Posh Hospital Care Orders). This was due to the creation of a new Infusion Security group [Infusion Ovride],
+ and needs added in the exclusions in this MLM.
+ ;;
+ keywords: ClientDocument; OMP; Dates;
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ /*******************Make Changes To Spelling And Flags In This Section*******************/
+
+send_alert := "DoNotSend";
+log_execution_info := false;
+
+
+Post_Hospital_Care_Orders_Enter := event { ClientDocumentEnter User ClientDocument: WHERE DocumentName = "Discharge Instructions (Post Hospital Care Orders)"};
+Post_Hospital_Care_Orders_Modify:= event { ClientDocumentModify User ClientDocument: WHERE DocumentName = "Discharge Instructions (Post Hospital Care Orders)"};
+
+alert_details:= destination { Alert: warning, "Must acknowledege alert", high, chart,
+ "Warning orders exist for patient", 14005, send_alert, "No Override Allowed" };
+
+
+( OccupationCode, userguid) := read last { UserInfo: occupationcode, guid};
+
+(securitygroup) := read
+ {
+ " select sg.code from cv3user u with (nolock) "
+ || " left join cv3usersecuritygroup as usg with (nolock) on usg.userguid=u.guid "
+ || " join cv3securitygroup as sg with (nolock) on sg.guid = usg.securitygroupguid "
+ || " where u.GUID = " || userguid || " and sg.code in ({{{SINGLE-QUOTE}}}Case Mgt{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CardPulm Nurse{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}infusion{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Infusion Ovride{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Wound Center{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}ETRN{{{SINGLE-QUOTE}}}) "
+ || " and sg.active = 1 and usg.expirydtm is null "
+ };
+
+(clientGuid, chartGuid, visitguid) := read last {ClientDocument: clientGuid, chartguid, clientvisitguid REFERENCING EvokingObject};
+
+
+
+Admit_status := read last {" select VisitStatus from CV3ClientVisit with (nolock) "
+ || " where clientguid = " || sql(clientGuid)
+ || " and chartguid = " || sql(chartGuid)
+ || " and guid = " || sql(visitguid)};
+
+if called_by_editor then clientguid := "9000001923700200"; clientvisitguid:= "9000002931500270"; chartguid := "9000002931500170"; endif; // if called_by
+
+if (OccupationCode = "RN" OR OccupationCode = "GN" OR OccupationCode = "SN") and (not exists securitygroup) then isRn := "yes"; else isRn := "no"; endif;
+
+
+(OMPMedsWithBadDates) := read
+ {
+ " SET CONCAT_NULL_YIELDS_NULL off select p.DrugName + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + p.Instructions"
+ || " from sxaambclientprescription p with (nolock) "
+ || " where p.statustype = 1 and p.ClientGuid = " || clientGuid || " "
+ || " and "
+ || " ( "
+ || " (convert(char(11), p.startdate,20)< convert(char(11), getdate(),20) and p.enddate is null) "
+ || " or "
+ || " (convert(char(11), p.enddate,20)< convert(char(11), getdate(),20) and p.startdate is null) "
+ || " or "
+ || " (convert(char(11), p.startdate,20)< convert(char(11), getdate(),20) and convert(char(11), p.enddate,20) < convert(char(11), getdate(),20)) "
+ || " ) "
+ };
+
+
+ One_OMPMedWithBadDates := " ";
+ All_OMPMedsWithBadDates:= " ";
+
+ for i in 1 seqto count OMPMedsWithBadDates do
+ One_OMPMedWithBadDates := OMPMedsWithBadDates [i];
+ All_OMPMedsWithBadDates := All_OMPMedsWithBadDates || " \n\n " || One_OMPMedWithBadDates ;
+ enddo;
+
+ ;;
+
+ evoke: Post_Hospital_Care_Orders_Enter ;
+ Post_Hospital_Care_Orders_Modify;
+ ;;
+
+ logic:
+ if exists OMPMedsWithBadDates and isRn = "yes" and admit_status = "ADM"
+ then conclude true;
+ else conclude false;
+ endif;
+
+ ;;
+
+ action:
+
+
+ write "There are medications in the Outpatient Medication List that have start/stop dates in the past. Please revise/remove those dates. \n {{+B}}{{+R}}" || All_OMPMedsWithBadDates at alert_details;
+
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_POST_OP_ORDERSETS_HOLD_SESSION.mlm b/MLMStripper/bin/Debug/SCH/SCH_POST_OP_ORDERSETS_HOLD_SESSION.mlm
new file mode 100644
index 0000000..20bdbeb
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_POST_OP_ORDERSETS_HOLD_SESSION.mlm
@@ -0,0 +1,124 @@
+maintenance:
+
+ title: SCH_POST_OP_ORDERSETS_HOLD_SESSION ;;
+ filename: SCH_POST_OP_ORDERSETS_HOLD_SESSION;;
+ arden: version 2.50;;
+ version: 5.50;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts, Inc. x7461 ;;
+ specialist: Maria Pest, Allscripts, Inc. x;;
+ date: 2012-11-15;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+
+ Change History
+ JML 11.15.2012 - Created
+ STH 11.5.2013 - CSR#: 30958 Updated for all proper order roles and to include ANY order that has POST OP in the name,
+ STH 05.1.2014 - HelpDesk Issue: Updated to put all orders on hold if they are entered by a qualifying occupation AND are not in 5C or FBC.
+ DJW 08.20.2014 - HD# 167686 - Needed to exclude the Robitic Post Op order from the logic. These should not be entered in Hold.
+ STH 07.20.2016 - HD#: 2259674 - Updated logic to look for orders that have Post Op with a leading and/or trailing space befor Post and after Op.
+ stars with "Post Op %" or ends with "% Post Op" or contains "% Post Op %" will all qualify; however "Post Open Heart...." will not.
+ TMS 03.30.2017 - HD# 2632217 - Add exclusion for Post Op Vascular Heparin Order Sets (Initial and Maintenance) which should not be placed in a hold session.
+ TMS 04.11.2018 - CSR #35320 - Add logic to exclude order sets containing the words "Post Op" when the order set description contains the words NOHOLD). This will allow
+ us to exclude order sets for oupatient surgery and pacu post op order sets without modifying the MLM for each orderset.
+ TMS 07.31.2019 - HD# #3829299 - Add DPM to occupation codes that will place orders into a hold session.
+ ;;
+ keywords: Order set, postop, session type, worksheetinfo
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+
+ 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 logging is needed.*/
+ log_execution_info:= false;
+
+ // Set the text for this variable to indicate whether to send the message or not.
+ send_alert := "DoNotSend";
+
+ //Local Variables for Logic Flow
+ stopOrder := false;
+ preopOrderSetAlertMsg := "";
+
+ /* Change the message within the quotes if a different short-message is needed. */
+ preop_orderset_alert:= destination {alert} with
+ [alert_type := warning,
+ short_message := "Post Op OrderSet HOLD session",
+ priority := "High",
+ scope := Chart,
+ rule_group := "Post Op OrderSet HOLD session Group",
+ rule_number := 8050,
+ send_with_order := send_alert,
+ alert_dialog_settings := "No Override Allowed",
+ display_alert := true];
+
+ preop_orderset_event := event{OrderSetInit User OrderSet:
+ WHERE (OrderSetName matches pattern "Post Op %"
+ or OrderSetName matches pattern "% Post Op"
+ or OrderSetName matches pattern "% Post Op %")};
+ // and (OrderSetName not in ("Robotic Prostatectomy Post Op Day 1","Pediatric Medication PACU Post Op OS", "Anesthesia Post Op Orders", "Post Op Vascular Heparin (Initial)", "Post Op Vascular Heparin (Maintenance)"))) };
+ //WHERE OrderSetName IN ("FBC Vaginal Hysterectomy Post Op",
+ // "FBC Abdominal Hysterectomy Post Op",
+ // "Laparoscopic Hysterectomy")};
+
+ /***************************************************************************************/
+
+ //Retrieve the current order session
+ worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
+
+ (OrderSetName, OrderSetStatus, OrderSetGuid) := read last {OrderSet : OrderSetName, OrderSetStatusCode, OrderCatalogSetGUID REFERENCING EvokingObject};
+
+ SetDescription := read last { "Select Description from CV3OrderCatalogSet where GUID = " || OrderSetGuid };
+ If SetDescription matches pattern "%(NOHOLD)%" then
+ HoldSession := "NO";
+ else HoldSession := "YES";
+ endif;
+
+
+ //Retrieve current logged on user
+ (OccCode) := read last {UserInfo : OccupationCode};
+
+ //Restrict logic to CPOE Only
+ //MD, DO, DDS, DMD, PA, PA-C, CRNP
+ if (OccCode in ("MD", "DO", "DDS", "DMD", "DPM", "PA", "PA-C", "CRNP", "IT")) and HoldSession = "Yes" then
+ //Get Patients current Location
+
+ (currentLocation, tempLocation) := read last {ClientVisit : CurrentLocation, TemporaryLocation};
+ if (currentLocation matches pattern "5C%") = false and (currentLocation matches pattern "FBC%") = false THEN
+
+ //"St. Clair Hospital Anc" OR tempLocation = "OR- temp location" OR tempLocation = "Cardiac Cath Temp Location") then
+ if (worksheetInfo.UnsubmittedOrdersCount = 0) then
+ void := call worksheetInfo.SetSessionType with ("HOLD", "Hold Orders");
+ else
+ stopOrder := true;
+ preopOrdersetAlertMsg := "ALERT: HOLD order session is required for Post-op orders"
+ || " for patients in pre-op temp or unit locations.\n\n"
+ || "Please select ""Go Back"" and re-select a session type"
+ || " of ""HOLD"" on the Order Entry Worksheet";
+ endif;
+ endif;
+ endif;
+
+;;
+ evoke:
+ preop_orderset_event;
+ ;;
+ logic:
+ conclude stopOrder;
+
+ if (worksheetInfo IS NOT NULL) then
+ void := call worksheetInfo.Dispose;
+ worksheetInfo := null;
+ endif;
+ ;;
+ action:
+ write preopOrdersetAlertMsg at preop_orderset_alert;
+ ;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_PREV_ACC_HOSPICE.mlm b/MLMStripper/bin/Debug/SCH/SCH_PREV_ACC_HOSPICE.mlm
new file mode 100644
index 0000000..3888713
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_PREV_ACC_HOSPICE.mlm
@@ -0,0 +1,115 @@
+maintenance:
+
+ title: SCH_PREV_ACC_HOSPICE;;
+ mlmname: SCH_PREV_ACC_HOSPICE;;
+ arden: version 2;;
+ version: 4.00;;
+ institution: St Clair Memorial Hospital;;
+ author: Robert Spence;;
+ specialist: ;;
+ date: 2009-06-01;;
+ validation: testing;;
+
+library:
+ purpose:
+ ;;
+ explanation:
+ ;;
+ keywords:
+ ;;
+knowledge:
+ type: data-driven;;
+ data:
+ //Logging level of execution information
+ log_execution_info:=FALSE;
+
+
+
+ //The evoking event for this MLM is OrderInit
+ evoking_event_order:=EVENT{OrderInit User Order: where name <> "Infusion Center Consult"};
+
+ order_alert:= destination { Alert: Warning, "Previous Hospice Patient With Infusion Consult", high, chart,
+ "Previous Hospice Patient", 9005};
+
+
+ //Retreives a list of order GUIDs for unsubmitted orders
+ unsub_ord:=read {UnsubmittedOrders: GUID};
+
+ //Provides a count of unsubmitted orders
+ unsub_ord_count:= count(unsub_ord) As Number;
+
+
+ //Retrieves additional information from the first order
+
+ (client_guid, chart_guid, client_visit_guid, user_guid):= read last {Order: ClientGUID, chartguid, ClientVisitGUID, UserGUID
+ REFERENCING EvokingObject};
+ should_fire := false;
+
+
+ if unsub_ord_count = 0 then
+
+ // does this chart already have an infusion order?
+ infus_curr := 0;
+ infus_curr := read last {" select count(*) "
+ || " from cv3order as o with (nolock) "
+ || " join cv3ordercatalogmasteritem as ocmi "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.name ={{{SINGLE-QUOTE}}}Infusion Center Consult{{{SINGLE-QUOTE}}} "
+ || " where o.clientguid = " || SQL(client_guid)
+ || " and o.chartguid = " || SQL(chart_guid) } ;
+
+ if (infus_curr=0) then
+
+ // has patient been discharged to hospice in the last day? and have a Infusion order ordered?
+ hosp_count := 0;
+ hosp_count := read last {" select count(*) "
+ || " from cv3clientvisit as cv with (nolock) "
+ || " join cv3order as o with (nolock) "
+ || " on o.clientguid = cv.clientguid "
+ || " and o.chartguid = cv.chartguid "
+ || " join cv3ordercatalogmasteritem as ocmi "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.name ={{{SINGLE-QUOTE}}}Infusion Center Consult{{{SINGLE-QUOTE}}} "
+ || " where cv.clientguid = " || SQL(client_guid)
+ || " and cv.dischargedtm >= getdate() -1 "
+ || " and cv.DischargeDisposition like {{{SINGLE-QUOTE}}}%Hospice%{{{SINGLE-QUOTE}}} "
+ };
+
+
+ if hosp_count >0 then
+ should_fire := true;
+
+ (hosp_acc, hosp_location, hosp_admitdtm, hosp_disdtm)
+ := read last {" select visitidcode, currentlocation, convert(varchar(20), admitdtm , 9), convert(varchar(20), dischargedtm , 9)"
+ || " from cv3clientvisit as cv with (nolock) "
+ || " join cv3order as o with (nolock) "
+ || " on o.clientguid = cv.clientguid "
+ || " and o.chartguid = cv.chartguid "
+ || " join cv3ordercatalogmasteritem as ocmi "
+ || " on ocmi.guid = o.ordercatalogmasteritemguid "
+ || " and ocmi.name ={{{SINGLE-QUOTE}}}Infusion Center Consult{{{SINGLE-QUOTE}}} "
+ || " where cv.clientguid = " || SQL(client_guid)
+ || " and cv.dischargedtm >= getdate() -1 "
+ || " and cv.DischargeDisposition like {{{SINGLE-QUOTE}}}%Hospice%{{{SINGLE-QUOTE}}} "
+ };
+ MessageText := "This Patient was Discharged to Hospice on " || hosp_disdtm || " from " || hosp_location || "\n" ||
+ " Account Number " || hosp_acc || " Admitted " || hosp_admitdtm || "\n\n" ||
+ "Please remember to reenter an {{+B}}{{+R}}Infusion Center Consult On This Patient{{-B}}{{-R}}";
+ endif;
+
+ endif; // infus_curr
+
+ endif; // unsub_ord_count
+
+ ;;
+ evoke: evoking_event_order
+ ;;
+ logic:
+
+ conclude should_fire ;
+ ;;
+ action:
+ Write MessageText at order_alert
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_PRIVACY_STATUS_COLUMN_UPDATE.mlm b/MLMStripper/bin/Debug/SCH/SCH_PRIVACY_STATUS_COLUMN_UPDATE.mlm
new file mode 100644
index 0000000..19493fd
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_PRIVACY_STATUS_COLUMN_UPDATE.mlm
@@ -0,0 +1,127 @@
+maintenance:
+
+ title: SCH_PRIVACY_STATUS_COLUMN_UPDATE;;
+ mlmname: SCH_PRIVACY_STATUS_COLUMN_UPDATE;;
+ arden: version 2.50;;
+ version: 18.4;;
+ institution: St. Clair Hospital;;
+ author: Teresa Spicuzza ;;
+ specialist: Steve Jones ;;
+ date: 2019-08-14;;
+ validation: testing;;
+
+library:
+ purpose: Add value to Enterprise Defined Column Privacy
+
+ ;;
+
+ explanation: Create column
+
+
+ Change history
+
+ 08.13.2019 TMS CSR # Created to populate enterprise defined column for Privacy based upon value Privacy Status of "Opt Out Of Directory"
+
+ ;;
+ keywords: ObjectsPlus/XA, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ log_execution_info := false;
+ update_column := false;
+ privacy_col_value := "";
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ visit_enter_event := event{ClientVisitEnter Any ClientVisit};
+ visit_modify_event:= event{ClientVisitModify Any ClientVisit};
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last { UserInfo : THIS };
+ endif;
+
+
+
+ (UserDisplayaName ) := read last { UserInfo: Displayname };
+
+
+ if EvokingEventType = "ClientVisitEnter" or EvokingEventType = "ClientVisitModify"
+ then
+ (client_guid, chart_guid, client_visit_guid, PrivacyStatusGUID) := read last {ClientVisit: clientguid, chartguid, guid, PrivacyStatusGUID REFERENCING EvokingObject};
+ endif;
+
+ if EvokingEventType = "ClientVisitEnter" OR ( UserDisplayaName <> "Interface" AND evokingEventType = "ClientVisitModify" )
+ THEN
+
+
+ PrivacyStatusValue := read last
+ {" select ps.Code from cv3PrivacyStatus ps
+ where ps.GUID = " || PrivacyStatusGUID
+ };
+
+
+ If PrivacyStatusValue = "Opt Out of Directory" then
+ Privacy_Column_Value := "DISCLOSE NO INFORMATION";
+ update_column := true;
+ else
+ Privacy_Column_Value := "";
+ update_column := true;
+
+ endif;
+ endif;
+ ;;
+ priority: 50
+ ;;
+ evoke:
+
+ visit_enter_event ;
+ visit_modify_event ;
+
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ if ( update_column = true AND ( EvokingEvent = visit_enter_event OR EvokingEvent = visit_modify_event ) ) then
+
+ Privacy_Col := NEW EDCObj WITH [
+ column_name := "Privacy",
+ column_value := Privacy_Column_Value,
+ client_guid := Client_GUID,
+ chart_guid := Chart_GUID,
+ client_visit_guid := Client_Visit_GUID
+ ];
+
+ return_value := call create_ED_column with ( Privacy_Col );
+ conclude true;
+
+
+ endif;
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_PROBIOTIC_PROTOCOL.mlm b/MLMStripper/bin/Debug/SCH/SCH_PROBIOTIC_PROTOCOL.mlm
new file mode 100644
index 0000000..780f235
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_PROBIOTIC_PROTOCOL.mlm
@@ -0,0 +1,441 @@
+maintenance:
+
+ title: Probiotic Protocol for Antibiotic Ordering;;
+ mlmname: SCH_Probiotic_Protocol;;
+ arden: version 2;;
+ version: 5.50;;
+ institution: St Clair;;
+ author: Bryan Berkeybile;;
+ specialist: Don Warnick;;
+ date: 2013-09-22;;
+ validation: testing;;
+
+library:
+ purpose: Probiotic Ordering
+ ;;
+
+ explanation: The MLM will create an order for a Probiotic if a patient is prescribed and antibiotic
+
+ Change history
+ 09.22.2013 DW CSR# 31693 Created
+ 10.24.2013 DW CSR# 31693 - Now the MLM supplies the session type (of the evoking antibiotic) to the Order Create MLM
+ Also, active orders has been redifined as >=15 (includes held orders)
+ 10.31.2013 DW CSR# 31693 - Converted the lab result to a number
+ 11.13.2013 DW CSR# 31693 - Pass Order Source Value to Order Creation Functional MLM
+ 01.14.2014 DW HD# 163173 - Exclude orders from the "Family Birth Center Admission" Order Set
+ 08.03.2015 GOS CSR :33324 -Exclusion for All Inflammatory Bowel Disease with inflixamab and adalimumab medication orders
+ Pop-up Message for User if Patient Already ordered with [inflixamab or adalimumab] orders.
+ 12.20.2017 TMS CSR# 35886 - Add logic for 1)when patient ordered an antifungal to auto discontinue the Florastor;
+ 2) to not order Florastor when an appropriate antibiotic is ordered if the patient is
+ already on an antifungal;
+ 3) Warn the user if an antifungal and florastor are being ordered in the same session.
+ 10.29.2018 TMS CSR# 37374 - Remove auto order entry of Florastor for patients ordered antibiotics. Maintain alerting for patients on
+ Florastor who are receiving Adalimumab or Infliximab, patients on florastor who are being order an antifungal
+ and a hard stop for patients with Absolute Neutrophil Count (ANC) less than 1 K/UL.
+ ;;
+ keywords: Probiotic Ordering
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ log_execution_info := false;
+
+ send_alert := "DoNotSend";
+ hard_stop := false;
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+
+ if called_by_editor
+ then EvokingObject := read last {Order: THIS where Name="Loratadine 10mg Tab" };
+ endif;
+
+ order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"
+ and (OrderSetName <> "Family Birth Center Admission" or OrderSetName is null) // changed 1/14/14
+ and InitialSessionTypeCode <> "Discharge"
+ and not (Name matches pattern "%flush%")
+ and not (Name matches pattern "%lock%")
+ and not (Name matches pattern "%zz%")
+ and not (Name matches pattern "%Neomycin%Enema%")
+ and Name <> "Vancomycin Soln"
+ and Name <> "Sulfasalazine 500mg Tab"
+ and Name <> "Saccharomyces Boulardi 250mg Cap"
+ };
+ order_init_event := event { OrderInit User Order: where TypeCode = "Medication"
+ and Name = "Saccharomyces Boulardi 250mg Cap"
+ };
+ (unsubmitted_florastor) := READ {UnsubmittedOrders: Name WHERE Name = "Saccharomyces Boulardi 250mg Cap"};
+
+ number_unsub_florastor := count (unsubmitted_florastor);
+
+ (unsubmitted_antifungal) := READ {UnsubmittedOrders: Name WHERE (Name MATCHES PATTERN "Fluconazole%")
+ or (Name MATCHES PATTERN "Micafungin%")
+ or (Name MATCHES PATTERN "Voriconazole%")
+ or (Name MATCHES PATTERN "Ketoconazole 200%")
+ or (Name = "Amphotericin B Liposome:")
+ or (Name = "Amphotericin B:")} ;
+
+ number_unsub_antifungal := count (unsubmitted_antifungal);
+
+
+
+ userguid :=read last {UserInfo: guid};
+
+ (OrderAdditionalInfoObj, SessionType) := read last { Order: OrderAdditionalInfo, InitialSessionTypeCode REFERENCING EvokingObject };
+
+ (CatalogItemObj, FrequencyValue) := read last {Order: OrderCatalogMasterItem, FrequencyCode REFERENCING EvokingObject};
+
+ (ClientVisitGuid, ChartGuid, ClientGuid, VisitType) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode};
+ (birthdate, birth_year ) := read last { ClientInfo: birthdate, BirthYearNum };
+
+
+ // Determine if the patient is over 18 // not needed tms
+/*
+ if exist birthdate and birth_year > 0 and birthdate is time
+ then
+ patient_age:= (NOW - birthdate) / (1 year);
+ // NOW_DateOnly:= (NOW formatted with "%.2t") as time;
+ // patient_age2 := (NOW_DateOnly - birthdate) / (1 year);
+ endif;
+*/
+//=====
+
+ (ActiveOrderPresent, OrderGuid) := read last
+ { " select o.name, o.guid "
+ || " from cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
+ || " and (o.name = {{{SINGLE-QUOTE}}}Saccharomyces Boulardi 250mg Cap{{{SINGLE-QUOTE}}}) "
+ || " and o.OrderStatusLevelNum >= 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ };
+
+
+ (AntifungalGuidList) := read
+ { " select Guid from cv3ordercatalogmasteritem where TherapeuticCategory = {{{SINGLE-QUOTE}}}anti-infectives | antifungals{{{SINGLE-QUOTE}}} "
+ || " and (name not like {{{SINGLE-QUOTE}}}%irrigation%{{{SINGLE-QUOTE}}} and name not like {{{SINGLE-QUOTE}}}%_IPRO{{{SINGLE-QUOTE}}})"
+ || " and ExpiryDate is null"
+ };
+
+ (ActiveAntifungal) := read
+ { " select o.name "
+ || " from cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
+ || " and o.OrderCatalogMasterItemGUID in (" || AntifungalGuidList || ")"
+ || " and o.OrderStatusLevelNum >= 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ };
+
+
+ LabResult := read last
+ { " Select top 1 bo.value from cv3BasicObservation bo where "
+ || " (bo.itemname = {{{SINGLE-QUOTE}}}Absolute Neutrophil Count (ANC){{{SINGLE-QUOTE}}} or bo.itemname = {{{SINGLE-QUOTE}}}Absolute Neutrophils{{{SINGLE-QUOTE}}}) and bo.value is not NULL and bo.IsHistory = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
+ || " and bo.clientguid = " || SQL(ClientGuid) || " and bo.chartguid = " || SQL(ChartGuid) || " and bo.ClientVisitGUID = " || SQL(ClientVisitGuid) || " "
+ || " order by bo.TouchedWhen desc "
+ };
+
+ // Added By Shivprasad Jadhav for CSR :33324- Florastor Protocol
+ Ord_OBJECT := OBJECT [Obs_Name, Obs_EnteredDtm , Obs_StatusCode] ;
+ Medi_OrderPresent := read as Ord_OBJECT { " select o.name ,o.Entered, o.OrderStatusCode "
+ || " from CV3Order o With (Nolock) Join Cv3ClientVisit cv With (Nolock) On o.ClientVisitGUID=cv.Guid And o.ClientGUID =cv.ClientGUID "
+ || " where o.ClientVisitGUID = " || SQL(ClientVisitGuid)
+ || " And o.clientguid = " || SQL(ClientGuid)
+ || " and o.ChartGUID = " || SQL(ChartGuid)
+ || " AND o.name in ({{{SINGLE-QUOTE}}}Infliximab:{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Adalimumab Inj{{{SINGLE-QUOTE}}}) "
+ || " Order By o.Entered Desc " };
+
+ If (EVOKINGOBJECT.Name = "Saccharomyces Boulardi 250mg Cap") And exists ActiveAntiFungal Then
+
+ info_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n This patient is already on an antifungal " || ActiveAntiFungal || ", which will diminish the effectiveness of Florastor. "
+ || "\n\n Recommend avoiding the use of Florastor with systemic antifungals. "
+ ,"Patient Receiving AntiFungal Medication", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ Endif;
+
+ If (EVOKINGOBJECT.Name = "Saccharomyces Boulardi 250mg Cap") And number_unsub_antifungal = 1 Then
+
+ unsub_info_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n This patient has an unsubmitted order for an antifungal which will diminish the effectiveness of Florastor: "
+ || "\n " || unsubmitted_antifungal [1]
+ || "\n\n Recommend avoiding the use of Florastor with systemic antifungals. "
+ ,"Unsubmitted AntiFungal Order", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ Endif;
+
+ If (EVOKINGOBJECT.Name = "Saccharomyces Boulardi 250mg Cap") And number_unsub_antifungal > 1 Then
+
+ unsub_info_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n This patient has " || number_unsub_antifungal ||" unsubmitted orders for antifungals which will diminish the effectiveness of Florastor: "
+ || "\n " || unsubmitted_antifungal
+ || "\n\n Recommend avoiding the use of Florastor with systemic antifungals. "
+ ,"Unsubmitted AntiFungal Orders", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+ Endif;
+
+ If (EVOKINGOBJECT.Name = "Saccharomyces Boulardi 250mg Cap") And ((LabResult as number) < 1 ) Then
+
+ // alert destination
+
+ order_alert_dest := destination {alert} with
+ [alert_type := warning,
+ short_message := "Florastor Order Conflict",
+ priority := "High",
+ scope := Chart,
+ rule_group := "Florastor Order Conflict",
+ rule_number := 4020,
+ send_with_order := "DoNotSend",
+ alert_dialog_settings := "No Override Allowed",
+ display_alert := true];
+
+ // alert message
+
+ alert_message := "{{+B}}You are attempting to order " || EVOKINGOBJECT.Name || "." || CRLF ||"This patient has an Absolute Neutrophil Count (ANC) of {{+R}}" || LabResult|| " K/UL. {{-R}}"
+
+ ||CRLF || "Saccharomyces boulardii is CONTRAINDICATED in patients with neutropenia due to increased risk of infection."
+ || CRLF || CRLF || "{{+R}}You MAY NOT PROCEED with this order. {{-R}} {{-B}} ";
+
+ hard_stop := true;
+
+ Endif;
+
+ If (EVOKINGOBJECT.Name in ("Infliximab:","Adalimumab Inj")) And exists ActiveOrderPresent Then
+
+ Ordername := Read Last {"select replace ({{{SINGLE-QUOTE}}}" || EVOKINGOBJECT.Name || "{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}:{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) " };
+
+ dlg_result_Florastor := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n This patient is receiving Florastor. If " || Ordername || " is being used for Inflammatory Bowel Disease, "
+ || " please discontinue the Florastor. Patients with acute flares of IBD may be at higher risk of developing Saccharomyces infections."
+ ,"Medication Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Endif;
+
+//==========================================
+/*
+ // Proceed if this is an inpatient/observation patient 18 or over and the drug is not of certain classes
+
+ If (VisitType = "inpatient" or VisitType = "observation" or VisitType = "emergency")
+ and patient_age >= 18
+ and CatalogItemObj.TherapeuticCategory matches pattern "anti-infective%"
+ and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antiviral agents"
+ and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antifungals"
+ and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antimalarial agents"
+ and CatalogItemObj.TherapeuticCategory <> "anti-infectives | antituberculosis agents"
+ and CatalogItemObj.TherapeuticCategory <> "anti-infectives | anthelmintics"
+ then
+
+ // Convert the Frequency Code to Doses Per Day
+
+ DosesPerDay := read last
+ { " select count (fsd.ScheduledTime) from CV3CodedFreqTranslation cft "
+ || " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
+ || " where cft.FrequencyCode = " || SQL(FrequencyValue) || " "
+ || " and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.active = 1 "
+ };
+
+ // Determine the "time from value" for Frequency Codes < 1 per day (i.e. Q48H, Weekly etc)
+
+ TimeFromValue := read last
+ { " select cft.TimeFromValue from CV3CodedFreqTranslation cft "
+ || " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
+ || " where cft.FrequencyCode = " || SQL(FrequencyValue) || " "
+ || " and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.active = 1 "
+ };
+
+
+ // Gather data from the stop fields
+
+ if OrderAdditionalInfoObj.StopAfterOption = 1 then StopAfterOption := "Days";
+ elseif OrderAdditionalInfoObj.StopAfterOption = 2 then StopAfterOption := "Hours";
+ elseif OrderAdditionalInfoObj.StopAfterOption = 3 then StopAfterOption := "Minutes";
+ elseif OrderAdditionalInfoObj.StopAfterOption = 4 then StopAfterOption := "Times";
+ endif;
+
+ StopAfterNumber := OrderAdditionalInfoObj.StopAfterValue;
+
+
+ if StopAfterOption is null and DosesPerDay > 0 then DurationOver72 := "true";
+ elseif StopAfterOption = "Days" and StopAfterNumber > 3 then DurationOver72 := "true";
+ elseif StopAfterOption = "Hours" and StopAfterNumber > 72 then DurationOver72 := "true";
+ elseif StopAfterOption = "Minutes" and StopAfterNumber > 4320 then DurationOver72 := "true";
+
+ elseif StopAfterOption = "Times" and TimeFromValue = 1
+ and StopAfterNumber > (3 * DosesPerDay) then DurationOver72 := "true";
+
+ elseif StopAfterOption = "Times" and TimeFromValue > 1
+ and (TimeFromValue * StopAfterNumber) > 3 then DurationOver72 := "true";
+
+ elseIf FrequencyValue = "" then DurationOver72 := "true";
+ else DurationOver72 := "false";
+ endif;
+
+ // Determine if the patient has a Lab ANC value over 1000
+
+ LabResult := read last
+ { " Select top 1 bo.value from cv3BasicObservation bo where "
+ || " (bo.itemname = {{{SINGLE-QUOTE}}}Absolute Neutrophil Count (ANC){{{SINGLE-QUOTE}}} or bo.itemname = {{{SINGLE-QUOTE}}}Absolute Neutrophils{{{SINGLE-QUOTE}}}) and bo.value is not NULL and bo.IsHistory = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
+ || " and bo.clientguid = " || SQL(ClientGuid) || " and bo.chartguid = " || SQL(ChartGuid) || " and bo.ClientVisitGUID = " || SQL(ClientVisitGuid) || " "
+ || " order by bo.TouchedWhen desc "
+ };
+
+ // Check for an active Saccharomyces Order on the account
+//=================================================================================================================================================================
+ // This portion of MLM is moved on upper side of MLM
+ /*(ActiveOrderPresent) := read last
+ { " select o.name "
+ || " from cv3ordercatalogmasteritem as ocmi with (nolock) "
+ || " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
+ || " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || ClientVisitGuid || " "
+ || " and (o.name = {{{SINGLE-QUOTE}}}Saccharomyces Boulardi 250mg Cap{{{SINGLE-QUOTE}}}) "
+ || " and o.OrderStatusLevelNum >= 15 "
+ || " and o.OrderStatusLevelNum not in (69, 70) "
+ };
+
+ // Added By Shivprasad Jadhav for CSR :33324- Florastor Protocol
+ Ord_OBJECT := OBJECT [Obs_Name, Obs_EnteredDtm , Obs_StatusCode] ;
+ Medi_OrderPresent := read as Ord_OBJECT { " select o.name ,o.Entered, o.OrderStatusCode "
+ || " from CV3Order o With (Nolock) Join Cv3ClientVisit cv With (Nolock) On o.ClientVisitGUID=cv.Guid And o.ClientGUID =cv.ClientGUID "
+ || " where o.ClientVisitGUID = " || SQL(ClientVisitGuid)
+ || " And o.clientguid = " || SQL(ClientGuid)
+ || " and o.ChartGUID = " || SQL(ChartGuid)
+ || " AND o.name in ({{{SINGLE-QUOTE}}}Infliximab:{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Adalimumab Inj{{{SINGLE-QUOTE}}}) "
+ || " Order By o.Entered Desc " };
+
+
+ //Medi_OrderPresent := "ABC";
+ If (exists Medi_OrderPresent or (EVOKINGOBJECT.Name in ("Infliximab:","Adalimumab Inj")) ) And exists ActiveOrderPresent Then
+ Ordername := Last of(Medi_OrderPresent.Obs_Name where Medi_OrderPresent.Obs_EnteredDtm Is Not Null And Medi_OrderPresent.Obs_StatusCode Is Not Null );
+ //Ordername :="XYZ";
+
+ dlg_result_Florastor := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n This patient is receiving Florastor. If " || Ordername|| " is being used for Inflammatory Bowel Disease, "
+ || "\n\n please discontinue the Florastor. Patients with acute flares of IBD may be at higher risk of developing Saccharomyces infections."
+ ,"Medication Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ Endif; */
+/*
+//Start :Added By Shivprasad Jadhav for CSR :33324- Florastor Protocol =============================================
+
+ (Healthissue) := read { " select distinct hid.shortname, chi.code, chi.typecode, hid.typecode "
+ ||" from cv3healthissuedeclaration hid with (nolock) "
+ ||" join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
+ ||" where hid.clientguid = " || ClientGuid
+ ||" and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
+ ||" and chi.typecode in ({{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt-Stated Hx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}AMB Med History{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Skin Tests{{{SINGLE-QUOTE}}}) "
+ ||" And Hid.ShortName in({{{SINGLE-QUOTE}}}Crohn{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}s disease{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Inflammatory bowel disease (Crohn{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}s disease){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Inflammatory bowel disease (ulcerative colitis){{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Ulcerative Colitis{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Inflammatory bowel disease in pediatric patient{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Inflammatory bowel disease{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Chronic inflammatory small bowel disease{{{SINGLE-QUOTE}}}, "
+ ||" {{{SINGLE-QUOTE}}}Personal history of inflammatory bowel disease{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}H/O inflammatory bowel Disease{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}idiopathic chronic inflammatory Bowel Disease{{{SINGLE-QUOTE}}}) "
+ ||" and chi.code in ({{{SINGLE-QUOTE}}}558.9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}555.9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}556.9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V12.79{{{SINGLE-QUOTE}}}) " };
+
+
+//End :Added By Shivprasad Jadhav for CSR :33324- Florastor Protocol ===========================================
+
+ // Is the patient a candidate for a Probiotic Order?
+
+ if DurationOver72 = "true"
+ and ((LabResult as number) >= 1 or not exist LabResult)
+ and ( not exists ActiveOrderPresent )
+ and ( not exists ActiveAntifungal )
+ And ( Not exists Healthissue )
+ And ( Not exists Medi_OrderPresent )
+ and ( Not exists unsubmitted_antifungal)
+ then
+
+ // Inform the user of the order to be created
+
+ dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n This patient has met the criteria for the Probiotic Protocol. "
+ || "\n\n An order for Florastor 500 mg PO BID will be automatically created. "
+ ,"Probiotic Protocol Order to be Entered", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ // Ceate the order
+ // If the user selects another careprovider (Nurse or US entry), pass the requestors user ID
+
+ if userguid <> EVOKINGOBJECT.CareProviderGUID then
+ userguid := EVOKINGOBJECT.CareProviderGUID;
+ endif;
+
+ create_CHF_order := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ORDER{{{SINGLE-QUOTE}}};
+ var := call create_CHF_order WITH (ClientVisitGuid, userguid, ClientGuid, SessionType,"Protocol Order", "Saccharomyces Boulardi 250mg Cap" , "Probiotic Protocol", "Medication");
+
+ endif; // Is the patient a candidate for a Probiotic Order?
+
+ endif; // Visit Type is Inpatient or Observation Patient 18 years or older
+*/
+ If (VisitType = "inpatient" or VisitType = "observation" or VisitType = "emergency")
+ and CatalogItemObj.TherapeuticCategory = "anti-infectives | antifungals"
+ and ActiveOrderPresent is not null and CatalogItemObj.GUID in AntifungalGuidList
+ then
+
+ dc_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n This patient has an active order for Florastor 500 mg. Antifungals diminish the benefit of Florastor. "
+ || "\n\n Do you wish to discontinue the Florastor?"
+ || "\n\n Select YES to discontinue the Florastor order."
+ || "\n\n Select NO to keep the Florastor order and continue."
+ ,"Probiotic Protocol Order to be Discontinued", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+
+ if((dc_message as string) = "Yes") then
+
+ if userguid <> EVOKINGOBJECT.CareProviderGUID then
+ userguid := EVOKINGOBJECT.CareProviderGUID;
+ endif;
+
+ Reason := "Patient Ordered Antifungal Medication";
+ Source := "Protocol Order";
+ DC_Probiotic_order := mlm {{{SINGLE-QUOTE}}}SCH_Func_Discontinue_By_OrderGuid{{{SINGLE-QUOTE}}};
+ dcord := call DC_Probiotic_order WITH (OrderGuid, userguid, ClientVisitGuid, Reason, Source);
+ endif;
+ endif;
+
+ If (VisitType = "inpatient" or VisitType = "observation" or VisitType = "emergency")
+ and CatalogItemObj.TherapeuticCategory = "anti-infectives | antifungals"
+ and number_unsub_florastor >= 1 and CatalogItemObj.GUID in AntifungalGuidList
+ then
+
+
+ delete_message := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
+ "\n This patient has an unsubmitted order for Florastor 500 mg. Please delete the order from the worksheet before submitting. "
+ || "\n\n Antifungals diminish the benefit of Florastor. "
+ ,"Unsubmitted Probiotic Order", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Information" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
+
+ endif;
+
+
+
+ ;;
+ priority: 50
+ ;;
+ evoke: order_enter_event;
+ order_init_event;
+
+
+ ;;
+ logic:
+
+ if called_by_editor
+ then
+ conclude false;
+ endif;
+
+ if EvokingObject is null
+ then
+ conclude false;
+ else
+
+ conclude hard_stop;
+ endif;
+
+ ;;
+ action:
+
+ write alert_message at order_alert_dest;
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_PULMONARY_VISIT_COLUMN_UPDATE.mlm b/MLMStripper/bin/Debug/SCH/SCH_PULMONARY_VISIT_COLUMN_UPDATE.mlm
new file mode 100644
index 0000000..6e4f650
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_PULMONARY_VISIT_COLUMN_UPDATE.mlm
@@ -0,0 +1,231 @@
+maintenance:
+
+ title: SCH_PULMONARY_VISIT_COLUMN_UDPATE;;
+ mlmname: SCH_PULMONARY_VISIT_COLUMN_UPDATE;;
+ arden: version 2.50;;
+ version: 16.3;;
+ institution: St. Clair Hospital;;
+ author: Juliet M. Law, Allscripts Corp, x7461;;
+ specialist: Janet Nordin, Allscripts Corp, x7428;;
+ date: 2019-03-12;;
+ validation: testing;;
+
+library:
+ purpose: Add value to Enterprise Defined Column on Pulmonary Visit List when a document is entered on a patient.
+
+ ;;
+
+ explanation: When a user with a specialty of "Pulmonary" saves a Consult eNote or Physician Progress Note or Discharge Summary document, update the Pulmonary
+ Visit List "Pulmonary" Enterprise Defined Column with the value "Patient Seen".
+
+
+ Change history
+
+ 03.12.2019 JML CSR #35844 Created
+
+ ;;
+ keywords: ObjectsPlus/XA, Pulmonary, Enterprise Defined Column
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ //Include parsing MLM
+ //str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ //Include generic function to update enterprise defined column
+ create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
+
+ log_execution_info := false;
+ update_column := false;
+ pulmonary_col_value := "";
+
+ //Create Enterprise Defined Column Obj
+ EDCObj := OBJECT [
+ column_name,
+ column_value,
+ client_guid,
+ chart_guid,
+ client_visit_guid
+ ];
+
+ //Event Triggers
+ client_doc_enter := event {ClientDocumentEnter User ClientDocument :
+ WHERE DocumentName = "Physician Progress Note"
+ OR DocumentName = "Consult eNote"
+ OR DocumentName = "Day of Discharge Summary eNote" };
+ client_doc_modify := event {ClientDocumentModify User ClientDocument :
+ WHERE DocumentName = "Physician Progress Note"
+ OR DocumentName = "Consult eNote"
+ OR DocumentName = "Day of Discharge Summary eNote" };
+
+ user_logon := event { ActivateApplication User UserInfo :
+ WHERE CareProvider IS NOT NULL
+ AND ( OrderRoleType matches pattern "%Physician%"
+ OR OrderRoleType = "CRNP" ) };
+
+
+ //--------------------------------------------------------------------
+ if called_by_editor
+ then
+ EvokingObject := read last { UserInfo : THIS };
+ endif;
+
+
+ //Retrieve relevant GUIDs
+ ActiveClient_Visit_GUID := EvokingObject.ClientVisitGUID;
+ ActiveClient_GUID := EvokingObject.ClientGUID;
+ ActiveChart_GUID := EvokingObject.ChartGUID;
+
+ care_prov_obj := read last { UserInfo : CareProvider };
+
+ user_discipline := care_prov_obj.Discipline;
+
+
+ if ( user_discipline = "Pulmonary" ) then
+ if ( EvokingEvent = user_logon ) then
+ //Retrieve a list of patient{{{SINGLE-QUOTE}}}s that have the Infectious Disease column value
+ (col_client_guid,
+ col_visit_guid) := read {"Declare @colName varchar(50)"
+ || ""
+ || "SELECT @colName = DataColumnName"
+ || " FROM CV3EnterpriseColumnDef ecd WITH (NOLOCK) JOIN CV3EnterpriseColumnData ecd2 WITH (NOLOCK)"
+ || " ON ecd.GUID = ecd2.ColumnDefinitionGUID"
+ || " WHERE ColumnLabel = {{{SINGLE-QUOTE}}}Pulmonary{{{SINGLE-QUOTE}}}"
+ || ""
+ || " EXEC ({{{SINGLE-QUOTE}}}SELECT cv.ClientGUID, evd.VisitGUID{{{SINGLE-QUOTE}}} + "
+ || " {{{SINGLE-QUOTE}}} FROM CV3EnterpriseVisitData evd WITH (NOLOCK) JOIN CV3CLIENTVISIT cv WITH (NOLOCK){{{SINGLE-QUOTE}}} +"
+ || " {{{SINGLE-QUOTE}}} ON evd.VisitGUID = cv.GUID{{{SINGLE-QUOTE}}} +"
+ || " {{{SINGLE-QUOTE}}} WHERE {{{SINGLE-QUOTE}}} + @colName + {{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}Patient Seen{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}"
+ || " AND VisitGUID is not null"
+ || " ORDER BY evd.touchedWhen{{{SINGLE-QUOTE}}})"};
+
+ if ( ( count col_client_guid ) > 0 ) then
+
+ update_column := true;
+ pulmonary_col_value := ();
+ pulmonary_client_guid := ();
+ pulmonary_visit_guid := ();
+
+ //Loop through patients that have Infectious Disease column value
+ for i IN 1 seqto ( count col_client_guid ) do
+ //Check for last time Infectious Disease column was valued
+ doc_client_guid := col_client_guid[i];
+ doc_visit_guid := col_visit_guid[i];
+
+ last_doc_update := read last {"SELECT cd.AuthoredDtm"
+ || " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocumentCUR cd WITH (NOLOCK)"
+ || " ON cv.CLIENTGUID = cd.ClientGUID"
+ || " AND cv.GUID = cd.ClientVisitGUID"
+ || " AND cv.ChartGUID = cd.ChartGUID"
+ || " JOIN CV3ClientDocDetailCUR cdd WITH (NOLOCK)"
+ || " ON cd.GUID = cdd.ClientDocumentGUID"
+ || " AND cd.ClientGUID = cdd.ClientGUID"
+ || " WHERE cv.ClientGUID = " || Sql(doc_client_guid)
+ || " AND cv.GUID = " || Sql(doc_visit_guid)
+ || " AND ( cd.DocumentName IN ( {{{SINGLE-QUOTE}}}Physician Progress Note-Pulmonary{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}Consult eNote-Pulmonary{{{SINGLE-QUOTE}}},"
+ || " {{{SINGLE-QUOTE}}}Day of Discharge Summary eNote-Pulmonary{{{SINGLE-QUOTE}}} ))"
+ || " ORDER BY cd.AuthoredDtm ASC"};
+
+ //Format dates to strings for easier comparision cuz dates/time in Arden stink
+ //last_str_date := extract month last_col_update[i] || "-" || extract day last_col_update[i] || "-" || extract year last_col_update[i];
+ last_str_date := extract month last_doc_update || "-" || extract day last_doc_update || "-" || extract year last_doc_update;
+ curr_str_date := extract month now || "-" || extract day now || "-" || extract year now;
+
+ //If Pulmonary document was entered today, then keep column value
+ //If Pulmnary document was entered yesterday, then clear column value
+ if ( ( last_str_date as string ) = ( curr_str_date as string ) ) then
+ pulmonary_col_value := (pulmonary_col_value, "Patient Seen");
+ pulmonary_client_guid := ( pulmonary_client_guid, doc_client_guid);
+ pulmonary_visit_guid := ( pulmonary_visit_guid, doc_visit_guid);
+
+ elseif ( ( last_str_date as string ) <> ( curr_str_date as string ) ) then
+ pulmonary_col_value := (pulmonary_col_value, "");
+ pulmonary_client_guid := ( pulmonary_client_guid, doc_client_guid);
+ pulmonary_visit_guid := ( pulmonary_visit_guid, doc_visit_guid);
+ endif;
+
+ enddo;
+
+ else
+ update_column := false;
+ endif;
+ else
+
+ if ( EvokingEvent = client_doc_modify ) then
+ //Extract authored DateTime from document currently being modified
+ curr_doc_authored := extract month EvokingObject.AuthoredDtm || "-" || extract day EvokingObject.AuthoredDtm || "-" || extract year EvokingObject.AuthoredDtm;
+ curr_str_date := extract month now || "-" || extract day now || "-" || extract year now;
+
+ if ( ( last_str_date as string ) = ( curr_str_date as string ) ) then
+ update_column := true;
+ pulmonary_col_value := "Patient Seen";
+ elseif ( ( last_str_date as string ) <> ( curr_str_date as string ) ) then
+ update_column := false;
+ pulmonary_col_value := "";
+ endif;
+
+ else
+ update_column := true;
+ pulmonary_col_value := "Patient Seen";
+ endif;
+ endif;
+ endif;
+
+ ;;
+ priority: 50
+ ;;
+ evoke:
+ client_doc_enter;
+ client_doc_modify;
+ user_logon;
+ ;;
+ logic:
+ if ( EvokingObject is null ) then
+ conclude false;
+ endif;
+
+ if ( update_column = true AND ( EvokingEvent = client_doc_enter OR EvokingEvent = client_doc_modify ) ) then
+
+ Pulmonary_Col := NEW EDCObj WITH [
+ column_name := "Pulmonary",
+ column_value := pulmonary_col_value,
+ client_guid := ActiveClient_GUID,
+ chart_guid := ActiveChart_GUID,
+ client_visit_guid := ActiveClient_Visit_GUID
+ ];
+
+ return_value := call create_ED_column with ( Pulmonary_Col );
+ conclude true;
+
+ elseif ( update_column = true AND EvokingEvent = user_logon ) then
+
+ //Loop through the Infectious Disease column values and update
+ for j IN 1 seqto ( count pulmonary_col_value ) do
+
+ Pulmonary_Col := NEW EDCObj WITH [
+ column_name := "Pulmonary",
+ column_value := pulmonary_col_value[j],
+ client_guid := pulmonary_client_guid[j],
+ chart_guid := "",
+ client_visit_guid := pulmonary_visit_guid[j]
+ ];
+
+ return_value := call create_ED_column WITH ( Pulmonary_Col );
+ enddo;
+
+ conclude true;
+ endif;
+
+ ;;
+ action:
+ ;;
+Urgency: 50;;
+end:
diff --git a/MLMStripper/bin/Debug/SCH/SCH_RANOLAZINE_MEDICATION_ALERTS.mlm b/MLMStripper/bin/Debug/SCH/SCH_RANOLAZINE_MEDICATION_ALERTS.mlm
new file mode 100644
index 0000000..399bf6c
--- /dev/null
+++ b/MLMStripper/bin/Debug/SCH/SCH_RANOLAZINE_MEDICATION_ALERTS.mlm
@@ -0,0 +1,553 @@
+maintenance:
+
+ title: SCH_RANOLAZINE_MEDICATION_ALERTS;;
+ mlmname: SCH_RANOLAZINE_MEDICATION_ALERTS;;
+ arden: version 2.5;;
+ version: 15.10;;
+ institution: St Clair;;
+ author: Teresa Spicuzza, Allscripts Corp;;
+ specialist: Amy Georgulis;;
+ date: 2016-08-17;;
+ validation: testing;;
+
+library:
+ purpose: Ranolazine Medication Alerts
+ ;;
+
+ explanation: MLM will alert user when any of the conflicting medications in the evoke statement are ordered with ranolazine greater then 500mg BID.
+
+ Change history
+
+ 08.17.2016 TMS New Alert MLM based off existing Statin Alerts for Ranolazine.
+ 05.16.2018 TMS Add "With Dialysis Treatment" to Frequency retrievals that contain As Ordered. CSR 33940
+ 09.30.2019 TMS Updated alert to require reason when alert presented to user not in physician/physician extender
+ group. CSR 37977
+
+ ;;
+ keywords: Ranolazine Medication Alert
+
+ ;;
+knowledge:
+ type: data-driven;;
+
+ data:
+
+ // Specify which .NET assemblies need to be loaded for ObjectsPlus
+ standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
+ include standard_libs;
+
+ error_occurred := false;
+ error_message := "";
+ str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
+
+ log_execution_info := false;
+
+ //Set the text for this variable to indicate whether to send the message or not
+ send_alert := "DoNotSend";
+
+ //--------------------------------------------------------------------
+ if called_by_editor then
+ EvokingObject := read last {Order: THIS
+ where Name="Ranolazine 500mg Tab" };
+ endif;
+
+ SP := " ";
+ CR := 13 formatted with "%c";
+ LF := 10 formatted with "%c";
+ CRLF:= CR||LF;
+ TAB := 9 formatted with "%c";
+ messageA := SP;
+ messageB := SP;
+ messageC := SP;
+
+ ordered_ranolazine := false;
+ continue_processing := false;
+ // rule_matches := false;
+ do_alert := false;
+ found_unsubmitted_conflicting_meds := false;
+ found_unsubmitted_ranolazine_meds := false;
+ found_existing_conflicting_meds := false;
+ msg_string := "";
+ alert_msg_lst := ();
+
+ //Declare the MLM that creates action on alert object
+ create_aoa_object := MLM {{{SINGLE-QUOTE}}}STD_Func_Create_Alert_Action_Object{{{SINGLE-QUOTE}}};
+ aoa_ActionItemStatus := "";
+ aoa_ActionItemID := "";
+ aoa_ActionItemName := "";
+ aoa_ActionEnterpriseItemID := "";
+ aa_lst := ();
+
+ ranolazine_order_enter := event { OrderEnter User Order: where TypeCode = "Medication"
+ and Name matches pattern "Ranolazine%"};
+ conflicting_order_enter := event { OrderEnter User Order: where TypeCode = "Medication"
+ and (Name = "Erythromycin:"
+ or Name = "Erythromycin 250mg EC Tab"
+ or Name = "Erythromycin 500mg EC Tab"
+ or Name = "Erythromycin Ethylsuccinate Susp"
+ or Name matches pattern "Fluconazole%"
+ or Name matches pattern "Verapamil%"
+ or Name matches pattern "Diltiazem%")
+ };
+
+ /* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
+ (user_id,userguid) :=read last {UserInfo: idcode, guid};
+
+ UserCode, OrderRole := read last
+ {"Select occupationcode, orderroletype "
+ ||" From cv3user with (nolock) "
+ ||" Where Guid = " || SQL(userguid) };
+
+ fire_on_UserCPOE := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT");
+
+ If usercode in fire_on_UserCPOE then
+ alert_settings := "";
+ UDDD_dictionary_name := "";
+ UDDD_is_restricted := FALSE;
+ else
+ alert_settings := "Must Comment";
+ UDDD_dictionary_name := "AlertAckComment";
+ UDDD_is_restricted := TRUE;
+ endif;
+
+
+ ranolazine_alert_dest := destination {alert} with
+ [alert_type := "Warning",
+ short_message := "Ranolazine Medication Alert",
+ priority := "Low",
+ scope := "Chart",
+ rule_group := "Ranolazine Meds",
+ rule_number := 4065,
+ send_with_order := send_alert,
+ alert_dialog_settings := alert_settings,
+ ack_comment_UDDD := UDDD_dictionary_name,
+ ack_comment_UDDD_is_restricted := UDDD_is_restricted,
+ display_alert := true];
+
+ //Retrieve values from Evoking Object
+ (ClientGUID, ChartGUID, VisitGUID,
+ evoking_OrderName, evoking_OrderGUID,
+ evoking_SignificantDtm, CatalogItemObj,
+ orderedUOMValue, orderedDoseValue, FrequencyValue,UserSchedType ,UserSchedDays, UserSchedDoses) := read last { Order : ClientGUID, ChartGUID, ClientVisitGUID, Name, GUID, SignificantDtm,
+ OrderCatalogMasterItem, UOM, DosageLow, FrequencyCode, Interval, DaysInInterval, DoseMultiplier
+ REFERENCING EvokingObject };
+ OrderAdditionalInfoObj := read last { Order: OrderAdditionalInfo
+ REFERENCING EvokingObject };
+
+ /* Get information from the OrderAdditionalInfo object */
+ (SummaryLine, FreqfromTime,FreqUOM) := read last { OrderAdditionalInfo: FreqSummaryLine, FreqFromTime, FreqUOM
+ REFERENCING OrderAdditionalInfoObj };
+
+
+
+
+ If (evoking_ordername matches pattern "Ranolazine%") then
+ if ((orderedDoseValue as number) > 500) then
+ ordertype := "ranolazine";
+ continue_processing := true;
+ highdose := true;
+ else
+ highdose := false;
+ ordertype := "ranolazine";
+ continue_processing := true;
+ endif;
+ else
+ continue_processing := true;
+ ordertype := "conflicting";
+
+ endif;
+
+ //check for ranolazine schedule > BID
+ If continue_processing = true and ordertype = "ranolazine" and highdose = false then
+
+ (schedtime, freqcode, timefrom, timeuom) := read last
+ {" select fsd.ScheduledTime, cft.FrequencyCode, cft.TimeFromValue, cft.TimeUom from CV3CodedFreqTranslation cft"
+ || " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
+ || " where cft.FrequencyCode = " || sql(frequencyvalue) || " and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.Active = 1"
+ || " order by fsd.ScheduledTime "
+ };
+
+ (TimesPerDay) := read last {" select count (fsd.ScheduledTime) from CV3CodedFreqTranslation cft"
+ || " join CV3FixedScheduleDefinition fsd on fsd.ParentGUID = cft.guid "
+ || " where cft.FrequencyCode = " || sql(frequencyvalue) || " and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.Active = 1"
+ };
+
+
+ Oncegroup := ("Now", "STAT", "Once", "One Time", "Today,", "Load", "Pre-procedure",
+ "Post-procedure","Pre-Transfusion", "Post-Transfusion","Between Blood",
+ "PRE OP,", "POST OP", "As Ordered", "As Directed", "Given in Infusion Center",
+ "Given in Delivery Room","With Dialysis Treatment");
+
+
+
+ If frequencyvalue in Oncegroup then
+ frequencygroup := "OneTime";
+ else frequencygroup := "Other";
+ endif;
+
+ if continue_processing = true and highdose = false then
+
+ If frequencyvalue <> "" and frequencygroup <> "OneTime" then
+
+ If timefrom = 1 and timeuom = "day" then
+ If TimesPerDay > 2 then
+ TooFrequent := true;
+ continue_processing := true;
+ else
+ continue_processing := false;
+ endif;
+ endif;
+
+
+ ElseIf frequencyvalue = "" then
+
+ If UserSchedType = "Daily" and UserSchedDoses > 2 and FreqFromTime = 1 and FreqUom = "day" then
+ TooFrequent := true;
+ continue_processing := true;
+ else TooFrequent := false;
+ continue_processing := false;
+ endif;
+
+
+ else TooFrequent := false;
+ continue_processing := false;
+ endif; //If frequencyvalue = ""
+ endif; // if continue_processing = true and highdose = false
+ endif; //If continue_processing = true and ordertype = "ranolazine" and highdose = false
+
+ if continue_processing = true and ordertype = "ranolazine" and (toofrequent = true or highdose = true) then
+
+ //Get list of unsubmitted orders that conflict with Ranolazine med
+ (conf_unsub_med_list,
+ conf_unsub_med_dose,
+ conf_unsub_med_UOM,
+ conf_unsub_oGUID,
+ conf_unsub_oCatGUID) := READ { Unsubmitted Order : Name, DosageLow, UOM, GUID, OrderCatalogMasterItemGUID
+ WHERE ( ( NAME matches pattern "Diltiazem%")
+ OR ( NAME matches pattern "Diltiazem%")
+ OR ( NAME matches pattern "Diltiazem%" )
+ OR ((NAME matches pattern "Erythromycin%") and (FormCode <> "Oint"))
+ OR (NAME matches pattern "Fluconazole%" )
+ OR (NAME matches pattern "Verapamil%" ) )};
+
+ if ( exists conf_unsub_med_list ) then
+ found_unsubmitted_conflicting_meds := true;
+ continue_processing := true;
+ // rule_matches := true;
+ endif;
+
+ //Get a list of relevant existing medications that conflict with ranolazine
+ (conf_existing_meds_list,
+ conf_existing_meds_name,
+ conf_existing_meds_dose,
+ conf_existing_meds_UOM,
+ conf_existing_order_guid,
+ conf_existing_oCat_guid ) := read {"SELECT LEFT(o.Name, (CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) - 1)), o.Name, ot.OrderDosageLow, ot.OrderUom, o.GUID, o.OrderCatalogMasterItemGUID "
+ || " 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 CV3OrderAddnlInfo oai WITH (NOLOCK)"
+ || " ON o.GUID = oai.GUID"
+ || " JOIN CV3OrderTask ot WITH (NOLOCK)"
+ || " ON o.GUID = ot.OrderGUID "
+ || " WHERE cv.ClientGUID = " || SQL(EvokingObject.ClientGUID)
+ || " AND cv.GUID = " || SQL(EvokingObject.ClientVisitGUID)
+ || " AND cv.ChartGUID = " || SQL(EvokingObject.ChartGUID)
+ || " AND ((o.Name LIKE {{{SINGLE-QUOTE}}}diltiazem%{{{SINGLE-QUOTE}}} )"
+ || " OR (o.Name like {{{SINGLE-QUOTE}}}erythromycin%{{{SINGLE-QUOTE}}} AND ot.OrderForm not in ({{{SINGLE-QUOTE}}}oint{{{SINGLE-QUOTE}}}))"
+ || " OR (o.Name LIKE {{{SINGLE-QUOTE}}}fluconazole%{{{SINGLE-QUOTE}}} )"
+ || " OR (o.Name LIKE {{{SINGLE-QUOTE}}}verapamil%{{{SINGLE-QUOTE}}} ))"
+ || " AND ((o.OrderStatusLevelNum > 15)"
+ || " AND (o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
+ || " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
+
+
+
+ if ( exists conf_existing_meds_list ) then
+// rule_matches := true;
+ continue_processing := true;
+ found_existing_conflicting_meds := true;
+
+ endif;
+ endif; //If continue_processing = true and ordertype = "ranolazine"
+
+ If continue_processing = true
+ and ordertype = "ranolazine"
+ and (toofrequent = true or highdose = true)
+ and found_existing_conflicting_meds = false
+ and found_unsubmitted_conflicting_meds = false then
+ continue_processing := false;
+ endif;
+
+
+ If continue_processing = true and ordertype = "conflicting" then
+ //Ordered med was a medication that conflicts with ranolazine
+ //Look for an unsubmitted order for a ranolozine orders
+ (unsub_ranolazine_list,
+ unsub_ranolazine_dose,
+ unsub_ranolazine_UOM,
+ unsub_ranolazine_oGUID,
+ unsub_ranolazine_oCatGUID,
+ unsub_ranolazine_FrequencyValue,
+ unsub_ranolazine_UserSchedType,
+ unsub_ranolazine_UserSchedDays,
+ unsub_ranolazine_UserSchedDoses ) := READ { Unsubmitted Order : Name, DosageLow, UOM, GUID, OrderCatalogMasterItemGUID, FrequencyCode, Interval, DaysInInterval, DoseMultiplier
+ WHERE ( NAME matches pattern "Ranolazine%" AND UOM = "mg")};
+ unsubhighdose := false;
+ UnsubTooFrequent := false;
+
+
+
+ if ( exists unsub_ranolazine_list ) then
+
+ for j in (1 seqto count unsub_ranolazine_list ) do
+ if (unsub_ranolazine_dose[j] as number) > 500 then
+ unsubhighdose := true;
+ endif;
+
+ If unsub_ranolazine_FrequencyValue[j] <> "