maintenance: title: DOC_SCH_Readmission_Risk_Chronic ;; mlmname: DOC_SCH_Readmission_Risk_Chronic ;; arden: version 2.5;; version: 5.50;; institution: SCH ;; author: Chintan Tilwa ;; specialist: ;; date: 2012-10-10;; validation: testing;; library: purpose: ;; explanation: Change history 09.10.2015 DW CSR# 23359 - ICD10 ;; keywords: ;; knowledge: type: data-driven;; data: (this_documentCommunication) := argument; //Get The Structure Note (this_FS_doc) := this_documentCommunication.DocumentConfigurationObj; //Get the Parameter List (this_parms) := this_FS_doc.ParametersList; //Paramters defination (this_cols) := this_FS_doc.ColumnsList; (this_curr_col) := this_FS_doc.Currentcolumn; (this_currentObs) := this_documentCommunication.CurrentObservationObj; (this_observations) := this_FS_doc.ChartedObservationsList; (this_curr_valobj) := this_currentObs.valueobj; MLM_DIPA := MLM {{{SINGLE-QUOTE}}}UTIL_OBJECT_Customize_DIPA_MLM{{{SINGLE-QUOTE}}}; Client_GUID := this_documentCommunication.ClientGUID; Client_Visit_GUID := this_documentCommunication.ClientVisitGUID; ChartGUID := this_documentCommunication.ChartGUID; prm1 := first of (this_parms where this_parms.Name = "SCH_CK_Retrieve_Chronic Conditions"); Obs1 := first of (this_observations where this_observations.ParameterGUID = prm1.ParameterGUID ); lst1 := Obs1.valueObj.ListItemsList ; sel1 := first of( lst1.Value where lst1.IsSelected = true ); prm2 := first of (this_parms where this_parms.Name = "SCH_CK_Chronic Conditions"); /* Replaced with ICD10 project (Pat_Chronic) := Read {"Select Distinct hi.shortname from CV3HealthIssueDeclaration hi (nolock) join CV3CodedHealthIssue chi (nolock) on chi.GUID = hi.CodedHealthIssueGUID where hi.ClientGUID = " || SQL(Client_GUID) || " 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.text like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hi.text like {{{SINGLE-QUOTE}}}%Renal Failure%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Renal Failure%{{{SINGLE-QUOTE}}} or hi.text like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} or hi.text like {{{SINGLE-QUOTE}}}%Congestive Heart Failure%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Congestive Heart Failure%{{{SINGLE-QUOTE}}} or hi.text like {{{SINGLE-QUOTE}}}%copd%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%copd%{{{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 end) in ({{{SINGLE-QUOTE}}}586{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}250.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}496{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.0{{{SINGLE-QUOTE}}})) and (hi.description not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}}) AND ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} AND ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}} OR ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} AND hi.ChartGUID = " || SQL(ChartGUID) || " ) OR hi.ClientVisitGUID = " || SQL(Client_Visit_GUID) || " ) ) " }; */ (Pat_Chronic) := Read {"Select Distinct hi.shortname from CV3HealthIssueDeclaration hi (nolock) join CV3CodedHealthIssue chi (nolock) on chi.GUID = hi.CodedHealthIssueGUID where hi.ClientGUID = " || SQL(Client_GUID) || " 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.text like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hi.text like {{{SINGLE-QUOTE}}}%Renal Failure%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Renal Failure%{{{SINGLE-QUOTE}}} or hi.text like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}} or hi.text like {{{SINGLE-QUOTE}}}%Congestive Heart Failure%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%Congestive Heart Failure%{{{SINGLE-QUOTE}}} or hi.text like {{{SINGLE-QUOTE}}}%copd%{{{SINGLE-QUOTE}}} or hi.shortname like {{{SINGLE-QUOTE}}}%copd%{{{SINGLE-QUOTE}}} or ( (hi.ICD9Code is null and chi.code in ({{{SINGLE-QUOTE}}}586{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}250.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}496{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.0{{{SINGLE-QUOTE}}}) ) or (hi.ICD9Code is not null and hi.ICD9Code in ({{{SINGLE-QUOTE}}}586{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}250.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}496{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.0{{{SINGLE-QUOTE}}}) ) ) ) and (hi.description not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}} or hi.shortname not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}}) AND ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} AND ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}} OR ( hi.ScopeLevel = {{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}} AND hi.ChartGUID = " || SQL(ChartGUID) || " ) OR hi.ClientVisitGUID = " || SQL(Client_Visit_GUID) || " ) ) " }; final_List1 := (); final_Text := "" ; final_Text1 := "" ; final_Text2 := "" ; final_Text3 := "" ; final_Text4 := "" ; Pat_Chronic_List := 1 seqto (count Pat_Chronic); For i in Pat_Chronic_List do If ( Pat_Chronic[i] Matches pattern "%Diabetes%" ) Then final_List1 := final_List1 , "Diabetes" ; final_Text1 := Pat_Chronic[i] ; Elseif ( Pat_Chronic[i] Matches pattern "%Renal Failure%" ) Then final_List1 := final_List1 , "Renal Failure" ; final_Text2 := Pat_Chronic[i] ; Elseif ( Pat_Chronic[i] Matches pattern "%CHF%" or Pat_Chronic[i] Matches pattern "%Congestive Heart Failure%" ) Then final_List1 := final_List1 , "CHF" ; final_Text3 := Pat_Chronic[i] ; Elseif ( Pat_Chronic[i] Matches pattern "%copd%" ) Then final_List1 := final_List1 , "COPD" ; final_Text4 := Pat_Chronic[i] ; endif; Enddo; If final_Text1 <> "" then final_Text := final_Text1; Endif; If final_Text2 <> "" then if final_Text <> "" then final_Text := final_Text || ", " || final_Text2 ; else final_Text := final_Text2; endif; Endif; If final_Text3 <> "" then if final_Text <> "" then final_Text := final_Text || ", " || final_Text3 ; else final_Text := final_Text3; endif; Endif; If final_Text4 <> "" then if final_Text <> "" then final_Text := final_Text || ", " || final_Text4 ; else final_Text := final_Text4; endif; Endif; prm3 := first of (this_parms where this_parms.Name = "SCH_CK_Retrieve_Chronic Conditions_FT"); If ( sel1 = "" OR sel1 is null ) then obs2 := CALL MLM_DIPA WITH this_DocumentCommunication, prm2, ""; this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := ( this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList, obs2); obs3 := CALL MLM_DIPA WITH this_DocumentCommunication, prm3, "" ; this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := ( this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList, obs3); Endif; If ( sel1 = "Retrieve Chronic Conditions Related History" ) then obs2 := CALL MLM_DIPA WITH this_DocumentCommunication, prm2, final_List1; this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := ( this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList, obs2); obs3 := CALL MLM_DIPA WITH this_DocumentCommunication, prm3, final_Text ; this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := ( this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList, obs3); Endif; MLM_Score := MLM {{{SINGLE-QUOTE}}}DOC_SCH_Readmission_Risk_Score{{{SINGLE-QUOTE}}}; obs_Score := Call MLM_Score With this_documentCommunication; ;; priority: 50 ;; evoke: ;; logic: Conclude true; ;; action: return this_documentCommunication; ;; Urgency: 50;; end: