183 lines
6.2 KiB
Plaintext
183 lines
6.2 KiB
Plaintext
maintenance:
|
|
|
|
title: SCH_UNSUBMITTED_LABS;;
|
|
mlmname: SCH_UNSUBMITTED_LABS;;
|
|
arden: version 2.5;;
|
|
version: 5.50;;
|
|
institution: Allscripts;;
|
|
author: Shawn T. Head;;
|
|
specialist: Debbie Eiler and Rob Stewart;;
|
|
date: 2016-02-19;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Set local session variable to true when a type and screen order is unsubmitted
|
|
;;
|
|
explanation:
|
|
Created to check for unsubmitted repeat labs when entering the post initiation thrombolytic order set so the proper schedules can be auto calculated for the user
|
|
|
|
Change History
|
|
============================================
|
|
3.3.2016 STH CSR-33758 : Created MLM
|
|
|
|
;;
|
|
keywords: APTT, FIBRINOGEN, CBC, INR, PT/INR, PROTHROMBIN UNSUBMITTED REPEAT LABS
|
|
;;
|
|
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;
|
|
|
|
//Define events
|
|
|
|
|
|
|
|
/*
|
|
if called_by_editor then
|
|
evokingobject := read last {Order : THIS where Name = ("APTT")};
|
|
endif;
|
|
*/
|
|
OrderSet_Enter := event{OrderSetInit User Order :
|
|
where OrderSetName in ("Post Initiation Catheter Directed Thrombolytic Therapy")};
|
|
(APTT_Orders, APTT_summaryline) := Read {UnsubmittedOrders : Name, summaryline
|
|
WHERE Name = "APTT" and summaryline is not null};
|
|
(Fibrinogen_Orders, Fibrinogen_summaryline) := Read {UnsubmittedOrders : Name, summaryline
|
|
WHERE Name = "Fibrinogen" and summaryline is not null};
|
|
(CBC_Orders, CBC_summaryline) := Read {UnsubmittedOrders : Name, summaryline
|
|
WHERE Name = "CBC No Diff (Hemogram Only)" and summaryline is not null};
|
|
(INR_Orders, INR_summaryline) := Read {UnsubmittedOrders : Name, summaryline
|
|
WHERE Name = "Prothrombin/INR" and summaryline is not null};
|
|
|
|
|
|
APTT_MaxToDTTM := "";
|
|
Fibrinogen_MaxToDTTM := "";
|
|
CBC_MaxToDTTM := "";
|
|
INR_MaxToDTTM := "";
|
|
ToDTTM_start := "";
|
|
ToDTTM_End := "";
|
|
ToDTTM_Length := "";
|
|
ToDTTM_Value := "";
|
|
existing_orders := ();
|
|
summary_line := ();
|
|
UnsubmittedLabDetailsOBJ := ();
|
|
if (count(aptt_orders)>0) then
|
|
existing_orders := existing_orders, APTT_Orders;
|
|
summary_line := summary_line, APTT_summaryline;
|
|
endif;
|
|
if (count(Fibrinogen_Orders)>0) then
|
|
existing_orders := existing_orders, Fibrinogen_Orders;
|
|
summary_line := summary_line, Fibrinogen_summaryline;
|
|
endif;
|
|
if (count(CBC_Orders)>0) then
|
|
existing_orders := existing_orders, CBC_Orders;
|
|
summary_line := summary_line, CBC_summaryline;
|
|
endif;
|
|
if (count(INR_Orders)>0) then
|
|
existing_orders := existing_orders, INR_Orders;
|
|
summary_line := summary_line, INR_summaryline;
|
|
endif;
|
|
|
|
for x in (1 seqto(count(existing_orders))) do
|
|
ToDTTM_start := find "To: " in string summary_line[x];
|
|
ToDTTM_start := (ToDTTM_start as number) + 3;
|
|
ToDTTM_End := find ", " in string summary_line[x] starting at (ToDTTM_start as number);
|
|
if (ToDTTM_start > 0 and ToDTTM_End > 0 and ToDTTM_End > ToDTTM_start) then
|
|
ToDTTM_Length := (ToDTTM_End as number) - (ToDTTM_Start as number);
|
|
ToDTTM_Value := substring (ToDTTM_Length as number) characters starting at ToDTTM_start from summary_line[x];
|
|
else
|
|
ToDTTM_Length := 0;
|
|
ToDTTM_Value := "";
|
|
endif;
|
|
tod := (ToDTTM_Value as time);
|
|
tod2 := (ToDTTM_Value as string);
|
|
aptd := (APTT_MaxToDTTM as time);
|
|
aptd2 := APTT_MaxToDTTM;
|
|
ord := (existing_orders[x]);
|
|
|
|
if(existing_orders[x] = "APTT") then
|
|
if (APTT_MaxToDTTM = "") then
|
|
APTT_MaxToDTTM := (ToDTTM_Value as time);
|
|
elseif ((ToDTTM_Value as time) > (APTT_MaxToDTTM as time)) then
|
|
APTT_MaxToDTTM := (ToDTTM_Value as time);
|
|
endif;
|
|
elseif(existing_orders[x] = "Fibrinogen") then
|
|
if (Fibrinogen_MaxToDTTM = "") then
|
|
Fibrinogen_MaxToDTTM := (ToDTTM_Value as time);
|
|
elseif ((ToDTTM_Value as time) > (Fibrinogen_MaxToDTTM as time)) then
|
|
Fibrinogen_MaxToDTTM := (ToDTTM_Value as time);
|
|
endif;
|
|
elseif(existing_orders[x] = "CBC No Diff (Hemogram Only)") then
|
|
if (CBC_MaxToDTTM = "") then
|
|
CBC_MaxToDTTM := (ToDTTM_Value as time);
|
|
elseif ((ToDTTM_Value as time) > (CBC_MaxToDTTM as time)) then
|
|
CBC_MaxToDTTM := (ToDTTM_Value as time);
|
|
endif;
|
|
elseif(existing_orders[x] = "Prothrombin/INR") then
|
|
if (INR_MaxToDTTM = "") then
|
|
INR_MaxToDTTM := (ToDTTM_Value as time);
|
|
elseif ((ToDTTM_Value as time) > (INR_MaxToDTTM as time)) then
|
|
INR_MaxToDTTM := (ToDTTM_Value as time);
|
|
endif;
|
|
endif;
|
|
UnsubmittedLabDetailsOBJ := UnsubmittedLabDetailsOBJ,existing_orders[x] || " - " || summary_line[x] || "\n";
|
|
ToDTTM_start := "";
|
|
ToDTTM_End := "";
|
|
ToDTTM_Length := "";
|
|
ToDTTM_Value := "";
|
|
|
|
enddo;
|
|
|
|
Labs4LocalSessionOBJ := ();
|
|
MaxTimes4LocalSessionOBJ := ();
|
|
if ("APTT" in existing_orders) then
|
|
Labs4LocalSessionOBJ := Labs4LocalSessionOBJ, "APTT";
|
|
MaxTimes4LocalSessionOBJ := MaxTimes4LocalSessionOBJ, APTT_MaxToDTTM;
|
|
endif;
|
|
if ("Fibrinogen" in existing_orders) then
|
|
Labs4LocalSessionOBJ := Labs4LocalSessionOBJ, "Fibrinogen";
|
|
MaxTimes4LocalSessionOBJ := MaxTimes4LocalSessionOBJ, Fibrinogen_MaxToDTTM;
|
|
endif;
|
|
if ("CBC No Diff (Hemogram Only)" in existing_orders) then
|
|
Labs4LocalSessionOBJ := Labs4LocalSessionOBJ, "CBC No Diff (Hemogram Only)";
|
|
MaxTimes4LocalSessionOBJ := MaxTimes4LocalSessionOBJ, CBC_MaxToDTTM;
|
|
endif;
|
|
if ("Prothrombin/INR" in existing_orders) then
|
|
Labs4LocalSessionOBJ := Labs4LocalSessionOBJ, "Prothrombin/INR";
|
|
MaxTimes4LocalSessionOBJ := MaxTimes4LocalSessionOBJ, INR_MaxToDTTM;
|
|
endif;
|
|
|
|
if (count(existing_orders) > 0) then
|
|
local_session.SessionMaxRepeatLabNames := labs4LocalSessionOBJ;
|
|
local_session.SessionMaxRepeatLabTimes := MaxTimes4LocalSessionOBJ;
|
|
local_session.UnsubmittedRepeatLabDetails := UnsubmittedLabDetailsOBJ;
|
|
else
|
|
local_session.SessionMaxRepeatLabNames := ();
|
|
local_session.SessionMaxRepeatLabTimes := ();
|
|
local_session.UnsubmittedRepeatLabDetails := ();
|
|
endif;
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:
|
|
OrderSet_Enter;
|
|
//diet_order_event;
|
|
;;
|
|
logic:
|
|
conclude true;
|
|
;;
|
|
action:
|
|
//write alert_message at order_alert_dest;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|