maintenance: title: SCH_Surgery_CaseClose_Alert;; mlmname: SCH_Surgery_CaseClose_Alert;; arden: version 2.5;; version: 16.3;; // institution: Allscripts, ;; author: Allscripts Healthcare Solutions, Inc.;; specialist: ;; date: 2017-04-11;; validation: Testing;; library: purpose: Maintains an Alert when SUrgCase Completion is entered/saved wand the date is past the # of days set in ChargingPeriod EP setting ;; explanation: This MLM is a sample of alert on SUrgCase Completion Save - and hard stop alert 02/02/16 - Allscripts - initiate readiness for deploy to STV Test; logic to detect whenClosed is > then EP setting for Case 04/11/17 - deploy at St Claire DEV 16.3 04/11/17 - testing value addition of 7 days (cahrge period) until EP setting is decided ;; keywords: ObjectsPlus, Advanced Visit List Data, Health Issues ;; knowledge: type: data-driven;; data: //****************Make Changes To Spelling And Flags In This Section**************** // list of CPT{{{SINGLE-QUOTE}}}s to check for - to see if COnsult //------------------------------------------------------------------- // Triggers //------------------------------------------------------------------- // Case Complete event case_complete_event := EVENT {SRGCaseStatusChange User SRGCase : Where ( CaseStatusName = "Reopened For Additional Documentation" ) OR (CaseStatusInternalType = "Complete")}; /// 02/29/16 - for trial upon opening //--------------------------------------------------------------- // Email and ObjectsPlus destinations //--------------------------------------------------------------- /// flags test_a:= "&"; a:= 0; ct_get_con:= 0; //******************Do Not Make Changes Below This Section******************* // Specify which .NET assemblies need to be loaded for ObjectsPlus standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; if called_by_editor then EvokingObject := read last {SRGCase: THIS }; evokingevent:= case_complete_event; endif; //break; /// for Charge Period Surg Procedures // get the required Charge Period from environmental profile (ch_per):= READ LAST {"SELECT value " || " FROM HVCEnvProfile (nolock) " || " WHERE HierarchyCode = " || SQL("Surgery|Charger") || " AND Code = " || SQL("ChargingPeriod") }; // Get the case events object from the evoking case object ( evoking_case_events, bu_obj ) := read last { SRGCase: SRGCaseEvent, Backup REFERENCING EvokingObject }; /// 02/29/26 - look at old status old_status:= bu_obj.CaseStatusInternalType ; old_status_name:= bu_obj.CaseStatusName ; // bu_obj.CaseStatusName := "Reopened For Additional Documentation" ; // get the case events as a list from the case events object ( case_events_list ) := evoking_case_events.records__; // find the case event that match the time type name parameter proc_end := evokingobject.ActualEndDateTimeUTC; /// 02/29/16 - if needed place here // If (EvokingObject.CaseStatusName = "Reopened For Additional Documentation" and // old_status = "Complete") // OR (EvokingObject.CaseStatusInternalType = "Complete") /// testing if called_by_editor then proc_end:= NOW - 8 days; endif; /// /// 02/09/16 - testing until EP setting is decided /* if not (exists ch_per) then ch_per := 7; endif; */ //////////////////////////////////////////////////// //break; /// 03/7/16 - update in case there is no procedure completion data if exists proc_end then proc_end_t:= day floor of (proc_end as time); // endif; ch_per_n:= ch_per as number; ch_per_t:= "7 days"; //(ch_per||" days") ; current := day floor of NOW; per_cur:= ((current - proc_end_t)/1 day) as number; // 86,400) ; endif; if //current > per_cur > ch_per_n then a:=1; endif; //break; ////////////////////////////////////////////////////////////////////////////// /// test for logic If a > 0 then ext_proc:= extract characters proc_end_t; proc_f:= string (first 11 from ext_proc); //break; alert_text:= "Procedure Update {{+B}} IS NOT permitted on a Procedure with End Date of: {{- B}}"||proc_f // for a {{+B}}{{+C}}Consult Code{{-C}}{{-B}}" ||"\n\nProcedures are {{+B}}Closed for updates {{+R}}"||ch_per||" days after Procedure End Date. {{-R}}{{-B}} "; // below if you need to enter the NDC Codes."; //||"It is being deleted.\n\nYou Must Re-Value to get a Score"; dest_var:= destination{alert: warning, "Procedure May Not be Updated", low, chart, "my rule group", 1001, "", "No Override Allowed" }; /// 072913 addition of messag box /*dialogresult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with alert_text, //"Document has opened - version 6", "Another Default Selection" , "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; */ endif; // a >0 an ;; priority: 50 ;; evoke: /// 03/07/16 - comment out evoke - so as not to fire during Demos / DayinLife case_complete_event ;; logic: if a = 0 //( EvokingObject is null or ///continue_processing = false ) then conclude false; elseif a > 0 then conclude true; endif; //break; ;; action: if exists dest_var //and a >0 then write alert_text at dest_var; endif; ;; urgency: 50;; end: