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: DOC_BIPAP_CPAP_HI_ORDER ;;
mlmname: DOC_BIPAP_CPAP_HI_ORDER;;
arden: version 2.5;;
version: 1.00;;
institution: St.Clair Hospital ;;
author: Sandy Zhang ;;
specialist: ;;
date: 2017-06-05;;
validation: testing;;
library:
purpose: When user selects “BIPAP" and/or "CPAP” from the below structured notes, then auto generate the “Respiratory consult" order and Health issue for "Sleep Apnea”
These structured notes have this MLM attached to the {{{SINGLE-QUOTE}}}Respiratory Device/Implant{{{SINGLE-QUOTE}}} attribute:
1) Adult Patient Profile (KBC Adult Patient Profile 2.0)
2) Adult Patient Profile - Behavioral Health
3) OB Patient Profile (KBC OB Patient Profile 2.0)
;;
explanation:
Change History
06.05.2017 SZ CSR# 35226 - Project started - BiPAP and CPAP Health Issue and Respiratory Consult Order creation
;;
keywords: BiPAP, CPAP, Health Issue, Respiratory Consult Order
;;
citations:
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
DocumentName := this_documentCommunication.DocumentName ;
thisStructuredNoteDoc := this_documentCommunication.DocumentConfigurationObj;
//grab values we are interested in
clientGuid := this_documentCommunication.ClientGUID;
visitGuid := this_documentCommunication.ClientVisitGUID;
chartGuid := this_documentCommunication.ChartGUID;
Current_Obs_Obj := this_documentCommunication.CurrentObservationObj;
Val_Obj := Current_Obs_Obj.ValueObj;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Only trigger MLM if document name matches
If DocumentName in ("Adult Patient Profile", "Adult Patient Profile - Behavioral Health", "OB Patient Profile" ) Then
(Bipap_values) := last(Val_Obj.ListItemsList where (Val_Obj.ListItemsList.Value = "BiPAP") or (Val_Obj.ListItemsList.Value = "BiPAP..."));
(Cpap_values) := last(Val_Obj.ListItemsList where (Val_Obj.ListItemsList.Value = "CPAP") or (Val_Obj.ListItemsList.Value = "CPAP..."));
// when {{{SINGLE-QUOTE}}}BiPAP{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}CPAP{{{SINGLE-QUOTE}}} is selected then execute a check for sleep apnea health issue and respiatory consult order
If (Bipap_values.IsSelected = true) or (Cpap_values.IsSelected = true) then
// SQL checks if patient has a current ICD10 Health Issue of Sleep Apnea
(SleepApneaHI) := read last {
"select shortname"
||" from cv3healthissuedeclaration "
||" where clientguid = " || sql(clientGuid)
||" and active = 1 and status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} And ICD10Code is not null"
||" and typecode = {{{SINGLE-QUOTE}}}problem-Chronic{{{SINGLE-QUOTE}}} and shortname like {{{SINGLE-QUOTE}}}%Sleep apnea%{{{SINGLE-QUOTE}}}"
};
// SQL checks if patient has an active respiatory consult order
(RespiratoryConsult_Order) := read last {
"select ocmi.Name"
||" from cv3ordercatalogmasteritem ocmi with (nolock)"
||" join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid"
||" where"
||" o.clientguid = " || sql(clientGuid)
||" and o.chartguid = " || sql(chartGuid)
||" and o.clientvisitguid = " || sql(visitGuid)
||" and o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) "
||" and ocmi.Name = {{{SINGLE-QUOTE}}}Respiratory Consult{{{SINGLE-QUOTE}}}"
};
// if patient is missing {{{SINGLE-QUOTE}}}sleep apnea{{{SINGLE-QUOTE}}} health issue and/or {{{SINGLE-QUOTE}}}respiratory consult{{{SINGLE-QUOTE}}},
// then create a dialog box to see if user would like to create them
If (SleepApneaHI is null) or (RespiratoryConsult_Order is null) then
// dialog box asks if user would like to create health issue and respiratory consult order
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n This selection will create a chronic health issue of {{{SINGLE-QUOTE}}}Sleep Apnea{{{SINGLE-QUOTE}}} and {{{SINGLE-QUOTE}}}Respiratory Consult{{{SINGLE-QUOTE}}} order " ||
"\n\n Click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to confirm your selection. " ||
"\n\n Click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} if you wish to change your selection. " ||
"\n "
,"BiPAP/CPAP Documentation ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
// If {{{SINGLE-QUOTE}}}yes{{{SINGLE-QUOTE}}} button is selected then we check if the Health Issue exists,
// if it {{{SINGLE-QUOTE}}}does exist{{{SINGLE-QUOTE}}} then move on to check for Resp Consult order exists, if it {{{SINGLE-QUOTE}}}doesn{{{SINGLE-QUOTE}}}t exist{{{SINGLE-QUOTE}}} then create a sleep apnea HI.
// Then check if Resp Consult order exists, if yes then move on, if no then create it.
If (dlg_result as string) = "Yes" then
If (SleepApneaHI is null) then
/********************* create a chronic health issue of {{{SINGLE-QUOTE}}}Sleep Apnea{{{SINGLE-QUOTE}}} here *******************************/
hitype := "Problem-Chronic";
hiname := "Sleep apnea";
hinumber:= "G47.30" ;
hischeme:= "ICD10" ;
hitext := "Please see Adult Patient Profile document for BiPAP/CPAP Settings. *Created from Patient Profile information.* " ;
Func_Create_HI_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_Create_Health_Issue{{{SINGLE-QUOTE}}};
void := call Func_Create_HI_MLM with (visitGuid,hiname,hinumber,hitext,hitype,hischeme);
HI_created := "HI for sleep apnea was created";
endif;
If (RespiratoryConsult_Order is null) then
/********************* create a general order for {{{SINGLE-QUOTE}}}Respiratory Consult{{{SINGLE-QUOTE}}} here *******************************/
// setup to generate our {{{SINGLE-QUOTE}}}Respiratory Consult{{{SINGLE-QUOTE}}} order
try
locationGuid := read last {
"SELECT CurrentLocationGUID, touchedWhen"
|| " FROM CV3ClientVisit with (nolock)"
|| " WHERE GUID = " || Sql(visitGuid)
|| " AND ClientGUID = " || Sql(clientGuid)
, primaryTime = touchedWhen
};
care_provider_guid, care_provider_name := read last {
" SELECT cp.guid, cp.DisplayName"
||" FROM CV3ClientVisit cv with (nolock)"
||" join cv3careprovider cp on cp.displayname = cv.providerdisplayname"
||" WHERE cv.GUID = " || Sql(visitGuid)
||" AND cv.ClientGUID = " || Sql(clientGuid)
||" AND cp.Active = 1"
};
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
care_provider_obj:= call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((care_provider_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((locationGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
Order_Creation_Reason := "Created per protocol";
RequestingSource := "";
SessionType := "Standard";
SessionReason := "";
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}CommonData: {{-R}}\n" || ex.Message || "\n\n";
if location_obj IS NOT Null then void := call location_obj.Dispose; location_obj := null; endif;
if care_provider_obj IS NOT Null then void := call care_provider_obj.Dispose; care_provider_obj := null; endif;
if client_visit_obj IS NOT Null then void := call client_visit_obj.Dispose; client_visit_obj := null; endif;
endcatch;
// this generates our {{{SINGLE-QUOTE}}}Respiratory Consult{{{SINGLE-QUOTE}}} order
try
order_catalog_obj:= call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with ("Respiratory Consult");
Order_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
with client_visit_obj, // good
order_catalog_obj, // good
Order_Creation_Reason, // good
care_provider_obj, // good
RequestingSource, // good
SessionType, // good
SessionReason, // good
location_obj, // good
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
order_obj.SpecialInstructions := "Please see Adult Patient Profile document for BiPAP/CPAP Settings. *Created from Patient Profile information.*" ;
retval := call order_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "NUR_NotifyType", "Physician" ;
check_box := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with "Using CPAP/BiPAP home",true;
additional_comments := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "NUR_GenAdditionalTxt","Please see Patient Profile document for BiPAP/CPAP Settings. *Created from Patient Profile information.*";
void := call Order_Obj.Save;
if order_catalog_obj IS NOT Null then void := call order_catalog_obj.Dispose; order_catalog_obj := null; endif;
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}New Other Order: {{-R}}\n" || ex.Message || "\n\n";
if Order_Obj IS NOT Null then void := call Order_Obj.Dispose; Order_Obj := null; endif;
endcatch;
// Dispose of the objects
if location_obj IS NOT Null then void := call location_obj.Dispose; location_obj := null; endif;
if care_provider_obj IS NOT Null then void := call care_provider_obj.Dispose; care_provider_obj := null; endif;
if client_visit_obj IS NOT Null then void := call client_visit_obj.Dispose; client_visit_obj := null; endif;
create_respcon_order := "respiratory consult order creation was attempted";
endif; // creates RespiratoryConsult_Order if it doesn{{{SINGLE-QUOTE}}}t exist
endif; // If "Yes" or "No" selected
endif; // if (SleepApneaHI is null) - If HI doesn{{{SINGLE-QUOTE}}}t exist then execute
endif; // if bipap or cpap is selected
endif; // If DocumentName is {{{SINGLE-QUOTE}}}adult patient profile{{{SINGLE-QUOTE}}} ......
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
;;
Urgency: 50;;
end: