Initial Checking with all 820 MLMs

This commit is contained in:
2020-02-02 00:54:01 -05:00
parent c59dc6de2e
commit 840d0432f4
828 changed files with 239162 additions and 0 deletions

View File

@@ -0,0 +1,225 @@
maintenance:
title: FORM_SET_Diabetic_Mgt_Check;;
mlmname: FORM_SET_Diabetic_Mgt_Check;;
arden: version 2.5;;
version: 16.3;;
institution: St Clair Hospital;;
author: Teresa Spicuzza, Allscripts ;;
specialist: St Clair Hospital;;
date: 2017-11-02;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
11.13.2017 TMS CSR 35723: Created to alert user when patient is a diabetic and the diabetic management protocol has not
been selected from the reference order sets in the transition order sets.
01.17.2017 TMS CSR 35723: Updated grid count from 6 to 99. Was not selecting protocol from alert if protocol in grid occurrence
greater than 6. Changed from 99 to 6 during testing with break to eliminate looping with break message 99 times.
;;
keywords: Insulin, weight based, diabetic, referenced order set
;;
citations:
;;
knowledge:
type: data-driven;;
data:
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
//This MLM is passed three arguments, of types
// communication_type, form_type and client info object respectively.
(this_communication, // Communication object
this_form, // Form object
client_info_obj //Arden ClientInfo object
) := argument;
comm_obj := this_communication.primaryobj;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
// Initialize error message
error_message:="";
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
ClientGuid := this_communication.ClientGUID;
ClientVisitGuid := this_communication.ClientVisitGUID;
ChartGuid := this_communication.ChartGUID;
DiabeticProtocolOrdersEntered := "No";
HealthIssue := read last {" select distinct hi.ShortName
from cv3healthissuedeclaration hi with (nolock)
inner join cv3codedhealthissue chi with (nolock) on hi.CodedHealthIssueGUID = chi.guid and chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})
where Clientguid = " || SQL (clientguid)
|| " and hi.active = 1
and Status in ({{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Chronic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Retired Code{{{SINGLE-QUOTE}}})
and (((ICD10Code like {{{SINGLE-QUOTE}}}E10%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or (ICD10Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}}))
or ((ICD9Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
or ((ICD9Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}} and ICD10Code is null))
or ((chi.TypeCode IN({{{SINGLE-QUOTE}}}I9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}})) and ((chi.Code like {{{SINGLE-QUOTE}}}250.%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}249.%{{{SINGLE-QUOTE}}}))
or ((chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}}) and ((chi.Code like {{{SINGLE-QUOTE}}}E11%{{{SINGLE-QUOTE}}}) or chi.Code like {{{SINGLE-QUOTE}}}E09%{{{SINGLE-QUOTE}}})))"};
if exist HealthIssue then
Patient_is_Diabetic := "Yes";
else Patient_is_Diabetic := "No";
endif;
If Patient_is_Diabetic = "No" then
DiabeticHomeMed := read last { "select distinct cp.DrugName
from SXAAMBClientPrescription cp
inner join SXAMTDrugNameMapVW dnm on dnm.drug_synonym_id = cp.FormularyBrandKey
join SXAMTCategoryDrugXREFVW cdx on cdx.drug_id = dnm.drug_id
join SXAMTDrugCategoriesVW cat on cat.multum_category_id = cdx.multum_category_id
where cp.ClientGUID = " || SQL(ClientGuid) || " and cp.statustype = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}}
and cat.category_name in ({{{SINGLE-QUOTE}}}insulin{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}dipeptidyl peptidase 4 inhibitors{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}antidiabetic combinations{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}sulfonylureas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}biguanides{{{SINGLE-QUOTE}}})
and cp.EndDate is null "};
if exist DiabeticHomeMed then
Patient_on_Home_Med := "Yes";
else Patient_on_Home_Med := "No";
endif;
endif;
GlucoseName, GlucoseValue, GlucoseUom, GlucoseDone, GlucoseAbn := read last
{"Select top 1 bo.ItemName, bo.value , bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode
From cv3order as o with (nolock)
join cv3basicobservation as bo with (nolock)
on o.clientguid = bo.clientguid
and o.chartguid = bo.chartguid
and o.guid = bo.orderguid
and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}}
and bo.Active = 1
And bo.IsHistory = 0
join cv3ordercatalogmasteritem as ocmi with (nolock)
on ocmi.guid = o.ordercatalogmasteritemguid
and ocmi.active = 1
where o.clientguid = " || SQL(clientguid) || "
and o.performeddtm >= (DATEADD(hour, -12, getdate()))
and bo.itemname in ({{{SINGLE-QUOTE}}}Glucose Non-Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Bedside{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Bedside.{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Fasting{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose Fasting from Blood Gas{{{SINGLE-QUOTE}}}
,{{{SINGLE-QUOTE}}}Glucose from Blood Gas{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose, ABG, POC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Glucose, VBG, POC{{{SINGLE-QUOTE}}})
and bo.AbnormalityCode in ({{{SINGLE-QUOTE}}}H{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}HH{{{SINGLE-QUOTE}}})
and bo.value > {{{SINGLE-QUOTE}}}300{{{SINGLE-QUOTE}}}
order by o.performeddtm desc "
};
If Patient_is_Diabetic = "Yes" or Patient_on_Home_Med = "Yes" or GlucoseValue is not null then
If CallingEvent = "FormClose" then //and this_communication.ParentOrderSetGUID is null then
Selected_Order_Box.value := "None";
checkorders := "";
Cat_Guid_List :=();
Cat_Name_List := ();
Evoke_Guid_List := ();
numgrids := 99;
r := 1;
grid_count := 1 seqto numgrids;
for r in grid_count do
Currentgrid := last of (field_list where field_list.DataItemName = "MultiOrderReferencedSet"
and field_List.Control_MultiFieldOccNum = r);
gridval := currentgrid.value;
allvalues := ();
index_list := 1 seqto (count gridval) ;
if exist currentgrid then
for S in index_list do
selorders1 := gridval.IsSelected [S];
if selorders1 = true then
main_order_name1 := Gridval.Name [S] ;
main_item_catalog_guid1 := Gridval.OrderCatalogMasterItemGUID [S];
If main_order_name1 = "Diabetic Management Protocol" then
DiabeticProtocolOrdersEntered := "Yes";
endif;
endif;
enddo;
endif;
enddo;
endif;
If DiabeticProtocolOrdersEntered = "No" then
If GlucoseValue is not null then
If Patient_is_Diabetic = "No" and Patient_on_Home_Insulin = "No" then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Patient has a " || GlucoseName || " of " || GlucoseValue || " "|| GlucoseUom || " with no Diabetic Health Issues or Diabetic Home Medications documented. \n \n You have not entered any orders from the Diabetic Management Protocol. \n Do you wish to select this order set? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
else
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Patient is a Diabetic with a " || GlucoseName || " of " || GlucoseValue || " "|| GlucoseUom || " \n\n You have not entered any orders from the Diabetic Management Protocol. \n Do you wish to select this order set? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
else
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n You have not entered any orders from the Diabetic Management Protocol. \n\n Do you wish to select this order set? ","Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
if((dialogResult as string) = "Yes") then
rCat_Guid_List :=();
rCat_Name_List := ();
rEvoke_Guid_List := ();
numgrids := 99;
k := 1;
rgrid_count := 1 seqto numgrids;
for k in rgrid_count do
thisgridvalue := ();
rCurrentgrid := last of (field_list where field_list.DataItemName = "MultiOrderReferencedSet"
and field_List.Control_MultiFieldOccNum = k);
rgridval := rcurrentgrid.value;
rallvalues := ();
index_list := 1 seqto (count rgridval) ;
if exist rcurrentgrid then
for M in index_list do
rselorders1 := gridval.IsSelected [M];
if rgridval.IsSelected [M] = true then
thisgridvalue := thisgridvalue, true;
else
rmain_order_name1 := rGridval.Name [M] ;
rmain_item_catalog_guid1 := rGridval.OrderCatalogMasterItemGUID [M];
If rmain_order_name1 = "Diabetic Management Protocol" then
rcurrentgrid.IsSelected := true;
rgridval.IsSelected [M] := true;
thisgridvalue := thisgridvalue, true;
else
thisgridvalue := thisgridvalue, false;
endif;
endif;
enddo;
endif;
rgridval.IsSelected := thisgridvalue;
enddo;
endif;
endif;
endif;
;;
priority: 50
;;
evoke: // No evoke statement
;;
logic:
conclude true;
;;
action:
// This MLM returns two parameters, of types communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end: