maintenance: title: SCH_ORDER_REC_STROKE_MEDICATIONS ;; filename: SCH_ORDER_REC_STROKE_MEDICATIONS;; arden: version 2.50;; version: 5.50;; institution: St. Clair Hospital;; author: Peggy Karish ;; specialist: Don Warnick;; date: 2017-05-04;; validation: testing;; library: purpose: This MLM will alert the physician when the patient does not have an appropriate med to be selected for discharge order reconciliation. ;; explanation: Change History DW 06.12.2017 - CSR# 35309 - Stroke Quality Measure - Created DW 10.16.2017 - CSR# 35309 - Stroke Quality Measure - Disable pilot code DW 10.17.2017 - CSR# 35309 - Corrected SQL issue with determining the strengths of the components of a combination drug. Issue converting text to float. DW 11.02.2017 - CSR# 35309 - Corrected SQL issue with document names (was searching for contraindications in "physician progress note" w/o a suffix which is appended DW 12.12.2017 - HD# 2995007 - Corrected issue regarding the patient classification by HI. To be classified as AFIB, the patient must also have a Stroke/TIA HI DW 12.18.2017 - HD# 2995007 - Corrected issue regarding the patient classification by HI. Was missing the {{{SINGLE-QUOTE}}}Discharge Diag{{{SINGLE-QUOTE}}} type. Sandy found it in testing Beta Blocker MLM ;; keywords: Order Reconciliation, Discharge ;; knowledge: type: data-driven;; data: // Intense Statins List /* Dnum Int Strngth Generic (Brand) d05048 xx mg-40 mg amLODIPine-atorvastatin (Caduet) d04105 40 mg atorvastatin (Lipator) d08089 40 mg-xx mg atorvastatin-ezetimibe (Liptruzet) d05348 xx mg-80 mg ezetimibe-simvastatin (Vytorin) d04851 20 mg rosuvastatin (Crestor) d00746 80 mg simvastatin (Zocor) */ // Caduet Lipator Liptruzet Vytorin Crestor Zocor IntenseStatinsID := "d05048" , "d04105" , "d08089" , "d05348" , "d04851" , "d00746" ; // DNUM IntenseStatinsStrn := "40" , "40" , "40" , "80" , "20" , "80"; // Intense Strength Dosage IntenseStatinsPosit:= "2" , "1" , "1" , "2" , "1" , "1"; // Which Medication in a combination drug is the Stroke Med (always 1 if not a combination) standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; log_execution_info:= false; error_destination := destination { Alert } with [alert_type := "Warning", short_message := "ObjectsPlus Error from MLM", priority := "low", scope := "chart", Rule_group := "MLM Error", Rule_number := 1003, Rule_subgroup := "", Send_with_order := "", Alert_dialog_settings := "", Display_alert := true ]; order_rec_event := event{OrderReconciliationPerform Any ORDERRECONCILE: Where ReconcileTypeCode = "Discharge"}; // doc_open_event := event{ClientDocumentEnter User ClientDocument: WHERE DocumentName = "Physician Progress Note" }; (ClientVisitGuid, ChartGuid, ClientGuid, VisitType) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, TypeCode}; birthdate := read last { ClientInfo: BirthDate}; patientage:= int ((NOW - birthdate) / (1 year)); /* // Search for pilot Hospitalist user names userguid :=read last {UserInfo: guid}; PiotDoctor := read last { " select u.IDCode from CV3User u join CV3CareProvider cp with (nolock) on cp.GUID = u.GUID join CV3OrganizationalUnit ou with (nolock) on ou.guid = u.OrgUnitGUID join CV3UserSecurityGroup usg with (nolock) on usg.UserGUID = u.GUID join CV3SecurityGroup sg with (nolock) on sg.GUID = usg.SecurityGroupGUID where ou.Description = {{{SINGLE-QUOTE}}}Medical Affairs{{{SINGLE-QUOTE}}} and sg.code = {{{SINGLE-QUOTE}}}OBS Physician{{{SINGLE-QUOTE}}} and u.Active = 1 and u.guid = " || userguid || " order by u.DisplayName " }; If exist PiotDoctor then */ /* // Search for Arterial Fibulation and Stroke Problems (DW 12.12.2017 - HD# 2995007 replaced with individual stroke and afib hi lookups. patient only should be classified as "afib" if they also have a stroke hi) CodedProblem := read last { " select case when chi.code >= {{{SINGLE-QUOTE}}}I48{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}I48.91{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Afib{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}Stroke{{{SINGLE-QUOTE}}} end from CV3HealthIssueDeclaration hid with (nolock) join CV3CodedHealthIssue chi with (nolock) on chi.guid = hid.CodedHealthIssueGUID where hid.typecode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}} and hid.CodingScheme = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} and hid.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and hid.clientguid = " || ClientGuid || " and hid.ChartGUID = " || ChartGuid || " and hid.ClientVisitGUID = " || ClientVisitGuid || " and ( chi.code >= {{{SINGLE-QUOTE}}}G45.0{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}G45.2{{{SINGLE-QUOTE}}} or chi.code >= {{{SINGLE-QUOTE}}}G45.8{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}G45.9{{{SINGLE-QUOTE}}} or chi.code >= {{{SINGLE-QUOTE}}}O99.41{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}O99.413{{{SINGLE-QUOTE}}} or chi.code = {{{SINGLE-QUOTE}}}O99.419{{{SINGLE-QUOTE}}} or chi.code >= {{{SINGLE-QUOTE}}}I60{{{SINGLE-QUOTE}}} and chi.code < {{{SINGLE-QUOTE}}}I64{{{SINGLE-QUOTE}}} or chi.code >= {{{SINGLE-QUOTE}}}I48{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}I48.91{{{SINGLE-QUOTE}}} ) " }; //hid.Description, hid.TypeCode, hid.CodingScheme, hid.Code, */ // Search for Stroke Problems CodedProblem_Stroke := read last { " select chi.code from CV3HealthIssueDeclaration hid with (nolock) join CV3CodedHealthIssue chi with (nolock) on chi.guid = hid.CodedHealthIssueGUID where (hid.typecode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}} or hid.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}} or hid.typecode = {{{SINGLE-QUOTE}}}Discharge Diag{{{SINGLE-QUOTE}}}) and hid.CodingScheme = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} and hid.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and hid.clientguid = " || ClientGuid || " and hid.ChartGUID = " || ChartGuid || " and hid.ClientVisitGUID = " || ClientVisitGuid || " and ( chi.code >= {{{SINGLE-QUOTE}}}G45.0{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}G45.2{{{SINGLE-QUOTE}}} or chi.code >= {{{SINGLE-QUOTE}}}G45.8{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}G45.9{{{SINGLE-QUOTE}}} or chi.code >= {{{SINGLE-QUOTE}}}O99.41{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}O99.413{{{SINGLE-QUOTE}}} or chi.code = {{{SINGLE-QUOTE}}}O99.419{{{SINGLE-QUOTE}}} or chi.code >= {{{SINGLE-QUOTE}}}I60{{{SINGLE-QUOTE}}} and chi.code < {{{SINGLE-QUOTE}}}I64{{{SINGLE-QUOTE}}} ) " }; // Search for Arterial Fibulation Problems CodedProblem_Afib := read last { " select chi.code from CV3HealthIssueDeclaration hid with (nolock) join CV3CodedHealthIssue chi with (nolock) on chi.guid = hid.CodedHealthIssueGUID where ( (hid.typecode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}} and hid.clientguid = " || ClientGuid || " and hid.ChartGUID = " || ChartGuid || " and hid.ClientVisitGUID = " || ClientVisitGuid || " ) or (hid.typecode = {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}} and hid.clientguid = " || ClientGuid || " ) ) and hid.CodingScheme = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} and hid.Status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and ( chi.code >= {{{SINGLE-QUOTE}}}I48{{{SINGLE-QUOTE}}} and chi.code <= {{{SINGLE-QUOTE}}}I48.91{{{SINGLE-QUOTE}}} ) " }; If exists CodedProblem_Stroke and not exist CodedProblem_Afib then CodedProblem := "Stroke"; endif; If exists CodedProblem_Stroke and exist CodedProblem_Afib then CodedProblem := "Afib"; endif; if CodedProblem = "Afib" or CodedProblem = "Stroke" then ComfortMeasuresOnlyOrder := read last { " select top 1 o.Name, cast( convert(char(16), o.CreatedWhen,120) as varchar) from CV3OrderCatalogMasterItem ocmi with (nolock) join CV3Order o with (nolock) on o.OrderCatalogMasterItemGUID = ocmi.GUID where ocmi.name like {{{SINGLE-QUOTE}}}Code Status:%{{{SINGLE-QUOTE}}} and o.Name like {{{SINGLE-QUOTE}}}%Comfort Measures Only{{{SINGLE-QUOTE}}} and o.OrderStatusLevelNum >= 15 and o.OrderStatusCode not in ({{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}}) and o.clientguid = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID = " || ClientVisitGuid || " order by o.CreatedWhen desc " }; // If there are no "Comfort Measures" orders, proceed with further SQL queries If not exists ComfortMeasuresOnlyOrder then // Return a list of relavant stroke medications (Anticoagulants, Antiplatelets, Statins) := read { " select distinct case when dc2.CategoryName = {{{SINGLE-QUOTE}}}anticoagulants{{{SINGLE-QUOTE}}} then gn.DrugCatalogKey else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end {{{SINGLE-QUOTE}}}Anticoagulant{{{SINGLE-QUOTE}}}, case when dc2.CategoryName = {{{SINGLE-QUOTE}}}antiplatelet agents{{{SINGLE-QUOTE}}} then gn.DrugCatalogKey else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end {{{SINGLE-QUOTE}}}Antiplatelet{{{SINGLE-QUOTE}}}, case when dc.CategoryName in ({{{SINGLE-QUOTE}}}antihyperlipidemic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HMG-CoA reductase inhibitors (statins){{{SINGLE-QUOTE}}}) then gn.DrugCatalogKey else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end {{{SINGLE-QUOTE}}}Statin{{{SINGLE-QUOTE}}} from SXAAMBDrugName bn with (nolock) join SXAAMBGenericNameDrugNameXRef dnx with (nolock) on dnx.DrugNameID = bn.DrugNameID join SXARxGenericName gn with (nolock) on gn.GenericNameID = dnx.GenericNameID join SXAMTCategoryDrugXREFVW cdx with (nolock) on cdx.drug_id = gn.DrugCatalogKey join SXAMTDrugCategoriesVW cat with (nolock) on cat.multum_category_id = cdx.multum_category_id join SXAAMBDrugCategoryXRef xr with (nolock) on gn.GenericNameID = xr.GenericNameID join SXAAMBDrugCategory dc with (nolock) on xr.DrugCategoryID = dc.DrugCategoryID join SXAAMBDrugCategory dc2 with (nolock) on dc.ParentDrugCategoryID = dc2.DrugCategoryID left join SXAAMBDrugCategory dc3 with (nolock) on dc2.ParentDrugCategoryID = dc3.DrugCategoryID where dc2.CategoryName = {{{SINGLE-QUOTE}}}anticoagulants{{{SINGLE-QUOTE}}} or dc2.CategoryName = {{{SINGLE-QUOTE}}}antiplatelet agents{{{SINGLE-QUOTE}}} or dc.CategoryName in ({{{SINGLE-QUOTE}}}antihyperlipidemic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HMG-CoA reductase inhibitors (statins){{{SINGLE-QUOTE}}}) "}; // case when dc.CategoryName in ({{{SINGLE-QUOTE}}}antihyperlipidemic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HMG-CoA reductase inhibitors{{{SINGLE-QUOTE}}}) then gn.DrugCatalogKey else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end {{{SINGLE-QUOTE}}}Statin{{{SINGLE-QUOTE}}} // dc2.CategoryName = {{{SINGLE-QUOTE}}}anticoagulants{{{SINGLE-QUOTE}}} or dc2.CategoryName = {{{SINGLE-QUOTE}}}antiplatelet agents{{{SINGLE-QUOTE}}} or dc.CategoryName in ({{{SINGLE-QUOTE}}}antihyperlipidemic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HMG-CoA reductase inhibitors{{{SINGLE-QUOTE}}}) // Search for Patient Medications (PatientMedDrugID, PatientMedStrength1, PatientMedStrength2, PatientMedName ) := read { " select distinct dnm.drug_id ,case when gi.StrengthDesc like {{{SINGLE-QUOTE}}}%mg%{{{SINGLE-QUOTE}}} then substring(gi.StrengthDesc,0,CHARINDEX({{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},gi.StrengthDesc)) else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end ,case when LEN(gi.StrengthDesc) - LEN(REPLACE(gi.StrengthDesc,{{{SINGLE-QUOTE}}}mg-{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})) = 3 then replace (substring(gi.StrengthDesc,CHARINDEX({{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},gi.StrengthDesc)+3,9),{{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end ,cp.DrugName from SXAAMBClientPrescription cp with (nolock) inner join SXAMTDrugNameMapVW dnm with (nolock) on dnm.drug_synonym_id = cp.FormularyBrandKey join SXAMTCategoryDrugXREFVW cdx with (nolock) on cdx.drug_id = dnm.drug_id join SXAMTDrugCategoriesVW cat with (nolock) on cat.multum_category_id = cdx.multum_category_id join sxarxgenericitem gi with (nolock) on gi.GenericItemID = cp.GenericItemID and gi.DrugCatalogKey = cp.FormularyDrugKey where cp.ClientGuid = " || ClientGuid || " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} union select distinct dm.DrugKey, ot.OrderDosageLow, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}, ocmi.Name from cv3ordercatalogmasteritem ocmi with (nolock) join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = ocmi.guid JOIN CV3DrugMapping dm with (nolock) on dm.CatalogItemGUID = ocmi.GUID join CV3OrganizationalUnit ou with (nolock) on ou.GUID = ocmi.OrgUnitGUID join CV3OrderTask ot with (nolock) on ot.OrderGUID = o.GUID where ou.name ={{{SINGLE-QUOTE}}}Pharmacy Department{{{SINGLE-QUOTE}}} and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}) and o.clientguid = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID = " || ClientVisitGuid || " "}; // 10/17/2017 - Corrected Issue with drug strentgh pattern (some have text and can{{{SINGLE-QUOTE}}}t convert to float). Removed the cast and convert only the intense statins later which do not have text // ,case when gi.StrengthDesc like {{{SINGLE-QUOTE}}}%mg%{{{SINGLE-QUOTE}}} then cast (substring(gi.StrengthDesc,0,CHARINDEX({{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},gi.StrengthDesc)) as float) else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end // ,case when LEN(gi.StrengthDesc) - LEN(REPLACE(gi.StrengthDesc,{{{SINGLE-QUOTE}}}mg-{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})) = 3 then cast (replace (substring(gi.StrengthDesc,CHARINDEX({{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},gi.StrengthDesc)+3,9),{{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as float) else {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} end // Check for Anticoagulant Medications AnticoagulantFound:= ""; for x in 1 seqto count (PatientMedDrugID) do if (PatientMedDrugID[x] is in Anticoagulants) then AnticoagulantFound := AnticoagulantFound || " " || PatientMedName [x]; endif; enddo; // Check for Antiplatelet Medications AntiplateletFound:= ""; for x in 1 seqto count (PatientMedDrugID) do if (PatientMedDrugID[x] is in Antiplatelets) then AntiplateletFound := AntiplateletFound || " " || PatientMedName [x]; endif; enddo; // Check for Statin Medications StatinFound := ""; IntStatinFound := ""; for x in 1 seqto count (PatientMedDrugID) do if (PatientMedDrugID[x] is in Statins) then StatinFound := StatinFound || " " || PatientMedName [x]; // Compare the drug name to the Intense Statin Drug ID list at the top of the MLM for y in 1 seqto count (IntenseStatinsID) do If (PatientMedDrugID[x] = IntenseStatinsID[y]) then // Determine which strength (combinations have 2)qualifies it as an Intense statin using the Intense Statin LR list at the top of the MLM position := IntenseStatinsPosit[y]; if position = "1" then intensestren:= PatientMedStrength1[x]; else intensestren:= PatientMedStrength2[x]; endif; // Determine if this strength qualifies as an Intense statin using the Intense Statin Strength list at the top of the MLM if (intensestren as number) >= (IntenseStatinsStrn[y] as number) then IntStatinFound := IntStatinFound || PatientMedName[x]; endif; endif; enddo; endif; enddo; // Search for all Contraindications ContraIndications := read {" select case when ocmi.name = {{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra Statin4{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}StatinContraindicated{{{SINGLE-QUOTE}}} when ocmi.name = {{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra INT Statin3{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}IntensiveStatinContraindicated{{{SINGLE-QUOTE}}} when ocmi.name = {{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra Antith 2{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}AntiplateletContraindicated{{{SINGLE-QUOTE}}} when ocmi.name = {{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra AntiCoag 1{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}AnticoagulantContraindicated{{{SINGLE-QUOTE}}} end from CV3ClientDocumentCUR cd with (nolock) join CV3ClientDocDetailCUR cdd with (nolock) on cdd.ClientDocumentGUID = cd.GUID and cdd.ClientGUID = cd.clientguid and cdd.Active = 1 and cdd.ArcType = cd.ArcType join CV3ObservationDocumentCUR od with (nolock) on od.OwnerGUID = cdd.ClientDocumentGUID and od.ArcType = cdd.ArcType join CV3ObservationCUR o with (nolock) on o.GUID = od.ObservationGUID and o.ArcType = od.ArcType join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID join SCMObsFSListValues fsl with (nolock) on fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || ClientGuid || " where cd.ClientGUID = " || ClientGuid || " and cd.ChartGUID = " || ChartGuid || " and cd.ClientVisitGUID = " || ClientVisitGuid || " and cd.IsCanceled = 0 and od.Active = 1 and (cd.DocumentName like {{{SINGLE-QUOTE}}}Physician Progress%{{{SINGLE-QUOTE}}} or cd.DocumentName like {{{SINGLE-QUOTE}}}Day of Discharge Summary eNote%{{{SINGLE-QUOTE}}} or cd.DocumentName like {{{SINGLE-QUOTE}}}History and Physical%{{{SINGLE-QUOTE}}}) and ocmi.Name in ({{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra INT Statin3{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra Antith 2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra AntiCoag 1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_MDPN_CM_STK Contra Statin4{{{SINGLE-QUOTE}}}) "}; // and cd.DocumentName in ({{{SINGLE-QUOTE}}}Physician Progress Note{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Day of Discharge Summary eNote{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}History and Physical{{{SINGLE-QUOTE}}}) 11/02 code wasn{{{SINGLE-QUOTE}}}t retruning the contraindications as these documents are all suffixed with discipline if "StatinContraindicated" in ContraIndications then StatinContra:= "true"; else StatinContra:= "false"; endif; if "IntensiveStatinContraindicated" in ContraIndications then InStatContra:= "true"; else InStatContra:= "false"; endif; if "AntiplateletContraindicated" in ContraIndications then AntiplContra:= "true"; else AntiplContra:= "false"; endif; if "AnticoagulantContraindicated" in ContraIndications then AnticgContra:= "true"; else AnticgContra:= "false"; endif; AlertMsg:= "false"; PbmCount:= 0; AntiplMissing := ""; AnticgMissing := ""; StatinMissing := ""; IntStatinMissing := ""; MsgText := ""; If CodedProblem = "Afib" then // Afib Section If AntiplateletFound = "" and AnticoagulantFound = "" and AntiplContra = "false" then AntiplMissing := "true"; AlertMsg:= "true"; PbmCount := PbmCount +1; else AntiplMissing := "false"; endif; If AnticoagulantFound = "" and AnticgContra = "false" then AnticgMissing := "true"; AlertMsg:= "true"; PbmCount := PbmCount +1; else AnticgMissing := "false"; endif; If StatinFound = "" and StatinContra = "false" then StatinMissing := "true"; AlertMsg:= "true"; PbmCount := PbmCount +1; else StatinMissing := "false"; If patientage < 76 and IntStatinFound = "" and InStatContra = "false" then IntStatinMissing := "true"; PbmCount := PbmCount +1; endif; endif; MsgProblem := "afib"; else // Stroke Section If AntiplateletFound = "" and AnticoagulantFound = "" and AntiplContra = "false" then AntiplMissing := "true"; AlertMsg:= "true"; PbmCount := PbmCount +1; else AntiplMissing := "false"; endif; If StatinFound = "" and StatinContra = "false" then StatinMissing := "true"; AlertMsg:= "true"; PbmCount := PbmCount +1; else StatinMissing := "false"; If patientage < 75 and IntStatinFound = "" and InStatContra = "false" then IntStatinMissing := "true"; PbmCount := PbmCount +1; endif; endif; MsgProblem := "stroke"; endif; If PbmCount > 0 then If AntiplMissing = "true" then MsgText := MsgText || "\n\n - An antiplatelet medication is recommended for stroke or TIA. This medication or an appropriately documented contraindication is missing."; endif; If AnticgMissing = "true" then MsgText := MsgText || "\n\n - Anticoagulation therapy is recommended in the setting of active or history of Afib or Aflutter. This medication or an appropriately documented contraindication is missing."; endif; If StatinMissing = "true" then MsgText := MsgText || "\n\n - A statin is recommended for stroke or TIA. This medication or an appropriately documented contraindication is missing."; endif; If IntStatinMissing = "true" then MsgText := MsgText || "\n\n - An intensive statin dose is recommended for stroke or TIA patients under 75. This medication or an appropriately documented contraindication is missing."; endif; /* MsgText := "\nAs a Certified Primary Stroke Center, St. Clair Hospital is responsible for complying with American Stroke Association and Joint Commission guidelines for stroke and TIA patients. " || "Currently, your patient will be discharged without an evidence-based recommended medication or an appropriately documented contraindication. " || "Please address in the discharge medication reconciliation or in the Quality Core Measures section of the progress note. \n " || MsgText || " \n\n\n\n "; */ MsgText := "\nBest Practice Recommendations: \n\n " || MsgText || "\n\n\n\n *These are American Stroke Association and Joint Commission recommendations for Primary Stroke Centers. \n\n\n\n "; dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " " || MsgText, "Discharge Medication Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; endif; endif; // Does patient have a Comfort Measures Only Code Status Order? /* dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n\n Coded Problem_Stroke :" ||CodedProblem_Stroke || "\n\n Coded Problem_Afib :" ||CodedProblem_Afib || "\n\n Coded Problem :" ||CodedProblem || "\n\n Patient Age :" || patientage || "\n\n Comfort Meas Only :" || ComfortMeasuresOnlyOrder || "\n\n ContraIndications :" || ContraIndications || "\n\n Anticoagulant Found :" || AnticoagulantFound || "\n\n Antiplatelet Found:" || AntiplateletFound || "\n\n Statin Found :" || StatinFound || "\n\n Intense StatinFound :" || IntStatinFound || " " , ".Stroke Evidence","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; */ endif; // Does patient has a coded problem for Stroke or Arterial Fibrulation? // endif; // Pilot Doctor ;; evoke: order_rec_event; // doc_open_event; ;; logic: conclude true; ;; action: if Error_occurred then write "An error has occured in the MLM {{+B}}SCH_ORDER_REC_SAVED_STROKE_MEDICATIONS{{-B}} " || "Please notify your System Administrators that an error message has occurred for this patient. They will review the following error message: \n" at error_destination; write error_message at error_destination; endif; ;; end: