maintenance: title: Blood Availibility Order;; mlmname: FORM_BLOOD_AVAILIBILITY_ORDER;; arden: version 2;; version: 5.50;; institution: St Clair;; author: Maria Pest;; specialist: Don Warnick;; date: 2015-11-09;; validation: testing;; library: purpose: Automatic Medication Scheduling ;; explanation: The MLM will search past lab blood orders by order number and return the order name to a field Change history 11.09.2015 DW CSR# 32531 Created 11.24.2015 DW HD# 1952521 Corrected the issue with not searching across all visits. (was joining on cv3chart which limited it to the same visit) 04.21.2016 STH CSR#: 32165 Updated for new names to be included in MLM logic. {go-live 4/27/2016} ;; keywords: Blood Availibility Order ;; 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; error_message:=""; 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; OrderNumber := last of (field_list where field_list.DataItemName = "BB Blood Prod Avail Order ID"); OrderNumberValue:= OrderNumber.Value; OrderName := last of (field_list where field_list.DataItemName = "BB Blood Prod Avail FT"); If CallingEvent = "FieldChange" then (PastOrderName) := read last { " select " || " case when ocmi.name = {{{SINGLE-QUOTE}}}Red Cell Products{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Red Blood Cells{{{SINGLE-QUOTE}}} " || " when ocmi.name in ({{{SINGLE-QUOTE}}}Transfuse Platelets{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Products{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Platelets{{{SINGLE-QUOTE}}} " || " when ocmi.name in ({{{SINGLE-QUOTE}}}Transfuse FFP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Fresh Frozen Plasma{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Thawed Fresh Frozen Plasma{{{SINGLE-QUOTE}}}" || " when ocmi.name in ({{{SINGLE-QUOTE}}}Transfuse Cryoprecipitate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Cryoprecipitate{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Cyoprecipiate{{{SINGLE-QUOTE}}} end " || " from cv3ordercatalogmasteritem ocmi with (nolock) " || " join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid " || " where o.ClientGUID = " || ClientGuid || " " || " and o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) " || " and o.createdwhen > getdate() -90 " || " and o.typecode = {{{SINGLE-QUOTE}}}diagnostic{{{SINGLE-QUOTE}}} and o.idcode = {{{SINGLE-QUOTE}}}" || OrderNumberValue || "{{{SINGLE-QUOTE}}}" || " and ocmi.name in ({{{SINGLE-QUOTE}}}Red Cell Products{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Transfuse Platelets{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Transfuse FFP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Transfuse Cryoprecipitate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Cryoprecipitate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Fresh Frozen Plasma{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Products{{{SINGLE-QUOTE}}}) " || " and o.entered > getdate()-21 " }; if exist PastOrderName then OrderName.Value := PastOrderName; else OrderName.Value := " "; dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n\nThis order number does not match a Blood Order.","Order Not Found", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; endif; endif; // If CallingEvent <> "FieldChange" ;; evoke: ;; logic: conclude true; ;; action: return this_communication, this_form; ;; end: