maintenance: title: SCH_CHART_TASK_CREATE_HEALTHISSUE;; mlmname: SCH_CHART_TASK_CREATE_HEALTHISSUE;; arden: version 2;; version: 5.00;; institution: St Clair Hospital;; author: Eclipsys;; specialist: ;; date: 2010-03-12;; validation: testing;; library: purpose: Chart a Health Issue Of Pneumococcal When Pneumococcal Vaccine Is Charted Either by the interface (batch) or by the user. Remove a health issue if a task on the same day is reset. ;; explanation: Pneumococcal Initiative Change history 09.01.2010 TS Added logic to chart and remove variable vaccines - Diphtheria/Tetanus Toxid, HIB, Hep B, Influenza, Meningococcal, Rubella, and TDAP 08.22.2011 DW Major rewrite CSR#26269 - changed Pneumococcal HI code from "2" to "V03.82" 09.20.2011 DW Major rewrite CSR#26486 - changed Influenza HI code from "1" to "V04.81" 01.24.2012 TS Change made to evoke statement to remove the time delay statement that was causing reset of a task or changing a previously charted task to not given to not remove the health issue. HD Ticket 146109 02.08.2012 DW CSR# 26307 - changed TDAP HI code from "4" to "V06.1" 04.04.2012 DW CSR# 26307 - Àdded new Health Issues for ED TDAP project 09.16.2014 TMS CSR# 32748 - Àdded new Catalog Name for Influenza 10.28.2014 STH CSR#: 32776 - Modify the "issuename" to pull from the health manager configuration to match the immunization history name when the ordered item/task is setup to write to health manager and send to state for immunization tracking. 12.16.2015 - CSR #:33655 - Update for Prevnar 13 {Loaded 1.13.2016 ahead of the target go-live date of the product being available} 03.08.2016 - STH CSR#: 33655/ Helpdesk ticket #: - There was a section added to this MLM by GMS that must have been abandoned because it was never moved live. The section was allowing the health issues to create in DEV durning testing; however additional configuration is required in other enviornments for this same logic to work in those enviornments. Reverted the section back to the original logic and the MLM works in all enviornments. Believe the section was a proof of concept for ICD10 that got abandoned. 05.31.2019 - DW CSR# 37676 - 18.4 Changed Interface user logic to Services ;; keywords: Charting, Create Health Issue, Remove HealthIssues; ;; knowledge: type: data-driven;; data: /* Set to true if logging 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"; WhatAmIDoing := ""; any_modified_task:= event {OrderTaskOccurrenceModify Any OrderTaskOccurrence: WHERE TaskName Matches Pattern "Pneumococcal Vaccine Inj (Pneumovax)%" or TaskName Matches Pattern "Pneumococcal 13-Valent Vaccine Inj%" or TaskName Matches Pattern "Influenza Virus Trivalent Vaccine%" or TaskName Matches Pattern "Influenza Virus Vaccine%" or TaskName Matches Pattern "Hepatitis B Virus Vaccine Inj%" or TaskName Matches Pattern "Haemophilus B Conj%" or TaskName Matches Pattern "Diphtheria/Tetanus Toxoid%" or TaskName Matches Pattern "Rubella Vaccine Inj%" or TaskName Matches Pattern "Meningococcal Vaccine Inj%" or TaskName Matches Pattern "Diphtheria, Pertussis, Tetanus Vaccine%" }; /* if called_by_editor then EvokingObject := read last {OrderTaskOccurrence: THIS where TaskName Matches Pattern "Pneumococcal Vaccine Inj (Pneumovax)%" }; endif; */ NewHealthIssue_dest := destination { ObjectsPlus } with [ alert_type := "Warning", short_message := "Object created by MLM", priority := "low", scope := "chart", rule_group := "Health Issue Object", rule_number := 2010 ]; Discontinue_HealthIssue_dest := destination { ObjectsPlus } with [ alert_type := "Warning", short_message := "Object deleted by MLM", priority := "low", scope := "chart", rule_group := "Health Issue Object", rule_number := 2040 ]; client_GUID := read last { ClientInfo: GUID }; userguid,user_id :=read last {UserInfo: guid,idcode}; // obtain the location info TaskName,TaskStatusCode,orderguid ,significantdtm:= read last {OrderTaskOccurrence: TaskName,TaskStatusCode,OrderGUID,SignificantDtm REFERENCING EvokingObject}; Client_Visit_Guid := read last { " select clientvisitguid from cv3order with (nolock) where guid = " || SQL(orderguid)}; (backup_obj) := read last {OrderTaskOccurrence: Backup REFERENCING EvokingObject}; // new logic to support variable vaccine orders/tasks issuename := ""; issuecode := ""; if ((taskname matches pattern "Pneumococcal Vaccine Inj%") or (taskname matches pattern "Pneumococcal 13-Valent Vaccine Inj%")) then issuename := "Pneumococcal Vaccine"; issuecode := "V03.82"; endif; if taskname matches pattern "Influenza Virus Trivalent Vaccine%" then issuename := "Influenza Vaccine"; issuecode := "V04.81"; endif; if taskname matches pattern "Influenza Virus Vaccine%" then issuename := "Influenza Vaccine"; issuecode := "V04.81"; endif; if taskname matches pattern "Diphtheria, Pertussis, Tetanus Vaccine%" then issuename := "TDAP- Tetanus,Diptheria, Acellular Pertussis"; issuecode := "V06.1"; endif; if taskname matches pattern "Hepatitis B Virus Vaccine Inj%" then issuename := "Hepatitis B Vaccine"; issuecode := "V05.3"; endif; if taskname matches pattern "Rubella Vaccine Inj%" then issuename := "Rubella Vaccine"; issuecode := "V04.3"; endif; if taskname matches pattern "Haemophilus B Conj%" then issuename := "Haemophilus B Conjugate (HIB) Vaccine"; issuecode := "V03.81"; endif; if taskname matches pattern "Meningococcal Vaccine Inj%" then issuename := "Meningococcal Vaccine"; issuecode := "V03.89"; endif; if taskname matches pattern "Diphtheria/Tetanus Toxoid%" then issuename := "Diphtheria/Tetanus Toxoid"; issuecode := "V06.5"; endif; //Added by STH 10/28/2014 to pull the Immunization Name from Health Manager when there is a CVX Coded added to create the health manager entry for sending to the state. //This same code/logic is used in the SCH_HM_MARK_AS_DONE for creating the health manager entry for the vaccine name given. CodingCVXCode := "HM CVXCode"; catalogItemGUID := EvokingObject.CatalogItemTaskGUID; ImmunizationCVXCode := read last {"Select an.Name from CV3AncillaryName an with (nolock) " || "Where an.MainCatItemGUID = " || SQL(catalogItemGUID) || " AND an.Active = 1 AND an.CodingStd = " || SQL(CodingCVXCode) }; if ImmunizationCVXCode is not null and ImmunizationCVXCode <> "" then HMCVXCodeName := read last {"select name from SXAHMVaccineCatalogItem with (nolock) " || " Where cvxcode = " || sql(ImmunizationCVXCode) || " and active = 1 " }; if HMCVXCodeName is not null and HMCVXCodeName <> "" then issuename := HMCVXCodeName; endif; endif; (bk_TaskName,bk_TaskStatusCode,bk_TouchedBy,bk_TouchedWhen,bk_LatestScheduledDtm, bk_EnteredProviderGUID,bk_PerformedProviderGUID,bk_EnteredDtm,bk_PerformedFromDtm, bk_SignificantDtm,bk_TaskReason,bk_TaskComment,bk_BodySite) := read last {OrderTaskOccurrence: TaskName,TaskStatusCode,TouchedBy,TouchedWhen, LatestScheduledDtm,EnteredProviderGUID,PerformedProviderGUID,EnteredDtm, PerformedFromDtm,SignificantDtm,TaskReason,TaskComment,BodySite REFERENCING backup_obj}; if taskstatuscode = "Performed" then yr := extract year significantdtm; mn := extract month significantdtm; dd := extract day significantdtm; else yr := extract year bk_SignificantDtm; mn := extract month bk_SignificantDtm; dd := extract day bk_SignificantDtm; endif; HealthIssueTypeCode := "Vaccine History"; delete_healthIssue_GUID, delete_ShortName, delete_dd,delete_mn,delete_yr:= read last { " select GUID,ShortName,OnsetDayNum,OnSetMonthNum,OnSetYearNum from CV3HealthIssueDeclaration with (nolock) " || " where TypeCode = " || SQL(HealthIssueTypeCode) || " AND ShortName = " || SQL(issuename) || " AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} AND ClientGUID = " || SQL(client_GUID) || " AND OnSetDayNum = " || SQL(dd) || " AND OnsetMonthNum = " || SQL(mn) || " AND OnsetYearNum = " || SQL(yr) } ; ;; // evoke: 0 minutes after time of any_modified_task; evoke: any_modified_task; ;; logic: if bk_TaskStatusCode = TaskStatusCode // I.e the status of the task has not changed. So do nothing then conclude false; else // else, let{{{SINGLE-QUOTE}}}s create or remove some health issues. /* dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "So the Task Status Code is Changing" || "\nYour task is going from " || bk_TaskStatusCode || "\nTo " || TaskStatusCode ,"Tester","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; */ try //get the .NET version of the Client Visit object. Needed to create new //ObjectsPlus objects client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((Client_Visit_Guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ; endtry; catch Exception ex error_occurred := true; error_message := "{{+R}}Retrieve client:{{-R}}\n" || ex.Message || "\n\n"; if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif; // If the client object cannot be retrieved, do not attempt // to create any ObjectsPlus objects. conclude true; endcatch; if ((TaskStatusCode = "Performed") and (not (exists delete_healthIssue_GUID))) // marked as performed // but if already a HI, do nothing. then try //--------------------------------------------------------- // New HealthIssue Example //--------------------------------------------------------- // Type and Code information for creating a new HealthIssue NewHealthIssueHIType := "Vaccine History"; NewHealthIssueHICode := issuecode; NewHealthIssueHIScheme := "Vaccine History"; // Create an instance of a HealthIssue New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, //ClientVisit NewHealthIssueHIType, // HI Type NewHealthIssueHIScheme, // HI Coding Scheme NewHealthIssueHICode ); // HI Code // Set some properties of the healthIssue PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with ( yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, // Year mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, // Month dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} ); // Day New_HealthIssue_obj.OnsetDate := PartialDate_obj; extratext := ""; if user_id matches pattern "%services" then extratext := "VeriScan"; else extratext := "the eMAR"; endif; New_HealthIssue_obj.Text := "Created via {{{SINGLE-QUOTE}}}Marked as Done{{{SINGLE-QUOTE}}} from " || extratext; New_HealthIssue_obj.Name := issuename; NewHealthIssue_dest.ObjectsPlus := New_HealthIssue_obj; endtry; catch exception ex error_occurred := true; if ( New_HealthIssue_obj is NOT NULL ) then void:= call New_HealthIssue_obj.Dispose; New_HealthIssue_obj:= null; endif; NewHealthIssue_dest := null; endcatch; elseif bk_TaskStatusCode = "Performed" then // else you are resting the task that was performed, so take away the Health Issue // Note we already found the related HI by the delete_healthIssue_GUID in the SQL in the Data element try if exists delete_healthIssue_GUID then Discontinue_HealthIssue_Obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( (delete_healthIssue_GUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}); empty := call Discontinue_HealthIssue_Obj.Discontinue; Discontinue_HealthIssue_dest.ObjectsPlus := Discontinue_HealthIssue_Obj; endif; endtry; catch exception ex error_occurred := true; error_message := error_message || "{{+R}}Discontinue HI {{-R}} \n\n"; if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception " || ex.InnerException.Message || "\n\n"; endif; if (Discontinue_HealthIssue_Obj is not null) then void := call Discontinue_HealthIssue_Obj.Dispose; Discontinue_HealthIssue_Obj := null; endif; Discontinue_HealthIssue_dest := null; endcatch; endif; conclude true; endif; ;; action: if exists NewHealthIssue_dest then write TRUE at NewHealthIssue_dest; endif; if exists Discontinue_HealthIssue_Dest then write TRUE at Discontinue_HealthIssue_Dest; endif; ;; Urgency: 50;; end: