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: