Files
St.Clair/MLMStripper/bin/Debug/FORM/FORM_SET_NEWBORN_NURSERY_ADMISSION.mlm

163 lines
6.4 KiB
Plaintext

maintenance:
title: FORM_SET_NEWBORN_NURSERY_ADMISSION;;
mlmname: FORM_SET_NEWBORN_NURSERY_ADMISSION;;
arden: version 2.5;;
version: 6.10;;
institution: St. Clair Hospital;;
author: Juliet M Law, Allscripts x7461;;
specialist: Peggy Karish, Allscripts ext 7441;;
date: 2014-10-09;;
validation: testing;;
library:
purpose: Automatically select and disable medication orders based on prescence of lab result on mother.
;;
explanation: This MLM is called from the Newborn Nursery Admission Order Set. On Form open, based on the existence and result of
the Hepatitis B Surface Antigen lab on the mother, the appropriate medications will be selected and all others disabled.
Change History
-----------------
10.09.2014 JML CSR# 32644: Created
10.29.2014 JML Moved to Production
01.14.2019 JML CSR#37671: Include criteria for newborn baby weight when disabling medication grid selections.
;;
keywords: Called MLMs, Newborn, Admission, Hepatitis B
;;
knowledge:
type: data-driven;;
data:
// 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;
/*******************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;
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGUID;
pObj := this_communication.PrimaryObj;
CallingEvent := this_communication.CallingEvent;
CallingField := this_communication.CallingFieldName;
//Retrieve relevant form fields
Hep_Meds_NEG_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 50 );
Hep_Meds_NEG := Hep_Meds_NEG_Grid.Value;
Hep_Meds_UNK_WtLg_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 51 );
Hep_Meds_UNK_WtLg := Hep_Meds_UNK_WtLg_Grid.Value;
Hep_Meds_UNK_WtSm_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 54 );
Hep_Meds_UNK_WtSm := Hep_Meds_UNK_WtSm_Grid.Value;
Hep_Meds_POS_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 53 );
Hep_Meds_POS := Hep_Meds_POS_Grid.Value;
//Locate MOM
//Retrieve MOM{{{SINGLE-QUOTE}}}s visit guid from cross reference table
momVisitGUID := read last {"SELECT mcv.MotherDeliveryVisitGUID "
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN SXAAMMotherChildVisitXRef mcv WITH (NOLOCK)"
|| " ON cv.GUID = mcv.ClientVisitGUID"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " AND cv.GUID = " || Sql(visit_guid)
|| " AND cv.ChartGUID = " || Sql(chart_guid)};
(momClientGUID,
momChartGUID) := read last {"SELECT cv.ClientGUID, cv.ChartGUID"
|| " FROM CV3ClientVisit cv WITH (NOLOCK)"
|| " WHERE cv.GUID = " || Sql(momVisitGUID)};
//Retrieve MOM{{{SINGLE-QUOTE}}}s Hepatitis B Surface Antigen result from OB Patient Profile
hepB_SAG_result := read last {"SELECT fsl.value"
|| " FROM CV3PatientCareDocument pcd WITH (NOLOCK) JOIN SXACDObservationParameter obsparam WITH (NOLOCK)"
|| " ON pcd.GUID = obsparam.PatCareDocGUID"
|| " LEFT JOIN SCMObsFSListValues fsl WITH (NOLOCK)"
|| " ON obsparam.ObservationDocumentGUID = fsl.ParentGUID"
|| " AND obsparam.ClientGUID = fsl.ClientGUID"
|| " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
|| " ON obsparam.ObsMasterItemGUID = ocmi.GUID"
|| " WHERE obsparam.ClientGUID = " || SQL(momClientGUID)
|| " AND obsparam.ClientVisitGUID = " || SQL(momVisitGUID)
|| " AND obsparam.ChartGUID = " || SQL(momChartGUID)
|| " AND pcd.Name = {{{SINGLE-QUOTE}}}OB Patient Profile{{{SINGLE-QUOTE}}}"
|| " AND obsparam.IsCanceled = 0"
|| " AND ocmi.Name like {{{SINGLE-QUOTE}}}PRO hbsag%{{{SINGLE-QUOTE}}}" };
baby_Wt := read last {"SELECT obsparam.ValueText"
|| " FROM CV3PatientCareDocument pcd WITH (NOLOCK) JOIN SXACDObservationParameter obsparam WITH (NOLOCK)"
|| " ON pcd.GUID = obsparam.PatCareDocGUID"
|| " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
|| " ON obsparam.ObsMasterItemGUID = ocmi.GUID"
|| " WHERE pcd.Name = {{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}}"
|| " AND obsparam.IsCanceled = 0"
|| " AND ocmi.Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}}"
|| " AND obsparam.ClientGUID = " || SQL(client_guid)
|| " AND obsparam.ClientVisitGUID = " || SQL(visit_guid)
|| " AND obsparam.ChartGUID = " || SQL(chart_guid) };
//Fire on Form Open event
if ( CallingEvent = "FormOpen" ) then
//If Mom{{{SINGLE-QUOTE}}}s Hepatitis B Surface Antigen result is negative, preselect Inj order under NEGA header
if ( hepB_SAG_result = "negative" AND ( baby_wt as number ) >= 2000 ) then
Hep_Meds_NEG.IsReadOnly := false;
Hep_Meds_UNK_WtLg.IsReadOnly := true;
Hep_Meds_UNK_WtSm.IsReadOnly := true;
Hep_Meds_POS.IsReadOnly := true;
elseif ( ( hepB_SAG_result = "unknown" OR hepB_SAG_result = "n/a" ) AND ( baby_wt as number) >= 2000 ) then
Hep_Meds_UNK_WtSm.IsReadOnly := true;
elseif ( ( hepB_SAG_result = "unknown" OR hepB_SAG_result = "n/a" ) AND ( baby_wt as number ) < 2000 ) then
Hep_Meds_UNK_WtLg.IsReadOnly := true;
elseif ( hepB_SAG_result = "positive" ) then
Hep_Meds_POS.IsReadOnly := false;
Hep_Meds_UNK_WtLg.IsReadOnly := true;
Hep_Meds_UNK_WtSm.IsReadOnly := true;
Hep_Meds_NEG.IsReadOnly := true;
endif;
endif;
;;
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;
;;
end: