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: