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: