maintenance: title: Drug and Diagnosis conflicts;; mlmname: STD_DRUG_DIAGNOSIS_CONFLICT;; arden: version 2.5;; version: 18.4;; institution: Allscripts, Standard MLM;; author: Allscripts Healthcare Solutions, Inc.;; specialist: ;; date: 2018-10-26;; validation: testing;; /* P r o p r i e t a r y N o t i c e */ /* Unpublished (c) 2014 - 2018 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved. P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and is protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium, disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users: This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}. All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates. */ /* P r o p r i e t a r y N o t i c e */ library: purpose: Generates a warning when a medication conflicts with the patient{{{SINGLE-QUOTE}}}s diagnoses. Checking occurs when a medication or a diagnosis is entered. ;; explanation: This MLM generates Alerts for DRUG-DIAGNOSIS conflicts. The facility can control how these Alerts are generated by setting flags defined in the MLM and by configuration in the Multum Data Configuration Dictionary. 1. Drug-Diagnosis conflict checking occurs at: * MEDICATION ORDER entry or modification from Sunrise Acute Care or Sunrise Medication Manager * Medication Outpatient orders from Order Reconciliation Manager * PRESCRIPTION entry or renewal from Sunrise Prescription Writer * HEALTH ISSUE entry 2. The Multum Data Configuration Dictionary - Drug-Diagnosis Data is used to set several values that are used in this MLM. They are as follows: * SEVERITY LEVEL FOR MLM CHECKING. The options are: - Minor Potential Hazard - Moderate Potential Hazard - Severe Potential Hazard *PLAUSIBILITY LEVEL FOR MLM CHECKING. The options are: - Minimally Plausible Hazard - Moderately Plausible Hazard - Highly Plausible Hazard * EXCLUDE column. When a drug-diagnosis pair is marked as excluded, an alert will not be generated for that drug-diagnosis pair. * OVERRIDE RIGHTS column. Rights are used to determine if a specific drug-diagnosis pair should NOT generate an alert for a specific group of individuals with that right. * TEXT column. When a drug-diagnosis pair has an enterprise-defined alert text, it is displayed preferentially over the text provided by the drug vendor. * ENTERPRISE SEVERITY column. When a drug-diagnosis pair has an enterprise-defined severity, it is displayed preferentially over the value provided by the drug vendor. * ENTERPRISE PLAUSIBILITY column. When a drug-diagnosis pair has an enterprise-defined plausibility, it is displayed preferentially over the value provided by the drug vendor. 3. The SEND_ALERT flag indicates whether the alert message should be sent to the ancillary system: If this field is set to "" or left blank, then CDS Controller will use the {{{SINGLE-QUOTE}}}Send with order{{{SINGLE-QUOTE}}} setting in the AlertTypes dictionary. (NOTE that the default AlertTypes dictionary setting of {{{SINGLE-QUOTE}}}Send with order{{{SINGLE-QUOTE}}} is unchecked. If it is checked and the send_alert variable is set to blank or "" then all of the alerts for this MLM will be sent with the order.) NOTE this flag only applies to orders. "DoNotSend" = do not send the alert regardless of the AlertTypes dictionary setting for the {{{SINGLE-QUOTE}}}Send with order{{{SINGLE-QUOTE}}} flag "Send" = send the alert regardless of the AlertTypes dictionary setting for the {{{SINGLE-QUOTE}}}Send with order{{{SINGLE-QUOTE}}} flag 4. The ALERT_IF_UNMAPPED flag indicates whether to alert the user that the medication order could NOT be checked because it was unmapped to Multum. NOTE this flag only applies to orders. The choices are: * True = alert the user that the medication order is unmapped. * False = do not alert the user that the medication order is unmapped. 5. The ICD9_CODING_SCHEME_LIST flag is used to find the enterprise-defined names of coding schemes that use ICD9 codes. These names are defined in the Dictionary Codes column from the Coded Health Issue Type Dictionary. 6. The ICD10_CODING_SCHEME_LIST flag is used to find the enterprise-defined names of coding schemes that use ICD10 codes. These names are defined in the Dictionary Codes column from the Coded Health Issue Type Dictionary. 7. The DMS_CODING_SCHEME_LIST flag is used to find the enterprise-defined names of coding schemes that use DSM. These names are defined in the Dictionary Codes column from the Coded Health Issue Type Dictionary. 8. The facility can set MLM flag to allow the site to determine where they want to see Drug Diagnosis Conflicts for Community Health Issue when a Sunrise medication is entered. Set the flag to True to turn on Com- munity Health Issue checking. The default = False; enable_community_data_healthissues_alerts := False; 9. The facility can set MLM flag to allow the site to control the "text" that is displayed in the alert message for Community Health Issue versus a Sunrise Health Issue. The default = " ( Unreconciled ) " . The alert text is configurable. unreconcilied_community_healthissue_alerts_text := " (Unreconciled) " ; 10. The facility can set MLM flag to allow the site to determine where they want to see Drug Diagnosis Conflicts for Community Medication when a Sunrise health issue is entered or modified. Set the flag to True to turn on Community Medication checking. The default = False; enable_community_data_medication_alerts := False; 11. The facility can set MLM flag to allow the site to control the "text" that is displayed in the alert message for Community Medication versus a Sunrise Medication. The default = " ( Pending ) " . The alert text is configurable. pending_community_medication_alerts_text := " (Pending) " ; 12. The facility can set MLM flag to exclude alerts about Drug Diagnosis Conflicts for Community Health Issues and Community Medication in different workflows. The default = empty list () community_data_excluded_triggers_list := (); 13. The facility can set MLM flag to limit drug diagnosis conflict alerts for Community Medication by record age. The default is 366, which means exclude any community medication that is older than 366 days. The number is configurable and can be set to a smaller or larger positive whole number. Set the flag to NULL to include all pending community medications, regardless of its age. exclude_pending_community_meds_older_than_days := 366; Change History 10.25.2013 TMS Updated 6.1 version with St. Clair customization from 5.5 Version to only fire for Physicians and Physician Extenders. CSR 31299 07.13.2014 TMS Added SCH custom changes from 6.1 version to 15.1 version. CSR 33555 02.17.2017 TMS Added SCM custom changes from 15.1 version to 16.3 version CSR 35130 03.03.2017 TMS Remove triggers for Health Issue Entry/Modification and Prescription Entry/Modification. These events were not supressed in new version of MLM for 16.3. HD 2593225 03.19.2019 TMS Added SCM custom changes from 16.3 version to 18.4 version CSR 37676 09.11.2019 TMS Added exclusion for drug diagnosis alert with beta blockers and Heart failure when ordered from the Admission Orders - CHF Order Set. CSR 38465 09.30.2019 TMS Updated alert to require reason when alert presented to user not in physician/physician extender group. CSR 37977 ;; keywords: Drug-Diagnosis, ICD9, ICD10 ,Health Issue ;; citations: {{+B}}Development{{-B}}: Drug information provided by Cerner Multum, Inc. Drug information can be customized and configured by local facility. {{+B}}Funding{{-B}}: Cerner Multum, Inc. {{+B}}Release{{-B}}: VantageRx Multum Database ;; knowledge: type: data-driven;; data: //***************Make Changes To Spelling And Flags In This Section************ // Set to true if logging is needed. log_execution_info := false; // Set to true if you want to display a message for any unmapped drugs. alert_if_unmapped:= false; // Set the text for this variable to indicate whether to send/print the Alert // message. // Note: This flag is used for Catalog based orders only. send_alert := "DoNotSend"; // List the enterprise names of the active ICD9 coding schemes // from the Coded Health Issue Type dictionary ICD9_coding_scheme_list := ("ICD9", "ICD9CM", "ICD-9-Billable"); // List the enterprise names of the active ICD10 coding schemes // from the Coded Health Issue Type dictionary ICD10_coding_scheme_list := ("ICD10", "ICD10CM", "ICD-10-Billable"); // List the enterprise names of the active SNOMEDCT coding schemes // from the Coded Health Issue Type dictionary SNOMEDCT_coding_scheme_list := ("SNOMED", "SNOMEDCT", "PT_SNOMEDCT" ); // List the enterprise names of the active DSM-IV coding schemes // from the Coded Health Issue Type dictionary DSM_IV_coding_scheme_list := ("DSM", "DSM-IV" ) ; //Add "Outpatient Hx" to include Home Medications ("Outpatient Rx", "Outpatient Hx") check_outpatient_orders := ("Outpatient Rx"); // The SYNC_ALERT_DIALOG flag controls the alert override, acknowledgement, // comment, and document requirements in the Synchronous Alert Detail dialog. // The variable is used to set the ALERT_DIALOG_SETTINGS for the synchronous // alert. The following phrases must be placed in a single string: // "No Override Allowed", "Must Acknowledge", "If Acknowledged", // "Must Comment", "Must Document", "Conditionally Document", "Default", "" // Example: "Must Acknowledge, Must Document" sync_alert_dialog := ""; // The ASYNC_ALERT_DIALOG flag controls the comment and document requirements // when the alert is acknowledged in the Asynchronous Alert Detail dialog. The // variable is used to set the ASYNC_ALERT_DIALOG_SETTINGS for the asynchronous // alert. The following phrases must be placed in a single string: // "If Acknowledged", "Must Comment", // "Must Document", "Conditionally Document", "Default", "" // Example: "If Acknowledged, Conditionally Document" async_alert_dialog := ""; // If a document can be attached to the alert, specify its name within the // quotes. // Example: "Alert Override Document" alert_override_document_name := ""; // If you are using "Conditionally Document" for one of the alert dialog // settings, specify the phrases that can make the document mandatory. // Put quotes around each phrase. Put them in a list using parentheses and // Commas. // Example: ("Using different protocol", "Other Reason") document_conditional_text_list := (); // If you are using a User Defined Data Dictionary (UDDD), specify its // name within the quotes. // Example: "My Restricted Dictionary" UDDD_dictionary_name := ""; // If you are using UDDD, specify if is a restricted dictionary or not. // Selections are: TRUE, FALSE UDDD_is_restricted := FALSE; // The drug diagnosis conflict alert flags are as follows: // Set this flag to TRUE to include community health issue data. // Set this flag to FALSE to suppress community health issue data. enable_community_data_healthissue_alerts := FALSE; // Set this flag to FALSE to suppress community medication data enable_community_data_medication_alerts := FALSE; // Enter the list of triggers that you want to exclude from drug diagnosis checking. // The trigger names must be strings. Use double-quotes around the trigger name. // 1. To exclude checking against community health issues when // entering an order, the following triggers are placed in the // list: // ("OrderInitNoIVAdditive","OrderAlternateEnterWithIVAdditive") // 2. To exclude checking against community health issues when // Modifying an order, the following trigger is placed in // the list: // ("OrderModify") // 3. To exclude checking against community health issues when // entering prescription, the following triggers are placed in // the list: // ("PrescriptionInit", "OutpatientOrderInitNoIVAdditive") // 4. To exclude checking against community health issues when // renewing prescription, the following trigger is placed in // the list: // ("PrescriptionRenew") // 5. To exclude checking against community health issues when // entering or verifying pharmacy order, the following trigger // is placed in the list: //("OrderInitPharmacy","OrderDispensePharmacyNew","OrderDispensePharmacyExisting") // 6. To exclude checking against community medication when // entering SCM health issue or accepting community health // issue, the following trigger is placed in the list: // "HealthIssueEnter") // 7. To exclude checking against community medication when // modifying health issue, the following trigger is placed in // the list: // ("HealthIssueModify") // 8. To exclude checking against SCM medication when // Importing community health issue, the following trigger is // placed in the list: // ("HealthIssueImport") // The default is an empty list (). It means that no triggers are excluded for community data community_data_excluded_triggers_list:= (); // Enter the text to differentiate community health issue in drug diagnosis alerts: // Set this flag to "(Unreconciled)" to include unreconciled community health issue data for MLM. unreconciled_community_data_healthissue_alerts := " (Unreconciled)"; pending_community_data_medication_alerts := " (Pending)"; // Set the age (in days) for pending community medications // you do like to exclude from Drug-Diagnosis checking. // Set the value to NULL to turn off the exclusion filter and // include all pending community medications: exclude_pending_community_meds_older_than_days := 366; fire_on_UserCPOE := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT"); fire_on_User := ("RN","RPh"); /* Get the current user{{{SINGLE-QUOTE}}}s occupation*/ userguid :=read last {UserInfo: guid}; UserCode := read last {"Select occupationcode " ||" From cv3user with (nolock) " ||" Where Guid = " || SQL(userguid) }; If usercode in fire_on_UserCPOE then sync_alert_dialog := ""; UDDD_dictionary_name := ""; UDDD_is_restricted := FALSE; continue_processing := true; elseif usercode in fire_on_User then sync_alert_dialog := "Must Comment"; UDDD_dictionary_name := "AlertAckComment"; UDDD_is_restricted := TRUE; continue_processing := true; else continue_processing := false; endif; // Change the message within the quotes if a different short-message is needed. drug_diag_alert:= DESTINATION { Alert } WITH [alert_type := "Warning", short_message :="Drug-Diagnosis Conflict Warning", Priority :="High", Scope := "chart", Rule_group :="ECLP Drug-Diagnosis Conflict", rule_number := 1005, send_with_order := send_alert, alert_abstract:= "", alert_dialog_settings := sync_alert_dialog, async_alert_dialog_settings := async_alert_dialog, document_name := alert_override_document_name, document_conditional_text := document_conditional_text_list, ack_comment_UDDD := UDDD_dictionary_name, ack_comment_UDDD_is_restricted := UDDD_is_restricted ]; // Declare MLMs that can be called from this MLM func_multum_references := MLM {{{SINGLE-QUOTE}}}STD_FUNC_MULTUM_REFERENCES{{{SINGLE-QUOTE}}}; func_community_data_retrieval_rules:= MLM {{{SINGLE-QUOTE}}}STD_FUNC_COMMUNITY_DATA_RETRIEVAL_RULES{{{SINGLE-QUOTE}}}; // The MLM will run at the following triggers: initialized_order := event {OrderInitNoIVAdditives User Order: where TypeCode = "Medication" }; initialized_patient_group_order := event {OrderInitNoIVAdditives Batch Order: where TypeCode = "Medication" AND IsCreatedFromPatientGroupOrderTemplate = TRUE}; entered_order := event {OrderEnterWithIVAdditives User Order: where TypeCode = "Medication" }; entered_patient_group_order := event {OrderEnterWithIVAdditives Batch Order: where TypeCode = "Medication" AND IsCreatedFromPatientGroupOrderTemplate = TRUE}; modified_order := event {OrderModify User Order: where TypeCode = "Medication" }; //"Outpatient Prescription and Home Medication Orders, //Comment out below triggers to exclude checking all Outpatient Orders //To include Home Medications remove the line {{{SINGLE-QUOTE}}}AND OrderAdditionalInfo.IsScript <> FALSE{{{SINGLE-QUOTE}}} initialized_outpatient_order := event {OutpatientOrderInitNoIVAdditive User Order: where TypeCode <> "other" AND OrderAdditionalInfo.IsScript <> FALSE }; pharm_order_init:= event {OrderInitPharmacy User Order: where TypeCode = "Medication" }; pharm_dispense_new := event {OrderDispensePharmacyNew Any Order: where TypeCode = "Medication" }; pharm_dispense_exist := event {OrderDispensePharmacyExisting Any Order: where TypeCode = "Medication" }; prescription_enter := event {PrescriptionInit Any ClientPrescription: where PrescriptionTypeDescription in ("Rx", "Hx") //and SourceApplicationType NOT in (10, 15) }; prescription_renew := event {PrescriptionRenew User ClientPrescription: where PrescriptionTypeDescription in ("Rx") }; health_issue_enter_event := event {HealthIssueEnter Any HealthIssue: where CodedHealthIssueGUID is present and CodedHealthIssueGUID <> 0 }; health_issue_modify_event := event {HealthIssueModify Any HealthIssue: where CodedHealthIssueGUID is present and CodedHealthIssueGUID <> 0 }; //Uncomment the imported_healthissue event if you want the drug //diagnosis alert to occur when community health issue is imported into the //Sunrise database. Otherwise, keep it commented out. //If you uncomment this event, please make sure to also uncomment //the equivalent in the evoke slot. //imported_healthissue := event {HealthIssueImport Any HealthIssue: // where CodedHealthIssueGUID is present // and CodedHealthIssueGUID <>0 }; alert_check_order := event {AlertCheckingOrder User Order: where ComplexOrderType not in (2, 4, 6) and TypeCode = "Medication" }; alert_check_prescription := event {AlertCheckingClientPrescription User ClientPrescription }; // Uncomment this section if you would like historical session type orders // to evoke this MLM, Otherwise, keep it commented out and this MLM will // ignore historical session type orders. // If you uncomment this section, make sure to also uncomment the // equivalent in the evoke clause. /* order_alternate_enter_IV_trigger:= event {OrderAlternateEnterWithIVAdditive User Order: where TypeCode = "Medication" AND AlternateOrderType = 1 }; order_alternate_enter_NOIV_trigger := event {OrderAlternateEnterNoIVAdditive User Order: where TypeCode = "Medication" AND AlternateOrderType = 1 }; order_alternate_modify_trigger := event {OrderAlternateModify User Order: where TypeCode = "Medication" AND AlternateOrderType = 1 }; */ //***************************************************************************** // This block executes only when this MLM is called by the editor if called_by_editor then object_choice := "Order"; if (object_choice = "Order") then EvokingObject:= read last {Order: This WHERE TypeCode = "Medication" // AND //Name = "Ampicillin" }; EvokingEventType := entered_order.type; elseif object_choice = "Prescription" then EvokingObject:= read last {ClientPrescription: This WHERE PrescriptionTypeDescription in ("Rx", "Hx") }; EvokingEventType := prescription_enter.type; elseif object_choice = "HealthIssue" then EvokingObject := read last {HealthIssue: This WHERE CHICode = "580.9" }; EvokingEventType := health_issue_enter_event.type; endif; endif; // if called_by_editor // Initialize variables // fire_on_User := ("IT","MD","DO","DDS","DPM","PA","PA-C","CRNP","RPh"); // continue_processing:= usercode in fire_on_User; // continue_processing := true; pending_community_healthissue_text_with_formatting:= "{{+B}}" || unreconciled_community_data_healthissue_alerts || "{{-B}}"; pending_community_data_medication_alerts_with_formatting := "{{+B}}" || pending_community_data_medication_alerts || "{{-B}}"; pending_community_abstract_alert_text := "(Community Data)"; mlmName := "STD_DRUG_DIAGNOSIS_CONFLICT"; //checking the flag enable_community_data_allergy_alerts //to make sure that the below SUB MLM is called only when the flag is true. if(enable_community_data_healthissue_alerts OR enable_community_data_medication_alerts) then (can_perform,can_retrieve_data_obj) := call func_community_data_retrieval_rules with ( EvokingObject, EvokingEventType, mlmName, community_data_excluded_triggers_list ); can_retrieve_pending_imported_healthissues := false; can_retrieve_pending_imported_medications := false; if(enable_community_data_healthissue_alerts = true) then can_retrieve_pending_imported_healthissues := can_retrieve_data_obj.UnreconciledImportedHealthIssues; endif; if(enable_community_data_medication_alerts = true) then can_retrieve_pending_imported_medications := can_retrieve_data_obj.PendingImportedMedications; endif; else can_perform := true; can_retrieve_pending_imported_healthissues := false; can_retrieve_pending_imported_medications := false; endif; (current_healthissue_closed_status):= read last {"SELECT IsClosed FROM cv3healthissuestatus WHERE Code={{{SINGLE-QUOTE}}}"|| EVOKINGOBJECT.Status ||"{{{SINGLE-QUOTE}}}"}; //check if the evoking object is health issue. If yes, check if enable_community_data_healthissue_alerts //flag is false and the health issue is a community one. In such a case, update the can_perform flag to true. if(EvokingObject is HealthIssueDeclaration ) then (current_imported_healthissue_translated_closed_status):= read last {"SELECT IsClosed FROM cv3healthissuestatus WHERE Code={{{SINGLE-QUOTE}}}"|| EVOKINGOBJECT.CommunityStatus ||"{{{SINGLE-QUOTE}}}"}; if(EvokingEventType = imported_healthissue.type AND EvokingObject.InternalStateType = 1 AND (enable_community_data_healthissue_alerts = false OR current_imported_healthissue_translated_closed_status = TRUE) ) then can_perform := false; endif; if(EvokingEventType = health_issue_enter_event.type AND current_healthissue_closed_status = TRUE) then can_perform := false; endif; endif; // Get patient Information (user_guid):= read last { StateInfo: UserGUID }; index_list := 1 seqto count (ICD9_coding_scheme_list); for JJ in index_list do ICD9_coding_scheme := ICD9_coding_scheme_list[JJ]; ICD9_coding_scheme_xml := ICD9_coding_scheme_xml || " \n"; enddo; index_list := 1 seqto count (ICD10_coding_scheme_list); for JJ in index_list do ICD10_coding_scheme := ICD10_coding_scheme_list[JJ]; ICD10_coding_scheme_xml := ICD10_coding_scheme_xml || " \n"; enddo; index_list := 1 seqto count (SNOMEDCT_coding_scheme_list); for JJ in index_list do SNOMEDCT_coding_scheme := SNOMEDCT_coding_scheme_list[JJ]; SNOMEDCT_coding_scheme_xml := SNOMEDCT_coding_scheme_xml || " \n"; enddo; index_list := 1 seqto count (DSM_IV_coding_scheme_list); for JJ in index_list do DSM_IV_coding_scheme := DSM_IV_coding_scheme_list[JJ]; DSM_IV_coding_scheme_xml := DSM_IV_coding_scheme_list_xml || " \n"; enddo; /* set current EP settings*/ (current_ep_settings):= read last {"SELECT Value FROM HVCEnvProfile where" || " Code={{{SINGLE-QUOTE}}}Enable ICD CodeSet{{{SINGLE-QUOTE}}}"}; current_codingScheme:= "" || current_ep_settings || ""; evoked_from_prescriptions := false; evoked_from_health_issue := false; // flag for which outpatient orders should be checked during reverse checking outpatient_orders_flag := 0; outpatient_rx_str := "Outpatient Rx"; outpatient_hx_str := "Outpatient Hx"; evoking_order_is_outpatient := false; reinstate_healthissue:=false; (backup_healthissue_closed_status):= read last {"SELECT IsClosed FROM cv3healthissuestatus WHERE Code={{{SINGLE-QUOTE}}}"|| EvokingObject.Backup.Status ||"{{{SINGLE-QUOTE}}}"}; if current_healthissue_closed_status=false and backup_healthissue_closed_status=true then reinstate_healthissue:=true; endif; if can_perform then if (EvokingObject IS ClientPrescription) then evoked_from_prescriptions := true; (evoking_prescription_name, evoking_prescription_name_id, evoking_prescription_start_date, evoking_prescription_renewal_date, evoking_prescription_status_type, evoking_prescription_type, evoking_prescription_source, client_guid, chart_guid, visit_guid ) := read last { ClientPrescription: DrugName, GenericNameID, StartDate, RenewalDate, StatusTypeDescription, PrescriptionType, AlertOnDemandSource, ClientGUID, ChartGUID, ClientVisitGUID REFERENCING EvokingObject }; /* elseif (EvokingObject IS HealthIssue) */ elseif (EvokingEventType = health_issue_enter_event.type) OR (EvokingEventType = imported_healthissue.type) OR (EvokingEventType = health_issue_modify_event.type and reinstate_healthissue=true) then evoked_from_health_issue := true; if (count (check_outpatient_orders) > 0) then //set the outpatient_orders_flag to include outpatient rx and/or //outpatient hx based on settings in check_outpatient_orders_list if (outpatient_rx_str in check_outpatient_orders) then outpatient_orders_flag := outpatient_orders_flag + 1; endif; if (outpatient_hx_str in check_outpatient_orders) then outpatient_orders_flag := outpatient_orders_flag + 2; endif; endif; (evoking_health_issue_CHITypeCode, evoking_health_issue_CHICode, evoking_health_issue_codingScheme, evoking_health_issue_guid, evoking_health_issue_coded_health_issue_guid, evoking_health_issue_short_name, client_guid, chart_guid, visit_guid, evoking_health_issue_ICD9Code, evoking_health_issue_ICD10Code, health_issue_active_flag, evoking_health_issue_internal_state_type, HealthIssueBackupObj ) := read last { HealthIssue: CHITYPECODE, CHICODE,CodingScheme, GUID, CodedHealthIssueGUID, ShortName,ClientGUID, ChartGUID, ClientVisitGUID,ICD9Code, ICD10Code, Active,InternalStateType, Backup REFERENCING EvokingObject }; IF (( evoking_health_issue_CHITypeCode IN ICD9_coding_scheme_list OR evoking_health_issue_CHITypeCode IN ICD10_coding_scheme_list OR evoking_health_issue_CHITypeCode IN SNOMEDCT_coding_scheme_list OR evoking_health_issue_CHITypeCode IN DSM_IV_coding_scheme_list )) then if evoking_health_issue_guid is null then evoking_health_issue_guid := 0; evoking_health_issue_coded_health_issue_guid := 0; endif; /* As per current EP settings , change in evoking_health_issue_xml*/ if(current_ep_settings MATCHES PATTERN "%ICD9%" AND NOT(current_ep_settings MATCHES PATTERN "%ICD10%")) then evoking_health_issue_xml := evoking_health_issue_xml || " \n"; current_codingScheme:=current_ep_settings; endif; if (current_ep_settings MATCHES PATTERN "%ICD10%" AND NOT(current_ep_settings MATCHES PATTERN "%ICD9%")) then evoking_health_issue_xml := evoking_health_issue_xml || " \n"; current_codingScheme:=current_ep_settings; endif; if (current_ep_settings MATCHES PATTERN "%ICD9%" AND current_ep_settings MATCHES PATTERN "%ICD10%" ) then codingScheme:=evoking_health_issue_codingScheme; if (current_ep_settings MATCHES PATTERN "%ICD9%" AND current_ep_settings MATCHES PATTERN "%ICD10%" ) then evoking_health_issue_xml := evoking_health_issue_xml || " \n"; if(codingScheme IS IN ICD9_coding_scheme_list) then current_codingScheme:="ICD9"; endif; if(codingScheme IS IN ICD10_coding_scheme_list) then current_codingScheme:="ICD10"; endif; if(codingScheme IS IN SNOMEDCT_coding_scheme_list) then current_codingScheme:="SNOMEDCT"; endif; endif; endif; // Get the unsubmitted orders that should be checked for drug-diagnosis // interactions. These are New or Modified orders ( unsubmitted_intended_action_list, unsubmitted_order_name_list, unsubmitted_order_guid_list, unsubmitted_catalog_item_guid_list, unsubmitted_order_additiveobj_list, unsubmitted_order_start_date_list, unsubmitted_order_status_type_list, unsubmitted_order_entry_form_guid_list, unsubmitted_alternate_order_type_list, unsubmitted_order_additional_info_obj_list, unsubmitted_order_entered_date_list ) := read{ Unsubmitted Order: IntendedAction, Name, GUID, OrderCatalogMasterItemGUID, OrderComponent, SignificantDtm, OrderStatusCode, OrderEntryFormGUID, AlternateOrderType, OrderAdditionalInfo, Entered WHERE TypeCode = "Medication" AND ( IntendedAction IS NULL OR IntendedAction IS IN ("Add New","Modify","Modified","Suspend")) }; unsubmitted_order_is_script_list := (); index_list := 1 seqto count (unsubmitted_order_additional_info_obj_list); for JJ in index_list do OrderAdditionalInfoObj := unsubmitted_order_additional_info_obj_list[jj]; (unsubmitted_order_additional_info_is_script) := read { OrderAdditionalInfo: IsScript REFERENCING OrderAdditionalInfoObj}; unsubmitted_order_is_script_list := unsubmitted_order_is_script_list, unsubmitted_order_additional_info_is_script; enddo; // For each unsubmitted order, add the order-name and additive info (if any), // to the list of unsubmitted order names to be processed. unsubmitted_order_parameter_xml := ""; index_list := 1 seqto count (unsubmitted_order_name_list); for JJ in index_list do unsubmitted_cat_guid := unsubmitted_catalog_item_guid_list[JJ]; unsubmitted_order_guid := unsubmitted_order_guid_list[JJ]; unsubmitted_additiveObj := unsubmitted_order_additiveobj_list[JJ]; unsubmitted_order_name := unsubmitted_order_name_list[JJ]; unsubmitted_order_start_date := unsubmitted_order_start_date_list[JJ]; unsubmitted_order_status_type := unsubmitted_order_status_type_list[JJ]; unsubmitted_order_entry_form_guid := unsubmitted_order_entry_form_guid_list[JJ]; if ( unsubmitted_order_start_date is null ) then unsubmitted_order_start_date := ""; endif; unsubmitted_alternate_order_type := unsubmitted_alternate_order_type_list[jj]; unsubmitted_order_is_script := unsubmitted_order_is_script_list[jj]; unsubmitted_order_entered_date := unsubmitted_order_entered_date_list[jj]; if ( unsubmitted_order_entered_date is null ) then unsubmitted_order_entered_date := ""; endif; unsubmitted_order_parameter_xml := unsubmitted_order_parameter_xml || " \n"; // If there are additives obtain the info if exist unsubmitted_additiveObj then ( temp_additive_name_list, temp_item_guid_list, temp_additive_guid_list ):= read{ OrderComponent: Name, OrderCatalogMasterItemGUID, GUID REFERENCING unsubmitted_additiveObj WHERE (Dosage AS Number) > 0 }; additive_index_list := 1 seqto count(temp_additive_name_list); for additive_ind in additive_index_list do unsubmitted_additive_cat_GUID := temp_item_guid_list[additive_ind]; unsubmitted_additive_name := temp_additive_name_list[additive_ind]; unsubmitted_additive_guid := temp_additive_guid_list[additive_ind]; if (unsubmitted_additive_cat_GUID is null) then unsubmitted_additive_cat_GUID := 0; endif; if (unsubmitted_order_start_date is null) then unsubmitted_order_start_date := ""; endif; unsubmitted_additive_xml := " \n"; unsubmitted_order_parameter_xml := unsubmitted_order_parameter_xml || unsubmitted_additive_xml; enddo; //for additive_index_list endif; //if exist unsubmitted_additiveObj enddo; //for for JJ // Get the unsubmitted prescription - New or Modified prescriptions ( unsubmitted_Rx_name_list, unsubmitted_Rx_prescription_id_list, unsubmitted_Rx_cds_unique_guid_list, unsubmitted_Rx_generic_name_id_list, unsubmitted_Rx_start_date_list, unsubmitted_Rx_renewal_date_list, unsubmitted_Rx_prescription_type_list ) := read { Unsubmitted ClientPrescription: DrugName, PrescriptionID, CDSUniqueIDGUID, GenericNameID, StartDate, RenewalDate, PrescriptionType WHERE PrescriptionTypeDescription in ("Rx", "Hx") }; unsubmitted_Rx_parameter_xml := ""; unsubmitted_Rx_index_list := 1 seqto count(unsubmitted_Rx_name_list); for unsubmitted_Rx_ind in unsubmitted_Rx_index_list do unsubmitted_Rx_name := unsubmitted_Rx_name_list[unsubmitted_Rx_ind]; unsubmitted_Rx_generic_name_id := unsubmitted_Rx_generic_name_id_list[unsubmitted_Rx_ind]; unsubmitted_Rx_prescription_id := unsubmitted_Rx_prescription_id_list[unsubmitted_Rx_ind]; unsubmitted_Rx_start_date:= unsubmitted_Rx_start_date_list[unsubmitted_Rx_ind]; unsubmitted_Rx_renewal_date := unsubmitted_Rx_renewal_date_list[unsubmitted_Rx_ind]; unsubmitted_Rx_prescription_type := unsubmitted_Rx_prescription_type_list[unsubmitted_Rx_ind]; if( unsubmitted_Rx_renewal_date is not null ) then unsubmitted_Rx_start_date := unsubmitted_Rx_renewal_date; elseif (unsubmitted_rx_start_date is null) then unsubmitted_Rx_start_date := ""; endif; unsubmitted_Rx_parameter_xml := unsubmitted_Rx_parameter_xml || " \n"; enddo; // END for unsubmitted_Rx_ind else continue_processing := false; endif; elseif (EvokingObject IS Order) then // Get the order component object associated with the evoking order (evoking_order_name, evoking_cat_item_guid, evoking_order_guid, evoking_order_start_date, order_type, OrdComponentObj, PharmOrderObj, evoking_complex_order_type, OrderVariableComponentObj, evoking_order_status, evoking_order_source, evoking_order_form_guid, client_guid, chart_guid, visit_guid, evoking_alternate_order_type, evoking_order_entered_date, AdditionalInfoObj, OrderBackupObj ) := read last { Order: Name, OrderCatalogMasterItemGUID, GUID, SignificantDtm, TypeCode, OrderComponent, PharmacyOrder, ComplexOrderType, OrderVariableComponent, Status, AlertOnDemandSource, OrderEntryFormGUID ClientGUID, ChartGUID, ClientVisitGUID, AlternateOrderType, Entered, OrderAdditionalInfo, Backup REFERENCING EvokingObject }; (evoking_order_is_script) := read last {OrderAdditionalInfo: IsScript REFERENCING AdditionalInfoObj }; if (alternate_order_type = 2) then evoking_order_is_outpatient := true; endif; if (evoking_order_is_script is null) then evoking_order_is_script := 0; endif; else continue_processing := false; endif; // EvokingEventType = initialized_order.type... else continue_processing := false; endif; // Get patient ID (guid) if client_guid is null or client_guid = 0 then client_guid := read last {ClientInfo: GUID}; endif; if chart_guid is null then chart_guid := 0; endif; if visit_guid is null then visit_guid := 0; endif; //for order modify, only continue if IV additives have been added if ( EvokingEventType = modified_order.type OR EvokingEventType = order_alternate_modify_trigger.type ) then BackupOrderComponentObj := OrderBackupObj.OrderComponent; (BackupComponentNamelist, BackupComponentGUIDlist, BackupComponentOrderCatalogMasterItemGUIDlist ) := read { OrderComponent: Name, GUID, OrderCatalogMasterItemGUID REFERENCING BackupOrderComponentObj }; (NewComponentNamelist, NewComponentGUIDlist, NewComponentOrderCatalogMasterItemGUIDlist ) := read { OrderComponent: Name, GUID, OrderCatalogMasterItemGUID REFERENCING OrdComponentObj }; if NewComponentGUIDlist IS NULL then continue_processing := FALSE; else NewComponents := (); num_components := count (NewComponentOrderCatalogMasterItemGUIDlist); for JJ in (1 seqto num_components ) do one_new_component:= NewComponentOrderCatalogMasterItemGUIDlist[JJ]; if NOT one_new_component IN BackupComponentOrderCatalogMasterItemGUIDlist then NewComponents:= NewComponents, one_new_component; endif; // NOT one_new_component enddo; //for J in (1 seqto num_components) if count (NewComponents) = 0 then continue_processing := FALSE; endif; endif; //if NewComponentGUIDlist is NULL endif; //EvokingEventType = modified_order.type if continue_processing then // Create lists for processing if (evoked_from_prescriptions) then if (evoking_prescription_name_id <> -1) then order_name_list := ,evoking_prescription_name; generic_nameID_list := ,evoking_prescription_name_id; start_date_list := ,evoking_prescription_start_date; status_type_list := ,evoking_prescription_status_type; prescription_type_list := evoking_prescription_type; source_list := ,evoking_prescription_source; endif; elseif NOT(evoked_from_health_issue) then order_name_list := ,evoking_order_name; order_guid_list := ,evoking_order_guid; cat_item_guid_list := ,evoking_cat_item_guid; start_date_list := ,evoking_order_start_date; status_type_list := ,evoking_order_status; source_list := ,evoking_order_source; endif; // evoked_from_prescriptions // Get pharmacy order objects if exists PharmOrderObj then is_pharmacy_order := true; pharm_OrderOption_Obj := read last { PharmacyOrder : PharmacyOrderOption REFERENCING PharmOrderObj }; if exists pharm_OrderOption_Obj then (pharm_OrdOptComponent_obj, pharm_OrdOptComponent_OVC_guid) := read first {PharmacyOrderOption : PharmacyOrderOptionComponent, OrderVariableComponentGUID REFERENCING pharm_OrderOption_Obj }; endif; //if exists pharm_OrderOption_Obj endif; // if exists PharmOrderObj // Get all pharmacy order option component data if is_pharmacy_order and exists pharm_OrdOptComponent_obj then (opt_comp_ocmi_name_list, opt_comp_ocmi_guid_list, opt_comp_drug_catalog_key_list, opt_comp_is_primary_list, opt_comp_current_disp_item_list) := read {PharmacyOrderOptionComponent : OrderCatalogMasterItemName, OrderCatalogMasterItemGUID, DrugCatalogKey, IsPrimary,IsCurrentDispensedItem REFERENCING pharm_OrdOptComponent_obj }; // Check to see if this is a complex order if exists OrderVariableComponentObj then this_is_complex_order := TRUE; first_order_variable_component_guid := read first {OrderVariableComponent: GUID REFERENCING OrderVariableComponentObj}; If pharm_OrdOptComponent_OVC_guid = first_order_variable_component_guid then this_is_matching_first_component := TRUE; is_primary_first_opt_comp := opt_comp_is_primary_list[1]; is_current_dispensed_first_opt_comp := opt_comp_current_disp_item_list[1]; // Only process complex orders when primary item is dispensed if is_primary_first_opt_comp AND is_current_dispensed_first_opt_comp then continue_processing := TRUE; else continue_processing := FALSE; endif; else continue_processing := FALSE; endif; //pharm_OrdOptComponent_OVC_guid endif; // if exists OrderVariableComponentObj endif; // if is_pharmacy_order // Do not process if this is a complex order and not primary component if continue_processing then // Initialize lists current_ocmi_name_list := (); current_ocmi_guid_list := (); current_drug_key_list := (); current_start_date_list := (); current_status_type_list := (); current_source_list := (); rest_of_ocmi_name_list := (); rest_of_drug_key_list := (); // Get the current items being dispensed (there could be several) current_ocmi_name_list := opt_comp_ocmi_name_list where opt_comp_current_disp_item_list; current_ocmi_guid_list := opt_comp_ocmi_guid_list where opt_comp_current_disp_item_list; current_drug_key_list := opt_comp_drug_catalog_key_list where opt_comp_current_disp_item_list; // Create separate list for those already processed rest_of_ocmi_name_list := opt_comp_ocmi_name_list where NOT opt_comp_current_disp_item_list; rest_of_ocmi_guid_list := opt_comp_ocmi_guid_list where NOT opt_comp_current_disp_item_list; rest_of_drug_key_list := opt_comp_drug_catalog_key_list where NOT opt_comp_current_disp_item_list; if exists current_ocmi_guid_list then // Reset list to clear evoking order in order to add pharmacy // components order_name_list := (); cat_item_guid_list := (); drug_key_list := (); start_date_list := (); status_type_list := (); order_guid_list := (); order_entry_form_guid_list := (); // Loop through the list of current dispensed components to // see if any items have already been processed. i := 1; for this_guid in current_ocmi_guid_list do this_item_name := current_ocmi_name_list[i]; this_key := current_drug_key_list[i]; // Do not process if this is the same item checked at // OrderPharmacyInit. if this_guid = evoking_cat_item_guid and EvokingEventType = pharm_dispense_new.type then no_alert_this_one:= true; else // Do not process if the same OCMI guid has been // processed before if (this_guid is in rest_of_ocmi_guid_list) then no_alert_this_one:= true; else // Do not process if item with same drug key // previously processed if (this_key is in rest_of_drug_key_list) then no_alert_this_one:= true; else // Add this one to the list to check order_name_list := order_name_list, this_item_name; cat_item_guid_list := cat_item_guid_list, this_guid; drug_key_list := drug_key_list, this_key; start_date_list := start_date_list, evoking_order_start_date; status_type_list := status_type_list, evoking_order_status; source_list := source_list, evoking_order_source; endif; // if (this_key is in rest_of_drug_key_list endif; // if (this_guid is in rest_of_ocmi_guid_list endif; // if this_guid = evoking_cat_item_guid i := i +1; enddo; // for this_guid in current_list endif; // if exists current_ocmi_guid endif; // if continue_processing // Only retrieve data if the Evoking Order has IV additives If exist OrdComponentObj AND EvokingEventType = entered_order.type OR EvokingEventType = modified_order.type OR EvokingEventType = alert_check_order.type OR EvokingEventType = order_alternate_enter_IV_trigger.type OR EvokingEventType = order_alternate_modify_trigger.type OR EvokingEventType = entered_patient_group_order.type OR EvokingEventType = pharm_dispense_exist.type OR EvokingEventType = pharm_dispense_new.type then // Get the catalog item from the order component object (additive_name_list, additive_cat_item_guid_list) := read { OrderComponent: Name, OrderCatalogMasterItemGUID REFERENCING OrdComponentObj where (Dosage AS Number) > 0 }; endif; // If exist OrdComponentObj endif; // continue_processing if continue_processing then // Call SCMDrugDiagnosisConflictAlertSelPr to check for Drug-Diagnosis // Conflicts MedicationIDList := (); MedicationDNumList:= (); MedicationIngredientDNumList:= (); MedicationStartDateList:=(); MedicationNameList:=(); MedicationGenericNameList :=(); MedicationIngredientNameList :=(); DiagnosisICD9CodeList :=(); DiagnosisICD9NameList :=(); DiagnosisICD10CodeList :=(); DiagnosisCodeList :=(); MultumConditionList :=(); ConflictTextList :=(); ConflictTextIDList := (); PlausibilityList :=(); SeverityList :=(); StatusList :=(); MedTypeList := (); IsIVAdditiveList :=(); IsSolutionList := (); TextTitleList := (); SeverityIDList := (); PlausibilityIDList := (); AlternateOrderTypeList := (); IsScriptList := (); EnteredDateList := (); DiagnosisInternalStateTypeList := (); Medication_Hx_Rx_Community_TypeCodeList := (); // Add evoking object information in the input XML parameter if (EvokingObject is Order) then // order has pharmacy components status_type := ""; if(drug_key_list is not null and (count ( drug_key_list ) > 0) ) then pharm_cat_item_guid_count:= 1 seqto count( drug_key_list ); for pharm_ind in pharm_cat_item_guid_count do evoking_pharm_cat_GUID:= cat_item_guid_list[pharm_ind]; evoking_pharm_name:= order_name_list[pharm_ind]; evoking_pharm_drug_key := drug_key_list[pharm_ind]; evoking_pharm_start_date := start_date_list[pharm_ind]; status_type := status_type_list[pharm_ind]; if (evoking_pharm_cat_GUID is not null) then if(evoking_pharm_start_date is null) then evoking_pharm_start_date := ""; endif; evoking_pharm_parameter_xml := " \n"; evoking_order_parameter_xml := evoking_order_parameter_xml || evoking_pharm_parameter_xml; endif; // if (evoking_additive_cat_GUID is not null) enddo; // regular evoking order else if evoking_order_start_date is null then evoking_order_start_date := ""; endif; if evoking_order_entered_date is null then evoking_order_entered_date := ""; endif; if evoking_order_form_guid is null then evoking_order_form_guid := "0"; endif; if EvokingEventType = alert_check_order.type then if evoking_order_source = "EvokingCatalog" then status_type := "Selected"; elseif evoking_order_source = "Worksheet" then status_type := "Unsubmitted"; else status_type := ""; endif; else status_type := "Current"; endif; evoking_order_parameter_xml := " \n"; endif; additive_index_list := 1 seqto count (additive_cat_item_guid_list); for additive_ind in additive_index_list do evoking_additive_cat_GUID := additive_cat_item_guid_list[additive_ind]; evoking_additive_name := additive_name_list[additive_ind]; if (evoking_additive_cat_GUID is not null) then if(evoking_order_start_date is not null) then evoking_order_start_date := ""; endif; evoking_additive_xml := " \n"; evoking_order_parameter_xml := evoking_order_parameter_xml || evoking_additive_xml; endif; enddo; elseif (EvokingObject is ClientPrescription) then if(evoking_prescription_renewal_date is not null) then evoking_prescription_start_date := evoking_prescription_renewal_date; elseif (evoking_prescription_start_date is null) then evoking_prescription_start_date := ""; endif; status_type := ""; if EvokingEventType = prescription_enter.type then status_type := "New"; elseif EvokingEventType = prescription_renew.type then status_type := "Active"; elseif EvokingEventType = alert_check_prescription.type then if evoking_prescription_source = "EvokingCatalog" then status_type := "Selected"; elseif evoking_prescription_source = "Worksheet" then status_type := "Unsubmitted"; else status_type := evoking_prescription_status_type; endif; else status_type := evoking_prescription_status_type; endif; evoking_Rx_parameter_xml := " \n"; endif; // END if EvokingObject - for adding evoking object info // exclude pending community medication parameter exclude_community_medication_older_than_days := ""; if (exclude_pending_community_meds_older_than_days is not null) then exclude_community_medication_older_than_days := exclude_pending_community_meds_older_than_days; endif; // Combine the evoking order, evoking Rx, unsubmitted order, unsubmitted Rx input_parameter_xml := "\n\n" || evoking_order_parameter_xml || evoking_Rx_parameter_xml || unsubmitted_order_parameter_xml || unsubmitted_Rx_parameter_xml || evoking_health_issue_xml || ICD9_coding_scheme_xml || ICD10_coding_scheme_xml || SNOMEDCT_coding_scheme_xml || DSM_IV_coding_scheme_xml || "\n"; (MedicationIDList, MedicationDNumList, MedicationIngredientDNumList, ConflictTextIDList, ConflictTextList, MedicationNameList, MedicationGenericNameList, MedicationIngredientNameList, DiagnosisICD9CodeList, DiagnosisICD9NameList, DiagnosisICD10CodeList, DiagnosisCodeList, MultumConditionList, MedicationStartDateList, PlausibilityList, SeverityList, StatusList, MedTypeList, IsIVAdditiveList, IsSolutionList, TextTitleList, SeverityIDList, PlausibilityIDList, AlternateOrderTypeList, IsScriptList, EnteredDateList, DiagnosisInternalStateTypeList, Medication_Hx_Rx_Community_TypeCodeList) := read{ "EXEC SCMDrugDiagnosisConflictAlertSelPr " || SQLEX(client_guid) || " ," || SQLEX(chart_guid) || " ," || SQLEX(visit_guid) || " ," || SQLEX(user_guid) || " ," || SQLEX(input_parameter_xml) || " ," || SQLEX(evoked_from_health_issue) || " ," || SQLEX(current_codingScheme) || " ," || SQLEX(outpatient_orders_flag) || " ," || SQLEX(can_retrieve_pending_imported_healthissues) || " ," || SQLEX(can_retrieve_pending_imported_medications)|| " ," || SQLEX(exclude_community_medication_older_than_days)}; // added to exclude heart failure diagnosis alert with beta blocker when ordered from Admission Orders - CHF order set TMS 09.11.209 If EVOKINGOBJECT.OrderSetName = "Admission Orders - CHF" and EVOKINGOBJECT.OrderSubsetName matches pattern "Beta Blockers%" then number_of_conflicts := count ConflictTextIDList; conflict_index_list:= 1 seqto (number_of_conflicts ); for i in conflict_index_list do if TextTitleList [i] not in ("beta-blockers - CHF", "carvedilol - CHF") then NewMedicationIDList := MedicationIDList [i]; NewMedicationDNumList := MedicationDNumList [i]; NewMedicationIngredientDNumList := MedicationIngredientDNumList [i]; NewConflictTextIDList := ConflictTextIDList [i]; NewConflictTextList := ConflictTextList [i]; NewMedicationNameList := MedicationNameList [i]; NewMedicationGenericNameList := MedicationGenericNameList [i]; NewMedicationIngredientNameList := MedicationIngredientNameList [i]; NewDiagnosisICD9CodeList := DiagnosisICD9CodeList [i]; NewDiagnosisICD9NameList := DiagnosisICD9NameList [i]; NewDiagnosisICD10CodeList := DiagnosisICD10CodeList [i]; NewDiagnosisCodeList := DiagnosisCodeList [i]; NewMultumConditionList := MultumConditionList [i]; NewMedicationStartDateList := MedicationStartDateList [i]; NewPlausibilityList := PlausibilityList [i]; NewSeverityList := SeverityList [i]; NewStatusList := StatusList [i]; NewMedTypeList := MedTypeList [i]; NewIsIVAdditiveList := IsIVAdditiveList [i]; NewIsSolutionList := IsSolutionList [i]; NewTextTitleList := TextTitleList [i]; NewSeverityIDList := SeverityIDList [i]; NewPlausibilityIDList := PlausibilityIDList [i]; NewAlternateOrderTypeList := AlternateOrderTypeList [i]; NewIsScriptList := IsScriptList [i]; NewEnteredDateList := EnteredDateList [i]; NewDiagnosisInternalStateTypeList := DiagnosisInternalStateTypeList [i]; NewMedication_Hx_Rx_Community_TypeCodeList := Medication_Hx_Rx_Community_TypeCodeList [i]; endif; enddo; MedicationIDList := NewMedicationIDList; MedicationDNumList := NewMedicationDNumList ; MedicationIngredientDNumList := NewMedicationIngredientDNumList; ConflictTextIDList := NewConflictTextIDList; ConflictTextList := NewConflictTextList; MedicationNameList := NewMedicationNameList; MedicationGenericNameList := NewMedicationGenericNameList; MedicationIngredientNameList := NewMedicationIngredientNameList; DiagnosisICD9CodeList := NewDiagnosisICD9CodeList; DiagnosisICD9NameList := NewDiagnosisICD9NameList; DiagnosisICD10CodeList := NewDiagnosisICD10CodeList; DiagnosisCodeList := NewDiagnosisCodeList; MultumConditionList := NewMultumConditionList; MedicationStartDateList := NewMedicationStartDateList; PlausibilityList := NewPlausibilityList; SeverityList := NewSeverityList; StatusList := NewStatusList; MedTypeList := NewMedTypeList; IsIVAdditiveList := NewIsIVAdditiveList; IsSolutionList := NewIsSolutionList; TextTitleList := NewTextTitleList; SeverityIDList := NewSeverityIDList; PlausibilityIDList := NewPlausibilityIDList; AlternateOrderTypeList := NewAlternateOrderTypeList; IsScriptList := NewIsScriptList; EnteredDateList := NewEnteredDateList; DiagnosisInternalStateTypeList := NewDiagnosisInternalStateTypeList; Medication_Hx_Rx_Community_TypeCodeList := NewMedication_Hx_Rx_Community_TypeCodeList; ENDIF; endif; //continue_processing = TRUE // Get the last revision date of the Multum database, strip out time portion revision_date := read last { "select change_date from SXAMTdatabase_infoSYN" }; revision_date := revision_date formatted with "%.2t"; revision_date_string := "\n{{+B}}Revision Date{{-B}}: " || revision_date; //Declare the Med_Data_Object Med_Data_Object := OBJECT [ Sort_field, ConflictTextID, TextTitle ]; ;; priority: 50;; evoke: initialized_order; entered_order; // initialized_patient_group_order; // entered_patient_group_order; // modified_order; // initialized_outpatient_order; // pharm_dispense_new; // pharm_dispense_exist; // pharm_order_init; // prescription_enter; // prescription_renew; // health_issue_enter_event; // health_issue_modify_event; alert_check_order; // alert_check_prescription; // Uncomment this section if you would like historical session type orders // to evoke this MLM. Otherwise, keep it commented out. // If you uncomment this section, please make sure to also uncomment the // equivalent event clauses. // order_alternate_enter_IV_trigger; // order_alternate_enter_NOIV_trigger; // order_alternate_modify_trigger; //Uncomment the imported_healthissue trigger if you want the drug //diagnosis alert //to occur when community health issue is imported into the Sunrise database. //Otherwise, keep it commented out. //If you uncomment this trigger, please make sure to also uncomment //the equivalent event clause. //imported_healthissue; ;; logic: if not (continue_processing) then conclude false; endif; // Initialize Variables indent:= " "; long_alert_message:= ""; conflict_details := ""; drug_diagnosis_conflict_health_issues := ""; drug_diagnosis_conflict_meds := ""; unmapped_medications :=""; unmapped_additives := ""; the_xxx:= ""; extra_info:= ""; alert_abstract_meds := ""; alert_abstract_health_issues := ""; alert_abstract_meds_list :=(); alert_abstract_health_issue_list := (); alert_abstract_unmapped_meds := ""; alert_abstract_unmapped_meds_list := (); PreviousPlausibilitySeverityConflictString := null; checkCode:=""; code:=""; // list that holds all of the objects that will be returned mdo_reference_list := (); conflict_text_count := count ConflictTextList; index_list:= 1 seqto (conflict_text_count); for index_item in index_list do MedicationID := MedicationIDList[index_item]; MedicationStartDate:= MedicationStartDateList[index_item]; MedicationName:= MedicationNameList[index_item]; MedicationGenericName:= MedicationGenericNameList[index_item]; MedicationIngredientName:= MedicationIngredientNameList[index_item]; DiagnosisICD9Code:= DiagnosisICD9CodeList[index_item]; DiagnosisICD9Name:= DiagnosisICD9NameList[index_item]; DiagnosisICD10Code:= DiagnosisICD10CodeList[index_item]; DiagnosisCode:= DiagnosisCodeList[index_item]; MultumCondition:= MultumConditionList[index_item]; ConflictText:= ConflictTextList[index_item]; ConflictTextID := ConflictTextIDList[index_item]; Plausibility:= PlausibilityList[index_item]; Severity:= SeverityList[index_item]; Status:= StatusList[index_item]; MedType := MedTypeList[index_item]; IsIVAdditive := IsIVAdditiveList[index_item]; IsSolution := IsSolutionList[index_item]; TextTitle := TextTitleList[index_item]; AlternateOrderType := AlternateOrderTypeList[index_item]; IsScript := IsScriptList[index_item]; EnteredDate := EnteredDateList[index_item]; InternalStateType := DiagnosisInternalStateTypeList[index_item]; Medication_Hx_Rx_Community_TypeCode := Medication_Hx_Rx_Community_TypeCodeList[index_item]; IsOutpatientOrder := false; if AlternateOrderType = 2 then IsOutpatientOrder := true; endif; if ConflictTextID <> -1 then instance := new Med_Data_Object; instance.Sort_field := TextTitleList[index_item]; instance.ConflictTextID := ConflictTextIDList[index_item]; instance.TextTitle := TextTitleList[index_item]; mdo_reference_list := mdo_reference_list, instance; endif; IsComponent := false; if (MedicationIngredientName is null OR MedicationIngredientName <> MedicationGenericName) then IsComponent := true; endif; if (index_item < conflict_text_count) then NextConflictTextID := ConflictTextIDList[index_item + 1]; else NextConflictTextID := null; endif; if (index_item > 1) then PreviousMedicationIngredientName := MedicationIngredientNameList[index_item - 1]; PreviousConflictTextID := ConflictTextIDList[index_item -1]; PreviousPlausibility := PlausibilityList[index_item -1]; PreviousSeverity := SeverityList[index_item -1]; PreviousMedicationName := MedicationNameList[index_item -1]; PreviousMedicationID := MedicationIDList[index_item -1]; PreviousDiagnosisICD9Name := DiagnosisICD9NameList[index_item -1]; PreviousDiagnosisICD9Code := DiagnosisICD9CodeList[index_item -1]; PreviousDiagnosisICD10Code := DiagnosisICD10CodeList[index_item -1]; PreviousDiagnosisCode := DiagnosisCodeList[index_item -1]; PreviousTextTitle := TextTitle[index_item -1]; else PreviousMedicationIngredientName := null; PreviousConflictTextID := null; PreviousPlausibility := null; PreviousSeverity := null; PreviousMedicationName := null; PreviousMedicationID := null; PreviousDiagnosisICD9Name := null; PreviousDiagnosisICD9Code := null; PreviousDiagnosisICD10Code := null; PreviousDiagnosisCode := null; PreviousTextTitle := null; endif; med_info:= ""; extra_info_1 := ""; extra_info := ""; the_xxx := ""; if IsComponent then med_info := "COMPONENT: "; extra_info_1 := " component in {{+R}}{{+I}}" || MedicationName || "{{-I}}{{-R}}"; elseif (IsIVAdditive = true) then med_info := "ADDITIVE: "; extra_info_1 := " additive in {{+R}}{{+I}}" || MedicationName || "{{-I}}{{-R}}"; elseif (IsSolution = true) then med_info := "SOLUTION: "; endif; if Status IS NULL or Status = "" then Status := "Current"; endif; if (conflict_text_count > 1) then ending_phrase:= ". The conflicts are: "; else ending_phrase:= ". The conflict is: "; endif; if (IsIVAdditive = true) OR (IsComponent = true) then extra_info:= " in {{+R}}{{+I}}" || MedicationName || "{{-I}}{{-R}}"; endif; if (IsIVAdditive = true) then the_xxx:= "the medication(s) in "; endif; if trim(MedType) = "Order" then if IsOutpatientOrder then //for outpatient orders,if startdate is null then use entered date instead if MedicationStartDate is null then if EnteredDate is null then EnteredDate := ""; else EnteredDate := (EnteredDate formatted with "%.4t"); endif; else MedicationStartDate := (MedicationStartDate formatted with "%.4t"); endif; else if MedicationStartDate is null then MedicationStartDate := ""; else MedicationStartDate := (MedicationStartDate formatted with "%.4t"); endif; endif; elseif trim(MedType) = "Prescription" then if MedicationStartDate is null then MedicationStartDate := ""; else MedicationStartDate := (MedicationStartDate formatted with "%.2t"); endif; endif; //Get the first word of the Multum Plausibility String //if it is {{{SINGLE-QUOTE}}}Highly{{{SINGLE-QUOTE}}}, then bold it. Otherwise, just underline plausibility_substring_count := FIND " " STRING Plausibility; if plausibility_substring_count > 0 then plausibilty_substring := TRIM (SUBSTRING plausibility_substring_count CHARACTERS FROM Plausibility); else plausibilty_substring := Plausibility; endif; if (UPPERCASE (plausibilty_substring)) = "HIGHLY" then plausibilty_substring := "{{+B}}" || plausibilty_substring || "{{-B}}"; else plausibilty_substring := "{{+U}}" || plausibilty_substring || "{{-U}}"; endif; //Get the first word of the Multum Severity String. //If it is {{{SINGLE-QUOTE}}}Severe{{{SINGLE-QUOTE}}}, then bold it. Otherwise, just underline severity_substring_count := FIND " " STRING Severity; if severity_substring_count > 0 then severity_substring := TRIM (SUBSTRING severity_substring_count CHARACTERS FROM Severity); else severity_substring := Severity; endif; if (UPPERCASE (severity_substring)) = "SEVERE" then severity_substring := "{{+B}}" || severity_substring || "{{-B}}"; else severity_substring := "{{+U}}" || severity_substring || "{{-U}}"; endif; DiagnosisICD9Code := TRIM DiagnosisICD9Code; if alert_if_unmapped and ConflictTextID = -1 then if IsIVAdditive then unmapped_additives := unmapped_additives || "\n" || med_info || "{{+B}}{{+R}}" || MedicationIngredientName || "{{-R}}{{-B}}"; if evoked_from_health_issue then unmapped_additives := unmapped_additives || extra_info; endif; if (MedicationIngredientName NOT IN alert_abstract_meds_list and MedicationIngredientName IS NOT NULL) then if (alert_abstract_meds <> "") then alert_abstract_meds := alert_abstract_meds || ", " ; endif; UnmappedMedicationIngredientName := " Unmapped - " || MedicationIngredientName || " in " || MedicationName|| "." ; alert_abstract_unmapped_meds := alert_abstract_unmapped_meds || UnmappedMedicationIngredientName ; alert_abstract_unmapped_meds_list := alert_abstract_unmapped_meds_list, UnmappedMedicationIngredientName; endif; else unmapped_medications := unmapped_medications || "\n" || indent || "{{+B}}{{+R}}" || MedicationName || "{{-R}}{{-B}}"; if (MedicationName NOT IN alert_abstract_meds_list and MedicationName IS NOT NULL) then if (alert_abstract_meds <> "") then alert_abstract_meds := alert_abstract_meds || ", " ; endif; UnmappedMedicationName := " Unmapped - " || MedicationName || "."; alert_abstract_unmapped_meds := alert_abstract_unmapped_meds || UnmappedMedicationName ; alert_abstract_unmapped_meds_list := alert_abstract_unmapped_meds_list, UnmappedMedicationName; endif; endif; elseif ConflictText is not null then alert_community_string_abstract := ""; if (MedicationName NOT IN alert_abstract_meds_list) then if(Medication_Hx_Rx_Community_TypeCode = 5) then alert_community_string_abstract := pending_community_abstract_alert_text; else alert_community_string_abstract := ""; endif; if (alert_abstract_meds <> "") then alert_abstract_meds := alert_abstract_meds || ", " ; endif; if IsIVAdditive then temp_medication_name := MedicationIngredientName || " in " || MedicationName ; alert_abstract_meds := alert_abstract_meds || temp_medication_name ; alert_abstract_meds_list := alert_abstract_meds_list, temp_medication_name; else alert_abstract_meds := alert_abstract_meds || MedicationName ; alert_abstract_meds_list := alert_abstract_meds_list, MedicationName; endif; alert_abstract_meds := alert_abstract_meds || alert_community_string_abstract; endif; code:=DiagnosisCode; if(evoking_health_issue_CHICode<> "") then code:=evoking_health_issue_CHICode; if (current_ep_settings MATCHES PATTERN "%ICD9%" AND NOT(current_ep_settings MATCHES PATTERN "%ICD10%")) then checkCode:=evoking_health_issue_ICD9Code; elseif (current_ep_settings MATCHES PATTERN "%ICD10%" AND NOT(current_ep_settings MATCHES PATTERN "%ICD9%")) then if evoking_health_issue_CHITypeCode IN ICD10_coding_scheme_list OR evoking_health_issue_CHITypeCode IN SNOMEDCT_coding_scheme_list then checkCode:=DiagnosisICD10Code; if checkCode is null then checkCode:=DiagnosisICD9Code; endif; else checkCode:=evoking_health_issue_ICD10Code; endif; elseif (current_codingScheme MATCHES PATTERN "%SNOMEDCT%" AND NOT(current_codingScheme MATCHES PATTERN "%ICD9%") AND NOT(current_codingScheme MATCHES PATTERN "%ICD10%")) then if(DiagnosisICD10Code<> "") then checkCode:=DiagnosisICD10Code; else checkCode:=DiagnosisICD9Code; endif; else if(DiagnosisICD10Code<> "") then checkCode:=DiagnosisICD10Code; else checkCode:=DiagnosisICD9Code; endif; endif; else if (current_ep_settings MATCHES PATTERN "%ICD9%" AND NOT(current_ep_settings MATCHES PATTERN "%ICD10%")) then checkCode:=DiagnosisICD9Code; if checkCode is null then checkCode:=DiagnosisICD10Code; endif; elseif (current_ep_settings MATCHES PATTERN "%ICD10%" AND NOT(current_ep_settings MATCHES PATTERN "%ICD9%")) then checkCode:=DiagnosisICD10Code; if checkCode is null then checkCode:=DiagnosisICD9Code; endif; else if code=DiagnosisICD10Code then checkCode:=DiagnosisICD10Code; else checkCode:=DiagnosisICD9Code; if checkCode is null then checkCode:=DiagnosisICD10Code; endif; endif; endif; endif; code := TRIM code; checkCode := TRIM checkCode; if(InternalStateType = 1 AND enable_community_data_healthissue_alerts = true) then alert_community_string := pending_community_abstract_alert_text; else alert_community_string := ""; endif; if (checkCode NOT IN alert_abstract_health_issue_list) then if (alert_abstract_health_issues <> "") then alert_abstract_health_issues := alert_abstract_health_issues || ", " ; endif; alert_abstract_health_issues := alert_abstract_health_issues || DiagnosisICD9Name || " (" || checkCode || ")" || alert_community_string ; alert_abstract_health_issue_list := alert_abstract_health_issue_list, checkCode; endif; if (evoked_from_health_issue) then if ( PreviousPlausibility IS NULL OR (Plausibility <> PreviousPlausibility) OR (Severity <> PreviousSeverity) OR (MedicationIngredientName <> PreviousMedicationIngredientName) OR (MedicationName <> PreviousMedicationName )) then drug_diagnosis_conflict_meds := drug_diagnosis_conflict_meds || "\n" || indent || indent || plausibilty_substring || " Plausible " || severity_substring || " Conflict with " ; if (Medication_Hx_Rx_Community_TypeCode = 5 AND enable_community_data_medication_alerts = true) then alert_medication_string := pending_community_data_medication_alerts_with_formatting; else alert_medication_string := ""; endif; if (IsComponent = true OR IsIVAdditive = true) then drug_diagnosis_conflict_meds := drug_diagnosis_conflict_meds || "the " || "{{+B}}{{+R}}" || MedicationIngredientName || "{{-R}}{{-B}}"; else drug_diagnosis_conflict_meds := drug_diagnosis_conflict_meds || "{{+B}}{{+R}}" || MedicationName || "{{-R}}{{-B}}" || alert_medication_string; endif; endif; conflict_details := conflict_details || "\n" ; if (extra_info_1 is not null) and (extra_info_1 <> "") AND ( PreviousPlausibility IS NULL OR (Plausibility <> PreviousPlausibility) OR (Severity <> PreviousSeverity) OR (MedicationIngredientName <> PreviousMedicationIngredientName) OR (MedicationName <> PreviousMedicationName ) ) then drug_diagnosis_conflict_meds := drug_diagnosis_conflict_meds || extra_info_1 || alert_medication_string; endif; if (PreviousMedicationIngredientName IS NULL OR PreviousMedicationIngredientName <> MedicationIngredientName) then if (med_info is not null) and (med_info <> "") then conflict_details := conflict_details || med_info; endif; if (MedicationIngredientName is not null) and (MedicationIngredientName <> "") and (IsComponent = true OR IsIVAdditive = true) then conflict_details := conflict_details || "{{+R}}" || MedicationIngredientName || "{{-R}}"; else conflict_details := conflict_details || "{{+R}}" || MedicationName || "{{-R}}"; endif; if (extra_info is not null ) and (extra_info <> "") then conflict_details := conflict_details || extra_info; endif; conflict_details := conflict_details || alert_medication_string; if (IsOutpatientOrder) and (MedicationStartDate is null) then conflict_details := conflict_details ||indent|| "Entered Date: " || EnteredDate; else conflict_details := conflict_details ||indent|| "Start Date: " || MedicationStartDate; endif; conflict_details := conflict_details ||indent|| "Status: " || Status ; if (IsOutpatientOrder) then if (IsScript) then conflict_details := conflict_details || " " || "Prescription"; else conflict_details := conflict_details || " " || "Home Medication"; endif; else if (MedType is not null) and (MedType <> "") then if(Medication_Hx_Rx_Community_TypeCode = 1 OR Medication_Hx_Rx_Community_TypeCode = 2) then conflict_details := conflict_details || " " || " Prescription"; elseif(Medication_Hx_Rx_Community_TypeCode = 3 OR Medication_Hx_Rx_Community_TypeCode = 4) then conflict_details := conflict_details || " " || " Home Medication"; elseif(Medication_Hx_Rx_Community_TypeCode = 5) then conflict_details := conflict_details || " " || " Community Medication"; else conflict_details := conflict_details || " " || MedType; endif; endif; endif; conflict_details := conflict_details || "\n" ; endif; conflict_details := conflict_details || plausibilty_substring || " Plausible " || severity_substring || " Conflict" || "\nDIAGNOSIS CLASSIFICATION: {{+U}}" || MultumCondition || "{{-U}}" || "\nEXPLANATION: " || ConflictText || "\n"; else if ( (med_info is not null) and (med_info <> "") and (MedicationIngredientName is not null) and (MedicationIngredientName <> "") and ( (MedicationIngredientName <> PreviousMedicationIngredientName) OR PreviousMedicationIngredientName is null )) then drug_diagnosis_conflict_health_issues := drug_diagnosis_conflict_health_issues || "\n"; drug_diagnosis_conflict_health_issues := drug_diagnosis_conflict_health_issues || indent || med_info; if(IsComponent = true OR IsIVAdditive = true) then drug_diagnosis_conflict_health_issues := drug_diagnosis_conflict_health_issues || "{{+B}}{{+R}}" || MedicationIngredientName || "{{-R}}{{-B}}"; else drug_diagnosis_conflict_health_issues := drug_diagnosis_conflict_health_issues || "{{+B}}{{+R}}" || MedicationName || "{{-R}}{{-B}}"; endif; endif; /*Alert1 medication*/ //setting the community health issue alert text if(InternalStateType = 1 AND enable_community_data_healthissue_alerts = true) then alert_string := pending_community_healthissue_text_with_formatting; else alert_string := ""; endif; if(code <> checkCode)then PlausibilitySeverityConflictString := plausibilty_substring || " Plausible " || severity_substring || " Conflict with {{+B}}{{+C}}" || DiagnosisICD9Name || " {{-C}}{{-B}}( "|| code || ","|| checkCode || ")" || alert_string; else PlausibilitySeverityConflictString := plausibilty_substring || " Plausible " || severity_substring || " Conflict with {{+B}}{{+C}}" || DiagnosisICD9Name || "{{-C}}{{-B}}(" || checkCode || ")" || alert_string; endif; if (PreviousPlausibilitySeverityConflictString IS NULL OR (PreviousPlausibilitySeverityConflictString <> PlausibilitySeverityConflictString) OR (MedicationName <> PreviousMedicationName OR MedicationIngredientName <> PreviousMedicationIngredientName)) then drug_diagnosis_conflict_health_issues := drug_diagnosis_conflict_health_issues || "\n" || indent || indent || PlausibilitySeverityConflictString; endif; PreviousPlausibilitySeverityConflictString := PlausibilitySeverityConflictString; if (PreviousMedicationID IS NULL OR MedicationName <> PreviousMedicationName OR MedicationIngredientName <> PreviousMedicationIngredientName ) then if (PreviousMedicationID IS NULL) then conflict_details := conflict_details || "\n"; endif; conflict_details := conflict_details || "\n{{+B}}Details for{{-B}} " || med_info || "{{+R}}" ; if(IsComponent = true OR IsIVAdditive = true) then conflict_details := conflict_details || MedicationIngredientName; else conflict_details := conflict_details || MedicationName; endif; conflict_details := conflict_details || "{{-R}}" || extra_info; if (IsOutpatientOrder) and (MedicationStartDate is null) then conflict_details := conflict_details || indent|| "Entered Date: " || EnteredDate; else conflict_details := conflict_details || indent|| "Start Date: " || MedicationStartDate; endif; conflict_details := conflict_details || indent || "Status: " ||Status; if (IsOutpatientOrder) then if (IsScript) then conflict_details := conflict_details || " " || "Prescription"; else conflict_details := conflict_details || " " || "Home Medication"; endif; else if (Medication_Hx_Rx_Community_TypeCode = 1 OR Medication_Hx_Rx_Community_TypeCode = 2) then conflict_details := conflict_details || " " || "Prescription"; elseif(Medication_Hx_Rx_Community_TypeCode = 3 OR Medication_Hx_Rx_Community_TypeCode = 4) then conflict_details := conflict_details || " " || "Home Medication"; elseif(Medication_Hx_Rx_Community_TypeCode = 5) then conflict_details := conflict_details || " " || "Community Medication"; else conflict_details := conflict_details || " " || MedType; endif; endif; endif; if (PreviousDiagnosisICD9Name IS NULL OR PreviousDiagnosisICD9Name <> DiagnosisICD9Name OR PreviousMedicationName <> MedicationName OR PreviousMedicationIngredientName <> MedicationIngredientName) then /*Alert2 medication*/ if(code <> checkCode ) then conflict_details := conflict_details || "\n-{{+C}}" || DiagnosisICD9Name || "{{-C}}"||" ( " || code || ","|| checkCode || ")" || alert_string; else conflict_details := conflict_details || "\n-{{+C}}" || DiagnosisICD9Name || "{{-C}} (" || checkCode || ")" || alert_string; endif; endif; conflict_details := conflict_details || "\n" || plausibilty_substring || " Plausible. " || severity_substring|| " Conflict" || "\nDIAGNOSIS CLASSIFICATION: {{+U}}" || MultumCondition || "{{-U}}" || "\nEXPLANATION: " || ConflictText || "\n"; endif; endif; enddo; //for index_item alert_abstract := ""; if (alert_abstract_meds is not null and alert_abstract_meds <> "") then alert_abstract := alert_abstract || alert_abstract_meds || " conflicts with " || alert_abstract_health_issues || "."; endif; if (alert_abstract_unmapped_meds is not null and alert_abstract_unmapped_meds <> "") then alert_abstract := alert_abstract || alert_abstract_unmapped_meds ; endif; if (evoked_from_health_issue) then /* set check code and checkCode value for HI enter*/ code:=evoking_health_issue_CHICode; if (current_ep_settings MATCHES PATTERN "%ICD9%" AND NOT(current_ep_settings MATCHES PATTERN "%ICD10%")) then checkCode:=evoking_health_issue_ICD9Code; elseif (current_ep_settings MATCHES PATTERN "%ICD10%" AND NOT(current_ep_settings MATCHES PATTERN "%ICD9%")) then if evoking_health_issue_CHITypeCode IN ICD10_coding_scheme_list OR evoking_health_issue_CHITypeCode IN SNOMEDCT_coding_scheme_list then checkCode:=DiagnosisICD10Code; if checkCode is null then checkCode:=DiagnosisICD9Code; endif; else checkCode:=evoking_health_issue_ICD10Code; endif; elseif (current_codingScheme MATCHES PATTERN "%SNOMEDCT%" AND NOT(current_codingScheme MATCHES PATTERN "%ICD9%") AND NOT(current_codingScheme MATCHES PATTERN "%ICD10%")) then if(DiagnosisICD10Code<> "") then checkCode:=DiagnosisICD10Code; else checkCode:=DiagnosisICD9Code; endif; else if(DiagnosisICD10Code<> "") then checkCode:=DiagnosisICD10Code; else checkCode:=DiagnosisICD9Code; endif; endif; code := TRIM code; checkCode := TRIM checkCode; if(EvokingObject.InternalStateType = 1 AND enable_community_data_healthissue_alerts = true) then alert_string_unreconciled := pending_community_healthissue_text_with_formatting; else alert_string_unreconciled := ""; endif; if (drug_diagnosis_conflict_meds is not null and drug_diagnosis_conflict_meds <> "") then if(code <> checkCode ) then long_alert_message := long_alert_message ||"There is a potential {{+B}}Drug-Diagnosis Conflict{{-B}} " || "with {{+B}}{{+C}}" || evoking_health_issue_short_name || "{{-C}}{{-B}} (" || code || "," || checkCode || ")" || alert_string_unreconciled || " and the following:" || drug_diagnosis_conflict_meds; else long_alert_message := long_alert_message ||"There is a potential {{+B}}Drug-Diagnosis Conflict{{-B}} " || "with {{+B}}{{+C}}" || evoking_health_issue_short_name || "{{-C}}{{-B}} (" || checkCode || ")" || alert_string_unreconciled || " and the following:" || drug_diagnosis_conflict_meds; endif; endif; if ( (unmapped_medications is not null and unmapped_medications <> "") or (unmapped_additives is not null and unmapped_additives <> "") ) then long_alert_message := long_alert_message || "\n\nThe following {{+B}}Unmapped medication(s) could not be " || "checked{{-B}} for Drug-Diagnosis Conflicts. " || "Please Use an alternate plan to do the check."; if (unmapped_medications is not null and unmapped_medications <> "") then long_alert_message := long_alert_message || unmapped_medications ; endif; if (unmapped_additives is not null and unmapped_additives <> "") then long_alert_message := long_alert_message || unmapped_additives ; endif; endif; if (conflict_details is not null and conflict_details <> "") then if(code <> checkCode ) then long_alert_message := long_alert_message || "\n\n{{+B}}Details for{{-B}}{{+C}} " || evoking_health_issue_short_name || "{{-C}} (" || code || "," || checkCode || ")" || alert_string_unreconciled || conflict_details; else long_alert_message := long_alert_message || "\n\n{{+B}}Details for {{-B}}{{+C}} " || evoking_health_issue_short_name || "{{-C}} (" || code || ")" || alert_string_unreconciled || conflict_details; endif; endif; else if (drug_diagnosis_conflict_health_issues is not null) and (drug_diagnosis_conflict_health_issues <> "") then long_alert_message := long_alert_message ||"There is a potential {{+B}}Drug-Diagnosis Conflict{{-B}} with "; if (exists the_xxx) then long_alert_message := long_alert_message || the_xxx; endif; long_alert_message := long_alert_message || "{{+B}}{{+R}}" || MedicationName || "{{-R}}{{-B}}" || ending_phrase || drug_diagnosis_conflict_health_issues; endif; if (unmapped_additives is not null and unmapped_additives <> "") then long_alert_message := long_alert_message || "\n\nThe following {{+B}}Unmapped medication(s) could not be " || "checked{{-B}} " || "for Drug-Diagnosis Conflicts. Please Use an alternate plan to " || "do the check."; if (unmapped_medications is not null and unmapped_medications <> "") then long_alert_message := long_alert_message || unmapped_medications; endif; if (unmapped_additives is not null and unmapped_additives <> "") then long_alert_message := long_alert_message || unmapped_additives; endif; elseif (unmapped_medications is not null and unmapped_medications <> "") then long_alert_message := long_alert_message || "\n\n{{+B}}{{+R}}" || MedicationName || "{{-R}}{{-B}}" || " could {{+B}}not be checked{{-B}} for {{+B}}Drug-Diagnosis Conflicts{{-B}} because " || "it was {{+B}}Unmapped{{-B}}. " || "Please use an alternate plan to do the check.\n" ; endif; if (conflict_details is not null) and (conflict_details <> "") then long_alert_message := long_alert_message || conflict_details; endif; endif; complet_multum_references:=""; sorted_obj_list := SORT Sort_field DATA mdo_reference_list; if exist sorted_obj_list then // Display citiations details citations_string:="{{+B}}Citations{{-B}}:\n {{+I}}Note: The following citations" || " are from Cerner Multum, Inc. If your local facility has modified the" || " explanation of the conflict in the alert message, the citations below" || " may or may not apply.{{-I}}"; number_list := 1 seqto count(sorted_obj_list); for JJ in number_list do one_TextTitle := sorted_obj_list[JJ].TextTitle; one_ConflictTextID := sorted_obj_list[JJ].ConflictTextID; if (JJ > 1) then Previousone_ConflictTextID := sorted_obj_list[JJ-1].ConflictTextID; else Previousone_ConflictTextID := null; endif; if (Previousone_ConflictTextID IS NULL OR Previousone_ConflictTextID <> one_ConflictTextID) then // build up list of refrences/Citations (multum_references, multum_date, ref_count):= call func_multum_references with "rtf", "ddi", one_TextTitle || " conflict", null, null, one_ConflictTextID, null, null; if multum_references is not null then if complet_multum_references is null or complet_multum_references="" then complet_multum_references:= multum_references; else complet_multum_references:= complet_multum_references || multum_references; endif; endif; endif; enddo;//for JJ in number_list do else // Display citiations details : None citations_string:="{{+B}}Citations{{-B}}: None"; endif; //--------------- // Clinical Rule //--------------- if long_alert_message <> "" then conclude true; endif; ;; action: drug_diag_alert.references := drug_diag_alert.references || revision_date_string || "\n\n" || citations_string || "\n\n" || complet_multum_references; drug_diag_alert.alert_abstract := alert_abstract; write long_alert_message at drug_diag_alert; ;; Urgency: 50;; end: