maintenance: title: DOC_FUNC_CREATE_HEALTH_ISSUE;; mlmname: DOC_FUNC_CREATE_HEALTH_ISSUE;; arden: version 5.5;; version: 2.50;; institution: St.Clair Hospital;; author: Don Warnick;; specialist: ;; date: 2011-08-22;; validation: testing;; library: purpose: This MLM will create a Health Issue when an observation is charted (started for smoking health issue) ;; explanation: This value is needed for meaningful use. Change history 08.22.2011 DW Created 04.19.2013 JML CSR 26725: Expand to create "Alcohol Abuse" hi when user selects yes to "problems related to alcohol..." observation. 06.03.2013 JML CSR 31688: Include "heavy smoker..." and "light smoker..." observation values in list that will create "Smoker" health issue when selected. 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 . 03.09.2018 DW CSR# 35320 SSC - Added section for pregnancy and lactation health issues ;; 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"; (thisDocumentCommunication) := argument; (thisStructuredNoteDoc):= thisDocumentCommunication.DocumentConfigurationObj; (thisParameters) := thisStructuredNoteDoc.ParametersList; (thisObservations) := thisStructuredNoteDoc.ChartedObservationsList; ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj]; FreeTextValueType := OBJECT [Value]; ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue]; ListValueListItemType:= OBJECT [ListItemGUID, Value, IsSelected]; clientGuid := thisDocumentCommunication.ClientGUID; visitGuid := thisDocumentCommunication.ClientVisitGUID; chartGuid := thisDocumentCommunication.ChartGUID; createHI := false; hi_search_name := ""; searchtype := ""; (this_currentObs) := thisDocumentCommunication.CurrentObservationObj; // Selected Observation Logic smoker_parametername := first of (thisParameters where thisParameters.Name = "SCHCK tobacco use pt"); alcohol_parametername:= first of (thisParameters where thisParameters.Name = "PRO alcohol problems rel yn alco"); preg_or_parametername:= first of (thisParameters where thisParameters.Name = "SCH OR_PRO fem repro pg yn"); lact_or_parametername:= first of (thisParameters where thisParameters.Name = "SCH_PRO fem repro breastfeed yn"); if (this_currentObs.ParameterGUID = smoker_parametername.ParameterGUID) then selected_parametername:= smoker_parametername; hi_search_name:= "smoking"; searchtype := "1"; hi_search_code:= "{{{SINGLE-QUOTE}}}305.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V15.82{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}F17.200{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Z87.891{{{SINGLE-QUOTE}}}"; elseif (this_currentObs.ParameterGUID = alcohol_parametername.ParameterGUID)then selected_parametername:= alcohol_parametername; hi_search_name:= "alcohol"; searchtype := "1"; hi_search_code:= "{{{SINGLE-QUOTE}}}305.0{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}291.81{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}F10.10{{{SINGLE-QUOTE}}}"; elseif (this_currentObs.ParameterGUID = preg_or_parametername.ParameterGUID)then selected_parametername:= preg_or_parametername; hi_search_name:= "pregnancy"; searchtype := "2"; hi_search_code:= "{{{SINGLE-QUOTE}}}Z33.1{{{SINGLE-QUOTE}}}"; elseif (this_currentObs.ParameterGUID = lact_or_parametername.ParameterGUID)then selected_parametername:= lact_or_parametername; hi_search_name:= "lactation"; searchtype := "2"; hi_search_code:= "{{{SINGLE-QUOTE}}}Z39.1{{{SINGLE-QUOTE}}}"; endif; selected_observation := first of (thisObservations where thisObservations.ParameterGUID = selected_parametername.ParameterGUID); // Search for existing health issue if searchtype is not null then if searchtype = "1" // Search by problem name and ICD10 code (include problem-visit on any account) then (Existing_HI_Found) := 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 not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}) and hi.ICD10Code is not null and (hi.Text like {{{SINGLE-QUOTE}}}%" || hi_search_name || "%{{{SINGLE-QUOTE}}} or hi.ShortName like {{{SINGLE-QUOTE}}}%" || hi_search_name || "%{{{SINGLE-QUOTE}}} or (case when chi.TypeCode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} then SUBSTRING(chi.Code,5,20) when chi.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} then chi.Code when chi.TypeCode = {{{SINGLE-QUOTE}}}icd10{{{SINGLE-QUOTE}}} then chi.Code end) in ( " || hi_search_code || " )) " }; elseif searchtype = "2" // Search by ICD10 code only (problem-visit on this visit only) then (Existing_HI_Found) := 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.ClientVisitGUID = " || visitGuid || " and hi.Active = 1 and hi.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and hi.TypeCode not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}) and hi.ICD10Code is not null and case when chi.TypeCode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} then SUBSTRING(chi.Code,5,20) when chi.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} then chi.Code when chi.TypeCode = {{{SINGLE-QUOTE}}}icd10{{{SINGLE-QUOTE}}} then chi.Code end in ( " || hi_search_code || " ) " }; endif; endif; // Proceed if and existing health issue has not been found if not exists Existing_HI_Found then // Smoking Section if hi_search_name = "smoking" then If true in (selected_observation.ValueObj.ListItemsList.IsSelected where selected_observation.ValueObj.ListItemsList.Value = "light smoker (4 or less cigarettes per day)…" or selected_observation.ValueObj.ListItemsList.Value = "current every day smoker..." or selected_observation.ValueObj.ListItemsList.Value = "current some day smoker..." or selected_observation.ValueObj.ListItemsList.Value = "light smoker..." ) then smoker := "Smoker"; elseif true in (selected_observation.ValueObj.ListItemsList.IsSelected where selected_observation.ValueObj.ListItemsList.Value = "former smoker (no use for at least 30 days)…" ) then smoker := "Former Smoker"; else smoker := "Non Smoker"; endif; If smoker not in ("Smoker","Former Smoker") then createHI := false; // Never a Smoker else dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This selection will create a chronic health issue of {{{SINGLE-QUOTE}}}" || smoker || "{{{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 Tobacco Use Documentation ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; If (dlg_result as string) = "No" then createHI := false; else createHI := true; If smoker = "Smoker" then issuename := "Smoker"; issuecode := "F17.200"; issuetype := "Problem-Chronic"; else issuename := "Former Smoker"; issuecode := "Z87.891"; issuetype := "Problem-Chronic"; endif; endif; endif; // Alcohol Section elseif hi_search_name = "alcohol" then if true in (selected_observation.ValueObj.ListItemsList.IsSelected where selected_observation.ValueObj.ListItemsList.Value = "yes...") then dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This selection will create a chronic health issue of {{{SINGLE-QUOTE}}}Alcohol Abuse{{{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 Alcohol Use Documentation ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; if ((dialogRes as string) = "Yes") then createHI := true; issueName := "Alcohol Abuse"; issuecode := "F10.10"; issuetype := "Problem-Chronic"; else createHI := false; endif; else createHI := false; endif; // Pregnancy Section elseif hi_search_name = "pregnancy" then if true in (selected_observation.ValueObj.ListItemsList.IsSelected where selected_observation.ValueObj.ListItemsList.Value = "yes") then dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This selection will create a visit health issue of {{{SINGLE-QUOTE}}}Pregnancy{{{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 Pregnancy Documentation ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; if ((dialogRes as string) = "Yes") then createHI := true; issueName := "Pregnancy"; issuecode := "Z33.1"; issuetype := "Problem-Visit"; else createHI := false; endif; else createHI := false; endif; // Lactation Section elseif hi_search_name = "lactation" then if true in (selected_observation.ValueObj.ListItemsList.IsSelected where selected_observation.ValueObj.ListItemsList.Value = "yes") then dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This selection will create a visit health issue of {{{SINGLE-QUOTE}}}Lactating Mother{{{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 Lactation Documentation ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; if ((dialogRes as string) = "Yes") then createHI := true; issueName := "Lactating Mother"; issuecode := "Z39.1"; issuetype := "Problem-Visit"; else createHI := false; endif; else createHI := false; endif; endif; // End of Health Issue Processing Sections // Create Health Issue Section if (createHI) then issuecodingscheme := "ICD10"; issuetext := "Created from Patient Profile information. " ; Func_Create_HI_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_Create_Health_Issue{{{SINGLE-QUOTE}}}; void := call Func_Create_HI_MLM with (visitGuid,issueName,issuecode,issuetext,issuetype,issuecodingscheme); endif; endif; // Existing HI not found ;; evoke: ;; logic: conclude true; ;; action: return thisDocumentCommunication; ;; Urgency: 50;; end: