maintenance: title: DOC_SCH_Triage_Screening_Visual;; mlmname: DOC_SCH_Triage_Screening_Visual;; arden: version 5.5;; version: 2.50;; institution: St.Clair Hospital;; author: Shivprasad Jadhav;; specialist: ;; date: 2015-03-05;; validation: testing;; library: purpose: This MLM will create a Health Issue when an observation is charted on ED Triage Note. ;; explanation: Create Visually Impaired HI if one does not already exist Change history 06.02.2012 GOS CSR:33112 - Created MLM 09.30.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 HI Dynamic Creation with all details Like ICD10 Code, Snowmed Code etc And Duplicate HI Check Change. 10.12.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 Coding Scheme [ICD10] And Duplicate Check of HI . 09.08.2016 DW HD# 2200677 - Disability Risk MLM - Duplicate Health Issue - copied Prod version over dev as they didn{{{SINGLE-QUOTE}}}t match. Altered HI lookup to interrogate all visits ;; keywords: ;; knowledge: type: data-driven;; data: standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; // Recieve arguments from the structured note (thisDocumentCommunication) := argument; // Extract interesting parts of the object model (thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj; (thisParameters) := thisStructuredNoteDoc.ParametersList; (thisObservations) := thisStructuredNoteDoc.ChartedObservationsList; // Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj]; FreeTextValueType := OBJECT [Value]; ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue]; ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected]; // Get the client and visit GUIDs clientGuid := thisDocumentCommunication.ClientGUID; visitGuid := thisDocumentCommunication.ClientVisitGUID; chartGuid := thisDocumentCommunication.ChartGUID; // Determine which of the Chronic Conditions boxes is checked this_parametername := first of (thisParameters where thisParameters.Name = "sch_edtriage_Special need"); theObservation := first of (thisobservations where thisobservations.ParameterGUID = this_parametername.ParameterGUID); If true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Blind" ) then chronic := "Blind"; // chronic := "Visually Impaired"; endif; this_parametername1 := first of (thisParameters where thisParameters.Name = "SCH_Ped_Special need"); theObservation1 := first of (thisobservations where thisobservations.ParameterGUID = this_parametername1.ParameterGUID); If true in (theObservation1.ValueObj.ListItemsList.IsSelected where theObservation1.ValueObj.ListItemsList.Value = "Blind" ) then chronic := "Blind"; endif; // for OB Patient Profile ----------------------------------------------------------------------------------------- this_parametername2 := first of (thisParameters where thisParameters.Name = "sch_obpt_Special Need"); theObservation2 := first of (thisobservations where thisobservations.ParameterGUID = this_parametername2.ParameterGUID); If true in (theObservation2.ValueObj.ListItemsList.IsSelected where theObservation2.ValueObj.ListItemsList.Value = "Blind" ) then chronic := "Blind"; endif; // for Adult Patient Profile ----------------------------------------------------------------------------------------- this_parametername3 := first of (thisParameters where thisParameters.Name = "SCH_Adultpt_Special need"); theObservation3 := first of (thisobservations where thisobservations.ParameterGUID = this_parametername3.ParameterGUID); If true in (theObservation3.ValueObj.ListItemsList.IsSelected where theObservation3.ValueObj.ListItemsList.Value = "Blind" ) then chronic := "Blind"; endif; //------------------------------------------------------------------------------------------------------------------------- // If the patient have health issue, determine if they already have a Health Issue in their record If chronic = "Blind" then //----------------------for PPM Alert to Careprovider ---------------------- CurrentLocation, Account := read last {"Select CurrentLocation, VisitIDCode From cv3Clientvisit with (nolock) Where Guid = " || SQL(visitGuid)||" " }; EndOfUnit := find "-" in string CurrentLocation; If EndofUnit <> 0 then Unit:= SUBSTRING EndOfUnit -1 CHARACTERS STARTING AT 1 from CurrentLocation; else Unit:= CurrentLocation; endif; // Send a Text Message Section PhoneNumber := read last {" select p.AreaCode + p.PhoneNumber from CV3User u with (nolock) join Cv3Phone p with (nolock) on p.PersonGUID = u.GUID " || " where u.displayname = {{{SINGLE-QUOTE}}}SCM, Text Messaging{{{SINGLE-QUOTE}}} and p.PhoneNote = {{{SINGLE-QUOTE}}}PPM{{{SINGLE-QUOTE}}} And p.Active =1 "}; Page_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PAGE{{{SINGLE-QUOTE}}}; MessageSubject:= "Important Message"; MessageBody := " Please call unit " || Unit || " Account # " || Account || " for Disability Risk - Blind "; PPMvoid := call Page_MLM with(PhoneNumber, MessageSubject, MessageBody); //--------------------------------------- (VisualImpHI) := read {" select distinct hi.shortname " || "from cv3healthissuedeclaration hi with (nolock) " || "join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID " || "where hi.clientguid = " || clientGuid || " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " || " and hi.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}} " || " And hi.ICD10Code is not null " // Added By Shivprasad on 29 Sept 2015 for ICD9-10 Changes || "and ( " || "hi.text like {{{SINGLE-QUOTE}}}%Blind%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Blind%{{{SINGLE-QUOTE}}} or " || " " || "(Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}} then chi.code when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}369.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}H54.0{{{SINGLE-QUOTE}}}) " //CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad || " ) " }; // 09.08.2016 DW HD# 2200677 - removed the firstline and replaced the second line below which will direct the SQL to look across all visits for a chronic HI // || " AND ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} AND ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} OR ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} AND hi.ChartGUID = " || SQL(chartGuid) || " ) OR hi.ClientVisitGUID = " || SQL(visitGuid) || " ) ) " // || "and hi.typecode not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}) " // Notify the user if a new Health Issue is about to be created and permit them to reverse them to cancel the process If not exists VisualImpHI AND thisDocumentCommunication.EventType <> "DocumentOpening" then dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This selection will create a chronic health issue of {{{SINGLE-QUOTE}}}" || chronic || "{{{SINGLE-QUOTE}}}" || "\n\n Click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to confirm your selection. " || "\n\n Click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} if you wish to change your selection. " || "\n " ,"Confirm {{{SINGLE-QUOTE}}}" || chronic || "{{{SINGLE-QUOTE}}} Documentation ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}} ; // If the user responds by cliking the "Yes" button, proceed with creating the order If (dlg_result as string) = "Yes" then try client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid 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 ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif; endcatch; /* // 09.08.2016 DW HD# 2200677 - moved this earlier in the logic //----------------------for PPM Alert to Careprovider ---------------------- CurrentLocation, Account := read last {"Select CurrentLocation, VisitIDCode From cv3Clientvisit with (nolock) Where Guid = " || SQL(visitGuid)||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" }; EndOfUnit := find "-" in string CurrentLocation; If EndofUnit <> 0 then Unit:= SUBSTRING EndOfUnit -1 CHARACTERS STARTING AT 1 from CurrentLocation; else Unit:= CurrentLocation; endif; // Send a Text Message Section PhoneNumber := read last {" select p.AreaCode + p.PhoneNumber from CV3User u with (nolock) join Cv3Phone p with (nolock) on p.PersonGUID = u.GUID " || " where u.displayname = {{{SINGLE-QUOTE}}}SCM, Text Messaging{{{SINGLE-QUOTE}}} and p.PhoneNote = {{{SINGLE-QUOTE}}}PPM{{{SINGLE-QUOTE}}} And p.Active =1 "}; Page_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PAGE{{{SINGLE-QUOTE}}}; MessageSubject:= "Important Message"; MessageBody := " Please call unit " || Unit || " Account # " || Account || " for Disability Risk - Blind "; PPMvoid := call Page_MLM with(PhoneNumber, MessageSubject, MessageBody); //--------------------------------------- */ try //--------------------------------------------------------- // New HealthIssue Example //--------------------------------------------------------- If chronic = "Blind" then issuename := "Blind"; issuecode := "H54.0" ; //"369.00"; //CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad endif; NewHealthIssueHIType := "Problem-Chronic"; NewHealthIssueHICode := issuecode; NewHealthIssueHIScheme := "ICD10" ; //"ICD9"; //CSR#23359-ICD9-ICD10 HI Change for Coding Scheme ICD10- Added By shivprasad dd := EXTRACT Day now; mn := EXTRACT Month now; yr := EXTRACT Year now; Terms := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindIMOTerms with (NewHealthIssueHIScheme,issuecode); //--Start: CSR 23359-ICD9-ICD10 HI Change Added By shivprasad Terms := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindIMOTerms with (NewHealthIssueHIScheme,NewHealthIssueHICode); FOR i IN 1 SEQTO (Terms.Count as Number ) DO HI_obj := Terms[i]; HI_Name := HI_obj.TermName as string; If HI_Name = issuename then HI_NO := i ; Endif; ENDDO; If HI_NO is Null Then HI_NO :=1 ; Endif; New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, Terms[HI_NO]); //--End Added by Shivprasad /* Terms := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindIMOTerms with (NewHealthIssueHIScheme,issuecode); New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, Terms[8]); */ //New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with // (client_visit_obj, NewHealthIssueHIType, NewHealthIssueHIScheme, NewHealthIssueHICode ); PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} ); New_HealthIssue_obj.OnsetDate := PartialDate_obj; New_HealthIssue_obj.Text := "Created from ED Triage Note Screening. " ; New_HealthIssue_obj.Name := issuename; if ( New_HealthIssue_obj is NOT NULL ) then void := call New_HealthIssue_obj.Save; void := call New_HealthIssue_obj.Dispose; endif; if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif; 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; endcatch; Elseif (dlg_result as string) = "No" then //void:= ""; lst1 := theObservation.valueObj.ListItemsList ; for i in lst1 do if i.Isselected = true and i.value = "Blind" then i.IsSelected := FALSE ; endif; enddo; lst2 := theObservation1.valueObj.ListItemsList ; for i in lst2 do if i.Isselected = true and i.value = "Blind" then i.IsSelected := FALSE ; endif; enddo; lst3 := theObservation2.valueObj.ListItemsList ; for i in lst3 do if i.Isselected = true and i.value = "Blind" then i.IsSelected := FALSE ; endif; enddo; lst4 := theObservation3.valueObj.ListItemsList ; for i in lst4 do if i.Isselected = true and i.value = "Blind" then i.IsSelected := FALSE ; endif; enddo; endif; // If exists CHFHI endif; // If (dlg_result as string) = "Yes" endif; // If chronic = "CHF" ;; evoke: ;; logic: conclude true; ;; action: return thisDocumentCommunication; ;; Urgency: 50;; end: