Initial Checking with all 820 MLMs
This commit is contained in:
292
MLMStripper/bin/Debug/DOC/DOC_FUNC_CCHD_SCREEN.mlm
Normal file
292
MLMStripper/bin/Debug/DOC/DOC_FUNC_CCHD_SCREEN.mlm
Normal file
@@ -0,0 +1,292 @@
|
||||
maintenance:
|
||||
|
||||
title: BMI Checking;;
|
||||
mlmname: DOC_FUNC_CCHD_Screen;;
|
||||
arden: version 5.0;;
|
||||
version: 2.00;;
|
||||
institution: St.Clair Hospital;;
|
||||
author: Pam Roberts / Dr. Griffin & Dean Miklavic ;;
|
||||
specialist: Shawn Head ;;
|
||||
date: 2012-06-13;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation:
|
||||
Change history
|
||||
|
||||
06.13.2012 - create by STH
|
||||
03.18-2013 - CSR #: 31350 - Modified to be "greater than OR equal to >=" instead of just "greaterthan >"
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
//Message box
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
|
||||
obsitemcall := ();
|
||||
obsitemupdate1 := ();
|
||||
obsitemupdate2 := ();
|
||||
obsitemcallgrp1 := ();
|
||||
obsitemcallgrp2 := ();
|
||||
addobs := false;
|
||||
addobslistitems := "";
|
||||
addobsvalue := "";
|
||||
clearhrsold := false;
|
||||
|
||||
|
||||
|
||||
/*********************************BEGIN EDIT SECTION*****************************************************/
|
||||
|
||||
|
||||
//declare list items that will need read/calculated/updated/edited/ect.
|
||||
obsitemcallgrp1 := ("SCH_FBC_CHDS_Initial Date Time",
|
||||
"SCH_FBC_Init_Pulse Ox_Rt Hand",
|
||||
"SCH_FBC_Second_Pulse Ox_Rt Hand",
|
||||
"SCH_FBC_Third_Pulse Ox_Rt Hand");
|
||||
|
||||
obsitemcallgrp2 := ("",
|
||||
"SCH_FBC_Init_Pulse Ox_Foot",
|
||||
"SCH_FBC_Second_Pulse Ox_Foot",
|
||||
"SCH_FBC_Third_Pulse Ox_Foot");
|
||||
|
||||
obsitemupdate1 := ("SCH_FBC_Hourly Age",
|
||||
"SCH_FBC_Init_Pulse Ox Diff",
|
||||
"SCH_FBC_Second_Pulse Ox Diff",
|
||||
"SCH_FBC_Third_Pulse Ox Diff");
|
||||
|
||||
obsitemupdate2 := ("",
|
||||
"SCH_FBC_CHDS_Init_Pass Fail",
|
||||
"SCH_FBC_CHDS_Second_Pass Fail",
|
||||
"SCH_FBC_CHDS_Third_Pass Fail");
|
||||
|
||||
|
||||
/*********************************END EDIT SECTION*****************************************************/
|
||||
|
||||
|
||||
|
||||
// Receive arguments from the structured note
|
||||
(thisDocumentCommunication) := argument;
|
||||
|
||||
|
||||
// Extract interesting parts of the object model
|
||||
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
|
||||
(thisParameters) := thisStructuredNoteDoc.ParametersList;
|
||||
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
|
||||
|
||||
// Identify the calling observation item
|
||||
callingobsvals := thisDocumentCommunication.CurrentObservationObj;
|
||||
callingobsname := first of (thisParameters where thisParameters.ParameterGUID = callingobsvals.ParameterGUID);
|
||||
callingobs := first of (thisobservations where thisobservations.ParameterGUID = callingobsname.ParameterGUID);
|
||||
callingobsval := callingobs.ValueObj.Value;
|
||||
|
||||
|
||||
// cyle through the both the obsitemcallgrp1 and obsitemcallgrp2 looking for the position and matching item name
|
||||
//in the list that matches the callingobsname. If it finds the config then it sets cfgposition equal to the location
|
||||
//in the list so it can be used through the rest of the MLM logic for knowing what item(s) need compared, updated, ect...
|
||||
//callingobsval will be equal to the value of obsitemcallgrp1 and callingobsval2 will be the value of the item obsitemcallgrp2
|
||||
for x in (1 seqto (count(obsitemcallgrp1))) do
|
||||
if callingobsname.name = obsitemcallgrp1[x] then
|
||||
callingobsname2 := first of (thisParameters where thisParameters.Name = obsitemcallgrp2[x]);
|
||||
callingobs2 := first of (thisobservations where thisobservations.ParameterGUID = callingobsname2.ParameterGUID);
|
||||
callingobsval2 := callingobs2.ValueObj.Value;
|
||||
obsitemcall := obsitemcallgrp1;
|
||||
cfgposition := x;
|
||||
elseif callingobsname.name = obsitemcallgrp2[x] then
|
||||
callingobsname2 := first of (thisParameters where thisParameters.Name = obsitemcallgrp1[x]);
|
||||
callingobs2 := first of (thisobservations where thisobservations.ParameterGUID = callingobsname2.ParameterGUID);
|
||||
callingobsval2 := callingobs2.ValueObj.Value;
|
||||
obsitemcall := obsitemcallgrp2;
|
||||
cfgposition := x;
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
|
||||
// Get the user, chart, client and visit GUIDs
|
||||
userGuid := thisDocumentCommunication.UserGUID;
|
||||
clientGuid := thisDocumentCommunication.ClientGUID;
|
||||
clientvisitGuid := thisDocumentCommunication.ClientVisitGUID;
|
||||
chartGuid := thisDocumentCommunication.ChartGUID;
|
||||
callingobsguid := callingobsvals.ParameterGUID;
|
||||
|
||||
//get the admit date/time from the database to be used to calculate the hours old
|
||||
admitdttm := read last {"select AdmitDtm from CV3ClientVisit "
|
||||
|| "where GUID = " || SQL(clientvisitGuid) //{{{SINGLE-QUOTE}}}9000002915600270{{{SINGLE-QUOTE}}} "
|
||||
|| " and ClientGUID = " || SQL(clientGuid) }; //{{{SINGLE-QUOTE}}}9000001871400200{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
|
||||
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
|
||||
FreeTextValueType := OBJECT [Value];
|
||||
NumericValueType := OBJECT [Value];
|
||||
DateValueType := OBJECT [Value];
|
||||
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
|
||||
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
|
||||
|
||||
|
||||
//check to make sure the event is a charted observation and that the calling observation exists in
|
||||
//the list obsitemcall at position "cfgposition" determined in for loop above
|
||||
if thisDocumentCommunication.EventType = "ChartObservation"
|
||||
and callingobsname.Name = obsitemcall[cfgposition] then
|
||||
|
||||
//get the observation information for the item(s) listed in obsitemupdate1[cfgposition] and obsitemupdate2[cfgposition]
|
||||
//these will be the items "updated" in the BEGIN UPDATE TO FORM SECTION
|
||||
updateobsparam1 := first of (thisParameters where thisParameters.Name = obsitemupdate1[cfgposition]);
|
||||
updateobsparam2 := first of (thisParameters where thisParameters.Name = obsitemupdate2[cfgposition]);
|
||||
updateobs1 := first of (thisobservations where thisobservations.ParameterGUID = updateobsparam1.ParameterGUID);
|
||||
updateobs2 := first of (thisobservations where thisobservations.ParameterGUID = updateobsparam2.ParameterGUID);
|
||||
updateobsval1 := updateobs1.ValueObj.Value;
|
||||
updateobsval2 := updateobs2.ValueObj.ListItemsList.IsSelected;
|
||||
|
||||
|
||||
//if the chartedobservation is in position 1 follow this logic. for this MLM this will be the admit date/time charted observation
|
||||
if cfgposition = 1 then
|
||||
//---------------------------BEGIN ADMIT DATE/TIME COMPARED TO INITIAL DATE/TIME ENTERED ON DOCUMENT--------------------------------//
|
||||
if callingobsval > admitdttm then
|
||||
//as long as the entered date/time is greater than the admit date/time then calculate the hours old and grad the whole number
|
||||
//without rounding. If the patient is 23 hours and 5 minutes old it will return 23. If the patient is 23 hours and 59 minutes it will
|
||||
//return 23 still per Dr. Griffin{{{SINGLE-QUOTE}}}s request
|
||||
calchours := (((callingobsval - admitdttm) / 60 seconds) / 60) formatted with "%.2f";
|
||||
finddec := FIND "." IN STRING (calchours as string);
|
||||
calchours := SUBSTRING finddec-1 characters from calchours;
|
||||
addobsvalue := calchours;
|
||||
addobs := true;
|
||||
elseif callingobsval = "" or callingobsval is null then
|
||||
clearhrsold := true;
|
||||
elseif admitdttm > callingobsval then
|
||||
//if the admit date/time is greater than the entered date/time present this message to user so they know how to correct the issue.
|
||||
errormsg := "The Initial Screening Date/Time entered is prior to the patients Admit Date/Time. "
|
||||
|| "Please enter an approriate date/time in the Initial Screening Date/Time field. "
|
||||
|| "If the screening date/time entered is correct you will need to update the admission date/time in SCM. "
|
||||
|| "If you are unable to update the admission date/time in SCM please call registration to have the admission date/time updated.";
|
||||
clearhrsold := true;
|
||||
endif;
|
||||
//if chearhrsold is set to true then delete the hrsold observation that was previously added to the document.
|
||||
if clearhrsold = true then
|
||||
MLM_update_value_observation := NEW ObservationType;
|
||||
MLM_update_value_observation.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
MLM_update_value_observation.ParameterGUID := updateobsparam1.ParameterGUID;
|
||||
MLM_update_value_observation.DataType := "NumericValue";
|
||||
MLM_update_value_observation.ValueObj := null;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList,MLM_update_value_observation);
|
||||
|
||||
endif;
|
||||
//---------------------------END ADMIT DATE/TIME COMPARED TO INITIAL DATE/TIME ENTERED ON DOCUMENT--------------------------------//
|
||||
|
||||
|
||||
|
||||
|
||||
//if the chartedobservation is in position 2, 3, or 4 follow this logic (for this MLM these are the pulse ox reading initial, second, third
|
||||
elseif cfgposition >= 2 and cfgposition <= 4 then
|
||||
|
||||
//--------------------------BEGIN CHECKING THE HAND AND FOOT PULSE OX DATA ENTERED ON DOCUMENT------------------------------------//
|
||||
if callingobsval = "" or callingobsval is null
|
||||
or callingobsval2 = "" or callingobsval2 is null then
|
||||
//if hand or foot pulse ox is null/blank then we will blank out the pulse ox % difference
|
||||
addobsvalue := "";
|
||||
addobs := true;
|
||||
else
|
||||
//if there are values in both hand and foot pulse ox value then determine which is greater and subtracted the highest from the lowest
|
||||
if callingobsval >= callingobsval2 then
|
||||
addobsvalue := callingobsval - callingobsval2;
|
||||
else
|
||||
addobsvalue := callingobsval2 - callingobsval;
|
||||
endif;
|
||||
//logic provided by Dr. Griffen read as....
|
||||
//If one Pulse Ox value is greater than 95 and the difference is less than 3, precheck the Pass Button. Otherwise select Fail.
|
||||
//If the difference is greater than 3, precheck the Fail Button.
|
||||
if (callingobsval >= 95 or callingobsval2 >= 95) and addobsvalue <= 3 then
|
||||
passfail := "Pass";
|
||||
else
|
||||
passfail := "Fail";
|
||||
endif;
|
||||
addobs := true;
|
||||
endif;
|
||||
//--------------------------END CHECKING THE HAND AND FOOT PULSE OX DATA ENTERED ON DOCUMENT------------------------------------//
|
||||
endif;
|
||||
|
||||
|
||||
//-------------------------------BEGIN UPDATE TO FORM SECTION--------------------------------------//
|
||||
//update the observations identified in obsitemupdate1 and obsitemupdate2 based on above logic as log as the logic set the addobs to true
|
||||
//and thdobsvalue has been determined through the logic above
|
||||
if addobs = true and addobsvalue <> "" then
|
||||
MLM_update_value_observation := NEW ObservationType;
|
||||
MLM_update_value_observation.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
MLM_update_value_observation.ParameterGUID := updateobsparam1.ParameterGUID;
|
||||
MLM_update_value_observation.DataType := "NumericValue";
|
||||
MLM_update_value_observation.ValueObj := NEW NumericValueType;
|
||||
MLM_update_value_observation.ValueObj.Value := addobsvalue;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList,MLM_update_value_observation);
|
||||
|
||||
selectParameter := first of (thisParameters where thisParameters.Name = obsitemupdate2[cfgposition]);
|
||||
if (exists selectParameter) then
|
||||
|
||||
this_currentObj := NEW ObservationType;
|
||||
this_currentObj.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
this_currentObj.ParameterGUID := selectParameter.ParameterGUID;
|
||||
this_currentObj.DataType := "ListValue";
|
||||
this_currentObj.ValueObj := NEW ListValueType;
|
||||
this_currentObj.ValueObj.ListGUID := selectParameter.ConfigurationObj.ListGUID;
|
||||
listItems := ();
|
||||
for item IN selectParameter.ConfigurationObj.ListItemsList Do
|
||||
selectedItem := NEW ListValueListItemType;
|
||||
selectedItem.ListItemGUID := item.ListItemGUID;
|
||||
selectedItem.Value := item.Value;
|
||||
if selectedItem.Value = passfail then
|
||||
selectedItem.IsSelected := true;
|
||||
else
|
||||
selectedItem.IsSelected := false;
|
||||
endif;
|
||||
listItems := (listItems, selectedItem);
|
||||
enddo;
|
||||
this_currentObj.ValueObj.ListItemsList := listItems;
|
||||
|
||||
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
||||
endif;
|
||||
|
||||
|
||||
//if the logic above has determined that we needed to update the observations in obsitemupdate1 and obsitemupdate2
|
||||
//and the logic has found that the value needs to be null/blank/deleted then this logic will remove any values from the document that
|
||||
//needs removed.
|
||||
elseif addobs = true and addobsvalue = "" then
|
||||
MLM_update_value_observation := NEW ObservationType;
|
||||
MLM_update_value_observation.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
MLM_update_value_observation.ParameterGUID := updateobsparam1.ParameterGUID;
|
||||
MLM_update_value_observation.DataType := "NumericValue";
|
||||
MLM_update_value_observation.ValueObj := null;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList,MLM_update_value_observation);
|
||||
|
||||
selectParameter := first of (thisParameters where thisParameters.Name = obsitemupdate2[cfgposition]);
|
||||
if (exists selectParameter) then
|
||||
this_currentObj := NEW ObservationType;
|
||||
this_currentObj.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
this_currentObj.ParameterGUID := selectParameter.ParameterGUID;
|
||||
this_currentObj.DataType := "ListValue";
|
||||
this_currentObj.ValueObj := null;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
||||
endif;
|
||||
elseif errormsg <> "" then
|
||||
//if the errormsg has been set to something other than blank/null and neither udpate sections were called then display the error message to user
|
||||
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with errormsg,"Entered Date/Time before Admit Date/Time","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
//-------------------------------END UPDATE TO FORM SECTION--------------------------------------//
|
||||
ENDIF;
|
||||
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic: conclude true;
|
||||
;;
|
||||
action: return thisDocumentCommunication;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user