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

Binary file not shown.

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>cv3mlm_full.sql</StartArguments>
<StartWorkingDirectory>C:\gitprojects\St.Clair\MLMStripper\bin\Debug</StartWorkingDirectory>
</PropertyGroup>
</Project>

View File

@@ -1,15 +1,202 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IO = System.IO;
namespace MLMStripper
{
class Program
{
static string INSERT_SQL = "INSERT [dbo].[CV3MLM] ([SiteID], [RepFlags], [Build], [TouchedBy], [TouchedWhen], [CreatedBy], [CreatedWhen], [Active], [GUID], [ID], [Name], [Description], [Status], [Logic], [MSrepl_tran_version], [UsageType], [Title], [ArdenVersion], [MLMVersion], [MLMDate], [MSReplrowguid]) VALUES (";
// # Readin and Process all Lines
static string curTitle;
static List<string> ReadInLines = new List<string>();
static bool LinesInBuffer { get { return ReadInLines.Count > 0; } }
#region Simple Getters
static string GetTitle(string line)
{
string s = line.Substring(INSERT_SQL.Length);
string[] split = s.Split(',');
string title = split[11].Trim().Substring(2); // removing starting 'N and last '
return title.Substring(0, title.Length - 1);
}
static int GetStatus(string line)
{
string s = line.Substring(INSERT_SQL.Length);
string[] split = s.Split(',');
int status = int.Parse(split[13].Trim());
return status;
}
static int GetActive(string line)
{
string s = line.Substring(INSERT_SQL.Length);
string[] split = s.Split(',');
int active = int.Parse(split[7].Trim());
return active;
}
#endregion
static int nPosFindIn(string startswithToLower, List<string> contents)
{
for (int i = contents.Count - 1; i >= 0; i--)
{
string s = contents[i].Trim();
if (s.ToLower().StartsWith(startswithToLower.ToLower()))
{
return i;
}
}
return -1;
}
static void CleanupEndOfFile(List<string> contents)
{
bool bAddEnd = false;
int nPos = nPosFindIn("end:", contents);
if (nPos == -1)
{
nPos = nPosFindIn("urgency:", contents);
bAddEnd = true;
}
if (nPos == -1)
{
for (int i = contents.Count - 1; i >= 0; i--)
{
string s = contents[i].Trim();
if (string.IsNullOrEmpty(s))
{
contents.RemoveAt(i);
}
else
{
break;
}
}
}
else
{
contents.RemoveRange(nPos + 1, (contents.Count - nPos - 1));
}
if (bAddEnd)
contents.Add("end:");
}
static void WriteOutFile()
{
// write out contents - remove last line and cleanup end
ReadInLines.RemoveAt(ReadInLines.Count - 1);
CleanupEndOfFile(ReadInLines);
// Now do the actual work
string dirpath = IO.Directory.GetCurrentDirectory() + "\\" + curTitle.Split('_')[0];
if (!IO.Directory.Exists(dirpath))
IO.Directory.CreateDirectory(dirpath);
string FileNameNPath = dirpath + "\\" + curTitle + ".mlm";
if(IO.File.Exists(FileNameNPath))
{
int i = 44;
}
using (IO.FileStream fs = new IO.FileStream(FileNameNPath, IO.FileMode.Create))
using (IO.StreamWriter sw = new IO.StreamWriter(fs, Encoding.UTF8))
{
foreach (string line in ReadInLines)
sw.WriteLine(line);
sw.Flush();
}
// done
ReadInLines.Clear();
curTitle = String.Empty;
}
static void Main(string[] args)
{
if (args == null || string.IsNullOrEmpty(args[0]))
{
Console.WriteLine("Provide Filename");
return;
}
string Filename = args[0];
if (!IO.File.Exists(Filename))
{
Console.WriteLine("File does not exist");
return;
}
// # Readin and Process all Lines
using (IO.FileStream fs = new IO.FileStream(Filename, IO.FileMode.Open))
using (IO.StreamReader reader = new IO.StreamReader(fs, Encoding.UTF8))
{
// Ignore the first two lines
reader.ReadLine();
reader.ReadLine();
int filecount = 0;
// # Iterate thru all the rest of the lines in the File
for (string Line = reader.ReadLine(); Line != null; Line = reader.ReadLine())
{
if (Line.StartsWith(INSERT_SQL))
{
if (LinesInBuffer)
{
WriteOutFile();
}
// we need active and status of 4
int active = GetActive(Line);
int status = GetStatus(Line);
//Trace.WriteLine(String.Format("Active:{0} - Status:{1} - FileCount:{2}", active, status, ++filecount));
if (active != 1 || status != 4)
continue;
// Begin Parsing this file
curTitle = GetTitle(Line);
//if (curTitle == "SCH_OUTPATIENT_STATUS_BOARD_COLUMN_UPDATE_2")
//{
// int i = 44;
//}
Trace.WriteLine(String.Format("{0} - FileCount:{1}", curTitle, ++filecount));
// clear buffer
ReadInLines.Clear();
ReadInLines.Add("maintenance:\n"); // begining new file
continue;
}
else if (!String.IsNullOrEmpty(curTitle))
{
ReadInLines.Add(Line);
}
}
if (LinesInBuffer)
{
WriteOutFile();
}
}
}
}
}

View File

@@ -0,0 +1,103 @@
maintenance:
title: ACS_DUPLICATE_REFERENCE_LAB_ALERT;;
filename: ACS_DUPLICATE_REFERENCE_LAB_ALERT;;
arden: version 2.5;;
version: 16.30;;
institution: Allscripts;;
author: Allscripts;;
specialist: St Clair - Maria Pest;;
date: 2017-12-21;;
validation: testing;;
library:
purpose:
Hard stop alert upon entry of Reference lab order that has already been ordered this admission.
;;
explanation:
Only fire for Inpatient Visits
Identify which orders should not be duplicated during an admission by the order name ending in any of the following:
(Mayo)
(ITxM)
(Prometheus)
(Quest)
(UPMC)
Current Visit - Any Order which ends with this, check to see if it (the exact order) already exists, and stop its duplication.
;;
keywords: Alert , Referenc Lab , Duplicate
;;
knowledge:
type: data-driven;;
data:
hardStop := true;
// Evoking Events
OrderInitEvent := event { OrderInit User Order:
where Name matches pattern "%(Mayo)"
OR Name matches pattern "%(ITxM)"
OR Name matches pattern "%(Prometheus)"
OR Name matches pattern "%(Quest)"
OR Name matches pattern "%(UPMC)"
};
// Defining the Evoking Object as ClientVisit.
if called_by_editor then
EvokingObject := read last
{Order: This
where Name matches pattern "%(Mayo)"
OR Name matches pattern "%(ITxM)"
OR Name matches pattern "%(Prometheus)"
OR Name matches pattern "%(Quest)"
OR Name matches pattern "%(UPMC)"
};
endif;
/* An alert is stored into the database */
Msg_alert:= Destination { Alert } with
[
alert_type := warning ,
short_message := "Duplicate Reference Lab Order" ,
priority := "medium" ,
scope := "chart" ,
rule_group := "Duplicate Order" ,
rule_number := 1011 ,
Alert_dialog_settings := "" ,
Display_alert := True
];
if(hardStop)then
Msg_alert.Alert_dialog_settings := "No Override Allowed";
endif;
MyMessage := "Reference lab order (" || EvokingObject.Name || ") has already been ordered this admission.";
query := "select count(*) from CV3Order where ClientGUID = " || EvokingObject.ClientGUID || " and ChartGUID = " || EvokingObject.ChartGUID || " and ClientVisitGUID = " || EvokingObject.ClientVisitGUID || " and Active = 1 and OrderStatusLevelNum not in (69,70) and Name = " || SQL(EvokingObject.Name);
ExisitingDuplicateOrderCnt := read last {"" || query};
;;
priority: 50
;;
evoke:
OrderInitEvent ;
;;
logic:
If ExisitingDuplicateOrderCnt > 0
Then
conclude true;
Else
conclude false;
Endif;
;;
action:
WRITE MyMessage At Msg_alert;
;;
Urgency: 80;;
end:

View File

@@ -0,0 +1,839 @@
maintenance:
title: Generic Lookup;;
mlmname: ACS_generic_Lookup ;;
arden: version 2.5;;
version: 5.50;;
institution: Allscripts;;
author: ACS;;
specialist: Allscripts Custom Services;;
date: 2011-12-05;;
validation: testing;;
library:
purpose: Generic tool to lookup past patient data, based upon passed parameters.
;;
explanation:
Change history
05.01.2014 DW CSR# 32070 - Add Admit Date to PN LOS text box
19.05.2015 DW CSR# 32982 - Add Skipped Doses to {{{SINGLE-QUOTE}}}Medication and Allergies{{{SINGLE-QUOTE}}}=> {{{SINGLE-QUOTE}}}Active Medications with detail{{{SINGLE-QUOTE}}} radio button
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
/******************************* Make Changes Here *************************************/
///*** REM - change current to NOW - 24 hours
////*** when data ready is ready to be within last 24 hours
current := Now - 24 hours;
/****************** Make Your code stretch NO WIDER THAN THIS! *************************/
(This_communicationobj,
Client_guid,
Client_visit_guid,
Client_chart_guid,
Getdata_from,//“historical” or “current” (use SQL or current object navigation)
Data_value_type,//Object to retrieve (“HealthIssue”, “order”, etc.)
Data_item,//Attribute to retrieve (“name”, “itemname”, “typecode”, “code”, etc.)
Filterable_item,//Filterable attribute (“name”, “itemname”, “typecode”, “code”, etc.)
Filterable_operator,//Filterable operator (“=”, “<>”, “in”, “matches pattern”, etc.)
Filterable_value,//Filterable value(s)(“chronic”, “atb”,“(480.00,480.30)", etc.)
Additional_condition)//Additional condition(s)
:= ARGUMENT;
// Initialize
Return_Data_item :=();//List object attributes retrieved
Return_Data_item_value :=();//List of values for the attribute(s)
Return_UOM_or_code :=();//List of UOMs (units of measure) for the attributes
Return_relevant_time :=();//List of medically relevant times
Return_start_or_alt_name:=();//List of start times (if relevant)
Return_stop_or_alt_code :=();//List of stop times (if relevant)
Return_user_or_other :=();//List of userguids who entered data.
Return_Significant_data:=();//List of other “significant data” as a text field.
Return_Sig_count := (); //list of significant COUNT data.
Return_Sig_Nt_count := (); //list of Non significant COUNT data.... Added By Shivprasad Jadhav For CSR : 32982
strUser_guid :="";
strSQL :="";
strWhere :="";
strFilterSQL :="";
IF exist This_communicationobj THEN
strUser_guid := This_communicationobj.UserGUID;
ENDIF;
if called_by_editor then
Data_value_type := "Vitals"; //"Orders"; //"Lab Results";
strUser_guid := read last {userinfo: guid};
data_item := "ocmi.name"; // "Lab Results"; //"hi.shortname + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + hi.description";
Filterable_item:= "ocmi.name"; // "ch.code"; //"o.name"; ///,
Filterable_operator:= "IN"; // "like"; // (“=”, “<>”, “in”, “matches pattern”, etc.)
Filterable_value:=
"{{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}L/min{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}},"
||"{{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Farenheit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}}";
// " {{{SINGLE-QUOTE}}}Basic Metabolic Panel{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Electrolytes{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Liver Panel{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Hemoglobin and Hemtocrit{{{SINGLE-QUOTE}}},"
// ||"{{{SINGLE-QUOTE}}}Prothrombin/INR{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}APTT{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CBC (Includes Diff){{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CBC with Manual Diff{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Creatinine{{{SINGLE-QUOTE}}}" ;
//"{{{SINGLE-QUOTE}}}Pulmonary Health Education Consult{{{SINGLE-QUOTE}}}";
(client_guid, client_visit_guid, client_chart_guid) :=
read last {clientvisit: clientguid, guid, chartguid};
Getdata_from := "Historical";
// Additional_condition:="ALL"; //o.OrderStatusLevelNum >= {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} " ; //"all";
endif;
IF Getdata_from = "Historical" THEN // assemble the main condition
strWhere := " where ClientGUID = " || SQL(Client_guid);
IF any(exists Filterable_item AND (not (Filterable_item is in ("", "No"))))
AND any(exists Filterable_operator AND (not(Filterable_operator is in ("", "No"))))
AND any(exists Filterable_value AND (not (Filterable_value is in ("", "No")))) THEN
strFilterSQL := " ( " || Filterable_item||" "||Filterable_operator||" ";
IF Filterable_operator = "IN" THEN
strFilterSQL := strFilterSQL ||"("|| Filterable_value||")";
ELSEIF Filterable_operator = "LIKE" THEN
if count Filterable_value = 1 then
strFilterSQL := strFilterSQL || "{{{SINGLE-QUOTE}}}%" || Filterable_value|| "%{{{SINGLE-QUOTE}}}";
else // enable multiple LIKEs in SQL
strFilterSQL := strFilterSQL ||"{{{SINGLE-QUOTE}}}%"|| Filterable_value[1] || "%{{{SINGLE-QUOTE}}}";
for m in 2 seqto count Filterable_value do
strFilterSQL := strFilterSQL || " or "
|| Filterable_item || " " || Filterable_operator|| " "
||"{{{SINGLE-QUOTE}}}%"|| Filterable_value[m] || "%{{{SINGLE-QUOTE}}}" ;
enddo;
endif;
ELSE
strFilterSQL := strFilterSQL || SQL(Filterable_value);
ENDIF; // Filterable_operator ="IN"
strFilterSQL := strFilterSQL || " ) ";
ENDIF; // any(exists Filterable_item AND ...
// CASE STMT FOR POSSIBLE HISTORICAL LOOKUPS
// HEALTH ISSUES ####################################################################
IF Data_value_type ="HealthIssue" THEN // create main SQL
strSQL := " SELECT "|| Data_item ||", ch.code, hi.TouchedWhen, hi.CreatedBy "
||" FROM CV3HealthIssueDeclaration hi"
||" left outer join CV3CodedHealthIssue ch "
||" on ch.GUID = hi.CodedHealthIssueGUID "
;
// apend the condition
strWhere := strWhere || " AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} AND hi.Active = 1 ";
IF strFilterSQL <>"" THEN
strSQL := strSQL || strWhere || " AND "|| strFilterSQL ;
ENDIF;
// get the returnable data
(Return_Data_item, Return_Data_item_value, Return_relevant_time,
Return_user_or_other) := read{ "" ||strSql|| " " };
IF NOT EXISTS Return_Data_item THEN
Return_Data_item := "\b No Problems Listed. \b0" ;
ENDIF;
// SERVICE ##########################################################################
ELSEIF Data_value_type = "Service" THEN // create main SQL
IF strUser_guid <> "" THEN
/*(Return_Data_item_value):= read last
{"SELECT Discipline FROM CV3CareProvider where "
|| " GUID =" || SQL(strUser_guid)
|| " AND Active = 1 " };*/
// Below New SQL Added By Shivprasad for CSR : 32338
(Return_Data_item_value):= read last {" Select Stuff (( Select {{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}+ d.Code "
|| " From cv3Careprovider cp (Nolock) Inner Join SXAAMCareProviderSpecialtyXREF cpx"
|| " On cp.GUID=cpx.CareProviderGUID "
|| " Inner Join CV3Discipline d (Nolock) On d.GUID=cpx.DisciplineGUID "
|| " Where cp.GUID =" || SQL(strUser_guid)
|| " AND cp.Active = 1 Order by d.TouchedWhen "
|| " FOR XML PATH({{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}), TYPE).value({{{SINGLE-QUOTE}}}.{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}varchar(max){{{SINGLE-QUOTE}}}), 1, 1, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as Discipline " } ;
IF NOT Exists Return_Data_item_value Then
Return_Data_item_value := "\b No Service Data Available. \b0" ;
EndIf;
ENDIF;
// LOS ##############################################################################
ELSEIF Data_value_type ="LOS" THEN
(admit_date, admit_date_modified) := read last
{"SELECT v.AdmitDtm, CONVERT(char (10),v.AdmitDtm,101) "
|| " FROM cv3clientvisit v "
|| " WHERE v.clientGUID = " || sql(Client_guid)
|| " and v.guid = " || sql(Client_visit_guid)
|| " and v.active = 1 " //non-closed visits
, primarytime = admitdtm};
hospital_hour:= INT((NOW - admit_date) / 1 hour) ;
hospital_day := INT(hospital_hour /24 ) + 1 ;
Formatted_NOW := NOW FORMATTED WITH "%.4t";
IF Exists hospital_day Then
Return_Data_item_value:= Return_Data_item_value, "\b Date of Admission: \b0 " || admit_date_modified || "\n\b Hospital Day: \b0 # "
|| hospital_day || ", Hour # " || hospital_hour
|| " (current date and time : " || Formatted_NOW || ")" ;
ELSE
Return_Data_item_value := "\b No LOS Data Available. \b0" ;
ENDIF;
// VITAL SIGNS ######################################################################
ELSEIF Data_value_type = "Vitals" THEN
/////// 021512 - added to fetch all Lines not just last 24 hrs ////////////
if Additional_condition matches pattern "Line Access%"
then
current:= NOW - 30 days;
endif;
///////////////////////////////////////////////
strSQL := " select ocmi.name, isnull(sp.valuetext, SOBS.value) vs_vals, "
||" sp.obsuom, " //ob.unitofmeasure , "
||" convert(char(16), sp.recordeddtm, 110) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} "
||" + convert(char(5), sp.recordeddtm, 14), "
||" d.documentname, ocmi.leftjustifiedlabel "
||" from cv3clientdocument d "
||" JOIN SXACDObservationParameter sp "
||" ON d.ClientGUID = sp.ClientGUID "
||" and d.ChartGUID = sp.ChartGUID "
||" and d.guid = sp.ownerguid "
||" and d.PatCareDocGUID = sp.PatCareDocGUID "
||" JOIN CV3ObsCatalogMasterItem ocmi "
||" ON ocmi.GUID = sp.ObsMasterItemGUID "
/* ||" join cv3observationDocument o "
||" on o.ownerguid = d.guid "
||" and o.ObservationDocumentGUID = sp.ObservationDocumentGUID "
||" and o.ObsMasterItemGUID = ocmi.guid "
||" and o.active = 1 "
||" left outer join cv3observation ob "
||" on sp.ObservationGUID = ob.GUID "
*/
||" LEFT outer JOIN SCMObsFSListValues SOBS "
||" on sp.ClientGUID = SOBS.ClientGUID "
||" and sp.ObservationDocumentGUID = SOBS.ParentGUID "
||" AND SOBS.Active = 1 "
|| " and SOBS.ClientGUID =" || sql(Client_guid)
||" WHERE d.clientGUID = " || sql(Client_guid)
||" and d.chartguid = " || sql(client_chart_guid)
||" and d.clientvisitguid = " || sql(Client_visit_guid)
||" and sp.recordeddtm >= " || sql(current)
;
/// 041912 - added "and SOBS.ClientGUID =" || sql(Client_guid) to the sql above
IF strFilterSQL <> "" THEN // append filter
strSQL := strSQL || " AND " || strFilterSQL ;
ENDIF;
(vs_names, vs_vals, vs_uoms ,vs_times, vs_docs, vs_labels) := read
{ "" || strSQL
|| "order by sp.RecordedDtm "
};
if exists vs_vals then // set return values
Return_Data_item:= vs_names;
Return_Data_item_value:= vs_vals;
Return_UOM_or_code := vs_uoms;
Return_relevant_time:= vs_times;
Return_start_or_alt_name:= "";
Return_stop_or_alt_code:= "";
Return_user_or_other:= "";
Return_Significant_data:= vs_labels;
Return_Sig_Count := "";
endif;
IF NOT Exists Return_Data_item_value Then
Return_Data_item_value := "\b No Vital Sign Data Available. \b0" ;
EndIf;
// I & O ############################################################################
ELSEIF Data_value_type is in ("IO_Drains_shift", "IO_NG_shift") THEN
strSQL := " select ocmi.name, x.outvalue, sp.obsuom, " //ob.unitofmeasure ,
||" sp.RecordedDtm , d.documentname "
||" , case "
||" when sp.shiftdailyhourlytotal = 1 then {{{SINGLE-QUOTE}}}Shift total{{{SINGLE-QUOTE}}} "
||" when sp.shiftdailyhourlytotal = 2 then {{{SINGLE-QUOTE}}}Daily total{{{SINGLE-QUOTE}}} "
||" when sp.shiftdailyhourlytotal = 3 then {{{SINGLE-QUOTE}}}Hourly total{{{SINGLE-QUOTE}}} "
||" else {{{SINGLE-QUOTE}}}unknown{{{SINGLE-QUOTE}}} "
||" end as shift_daily_hourly "
||" from cv3clientdocument d "
/* ||" join cv3observationDocument o "
||" on o.ownerguid = d.guid "
||" and o.active = 1 "
*/
||" JOIN SXACDObservationParameter sp "
||" ON d.ClientGUID = sp.ClientGUID "
||" and d.ChartGUID = sp.ChartGUID "
||" and d.PatCareDocGUID = sp.PatCareDocGUID "
||" and d.guid = sp.ownerguid "
// ||" and o.ObservationDocumentGUID = sp.ObservationDocumentGUID "
||" JOIN CV3ObsCatalogMasterItem ocmi "
||" ON ocmi.GUID = sp.ObsMasterItemGUID "
||" left outer join CV3ClientObsEntryItem oei on oei.GUID = sp.ParameterGUID "
||" and oei.IsUpdate = 1 " //get latest item only
/* ||" join cv3observation ob "
||" on sp.ObservationGUID = ob.GUID "
||" and ob.shiftdailyhourlytotal = 1 " // shift total only
*/
||" join cv3observationxinfo x "
||" on sp.ObservationGUID = x.observationxinfoguid "
||" WHERE d.clientGUID = " || sql(Client_guid)
||" and d.chartguid = " || sql(client_chart_guid)
||" and d.clientvisitguid = " || sql(Client_visit_guid)
||" and sp.shiftdailyhourlytotal = 1 " // shift total only
;
IF strFilterSQL <> "" THEN // append condition
strSQL := strSQL || " AND " || strFilterSQL ;
ENDIF;
(io_names, io_vals, io_uoms, io_times, io_docs, io_sdh_tots) := read
{ "" || strSQL
|| "", primarytime = recordeddtm};
if exists io_times then // get the latest recorded values
latest_shft_io_time := max (io_times);
latest_shft_io_vals := io_vals where((time of io_vals) = latest_shft_io_time);
latest_shft_io_names := io_names
where((time of io_names) = latest_shft_io_time);
latest_shft_io_sdh_tots := io_sdh_tots
where((time of io_sdh_tots) = latest_shft_io_time);
latest_shft_total := sum (latest_shft_io_vals as number);
// set return values
Return_Data_item:= ,Data_value_type;
Return_Data_item_value:= ,latest_shft_total;
Return_UOM_or_code := ,(first io_uoms);
Return_relevant_time:= ,latest_shft_io_time;
Return_start_or_alt_name:= "";
Return_stop_or_alt_code:= "";
Return_user_or_other:= "";
Return_Significant_data:= "";
Return_Sig_Count := "";
endif;
IF NOT Exists Return_Data_item_value Then
Return_Data_item_value := "\b No Shift I&O Data Available for \b0"
|| Data_value_type ;
EndIf;
//Added below elseif section for IO_NG_shift_NB in Newborn Assessment and Discharge Summary document (CSR-33427) (Vikas)
ELSEIF Data_value_type is in ("IO_NG_shift_NB") THEN
//break;
strSQL := " select ocmi.name, isnull(x.outvalue,x.invalue) as outvalue, sp.obsuom, " //ob.unitofmeasure ,
||" sp.RecordedDtm , d.documentname "
||" , case "
||" when sp.shiftdailyhourlytotal = 1 then {{{SINGLE-QUOTE}}}Shift total{{{SINGLE-QUOTE}}} "
||" when sp.shiftdailyhourlytotal = 2 then {{{SINGLE-QUOTE}}}Daily total{{{SINGLE-QUOTE}}} "
||" when sp.shiftdailyhourlytotal = 3 then {{{SINGLE-QUOTE}}}Hourly total{{{SINGLE-QUOTE}}} "
||" else {{{SINGLE-QUOTE}}}unknown{{{SINGLE-QUOTE}}} "
||" end as shift_daily_hourly "
||" from cv3clientdocument d "
/* ||" join cv3observationDocument o "
||" on o.ownerguid = d.guid "
||" and o.active = 1 "
*/
||" JOIN SXACDObservationParameter sp "
||" ON d.ClientGUID = sp.ClientGUID "
||" and d.ChartGUID = sp.ChartGUID "
||" and d.PatCareDocGUID = sp.PatCareDocGUID "
||" and d.guid = sp.ownerguid "
||" and d.DocumentName = {{{SINGLE-QUOTE}}}B2. Newborn Intake and Output{{{SINGLE-QUOTE}}} "
// ||" and o.ObservationDocumentGUID = sp.ObservationDocumentGUID "
||" JOIN CV3ObsCatalogMasterItem ocmi "
||" ON ocmi.GUID = sp.ObsMasterItemGUID "
||" left outer join CV3ClientObsEntryItem oei on oei.GUID = sp.ParameterGUID "
||" and oei.IsUpdate = 1 " //get latest item only
/* ||" join cv3observation ob "
||" on sp.ObservationGUID = ob.GUID "
||" and ob.shiftdailyhourlytotal = 1 " // shift total only
*/
||" join cv3observationxinfo x "
||" on sp.ObservationGUID = x.observationxinfoguid "
||" WHERE d.clientGUID = " || sql(Client_guid)
||" and d.chartguid = " || sql(client_chart_guid)
||" and d.clientvisitguid = " || sql(Client_visit_guid)
||" and sp.shiftdailyhourlytotal = 1 " // shift total only
;
IF strFilterSQL <> "" THEN // append condition
strSQL := strSQL || " AND " || strFilterSQL ;
ENDIF;
//Break;
(io_names, io_vals, io_uoms, io_times, io_docs, io_sdh_tots) := read
{ "" || strSQL
|| "", primarytime = recordeddtm};
if exists io_times then // get the latest recorded values
latest_shft_io_time := max (io_times);
latest_shft_io_vals := io_vals where((time of io_vals) = latest_shft_io_time);
latest_shft_io_names := io_names
where((time of io_names) = latest_shft_io_time);
latest_shft_io_sdh_tots := io_sdh_tots
where((time of io_sdh_tots) = latest_shft_io_time);
latest_shft_total := sum (latest_shft_io_vals as number);
// set return values
Return_Data_item:= ,Data_value_type;
Return_Data_item_value:= ,latest_shft_total;
Return_UOM_or_code := ,(first io_uoms);
Return_relevant_time:= ,latest_shft_io_time;
Return_start_or_alt_name:= "";
Return_stop_or_alt_code:= "";
Return_user_or_other:= "";
Return_Significant_data:= "";
Return_Sig_Count := "";
endif;
IF NOT Exists Return_Data_item_value Then
Return_Data_item_value := "\b No Shift I&O Data Available for \b0"
|| Data_value_type ;
EndIf;
ELSEIF Data_value_type is in ( "IO24", "IOSOC") THEN
IF Data_value_type = "IO24" THEN
sql_last_24hr := " AND RecordedDateTime >= getDate() - 1 ";
else
sql_last_24hr := " ";
endif;
(All_IO_RecDTm, All_IO_TotIT, All_IO_TotOP, All_IO_Tot24 ) := READ
{" SELECT RecordedDateTime,TotalIntake,TotalOutput,Total24hr "
|| " FROM SCMObsFSGrandTotals "
|| " WHERE ClientGUID = " || SQL(client_guid)
|| " and chartguid = " || sql(client_chart_guid)
|| " AND ShIftDailyHourlyTotal = 1 " //shift total
|| " AND TotalType = 3 " //grand total
|| " AND Active = 1 "
|| sql_last_24hr
|| " order by RecordedDateTime desc "
};
IF Data_value_type = "IO24" THEN
All_IO_RecDTm := first 4 from All_IO_RecDTm;
All_IO_TotIT := first 4 from All_IO_TotIT;
All_IO_TotOP := first 4 from All_IO_TotOP;
All_IO_Tot24 := first 4 from All_IO_Tot24;
endif;
//Variables for total
Intake_Total:= 0 As NUMBER ;
Output_Total:= 0 As NUMBER ;
Fluid_Balance:= 0 As NUMBER;
max_io_time := first(All_IO_RecDTm);
min_io_time := last(All_IO_RecDTm);
For ictr IN 1 seqto count All_IO_RecDTm Do
//Calculating Total Intake AND OutPut
If Exists All_IO_TotIT[ictr] Then Intake_Total :=
Intake_Total + ( All_IO_TotIT[ictr] As Number );
EndIF;
If Exists All_IO_TotOP[ictr] Then Output_Total :=
Output_Total + (All_IO_TotOP[ictr] As NUMBER ) ;
EndIF;
EndDo;
Fluid_Balance := Intake_Total - Output_Total;
if exists All_IO_RecDTm then
Return_Data_item:= ("Intake Total","Output Totalr","Fluid Balance") ;
Return_Data_item_value:= Intake_Total, Output_Total, Fluid_Balance ;
Return_UOM_or_code := ("mL", "mL", "mL");
Return_relevant_time:= (max_io_time, max_io_time, max_io_time);
Return_start_or_alt_name:= (min_io_time, min_io_time, min_io_time);
Return_stop_or_alt_code:= (max_io_time, max_io_time, max_io_time);
Return_user_or_other:= "";
Return_Significant_data:= "";
Return_Sig_Count := "";
endif;
IF NOT Exists Return_Data_item_value Then
Return_Data_item_value := "\b No I&O Summary Data Available. \b0" ;
EndIf;
/* // Orders #################################################################
ELSEIF Data_value_type = "Orders" THEN
strSQL := " select o.name, isnull(o.summaryline,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}), requesteddtm "
||" , OTO.TaskName, therapeuticcategory, therapeuticcategoryID "
||" , max(OTO.PerformedFromDtm) "
||" from cv3order o "
||" left outer join cv3ordertaskoccurrence oto "
||" on oto.clientguid = o.clientguid "
||" and oto.orderguid = o.guid "
||" AND OTO.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
||" and oto.active = 1 "
||" join cv3ordercatalogmasteritem ocmi"
||" on ocmi.guid = o.ordercatalogmasteritemguid"
||" WHERE o.Active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
||" and o.OrderStatusLevelNum <= {{{SINGLE-QUOTE}}}50{{{SINGLE-QUOTE}}}"
||" and o.IsSuspended = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
||" and o.IsHeld = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
|| " and o.clientGUID = " || sql(Client_guid)
||" and o.chartguid = " || sql(client_chart_guid)
||" and o.clientvisitguid = " || sql(Client_visit_guid) ;
IF strFilterSQL <> "" THEN // append condition
strSQL := strSQL || " AND " || strFilterSQL ;
ENDIF;
IF Additional_condition <> "" THEN
strSQL := strSQL || " AND " || Additional_condition ;
ENDIF;
strSQL := strSQL
|| " group by o.name, o.summaryline, requesteddtm, OTO.TaskName ";
(ord_names, ord_summs, ord_times, task_names, cl_val, cl_code, task_times) :=
read { "" || strSQL
, primarytime = requesteddtm };
if exists ord_names then
Return_Data_item:= ord_names;
Return_Data_item_value:= ord_summs;
Return_UOM_or_code := "";
Return_relevant_time:= ord_times;
Return_start_or_alt_name:= "";
Return_stop_or_alt_code:= "";
Return_user_or_other:= "";
Return_Significant_data:= task_times;
endif;
IF NOT Exists Return_Data_item then
Return_Data_item_value := "\b No Active Order Data Available. \b0" ;
EndIf;
*/
// Orders ############################################################
// ELSEIF Data_value_type = "Therap_Cat_Orders" THEN //"Abx Orders" THEN
ELSEIF Data_value_type = "Orders" THEN
/*
//// Previous fetch of Antibiotics done by ClassType
strsql:="select o.name,o.SummaryLine, tv.value, ct.code, requesteddtm "
||" from CV3ORder o"
||" join cv3catalogclasstypevalue tv"
||" on tv.catalogmasterguid = o.ordercatalogmasteritemguid"
||" inner join cv3classtype ct"
||" On tv.classtypeguid = ct.guid"
||" WHERE o.Active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
||" and o.OrderStatusLevelNum <= {{{SINGLE-QUOTE}}}50{{{SINGLE-QUOTE}}}"
||" and o.IsSuspended = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
||" and o.IsHeld = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
||" and o.clientguid = " || sql(Client_guid) //{{{SINGLE-QUOTE}}}9000001864400200{{{SINGLE-QUOTE}}}"
||" and o.ChartGUID = " || sql(Client_chart_guid)
||" and o.ClientVisitGUID = " || sql(Client_visit_guid) ;
//||" and ct.code = {{{SINGLE-QUOTE}}}PN_Antibiotics{{{SINGLE-QUOTE}}}" ;
*/
/* if Additional_condition <> "All" then
strsql:="select o.name,o.SummaryLine, therapeuticcategory, "
||" therapeuticcategoryID, "
||" requesteddtm, OTO.TaskName, max(OTO.PerformedFromDtm) "
||" from CV3ORder o"
||" left outer join cv3ordertaskoccurrence oto "
||" on oto.clientguid = o.clientguid "
||" and oto.orderguid = o.guid "
||" AND OTO.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
||" and oto.active = 1 "
||" join cv3ordercatalogmasteritem ocmi"
||" on ocmi.guid = o.ordercatalogmasteritemguid"
||" WHERE o.Active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
||" and o.OrderStatusLevelNum <= {{{SINGLE-QUOTE}}}50{{{SINGLE-QUOTE}}}"
||" and o.IsSuspended = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
||" and o.IsHeld = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
||" and o.clientguid = " || sql(Client_guid)
||" and o.ChartGUID = " || sql(Client_chart_guid)
||" and o.ClientVisitGUID = " || sql(Client_visit_guid) ;
elseif
Additional_condition = "All"
then
*/
//Hide Start: By Shivprasad
/* strsql := "select o.name,o.SummaryLine, ocmi.therapeuticcategory, "
||" therapeuticcategoryID, requesteddtm, OTO.TaskName, "
||" max(OTO.PerformedFromDtm), OrderStatusCode, StopDate "
||" , e.admininstructions, count(OTO.PerformedFromDtm) "
||" from CV3ORder o"
||" left outer join cv3ordertaskoccurrence oto "
||" on oto.clientguid = o.clientguid "
||" and oto.orderguid = o.guid "
||" AND OTO.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
||" and oto.active = 1 "
||" join cv3ordercatalogmasteritem ocmi "
||" on ocmi.guid = o.ordercatalogmasteritemguid "
//||" WHERE o.Active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
//||" and o.OrderStatusLevelNum <= {{{SINGLE-QUOTE}}}50{{{SINGLE-QUOTE}}}"
||" left outer join CV3MedicationExtension e "
||" on e.ClientGUID = o.ClientGUID "
||" and e.GUID = o.GUID "
||" WHERE o.clientguid = " || sql(Client_guid)
||" and o.ChartGUID = " || sql(Client_chart_guid)
||" and o.ClientVisitGUID = " || sql(Client_visit_guid)
||" and o.IsSuspended = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
||" and o.IsHeld = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} ";
// endif;
if Additional_condition <> "All" then
strsql := strsql || " and o.Active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
|| " and o.OrderStatusLevelNum <= {{{SINGLE-QUOTE}}}60{{{SINGLE-QUOTE}}}";
IF Additional_condition <> "" THEN
strSQL := strSQL || " AND " || Additional_condition ;
endif;
endif;
IF strFilterSQL <> "" THEN
strSQL := strSQL || " AND "|| strFilterSQL ;
endif;
strSQL := strSQL || " group by o.name, o.summaryline, requesteddtm, "
||" ocmi.therapeuticcategory, therapeuticcategoryID, OTO.TaskName, "
||" OrderStatusCode, Stopdate "
||" , e.admininstructions "
; */ //Hide End : By Shivprasad
//Added By Shivprasad Jadhav For CSR : 32982
strsql := "select o.guid , o.name,o.SummaryLine, ocmi.therapeuticcategory, "
||" therapeuticcategoryID, requesteddtm, OTO.TaskName, "
||" max(OTO.PerformedFromDtm) as PerformDate, OrderStatusCode, StopDate "
||" , e.admininstructions, count(OTO.PerformedFromDtm) as cntPerformed ,0 as cntNotPerformed "
||" Into #Temp1 "
||" from CV3ORder o"
||" left outer join cv3ordertaskoccurrence oto "
||" on oto.clientguid = o.clientguid "
||" and oto.orderguid = o.guid "
||" AND OTO.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} "
||" and oto.active = 1 "
||" join cv3ordercatalogmasteritem ocmi "
||" on ocmi.guid = o.ordercatalogmasteritemguid "
||" left outer join CV3MedicationExtension e "
||" on e.ClientGUID = o.ClientGUID "
||" and e.GUID = o.GUID "
||" WHERE o.clientguid = " || sql(Client_guid)
||" and o.ChartGUID = " || sql(Client_chart_guid)
||" and o.ClientVisitGUID = " || sql(Client_visit_guid)
||" and o.IsSuspended = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
||" and o.IsHeld = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} ";
// endif;
if Additional_condition <> "All" then
strsql := strsql || " and o.Active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
|| " and o.OrderStatusLevelNum <= {{{SINGLE-QUOTE}}}60{{{SINGLE-QUOTE}}}";
IF Additional_condition <> "" THEN
strSQL := strSQL || " AND " || Additional_condition ;
endif;
endif;
IF strFilterSQL <> "" THEN
strSQL := strSQL || " AND "|| strFilterSQL ;
endif;
strSQL := strSQL || " group by o.guid ,o.name, o.summaryline, requesteddtm, "
||" ocmi.therapeuticcategory, therapeuticcategoryID, OTO.TaskName, "
||" OrderStatusCode, Stopdate "
||" , e.admininstructions "
;
strsql1 := "select o.guid ,o.name,o.SummaryLine, ocmi.therapeuticcategory, "
||" therapeuticcategoryID, requesteddtm, OTO.TaskName, "
||" max(OTO.PerformedFromDtm) as PerformDate , OrderStatusCode, StopDate "
||" , e.admininstructions, IsNull (Case When ( OTO.TaskStatusCode = {{{SINGLE-QUOTE}}}Overdue{{{SINGLE-QUOTE}}}) Then COUNT(OTO.TaskStatusCode)End, 0) as cntNonPerformed "
||" Into #Temp2 "
||" from CV3ORder o"
||" left outer join cv3ordertaskoccurrence oto "
||" on oto.clientguid = o.clientguid "
||" and oto.orderguid = o.guid "
||" AND OTO.TaskStatusCode in( {{{SINGLE-QUOTE}}}Overdue{{{SINGLE-QUOTE}}}) "
||" and oto.active = 1 "
||" join cv3ordercatalogmasteritem ocmi "
||" on ocmi.guid = o.ordercatalogmasteritemguid "
||" left outer join CV3MedicationExtension e "
||" on e.ClientGUID = o.ClientGUID "
||" and e.GUID = o.GUID "
||" WHERE o.clientguid = " || sql(Client_guid)
||" and o.ChartGUID = " || sql(Client_chart_guid)
||" and o.ClientVisitGUID = " || sql(Client_visit_guid)
||" and o.IsSuspended = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
||" and o.IsHeld = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} ";
// endif;
if Additional_condition <> "All" then
strsql1 := strsql1 || " and o.Active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
|| " and o.OrderStatusLevelNum <= {{{SINGLE-QUOTE}}}60{{{SINGLE-QUOTE}}}";
IF Additional_condition <> "" THEN
strSQL1 := strSQL1 || " AND " || Additional_condition ;
endif;
endif;
IF strFilterSQL <> "" THEN
strSQL1 := strSQL1 || " AND "|| strFilterSQL ;
endif;
strSQL1 := strSQL1 || " group by o.guid ,o.name, o.summaryline, requesteddtm, "
||" ocmi.therapeuticcategory, therapeuticcategoryID, OTO.TaskName, OTO.TaskStatusCode, "
||" OrderStatusCode, Stopdate "
||" , e.admininstructions "
;
strsql2 := "select o.guid ,o.name,o.SummaryLine, ocmi.therapeuticcategory, "
||" therapeuticcategoryID, requesteddtm, OTO.TaskName, "
||" max(OTO.PerformedFromDtm) as PerformDate , OrderStatusCode, StopDate "
||" , e.admininstructions, IsNull (Case When (OTO.TaskStatusCode = {{{SINGLE-QUOTE}}}Not Performed{{{SINGLE-QUOTE}}} ) Then COUNT(OTO.TaskStatusCode)End, 0) as cntNonPerformed "
||" Into #Temp3 "
||" from CV3ORder o"
||" left outer join cv3ordertaskoccurrence oto "
||" on oto.clientguid = o.clientguid "
||" and oto.orderguid = o.guid "
||" AND OTO.TaskStatusCode = {{{SINGLE-QUOTE}}}Not Performed{{{SINGLE-QUOTE}}} "
||" and oto.active = 1 "
||" join cv3ordercatalogmasteritem ocmi "
||" on ocmi.guid = o.ordercatalogmasteritemguid "
||" left outer join CV3MedicationExtension e "
||" on e.ClientGUID = o.ClientGUID "
||" and e.GUID = o.GUID "
||" WHERE o.clientguid = " || sql(Client_guid)
||" and o.ChartGUID = " || sql(Client_chart_guid)
||" and o.ClientVisitGUID = " || sql(Client_visit_guid)
||" and o.IsSuspended = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} "
||" and o.IsHeld = {{{SINGLE-QUOTE}}}0{{{SINGLE-QUOTE}}} ";
// endif;
if Additional_condition <> "All" then
strsql2 := strsql2 || " and o.Active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
|| " and o.OrderStatusLevelNum <= {{{SINGLE-QUOTE}}}60{{{SINGLE-QUOTE}}}";
IF Additional_condition <> "" THEN
strSQL2 := strSQL2 || " AND " || Additional_condition ;
endif;
endif;
IF strFilterSQL <> "" THEN
strSQL2 := strSQL2 || " AND "|| strFilterSQL ;
endif;
strSQL2 := strSQL2 || " group by o.guid ,o.name, o.summaryline, requesteddtm, "
||" ocmi.therapeuticcategory, therapeuticcategoryID, OTO.TaskName, OTO.TaskStatusCode, "
||" OrderStatusCode, Stopdate "
||" , e.admininstructions "
;
// strSQL := strSQL || strSQL1 || " " || " Update p set p.cntNotPerformed=np.cntNonPerformed from #Temp1 p join #Temp2 np on p.Name=np.Name "
// || " Select * from #Temp1 Drop Table #Temp1 Drop Table #Temp2 ";
strSQL := strSQL || strSQL1 || strSQL2 || " " || " Update p set p.cntNotPerformed=(np.cntNonPerformed + np1.cntNonPerformed)from #Temp1 p join #Temp2 np on p.guid=np.guid join #Temp3 np1 on p.guid=np1.guid "
|| " Select name,SummaryLine, therapeuticcategory,therapeuticcategoryID, requesteddtm, TaskName, PerformDate , OrderStatusCode, StopDate ,admininstructions, cntPerformed , cntNotPerformed from #Temp1 Drop Table #Temp1, #Temp2 , #Temp3 ";
//name,SummaryLine, therapeuticcategory,therapeuticcategoryID, requesteddtm, TaskName, PerformDate , OrderStatusCode, StopDate ,admininstructions, cntPerformed , cntNotPerformed
// End : Shivprasad Code
(ord_names, ord_summs, cl_val, cl_code, ord_times, task_names, task_times,
o_stat, Stop_d, ord_admin_inst, num_given, Num_Nt_given) := read //Num_Nt_given Addedby Shivprasad for CSR:32982
{ "" || strSQL
, primarytime = requesteddtm };
if exists ord_summs then
Return_Data_item:= ord_names;
Return_Data_item_value:= ord_summs;
Return_UOM_or_code:= cl_val; // therapeuticcategory
Return_relevant_time:= ord_times;
// Return_start_or_alt_name:= "";
Return_start_or_alt_name:= ord_admin_inst;
Return_stop_or_alt_code:= stop_d;
Return_user_or_other:= o_stat;
Return_Significant_data:= task_times;
Return_Sig_Count := num_given;
Return_Sig_nt_Count := Num_Nt_given ; //Added By Shivprasad Jadhav For CSR : 32982
endif;
IF NOT Exists Return_Data_item_value Then
Return_Data_item_value := "\b No Active Antibiotic Data Available. \b0" ;
EndIf;
//LAb Results ###############################################################
ELSEIF Data_value_type IN ( "Lab Results", "Micro Results") THEN
strsql:= "select o.Name, o.GUID, o.PerformedDtm, bo.ItemName, bo.Value, "
||" bo.ResultItemCode, bo.entered, tol.Text, bo.unitofmeasure "
||" from CV3Order o "
||" join CV3BasicObservation bo on bo.clientguid = o.clientguid "
||" and bo.chartguid = o.chartguid "
||" and bo.clientvisitguid = o.clientvisitguid "
||" and o.GUID = bo.OrderGUID "
||" left outer join CV3TextualObservationLine tol "
||" on bo.clientguid = tol.clientguid "
||" and bo.GUID = tol.ObservationGUID"
||" where o.clientguid = "|| sql(Client_guid)
||" and o.ChartGUID = " ||sql(Client_chart_guid)
||" and bo.entered >= "|| sql(current)
||" and IsHistory = 0 " ;
//||" order by o.Name desc";
IF strFilterSQL <> "" THEN
strSQL := strSQL || " AND "|| strFilterSQL ;
endif;
if data_value_type = "Lab Results" then
strSQL := strSQL || " group by o.Name , o.GUID, o.PerformedDtm, bo.ItemName, "
||" bo.Value, bo.ResultItemCode, bo.entered, tol.Text, bo.unitofmeasure ";
endif;
(ord_names, ord_guids, ord_times, cl_names, cl_vals,
cl_codes, cl_enter, cl_text, cl_uom ) := read
{ "" || strSQL
|| "order by o.name desc" };
if exists ord_names then
Return_Data_item:= ord_names;
Return_Data_item_value:= cl_vals;
Return_UOM_or_code := cl_uom;
Return_relevant_time:= ord_times;
Return_start_or_alt_name:= cl_names;
Return_stop_or_alt_code:= cl_codes;
Return_user_or_other:= ord_guids;
Return_Significant_data:= cl_text;
Return_Sig_Count := "";
endif;
IF NOT Exists Return_Data_item Then
Return_Data_item_value := "\b No Results. \b0" ;
EndIf;
ENDIF; // CASE STMT FOR POSSIBLE HISTORICAL LOOKUPS
ENDIF; // Getdata_from = "Historical"
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
return
Return_Data_item,
Return_Data_item_value,
Return_UOM_or_code ,
Return_relevant_time,
Return_start_or_alt_name,
Return_stop_or_alt_code,
Return_user_or_other,
Return_Significant_data,
This_communicationobj,
Return_sig_count,
Return_Sig_nt_Count; // Added By Shivprasad Jadhav For CSR : 32982
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,149 @@
maintenance:
title: ACS_obs_select_func_on_lookup ;;
mlmname: ACS_obs_select_func_on_lookup;;
arden: version 2.5;;
version: 5.50;;
institution: St Clair;;
author: Allscripts Custom Services;;
specialist: ;;
date: 2011-11-30;;
validation: testing;;
library:
purpose: Select an observation item (list item) based on other provided data
;;
explanation:
Change history
05.01.2012 CSR# 26409 & 26930 DW Altered per CHF Core Measure requirements and Prism Enhancements
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
/******************Make Changes To Spelling And Flags In This Section************************************/
//Set to true if a decision.log is needed for diagnostic purposes.
log_execution_info:= false;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Master list for driving the logic. Items in the list MUST follow the pattern:
// "<DOC_NAME>$<CORE_MEASURE>$<FILTER_VALUE_NOT_FOUND>$<OBS_CAT_ITEM_NAME>$<OBSFSLIST_VAL>"
master_list := (
"<DOC_NAME>$<CORE_MEASURE>$<FILTER_VALUE_NOT_FOUND>$<OBS_CAT_ITEM_NAME>$<OBSFSLIST_VAL>",
//Enter your values below..........
// Heart failure
"Physician Progress Note$|cm_chf|$cardiovascular agents | angiotensin converting enzyme inhibitors"
||"$SCH_MDPN_CM_HF_Orders ACE$no",
"Physician Progress Note$|cm_chf|$cardiovascular agents | angiotensin II inhibitors"
||"$SCH_MDPN_CM_HF_Orders ACE$no",
// Acute Myocardial Infarction
"Physician Progress Note$|cm_ami|$cardiovascular agents | angiotensin converting enzyme inhibitors"
||"$SCH_MDPN_CM_AMI ACE unknown$-",
"Physician Progress Note$|cm_ami|$cardiovascular agents | angiotensin II inhibitors"
||"$SCH_MDPN_CM_AMI ARB unknown$-",
"Physician Progress Note$|cm_ami|$cardiovascular agents | beta-adrenergic blocking agents"
||"$SCH_MDPN_CM_AMI BetaB unknown$-",
"Physician Progress Note$|cm_ami|$metabolic agents | antihyperlipidemic agents"
||"$SCH_MDPN_CM_AMI Statin unknown$-",
// Stroke
"Physician Progress Note$|cm_stroke|$(ANY)$SCH_MDPN_CM_Stroke Antithromb unknown$-",
// Venous Thromboembolism
"Physician Progress Note$|cm_VTE|$(ANY)$SCH_MDPN_CM_VTE Prohylaxis unknown$-"
);
/***************************************** End of Changes Section****************************************/
(This_communicationobj, //initial pointer to doc object
core_measure, //Core measure used by calling MLM
filter_vals_not_found) //data NOT found by calling MLM
:= argument;
// initialize vars:
doc_name_list := (); //document name (1st value in the delimited value set)
core_meas_list := (); //core measure (2nd value in the delimited value set)
filt_val_list := (); //filter values (4rd value in the delimited value set)
obs_cat_i_list := (); //catalog item name (second value in the delimited value set)
ofs_l_val_list := (); //OBS FS List value (Third value in the delimited value set)
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; // For parsing meds_mod_list
WriteToNote := MLM {{{SINGLE-QUOTE}}}STD_DOC_FUNC_CHART_OBSERVATION_HELPER_JAB{{{SINGLE-QUOTE}}};
// Object needed to declare in the calling the above MLM (for listitems only)
SelectedList := OBJECT[ ListGUID, SelectedValues, SuggestiveText];
newValue :=(); // initialize list of items for selection
PN_sel_list := NEW SelectedList; //instantiate NewValue for ListItems
if called_by_editor then
core_measure := "|cm_chf|";
filter_vals_not_found := ("metabolic agents | antihyperlipidemic agents","cardiovascular agents | angiotensin II inhibitors");
endif;
// get document subobjects
(this_structuredNoteDoc) := This_communicationobj.DocumentConfigurationObj;
(this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList;
(this_parameters) := this_structuredNoteDoc.ParametersList;
//Create the sequence matched lists for looping
for j in 1 seqto count(master_list) do
m_item := master_list[j];
m_i_list := call str_parse with m_item, "$"; // parse into separate lists
doc_name_list := doc_name_list, m_i_list[1]; //document name
core_meas_list := core_meas_list, m_i_list[2]; //core measure
filt_val_list := filt_val_list, m_i_list[3]; //filter list
obs_cat_i_list := obs_cat_i_list, m_i_list[4]; //catalog item name
ofs_l_val_list := ofs_l_val_list, m_i_list[5]; //OBS FS List value
enddo;
for i_f_v_not_found in filter_vals_not_found do
if i_f_v_not_found <> "(ANY)" then
target_filt_vals := first of (filt_val_list where (core_meas_list = core_measure and filt_val_list = i_f_v_not_found) ) ;
target_obs := first of (obs_cat_i_list where (core_meas_list = core_measure and filt_val_list = i_f_v_not_found) ) ;
target_list_item := first of (ofs_l_val_list where (core_meas_list = core_measure and filt_val_list = i_f_v_not_found) ) ;
else
target_filt_vals := first of (filt_val_list where (core_meas_list = core_measure and filt_val_list = "(ANY)" ) ) ;
target_obs := first of (obs_cat_i_list where (core_meas_list = core_measure and filt_val_list = "(ANY)" ) ) ;
target_list_item := first of (ofs_l_val_list where (core_meas_list = core_measure and filt_val_list = "(ANY)" ) ) ;
endif;
// get target observation list for changing
target_param := first of (this_parameters where this_parameters.name = target_obs );
target_list_obs := FIRST OF (this_ChartedObservationsList WHERE this_ChartedObservationsList.parameterGUID = target_param.parameterGUID);
// create the selection list for helper MLM
PN_sel_list.ListGUID := target_param.configurationobj.listguid;
list_name := target_obs;
newValue := newValue, target_list_item ;
PN_sel_list.SelectedValues := newvalue; //value to select
PN_sel_list.SuggestiveText := null; //optional text
if exists newvalue then //limit updates, otherwise copyforward will not work properly!
This_communicationobj := CALL WriteToNote WITH (This_communicationobj, list_name , PN_sel_list);
endif;
enddo;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return This_communicationobj;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,230 @@
maintenance:
title: Generic Lookup;;
mlmname: ACS_result_impression_Lookup;;
arden: version 2.5;;
version: 5.00;;
institution: Allscripts;;
author: Allscripts Custom Services;;
specialist: Allscripts Custom Services;;
date: 2011-11-05;;
validation: testing;;
library:
purpose: lookup and parse out the "IMPRESSION" from a set of patient{{{SINGLE-QUOTE}}}s results.
;;
explanation:
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
/****************** Make Your code stretch NO WIDER THAN THIS! *************************/
(Client_guid,
Client_visit_guid,
Client_chart_guid,
Getdata_from,//“historical” or “current” (use SQL or current object navigation)
Data_value_type,//Object to retrieve (“HealthIssue”, “order”, etc.)
Data_item,//Attribute to retrieve (“name”, “itemname”, “typecode”, “code”, etc.)
Filterable_item,//Filterable attribute (“name”, “itemname”, “typecode”, “code”, etc.)
Filterable_operator,//Filterable operator (“=”, “<>”, “in”, “matches pattern”, etc.)
Filterable_value,//Filterable value(s)(“chronic”, “atb”,“(480.00,480.30)", etc.)
Additional_condition)//Additional condition(s)
//(“orderstatuslevelnum between 55 and 60”,
//“performedtm > dateadd(-24, hh, getdate()”, etc.)
:= ARGUMENT;
//setting for
current:= Now - 8 years ; //24 hours;
//initialize
strFilterSQL :="";
if called_by_editor then
(client_guid, client_visit_guid, client_chart_guid) :=
read last {clientvisit: clientguid, guid, chartguid};
Getdata_from := "Historical";
Data_value_type := "Results";
Data_item := "text_val";
Filterable_item := "r.code"; // "itemname";
filterable_operator := "="; // "like";
filterable_value := "Medical Imaging"; // "chest";
endif;
IF any(exists Filterable_item AND (not (Filterable_item is in ("", "No"))))
AND any(exists Filterable_operator AND (not(Filterable_operator is in ("", "No"))))
AND any(exists Filterable_value AND (not (Filterable_value is in ("", "No")))) THEN
strFilterSQL := Filterable_item || " " || Filterable_operator || " ";
IF Filterable_operator = "IN" THEN
strFilterSQL := strFilterSQL || "(" || Filterable_value || ")";
ELSEIF Filterable_operator ="LIKE" THEN
strFilterSQL := strFilterSQL || "{{{SINGLE-QUOTE}}}%" || Filterable_value|| "%{{{SINGLE-QUOTE}}}";
ELSE
strFilterSQL := strFilterSQL || SQL(Filterable_value);
ENDIF;
ENDIF;
if any(exists Additional_condition AND (not (Additional_condition is in ("", "No")))) then
strFilterSQL := strFilterSQL || " and " ||Additional_condition;
endif;
// add filter for time, if not present
if not(strFilterSQL matches pattern "%where%performeddtm%") then
strFilterSQL := strFilterSQL || " and b.entered >= " || sql(current) ;
endif;
(result_items, result_times, result_impressions) := read
// set up (temporary) tables for data entry
{" declare @txt_src table (titem varchar(125), "
||" tguid numeric(16,0), ttime datetime, tln int, ttext varchar(255)) "
||" declare @maxln table (tguid numeric(16,0), mln int) "
||" declare @txt_imp table "
||" (id numeric(16,0) not null, "
||" item varchar(125) null, "
||" obs_time datetime null, "
||" min_line_num int null, "
||" curr_line_num int null, "
||" max_line_num int null, "
||" obs_text varchar(8000) null) "
// pull patient specific data for processing
||" insert @txt_src "
||" select b.itemname, t.ObservationGUID, o.performeddtm, t.LineNum, t.text "
||" from CV3BasicObservation b "
||" join CV3TextualObservationLine t on t.ClientGUID = b.ClientGUID "
||" and b.GUID = t.ObservationGUID "
||" join cv3order o on o.clientguid = b.clientguid "
||" and o.chartguid = b.chartguid "
||" and o.clientvisitguid = b.clientvisitguid "
||" and o.guid = b.orderguid "
||" join cv3ordercatalogmasteritem ocmi on ocmi.GUID = o.OrderCatalogMasterItemGUID "
||" left outer join CV3OrderReviewCategory r on r.GUID = ocmi.OrderReviewCategoryGUID "
||" where b.ClientGUID = " || sql(client_guid)
||" and b.ChartGUID = " || sql(client_chart_guid)
||" and b.ClientVisitGUID = " || sql(client_visit_guid)
// ||" and b.entered >= " || sql(current)
||" and b.IsTextual = 1 "
||" and b.IsHistory = 0 "
||" and " || strFilterSQL
// remove white spaces
||" while (select max(patindex({{{SINGLE-QUOTE}}}%{{{SINGLE-QUOTE}}}+char(10)+{{{SINGLE-QUOTE}}}%{{{SINGLE-QUOTE}}}, ttext)) from @txt_src) > 0 "
||" begin "
||" update @txt_src " // remove the carriage return
||" set ttext = stuff(ttext, patindex({{{SINGLE-QUOTE}}}%{{{SINGLE-QUOTE}}}+char(10)+{{{SINGLE-QUOTE}}}%{{{SINGLE-QUOTE}}}, ttext), 1, null) "
||" where patindex({{{SINGLE-QUOTE}}}%{{{SINGLE-QUOTE}}}+char(10)+{{{SINGLE-QUOTE}}}%{{{SINGLE-QUOTE}}}, ttext) > 0 "
||" end "
// initialize the table
||" insert @txt_imp " // get starting line
||" select distinct tguid, titem, ttime, 0,0, null, {{{SINGLE-QUOTE}}}(no IMPRESSION found){{{SINGLE-QUOTE}}} "
||" from @txt_src "
// get only the impression fragment, starting at {{{SINGLE-QUOTE}}}IMPRESSION:{{{SINGLE-QUOTE}}}
||" update @txt_imp " // get starting line
||" set min_line_num = tln, curr_line_num = tln, obs_text = "
||" substring(tTEXT, PATINDEX({{{SINGLE-QUOTE}}}%impression%{{{SINGLE-QUOTE}}}, ttext), DATALENGTH(ttext) "
||" - PATINDEX({{{SINGLE-QUOTE}}}%impression%{{{SINGLE-QUOTE}}}, ttext)) "
||" from @txt_src "
||" where tguid = id "
||" and tTEXT like {{{SINGLE-QUOTE}}}%impression%{{{SINGLE-QUOTE}}} "
// update the max_line_num to the {{{SINGLE-QUOTE}}}dictated by{{{SINGLE-QUOTE}}} end, if exist
||" update @txt_imp "
||" set max_line_num = tln "
||" from @txt_src "
||" where id = tguid "
||" and tln > min_line_num "
// ||" and obs_text like {{{SINGLE-QUOTE}}}%dictated%{{{SINGLE-QUOTE}}} "
||" and obs_text like {{{SINGLE-QUOTE}}}%dictat%{{{SINGLE-QUOTE}}} " // Added By Shivprasad CSR : 32844
||" and not (obs_text = {{{SINGLE-QUOTE}}}(no IMPRESSION found){{{SINGLE-QUOTE}}}) "
// if no {{{SINGLE-QUOTE}}}dictated by{{{SINGLE-QUOTE}}} ending, go to end of blob
||" insert @maxln "
||" select tguid, mln = MAX(tln) "
||" from @txt_src "
||" group by tguid "
// no {{{SINGLE-QUOTE}}}dictated{{{SINGLE-QUOTE}}} found: set max_line_num to end of blob
||" update @txt_imp "
||" set max_line_num = mln "
||" from @maxln "
||" where id = tguid "
||" and max_line_num is null "
||" and not (obs_text = {{{SINGLE-QUOTE}}}(no IMPRESSION found){{{SINGLE-QUOTE}}}) "
// iterate/append all lines between min and max line numbers
||" while (select count(*) "
||" from @txt_imp where (max_line_num - curr_line_num) > 0 ) > 0 "
||" begin "
||" update @txt_imp "
||" set curr_line_num = tln, "
||" obs_text = obs_text + tTEXT "
||" from @txt_src "
||" where id = tguid "
||" and curr_line_num < max_line_num "
||" and tln = curr_line_num + 1 "
||" end "
// truncate text to {{{SINGLE-QUOTE}}}dictated{{{SINGLE-QUOTE}}}
||" update @txt_imp "
// ||" set obs_text = SUBSTRING(obs_text, 1, patindex({{{SINGLE-QUOTE}}}%dictated%{{{SINGLE-QUOTE}}}, obs_text) + 7) "
// ||" where patindex({{{SINGLE-QUOTE}}}%dictated%{{{SINGLE-QUOTE}}}, obs_text) > 0 "
||" set obs_text = SUBSTRING(obs_text, 1, patindex({{{SINGLE-QUOTE}}}%dictat%{{{SINGLE-QUOTE}}}, obs_text) + 8 ) " // Added By Shivprasad CSR : 32844
||" where patindex({{{SINGLE-QUOTE}}}%dictat%{{{SINGLE-QUOTE}}}, obs_text) > 0 "
||" and not (obs_text = {{{SINGLE-QUOTE}}}(no IMPRESSION found){{{SINGLE-QUOTE}}}) "
// Now add the addendum, if it exists, useing the same logic as above
||" update @txt_imp "
||" set min_line_num = tln, curr_line_num = tln, max_line_num = null, "
||" obs_text = obs_text + {{{SINGLE-QUOTE}}} +++++{{{SINGLE-QUOTE}}} + "
||" substring(tTEXT, PATINDEX({{{SINGLE-QUOTE}}}%ADDENDUM%{{{SINGLE-QUOTE}}}, ttext), "
||" DATALENGTH(ttext) - PATINDEX({{{SINGLE-QUOTE}}}%ADDENDUM%{{{SINGLE-QUOTE}}}, ttext)) "
||" from @txt_src "
||" where id = tguid "
||" and tln >= curr_line_num "
||" and tTEXT like {{{SINGLE-QUOTE}}}%ADDENDUM%{{{SINGLE-QUOTE}}} "
||" and not (obs_text = {{{SINGLE-QUOTE}}}(no IMPRESSION found){{{SINGLE-QUOTE}}}) "
||" update @txt_imp "
||" set max_line_num = tln "
||" from @txt_src "
||" where id = tguid "
||" and tln >= curr_line_num "
||" and tTEXT like {{{SINGLE-QUOTE}}}%LAST PAGE%{{{SINGLE-QUOTE}}} " // never found this...
||" and not (obs_text = {{{SINGLE-QUOTE}}}(no IMPRESSION found){{{SINGLE-QUOTE}}}) "
||" update @txt_imp "
||" set max_line_num = mln "
||" from @maxln "
||" where id = tguid "
||" and max_line_num is null "
||" and not (obs_text = {{{SINGLE-QUOTE}}}(no IMPRESSION found){{{SINGLE-QUOTE}}}) "
||" while (select count(*) "
||" from @txt_imp where (max_line_num - curr_line_num) > 0 ) > 0 "
||" begin "
||" update @txt_imp "
||" set curr_line_num = tln, "
||" obs_text = obs_text + tTEXT "
||" from @txt_src "
||" where id = tguid "
||" and curr_line_num < max_line_num "
||" and tln = curr_line_num + 1 "
||" end "
||" select item, obs_time, obs_text "
||" from @txt_imp "
};
//break;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return result_items, result_times, result_impressions;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,140 @@
maintenance:
title: CALLED_DOC_FS_DEFINITION_MLM;;
mlmname: CALLED_DOC_FS_DEFINITION_MLM;;
arden: version 2.5;;
version: 5.50;;
institution: St. Clair Hospital;;
author: Juliet M. Law;;
specialist: ;;
date: 2011-09-22;;
validation: testing;;
library:
purpose: Standardize the document mlm responsible for variable assignment and debugging.
Specific to flowsheets.
;;
explanation:
;;
keywords: RTF, Document Called MLM , list, debug, displayMessageFlag
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
log_execution_info := false;
(displayMessageFlag) := false;
(client_guid) := this_documentCommunication.ClientGUID;
(client_visit_guid) := this_documentCommunication.ClientVisitGUID;
(chart_guid) := this_documentCommunication.ChartGUID;
(user_guid) := this_documentCommunication.UserGUID;
(document_type) := this_documentCommunication.DocumentType;
(document_name) := this_documentCommunication.DocumentName;
(event_type) := this_documentCommunication.EventType;
(configuration_guid) := this_documentCommunication.ConfigurationGUID;
(this_currentObs) := this_documentCommunication.CurrentObservationObj;
(CancelEventFlag) := this_documentCommunication.CancelEvent;
(this_fs_doc) := this_documentCommunication.DocumentConfigurationObj;
(authored_by_guid) := this_fs_doc.AuthoredByGUID;
(isIOFlowsheetFlag) := this_fs_doc.IsIOFlowsheet;
(client_document_guid) := this_fs_doc.CurrentColumn.ClientDocumentGUID;
(this_parameters) := this_fs_doc.ParametersList;
(this_columnList) := this_fs_doc.ColumnsList;
(this_currentColumn) := this_fs_doc.CurrentColumn;
(this_chartedObservationsList) := this_fs_doc.CurrentColumn.ChartedObservationsList;
(this_parameters_displayName) := this_parameters.DisplayName;
if (event_type = "DocumentClosing") then
current_parameter := first of (this_parameters WHERE
this_parameters.ParameterGUID = this_currentObs.ParameterGUID);
current_parameter_name := current_parameter.Name;
current_parameter_guid := current_parameter.ParameterGUID;
current_parameter_datatype := current_parameter.DataType;
if (current_parameter_datatype IS IN ("FreeTextValue", "NumericValue", "DateValue")) then
current_value := this_currentObs.ValueObj.Value;
elseif (current_parameter_datatype = "ListValue") then
selectedItems := (this_currentObs.ValueObj.ListItemsList
WHERE this_currentObs.ValueObj.ListItemsList.IsSelected = true);
selectedItems_Value := selectedItems.Value;
countOf_selectedItems := count of selectedItems_Value;
current_value := first of selectedItems_Value;
endif;
if (current_parameter_name = "debug_message" AND exists current_value) then
displayMessageFlag := true;
endif;
endif;
diagnostic_message := ("CALLED_DOC_FS_DEFINITION_MLM \n"
|| "\n client guid: " || client_guid
|| "\n client visit guid: " || client_visit_guid
|| "\n chart guid: " || chart_guid
|| "\n user guid: " || user_guid
|| "\n document type: " || document_type
|| "\n document name: " || document_name
|| "\n event type: " || event_type
|| "\n configuration guid: " || configuration_guid
|| "\n current obs: " || this_currentObs
|| "\n cancel event flag: " || CancelEventFlag
|| "\n this flowsheet doc: " || this_fs_doc
|| "\n authored by guid: " || authored_by_guid
|| "\n IO flowsheet flag: " || isIOFlowsheetFlag
|| "\n client document guid: " || client_document_guid
|| "\n current parameter: " || current_parameter
|| "\n current parameter name: " || current_parameter_name
|| "\n current parameter guid: " || current_parameter_guid
|| "\n current parameter datatype: " || current_parameter_datatype
|| "\n current value: " || current_value
|| "\n selected items: " || selectedItems
|| "\n selected items value: " || selectedItems_Value
|| "\n count of selected items value: " || countOf_selectedItems
|| "\n"
);
;;
priority: 50
;;
evoke:
;;
logic:
conclude true;
;;
action:
return (this_documentCommunication,
client_guid,
client_visit_guid,
chart_guid,
user_guid,
document_type,
document_name,
event_type,
configuration_guid,
this_currentObs,
CancelEventFlag,
this_fs_doc,
authored_by_guid,
isIOFlowsheetFlag,
client_document_guid,
this_parameters,
this_columnList,
this_currentColumn,
this_chartedObservationsList,
this_parameters_displayName,
current_parameter,
current_parameter_name,
current_parameter_guid,
current_parameter_datatype,
selectedItems,
selectedItems_Value,
current_value,
diagnostic_message,
displayMessageFlag
);
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,73 @@
maintenance:
title: CALLED_DOC_FS_OBS_VALUE_MLM;;
mlmname: CALLED_DOC_FS_OBS_VALUE_MLM;;
arden: version 2.5;;
version: 5.50;;
institution: St. Clair Hospital;;
author: Juliet M. Law;;
specialist: ;;
date: 2011-09-22;;
validation: testing;;
library:
purpose: Identify the current observation in a flowsheet and return the value.
;;
explanation:
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication, parameter_name, UpdateType) := argument;
// .Net assemblies need to be loaded for ObjectsPlus
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
log_execution_info := false;
(this_fs_doc) := this_documentCommunication.DocumentConfigurationObj;
(this_parameters) := this_fs_doc.ParametersList;
(this_columnList) := this_fs_doc.ColumnsList;
(this_currentColumn) := this_fs_doc.CurrentColumn;
(this_currentObs) := this_documentCommunication.CurrentObservationObj;
(this_chartedObservationsList) := this_fs_doc.CurrentColumn.ChartedObservationsList;
if (not exists UpdateType OR UpdateType NOT IN ("Update","Read")) then
UpdateType := "Read";
endif;
if (this_documentCommunication.EventType = "DocumentClosing") then
theParameter := first of (this_parameters WHERE this_parameters.Name = parameter_name);
(theCurrentColumn) := first of (this_columnList
WHERE this_columnList.ClientDocumentGUID = this_currentObs.ClientDocumentGUID);
(theObservation) := first of (theCurrentColumn.ChartedObservationsList
WHERE theCurrentColumn.ChartedObservationsList.ParameterGUID = theParameter.ParameterGUID);
if (exists theParameter AND exists theObservation) then
if (theParameter.DataType = "ListValue") then
selectedValue := (theObservation.ValueObj.ListItemsList.Value
WHERE theObservation.ValueObj.ListItemsList.IsSelected = true);
else
currentValue := theObservation.ValueObj.Value;
endif;
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic:
conclude true;
;;
action:
return (this_documentCommunication, selectedValue, currentValue);
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,259 @@
maintenance:
title: CALLED_DOM_CCC;;
mlmname: CALLED_DOM_CCC;;
arden: VERSION 2.5;;
version: 7.02;;
institution: Allscripts;;
author: Allscripts;;
specialist: Allscripts;;
date: 2014-09-22;;
validation: TESTING;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2014 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 "Commercial Computer Software".
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:
;;
explanation:
/*### SCM Release Version: 6.1, 14.3, 15.1 ###*/
VERSION DATE AUTHOR REVISION
---------------------------------------------------------------------------------------------------------
V6.10 2011-05-01 Initial Inclusion.
V7.00 2014-04-16 SMS Incremented version.
V7.01 2014-04-21 SMS Added IF block to allow charting to FS in addition to SN.
V7.02 2014-09-22 SMS Added IF block to check if .ValueObj EXISTS and if it doesn{{{SINGLE-QUOTE}}}t, create it.
This is a helper MLM that you can use to chart an observation by passing in the required parameters.
;;
keywords: RTF, Document Called MLM , list, multi-select
;;
knowledge:
type: data-driven
;;
data:
(this_documentCommunication, parameter_name, newValue, sugg_txt_value, UpdateType, pListGUID) := ARGUMENT;
/*******************Make Changes To Spelling And Flags In This Section******************/
//*** Variable and Constant Declaration ***//
// Document Types
FLOWSHEET := "Flowsheet";
STRUCTUREDNOTE := "StructuredNote";
(this_structuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(this_parameters) := this_structuredNoteDoc.ParametersList;
(this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList;
IF this_documentCommunication.DocumentType = FLOWSHEET THEN
(this_columnsList) := this_structuredNoteDoc.ColumnsList;
(this_currentColumn) := this_structuredNoteDoc.CurrentColumn;
(this_ClientDocumentGUID) := this_currentColumn.ClientDocumentGUID;
(this_chartedObservationsList) := this_structuredNoteDoc.CurrentColumn.ChartedObservationsList;
ELSEIF this_documentCommunication.DocumentType = STRUCTUREDNOTE THEN
(this_ClientDocumentGUID) := this_structuredNoteDoc.ClientDocumentGUID;
(this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList;
ENDIF;
this_DocumentType := this_documentCommunication.DocumentType;
//if the parameter type is a text and the observation already exist the new data may be a
//Replace of Append to current valueObj.Value
IF NOT EXISTS UpdateType OR UpdateType NOT IN("Append","Replace") THEN
UpdateType := "Replace";
ENDIF;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//*** Data Structures ***//
//The following data structures can be used to create new objects within the MLM itself.
//Not all data structures are represented here, only ones that can be created in the MLM.
// Parameter Types
NUMERICVALUE := "NumericValue";
FREETEXTVALUE := "FreeTextValue";
LISTVALUE := "ListValue";
LISTSETVALUE := "ListSetValue";
DATEVALUE := "DateValue";
IOVALUE := "IOValue";
GENERICDRIPVALUE := "GenericDripValue";
DRIPVALUE := "DripValue";
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
ListValueType := OBJECT [ListGUID, ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
DateValueType := OBJECT [Value];
FreeTextValueType := OBJECT [Value];
NumericValueType := OBJECT [Value];
ListSetValueType := OBJECT [ListValuesList];
//
// This section of code will demonstrate how to write to FreeTextValue, DateValue,NumericValue and ListValue
parameter := FIRST OF (this_Parameters WHERE this_Parameters.Name = parameter_name);
IF EXISTS parameter THEN
//******************************************************************************************************
// Check for existing object
//*******************************************************************************************************
obs := FIRST OF(this_ChartedObservationsList WHERE this_ChartedObservationsList.parameterGUID = parameter.parameterGUID);
IF NOT EXISTS obs THEN
//Create a new Observation for the list
obs := NEW ObservationType;
//obs.ClientDocumentGUID := this_documentCommunication.DocumentConfigurationObj.ClientDocumentGUID; //2014-04-21 SMS
obs.ClientDocumentGUID := this_ClientDocumentGUID;
obs.ParameterGUID := parameter.ParameterGUID;
obs.DataType := parameter.DataType;
ENDIF; //2014-09-22 SMS
IF NOT EXISTS obs.ValueObj THEN //2014-09-22 SMS
// Based on the parameter.DataType create the ValueObj Type and set the valueObj.value for (FREETEXTVALUETYPE,DATEVALUETYPE,NUMERICVALUETYPE)
// If the DataType is LISTVALUE then creat the valueObj of LISTVALUETYPE ABD ASSIGN THE paramter.configurationObj.ListGUID
IF parameter.DataType = FREETEXTVALUE THEN
obs.ValueObj := NEW FreeTextValueType;
ELSEIF parameter.DataType = DATEVALUE THEN
obs.ValueObj := NEW DateValueType;
ELSEIF parameter.DataType = NUMERICVALUE THEN
obs.ValueObj := NEW NumericValueType;
ELSEIF parameter.DataType = LISTVALUE THEN
obs.ValueObj := NEW ListValueType;
obs.ValueObj.ListGUID := parameter.ConfigurationObj.ListGUID;
ELSEIF parameter.DataType = LISTSETVALUE THEN
obs.ValueObj := NEW ListSetValueType;
ENDIF; // if parameter.DataType = FREETEXTVALUE then
//APPEND obs to the ChartedObservationsList
ENDIF;
IF parameter.DataType = FREETEXTVALUE AND UpdateType = "Append" THEN
IF LENGTH OF obs.ValueObj.Value > 0 THEN
obs.ValueObj.Value := obs.ValueObj.Value || "\n" || newValue;
ELSE
obs.ValueObj.Value := newValue;
ENDIF;
//break;
ELSEIF parameter.DataType = FREETEXTVALUE AND UpdateType = "Replace" THEN
IF EXISTS newValue THEN
//break;
obs.ValueObj.Value := newValue;
ELSE
obs.ValueObj := null;
ENDIF;
//break;
ELSEIF parameter.DataType IN(DATEVALUE,NUMERICVALUE) THEN
IF EXISTS newValue THEN // new code added by Stve Abel from Roswell Park
obs.ValueObj.Value := newValue;
//break;
ELSE
obs.ValueObj := null;
ENDIF;
// obs.ValueObj.Value := newValue; This was the code before Steve Abel addition
ELSEIF parameter.DataType = LISTVALUE THEN
//Populate the ListItemsList in the new observation object (obs)
// loop through each item in the parameter.ConfugurationObj.ListItemsList using "item"and append the item to the newly created object ListValueListItemType
//assign the item.listItemGUID to the selectedItem.ListItemGUID, the Item.value to the selectedItem.Value and set the SelectedItem.IsSelected := true
listItems := ();
IF newValue = "" THEN
newValue := NULL;
ENDIF;
IF sugg_txt_value = "" THEN
sugg_txt_value := NULL;
ENDIF;
IF (NOT EXISTS newValue) AND (NOT EXISTS sugg_txt_value) THEN
obs.ValueObj := null;
ELSE
IF EXISTS newValue THEN
FOR k IN 1 SEQTO COUNT OF parameter.ConfigurationObj.ListItemsList DO
item := parameter.ConfigurationObj.ListItemsList[k];
parm := FIRST OF(newValue WHERE newValue.ListValue = item.Value);
IF EXISTS parm THEN
//Create a list item object for the selected list item
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := parm.ListValue;
selectedItem.IsSelected := parm.IsSelected;
// Arden list append statement appending the new object to the listItems object of the ListValueListItemType Object
listItems := (listItems, selectedItem);
// set the obs.valueObj.ListItemsList := listItems list object
Obs.ValueObj.ListItemsList := listItems;
ENDIF;
ENDDO;
ENDIF;
IF EXISTS sugg_txt_value THEN
obs.ValueObj.SuggestedTextValue := sugg_txt_value;
ENDIF;
ENDIF;
ELSEIF parameter.DataType = LISTSETVALUE THEN
newListValue := NEW ListValueType;
newListValue.ListGUID := pListGUID;
k := 0;
listItems := ();
ii := 0;
FOR i IN 1 SEQTO COUNT OF parameter.ConfigurationObj.ListConfigurationList DO
IF parameter.ConfigurationObj.ListConfigurationList[i].ListGUID = pListGUID THEN
ii := i;
ENDIF;
ENDDO;
FOR pItem IN parameter.ConfigurationObj.ListConfigurationList[ii].ListItemsList DO
k := k + 1;
parm := FIRST OF(newValue WHERE newValue.ListValue = pItem.Value);
IF EXISTS parm THEN
newItem := NEW ListValueListItemType;
newItem.ListItemGUID := pItem.ListItemGUID;
newItem.Value := parm.ListValue;
newItem.IsSelected := parm.IsSelected;
listItems := (listItems, newItem);
ENDIF;
ENDDO;
newListValue.ListItemsList := (newListValue.ListItemsList, listItems);
Obs.ValueObj.ListValuesList := (Obs.ValueObj.ListValuesList, newListValue);
IF EXISTS sugg_txt_value THEN
newListValue.SuggestedTextValue := sugg_txt_value;
ENDIF;
ENDIF;
IF EXISTS obs THEN //2014-04-21 SMS
IF this_DocumentType = FLOWSHEET THEN
this_documentCommunication.DocumentConfigurationObj.CurrentColumn.ChartedObservationsList := this_documentCommunication.DocumentConfigurationObj.CurrentColumn.ChartedObservationsList, obs;
ELSEIF this_DocumentType = STRUCTUREDNOTE THEN
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList, obs);
ENDIF;
ENDIF;
ENDIF; //IF EXISTS parameter THEN
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
;;
evoke:
;;
logic:
CONCLUDE TRUE;
;;
action:
RETURN this_documentCommunication;
;;
Urgency: 50
end:

View File

@@ -0,0 +1,288 @@
maintenance:
title: CALLED_LAUNCH_LISTBOX_MULTI_SELECT_ACS;;
mlmname: CALLED_LAUNCH_LISTBOX_MULTI_SELECT_ACS;;
arden: VERSION 2.5;;
version: 7.00;;
institution: Allscripts;;
author: Allscripts;;
specialist: Allscripts;;
date: 2014-03-27;;
validation: TESTING;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2013 - 2014 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 "Commercial Computer Software".
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:
Create a dynamic, multiselect List Window without a dll.
;;
explanation:
DEPENDENCIES:
-------------
.NET 4 +
This MLM takes an Arden List and puts it into a dropdown list that will overlay over the current form or document.
The dropdown will close when the user successfully chooses an item in the list.
There is a flag in the code (it{{{SINGLE-QUOTE}}}s commented out) if you want to give the user the ability to close the window
with the red x. This MLM only requires .NET 4 be installed.
The MLM returns the values selected by the user as an Arden List.
;;
keywords:
.NET 4, UDDD, Dynamic
;;
knowledge:
type: data-driven;;
data:
(listItems, SelectionMode, WindowTitle) := ARGUMENT;
if called_by_editor and not exists listItems then
listItems := ("one","two","three","four","five","six","$even","Eight","n!n3");
endif;
using "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
using "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
using "PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
using "PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
using "System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using "SCMLib";
using namespace "System";
using namespace "System.Reflection";
using namespace "System.Reflection.Emit";
using namespace "System.Collections.Generic";
using namespace "System.Text";
using namespace "System.Windows";
using namespace "System.Windows.Controls";
using namespace "System.Windows.Data";
using namespace "System.Windows.Documents";
using namespace "System.Windows.Input";
using namespace "System.Windows.Media";
using namespace "System.Windows.Media.Imaging";
using namespace "System.Windows.Navigation";
using namespace "System.Windows.Shapes";
using namespace "System.Data.SqlClient";
using namespace "SCMLib.PObj";
using namespace "SCMLib.Context";
// SET UP THE WINDOW AND IT{{{SINGLE-QUOTE}}}s SETTINGS
mouse := {{{SINGLE-QUOTE}}}System.Windows.Forms.Control{{{SINGLE-QUOTE}}}.MousePosition;
window := NEW NET_OBJECT {{{SINGLE-QUOTE}}}Window{{{SINGLE-QUOTE}}};
//window.WindowStyle := {{{SINGLE-QUOTE}}}System.Windows.WindowStyle{{{SINGLE-QUOTE}}}.None; // Comment this out if you want all the buttons in the top right of the window.
window.WindowStyle := {{{SINGLE-QUOTE}}}System.Windows.WindowStyle{{{SINGLE-QUOTE}}}.ToolWindow; // Uncomment this to get a tool window that only has the red x.
// Make sure to change the height
//window.Width := 40; // Defines how wide the ListBox is
//window.Height := 38; // Defines how tall the ListBox is
window.MinWidth := 200; // Defines how wide the ListBox is
window.MinHeight := 100; // Defines how tall the ListBox is
window.MaxWidth := 600; // Defines how wide the ListBox is
window.MaxHeight := 580; // Defines how tall the ListBox is
window.SizeToContent := "WidthAndHeight";
window.WindowStartupLocation := "CenterScreen";
if(exists(WindowTitle) and WindowTitle <> "")then
window.Title := WindowTitle;
endif;
//window.Left := mouse.X /*- (window.Width/2)*/; // if you uncomment this the window will be horizontally centered to the cursor
// window.Top := mouse.Y /* - (window.Height/2)*/; // if you uncomment this the window will be vertically centered to the cursor
uri := NEW NET_OBJECT {{{SINGLE-QUOTE}}}Uri{{{SINGLE-QUOTE}}} WITH "/PresentationFramework.Aero;v4.0.0.0;31bf3856ad364e35;component/themes/aero.normalcolor.xaml", {{{SINGLE-QUOTE}}}UriKind{{{SINGLE-QUOTE}}}.Relative;
window.Resources.Source := uri;
// SET UP THE ListBox
ListBox := NEW NET_OBJECT {{{SINGLE-QUOTE}}}ListBox{{{SINGLE-QUOTE}}};
ListBox.HorizontalAlignment := {{{SINGLE-QUOTE}}}System.Windows.HorizontalAlignment{{{SINGLE-QUOTE}}}.Stretch;
ListBox.VerticalAlignment := {{{SINGLE-QUOTE}}}System.Windows.VerticalAlignment{{{SINGLE-QUOTE}}}.Stretch;
if(SelectionMode = "Multiple")then
ListBox.SelectionMode := "Multiple";
endif;
ListBox.MaxHeight := 375;
//Set Up the Buttons
//OK
ButtonOk := NEW NET_OBJECT {{{SINGLE-QUOTE}}}Button{{{SINGLE-QUOTE}}};
ButtonOk.Content := "OK" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
ButtonOk.Margin := 5;
//Cancel
ButtonCancel := NEW NET_OBJECT {{{SINGLE-QUOTE}}}Button{{{SINGLE-QUOTE}}};
ButtonCancel.Content := "Cancel" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
ButtonCancel.Margin := 5;
//container
StackPanel_Buttons := NEW NET_OBJECT {{{SINGLE-QUOTE}}}StackPanel{{{SINGLE-QUOTE}}};
StackPanel_Buttons.Orientation := {{{SINGLE-QUOTE}}}Orientation{{{SINGLE-QUOTE}}}.Horizontal;
StackPanel_Buttons.HorizontalAlignment := {{{SINGLE-QUOTE}}}HorizontalAlignment{{{SINGLE-QUOTE}}}.Right;
void := call StackPanel_Buttons.Children.Add with ButtonOk;
void := call StackPanel_Buttons.Children.Add with ButtonCancel;
//create a container
StackPanel := NEW NET_OBJECT {{{SINGLE-QUOTE}}}StackPanel{{{SINGLE-QUOTE}}};
void := call StackPanel.Children.Add with ListBox;
void := call StackPanel.Children.Add with StackPanel_Buttons;
window.Content := StackPanel;
parameters := NEW NET_OBJECT {{{SINGLE-QUOTE}}}List<Type>{{{SINGLE-QUOTE}}};
obj := new NET_OBJECT {{{SINGLE-QUOTE}}}Object{{{SINGLE-QUOTE}}};
objType := CALL obj.GetType;
void := CALL parameters.Add WITH objType AS {{{SINGLE-QUOTE}}}Type{{{SINGLE-QUOTE}}};
a1 := CALL {{{SINGLE-QUOTE}}}Assembly{{{SINGLE-QUOTE}}}.Load WITH "PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
a2 := CALL {{{SINGLE-QUOTE}}}Assembly{{{SINGLE-QUOTE}}}.Load WITH "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
a3 := CALL {{{SINGLE-QUOTE}}}Assembly{{{SINGLE-QUOTE}}}.Load WITH "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
a4 := CALL {{{SINGLE-QUOTE}}}Assembly{{{SINGLE-QUOTE}}}.Load WITH "System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
ClickEventArgsType := CALL {{{SINGLE-QUOTE}}}Type{{{SINGLE-QUOTE}}}.GetType WITH "System.Windows.RoutedEventArgs, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", true, false;
ClickEventHandlerType := CALL {{{SINGLE-QUOTE}}}Type{{{SINGLE-QUOTE}}}.GetType WITH "System.Windows.RoutedEventHandler, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", true, false;
FrameworkElementType := CALL {{{SINGLE-QUOTE}}}Type{{{SINGLE-QUOTE}}}.GetType WITH "System.Windows.FrameworkElement, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", true, false;
WindowType := CALL window.GetType;
ButtonType := CALL ButtonOk.GetType;
StackPanelType := {{{SINGLE-QUOTE}}}System.Windows.Controls.StackPanel{{{SINGLE-QUOTE}}};
ListBoxType := CALL ListBox.GetType;
ItemCollectionType := {{{SINGLE-QUOTE}}}System.Windows.Controls.ItemCollection{{{SINGLE-QUOTE}}};
void := CALL parameters.Add WITH ClickEventArgsType AS {{{SINGLE-QUOTE}}}Type{{{SINGLE-QUOTE}}};
paramArray := CALL parameters.ToArray;
eventHandler := NEW NET_OBJECT {{{SINGLE-QUOTE}}}DynamicMethod{{{SINGLE-QUOTE}}} WITH "Button_Click", {{{SINGLE-QUOTE}}}Void{{{SINGLE-QUOTE}}}, paramArray;
method1 := CALL FrameworkElementType.GetMethod WITH "get_Parent";
method2 := CALL WindowType.GetMethod WITH "Close";
method6Property := CALL ButtonType.GetProperty WITH "Content";
method6 := CALL method6Property.GetSetMethod;
stringValue := "Clicked" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
generator := CALL eventHandler.GetILGenerator;
//Change the selected buttons Text, so we can tell which button was clicked
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Nop;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Ldarg_0;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Castclass, ButtonType;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Ldstr, stringValue;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Call, method6;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Nop;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Ldarg_0;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Castclass, ButtonType;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Callvirt, method1;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Castclass, StackPanelType;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Callvirt, method1;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Castclass, StackPanelType;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Callvirt, method1;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Castclass, WindowType;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Callvirt, method2;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Nop;
void := CALL generator.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Ret;
buttonEvent := {{{SINGLE-QUOTE}}}Button{{{SINGLE-QUOTE}}}.ClickEvent;
delegate := CALL eventHandler.CreateDelegate WITH ClickEventHandlerType;
void := CALL ButtonOk.AddHandler WITH buttonEvent, delegate;
//close Button
eventHandler2 := NEW NET_OBJECT {{{SINGLE-QUOTE}}}DynamicMethod{{{SINGLE-QUOTE}}} WITH "ButtonClear_Click", {{{SINGLE-QUOTE}}}Void{{{SINGLE-QUOTE}}}, paramArray;
generator2 := CALL eventHandler2.GetILGenerator;
//Change the selected buttons Text, so we can tell which button was clicked
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Nop;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Ldarg_0;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Castclass, ButtonType;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Ldstr, stringValue;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Call, method6;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Nop;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Ldarg_0;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Castclass, ButtonType;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Callvirt, method1;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Castclass, StackPanelType;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Callvirt, method1;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Castclass, StackPanelType;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Callvirt, method1;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Castclass, WindowType;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Callvirt, method2;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Nop;
void := CALL generator2.Emit WITH {{{SINGLE-QUOTE}}}OpCodes{{{SINGLE-QUOTE}}}.Ret;
delegate := CALL eventHandler2.CreateDelegate WITH ClickEventHandlerType;
void := CALL ButtonCancel.AddHandler WITH buttonEvent, delegate;
itemList := NEW NET_OBJECT {{{SINGLE-QUOTE}}}List<String>{{{SINGLE-QUOTE}}};
for item in ListItems do
void := CALL itemList.Add WITH item as string;
enddo;
value := ();
IF itemList.Count > 0 THEN
ListBox.ItemsSource := itemList;
try
void := CALL window.ShowDialog;
buttonClicked := "";
if(ButtonCancel.Content = "Clicked")then
buttonClicked := "Cancel";
endif;
if(ButtonOk.Content = "Clicked")then
buttonClicked := "Ok";
endif;
if(buttonClicked = "Ok")then
for i in (1 seqto ListBox.SelectedItems.Count)do
value := (value,ListBox.SelectedItems[i]);
enddo;
endif;
endtry;
catch exception ex
void := CALL {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with ex as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
endcatch;
ENDIF;
;;
priority: 50
;;
evoke: //MLM is called not evoked
;;
logic:
CONCLUDE TRUE;
;;
action:
RETURN value AS STRING;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,230 @@
maintenance:
title: Called_RPM_DOM_Get_Definition_MLM ;;
mlmname: Called_RPM_DOM_Get_Definition_MLM ;;
arden: version 2.5;;
version: 5.20;;
institution: RPM, Sample Document Called MLM;;
author: Rick Mansour ;;
specialist: ;;
date: 2010-11-08;;
validation: testing;;
library:
purpose: Standardize the document mlm responsible for variable assignment and debugging.
The 5.2 version adds in the CoSigner1, CoSigner2 and the DocumentTopic
;;
explanation:
;;
keywords: RTF, Document Called MLM , list, debug, displayMessageFlag,
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
/*******************Make Changes To Spelling And Flags In This Section******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
/***************************************************************************************/
// This disarticulation of the this_DocumentCommunication is needed for most document mlms
//*** Variable and Constant Declaration ***//
(displayMessageFlag) := FALSE ;
(client_guid) := this_documentCommunication.ClientGUID;
(client_visit_guid) := this_documentCommunication.ClientVisitGUID;
(client_chart_guid) := this_documentCommunication.ChartGUID;
(user_guid) := this_documentCommunication.UserGUID;
(document_type) := this_documentCommunication.DocumentType;
(document_name) := this_documentCommunication.DocumentName;
(event_type) := this_documentCommunication.EventType;
(configuration_guid) := this_documentCommunication.ConfigurationGUID ;
(this_currentObj) := this_documentCommunication.CurrentObservationObj;
(CancelEventFlag) := this_documentCommunication.CancelEvent;
(this_structuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(authored_date_time) := this_structuredNoteDoc.AuthoredDateTime;
(authored_by_guid) := this_structuredNoteDoc.AuthoredByGuid;
(client_document_guid) := this_structuredNoteDoc.ClientDocumentGUID;
(document_date_time) := this_structuredNoteDoc.DateTime;
(isNewFlag) := this_structuredNoteDoc.IsNew;
(isIncompleteFlag) := this_structuredNoteDoc.IsIncomplete;
(isResultsPendingFlag) := this_structuredNoteDoc.IsResultsPending;
(isPriorityFlag) := this_structuredNoteDoc.IsPriority;
(this_parameters) := this_structuredNoteDoc.ParametersList;
(this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList;
(CoSigner1) := this_structuredNoteDoc.CoSigner1; // (Read Only)
(CoSigner2) := this_structuredNoteDoc.CoSigner2; // (Read Only)
(DocumentTopic) := this_structuredNoteDoc.DocumentTopic; // (Read/Write)
(this_parameters_display_name) := this_parameters.DisplayName;
// The "ChartObservation" EventType is associated with the charted information
// and the parameter_name. This code dissects the information.
IF event_type = "ChartObservation" THEN
// could be "DocumentOpening", "ChartObservation", OR "DocumentClosing"
current_parameter := FIRST OF (this_Parameters
WHERE this_parameters.ParameterGUID = this_CurrentObj.ParameterGUID);
current_parameter_name := current_parameter.name;
current_parameter_guid := current_parameter.ParameterGuid;
current_parameter_DataType := current_parameter.DataType;
IF current_parameter_DataType IS IN("FreeTextValue","NumericValue","DateValue") THEN
current_value := this_currentObj.ValueObj.value;
ELSEIF current_parameter_DataType = "ListValue" THEN
selectedItems := (this_currentObj.ValueObj.ListItemsList
WHERE this_currentObj.ValueObj.ListItemsList.IsSelected =
true);
selectedItems_value := selectedItems.value;
countOf_selectedItems := count of selectedItems_value;
current_value := FIRST OF selectedItems_value;
ENDIF;
// This code looks for a specific charted observation used for debugging
// By setting the displayMessageFlag := True the entire contents of the
// document will show up as a message
if current_parameter_name = "debug_message" and exist current_value then
displayMessageFlag := TRUE;
endif;
ENDIF;
// A structured note has parameters that are assinged to the mlm function and some
// are charted. This code loops through all of the mlm assigned parameters and
// creates a list of those which have charted values and those without charted values.
// This will help detect parameter name spelling errors in the mlm
// The message will show when the displayMessageFlag = TRUE
param_info_charted:=""; param_info_empty:="";
ictr_charted:=0; ictr_empty := 0 ;
obs_value:="";
obs_value_list:=();
this_Parameters_Sorted := sort(this_Parameters.name);
for param_Obj_Name IN this_Parameters_Sorted DO
param_Obj := first of (this_Parameters
WHERE this_Parameters.name = param_Obj_Name);
param_Obs_Obj := first of (this_ChartedObservationsList
WHERE this_ChartedObservationsList.ParameterGUID = param_Obj.ParameterGUID);
if exist param_Obs_Obj then
if param_Obj.DataType = "ListValue" then
obs_value_list := param_Obs_Obj.valueObj.ListItemsList.value
WHERE param_Obs_Obj.valueObj.ListItemsList.IsSelected = TRUE ;
if NOT EXIST obs_value_list then obs_value := "not charted";
else obs_value := obs_value_list;
endif;
else
obs_value := param_Obs_Obj.valueObj.value ;
endif;
else
obs_value := "not charted" ;
endif;//if exist param_Obs_Obj then
if obs_value = "not charted" then
ictr_empty := ictr_empty + 1;
param_info_empty := param_info_empty || ictr_empty || ". " || param_Obj.Name
|| " " || param_Obj.DataType || "\n";
param_info_empty := param_info_empty || ictr_empty || "a. "
|| param_Obj.DisplayName || " " || obs_value || "\n\n";
else
ictr_charted := ictr_charted + 1;
param_info_charted := param_info_charted || ictr_charted || ". "
|| param_Obj.Name || " " || param_Obj.DataType || "\n";
param_info_charted := param_info_charted || ictr_charted || "a. "
|| param_Obj.DisplayName || " " || obs_value || "\n\n";
endif;
enddo;
diagnosticMessage:= ("Called_RPM_DOM_GetDefinition_MLM \n"
|| "\n client_guid: " || client_guid
|| "\n client_visit_guid: " || client_Visit_guid
|| "\n client_chart_guid: " || client_chart_guid
|| "\n user_guid: " || user_guid //
|| "\n document_type: " || document_type //
|| "\n document_name: " || document_name
|| "\n event_type: " || event_type
|| "\n configuration_guid: " || configuration_guid
|| "\n this_currentObj: " || this_currentObj
|| "\n this_CancelEvent: " || CancelEventFlag
|| "\n this_structuredNoteDoc: " || this_structuredNoteDoc
|| "\n authored_date_time: " || authored_date_time
|| "\n authored_by_guid: " || authored_by_guid
|| "\n client_document_guid: " || client_document_guid
|| "\n document_date_time: " || document_date_time
|| "\n isNewFlag: " || isNewFlag
|| "\n isIncompleteFlag: " || isIncompleteFlag
|| "\n isResultsPendingFlag: " || isResultsPendingFlag
|| "\n isPriorityFlag: " || isPriorityFlag
|| "\n current_parameter: " || current_parameter
|| "\n current_parameter_name: " || current_parameter_name
|| "\n current_parameter_guid: " || current_parameter_guid
|| "\n current_parameter_DataType: " || current_parameter_DataType
|| "\n current_value: " || current_value
|| "\n selectedItems: " || selectedItems
|| "\n selectedItems_value: " || selectedItems_value
|| "\n countOf_selectedItems: " || countOf_selectedItems
|| "\n current_value: " || current_value
// || "\n this_Parameters.name: " || this_Parameters_Sorted
|| "\n"
|| "\n The information below returns all of the "
|| "\n parameters assigned to document mlm function "
|| "\n in the structured note editor."
|| "\n The this_ChartedObservationsList return is limited to "
|| "\n the parameter assigned in the Structured Note editor "
|| "\n"
|| "\n Parameter Information CHARTED: \n\n" || param_info_charted
|| "\n"
|| "\n Parameter Information NOT CHARTED: \n\n" || param_info_empty
);
// this_documentCommunication.DisplayMessage := FALSE ;
// this_documentCommunication.Message :=
// "Called_RPM_DOM_GetDefinition_MLM \n" || diagnosticMessage ;
;;
evoke:
;;
logic:
conclude true;
;;
action:
// All of these variable are returned to the
// calling mlm including the diagnosticMessage used for debuging.
return (this_documentCommunication,
client_guid,
client_visit_guid,
client_chart_guid,
user_guid,
document_type,
document_name,
event_type,
configuration_guid,
this_currentObj,
CancelEventFlag,
this_structuredNoteDoc,
authored_date_time,
authored_by_guid,
client_document_guid,
document_date_time,
isNewFlag,
isIncompleteFlag,
isResultsPendingFlag,
isPriorityFlag,
this_parameters,
this_chartedObservationsList,
this_parameters_display_name,
current_parameter,
current_parameter_name,
current_parameter_guid,
current_parameter_DataType,
selectedItems,
selectedItems_value,
current_value,
diagnosticMessage,
displayMessageFlag,
CoSigner1,
CoSigner2,
DocumentTopic) ;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,165 @@
maintenance:
title: CALLED_RPM_DOM_MLM ;;
mlmname: CALLED_RPM_DOM_MLM ;;
arden: version 2.5;;
version: 6.00;;
institution: RPM, Sample Document Called MLM;;
author: Rick Mansour with addition from Steve Abel;;
specialist: ;;
date: 2010-11-03;;
validation: testing;;
library:
purpose: Demonstrate the ability to identify the current Observation in a structured
document and instantiate the parameter.
;;
explanation: This is your basic starter mlms for all standard document mlms.
;;
keywords: RTF, Document Called MLM , list, multi-select
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication,
parameter_name,newValue,
sugg_txt_value,UpdateType) := argument;
/*******************Make Changes To Spelling And Flags In This Section******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
/* Create variable for tab*/
// TAB := 9 formatted with "%c" ;
/***************************************************************************************/
//*** Variable and Constant Declaration ***//
(this_structuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(this_parameters) := this_structuredNoteDoc.ParametersList;
(this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList;
// if the parameter type is a text and the observation already exist the new data may be a
// Replace of Append to current valueObj.Value
if not exists UpdateType OR UpdateType NOT IN("Append","Replace") then
UpdateType := "Replace";
endif;
/////////////////////////////////////////////////////////////////////////////////////////////////
//*** Data Structures ***//
//The following data structures can be used to create new objects within the MLM itself.
//Not all data structures are represented here, only ones that can be created in the MLM.
// Parameter Types
NUMERICVALUE := "NumericValue";
FREETEXTVALUE := "FreeTextValue";
LISTVALUE := "ListValue";
LISTSETVALUE := "ListSetValue";
DATEVALUE := "DateValue";
IOVALUE := "IOValue" ;
GENERICDRIPVALUE := "GenericDripValue" ;
DRIPVALUE := "DripValue" ;
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID,
ParameterGUID, DataType, ValueObj];
ListValueType := OBJECT [ListGUID,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
DateValueType := OBJECT [Value];
FreeTextValueType := OBJECT [Value];
NumericValueType := OBJECT [Value];
//
// This section of code will demonstrate how to write to FreeTextValue, DateValue,NumericValue
// and ListValue
parameter := FIRST OF (this_Parameters WHERE this_Parameters.Name = parameter_name );
IF EXISTS parameter THEN
//***************************************************************************************
// Check for existing object
//***************************************************************************************
obs := first of(this_ChartedObservationsList
WHERE this_ChartedObservationsList.parameterGUID = parameter.parameterGUID) ;
if not exist obs then
//Create a new Observation for the list
obs := NEW ObservationType;
obs.ClientDocumentGUID :=
this_documentCommunication.DocumentConfigurationObj.ClientDocumentGUID;
obs.ParameterGUID := parameter.ParameterGUID;
obs.DataType := parameter.DataType;
// Based on the parameter.DataType create the ValueObj Type and set the
// valueObj.value for (FREETEXTVALUETYPE,DATEVALUETYPE,NUMERICVALUETYPE)
// If the DataType is LISTVALUE then creat the valueObj of LISTVALUETYPE
// ABD ASSIGN THE paramter.configurationObj.ListGUID
if parameter.DataType = FREETEXTVALUE then
obs.ValueObj := NEW FreeTextValueType ;
elseif parameter.DataType = DATEVALUE then
obs.ValueObj := NEW DateValueType ;
elseif parameter.DataType = NUMERICVALUE then
obs.ValueObj := NEW NumericValueType ;
elseif parameter.DataType = LISTVALUE then
obs.ValueObj := NEW ListValueType;
obs.ValueObj.ListGUID := parameter.ConfigurationObj.ListGUID;
endif; // if parameter.DataType = FREETEXTVALUE then
// APPEND obs to the ChartedObservationsList
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList
:= (this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList,
obs);
endif;
if parameter.DataType = FREETEXTVALUE AND UpdateType = "Append" then
if length of obs.ValueObj.Value > 0 then
obs.ValueObj.Value := obs.ValueObj.Value || "\n" || newValue ;
else
obs.ValueObj.Value := newValue ;
endif;
elseif parameter.DataType = FREETEXTVALUE AND UpdateType = "Replace" then
obs.ValueObj.Value := newValue ;
elseif parameter.DataType IN(DATEVALUE,NUMERICVALUE) then
if exists newValue then // new code added by Stve Abel from Roswell Park
obs.ValueObj.Value := newValue ;
else
obs.ValueObj := null;
endif;
// obs.ValueObj.Value := newValue; This was the code before Steve Abel addition
elseif parameter.DataType = LISTVALUE then
//Populate the ListItemsList in the new observation object (obs)
// loop through each item in the parameter.ConfugurationObj.ListItemsList using
// "item"and append the item to the newly created object ListValueListItemType
// assign the item.listItemGUID to the selectedItem.ListItemGUID, the Item.value
// to the selectedItem.Value and set the SelectedItem.IsSelected := true
listItems := ();
FOR item IN parameter.ConfigurationObj.ListItemsList DO
IF item.Value IN newValue THEN
//Create a list item object for the selected list item
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := true;
// Arden list append statement appending the new object to the listItems
// object of the ListValueListItemType Object
listItems := (listItems, selectedItem);
ENDIF;
// set the obs.valueObj.ListItemsList := listItems list object
Obs.ValueObj.ListItemsList := listItems;
if exists sugg_txt_value then
obs.ValueObj.SuggestedTextValue := sugg_txt_value ;
endif ;
ENDDO;
endif; //if parameter.DataType = LISTVALUE then
ENDIF; //IF EXISTS parameter THEN
/////////////////////////////////////////////////////////////////////////////////////////////////
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,97 @@
maintenance:
title: CLINSUM_COMMENT_INFO ;;
mlmname: CLINSUM_COMMENT_INFO ;;
arden: version 2.5;;
version: 1.00;;
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav ;;
specialist: Shivprasad Jadhav , Allscripts;;
date: 2015-07-14;;
validation: testing;;
library:
purpose:
Populate a Clinical Summary Tile for Comment Value as a Significant Indicator ;;
explanation:
Change history
07-14.2014 DW CSR# 32230 Created By GOS for Comment for Resist Organism Value in Clinical Summary Chart
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(session_id, user_GUID, client_GUID, chart_GUID, visit_GUID, from_date, to_date) := argument;
if called_by_editor then
client_GUID:= read last{ClientInfo:GUID};
visit_GUID:= read last{ClientVisit:GUID};
chart_GUID:= read last{ClientVisit:ChartGUID};
endif;
// Column definition. More column properties may be added. Any changes to the defintion must be reflected in MLM STD_FUNC_CLINSUM_TRANSLATE.
colDefinition_def := object
[
FieldName, // The name of the field in the data row that contains the column{{{SINGLE-QUOTE}}}s value
ColumnHeader, // The text for the column header
DisplaySeqNum, // left-to-right sequence number in which to display the column
DataType, // The .net type name of the value
DisplayFormat, // format string to apply to the column
WidthDefaultPixel, // default width of the column, in pixels
WidthMinPixel, // Min width of the column, in pixels
WidthMaxPixel, // Max width of the column, in pixels
IsVisible, // Is the column visible
IsSortable // Is the column sortable
];
// Use column definition to define a row. Used by C# code to create the grid
rowDefinition_obj:= (new colDefinition_def with "TypeCode", "Type",0, "String", "", 50, 20, 50, true, false ),
(new colDefinition_def with "Text", "Comments", 1, "String", "", 50, 20, 50, true, false ),
(new colDefinition_def with "TouchedWhen", "Entered Date", 2, "String", "", 50, 20, 50, true, false )
;
rowValue_def := OBJECT [TypeCode,Text,TouchedWhen];
// Populate the row with data.
rows_obj :=();
TypeCode1,Text1,TouchedWhen1 := read first { " Select cd.TypeCode, cd.Text, cd.TouchedWhen "
|| " from CV3CommentDeclaration cd "
|| " Where cd.ClientGUID = " || Sql(client_GUID)
|| " And cd.TypeCode = {{{SINGLE-QUOTE}}}Resist Organism{{{SINGLE-QUOTE}}} "
|| " And cd.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} " };
singleRow_obj := new rowValue_def;
singleRow_obj.TypeCode := TypeCode1 ;//AS STRING);
singleRow_obj.Text := (Text1 AS STRING);
singleRow_obj.TouchedWhen := (TouchedWhen1 AS STRING);
rows_obj := rows_obj || singleRow_obj;
// Once the rows have been defined & populated this MLM Function will tranlate the OBJECT(s)
// into CDSDataObjects which can be read by the C# code that called this MLM.
translator := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CLINSUM_TRANSLATE{{{SINGLE-QUOTE}}};
(rowDefintion_dataObj, rows_dataObj) := call translator with rowDefinition_obj, singleRow_obj ;
;;
priority: 50
;;
evoke:
;;
logic:
conclude true;
;;
action:
return rowDefintion_dataObj, rows_dataObj;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,99 @@
maintenance:
title: CLINSUM_STATUS_BOARD_STATUS_TIMES ;;
mlmname: CLINSUM_STATUS_BOARD_STATUS_TIMES ;;
arden: version 2.5;;
version: 1.00;;
institution: ;;
author: Amanda Kirsopp ;;
specialist: Don Warnick ;;
date: 2013-06-07;;
validation: testing;;
library:
purpose:
Populate a Clinical Summary Tile for ED Status Board Status times. To be used by the MR Coders
;;
explanation:
Change history
11.28.2012 DW CSR# 31622 Created for Quality Blue requirement
04.02.2014 DW CSR# 32326 Remove TBADM from the Medical Records Clinical Summary Tab
05.03.2018 JML CSR# 36699 Added column "Updated By Provider" to display user who updated status on board.
06.06.2018 DW CSR# 36857 Add PEIP to the Medical Records Clinical Summary Tab (go forward name of TIP)
07.02.2018 DW CSR# 36891 Add credentials to the name of the physician displayed in the tile
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(session_id, user_GUID, client_GUID, chart_GUID, visit_GUID, from_date, to_date) := argument;
if called_by_editor then
client_GUID:= read last{ClientInfo:GUID};
visit_GUID:= read last{ClientVisit:GUID};
chart_GUID:= read last{ClientVisit:ChartGUID};
endif;
// Column definition. More column properties may be added. Any changes to the defintion must be reflected in MLM STD_FUNC_CLINSUM_TRANSLATE.
colDefinition_def := object
[
FieldName, // The name of the field in the data row that contains the column{{{SINGLE-QUOTE}}}s value
ColumnHeader, // The text for the column header
DisplaySeqNum, // left-to-right sequence number in which to display the column
DataType, // The .net type name of the value
DisplayFormat, // format string to apply to the column
WidthDefaultPixel, // default width of the column, in pixels
WidthMinPixel, // Min width of the column, in pixels
WidthMaxPixel, // Max width of the column, in pixels
IsVisible, // Is the column visible
IsSortable // Is the column sortable
];
// Use column definition to define a row. Used by C# code to create the grid
rowDefinition_obj:= (new colDefinition_def with "ScheduledDtm", "Time",0, "DateTime", "", 120, 120, 120, true, true ),
(new colDefinition_def with "OrderName", "Status", 1, "String", "", 180, 180, 180, true, true ),
(new colDefinition_def with "TouchedBy", "Updated By Provider", 2, "String", "", 200, 200, 200, true, true )
;
rowValue_def := OBJECT [ScheduledDtm,OrderName,TouchedBy];
// Populate the row with data.
rows_obj :=();
singleRow_obj:= read as rowValue_def { " SET CONCAT_NULL_YIELDS_NULL off select a.touchedwhen, "
|| " case when a.columnnewvalue = {{{SINGLE-QUOTE}}}tip{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Provider Exam in Progress{{{SINGLE-QUOTE}}} "
|| " when a.columnnewvalue = {{{SINGLE-QUOTE}}}peip{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Provider Exam in Progress{{{SINGLE-QUOTE}}} "
|| " when a.columnnewvalue = {{{SINGLE-QUOTE}}}tbaor{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}To be Admitted Orders Received{{{SINGLE-QUOTE}}} end "
|| " , (SELECT u.DisplayName + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + u.occupationcode FROM CV3USER u WHERE u.IDCode = RIGHT( a.TouchedBy, ( LEN(a.TOUCHEDBY) - CHARINDEX({{{SINGLE-QUOTE}}}_{{{SINGLE-QUOTE}}}, a.TouchedBy) ) ) ) "
|| " from sxaedlocationaudit a (nolock) "
|| " join cv3location l on l.guid = a.locationguid "
|| " where a.clientvisitguid = " || sql(visit_GUID)
|| " and a.columnnewvalue in ({{{SINGLE-QUOTE}}}tip{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}peip{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}tbaor{{{SINGLE-QUOTE}}}) "
|| " and l.code like {{{SINGLE-QUOTE}}}%|ED %{{{SINGLE-QUOTE}}} order by a.touchedwhen "
};
rows_obj := singleRow_obj;
// Once the rows have been defined & populated this MLM Function will tranlate the OBJECT(s)
// into CDSDataObjects which can be read by the C# code that called this MLM.
translator := MLM {{{SINGLE-QUOTE}}}STD_FUNC_CLINSUM_TRANSLATE{{{SINGLE-QUOTE}}};
(rowDefintion_dataObj, rows_dataObj) := call translator with rowDefinition_obj, rows_obj
;;
priority: 50
;;
evoke:
;;
logic:
conclude true;
;;
action:
return rowDefintion_dataObj, rows_dataObj;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,404 @@
maintenance:
title: DOC_ACS_DOM_PE_All_Defaults ;;
mlmname: DOC_ACS_DOM_PE_All_Defaults ;;
arden: version 2.5;;
version: 5.50;;
institution: RPM, Sample ;;
author: Rick Mansour ;;
specialist: Allscripts Custom Services;;
date: 2011-10-08 ;;
validation: testing;;
library:
purpose: Uses a select restricted list to populate a Physical exam.
Change history
20111116 ACS: Edited for St. Clair and 5.5
09.04.2012 CSR# 30963 DW Prism Enhancements - Add a new PE (Newborn)
10.16.2012 Added check for Active records ONLY in the SQL Query (CV3FlowsheetVersion and CV3ObservationEntryItem)
that retrieves all default normal values
for Physical Exam sections; this was a code correction based on default normals not populating
for "Skin","HEENT", etc. observations.
;;
explanation: This mlm is to use with a physical examination.
* This mlm calls the following MLMs:
- Called_RPM_DOM_Get_Definition_MLM and
- STD_DOC_FUNC_CHART_OBSERVATION_HELPER_JAB
* Negative inserts the structured note defaults
* Copy last inserts the last value for this Parameter/Observation from the most recent
document of this name.
* Copy my last inserts the last value for the Parameter/Observation in a any document
authored by the current user
* If any above returns null or the selected item is "not examined" or "clear" then the
valueObj is set to null which erases the value in the observation on the form.
This mlm uses a naming convention. The example is
current_parameter_name := "rpm_pe_constitutional_st" ;//LISTVALUE type of parameter.
target_parameter_DisplayName := "rpm_pe_constitutional"; //TEXTVALUE type of parameter
After the list is clicked, it becomes the current parameter and the follwoing code
finds the paired "target_parameter":
len_current_parameter_name := length of current_parameter_name ;
target_parameter_name := substring (len_current_parameter_name-3) characters
starting at 1 from current_parameter_name ;
This mlm sends the this_documentCommunicaiton to
Called_RPM_DOM_Get_Definition_MLM
and gets back the values of all of the important attributes of the object
This mlm calls the STD_DOC_FUNC_CHART_OBSERVATION_HELPER_JAB in order to write
to the note when charting an observation with the mlm.
;;
keywords: RTF, Document Called MLM , list, multi-select
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
/*******************Make Changes To Spelling And Flags In This Section******************/
// This code BELOW is sample code and should be changed for all new mlms
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
// The MLM will display the diagnosticMessage Varaible if the
// displayMessageFlag is set to TRUE
displayMessageFlag := false ;
// observation names of the GLOBAL default choices
major_default_obs_names := ( "SCH_MDPN_PE_nl", "SCH_MDPN_PE_my nl",
"SCH_MDPN_PE_my last", "SCH_MDPN_PE_save");
// Observation names of the LIST iteems (radio buttons) for setting individual findings
pe_list_st:=
("SCH_MDPN_PE_Gen",
"SCH_MDPN_PE_Mental Status",
"SCH_MDPN_PE_ENMT",
"SCH_MDPN_PE_Cardio",
"SCH_MDPN_PE_Resp",
"SCH_MDPN_PE_Gastro",
"SCH_MDPN_PE_GU",
"SCH_MDPN_PE_Neuro",
"SCH_MDPN_PE_Musculo",
"SCH_MDPN_PE_Rectal",
"SCH_MDPN_PE_Skin",
"SCH_MDPN_PE_Vascul",
"SCH_MDPN_PE_Newborn"
);
/* ("rpm_pe_Respiratory_st",
"rpm_pe_Constitutional_st",
"rpm_pe_CVS_Heart_st",
"rpm_pe_Skin_st",
"rpm_pe_Abdomen_st",
"rpm_pe_Psychiatric_st",
"rpm_pe_Eyes_st",
"rpm_pe_ENMT_st",
"rpm_pe_CVS_Pulses_st",
"rpm_pe_Lymphatic_st",
"rpm_pe_Musculoskeletal_st",
"rpm_pe_Neurologic_st",
"rpm_pe_Edema_Varicosities_st",
"rpm_pe_Neck_Thyroid_st");
*/
// Observation names of the TEXT items (to be written to)
// These should correspond, respectively to the LIST item observations, above
pe_list:=
("SCH_MDPN_PE General",
"SCH_MDPN_PE Mental Status",
"SCH_MDPN_PE ENMT",
"SCH_MDPN_PE Cardiovascular",
"SCH_MDPN_PE Respiratory",
"SCH_MDPN_PE Gastro",
"SCH_MDPN_PE GU",
"SCH_MDPN_PE Neuro",
"SCH_MDPN_PE Musculoskeletal",
"SCH_MDPN_PE Rectal",
"SCH_MDPN_PE Skin",
"SCH_MDPN_PE Vascular",
"SCH_MDPN_PE Newborn"
);
/* ("rpm_pe_Respiratory",
"rpm_pe_Constitutional",
"rpm_pe_CVS_Heart",
"rpm_pe_Skin",
"rpm_pe_Abdomen",
"rpm_pe_Psychiatric",
"rpm_pe_Eyes",
"rpm_pe_ENMT",
"rpm_pe_CVS_Pulses",
"rpm_pe_Lymphatic",
"rpm_pe_Musculoskeletal",
"rpm_pe_Neurologic",
"rpm_pe_Edema_Varicosities",
"rpm_pe_Neck_Thyroid");
*/
// This is the only part of this mlms that you will need to change!
/******************************END of Changes********************************************/
//Section 1 Variable and Constant Declaration DO NOT CHANGE THIS SECTION !!!!!!!!!!!!!!!
// Variable declarations
WriteToNote_MLM := MLM {{{SINGLE-QUOTE}}}STD_DOC_FUNC_CHART_OBSERVATION_HELPER_JAB{{{SINGLE-QUOTE}}}; //{{{SINGLE-QUOTE}}}Called_RPM_DOM_MLM{{{SINGLE-QUOTE}}};
// get_Object := MLM {{{SINGLE-QUOTE}}}CALLED_RETURN_OBJECT{{{SINGLE-QUOTE}}};
Get_Variable_Values := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
// .Net assemblies need to be loaded for ObjectsPlus
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
target_parameter_name := "" ;
target_list := ();
newValue:= "" ;
// sugg_txt_value:="";
UpdateType := "Replace";
// Object needed to declare in the calling the above MLM (for listitems only)
SelectedList := OBJECT[ ListGUID, SelectedValues, SuggestiveText];
// Create the new selection list object for selection
PN_sel_list := NEW SelectedList;
// this mlm will assign values to the document objects.
(this_documentCommunication,
client_guid, client_visit_guid, client_chart_guid,
user_guid, document_type, document_name,
event_type, configuration_guid, this_currentObj,
CancelEventFlag, this_structuredNoteDoc, authored_date_time,
authored_by_guid, client_document_guid, document_date_time,
isNewFlag, isIncompleteFlag, isResultsPendingFlag,
isPriorityFlag, this_parameters, this_chartedObservationsList,
this_parameters_display_name, current_parameter,
current_parameter_name, current_parameter_guid, current_parameter_DataType,
selectedItems, selectedItems_value, current_value,
diagnosticMessage, displayMessageFlag2, CoSigner1,
CoSigner2, DocumentTopic)
:= CALL Get_Variable_Values WITH (this_documentCommunication);
//Variable and Constant Declaration
//DO NOT CHANGE THE ABOVE SEQUENCE. IT MATCHES THE SEQUENCE IN THE CALLED MLM !!!!!!!!! //
if called_by_editor then
target_parameter_name := "" ;
current_parameter_name := "SCH_MDPN_PE_Gen";
document_name := "Physician Progress Note";
current_value := "my last"; //"normal";
newValue:= "" ;
user_guid := "8000001053119001"; //(peggy karish)
(client_guid, client_chart_guid, client_visit_guid):= read last
{ClientVisit: ClientGUID, ChartGUID, GUID};
endif; //if called_by_editor then
// In this section of the MLM the newValue should be determined through logic
// or SQL retrieved data or calling another mlm for the return value
// get the target_parameter_name and target_parameter_DisplayName
(PCDocGUID) := this_structuredNoteDoc.PatientCareDocumentGUID ;
if not exists client_document_guid then
client_document_guid := 0 ;
endif ;
// len_current_parameter_name := length of current_parameter_name ;
target_param_root := "SCH_MDPN_PE ";
len_tpr := length of target_param_root;
len_cpn:= length of current_parameter_name;
len_diff_tpr_cpn := len_cpn - len_tpr;
if len_diff_tpr_cpn < 3 then
str_span := len_diff_tpr_cpn;
else
str_span := 3;
endif;
// target_parameter_name := substring (len_current_parameter_name-3) characters
// starting at 1 from current_parameter_name ;
target_parameter_name := target_param_root || (substring str_span characters
starting at (len_tpr + 1) from current_parameter_name) || "%" ;
//target_parameter := first of (this_Parameters
// WHERE this_Parameters.Name = target_parameter_name) ;
targetObject := first of (this_parameters where this_parameters.name =
target_parameter_name);
// targetObject := CALL get_Object WITH (this_documentCommunication,target_parameter_name) ;
target_parameter_DisplayName := targetObject.DisplayName ;
if any(PE_list matches pattern target_parameter_name) then
target_parameter_name := first (PE_list
where it matches pattern target_parameter_name);
target_list := , target_parameter_name;
elseif current_parameter_name is in major_default_obs_names then
target_list := (PE_list) ;
endif;
FOR target_parameter_name IN(target_list) DO
if current_value IN( "Negative+", "my normal") then
// sugg_txt_value:= "" ;
// UpdateType:= "Replace" ; // either "Replace" or "Append"
newValue:= read last
{ " SELECT UserSpecificDefault "
|| " FROM ACS_PE_UserDefaults "
|| " WHERE UserGUID = " || sql(user_guid)
|| " AND OCMI_ObservationName = " || sql(target_parameter_name)
|| " AND Active = 1 "
};
elseif current_value IN( "Negative", "normal") then
// sugg_txt_value:= "" ;
// UpdateType:= "Replace" ; // either "Replace" or "Append"
newValue:= read last
{ " SELECT FSVI.SpecificDefault "
|| " FROM CV3PatientCareDocument PCD "
|| " JOIN CV3FlowsheetVersion FSV "
|| " ON FSV.FlowsheetGUID = PCD.KTreeRootGUID "
|| " JOIN CV3FlowsheetVersionItem FSVI "
|| " ON FSVI.VersionGUID = FSV.GUID "
|| " JOIN CV3ObservationEntryItem OEI "
|| " ON OEI.GUID = FSVI.ObsEntryItemGUID "
|| " JOIN CV3ObsCatalogMasterItem OCMI "
|| " ON OCMI.GUID = OEI.ObsMasterItemGUID "
|| " WHERE PCD.GUID = " || PCDocGUID
|| " AND OCMI.Name = " || sql(target_parameter_name)
|| " AND FSVI.Active = 1" //JML: 10.16.2012 code correction (see history above)
|| " AND OEI.Active = 1" //JML: 10.16.2012 code correction (see history above)
};
elseif current_value IN ("copy last", "last") then
// sugg_txt_value:= "" ;
// UpdateType:= "Replace" ; // either "Replace" or "Append"
newValue:= read last
{ " SELECT TOP 1 Obs.ValueText "
|| " FROM CV3ClientDocument CD "
|| " JOIN SXACDObservationParameter sp " //this is the new table in 5.5
|| " ON CD.ClientGUID = sp.ClientGUID "
|| " and CD.ChartGUID = sp.ChartGUID "
|| " and sp.OwnerGUID = cd.guid " //IMPORTANT limiter condition!
|| " and CD.PatCareDocGUID = sp.PatCareDocGUID "
|| " JOIN CV3Observation Obs "
|| " ON sp.ObservationGUID = Obs.GUID "
|| " JOIN CV3ObsCatalogMasterItem OCMI "
|| " ON OCMI.GUID = sp.ObsMasterItemGUID "
|| " WHERE CD.ClientGUID = " || sql(client_guid)
|| " AND cd.DocumentName like ({{{SINGLE-QUOTE}}}%{{{SINGLE-QUOTE}}} + " || sql( Document_Name ) || " + {{{SINGLE-QUOTE}}}%{{{SINGLE-QUOTE}}})"
|| " AND OCMI.Name = " || sql(target_parameter_name)
|| " AND CD.GUID <> " || sql(client_document_guid)
|| " ORDER BY CD.Entered DESC "
};
elseif current_value IN("copy my last","my last") then
// sugg_txt_value:= "" ;
// UpdateType:= "Replace" ; // either "Replace" or "Append"
newValue:= read last
{ " SELECT TOP 1 Obs.ValueText "
|| " FROM CV3ClientDocument CD "
|| " JOIN SXACDObservationParameter sp " //this is the new table in 5.5
|| " ON CD.ClientGUID = sp.ClientGUID "
|| " and CD.ChartGUID = sp.ChartGUID "
|| " and sp.OwnerGUID = cd.guid " //IMPORTANT limiter condition!
|| " and CD.PatCareDocGUID = sp.PatCareDocGUID "
|| " JOIN CV3Observation Obs "
|| " ON sp.ObservationGUID = Obs.GUID "
|| " JOIN CV3ObsCatalogMasterItem OCMI "
|| " ON OCMI.GUID = sp.ObsMasterItemGUID "
|| " WHERE CD.ClientGUID = " || sql(client_guid)
|| " AND CD.AuthoredProviderGUID = " || sql(user_guid)
|| " AND OCMI.Name = " || sql(target_parameter_name)
|| " AND CD.GUID <> " || sql(client_document_guid)
|| " ORDER BY CD.Entered DESC "
};
endif;
if (current_value IN ("my last") AND not exist newValue)
or (current_value = "clear") then
newValue := ""; // no old value found, replace with blank
endif;
//SET OBS TEXT VALUES//////////////////////////////////////////////////////////////////
if exists target_parameter_name and exists newValue then
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, target_parameter_name,
// newValue, sugg_txt_value,UpdateType);
(newValue, UpdateType));
endif ;
ENDDO;
//SET OBS LIST VALUES//////////////////////////////////////////////////////////////////////
// Set the non-selected radion button list values
// Set the non-chosen GLOBAL list values to {{{SINGLE-QUOTE}}}isselected = false{{{SINGLE-QUOTE}}}
other_param_names := major_default_obs_names where it <> current_parameter_name;
newValue:="";
// sugg_txt_value:="";
PN_sel_list.SelectedValues := , newvalue; //value to select
PN_sel_list.SuggestiveText := null; //optional text
// UpdateType:="Replace";
FOR target_parameter_name IN(other_param_names) DO // LIST Values
if exists target_parameter_name and exists newValue then // Set the LIST values
target_param := first of (this_parameters
where this_parameters.name = target_parameter_name);
target_config_obj := target_param.ConfigurationObj;
// create the selection list for helper MLM
PN_sel_list.ListGUID := target_config_obj.listguid;
// SELECT THE RADIO BUTTON(s)
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, target_parameter_name,
PN_sel_list);
// newValue, sugg_txt_value, UpdateType);
endif ;
ENDDO; // target_parameter_name IN(other_param_names)
// Set the INDIVIDUAL list values to match the global list choice
if current_parameter_name is in major_default_obs_names then
newValue:= current_value ;
PN_sel_list.SelectedValues := , newvalue; //value to select
PN_sel_list.SuggestiveText := null; //optional text
FOR target_parameter_name IN (PE_List_st) DO // LIST Values
if exists target_parameter_name and exists newValue then // Set the LIST values
target_param := first of (this_parameters
where this_parameters.name = target_parameter_name);
target_config_obj := target_param.ConfigurationObj;
// create the selection list for helper MLM
PN_sel_list.ListGUID := target_config_obj.listguid;
// SELECT THE RADIO BUTTON(s)
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, target_parameter_name,
PN_sel_list);
// newValue, sugg_txt_value, UpdateType);
endif ; // target_parameter_name IN(PE_List_st)
ENDDO;
endif; // current_parameter_name is in major_default_obs_names
//////////////////////////////////////////////////////////////////////////////////////////
// If the state of the isIncomplete, isPriority and isResultsPending
// need to be changed in the note
// set one or more of these flags := TRUE
// isIncompleteFlag := TRUE ;
// isResultsPendingFlag := TRUE ;
// isPriorityFlag := TRUE ;
// This code sets the checkboxes to checked or unchecked.
// DO NOT CHANGE THIS CODE BELOW
this_structuredNoteDoc.IsIncomplete := isIncompleteFlag ;
this_structuredNoteDoc.IsResultsPending := isResultsPendingFlag ;
this_structuredNoteDoc.IsPriority := isPriorityFlag ;
// ThE ABOVE code sets the checkboxes to checked or unchecked.
// DO NOT CHANGE THIS CODE ABOVE
// The code below will display the diagnosticMessage Varaible if the
// displayMessageFlag is set to TRUE displayMesssaageFlag:=TRUE;
this_documentCommunication.DisplayMessage := displayMessageFlag;
this_documentCommunication.Message := "Diagnostic Message : "
||diagnosticMessage || "\n\nTargetObject\n\n" || targetObject || "";
//////////////////////////////////////////////////////////////////////////////////////////
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,166 @@
maintenance:
title: DOC_ACS_DOM_Set_User_Defaults ;;
mlmname: DOC_ACS_DOM_Set_User_Defaults ;;
arden: version 2.5;;
version: 5.50;;
institution: St. Clair ;;
author: Rick Mansour ;;
specialist: Allscripts Custom Services;;
date: 2011-10-09 ;;
validation: testing;;
library:
purpose: Uses a select restricted list to populate a Physical exam.
;;
explanation: This mlm is to use with a physical examination.
This mlm set UserDefaultSpecific filed values
Change history
20111117 ACS : changed for St. Clair and SQL performance
09.04.2012 CSR# 30963 DW Prism Enhancements - Add a new PE (Newborn)
This MLM uses a custom table with the following schema:
CREATE TABLE [dbo].[ACS_PE_UserDefaults](
[UserGUID] [dbo].[HVCIDdt] NOT NULL,
[OCMI_ObservationName] [varchar](200) NOT NULL,
[PatCareDocName] [varchar](200) NOT NULL,
[UserSpecificDefault] [varchar](2000) NOT NULL,
[CreatedWhen] [datetime] NOT NULL,
[TouchedWhen] [datetime] NOT NULL,
[Active] [bit] NOT NULL CONSTRAINT [DF_rpmCDUserDefaults_Active] DEFAULT ((0))
) ON [PRIMARY]
CREATE UNIQUE CLUSTERED INDEX ACS_PE_UD_INDX on
ACS_PE_UserDefaults (userguid, PatCareDocName, ocmi_observationname)
;;
keywords: RTF, Document Called MLM , list, multi-select
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
/*******************Make Changes To Spelling And Flags In This Section******************/
// Set to true if a decision.log is needed.
log_execution_info := false;
//This is the only part of this mlms that you will need to change
default_parameter_list :=
("SCH_MDPN_PE General",
"SCH_MDPN_PE Mental Status",
"SCH_MDPN_PE ENMT",
"SCH_MDPN_PE Cardiovascular",
"SCH_MDPN_PE Respiratory",
"SCH_MDPN_PE Gastro",
"SCH_MDPN_PE GU",
"SCH_MDPN_PE Neuro",
"SCH_MDPN_PE Musculoskeletal",
"SCH_MDPN_PE Rectal",
"SCH_MDPN_PE Skin",
"SCH_MDPN_PE Vascular",
"SCH_MDPN_PE Newborn"
);
/*
("rpm_pe_constitutional","rpm_pe_eyes","rpm_pe_ENMT",
"rpm_pe_neck_thyroid","rpm_pe_CVS_Heart","rpm_pe_CVS_Pulses",
"rpm_pe_Abdomen","rpm_pe_Breast","rpm_pe_Edema_Varicosities",
"rpm_pe_Neurologic","rpm_pe_Musculoskeletal","rpm_pe_Skin",
"rpm_pe_Lymphatic","rpm_pe_Psychiatric","rpm_pe_Respiratory"
);
*/
/**********************************END OF CHANGES****************************************/
//Section 1 Variable and Constant Declaration
Get_Variable_Values := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
//Variable and Constant Declaration
sql_insert_list := ();
// DO NOT CHANGE THIS SECTION !!!!!!!!!!!!!! //
// this mlm will assign values to the document objects.
(this_documentCommunication,
client_guid, client_visit_guid, client_chart_guid,
user_guid, document_type, document_name,
event_type, configuration_guid, this_currentObj,
CancelEventFlag, this_structuredNoteDoc, authored_date_time,
authored_by_guid, client_document_guid, document_date_time,
isNewFlag, isIncompleteFlag, isResultsPendingFlag,
isPriorityFlag, this_parameters, this_chartedObservationsList,
this_parameters_display_name, current_parameter,
current_parameter_name, current_parameter_guid, current_parameter_DataType,
selectedItems, selectedItems_value, current_value,
diagnosticMessage, displayMessageFlag, CoSigner1,
CoSigner2, DocumentTopic)
:= CALL Get_Variable_Values WITH (this_documentCommunication);
//DO NOT CHANGE THE ABOVE SEQUENCE. IT MATCHES THE SEQUENCE IN THE CALLED MLM !!!!!!!! //
if called_by_editor then
current_value := "save defaults";
client_guid := read last {ClientInfo: GUID};
user_guid := read last {userinfo: guid};
document_name := "PN doc";
sql_insert_list :=
"(" || sql(user_guid) || ", {{{SINGLE-QUOTE}}}general{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}PN doc{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}gen nl.{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}1-1-2012{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}1-1-2013{{{SINGLE-QUOTE}}}, 1)",
"(" || sql(user_guid) || ", {{{SINGLE-QUOTE}}}neuro{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}PN doc{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}crazy{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}1-1-2014{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}1-1-2015{{{SINGLE-QUOTE}}}, 2)"
;
current_parameter_name := "SCH_MDPN_PE General"; // "rpm_pe_constitutional" ;
endif;
if current_value is in ("save", "save defaults") then
FOR system_name IN default_parameter_list DO
save_parameter:= first of (this_parameters
WHERE this_parameters.Name = system_name) ;
if exists save_parameter then
save_parameterObs := first of (this_ChartedObservationsList WHERE
this_ChartedObservationsList.parameterGUID = save_parameter.parameterGUID);
if exists save_parameterObs and save_parameterObs.valueObj.value <> "" then
new_SpecificDefault := save_parameterObs.valueObj.value ;
sql_insert_list := sql_insert_list,
"(" || sql(user_guid) || ","
|| sql(system_name) || ","
|| sql(document_name) || ","
|| sql(new_SpecificDefault) || ","
|| sql(NOW) || ","
|| sql(NOW) || ",1)" ;
endif;
endif;
ENDDO;
delete_default:= read last
{ " DELETE FROM ACS_PE_UserDefaults "
|| " WHERE UserGUID = " || sql(user_guid)
|| " AND PatCareDocName = " || sql(document_name)
};
insert_default:= read last
{ " INSERT INTO ACS_PE_UserDefaults "
|| " (UserGUID,OCMI_ObservationName,PatCareDocName, "
|| " UserSpecificDefault,CreatedWhen,TouchedWhen,Active) "
|| " Values " || sql_insert_list
};
ENDIF;
sMessage := user_guid || "\n" || system_name || "\n" || document_name
|| "\n" || new_SpecificDefault || "\n" || NOW
;
// this_documentCommunication.DisplayMessage := TRUE;
this_documentCommunication.Message := sMessage ;
//////////////////////////////////////////////////////////////////////////////////////
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,726 @@
maintenance:
title: DOC_ACS_Problem_Assessment_Plan_Reorder ;;
mlmname: DOC_ACS_Problem_Assessment_Plan_Reorder ;;
arden: version 2.5;;
version: 1.00;;
institution: RPM, Sample Document Called MLM;;
author: Your name ;;
specialist: ;;
date: 2010-12-31;;
validation: testing;;
library:
purpose: Standardize the document mlm responsible for reordering problems and assessments
;;
explanation:
Change history
20101231 : Original MLM created by Dr. Mansour
20110930 : updated by Allscripts Custom Services (ACS)
20120109 : added button deselection per request (ACS)
20120418: changed "ClientGUID like " to "ClientGUID =" in 2 places in the HI sql statement
08.27.2012 DW CSR# 30963 - Prism Enhancements - Copy last saved note from user with same discipline
08.12.2013 DW CSR# 31472 - Add a Clear Plan button CSR#31743 - Create a Problem List Selector app
03.19.2015 DW CSR# 32616 - Develop Application to allow for communication between clinical documentation specialist
04.23.2015 DW CSR# 32359 - Physician Charging (appended the ICD Code to the visit problems imported into the A/P section)
09.24.2015 DW CSR# 23359 - ICD10
09/14/2016 DW HD# 2198672- We found that the 08.27.2012 change above opened the SQL to pulling SNs and FSs that had no problems. I listed the documents that have problems
07/31/2019 JML 18.4 Upgrade - Modified SQL so Copy Last function will work
;;
keywords: RTF, Document Called MLM , list
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
/*******************Make Changes To Spelling And Flags In This Section******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
// specifiy the count of problem/assessment-plan text fields, for iteration
count_prob_obs := 14;
// assuming that all similar obs have been configured in the same way
// provide the root names of each
button_root := "SCH_MDPN_AP_Sort "; //"button_move_";
problem_root:= "SCH_MDPN_Problem "; //"Problem_";
ass_plan_root:= "SCH_MDPN_Assessment / Plans "; //"Assessment_Plan_";
// These variables are to handle the placeholder (tens place) in the obs names
// for the first nine named items (i.e. if "1" to "9" then placeholder is "";
// if "01" to "09" then placeholder is "0";
button_tens_placeholder := "";
problem_tens_placeholder := "";
ass_plan_tens_placeholder := "0";
// Observation containing copy problem list buttons:
copy_prob_buttons_obs := "SCH_MDPN_AP_Copy";
// specify the button mappings to SQL compatible lists of problem types:
// use "<LAST NOTE>" (no single quotes) to specify copying from the recorded note
// NOTE: THE RELATIVE ORDER OF ITEMS MUST BE MAINTAINED WITHIN LISTS!!!
// MUST HAVE THE FOLLOWING ORDER FOR EACH ELEMENT ITEM:
// "BUTTON_NAME|{{{SINGLE-QUOTE}}}HEALTH_ISSUE_TYPE1{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}HEALTH_ISSUE_TYPE2{{{SINGLE-QUOTE}}},etc"
button_hi_map_list :=
(
"Copy Problem-Visit|{{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}",
"Copy Problem-Proced|{{{SINGLE-QUOTE}}}Problem-Proced{{{SINGLE-QUOTE}}}",
"Copy Problem-Chronic|{{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}",
"Copy All|{{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Proced{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}",
"Copy last saved note|<LAST NOTE>",
"Launch Problem Selector|Launch Problem Selector",
"Clear All|<CLEAR ALL>"
);
/***************************************************************************************/
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
WriteToNote_MLM := MLM {{{SINGLE-QUOTE}}}STD_DOC_FUNC_CHART_OBSERVATION_HELPER_JAB{{{SINGLE-QUOTE}}};
// this mlm will assign values to the document objects.
Get_Variable_Values := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
// ACS-20120109: added per request of P Karish - button deselection
(this_structuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(this_observations) := this_structuredNoteDoc.ChartedObservationsList;
(this_parameters) := this_structuredNoteDoc.ParametersList;
(this_currentObj) := this_documentCommunication.CurrentObservationObj;
current_parameter := FIRST OF (this_Parameters WHERE this_parameters.ParameterGUID = this_CurrentObj.ParameterGUID);
current_parameter_name := current_parameter.name ;
current_parameter_guid := current_parameter.ParameterGuid ;
current_parameter_DataType := current_parameter.DataType ;
modifier_observation := first of (this_observations where this_observations.ParameterGUID = current_parameter_guid);
IF exists modifier_observation THEN
IF exists modifier_observation.ValueObj THEN
//Calculate the modifier value based on the selected items lowest numeric equivalent value
FOR chartedListItem IN modifier_observation.ValueObj.ListItemsList DO
IF chartedListItem.IsSelected = true THEN
chartedListItem.IsSelected := false;
ENDIF;
ENDDO;
ENDIF;
ENDIF;
// Initialize Variables
msg := "";
target_parameter_name := "" ;
newValue:= "" ;
sugg_txt_value:="";
button_name_list := ();
problem_name_list := ();
ass_plan_name_list := ();
index_list := ();
last_prob_index := 0;
REPLACE_APPEND := "Replace";
THIS_MLM_NAME:= "DOC_RPM_Problem_Assessment_Plan_Reorder";
//Section 1 Variable and Constant Declaration DO NOT CHANGE THIS SECTION !!!!!!!!!!!!!
(this_documentCommunication,
client_guid, client_visit_guid, client_chart_guid,
user_guid, document_type, document_name,
event_type, configuration_guid, this_currentObj,
CancelEventFlag, this_structuredNoteDoc, authored_date_time,
authored_by_guid, client_document_guid, document_date_time,
isNewFlag, isIncompleteFlag, isResultsPendingFlag,
isPriorityFlag, this_parameters, this_chartedObservationsList,
this_parameters_display_name, current_parameter,
current_parameter_name, current_parameter_guid,
current_parameter_DataType, selectedItems,
selectedItems_value, current_value,
diagnosticMessage, displayMessageFlag,
CoSigner1, CoSigner2,DocumentTopic)
:= CALL Get_Variable_Values WITH (this_documentCommunication);
//Variable and Constant Declaration DO NOT CHANGE THE ABOVE SEQUENCE.
//IT MATCHES THE SEQUENCE IN THE CALLED MLM !!!!!!!!!!!!!!!!!!!!!! //
/* In this section of the MLM the newValue should be determined through logic */
/* or SQL retrieved data or calling another mlm for the return value */
/***************************************************************************/
if called_by_editor then
current_parameter_name := "SCH_MDPN_AP_Copy"; //"SCH_MDPN_AP_Sort 2";
//"button_move_2";
current_value := "Copy last saved note";
//"Copy Problem-Visit"; //"down";
//"Copy all";
document_name := "Physician Progress Note";
(client_guid, client_chart_guid, client_visit_guid) :=
READ LAST{ClientVisit:clientguid, ChartGUID, guid};
endif;
// gather user discipline
(user_discipline) := read last {
" SELECT cp.discipline "
|| " FROM CV3User u with (nolock)"
|| " join CV3CareProvider cp with (nolock) on cp.GUID = u.GUID "
|| " WHERE u.GUID = " || Sql(user_guid)
|| " AND u.Active = 1 "
};
// get string lengths of parameters for parsing
len_button_root := length of button_root;
len_Problem_root := length of Problem_root;
len_ass_plan_root := length of ass_plan_root;
len_current_parameter_name := length of current_parameter_name;
for i in 1 seqto count_prob_obs do
index_list := index_list , i;
if button_tens_placeholder <> "" and i < 10 then
button_name_i := button_root || button_tens_placeholder || i;
else
button_name_i := button_root || i;
endif;
button_name_list := button_name_list, button_name_i;
if problem_tens_placeholder <> "" and i < 10 then
problem_name_i := problem_root || problem_tens_placeholder || i;
else
problem_name_i := problem_root || i;
endif;
problem_name_list := problem_name_list, problem_name_i;
if ass_plan_tens_placeholder <> "" and i < 10 then
ass_plan_name_i := ass_plan_root || ass_plan_tens_placeholder || i;
else
ass_plan_name_i := ass_plan_root || i;
endif;
ass_plan_name_list := ass_plan_name_list, ass_plan_name_i;
enddo; // for i in 1 seqto count_prob_obs
// MOVE UP/DOWN OR CLEAR
if current_parameter_name matches pattern (button_root || "%") then
current_index := first(index_list where button_name_list = current_parameter_name);
curr_prob_parm_name := problem_name_list[current_index];
curr_ap_parm_name := ass_plan_name_list[current_index];
curr_prob_parm := first of (this_parameters WHERE this_parameters.Name = curr_prob_parm_name);
curr_ap_parm := first of (this_parameters WHERE this_parameters.Name = curr_ap_parm_name);
IF EXIST curr_prob_parm OR EXIST curr_ap_parm THEN
curr_prob_obs := first of (this_ChartedObservationsList WHERE this_ChartedObservationsList.ParameterGUID = curr_prob_parm.ParameterGUID);
curr_ap_obs := first of (this_ChartedObservationsList WHERE this_ChartedObservationsList.ParameterGUID = curr_ap_parm.ParameterGUID);
IF EXIST curr_prob_obs or exist curr_ap_obs then
if length of curr_prob_obs.valueObj.value > 0 then
curr_prob_newValue := curr_prob_obs.valueObj.value;
else
curr_prob_newValue := "";
endif;
if length of curr_ap_obs.valueObj.value > 0 then
curr_ap_newValue := curr_ap_obs.valueObj.value;
else
curr_ap_newValue := "";
endif;
endif;
endif;
// Up/Down/Bottom/Top Buttons Section
if current_value IN("up","down","bottom","top") then //determine digits place
if current_value = "bottom" then
// get the last entered problem by scanning in reverse order
for j in 1 seqto count_prob_obs do
if last_prob_index = 0 then //haven{{{SINGLE-QUOTE}}}t found last prob yet
last_prob_name := problem_name_list [ count_prob_obs -J + 1];
last_prob_parm := first of (this_parameters WHERE this_parameters.Name = last_prob_name );
IF EXIST last_prob_parm THEN //found param, now get obs
last_prob_obs := first of (this_ChartedObservationsList WHERE this_ChartedObservationsList.ParameterGUID
= last_prob_parm.ParameterGUID);
IF EXIST last_prob_obs then // check to see if there is a problem
if length of last_prob_obs.valueObj.value > 0 then
last_prob_index := count_prob_obs -J + 1;
endif;
endif; // EXIST last_prob_obs
endif; // EXIST last_prob_parm
endif; // last_prob_index = 0
enddo; // j in 1 seqto count_prob_obs
endif; // current_value = "bottom"
if current_value = "top" then
max_index := current_index - 1;
top_index := 1;
i_multiplier := 1;
elseif current_value = "up" then
max_index := 1;
top_index := current_index - 1;
i_multiplier := 1;
elseif current_value = "down" then
max_index := 1;
top_index := current_index + 1;
i_multiplier := -1;
elseif current_value = "bottom" then
max_index := last_prob_index - current_index; // count_prob_obs - current_index;
top_index := last_prob_index; // count_prob_obs;
i_multiplier := -1;
endif;
for i in 1 seqto (max_index ) do
next_prob_parm_name := problem_name_list[current_index - (i * i_multiplier)];
next_ap_parm_name := ass_plan_name_list[current_index - (i * i_multiplier)];
next_prob_parm := first of (this_parameters WHERE this_parameters.Name = next_prob_parm_name);
next_ap_parm := first of (this_parameters WHERE this_parameters.Name = next_ap_parm_name);
IF EXIST next_prob_parm OR EXIST next_ap_parm THEN
next_prob_obs := first of (this_ChartedObservationsList WHERE this_ChartedObservationsList.ParameterGUID = next_prob_parm.ParameterGUID);
next_ap_obs := first of (this_ChartedObservationsList WHERE this_ChartedObservationsList.ParameterGUID = next_ap_parm.ParameterGUID);
IF EXIST next_prob_obs or exist next_ap_obs then
if length of next_prob_obs.valueObj.value > 0 then
next_prob_newValue := next_prob_obs.valueObj.value;
else
next_prob_newValue := "";
endif;
if length of next_ap_obs.valueObj.value > 0 then
next_ap_newValue := next_ap_obs.valueObj.value;
else
next_ap_newValue := "";
endif;
else
next_prob_newValue := "";
next_ap_newValue := "";
endif;
endif;
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, curr_prob_parm_name,(next_prob_newValue, REPLACE_APPEND) );
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, curr_ap_parm_name, (next_ap_newValue, REPLACE_APPEND) );
curr_prob_parm_name := next_prob_parm_name;
curr_ap_parm_name := next_ap_parm_name;
enddo;
top_prob_parm_name := problem_name_list[top_index];
top_ap_parm_name := ass_plan_name_list[top_index];
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, top_prob_parm_name,(curr_prob_newValue, REPLACE_APPEND) );
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, top_ap_parm_name, (curr_ap_newValue, REPLACE_APPEND) );
// Clear Problem and Plan Button Section
elseif current_value = "clear both" THEN
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, curr_prob_parm_name,("", REPLACE_APPEND) );
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, curr_ap_parm_name,("", REPLACE_APPEND) );
// Clear Plan Button Section
elseif current_value = "clear plan (AP)" THEN
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, curr_ap_parm_name,("", REPLACE_APPEND) );
endif; // current_value IN("up","down","bottom","top")
endif; // current_parameter_name matches pattern (button_root || "%")
// Copy Buttons Section
if current_parameter_name = copy_prob_buttons_obs then //"button_copy_problem_list"
// Parse Buttons
for j in 1 seqto count button_hi_map_list do
// parse the button mapper:
b_hi_element_list := call str_parse with button_hi_map_list[j], "|";
button_i := b_hi_element_list[1];
hi_sql_list_i := b_hi_element_list[2];
// Copy HI Buttons Section (Problem-Visit/Copy Problem-Proced/Copy Problem-Chronic/Copy All)
if current_value = button_i and hi_sql_list_i <> "<LAST NOTE>" and hi_sql_list_i <> "<CLEAR ALL>" and hi_sql_list_i <> "Launch Problem Selector" then
HI_Object := OBJECT [ ShortName,TypeCode,ScopeLevel ];
//041812 - changed "ClientGUID like " to "ClientGUID =" in 2 places in the HI sql statement
// 04.23.2015 DW CSR# 32359 - Physician Charging (appended the ICD Code to the visit problems imported into the A/P section)
/* Replaced with ICD10 project
OBjrs:= READ AS HI_Object
{" SELECT ShortName + {{{SINGLE-QUOTE}}} [{{{SINGLE-QUOTE}}} + isnull(code, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) + {{{SINGLE-QUOTE}}}]{{{SINGLE-QUOTE}}},TypeCode,ScopeLevel "
|| " FROM CV3HealthIssueDeclaration "
|| " WHERE (ClientGUID = " || sql(client_guid)
|| " AND ChartGUID = " || sql(client_chart_guid)
|| " AND ScopeLevel IN ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}}) "
|| " AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| " AND TypeCode IN ( " || hi_sql_list_i || ") )"
|| " OR (ClientGUID = " || sql(client_guid)
|| " AND ChartGUID <> " || sql(client_chart_guid)
|| " AND ScopeLevel = {{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}} "
|| " AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| " AND TypeCode IN ( " || hi_sql_list_i || ") )"
|| " ORDER By ShortName "
};
*/
OBjrs:= READ AS HI_Object
{" SELECT ShortName + {{{SINGLE-QUOTE}}} [{{{SINGLE-QUOTE}}} + isnull(code, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) + {{{SINGLE-QUOTE}}}]{{{SINGLE-QUOTE}}},TypeCode,ScopeLevel "
|| " FROM CV3HealthIssueDeclaration "
|| " WHERE "
|| " ( "
|| " (ClientGUID = " || sql(client_guid)
|| " AND ChartGUID = " || sql(client_chart_guid)
|| " AND ScopeLevel IN ({{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}}) "
|| " AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| " AND TypeCode IN ( " || hi_sql_list_i || ") )"
|| " OR "
|| " (ClientGUID = " || sql(client_guid)
|| " AND ChartGUID <> " || sql(client_chart_guid)
|| " AND ScopeLevel = {{{SINGLE-QUOTE}}}3{{{SINGLE-QUOTE}}} "
|| " AND Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| " AND TypeCode IN ( " || hi_sql_list_i || ") )"
|| " ) "
|| " and CodingScheme = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} ORDER By ShortName "
};
IF EXIST OBjrs THEN
target_parameter_name_list := problem_name_list;
empty_target_parameter_name_list :=();
FOR ictr IN 1 SEQTO COUNT OF target_parameter_name_list DO
candidate_parameter_name := target_parameter_name_list[ictr] ;
candidate_parameter := first of (this_Parameters WHERE this_Parameters.Name = candidate_parameter_name) ;
if exists candidate_parameter then
candidate_parameter_Obs := first of (this_ChartedObservationsList WHERE this_ChartedObservationsList.ParameterGUID = candidate_parameter.ParameterGUID);
if candidate_parameter_Obs.valueObj.value is NULL then
empty_target_parameter_name_list := (empty_target_parameter_name_list, candidate_parameter_name);
endif; //if exists candidate_parameter_Obs AND Length OF ...
endif; //if exists candidate_parameter then
ENDDO; //FOR ictr IN 1 SEQTO COUNT OF target_parameter_name_list DO
ParameterGUIDs_List :=(this_Parameters.ParameterGUID WHERE this_Parameters.Name IN (target_parameter_name_list));
Problems_list := (this_ChartedObservationsList.valueObj.Value WHERE this_ChartedObservationsList.ParameterGUID IN (ParameterGUIDs_List) );
missing_problems_list :=();
for ictr IN 1 SEQTO COUNT OF OBjrs do
problem_member := OBjrs[ictr].ShortName ;
if problem_member NOT IN (Problems_List) then
missing_problems_list := missing_problems_list,problem_member ;
endif; //if problem_member NOT IN(Problems_List)
enddo; // for problem_member IN Problems_List
Count_Of_Missing_Problems := COUNT OF missing_problems_list ;
if Count_Of_Missing_Problems > count_prob_obs then
Count_Of_Missing_Problems := count_prob_obs ;
endif; // if Count_Of_Missing_Problems > 10 then
for ictr IN 1 SEQTO Count_Of_Missing_Problems do
target_parameter_name := empty_target_parameter_name_list[ictr];
newValue := missing_problems_list[ictr];
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, target_parameter_name,(newValue, REPLACE_APPEND) );
enddo;
ENDIF; //if exist OBjrs THEN SCH_MDPN_AP_Copy
// Call Launch Problem List Builder Section
elseif current_value = button_i and hi_sql_list_i = "Launch Problem Selector"
then
LaunchProblemSelectorMLM := MLM {{{SINGLE-QUOTE}}}Doc_Func_Launch_Progress_Notes_Problem_List_Builder{{{SINGLE-QUOTE}}};
this_documentCommunication := CALL LaunchProblemSelectorMLM WITH (this_documentCommunication,button_i );
// Copy Last Saved Note Section
elseif current_value = button_i and hi_sql_list_i = "<LAST NOTE>" then
// Find last document authored by a user with the same discipline as the current user
// ** 08.27.2012 CSR# 30963 DW commented out prior document name fiter (we need to pull the data element from any document)
// 09/14/2016 HD# 2198672 - We found that the change above opened the SQL to pulling SNs and FSs that had no problems. I listed the documents that have problems
(last_document_guid):= read last
{ " SELECT TOP 1 CD.GUID "
|| " FROM CV3ClientDocument CD with (nolock)"
|| " Join CV3User u with (nolock) on u.guid = CD.UserGUID "
|| " Join CV3CareProvider cp with (nolock) on cp.GUID = u.GUID "
|| " WHERE CD.ClientGUID = " || sql(client_GUID)
|| " AND CD.ClientVisitGUID = " || sql(client_visit_GUID)
|| " AND CD.ChartGUID = " || sql(client_chart_GUID)
// || " AND CD.DocumentName like {{{SINGLE-QUOTE}}}" || document_name || "%{{{SINGLE-QUOTE}}} "
|| " and ( cd.DocumentName like {{{SINGLE-QUOTE}}}History and Physical%{{{SINGLE-QUOTE}}} or cd.DocumentName like {{{SINGLE-QUOTE}}}Day of Discharge Summary eNote%{{{SINGLE-QUOTE}}} or cd.DocumentName like {{{SINGLE-QUOTE}}}Consult eNote%{{{SINGLE-QUOTE}}} or cd.DocumentName like {{{SINGLE-QUOTE}}}Physician Progress Note%{{{SINGLE-QUOTE}}} ) "
|| " AND CD.Active = 1 "
|| " AND cp.discipline = " || sql(user_discipline)
|| " ORDER BY CD.Entered DESC "
};
parameter_name_list := problem_name_list, ass_plan_name_list;
sql_parameter_name_list :=();
for parameter_name IN parameter_name_list DO
sql_parameter_name_list := sql_parameter_name_list , sql(parameter_name);
enddo;
// Find data on last document authored by a user with the same discipline as the current user
(ObsName,ValueText) := read
{" SELECT OCMI.Name, sp.ValueText"
||" FROM SXACDObservationParameter sp with (nolock) "
|| " Inner Join CV3ObsCatalogMasterItem OCMI with (nolock) "
|| " ON OCMI.Guid = sp.ObsMasterItemGUID "
|| " join CV3Observation o with (nolock) on o.GUID = sp.ObservationGUID "
|| " join CV3User u with (nolock) on u.guid = o.UserGUID "
|| " join CV3CareProvider cp with (nolock) on cp.GUID = u.GUID "
|| " WHERE sp.clientguid = " || sql(client_GUID)
|| " AND sp.ChartGUID = " || sql(client_chart_GUID)
|| " AND sp.ClientVisitGUID = " || sql(client_visit_GUID)
|| " AND sp.OwnerGUID = " || sql(last_document_guid)
|| " AND OCMI.Name IN(" || sql_parameter_name_list ||")"
};
// If Prior Notes are found on the document, then write them
if exists ObsName then
// DW 03.19.2015 CSR# 32616 (Clinical Documentation Specialist) - This routine was re-written copy the probs/plans are copied into the open fields
/* Routine disabled - DW 03.19.2015 CSR# 32616
// This routine blanks out the 14 Problem and Plan fields
FOR target_parameter_name IN parameter_name_list DO
newValue := "";
this_documentCommunication := CALL WriteToNote_MLM WITH (this_documentCommunication, target_parameter_name,(newValue, REPLACE_APPEND) );
ENDDO;
*/
// Find the number value of the first open problem field
firstopenfield := 0;
for openctr IN 1 SEQTO 14 DO
fieldname := "SCH_MDPN_Problem " || openctr;
theParameter := first of (this_parameters where this_parameters.Name = fieldname );
theObservation:= first of (this_observations where this_observations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null and firstopenfield = 0
then
firstopenfield := openctr;
endif;
enddo;
for ictr IN 1 SEQTO COUNT OF ObsName DO
target_parameter_name := ObsName[ictr];
// Gather the last character (or last 2 chars if >=10) of the field name to be copied in
fldlength := length(target_parameter_name);
nexttolast := SUBSTRING 1 CHARACTERS STARTING AT (fldlength -1) FROM target_parameter_name;
if nexttolast = " " or nexttolast = "0"
then suffix := SUBSTRING 1 CHARACTERS STARTING AT (fldlength) FROM target_parameter_name as number;
else suffix := SUBSTRING 2 CHARACTERS STARTING AT (fldlength -1) FROM target_parameter_name as number;
endif;
newsuffix := suffix + firstopenfield -1; // Add the last character(s) of the field name to the # of the first open field
// Create the new field name to be copied into (these are the blank fields)
if target_parameter_name matches pattern "SCH_MDPN_Problem%"
then
target_parameter_name := "SCH_MDPN_Problem " || newsuffix;
else
if newsuffix <= 9
then
target_parameter_name := "SCH_MDPN_Assessment / Plans 0" || newsuffix;
else
target_parameter_name := "SCH_MDPN_Assessment / Plans " || newsuffix;
endif;
endif;
// Write to the fields
if ValueText[ictr] is not null then
newValue := ValueText[ictr] || " ";
this_documentCommunication := CALL WriteToNote_MLM WITH (this_documentCommunication, target_parameter_name,(newValue, REPLACE_APPEND) );
endif;
enddo; // for ictr IN 1 SEQTO COUNT OF ObsName
////
endif; // If Prior Notes are found on the document
// Find "Dispostion - Discharge Plan" on last document authored by a user with the same discipline as the current user
if exists ValueText then
(ValueText) := read
{" SELECT sp.ValueText "
||" FROM SXACDObservationParameter sp with (nolock) "
|| " Inner Join CV3ObsCatalogMasterItem OCMI with (nolock) "
|| " ON OCMI.Guid = sp.ObsMasterItemGUID "
|| " join CV3Observation o with (nolock) on o.GUID = sp.ObservationGUID "
|| " join CV3User u with (nolock) on u.guid = o.UserGUID "
|| " join CV3CareProvider cp with (nolock) on cp.GUID = u.GUID "
|| " WHERE sp.clientguid = " || sql(client_GUID)
|| " AND sp.ChartGUID = " || sql(client_chart_GUID)
|| " AND sp.ClientVisitGUID = " || sql(client_visit_GUID)
|| " AND sp.OwnerGUID = " || sql(last_document_guid)
|| " AND OCMI.Name = {{{SINGLE-QUOTE}}}SCH_MDPN_DischargePlan{{{SINGLE-QUOTE}}} "
};
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, "SCH_MDPN_DischargePlan",(ValueText, REPLACE_APPEND) );
endif;
// Clear All fields Section
elseif current_value = button_i and hi_sql_list_i = "<Clear All>" then
current_index :=1;
max_index := count_prob_obs;
for i in 1 seqto (max_index ) do
next_prob_parm_name := problem_name_list[current_index];
next_ap_parm_name := ass_plan_name_list[current_index];
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, next_prob_parm_name,("", REPLACE_APPEND) );
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, next_ap_parm_name,("", REPLACE_APPEND) );
current_index := current_index + 1;
enddo;
endif; // Copy Buttons Rules by Type Section
enddo; // Parse Copy Buttons Section
endif; // Copy Buttons Section
//uncomment for debugging:
/* msg := msg
||"\nFINAL:2"
||"\nlast_prob_index = " || last_prob_index
||"\nlast_prob_name = " || last_prob_name
||"this_ChartedObservationsList.valueObj.Value "
|| this_ChartedObservationsList.valueObj.Value || "\n\n"
||"PN_sel_list = "|| PN_sel_list || "\n\n"
||"current_parameter.configurationobj.listguid = "
|| current_parameter.configurationobj.listguid
||"\n\ncurrent_value = "|| current_value
|| "\n\nnewValue = " || newValue || "\n\n"
||"this_documentCommunication.CurrentObservationObj.ValueObj.ListItemsList = "
||this_documentCommunication.CurrentObservationObj.ValueObj.ListItemsList.records__
|| "\n\n"
|| "Problems_List " || Problems_List|| "\n\n"
|| "missing_problems_list " || missing_problems_list || "\n\n"
|| "Count_Of_Missing_Problems = " || Count_Of_Missing_Problems
|| "\nempty_target_parameter_name_list "
|| empty_target_parameter_name_list || "\n\n"
|| "this_Parameters.Name " || this_Parameters.Name
;
*/
if msg <> "" then //display message to user
this_documentCommunication.DisplayMessage := true;
this_documentCommunication.Message := msg;
endif;
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,236 @@
maintenance:
title: DOC_ACS_Progress_Note_Daily_Assessment_Plan_Review ;;
mlmname: DOC_ACS_Progress_Note_Daily_Assessment_Plan_Review ;;
arden: version 2.5;;
version: 5.50;;
institution: RPM, Sample Document Called MLM;;
author: Rick Mansour, MD ;;
specialist: Allscripts Custom Services;;
date: 2011-01-16;;
validation: testing;;
library:
purpose: Standardize the document mlm responsible for initiation.
The 5.2 version adds in the CoSigner1, CoSigner2 and the DocumentTopic
20111115 ACS: MLM adapted for use at St. Clair Hospital
2019.07.30 JML Modified SQL logic so plan and problems will show in note
;;
explanation: none
;;
keywords: RTF, Document Called MLM , list
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
/*******************Make Changes To Spelling And Flags In This Section******************/
// THIS IS THE ONLY SECTION OF THIS MLM THAT REQUIRES CHANGES //
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
// Put the list of alternating HISTORICAL problems and plans in this list for lookup
CF_Parameter_Name_List :=
("SCH_MDPN_Problem 1", "SCH_MDPN_Assessment / Plans 01",
"SCH_MDPN_Problem 2", "SCH_MDPN_Assessment / Plans 02",
"SCH_MDPN_Problem 3", "SCH_MDPN_Assessment / Plans 03",
"SCH_MDPN_Problem 4", "SCH_MDPN_Assessment / Plans 04",
"SCH_MDPN_Problem 5", "SCH_MDPN_Assessment / Plans 05",
"SCH_MDPN_Problem 6", "SCH_MDPN_Assessment / Plans 06",
"SCH_MDPN_Problem 7", "SCH_MDPN_Assessment / Plans 07",
"SCH_MDPN_Problem 8", "SCH_MDPN_Assessment / Plans 08",
"SCH_MDPN_Problem 9", "SCH_MDPN_Assessment / Plans 09",
"SCH_MDPN_Problem 10", "SCH_MDPN_Assessment / Plans 10",
"SCH_MDPN_Problem 11", "SCH_MDPN_Assessment / Plans 11",
"SCH_MDPN_Problem 12", "SCH_MDPN_Assessment / Plans 12",
"SCH_MDPN_Problem 13", "SCH_MDPN_Assessment / Plans 13",
"SCH_MDPN_Problem 14", "SCH_MDPN_Assessment / Plans 14"
);
/* ("LargeTextRTF",
"Problem_1","Assessment_Plan_1",
"Problem_2","Assessment_Plan_2",
"Problem_3","Assessment_Plan_3",
"Problem_4","Assessment_Plan_4",
"Problem_5","Assessment_Plan_5",
"Problem_6","Assessment_Plan_6",
"Problem_7","Assessment_Plan_7",
"Problem_8","Assessment_Plan_8",
"Problem_9","Assessment_Plan_9",
"Problem_10","Assessment_Plan_10");
*/
// Target text observation that this MLM will write to
target_parameter_name := "SCH_MDPN_AP_Review FT"; //"Progress_Note_Assessment_Plan";
// THIS FLAG CONTROLS THE DEBUG MESSAGE
displayMessageFlag := FALSE ;
/********************************END OF CHANGES******************************************/
// Variable and Constant Declaration
WriteToNote_MLM := MLM {{{SINGLE-QUOTE}}}STD_DOC_FUNC_CHART_OBSERVATION_HELPER_JAB{{{SINGLE-QUOTE}}};
//{{{SINGLE-QUOTE}}}Called_RPM_DOM_MLM{{{SINGLE-QUOTE}}};
newValue:= "" ;
sugg_txt_value:="";
REPLACE_APPEND := "Replace";
THIS_MLM_NAME:= "DOC_ACS_Progress_Note_Daily_Assessment_Plan";
//Section 1 Gather Document and Observation Info DO NOT CHANGE THIS SECTION !!!!!!!!!!! //
Get_Variable_Values := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
// this mlm will assign values to the document objects.
(this_documentCommunication,
client_guid, client_visit_guid, client_chart_guid,
user_guid, document_type, document_name,
event_type, configuration_guid, this_currentObj,
CancelEventFlag, this_structuredNoteDoc, authored_date_time,
authored_by_guid, client_document_guid, document_date_time,
isNewFlag, isIncompleteFlag, isResultsPendingFlag,
isPriorityFlag, this_parameters, this_chartedObservationsList,
this_parameters_display_name, current_parameter,
current_parameter_name, current_parameter_guid, current_parameter_DataType,
selectedItems, selectedItems_value, current_value,
diagnosticMessage, displayMessageFlag, CoSigner1,
CoSigner2, DocumentTopic)
:= CALL Get_Variable_Values WITH (this_documentCommunication);
//DO NOT CHANGE THE ABOVE SEQUENCE. IT MATCHES THE SEQUENCE IN THE CALLED MLM !!!!!!!! //
// In this section of the MLM the newValue should be determined through logic
// or SQL retrieved data or calling another mlm for the return value
// Make CF_Parameter_Name_List work with IN Operatore in the SQL Statement
// Following code inserts an apostrophe inside the quotes ie "{{{SINGLE-QUOTE}}}Problem_1{{{SINGLE-QUOTE}}}"
SQL_Parameter_Name_List:=();
FOR CF_Parameter_Name IN CF_Parameter_Name_List DO
SQL_Parameter_Name_List := (SQL_Parameter_Name_List,sql(CF_Parameter_Name));
ENDDO;
// CHANGE THE THREE VARIABLE ASSIGNMENTS ABOVE TO MAKE THIS WORK ON THE HANDOFF NOTE //
if called_by_editor then
(client_guid, client_visit_guid, client_chart_guid) := read last
{ClientVisit:clientguid, GUID, chartguid};
current_value := 3 ; //radio button val = 1 - LAST note problems
Document_Name := "Physician Progress Note"; //"Progress Note - Daily";
endif;
// Get the historical documents that match the current document
(document_guids_list,authored_provider_guids_list, AuthoredDtm_list):=Read
{" SELECT GUID, AuthoredProviderGUID, AuthoredDtm "
|| " FROM CV3ClientDocument "
|| " WHERE ClientGUID = " || sql(client_GUID)
|| " AND ChartGUID = " || sql(client_chart_GUID)
|| " AND ClientVisitGUID = " || sql(client_visit_GUID)
// || " AND DocumentName = " || sql(Document_Name)
|| " AND DocumentName like ({{{SINGLE-QUOTE}}}%{{{SINGLE-QUOTE}}} + " || sql( Document_Name ) || " + {{{SINGLE-QUOTE}}}%{{{SINGLE-QUOTE}}})"
|| " ORDER BY AuthoredDtm DESC "
};
IF EXIST document_guids_list THEN // there are historical matching docs
document_guids_list_count := COUNT OF document_guids_list;
current_value := current_value AS number; // radio button choice (1,2,3,...etc)
if current_value <= document_guids_list_count and current_value > 0 then
// Get the historical document that correspondes to the user{{{SINGLE-QUOTE}}}s choice
target_document_guid := document_guids_list[current_value] ;
authored_provider_guid := authored_provider_guids_list[current_value];
authoredDtm := AuthoredDtm_list[current_value];
// Get the author{{{SINGLE-QUOTE}}}s information and create the preface
(first_name,last_name):= read last
{" SELECT FirstName, LastName "
||" FROM CV3User "
||" WHERE GUID = " || sql(authored_provider_guid)};
PAP_Value := "Assessment Entered By " ||first_name || " "
|| last_name || " Entered Date: " || authoredDtm || "\n\n" ;
// Create an object for holding the problem information
recordset_object := Object [ Name, Description, ValueText ];
// get the list of historical problem(s) on the chosen note
objrs := read AS recordset_object
{" SELECT OCMI.Name, OCMI.Description, O.ValueText "
|| " FROM CV3ClientDocument CD "
|| " JOIN SXACDObservationParameter sp " //this is the new table in 5.5
|| " ON CD.ClientGUID = sp.ClientGUID "
|| " and CD.ChartGUID = sp.ChartGUID "
|| " and sp.OwnerGUID = cd.guid " //IMPORTANT limiter condition!
|| " and CD.PatCareDocGUID = sp.PatCareDocGUID "
// || " JOIN CV3ObservationDocument OD "
// || " on OD.ObservationDocumentGUID = sp.ObservationDocumentGUID "
// || " ON OD.OwnerGUID = CD.GUID "
|| " JOIN CV3Observation o "
|| " ON sp.observationGUID = o.guid "
|| " JOIN CV3ObsCatalogMasterItem OCMI "
|| " ON OCMI.GUID = sp.ObsMasterItemGUID "
// || " ON OCMI.Guid = OD.ObsMasterItemGUID "
|| " WHERE CD.ClientGUID = " || sql(client_guid)
|| " AND CD.ChartGUID = " || sql(client_chart_guid)
|| " AND CD.GUID = " || sql(target_document_guid)
|| " AND OCMI.Name IN(" || SQL_Parameter_Name_List || ")"
|| " AND CD.Active = 1 "
// || " AND OD.Active = 1 "
|| " AND O.VAlueTExt IS NOT NULL "
};
// Loop to rearrange the problems according to the original list
FOR ictr IN 1 SEQTO COUNT OF CF_Parameter_Name_List DO
temp_data := NEW recordset_object;
temp_data := (objrs WHERE objrs.Name = CF_Parameter_Name_List[ictr]);
// Prepare the Text for output in the current note
if exists temp_data[1].Description then
if temp_data[1].Description matches pattern "%problem%" then
// this is for a PROBLEM
PAP_Value := PAP_Value || "\b1 " || temp_data[1].ValueText || "\b0 \n";
else // this is for a PLAN
PAP_Value := PAP_Value || temp_data[1].ValueText || "\n";
endif;
endif; // exists temp_data[1].Description
ENDDO; // FOR ictr IN 1 SEQTO COUNT OF CF_Parameter_Name_List DO
newValue := PAP_Value;
else // user radio button choice is greater than # of historical matching docs
newValue :="There is no assessment and plan for this number " || current_value ;
endif; //if current_value <= list_count and current_value > 0 AND ...
ENDIF; // IF EXIST document_guids_list THEN
if exists newValue and exists target_parameter_name then
// This section calls the MLM to populate the observation object.
// It should be repeated each time an observation is poopulated.
// It will not work in a loop //
this_documentCommunication := CALL WriteToNote_MLM
WITH (this_documentCommunication, target_parameter_name,newValue,
// sugg_txt_value,REPLACE_APPEND);
REPLACE_APPEND);
endif;
//////////////////////////////////////////////////////////////////////////
// If the state of note the isIncomplete, isPriority and isResultsPending
// need to be changed in the note//
// set one or more of these flags := TRUE//
// isIncompleteFlag := TRUE ;
// isResultsPendingFlag := TRUE ;
// isPriorityFlag := TRUE ;
//////////////////////////////////////////////////////////////////////////
// This code sets the checkboxes to checked or unchecked.
// DO NOT CHANGE THIS CODE BELOW
this_structuredNoteDoc.IsIncomplete := isIncompleteFlag ;
this_structuredNoteDoc.IsResultsPending := isResultsPendingFlag ;
this_structuredNoteDoc.IsPriority := isPriorityFlag ;
// ThE ABOVE code sets the checkboxes to checked or unchecked.
// DO NOT CHANGE THIS CODE ABOVE
// The code below will display the diagnosticMessage Varaible if
// the displayMessageFlag is set to TRUE
this_documentCommunication.DisplayMessage := displayMessageFlag;
// this_documentCommunication.Message :=
// "MLM Name : " || THIS_MLM_NAME || "\n\n" ||diagnosticMessage ;
this_documentCommunication.Message := newValue || " goes into "
|| target_parameter_name ;
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,185 @@
maintenance:
title: DOC_ACS_Reciprocal_Multi_Select ;;
mlmname: DOC_ACS_Reciprocal_Multi_Select ;;
arden: version 2.5;;
version: 5.50;;
institution: RPM, Sample Document Called MLM;;
author: Rick Mansour and Allscripts Custom Services;;
specialist: ;;
date: 2011-07-16;;
validation: testing;;
library:
purpose: Demonstrate the ability to select a list if the first item "all" is selected
Deselect the list if all items are selected and "all" is selected
Reciprocating relationship between two lists with a name relationship
;;
explanation:
It is common for sites to create two lists with the same list values- one to chart
the patient has that symptom (+) and one to document the patient does not have that
symptom (-). Charting the same item in both lists would result in the document
saying the patient both has and doesnt have the symptom. This MLM will be used
across two lists to ensure that contradicting values do not get charted.
If a contradicting value is individually selected, then the first item will be
unselected. HOWEVER if the entire list is selected with a select all type function
then the list member will be skipped if the reciprocal already checked on the
reciprocal list.
"all" is the first member of each list. If all is checked the the entire list is
checked except "all" and any members of the opposite list that are checked.
If "all" is checked when all other members of the list are already checked then
the mlm sets the list to all unchecked.
this mlm assumes a naming convention:
1. "ros_gi_pos"/"ros_gi_neg" are reciprical pairs"
2. "ros_gi_" is the root of both parameter names
3. "neg" and "pos" are the variable parts of the paired opposites list.
4. the list members are the same in "list value"
5. for readability of the note the "cell value" in the pos list is in UPPERCASE
This assumption makes this a generic mlm. An alternative if to use an if then else
statement to finds named pairs.
;;
keywords: RTF, Document Called MLM , list, multi-select
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
// CALLED MLMS used by this mlm
WriteToNote := MLM {{{SINGLE-QUOTE}}}STD_DOC_FUNC_CHART_OBSERVATION_HELPER_JAB{{{SINGLE-QUOTE}}}; // {{{SINGLE-QUOTE}}}CALLED_RPM_DOM_MLM{{{SINGLE-QUOTE}}};
// get_Object := MLM{{{SINGLE-QUOTE}}}CALLED_RETURN_OBJECT{{{SINGLE-QUOTE}}};
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
/***************************************************************************************/
//*** Variable and Constant Declaration ***//
//The following variables are references to various points in the
//DocumentCommunication object model.
//
(this_structuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList;
(this_parameters) := this_structuredNoteDoc.ParametersList;
// this_documentCommunication.CurrentObservationObj is the observation that changed
// and trigered the mlm. It shares a parameterguid with its Parameter (a member of
// the observation catalog)
this_currentObj := this_documentCommunication.CurrentObservationObj;
parameter := FIRST OF (this_Parameters
WHERE this_parameters.ParameterGUID = this_CurrentObj.ParameterGUID);
parameter_name := parameter.name ;
parameter_guid := parameter.ParameterGuid ;
// Object needed to declare in the calling the above MLM (for listitems only)
SelectedList := OBJECT[ ListGUID, SelectedValues, SuggestiveText];
if called_by_editor then
parameter_name := "ros_rpm_gi_pos" ;
endif;
// This code determines the recirpocal paramter name
IF UPPERCASE parameter_name MATCHES PATTERN "%POS%" THEN
reciprocal_parameter_name := (SUBSTRING (FIND "POS"
IN STRING UPPERCASE parameter_name)-1 CHARACTERS FROM STRING parameter_name)
|| "neg";
ELSEIF UPPERCASE parameter_name MATCHES PATTERN "%NEG%" THEN
reciprocal_parameter_name := (SUBSTRING (FIND "NEG"
IN STRING UPPERCASE parameter_name)-1 CHARACTERS FROM STRING parameter_name)
|| "pos";
ENDIF;
//Get the parameter(s) and observations
curr_param := first of (this_parameters where this_parameters.name = parameter_name );
recip_param := first of (this_parameters
where this_parameters.name = reciprocal_parameter_name );
reciprocal_obs := FIRST OF (this_ChartedObservationsList
WHERE this_ChartedObservationsList.parameterGUID = recip_param.parameterGUID);
curr_obs:= FIRST OF (this_ChartedObservationsList
WHERE this_ChartedObservationsList.parameterGUID = curr_param.parameterGUID);
//Get the ListConfiguration object of the parameter
currentObj_parameterObj := curr_param.configurationobj;
// currentObj_parameterObj := CALL get_Object WITH (this_documentCommunication,parameter_name);
//get the selected items
currentObj_selected_items := (this_currentObj.valueobj.listitemslist.value
where this_currentObj.valueobj.listitemslist.isselected = true);
// currentObj_selected_items := currentObj_parameterObj.Obs_SelectedListValues;
reciprocal_selected_items := (reciprocal_obs.valueobj.listitemslist.value
where reciprocal_obs.valueobj.listitemslist.isselected = true);
// reciprocal_parameterObj := CALL get_Object
// WITH (this_documentCommunication,reciprocal_parameter_name) ;
// reciprocal_selected_items := reciprocal_parameterObj.Obs_SelectedListValues;
/////////////////////////////////////////////////////////////////////////////////////////////////////
count_current_config_items := (count of currentObj_parameterObj.listitemslist.value)
// count_current_config_items := (count of currentObj_parameterObj.ConfigurationObjValues)
AS NUMBER ;
count_current_selected_items := (count of currentObj_selected_items) AS NUMBER ;
newValue :=(); // initialize list of items for selection
PN_sel_list := NEW SelectedList; //instantiate NewValue for ListItems
IF "all" IN currentObj_selected_items THEN
if count_current_selected_items = count_current_config_items then
newValue := ""; //no need to select any more list items
else
for item IN currentObj_parameterObj.listitemslist.value do
// for item IN currentObj_parameterObj.ConfigurationObjValues do
if item <> "all" and item NOT IN reciprocal_selected_items then
newValue := newValue, item ;
endif; // if item <> "all" and item NOT IN reciprocal_selected_items
enddo; // for item IN currentObj_parameterObj.listitemslist.value
endif; // if count_current_selected_items = count_current_config_items
// create the selection list for helper MLM
PN_sel_list.ListGUID := currentObj_parameterObj.listguid; //guid for list
list_name := parameter_name;
ELSE // IF "all" NOT IN currentObj_selected_items THEN
for item IN reciprocal_selected_items do
if item <> "all" and item NOT IN currentObj_selected_items then
newValue := newValue, item ;
endif; // if item <> "all" and item NOT IN reciprocal_selected_items
enddo; // for item IN reciprocal_selected_items
// create the selection list for helper MLM
PN_sel_list.ListGUID := recip_param.configurationobj.listguid;
list_name := reciprocal_parameter_name;
ENDIF; //if "all" IN currentObj_selected_items then
PN_sel_list.SelectedValues := newvalue; //value to select
PN_sel_list.SuggestiveText := null; //optional text
if exists newvalue then //limit updates, otherwise copyforward will not work properly!
this_documentCommunication := CALL WriteToNote
WITH (this_documentCommunication, list_name ,
PN_sel_list);
// newValue,"","");
endif;
// uncomment for debugging
/* sMessage := parameter_name
|| "\nnewvalue = " || newvalue
|| "\ncurrentObj_selected_items = " || currentObj_selected_items.records__
||"\nPN_sel_list = " || PN_sel_list
|| "\nreciprocal_selected_items = " || reciprocal_selected_items.records__
;
//Tell DocumentCommunication to Display the Message
this_documentCommunication.DisplayMessage := TRUE;
this_documentCommunication.Message := sMessage ;
*/
////////////////////////////////////////////////////////////////////////////////////////////////////
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,66 @@
maintenance:
title: DOC_ADULT_ASSESSMENT_CLOSE;;
mlmname: DOC_ADULT_ASSESSMENT_CLOSE;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Juliet M. Law;;
specialist: ;;
date: 2011-09-02;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
09.02.2011 JML Created; copied from DOC_MD_PROGRESSNOTE
03.03.2015 JML CSR 32519: Changed MLM name for braden risk.
4.29.2016 STH CSR#: 33207: Added call to new MLM DOC_FUNC_IV_HALDOL_STATUSBOARD used for status board column update of IV Haldol given within last 24hrs. {Go-Live 6/1/2016}
08.01.2017 SAcharya CSR# 35187: Added call to new MLM "DOC_SCH_CREATE_ORDER_DECREASE_FUNCTION" which will generate "Decrease Function" Order. (Go-Live 08/22/2017)
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Receive arguments from the flowsheet
(thisDocumentCommunication) := argument;
DocBradenScaleAlert := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_BRADEN_SCALE_CHANGE_ALERT{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocBradenScaleAlert WITH thisDocumentCommunication;
(thisDocumentCommunication) := argument;
// Call MLM to determine if Braden Calculated Value deems a Dietitian Consult Order created.
DocBradenObs := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_CREATE_DIETITIAN_CONSULT_FROM_ADULT_ASSESS_OBS{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocBradenObs WITH thisDocumentCommunication;
//Reset to receive arguments from the flowsheet
(thisDocumentCommunication) := argument;
// Call MLM to determine if a dressing change order needs created
DocDressingObs := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocDressingObs WITH thisDocumentCommunication;
//Call MLM to update status board IV Haldol dosage amount when charting the cardiac rhythm
IVHaldolStatusBoardUpdate := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_IV_HALDOL_STATUSBOARD{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL IVHaldolStatusBoardUpdate WITH thisDocumentCommunication;
//Call MLM to create Order "Decrease Function" Order
DecreaseFunctionOrder := MLM {{{SINGLE-QUOTE}}}DOC_SCH_CREATE_ORDER_DECREASE_FUNCTION{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DecreaseFunctionOrder WITH thisDocumentCommunication;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,66 @@
maintenance:
title: DOC_ADULT_ASSESSMENT_OPEN;;
mlmname: DOC_ADULT_ASSESSMENT_OPEN;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Juliet M. Law;;
specialist: ;;
date: 2014-03-24;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
03.24.2014 JML Created; copied from DOC_ADULT_ASSESSMENT_CLOSE
01.25.2016 JML CSR 33953: Call MLM on flowsheet close to alert if catheter risk not charted.
05.10.2016 DJW CSR#34412 Advance Directive Follow Up
02.17.2017 STH CSR#: 35129 - ADDED CALL TO DOC_FUNC_HEP_C_SCREENING
10.23.2017 jml CSR# 26413: Call to DOC_FUNC_POLST_FOLLOWUP_CHARTING_REMINDER
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Receive arguments from the flowsheet
(thisDocumentCommunication) := argument;
// Call MLM to determine if a dressing change order needs created
Doc_Anticoag_Platelet_Alert := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_ANTICOAG_PLATELET_ALERT{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL Doc_Anticoag_Platelet_Alert WITH thisDocumentCommunication;
Doc_VTE_Override := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_VTE_PHYSICIAN_OVERRIDE{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL Doc_VTE_Override WITH thisDocumentCommunication;
//Call MLM to alert on urinary catheter risk assessment
DocCatheterRiskObs := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_URINARY_CATHETER_CHART_ALERT{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocCatheterRiskObs WITH thisDocumentCommunication;
//Call MLM to alert on advance directive follow up
DocAdvDirFollowup := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_ADVANCE_DIRECTIVE_FOLLOWUP_CHARTING_REMINDER{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocAdvDirFollowup WITH thisDocumentCommunication;
//Call MLM to alert on POLST follow up
DocPOLSTFollowUp := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_POLST_FOLLOWUP_CHARTING_REMINDER{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocPOLSTFollowUp WITH thisDocumentCommunication;
(thisDocumentCommunication) := argument;
HepScreen := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_HEP_C_SCREENING{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL HepScreen with thisDocumentCommunication;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,141 @@
maintenance:
title: DOC_BIPAP_CPAP ;;
mlmname: DOC_BIPAP_CPAP ;;
arden: version 2.5;;
version: 6.00;;
institution: St. Clair Hospital ;;
author: Shivprasad Jadhav;;
specialist: Shubha Rai;;
date: 2015-11-16;;
validation: testing;;
library:
purpose: When BiPAP or CPAP is selected, auto select the instruction to patient to bring in home device in [Adult Patient Profile], [Pediatric Patient Profile],[OB Patient Profile];;
explanation:
Change History
-------------------------------------------------
18-11-2015 GOS MLM Created CSR :33757- BIPAP/CPAP change in [Adult Patient Profile],[Adult Patient Profile-Behavirol Health],
[Pediatric Patient Profile],[OB Patient Profile]
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
// Extract interesting parts of the object model
DocumentName := this_documentCommunication.DocumentName ;
(thisStructuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
(UserGUID) := this_documentCommunication.UserGUID ;
(this_curr_valobj) := this_currentObs.valueobj;
// Get the client and visit GUIDs
clientGuid := this_documentCommunication.ClientGUID;
visitGuid := this_documentCommunication.ClientVisitGUID;
chartGuid := this_documentCommunication.ChartGUID;
Client_Document_GUID := this_FS_doc.ClientDocumentGUID;
//z:=thisParameters.Records__;
If ( DocumentName = "Adult Patient Profile" ) or ( DocumentName = "Adult Patient Profile - Behavioral Health" ) Then
this_parametername := first of (thisParameters where thisParameters.Name = "PRO resp device");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = this_parametername.ParameterGUID);
If true in (theObservation.ValueObj.ListItemsList.IsSelected where
theObservation.ValueObj.ListItemsList.Value = "BiPAP..." ) then chronic := "BIPAP";
Endif;
If chronic Is Null Then
If true in (theObservation.ValueObj.ListItemsList.IsSelected where
theObservation.ValueObj.ListItemsList.Value = "CPAP..." ) then chronic := "CPAP";
Endif;
EndIf;
If chronic in ("BIPAP","CPAP") Then
MLM_DIPA := MLM {{{SINGLE-QUOTE}}}UTIL_OBJECT_Customize_DIPA_MLM{{{SINGLE-QUOTE}}};
prm_Resp_Device := First of (thisParameters where thisParameters.Name = "SCH_resp home device instruction");
Var1 := "Instructed patient to bring in home device.";
If exists Var1 then
Obs_Comf_Vi := CALL MLM_DIPA WITH this_DocumentCommunication,prm_Resp_Device, Var1 as string ;
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList,Obs_Comf_Vi );
Endif;
Endif;
ElseIf DocumentName = "Pediatric Patient Profile" Then
this_parametername := first of (thisParameters where thisParameters.Name = "PRO resp device peds");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = this_parametername.ParameterGUID);
If true in (theObservation.ValueObj.ListItemsList.IsSelected where
theObservation.ValueObj.ListItemsList.Value = "BiPAP..." ) then chronic := "BIPAP";
Endif;
If chronic Is Null Then
If true in (theObservation.ValueObj.ListItemsList.IsSelected where
theObservation.ValueObj.ListItemsList.Value = "CPAP..." ) then chronic := "CPAP";
Endif;
EndIf;
If chronic in ("BIPAP","CPAP") Then
MLM_DIPA := MLM {{{SINGLE-QUOTE}}}UTIL_OBJECT_Customize_DIPA_MLM{{{SINGLE-QUOTE}}};
prm_Resp_Device := First of (thisParameters where thisParameters.Name = "SCHCK_PRO resp home device ped");
Var1 := "Instructed patient to bring in home device.";
if exists Var1 then
Obs_Comf_Vi := CALL MLM_DIPA WITH this_DocumentCommunication,prm_Resp_Device, Var1 as string ;
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList,Obs_Comf_Vi );
Endif;
Endif;
ElseIf DocumentName = "OB Patient Profile" Then
this_parametername := first of (thisParameters where thisParameters.Name = "PRO resp device ob");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = this_parametername.ParameterGUID);
If true in (theObservation.ValueObj.ListItemsList.IsSelected where
theObservation.ValueObj.ListItemsList.Value = "BiPAP..." ) then chronic := "BIPAP";
Endif;
If chronic Is Null Then
If true in (theObservation.ValueObj.ListItemsList.IsSelected where
theObservation.ValueObj.ListItemsList.Value = "CPAP..." ) then chronic := "CPAP";
Endif;
EndIf;
If chronic in ("BIPAP","CPAP") Then
MLM_DIPA := MLM {{{SINGLE-QUOTE}}}UTIL_OBJECT_Customize_DIPA_MLM{{{SINGLE-QUOTE}}};
prm_Resp_Device := First of (thisParameters where thisParameters.Name = "SCHCK_PRO resp home device OB");
Var1 := "Instructed patient to bring in home device.";
if exists Var1 then
Obs_Comf_Vi := CALL MLM_DIPA WITH this_DocumentCommunication,prm_Resp_Device, Var1 as string ;
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList,Obs_Comf_Vi );
Endif;
Endif;
EndIf;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

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:

View File

@@ -0,0 +1,56 @@
maintenance:
title: DOC_BIPAP_CPAP_UNIVERSAL ;;
mlmname: DOC_BIPAP_CPAP_UNIVERSAL;;
arden: version 2.5;;
version: 1.00;;
institution: St.Clair Hospital;;
author: Sandy Zhang ;;
specialist: Debbie Eiler ;;
date: 2017-06-12;;
validation: testing;;
library:
purpose: calls MLMs below when any of the {{{SINGLE-QUOTE}}}Respiratory Device/Implant{{{SINGLE-QUOTE}}} checkbox options are modified
attached to: 1) {{{SINGLE-QUOTE}}}KBC Adult Patient Profile 2.0{{{SINGLE-QUOTE}}}
2) Adult Patient Profile - Behavioral Health
3) KBC OB Patient Profile 2.0
and attribute {{{SINGLE-QUOTE}}}! REVIEW OF SYSTEMS (Prior to Admission){{{SINGLE-QUOTE}}} -> {{{SINGLE-QUOTE}}}PRO Respiratory QA{{{SINGLE-QUOTE}}} -> {{{SINGLE-QUOTE}}}PRO resp device{{{SINGLE-QUOTE}}}
and attribute {{{SINGLE-QUOTE}}}Review of Systems (Prior to Admission){{{SINGLE-QUOTE}}} -> {{{SINGLE-QUOTE}}}PRO Respiratory OB QA{{{SINGLE-QUOTE}}} -> {{{SINGLE-QUOTE}}}PRO resp device ob{{{SINGLE-QUOTE}}}
;;
explanation:
Change History
06.12.2017 SZ CSR# 35226 BiPAP and CPAP Health Issue and Respiratory Consult Order creation
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
(thisDocumentCommunication) := argument;
autoselect_CPAP_BiPAP_instructions := MLM {{{SINGLE-QUOTE}}}DOC_BIPAP_CPAP{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL autoselect_CPAP_BiPAP_instructions WITH thisDocumentCommunication;
(thisDocumentCommunication) := argument;
BiPAP_CPAP_HI_order_creation := MLM {{{SINGLE-QUOTE}}}DOC_BIPAP_CPAP_HI_ORDER{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL BiPAP_CPAP_HI_order_creation WITH thisDocumentCommunication;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,122 @@
maintenance:
title: Call Med Rec;;
filename: Doc_Call_Med_Rec;;
arden: version 2;;
version: 1.00;;
institution: Eclipsys Corp;;
author: Eclipsys Corp;;
specialist: ;;
date: 2008-11-18;;
validation: testing;;
library:
purpose: This mlm open Orders Reconciliation Manager from a document
;;
explanation:
05.31.2019 JML 18.4 Upgrade modification; Launch ORM radio button not unchecking
if observation exists in more than one section on structured note
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
/****** Place all your reading and updating here **********/
// Include MLM to reference assemblies needed for this MLM.
// This MLM specifically uses the assemblies mscorlib and
// ObjectsPlusXA.SCM.Forms
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// SCH_DI OrdRec Launch
launchordrec := false;
theParameterx := ( thisParameters where thisParameters.Name = "SCH_DI Launch Ord Rec" );
if ( exists theParameterx ) then
//Determine if Obs exists more than once on Note
for i IN 1 seqto count theParameterx do
//this_parametername := first of (thisParameters where thisParameters.Name = "SCH_DI Launch Ord Rec");
this_parametername := theParameterx[i];
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := false;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
enddo;
endif;
visit_guid := this_documentCommunication.ClientVisitGUID;
try
// Create the Order Reconciliation Manager object
order_rec_mgr_obj := new NET_OBJECT {{{SINGLE-QUOTE}}}OrderReconciliationManager{{{SINGLE-QUOTE}}};
order_rec_mgr_obj.ClientVisitPrimaryKey := (( visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
void := call order_rec_mgr_obj.ShowDialog;
endtry;
catch exception ex
if ( order_rec_mgr_obj is NOT NULL ) then
void:= call order_rec_mgr_obj.Dispose;
order_rec_mgr_obj:= NULL;
endif;
endcatch;
;;
evoke: // No evoke statement
;;
logic:
conclude true; // always concludes TRUE
;;
action:
return this_documentCommunication;
;;
end:

View File

@@ -0,0 +1,200 @@
maintenance:
title: DOC_CALL_SPECIMEN_PATHOLOGY ;;
mlmname: DOC_CALL_SPECIMEN_PATHOLOGY;;
arden: version 2.5;;
version: 0.00;;
institution: ;;
author: Brijesh Chauhan (Allscripts) ;;
specialist: ;;
date: 2017-08-16;;
validation: testing;;
library:
purpose: Print Speciment Pathology report after document will complete
;;
explanation:
**Change History**
1) 08/16/2017 New MLM created
2) 10/9/2018 STH CSR#: 37482 - Modified original and updated to work. {Go-Live 10/29/2018}
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
mlm_name := "DOC_CALL_SPECIMEN_PATHOLOGY";
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "SCMLib";
using "SCM.Common.Interfaces";
using namespace "SCMLib";
using namespace "SCM.Common.Interfaces";
error_destination := destination { Alert } with [
alert_type := "warning",
short_message := "ObjectsPlus Error from MLM",
priority := "low",
scope := "chart",
Rule_group := "ObjectsPlus Error from MLM",
Rule_number := 1003,
Rule_subgroup := "",
Send_alert_with_order := "",
Alert_dialog_settings := "",
Display_alert := true ];
error_dtl := "";
client_doc_enter := EVENT { ClientDocumentEnter USER ClientDocument : WHERE DocumentName IN ("Endo IntraOp Nursing Note","MLSC IntraOp Nursing Note","IntraOp Nursing Note")};
client_doc_modify := EVENT { ClientDocumentModify USER ClientDocument : WHERE DocumentName IN ("Endo IntraOp Nursing Note","MLSC IntraOp Nursing Note","IntraOp Nursing Note")};
ClientGUID := EVOKINGOBJECT.ClientGUID;
ChartGUID := EVOKINGOBJECT.ChartGUID;
VisitGUID := EVOKINGOBJECT.ClientVisitGUID;
CD_GUID := EVOKINGOBJECT.GUID;
errhndl := false;
tstinfo := EVOKINGOBJECT.ClientObservationDocument;
tstinfo2 := tstinfo.ClientObservation;
(CD_IsIncomplete, CD_Name) := read last {"SELECT
cd.isincomplete,cd.DocumentName
FROM CV3ClientVisit cv with (nolock)
INNER JOIN SXACDObservationParameter ObsParam with (nolock)
ON cv.ClientGUID = ObsParam.ClientGUID
AND cv.ChartGUID = ObsParam.ChartGUID
AND ObsParam.IsCanceled = 0
INNER JOIN CV3ClientDocument CD with (nolock)
on ObsParam.clientguid = cd.clientguid
and ObsParam.chartguid = cd.ChartGUID
and ObsParam.ClientVisitGUID = cd.ClientVisitGUID
and cd.GUID = ObsParam.OwnerGUID
LEFT OUTER JOIN SCMObsFSListValues with (nolock)
ON cv.ClientGUID = SCMObsFSListValues.ClientGUID
AND ObsParam.ObservationDocumentGUID = SCMObsFSListValues.ParentGUID
INNER JOIN CV3ObsCatalogMasterItem ocmi with (nolock)
on obsparam.ObsMasterItemGUID = ocmi.GUID
and ocmi.name like {{{SINGLE-QUOTE}}}SCH OR specimen description[0-9]%{{{SINGLE-QUOTE}}}
where cv.ClientGUID = " || sql(ClientGUID)
|| " and cv.ChartGUID =" || sql(ChartGUID)
|| " and cv.guid = " || sql(VisitGUID)
|| " and ObsParam.OwnerGUID = " || sql(CD_GUID) || " "};
//If there client document (structured note) does not contain at least 1 specimen AND/OR the client document is saved as incomplete the MLM will skip all the below logic and do nothing.
if((count(CD_Name)>0) and (CD_IsIncomplete = false)) then
//Get the CaseID from thew end of the clientdocumentname to pass into the HVCLine1 parameter of the report parameters
dash_CDName := find "-" in string CD_Name;
if(dash_CDName > 0) then
Len_CaseID := (length of CD_Name) - (dash_CDName);
CaseID := substring (Len_CaseID) characters starting at (dash_CDName + 1) from CD_Name;
endif;
//DEFAULT BROADCAST PRINTER TO PDFHIS
//If the structured note starts with ENDO print to ENDO printer, if the document starts with MLSC print to MLSC printer otherwise print to OR printer.
BroadcastPrinter := "PDFHIS";
Printcopies := 2;
if(CD_Name matches pattern "Endo%") then
BroadcastPrinter := "ENDO - GE LAB BACK";
Printcopies := 1;
elseif (CD_Name matches pattern "MLSC%") then
BroadcastPrinter := "MLSC Surgical";
else
BroadcastPrinter := "OR";
endif;
//Make sure we got a valid case ID from the end of the structured note. If the IntraOp note was entered in Acute Care (instead of surgical care) there will be no case identifier added to end of note.
if(caseID <> "" and caseID is not null) then
try
//Start building the report call object based on the report version name SCH_Specimen_Pathology_MLM
report_request_obj := call {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.ReportRequest{{{SINGLE-QUOTE}}}.CreateReportRequest with ("SCH_Specimen_Pathology_MLM" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
//Make sure a valid report object was created, and if so create a list containg the report parameters availble.
if (report_request_obj.Parameters is not null and report_request_obj.Parameters.Count > 0)
then
report_parameter_list := ();
for parameterIndex in (1 seqto report_request_obj.Parameters.Count)
do
report_parameter_list := report_parameter_list, report_request_obj.Parameters[parameterIndex];
enddo;
endif;
//set variables equal to the report parameters from the list that we need to modify for the report to run against proper patient and note.
param_VisitGUID := first(report_parameter_list where report_parameter_list.Label = "ClientVisitGUID");
param_ClientDocGUID := first (report_parameter_list where report_parameter_list.Label = "DocumentGUID");
param_CaseID := first (report_parameter_list where report_parameter_list.Label = "Case Identifier:");
//make sure the parameters are set to allow modification, and if so set the parater values equal to the proper case ID, Visit guid and document guid
if param_CaseID.AllowModification then
void := call param_CaseID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(CaseID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
endif;
if param_VisitGUID.AllowModification then
void := call param_VisitGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(VisitGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
endif;
if param_ClientDocGUID.AllowModification then
void := call param_ClientDocGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(CD_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
endif;
//set the report object to use broadcast print and set the proper printer based on the structured note name defined above.
report_request_obj.PrintPolicy := 4;
report_request_obj.NumberOfCopies := Printcopies;
report_request_obj.PrintJobDestination := BroadcastPrinter;
// print the report
void := call report_request_obj.Save;
// Call Dispose on report_request_obj to clean it up
if report_request_obj is not null
then
void := call report_request_obj.Dispose;
report_request_obj := null;
endif;
endtry;
catch exception ex
error_dtl := ex;
errhndl := true;
if report_request_obj is not null
then
void := call report_request_obj.Dispose;
report_request_obj := null;
endif;
endcatch;
endif;
endif;
;;
priority: 50
;;
evoke:
3 seconds after time of client_doc_enter;
3 seconds after time of client_doc_modify;
;;
logic:
conclude true;
;;
action:
if errhndl then
write "An error has occured in the MLM {{+B}}" || mlm_name || "{{-B}} "
||"Please notify your System Administrators that an error message has "
||"occurred for this patient. They will review the following error "
||"message: \n\n" || "Case ID: " || CaseID
|| "\n VisitGUID: " || VisitGUID
|| "\n CD_GUID: " || CD_GUID
|| "\n\nERROR: " || error_dtl at error_destination;
endif;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,110 @@
maintenance:
title: DOC_CAM_SCORE_ADULT_ASESSMENT;;
mlmname: DOC_CAM_SCORE_ADULT_ASESSMENT;;
arden: version 6.1;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Shivprasad Jadhav ;;
specialist: Shivprasad Jadha, Allscripts Corporation;;
date: 2015-01-10;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
2015-01-10JML CSR 33048: Create date.
2016-06-24 - STH - CSR#: 34407 - Modified flowsheet observations to individual items with yes/no answers and changes CAM score to be
positive or negative instead of a number. {Go-Live 7/12/2016}
2016-06-24 - STH - CSR#: 34407 (CA Service Desk Ticket #: 2249594 ) - Issue reported if all no{{{SINGLE-QUOTE}}}s selected the score is not populating with Negative.
There was logic originally if all were unanswered to not populate an answer; however all no{{{SINGLE-QUOTE}}}s also was causing no
answer. Changed logic to always populate negative unless 1,2 are selected and 3 and/or 4 is also selected then
it will be positive.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Receive arguments from the structured note
(this_documentCommunication) := argument;
//Get The Flowsheet Name
(this_FS_doc) := this_documentCommunication.DocumentConfigurationObj;
//Get the Parameter List
(this_parms) := this_FS_doc.ParametersList;
//Paramters defination
(this_curr_col) := this_FS_doc.Currentcolumn;
(this_currentObs) := this_documentCommunication.CurrentObservationObj;
this_observations := this_curr_col.chartedobservationslist;
//Document Types
STRUCTUREDNOTE := "StructuredNote";
//Event Types
DOCUMENTCLOSING := "DocumentClosing";
CHARTOBSERVATION := "ChartObservation";
DOCUMENTOPENING := "DocumentOpening";
AcuteOnset := false;
Inattention := false;
Disorganized := false;
AlteredLOC := false;
//Setting debugFlag to True will allow popup dialogs containing debug information to appear
debugFlag := false;
CAM_Parameters := ("SCH_AI_Acute onset/ fluctuating course","SCH_AI_Inattention","SCH_AI_Disorganized Speech","SCH_AI_Altered LOC");
CAM_Param_List := (this_parms where this_parms.Name in CAM_Parameters);
for x in 1 seqto count(CAM_Param_List) do
CAM_Obs := first of (this_observations where this_observations.ParameterGUID in CAM_Param_List[x].ParameterGUID );
CAM_Value := first of (CAM_Obs.ValueObj.ListItemsList.Value where CAM_Obs.ValueObj.ListItemsList.isselected = true);
if(CAM_Value = "yes") then
if(CAM_Param_list[x].Name = "SCH_AI_Acute onset/ fluctuating course") then
AcuteOnset := true;
elseif(CAM_Param_list[x].Name = "SCH_AI_Inattention") then
Inattention := true;
elseif(CAM_Param_list[x].Name = "SCH_AI_Disorganized Speech") then
Disorganized := true;
elseif(CAM_Param_list[x].Name = "SCH_AI_Altered LOC") then
AlteredLOC := true;
endif;
endif;
enddo;
MLM_DIPA := MLM {{{SINGLE-QUOTE}}}UTIL_OBJECT_DIPA_MLM{{{SINGLE-QUOTE}}};
prm_edr := First of (this_parms where this_parms.Name = "AS confusion assess FT");
If ((AcuteOnset = true and Inattention = true and Disorganized = true)
or (AcuteOnset = true and Inattention = true and AlteredLOC = true)) then
Val := "Positive";
else
Val := "Negative";
endif;
Obs_edr := CALL MLM_DIPA WITH this_DocumentCommunication,prm_edr, Val as string ;
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList,
Obs_edr);
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,181 @@
maintenance:
title: DOC_Clinical_Scales_Flowsheet;;
mlmname: DOC_Clinical_Scales_Flowsheet;;
arden: version 2.5;;
version: 1.02;; //Release 5.5 SP1/FP1 and 6.0/6.1 SU2 and higher
institution: St. Clair, Allscrtips;;
author: Shawn Head;;
specialist: Janit Nordin;;
date: 2016-04-12;;
validation: testing;;
library:
purpose:
This MLM will automatically populate values based on the clinical scales values for PHQ-9 and PHQ-7
;;
explanation:
Modification history:
04.12.2016 - STH CSR#: 33982 - created
07.23.2019 - TMS CSR#: 37676 - Change log_execution_info to false per upgrade analysis.
;;
keywords: Objects Plus, Education Log, Worklist, ARRA
;;
knowledge:
type: data-driven;;
data:
mlm_name := "DOC_EDUCATION_FS_PRECHECK";
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
//Set to true if a decision.log is needed for diagnostic purposes. Please refer to the CDS Authoring Guides for more information
log_execution_info:= false;
// Specify which .NET assemblies need to be loaded for ObjectsPlus
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
set_cds_vars := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_DEFINITION_MLM{{{SINGLE-QUOTE}}};
//---------------------------------------------------------------
// Error destination
//---------------------------------------------------------------
//"SYSTEM ALERT",
send_alert := "DoNotSend";
error_destination := destination { Alert: warning, "ObjectsPlus Error from MLM", low, chart, "ObjectsPlus Error from MLM", 1003, send_alert, "No Override Allowed" };
// Receive arguments from the structured note
(this_DocumentCommunication) := argument;
// Get the user, chart, client and visit GUIDs
if called_by_editor then
userguid := "";
clientGuid := "9000001860200200"; //Admission, Holly
clientvisitguid := "9000003613200270";//Admission, Holly
chartguid := "9000003613100170";//Admission, Holly
else
userGuid := this_DocumentCommunication.UserGUID;
clientGuid := this_DocumentCommunication.ClientGUID;
clientvisitGuid := this_DocumentCommunication.ClientVisitGUID;
chartGuid := this_DocumentCommunication.ChartGUID;
endif;
// 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];
ListValueType := OBJECT [ListGuid, ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
//Document Type
FLOWSHEET := "FlowSheet";
//Event Types
CHARTOBSERVATION := "ChartObservation";
DOCUMENTCLOSING := "DocumentClosing";
DOCUMENTOPENING := "DocumentOpening";
(this_documentCommunication, client_guid, client_visit_guid, chart_guid,
user_guid, document_type, document_name, event_type,
configuration_guid, this_currentObs, CancelEventFlag, this_fs_doc,
authored_by_guid, isIOFlowsheetFlag, client_document_guid, this_parameters,
this_columnList, this_currentColumn, this_chartedObservationsList,
this_parameters_displayName, current_parameter, current_parameter_name, current_parameter_guid,
current_parameter_datatype, selectedItems, selectedItems_Value, current_value,
diagnostic_message, displayMessageFlag) := CALL set_cds_vars WITH (this_documentCommunication);
Error_occurred := false;
//create a list of charted parameters that exist in the list of observartion names created above.
charted_parameters := (this_parameters where this_parameters.Name is in ("SCH_PHP_GAD Score","SCH_PHP_ PHQ"));
for x in (1 seqto(count(charted_parameters))) do
Education_obs := charted_parameters[x];
theCurrentColumn := first of ( this_columnList WHERE this_columnList.ClientDocumentGUID = this_currentObs.ClientDocumentGUID);
current_obs := first of ( theCurrentColumn.ChartedObservationsList WHERE theCurrentColumn.ChartedObservationsList.ParameterGUID = Education_obs.ParameterGUID);
if(charted_parameters[x].Name = "SCH_PHP_ PHQ") then
PHQScore := (current_obs.ValueObj.Value as number);
if((PHQScore >= 0) and (PHQScore <= 4)) then
Depression_Severity := "Minimal";
Recommend_action := "none";
elseif((PHQScore >= 5) and (PHQScore <= 9)) then
Depression_Severity := "Mild";
Recommend_action := "Watchful waiting, repeat at follow up";
elseif((PHQScore >= 10) and (PHQScore <= 14)) then
Depression_Severity := "Moderate";
Recommend_action := "Treatment plan, considering counseling, follow-up and/or pharmacotherapy";
elseif((PHQScore >= 15) and (PHQScore <= 19)) then
Depression_Severity := "Moderately Severe";
Recommend_action := "Active treatment with pharmacotherapy and/or psychotherapy";
elseif((PHQScore >= 20)) then
Depression_Severity := "Severe";
Recommend_action := "Immediate initiation of pharmacotherapy and, if severe impairment or poor response to therapy, expedited referral to a mental health specialist for psychotherapy and/or collaborative management ";
endif;
Depression_Param := first of (this_parameters WHERE this_parameters.Name = "SCH_PHP_PHQ Depression Severity");
this_currentObj1 := NEW ObservationType;
this_currentObj1.ClientDocumentGUID := this_fs_doc.ClientDocumentGUID;
this_currentObj1.ParameterGUID := Depression_Param.ParameterGUID;
this_currentObj1.DataType := "FreeTextValue";
this_currentObj1.ValueObj := NEW FreeTextValueType;
this_currentObj1.ValueObj.Value := Depression_Severity AS STRING;
this_fs_doc.CurrentColumn.ChartedObservationsList := (this_fs_doc.CurrentColumn.ChartedObservationsList, this_currentObj1);
Recomend_Param := first of (this_parameters WHERE this_parameters.Name = "SCH_PHP_PHQ Recommendations");
this_currentObj2 := NEW ObservationType;
this_currentObj2.ClientDocumentGUID := this_currentObs.ClientDocumentGUID;
this_currentObj2.ParameterGUID := Recomend_Param.ParameterGUID;
this_currentObj2.DataType := "FreeTextValue";
this_currentObj2.ValueObj := NEW FreeTextValueType;
this_currentObj2.ValueObj.Value := Recommend_action AS STRING;
this_fs_doc.CurrentColumn.ChartedObservationsList := (this_fs_doc.CurrentColumn.ChartedObservationsList, this_currentObj2);
elseif((charted_parameters[x].Name = "SCH_PHP_GAD Score") and ((current_obs.ValueObj.Value as number)>=0)) then
GADScore := (current_obs.ValueObj.Value as number);
if((GADScore >= 0) and (GADScore <= 4)) then
Anxiety := "Minimal";
elseif((GADScore >= 5) and (GADScore <= 9)) then
Anxiety := "Mild";
elseif((GADScore >= 10) and (GADScore <= 14)) then
Anxiety := "Moderate";
elseif((GADScore >= 15) /*and (PHQScore <= 27)*/) then
Anxiety := "Severe";
endif;
Anxiety_Param := first of (this_parameters WHERE this_parameters.Name = "SCH_PHP_GAD Anxiety Severity");
this_currentObj3 := NEW ObservationType;
this_currentObj3.ClientDocumentGUID := this_currentObs.ClientDocumentGUID;
this_currentObj3.ParameterGUID := Anxiety_Param.ParameterGUID;
this_currentObj3.DataType := Anxiety_Param.DataType;
this_currentObj3.ValueObj := NEW FreeTextValueType;
this_currentObj3.ValueObj.Value := Anxiety AS STRING;
this_fs_doc.CurrentColumn.ChartedObservationsList := (this_fs_doc.CurrentColumn.ChartedObservationsList, this_currentObj3);
endif;
enddo;
;;
priority: 50
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_DocumentCommunication; ;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,140 @@
maintenance:
title: DOC_CLIN_DOC_SPECIALIST_SN;;
mlmname: DOC_CLIN_DOC_SPECIALIST_SN;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Rich Schaeffer;;
specialist: Don Warnick;;
date: 2015-02-02;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
02.12.2015 DW CSR# 32616 Develop Application to allow for communication between clinical documentation specialist
11.09.2015 DW CSR# 33624 Add Clairfication to Day of Discharge Note
08.01.2017 DW CSR# 33968 CDS Improvements
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
ThisDocumentGuid := thisStructuredNoteDoc.ClientDocumentGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// DOCUMENT OPEN
if thisdocumentCommunication.EventType = "DocumentOpening"
then
(obsNamesList, obsNameValue, obsGuid) := read
{
" SET CONCAT_NULL_YIELDS_NULL off "
|| " Select ocmi.name , o.ValueText, cd.guid "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and (cd.DocumentName like {{{SINGLE-QUOTE}}}Physician Progress%{{{SINGLE-QUOTE}}} or cd.DocumentName like {{{SINGLE-QUOTE}}}Day of Discharge Summary eNote%{{{SINGLE-QUOTE}}}) "
|| " and ocmi.name like {{{SINGLE-QUOTE}}}SCH_CDA_Doc Response MLM%{{{SINGLE-QUOTE}}} "
|| " order by ocmi.name desc "
};
// || " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
indexList2 := 1 seqto count (obsNamesList);
for j in indexList2 do
obsValue := last (first j from obsNameValue);
CDSGuid:= SUBSTRING 16 CHARACTERS STARTING AT 3 FROM obsValue;
if CDSGuid = ThisDocumentGuid
then
responsenumber:= SUBSTRING 1 CHARACTERS STARTING AT 1 FROM obsValue;
userdatestamp := SUBSTRING 100 CHARACTERS STARTING AT 19 FROM obsValue;
if responsenumber = "1" then formattedText1 := "Agreed";
elseif responsenumber = "2" then formattedText1 := "Disagreed";
elseif responsenumber = "3" then formattedText1 := "Need to Discuss";
elseif responsenumber = "4" then formattedText1 := "Reviewed";
endif;
formattedText2 := userdatestamp ;
endif;
enddo;
// Write to the Structured Note Text Box
If formattedText1 is not null
then
formattedText1 := formattedText1 || " " || formattedText2;
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_CDA_Response");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedText1;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
endif; // Document Open
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,250 @@
maintenance:
title: DOC_DIET_KBC_ADULT_ASSESSMENT ;;
mlmname: DOC_DIET_KBC_ADULT_ASSESSMENT;;
arden: version 6.1;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Shivprasad Jadhav ;;
specialist: Shivprasad Jadhav, Allscripts Corporation;;
date: 2015-09-01;;
validation: testing;;
library:
purpose:
1st senario-When user select criteria i.e {1-Patient consuming <50% of meals x 3days or 2-NPO or clear liquids >3days}
from [2."Adult Assessment/Intervention"flowsheet when selecting [Risk assessment/Screenings] observation in "Nutrition Risk Screen" then MLM should creat
a Dietitian Consult for the charted observation which has mention.
2nd Senario- If there is an active "Dietitian consult order with this indication i.e{1-Patient consuming <50% of meals x3 days} or {2- NPO or clear liquids >3 days}
has present or charted previously and "Dietitian Consult order was created previously then MLM should not create a 2nd order for Dietitian consult .
3rd Senario- If user select othere criteria except given criteria i.e {1-Patient consuming <50% of meals x3 days} or {2- NPO or clear liquids >3 days} then MLM should not creat
any "Dietitian Consult Order.
;;
explanation:
Change history
10-01-2015 SJ CSR 32400 : Created date.
09-28-2016 DJW HD#2113751 - Provide a message box to confirm the choice before automatically creating a Dietitian Consult Order
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
// Receive arguments from the structured note
(this_documentCommunication) := argument;
//Get The Flowsheet Name
(this_FS_doc) := this_documentCommunication.DocumentConfigurationObj;
(this_parms) := this_FS_doc.ParametersList;
(this_curr_col) := this_FS_doc.Currentcolumn;
(this_currentObs) := this_documentCommunication.CurrentObservationObj;
this_observations := this_curr_col.chartedobservationslist;
(ClientGuid) := this_documentCommunication.ClientGUID;
(ChartGuid) := this_documentCommunication.ChartGUID;
(ClientVisitGuid) := this_documentCommunication.ClientVisitGUID;
(UserGuid) := this_DocumentCommunication.UserGUID ;
LocationGuid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || ClientGuid};
// read First {" Select cv.CurrentLocationGUID from Cv3ClientVisit cv With (nolock) Where cv.guid= "||SQL(ClientVisitGuid) ||" "} ;
CatalogItemName := "Dietitian Consult";
prm_med := First of (this_parms where this_parms.Name = "AS nut risk screen");
Obs_med := first of (this_observations where this_observations.ParameterGUID = prm_med.ParameterGUID );
val_med := Obs_med.ValueObj.listitemslist where Obs_med.ValueObj.listitemslist.isselected = true ;
/*a:=val_med[1].Value;
b:=val_med[2].Value;
DataItem1:=val_med[3].Value;
DataItem2:=val_med[4].Value;
e:=val_med[5].Value; */
indexList := 1 seqto count (val_med);
for i in indexList do
If val_med[i].Value="patient consuming <50% of meals x 3 days" Then
DataItem1 := "patient consuming <50% of meals x 3 days";
Elseif val_med[i].Value="NPO or clear liquids > 3 days" Then
DataItem2 := "NPO or clear liquids > 3 days";
Else DataItem1 := Null ; DataItem2 := Null ;
Endif;
enddo;
UserData := Read first { "Select Top 1 o.name "
|| " from cv3ClientVisit cv (nolock) Join cv3Order o (nolock) "
|| " On cv.guid =o.ClientVisitGUID And cv.ClientGUID=o.ClientGUID "
|| " Join cv3OrderUserData ud On ud.OrderGUID=o.GUID And ud.ClientGUID=cv.ClientGUID "
|| " And ud.UserDataCode in ({{{SINGLE-QUOTE}}}NUTR_Consult Reasons{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}NUTR_Consult Reason 2{{{SINGLE-QUOTE}}}) "
|| " And o.Name = {{{SINGLE-QUOTE}}}Dietitian Consult{{{SINGLE-QUOTE}}} And o.orderstatuslevelnum < 55 "
|| " and o.OrderStatusCode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} And o.ClientVisitGUID = " || ClientVisitGuid
|| " Where ud.Value in ({{{SINGLE-QUOTE}}}Patient consuming <50% of meals x 3 days{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}NPO or Clear Liquids > 3 days{{{SINGLE-QUOTE}}}) "};
If UserData is Null Then
If (DataItem1 is Not Null) or ( DataItem2 is Not Null ) Then
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n This choice will create a Dietitian Consult {{{SINGLE-QUOTE}}}" ||
"\n\n Click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to confirm your choice " ||
"\n\n Click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} if you wish to change your choice " ||
"\n "
,"Create a Dietitian Consult Order ? ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
If (dlg_result as string) = "Yes" then
error_destination := destination { IntermediateMessage } with [
alert_type := "Warning",
short_message := "Auto Order MLM",
priority := "low",
scope := "chart",
Rule_group := "Auto Order MLM",
Rule_number := 1001,
Rule_subgroup := "",
Send_alert_with_order := "",
Alert_dialog_settings := "",
Display_alert := true ];
user_IDType := "Edstan Number (physician)";
user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || UserGUID
|| " and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
order_Creation_Reason := "Order Created Form MLM";
try
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
WSSessionType := "Standard";
WSSessionReason := "";
WSRequestedBySource := "";
WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((LocationGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}Common Data:{{-R}}\n" ||
ex.Message || "\n\n";
if ( client_visit_obj is NOT NULL ) then
void:= call client_visit_obj.Dispose;
client_visit_obj:= null;
endif;
if ( WSRequestedBy_obj is NOT NULL ) then
void:= call WSRequestedBy_obj.Dispose;
WSRequestedBy_obj:= null;
endif;
if ( WSlocation_obj is NOT NULL ) then
void:= call WSlocation_obj.Dispose;
WSlocation_obj:= null;
endif;
endcatch;
try
// get OrderCatalogMasterItem ObjectsPlus object
general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with CatalogItemName;
// Create the prefilled General order
GeneralOrder2_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
with
client_visit_obj, // ClientVisit ObjectsPlus object
general_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
order_Creation_Reason, // CreateReason
wsRequestedBy_obj, // RequestedBy ObjectsPlus object
wsRequestedBySource, // string RequestedBySource (must be in dictionary)
wsSessionType, // string SessionType
wsSessionReason, // string SessionReason
wslocation_obj, // Location ReleaseLocGrpID
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
IF (EXISTS DataItem1 AND DataItem1 IS NOT NULL ) or (EXISTS DataItem2 AND DataItem2 IS NOT NULL ) THEN
If DataItem1 is not Null Then Val := DataItem1 ; Else Val := DataItem2; Endif;
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
"NUTR_Consult Reasons" , Val ;
ENDIF;
IF (EXISTS DataItem1 AND DataItem1 IS NOT NULL ) And (EXISTS DataItem2 AND DataItem2 IS NOT NULL ) THEN
Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
"NUTR_Consult Reason 2" , DataItem2 ;
ENDIF;
if ( general_catalog_item is NOT NULL ) then
void:= call general_catalog_item.Dispose;
general_catalog_item:= null;
endif;
//GeneralOrder2_dest.ObjectsPlus := GeneralOrder2_obj;
empty := Call GeneralOrder2_obj.save;
endtry;
catch Exception ex
error_occurred := true;
error_message := error_message || "{{+R}}New general order:{{-R}}\n" ||
ex.Message || "\n\n";
if ( general_catalog_item is NOT NULL ) then
void:= call general_catalog_item.Dispose;
general_catalog_item:= null;
endif;
if ( GeneralOrder2_obj is NOT NULL ) then
void:= call GeneralOrder2_obj.Dispose;
GeneralOrder2_obj:= null;
endif;
endcatch;
if ( client_visit_obj is NOT NULL ) then
void:= call client_visit_obj.Dispose;
client_visit_obj:= null;
endif;
if ( WSRequestedBy_obj is NOT NULL ) then
void:= call WSRequestedBy_obj.Dispose;
WSRequestedBy_obj:= null;
endif;
if ( WSlocation_obj is NOT NULL ) then
void:= call WSlocation_obj.Dispose;
WSlocation_obj:= null;
endif;
endif; // Proceed with the consult order?
Endif;
Endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,45 @@
maintenance:
title: DOC_DISCHARGE_INSTRUCTIONS_OPEN;;
mlmname: DOC_DISCHARGE_INSTRUCTIONS_OPEN;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Don Warnick;;
specialist: ;;
date: 2014-04-30;;
validation: testing;;
library:
purpose:
;;
explanation: This MLM will call functional MLMs to be run upon open of the Discharge Instructions Structued Note
Change history
04.30.2014 DW CSR# 31688 - Created
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(thisDocumentCommunication) := argument;
DocInfluenza := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_DISCHARGE_DIAG{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocInfluenza WITH thisDocumentCommunication;
(thisDocumentCommunication) := argument;
DocPneumovax := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_CCDA_DATA{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocPneumovax WITH thisDocumentCommunication;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,133 @@
maintenance:
title: DOC_EDUCATION_FS_PRECHECK;;
mlmname: DOC_EDUCATION_FS_PRECHECK;;
arden: version 2.5;;
version: 1.02;; //Release 5.5 SP1/FP1 and 6.0/6.1 SU2 and higher
institution: St. Clair, Allscrtips;;
author: Shawn Head;;
specialist: Debbie Eiler;;
date: 2016-04-12;;
validation: testing;;
library:
purpose:
This MLM will automatically select values in the education section based on which education flowsheet the user is on.
;;
explanation:
Modification history:
4.12.2016 - STH CSR#: 33982 - created
5.6.2016 - STH CSR#: 33982 - CA Service Desk Ticket #: 2157915 - 2 new observation values where added to the generic teaching observation list. Need to have MLM uncheck these on all flowsheets.
;;
keywords: Objects Plus, Education Log, Worklist, ARRA
;;
knowledge:
type: data-driven;;
data:
mlm_name := "DOC_EDUCATION_FS_PRECHECK";
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Include ObjectsPlus Assemblies
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
(thisDocumentCommunication) := argument;
/**************Make Changes To Spelling And Flags In This Section**************/
//Set up variables; initialize
fire_on_param := "ED_Generic Teaching";
//Document Type
FLOWSHEET := "FlowSheet";
//Event Types
CHARTOBSERVATION := "ChartObservation";
DOCUMENTCLOSING := "DocumentClosing";
/******************************************************************************/
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid, ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
//Set Flowsheet DocumentCommunication object model variables via Called MLM
(this_fs_doc) := thisDocumentCommunication.DocumentConfigurationObj;
(this_parameters) := this_fs_doc.ParametersList;
(this_currentObs) := thisDocumentCommunication.CurrentObservationObj;
(this_cols) := this_fs_doc.ColumnsList;
(this_curr_col) := this_fs_doc.CurrentColumn;
(this_chartedObs) := this_curr_col.ChartedObservationsList;
document_type := thisDocumentCommunication.DocumentType;
event_type := thisDocumentCommunication.EventType;
client_guid := thisDocumentCommunication.ClientGUID;
visit_guid := thisDocumentCommunication.ClientVisitGUID;
chart_guid := thisDocumentCommunication.ChartGUID;
if(thisDocumentCommunication.DocumentName matches pattern "%Adult Education Outcome%") then
DeslectItems := (1,3,4,15,16,21);
elseif(thisDocumentCommunication.DocumentName matches pattern "%OB Education Outcome%") then
DeslectItems := (1,3,7,9,14,15,16,21);
elseif(thisDocumentCommunication.DocumentName matches pattern "%Pediatric Education Outcome%") then
DeslectItems := (1,4,13,14,15,16,21);
elseif(thisDocumentCommunication.DocumentName matches pattern "%Newborn Education Outcome%") then
DeslectItems := (1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,21);
endif;
if (document_type = FLOWSHEET) then // AND event_type = CHARTOBSERVATION) then
//*************** UNIVERSAL INTERVENTIONS **************************
//Autocheck all values under "Universal Interventions" Observation
univIndParameter := first of (this_parameters WHERE this_parameters.Name = fire_on_param);
if (exists univIndParameter) then
//Define parameter ConfigurationObj to extract Suggested Text value
univIndListConfiguration := univIndParameter.ConfigurationObj;
univIndObs := first of ( this_chartedObs WHERE this_chartedObs.ParameterGUID = univIndParameter.ParameterGUID);
Education_ListItemsList := univIndObs.ValueObj.ListValuesList.ListItemsList;
EducationLists := Education_ListItemsList.IsSelected;
lst1stitemselected := Education_ListItemsList[1].IsSelected[1];
if(lst1stitemselected) then
totalitemct := 0;
for x in (1 seqto(count(EducationLists))) do
selectedlist := EducationLists[x];
ctselst := count(selectedlist);
for y in (1 seqto(count(selectedlist))) do
totalitemct := totalitemct + 1;
if(totalitemct in DeslectItems) then
selectedlist[y] := false;
else
selectedlist[y] := true;
endif;
enddo;
EducationLists[x] := selectedlist;
enddo;
Education_ListItemsList.IsSelected := EducationLists;
endif;
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,45 @@
maintenance:
title: DOC_ED_DISCHARGE_INSTRUCTIONS_CLOSE;;
mlmname: DOC_ED_DISCHARGE_INSTRUCTIONS_CLOSE;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Don Warnick;;
specialist: Prggy Karish;;
date: 2017-06-07;;
validation: testing;;
library:
purpose:
;;
explanation: This MLM will call functional MLMs to be run upon close of the ED Discharge Instructions Structued Note
Change history
07.07.2017 DW CSR# 35436 - PDMP Improvements
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(thisDocumentCommunication) := argument;
PrintEDDischInst := MLM {{{SINGLE-QUOTE}}}DOC_PRINT_ED_DCINST{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL PrintEDDischInst WITH thisDocumentCommunication;
(thisDocumentCommunication) := argument;
SavePDMPSearchData := MLM {{{SINGLE-QUOTE}}}Doc_Launch_PDMP_Search{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL SavePDMPSearchData WITH thisDocumentCommunication;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,61 @@
maintenance:
title: DOC_ED_TRIAGE_NOTE_CLOSE;;
mlmname: DOC_ED_TRIAGE_NOTE_CLOSE;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Don Warnick;;
specialist: Don Warnick;;
date: 2016-08-23;;
validation: testing;;
library:
purpose: Call upon close of the ED Triage Note
;;
explanation:
Change history
08.22.2016 DJW CSR# 34849 Patient Header Visit Count Readmission Monitoring - Created
04.21.2017 SZ CSR# 35113 SIRS Sepsis Alert ED
05.23.2018 DW CSR# 36510 Harm to Self or Others - Created
03.05.2019 DW CSR# 38048 - Alert to mitigate Daylight Savings Time issue present 16.3 CU10 PR54 (corrected later)
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(thisDocumentCommunication) := argument;
StrokeLastKnownWell := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_STROKE_LAST_KNOWN_WELL_CALC{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL StrokeLastKnownWell WITH thisDocumentCommunication;
(thisDocumentCommunication) := argument;
DocPatientHeaderVisitCount := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_PATIENT_HEADER_VISIT_COUNT{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocPatientHeaderVisitCount WITH thisDocumentCommunication;
(thisDocumentCommunication) := argument;
SepsisColumnUpdate := MLM {{{SINGLE-QUOTE}}}DOC_SEPSIS_STATUS_BOARD_COLUMN_ED{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL SepsisColumnUpdate WITH thisDocumentCommunication;
(thisDocumentCommunication) := argument;
SuicidalOrViolent := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_SUICIDAL_OR_VIOLENT{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL SuicidalOrViolent WITH thisDocumentCommunication;
//Call MLM to alert that mitigates Daylight Savings Time issue present 16.3 CU10 PR54 (corrected later)
DSTAlert := MLM {{{SINGLE-QUOTE}}}DOC_SMP_CHECK_DAYLIGHT_SAVINGS_TIME{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DSTAlert WITH thisDocumentCommunication;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,50 @@
maintenance:
title: DOC_ED_TRIAGE_NOTE_OPEN;;
mlmname: DOC_ED_TRIAGE_NOTE_OPEN;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Don Warnick;;
specialist: Don Warnick;;
date: 2016-08-23;;
validation: testing;;
library:
purpose: Call MLMs upon open of the ED Triage Note
;;
explanation:
Change history
05.23.2018 DW CSR# 36510 Harm to Self or Others - Created
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(thisDocumentCommunication) := argument;
StrokeLastKnownWell := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_STROKE_LAST_KNOWN_WELL_CALC{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL StrokeLastKnownWell WITH thisDocumentCommunication;
(thisDocumentCommunication) := argument;
SuicidalOrViolent := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_SUICIDAL_OR_VIOLENT{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL SuicidalOrViolent WITH thisDocumentCommunication;
(thisDocumentCommunication) := argument;
DocDTAP := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_GENERIC_MANDATORY_BY_OCCUPATION{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocDTAP WITH thisDocumentCommunication;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,51 @@
maintenance:
title: DOC_ED_VITAL_SIGNS_CLOSE;;
mlmname: DOC_ED_VITAL_SIGNS_CLOSE;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Peggy Karish;;
specialist: Sandy Zhang;;
date: 2017-05-03;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
05.03.2017 SZ CSR: 35113 Created this universal MLM for closing of Flowsheet known as Doc. Cat. - Flowsheet: "1. Vital Signs - ED"
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Receive arguments from the flowsheet
(thisDocumentCommunication) := argument;
DressingChangeAlert := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DressingChangeAlert WITH thisDocumentCommunication;
//Reset to receive arguments from the flowsheet
(thisDocumentCommunication) := argument;
SIRSAlert := MLM {{{SINGLE-QUOTE}}}DOC_SEPSIS_STATUS_BOARD_COLUMN_ED{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL SIRSAlert WITH thisDocumentCommunication;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,262 @@
maintenance:
title: DOC_FUNC_ABUSE_SCREEN_SOCIAL_SERVICE_REFERRAL;;
mlmname: DOC_FUNC_ABUSE_SCREEN_SOCIAL_SERVICE_REFERRAL;;
arden: version 2.50;;
version: 18.4;;
institution: St.Clair Hospital;;
author: Juliet M. Law;;
specialist: Courtney Carr;;
date: 2019-09-04;;
validation: testing;;
library:
purpose: Automatically order a Social Service Referral (Non Psych) when {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} is answered to any question under the Abuse section
on the Adult Patient Profile.
;;
explanation: This MLM will trigger off the user answering {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to any question under the Abuse section on the Adult Patient Profile.
The Referral order will only be placed once.
Change history
09.04.2019 JML CSR# 38606 Created.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
documentName := thisDocumentCommunication.DocumentName;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
locationGuid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit WITH(NOLOCK) WHERE GUID = " || SQL(visitGuid)};
if ( documentName = "Adult Patient Profile" ) then
abuseParamName := ( "PRO abuse screen threat fam yn"
, "PRO abuse screen advantage yn"
, "PRO abuse screen unsafe at home yn");
orderName := "Social Service Referral (Non Psych)";
elseif ( documentName = "Adult Patient Profile - Behavioral Health" ) then
abuseParamName := ( "PRO Abuse Screen trauma_BH profile"
, "PRO Abuse Screen advantage_BH profile"
, "PRO abuse screen limit contact_BH profile"
, "PRO abuse screen threat anyone_BH profile"
, "PRO abuse screen do you feel safe"
, "PRO abuse screen making feel unsafe"
, "PRO abuse screen unsafe at home_BH profile" );
orderName := "Psych Social Service Referral";
endif;
paramCount := 0;
//Required Objects+ Variables
SessionType := "Standard";
SessionReason := "";
RequestingSource := "";
Order_Creation_Reason := "Abuse Screen - Created from MLM";
mlm_name := "DOC_FUNC_ABUSE_SCREEN_SOCIAL_SERVICE_REFERRAL";
errorOccurred := false;
errorMsg := "";
if ( thisDocumentCommunication.EventType = "ChartObservation" ) then
for var IN 1 seqto count abuseParamName do
abuseParam := first of ( thisParameters WHERE thisParameters.Name = abuseParamName[var] );
if ( exists abuseParam ) then
abuseObs := first of ( thisObservations WHERE thisObservations.ParameterGUID = abuseParam.ParameterGUID );
if ( exists abuseObs ) then
selectedYes := exists ( abuseObs.ValueObj.ListItemsList.Value
WHERE ( abuseObs.ValueObj.ListItemsList.Value = "yes"
OR abuseObs.ValueObj.ListItemsList.Value = "yes..." )
AND abuseObs.ValueObj.ListItemsList.IsSelected = true );
if ( selectedYes ) then
paramCount := paramCount + 1;
endif;
endif;
endif;
enddo;
if ( paramCount = 1 ) then
//Check for Social Service Referral existence
orderExists := READ LAST { "SELECT o.Name"
|| " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|| " WHERE o.ClientGUID = " || SQL(clientGuid)
|| " AND o.ClientVisitGUID = " || SQL(visitGuid)
|| " AND o.ChartGUID = " || SQL(chartGuid)
|| " AND o.Name = " || SQL(orderName)
|| " AND ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})" };
if ( NOT ( exists orderExists ) ) then
msg_hi := "This selection will create a " || orderName || " order.";
msg_hi := msg_hi || "\n\nClick {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to confirm your selection. ";
msg_hi := msg_hi || "\n\nClick {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} if you wish to change your selection.";
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show WITH msg_hi, "Confirm Abuse Screening Selection", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
if ( ( dialogRes as String ) = "Yes" ) then
try
//Retrieve .Net version of client visit object
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
//Use current user as default care provider
care_provider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((userGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
//Get Location Obj
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((locationGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
//Get the OrderCatalogMasterItem Obj
order_catalog_obj := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
with (orderName);
endtry;
catch Exception ex
errorOccurred := true;
errorMsg := "{{+R}}CommonData: {{-R}}\n" ||
ex.Message || "\n\n";
//Clean up
if order_catalog_obj is NOT Null then
void := call order_catalog_obj.Dispose;
order_catalog_obj := null;
endif;
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;
try
//Generate the Dietitian Consult Order
Order_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
with client_visit_obj,
order_catalog_obj,
Order_Creation_Reason,
care_provider_obj,
RequestingSource,
SessionType,
SessionReason,
location_obj,
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
endtry;
catch Exception ex
errorOccurred := true;
errorMsg := "{{+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;
if ( documentName = "Adult Patient Profile" ) then
//Set UDDI field value on order (Indication for Consult)
ret_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}}
with "SS_Consult Reasons","Abuse and neglect";
endif;
//Save order
void := call Order_Obj.Save;
//CleanUp
if order_catalog_obj IS NOT Null then
void := call order_catalog_obj.Dispose;
order_catalog_obj := null;
endif;
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;
if errorOccurred then
thisDocumentCommunication.DisplayMessage := true;
thisDocumentCommunication.Message := errorMsg;
endif;
endif;
endif;
endif;
endif;
;;
evoke:
;;
logic:
conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,336 @@
maintenance:
title: DOC_FUNC_ACUTE_CHF_CRITERIA ;;
mlmname: DOC_FUNC_ACUTE_CHF_CRITERIA ;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Shivprasad Jadhav ;;
specialist: Shivprasad Jadhav, GOS Allscripts;;
date: 2015-08-12;;
validation: testing;;
library:
purpose: On Document save MLM look for the [Acute CHF] or [CHF] Selection in structured note Or look for the HI Depend on HI type and its scope of [ Acute CHF or CHF].
Then it will look for Mail send history. As we are creating comment when mail sent earlier. If Mail not sent earlier then it send mail to [#patient Registration-Pharmacy@StClair.org ]
;;
explanation:
Change history
08.12.2015 SSJ CSR# 33338 - Created
07.20.2016 SSJ CSR#333338- Added filter for patient Typecode [Inpatient and Observation] only
08.16.2016 Shivprasad - CSR #333338- Made changes as per new specs to sent mail and added logic to create HI for CHF, COPD, Renal And Diabetes.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
DocGuid := thisStructuredNoteDoc.ClientDocumentGUID ;
HI_MLM := MLM {{{SINGLE-QUOTE}}}SCH_Func_Create_Health_Issue{{{SINGLE-QUOTE}}};
VST_Code := Read last {"Select cv.Typecode from cv3ClientVisit cv (nolock) Where cv.Guid = " || visitGuid || " And cv.ClientGUID = " || clientGuid } ;
(LocationLevelCode) := read last { " Select Top 1 case when cc.typecode = {{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then cc.levelcode when b.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then b.levelcode
when a.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then a.levelcode when cv3l.typecode={{{SINGLE-QUOTE}}}unit{{{SINGLE-QUOTE}}} then cv3l.levelcode else null end as Unit
From CV3ClientVisit CV With (Nolock) Left Join CV3Location CV3L On CV3L.GUID=CV.CurrentLocationGUID
Left Join CV3Location a With (Nolock) on CV3L.parentguid= a.guid Left Join CV3Location b With (Nolock) on a.parentguid = b.guid
left join cv3location cc With (Nolock) on b.parentguid = cc.guid WHERE CV.GUID = "|| visitGuid };
// DOCUMENT CLOSING SECTION
IF thisdocumentCommunication.EventType = "DocumentClosing" then
errormessage := "";
// Determine if the Acute CHF button is selected
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Chronic_Conditions"); //SCH_CK_Diagnosis Risk
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
//------For Adult Patient Profile Observation Only---------------------------------------------------------------------------
theParameter1 := first of (thisparameters where thisparameters.Name = "SCH_CK_Diagnosis Risk"); //SCH_CK_Diagnosis Risk
theObservation1 := first of (thisobservations where thisobservations.ParameterGUID = theParameter1.ParameterGUID);
//--------------------------------------------------------------------------------------------------------------------------
// To get user selections for Observation
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "CHF")
then
HI_CHF :="CHF";
else
HI_CHF :="";
endif;
//------For Adult Patient Profile Observation Only---------------------------------------------------------------------------
if true in (theObservation1.ValueObj.ListItemsList.IsSelected where theObservation1.ValueObj.ListItemsList.Value = "Acute CHF") then
HI_CHF :="CHF";
elseIf False in (theObservation1.ValueObj.ListItemsList.IsSelected where theObservation1.ValueObj.ListItemsList.Value = "Acute CHF") Then
HI_CHF :="";
endif;
//--------------------------------------------------------------------------------------------------------------
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "COPD")
then
HI_COPD :="COPD";
else
HI_COPD :="";
endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Diabetes")
then
HI_Diabetes :="Diabetes";
else
HI_Diabetes :="";
endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Renal Failure")
then
HI_Renal :="Renal Failure";
else
HI_Renal :="";
endif;
//Health Issue Variable
CHF_Created := "No";
COPD_Created := "No";
Diabetes_Created := "No";
Renal_Created := "No";
//To Create health Issue Filter Criteria based on user selection on St. Note.
If (HI_CHF <> "" ) or (HI_COPD <> "" ) or (HI_Diabetes <> "") or ( HI_Renal <> "") Then
//Message to User for Health Issue Creation
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "A Health Issue has been created for this Condition. ", "Important Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
/*************************** Health Issue for CHF ******************************/
If HI_CHF <> "" Then
// HI CHF Information
HI_Name := "CHF (congestive heart failure)";
HI_9Code := "428.0";
HI_10Code := "I50.9";
CodingScheme:= "ICD10";
HI_TYPE := "Problem-Chronic";
IssueText := "Created from {{{SINGLE-QUOTE}}}Pharmacy Insurance Information MLM{{{SINGLE-QUOTE}}}. " ;
(CurrentVisit_CHF) := read last { "select distinct hi.shortname , hi.ScopeLevel, hi.typecode "
|| " from Cv3ClientVisit cv With (Nolock) Join cv3healthissuedeclaration hi with (nolock) "
|| " on cv.guid= hi.ClientVisitGUID And cv.ClientGuid =Hi.ClientGUID "
|| " join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID"
|| " where cv.GUID = " || visitGuid
|| " And cv.clientguid = " || clientGuid || " and hi.active = 1 "
|| " and hi.typecode in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}) "
|| " and ((Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}"|| HI_9Code ||"{{{SINGLE-QUOTE}}}) or (Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}"|| HI_10Code ||"{{{SINGLE-QUOTE}}}) ) " };
If Not exist CurrentVisit_CHF Then
Void := Call HI_MLM With (visitGuid, HI_Name, HI_10Code, IssueText,HI_TYPE,CodingScheme); //(visitGuid,issuename,issuecode,issuetext,issuetype,issuescheme)
CHF_Created := "Yes";
EndIf;
Endif;
/*************************** Health Issue for COPD ******************************/
If HI_COPD <> "" Then
HI_Name := "Chronic Obstructive Pulmonary Desease";
HI_9Code := "496";
HI_10Code := "J44.9";
CodingScheme := "ICD10";
HI_TYPE := "Problem-Chronic";
IssueText := "Created from {{{SINGLE-QUOTE}}}Pharmacy Insurance Information MLM{{{SINGLE-QUOTE}}}. " ;
(CurrentVisit_COPD) := read last { "select distinct hi.shortname , hi.ScopeLevel, hi.typecode "
|| " from Cv3ClientVisit cv With (Nolock) Join cv3healthissuedeclaration hi with (nolock) "
|| " on cv.guid= hi.ClientVisitGUID And cv.ClientGuid =Hi.ClientGUID "
|| " join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID"
|| " where cv.GUID = " || visitGuid
|| " And cv.clientguid = " || clientGuid || " and hi.active = 1 "
|| " and hi.typecode in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}) "
|| " and ((Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}"|| HI_9Code ||"{{{SINGLE-QUOTE}}})
or (Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}"|| HI_10Code ||"{{{SINGLE-QUOTE}}}) ) " };
If Not exist CurrentVisit_COPD Then
Void := Call HI_MLM With (visitGuid, HI_Name, HI_10Code, IssueText,HI_TYPE,CodingScheme); //(visitGuid,issuename,issuecode,issuetext,issuetype,issuescheme)
COPD_Created := "Yes";
Endif;
EndIf;
/*************************** Health Issue for Diabetes ******************************/
If HI_Diabetes <> "" Then
HI_Name := "Diabetes";
HI_9Code := "250.00";
HI_10Code := "E11.9";
CodingScheme := "ICD10";
HI_TYPE := "Problem-Chronic";
IssueText := "Created from {{{SINGLE-QUOTE}}}Pharmacy Insurance Information MLM{{{SINGLE-QUOTE}}}. " ;
(CurrentVisit_Diabetes) := read last { "select distinct hi.shortname , hi.ScopeLevel, hi.typecode "
|| " from Cv3ClientVisit cv With (Nolock) Join cv3healthissuedeclaration hi with (nolock) "
|| " on cv.guid= hi.ClientVisitGUID And cv.ClientGuid =Hi.ClientGUID "
|| " join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID"
|| " where cv.GUID = " || visitGuid
|| " And cv.clientguid = " || clientGuid || " and hi.active = 1 "
|| " and hi.typecode in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}) "
|| " and ((Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}"|| HI_9Code ||"{{{SINGLE-QUOTE}}})
or (Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}"|| HI_10Code ||"{{{SINGLE-QUOTE}}}) ) " };
If Not exist CurrentVisit_Diabetes Then
Void := Call HI_MLM With (visitGuid, HI_Name, HI_10Code, IssueText,HI_TYPE,CodingScheme); //(visitGuid,issuename,issuecode,issuetext,issuetype,issuescheme)
Diabetes_Created := "Yes";
Endif;
EndIf;
/*************************** Health Issue for renal Chronic ******************************/
If HI_Renal <> "" Then
HI_Name := "Chronic renal failure";
HI_9Code := "585.9";
HI_10Code := "N18.9";
CodingScheme := "ICD10";
HI_TYPE := "Problem-Chronic";
IssueText := "Created from {{{SINGLE-QUOTE}}}Pharmacy Insurance Information MLM{{{SINGLE-QUOTE}}}. " ;
(CurrentVisit_Renal) := read last { "select distinct hi.shortname , hi.ScopeLevel, hi.typecode "
|| " from Cv3ClientVisit cv With (Nolock) Join cv3healthissuedeclaration hi with (nolock) "
|| " on cv.guid= hi.ClientVisitGUID And cv.ClientGuid =Hi.ClientGUID "
|| " join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID"
|| " where cv.GUID = " || visitGuid
|| " And cv.clientguid = " || clientGuid || " and hi.active = 1 "
|| " and hi.typecode in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}) "
|| " and ((Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}"|| HI_9Code ||"{{{SINGLE-QUOTE}}})
or (Case when chi.TypeCode = {{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}} then chi.code end) in ({{{SINGLE-QUOTE}}}"|| HI_10Code ||"{{{SINGLE-QUOTE}}}) ) " };
If Not exist CurrentVisit_Renal Then
Void := Call HI_MLM With (visitGuid, HI_Name, HI_10Code, IssueText,HI_TYPE,CodingScheme); //(visitGuid,issuename,issuecode,issuetext,issuetype,issuescheme)
Renal_Created := "Yes";
Endif;
Endif;
/*************************** Health Issue Creation Completed **************************************************** ******************************/
// To get Last observation value charted on patient or current Values for {{{SINGLE-QUOTE}}}SCHCK_Chronic_Conditions{{{SINGLE-QUOTE}}} Observation
/*
If DocGuid Is not Null Then
LastObsVal := read First {"SELECT oflv.value "
|| " FROM CV3ClientDocument cd WITH (NOLOCK) INNER JOIN cv3ClientVisit cv WITH (NOLOCK) ON cv.GUID = cd.ClientVisitGUID And cv.clientguid = cd.ClientGUID "
|| " AND cv.chartguid = cd.ChartGUID AND cd.iscanceled = 0 And cd.Active = 1 AND cd.DocumentName in ( {{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}) "
|| " INNER JOIN SXACDObservationParameter OP WITH (NOLOCK) ON OP.ClientGUID = cd.ClientGUID AND OP.ChartGUID = cd.ChartGUID "
|| " AND OP.PatCareDocGUID = cd.PatCareDocGUID AND OP.RecordedDtm = cd.AuthoredDtm "
|| " INNER JOIN CV3ObsCatalogMasterItem omi WITH (NOLOCK) ON omi.GUID = op.ObsMasterItemGUID And omi.name in ({{{SINGLE-QUOTE}}}SCHCK_Chronic_Conditions{{{SINGLE-QUOTE}}}) "
|| " LEFT JOIN SCMObsFSListValues oflv WITH (NOLOCK) ON oflv.ParentGUID = op.ObservationDocumentGUID AND oflv.Active = 1 AND cd.ClientGUID = oflv.ClientGUID "
|| " AND oflv.ClientGUID = cd.ClientGUID "
|| " Where cv.guid = " || visitGuid
|| " And cd.guid = " || thisStructuredNoteDoc.ClientDocumentGUID
|| " And oflv.value in ({{{SINGLE-QUOTE}}}CHF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}COPD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Diabetes{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Failure{{{SINGLE-QUOTE}}}) " };
Else
LastObsVal := read First {"SELECT oflv.value "
|| " FROM CV3ClientDocument cd WITH (NOLOCK) INNER JOIN cv3ClientVisit cv WITH (NOLOCK) ON cv.GUID = cd.ClientVisitGUID And cv.clientguid = cd.ClientGUID "
|| " AND cv.chartguid = cd.ChartGUID AND cd.iscanceled = 0 And cd.Active = 1 AND cd.DocumentName in ( {{{SINGLE-QUOTE}}}Adult Patient Profile{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Adult Patient Profile - Observation{{{SINGLE-QUOTE}}}) "
|| " INNER JOIN SXACDObservationParameter OP WITH (NOLOCK) ON OP.ClientGUID = cd.ClientGUID AND OP.ChartGUID = cd.ChartGUID "
|| " AND OP.PatCareDocGUID = cd.PatCareDocGUID AND OP.RecordedDtm = cd.AuthoredDtm "
|| " INNER JOIN CV3ObsCatalogMasterItem omi WITH (NOLOCK) ON omi.GUID = op.ObsMasterItemGUID And omi.name in ({{{SINGLE-QUOTE}}}SCHCK_Chronic_Conditions{{{SINGLE-QUOTE}}}) "
|| " LEFT JOIN SCMObsFSListValues oflv WITH (NOLOCK) ON oflv.ParentGUID = op.ObservationDocumentGUID AND oflv.Active = 1 AND cd.ClientGUID = oflv.ClientGUID "
|| " AND oflv.ClientGUID = cd.ClientGUID "
|| " Where cv.guid = " || visitGuid
//|| " And cd.guid = " || thisStructuredNoteDoc.ClientDocumentGUID
|| " And oflv.value in ({{{SINGLE-QUOTE}}}CHF{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}COPD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Diabetes{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Renal Failure{{{SINGLE-QUOTE}}}) " };
Endif;
*/
// To identify the Existing Email Sent or Not
LastMLMSent := read First {"Select cd.text from cv3ClientVisit cv With (Nolock) Join CV3CommentDeclaration cd With (Nolock)
On cv.guid=cd.ClientVisitGUID And cd.ClientGUID=cv.ClientGUID and cd.ChartGUID= cv.ChartGUID
And cd.Typecode= {{{SINGLE-QUOTE}}}Reg Notified of CHF{{{SINGLE-QUOTE}}} And cd.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} And cd.ClientVisitGUID = " || visitGuid || ""};
//-------------------------------------------------------------------------------------------------------
If LocationLevelCode In ("4B","5A","5B","5E","5F","5G","6E","6F","CCU1","CCU2","CVSU","ICU","ICU Pod 2","IMC") Then
If ((HI_CHF <> "" ) or (HI_COPD <> "" ) or (HI_Diabetes <> "") or ( HI_Renal <> "") )
// And (CHF_Created = "Yes" or COPD_Created = "Yes" or Diabetes_Created = "Yes" or Renal_Created = "Yes" )
Then // To Value selection and HI Creation confirmation
//If (LastObsVal is Null ) And (LastMLMSent is Null ) Then // To Restrict One Time to send this message
If (LastMLMSent is Null ) Then // To Restrict One Time to send this message
If (VST_Code Matches Pattern "%Inpatient%") or (VST_Code Matches Pattern "%Observation%") Then
(PatientName , MRN, VisitIDCode, DOA) := Read First {" Select ClientDisplayName, IDCode, VisitIDCode, FORMAT( AdmitDtm ,{{{SINGLE-QUOTE}}}MM/dd/yyyy{{{SINGLE-QUOTE}}}) as DOA from cv3CLientVisit Where Guid = " || visitGuid || " "};
// Send a Text Message Section
PhoneNumber := read last {" select p.PhoneNumber from CV3User u with (nolock) join Cv3Phone p with (nolock) on p.PersonGUID = u.GUID " ||
" where u.displayname = {{{SINGLE-QUOTE}}}SCM, Text Messaging{{{SINGLE-QUOTE}}} and p.PhoneNote = {{{SINGLE-QUOTE}}}Outpatient Pharmacy Prescription Request{{{SINGLE-QUOTE}}} And p.Active =1 "};
//PhoneNumber := "Shivprasad.Jadhav@stclair.org;" ;
If PhoneNumber ="#Patient Registration-Pharmacy" Then
PhoneNumber := " #PatientRegistrationPharmacy@stclair.org" ;
EndIf;
//PhoneNumber := PhoneNumber,"Shivprasad.jadhav@stclair.org;";
Page_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PAGE{{{SINGLE-QUOTE}}};
MessageSubject:= "Pharmacy Insurance Information";
MessageBody := " Please enter this patients Pharmacy Insurance information into the Registration system. \n "
|| "Patient Name: "|| PatientName || " \n "
|| "Medical Record Number: "|| MRN || " \n "
|| "Account Number: "|| VisitIDCode || " \n "
|| "Date of Admission: "|| DOA || " \n " ;
PPMvoid := call Page_MLM with(PhoneNumber, MessageSubject, MessageBody);
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
CommentTypeCode := "Reg Notified of CHF";
PatientComment_Obj := call {{{SINGLE-QUOTE}}}PatientComment{{{SINGLE-QUOTE}}}.CreatePatientComment with client_visit_obj, CommentTypeCode;
PatientComment_Obj.text := "Mail Sent";
Void := Call PatientComment_Obj.Save;
EndIf;
Endif;
EndIf;
Endif;
endif; // End of Close Document
Endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,109 @@
maintenance:
title: DOC_FUNC_ADULT_PATIENT_PROFILE_CHF;;
mlmname: DOC_FUNC_ADULT_PATIENT_PROFILE_CHF;;
arden: version 2.50;;
version: 5.50;;
institution: St.Clair Hospital;;
author: Juliet M. Law;;
specialist: Dean Miklavic;;
date: 2012-06-25;;
validation: testing;;
library:
purpose: Populate CHF column on the TICU Status Board with value contained in hidden observation on the Adult Patient Profile
for patients with CHF health issue.
;;
explanation: This MLM inserts a value of "CHF" into a hidden observation on the Adult Patient Profile when a patient has a health issue
of type "Problem-Chronic", "Problem-Proced", "Problem-Visit", or "Pt-Stated" with a value of CHF. A column on the
TICU Status Board will be populated based on the contents of the hidden observation on the Adult Patient Profile.
Change history
06.25.2012 JML CSR# 26414 Created.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
if (thisDocumentCommunication.EventType = "DocumentOpening") then
//Determine if Patient has a CHF Health Issue
(chfHI) := read {"SELECT chi.Description, chi.TouchedWhen, hid.TypeCode"
|| " FROM CV3HealthIssueDeclaration hid JOIN CV3CodedHealthIssue chi"
|| " ON chi.guid = hid.codedhealthissueguid"
|| " WHERE hid.ClientGUID = " || Sql(clientGuid)
|| " AND hid.TypeCode IN ({{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Problem-Proced{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt-Stated Hx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}})"
|| " AND (hid.ShortName LIKE {{{SINGLE-QUOTE}}}%CHF%{{{SINGLE-QUOTE}}}"
|| " OR hid.ShortName LIKE {{{SINGLE-QUOTE}}}%CONGESTIVE HEART FAILURE%{{{SINGLE-QUOTE}}}"
|| " OR hid.ShortName LIKE {{{SINGLE-QUOTE}}}%CONGESTIVE CARDIAC FAILURE%{{{SINGLE-QUOTE}}})"
|| " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
|| " AND hid.Active = 1"};
if (exists chfHI) then
//Patient has CHF health issue
//Update observation on Patient Profile
chfHIValue := "CHF";
else
chfHIValue := "";
endif;
//Retrieve observation
TicuStatusBoardParameterName := "SCHCK_Health Issue_Status Board";
TicuStatusBoardParameter := first of (thisParameters WHERE thisParameters.Name = TicuStatusBoardParameterName);
if (exists TicuStatusBoardParameter) then
this_currentTicuStatusBoardObs := NEW ObservationType;
this_currentTicuStatusBoardObs.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
this_currentTicuStatusBoardObs.ParameterGUID := TicuStatusBoardParameter.ParameterGUID;
this_currentTicuStatusBoardObs.DataType := "FreeTextValue";
this_currentTicuStatusBoardObs.ValueObj := NEW FreeTextValueType;
this_currentTicuStatusBoardObs.ValueObj.Value := chfHIValue;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentTicuStatusBoardObs);
endif;
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,122 @@
maintenance:
title: DOC_FUNC_ADULT_PATIENT_PROFILE_URINARY_CATHETER_ALERT;;
mlmname: DOC_FUNC_ADULT_PATIENT_PROFILE_URINARY_CATHETER_ALERT;;
arden: version 2.50;;
version: 5.50;;
institution: St.Clair Hospital;;
author: Juliet M. Law;;
specialist: Janet Nordin;;
date: 2016-02-03;;
validation: testing;;
library:
purpose: Display alert if user answers that patient has an indwelling urinary catheter but no order exists on patient{{{SINGLE-QUOTE}}}s chart.
;;
explanation: This MLM will trigger off the user answering {{{SINGLE-QUOTE}}}Yes...{{{SINGLE-QUOTE}}} to the patient having an Indwelling Urinary Catheter.
This MLM will determine if one of the following catheter orders exist:
* Catheter: Foley
* Catheter: Indwelling Double Lumen
* Catheter: Indwelling Triple Lumen
If one of the above orders does not exist, then this MLM will display an alert informing the user to enter one of the above orders.
Change history
02.03.2016 JML CSR# 33953 Created.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
urinaryCathParamName := "SCH_CK_Indwelling Urinary Catheter";
foley_order_lst := ("{{{SINGLE-QUOTE}}}Catheter: Foley{{{SINGLE-QUOTE}}}",
"{{{SINGLE-QUOTE}}}Catheter: Indwelling Double Lumen{{{SINGLE-QUOTE}}}",
"{{{SINGLE-QUOTE}}}Catheter: Indwelling Triple Lumen{{{SINGLE-QUOTE}}}");
missingCathMsg := "This patient does not have a current order for an Indwelling Urinary Catheter. Please obtain order.";
if ( thisDocumentCommunication.EventType = "ChartObservation" ) then
//Retrieve parameter
urinaryCathParam := first of ( thisParameters WHERE thisParameters.Name = urinaryCathParamName );
if ( exists urinaryCathParam ) then
//Read Observation Value
urinaryCathObs := first of ( thisObservations WHERE thisObservations.ParameterGUID = urinaryCathParam.ParameterGUID );
if ( exists urinaryCathObs ) then
if ( thisDocumentCommunication.CurrentObservationObj.ParameterGUID = urinaryCathParam.ParameterGUID ) then
selectedYes := exists ( urinaryCathObs.ValueObj.ListItemsList.Value
WHERE urinaryCathObs.ValueObj.ListItemsList.Value = "Yes..."
AND urinaryCathObs.ValueObj.ListItemsList.IsSelected = true);
if ( selectedYes ) then
//Determine if patient has a catheter order
cathOrderExists := read last {"SELECT 1"
|| " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|| " JOIN CV3OrderUserData oud WITH (NOLOCK)"
|| " ON o.GUID = oud.OrderGUID"
|| " AND o.ClientGUID = oud.ClientGUID"
|| " WHERE o.ClientGUID = " || Sql(clientGuid)
|| " AND o.ClientVisitGUID = " || Sql(visitGuid)
|| " AND o.ChartGUID = " || Sql(chartGuid)
|| " AND o.Name IN ( " || foley_order_lst || " )"
|| " AND ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
if ( NOT ( exists cathOrderExists ) ) then
//thisDocumentCommunication.Message := missingCathMsg;
//thisDocumentCommunication.DisplayMessage := true;
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with missingCathMsg, "Missing Catheter Order", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
endif;
endif;
endif;
endif;
endif;
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,303 @@
maintenance:
title: DOC_FUNC_ADVANCE_DIRECTIVE;;
mlmname: DOC_FUNC_ADVANCE_DIRECTIVE;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Don Warnick;;
specialist: ;;
date: 2012-02-09;;
validation: testing;;
library:
purpose:
;;
explanation: This MLM manages the Advance Directive portion of the Patient Profiles. It checks boxes if an Advance Directive comment is filed.
It will make an order if a request for infomration is charted....this makes a worklist task
Change history
02.09.2012 DW CSR# 26945 - Created
11.15.2012 DW HD# 147643 - Corrected issue with mulitple order creation
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
// DOCUMENT OPENING SECTION
IF thisdocumentCommunication.EventType = "DocumentOpening" then
// Initialize the "Advance Directive Order" button
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Advance Directive Order Patient Profile");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "-" then selectedItem.IsSelected := false; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Check to see if there is an Advance Directive comment = Y on file
(AdvanceDirectiveOnFile) := read
{
" select text from CV3CommentDeclaration with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}ADVDIRONFILE{{{SINGLE-QUOTE}}} and clientguid = " || ClientGuid || " and TEXT = {{{SINGLE-QUOTE}}}y{{{SINGLE-QUOTE}}}"
};
// Check to see if the "on file at on file at St. Clair Hospital" button was previously checked. If so set Onfilechecked_before = yes.
Onfilechecked_before:= "no";
Onfilechecked_after := "no";
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK Advance Directive");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "on file at St. Clair Hospital")
then Onfilechecked_before := "yes"; else Onfilechecked_before := "no"; endif;
// If there is an Advance Directive comment = Y on file the select the appropriate radio buttons and set Onfilechecked_after = "yes"
if exist AdvanceDirectiveOnFile then
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK Advance Directive Pt has med");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "Has a Medical Advance Directive" then selectedItem.IsSelected := true; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK Advance Directive");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "on file at St. Clair Hospital" then selectedItem.IsSelected := true; Onfilechecked_after := "yes"; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Determine the Document name and whether the user is a nurse
DocumentName:= thisDocumentCommunication.documentname;
if DocumentName in ("Adult Patient Profile - Behavioral Health Outpatient","Adult Patient Profile - Infusion")
then suppressforthisdocument := "yes"; else suppressforthisdocument := "no"; endif;
theParameter := first of (thisparameters where thisparameters.Name = "sch_notmandatory1");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
then nurse := "yes"; else nurse := "no"; endif;
// Display message box reminder if approriate Document Name, User is RN, and the "request for info button" was changed from no to yes
if Onfilechecked_before = "no" and Onfilechecked_after = "yes" and nurse = "yes" and suppressforthisdocument = "no" then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n There is a scanned Advance Directive document on file. \n\n Retrieve the most current document, print it and place it on the chart" , "Reminder","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
endif;
endif;
// CHART OBSERVATION SECTION
IF thisdocumentCommunication.EventType = "ChartObservation" then
// "No Advance Directive" Buttons Section
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK Advance Directive none");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID
then
// "Requests Information on how to complete advance directive" button Section (Update the "Advance Directive Order" button)
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "requests information on how to complete advance directive")
then RequestForInformationSelected := "yes"; else RequestForInformationSelected := "no"; endif;
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Advance Directive Order Patient Profile");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "-" and RequestForInformationSelected = "yes" 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; // "Requests information..." button is selected
endif; // CHART OBSERVATION SECTION
// DOCUMENT CLOSING SECTION
IF thisdocumentCommunication.EventType = "DocumentClosing" then
// If the "Advance Directive Order" button is set to "Yes", then make a new order
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Advance Directive Order Patient Profile");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "-")
then placeorder := "yes"; else placeorder := "no";
endif;
If placeorder = "yes"
then
try
NextHour:= EXTRACT HOUR currenttime + 1 || ":00";
SessionType := "Standard";
SessionReason := "";
RequestingSource := "";
user_IDType := "Edstan Number (physician)";
order_Creation_Reason := "From Test MLM";
orderItemName := "Patient requests information on completing Advance Directive";
Catalog_Item_Modifier := NextHour;
Catalog_Item_Version := "";
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((thisdocumentCommunication.ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
user_IDCode := read last {"SELECT IDCode FROM CV3User " || " where GUID = " || thisdocumentCommunication.UserGUID};
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || thisdocumentCommunication.ClientGUID};
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with orderItemName;
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
with client_visit_obj,
general_catalog_item,
Catalog_Item_Modifier,
Catalog_Item_Version,
order_creation_reason,
RequestingCareProvider_obj,
RequestingSource,
SessionType,
SessionReason,
location_obj,
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
void := call GeneralOrder_Obj.Save;
void := call GeneralOrder_Obj.Dispose;
endtry;
// Exception Handling
catch Exception ex
debugFlag := true;
messageText := messageText || "New General Order:\n" || ex.Message || "\n\n";
endcatch;
// Clean UP
if (location_obj IS NOT NULL) then void := call location_obj.Dispose; location_obj := NULL; endif;
if (requesting_care_provider_obj IS NOT NULL) then void := call requesting_care_provider_obj.Dispose; requesting_care_provider_obj := NULL; endif;
if (general_catalog_item IS NOT NULL) then void := call general_catalog_item.Dispose; general_catalog_item := NULL; endif;
if (client_visit_obj IS NOT NULL) then void := call client_visit_obj.Dispose; client_visit_obj := NULL; endif;
endif; // End of Place Order = Yes section
endif; // End of Close Document
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,157 @@
maintenance:
title: DOC_FUNC_ADVANCE_DIRECTIVE_FOLLOWUP_CHARTING_REMINDER;;
mlmname: DOC_FUNC_ADVANCE_DIRECTIVE_FOLLOWUP_CHARTING_REMINDER;;
arden: version 2.5;;
version: 5.50;;
institution: Allscripts;;
author: Debbie Eiler;;
specialist: Don Warnick;;
date: 2011-07-18;;
validation: testing;;
library:
purpose: Remind the nurse to chart that they have followed up with the familiy on the need to bring in the patient{{{SINGLE-QUOTE}}}s Advance Directive
;;
explanation: Upon open of the Adult Assessment/Intervention Flowsheet remind the nurse that the patient family is to bring in the Advance Directive and charted follow up must occur
Change history
05.10.2016 DJW CSR#34412 Advance Directive Follow Up Created
10.26.2017 JML CSR#26413 Modified to support document scanning in SCM
;;
keywords: braden, alert, flowsheet
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
msg := "";
//Set constants indicating document type and event
FLOWSHEET := "Flowsheet";
CHARTOBSERVATION := "ChartObservation";
DOCUMENTCLOSING := "DocumentClosing";
// Get the client and visit GUIDs
client_guid := this_documentCommunication.ClientGUID;
client_visit_guid := this_documentCommunication.ClientVisitGUID;
chart_guid := this_documentCommunication.ChartGUID;
user_guid := this_documentCommunication.UserGUID;
//Retrieve DocumentType (StructuredNote or Flowsheet) and EventType
this_DocumentType := this_documentCommunication.DocumentType;
this_EventType := this_documentCommunication.EventType;
OccCode := read last {" select OccupationCode from CV3USER with (nolock) where guid = " || sql(user_guid) };
if ( OccCode IN ("RN","GN","LPN","IT") ) then
(AdvanceDirectiveDate,AdvanceDirectiveStatus,currentdate) := read last
{
" select distinct "
|| " case when cd.DocumentName is not null and com.text IS null then convert(date, fsl.TouchedWhen,112) "
|| " when cd.DocumentName is not null and com.text = {{{SINGLE-QUOTE}}}Y{{{SINGLE-QUOTE}}} and com.typecode = {{{SINGLE-QUOTE}}}ADVDIRONFILE{{{SINGLE-QUOTE}}} then convert(date, com.TouchedWhen,112) "
|| " end , "
|| " case when cd.DocumentName is not null and com.text IS null and ocmi.name IN ({{{SINGLE-QUOTE}}}SCHCK Advance Directive{{{SINGLE-QUOTE}}}) then {{{SINGLE-QUOTE}}}Instructed to bring in copy of Advance Directive{{{SINGLE-QUOTE}}} "
|| " when cd.DocumentName is not null and com.text IS null and ocmi.name IN ({{{SINGLE-QUOTE}}}SCHCK Advance Directive Pt has Med{{{SINGLE-QUOTE}}}) and fsl.value = {{{SINGLE-QUOTE}}}Unable to obtain due to patient condition{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Unable to obtain Advance Directive due to patient condition{{{SINGLE-QUOTE}}} "
|| " when cd.DocumentName is not null and com.text = {{{SINGLE-QUOTE}}}Y{{{SINGLE-QUOTE}}} and com.typecode = {{{SINGLE-QUOTE}}}ADVDIRONFILE{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}A copy has been scanned. Please update the Patient Profile{{{SINGLE-QUOTE}}} "
|| " end , "
|| " convert(date,getdate(),112) "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || SQL(client_guid) || " and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID and ocmi.name in ({{{SINGLE-QUOTE}}}SCHCK Advance Directive{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}SCHCK Advance Directive Pt has Med{{{SINGLE-QUOTE}}}) "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join cv3obscatalogitem oci with (nolock) on oci.guid = o.obsitemguid "
|| " join SCMObsFSListValues fsl with (nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL(client_guid) || " "
|| " and (fsl.value = {{{SINGLE-QUOTE}}}instructed to bring a copy to the hospital{{{SINGLE-QUOTE}}} or fsl.value = {{{SINGLE-QUOTE}}}Unable to obtain due to patient condition{{{SINGLE-QUOTE}}})) "
|| " left join CV3CommentDeclaration com with (nolock) on com.clientguid = " || SQL(client_guid) || " and com.TEXT = {{{SINGLE-QUOTE}}}y{{{SINGLE-QUOTE}}} and com.touchedwhen > fsl.touchedwhen and com.typecode = {{{SINGLE-QUOTE}}}ADVDIRONFILE{{{SINGLE-QUOTE}}} "
|| " where cd.clientguid = " || SQL(client_guid) || " and cd.ChartGUID = " || SQL(chart_guid) || " and cd.ClientVisitGUID = " || SQL(client_visit_guid) || " and cd.DocumentName like {{{SINGLE-QUOTE}}}%Patient Profile%{{{SINGLE-QUOTE}}} "
|| " and cd.CreatedWhen = "
|| " (select top 1 cdx.CreatedWhen from CV3ClientDocument cdx with (nolock) where "
|| " cdx.clientguid = " || SQL(client_guid) || " and cdx.ChartGUID = " || SQL(chart_guid) || " and cdx.ClientVisitGUID = " || SQL(client_visit_guid) || " "
|| " and cdx.DocumentName like {{{SINGLE-QUOTE}}}%Patient Profile%{{{SINGLE-QUOTE}}}) "
};
FollowupChartingDate,FollowupChartingStatus,currentdate2 := read last
{
" set concat_null_yields_null off "
|| " select "
|| " convert(date, cd.AuthoredDtm,112) {{{SINGLE-QUOTE}}}Timestamp{{{SINGLE-QUOTE}}}, "
|| " cast (o.ValueText as varchar(2000)) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + cast (fsl.value as varchar (2000)) {{{SINGLE-QUOTE}}}Value{{{SINGLE-QUOTE}}}, "
|| " convert(date,getdate(),112) "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || SQL(client_guid) || " "
|| " join CV3ObservationDocument od with (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) ON od.ObsMasterItemGUID = ocmi.GUID "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join cv3obscatalogitem oci with (nolock) ON oci.guid = o.obsitemguid "
|| " left join cv3obscatalogset ocs with (nolock) ON ocs.guid = od.ObsSetGUID "
|| " left join SCMObsFSListValues fsl with (nolock) ON fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || SQL(client_guid) || " "
|| " where cd.clientguid = " || SQL(client_guid) || " and cd.ChartGUID = " || SQL(chart_guid) || " and cd.ClientVisitGUID = " || SQL(client_visit_guid) || " "
|| " and od.active = 1 and cdd.active = 1 and cd.IsCanceled = 0 "
|| " and ocmi.description in ({{{SINGLE-QUOTE}}}SCHCK_AS Advance Directive FU{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCHCK Advance Directive{{{SINGLE-QUOTE}}})"
|| " and cd.DocumentName = {{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}} "
|| " order by ocmi.description , cd.authoreddtm "
};
// Determine if an alert should fire.
if exists AdvanceDirectiveStatus and AdvanceDirectiveStatus = "Instructed to bring in copy of Advance Directive" and currentdate > AdvanceDirectiveDate
then potential_alert := "yes";
else potential_alert := "no";
endif;
if exists FollowupChartingStatus and FollowupChartingStatus = " Patient/Family reminded to bring in copy of Advance Directive"
then suppress_alert1 := "yes";
else suppress_alert1 := "no";
endif;
if exists FollowupChartingStatus and FollowupChartingStatus = "Unable to contact family" and currentdate2 = FollowupChartingDate
then suppress_alert2 := "yes";
else suppress_alert2 := "no";
endif;
If (Extract Hour NOW) in(0,1,2,3,4,5,6,7)
then suppress_alert3 := "yes";
else suppress_alert3 := "no";
endif;
if potential_alert = "yes" and
(
suppress_alert1 = "no"
and
(suppress_alert2 = "no" and suppress_alert3 = "no")
)
then
msg := " Reminder: Advance Directive Follow-up has not been documented";
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "Advance Directive Follow up Charting Required", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
endif; // occupation
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,194 @@
maintenance:
title: BMI Checking;;
mlmname: DOC_FUNC_ANTICOAG_PLATELET_ALERT;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Shawn Head;;
specialist: ;;
date: 2013-02-15;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
02-15-2013 - CSR #: 31409 new alert for patients with anticoag order(s) AND have a platelet count less than 50 (50,000)
8-30-2013 - HelpDesk issue - Updated to use better SQL logic to extract data from database. MLM was taking 60-90 seconds to open flowsheet for a specific patient.
11-14-2013 - HelpDesk issue #: 162093 - Updated to more accuratly identify synonyms .
1-28-2014 - CSR #: 31957 - Update observation item for fall harm for the new observation created.
;;
keywords: platelet, count, anticoag, anticoagulant
;;
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";
// Receive arguments from the structured note
(thisDocumentCommunication) := argument;
// Get the user, charte, client and visit GUIDs
userGuid := thisDocumentCommunication.UserGUID;
clientGuid := thisDocumentCommunication.ClientGUID;
clientvisitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
// Chart Observation Section
//only trigger on document open
IF thisdocumentCommunication.EventType ="DocumentOpening" then
latestplatetctdttm := read last {"select MAX(entered) "
|| " from CV3BasicObservation bo with (nolock) "
|| " where bo.ClientGUID = " || SQL(clientGuid)
|| " and bo.ClientVisitGUID = " || SQL(clientvisitGuid) //{{{SINGLE-QUOTE}}}9000003475300270{{{SINGLE-QUOTE}}}
|| " and (bo.itemname in ({{{SINGLE-QUOTE}}}Platelet Count{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Count.{{{SINGLE-QUOTE}}})) " };
if latestplatetctdttm is not null then
//get the latest platelet count result for patients that have
//an active order for one of the defined anticoag medications listed.
//Medication names or synonyms like {{{SINGLE-QUOTE}}}%lovenox%{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}%Heparin%{{{SINGLE-QUOTE}}}
//%Coumadin%, {{{SINGLE-QUOTE}}}%Pradaxa%{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}%Xarelto%{{{SINGLE-QUOTE}}}
//If they dont have an anticoag order OR if they dont have any platelet count
//results this should return NULL preventing the next section from executing
//saving processing time and logic checking that is not required.
plateletct := read last {"select top 1 bo.Value "
|| " from CV3ClientVisit cv with (nolock) "
|| " inner join CV3BasicObservation bo with (nolock) on (cv.clientguid = bo.clientguid "
|| " and cv.GUID = bo.ClientVisitGUID "
|| " and bo.clientguid = " || SQL(clientGuid) //{{{SINGLE-QUOTE}}}9000064583200200{{{SINGLE-QUOTE}}}
|| " and bo.ClientVisitGUID = " || SQL(clientvisitGuid) //{{{SINGLE-QUOTE}}}9000003475300270{{{SINGLE-QUOTE}}}
|| " and (bo.itemname in ({{{SINGLE-QUOTE}}}Platelet Count{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Count.{{{SINGLE-QUOTE}}})) "
|| " and bo.Entered = " || SQL(latestplatetctdttm) || ") " // {{{SINGLE-QUOTE}}}2013-02-20 14:11:43.433{{{SINGLE-QUOTE}}})
|| " inner join CV3Order o with (nolock) on bo.ClientGuid = o.ClientGuid and bo.ClientVisitGUID = o.ClientVisitGUID "
|| " inner join CV3CatalogItemName cin with (nolock) on o.OrderCatalogMasterItemGUID = cin.OrderMasterItemGUID "
|| " where "
|| " (o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} "
|| " and o.Name is not null "
|| " and o.Active = 1 "
|| " and (o.OrderStatusCode like {{{SINGLE-QUOTE}}}AU%{{{SINGLE-QUOTE}}} or o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}}) "
|| " and (cin.Name like {{{SINGLE-QUOTE}}}%Enoxaparin%{{{SINGLE-QUOTE}}} "
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Heparin%{{{SINGLE-QUOTE}}} "
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Warfarin%{{{SINGLE-QUOTE}}} "
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Dabigatran%{{{SINGLE-QUOTE}}} "
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Rivaroxaban%{{{SINGLE-QUOTE}}} "
|| " or cin.Name like {{{SINGLE-QUOTE}}}%lovenox%{{{SINGLE-QUOTE}}} "
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Coumadin%{{{SINGLE-QUOTE}}} "
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Pradaxa%{{{SINGLE-QUOTE}}} "
|| " or cin.Name like {{{SINGLE-QUOTE}}}%Xarelto%{{{SINGLE-QUOTE}}} "
|| " or o.Name like {{{SINGLE-QUOTE}}}%Enoxaparin%{{{SINGLE-QUOTE}}} "
|| " or o.Name like {{{SINGLE-QUOTE}}}%Heparin%{{{SINGLE-QUOTE}}} "
|| " or o.Name like {{{SINGLE-QUOTE}}}%Warfarin%{{{SINGLE-QUOTE}}} "
|| " or o.Name like{{{SINGLE-QUOTE}}}%Dabigatran%{{{SINGLE-QUOTE}}} "
|| " or o.Name like {{{SINGLE-QUOTE}}}%Rivaroxaban%{{{SINGLE-QUOTE}}} "
|| " or o.Name like {{{SINGLE-QUOTE}}}%lovenox%{{{SINGLE-QUOTE}}} "
|| " or o.Name like {{{SINGLE-QUOTE}}}%Coumadin%{{{SINGLE-QUOTE}}} "
|| " or o.Name like {{{SINGLE-QUOTE}}}%Pradaxa%{{{SINGLE-QUOTE}}} "
|| " or o.Name like {{{SINGLE-QUOTE}}}%Xarelto%{{{SINGLE-QUOTE}}})) " };
endif;
//this if statement will prevent unnecessary code from being executed if
//there is no platelet count on this patients chart OR if they dont have
//an anticoag order on their chart
If plateletct is not null and (plateletct as number) <= 50 then
//get the most curernt observation date/time
//for the observation name {{{SINGLE-QUOTE}}}SCHCK_AS harm risk indicators{{{SINGLE-QUOTE}}} for the harm risk assessment
obsdttm := read last { " SELECT Distinct "
|| " isnull(MAX(cd.authoreddtm),{{{SINGLE-QUOTE}}}1900-01-01{{{SINGLE-QUOTE}}}) "
|| " FROM CV3ClientDocument CD WITH (NOLOCK) "
|| " JOIN CV3ObservationDocument OD WITH (NOLOCK) "
|| " ON OD.OwnerGUID = CD.GUID "
|| " and OD.Arctype = CD.Arctype "
|| " JOIN CV3Observation Obs WITH (NOLOCK) "
|| " ON OD.ObservationGUID = Obs.GUID "
|| " AND OD.Arctype = Obs.Arctype "
|| " left JOIN CV3ObservationXInfo OXI WITH (NOLOCK) "
|| " ON obs.GUID = OXI.observationXInfoGUID "
|| " and obs.Arctype = OXI.Arctype "
|| " LEFT JOIN CV3ObservationEntryItem OEI with (nolock) "
|| " ON OEI.GUID = OD.ParameterGUID "
|| " JOIN CV3ObsCatalogMasterItem OCMI with (nolock) "
|| " on OCMI.GUID = OD.ObsMasterItemGUID "
|| " join cv3obscatalogitem oci with (nolock) "
|| " on oci.guid = obs.obsitemguid "
|| " WHERE CD.ClientGUID = " || sql(clientguid)
|| " and cd.ClientVisitGUID = " || sql(clientvisitguid)
|| " and cd.ChartGUID = " || sql(chartguid)
|| " and oci.name in ({{{SINGLE-QUOTE}}}SCHCK_AS harm risk indicators{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCHCK_AS Harm Risk Assm{{{SINGLE-QUOTE}}})"
|| " AND OD.Active = 1 "
|| " AND CD.Active = 1 " };
//get the latest observation value from both the current and archive tables that matches the
//date/time set in the above if statement for variable obsdttm
findanticoagobsval := read last { " SELECT oflv.value "
|| " FROM CV3ClientDocument CD WITH (NOLOCK) "
|| " JOIN CV3ObservationDocument OD WITH (NOLOCK) "
|| " ON OD.OwnerGUID = CD.GUID "
|| " and OD.Arctype = CD.Arctype "
|| " JOIN CV3Observation Obs WITH (NOLOCK) "
|| " ON OD.ObservationGUID = Obs.GUID "
|| " AND OD.Arctype = Obs.Arctype "
|| " join SCMObsFSListValues oflv with (nolock) "
|| " on od.observationdocumentguid = oflv.ParentGUID "
|| " and cd.clientguid = oflv.clientguid "
|| " left JOIN CV3ObservationXInfo OXI WITH (NOLOCK) "
|| " ON obs.GUID = OXI.observationXInfoGUID "
|| " and obs.Arctype = OXI.Arctype "
|| " LEFT JOIN CV3ObservationEntryItem OEI with (nolock) "
|| " ON OEI.GUID = OD.ParameterGUID "
|| " JOIN CV3ObsCatalogMasterItem OCMI with (nolock) "
|| " on OCMI.GUID = OD.ObsMasterItemGUID "
|| " join cv3obscatalogitem oci with (nolock) "
|| " on oci.guid = obs.obsitemguid "
|| " and oci.name in ({{{SINGLE-QUOTE}}}SCHCK_AS harm risk indicators{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCHCK_AS Harm Risk Assm{{{SINGLE-QUOTE}}})"
|| " AND oflv.Value like {{{SINGLE-QUOTE}}}%50,000%{{{SINGLE-QUOTE}}} "
|| " WHERE CD.ClientGUID = " || sql(clientguid)
|| " and cd.ClientVisitGUID = " || sql(clientvisitguid)
|| " and cd.ChartGUID = " || sql(chartguid)
|| " and cd.AuthoredDtm = " || SQL(obsdttm)
|| " AND OD.Active = 1 "
|| " AND CD.Active = 1 " };
//This section checks to if there was a documented observation on the
//A/I flowsheet with a vlue like {{{SINGLE-QUOTE}}}%50,000%{{{SINGLE-QUOTE}}}. If one is not documented
//AND if the plateletct is less than 50 (indicating less than 50,000)
//then the warning message will fire; otherwise it will not display the
//warning message to the user.
if findanticoagobsval is null and (plateletct as number) <= 50 then
msg:= "This patient has an increased risk of harm should a fall occur due to a Platelet Count less than 50,000 "
|| "AND an active Anticoag order."
|| "\n\nPlease reassess the harm risk indicators and consider appropriate interventions aimed at reducing harm.";
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
endif;
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,155 @@
maintenance:
title: DOC_FUNC_BEHAVIORAL_HEALTH_OUTPATIENT_ALERTS;;
mlmname: DOC_FUNC_BEHAVIORAL_HEALTH_OUTPATIENT_ALERTS;;
arden: version 2.50;;
version: 18.4;;
institution: St.Clair Hospital;;
author: Juliet M. Law;;
specialist: Peggy Leschak;;
date: 2019-08-29;;
validation: testing;;
library:
purpose: Display alert if user answers {{{SINGLE-QUOTE}}}YES{{{SINGLE-QUOTE}}} to a set of nutritional questions on the Adult Patient Profile - Behavorial Health Outpatient document.
;;
explanation: This MLM will trigger off the user answering {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to the following questions:
* Is this a change in appetite?
* Weight loss or weight gain of 10 pounds or more in the past 3 months?
* Do you have any dental problems affecting your nutrition?
This MLM will trigger off the user answering anything EXCEPT {{{SINGLE-QUOTE}}}None{{{SINGLE-QUOTE}}} to the following question:
* History of Eating Disorder or current behaviors indicative of a possible eating disorder?
The alert will only display once.
Change history
08.29.2019 JML CSR# 38601 Created.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
nutParamName := ( "SCH_PRO_Nutr change of app"
, "SCH_PRO_Weight loss"
, "SCH_PRO_Weight gain"
, "SCH_PRO_Nutr Dental SG"
, "PRO nutrition eating disorderOutpt");
abuseParamName := ( "PRO Abuse Screen referangency_BH profile"
, "PRO Abuse Screen referangency_BH profile2"
, "PRO Abuse Screen referangency_BH profile3"
, "PRO Abuse Screen referangency_BH profile4"
, "PRO Abuse Screen referangency_BH profile5"
, "PRO Abuse Screen referangency_BH profile6"
, "PRO Abuse Screen referangency_BH profile7" );
displayNutMessage := false;
displayAbuseMessage := false;
nutritionMsg := "NUTRITION ALERT!\n\nNotify Attending Physician for the appropriate referral. Add problem to Referral or Deferral section of the patient{{{SINGLE-QUOTE}}}s treatment plan.";
abuseMsg := "ABUSE ALERT!\n\nNotify Attending Physician for the appropriate referral. Add problem to Referral or Deferral section of the patients treatment plan";
if ( thisDocumentCommunication.EventType = "DocumentClosing" ) then
for var IN 1 seqto count nutParamName do
nutParam := first of ( thisParameters WHERE thisParameters.Name = nutParamName[var] );
if ( exists nutParam ) then
nutObs := first of ( thisObservations WHERE thisObservations.ParameterGUID = nutParam.ParameterGUID );
if ( exists nutObs ) then
selectedYes := exists ( nutObs.ValueObj.ListItemsList.Value
WHERE nutObs.ValueObj.ListItemsList.Value = "yes"
AND nutObs.ValueObj.ListItemsList.IsSelected = true );
selectedNonNone := count ( nutObs.ValueObj.ListItemsList.Value
WHERE nutObs.ValueObj.ListItemsList.Value IN ( "anorexia","bulimia","induced vomiting","overuse of laxatives","excessive exercise")
AND nutObs.ValueObj.ListItemsList.IsSelected = true );
if ( selectedYes ) then
displayNutMessage := true;
endif;
if ( selectedNonNone > 0 ) then
displayNutMessage := true;
endif;
endif;
endif;
enddo;
for var IN 1 seqto count abuseParamName do
abuseParam := first of ( thisParameters WHERE thisParameters.Name = abuseParamName[var] );
if ( exists abuseParam ) then
abuseObs := first of ( thisObservations WHERE thisObservations.ParameterGUID = abuseParam.ParameterGUID );
if ( exists abuseObs ) then
selectedYes := exists ( abuseObs.ValueObj.ListItemsList.Value
WHERE abuseObs.ValueObj.ListItemsList.Value = "yes"
AND abuseObs.ValueObj.ListItemsList.IsSelected = true );
if ( selectedYes ) then
displayAbuseMessage := true;
endif;
endif;
endif;
enddo;
if ( displayNutMessage ) then
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with nutritionMsg, "Nutrition Behavior Alert", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
endif;
if ( displayAbuseMessage ) then
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with abuseMsg, "Abuse Screening Alert", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Exclamation" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
endif;
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,232 @@
maintenance:
title: DOC_FUNC_BLOOD_REFUSAL_HEALTH_ISSUE;;
mlmname: DOC_FUNC_BLOOD_REFUSAL_HEALTH_ISSUE;;
arden: version 5.5;;
version: 15.10;;
institution: St.Clair Hospital;;
author: Juliet M. Law;;
specialist: ;;
date: 2016-06-16;;
validation: testing;;
library:
purpose: Create a health issue when blood refusal observation is charted on any Adult Patient Profile structured note.
;;
explanation: This MLM will fire on the following structured note documents:
* Adult Patient Profile
* OB Patient Profile
* Adult Patient Profile - Behavioral Health
* Adult Patient Profile - Behavioral Health Outpatient
* Adult Patient Profile - Infusion
* Adult Patient Profile - Observation
When "Refuses Blood Products" observation value is selected under Transfusion History, a Problem-Chronic health issue, "Refusal of blood product", will be created, if it doesn{{{SINGLE-QUOTE}}}t exist.
When "Refuses Blood Products due to Religious Beliefs" is selected under Transfusion History, a Problem-Chronic health issue, "Transfusion of blood product refused for religious reason",
will be created, if it doesn{{{SINGLE-QUOTE}}}t exist.
Change history
06.16.2016 JML CSR 33898: Created
;;
keywords:
;;
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";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid, ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
transfusionParameterName := "PRO transfuse restrictions";
refusesBloodValue := "Refuses Blood Products";
createBV := false;
refusesBloodReligionValue := "Refuses Blood Products due to Religious Beliefs";
createRBV := false;
blood_hi_name := "";
//Determine if patient has existing Blood Refusal health issue
bloodRefuseHI := READ LAST { "SELECT hi.ShortName"
|| " FROM CV3HealthIssueDeclaration hi WITH (NOLOCK) JOIN CV3CodedHealthIssue chi WITH (NOLOCK)"
|| " ON hi.CodedHealthIssueGUID = chi.GUID"
|| " WHERE hi.ClientGUID = " || SQL(clientGuid)
|| " AND hi.ClientVisitGUID = " || SQL(visitGuid)
|| " AND hi.Active = 1"
|| " AND hi.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| " AND hi.ICD10Code is Not null "
|| " AND hi.TypeCode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}"
|| " AND ( hi.Text = {{{SINGLE-QUOTE}}}Refusal of blood product{{{SINGLE-QUOTE}}}"
|| " OR hi.ShortName = {{{SINGLE-QUOTE}}}Refusal of blood product{{{SINGLE-QUOTE}}})" };
rBloodRefuseHI := READ LAST { "SELECT hi.ShortName"
|| " FROM CV3HealthIssueDeclaration hi WITH (NOLOCK) JOIN CV3CodedHealthIssue chi WITH (NOLOCK)"
|| " ON hi.CodedHealthIssueGUID = chi.GUID"
|| " WHERE hi.ClientGUID = " || SQL(clientGuid)
|| " AND hi.ClientVisitGUID = " || SQL(visitGuid)
|| " AND hi.Active = 1"
|| " AND hi.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| " AND hi.ICD10Code is Not null "
|| " AND hi.TypeCode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}"
|| " AND ( hi.Text = {{{SINGLE-QUOTE}}}Transfusion of blood product refused for religious reason{{{SINGLE-QUOTE}}}"
|| " OR hi.ShortName = {{{SINGLE-QUOTE}}}Transfusion of blood product refused for religious reason{{{SINGLE-QUOTE}}})" };
if (thisDocumentCommunication.EventType = "ChartObservation") Then
//Determine value that they selected
bloodRestrictParam := first of ( thisParameters WHERE thisParameters.Name = transfusionParameterName );
bloodRestrictObs := first of ( thisObservations WHERE thisObservations.ParameterGUID = bloodRestrictParam.ParameterGUID );
bloodRestrictValues := ( bloodRestrictObs.ValueObj.ListItemsList.Value WHERE bloodRestrictObs.ValueObj.ListItemsList.IsSelected = true );
//If {{{SINGLE-QUOTE}}}Refuses Blood Products{{{SINGLE-QUOTE}}} value selected AND {{{SINGLE-QUOTE}}}Refusal of blood product{{{SINGLE-QUOTE}}} HI doesn{{{SINGLE-QUOTE}}}t exist, create HI
if ( refusesBloodValue IN bloodRestrictValues AND not exists bloodRefuseHI ) then
createBV := true;
else
createBV := false;
endif;
//If {{{SINGLE-QUOTE}}}Refuses Blood Products due to Religious Beliefs{{{SINGLE-QUOTE}}} value selected AND {{{SINGLE-QUOTE}}}Transfusion of blood product refused for religious reason{{{SINGLE-QUOTE}}} hi doesn{{{SINGLE-QUOTE}}}t exist, create HI
if ( refusesBloodReligionValue IN bloodRestrictValues AND not exists rBloodRefuseHI ) then
createRBV := true;
else
createRBV := false;
endif;
//If either value above selected to create HI, alert user
if ( createBV OR createRBV ) then
msg_hi := "This selection will create a health issue for this visit of ";
if ( createBV ) then
msg_hi := msg_hi || "{{{SINGLE-QUOTE}}}Refusal of blood product{{{SINGLE-QUOTE}}}";
elseif ( createRBV ) then
msg_hi := msg_hi || "{{{SINGLE-QUOTE}}}Transfusion of blood product refused for religious reason{{{SINGLE-QUOTE}}}";
endif;
msg_hi := msg_hi || "\n\nClick {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to confirm your selection. ";
msg_hi := msg_hi || "\n\nClick {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} if you wish to change your selection.";
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show WITH msg_hi, "Confirm Blood Avoidance/Restrictions", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
if ( ( dialogRes as String ) = "Yes" ) then
//User selected Yes, create appropriate HI
try
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}Retrieve client:{{-R}}\n" ||
ex.Message || "\n\n";
if ex.InnerException is not null net_object then
error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
endif;
if ( client_visit_obj is NOT NULL ) then
void:= call client_visit_obj.Dispose; client_visit_obj:= null;
endif;
endcatch;
try
NewHealthIssueHIType := "Problem-Visit";
if ( createRBV ) then
NewHealthIssueHICode := "Z53.1"; //"V13.3";
elseif ( createBV ) then
NewHealthIssueHICode := "Z78.9";
endif;
NewHealthIssueHIScheme := "ICD10"; //"ICD9";
dd := EXTRACT Day now;
mn := EXTRACT Month now;
yr := EXTRACT Year now;
Terms := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindIMOTerms with (NewHealthIssueHIScheme,NewHealthIssueHICode);
for i IN 1 SEQTO (Terms.Count as Number ) do
HI_obj := Terms[i];
HI_Name := HI_obj.TermName as string;
If HI_Name = "Refusal of blood product" then
HI_NO := i;
elseif HI_Name = "Transfusion of blood product refused for religious reason" then
HI_NO := i;
endif;
enddo;
If HI_NO is Null Then
HI_NO :=1 ;
Endif;
New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, Terms[HI_NO]);
PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with (yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} );
New_HealthIssue_obj.OnsetDate := PartialDate_obj;
New_HealthIssue_obj.Text := "Created from Patient Profile information. " ;
if ( createBV ) then
New_HealthIssue_obj.Name := "Refusal of blood product";
elseif ( createRBV ) then
New_HealthIssue_obj.Name := "Transfusion of blood product refused for religious reason";
endif;
if ( New_HealthIssue_obj is NOT NULL ) then
void := call New_HealthIssue_obj.Save;
void := call New_HealthIssue_obj.Dispose;
endif;
if ( client_visit_obj is NOT NULL ) then
void:= call client_visit_obj.Dispose;
client_visit_obj:= null;
endif;
endtry;
catch exception ex
error_occurred := true;
if ( New_HealthIssue_obj is NOT NULL ) then
void:= call New_HealthIssue_obj.Dispose;
New_HealthIssue_obj:= null;
endif;
endcatch;
else
void := "";
endif;
endif;
endif;
;;
evoke:
;;
logic:
conclude true;
;;
action:
return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,85 @@
maintenance:
title: BMI Checking;;
mlmname: DOC_FUNC_BMI_Check;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Teresa Spicuzza;;
specialist: ;;
date: 2011-06-28;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
06.28.2011 TS Created
01.30.2012 DW Optimized for FP1
;;
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";
// Receive arguments from the structured note
(thisDocumentCommunication) := argument;
// Get the user, charte, client and visit GUIDs
userGuid := thisDocumentCommunication.UserGUID;
clientGuid := thisDocumentCommunication.ClientGUID;
clientvisitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
/* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
UserCode := read last
{"Select occupationcode "
||" From cv3user "
||" Where Guid = " || SQL(userguid) };
// Chart Observation Section
IF thisdocumentCommunication.EventType ="DocumentOpening" and usercode is in ("RN", "LPN", "CNA", "PCA", "GN", "IT") then
BMIvaluetext, obsname := read last {"Select o.ValueText, oci.name from CV3ClientDocumentcur cd "
|| " join CV3ClientDocDetailcur cdd on (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || SQL(ClientGuid) || ") "
|| " join CV3ObservationDocumentcur od on cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3ObsCatalogMasterItem on od.ObsMasterItemGUID = CV3ObsCatalogMasterItem.GUID "
|| " join CV3Observationcur o on o.GUID = od.ObservationGUID "
|| " LEFT OUTER JOIN CV3User u ON o.UserGUID = u.GUID "
|| " join cv3obscatalogitem oci on oci.guid = o.obsitemguid and oci.name = {{{SINGLE-QUOTE}}}SCH_vs_BMI{{{SINGLE-QUOTE}}} "
|| " where cd.clientguid = " || SQL(ClientGuid) || " and cd.chartguid = " || SQL(ChartGuid)
|| " and o.ValueText is not null "
|| " order by cd.authoreddtm asc " };
If BMIvaluetext is null then
msg:= "This patient does not have a documented BMI."
|| "\n\nPlease document the patient{{{SINGLE-QUOTE}}}s Height/Length and Admission/Current Weight in the same time column to calculate the BMI.";
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,135 @@
maintenance:
title: DOC_FUNC_BRADEN_SCALE_CHANGE_ALERT;;
mlmname: DOC_FUNC_BRADEN_SCALE_CHANGE_ALERT;;
arden: version 2.5;;
version: 5.50;;
institution: Allscripts;;
author: Juliet M. Law ;;
specialist: ;;
date: 2011-07-18;;
validation: testing;;
library:
purpose: Alert on decrease in Braden Scale Score.
;;
explanation: On the Adult Assessment/Intervention Flowsheet, if the Braden Risk criteria calculates a Braden score
less than or equal to 18 and the last charted Braden score charted was greater than the current Braden score, alert
the user.
;;
keywords: braden, alert, flowsheet
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Called MLMs to set up the CDS and return obs values
set_cds_vars := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_DEFINITION_MLM{{{SINGLE-QUOTE}}};
read_obs_value := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_OBS_VALUE_MLM{{{SINGLE-QUOTE}}};
/**************Make Changes To Spelling And Flags In This Section**************/
//Set up variables; initialize
braden_param := "AS SC braden score CAL";
msg := "";
mlm_name := "DOC_FUNC_CREATE_DIETITIAN_CONSULT_FROM_BRADEN_OBS";
//Set constants indicating document type and event
FLOWSHEET := "Flowsheet";
CHARTOBSERVATION := "ChartObservation";
DOCUMENTCLOSING := "DocumentClosing";
/******************************************************************************/
//Initialize DocumentCommunication objects
(this_documentCommunication, client_guid, client_visit_guid, chart_guid,
user_guid, document_type, document_name, event_type,
configuration_guid, this_currentObs, CancelEventFlag, this_fs_doc,
authored_by_guid, isIOFlowsheetFlag, client_document_guid, this_parameters,
this_columnList, this_currentColumn, this_chartedObservationsList,
this_parameters_displayName, current_parameter, current_parameter_name, current_parameter_guid,
current_parameter_datatype, selectedItems, selectedItems_Value, current_value,
diagnostic_message, displayMessageFlag) := call set_cds_vars WITH (this_documentCommunication);
//Retrieve DocumentType (StructuredNote or Flowsheet) and EventType
this_DocumentType := this_documentCommunication.DocumentType;
this_EventType := this_documentCommunication.EventType;
//Process logic on Flowsheets when the document is closing
if (this_DocumentType = FLOWSHEET AND this_EventType = DOCUMENTCLOSING) then
//Retrieve Braden Score parameter
theParameter := first of (this_parameters WHERE this_parameters.Name = braden_param);
if (exists theParameter) then
//Called MLM to retrieve value for Braden Score parameter
(this_documentCommunication, selectedValue, currentValue) := CALL read_obs_value WITH (this_documentCommunication, theParameter.Name, "Read");
if (exists currentValue) then
//Set current Braden Score variable
currentBradenScore := currentValue as number;
//Retrieve DateTime from current charted column
chartedDateTime := first of (this_columnList.DateTime
where this_columnList.ClientDocumentGUID = this_currentObs.ClientDocumentGUID);
//Retrieve previously charted Braden Score from database;
//Current charted column DateTime used to exclude current braden score value in the case
//that a modification is being made
oldBradenScore := ();
(oldBradenScore) := read {"SELECT o.ValueText, cd.touchedWhen "
|| " FROM CV3ClientDocumentcur cd JOIN CV3ClientDocDetailcur cdd "
|| " ON cdd.ClientDocumentGUID = cd.GUID "
|| " JOIN CV3ObservationDocumentcur od "
|| " ON cdd.CLientDocumentGUID = od.OwnerGUID "
|| " JOIN CV3ObsCatalogMasterItem ocmi"
|| " ON od.ObsMasterItemGUID = ocmi.GUID"
|| " JOIN CV3Observationcur o "
|| " ON o.GUID = od.ObservationGUID"
|| " LEFT OUTER JOIN CV3User u "
|| " ON o.UserGUID = u.GUID"
|| " JOIN cv3obscatalogitem oci "
|| " ON oci.guid = o.obsitemguid "
|| " WHERE cd.clientguid = " || SQL(client_guid)
|| " AND cd.chartguid = " || SQL(chart_guid)
|| " AND cd.ClientVisitGUID = " || SQL(client_visit_guid)
|| " AND oci.name = {{{SINGLE-QUOTE}}}" || braden_param || "{{{SINGLE-QUOTE}}}"
|| " AND o.ValueText is not null"
|| " AND cdd.Active = 1"
|| " AND od.active = 1"
|| " AND cd.authoreddtm < {{{SINGLE-QUOTE}}}" || chartedDateTime || "{{{SINGLE-QUOTE}}}"
|| " ORDER BY cd.authoreddtm asc "
, primaryTime = touchedWhen};
lastBradenScore := last of (oldBradenScore) as number;
//If current Braden Score less than or equal to 18 AND the current Braden Score is less than
//the last charted Braden Score, then alert the user.
if (currentBradenScore <= 18) then
if (currentBradenScore < lastBradenScore) then
msg := "Today{{{SINGLE-QUOTE}}}s Braden Score has decreased since the last assessment. Additional Skin Care "
|| "Interventions might be indicated.";
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "Braden Scale Change", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
endif;
endif;
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,345 @@
maintenance:
title: DOC_FUNC_CARE_TRANSITIONS_INPATIENT_ASSESSMENT;;
mlmname: DOC_FUNC_CARE_TRANSITIONS_INPATIENT_ASSESSMENT;;
arden: version 6.1;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Juliet Law;;
specialist: Dean Miklavic;;
date: 2014-12-04;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
12.04.2014 JML CSR 32423: Create date.
01.27.2015 JML Moved to Production.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Receive arguments from the structured note
(this_documentCommunication) := argument;
// .Net assemblies required for ObjectsPlus
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Include MLM
str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
//Include Called MLM to setup CDS objects
set_cds_vars := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
//Document Types
STRUCTUREDNOTE := "StructuredNote";
//Event Types
DOCUMENTCLOSING := "DocumentClosing";
CHARTOBSERVATION := "ChartObservation";
DOCUMENTOPENING := "DocumentOpening";
//Setting debugFlag to True will allow popup dialogs containing debug information to appear
debugFlag := false;
//Initialize CDS objects via MLM call
(this_documentCommunication, client_guid, client_visit_guid, client_chart_guid, user_guid,
document_type, document_name, event_type, configuration_guid, this_currentObj, CancelEventFlag,
this_structuredNoteDoc, authored_date_time, authored_by_guid, client_document_guid, document_date_time,
isNewFlag, isIncompleteFlag, isResultsPendingFlag, isPriorityFlag, this_parameters,
this_chartedObservationsList, this_parameters_display_name, current_parameter, current_parameter_name,
current_parameter_guid, current_parameter_DataType, selectedItems, selectedItems_value, current_value,
diagnosticMessage, displayMessageFlag, CoSigner1, CoSigner2, DocumentTopic) := CALL set_cds_vars WITH
(this_documentCommunication);
//Set up debugging information to be captured
messageText := "";
if (debugFlag = true) then
messageText := "Debug Information:\n\n";
messageText := messageText || " DOC_FUNC_PREOPERATIVE_CHECKLIST mlm called.\n\n";
endif;
//Local Variables
theDocumentName := "Care Transitions Inpatient Assessment";
// 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];
if ( event_type = DOCUMENTOPENING AND document_name = theDocumentName ) then
//Get the patient{{{SINGLE-QUOTE}}}s last inpatient / obs discharge datetime
last_IPOB_discharge_date := read last {"SELECT Top 1 cv.DischargeDtm"
|| " FROM CV3ClientVisit cv WITH (NOLOCK)"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " AND cv.VisitStatus = {{{SINGLE-QUOTE}}}DSC{{{SINGLE-QUOTE}}}"
|| " AND cv.TypeCode IN ({{{SINGLE-QUOTE}}}Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Observation{{{SINGLE-QUOTE}}})"
|| " ORDER BY cv.DischargeDtm DESC"};
//Retrieve IPOBS Admissions observation
ipParameterName := "SCH_Quality_IPOBS_Admissions_Last30days";
ipParameter := first of ( this_parameters WHERE this_parameters.Name = ipParameterName );
if ( exists ipParameter ) then
//Retrieve number of inpatient/observation discharges in the last 30 days
num_IPOBS_visits := read last {"SELECT Count(cv.Guid)"
|| " FROM CV3Client c WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
|| " ON c.GUID = cv.ClientGUID"
|| " WHERE c.GUID = " || Sql(client_guid)
|| " AND cv.TypeCode IN ({{{SINGLE-QUOTE}}}Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Observation{{{SINGLE-QUOTE}}})"
|| " AND cv.DischargeDtm >= DATEADD(day, -30, getdate())"
|| " AND cv.DischargeDtm < GetDate()"
|| " AND cv.VisitStatus = {{{SINGLE-QUOTE}}}DSC{{{SINGLE-QUOTE}}}"};
if ( exists num_IPOBS_visits ) then
//Setup object type to write to observation
this_currentIPOBSVisitObs := NEW ObservationType;
this_currentIPOBSVisitObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentIPOBSVisitObs.ParameterGUID := ipParameter.ParameterGUID;
this_currentIPOBSVisitObs.DataType := "NumericValue";
this_currentIPOBSVisitObs.ValueObj := NEW NumericValueType;
this_currentIPOBSVisitObs.ValueObj.Value := num_IPOBS_visits as number;
this_structuredNoteDoc.ChartedObservationsList := (this_structuredNoteDoc.ChartedObservationsList, this_currentIPOBSVisitObs);
endif;
endif; //End ipParameter Exists
//Retrieve ED Admissions observation
edParameterName := "SCH_Quality_ED_Admissions_Last30days";
edParameter := first of ( this_parameters WHERE this_parameters.Name = edParameterName );
if ( exists edParameter ) then
//Retrieve number of ED discharges in last 30 days
num_ED_visits := read last {"SELECT Count(cv.Guid)"
|| " FROM CV3Client c WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
|| " ON c.GUID = cv.ClientGUID"
|| " WHERE c.GUID = " || Sql(client_guid)
|| " AND cv.TypeCode = {{{SINGLE-QUOTE}}}Emergency{{{SINGLE-QUOTE}}}"
|| " AND cv.DischargeDtm >= DATEADD(day, -30, getdate())"
|| " AND cv.DischargeDtm < GetDate()"
|| " AND cv.VisitStatus = {{{SINGLE-QUOTE}}}DSC{{{SINGLE-QUOTE}}}"};
if ( exists num_ED_visits ) then
//Setup object type to write to observation
this_currentEDVisitObs := NEW ObservationType;
this_currentEDVisitObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentEDVisitObs.ParameterGUID := edParameter.ParameterGUID;
this_currentEDVisitObs.DataType := "NumericValue";
this_currentEDVisitObs.ValueObj := NEW NumericValueType;
this_currentEDVisitObs.ValueObj.Value := num_ED_visits as number;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentEDVisitObs );
endif;
endif; //END edParameter Exists
//Retrieve Last Discharge Date observation
dscParameterName := "SCH_Quality_Last_Discharge_Date";
dscParameter := first of ( this_parameters WHERE this_parameters.Name = dscParameterName );
if ( exists dscParameter ) then
//Retrieve last inpatient, observation, or emergency discharge date
last_discharge_date := read last {"SELECT cv.DischargeDtm"
|| " FROM CV3Client c WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
|| " ON c.GUID = cv.ClientGUID"
|| " WHERE c.GUID = " || Sql(client_guid)
|| " AND cv.DischargeDtm IS NOT NULL"
|| " AND cv.TypeCode IN ({{{SINGLE-QUOTE}}}Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Observation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Emergency{{{SINGLE-QUOTE}}})"
|| " ORDER BY cv.DischargeDtm asc"};
if ( exists last_discharge_date ) then
//Setup object type to write to observation
this_currentDSCObs := NEW ObservationType;
this_currentDSCObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentDSCObs.ParameterGUID := dscParameter.ParameterGUID;
this_currentDSCObs.DataType := "DateValue";
this_currentDSCObs.ValueObj := NEW DateValueType;
this_currentDSCObs.ValueObj.Value := last_discharge_date;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentDSCObs );
endif;
endif; //END dscParameter exists
//Retrieve Primary Insurance observation
insParameterName := "SCH_Quality_Primary_Insurance";
insParameter := first of ( this_parameters WHERE this_parameters.Name = insParameterName );
if ( exists insParameter ) then
//Retrieve primary insurance
primary_ins := read last {"SELECT TOP 1 ic.Name"
|| " FROM CV3FRPContract fc WITH (NOLOCK) JOIN CV3FRP f WITH (NOLOCK)"
|| " ON fc.FRPGUID = f.GUID"
|| " JOIN SXAAMInsuranceCarrier ic WITH (NOLOCK)"
|| " ON f.InsuranceCarrierID = ic.InsuranceCarrierID"
|| " WHERE fc.ClientGUID = " || Sql(client_guid)
|| " AND fc.ClientVisitGUID = " || Sql(client_visit_guid)
|| " AND fc.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
|| " ORDER BY fc.SequenceNum"};
if ( exists primary_ins ) then
//Setup object to write to observation
this_currentInsObs := NEW ObservationType;
this_currentInsObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentInsObs.ParameterGUID := insParameter.ParameterGUID;
this_currentInsObs.DataType := "FreeTextValue";
this_currentInsObs.ValueObj := NEW FreeTextValueType;
this_currentInsObs.ValueObj.Value := primary_ins;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentInsObs );
endif;
endif; //END insParameter Exists
//Retrieve the Home Care Last Admission observation
hclaParameterName := "SCH_Quality_Home_Care_Last_Admission";
hclaParameter := first of ( this_parameters WHERE this_parameters.Name = hclaParameterName );
if ( exists hclaParameter ) then
//Retrieve Home Care Order Information
( orderGuid,
orderSummary ) := read {"SELECT o.GUID, IsNull(o.SummaryLine,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}})"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.GUID = o.ClientVisitGUID"
|| " AND cv.ClientGUID = o.ClientGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " AND ( o.NAME = {{{SINGLE-QUOTE}}}Home Health Services{{{SINGLE-QUOTE}}} OR o.NAME = {{{SINGLE-QUOTE}}}DME - Home Care{{{SINGLE-QUOTE}}} OR o.NAME = {{{SINGLE-QUOTE}}}Home Health Services Consult{{{SINGLE-QUOTE}}})"
|| " AND cv.TypeCode IN ({{{SINGLE-QUOTE}}}Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Observation{{{SINGLE-QUOTE}}})"
|| " AND cv.DischargeDtm = " || Sql(last_IPOB_discharge_date)
|| " AND ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
if ( exists orderGuid ) then
//Preselect the {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} on the observation
preselectValue := "Yes";
if ( count orderGuid = 1 ) then
if ( last of ( orderSummary ) IS NULL ) then
parameterValue := "";
else
parameterValue := last of ( orderSummary );
endif;
parameterValue := Trim(parameterValue);
else
if ( first of (orderSummary) IS NULL ) then
parameterValue := "";
else
parameterValue := first of ( Trim(orderSummary) ) || "\n\n";
endif;
if ( last of (orderSummary) IS NULL ) then
parameterValue := parameterValue || "";
else
parameterValue := parameterValue || last of ( Trim(orderSummary) );
endif;
endif;
else
preselectValue := "No";
endif;
//Setup the object to write to the observation
this_currentHCObs := NEW ObservationType;
this_currentHCObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentHCObs.ParameterGUID := hclaParameter.ParameterGUID;
this_currentHCObs.DataType := "ListValue";
this_currentHCObs.ValueObj := NEW ListValueType;
this_currentHCObs.ValueObj.ListGUID := hclaParameter.ConfigurationObj.ListGUID;
listItems := ();
for item IN hclaParameter.ConfigurationObj.ListItemsList do
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if ( selectedItem.Value = "Yes" AND preselectValue = "Yes" ) then
selectedItem.IsSelected := true;
endif;
if ( selectedItem.Value = "No" AND preselectValue = "Yes" ) then
selectedItem.IsSelected := false;
endif;
if ( selectedItem.Value = "No" AND preselectValue = "No" ) then
selectedItem.IsSelected := true;
endif;
if ( selectedItem.Value = "No" AND preselectValue = "Yes" ) then
selectedItem.IsSelected := false;
endif;
listItems := ( listItems, selectedItem );
enddo;
this_currentHCObs.ValueObj.ListItemsList := listItems;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentHCObs );
if ( exists orderGUID ) then
//Retrieve the Home Care Agency observation
agencyParameterName := "SCH_Quality_HomeCareAgency";
agencyParameter := first of ( this_parameters WHERE this_parameters.Name = agencyParameterName );
if ( exists agencyParameter ) then
//Setup object to write to observation
this_currentAGObs := NEW ObservationType;
this_currentAGObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentAGObs.ParameterGUID := agencyParameter.ParameterGUID;
this_currentAGObs.DataType := "FreeTextValue";
this_currentAGObs.ValueObj := NEW FreeTextValueType;
this_currentAGObs.ValueObj.Value := parameterValue;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentAGObs);
endif;
endif;
endif; //END hclaParameter Exists
//Retrieve Admitting Diagnosis observation
admDiagParameterName := "SCH_Quality_Admitting_Diagnosis";
admDiagParameter := first of ( this_parameters WHERE this_parameters.Name = admDiagParameterName );
if ( exists admDiagParameter ) then
//Retrieve admitting diagnosis
adm_diagnosis := read last {"SELECT hid.Text"
|| " FROM CV3HealthIssueDeclaration hid WITH (NOLOCK)"
|| " WHERE hid.ClientGUID = " || Sql(client_guid)
|| " AND hid.ClientVisitGUID = " || Sql(client_visit_guid)
|| " AND hid.TypeCode = {{{SINGLE-QUOTE}}}Admitting Dx{{{SINGLE-QUOTE}}}"
|| " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
|| " AND hid.Active = 1"};
if ( exists adm_diagnosis ) then
//Setup object to write to observation
this_currentAdmObs := NEW ObservationType;
this_currentAdmObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentAdmObs.ParameterGUID := admDiagParameter.ParameterGUID;
this_currentAdmObs.DataType := "FreeTextValue";
this_currentAdmObs.ValueObj := NEW FreeTextValueType;
this_currentAdmObs.ValueObj.Value := adm_diagnosis;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentAdmObs );
endif;
endif; //END admDiagParameter Exists
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,257 @@
maintenance:
title: DOC_FUNC_CARE_TRANSITIONS_INPATIENT_ASSESSMENT_CLOSE;;
mlmname: DOC_FUNC_CARE_TRANSITIONS_INPATIENT_ASSESSMENT_CLOSE;;
arden: version 6.1;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav, GOS Allscripts;;
date: 2014-12-04;;
validation: testing;;
library:
purpose: When user selects YES on the "Outpatient Pharmacy Services requested" observation and clicks SAVE,
automatically create a [Pharmacy Discharge Prescription Order] order item for the patient.
If there is text in the suggested dictionary text box on the structured note (Example: Lasix, Coreg). Copy this text into the Special Instructions box on the order item.
MLM will also retrieve and populate Pharmacy Insurance information from the Patient Info / Comments tab.
Set the Consult Indications data item to: "Fill Patient Prescription" from the drop down selection.
;;
explanation:
Change history
30.06.2015 GOS CSR 33339: Create date.
01.05.2018 JML CSR# 26413: REG/SCHED upgrade. Modified MLM to look in CV3ClientUserData table for value
that was previously read from comment created by AMPFM.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Receive arguments from the structured note
(thisDocumentCommunication) := argument;
// .Net assemblies required for ObjectsPlus
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
//Local Variables
theDocumentName := "Care Transitions Inpatient Assessment";
// 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];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
DocGuid := thisStructuredNoteDoc.ClientDocumentGUID ;
//Include Called MLM to setup CDS objects
//set_cds_vars := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
//Document Types
STRUCTUREDNOTE := "StructuredNote";
//Event Types
DOCUMENTCLOSING := "DocumentClosing";
CHARTOBSERVATION := "ChartObservation";
DOCUMENTOPENING := "DocumentOpening";
//Setting debugFlag to True will allow popup dialogs containing debug information to appear
debugFlag := false;
//Initialize CDS objects via MLM call
/*(thisDocumentCommunication, client_guid, client_visit_guid, client_chart_guid, user_guid,
document_type, document_name, event_type, configuration_guid, this_currentObj, CancelEventFlag,
this_structuredNoteDoc, authored_date_time, authored_by_guid, client_document_guid, document_date_time,
isNewFlag, isIncompleteFlag, isResultsPendingFlag, isPriorityFlag, this_parameters,
this_chartedObservationsList, this_parameters_display_name, current_parameter, current_parameter_name,
current_parameter_guid, current_parameter_DataType, selectedItems, selectedItems_value, current_value,
diagnosticMessage, displayMessageFlag, CoSigner1, CoSigner2, DocumentTopic) := CALL set_cds_vars WITH
(thisDocumentCommunication); */
If DocGuid Is not Null Then
LastObsVal := read First {"SELECT oflv.value "
|| " FROM CV3ClientDocument cd WITH (NOLOCK) INNER JOIN cv3ClientVisit cv WITH (NOLOCK) ON cv.GUID = cd.ClientVisitGUID And cv.clientguid = cd.ClientGUID "
|| " AND cv.chartguid = cd.ChartGUID AND cd.iscanceled = 0 And cd.Active = 1 AND cd.DocumentName = {{{SINGLE-QUOTE}}}Care Transitions Inpatient Assessment{{{SINGLE-QUOTE}}} "
|| " INNER JOIN SXACDObservationParameter OP WITH (NOLOCK) ON OP.ClientGUID = cd.ClientGUID AND OP.ChartGUID = cd.ChartGUID "
|| " AND OP.PatCareDocGUID = cd.PatCareDocGUID AND OP.RecordedDtm = cd.AuthoredDtm "
|| " INNER JOIN CV3ObsCatalogMasterItem omi WITH (NOLOCK) ON omi.GUID = op.ObsMasterItemGUID And omi.name in ({{{SINGLE-QUOTE}}}SCH_Quality_Outpatient_Rx_Consult{{{SINGLE-QUOTE}}}) "
|| " LEFT JOIN SCMObsFSListValues oflv WITH (NOLOCK) ON oflv.ParentGUID = op.ObservationDocumentGUID AND oflv.Active = 1 AND cd.ClientGUID = oflv.ClientGUID "
|| " AND oflv.ClientGUID = cd.ClientGUID "
|| " Where cv.guid = " || visitGuid
|| " And cd.guid = " || thisStructuredNoteDoc.ClientDocumentGUID
|| " And oflv.value in ({{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}})" };
Else
LastObsVal := LastObsVal ;
EndIf;
if ( thisDocumentCommunication.EventType = DOCUMENTCLOSING ) then
// For Care Transition -----------------------------------------------------------------------------------------------------
this_parametername := Last of (thisParameters where thisParameters.Name = "SCH_Quality_Outpatient_Rx_Consult");
theObservation := Last of (thisobservations where thisobservations.ParameterGUID = this_parametername.ParameterGUID);
If true in (theObservation.ValueObj.ListItemsList.IsSelected where
theObservation.ValueObj.ListItemsList.Value = "Yes"
) then
SelValue := "Yes";
Else
SelValue := "No";
endif;
SuggestedVal := theObservation.ValueObj.SuggestedTextValue ; If SuggestedVal is null Then SuggestedVal :=""; Endif;
If SelValue = "Yes" And ( LastObsVal Is Null or LastObsVal ="No" ) Then
//CSR 26413 CHANGE: Modified SQL to use CV3ClientUsData
//Get the patient{{{SINGLE-QUOTE}}}s last inpatient / obs discharge datetime
Comm_Doc := OBJECT [Comm_name, Comm_val ] ;
Comm_vals := read as Comm_Doc {"SELECT cud.UserDataCode, cud.Value "
|| " FROM CV3ClientVisit cv With (Nolock) Join CV3ClientUserData cud With (Nolock) "
|| " On cv.ClientGUID = cud.ClientGUID "
|| " WHERE cv.GUID = " || Sql(visitGuid)
|| " AND cud.ClientGUID = " || Sql(clientGuid)
|| " AND cv.ChartGUID = " || Sql(chartGuid)
|| " And cud.UserDataCode in ({{{SINGLE-QUOTE}}}SER-RxInsurer{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SER-RxBIN{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SER-RxGROUP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SER-RxInsName{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SER-RxMemberID{{{SINGLE-QUOTE}}}) "
|| " And cud.Active = 1"
|| " And cud.Value IS NOT NULL And cud.Value <> {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}" };
Comm_RxInsurer := first of (Comm_vals.Comm_val where Comm_vals.Comm_name = "RxInsurer" ); If Comm_RxInsurer is null Then Comm_RxInsurer :=""; Endif;
Comm_RxBIN := first of (Comm_vals.Comm_val where Comm_vals.Comm_name = "RxBIN" ); If Comm_RxBIN is null Then Comm_RxBIN :=""; Endif;
Comm_RxGROUP := first of (Comm_vals.Comm_val where Comm_vals.Comm_name = "RxGROUP" ); If Comm_RxGROUP is null Then Comm_RxGROUP :=""; Endif;
Comm_RxInsName := first of (Comm_vals.Comm_val where Comm_vals.Comm_name = "RxInsName" ); If Comm_RxInsName is null Then Comm_RxInsName :=""; Endif;
Comm_RxMemberID:= first of (Comm_vals.Comm_val where Comm_vals.Comm_name = "RxMemberID" );If Comm_RxMemberID is null Then Comm_RxMemberID :=""; Endif;
// Create Order
//====================================================================================================
user_IDType := "Edstan Number (physician)";
IF(visitGuid IS NOT NULL) THEN
try
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
WSSessionType := "Standard";//"Inpatient Orders";//Standard";//"
WSSessionReason := "";
WSRequestedBySource := "";//"1 Standard";
user_IDCode := read last {"SELECT IDCode FROM CV3User " || " where GUID = " || thisdocumentCommunication.UserGUID};
WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || thisdocumentCommunication.ClientGUID};
WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}Common Data:{{-R}}\n" ||
ex.Message || "\n\n";
if ( client_visit_obj is NOT NULL ) then
void:= call client_visit_obj.Dispose;
client_visit_obj:= null;
endif;
if ( WSRequestedBy_obj is NOT NULL ) then
void:= call WSRequestedBy_obj.Dispose;
WSRequestedBy_obj:= null;
endif;
if ( WSlocation_obj is NOT NULL ) then
void:= call WSlocation_obj.Dispose;
WSlocation_obj:= null;
endif;
Endcatch;
ENDIF;
if (client_visit_obj is not null) then
try
Catalog_Item_Name := "Pharmacy Consult - Discharge Prescription Service";
order_Creation_Reason := "Order Created From MLM";
// get OrderCatalogMasterItem ObjectsPlus object
diagnostic_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
with
client_visit_obj, // ClientVisit ObjectsPlus object
diagnostic_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
order_Creation_Reason, // CreateReason
wsRequestedBy_obj, // RequestedBy ObjectsPlus object
wsRequestedBySource, // string RequestedBySource (must be in dictionary)
wsSessionType, // string SessionType
wsSessionReason, // string SessionReason
wslocation_obj, // Location ReleaseLocGrpID
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
Field0 := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "PRX_OutptConsultIndicator",( "Possible Discharge Prescription Patient" AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}}); Field1 := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "PRX_Outpt_RxBIN",(Comm_RxBIN AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
Field2 := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "PRX_Outpt_RxInsurer",( Comm_RxInsurer AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
Field3 := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "PRX_Outpt_RxGROUP",( Comm_RxGROUP AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
Field4 := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "PRX_Outpt_RxInsName",( Comm_RxInsName AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
Field5 := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "PRX_Outpt_RxMemberID",( Comm_RxMemberID AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
Field6 := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "PRX_Outpt_SpecialInstruction",( SuggestedVal AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
void := call DiagnosticOrder_obj.save; ///To Save The Order To SCM
endtry;
catch Exception ex
error_occurred := true;
error_message := error_message || "{{+R}}New general order:{{-R}}\n" ||
ex.Message || "\n\n";
if ( Catalog_Item_Name is NOT NULL ) then
void:= call Catalog_Item_Name.Dispose;
Catalog_Item_Name:= null;
endif;
if ( DiagnosticOrder_obj is NOT NULL ) then
void:= call DiagnosticOrder_obj.Dispose;
DiagnosticOrder_obj:= null;
endif;
endcatch;
ENDIF;
//====================================================================================================
// End Order
Endif;
Endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,500 @@
maintenance:
title: DOC_FUNC_CARE_TRANSITIONS_POST_DISCHARGE_FOLLOWUP;;
mlmname: DOC_FUNC_CARE_TRANSITIONS_POST_DISCHARGE_FOLLOWUP;;
arden: version 6.1;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Juliet Law;;
specialist: Dean Miklavic;;
date: 2014-12-08;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
12.08.2014 JML CSR 32423: Create date.
01.27.2015 JML Moved to Production.
03.02.2015 JML WO# 1648240: Moved update to production based on issue with multiple post discharge documents existing on patient account.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Receive arguments from the structured note
(this_documentCommunication) := argument;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
//Include MLM
str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
//Include Called MLM to setup CDS objects
set_cds_vars := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
//Document Types
STRUCTUREDNOTE := "StructuredNote";
//Event Types
DOCUMENTCLOSING := "DocumentClosing";
CHARTOBSERVATION := "ChartObservation";
DOCUMENTOPENING := "DocumentOpening";
//Setting debugFlag to True will allow popup dialogs containing debug information to appear
debugFlag := false;
//Initialize CDS objects via MLM call
(this_documentCommunication, client_guid, client_visit_guid, client_chart_guid, user_guid,
document_type, document_name, event_type, configuration_guid, this_currentObj, CancelEventFlag,
this_structuredNoteDoc, authored_date_time, authored_by_guid, client_document_guid, document_date_time,
isNewFlag, isIncompleteFlag, isResultsPendingFlag, isPriorityFlag, this_parameters,
this_chartedObservationsList, this_parameters_display_name, current_parameter, current_parameter_name,
current_parameter_guid, current_parameter_DataType, selectedItems, selectedItems_value, current_value,
diagnosticMessage, displayMessageFlag, CoSigner1, CoSigner2, DocumentTopic) := CALL set_cds_vars WITH
(this_documentCommunication);
using "AddFollowupPhysicianSN";
using namespace "AddNewProviderSN";
test := new net_object {{{SINGLE-QUOTE}}}AddNewProviderSN.AddFollowupPhysicianForm{{{SINGLE-QUOTE}}};
//Set up debugging information to be captured
messageText := "";
if (debugFlag = true) then
messageText := "Debug Information:\n\n";
messageText := messageText || " DOC_FUNC_CARE_TRANSITIONS_POST_DISCHARGE_FOLLOWUP mlm called.\n\n";
endif;
//Local Variables
theDocumentName := "Care Transitions Post Discharge Follow Up";
// 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];
if ( event_type = DOCUMENTOPENING AND document_name = theDocumentName ) then
//Get the patient{{{SINGLE-QUOTE}}}s last inpatient / obs discharge datetime
last_IPOB_discharge_date := read last {"SELECT Top 1 cv.DischargeDtm"
|| " FROM CV3ClientVisit cv WITH (NOLOCK)"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " AND cv.VisitStatus = {{{SINGLE-QUOTE}}}DSC{{{SINGLE-QUOTE}}}"
|| " AND cv.TypeCode IN ({{{SINGLE-QUOTE}}}Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Observation{{{SINGLE-QUOTE}}})"
|| " ORDER BY cv.DischargeDtm DESC"};
last_IPOB_care_inpat_doc := read last {"SELECT TOP 1 cd.GUID"
|| " FROM CV3ClientDocument cd WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
|| " ON cd.CLIENTGUID = cv.CLIENTGUID"
|| " AND cd.CLIENTVISITGUID = cv.GUID"
|| " WHERE cd.CLIENTGUID = " || Sql(client_guid)
|| " AND cd.DocumentName = {{{SINGLE-QUOTE}}}Care Transitions Inpatient Assessment{{{SINGLE-QUOTE}}}"
|| " AND cv.DISCHARGEDTM = " || Sql(last_IPOB_discharge_date)
|| " ORDER BY cd.AuthoredDtm DESC"};
last_IPOB_care_outpat_doc := read last {"SELECT TOP 1 cd.GUID"
|| " FROM CV3ClientDocument cd WITH (NOLOCK) JOIN CV3ClientVisit cv WITH (NOLOCK)"
|| " ON cd.CLIENTGUID = cv.CLIENTGUID"
|| " AND cd.CLIENTVISITGUID = cv.GUID"
|| " WHERE cd.CLIENTGUID = " || Sql(client_guid)
|| " AND cd.DocumentName = {{{SINGLE-QUOTE}}}Care Transitions Post Discharge Follow Up{{{SINGLE-QUOTE}}}"
|| " AND cv.DISCHARGEDTM = " || Sql(last_IPOB_discharge_date)
|| " ORDER BY cd.AuthoredDtm DESC"};
//Check to see if an outpatient care doc exists
if ( exists last_IPOB_care_outpat_doc ) then
//Retrieve Prior Call Made observation
priorCallParameterName := "SCH_Quality_Prior_Call_Made";
priorCallParameter := first of ( this_parameters WHERE this_parameters.Name = priorCallParameterName );
//Retrieve information from last Post discharge Assessment document, if exists
if ( exists priorCallParameter ) then
(last_call_date,
authored_by) := read last {"SELECT o.ValueText, cp.DisplayName"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocumentCur cd WITH (NOLOCK)"
|| " ON cv.GUID = cd.ClientVisitGUID"
|| " AND cv.ClientGUID = cd.ClientGUID"
|| " AND cv.ChartGUID = cd.ChartGUID"
|| " JOIN CV3ClientDocDetailCur cdd WITH (NOLOCK)"
|| " ON cd.GUID = cdd.ClientDocumentGUID"
|| " AND cd.ClientGUID = cdd.ClientGUID"
|| " JOIN CV3ObservationDocumentCur od WITH (NOLOCK)"
|| " ON cdd.ClientDocumentGUID = od.OwnerGUID"
|| " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
|| " ON od.ObsMasterItemGUID = ocmi.GUID"
|| " JOIN CV3ObservationCur o WITH (NOLOCK)"
|| " ON od.ObservationGUID = o.GUID"
|| " JOIN CV3ObsCatalogItem oci WITH (NOLOCK)"
|| " ON o.ObsItemGUID = oci.GUID"
|| " JOIN CV3CareProvider cp WITH (NOLOCK)"
|| " ON cd.AuthoredProviderGUID = cp.GUID"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " AND cv.DischargeDtm = " || Sql(last_IPOB_discharge_date)
|| " AND cd.GUID = " || Sql(last_IPOB_care_outpat_doc)
|| " AND cdd.Active = 1"
|| " AND od.Active = 1"
|| " AND oci.Name = {{{SINGLE-QUOTE}}}SCH_Quality_DC_FU_Date{{{SINGLE-QUOTE}}}"};
patient_reached := read last {"SELECT fsl.Value"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocument cd WITH (NOLOCK)"
|| " ON cv.GUID = cd.ClientVisitGUID"
|| " AND cv.ClientGUID = cd.ClientGUID"
|| " AND cv.ChartGUID = cd.ChartGUID"
|| " JOIN CV3ClientDocDetail cdd WITH (NOLOCK)"
|| " ON cd.GUID = cdd.ClientDocumentGUID"
|| " AND cd.ClientGUID = cdd.ClientGUID"
|| " JOIN CV3ObservationDocument od WITH (NOLOCK)"
|| " ON cdd.ClientDocumentGUID = od.OwnerGUID"
|| " LEFT JOIN SCMObsFsListValues fsl WITH (NOLOCK)"
|| " ON od.ObservationDocumentGUID = fsl.ParentGUID"
|| " AND cdd.ClientGUID = fsl.ClientGUID"
|| " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
|| " ON od.ObsMasterItemGUID = ocmi.GUID"
|| " JOIN CV3Observation o WITH (NOLOCK)"
|| " ON od.ObservationGUID = o.GUID"
|| " JOIN CV3ObsCatalogItem oci WITH (NOLOCK)"
|| " ON o.ObsItemGUID = oci.GUID"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " AND cv.DischargeDtm = " || Sql(last_IPOB_discharge_date)
|| " AND cd.GUID = " || Sql(last_IPOB_care_outpat_doc)
|| " AND cdd.Active = 1"
|| " AND od.Active = 1"
|| " AND oci.Name = {{{SINGLE-QUOTE}}}SCH_QUALITY_PATIENT_REACHED{{{SINGLE-QUOTE}}}"};
//Format text string
priorCallString := last_call_date || ", " || authored_by || ", Patient Reached: " || patient_reached;
//Setup object to write to observation
this_currentPriorCallObs := NEW ObservationType;
this_currentPriorCallObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentPriorCallObs.ParameterGUID := priorCallParameter.ParameterGUID;
this_currentPriorCallObs.DataType := "FreeTextValue";
this_currentPriorCallObs.ValueObj := NEW FreeTextValueType;
this_currentPriorCallObs.ValueObj.Value := priorCallString;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentPriorCallObs );
endif; //End priorCallParameter Exists
endif; //End IF oupatient document exists
//Retrieve Today{{{SINGLE-QUOTE}}}s Call Date observation
callDateParameterName := "SCH_Quality_DC_FU_Date";
callDateParameter := first of ( this_parameters WHERE this_parameters.Name = callDateParameterName );
if ( exists callDateParameter ) then
//Set today{{{SINGLE-QUOTE}}}s date as value in observation
this_currentCallDateObs := NEW ObservationType;
this_currentCallDateObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentCallDateObs.ParameterGUID := callDateParameter.ParameterGUID;
this_currentCallDateObs.DataType := "DateValue";
this_currentCallDateObs.ValueObj := NEW DateValueType;
this_currentCallDateObs.ValueObj.Value := document_date_time;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentCallDateObs );
endif; //End callDateParameter Exists
//Retrieve DME Received observation
dmeParameterName := "SCH_Quality_DME_Recvd";
dmeParameter := first of ( this_parameters WHERE this_parameters.Name = dmeParameterName );
if ( exists dmeParameter ) then
//Retrieve most recent Medical Equipment Order
(orderGuid,
orderSummary) := read {"SELECT o.GUID, o.SummaryLine"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.GUID = o.ClientVisitGUID"
|| " AND cv.ClientGUID = o.ClientGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " AND o.NAME = {{{SINGLE-QUOTE}}}Medical Equipment{{{SINGLE-QUOTE}}}"
|| " AND cv.TypeCode IN ({{{SINGLE-QUOTE}}}Inpatient{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Observation{{{SINGLE-QUOTE}}})"
|| " AND cv.DischargeDtm = " || Sql(last_IPOB_discharge_date)
|| " AND ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|| " ORDER BY o.RequestedDtm DESC"};
if ( exists orderGuid ) then
preselectValue := "Yes";
if ( count orderGuid = 1 ) then
if ( last of ( orderSummary ) IS NULL ) then
parameterValue := "";
else
parameterValue := last of ( orderSummary );
endif;
parameterValue := Trim(parameterValue);
else
if ( first of ( orderSummary ) IS NULL ) then
parameterValue := "";
else
parameterValue := first of ( Trim(orderSummary) ) || "\n\n";
endif;
if ( last of (orderSummary) IS NULL ) then
parameterValue := parameterValue || "";
else
parameterValue := parameterValue || last of ( Trim(orderSummary) );
endif;
endif;
else
preSelectValue := "No";
endif;
//Setup the object to write to the observation
this_currentMedEquipObs := NEW ObservationType;
this_currentMedEquipObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentMedEquipObs.ParameterGUID := dmeParameter.ParameterGUID;
this_currentMedEquipObs.DataType := "ListValue";
this_currentMedEquipObs.ValueObj := NEW ListValueType;
this_currentMedEquipObs.ValueObj.ListGUID := dmeParameter.ConfigurationObj.ListGUID;
listItems := ();
for item IN dmeParameter.ConfigurationObj.ListItemsList do
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if ( selectedItem.Value = "Yes" AND preselectValue = "Yes" ) then
selectedItem.IsSelected := true;
endif;
if ( selectedItem.Value = "No" AND preselectValue = "Yes" ) then
selectedItem.IsSelected := false;
endif;
if ( selectedItem.Value = "No" AND preselectValue = "No" ) then
selectedItem.IsSelected := true;
endif;
if ( selectedItem.Value = "Yes" AND preselectValue = "No" ) then
selectedItem.IsSelected := false;
endif;
if ( selectedItem.Value = "Partial" AND preselectValue = "Yes" ) then
selectedItem.Value := false;
endif;
if ( selectedItem.Value = "Partial" AND preselectValue = "No" ) then
selectedItem.Value := false;
endif;
listItems := ( listItems, selectedItem );
enddo;
if ( preselectValue = "Yes" ) then
//dmeConfiguration := dmeParameter.ConfigurationObj;
//if ( dmeConfiguration.AllowsSuggestedText = true ) then
// this_currentMedEquipObs.ValueObj.SuggestedTextValue := orderSummary;
//endif;
//Retrieve DME Orders textbox parameter
dmeOrdersParameterName := "SCH_Quality_DME_Orders";
dmeOrdersParameter := first of ( this_parameters WHERE this_parameters.Name = dmeOrdersParameterName );
if ( exists dmeOrdersParameter ) then
this_currentDMEObj := NEW ObservationType;
this_currentDMEObj.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentDMEObj.ParameterGUID := dmeOrdersParameter.ParameterGUID;
this_currentDMEObj.DataType := "FreeTextValue";
this_currentDMEObj.ValueObj := NEW FreeTextValueType;
this_currentDMEObj.ValueObj.Value := parameterValue;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentDMEObj );
endif;
endif;
this_currentMedEquipObs.ValueObj.ListItemsList := listItems;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentMedEquipObs );
endif; //End dmeParameter Exists
//Retrieve Quality Programs Suggested observation
progsParameterName := "SCH_Quality_Programs_SuggestedDC";
progsParameter := first of ( this_parameters WHERE this_parameters.Name = progsParameterName );
if ( exists progsParameter ) then
//Retrieve suggested programs from last Care Transitions Inpatient Assessment document
(programNames) := read {"SELECT fsl.value"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocument cd WITH (NOLOCK)"
|| " ON cv.GUID = cd.ClientVisitGUID"
|| " AND cv.ClientGUID = cd.ClientGUID"
|| " AND cv.ChartGUID = cd.ChartGUID"
|| " JOIN CV3ClientDocDetail cdd WITH (NOLOCK)"
|| " ON cd.GUID = cdd.ClientDocumentGUID"
|| " AND cd.ClientGUID = cdd.ClientGUID"
|| " JOIN CV3ObservationDocument od WITH (NOLOCK)"
|| " ON cdd.ClientDocumentGUID = od.OwnerGUID"
|| " LEFT JOIN SCMObsFsListValues fsl WITH (NOLOCK)"
|| " ON od.ObservationDocumentGUID = fsl.ParentGUID"
|| " AND cdd.ClientGUID = fsl.ClientGUID"
|| " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
|| " ON od.ObsMasterItemGUID = ocmi.GUID"
|| " JOIN CV3Observation o WITH (NOLOCK)"
|| " ON od.ObservationGUID = o.GUID"
|| " JOIN CV3ObsCatalogItem oci WITH (NOLOCK)"
|| " ON o.ObsItemGUID = oci.GUID"
|| " WHERE cv.ClientGUID = " || Sql(client_guid)
|| " AND cv.DischargeDtm = " || Sql(last_IPOB_discharge_date)
|| " AND cd.GUID = " || Sql(last_IPOB_care_inpat_doc)
|| " AND cdd.Active = 1"
|| " AND od.Active = 1"
|| " AND oci.Name = {{{SINGLE-QUOTE}}}SCH_Quality_Programs_Suggested{{{SINGLE-QUOTE}}}"};
if ( exists programNames ) then
//Setup object to write to observation
this_currentProgObs := NEW ObservationType;
this_currentProgObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentProgObs.ParameterGUID := progsParameter.ParameterGUID;
this_currentProgObs.DataType := "ListValue";
this_currentProgObs.ValueObj := NEW ListValueType;
this_currentProgObs.ValueObj.ListGUID := progsParameter.ConfigurationObj.ListGUID;
listItems := ();
for item IN progsParameter.ConfigurationObj.ListItemsList do
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if ( selectedItem.Value IN programNames ) then
selectedItem.IsSelected := true;
endif;
if ( selectedItem.Value NOT IN programNames ) then
selectedItem.IsSelected := false;
endif;
listItems := ( listItems, selectedItem );
enddo;
this_currentProgObs.ValueObj.ListItemsList := listItems;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentProgObs );
endif;
endif; //End progsParameter Exists
endif;
;;
evoke:
;;
logic:
if ( event_type = CHARTOBSERVATION ) THEN
//1 -- OBJ+ to populate followup physician
if ( current_parameter.Name = "SCH_Quality_MD_Select1" ) then
if ( current_value = "Physician selector" ) then
test2 := CALL test.ShowDialog;
followup1_return_value := test.Text;
elseif ( current_value = "Clear Followup" ) then
followup1_return_value := "";
endif;
endif;
//2 -- OBJ+ to populate followup physician
if ( current_parameter.Name = "SCH_Quality_MD_Select2" ) then
if ( current_value = "Physician selector" ) then
test2 := CALL test.ShowDialog;
followup2_return_value := test.Text;
elseif ( current_value = "Clear Followup" ) then
followup2_return_value := "";
endif;
endif;
//3 -- OBJ+ to populate followup physician
if ( current_parameter.Name = "SCH_Quality_MD_Select3" ) then
if ( current_value = "Physician selector" ) then
test2 := CALL test.ShowDialog;
followup3_return_value := test.Text;
elseif ( current_value = "Clear Followup" ) then
followup3_return_value := "";
endif;
endif;
//4 -- OBJ+ to populate followup physician
if ( current_parameter.Name = "SCH_Quality_MD_Select4" ) then
if ( current_value = "Physician selector" ) then
test2 := CALL test.ShowDialog;
followup4_return_value := test.Text;
elseif ( current_value = "Clear Followup" ) then
followup4_return_value := "";
endif;
endif;
//1 -- Populate first appointment
followupApptParameterName_1 := "SCH_Quality_FU_Appt1";
followupApptParameter_1 := first of ( this_parameters WHERE this_parameters.Name = followupApptParameterName_1 );
if ( exists followupApptParameter_1 ) then
this_currentApptObs := NEW ObservationType;
this_currentApptObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentApptObs.ParameterGUID := followupApptParameter_1.ParameterGUID;
this_currentApptObs.DataType := "FreeTextValue";
this_currentApptObs.ValueObj := NEW FreeTextValueType;
this_currentApptObs.ValueObj.Value := followup1_return_value;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentApptObs );
endif;
//2 -- Populate second appointment
followupApptParameterName_2 := "SCH_Quality_FU_Appt2";
followupApptParameter_2 := first of ( this_parameters WHERE this_parameters.Name = followupApptParameterName_2 );
if ( exists followupApptParameter_2 ) then
this_currentApptObs := NEW ObservationType;
this_currentApptObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentApptObs.ParameterGUID := followupApptParameter_2.ParameterGUID;
this_currentApptObs.DataType := "FreeTextValue";
this_currentApptObs.ValueObj := NEW FreeTextValueType;
this_currentApptObs.ValueObj.Value := followup2_return_value;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentApptObs );
endif;
//3 -- Populate third appointment
followupApptParameterName_3 := "SCH_Quality_FU_Appt3";
followupApptParameter_3 := first of ( this_parameters WHERE this_parameters.Name = followupApptParameterName_3 );
if ( exists followupApptParameter_3 ) then
this_currentApptObs := NEW ObservationType;
this_currentApptObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentApptObs.ParameterGUID := followupApptParameter_3.ParameterGUID;
this_currentApptObs.DataType := "FreeTextValue";
this_currentApptObs.ValueObj := NEW FreeTextValueType;
this_currentApptObs.ValueObj.Value := followup3_return_value;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentApptObs );
endif;
//4 -- Populate fourth appointment
followupApptParameterName_4 := "SCH_Quality_FU_Appt4";
followupApptParameter_4 := first of ( this_parameters WHERE this_parameters.Name = followupApptParameterName_4 );
if ( exists followupApptParameter_4 ) then
this_currentApptObs := NEW ObservationType;
this_currentApptObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentApptObs.ParameterGUID := followupApptParameter_4.ParameterGUID;
this_currentApptObs.DataType := "FreeTextValue";
this_currentApptObs.ValueObj := NEW FreeTextValueType;
this_currentApptObs.ValueObj.Value := followup4_return_value;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentApptObs );
endif;
ENDIF;
conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,111 @@
maintenance:
title: DOC_FUNC_CCDA_CREATE_AND_TRANSPORT;;
mlmname: DOC_FUNC_CCDA_CREATE_AND_TRANSPORT;;
arden: version 2.5;;
version: 5.50;;
institution: Allscripts;;
author: Renish Bhimani;;
specialist: ;;
date: 2014-05-21;;
validation: testing;;
ScheduledFlags: LongRunning;;
library:
purpose: print CCD-A document report from MLM
;;
explanation: The MLM is called from a Document and if a Print Button is selected, it calls MLM "SCH_FUNC_CCDA_Print"
which generates a CCDA document
Change history
06.25.2014 DW CSR# 31688 - MU2
07.08.2014 DW CSR# 31688 - MU2 Suppress print for behavioral health patients
08.18.2015 DW CSR# 26006 - Transport CCDA to CCHIE via XDS protocol (add a dummy TransportType parmaeter to the MLM call)
12.11.2018 DW CSR# 37522 - Optimize scheduled MLMs. Added Long Running parameter
09.20.2019 DW CSR# 35638 - MU3 - Transmit to physician direct address (redisign....pass direct address to create and transport MLM instead of discharge location)
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
trig_event_enter := event {ClientDocumentEnter User ClientDocument: where documentname in ("Discharge Instructions (Post Hospital Care Orders)")};
trig_event_modify:= event {ClientDocumentModify User ClientDocument: where documentname in ("Discharge Instructions (Post Hospital Care Orders)")};
(VisitGUID, ChartGUID, ClientGUID) := read last {ClientDocument: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject};
PrintButtonSelected := read first
{
" select top 1 fsl.value "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || sql(ClientGUID) || " and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || sql(ClientGUID) || " ) "
|| " where cd.clientguid = " || sql(ClientGUID) || " and cd.ChartGUID = " || SQL(ChartGuid) || " and cd.ClientVisitGUID= " || SQL(VisitGuid) || " "
|| " and cd.iscanceled = 0 "
|| " and cd.documentname like {{{SINGLE-QUOTE}}}%Post Hospital Care Orders%{{{SINGLE-QUOTE}}} "
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}CXD Transition Care Print{{{SINGLE-QUOTE}}}) "
|| " and fsl.value is not null "
|| " order by cd.touchedwhen desc "
};
PsychPatient := read
{
" Select currentlocation from cv3clientvisit with (nolock) "
|| " Where ClientGUID = " || sql(ClientGUID) || " AND ChartGUID = " || SQL(ChartGuid)
|| " AND GUID = " || SQL(VisitGuid) || " and currentlocation like {{{SINGLE-QUOTE}}}Psy%{{{SINGLE-QUOTE}}} "
};
if PrintButtonSelected is not null
and not exist PsychPatient
then
SCMEnvironment := "NA";
DirectAddress := "NA";
Transport := FALSE;
TransportType := "NA";
CCDAReport := "CCDA Summary of Care";
CCD_MLM := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CCDA_CREATE_AND_TRANSPORT{{{SINGLE-QUOTE}}};
void := call CCD_MLM with clientGuid,chartguid,visitguid,CCDAReport,Transport,SCMEnvironment,DirectAddress,TransportType;
endif;
// Diagnostic Alert - Can be enabled if needed
send_alert := "DoNotSend";
alert_dest := destination { Alert: warning, "Informational", high, chart, "Informational", 15042, send_alert, "No Override Allowed" };
;;
priority: 50
;;
evoke:
15 seconds after time of trig_event_enter;
15 seconds after time of trig_event_modify;
;;
logic:
conclude true;
;;
action:
// Diagnostic Alert - Can be enabled if needed
write " Messages " || " CALL the CREATE MLM - " || NOW || " " || PrintButtonSelected
|| " " || SCMEnvironment || " " || DischargeLocation
|| " " || Transport || " " || CCDAReport
at alert_dest;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,481 @@
maintenance:
title: DOC_FUNC_CCDA_DATA;;
mlmname: DOC_FUNC_CCDA_DATA;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Don Warnick;;
specialist: ;;
date: 2014-04-30;;
validation: testing;;
library:
purpose:
;;
explanation: This MLM manages will popultate the required fields for the CCDA
Change history
04.30.2014 DW CSR# 31688 - MU2
07.08.2014 DW CSR# 31688 - MU2 (1)Print Discharge Instructions (2)Fill text fields upon close rather than open
07.29.2014 DW HD# 167119 - Only the first 2 OT (and PT) observations of the latest set were being pulled
08.20.2014 DW HD# 168587 - Needed to increase the size of the "DATA" field of the OT and PT temp SQL tables. A user exceeded 200 characters. Changed it to 1000.
05.10.2015 STH CRS#: 32070 - Auto print Patient DC instructions and generate DC summary ONLY once discharge order reconiciliation is completed. Also alert
users if order reconciliation is incomplete on entrying into the document.
08.19.2015 DW CSR# 33555 - 15.1 - updated formatting of "Followup" section
10.26.2015 STH Support case 1917862 - issue with clinic visits requing order rec completion
;;
keywords:
;;
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";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
PatCurLocation := read last {"select currentlocation from cv3clientvisit with (nolock)"
|| " where clientguid = " || sql(clientguid)
|| " and chartguid = " || sql(chartGuid)
|| " and guid = " || sql(visitGuid) };
(VisitType) := read {"select top 1 typecode from cv3clientvisit with (nolock) "
|| " where clientguid = " || sql(clientGuid)
|| " and chartguid = " || sql(chartGuid)
|| " and guid = " || sql(visitGuid)};
//BEGIN - [STH] CSR#: 32070
if ((PatCurLocation matches pattern "infus%") or (trim(VisitType[1]) is not in ("Inpatient","Observation"))) then
dc_orderrec_GUID := 0;
else
dc_orderrec_GUID := read last {"select guid from CV3OrderReconcile with (nolock) "
|| " where clientguid = " || sql(ClientGuid)
|| " and chartguid = " || sql(ChartGuid)
|| " and ClientVisitGUID = " || sql(VisitGuid)
|| " and reconciletypecode = {{{SINGLE-QUOTE}}}discharge{{{SINGLE-QUOTE}}} "
|| " and ReconcileStatusType = 2 "};
endif;
//END - [STH] CSR#: 32070
// DOCUMENT OPENING SECTION
IF thisdocumentCommunication.EventType = "DocumentOpening"
then
//BEGIN [STH] - CSR#: 32070
if dc_orderrec_guid is null or dc_orderrec_guid = "" then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Discharge Order Reconciliation is INCOMPLETE. You cannot print the patients Discharge Instructions until the Discharge Order Reconciliation is completed. Do you want to launch Order Reconciliation now?"
,"Discharge Order Reconciliation Incomplete","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}},"Button1" as {{{SINGLE-QUOTE}}}MessageBoxDefaultButton{{{SINGLE-QUOTE}}};
resulttext := dialogResult as string;
if resulttext = "Yes" then
(thisDocumentCommunication) := argument;
OpenMedRec := MLM {{{SINGLE-QUOTE}}}DOC_Call_Med_Rec{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL OpenMedRec WITH thisDocumentCommunication;
endif;
endif;
//END - [STH] - CSR#: 32070
// Desellect the "Print Document" button
theParameter := first of (thisparameters where thisparameters.Name = "CXD Transition Care Print");
theObservation:= first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Transition Care Print");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := false;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Set the HIS only "dummy" button to true to activate the SAVE button
theParameter := first of (thisparameters where thisparameters.Name = "CXD Testing MLM Only");
theObservation:= first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Testing MLM Only");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := true;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif; // EventType = "DocumentOpening"
// DOCUMENT CLOSING SECTION
IF thisdocumentCommunication.EventType = "DocumentClosing"
then
// GATHER DATA
// Occupational Therapy Data (only the latest charted from SN or FS is to be displayed)
(OTGoalstData) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), touchedwhen datetime, data varchar(1000), latestdate datetime) "
|| " SET CONCAT_NULL_YIELDS_NULL off "
|| " INSERT INTO #tmp_aaa (touchedwhen,data) "
|| " select cd.entered , o.ValueText + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + fsl.value "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || ClientGuid || " and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || ClientGuid || " ) "
|| " where cd.clientguid = " || ClientGuid || " and cd.ChartGUID = " || ChartGuid || " and cd.ClientVisitGUID= " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.documentname in ({{{SINGLE-QUOTE}}}occupational Therapy Initial Evaluation{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}4. Adult Goal/Outcome Evaluation{{{SINGLE-QUOTE}}}) "
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}SCHCK_OT disc prog rec{{{SINGLE-QUOTE}}}) "
|| " order by cd.touchedwhen desc "
|| " declare @lastdate datetime "
|| " set @lastdate = (select touchedwhen from #tmp_aaa where id = 1) "
|| " update t1 set t1.latestdate = @lastdate from #tmp_aaa t1 where t1.touchedwhen = @lastdate "
|| " delete from #tmp_aaa where latestdate is null "
|| " select data from #tmp_aaa "
|| " drop table #tmp_aaa "
};
if exists OTGoalstData
then
OTGoalstDataText := "\n OT Discharge Recommendation : " || OTGoalstData;
else
OTGoalstDataText := "";
endif;
// Physical Therapy Data (only the latest charted from SN or FS is to be displayed)
(PTGoalstData) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), touchedwhen datetime, data varchar(1000), latestdate datetime) "
|| " SET CONCAT_NULL_YIELDS_NULL off "
|| " INSERT INTO #tmp_aaa (touchedwhen,data) "
|| " select cd.entered , o.ValueText + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + fsl.value "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || ClientGuid || " and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || ClientGuid || " ) "
|| " where cd.clientguid = " || ClientGuid || " and cd.ChartGUID = " || ChartGuid || " and cd.ClientVisitGUID= " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.documentname in ({{{SINGLE-QUOTE}}}Physicial Therapy Initial Evaluation{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}4. Adult Goal/Outcome Evaluation{{{SINGLE-QUOTE}}}) "
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}SCHCK_PT disc prog rec{{{SINGLE-QUOTE}}}) "
|| " order by cd.touchedwhen desc "
|| " declare @lastdate datetime "
|| " set @lastdate = (select touchedwhen from #tmp_aaa where id = 1) "
|| " update t1 set t1.latestdate = @lastdate from #tmp_aaa t1 where t1.touchedwhen = @lastdate "
|| " delete from #tmp_aaa where latestdate is null "
|| " select data from #tmp_aaa "
|| " drop table #tmp_aaa "
};
if exists PTGoalstData
then
PTGoalstDataText := "\n PT Discharge Recommendation : " || PTGoalstData;
else
PTGoalstDataText := "";
endif;
(DischargeOrder) := read last
{
" SET CONCAT_NULL_YIELDS_NULL off select {{{SINGLE-QUOTE}}}\n {{{SINGLE-QUOTE}}} + o.name + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + REPLACE(REPLACE(REPLACE(o.SummaryLine, CHAR(10), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), CHAR(13), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), CHAR(9), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) "
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || VisitGuid || " "
|| " and (o.name = {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}})"
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
};
// Concatenate the 3 values together with nice formatting
If exists DischargeOrder
then RehabGoalstDataText:= " " || DischargeOrder;
If exists PTGoalstData
then RehabGoalstDataText := RehabGoalstDataText || " \n ________________ " || PTGoalstDataText;
endif;
If exists OTGoalstData
then RehabGoalstDataText := RehabGoalstDataText || " \n ________________ " || OTGoalstDataText;
endif;
elseif exists PTGoalstData
then RehabGoalstDataText:= " " || PTGoalstDataText;
If exists OTGoalstData
then RehabGoalstDataText := RehabGoalstDataText || " \n ________________ " || OTGoalstDataText;
endif;
elseif exists OTGoalstData
then RehabGoalstDataText:= " " || OTGoalstDataText;
else
RehabGoalstDataText:= " ";
endif;
// Followup Visit and Test Orders
(FollowupVisitsandTestsList) := read
{
" SET CONCAT_NULL_YIELDS_NULL off select {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + o.name + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + REPLACE(REPLACE(REPLACE(o.SummaryLine, CHAR(10), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}), CHAR(13), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}), CHAR(9), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) "
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || VisitGuid || " "
|| " and o.InitialSessionTypeCode = {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} "
|| " and (o.name like {{{SINGLE-QUOTE}}}Lab Test%{{{SINGLE-QUOTE}}} or o.name like {{{SINGLE-QUOTE}}}Lab Test - INR%{{{SINGLE-QUOTE}}} or o.name like {{{SINGLE-QUOTE}}}Medical Imaging & Other Tests%{{{SINGLE-QUOTE}}} or o.name = {{{SINGLE-QUOTE}}}Discharge Follow-Up Visits{{{SINGLE-QUOTE}}} ) "
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
};
if exists FollowupVisitsandTestsList
then
for i in 1 seqto count FollowupVisitsandTestsList do
if i = 1
then FollowupVisitsandTestsListText := " \n " || FollowupVisitsandTestsList [i];
else FollowupVisitsandTestsListText := FollowupVisitsandTestsListText || "\n _____________\n" || FollowupVisitsandTestsList [i];
endif;
enddo;
// Check the Patient Education Box
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Plan of Care Instruction Type");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := true;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
else
FollowupVisitsandTestsListText := " ";
endif;
// Other Orders
(OtherOrdersList) := read
{
" SET CONCAT_NULL_YIELDS_NULL off select {{{SINGLE-QUOTE}}}\n{{{SINGLE-QUOTE}}} + o.name + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + REPLACE(REPLACE(REPLACE(o.SummaryLine, CHAR(10), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), CHAR(13), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), CHAR(9), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) "
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || VisitGuid || " "
|| " and o.InitialSessionTypeCode = {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} and o.name <> {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} and o.name <> {{{SINGLE-QUOTE}}}Discharge Follow-Up Visits{{{SINGLE-QUOTE}}} "
|| " and o.name not like {{{SINGLE-QUOTE}}}Lab Test%{{{SINGLE-QUOTE}}} and o.name not like {{{SINGLE-QUOTE}}}Lab Test - INR%{{{SINGLE-QUOTE}}} and o.name not like {{{SINGLE-QUOTE}}}Medical Imaging & Other Tests%{{{SINGLE-QUOTE}}} "
|| " and o.typecode <> {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} "
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
};
if exists OtherOrdersList
then
//
// Determine if the Orders have overflowed the first textbox (>2000)
for i in 1 seqto count OtherOrdersList do
if i = 1
then OtherOrders:= OtherOrdersList [i];
else OtherOrders:= OtherOrders || "\n ___________________________" || OtherOrdersList [i];
endif;
enddo;
if length OtherOrders <= 1900
then
OtherOrders1Text := (substring 1900 characters starting at 1 from OtherOrders);
OtherOrders2Text := " ";
else
OtherOrders1Text := (substring 1900 characters starting at 1 from OtherOrders);
OtherOrders2Text := (substring 2000 characters starting at 1901 from OtherOrders);
endif;
else
OtherOrders1Text := " ";
OtherOrders2Text := " ";
endif;
// POPULATE THE FIELDS WITH THE DATA
// Populate the Rehab Goals field (OT PT Discharge)
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Plan of Care Goals");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := RehabGoalstDataText;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the Followup Visits and Tests field
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Plan of Care Instructs");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := FollowupVisitsandTestsListText;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the Other Orders field
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Hosp DC Instructions 1");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := OtherOrders1Text;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the Other Orders #2 field
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Hosp DC Instructions 2");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := OtherOrders2Text;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Print the Discharge Instructions if the button is selected
theParameter := first of (thisparameters where thisparameters.Name = "CXD Transition Care Print");
theObservation:= first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Print and Send With Patient")
then PrintDocument := "yes";
else PrintDocument := "no";
endif;
If PrintDocument = "yes"
then
Report_Print_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PRINT{{{SINGLE-QUOTE}}};
reportname := "Discharge Instructions"; logicalprinter := "Default Report Printer"; physicalprinter:= "";
print1 := call Report_Print_MLM with(reportname, logicalprinter, physicalprinter);
print2 := call Report_Print_MLM with(reportname, logicalprinter, physicalprinter);
//BEGIN - [STH] CSR#: 32070
DCSummmary_Print_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_DCSUMMARY_PRINT{{{SINGLE-QUOTE}}};
void := CALL DCSummmary_Print_MLM with (clientguid,chartguid,visitguid,"Day of Discharge%",null);
//END - [STH] CSR#: 32070
endif; // Create a document
endif; // Docuement Closing
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,111 @@
maintenance:
title: DOC_FUNC_CCDA_PRINT;;
mlmname: DOC_FUNC_CCDA_PRINT;;
arden: version 2.5;;
version: 5.50;;
institution: Allscripts;;
author: Renish Bhimani;;
specialist: ;;
date: 2014-05-21;;
validation: testing;;
library:
purpose: print CCD-A document report from MLM
;;
explanation: The MLM is called from a Document and if a Print Button is selected, it calls MLM "SCH_FUNC_CCDA_Print"
which generates a CCDA document
Change history
06.25.2014 DW CSR# 31688 - MU2
07.08.2014 DW CSR# 31688 - MU2 Suppress print for behavioral health patients
12.11.2018 DW HD#3548079 - Blank prints are sometimes generated. We think it is due to system latency. I changed the delay from 90 to 120 seconds to permit DOC_FUNC_CCDA_CREATE_AND_TRANSPORT to create the CCDA Summary of Care
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
trig_event_enter := event {ClientDocumentEnter User ClientDocument: where documentname in ("Discharge Instructions (Post Hospital Care Orders)")};
trig_event_modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Discharge Instructions (Post Hospital Care Orders)")};
(VisitGUID, ChartGUID, ClientGUID) := read last {ClientDocument: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject};
ClientDocumentName := "CCDA Summary of Care";
ClientDocumentGUID := read first
{
" Select GUID from CV3ClientDocument with (nolock) WHERE DocumentName = " || SQL(ClientDocumentName)
|| " AND ClientGUID = " || sql(ClientGUID) || " AND ChartGUID = " || SQL(ChartGuid)
|| " AND ClientVisitGUID = " || SQL(VisitGuid)
|| " ORDER BY TouchedWhen DESC"
};
PrintButtonSelected := read first
{
" select top 1 fsl.value "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || sql(ClientGUID) || " and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || sql(ClientGUID) || " ) "
|| " where cd.clientguid = " || sql(ClientGUID) || " and cd.ChartGUID = " || SQL(ChartGuid) || " and cd.ClientVisitGUID= " || SQL(VisitGuid) || " "
|| " and cd.iscanceled = 0 "
|| " and cd.documentname like {{{SINGLE-QUOTE}}}%Post Hospital Care Orders%{{{SINGLE-QUOTE}}} "
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}CXD Transition Care Print{{{SINGLE-QUOTE}}}) "
|| " and fsl.value is not null "
|| " order by cd.touchedwhen desc "
};
PsychPatient := read
{
" Select currentlocation from cv3clientvisit with (nolock) "
|| " Where ClientGUID = " || sql(ClientGUID) || " AND ChartGUID = " || SQL(ChartGuid)
|| " AND GUID = " || SQL(VisitGuid) || " and currentlocation like {{{SINGLE-QUOTE}}}Psy%{{{SINGLE-QUOTE}}} "
};
if (ClientDocumentGUID <> "" OR ClientDocumentGUID is not null)
and PrintButtonSelected is not null
and not exist PsychPatient
then
CCD_MLM := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CCDA_Print{{{SINGLE-QUOTE}}};
void := call CCD_MLM with ClientGuid,ChartGuid,VisitGuid,ClientDocumentName;
endif;
// Diagnostic Alert - Can be enabled if needed
// send_alert := "DoNotSend";
// alert_dest := destination { Alert: warning, "Informational" , high, chart, "Informational" , 15042, send_alert, "No Override Allowed" };
;;
priority: 50
;;
evoke:
120 seconds after time of trig_event_enter;
120 seconds after time of trig_event_modify;
// trig_event_enter;
// trig_event_modify;
;;
logic:
conclude true;
;;
action:
// Diagnostic Alert - Can be enabled if needed
// write " Messages " || " CALL the PRINT MLM - " || NOW || " " || PrintButtonSelected at alert_dest;
;;
Urgency: 50;;
end:

View 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:

View File

@@ -0,0 +1,662 @@
maintenance:
title: DOC_FUNC_CLIN_DOC_SPECIALIST_CLARIFICATION;;
mlmname: DOC_FUNC_CLIN_DOC_SPECIALIST_CLARIFICATION;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Rich Schaeffer;;
specialist: Don Warnick;;
date: 2015-02-02;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
02.02.2015 DW CSR# 32616 Develop Application to allow for communication between clinical documentation specialist
03.23.2015 DW CSR# 32359 Physician CPT codes - Include the ICD code in the plan
09.30.2015 DW HD# 1887748 Line was added to address null vaule in HIS only section when a doctor opened a blank communication and selected "accept"
10.01.2015 DW CSR# 23359 ICD10
11.09.2015 DW CSR# 33624 Add Clairfication to Day of Discharge Note
06.29.2017 DW CSR# 33968 CDS Improvements
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// DOCUMENT OPEN SECTION
if thisdocumentCommunication.EventType = "DocumentOpening"
then
(OccCode, userName) := read last {" select OccupationCode, IDCode from CV3USER with (nolock) where guid = " || sql(userGuid) };
// if ( OccCode = "IT" AND userName = "jlaw" ) then
// break;
// endif;
// Gather a list of Responses from all EPNs for this visit. This will provide a list of CDS SN{{{SINGLE-QUOTE}}}s that are addresses and need to be excluded
(obsNamesListEPN, obsNameValueEPN, obsGuidEPN) := read
{"
SET CONCAT_NULL_YIELDS_NULL off
Select ocmi.name , o.ValueText, cd.guid, cd.*
from CV3ClientDocumentCUR cd with (nolock)
join CV3ClientDocDetailCUR cdd with (nolock) on cdd.ClientDocumentGUID = cd.GUID and cdd.ClientGUID = cd.clientguid and cdd.active = 1 and cdd.ArcType = cd.ArcType
join CV3ObservationDocumentCUR od with (nolock) on cdd.CLientDocumentGUID = od.OwnerGUID and od.ArcType = cdd.ArcType
join CV3ObservationCUR o with (nolock) on o.GUID = od.ObservationGUID and o.ArcType = od.ArcType
join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID
where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || "
and cd.iscanceled = 0 and o.ValueText is not null and (cd.DocumentName like {{{SINGLE-QUOTE}}}Physician Progress%{{{SINGLE-QUOTE}}} or cd.DocumentName like {{{SINGLE-QUOTE}}}Day of Discharge Summary eNote%{{{SINGLE-QUOTE}}}) and ocmi.name like {{{SINGLE-QUOTE}}}SCH_CDA_Doc Response MLM%{{{SINGLE-QUOTE}}}
order by ocmi.name desc
"};
// Exlusion GUID List
ExlusionGuids := "";
indexList2 := 1 seqto count (obsNamesListEPN);
for j in indexList2 do
obsNameEPN := last (first j from obsNamesListEPN);
obsValueEPN := last (first j from obsNameValueEPN);
CDSGuid:= SUBSTRING 16 CHARACTERS STARTING AT 3 FROM obsValueEPN;
if ExlusionGuids = ""
then ExlusionGuids := ExlusionGuids || "{{{SINGLE-QUOTE}}}" || CDSGuid || "{{{SINGLE-QUOTE}}}";
else ExlusionGuids := ExlusionGuids || ",{{{SINGLE-QUOTE}}}" || CDSGuid || "{{{SINGLE-QUOTE}}}";
endif;
enddo;
// If there are no exclusions, this will be the default value for the following query
null_found_bad_data := find "null" in string ExlusionGuids; // 03.30.2015 DW HD# 1887748 - Line was added to address null vaule in HIS only section when a doctor opened a blank communication and selected "accept"
If ExlusionGuids = "" or null_found_bad_data <> 0 then ExlusionGuids := "({{{SINGLE-QUOTE}}}999{{{SINGLE-QUOTE}}})"; endif;
(obsNamesList, obsNameValue, obsGuid, obsCDSname) := read
{"
SET CONCAT_NULL_YIELDS_NULL off
Select ocmi.name ,o.ValueText ,cd.guid, cp.DisplayName + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + convert(char(10), cdd.touchedwhen,20) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + convert(char(5),cdd.touchedwhen,8)
from CV3ClientDocumentCUR cd with (nolock)
join CV3ClientDocDetailCUR cdd with (nolock) on cdd.ClientDocumentGUID = cd.GUID and cdd.ClientGUID = cd.clientguid and cdd.ArcType = cd.ArcType
join CV3ObservationDocumentCUR od with (nolock) on cdd.CLientDocumentGUID = od.OwnerGUID and od.ArcType = cdd.ArcType
join CV3ObservationCUR o with (nolock) on o.GUID = od.ObservationGUID and o.ArcType = od.ArcType
join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID
join CV3CareProvider cp with (nolock) on cp.guid = o.RecordedProviderGUID
where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || "
and cd.iscanceled = 0 and cdd.active = 1 and od.active = 1 and o.ValueText is not null and cd.DocumentName = {{{SINGLE-QUOTE}}}Clinical Documentation Specialist Communication{{{SINGLE-QUOTE}}}
and cd.guid not in (" || ExlusionGuids || ")
order by cd.guid
"};
// Display CDS Structured Note data that doesn{{{SINGLE-QUOTE}}}t have a doctor response.
writeguid := " ";
writetext := " ";
priorguid := " ";
cdscomment := " ";
doctorname := " ";
guidcounter := 0;
obsnameappend:= "";
indexList := 1 seqto count (obsNamesList);
OptionFound := " ";
for i in indexList do
obsName := last (first i from obsNamesList);
obsValue := last (first i from obsNameValue);
CDSName := last (first i from obsCDSname);
CDSGUID := last (first i from obsGuid);
if priorguid <> CDSGUID
then
priorguid := CDSGUID;
guidcounter:= guidcounter + 1;
endif;
obsnameappend := " " || guidcounter as string;
if obsName = "SCH_CDA_Physician" then doctorname:= "To " || obsValue;
elseif obsName = "SCH_CDA_Question 1A" then clarification := "\n\n" || obsValue; // writetext := obsValue; writeobservationname := "SCH_CDA_Question " || guidcounter;
elseif obsName = "SCH_CDA_Clarification Request" then writetext := obsValue; writeobservationname := "SCH_CDA_Clarification Request ePN" || obsnameappend;
elseif obsName = "SCH_CDA_Swap Code" then writetext := obsValue; writeobservationname := "SCH_CDA_MC ICD Swap Code ePN" || obsnameappend || "A";
elseif obsName = "SCH_CDA_ICD Name A" then writetext := obsValue; writeobservationname := "SCH_CDA_MC ICD Name ePN " || guidcounter || "A"; OptionFound := "SCH_CDA_Expand " || guidcounter || "A";
elseif obsName = "SCH_CDA_ICD Code A" then writetext := obsValue; writeobservationname := "SCH_CDA_MC ICD Code ePN " || guidcounter || "A";
elseif obsName = "SCH_CDA_ICD Name B" then writetext := obsValue; writeobservationname := "SCH_CDA_MC ICD Name ePN " || guidcounter || "B"; OptionFound := "SCH_CDA_Expand " || guidcounter || "B";
elseif obsName = "SCH_CDA_ICD Code B" then writetext := obsValue; writeobservationname := "SCH_CDA_MC ICD Code ePN " || guidcounter || "B";
elseif obsName = "SCH_CDA_ICD Name C" then writetext := obsValue; writeobservationname := "SCH_CDA_MC ICD Name ePN " || guidcounter || "C"; OptionFound := "SCH_CDA_Expand " || guidcounter || "C";
elseif obsName = "SCH_CDA_ICD Code C" then writetext := obsValue; writeobservationname := "SCH_CDA_MC ICD Code ePN " || guidcounter || "C";
endif;
// Check the box that displays the option that is found
If OptionFound <> " "
then
this_parametername := first of (thisParameters where thisParameters.Name = OptionFound);
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := true;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
// Write to the Structured Note Text Box
If writetext <> " "
then
writefield := first of (thisParameters where thisParameters.Name = writeobservationname);
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := writefield.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := writetext;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
// Write to the Clarification field
if clarification <> " "
then
clarificationtext:= doctorname || " from " || CDSName || " " || clarification;
writefield := first of (thisParameters where thisParameters.Name = "SCH_CDA_Question " || guidcounter);
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := writefield.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := clarificationtext;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
// Write the GUID of the CDS SN to a hidden field
writefield := first of (thisParameters where thisParameters.Name = "SCH_CDA_Document ID" || obsnameappend);
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := writefield.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := CDSGUID;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
// Check the box that displays the section
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_CDA_Expand" || obsnameappend);
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := true;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
// If there is a Health Issue found, then set the Issue Type button to Chronic
if OptionFound <> " "
then
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_CDA_Select" || obsnameappend);
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "Chronic" then selectedItem.IsSelected := true;
else selectedItem.IsSelected := false;
endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
OptionFound := " "; // reset for next CDA set
endif;
enddo;
endif; // Document Open
// CHART OBSERVATION SECTION
if thisdocumentCommunication.EventType = "ChartObservation"
then
// Determine the name of the response selected (1 - 5) and append this value to the other observations
selectedobservationname:= first of (thisparameters.Name where thisparameters.ParameterGUID = thisDocumentCommunication.CurrentObservationObj.parameterguid);
// Determine the CDS Message number that is being processed. There are 4 configured to appear in the note.
If (SUBSTRING 1 CHARACTERS STARTING AT ((LENGTH selectedobservationname)-1) FROM selectedobservationname) = " "
then
// Comment response format (disagree, need to discuss, reviewed)
appendobs := " " || (SUBSTRING 1 CHARACTERS STARTING AT (LENGTH selectedobservationname) FROM selectedobservationname);
else
// Agree to problem format (add problem only, add problem and plan)
appendobs := " " || (SUBSTRING 1 CHARACTERS STARTING AT ((LENGTH selectedobservationname)-1) FROM selectedobservationname);
appendobschoice := SUBSTRING 1 CHARACTERS STARTING AT (LENGTH selectedobservationname) FROM selectedobservationname; // Choice Suffix ( A, B, C)
endif;
datestamp := EXTRACT MONTH NOW || "/" || EXTRACT DAY NOW|| "/" || EXTRACT YEAR NOW|| " " || EXTRACT HOUR NOW || ":" || EXTRACT MINUTE NOW;
username := read last {" SET CONCAT_NULL_YIELDS_NULL off Select displayname + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + OccupationCode from CV3User where guid = " || UserGuid || " " };
// Retreive the CSD SN GUID that was written to the Document ID field upon open
theParameter := first of (thisparameters where thisparameters.Name = "SCH_CDA_Document ID" || appendobs );
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
CSDSNGuid := theObservation.ValueObj.Value;
// Gather the Health Issue Name
theParameter := first of (thisparameters where thisparameters.Name = "SCH_CDA_MC ICD Name ePN" || appendobs || appendobschoice );
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
issuename := theObservation.ValueObj.Value;
// Gather the Health Issue Code
theParameter := first of (thisparameters where thisparameters.Name = "SCH_CDA_MC ICD Code ePN" || appendobs || appendobschoice );
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
issuecode := theObservation.ValueObj.Value;
if issuename is null and issuecode is null then isaquestion := "yes"; else isaquestion := "no"; endif;
// Gather the Health Issue Type
theParameter := first of (thisparameters where thisparameters.Name = "SCH_CDA_Select" || appendobs );
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Chronic")
then issuetype := "Problem-Chronic";
else issuetype := "Problem-Visit";
endif;
// Determine the Doctor Reponse that was selected
updateplan := "no";
theParameter := first of (thisparameters where thisparameters.Name = selectedobservationname );
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Add or Replace Problem and Plan")
then
if isaquestion = "no"
then agreed := "yes"; updateplan := "yes"; writetext := "1-" || CSDSNGuid || " " || username || " " || datestamp;
else agreed := "no"; updateplan := "no"; writetext := "4-" || CSDSNGuid || " " || username || " " || datestamp; // if selected inappropriately for a question, treat as acknowledged
endif;
endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Add or Replace Problem Only")
then
if isaquestion = "no"
then agreed := "yes"; updateplan := "no"; writetext := "1-" || CSDSNGuid || " " || username || " " || datestamp;
else agreed := "no"; updateplan := "no"; writetext := "4-" || CSDSNGuid || " " || username || " " || datestamp; // if selected inappropriately for a question, treat as acknowledged
endif;
endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Disagree")
then agreed := "no"; updateplan := "no"; writetext := "2-" || CSDSNGuid || " " || username || " " || datestamp;
endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Need to Discuss")
then agreed := "no"; updateplan := "no"; writetext := "3-" || CSDSNGuid || " " || username || " " || datestamp;
endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Reviewed")
then agreed := "no"; updateplan := "no"; writetext := "4-" || CSDSNGuid || " " || username || " " || datestamp;
endif;
// Write the GUID of the CDS SN to a hidden field
writefield := first of (thisParameters where thisParameters.Name = "SCH_CDA_Doc Response MLM" || appendobs );
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := writefield.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := writetext;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
// If "Agreed", was selected, create a Health Issue, add to Problems, add to Plans (if appropiate)
if agreed = "yes"
then
issuescheme:= "ICD10";
issuetext := " " ;
// Gather the Clarification Request Data
theParameter := first of (thisparameters where thisparameters.Name = "SCH_CDA_Clarification Request ePN" || appendobs);
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
evidence := theObservation.ValueObj.Value;
(ExistingHI) := read
{
" select distinct hi.shortname "
|| "from cv3healthissuedeclaration hi with (nolock) "
|| "join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
|| "where hi.clientguid = " || ClientGuid || " and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| "and hi.typecode = {{{SINGLE-QUOTE}}}problem-chronic{{{SINGLE-QUOTE}}} "
|| "and "
|| " hi.ICD10Code = {{{SINGLE-QUOTE}}}" || issuecode || "{{{SINGLE-QUOTE}}} "
};
if not exist ExistingHI
then
Func_Create_HI_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_Create_Health_Issue{{{SINGLE-QUOTE}}};
void := call Func_Create_HI_MLM with (visitGuid,issuename,issuecode,issuetext,issuetype,issuescheme);
endif;
// Replacement Problem Proceesing
theParameter := first of (thisparameters where thisparameters.Name = "SCH_CDA_MC ICD Swap Code ePN" || appendobs || "A");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
ReplacementFound := theObservation.ValueObj.Value;
targentproblem:= "";
ProblemList := 1 seqto 14;
for x in ProblemList do
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem " || x);
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
// Parse out the ICD10 code from the text in the Probliem field to be used for compare to the "replacement problem" entered by the CDS personnel
IDCodeBeg := (find "[" in string thisfield) +1;
IDCodeEnd := find "]" in string thisfield;
thisIDCode:= SUBSTRING (IDCodeEnd - IDCodeBeg) CHARACTERS STARTING AT IDCodeBeg FROM thisfield;
if thisIDCode = ReplacementFound
then
targentproblem:= "SCH_MDPN_Problem " || x;
if updateplan = "yes"
then
if x < 10
then
targentplan:= "SCH_MDPN_Assessment / Plans 0" || x;
else
targentplan:= "SCH_MDPN_Assessment / Plans " || x;
endif;
endif;
writefield := first of (thisParameters where thisParameters.Name = "SCH_CDA_MC ICD Swap Name ePN" || appendobs || appendobschoice);
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := writefield.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := "Problem " || ReplacementFound || " has been replaced in the note.";
if updateplan = "no" then newObservation.ValueObj.Value := newObservation.ValueObj.Value || " Plan is unchanged."; endif;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
enddo;
// No replacement problem was found. Write to the first open field in the AP Plan section
If targentproblem = ""
then
openfields := "0";
opencounter := 0;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 1");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_1 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 2");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_2 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 3");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_3 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 4");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_4 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 5");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_5 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 6");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_6 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 7");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_7 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 8");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_8 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 9");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_9 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 10");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_10 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 11");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_11 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 12");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_12 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 13");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_13 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 14");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_14 := "open"; opencounter := opencounter + 1; endif;
// Select the first open field for the Problem. Select the first open field for the Plan, if indicated by the doctor.
if field_1 = "open" then targentproblem:= "SCH_MDPN_Problem 1"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 01"; endif;
elseif field_2 = "open" then targentproblem:= "SCH_MDPN_Problem 2"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 02"; endif;
elseif field_3 = "open" then targentproblem:= "SCH_MDPN_Problem 3"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 03"; endif;
elseif field_4 = "open" then targentproblem:= "SCH_MDPN_Problem 4"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 04"; endif;
elseif field_5 = "open" then targentproblem:= "SCH_MDPN_Problem 5"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 05"; endif;
elseif field_6 = "open" then targentproblem:= "SCH_MDPN_Problem 6"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 06"; endif;
elseif field_7 = "open" then targentproblem:= "SCH_MDPN_Problem 7"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 07"; endif;
elseif field_8 = "open" then targentproblem:= "SCH_MDPN_Problem 8"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 08"; endif;
elseif field_9 = "open" then targentproblem:= "SCH_MDPN_Problem 9"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 09"; endif;
elseif field_10 = "open" then targentproblem:= "SCH_MDPN_Problem 10"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 10"; endif;
elseif field_11 = "open" then targentproblem:= "SCH_MDPN_Problem 11"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 11"; endif;
elseif field_12 = "open" then targentproblem:= "SCH_MDPN_Problem 12"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 12"; endif;
elseif field_13 = "open" then targentproblem:= "SCH_MDPN_Problem 13"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 13"; endif;
elseif field_14 = "open" then targentproblem:= "SCH_MDPN_Problem 14"; if updateplan = "yes" then targentplan:= "SCH_MDPN_Assessment / Plans 14"; endif;
endif;
endif;
// Write the problem name to the open problem slot
targentproblem := first of (thisParameters where thisParameters.Name = targentproblem);
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := targentproblem.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := issuename || " [" || issuecode || "]";
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
// Write the plan to the open plan slot
targentplan := first of (thisParameters where thisParameters.Name = targentplan);
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := targentplan.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := evidence;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif; // Agreed = "yes"
endif; // Observation Change
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,130 @@
maintenance:
title: DOC_FUNC_COUMADIN_EDUCATION_OBS;;
mlmname: DOC_FUNC_COUMADIN_EDUCATION_OBS;;
arden: version 5.5;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Juliet Law;;
specialist: Debbie Eiler;;
date: 2011-09-08;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
09.08.2011 JML Create date.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// .Net assemblies required for ObjectsPlus
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
// Receive arguments from the structured note
(thisDocumentCommunication) := argument;
// Configured parameter names that will be selected
USER_CONFIGURED_PARAMETER_NAMES := ("SCH_PHCO Warfarin Education",
"SCH_PHCO Warfarin Physician Contact",
"SCH_PHCO Warfarin Labwork");
//Document Types
STRUCTUREDNOTE := "StructuredNote";
//Event Types
DOCUMENTCLOSING := "DocumentClosing";
CHARTOBSERVATION := "ChartObservation";
//Setting debugFlag to True will allow popup dialogs containing debug information to appear
debugFlag := false;
// DocumentCommunication Object Model variables
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Get the client, visit, chart, and user GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
//Set up debugging information to be captured
messageText := "";
if (debugFlag = true) then
messageText := "Debug Information:\n\n";
messageText := messageText || " DOC_FUNC_PT_CONSULT_FROM_ADM_OBS mlm called.\n\n";
endif;
// Parameter that will trigger selecting all coumadin edu obs
theParameterName := "SCH_PHCO Warfarin Education Y/N";
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
if (thisDocumentCommunication.EventType = CHARTOBSERVATION) then
theParameter := first of (thisParameters where thisParameters.Name = theParameterName);
theObservation := first of (thisObservations where thisObservations.ParameterGUID = theParameter.ParameterGUID);
if (thisDocumentCommunication.CurrentObservationObj.ParameterGUID = theParameter.ParameterGUID) then
canSelectAll := exists (theObservation.ValueObj.ListItemsList.Value
where theObservation.ValueObj.ListItemsList.Value = "Yes..."
and theObservation.ValueObj.ListItemsList.IsSelected = true);
if (canSelectAll) then
For parameterName IN USER_CONFIGURED_PARAMETER_NAMES Do
selectParameter := first of (thisParameters where thisParameters.Name = parameterName);
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;
selectedItem.IsSelected := true;
listItems := (listItems, selectedItem);
enddo;
this_currentObj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
enddo;
endif;
endif;
endif;
if (debugFlag = true) then
messageText := messageText || "\n DOC_FUNC_PT_CONSULT_FROM_ADM_OBS mlm completed.\n\n";
thisDocumentCommunication.DisplayMessage := true;
thisDocumentCommunication.Message := messageText;
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,329 @@
maintenance:
title: DOC_FUNC_CREATE_DIETITIAN_CONSULT_FROM_ADULT_ASSESS_OBS;;
mlmname: DOC_FUNC_CREATE_DIETITIAN_CONSULT_FROM_ADULT_ASSESS_OBS;;
arden: version 2.5;;
version: 6.10;;
institution: Allscripts;;
author: Juliet M. Law ;;
specialist: ;;
date: 2011-07-18;;
validation: testing;;
library:
purpose: Generate a Dietitian Consult Order from a Braden Score result.
;;
explanation: On the Adult Assessment/Intervention Flowsheet, if the Braden Risk criteria calculate a Braden score
less than or equal to 14, then a Dietitian Consult order will automatically be generated, if one does not
already exist for the patient.
Change History
--------------
2011-07-18 JML Created
2014-05-02 JML WO# 161614: MLM re-write; Dietician consults erroneously created for Braden Scores.
2015-02-16 JML CSR 32519: MLM re-write; created; creating dietician consult if Braden Nutrition
score is 2 or less (renamed MLM).
2015-03-03 JML Moved to Production.
2016-06-16 STH CSR#: 33438 - Added logic to only generate the Dietitian Consult if there are 2 consecutive Nutrition (quality of food intake)
{Go-Live 6/21/2016}
;;
keywords: braden, dietitian consult, flowsheet
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Include ObjectsPlus Assemblies
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
//Include Called MLM to setup CDS objects
set_cds_vars := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_DEFINITION_MLM{{{SINGLE-QUOTE}}};
(thisDocumentCommunication) := argument;
/**************Make Changes To Spelling And Flags In This Section**************/
//Set up variables; initialize
//braden_param := "AS SC braden score CAL";
braden_param := "AS SC braden nutrition";
pressure_param := "AS press ulcer location";
wound_param := "AS body location";
dietitian_consult_name := "Dietitian Consult";
order_reason := "";
continue_creating_order := false;
rcd_val := "";
msg := "";
braden_val_list := ();
//Required Objects+ Variables
SessionType := "Standard";
SessionReason := "";
RequestingSource := "";
Order_Creation_Reason := "Low Braden score entered";
mlm_name := "DOC_FUNC_CREATE_DIETITIAN_CONSULT_FROM_BRADEN_OBS";
//Constants for document type and event
DOCUMENTCLOSING := "DocumentClosing";
CHARTOBSERVATION := "ChartObservation";
FLOWSHEET := "Flowsheet";
/******************************************************************************/
//Initialize CDS objects via MLM call
(thisDocumentCommunication, client_guid, client_visit_guid, chart_guid,
user_guid, document_type, document_name, event_type,
configuration_guid, this_currentObs, CancelEventFlag, this_fs_doc,
authored_by_guid, isIOFlowsheetFlag, client_document_guid, this_parameters,
this_columnList, this_currentColumn, this_chartedObservationsList,
this_parameters_displayName, current_parameter, current_parameter_name, current_parameter_guid,
current_parameter_datatype, selectedItems, selectedItems_Value, current_value,
diagnostic_message, displayMessageFlag) := CALL set_cds_vars WITH (thisDocumentCommunication);
if ( event_type = DOCUMENTCLOSING ) then
theCurrentColumn := first of ( this_columnList WHERE this_columnList.ClientDocumentGUID = this_currentObs.ClientDocumentGUID );
bradenParam := first of ( this_parameters WHERE this_parameters.Name = braden_param);
if ( exists bradenParam ) then
bradenObs := first of ( theCurrentColumn.ChartedObservationsList WHERE theCurrentColumn.ChartedObservationsList.ParameterGUID = bradenParam.ParameterGUID );
if ( exists bradenObs ) then
last_braden := last of ( bradenObs.ValueObj.ListItemsList.Value WHERE bradenObs.ValueObj.ListItemsList.IsSelected = true );
last_braden := SUBSTRING 1 CHARACTERS FROM last_braden;
if ( ( last_braden as number ) <= 2 ) then
current_column_dttm := theCurrentColumn.DateTime;
previous_braden_score := read first { " select guid as {{{SINGLE-QUOTE}}}clientvisitguid{{{SINGLE-QUOTE}}}, clientguid, chartguid into #tmp_patients from cv3clientvisit with (nolock)
where ClientGuid = " || sql(client_guid)
|| " and ChartGUID = " || sql(chart_guid)
|| " and guid = " || sql(client_visit_guid)
|| " Select guid into #tmp_obnames from CV3ObsCatalogMasterItem with (nolock)
where expirationDtm is null
and name = {{{SINGLE-QUOTE}}}AS SC BRADEN NUTRITION{{{SINGLE-QUOTE}}}
select top 1 substring(oflv.value,2,1) as obsvalue
from #tmp_patients cv with (nolock)
inner join SXACDObservationParameter ObsParam with (nolock)
on cv.ClientGUID = ObsParam.ClientGUID
and cv.chartguid = ObsParam.ChartGUID
and cv.clientvisitguid = ObsParam.clientvisitguid
AND ObsParam.IsCanceled = 0
and ObsParam.ObsMasterItemGUID in (select guid from #tmp_obnames)
inner join SCMObsFSListValues oflv with (nolock)
on obsparam.clientguid = oflv.clientguid
and obsparam.ObservationDocumentGUID = oflv.ParentGUID
where RecordedDtm < " || sql (current_column_dttm)
|| " order by RecordedDtm desc
drop table #tmp_obnames, #tmp_patients " };
if((previous_braden_score as number) <= 2) then
order_reason := "Braden Nutrition Score 2 or Less";
continue_creating_order := true;
endif;
endif;
endif;
endif;
if ( NOT continue_creating_order ) then
pressParam := first of ( this_parameters WHERE this_parameters.Name = pressure_param);
if ( exists pressParam ) then
pressureObs := first of ( theCurrentColumn.ChartedObservationsList WHERE theCurrentColumn.ChartedObservationsList.ParameterGUID = pressParam.ParameterGUID );
if ( exists pressureObs ) then
pressure_location := count ( pressureObs.ValueObj.ListItemsList.IsSelected WHERE pressureObs.ValueObj.ListItemsList.IsSelected = true );
if ( pressure_location >= 1 ) then
order_reason := "Pressure Ulcer";
continue_creating_order := true;
endif;
endif;
endif;
endif;
if ( NOT continue_creating_order ) then
woundParam := first of ( this_parameters WHERE this_parameters.Name = wound_param);
if ( exists woundParam ) then
woundObs := first of ( theCurrentColumn.ChartedObservationsList WHERE theCurrentColumn.ChartedObservationsList.ParameterGUID = woundParam.ParameterGUID );
if ( exists woundObs ) then
wound_location := count ( woundObs.ValueObj.ListItemsList.IsSelected WHERE woundObs.ValueObj.ListItemsList.IsSelected = true );
if ( wound_location >= 1 ) then
order_reason := "Wound Care";
continue_creating_order := true;
endif;
endif;
endif;
endif;
if ( continue_creating_order ) then
//Braden score less than or equal to 14
//Check for existence of Dietitian Consult Order
(orderName) := read {"SELECT o.Name, o.TouchedWhen"
|| " FROM CV3Order as o with (nolock) JOIN"
|| " (CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|| " JOIN CV3OrderReviewCategory AS orc with (nolock)"
|| " ON ocmi.OrderReviewCategoryGUID = orc.GUID)"
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|| " WHERE o.ClientGUID = " || Sql(client_guid)
|| " AND o.ClientVisitGUID = " || Sql(client_visit_guid)
|| " AND o.ChartGUID = " || Sql(chart_guid)
|| " AND ("
|| " (o.Name = {{{SINGLE-QUOTE}}}" || dietitian_consult_name || "{{{SINGLE-QUOTE}}})"
|| " OR ("
|| " orc.Code LIKE {{{SINGLE-QUOTE}}}%Risk Assessment Referrals%{{{SINGLE-QUOTE}}}"
|| " AND o.Name IN ({{{SINGLE-QUOTE}}}Cachexic Appearance{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Chewing or Swallowing Difficulty{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Currently Unable to Feed Self{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Decubitis Pressure Ulcer Present{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Mouth Pain- Prevents Eating{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Nausea, Vomiting Excess over 3 days{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Poor Appetite, Intake times 2 weeks{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Recent Oral, Esophageal, or GI Cancer{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}SOB-Prevents Eating- CHF or COPD Only{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Tube Feedings-Risk{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Weight Loss Unintentional>10 lbs in 3 mo{{{SINGLE-QUOTE}}})"
|| " )"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}Dietitian Follow Up%{{{SINGLE-QUOTE}}})"
|| " )"
|| " AND"
|| " ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"};
orderCount := count(orderName) as number;
if orderCount = 0 then
//No Dietitian Consult Orders exist
//Get the currently logged on user
//Get the locationGuid
locationGuid := read last {"SELECT CurrentLocationGUID, touchedWhen"
|| " FROM CV3ClientVisit with (nolock)"
|| " WHERE GUID = " || Sql(client_visit_guid)
|| " AND ClientGUID = " || Sql(client_guid)
, primaryTime = touchedWhen};
try
//Retrieve .Net version of client visit object
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((client_visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
//Use current user as default care provider
care_provider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((user_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
//Get Location Obj
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((locationGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
//Get the OrderCatalogMasterItem Obj
order_catalog_obj := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
with (dietitian_consult_name);
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}CommonData: {{-R}}\n" ||
ex.Message || "\n\n";
//Clean up
if order_catalog_obj is NOT Null then
void := call order_catalog_obj.Dispose;
order_catalog_obj := null;
endif;
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;
try
//Generate the Dietitian Consult Order
Order_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
with client_visit_obj,
order_catalog_obj,
Order_Creation_Reason,
care_provider_obj,
RequestingSource,
SessionType,
SessionReason,
location_obj,
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
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;
//Set UDDI field value on order (Indication for Consult)
ret_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}}
with "NUTR_Consult Reasons",order_reason;
//Order_Obj.SpecialInstructions := "Current Braden Nutrition Score is " || last_braden || ".";
//Save order
void := call Order_Obj.Save;
//CleanUp
if order_catalog_obj IS NOT Null then
void := call order_catalog_obj.Dispose;
order_catalog_obj := null;
endif;
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;
if error_occurred then
thisDocumentCommunication.DisplayMessage := true;
thisDocumentCommunication.Message := error_message;
endif;
endif;
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,515 @@
maintenance:
title: DOC_FUNC_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS;;
mlmname: DOC_FUNC_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS;;
arden: version 2.5;;
version: 5.50;;
institution: Allscripts;;
author: Juliet M. Law ;;
specialist: ;;
date: 2011-08-29;;
validation: testing;;
library:
purpose: Generate a Dressing Change order following a line insertion observation entry.
;;
explanation: When charting the location of a central line, picc line, or vascular access port line,
if the location value equals "Inserted" or "Inserted Pre Hospital", then
a dressing change order must be created to ensure the infusion team is scheduled for the dressing change.
The following flowsheets are affected by this:
* Adult Assessment/Intervention
* Pediatric Assessment/Intervention
* OB Assessment/Intervention
* Vital Signs - ED
The following observations and values are affected by this,
generating the following orders:
* Inserted:
- CVP Line Dressing Change
- INV Central Line Location
- INV Central Line Location Peds
- PICC Line Dressing Change
- INV PICC Location
- INV PICC Location Peds
- schck_INV PICC Location 2
- schck_INV PICC Location Peds 2
- Port Dressing Change
- INV Vasc Access Port Location
- Midline Dressing Change
- INV midline cath location
- INV midline cath location peds
* Inserted Pre Hospital:
- CVP Line Dressing Change
- INV Central Line Location
- INV Central Line Location Peds
- PICC Line Dressing Change
- INV PICC Location
- INV PICC Location Peds
- schck_INV PICC Location 2
- schck_INV PICC Location Peds 2
- Port Dressing Change
- INV Vasc Access Port Location
- Midline Dressing Change
- INV midline cath location
- INV midline cath location peds
;;
keywords: flowsheet
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
// .Net assemblies need to be loaded for ObjectsPlus
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
// Called MLM declaration section
// Utility function to parse strings
str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
set_cds_vars := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_DEFINITION_MLM{{{SINGLE-QUOTE}}};
read_obs_value := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_OBS_VALUE_MLM{{{SINGLE-QUOTE}}};
//***************** USER CONFIGURED CONSTANTS *********************
// Configured parameter names and corresponding index number that identifies which order
// in the USER_CONFIGURED_ORDER_ITEMS_LIST to create
// Add your configured parameter name to the top of this list
(USER_CONFIGURED_PARAMETER_LIST) := (
"INV central line location|1",
"INV central line location peds|1",
"schck_INV picc location 2|2",
"schck_INV picc location peds 2|2",
"INV PICC location|2",
"INV PICC location peds|2",
"INV vasc access port location|3",
"INV midline cath location|4",
"INV midline cath location peds|4"
);
(PICC_DUPLICATE_ORDER_LIST) := ("INV PICC location",
"INV PICC location peds",
"schck_INV picc location 2",
"schck_INV picc location peds 2");
// Charted values that will trigger order to be placed
// NOTE: these values do not directly correspond to the parameter name
// Add your configured corresponding charted values to the top of this list
(USER_CONFIGURED_CHARTED_VALUES_LIST) := (
"Inserted:",
"Inserted Pre Hospital:",
"Insert:"
);
// Associated Order Catalog Item name to create based on parameter
// Parameter list includes an index number that associates the parameter to the order item
// for example, "INV central line location|1" associates with "CVP Line Dressing Change" since
// the 1 represents the first index in the USER_CONFIGURED_ORDER_ITEMS_LIST
(USER_CONFIGURED_ORDER_ITEMS_LIST) := (
"CVP Line Dressing Change",
"PICC Line Dressing Change",
"Port Dressing Change",
"Midline Dressing Change"
);
//********************** End of USER CONFIGURED CONSTANTS section *********************************
// Default values when creating orders
SessionType := "Standard";
SessionReason := "";
RequestingSource := "";
user_IDType := "Primary";
order_creation_reason := "From MLM";
orderPlacedMessage := "";
orderItemName := NULL;
canPlaceOrder := false;
chartedDateTime := NULL;
triggerValueExists := false;
pedsExists := false;
//******************** Variable and Constant Declaration section *************************************
//Document Type
FLOWSHEET := "FlowSheet";
//Event Types
CHARTOBSERVATION := "ChartObservation";
DOCUMENTCLOSING := "DocumentClosing";
// Setting the cancelProcessing to true will cause the charted observation not to be saved
cancelProcessing := false;
// Setting the debugFlag to true will cause popup dialogs containing debug information to display
debugFlag := false;
//Set Flowsheet DocumentCommunication object model variables via Called MLM
(this_documentCommunication, client_guid, client_visit_guid, chart_guid,
user_guid, document_type, document_name, event_type,
configuration_guid, this_currentObs, CancelEventFlag, this_fs_doc,
authored_by_guid, isIOFlowsheetFlag, client_document_guid, this_parameters,
this_columnList, this_currentColumn, this_chartedObservationsList,
this_parameters_displayName, current_parameter, current_parameter_name, current_parameter_guid,
current_parameter_datatype, selectedItems, selectedItems_Value, current_value,
diagnostic_message, displayMessageFlag) := CALL set_cds_vars WITH (this_documentCommunication);
this_DocumentType := this_documentCommunication.DocumentType;
this_EventType := this_documentCommunication.EventType;
// Set up debugging information to be captured
messageText := "";
if (debugFlag = true) then
messageText := "Debug Information: \n\n";
messageText := messageText || " DOC_FUNC_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS mlm is called\n\n";
endif;
//********************** Begin Processing Logic ***********************************
// Perform logic if DocumentType is FlowSheet and EventType is DocumentClosing
if ((this_DocumentType = FLOWSHEET) AND (this_EventType = DOCUMENTCLOSING)) then
// Iterate through parameters in user configured list
FOR parameterName IN USER_CONFIGURED_PARAMETER_LIST DO
// Parse out parameter name from associated order index location
parameterElementList := call str_parse with parameterName, "|";
observationName := parameterElementList[1];
orderIdx := parameterElementList[2] as number;
theParameter := first of (this_parameters WHERE this_parameters.Name = observationName);
if (exists theParameter) then
(this_documentCommunication, selectedValue, currentValue) := call read_obs_value with (this_documentCommunication, theParameter.Name, "Read");
if (exists selectedValue) then
// Determine if we should place the order by what was charted matching one of the values
// in our configured list
triggerValueExists := ((USER_CONFIGURED_CHARTED_VALUES_LIST[1] IN selectedValue)
OR (USER_CONFIGURED_CHARTED_VALUES_LIST[2] IN selectedValue)
OR (USER_CONFIGURED_CHARTED_VALUES_LIST[3] IN selectedValue));
// If we can place the order, then retrieve the associated order item name based on the
// order index
if (triggerValueExists) then
orderItemName := USER_CONFIGURED_ORDER_ITEMS_LIST[orderIdx];
//Check for order existence with same request date & time of charted obs time on flowsheet
//Get DateTime on column just charted
chartedDateTime := first of (this_columnList.DateTime
where this_columnList.ClientDocumentGUID = this_currentObs.ClientDocumentGUID);
greaterChartDateTime := chartedDateTime + 1 hour;
lessChartDateTime := chartedDateTime - 1 hour;
requestYear := year of chartedDateTime as string;
if ((month of chartedDateTime >= 1) and (month of chartedDatetime <= 9)) then
requestMonth := ("0" || month of chartedDateTime) as string;
else
requestMonth := month of chartedDateTime as string;
endif;
if ((day of chartedDateTime >= 1) and (day of chartedDateTime <= 9)) then
requestDay := ("0" || day of chartedDateTime) as string;
else
requestDay := day of chartedDateTime as string;
endif;
requestDateCheck := (requestMonth || "-" || requestDay || "-" || requestYear) as string;
orderRequestDate := (requestYear || "-" || requestMonth || "-" || requestDay) as string;
//Locate Order
orderSpecInstr := ();
existingOrderName := ();
(existingOrderName, orderSpecInstr) := read {"SELECT o.Name, oai.SpecialInstructions, o.TouchedWhen"
|| " FROM CV3Order as o with (nolock) JOIN"
|| " (CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|| " JOIN CV3OrderReviewCategory AS orc with (nolock)"
|| " ON ocmi.OrderReviewCategoryGUID = orc.GUID)"
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|| " JOIN CV3OrderAddnlInfo as oai with (nolock)"
|| " ON o.GUID = oai.GUID"
|| " WHERE o.ClientGUID = " || client_guid
|| " AND o.ClientVisitGUID = " || client_visit_guid
|| " AND o.ChartGUID = " || chart_guid
|| " AND ("
|| " (o.Name = {{{SINGLE-QUOTE}}}" || orderItemName || "{{{SINGLE-QUOTE}}})"
|| " )"
|| " AND"
|| " ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|| " AND ((o.CreatedWhen >= {{{SINGLE-QUOTE}}}" || lessChartDateTime || "{{{SINGLE-QUOTE}}}"
|| " and o.CreatedWhen < {{{SINGLE-QUOTE}}}" || greaterChartDateTime || "{{{SINGLE-QUOTE}}})"
|| " OR o.RequestedDate = {{{SINGLE-QUOTE}}}" || orderRequestDate || "{{{SINGLE-QUOTE}}}"
/* JML: Help desk ticket fix */ || " OR oai.SpecialInstructions LIKE {{{SINGLE-QUOTE}}}%" || chartedDateTime || "%{{{SINGLE-QUOTE}}})"
, primaryTime = touchedWhen};
if ((count existingOrderName) = 0) then
canPlaceOrder := true;
elseif ((count existingOrderName) = 1) then
if (("PICC Line Dressing Change" in existingOrderName) and (theParameter.Name in PICC_DUPLICATE_ORDER_LIST)) then
if (orderSpecInstr[1] matches pattern "PICC%" AND
((theParameter.Name = PICC_DUPLICATE_ORDER_LIST[3]) OR
(theParameter.Name = PICC_DUPLICATE_ORDER_LIST[4]))) then
canPlaceOrder := true;
elseif (orderSpecInstr[1] matches pattern "Additional PICC%" AND
((theParameter.Name = PICC_DUPLICATE_ORDER_LIST[1]) OR
(theParameter.Name = PICC_DUPLICATE_ORDER_LIST[2]))) then
canPlaceOrder := true;
else
canPlaceOrder := false;
endif;
else
canPlaceOrder := false;
endif;
else //count = 2
canPlaceOrder := false;
endif;
if (canPlaceOrder) then
parameterDisplayName := theParameter.DisplayName;
if (theParameter.Name matches pattern "%peds%") then
pedsExists := true;
endif;
specialInstructions := "";
if (parameterDisplayName = "PICC") then
if pedsExists then
piccDeviceParamName := "INV picc device Peds";
insertLengthParamName := "AS iv device insert cath length NU peds";
externalLengthParamName := "SCHCK_AS iv device external length NU peds";
dressSecureParamName := "INV iv device dress secure peds";
elseif not pedsExists then
piccDeviceParamName := "INV picc device";
insertLengthParamName := "AS iv device insert cath length NU";
externalLengthParamName := "SCHCK_AS iv device external length NU";
dressSecureParamName := "INV iv device dress secure";
endif;
piccLocation := selectedValue;
(this_documentCommunication, piccDevice, currentValue) := call read_obs_value with
(this_documentCommunication, piccDeviceParamName, "Read");
(this_documentCommunication, selectedValue, insertLength) := call read_obs_value with
(this_documentCommunication, insertLengthParamName, "Read");
insertLength := "Insert Length " || insertLength;
(this_documentCommunication, selectedValue, externalLength) := call read_obs_value with
(this_documentCommunication, externalLengthParamName, "Read");
externalLength := "External Length " || externalLength;
(this_documentCommunication, dressing, currentValue) := call read_obs_value with
(this_documentCommunication, dressSecureParamName, "Read");
if ("pressure dressing applied" IN dressing) then
pressureDress := true;
else
pressureDress := false;
endif;
specialInstructions := "PICC: " || chartedDateTime || "; " || piccLocation || "; " || piccDevice
|| "; " || insertLength || "; " || externalLength;
elseif (parameterDisplayName = "Additional PICC") then
if pedsExists then
insertLengthParamName := "AS iv device insert cath length NU Peds PICC 2";
externalLengthParamName := "SCHCK_AS iv device external length NU Peds PICC 2";
dressSecureParamName := "INV iv device dress secure Peds PICC 2";
elseif NOT pedsExists then
insertLengthParamName := "AS iv device insert cath length NU PICC 2";
externalLengthParamName := "SCHCK_AS iv device external length NU PICC 2";
dressSecureParamName := "INV iv device dress secure PICC 2";
endif;
addlPiccLocation := selectedValue;
(this_documentCommunication, addlPiccDevice, currentValue) := call read_obs_value with
(this_documentCommunication, "schck_inv picc device 2", "Read");
(this_documentCommunication, selectedValue, addlInsertLength) := call read_obs_value with
(this_documentCommunication, insertLengthParamName, "Read");
addlInsertLength := "Insert Length " || addlInsertLength;
(this_documentCommunication, selectedValue, addlExternalLength) := call read_obs_value with
(this_documentCommunication, externalLengthParamName, "Read");
addlExternalLength := "External Length " || addlExternalLength;
(this_documentCommunication, addlDressing, currentValue) := call read_obs_value with
(this_documentCommunication, dressSecureParamName, "Read");
if ("pressure dressing applied" IN addlDressing) then
pressureDress := true;
else
pressureDress := false;
endif;
specialInstructions := "Additional PICC: " || chartedDateTime || "; " || addlPiccLocation || "; " || addlPiccDevice
|| "; " || addlInsertLength || "; " || addlExternalLength;
elseif (parameterDisplayName = "Midline Catheter") then
if pedsExists then
insertLengthParamName := "AS iv device insert cath length NU Peds midline";
externalLengthParamName := "SCHCK_AS iv device external length NU Peds midline";
dressSecureParamName := "INV iv device dress secure Peds midline";
elseif NOT pedsExists then
insertLengthParamName := "AS iv device insert cath length NU midline";
externalLengthParamName := "SCHCK_AS iv device external length NU midline";
dressSecureParamName := "INV iv device dress secure midline";
endif;
midlineLocation := selectedValue;
(this_documentCommunication, midlineDevice, currentValue) := call read_obs_value with
(this_documentCommunication, "INV midline cath device", "Read");
(this_documentCommunication, selectedValue, insertLength) := call read_obs_value with
(this_documentCommunication, insertLengthParamName, "Read");
insertLength := "Insert Length " || insertLength;
(this_documentCommunication, selectedValue, externalLength) := call read_obs_value with
(this_documentCommunication, externalLengthParamName, "Read");
externalLength := "External Length " || externalLength;
(this_documentCommunication, dressing, currentValue) := call read_obs_value with
(this_documentCommunication, dressSecureParamName, "Read");
if ("pressure dressing applied" IN dressing) then
pressureDress := true;
else
pressureDress := false;
endif;
specialInstructions := chartedDateTime || "; " || midlineLocation || "; " || midlineDevice
|| "; " || insertLength || "; " || externalLength;
elseif (parameterDisplayName = "Central Line") then
centralLineLocation := selectedValue;
(this_documentCommunication, centralLineDevice, currentValue) := call read_obs_value with
(this_documentCommunication, "INV central line device", "Read");
pressureDress := false;
specialInstructions := chartedDateTime || ", " || centralLineLocation || ", " || centralLineDevice;
elseif (parameterDisplayName = "Vascular Access Port") then
vascAccessLocation := selectedValue;
(this_documentCommunication, vascPortType, currentValue) := call read_obs_value with
(this_documentCommunication, "INV vasc access port type", "Read");
(this_documentCommunication, vascNeedle, currentValue) := call read_obs_value with
(this_documentCommunication, "INV vasc access port needle", "Read");
(this_documentCommunication, dressing, currentValue) := call read_obs_value with
(this_documentCommunication, "INV iv device dress secure vasc acc", "Read");
if (NOT (exists dressing)) then
(this_documentCommunication, dressing, currentValue) := call read_obs_value with
(this_documentCommunication, "INV iv device dress secure Peds vasc acc", "Read");
endif;
if ((exists dressing) AND ("pressure dressing applied" IN dressing)) then
pressureDress := true;
else
pressureDress := false;
endif;
specialInstructions := chartedDateTime || "; " || vascAccessLocation || "; " || vascPortType
|| "; " || vascNeedle;
endif;
// Create a GENERAL order from a catalog item
try
// ClientVisit object
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((client_visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
// GENERAL catalog item object
general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
with orderItemName;
// CareProvider Object
requesting_care_provider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((user_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
// Location Object
location_guid := read last {"SELECT CurrentLocationGuid FROM CV3ClientVisit "
|| " WHERE ClientGuid = " || client_guid};
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
// Create GENERAL order
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
with client_visit_obj,
general_catalog_item,
order_creation_reason,
requesting_care_provider_obj,
RequestingSource,
SessionType,
SessionReason,
location_obj,
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
if pressureDress then
ret_val := call GeneralOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}}
with "NUR_INF_Pressure DrsgCB", True;
endif;
GeneralOrder_Obj.RequestedDate := orderRequestDate;
GeneralOrder_Obj.SpecialInstructions := specialInstructions;
void := call GeneralOrder_Obj.Save;
void := call GeneralOrder_Obj.Dispose;
orderPlacedMessage := orderPlacedMessage || "\n" || orderItemName;
endtry;
// Exception Handling
catch Exception ex
debugFlag := true;
messageText := messageText || "New General Order:\n" ||
ex.Message || "\n\n";
endcatch;
// Clean UP
if (location_obj IS NOT NULL) then
void := call location_obj.Dispose;
location_obj := NULL;
endif;
if (requesting_care_provider_obj IS NOT NULL) then
void := call requesting_care_provider_obj.Dispose;
requesting_care_provider_obj := NULL;
endif;
if (general_catalog_item IS NOT NULL) then
void := call general_catalog_item.Dispose;
general_catalog_item := NULL;
endif;
if (client_visit_obj IS NOT NULL) then
void := call client_visit_obj.Dispose;
client_visit_obj := NULL;
endif;
endif; //canPlaceOrder = True
endif; //triggerValueExists
endif; //theObservation exists
endif; //theParameter Exists
enddo;
endif;
// If an exception occurred, display debug information
if (debugFlag = true) then
this_documentCommunication.DisplayMessage := (orderPlacedMessage <> "");
this_documentCommunication.Message := "The following order(s) were placed:\n" || orderPlacedMessage;
messageText := messageText || "\n DOC_FUNC_CREATE_DRESSING_CHANGE_FROM_LINE_INSERTION_OBS mlm completed\n\n";
this_documentCommunication.DisplayMessage := true;
this_documentCommunication.Message := messageText;
endif;
if (cancelProcessing = true) then
this_documentCommunication.CancelEvent := true;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
return this_DocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,267 @@
maintenance:
title: DOC_FUNC_CREATE_HEALTH_ISSUE;;
mlmname: DOC_FUNC_CREATE_HEALTH_ISSUE;;
arden: version 5.5;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Don Warnick;;
specialist: ;;
date: 2011-08-22;;
validation: testing;;
library:
purpose: This MLM will create a Health Issue when an observation is charted (started for smoking health issue)
;;
explanation: This value is needed for meaningful use.
Change history
08.22.2011 DW Created
04.19.2013 JML CSR 26725: Expand to create "Alcohol Abuse" hi when user selects yes to "problems related to alcohol..."
observation.
06.03.2013 JML CSR 31688: Include "heavy smoker..." and "light smoker..." observation values in list that
will create "Smoker" health issue when selected.
09.30.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 HI Dynamic Creation with all details Like ICD10 Code, Snowmed Code etc And Duplicate HI Check Change.
10.12.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 Coding Scheme [ICD10] And Duplicate Check of HI .
03.09.2018 DW CSR# 35320 SSC - Added section for pregnancy and lactation health issues
;;
keywords:
;;
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";
(thisDocumentCommunication) := argument;
(thisStructuredNoteDoc):= thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType:= OBJECT [ListItemGUID, Value, IsSelected];
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
createHI := false;
hi_search_name := "";
searchtype := "";
(this_currentObs) := thisDocumentCommunication.CurrentObservationObj;
// Selected Observation Logic
smoker_parametername := first of (thisParameters where thisParameters.Name = "SCHCK tobacco use pt");
alcohol_parametername:= first of (thisParameters where thisParameters.Name = "PRO alcohol problems rel yn alco");
preg_or_parametername:= first of (thisParameters where thisParameters.Name = "SCH OR_PRO fem repro pg yn");
lact_or_parametername:= first of (thisParameters where thisParameters.Name = "SCH_PRO fem repro breastfeed yn");
if (this_currentObs.ParameterGUID = smoker_parametername.ParameterGUID) then selected_parametername:= smoker_parametername; hi_search_name:= "smoking"; searchtype := "1"; hi_search_code:= "{{{SINGLE-QUOTE}}}305.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V15.82{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}F17.200{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Z87.891{{{SINGLE-QUOTE}}}";
elseif (this_currentObs.ParameterGUID = alcohol_parametername.ParameterGUID)then selected_parametername:= alcohol_parametername; hi_search_name:= "alcohol"; searchtype := "1"; hi_search_code:= "{{{SINGLE-QUOTE}}}305.0{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}291.81{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}F10.10{{{SINGLE-QUOTE}}}";
elseif (this_currentObs.ParameterGUID = preg_or_parametername.ParameterGUID)then selected_parametername:= preg_or_parametername; hi_search_name:= "pregnancy"; searchtype := "2"; hi_search_code:= "{{{SINGLE-QUOTE}}}Z33.1{{{SINGLE-QUOTE}}}";
elseif (this_currentObs.ParameterGUID = lact_or_parametername.ParameterGUID)then selected_parametername:= lact_or_parametername; hi_search_name:= "lactation"; searchtype := "2"; hi_search_code:= "{{{SINGLE-QUOTE}}}Z39.1{{{SINGLE-QUOTE}}}";
endif;
selected_observation := first of (thisObservations where thisObservations.ParameterGUID = selected_parametername.ParameterGUID);
// Search for existing health issue
if searchtype is not null
then
if searchtype = "1" // Search by problem name and ICD10 code (include problem-visit on any account)
then
(Existing_HI_Found) := read
{ " select distinct hi.ShortName
from CV3HealthIssueDeclaration hi with (nolock) join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID
where hi.ClientGUID = " || ClientGuid || " and hi.Active = 1 and hi.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and hi.TypeCode not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}) and hi.ICD10Code is not null
and (hi.Text like {{{SINGLE-QUOTE}}}%" || hi_search_name || "%{{{SINGLE-QUOTE}}} or hi.ShortName like {{{SINGLE-QUOTE}}}%" || hi_search_name || "%{{{SINGLE-QUOTE}}} or (case when chi.TypeCode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} then SUBSTRING(chi.Code,5,20) when chi.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} then chi.Code when chi.TypeCode = {{{SINGLE-QUOTE}}}icd10{{{SINGLE-QUOTE}}}
then chi.Code end) in ( " || hi_search_code || " )) "
};
elseif searchtype = "2" // Search by ICD10 code only (problem-visit on this visit only)
then
(Existing_HI_Found) := read
{ " select distinct hi.ShortName
from CV3HealthIssueDeclaration hi with (nolock) join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID
where hi.ClientGUID = " || ClientGuid || " and hi.ClientVisitGUID = " || visitGuid || " and hi.Active = 1 and hi.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} and hi.TypeCode not in ({{{SINGLE-QUOTE}}}admitting dx{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}chronic dx{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}dx comments{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}) and hi.ICD10Code is not null
and case when chi.TypeCode = {{{SINGLE-QUOTE}}}imo{{{SINGLE-QUOTE}}} then SUBSTRING(chi.Code,5,20) when chi.TypeCode = {{{SINGLE-QUOTE}}}icd9{{{SINGLE-QUOTE}}} then chi.Code when chi.TypeCode = {{{SINGLE-QUOTE}}}icd10{{{SINGLE-QUOTE}}} then chi.Code end in ( " || hi_search_code || " ) "
};
endif;
endif;
// Proceed if and existing health issue has not been found
if not exists Existing_HI_Found
then
// Smoking Section
if hi_search_name = "smoking"
then
If true in (selected_observation.ValueObj.ListItemsList.IsSelected where
selected_observation.ValueObj.ListItemsList.Value = "light smoker (4 or less cigarettes per day)…" or selected_observation.ValueObj.ListItemsList.Value = "current every day smoker..." or
selected_observation.ValueObj.ListItemsList.Value = "current some day smoker..." or selected_observation.ValueObj.ListItemsList.Value = "light smoker..." )
then smoker := "Smoker";
elseif true in (selected_observation.ValueObj.ListItemsList.IsSelected where selected_observation.ValueObj.ListItemsList.Value = "former smoker (no use for at least 30 days)…" )
then smoker := "Former Smoker";
else
smoker := "Non Smoker";
endif;
If smoker not in ("Smoker","Former Smoker")
then
createHI := false; // Never a Smoker
else
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This selection will create a chronic health issue of {{{SINGLE-QUOTE}}}" || smoker || "{{{SINGLE-QUOTE}}}" || "\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 "
,"Confirm Tobacco Use Documentation ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
If (dlg_result as string) = "No"
then
createHI := false;
else
createHI := true;
If smoker = "Smoker"
then issuename := "Smoker"; issuecode := "F17.200"; issuetype := "Problem-Chronic";
else issuename := "Former Smoker"; issuecode := "Z87.891"; issuetype := "Problem-Chronic";
endif;
endif;
endif;
// Alcohol Section
elseif hi_search_name = "alcohol"
then
if true in (selected_observation.ValueObj.ListItemsList.IsSelected where selected_observation.ValueObj.ListItemsList.Value = "yes...")
then
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This selection will create a chronic health issue of {{{SINGLE-QUOTE}}}Alcohol Abuse{{{SINGLE-QUOTE}}} \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 "
,"Confirm Alcohol Use Documentation ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
if ((dialogRes as string) = "Yes")
then
createHI := true;
issueName := "Alcohol Abuse"; issuecode := "F10.10"; issuetype := "Problem-Chronic";
else
createHI := false;
endif;
else
createHI := false;
endif;
// Pregnancy Section
elseif hi_search_name = "pregnancy"
then
if true in (selected_observation.ValueObj.ListItemsList.IsSelected where selected_observation.ValueObj.ListItemsList.Value = "yes")
then
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This selection will create a visit health issue of {{{SINGLE-QUOTE}}}Pregnancy{{{SINGLE-QUOTE}}} \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 "
,"Confirm Pregnancy Documentation ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
if ((dialogRes as string) = "Yes")
then
createHI := true;
issueName := "Pregnancy"; issuecode := "Z33.1"; issuetype := "Problem-Visit";
else
createHI := false;
endif;
else
createHI := false;
endif;
// Lactation Section
elseif hi_search_name = "lactation"
then
if true in (selected_observation.ValueObj.ListItemsList.IsSelected where selected_observation.ValueObj.ListItemsList.Value = "yes")
then
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This selection will create a visit health issue of {{{SINGLE-QUOTE}}}Lactating Mother{{{SINGLE-QUOTE}}} \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 "
,"Confirm Lactation Documentation ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
if ((dialogRes as string) = "Yes")
then
createHI := true;
issueName := "Lactating Mother"; issuecode := "Z39.1"; issuetype := "Problem-Visit";
else
createHI := false;
endif;
else
createHI := false;
endif;
endif; // End of Health Issue Processing Sections
// Create Health Issue Section
if (createHI)
then
issuecodingscheme := "ICD10";
issuetext := "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,issueName,issuecode,issuetext,issuetype,issuecodingscheme);
endif;
endif; // Existing HI not found
;;
evoke:
;;
logic:
conclude true;
;;
action:
return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,64 @@
maintenance:
title: DOC_FUNC_DCSUMMARY_SAVE_AND_PRINT;;
mlmname: DOC_FUNC_DCSUMMARY_SAVE_AND_PRINT;;
arden: version 2.5;;
version: 0.00;;
institution: St. Clair Hospital;;
author: Shawn Head;;
specialist: Shawn Head;;
date: 2015-06-01;;
validation: testing;;
library:
purpose: Create DC Summary report after saving the discharge summary.
;;
explanation:
Change history
06.3.2015 STH CSR# 32070 go-live 6/9/2015 - 15 seconds after a Day of Discharge Summary eNote is created/modified this MLM will check to see if
Discharge Order reconiliation is completed. If its complete the MLM will call the DC Summary print.
;;
keywords:
Discharge Summary, Day of Discharge Note, DC Summary
;;
citations:
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
trig_event_enter := event {ClientDocumentEnter User ClientDocument: where documentname matches pattern ("Day of Discharge Summary eNote%")};
trig_event_modify:= event {ClientDocumentModify User ClientDocument: where documentname matches pattern ("Day of Discharge Summary eNote%")};
(VisitGUID, ChartGUID, ClientGUID, docguid) := read last {ClientDocument: ClientVisitGUID, ChartGUID, ClientGUID, guid REFERENCING EvokingObject};
dc_orderrec_GUID := read last {"select guid from CV3OrderReconcile with (nolock) "
|| " where clientguid = " || sql(ClientGUID)
|| " and chartguid = " || sql(ChartGUID)
|| " and ClientVisitGUID = " || sql(VisitGUID)
|| " and reconciletypecode = {{{SINGLE-QUOTE}}}discharge{{{SINGLE-QUOTE}}} "
|| " and ReconcileStatusType = 2 "};
if dc_orderrec_guid is not null and dc_orderrec_guid <> "" then
DCSummmary_Print_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_DCSUMMARY_PRINT{{{SINGLE-QUOTE}}};
void := CALL DCSummmary_Print_MLM with (clientguid,chartguid,visitguid,null,docguid);
endif;
;;
priority: 50
;;
evoke:
15 seconds after time of trig_event_enter;
15 seconds after time of trig_event_modify;
;;
logic:
conclude true;
;;
action:
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,125 @@
maintenance:
title: DOC_FUNC_DEFAULT_OBS_VALUES;;
mlmname: DOC_FUNC_DEFAULT_OBS_VALUES;;
arden: version 2.5;;
version: 1.00;;
institution: St. Clair Hospital;;
author: Shawn Head x7468 - Allscripts/St. Clair Hospital;;
specialist: Courtney Carr - Allscripts/St. Clair Hospital;;
date: 2017-06-20;;
validation: testing;;
library:
purpose:
;;
explanation:
06-20-2017 STH CSR#: 35320 - This MLM is called to parse through the configuration on structured notes to default the observation values to user configurable values.
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
std_write_obs_MLM := mlm {{{SINGLE-QUOTE}}}STD_FUNC_DOC_WRITE_TO_DOCUMENT{{{SINGLE-QUOTE}}};
string_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
DocGuid := thisStructuredNoteDoc.ClientDocumentGUID ;
allrulesprocessed := false;
Generic_SN_Parameter := first of (thisParameters where thisParameters.Name = "GenericSetObsDefaults");
Generic_SN_Obs := first of (thisObservations where thisObservations.ParameterGUID = Generic_SN_Parameter.ParameterGUID);
Generic_SN_Rules := Generic_SN_Obs.ValueObj.Value;
fidcrlf := find CRLF in string Generic_SN_Rules;
ctlen := length of Generic_SN_Rules;
ReplaceCRLF := "";
for x in (fidcrlf seqto(ctlen)) do
ReplaceCRLF := read {" select replace("|| sql(Generic_SN_Rules) || ",char(13)+char(10),{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) "};
fidcrlf := find CRLF in string ReplaceCRLF;
if fidcrlf = 0 then
fidcrlf := ctlen + 1;
endif;
enddo;
if not (ReplaceCRLF[1] matches pattern "%|") then
ReplaceCRLF[1] := ReplaceCRLF[1] || "|";
endif;
Rules_List := ();
Rules_Obs_Values := ();
SplitRulesFromValues := ();
SplitValuesFromSuggestedText := ();
Rules_List := call string_parse with (ReplaceCRLF[1],"|");
for x in 1 seqto(count(Rules_List)) do
test2 := Rules_List[x];
tstfind := find CRLF in string Rules_List[x];
(SplitRulesFromValues) := call string_parse with (Rules_List[x],"~");
Rules_Obs_Parameter := SplitRulesFromValues[1];
testsplit := (SplitRulesFromValues[2] matches pattern "%{%");
if(SplitRulesFromValues[2] matches pattern "%{%") then
SplitValuesFromSuggestedText := call string_parse with (SplitRulesFromValues[2],"{");
(Rules_Obs_Values) := call string_parse with (SplitValuesFromSuggestedText[1],"^");
Rules_Obs_SuggestedText := SplitValuesFromSuggestedText[2];
else
(Rules_Obs_Values) := call string_parse with (SplitRulesFromValues[2],"^");
Rules_Obs_SuggestedText := "";//SplitValuesFromSuggestedText[2];
endif;
IF(count(Rules_Obs_Values)>1) then
(thisDocumentCommunication) := CALL std_write_obs_MLM with (thisDocumentCommunication,Rules_Obs_Parameter,Rules_Obs_Values,Rules_Obs_SuggestedText,"Replace");
else
(thisDocumentCommunication) := CALL std_write_obs_MLM with (thisDocumentCommunication,Rules_Obs_Parameter,Rules_Obs_Values[1],Rules_Obs_SuggestedText,"Replace");
endif;
enddo;
if((Generic_SN_Rules <> "") and (allrulesprocessed)) then
(thisDocumentCommunication) := CALL std_write_obs_MLM with (thisDocumentCommunication,Generic_SN_Parameter.Name,"","","Replace");
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,670 @@
maintenance:
title: Influenza Logic;;
mlmname: DOC_FUNC_DiabetesRisk;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Teresa Spicuzza;;
specialist: ;;
date: 2010-09-01;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
11.23.2010 TS Created - (copy of Doc_FuncPneumovax functionality) MLM checks health issues for diabetes
and checks to see if patient has a HGA1C in the past 3 months if not order placed via mlm.
10.11.2012 JML CSR 30961 - added code to automatically check an HIS defined "unhide" button that displays
additional questions regarding diabetes risk
06.05.2013 JML CSR 30961 - removed coded section that "un-selects" the "SCHCK_Diabetes retrieve info SCM"
observation after user selects it; not allowing the obs to remain selected
was causing an issue with making that obs mandatory for RNs
09.10.2015 DW CSR# 23359 - ICD10
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Receive arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
todays_date := now;
// Chart Observation Section
IF thisdocumentCommunication.EventType = "ChartObservation" then
// Determine if the Retrieve Info From SCM button has been selected
// (if so, set SCM flag to yes and reset the button or set the SCM flag to no)
theParameterx := first of (thisparameters where thisparameters.Name = "SCHCK_Diabetes retrieve info SCM");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameterx.ParameterGUID);
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameterx.ParameterGUID then
//CSR 30961 retrieve Info from scm button checked, automatically check the {{{SINGLE-QUOTE}}}unhide{{{SINGLE-QUOTE}}} button
unhide_parametername := first of (thisParameters WHERE thisParameters.Name = "SCHCK_Diabetes Unhide");
new_currentObj := NEW ObservationType;
new_currentObj.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
new_currentObj.ParameterGUID := unhide_parametername.ParameterGUID;
new_currentObj.DataType := "ListValue";
new_currentObj.ValueObj := NEW ListValueType;
new_currentObj.ValueObj.ListGUID := unhide_parametername.ConfigurationObj.ListGUID;
new_listItems := ();
for item IN unhide_parametername.ConfigurationObj.ListItemsList do
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := true;
new_listItems := (new_listItems, selectedItem);
enddo;
new_currentObj.ValueObj.ListItemsList := new_listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, new_currentObj);
//End CSR code change
SCMButton := "yes";
else SCMButton := "no";
endif;
// Determine if the "HgA1C Order - Yes" button has been selected
// (if so, set the SCMButton flag to neither and the "Place Order - Yes" button to yes)
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Diabetes HgA1C order");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if thisDocumentCommunication.CurrentObservationObj.parameterguid = theParameter.ParameterGUID then SCMButton := "neither"; endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
then PlaceOrderYesButton := "yes"; endif;
If SCMButton = "neither" and PlaceOrderYesButton = "yes" then
// The following code is done only if the Place Order YES button was selected
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n You cannot place an order on this patient. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Diabetes HgA1C order");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "yes" then selectedItem.IsSelected := false; endif;
if selectedItem.Value = "no" then selectedItem.IsSelected := true; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
// The following code is done only if a the Retrieve from SCM button was selected
// (get data from SCM and populate fields)
If SCMButton = "yes" then
// Diabetes health issues
/*
"select distinct hid.shortname chi.code chi.typecode hid.typecode "
||"from cv3healthissuedeclaration hid with (nolock) "
||"join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
where clientvisitguid = {{{SINGLE-QUOTE}}}9000002831200270{{{SINGLE-QUOTE}}} and chi.typecode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}}"
|| "where clientguid = " || ClientGuid || " and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| "and chi.typecode = {{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}} ( "
*/
/* Replaced with ICD10 project
(diabeteshealthissue) := read
{
"select distinct hid.shortname, chi.code, chi.typecode, hid.typecode "
||"from cv3healthissuedeclaration hid with (nolock) "
||"join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
|| "where hid.clientguid = " || ClientGuid || " and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| "and chi.typecode in ({{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt-Stated Hx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}AMB Med History{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Skin Tests{{{SINGLE-QUOTE}}}) "
|| "and (hid.text like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hid.shortname like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} )"|| " and chi.code not in ({{{SINGLE-QUOTE}}}250.50{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.5{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}352.3{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}354{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}362.29{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}588.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.01{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.03{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.04{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}648.80{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.81{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.82{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.83{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.84{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}648.90{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}775.00{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}775.10{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V12.2{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V18.0{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V19.8{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V49.89{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}V77.1{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}V84.89{{{SINGLE-QUOTE}}})"
|| " and (hid.description not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}} or hid.shortname not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}}) "
};
*/
ProblemList := "({{{SINGLE-QUOTE}}}250.50{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}253.5{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}352.3{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}354{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}362.29{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}588.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.01{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.03{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.04{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.80{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.81{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.82{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.83{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.84{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}648.90{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}775.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}775.10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V12.2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V18.0{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V19.8{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V49.89{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V77.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V84.89{{{SINGLE-QUOTE}}})";
(diabeteshealthissue) := read
{
"select distinct hid.shortname, chi.code, chi.typecode, hid.typecode "
||"from cv3healthissuedeclaration hid with (nolock) "
||"join cv3codedhealthissue chi on chi.Guid = hid.codedhealthissueguid "
|| "where hid.clientguid = " || ClientGuid || " and hid.active = 1 and hid.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|| "and chi.typecode in ({{{SINGLE-QUOTE}}}ICD9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}ICD10{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt-Stated Hx{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pt Stated HX{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}AMB Med History{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Chronic{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Vaccine History{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Skin Tests{{{SINGLE-QUOTE}}}) "
|| "and (hid.text like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} or hid.shortname like {{{SINGLE-QUOTE}}}%Diabetes%{{{SINGLE-QUOTE}}} )"
|| "and "
|| "( "
|| "(hid.ICD9Code is null and chi.code not in " || ProblemList || " ) "
|| "or "
|| "(hid.ICD9Code is not null and hid.ICD9Code not in " || ProblemList || " ) "
|| ") "
|| " and (hid.description not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}} or hid.shortname not like {{{SINGLE-QUOTE}}}Diabetes, Gestational%{{{SINGLE-QUOTE}}}) "
};
diabeteshealthissue_found := count(diabeteshealthissue) As Number;
// A1C Test performed
(testperformed) := read last{
"select significantdtm "
|| "from cv3order with (nolock) "
|| "where clientguid = " || ClientGuid || " and name = {{{SINGLE-QUOTE}}}Hemoglobin A1C{{{SINGLE-QUOTE}}} and active = 1 and orderstatuscode = {{{SINGLE-QUOTE}}}RESF{{{SINGLE-QUOTE}}} "
|| "order by significantdtm"
};
testperformed_found := count(testperformed) As Number ;
testnote := "";
//if (testperformed as time)is within the past 3 months then within3months := "Has been "; else within3months := "Has not been "; endif;
if (testperformed as time)is within the past 3 months then within3months := "Has been ";
testnote := "Patient has been tested in the past 3 months: " || testperformed;
else within3months := "Has not been ";
testnote:= "Patient has not been tested in the past 3 months. ";
endif;
// Populate Fields and Boxes
// Select Health Issue radio button (or Health Issue unknown)
healthissue := " ";
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Diabetes HI- unknown");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if diabeteshealthissue_found = 0 then selectedItem.IsSelected := true; healthissue := "Is unknown if "; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
If healthissue <> "Is unknown if " then
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Diabetes HI- y/n");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "yes" and diabeteshealthissue_found > 0 then selectedItem.IsSelected := true; healthissue := "Has a "; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
// Select A1c done in past 3 months radio button (or test done unknown)
labtests := " ";
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Diabetes HgA1C- unknown");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if within3months = "Has not been " then selectedItem.IsSelected := true; labtests := "Is unknown if "; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
If within3months = "Has been " then
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Diabetes HgA1C- y/n");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "yes" then selectedItem.IsSelected := true; labtests := "Is "; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
// new for check lab as no
If within3months = "Has not been " then
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Diabetes HgA1C- y/n");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "no" then selectedItem.IsSelected := true; labtests := "Is not "; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
// Prepare the data for the Diabetes Health Issue and A1C performed boxes
holdHI:="";
if diabeteshealthissue_found > 0 then
for k in (1 seqto (diabeteshealthissue_found)) do
if diabeteshealthissue[k] is not null then
holdHI := holdHI || diabeteshealthissue[k] ;
if k <> diabeteshealthissue_found then // not the last in the list
holdHI := holdHI || ", ";
endif;
endif;
enddo;
endif;
if holdHI = "" then formattedTextHI := " Nothing found. Does the patient have diabetes? ";
else formattedtextHi := holdHI;
endif;
holdHI:="";
if testperformed_found > 0 then
for k in (1 seqto (testperformed_found )) do
if testperformed[k] is not null then
holdHI := holdHI || testperformed[k] ;
if k <> testperformed_found then // not the last in the list
holdHI := holdHI || ", ";
endif;
endif;
enddo;
endif;
if holdHI = "" then formattedTextTest := " Nothing found. Has the patient had a HgA1C performed? ";
else formattedTextTest := testnote;
endif;
// Populate the Health Issue text box
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Diabetes HI-FT");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := formattedTextHI;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the A1c performed text box
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Diabetes Hga1c- FT");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := formattedTextTest;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// The following code is performed only if a button other than the Retrieve from SCM button was selected
//
// Since it appears that the checking of buttons does not occur until the end,
// this section it to be done only when not SCM button
//
elseIf SCMButton = "no" then
// Determine which of the Health Issue buttons is selected
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Diabetes HI- y/n");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
then healthissue := "Does not have "; endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
then healthissue := "Has a "; endif;
if false in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
and
false in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
then
healthissue := "Is unknown if "; endif;
// Determine which of the A1C Perfomred buttons is selected
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Diabetes HgA1C- y/n");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
then labtests := "Is not "; endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
then labtests := "Is "; endif;
if false in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
and
false in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
then
labtests := "Is unknown if "; endif;
endif; // If not the SCM button
if SCMButton = "yes" or SCMButton = "no" then
// The following code is done regardless of whether the Retrieve from SCM button or other button was selected
// (this excludes the place order yes button)
// Determine if test was performed within the past 3 months
//testnote:= "";
if (testperformed as time)is within the past 3 months then within3months := "Has been ";
testnote := "Patient has been tested in the past 3 months: " || testperformed;
else within3months := "Has not been ";
testnote:= "Patient has not been tested in the past 3 months. ";
endif;
// Assess the risk
/*
// This secton as well as the FormattedText1 := below are for diagnostic purposes only
Factor1 := scmbutton || ": value of scmbutton. ";
Factor2 := diabeteshealthissue || ": diabetes health issue. ";
Factor3 := diabeteshealthissue_found || ": dhi found. ";
Factor4 := labtests || ": labtests. ";
Factor5 := healthissue || ": healthissue. ";
Factor6 := within3months || ": Within3months. ";
Factor7 := testperformed_found || ": tp found. ";
Factor8 := formattedtextHi || ": value of formattedtextHI. " ;
Factor9 := formattedtexttest|| ": value of formattedtexttest. " ;
formattedTextReason := " Risk was not determined. ";
orderlab := "no";
formattedText1 := Factor1 ||"\n " || Factor4 || "\n " || Factor5 || "\n " || Factor6 ;
// Populate (HIS only) Diagnostic box
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Pneumo FT info");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := formattedText1;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
*/
//Scenarios that will cause an order to be placed
If healthissue = "Has a " and (within3months = "Has not been " and labtests = "Is not ") then orderlab := "yes";
formattedTextReason := "Order is to be placed since patient is a diabetic and has not been tested in the past 3 months." ; endif;
If healthissue = "Has a " and (within3months = "Has been " or labtests = "Is ") then orderlab := "no";
formattedTextReason := "Order is not to be placed since patient is a diabetic but has been tested in the past 3 months." ; endif;
If healthissue <> "Has a " then orderlab := "no";
formattedTextReason := "Order is not to be placed since patient is not diabetic." ; endif;
If healthissue = "Is unknown if " then orderlab := "no";
formattedTextReason := " Risk was not determined. " ; endif;
// Populate the Risk Details box /*
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Diabetes Risk Assess Details");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := formattedTextReason;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Select Order A1C radio button
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_Diabetes HgA1C order");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "yes" and orderlab = "yes" then selectedItem.IsSelected := true; endif;
if selectedItem.Value = "no" and orderlab = "no" then selectedItem.IsSelected := true; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif; // end of section for assessing risk
// Display error message when Health Issue or A1C performed is unknown
If healthissue = "Is unknown if " and labtests = "Is unknown if " then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n\n There are no Health Issues in SCM indicating that the patient has diabetes or has had an HgA1C in the past 3 months."
|| "\n\n Please address these questions with the patient and select the appropriate button for each of these. \n\n "
,"Un-addressed information to be resolved ","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
If healthissue <> "Is unknown if " and labtests = "Is unknown if " then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n\n There are no indications in SCM that the patient has had an HgA1C in the past 3 months"
|| "\n\n Please address this question with the patient and select the appropriate button. \n\n"
,"Un-addressed information to be resolved ","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
If healthissue = "Is unknown if " and labtests <> "Is unknown if " then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"\n\n There are no Health Issues in SCM indicating that the patient has diabetes"
|| "\n\n Please address this question with the patient and select the appropriate button. \n\n"
,"Un-addressed information to be resolved ","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
endif; // Observation Event
// Document Closing Event
IF thisdocumentCommunication.EventType = "DocumentClosing" then
// Determine if an order is to be placed
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Diabetes HgA1C order");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
then placeorder := "no"; endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
then placeorder := "yes"; endif;
// Order present
(orderpresent) := read
{
" select o.name "
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || VisitGuid || " "
|| " and (o.name = {{{SINGLE-QUOTE}}}Hemoglobin A1C{{{SINGLE-QUOTE}}}) "
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}) "
};
orderpresent_found := count(orderpresent) As Number;
If placeorder = "yes" and orderpresent_found = 0 then
SessionType := "Standard";
SessionReason := "";
RequestingSource := "";
user_IDType := "Edstan Number (physician)";
order_Creation_Reason := "From Test MLM";
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((thisdocumentCommunication.ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
user_IDCode := read last {"SELECT IDCode FROM CV3User " || " where GUID = " || thisdocumentCommunication.UserGUID};
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || thisdocumentCommunication.ClientGUID};
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
// Create a new MEDICATION order from a Pre-Filled item ***
try
Catalog_Item_Name := "Hemoglobin A1C";
Catalog_Item_Modifier := "Per Risk Assessment";
Catalog_Item_Version := "";
Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
Parent_DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
// PreFilled_MedicationOrder_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
with
client_visit_obj, // ClientVisit ObjectsPlus object
// Medication_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
Catalog_Item_Modifier, // string ItemNameModifier
Catalog_Item_Version, // string ItemNameModifierVersion
order_Creation_Reason, // string CreateReason
RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
RequestingSource, // string RequestedBySource (must be in dictionary)
SessionType, // string SessionType
SessionReason, // string SessionReason
location_obj, // Location ReleaseLocGrpID
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
if ( Laboratory_catalog_item is NOT NULL ) then
void := call Parent_DiagnosticOrder_obj.Save;
void := call Parent_DiagnosticOrder_obj.Dispose;
void:= call Laboratory_catalog_item.Dispose;
Laboratory_catalog_item:= null;
endif;
// Parent_DiagnositicOrder_dest.ObjectsPlus := Parent_DiagnositicOrder_obj;
endtry;
catch Exception ex error_occurred := true; error_message := "{{+R}}New Parent Diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
if ( Laboratory_catalog_item is NOT NULL ) then void:= call Laboratory_catalog_item.Dispose; Laboratory_catalog_item:= null; endif;
if ( Parent_DiagnosticOrder_obj is NOT NULL ) then void:= call Parent_DiagnosticOrder_obj.Dispose; Parent_DiagnosticOrder_obj:= null; endif;
Parent_DiagnosticOrder_dest := null;
endcatch;
endif; // End of Place Order = Yes section
endif; // End of Close Document
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,133 @@
maintenance:
title: Doc_Func_Diabetes_Assessmt_Outpatient ;;
filename: Doc_Func_Diabetes_Assessmt_Outpatient;;
arden: version 2;;
version: 1.00;;
institution: Allscripts Corp;;
author: Shivprasad Jadhav ;;
specialist: Maya/Shubha ;;
date: 2012-05-11;;
validation: testing;;
library:
purpose: This MLM will populate the Value in {{{SINGLE-QUOTE}}}Vial and Syring method{{{SINGLE-QUOTE}}} when user select Yes in Instructed patient action for Insulin in Diabetic Assessment Outpatient SN.
;;
explanation: This MLM will populate the Value in {{{SINGLE-QUOTE}}}Vial and Syring method{{{SINGLE-QUOTE}}} when user select Yes in Instructed patient action for Insulin.
Change history
01.27.2017 SJ Created CSR # 35130- Created under 16.3 transformation of Aware Note to St. Note.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Reset the launch button
theParameterx := first of (thisparameters where thisparameters.Name = "SCH_diab Edu Insulin syringe method new");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameterx.ParameterGUID); //"SCH_Diab edu Vial & Syring Method FT"
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Yes")
then Insulin1 := "yes";
else Insulin1 := "no";
endif;
theParameter1 := first of (thisparameters where thisparameters.Name = "SCH_diab Edu Ijecting insulin pen");
theObservation1 := first of (thisobservations where thisobservations.ParameterGUID = theParameter1.ParameterGUID);
if true in (theObservation1.ValueObj.ListItemsList.IsSelected where theObservation1.ValueObj.ListItemsList.Value = "Yes")
then Insulin2 := "yes";
else Insulin2 := "no";
endif;
/* To Format the String value in Free Text Box */
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
Var1 := "Vial and Syringe Method: "
||CRLF|| " Cloudy insulin (NPH or premixed only) should be gently mixed by rolling via between hands. Remove lid from top of insulin vial and wipe rubber top with alcohol. "
||CRLF|| " Remove plastic needle cap. Pull back plunger of the syringe to the number of units. Inject air from syringe into vial and leave needle in vial. "
||CRLF|| " Turn vial upside down holding syringe and needle in place. Pull plunger back to draw correct number of units of insulin into syringe. "
||CRLF|| " Check for bubbles and push air out of syringe back into vial. Adjust plunger to ensure correct number of units of insulin are in syringe proper injection technique."
||CRLF|| " Site rotation. Storage and expiration of insulin. Appropriate disposal of sharps.";
Var2 := "Insulin Pen Method: "
||CRLF|| "Clean tip of pen. Attach the pen needle. Perform safety shot. Dial the correct dose. Proper injection technique. Site rotation. "
||CRLF|| "Storage and expiration appropriate disposal of sharps.";
MLM_DIPA := MLM {{{SINGLE-QUOTE}}}UTIL_OBJECT_Customize_DIPA_MLM{{{SINGLE-QUOTE}}};
prm_Vial := First of (thisParameters where thisParameters.Name = "SCH_Diab edu Vial & Syring Method FT");
/* Setting the Value to actual Observation */
If Insulin1 = "yes" Then
Obs_Edu_Vial := CALL MLM_DIPA WITH this_DocumentCommunication,prm_Vial, Var1 as string ;
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList,Obs_Edu_Vial );
Else
Obs_Edu_Vial := CALL MLM_DIPA WITH this_DocumentCommunication,prm_Vial, "" as string ;
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList,Obs_Edu_Vial );
Endif;
prm_Vial1 := First of (thisParameters where thisParameters.Name = "SCH_Diab edu Insulin Pen Method FT");
If Insulin2 = "yes" Then
Obs_Edu_Vial1 := CALL MLM_DIPA WITH this_DocumentCommunication,prm_Vial1, Var2 as string ;
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList,Obs_Edu_Vial1 );
Else
Obs_Edu_Vial1 := CALL MLM_DIPA WITH this_DocumentCommunication,prm_Vial1, "" as string ;
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (
this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList,Obs_Edu_Vial1 );
Endif;
;;
evoke: // No evoke statement
;;
logic:
conclude true; // always concludes TRUE
;;
action:
return this_documentCommunication;
;;
end:

View File

@@ -0,0 +1,140 @@
maintenance:
title: DOC_FUNC_DIABETES_SERVICE_TIME_CALCULATION;;
mlmname: DOC_FUNC_DIABETES_SERVICE_TIME_CALCULATION;;
arden: version 5.5;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Maya Poojari and Janet Nordin;;
specialist: Don Warnick;;
date: 2011-06-06;;
validation: testing;;
library:
purpose: This MLM will subtract 2 time fields to determine duration.
;;
explanation:
Change history
08.30.2016 DW CSR# 34994 Diabetes Assessment - Created
;;
keywords:
;;
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";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
NumericValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
// Gather the Arrival and Departure Date/Time entered by the user
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_FB_Arrival time");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = this_parametername.ParameterGUID);
arrivaltime := theObservation.ValueObj.Value;
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_FB_Departure Time");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = this_parametername.ParameterGUID);
departuretime := theObservation.ValueObj.Value;
// Subtract the times, parse out the seconds value and convert that value to a number (difference returned as "X months, X seconds"
duration_with_verbiage:= departuretime - arrivaltime;
only_time_length := ((FIND "se" IN STRING (duration_with_verbiage as string))- (FIND "," IN STRING (duration_with_verbiage as string))-1);
duration_seconds := SUBSTRING only_time_length CHARACTERS STARTING AT ((FIND "," IN STRING (duration_with_verbiage as string)) + 1) from (duration_with_verbiage as string);
duration_seconds_number := duration_seconds as number;
// If both time fields are populated and are not equal, determine which service was rendered and determine the number of service units delivered
if arrivaltime is not null and departuretime is not null and duration_seconds_number > 0
then
If duration_seconds_number < 14401
then
theParameter := first of (thisparameters where thisparameters.Name = "SCH_GCDD_ Type of Encounter");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Diabetes Self-Management Education (DSME)")
then
service_increment:= 30;
endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Medical Nutrition Therapy (MNT)")
then
service_increment:= 15;
endif;
duration_minutes := duration_seconds_number /60;
service_units := truncate(duration_minutes /service_increment);
else
duration_minutes := 0;
service_units := 0;
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "The visit time is greater than 4 hours. Please verify the accuracy of the date fields." ,"Error","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
// Update the duration field
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_FB_Total Visit Time_NU");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "NumericValue";
this_currentObj.ValueObj := New NumericValueType;
this_currentObj.ValueObj.Value := duration_minutes;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Update the units of service field
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_FB_Total Unit Time_GN");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "NumericValue";
this_currentObj.ValueObj := New NumericValueType;
this_currentObj.ValueObj.Value := service_units;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,99 @@
maintenance:
title: ;;
mlmname: DOC_FUNC_DISCHARGE_DIAG;;
arden: version 2.5;;
version: 0.00;;
institution: ;;
author: ;;
specialist: ;;
date: 2012-11-05;;
validation: testing;;
library:
purpose: Pull the discharge diagnosis from progress notes using SQL/SP "SCH_PHCO_DCInst_SUB_Discharge_Diag"
This MLM will limit the results to the "ProgressNote" entries excluding the items added to the health issue type Discharge Diag
and will then update the discharge instructions (post hospital care orders) document to show the discharge diag from progress notes
;;
explanation:
4/16/2013 - CSR #: 31547 - Update MLM and stored procedure to pull from the discharge order observation also.
;;
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";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructeredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
IF thisdocumentCommunication.EventType = "DocumentOpening" then
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
clientvisitGuid := thisDocumentCommunication.ClientVisitGUID;
group1 := ();
group2 := ();
healthissues := ();
locationentered := ();
returnhealthissues := ();
If called_by_editor then
clientvisitguid := "0";
endif;
( group1, group2, healthissues, locationentered ) := read { "EXEC SCH_PHCO_DCInst_SUB_Discharge_Diag {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}},"|| sql(clientvisitGuid)};//|| SQL(current_status) };
for x in (1 seqto (count(healthissues))) do
if locationentered[x] = "ProgressNote" or locationentered[x] = "DischargeOrder" then
if (length(returnhealthissues) > 0) then
returnhealthissues := returnhealthissues || ", " || healthissues[x];
else
returnhealthissues := healthissues[x];
endif;
endif;
enddo;
// Create our observation and give it back to the structured note
DischargeDiag := first of (thisParameters where thisParameters.Name = "SCHCK_DI_Diagnosis from PN");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := DischargeDiag.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := returnhealthissues as string;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,112 @@
maintenance:
title: DOC_FUNC_DISCHARGE_SUMMARY ;;
mlmname: DOC_FUNC_DISCHARGE_SUMMARY;;
arden: version 2.5;;
version: 0.00;;
institution: St. Clair Hospital;;
author: Shawn Head x7468;;
specialist: Shawn Head x7468;;
date: 2015-05-01;;
validation: testing;;
library:
purpose: Create a Discharge Summary report request for completed electronic Discharge summaries.
;;
explanation: This MLM will check to see if the Discharge Order Reconciliation is completed BEFORE allowing the patient discharge instructions, CCDA, and Discharge Summary are printed/created.
If Discharged Order Reconciliation is incomplete when the user clicks the "Print and send with patient" observation on the Discharge Instructions structured note they will get a
prompt letting them know you cannot print the discharge instructions until order reconciliation is completed.
History
5-1-2015 - STH CSR#: 32070 (DEV) - Created MLM - Loaded to PROD 6-2-2015
10.26.2015 STH Support case 1917862 - issue with clinic visits requing order rec completion
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//void := CALL Print_DC_Summary with (clientguid,chartguid,visitguid,"Day of Discharge%");
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
(VisitType) := read {"select top 1 typecode from cv3clientvisit with (nolock) "
|| " where clientguid = " || sql(clientGuid)
|| " and chartguid = " || sql(chartGuid)
|| " and guid = " || sql(visitGuid)};
theParameter := first of (thisparameters where thisparameters.Name = "CXD Transition Care Print");
theObservation:= first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
dc_orderrec_GUID := read last {"select guid from CV3OrderReconcile with (nolock) "
|| " where clientguid = " || sql(ClientGuid)
|| " and chartguid = " || sql(ChartGuid)
|| " and ClientVisitGUID = " || sql(VisitGuid)
|| " and reconciletypecode = {{{SINGLE-QUOTE}}}discharge{{{SINGLE-QUOTE}}} "
|| " and ReconcileStatusType = 2 "};
if (((dc_orderrec_guid is null) or (dc_orderrec_guid = "")) and (trim(VisitType[1]) is in ("Inpatient","Observation"))) then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "You cannot print the patient discharge instructions until Discharge Order Reconciliation is complete."
,"Discharge Order Reconciliation Incomplete","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}},"Button1" as {{{SINGLE-QUOTE}}}MessageBoxDefaultButton{{{SINGLE-QUOTE}}};
resulttext := dialogResult as string;
/*--If they decide they want to allow the user to launch order reconciliation from this error message we can use the logic below to match what appears when the document is opened. This includes the prompt to launch order rec.
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Discharge Order Reconciliation is INCOMPLETE. You cannot print the patients Discharge Instructions until the Discharge Order Reconciliation is completed. Do you want to launch Order Reconciliation now?"
,"Discharge Order Reconciliation Incomplete","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}},"Button1" as {{{SINGLE-QUOTE}}}MessageBoxDefaultButton{{{SINGLE-QUOTE}}};
resulttext := dialogResult as string;
if resulttext = "Yes" then
(thisDocumentCommunication) := argument;
OpenMedRec := MLM {{{SINGLE-QUOTE}}}DOC_Call_Med_Rec{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL OpenMedRec WITH thisDocumentCommunication;
endif;
*/
for x in 1 seqto(count(theObservation.ValueObj.ListItemsList.IsSelected)) do
if theObservation.ValueObj.ListItemsList[x].Value = "Print and Send With Patient" then
theObservation.ValueObj.ListItemsList[x].IsSelected := false;
endif;
enddo;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,107 @@
maintenance:
title: DOC_FUNC_ED_BEDSIDE_SWALLOWING_ALERT;;
mlmname: DOC_FUNC_ED_BEDSIDE_SWALLOWING_ALERT;;
arden: version 2.5;;
version: 5.50;;
institution: Allscripts;;
author: Juliet M. Law ;;
specialist: ;;
date: 2013-06-20;;
validation: testing;;
library:
purpose: Alert on failure to indicate bedside swallowing risk on NIH Stroke Scale
;;
explanation: On the ED Adult Assessment/Intervention Flowsheet, if the flowsheet contains a full exam score for
NIH Stroke Scale and the user fails to answer the Bedside Swallowing screen, then display
alert and do not allow save of flowsheet.
;;
keywords: NIH Stroke, alert, flowsheet
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Called MLMs to set up the CDS and return obs values
set_cds_vars := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_DEFINITION_MLM{{{SINGLE-QUOTE}}};
read_obs_value := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_OBS_VALUE_MLM{{{SINGLE-QUOTE}}};
/**************Make Changes To Spelling And Flags In This Section**************/
//Set up variables; initialize
nihStroke_Score_param := "AS SC nih ss total CAL";
bedsideSwallow_Risk_param := "sch_ed_SCHCK_NIH Remain Awake";
msg := "";
mlm_name := "DOC_FUNC_ED_BEDSIDE_SWALLOWING_ALERT";
//Set constants indicating document type and event
FLOWSHEET := "Flowsheet";
CHARTOBSERVATION := "ChartObservation";
DOCUMENTCLOSING := "DocumentClosing";
/******************************************************************************/
//Initialize DocumentCommunication objects
(this_documentCommunication, client_guid, client_visit_guid, chart_guid,
user_guid, document_type, document_name, event_type,
configuration_guid, this_currentObs, CancelEventFlag, this_fs_doc,
authored_by_guid, isIOFlowsheetFlag, client_document_guid, this_parameters,
this_columnList, this_currentColumn, this_chartedObservationsList,
this_parameters_displayName, current_parameter, current_parameter_name, current_parameter_guid,
current_parameter_datatype, selectedItems, selectedItems_Value, current_value,
diagnostic_message, displayMessageFlag) := call set_cds_vars WITH (this_documentCommunication);
//Retrieve DocumentType (StructuredNote or Flowsheet) and EventType
this_DocumentType := this_documentCommunication.DocumentType;
this_EventType := this_documentCommunication.EventType;
/* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
UserCode := read last
{"Select occupationcode "
||" From cv3user "
||" Where Guid = " || SQL(user_guid) };
//Process logic on Flowsheets when document is closing
if (this_DocumentType = FLOWSHEET AND this_EventType = DOCUMENTCLOSING AND UserCode IN ("RN","LPN","CNA","IT")) then
//Retrieve the NIH Stroke Scale Full Exam Score
theParameter := first of (this_parameters WHERE this_parameters.Name = nihStroke_Score_param);
if (exists theParameter) then
(this_documentCommunication, selectedValue, currentValue) := CALL read_obs_value WITH (this_documentCommunication, theParameter.Name, "Read");
if (currentValue > 0) then
//Retrieve bedside swallowing risk parameter
bsParameter := first of (this_parameters WHERE this_parameters.Name = bedsideSwallow_Risk_param);
if (exists bsParameter) then
(this_documentCommunication, selectedValue, currentValue) := CALL read_obs_value WITH (this_documentCommunication, bsParameter.Name, "Read");
if (not exists selectedValue) then
msg := "Please complete the Bedside Swallowing Screen.";
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with msg, "Bedside Swallowing Screen", "Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
endif;
endif;
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,352 @@
maintenance:
title: DOC_FUNC_EPN_ALERTS;;
mlmname: DOC_FUNC_EPN_ALERTS;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Don Warnick;;
specialist: Don Warnick ;;
date: 2010-02-02;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
10.20.2014 DW CSR# 32746 - (Alert for missing VTE order) & 32675 (Altert for incomplete or missing Admission ORM)
10.23.2015 DW CSR# 32874 - Alert the Pulumonary Specialists when an ICU patient has an active Ventilator order, but does not have and active Chest Medical Imaging order.
12.16.2015 DW CSR# 33655 - Previnar
02.09.2016 DW CSR# 33949 - Add Code Status and CPR order review
10.05.2017 JML CSR# 26413 - Modified for Code Status changes based on DOH
11.03.2017 JML CSR# 26413 - Eliminating Outpatients and Discharged patients from receiving code status alert
09.28.2018 DW CSR# 36715 - Created - PDMP in order session
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
using "CustomCodeStatusAlert";
using namespace "CustomCodeStatusAlert";
(OccCode, RoleType) := read last {" select OccupationCode, OrderRoleType from CV3USER with (nolock) where guid = " || sql(userGuid) };
//Get Visit Status
( visitStatus,
visitType) := read last { "SELECT cv.VisitStatus, cv.TypeCode FROM CV3ClientVisit cv WHERE cv.GUID = " || SQL(visitGuid) };
// Code Status Order Section
(CodeStatusOrder,
CodeStatusType) := read {"SELECT ocmi.Name, CASE WHEN ocmi.Name IN ({{{SINGLE-QUOTE}}}Code Status: Comfort Measures Only{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Code Status: Limited Interventions{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Full Treatment{{{SINGLE-QUOTE}}}) THEN {{{SINGLE-QUOTE}}}CODE STATUS{{{SINGLE-QUOTE}}}"
|| " WHEN ocmi.Name = {{{SINGLE-QUOTE}}}Code Status: Ethically unable to determine{{{SINGLE-QUOTE}}} THEN {{{SINGLE-QUOTE}}}CODE STATUS ND{{{SINGLE-QUOTE}}}"
|| " WHEN ocmi.Name IN ({{{SINGLE-QUOTE}}}CPR/Attempt Resuscitation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DNR/Do Not Attempt Resuscitation{{{SINGLE-QUOTE}}}) THEN {{{SINGLE-QUOTE}}}CPR{{{SINGLE-QUOTE}}}"
|| " ELSE {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}"
|| " END"
|| " FROM CV3OrderCatalogMasterItem ocmi with (nolock) JOIN CV3Order o with (nolock)"
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|| " AND o.ClientGUID = " || SQL(ClientGuid)
|| " AND o.ClientVisitGUID = " || SQL(VisitGuid)
|| " AND o.ChartGUID = " || SQL(ChartGuid)
|| " WHERE ( ocmi.Name IN ({{{SINGLE-QUOTE}}}CPR/Attempt Resuscitation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DNR/Do Not Attempt Resuscitation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Comfort Measures Only{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Code Status: Limited Interventions{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Full Treatment{{{SINGLE-QUOTE}}})"
|| " OR ocmi.Name = {{{SINGLE-QUOTE}}}Code Status: Ethically unable to determine{{{SINGLE-QUOTE}}} )"
|| " AND o.OrderStatusLevelNum >= 15 "
|| " AND o.OrderStatusLevelNum not in (69, 70) "};
// DOCUMENT OPEN
if thisdocumentCommunication.EventType = "DocumentOpening" then
// Admission ORM Section
(AdmORMStatus) := read last
{
" select "
|| " (SELECT enumrefvalue FROM SCH_EnumRef_LookUp_FN({{{SINGLE-QUOTE}}}CV3ORDERRECONCILE{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}reconcilestatustype{{{SINGLE-QUOTE}}},reconcilestatustype)) as {{{SINGLE-QUOTE}}}reconcile_status{{{SINGLE-QUOTE}}} "
|| " from CV3ORDERRECONCILE with (nolock) "
|| " where chartguid = " || ChartGuid || " and clientguid = " || ClientGuid || " and clientvisitguid = " || VisitGuid || " and ReconcileTypeCode = {{{SINGLE-QUOTE}}}admission{{{SINGLE-QUOTE}}}"
};
/*
(CPROrder) := read last
{
" select ocmi.Name "
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " and o.chartguid = " || ChartGuid || " and o.clientguid = " || ClientGuid || " and o.clientvisitguid = " || VisitGuid || " "
|| " and o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) "
|| " where (ocmi.name like {{{SINGLE-QUOTE}}}CPR%{{{SINGLE-QUOTE}}} or ocmi.name like {{{SINGLE-QUOTE}}}DNR%{{{SINGLE-QUOTE}}} ) "
};
*/
// Ventilator Order Section
(VentilatorOrder) := read last
{
" select ocmi.Name "
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " and o.chartguid = " || ChartGuid || " and o.clientguid = " || ClientGuid || " and o.clientvisitguid = " || VisitGuid || " "
|| " and o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) "
|| " where ocmi.name = {{{SINGLE-QUOTE}}}ventilator{{{SINGLE-QUOTE}}} "
};
(ChestOrder) := read last
{
" select ocmi.Name "
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " and o.chartguid = " || ChartGuid || " and o.clientguid = " || ClientGuid || " and o.clientvisitguid = " || VisitGuid || " "
|| " and o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) "
|| " and o.RepeatOrder <> 1 "
|| " where ocmi.name = {{{SINGLE-QUOTE}}}Chest Portable{{{SINGLE-QUOTE}}}"
};
CurrentLocation := read last {"Select CurrentLocation FROM CV3ClientVisit with (nolock) where currentlocation like {{{SINGLE-QUOTE}}}icu%{{{SINGLE-QUOTE}}} and ClientGUID = " || thisdocumentCommunication.ClientGUID};
Specialty := read last {"Select Discipline from CV3CareProvider with (nolock) where TypeCode = {{{SINGLE-QUOTE}}}physician{{{SINGLE-QUOTE}}} and discipline like {{{SINGLE-QUOTE}}}%pulmonary%{{{SINGLE-QUOTE}}} and guid = " || thisDocumentCommunication.UserGUID};
// PDMP Search Section
PatientAge := read last
{"
select case when
right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (datepart (MM,getdate()) as varchar),2) + right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (datepart (DD,getdate()) as varchar),2) <
right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (birthmonthnum as varchar),2) + right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (birthdaynum as varchar),2)
then datediff (yy, cast (birthyearnum as varchar) ,getdate()) -1
else datediff (yy, cast (birthyearnum as varchar) ,getdate())
end
from cv3client with (nolock) where guid = " || clientGuid || "
"};
If patientage > 0
then
Opiods_BenzosFound := " ";
SignificantEvent := read last
{"
select c.text
from CV3ClientEventDeclaration c with (nolock)
where c.TypeCode = {{{SINGLE-QUOTE}}}PDMP{{{SINGLE-QUOTE}}} and c.status = {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} and c.text like {{{SINGLE-QUOTE}}}%:%{{{SINGLE-QUOTE}}}
and c.ClientGUID = " || ClientGuid || " and c.clientvisitguid = " || VisitGuid || " and c.chartguid = " || ChartGuid || "
order by c.CreatedWhen
"};
if not exist SignificantEvent
then
(Opiods_Benzos) := read
{ "
select distinct gn.DrugCatalogKey
from SXAAMBDrugName bn with (nolock)
join SXAAMBGenericNameDrugNameXRef dnx with (nolock) on dnx.DrugNameID = bn.DrugNameID
join SXARxGenericName gn with (nolock) on gn.GenericNameID = dnx.GenericNameID
join SXAAMBDrugCategoryXRef xr with (nolock) on gn.GenericNameID = xr.GenericNameID
join SXAAMBDrugCategory dc with (nolock) on xr.DrugCategoryID = dc.DrugCategoryID
where dc.CategoryName in ({{{SINGLE-QUOTE}}}Benzodiazepines{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}narcotic analgesics{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}narcotic analgesic combinations{{{SINGLE-QUOTE}}})
"};
(PatientMedDrugID, PatientMedName, PatientMedOrderInfo ) := read
{ "
SET CONCAT_NULL_YIELDS_NULL off
select dm.DrugKey, ocmi.Name, convert(char(11),o.Entered,101) + convert(char(5),o.Entered,108) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + substring (u.FirstName,1,1) + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + u.lastname + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + u.OccupationCode
from cv3ordercatalogmasteritem ocmi with (nolock)
join cv3order o with (nolock) on o.OrderCatalogMasterItemGUID = ocmi.guid
JOIN CV3DrugMapping dm with (nolock) on dm.CatalogItemGUID = ocmi.GUID
join CV3OrganizationalUnit ou with (nolock) on ou.GUID = ocmi.OrgUnitGUID
left join cv3user u with (nolock) on u.guid = o.userguid
join CV3OrganizationalUnit uou with (nolock) on uou.guid = u.OrgUnitGUID
where
ou.name ={{{SINGLE-QUOTE}}}Pharmacy Department{{{SINGLE-QUOTE}}} and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}) and
u.OrderRoleType <> {{{SINGLE-QUOTE}}}anesthesia physician{{{SINGLE-QUOTE}}} and uou.Description <> {{{SINGLE-QUOTE}}}Emergency Department{{{SINGLE-QUOTE}}} and
o.clientguid = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID = " || visitGuid || "
"};
// Check for Opiod/Benzo Medications
Opiods_BenzosFound:= "";
for x in 1 seqto count (PatientMedDrugID) do
if (PatientMedDrugID[x] is in Opiods_Benzos)
then Opiods_BenzosFound := Opiods_BenzosFound || "\n - PDMP Search Required for - " || PatientMedName [x] || " " || PatientMedOrderInfo [x] ;
endif;
enddo;
endif; // significant event found ?
endif; // patient age > 0 ?
// VTE Order Section
(VTERelatedOrders) := read
{
" select ocmi.Name "
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|| " and o.chartguid = " || ChartGuid || " and o.clientguid = " || ClientGuid || " and o.clientvisitguid = " || VisitGuid || " "
|| " and o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) "
|| " where ( "
|| " ocmi.name = {{{SINGLE-QUOTE}}}VTE Drug Therapy Evaluation{{{SINGLE-QUOTE}}} or "
|| " (ocmi.name like {{{SINGLE-QUOTE}}}%Heparin%{{{SINGLE-QUOTE}}} and o.typecode = {{{SINGLE-QUOTE}}}medication{{{SINGLE-QUOTE}}} and ocmi.name not like {{{SINGLE-QUOTE}}}%flush%{{{SINGLE-QUOTE}}} and ocmi.name not like {{{SINGLE-QUOTE}}}%lock%{{{SINGLE-QUOTE}}}) "
|| " or ocmi.name like {{{SINGLE-QUOTE}}}%Enoxaparin%{{{SINGLE-QUOTE}}} or ocmi.name like {{{SINGLE-QUOTE}}}%Fondaparinux%{{{SINGLE-QUOTE}}} or ocmi.name like {{{SINGLE-QUOTE}}}%Argatroban%{{{SINGLE-QUOTE}}} or ocmi.name like {{{SINGLE-QUOTE}}}%Dabigatran%{{{SINGLE-QUOTE}}} "
|| " or ocmi.name like {{{SINGLE-QUOTE}}}%Apixaban%{{{SINGLE-QUOTE}}} or ocmi.name like {{{SINGLE-QUOTE}}}%Rivaroxaban%{{{SINGLE-QUOTE}}} or ocmi.name like {{{SINGLE-QUOTE}}}%Warfarin%{{{SINGLE-QUOTE}}} "
|| " or (ocmi.name like {{{SINGLE-QUOTE}}}Aspirin%{{{SINGLE-QUOTE}}} and ocmi.name not like {{{SINGLE-QUOTE}}}%dipyridamole%{{{SINGLE-QUOTE}}}) "
|| " ) "
|| " and ocmi.name not like {{{SINGLE-QUOTE}}}zz%{{{SINGLE-QUOTE}}} "
|| " and ocmi.name <> {{{SINGLE-QUOTE}}}No Warfarin{{{SINGLE-QUOTE}}} "
};
VTEEvaluationOrder := "No";
VTEPreventativeOrder := "No";
indexList := 1 seqto count (VTERelatedOrders);
for i in indexList do
obsName := last (first i from VTERelatedOrders);
if obsName = "VTE Drug Therapy Evaluation" then VTEEvaluationOrder := "Yes"; endif; // VTE order was found
if obsName <> "VTE Drug Therapy Evaluation" then
// If it is an Asprin order, a Knee or Hip OS order needs to be on file to qualify
if obsName matches pattern "%Aspirin%" then
(KneeOrHipOrders) := read
{
" select top 1 o.OrderSetName "
|| " from cv3order as o with (nolock) "
|| " where o.chartguid = " || ChartGuid || " and o.clientguid = " || ClientGuid || " and o.clientvisitguid = " || VisitGuid || " "
|| " and o.OrderStatusLevelNum >= 15 and o.OrderStatusLevelNum not in (69, 70) "
|| " and (o.OrderSetName like {{{SINGLE-QUOTE}}}%knee%{{{SINGLE-QUOTE}}} or o.OrderSetName like {{{SINGLE-QUOTE}}}%hip%{{{SINGLE-QUOTE}}}) "
};
If exists KneeOrHipOrders then
VTEPreventativeOrder := "Yes";
endif;
else
VTEPreventativeOrder := "Yes"; // A Non-Aspirin Medication order
endif;
endif;
enddo;
// Message Assesment Section
//formattedTextAll:= " ** Important Reminders (VIEW ONLY) ** ";
//formattedTextAll:= " ";
If AdmORMStatus = "incomplete" then AdmORMStatusMessage := " - Admission ORM Incomplete";
elseif not exists AdmORMStatus then AdmORMStatusMessage := " - Admission ORM NOT Initiated";
else AdmORMStatusMessage := "";
endif;
// If not exists CodeStatusOrder then CodeStatusMessage := "\n\n - Code Status - CPR Review Required"; else CodeStatusMessage := ""; endif;
// If not exists CPROrder then CPRMessage := " CPR Review Required"; else CPRMessage := ""; endif;
If VTEEvaluationOrder = "No" and VTEPreventativeOrder = "No" then VTEStatusMessage := "\n - VTE Review Required";
else VTEStatusMessage := ""; endif;
If exists Specialty and exist VentilatorOrder and not exists ChestOrder and exists CurrentLocation then
VentilatorMessage := "\n - The order for a Chest Portable-Daily has expired.";
else
VentilatorMessage := "";
endif;
// No Messages found message
If AdmORMStatusMessage = "" and VTEStatusMessage = "" and VentilatorMessage = "" then
NoErrorMessage := "\n - There are no messages for the patient.";
// then NoErrorMessage := "\n\n ";
else
NoErrorMessage := "";
endif;
//formattedTextAll:= AdmORMStatusMessage || CodeStatusMessage || VTEStatusMessage || VentilatorMessage || NoErrorMessage;
formattedTextAll:= AdmORMStatusMessage || VTEStatusMessage || VentilatorMessage || NoErrorMessage || Opiods_BenzosFound;
endif; // Document Open
// Write to the Structured Note Text Box
If formattedTextAll is not null then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Reminder");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
;;
evoke:
;;
logic:
if ( NOT ( RoleType matches pattern "%student%" ) ) AND ( NOT ( OccCode matches pattern "%student%" ) ) then
if ( visitStatus = "ADM" AND ( visitType = "Inpatient" OR visitType = "Observation" ) ) then
if thisDocumentCommunication.EventType = "DocumentOpening" OR thisDocumentCommunication.EventType = "DocumentClosing" then
if ( NOT ( exists CodeStatusOrder ) ) then
CodeStatusAlert_OBJ := new net_object {{{SINGLE-QUOTE}}}CustomCodeStatusAlert.CustomCodeStatusAlertForm{{{SINGLE-QUOTE}}} WITH thisDocumentCommunication.EventType;
rtnValue := CALL CodeStatusAlert_OBJ.ShowDialog;
elseif ( "CODE STATUS ND" IN CodeStatusType ) then
CodeStatusAlert_OBJ := new net_object {{{SINGLE-QUOTE}}}CustomCodeStatusAlert.CustomCodeStatusAlertForm{{{SINGLE-QUOTE}}} WITH "CODE STATUS ND", "Code Status: Ethically unable to determine", thisDocumentCommunication.EventType;
rtnValue := CALL CodeStatusAlert_OBJ.ShowDialog;
endif;
endif;
endif;
endif;
conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,198 @@
maintenance:
title: DOC_FUNC_ETHICS_NOTE;;
mlmname: DOC_FUNC_ETHICS_NOTE;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Peggy Karish;;
specialist: Don Warnick ;;
date: 2018-03-19;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
03.19.2018 DW CSR# 36364 - Ethics Note - Created
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType:= OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
launchtheapp:= "no";
// Document Open
if thisdocumentCommunication.EventType = "DocumentOpening"
then
// Vital Signs Section
DocVitalsHL2 := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_VS_24hrs{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocVitalsHL2 WITH thisDocumentCommunication;
// Code Status Section
formattedText:= "";
CodeStatusOrder := read
{"
SET CONCAT_NULL_YIELDS_NULL off
SELECT ocmi.Name + {{{SINGLE-QUOTE}}} - {{{SINGLE-QUOTE}}} + substring (o.summaryline, 3,500)
FROM CV3OrderCatalogMasterItem ocmi with (nolock)
JOIN CV3Order o with (nolock) ON o.OrderCatalogMasterItemGUID = ocmi.GUID AND o.ClientGUID = " || ClientGuid || " AND o.ClientVisitGUID = " || VisitGuid || " AND o.ChartGUID = " || ChartGuid || "
WHERE (
ocmi.Name in ({{{SINGLE-QUOTE}}}CPR/Attempt Resuscitation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DNR/Do Not Attempt Resuscitation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Comfort Measures Only{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Code Status: Limited Interventions{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Full Treatment{{{SINGLE-QUOTE}}})
or
ocmi.Name = {{{SINGLE-QUOTE}}}Code Status: Ethically unable to determine{{{SINGLE-QUOTE}}}
)
AND o.OrderStatusLevelNum >= 15 AND o.OrderStatusLevelNum not in (69, 70)
"};
if exists CodeStatusOrder
then
for i in 1 seqto count CodeStatusOrder do
if i = 1
then formattedText:= formattedText || CodeStatusOrder[i];
else formattedText:= formattedText || "\n\n" || CodeStatusOrder[i];
endif;
enddo;
endif;
// Write to the Structured Note Text Box
If formattedText is not null then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_EthicsCode Status Current");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedText;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
// Chart Observation
ElseIf thisdocumentCommunication.EventType = "ChartObservation" // and selectedobservationname = "SCH_MDPN_Ethics ConsultReq Launch"
then
launchtheapp:= "yes";
using "AddCareProvidertoSN";
test:= new net_object {{{SINGLE-QUOTE}}}AddProviderToNote.AddProviderToNoteForm{{{SINGLE-QUOTE}}};
// Reset the launch button
theParameterx := first of (thisparameters where thisparameters.Name = "SCH_MDPN_Ethics ConsultReq Launch");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameterx.ParameterGUID);
if thisdocumentCommunication.CurrentObservationObj.parameterguid = theParameterx.ParameterGUID then
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Ethics ConsultReq Launch");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := false;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
endif;
;;
evoke:
;;
logic:
if launchtheapp = "yes"
then
oeUnsigned:=CALL test.ShowDialog;
return_string:= test.text;
endif;
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Ethics ConsultRequestor");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := return_string;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,135 @@
maintenance:
title: DOC_FUNC_FACE_TO_FACE_NOTE;;
mlmname: DOC_FUNC_FACE_TO_FACE_NOTE;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Shubha Rai ;;
specialist: Don Warnick;;
date: 2016-09-29;;
validation: testing;;
library:
purpose: Retrieve data from the RT Ambulation SN fields into a textbox on the Face to Face SN
;;
explanation:
Change history
09.29.2016 DW CSR# 34813 - Created
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// DOCUMENT OPEN SECTION
if thisdocumentCommunication.EventType = "DocumentOpening"
then
(FTFValue,FTFHeader,FTFHeaderGuid) := read
{"
SET CONCAT_NULL_YIELDS_NULL off
Select
case when ocs.DisplayName is null then o.ValueText + fsl.value else ocmi.LeftJustifiedLabel + {{{SINGLE-QUOTE}}} - {{{SINGLE-QUOTE}}} + o.ValueText + fsl.value end,
case when ocs.DisplayName is null then ocmi.LeftJustifiedLabel else ocs.DisplayName end,
case when ocs.DisplayName is null then 0 else ocs.guid end
from CV3ClientDocumentCUR cd with (nolock)
join CV3ClientDocDetailCUR cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1)
join CV3ObservationDocumentCUR od with (nolock) ON cdd.CLientDocumentGUID = od.OwnerGUID
join CV3ObservationCUR o with (nolock) ON o.GUID = od.ObservationGUID
join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID
left join SCMObsFSListValues fsl with (nolock) ON fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || ClientGuid || "
left join CV3ObsCatalogSet ocs with (nolock) on ocs.GUID = od.ObsSetGUID
where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || "
and cd.iscanceled = 0
and cd.DocumentName like {{{SINGLE-QUOTE}}}RT Ambulation Assessment{{{SINGLE-QUOTE}}}
and ocmi.name like {{{SINGLE-QUOTE}}}sch_rt%{{{SINGLE-QUOTE}}}
order by od.DisplaySequence "
};
FTFInformation := " ";
FTFCurrentHeaderGuid := "999";
indexList := 1 seqto count (FTFValue);
for i in indexList do
if FTFHeaderGuid[i] <> FTFCurrentHeaderGuid
then
if FTFCurrentHeaderGuid = "999"
then
FTFInformation := "\b " || FTFHeader[i] || "\b0" ;
else
FTFInformation := FTFInformation || "\n\n" || "\b " || FTFHeader[i] || "\b0" ;
endif;
endif;
FTFInformation := FTFInformation || "\n" || FTFValue[i];
FTFCurrentHeaderGuid := FTFHeaderGuid[i];
enddo;
// Write to the Structured Note Text Box
If FTFInformation <> " "
then
writefield := first of (thisParameters where thisParameters.Name = "SCH_FTF_ RT ambulation FT");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := writefield.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := FTFInformation;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
endif; // Document Open
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,344 @@
maintenance:
title: DOC_FUNC_FALL_HARM_RISK;;
mlmname: DOC_FUNC_FALL_HARM_RISK;;
arden: version 2.5;;
version: 5.50;;
institution: Allscripts;;
author: Juliet M. Law ;;
specialist: ;;
date: 2013-12-13;;
validation: testing;;
library:
purpose: Automatically check observations under the Fall Harm Risk section on the
Adult Assessment / Intervention Flowsheet..
;;
explanation: On the Adult Assessment/Intervention Flowsheet, automatically check several observations
based on patient having a "History of Fall in Past 6 months" significant event.
Change History
12.13.2013 JML Created
03.17.2014 JML Modified MLM to optimize SQL queries to handle SCM flowsheet freezing issue;
saving observation values for UDDIs with textbox type in values.
11.19.2015 JML WO #1947083: Modified MLM to not include completed anticoagulant orders
when determining auto-checking of "therapeutic anticoag..." observation.
11.07.2018 JML CSR 37204: Removed code for observations that were inactivated on the flowsheet under
the Fall / Harm Risk Assessment category.
;;
keywords: fall, risk, flowsheet
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Include ObjectsPlus Assemblies
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
(thisDocumentCommunication) := argument;
/**************Make Changes To Spelling And Flags In This Section**************/
//Set up variables; initialize
fire_on_param := "SCHCK_INV Universal INV";
//Document Type
FLOWSHEET := "FlowSheet";
//Event Types
CHARTOBSERVATION := "ChartObservation";
DOCUMENTCLOSING := "DocumentClosing";
/******************************************************************************/
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid, ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
//Set Flowsheet DocumentCommunication object model variables via Called MLM
(this_fs_doc) := thisDocumentCommunication.DocumentConfigurationObj;
(this_parameters) := this_fs_doc.ParametersList;
(this_currentObs) := thisDocumentCommunication.CurrentObservationObj;
(this_cols) := this_fs_doc.ColumnsList;
(this_curr_col) := this_fs_doc.CurrentColumn;
(this_chartedObs) := this_curr_col.ChartedObservationsList;
document_type := thisDocumentCommunication.DocumentType;
event_type := thisDocumentCommunication.EventType;
client_guid := thisDocumentCommunication.ClientGUID;
visit_guid := thisDocumentCommunication.ClientVisitGUID;
chart_guid := thisDocumentCommunication.ChartGUID;
anticoag_exists := false;
check_fall_history := read last {"SELECT 1"
|| " FROM CV3ClientEventDeclaration ced WITH (NOLOCK)"
|| " WHERE ced.ClientGUID = " || Sql(client_guid)
|| " AND ced.Active = 1"
|| " AND ced.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
|| " AND ced.TypeCode IN ({{{SINGLE-QUOTE}}}Fall{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Fall History{{{SINGLE-QUOTE}}})"
|| " AND DATEDIFF(MONTH, ced.CreatedWhen, GetDate()) <= 6"};
patientAge := read last {"SELECT CASE"
|| " WHEN ((c.BirthMonthNum > MONTH(getdate())) "
|| " OR (c.BirthMonthNum = MONTH(getdate()) and c.BirthDayNum > DAY(getdate()))) then"
|| " Convert(char(3),(YEAR(getdate()) - c.BirthYearNum) - 1)"
|| " ELSE"
|| " Convert(char(3),(YEAR(GETDATE()) - c.BirthYearNum))"
|| " END"
|| " FROM CV3Client c WITH (NOLOCK) "
|| " WHERE c.GUID = " || Sql(client_guid)};
patientBMI := read last {"Select TOP 1 o.ValueText"
|| " from CV3ClientDocumentCUR cd WITH (NOLOCK) join CV3ClientDocDetailCUR cdd WITH (NOLOCK) "
|| " on cdd.ClientDocumentGUID = cd.GUID"
|| " join CV3ObservationDocumentCUR od WITH (NOLOCK) "
|| " on cdd.CLientDocumentGUID = od.OwnerGUID "
|| " join CV3ObsCatalogMasterItem ocmi WITH (NOLOCK) "
|| " on od.ObsMasterItemGUID = ocmi.GUID "
|| " join CV3ObservationCUR o WITH (NOLOCK) "
|| " on o.GUID = od.ObservationGUID "
|| " join cv3obscatalogitem oci WITH (NOLOCK) "
|| " on oci.guid = o.obsitemguid "
|| "where cd.clientguid = " || Sql(client_guid)
|| " and cd.ClientVisitGUID = " || Sql(visit_guid)
|| " and cd.chartguid = " || Sql(chart_guid)
|| " and o.ValueText is not null "
|| " and od.active = 1"
|| " and oci.name = {{{SINGLE-QUOTE}}}SCH_vs_BMI{{{SINGLE-QUOTE}}}"
|| "order by cd.authoreddtm desc "};
check_platelet_count := read last {"SELECT TOP 1 bo.Value"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.ClientGUID = o.ClientGUID"
|| " AND cv.GUID = o.ClientVisitGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " JOIN CV3BasicObservation bo WITH (NOLOCK)"
|| " ON o.GUID = bo.OrderGUID"
|| " AND o.ClientGUID = bo.ClientGUID"
|| " AND o.ClientVisitGUID = bo.ClientVisitGUID"
|| " WHERE bo.ClientGUID = " || Sql(client_guid)
|| " AND bo.ClientVisitGUID = " || Sql(visit_guid)
|| " AND bo.ChartGUID = " || Sql(chart_guid)
|| " AND bo.ItemName IN ({{{SINGLE-QUOTE}}}Platelet Count{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Platelet Count.{{{SINGLE-QUOTE}}})"
|| " AND ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|| " ORDER BY bo.CreatedWhen DESC"};
(check_anticoag_order,
anticoag_order_dose) := read last {"SELECT TOP 1 o.Name, ot.OrderDosageLow"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.GUID = o.ClientVisitGUID"
|| " AND cv.ClientGUID = o.ClientGUID"
|| " JOIN CV3OrderTask ot WITH (NOLOCK)"
|| " ON o.GUID = ot.OrderGUID"
|| " AND o.ClientGUID = ot.ClientGUID"
|| " AND o.ChartGUID = ot.ChartGUID"
|| " JOIN CV3OrderTaskOccurrence oto WITH (NOLOCK)"
|| " ON ot.GUID = oto.OrderTaskGUID"
|| " AND ot.ClientGUID = oto.ClientGUID"
|| " WHERE o.ClientGUID = " || Sql(client_guid)
|| " AND o.ClientVisitGUID = " || Sql(visit_guid)
|| " AND o.ChartGUID = " || Sql(chart_guid)
|| " AND o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}"
|| " AND o.Active = 1"
|| " AND"
|| " ( o.Name LIKE {{{SINGLE-QUOTE}}}%Enoxaparin%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}%Heparin%25,000%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}%Heparin%Infusion%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}%Heparin%Prisma%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}%Warfarin%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE{{{SINGLE-QUOTE}}}%Dabigatran%{{{SINGLE-QUOTE}}} "
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}%Rivaroxaban%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}%Fondaparinux%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}%Argatroban%{{{SINGLE-QUOTE}}}"
|| " OR o.Name LIKE {{{SINGLE-QUOTE}}}%Apixaban%{{{SINGLE-QUOTE}}} )"
|| " AND ((o.OrderStatusLevelNum > 15"
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|| " ORDER BY o.CreatedWhen DESC"};
if (document_type = FLOWSHEET AND event_type = CHARTOBSERVATION) then
//*************** UNIVERSAL INTERVENTIONS **************************
//Autocheck all values under "Universal Interventions" Observation
univIndParameter := first of (this_parameters WHERE this_parameters.Name = fire_on_param);
if (exists univIndParameter) then
//Define parameter ConfigurationObj to extract Suggested Text value
univIndListConfiguration := univIndParameter.ConfigurationObj;
univIndObs := first of ( this_chartedObs WHERE this_chartedObs.ParameterGUID = univIndParameter.ParameterGUID);
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID := this_fs_doc.ClientDocumentGUID;
this_currentObj.ParameterGUID := univIndParameter.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := NEW ListValueType;
this_currentObj.ValueObj.ListGUID := univIndParameter.ConfigurationObj.ListGUID;
//Determine if ListValue parameter allows for text type in in addition to list values
if ( univIndListConfiguration.AllowsSuggestedText = true ) then
//Determine if user typed something in
if ( exists univIndObs.ValueObj.SuggestedTextValue ) then
//Save it to the ListValueType object (defined above)
this_currentObj.ValueObj.SuggestedTextValue := univIndObs.ValueObj.SuggestedTextValue;
endif;
endif;
listItems := ();
for item IN univIndParameter.ConfigurationObj.ListItemsList Do
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := true;
listItems := (listItems, selectedItem);
enddo;
this_currentObj.ValueObj.ListItemsList := listItems;
this_fs_doc.CurrentColumn.ChartedObservationsList := (this_fs_doc.CurrentColumn.ChartedObservationsList, this_currentObj);
endif;
//*********** HIGH FALL RISK ASSESSMENT **************************
//Query for "Fall History" significant Event
fallRiskParam := first of (this_parameters WHERE this_parameters.Name = "SCHCK_AS High Fall Risk Assm");
if (exists fallRiskParam) then
(fallRiskObs) := first of (this_chartedObs WHERE this_chartedObs.ParameterGUID = fallRiskParam.ParameterGUID);
(fallRiskValues) := (fallRiskObs.ValueObj.ListItemsList.Value WHERE fallRiskObs.ValueObj.ListItemsList.IsSelected = true);
this_currentObj2 := NEW ObservationType;
this_currentObj2.ClientDocumentGUID := this_fs_doc.ClientDocumentGUID;
this_currentObj2.ParameterGUID := fallRiskParam.ParameterGUID;
this_currentObj2.DataType := "ListValue";
this_currentObj2.ValueObj := NEW ListValueType;
this_currentObj2.ValueObj.ListGUID := fallRiskParam.ConfigurationObj.ListGUID;
listItems := ();
for item IN fallRiskParam.ConfigurationObj.ListItemsList do
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if ((selectedItem.Value = "*History of Fall in Past 6 Months") AND (exists check_fall_history)) then
selectedItem.IsSelected := true;
elseif (( selectedItem.Value = "No Indicators Present") AND ( count fallRiskValues > 0 )) then
if ( ( count fallRiskValues = 1 ) AND ( "No Indicators Present" IN fallRiskValues ) ) then
selectedItem.IsSelected := true;
elseif ( ( count fallRiskValues > 1 ) AND ( "No Indicators Present" IN fallRiskValues ) ) then
selectedItem.IsSelected := false;
else
selectedItem.IsSelected := false;
endif;
elseif (selectedItem.Value IN fallRiskValues) then
selectedItem.IsSelected := true;
else
selectedItem.IsSelected := false;
endif;
listItems := (listItems, selectedItem);
enddo;
this_currentObj2.ValueObj.ListItemsList := listItems;
this_fs_doc.CurrentColumn.ChartedObservationsList := (this_fs_doc.CurrentColumn.ChartedObservationsList, this_currentObj2);
endif;
//*********************** HARM RISK ASSESSMENT *********************************
//Determine if obs need auto checked under the Harm Risk Assessment
//Retrieve the HARM Risk Assessment observation
harmRiskAssm := "SCHCK_AS Harm Risk Assm";
harmRiskAssmParam := first of (this_parameters WHERE this_parameters.Name = harmRiskAssm);
if (exists harmRiskAssmParam) then
(harmRiskAssmObs) := first of (this_chartedObs WHERE this_chartedObs.ParameterGUID = harmRiskAssmParam.ParameterGUID);
harmRiskAssmValues := (harmRiskAssmObs.ValueObj.ListItemsList.Value
WHERE harmRiskAssmObs.ValueObj.ListItemsList.IsSelected = true);
this_currentObj4 := NEW ObservationType;
this_currentObj4.ClientDocumentGUID := this_fs_doc.ClientDocumentGUID;
this_currentObj4.ParameterGUID := harmRiskAssmParam.ParameterGUID;
this_currentObj4.DataType := "ListValue";
this_currentObj4.ValueObj := NEW ListValueType;
this_currentObj4.ValueObj.ListGUID := harmRiskAssmParam.ConfigurationObj.ListGUID;
listItems := ();
for item IN harmRiskAssmParam.ConfigurationObj.ListItemsList do
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if ( ( ( patientAge as number ) >= 85 ) AND ( selectedItem.Value = "*Age 85 or Greater" ) ) then
selectedItem.IsSelected := true;
endif;
if ( ( ( patientBMI as number ) < 20 ) AND ( selectedItem.Value = "*BMI Less than 20, Frail" ) ) then
selectedItem.IsSelected := true;
endif;
if ( selectedItem.Value matches pattern "*Therapeutic Anticoag%" ) then
if ( exists check_anticoag_order ) then
if ( ( check_anticoag_order matches pattern "Enoxaparin%" ) AND ( ( anticoag_order_dose as number ) > 40 ) ) then
anticoag_exists := true;
selectedItem.IsSelected := true;
elseif ( ( check_anticoag_order matches pattern "Rivaroxaban%" ) AND ( ( anticoag_order_dose as number ) > 10 ) ) then
anticoag_exists := true;
selectedItem.IsSelected := true;
elseif ( ( NOT check_anticoag_order matches pattern "Enoxaparin%" ) AND ( NOT check_anticoag_order matches pattern "Rivaroxaban%" ) ) then
anticoag_exists := true;
selectedItem.IsSelected := true;
endif;
elseif ( ( exists check_platelet_count ) AND ( ( check_platelet_count as number ) <= 50 ) ) then
selectedItem.IsSelected := true;
endif;
endif;
if ( ( selectedItem.Value = "No Indicators Present" ) AND ( count harmRiskAssmValues > 0 ) ) then
if ( ( count harmRiskAssmValues = 1 ) AND ( "No Indicators Present" IN harmRiskAssmValues ) ) then
selectedItem.IsSelected := true;
elseif ( ( count harmRiskAssmValues > 1 ) AND ( "No Indicators Present" IN harmRiskAssmValues ) ) then
selectedItem.IsSelected := false;
endif;
elseif ( selectedItem.Value IN harmRiskAssmValues ) then
selectedItem.IsSelected := true;
endif;
listItems := (listItems, selectedItem);
enddo;
this_currentObj4.ValueObj.ListItemsList := listItems;
this_fs_doc.CurrentColumn.ChartedObservationsList := (this_fs_doc.CurrentColumn.ChartedObservationsList, this_currentObj4);
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action:
return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,219 @@
maintenance:
title: DOC_FUNC_FBC_BILIMETER_SCREEN;;
mlmname: DOC_FUNC_FBC_BILIMETER_SCREEN;;
arden: version 5.0;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Juliet M. Law, Allscripts, Inc. x7461 ;;
specialist: Dean Miklavic, Allscripts, Inc. x7466 ;;
date: 2012-11-02;;
validation: testing;;
library:
purpose: This MLM attaches to the Transcutaneous Bilimeter Screening document (SCH_FBC_Bilimeter Screen).
Retrieve gestational age from Newborn Patient Profile; calculate age in hours based on Bilimeter Screening date.
;;
explanation: This MLM will check if the Newborn Patient Profile document exists. If the document does not exist, the user
will receive an alert on document open that the gestational age could not be retrieved. The document will not allow
saving as a completed document.
If the document does exist, the gestational age will be retrieved and populated into the observation.
After the user enters the Bilimeter Screening date time, the age in hours will be calculated and populate
the observation.
Change history
11.02.2012 - JML Created
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Receive arguments from the structured note
(this_documentCommunication) := argument;
//.Net Libraries
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
// Called MLM declaration section
set_cds_vars := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
read_obs_value := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_OBS_VALUE_MLM{{{SINGLE-QUOTE}}};
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
/*********************************BEGIN EDIT SECTION*****************************************************/
//Define Document Type Constants
FLOWSHEET := "Flowsheet";
STRUCTUREDNOTE := "StructuredNote";
//Define Event Type Constants
DOCUMENTOPENING := "DocumentOpening";
DOCUMENTCLOSING := "DocumentClosing";
CHARTOBSERVATION := "ChartObservation";
// Setting the cancelProcessing to true will cause the charted observation not to be saved
cancelProcessing := false;
// Setting the debugFlag to true will cause popup dialogs containing debug information to display
debugFlag := false;
//Variable Declaration
displayAlert := false;
/*********************************END EDIT SECTION*****************************************************/
//Set CDS DocumentCommunication object model variables via Called MLM
(this_documentCommunication, client_guid, client_visit_guid, client_chart_guid,
user_guid, document_type, document_name, event_type,
configuration_guid, this_currentObj, CancelEventFlag, this_structuredNoteDoc,
authored_date_time, authored_by_guid, client_document_guid, document_date_time,
isNewFlag, isIncompleteFlag, isResultsPendingFlag, isPriorityFlag,
this_parameters, this_chartedObservationsList, this_parameters_display_name, current_parameter,
current_parameter_name, current_parameter_guid, current_parameter_DataType, selectedItems,
selectedItems_value, current_value, diagnosticMessage, displayMessageFlag,
CoSigner1, CoSigner2, DocumentTopic) := CALL set_cds_vars WITH (this_documentCommunication);
// Set up debugging information to be captured
messageText := "";
if (debugFlag = true) then
messageText := "Debug Information: \n\n";
messageText := messageText || " DOC_FUNC_FBC_BILIMETER_SCREEN mlm is called\n\n";
endif;
// 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];
//Assign document name and parameter to variable
newbornDocument := "Newborn Patient Profile";
newbornGestAgeParam := "PRO gestational age infant NU";
pediatricDocument := "Pediatric Patient Profile";
pediatricGestAgeParam := "PRO gestational age peds NU";
//Check for existence of Newborn Patient Profile
(newbornDocName, newbornGestAge) := read {"SELECT cd.DocumentName, o.ValueText"
|| " FROM CV3ClientVisit cv JOIN CV3ClientDocumentCUR cd "
|| " on cv.GUID = cd.ClientVisitGUID"
|| " JOIN CV3ClientDocDetailCUR cdd "
|| " on cd.GUID = cdd.ClientDocumentGUID"
|| " JOIN CV3ObservationDocumentCUR od"
|| " on cdd.ClientDocumentGUID = od.OwnerGUID"
|| " JOIN CV3ObsCatalogMasterItem ocmi"
|| " on od.ObsMasterItemGUID = ocmi.GUID"
|| " JOIN CV3ObservationCUR o"
|| " on od.ObservationGUID = o.GUID"
|| " JOIN CV3ObsCatalogItem oci"
|| " on o.ObsItemGUID = oci.GUID"
|| " WHERE ((cd.DocumentName = {{{SINGLE-QUOTE}}}" || newbornDocument || "{{{SINGLE-QUOTE}}}"
|| " AND oci.Name = {{{SINGLE-QUOTE}}}" || newbornGestAgeParam || "{{{SINGLE-QUOTE}}})"
|| " OR "
|| " (cd.DocumentName = {{{SINGLE-QUOTE}}}" || pediatricDocument || "{{{SINGLE-QUOTE}}}"
|| " AND oci.Name = {{{SINGLE-QUOTE}}}" || pediatricGestAgeParam || "{{{SINGLE-QUOTE}}}))"
|| " AND cd.IsCanceled = 0"
|| " AND cdd.Active = 1"
|| " AND od.Active = 1"
|| " AND cv.ClientGUID = " || Sql(client_guid)
|| " AND cv.GUID = " || Sql(client_visit_guid)
|| " AND cv.ChartGUID = " || Sql(client_chart_guid)
|| " ORDER BY cd.AuthoredDtm DESC"};
//On Document Open, retrieve the gestational age from the Newborn Patient Profile; if not available display
//alert to user
if (document_type = STRUCTUREDNOTE AND (event_type = DOCUMENTOPENING OR event_type = DOCUMENTCLOSING)) then
if (not (exists newbornDocName)) then
//Newborn Patient Profile AND Pediatric Patient Profile don{{{SINGLE-QUOTE}}}t exist for this baby; alert user
displayAlert := true;
else
//Document does exist, but gestation age does not; alert user
if (last of (newbornGestAge) IS NULL) then
displayAlert := true;
else
//Document and gestational age exist; populate observation SCH_FBC_Bilimeter_gestational age
bilimeterGestAgeParam := "SCH_FBC_Bilimeter_gestational age";
//set variable to value
bilimeterGestAgeValue := last of (newbornGestAge);
bilimeterGestAge := first of (this_parameters WHERE this_parameters.Name = bilimeterGestAgeParam);
if (exists bilimeterGestAge) then
this_currentObs := NEW ObservationType;
this_currentObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentObs.ParameterGUID := bilimeterGestAge.ParameterGUID;
this_currentObs.DataType := "NumericValue";
this_currentObs.ValueObj := NEW NumericValueType;
this_currentObs.ValueObj.Value := bilimeterGestAgeValue as number;
this_structuredNoteDoc.ChartedObservationsList := (this_structuredNoteDoc.ChartedObservationsList, this_currentObs);
endif;
endif;
endif;
if (displayAlert) then
alertMsg := "Gestational Age has not been documented on the Newborn Patient Profile or the Pediatric Patient Profile."
|| " Please enter this information "
|| "before completing the Transcutaneous Bilimeter Screening.\n\n"
|| "Please NOTE that you will be unable to SAVE this document until a gestational age has been entered "
|| "on the Newborn Patient Profile or the Pediatric Patient Profile. Please cancel this document.";
this_documentCommunication.DisplayMessage := true;
this_documentCommunication.Message := alertMsg;
this_documentCommunication.CancelEvent := true;
endif;
elseif (document_type = STRUCTUREDNOTE AND event_type = CHARTOBSERVATION) then
//If charted observation is the bilimeter screen date time, retrieve value and calculate age in hours
if (current_parameter_name = "SCH_FBC_Bilimeter_Screen Date Time") then
//Retrieve admit date to calculate hours old
admitdttm := read last {"SELECT AdmitDtm "
|| " FROM CV3ClientVisit cv WITH (NOLOCK)"
|| " WHERE cv.GUID = " || SQL(client_visit_Guid)
|| " AND cv.ClientGUID = " || SQL(client_Guid)
|| " AND cv.ChartGUID = " || Sql(client_chart_guid) };
calcHours := (((current_value - admitdttm) / 60 seconds) / 60) formatted with "%.2f";
findDec := FIND "." IN STRING (calcHours as string);
calcHours := SUBSTRING findDec-1 CHARACTERS FROM calcHours;
//Populate observation
HoursAgeParameterName := "SCH_FBC_Bilimeter_Hourly Age";
HoursAgeParameter := first of (this_parameters WHERE this_parameters.Name = HoursAgeParameterName);
if (exists HoursAgeParameter) then
this_currentAgeObs := NEW ObservationType;
this_currentAgeObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentAgeObs.ParameterGUID := HoursAgeParameter.ParameterGUID;
this_currentAgeObs.DataType := "NumericValue";
this_currentAgeObs.ValueObj := NEW NumericValueType;
this_currentAgeObs.ValueObj.Value := calcHours;
this_structuredNoteDoc.ChartedObservationsList := (this_structuredNoteDoc.ChartedObservationsList, this_currentAgeObs);
endif;
endif;
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,154 @@
maintenance:
title: DOC_FUNC_FOCUS_NOTE_ALLERGY_ONSET_DATE_CHECK;;
mlmname: DOC_FUNC_FOCUS_NOTE_ALLERGY_ONSET_DATE_CHECK;;
arden: version 2.5;;
version: 5.50;;
institution: St.Clair Hospital;;
author: Juliet M. Law;;
specialist: Debbie Eiler;;
date: 2012-08-15;;
validation: testing;;
library:
purpose: Hard stop when attempting to save the Focus Note Structured Note with no allergy onset date.
;;
explanation: Stops the nurse from saving the structured note when the drug allergy reaction pull set contains
allergies with no onset date recorded.
change history
08.15.2012 JML CSR# 30881 - Created
11.19.2012 JML Copied to Production
11.29.2012 JML Changed time range for checking new allergies entered; went from 2 hours down to 30 mins.
;;
keywords: ClientDocument; allergy; onset date;
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
//.Net Libraries
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
// Called MLM declaration section
// Utility function to parse strings
str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
set_cds_vars := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
read_obs_value := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_OBS_VALUE_MLM{{{SINGLE-QUOTE}}};
/*******************Make Changes To Spelling And Flags In This Section*******************/
//Document Type
FLOWSHEET := "FlowSheet";
STRUCTUREDNOTE := "StructuredNote";
//Event Types
DOCUMENTOPENING := "DocumentOpening";
CHARTOBSERVATION := "ChartObservation";
DOCUMENTCLOSING := "DocumentClosing";
// Setting the cancelProcessing to true will cause the charted observation not to be saved
cancelProcessing := false;
// Setting the debugFlag to true will cause popup dialogs containing debug information to display
debugFlag := false;
allergyAlertMessage := "";
closeDocument := true;
allergyObsName := "Allergies_Medication_Focus Note";
/******************************************************************************/
//Set Flowsheet DocumentCommunication object model variables via Called MLM
(this_documentCommunication, client_guid, client_visit_guid, client_chart_guid,
user_guid, document_type, document_name, event_type,
configuration_guid, this_currentObj, CancelEventFlag, this_structuredNoteDoc,
authored_date_time, authored_by_guid, client_document_guid, document_date_time,
isNewFlag, isIncompleteFlag, isResultsPendingFlag, isPriorityFlag,
this_parameters, this_chartedObservationsList, this_parameters_display_name, current_parameter,
current_parameter_name, current_parameter_guid, current_parameter_DataType, selectedItems,
selectedItems_value, current_value, diagnosticMessage, displayMessageFlag,
CoSigner1, CoSigner2, DocumentTopic) := CALL set_cds_vars WITH (this_documentCommunication);
// Set up debugging information to be captured
messageText := "";
if (debugFlag = true) then
messageText := "Debug Information: \n\n";
messageText := messageText || " DOC_FUNC_FOCUS_NOTE_ALLERGY_ONSET_DATE_CHECK mlm is called\n\n";
endif;
if (document_type = STRUCTUREDNOTE AND event_type = DOCUMENTCLOSING) then
//Retrieve allergies in Allergy Pull Set on Structured Note
(allergyEntered,
severityEntered,
onsetMonthEntered,
onsetDayEntered,
onsetYearEntered) := read {"SELECT IsNull(a.Code, {{{SINGLE-QUOTE}}}Miscellaneous{{{SINGLE-QUOTE}}}),"
|| " IsNull(SvrtyLevelDisplay, SvrtyLevelCode) AS SvrtyLevel,"
|| " CASE WHEN ad.OnsetMonthNum = 0 THEN Null ELSE ad.OnsetMonthNum END as OnsetMonth,"
|| " CASE WHEN ad.OnsetDayNum = 0 THEN Null ELSE ad.OnsetDayNum END as OnsetDay,"
|| " CASE WHEN ad.OnsetYearNum = 0 THEN Null ELSE ad.OnsetYearNum END as OnsetYear"
|| " FROM CV3AllergyDeclaration ad LEFT JOIN CV3Allergen a ON ad.AllergenGUID = a.GUID"
|| " AND a.Active = 1"
|| " LEFT OUTER JOIN CV3EnumReference enumRef1 ON (enumRef1.TableName = {{{SINGLE-QUOTE}}}CV3AllergyDeclaration{{{SINGLE-QUOTE}}}"
|| " AND enumRef1.ColumnName = {{{SINGLE-QUOTE}}}CategoryType{{{SINGLE-QUOTE}}}"
|| " AND enumRef1.EnumValue = CategoryType)"
|| " LEFT OUTER JOIN CV3EnumReference enumRef2 ON (enumRef2.TableName = {{{SINGLE-QUOTE}}}CV3AllergyDeclaration{{{SINGLE-QUOTE}}}"
|| " AND enumRef2.ColumnName = {{{SINGLE-QUOTE}}}CategoryType{{{SINGLE-QUOTE}}}"
|| " AND enumRef2.EnumValue = 0)"
|| " LEFT OUTER JOIN CV3EnumReference enumRef3 ON (enumRef3.TableName = {{{SINGLE-QUOTE}}}CV3AllergyDeclaration{{{SINGLE-QUOTE}}}"
|| " AND enumRef3.ColumnName = {{{SINGLE-QUOTE}}}Type{{{SINGLE-QUOTE}}}"
|| " AND enumRef3.EnumValue = ad.Type"
|| " AND enumRef3.EnumValue = 2)"
|| " WHERE ad.ClientGUID = " || Sql(client_guid)
|| " AND ad.ClientVisitGUID = " || Sql(client_visit_guid)
|| " AND ad.ChartGUID = " || Sql(client_chart_guid)
|| " AND a.TypeCode = {{{SINGLE-QUOTE}}}Drug{{{SINGLE-QUOTE}}}"
|| " AND ad.Active = 1"
|| " AND ad.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
|| " AND "
|| " (ad.TouchedWhen <= GETDATE()"
|| " AND ad.TouchedWhen >= DATEADD(mi,-30, getdate()))"};
if (exists allergyEntered) then
AllMissingAllergyOnsetDates := ();
for i IN 1 seqto (count allergyEntered) do
if ((onsetMonthEntered[i] IS NULL)) then
if ((onsetYearEntered[i] IS NULL)) then
AllMissingAllergyOnsetDates := allergyEntered[i] || " " || severityEntered[i], AllMissingAllergyOnsetDates;
endif;
endif;
enddo;
if (count AllMissingAllergyOnsetDates > 0) then
allergyAlertMessage := "There are Allergies that do not have an Onset Date. Please return to the Allergy and enter"
|| " an Onset Date.";
this_documentCommunication.Message := allergyAlertMessage;
this_documentCommunication.DisplayMessage := True;
this_documentCommunication.CancelEvent := True;
endif;
endif;
endif;
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_documentCommunication;
;;
end:

View File

@@ -0,0 +1,144 @@
maintenance:
title: DOC_FUNC_FOREIGN_TRAVEL_ALERT;;
mlmname: DOC_FUNC_FOREIGN_TRAVEL_ALERT;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Dean Miklavik;;
specialist: Don Warnick ;;
date: 2014-10-15;;
validation: testing;;
library:
purpose:
;;
explanation: This MLM will return an alert to have the nurese notify Infection Control when the patient has a fever and has recently traveled
outside of the country or has had contact with someone who has recently traveled
Change history
10.15.2014 DW CSR# 32793 - Created
12.01.2014 DW CSR# 32793 - Introduced text messaging to Infection Control
;;
keywords:
;;
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";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
// CHART OBSERVATION SECTION
IF thisdocumentCommunication.EventType = "ChartObservation"
then
// Determine if a fever was indicated
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Fever_Risk_Assessment");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes...")
then Fever := "yes";
endif;
// Determine if a foreign travel was indicated
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Travel_Risk_Assessment1");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes...")
then ForeignTravel := "yes";
endif;
// Determine if the foreign travel was to a country of interest
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_Travel_Risk_Assessment3");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "none of these countries")
then CountryOfInterest := "no";
endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value <> "none of these countries")
then CountryOfInterest := "yes";
endif;
// Decide whehter to fire the alert
If Fever = "yes" and ForeignTravel = "yes" and CountryOfInterest = "yes"
then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with " Notify the Infection Prevention Nurse STAT at Ext 2230 or 2211. ", "Important Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
// Gather the patien{{{SINGLE-QUOTE}}}t nursing unit
CurrentLocation := read last {"Select CurrentLocation From cv3Clientvisit with (nolock) Where Guid = " || SQL(visitGuid)||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" };
EndOfUnit := find "-" in string CurrentLocation;
If EndofUnit <> 0
then Unit:= SUBSTRING EndOfUnit -1 CHARACTERS STARTING AT 1 from CurrentLocation;
else Unit:= CurrentLocation;
endif;
// Send a Text Message Section
PhoneNumber := read last {" select p.AreaCode + p.PhoneNumber from CV3User u with (nolock) join Cv3Phone p with (nolock) on p.PersonGUID = u.GUID " ||
" where u.displayname = {{{SINGLE-QUOTE}}}SCM, Text Messaging{{{SINGLE-QUOTE}}} and p.PhoneNote = {{{SINGLE-QUOTE}}}Infection Control Department Manager{{{SINGLE-QUOTE}}} "};
Page_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PAGE{{{SINGLE-QUOTE}}};
MessageSubject:= "Important Message";
MessageBody := " Please call unit " || Unit || " for a fever travel risk patient. St.Clair main# 412-942-4000";
void := call Page_MLM with(PhoneNumber, MessageSubject, MessageBody);
endif; // Fire the Alert
endif; // EventType = "ChartObservation"
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,139 @@
maintenance:
title: DOC_FUNC_GENERIC_MANDATORY_BY_OCCUPATION;;
mlmname: DOC_FUNC_GENERIC_MANDATORY_BY_OCCUPATION;;
arden: version 5.5;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Juliet Law;;
specialist: ;;
date: 2011-07-07;;
validation: testing;;
library:
purpose: This MLM allows interdisciplinary users to enter data on structured notes that contain
mandatory observations.
;;
explanation:
Change history
07.07.2011 JML Create date.
06.26.2018 DW CSR# 36510 Harm to Self or Others - exclude "Nurse (RN) Med Rec" order role type from mandatory requirement
;;
keywords: mandatory, RN
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Receive arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Get the client, visit, chart, and user GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
//Declare and initialize variables
mandatoryFieldCount := 50; //maximum number of generic obs defined on SN that toggles mandatory requirement
thisDocParamName := "sch_notmandatory"; //base name of generic obs defined on SN
isRn := ""; //Boolean - is current logged on user an RN
//Retrieve current user{{{SINGLE-QUOTE}}}s Id and occupation code
(userId, userOcc, orderroletype) := read last {
" SELECT IDCode, OccupationCode, OrderRoleType, touchedWhen "
|| " FROM CV3User with (nolock)"
|| " WHERE GUID = " || Sql(userGuid)
|| " AND Active = 1 "
, primarytime = touchedWhen
};
//Determine if current logged on user is RN, set boolean
if (userOcc = "RN" OR userOcc = "GN" OR userOcc = "SN") and orderroletype <> "Nurse (RN) Med Rec" then
isRn := "yes";
else
isRn := "no";
endif;
//Only execute on DocumentOpen event
if thisDocumentCommunication.EventType = "DocumentOpening" then
//Loop through maximum number of generic obs
for i in 1 seqto (mandatoryFieldCount) do
//Concatenate base parameter/obs name with counter value
tempFldName := thisDocParamName || i;
//Search SN for existence of parameter/obs name
this_parameterName := first of (thisParameters where thisParameters.name = tempFldName);
if exists(this_parameterName) then
//Instantiate a new Observation object
this_currentObj := NEW ObservationType;
//Populate properties of Observation object with data
this_currentObj.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parameterName.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID := this_parameterName.ConfigurationObj.ListGUID;
listItems := ();
//Loop through List
For item IN this_parameterName.ConfigurationObj.ListItemsList Do
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
//Select radio button value based on isRn value
//This logic will toggle the mandatory fields on the SN
if selectedItem.Value = "yes" AND isRn = "yes" then
selectedItem.IsSelected := true;
endif;
if selectedItem.Value = "no" AND isRn = "no" then
selectedItem.IsSelected := true;
endif;
listItems := (listItems, selectedItem);
enddo;
this_currentObj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
enddo;
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,113 @@
maintenance:
title: DOC_FUNC_GENERIC_MULTI_SELECT;;
mlmname: DOC_FUNC_GENERIC_MULTI_SELECT;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Janet Nordin;;
specialist: Don Warnick;;
date: 2016-04-08;;
validation: testing;;
library:
purpose:
;;
explanation: This generic MLM will select the checkboxes in an observation when the "All" checkbox is selected.
This MLM should be used instead of "DOC_ACS_Reciprocal_Multi_Select" when the observation list utilizes a suggested dictionary.
That MLM will place a "null" in the freetextbox. This one will not.
Change history
04.08.2016 DW CSR# 33486 - Created for the Post Hospital Care Orders SN but may be used for any SN
;;
keywords: generic, multi-select
;;
knowledge:
type: data-driven;;
data:
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
// Find the Observation Name that was selected
this_currentObj := thisdocumentCommunication.CurrentObservationObj;
current_parameter := FIRST OF (thisParameters WHERE thisparameters.ParameterGUID = this_CurrentObj.ParameterGUID);
selected_observation_name := current_parameter.name ;
IF thisdocumentCommunication.EventType = "ChartObservation" then
// Determine if the "All" checkbox is set to "true" (since the "All" checkox is reset to false later in the MLM, this means that someone has selected it to trigger the MLM)
theParameter := first of (thisparameters where thisparameters.Name = selected_observation_name);
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "All")
then AllWasSelected := "true";
else AllWasSelected := "false";
endif;
// If the All checkbox is set to true, then select all checkboxes and de-select the "All" checkbox to initialize it for future selection
If AllWasSelected = "true"
then
this_parametername := first of (thisParameters where thisParameters.Name = selected_observation_name);
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "All" then selectedItem.IsSelected := false; else selectedItem.IsSelected := true; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
endif; // End of Observation Event section
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,626 @@
maintenance:
title: DOC_FUNC_HEP_C_SCREENING;;
mlmname: DOC_FUNC_HEP_C_SCREENING;;
arden: version 5.5;;
version: 15.10;;
institution: St.Clair Hospital;;
author: Shawn Head x7468;;
specialist: Janet Nordin;;
date: 2017-02-13;;
validation: testing;;
library:
purpose: When patient is being evaluated for Hep C. on the Adult Patient Profile and also the Adult Patient Profile - Behavioraly Health
;;
explanation: This MLM will fire on the following structured note documents:
* Adult Patient Profile
* Adult Patient Profile - Behavioral Health
* Adult Patient Profile - Observation
*********Details to be outline here.********
Change history
02.13.2017 STH CSR 35129: Created
04.11.2017 STH CSR 35129: Issue with configuration of flowsheet observation and also auto ordering the lab due to nurses not having the proper security. {Go-Live 4/13/2017}
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
FireOnAdultPatProfiles := ();
FireOnAssessmentPlanFS := ();
/*------------------MAKE CHANGES IN THIS SECTION ONLY----------------------------*/
HepCPatient := "SCH_Hep C_Patient born between 1945-1965";
HepCPriorScreening := "SCH_Hep C_Have you had prior screening";
HepCScreen_PatApproval := ("SCH_Hep C _Testing","SCH_Hep C _Testing NEW","SCH_Hep C Screening New"); // Added By Shami for FS logic
//created new SQL variable as we had to keep re-creating observations after go-live that we had to account for. MLM{{{SINGLE-QUOTE}}}s like lists one way and SQL likes them another.
HepCScreen_PatApproval_SQL := "({{{SINGLE-QUOTE}}}SCH_Hep C _Testing{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C _Testing NEW{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C Screening New{{{SINGLE-QUOTE}}})"; // Added By Shami for FS logic
HepCScreen_AutoOrder := "SCH_Hep C Screening Order";
HepCordername := "Hepatitis C Antibody IgG";
HepCFSCharting := "({{{SINGLE-QUOTE}}}SCH_Hep C Screening New{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C_Screening{{{SINGLE-QUOTE}}})";
(FireOnAdultPatProfiles) := ("Adult Patient Profile","Adult Patient Profile - Observation","Adult Patient Profile - Behavioral Health");
(FireOnAssessmentPlanFS) := ("2. Adult Assessment/Intervention");
//Depending on lab inventory to complete the Hep C testing the order that needs placed may change.
//the standard order will be the StClair order; however if anyone every "unexpires" the Mayo order the MLM
//will automatically start ordering the Mayo order instead of the StClair order. According ot Maria they
//will only unexpire the Mayo order when the St. Clair order is out of stock.
Catalog_Item_Name_StClair := "Hepatitis C Antibody IgG";
Catalog_Item_Name_Mayo := "Hepatitis C Antibody (Mayo)";
/*-----------------END EDIT SECTION---------------------------------------------*/
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Order and Error Destinations
DiagnosticOrder_dest := destination { ObjectsPlus } with
[ alert_type := "Warning",
short_message := "Object created by MLM",
priority := "low",
scope := "chart",
rule_group := "Order Object",
rule_number := 2010 ];
error_destination := destination { Alert } with [
alert_type := "Warning",
short_message := "ObjectsPlus Error from MLM",
priority := "low",
scope := "chart",
Rule_group := "ObjectsPlus Error from MLM",
Rule_number := 1003,
Rule_subgroup := "",
Send_alert_with_order := "",
Alert_dialog_settings := "",
Display_alert := true ];
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(this_currentObs) := thisDocumentCommunication.CurrentObservationObj;
(this_cols) := thisStructuredNoteDoc.ColumnsList;
(this_curr_col) := thisStructuredNoteDoc.CurrentColumn;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid, ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
currentlocationGUID := read last { "select currentlocationguid from cv3clientvisit where clientguid = " || sql(clientGuid) || " and guid = " || sql(visitGuid) || " "};
DocEventType := thisDocumentCommunication.EventType;
ChartPatAge := false;
ChartPriorScreen := false;
ChartAutoOrder := false;
(birth_year) := read last { " select cast (birthyearnum as varchar) from cv3client with (nolock) where guid = " || sql(ClientGuid) };
if(((birth_year as number) >= 1945) and ((birth_year as number) <= 1965)) then
RightAgeyes := true;
RightAgeNo := false;
else
RightAgeYes := false;
RightAgeNo := true;
endif;
if((RightAgeyes) or (DocEventType = "ChartObservation")) then
//Ran this SQL logic against a PROD patient that had over 1400 visits and dated back to 2002. The SQL returned on 0 seconds. With that being said
//there is always the potential this SQL logic can cause a delay if it is slow to return data. Always check this SQL logic as it is required every time
//this MLM is called and looks across all charts for a specific order.
HepCScreeningOrders := read { " select clientguid, ChartGUID, guid as {{{SINGLE-QUOTE}}}clientvisitguid{{{SINGLE-QUOTE}}} into #tmp_cv from cv3clientvisit cv with (nolocK)
where ClientGUID = " || sql(clientGuid) || "
select ocmi.guid,ocmi.name, ocmi.OrderReviewCategoryGUID, rci.ItemName, rci.GUID as {{{SINGLE-QUOTE}}}rci_guid{{{SINGLE-QUOTE}}}, rci.ResultCategoriesGUID
into #tmp_ocmi
from cv3ordercatalogmasteritem ocmi with (nolock)
inner join CV3ResultCatalogItem rci with (nolock) on ocmi.guid = rci.OrderMasterItemGUID
where ocmi.Name like {{{SINGLE-QUOTE}}}%Hepatitis C%{{{SINGLE-QUOTE}}} or ocmi.Name like {{{SINGLE-QUOTE}}}%hep c%{{{SINGLE-QUOTE}}}
select cv.*, o.guid as {{{SINGLE-QUOTE}}}orderGUID{{{SINGLE-QUOTE}}}, o.OrderStatusCode, o.OrderStatusLevelNum, o.SignificantDtm from #tmp_cv cv with (nolock)
inner join CV3Order o with (nolock) on cv.clientguid = o.clientguid and cv.chartguid = o.chartguid
left join CV3BasicObservation bo with (nolock)
on cv.ClientGUID = bo.ClientGUID
and cv.ChartGUID = bo.ChartGUID
and cv.clientvisitguid = bo.ClientVisitGUID
and bo.OrderGUID = o.GUID
inner join #tmp_ocmi ocmi with (nolock) on ((bo.ResultItemGUID = ocmi.rci_guid and bo.ItemName = ocmi.ItemName) or (o.OrderCatalogMasterItemGUID = ocmi.guid))
where (
(o.ClientGUID = " || sql(clientGuid) || "
and o.ChartGUID = " || sql(chartGuid) || "
and o.ClientVisitGUID = " || sql(visitGuid) || "
and OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))
or
(o.ClientGUID = " || sql(clientGuid) || "
and o.ClientVisitGUID <> " || sql(visitGuid) || "
and o.OrderStatusLevelNum >= {{{SINGLE-QUOTE}}}60{{{SINGLE-QUOTE}}}
and OrderStatusLevelNum not in ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))
or
(o.ClientGUID = " || sql(clientGuid) || "
and OrderStatusLevelNum = {{{SINGLE-QUOTE}}}83{{{SINGLE-QUOTE}}})
)
drop table #tmp_cv, #tmp_ocmi "}; //clientGuid, visitGuid, chartGuid
endif;
/*--########################################### BEGINING OF ASSESSMENT AND PLAN FLOWSHEET LOGIC####################################################--*/
/* -- START: COMMENTED AS IT WAS SLOWING DOWN THE FS
if(trim(thisDocumentCommunication.DocumentName as string) in FireOnAssessmentPlanFS) then
if (count(HepCScreeningOrders)>0 AND HepCScreeningOrders is not NULL) then
FSAlert := false;
else
FSAlert := true;
endif;
if((DocEventType = "DocumentOpening") and (FSAlert)) then
HepC_FS_Charting := read last {" select guid as {{{SINGLE-QUOTE}}}clientvisitguid{{{SINGLE-QUOTE}}}, clientguid, chartguid into #tmp_patients from cv3clientvisit with (nolock)
where ClientGuid = " || sql(clientGuid)
|| " and ChartGUID = " || sql(ChartGuid)
|| " and guid = " || sql(VisitGuid)
|| " Select guid into #tmp_obnames from CV3ObsCatalogMasterItem with (nolock)
where name in " || HepCFSCharting || "
select top 1 isnull(oflv.value,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as {{{SINGLE-QUOTE}}}obsvalue{{{SINGLE-QUOTE}}}
from #tmp_patients cv with (nolock)
inner join SXACDObservationParameter ObsParam with (nolock)
on cv.ClientGUID = ObsParam.ClientGUID
and cv.chartguid = ObsParam.ChartGUID
and cv.clientvisitguid = ObsParam.clientvisitguid
AND ObsParam.IsCanceled = 0
and ObsParam.ObsMasterItemGUID in (select guid from #tmp_obnames)
inner join SCMObsFSListValues oflv with (nolock)
on obsparam.clientguid = oflv.clientguid
and obsparam.ObservationDocumentGUID = oflv.ParentGUID
and oflv.active = 1
order by RecordedDtm desc
drop table #tmp_obnames, #tmp_patients " };
AlertShow := read last {" SELECT Distinct
OD.CreatedWhen AS ObsDate
FROM CV3Clientvisit CV
INNER JOIN CV3ClientDocument CD WITH (NOLOCK)
ON CV.GUID = CD.ClientVisitGUID And CD.ClientGUID = CV.ClientGUID
And CD.DocumentName = {{{SINGLE-QUOTE}}}2. Adult Assessment/Intervention{{{SINGLE-QUOTE}}}
AND CD.Active = 1
AND CD.IsCanceled = 0
INNER JOIN CV3ObservationDocument OD WITH (NOLOCK)
ON CD.GUID = OD.OwnerGUID
AND OD.Active = 1
INNER JOIN CV3ObsCatalogMasterItem OCMI WITH (NOLOCK)
ON OCMI.GUID = OD.ObsMasterItemGUID
AND OCMI.Name IN ({{{SINGLE-QUOTE}}}SCH_Hep C _Testing NEW{{{SINGLE-QUOTE}}},
{{{SINGLE-QUOTE}}}SCH_Hep C Screening New{{{SINGLE-QUOTE}}},
{{{SINGLE-QUOTE}}}SCH_Hep C _Hep Education{{{SINGLE-QUOTE}}},
{{{SINGLE-QUOTE}}}SCH_Hep C _Hep Verbalize understanding{{{SINGLE-QUOTE}}})
LEFT JOIN CV3Observation O With (NoLock)
ON OD.ObservationGUID = O.GUID
LEFT JOIN SCMObsFSListValues SFV WITH (NOLOCK)
ON SFV.ParentGUID = OD.ObservationDocumentGUID
AND SFV.ClientGUID = CD.ClientGUID
AND SFV.Active = 1
WHERE (OD.CreatedWhen BETWEEN DATEADD(HOUR,7,CONVERT(VARCHAR(10), GETDATE(),110)) AND
DATEADD(HOUR,19,CONVERT(VARCHAR(10), GETDATE(),110)) ) AND
CV.ClientGuid = " || sql(clientGuid)
|| " and CV.ChartGUID = " || sql(ChartGuid)
|| " and CV.guid = " || sql(VisitGuid)
|| " ORDER BY OD.CreatedWhen DESC" };
CHARTED_DATA_OBJ := OBJECT [DocumentNameOBJ,OBSNAME,OBSVALUE];
(CHARTED_DATA_LIST) := READ AS CHARTED_DATA_OBJ { " SELECT CD.DocumentName,OCMI.Name,ISNULL(sp.ValueText,dbo.SXAGetFSListValsFn(OD.ObservationDocumentGUID,CD.ClientGUID)) AS Value, " ||
" ROW_NUMBER() OVER(PARTITION BY OCMI.NAME ORDER BY SP.RecordedDtm DESC) AS R " ||
" INTO #TEST " ||
" FROM CV3ClientDocument CD WITH (NOLOCK) " ||
" INNER JOIN CV3ObservationDocument OD WITH (NOLOCK) ON OD.OwnerGUID = CD.GUID AND OD.ArcType = CD.ArcType AND OD.Active = 1 AND CD.IsCanceled = 0 " ||
" INNER JOIN CV3ObsCatalogMasterItem OCMI WITH (NOLOCK) ON OCMI.GUID = OD.ObsMasterItemGUID " ||
" AND OCMI.Name IN ({{{SINGLE-QUOTE}}}SCH_Hep C _Hep Education{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C _Hep Verbalize understanding{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C_Have you had prior screening{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C_Patient born between 1945-1965{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Hep C _Testing NEW{{{SINGLE-QUOTE}}}) " ||
" INNER JOIN SXACDObservationParameter SP WITH (NOLOCK) ON SP.ClientGUID = CD.ClientGUID " ||
" AND SP.ChartGUID = CD.ChartGUID AND SP.PatCareDocGUID = CD.PatCareDocGUID " ||
" AND SP.ObservationDocumentGUID = OD.ObservationDocumentGUID " ||
" WHERE CD.ClientVisitGUID = " || SQL(VisitGuid) || " AND CD.ClientGUID = " || SQL(clientGuid) || " AND CD.ChartGUID = " || SQL(ChartGuid) || " AND CD.Active = 1 " ||
" AND ISNULL(sp.ValueText,dbo.SXAGetFSListValsFn(OD.ObservationDocumentGUID,CD.ClientGUID)) IS NOT NULL " ||
" SELECT DocumentName,NAME,Value FROM #TEST WHERE R = 1 " };
FOR V IN 1 SEQTO COUNT OF CHARTED_DATA_LIST DO
DocumentName := CHARTED_DATA_LIST[V].DocumentNameOBJ;
IF CHARTED_DATA_LIST[V].OBSNAME = "SCH_Hep C _Hep Education" THEN
Edu := CHARTED_DATA_LIST[V].OBSVALUE;
ELSEIF CHARTED_DATA_LIST[V].OBSNAME = "SCH_Hep C _Hep Verbalize understanding" THEN
verb := CHARTED_DATA_LIST[V].OBSVALUE;
ELSEIF CHARTED_DATA_LIST[V].OBSNAME = "SCH_Hep C_Have you had prior screening" THEN
prior := CHARTED_DATA_LIST[V].OBSVALUE;
ELSEIF CHARTED_DATA_LIST[V].OBSNAME = "SCH_Hep C_Patient born between 1945-1965" THEN
Born := CHARTED_DATA_LIST[V].OBSVALUE;
ELSEIF CHARTED_DATA_LIST[V].OBSNAME = "SCH_Hep C _Testing NEW" THEN
Test := CHARTED_DATA_LIST[V].OBSVALUE;
ENDIF;
ENDDO;
ComponentCatalogGuidList := "";
IF Edu is NULL THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Education Given" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Education Given" ;
ENDIF;
ENDIF;
IF Verb is NULL THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Patient/SO verbalized understanding" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient/SO verbalized understanding" ;
ENDIF;
ENDIF;
IF Test is NULL THEN
IF ComponentCatalogGuidList = "" then
ComponentCatalogGuidList := ". Patient agrees to testing?" ;
ELSE
ComponentCatalogGuidList := ComponentCatalogGuidList ||"\n" || ". Patient agrees to testing?" ;
ENDIF;
ENDIF;
IF(AlertShow is NULL) THEN
IF( Born ="Yes") THEN
IF( Prior = "No/Unknown" OR Prior= "No") THEN
IF((NOT EXISTS Edu OR NOT EXISTS Verb ) AND (trim(Test as string) = "Undecided") or (trim(Test as string) = "Unable to Consent")) THEN
voiddialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
(DocumentName as string) || " does not have the following Hepatitis C Questions answered \n" ||""|| (ComponentCatalogGuidList as string) || "\n and has the patient{{{SINGLE-QUOTE}}}s consent listed as " || (Test as string) || "\n Please update the "||(DocumentName as string) || " or chart on this flowsheet.",
"Hepatitis C Screening Questions", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
ELSEIF( NOT Exists Test OR NOT EXISTS Edu OR NOT EXISTS Verb) then
voiddialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
(DocumentName as string) || " does not have the following Hepatitis C Questions answered \n" ||""|| (ComponentCatalogGuidList as string) || "\n Please update the "||(DocumentName as string) || " or chart on this flowsheet. ",
"Hepatitis C Screening Questions", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
ELSEIF ( (trim(Test as string) = "Undecided") or (trim(Test as string) = "Unable to Consent") ) THEN
voiddialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
(DocumentName as string) || " currently Does Not have the patients consent for Testing Completed.",
"Hepatitis C Patient Consent Required", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
ENDIF;
ENDIF;
ENDIF;
ENDIF;
ENDIF;
ENDIF;
-- END: COMMENTED AS IT WAS SLOWING DOWN THE FS */
/*--########################################### END OF ASSESSMENT AND PLAN FLOWSHEET LOGIC####################################################--*/
/*--########################################### BEGINING OF ADULT PATIENT PROFILE LOGIC####################################################--*/
/*--########################################### BEGINING OF ADULT PATIENT PROFILE LOGIC####################################################--*/
if(trim(thisDocumentCommunication.DocumentName as string) in FireOnAdultPatProfiles OR trim(thisDocumentCommunication.DocumentName as string) in FireOnAssessmentPlanFS) then
if(DocEventType = "DocumentOpening") then
if(RightAgeYes) then
ChartPriorScreen := true;
if (count(HepCScreeningOrders)>0) then
PriorScreenYes := true;
PriorScreenNo := false;
else
PriorScreenYes := false;
PriorScreenNo := true;
endif;
endif;
ChartPatAge := true;
endif;
// 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);
if(callingobs.DataType = "ListValue") then
callingobsval := (callingobs.ValueObj.ListItemsList.Value where callingobs.ValueObj.ListItemsList.IsSelected = true);
else
callingobsval := callingobs.ValueObj.Value;
endif;
ListSetValueType := OBJECT [ListValuesList];
ListValueType := OBJECT [ListGUID, ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
Obs_ListSet := callingobsvals.ValueObj.ListItemsList;
//Obs_ListItem := Obs_ListSet.ListItemsList ;
Obs_Value := Obs_ListSet.value ;
FOR item IN Obs_ListSet DO
if item.IsSelected = true then
msg1:= item.value;
endif;
ENDDo;
//z:= Obs_ListSet.Records__;
if (DocEventType = "ChartObservation") Then
/*------BEGIN-SECTION---PATIENT HAS HAD PRIOR SCREENING-------------------------------------*/
IF(callingobsname.Name = HepCPatient) then
if("Yes..." in callingobsval) then
RightAgeyes := true;
RightAgeNo := false;
else
RightAgeYes := false;
RightAgeNo := true;
PriorScreenYes := false;
PriorScreenNo := false;
endif;
if((RightAgeYes) and (count(HepCScreeningOrders>0)) and ("Yes..." in callingobsval)) then
PriorScreenYes := true;
PriorScreenNo := false;
elseif("Yes..." in callingobsval) then
PriorScreenYes := false;
PriorScreenNo := true;
else
PriorScreenYes := false;
PriorScreenNo := false;
endif;
ChartPatAge := true;
ChartPriorScreen := true;
endif;
/*------BEGIN-SECTION---PATIENT HAS HAD PRIOR SCREENING-------------------------------------*/
/*------BEGIN-SECTION--PATIENT APPROVAL FOR HEP C SCREEN SECTION-----------------------------*/
if(callingobsname.Name in HepCScreen_PatApproval) then
if ("Yes" in callingobsval) OR ("Place order for Hepatitis C Antibody" in msg1 ) then
selectorderyes := true;
selectorderno := false;
else
selectorderyes := false;
selectorderno := true;
endif;
ChartAutoOrder := true;
endif;
/*------END-SECTION----PATIENT APPROVAL FOR HEP C SCREEN SEC/TION-----------------------------*/
endif;
//ChartPatAge, ChartPriorScreen, ChartAutoOrder
if(ChartPatAge) then
HepCPatient_Param := first of (thisParameters where thisParameters.Name = HepCPatient);
if (exists HepCPatient_Param) then
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := HepCPatient_Param.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := NEW ListValueType;
this_currentObj.ValueObj.ListGUID := HepCPatient_Param.ConfigurationObj.ListGUID;
listItems := ();
for item IN HepCPatient_Param.ConfigurationObj.ListItemsList Do
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if(item.Value = "Yes...") then
selectedItem.IsSelected := RightAgeYes;
else
selectedItem.IsSelected := RightAgeNo;
endif;
listItems := (listItems, selectedItem);
enddo;
this_currentObj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
endif;
if(ChartPriorScreen) then
HepCPriorScreening_Param := first of (thisParameters where thisParameters.Name = HepCPriorScreening);
if (exists HepCPriorScreening_Param) then
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := HepCPriorScreening_Param.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := NEW ListValueType;
this_currentObj.ValueObj.ListGUID := HepCPriorScreening_Param.ConfigurationObj.ListGUID;
listItems := ();
for item IN HepCPriorScreening_Param.ConfigurationObj.ListItemsList Do
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if(item.Value = "Yes") then
selectedItem.IsSelected := PriorScreenYes;
else
selectedItem.IsSelected := PriorScreenNo;
endif;
listItems := (listItems, selectedItem);
enddo;
this_currentObj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
endif;
if(ChartAutoOrder) then
if((selectorderyes) and (count(HepCScreeningOrders)<=0)) then
MayoOrderActive := read first { " select case when ExpiryDate is null then {{{SINGLE-QUOTE}}}true{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}false{{{SINGLE-QUOTE}}} end as {{{SINGLE-QUOTE}}}MayoExpired{{{SINGLE-QUOTE}}}
from CV3OrderCatalogMasterItem
where name = " || sql(Catalog_Item_Name_Mayo) || " "};
if(MayoOrderActive = "true") then
Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name_Mayo;
else
Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name_StClair;
endif;
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
"Clicking Yes will automatically place an order for " || (Laboratory_catalog_item.Name as string) || " which will be scheduled for AM rounds. \n\nAre you sure you want to place the order now?",
"Auto Order Hepatitis C Antibody IgG?", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
If ((dialogResult as string) in ("Yes")) then
SessionType := "Standard";
SessionReason := "";
RequestingSource := "Standing Order";
user_IDType := "Edstan Number (physician)";
order_Creation_Reason := "From Hep C Screening MLM";
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((thisdocumentCommunication.ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
user_IDCode := read last {"SELECT IDCode FROM CV3User " || " where GUID = " || thisdocumentCommunication.UserGUID};
//RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
CP_GUID := read last {" select ProviderGUID from CV3CareProviderVisitRole
where ClientGUID = " || sql(clientGuid) || "
and ChartGUID = " || sql(chartGuid) || "
and ClientVisitGUID = " || sql(visitGuid) || "
and Active = 1
and status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}
and RoleCode = {{{SINGLE-QUOTE}}}Attending{{{SINGLE-QUOTE}}} "};
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( CP_GUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} ); //Int64
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((currentlocationGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
try
Parent_DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
// PreFilled_MedicationOrder_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
with
client_visit_obj, // ClientVisit ObjectsPlus object
Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
order_Creation_Reason, // string CreateReason
RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
RequestingSource, // string RequestedBySource (must be in dictionary)
SessionType, // string SessionType
SessionReason, // string SessionReason
location_obj, // Location ReleaseLocGrpID
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
ReqTime_obj := new net_object {{{SINGLE-QUOTE}}}RequestedTime{{{SINGLE-QUOTE}}};
ReqTime_obj.CodedTime := "AM Rounds";
Parent_DiagnosticOrder_obj.RequestedTime := ReqTime_obj;
Parent_DiagnosticOrder_obj.RequestedDate := "T+1";
if ( Parent_DiagnosticOrder_obj is NOT NULL ) then
try
void := call Parent_DiagnosticOrder_obj.Save;
selectorderyes := true;
selectorderno := false;
void := call Parent_DiagnosticOrder_obj.Dispose;
void:= call Laboratory_catalog_item.Dispose;
Laboratory_catalog_item:= null;
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}New Parent Diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
Endcatch;
endif;
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}New Parent Diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
if ( Laboratory_catalog_item is NOT NULL ) then void:= call Laboratory_catalog_item.Dispose; Laboratory_catalog_item:= null; endif;
if ( Parent_DiagnosticOrder_obj is NOT NULL ) then void:= call Parent_DiagnosticOrder_obj.Dispose; Parent_DiagnosticOrder_obj:= null; endif;
selectorderyes := false;
selectorderno := true;
Parent_DiagnosticOrder_dest := null;
endcatch;
// Dispose
if ( ClientVisit_obj is NOT NULL ) then void:= call ClientVisit_obj.Dispose; ClientVisit_obj:= null; endif;
if ( RequestedBy_obj is NOT NULL ) then void:= call RequestedBy_obj.Dispose; RequestedBy_obj:= null; endif;
if ( Location_obj is NOT NULL ) then void:= call Location_obj.Dispose; Location_obj:= null; endif;
else
selectorderyes := false;
selectorderno := true;
endif;
endif;
HepC_AutoOrderParam := first of (thisParameters where thisParameters.Name = HepCScreen_AutoOrder);
if (exists HepC_AutoOrderParam) then
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := HepC_AutoOrderParam.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := NEW ListValueType;
this_currentObj.ValueObj.ListGUID := HepC_AutoOrderParam.ConfigurationObj.ListGUID;
listItems := ();
for item IN HepC_AutoOrderParam.ConfigurationObj.ListItemsList Do
abc123 := item.Value;
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if(item.Value = "Yes") then
selectedItem.IsSelected := selectorderyes;
else
selectedItem.IsSelected := selectorderno;
endif;
listItems := (listItems, selectedItem);
enddo;
this_currentObj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
endif;
endif;
/*--########################################### END OF ADULT PATIENT PROFILE LOGIC####################################################--*/
;;
evoke:
;;
logic:
conclude true;
;;
action:
if Error_occurred
then
write "An error has occured in the MLM {{+B}}DOC_FUNC_HEP_C_SCREENING{{-B}} " ||
"Please notify your System Administrators that an error message has " ||
"occurred for this patient. They will review the following error " ||
"message: \n" at error_destination;
write "1. " || error_message at error_destination;
endif;
return thisDocumentCommunication;
;;
Urgency: 50;;
end:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,164 @@
maintenance:
title: ;;
mlmname: DOC_FUNC_INSULIN_PUMP_FS_CALC;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Shawn Head;;
specialist: Dean Miklavic;;
date: 2014-08-26;;
validation: testing;;
library:
purpose:
This MLM will calculate the above target BGM, the correction bolus and the correction dose on the Insulin Pump flowsheet.
;;
explanation:
create for CSR #: 32128
;;
keywords:
target BGM, correction bolus, correction dose, insulin pump calculation
;;
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";
error_occurred := false;
error_message := "";
log_execution_info := false;
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// 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];
ListValueType := OBJECT [ListGuid, ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
//Set Flowsheet DocumentCommunication object model variables via Called MLM
(this_fs_doc) := thisDocumentCommunication.DocumentConfigurationObj;
(this_parameters) := this_fs_doc.ParametersList;
(this_currentObs) := thisDocumentCommunication.CurrentObservationObj;
(this_cols) := this_fs_doc.ColumnsList;
(this_curr_col) := this_fs_doc.CurrentColumn;
(this_chartedObs) := this_curr_col.ChartedObservationsList;
document_type := thisDocumentCommunication.DocumentType;
event_type := thisDocumentCommunication.EventType;
client_guid := thisDocumentCommunication.ClientGUID;
visit_guid := thisDocumentCommunication.ClientVisitGUID;
chart_guid := thisDocumentCommunication.ChartGUID;
IF thisDocumentCommunication.EventType = "ChartObservation" then
theParameter := first of (this_parameters where this_parameters.Name = "SCHCK_AS Current BGM");
theObservation := first of (this_chartedObs where this_chartedObs.ParameterGUID = theParameter.ParameterGUID);
CurrentBMG := theObservation.ValueObj.Value;
theParameter := first of (this_parameters where this_parameters.Name = "SCHCK_AS Target BGM");
theObservation := first of (this_chartedObs where this_chartedObs.ParameterGUID = theParameter.ParameterGUID);
targetBMG := theObservation.ValueObj.Value;
theParameter := first of (this_parameters where this_parameters.Name = "SCHCK_AS Above Target BMG");
theObservation := first of (this_chartedObs where this_chartedObs.ParameterGUID = theParameter.ParameterGUID);
AbovetargetBMG := theObservation.ValueObj.Value;
theParameter := first of (this_parameters where this_parameters.Name = "SCHCK_AS Insulin Correction Factor");
theObservation := first of (this_chartedObs where this_chartedObs.ParameterGUID = theParameter.ParameterGUID);
CorrectFactor := theObservation.ValueObj.Value;
theParameter := first of (this_parameters where this_parameters.Name = "SCHCK_AS Insulin Correction Bolus");
theObservation := first of (this_chartedObs where this_chartedObs.ParameterGUID = theParameter.ParameterGUID);
CorrectionBolus := theObservation.ValueObj.Value;
theParameter := first of (this_parameters where this_parameters.Name = "SCHCK_AS Insulin Correction Dose");
theObservation := first of (this_chartedObs where this_chartedObs.ParameterGUID = theParameter.ParameterGUID);
CorrectDose := theObservation.ValueObj.Value;
if (((CurrentBMG as number) > 0) and ((targetBMG as number) > 0)) then
calcTargetBMG := (CurrentBMG as number) - (targetBMG as number);
if (AbovetargetBMG is null) or ((AbovetargetBMG as number) <> (calcTargetBMG as number)) then
AboveBMGparam := first of (this_parameters WHERE this_parameters.Name = "SCHCK_AS Above Target BGM");
this_currentObj1 := NEW ObservationType;
this_currentObj1.ClientDocumentGUID := this_fs_doc.ClientDocumentGUID;
this_currentObj1.ParameterGUID := AboveBMGparam.ParameterGUID;
this_currentObj1.DataType := "NumericValue";
this_currentObj1.ValueObj := NEW NumericValueType;
this_currentObj1.ValueObj.Value := (calcTargetBMG as number);
this_fs_doc.CurrentColumn.ChartedObservationsList := (this_fs_doc.CurrentColumn.ChartedObservationsList, this_currentObj1);
endif;
endif;
if ((CorrectFactor as number) > 0) then
if ((calcTargetBMG as number) > 0) then
//SCHCK_AS Above Target BGM / SCHCK_AS Insulin Correction Factor
CorrectiveBolus := ((calcTargetBMG as number) / (CorrectFactor as number));
CorrectiveBolus := CorrectiveBolus formatted with "%.2f";
CorrectiveDose := round (CorrectiveBolus as number);
else
CorrectiveBolus := 0;
CorrectiveDose := 0;
endif;
CorrectBolusparam := first of (this_parameters WHERE this_parameters.Name = "SCHCK_AS Insulin Correction Bolus");
CorrectDoseparam := first of (this_parameters WHERE this_parameters.Name = "SCHCK_AS Insulin Correction Dose");
this_currentObj2 := NEW ObservationType;
this_currentObj2.ClientDocumentGUID := this_fs_doc.ClientDocumentGUID;
this_currentObj2.ParameterGUID := CorrectBolusparam.ParameterGUID;
this_currentObj2.DataType := "NumericValue";
this_currentObj2.ValueObj := NEW NumericValueType;
this_currentObj2.ValueObj.Value := (CorrectiveBolus as number);
this_fs_doc.CurrentColumn.ChartedObservationsList := (this_fs_doc.CurrentColumn.ChartedObservationsList, this_currentObj2);
this_currentObj3 := NEW ObservationType;
this_currentObj3.ClientDocumentGUID := this_fs_doc.ClientDocumentGUID;
this_currentObj3.ParameterGUID := CorrectDoseparam.ParameterGUID;
this_currentObj3.DataType := "NumericValue";
this_currentObj3.ValueObj := NEW NumericValueType;
this_currentObj3.ValueObj.Value := (CorrectiveDose as number);
this_fs_doc.CurrentColumn.ChartedObservationsList := (this_fs_doc.CurrentColumn.ChartedObservationsList, this_currentObj3);
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic:
conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,305 @@
maintenance:
title: DOC_FUNC_IRU_PREADMISSION_SCREEN;;
mlmname: DOC_FUNC_IRU_PREADMISSION_SCREEN;;
arden: version 15.1;;
version: 2.50;;
institution: St.Clair Hospital;;
author: Juliet Law;;
specialist: Shubha Rai / Debbie Eiler;;
date: 2016-02-29;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
02.29.2016 JML CSR 33994: Create date.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Receive arguments from the structured note
(this_documentCommunication) := argument;
// .Net assemblies required for ObjectsPlus
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Include MLM
str_parse := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
//Include Called MLM to setup CDS objects
set_cds_vars := MLM {{{SINGLE-QUOTE}}}Called_RPM_DOM_Get_Definition_MLM{{{SINGLE-QUOTE}}};
Get_result_impression_lookup := MLM {{{SINGLE-QUOTE}}}ACS_result_impression_Lookup{{{SINGLE-QUOTE}}};
//Document Types
STRUCTUREDNOTE := "StructuredNote";
//Event Types
DOCUMENTCLOSING := "DocumentClosing";
CHARTOBSERVATION := "ChartObservation";
DOCUMENTOPENING := "DocumentOpening";
//Setting debugFlag to True will allow popup dialogs containing debug information to appear
debugFlag := false;
//Tab definitions and formating
TAB := 9 FORMATTED WITH "%C" ;
TAB2 := TAB || TAB ;
TAB3 := TAB || TAB || TAB;
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
CRLF2 := CR||LF||LF;
SP:= 32 formatted with "%c";
SP2:= SP||SP;
SP3:= SP||SP||SP;
//Initialize CDS objects via MLM call
(this_documentCommunication, client_guid, client_visit_guid, client_chart_guid, user_guid,
document_type, document_name, event_type, configuration_guid, this_currentObj, CancelEventFlag,
this_structuredNoteDoc, authored_date_time, authored_by_guid, client_document_guid, document_date_time,
isNewFlag, isIncompleteFlag, isResultsPendingFlag, isPriorityFlag, this_parameters,
this_chartedObservationsList, this_parameters_display_name, current_parameter, current_parameter_name,
current_parameter_guid, current_parameter_DataType, selectedItems, selectedItems_value, current_value,
diagnosticMessage, displayMessageFlag, CoSigner1, CoSigner2, DocumentTopic) := CALL set_cds_vars WITH
(this_documentCommunication);
//Set up debugging information to be captured
messageText := "";
if (debugFlag = true) then
messageText := "Debug Information:\n\n";
messageText := messageText || " DOC_FUNC_IRU_PREADMISSION_SCREEN mlm called.\n\n";
endif;
//Local Variables
theDocumentName := "Inpatient Rehabilitation Unit Pre-Admission Screen";
// 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];
if ( event_type = DOCUMENTOPENING AND document_name = theDocumentName ) then
vital_sign_msg := "Vital Signs in last Past 24 Hours - Last Charted";
//Retrieve last 24 hours of vital signs
( vital_sign,
vital_value,
vital_date ) := READ {"SELECT oci.Name, o.ValueText, cd.AuthoredDtm"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3ClientDocumentCUR cd WITH (NOLOCK)"
|| " ON cv.ClientGUID = cd.ClientGUID"
|| " AND cv.GUID = cd.ClientVisitGUID"
|| " AND cv.ChartGUID = cd.ChartGUID"
|| " JOIN CV3ClientDocDetailCUR cdd WITH (NOLOCK) "
|| " ON cd.GUID = cdd.ClientDocumentGUID"
|| " AND cd.ClientGUID = cdd.ClientGUID"
|| " JOIN CV3ObservationDocumentCUR od WITH (NOLOCK)"
|| " ON cdd.ClientDocumentGUID = od.OwnerGUID "
|| " JOIN CV3ObsCatalogMasterItem ocmi WITH (NOLOCK)"
|| " ON od.ObsMasterItemGUID = ocmi.GUID"
|| " JOIN CV3ObservationCUR o WITH (NOLOCK)"
|| " ON o.GUID = od.ObservationGUID"
|| " JOIN CV3ObsCatalogItem oci WITH (NOLOCK)"
|| " ON oci.guid = o.ObsItemGUID"
|| " WHERE cd.ClientGUID = " || Sql(client_guid)
|| " AND cd.ChartGUID = " || Sql(client_chart_guid)
|| " AND cd.ClientVisitGUID = " || Sql(client_visit_guid)
|| " AND cd.DocumentName = {{{SINGLE-QUOTE}}}1.Vital Signs - Basic{{{SINGLE-QUOTE}}}"
|| " AND o.ValueText is not null"
|| " AND oci.Name IN ({{{SINGLE-QUOTE}}}Farenheit{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}},"
|| " {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}})"
|| " AND DateDiff(HOUR, cd.AuthoredDtm, GETDATE()) <= 24"
|| " AND od.Active = 1"
|| " AND cdd.Active = 1"
|| " ORDER BY cd.AuthoredDtm"};
if ( exists vital_sign ) then
pulse_ox := "Pulse Ox: "; pulse_ox_value := ""; pulse_ox_datediff := 0;
temp := "T: "; temp_value := ""; temp_datediff := 0;
hr := "HR: "; hr_value := ""; hr_datediff := 0;
resp_rate := "R: "; resp_rate_value := ""; resp_rate_datediff := 0;
bp := "BP: "; bp_sys_value := ""; bp_sys_datediff := 0;
bp_dia_value := ""; bp_dia_datediff := 0;
for i IN 1 seqto ( count vital_sign ) do
if ( vital_sign[i] = "SCH_vs_pulse ox saturation" AND pulse_ox_datediff = 0 ) then
pulse_ox_value := vital_value[i];
pulse_ox_datediff := ( now - vital_date[i] );
elseif ( vital_sign[i] = "SCH_vs_pulse ox saturation" AND ( ( now - vital_date[i] ) <= pulse_ox_datediff ) ) then
pulse_ox_value := vital_value[i];
else
pulse_ox_datediff := ( now - vital_date[i] );
endif;
if ( vital_sign[i] = "Farenheit" AND temp_datediff = 0 ) then
temp_value := vital_value[i];
temp_datediff := ( now - vital_date[i] );
elseif ( vital_sign[i] = "Farenheit" AND ( ( now - vital_date[i] ) <= temp_datediff ) ) then
temp_value := vital_value[i];
else
temp_datediff := ( now - vital_date[i] );
endif;
if ( vital_sign[i] = "Heart Rate" AND hr_datediff = 0 ) then
hr_value := vital_value[i];
hr_datediff := ( now - vital_date[i] );
elseif ( vital_sign[i] = "Heart Rate" AND ( ( now - vital_date[i] ) <= hr_datediff ) ) then
hr_value := vital_value[i];
else
hr_datediff := ( now - vital_date[i] );
endif;
if ( vital_sign[i] = "Resp Rate" AND resp_rate_datediff = 0 ) then
resp_rate_value := vital_value[i];
resp_rate_datediff := ( now - vital_date[i] );
elseif ( vital_sign[i] = "Resp Rate" AND ( ( now - vital_date[i] ) <= resp_rate_datediff ) ) then
resp_rate_value := vital_value[i];
else
resp_rate_datediff := ( now - vital_date[i] );
endif;
if ( vital_sign[i] = "Noninvasive Systolic BP" AND bp_sys_datediff = 0 ) then
bp_sys_value := vital_value[i];
bp_sys_datediff := ( now - vital_date[i] );
elseif ( vital_sign[i] = "Noninvasive Systolic BP" AND ( ( now - vital_date[i] ) <= bp_sys_datediff ) ) then
bp_sys_value := vital_value[i];
else
bp_sys_datediff := ( now - vital_date[i] );
endif;
if ( vital_sign[i] = "Noninvasive Diastolic BP" AND bp_dia_datediff = 0 ) then
bp_dia_value := vital_value[i];
bp_dia_datediff := ( now - vital_date[i] );
elseif ( vital_sign[i] = "Noninvasive Diastolic BP" AND ( ( now - vital_date[i] ) <= bp_dia_datediff ) ) then
bp_dia_value := vital_value[i];
else
bp_dia_datediff := ( now - vital_date[i] );
endif;
enddo;
vital_sign_msg := vital_sign_msg || CRLF2 || TAB || vital_date[i] || SP2 || temp || temp_value
|| SP2 || hr || hr_value
|| SP2 || resp_rate || resp_rate_value
|| SP2 || bp || bp_sys_value || "/" || bp_dia_value
|| SP2 || pulse_ox || pulse_ox_value;
else
vital_sign_msg := vital_sign_msg || CRLF2 || TAB || "No vital signs charted in the last 24 hours.";
endif;
VitalParameterName := "SCH_FB_IRU Vital Signs";
VitalParameter := first of ( this_parameters WHERE this_parameters.Name = VitalParameterName );
this_currentVitalsObs := NEW ObservationType;
this_currentVitalsObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentVitalsObs.ParameterGUID := VitalParameter.ParameterGUID;
this_currentVitalsObs.DataType := "FreeTextValue";
this_currentVitalsObs.ValueObj := NEW FreeTextValueType;
this_currentVitalsObs.ValueObj.Value := vital_sign_msg;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentVitalsObs );
//Retrieve applicable diagnostic MI / Cardiac results
medical_imaging_msg := "Medical Imaging Results in last 7 days";
( order_name,
order_dttm ) := READ {"SELECT DISTINCT {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} + o.Name + {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}, osh.CreatedWhen"
|| " FROM CV3ClientVisit v WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK) "
|| " ON v.GUID = o.ClientVisitGUID"
|| " AND v.ClientGUID = o.ClientGUID"
|| " AND v.ChartGUID = o.ChartGUID"
|| " JOIN CV3OrderStatusHistory osh WITH (NOLOCK)"
|| " ON o.GUID = osh.OrderGUID"
|| " AND o.ClientGUID = osh.ClientGUID"
|| " JOIN CV3OrderCatalogMasterItem om WITH (NOLOCK) "
|| " ON o.OrderCatalogMasterItemGUID = om.GUID"
|| " JOIN CV3OrganizationalUnit org WITH (NOLOCK) "
|| " ON om.OrgUnitGUID = org.GUID"
|| " WHERE v.ClientGUID = " || Sql(client_guid)
|| " AND v.GUID = " || Sql(client_visit_guid)
|| " AND v.ChartGUID = " || Sql(client_chart_guid)
|| " AND o.CreatedWhen >= dateadd(day, -7, getdate())"
|| " and o.CreatedWhen < DATEADD(day, 0, getdate())"
|| " AND o.TypeCode = {{{SINGLE-QUOTE}}}Diagnostic{{{SINGLE-QUOTE}}}"
|| " AND osh.FunctionCodeNum = {{{SINGLE-QUOTE}}}10{{{SINGLE-QUOTE}}}"
|| " AND ( org.code LIKE {{{SINGLE-QUOTE}}}%medical imaging%{{{SINGLE-QUOTE}}}"
|| " OR org.Code like {{{SINGLE-QUOTE}}}%cardiology%{{{SINGLE-QUOTE}}}"
|| " OR org.Code like {{{SINGLE-QUOTE}}}%cardiac%{{{SINGLE-QUOTE}}}"
|| " OR org.Code like {{{SINGLE-QUOTE}}}%eeg%{{{SINGLE-QUOTE}}})"};
if ( exists order_name ) then
Retreive_Attribute := "text_val";
Retreive_Object := "Results";
Filterable_Attribute := "itemname";
Filterable_Operator := "IN" ;
if ( count order_name = 1 ) then
Filterable_Value := first of ( order_name );
else
Filterable_Value := order_name;
endif;
Additional_condition := "";
// Call Impression Lookup MLM to get patient data
(All_Attributes_Lst, All_Med_Rel_Dttm_Lst, All_Values_Lst) := CALL Get_result_impression_lookup WITH
(client_guid, client_visit_guid, client_chart_guid, Is_Historical, Retreive_Object, Retreive_Attribute,
Filterable_Attribute, Filterable_Operator, Filterable_Value, Additional_condition);
if ( exists All_Values_Lst ) then
for i IN 1 seqto ( count All_Attributes_Lst ) do
medical_imaging_msg := medical_imaging_msg || CRLF2 || TAB || All_Attributes_Lst[i] || SP
|| All_Med_Rel_Dttm_Lst[i] || ": " || All_Values_Lst[i];
enddo;
else
medical_imaging_msg := medical_imaging_msg || CRLF2 || TAB || "No IMAGE diagnostic impressios Recorded.";
endif;
else
medical_imaging_msg := medical_imaging_msg || CRLF2 || TAB || "No IMAGE diagnostic impressions Recorded.";
endif;
MIParameterName := "SCH_FB_IRU_Diagnosis";
MIParameter := first of ( this_parameters WHERE this_parameters.Name = MIParameterName );
this_currentMIObs := NEW ObservationType;
this_currentMIObs.ClientDocumentGUID := this_structuredNoteDoc.ClientDocumentGUID;
this_currentMIObs.ParameterGUID := MIParameter.ParameterGUID;
this_currentMIObs.DataType := "FreeTextValue";
this_currentMIObs.ValueObj := NEW FreeTextValueType;
this_currentMIObs.ValueObj.Value := medical_imaging_msg;
this_structuredNoteDoc.ChartedObservationsList := ( this_structuredNoteDoc.ChartedObservationsList, this_currentMIObs );
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,179 @@
maintenance:
title: DOC_FUNC_IV_HALDOL_STATUSBOARD;;
mlmname: DOC_FUNC_IV_HALDOL_STATUSBOARD;;
arden: version 2.5;;
version: 5.50;;
institution: Allscripts;;
author: Shawn T. Head ;;
specialist: Dean M;;
date: 2016-04-28;;
validation: testing;;
library:
purpose: Update statusboard IV Haldol dosage to remove red flag once ryhthem strip is documented on flowsheet.
;;
explanation:
4.29.2016 STH CSR#: 33207 - When the user charts the observation "Rhythm" on the Adult Assessment A/I Flowsheet and there is currently a value in the IV Haldol column on the status board with an * at the end
This MLM will update the column to remove the * and replace it with CRLF so the red flag clears off status board.
NOTE: There are 2 other MLM{{{SINGLE-QUOTE}}}s that are used in conjuction with this MLM to create the haldol column on charting of IV haldol.
SCH_CHARTED_HALDOL_24HRS & DOC_ADULT_ASSESSMENT_CLOSE {Go-Live 6/1/2016}
12.8.2016 STH CSR#: 335130 - Update for issues identified when testing for 16.3 Needed to change the search to look for the current value by searching for the enterprise defined column by name not by the column number.
;;
keywords: IV Haldol, alert, flowsheet
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
// RS ADD Message box
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Called MLMs to set up the CDS and return obs values
set_cds_vars := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_DEFINITION_MLM{{{SINGLE-QUOTE}}};
read_obs_value := MLM {{{SINGLE-QUOTE}}}CALLED_DOC_FS_OBS_VALUE_MLM{{{SINGLE-QUOTE}}};
//create_ED_column := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ENTERPRISE_DEFINED_COLUMN{{{SINGLE-QUOTE}}};
/**************Make Changes To Spelling And Flags In This Section**************/
//Set up variables; initialize
braden_param := "Rhythm";
msg := "";
mlm_name := "DOC_FUNC_IV_HALDOL_STATUSBOARD";
//Set constants indicating document type and event
FLOWSHEET := "Flowsheet";
CHARTOBSERVATION := "ChartObservation";
DOCUMENTCLOSING := "DocumentClosing";
/******************************************************************************/
updatecol := false;
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
TS := 9 formatted with "%c";
CRLF:= CR||LF;
//Initialize DocumentCommunication objects
(this_documentCommunication, clientGUID, CVGUID, chartGUID,
user_guid, document_type, document_name, event_type,
configuration_guid, this_currentObs, CancelEventFlag, this_fs_doc,
authored_by_guid, isIOFlowsheetFlag, client_document_guid, this_parameters,
this_columnList, this_currentColumn, this_chartedObservationsList,
this_parameters_displayName, current_parameter, current_parameter_name, current_parameter_guid,
current_parameter_datatype, selectedItems, selectedItems_Value, current_value,
diagnostic_message, displayMessageFlag) := call set_cds_vars WITH (this_documentCommunication);
//Retrieve DocumentType (StructuredNote or Flowsheet) and EventType
this_DocumentType := this_documentCommunication.DocumentType;
this_EventType := this_documentCommunication.EventType;
try
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
with ((CVGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
EntDefinedColumn_obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
with ( client_visit_obj, "Haldol Total");
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}Common Data:{{-R}}\n" ||
ex.Message || "\n\n";
if ( client_visit_obj is NOT NULL ) then
void:= call client_visit_obj.Dispose;
client_visit_obj:= null;
endif;
if ( EntDefinedColumn_obj is NOT NULL) then
void := call EntDefinedColumn_obj.Dispose;
EntDefinedColumn_obj := null;
endif;
endcatch;
current_value := EntDefinedColumn_obj.Value;
/*read last { " select EnterpriseVisitCol37 from CV3EnterpriseVisitData
where clientguid = " || sql(ClientGUID)
|| " and visitguid = " || sql(CVGUID) };
*/
IV_Haldol_Alert_on_statusboard := current_value matches pattern "%*%";
//Process logic on Flowsheets when the document is closing
if (IV_Haldol_Alert_on_statusboard and this_DocumentType = FLOWSHEET AND this_EventType = DOCUMENTCLOSING) then
//Retrieve Braden Score parameter
theParameter := first of (this_parameters WHERE this_parameters.Name = braden_param);
if (exists theParameter) then
//Retrieve DateTime from current charted column
updatecol := true;
finda := FIND "*" IN STRING current_value;
newvalue := SUBSTRING (finda-1) CHARACTERS FROM current_value;
newvalue := newvalue || TS;
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic:
if (updatecol=true) then
try
/*
EntDefinedColumn_obj := call {{{SINGLE-QUOTE}}}EnterpriseDefinedColumn{{{SINGLE-QUOTE}}}.FindByName
with ( client_visit_obj, "Haldol Total");
*/
EntDefinedColumn_obj.Value := newvalue;
void := call EntDefinedColumn_obj.Save;
void := call EntDefinedColumn_obj.Dispose;
EntDefinedColumn_obj := null;
endtry;
catch Exception ex
error_occurred := true;
error_message := error_message || "{{+R}}Enterprise Patient List Column{{-R}}\n"
|| ex.message || "\n\n";
if ex.InnerException is not null net_object then
error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
endif;
if (EntDefinedColumn_obj is not null) then
void := call EntDefinedColumn_obj.Dispose;
EntDefinedColumn_obj := null;
endif;
EDColumn_Dest := null;
endcatch;
if ( client_visit_obj is not null ) then
void := call client_visit_obj.Dispose;
client_visit_obj := null;
endif;
endif;
conclude true;
;;
action:
return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,487 @@
maintenance:
title: Vital Signs - Highs and Lows;;
mlmname: DOC_FUNC_Last_24hrs;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Shivprasad Jadhav;;
specialist: ;;
date: 2014-12-16;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
20.12.2014 DW Created to show last 24 hours Vital Sign observations from Physician Progress Note.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// OBSERVATION CHANGE
if thisDocumentCommunication.EventType = "ChartObservation"
then
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, o.ValueText, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}} THEN 05 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Mean BP{{{SINGLE-QUOTE}}} THEN 06 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive BP Source 1{{{SINGLE-QUOTE}}} THEN 07 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}} THEN 08 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_pulse ox source{{{SINGLE-QUOTE}}} THEN 09 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Mean BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive BP Source 1{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_vs_pulse ox source{{{SINGLE-QUOTE}}} ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}1.Vital Signs - Basic{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
// || " delete from #tmp_aaa where timstmp2 is not null "
|| " Delete from #tmp_aaa where Value is Null "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Vital Signs - Basic in Past 24 Hours -All Charted \b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := (obsNamesList[i]);
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("farenheit" , "Heart Rate" , "Resp Rate" , "Noninvasive Diastolic BP" , "Noninvasive Systolic BP" ,
"Noninvasive Mean BP", "Noninvasive BP Source 1", "SCH_vs_pulse ox saturation", "SCH_vs_pulse ox source")
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "Heart Rate" then formattedText1 := formattedText1 || "\b HR:\b0 ";
elseif obsName = "Farenheit" then formattedText1 := formattedText1 || "\b T:\b0 ";
elseif obsName = "Resp Rate" then formattedText1 := formattedText1 || "\b R:\b0 ";
elseif obsName = "Noninvasive Systolic BP" then formattedText1 := formattedText1 || "\b BP:\b0 ";
elseif obsName = "Noninvasive Diastolic BP" then formattedText1 := formattedText1 || "/";
elseif obsName = "Noninvasive Mean BP" then formattedText1 := formattedText1 || "\b Mean BP:\b0 ";
elseif obsName = "Noninvasive BP Source 1" then formattedText1 := formattedText1 || "/";
elseif obsName = "SCH_vs_pulse ox saturation" then formattedText1 := formattedText1 || "\b Pulse Ox:\b0 ";
//elseif obsName = "SCH_vs_pulse ox source" then formattedText1 := formattedText1 || "/" ; //b O2 L/min:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]);
endif; // Obsname amongst the Vital Signs observations
// for Urine
// SCH_io_Foley Catheter, io_output_condom_catheter, SCH_io_Straight Catheter
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif;
// DOCUMENT OPEN
/*
if thisdocumentCommunication.EventType = "DocumentOpening"
then
// Query the database for the vitals info
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, o.ValueText, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}Farenheit{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}} THEN 05 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Systolic BP - Radial{{{SINGLE-QUOTE}}} THEN 06 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Diastolic BP - Radial{{{SINGLE-QUOTE}}} THEN 07 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Systolic BP - Second Line{{{SINGLE-QUOTE}}} THEN 08 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Diastolic - Second Line{{{SINGLE-QUOTE}}} THEN 09 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}} THEN 10 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}L/min{{{SINGLE-QUOTE}}} THEN 11 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height in cm{{{SINGLE-QUOTE}}} THEN 20 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height in ft{{{SINGLE-QUOTE}}} THEN 21 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height remainder in inches{{{SINGLE-QUOTE}}} THEN 22 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}} THEN 23 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt gm ob NU{{{SINGLE-QUOTE}}} THEN 24 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt lb ob NU{{{SINGLE-QUOTE}}} THEN 25 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt oz ob NU{{{SINGLE-QUOTE}}} THEN 26 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt lb ob NU{{{SINGLE-QUOTE}}} THEN 27 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt oz ob NU{{{SINGLE-QUOTE}}} THEN 28 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - grams{{{SINGLE-QUOTE}}} THEN 29 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - lbs{{{SINGLE-QUOTE}}} THEN 40 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - oz{{{SINGLE-QUOTE}}} THEN 41 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Weight - lbs{{{SINGLE-QUOTE}}} THEN 42 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}} THEN 43 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_Occipital-Frontal Head{{{SINGLE-QUOTE}}} THEN 44 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Stool{{{SINGLE-QUOTE}}}THEN 45 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Urine{{{SINGLE-QUOTE}}}THEN 46 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ( "
|| " {{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}L/min{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Systolic BP - Radial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Diastolic BP - Radial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Systolic BP - Second Line{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Arterial Diastolic - Second Line{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby b wt gm ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby a wt lb ob NU{{{SINGLE-QUOTE}}} , "
|| " {{{SINGLE-QUOTE}}}AS deliv baby b wt lb ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby a wt oz ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby b wt oz ob NU{{{SINGLE-QUOTE}}} , "
|| " {{{SINGLE-QUOTE}}}SCH_Newborn Weight - grams{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Newborn Weight - lbs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Newborn Weight - oz{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Weight - lbs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Height in ft{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Height remainder in inches{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Height in cm{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_vs_Occipital-Frontal Head{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Current Weight{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Stool{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Urine{{{SINGLE-QUOTE}}} "
|| " ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}B1. Newborn Vital Signs{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}B2. Newborn Assessment/Intervention{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}1.Vital Signs - Basic{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}1.Vital Signs - Critical Care{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
|| " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
|| " update t2 set timstmp2 = {{{SINGLE-QUOTE}}}first weight{{{SINGLE-QUOTE}}}, name = {{{SINGLE-QUOTE}}}First Adult Weight - kg{{{SINGLE-QUOTE}}} from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq <> t2.sortseq and t2.name = {{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}} "
|| " delete from #tmp_aaa where timstmp2 is not null and timstmp2 <> {{{SINGLE-QUOTE}}}first weight{{{SINGLE-QUOTE}}} "
|| " "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// Process the First Group Data Elements (past 24 hours)
header1 :="\b Vital Signs in Past 24 Hours - Last Charted \b0\n\n";
formattedText1:= " ";
thisdatefield := " ";
yesterday:= now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := last (first i from obsNamesList);
// Reformat the Time Stamp
thisdatefield_unformatted := last (first i from highValuesList);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("farenheit","Heart Rate","Resp Rate","SCH_vs_pulse ox saturation","L/min",
"Noninvasive Diastolic BP","Noninvasive Systolic BP","Arterial Systolic BP - Radial","Arterial Diastolic BP - Radial",
"Arterial Systolic BP - Second Line","Arterial Diastolic - Second Line" )
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := last (first i from highValuesList);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> last (first i from highValuesList) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := last (first i from highValuesList);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "Heart Rate" then formattedText1 := formattedText1 || "\b HR:\b0 ";
elseif obsName = "Farenheit" then formattedText1 := formattedText1 || "\b T:\b0 ";
elseif obsName = "Noninvasive Systolic BP" then formattedText1 := formattedText1 || "\b BP:\b0 ";
elseif obsName = "Noninvasive Diastolic BP" then formattedText1 := formattedText1 || "/";
elseif obsName = "Arterial Systolic BP - Radial" then formattedText1 := formattedText1 || "\b ART BP:\b0 ";
elseif obsName = "Arterial Diastolic BP - Radial" then formattedText1 := formattedText1 || "/";
elseif obsName = "Arterial Systolic BP - Second Line" then formattedText1 := formattedText1 || "\b ART BP Second:\b0 ";
elseif obsName = "Arterial Diastolic - Second Line" then formattedText1 := formattedText1 || "/";
elseif obsName = "Resp Rate" then formattedText1 := formattedText1 || "\b R:\b0 ";
elseif obsName = "SCH_vs_pulse ox saturation" then formattedText1 := formattedText1 || "\b Pulse Ox:\b0 ";
elseif obsName = "L/min" then formattedText1 := formattedText1 || "\b O2 L/min:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || last (first i from lastValuesList);
endif; // Obsname amongst the Vital Signs observations
enddo;
formattedText1 := header1 || formattedText1;
// Process the Second Group Data Elements (Start of Chart)
header2 :="\n\n \b Additional Information - Last Charted \b0 \n\n";
formattedText2:= " ";
thisdatefield := " ";
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := last (first i from obsNamesList);
// Reformat the Time Stamp
thisdatefield_unformatted := last (first i from highValuesList);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the second group
if obsName in (
"AS deliv baby a wt gm ob NU" , "AS deliv baby b wt gm ob NU" , "AS deliv baby a wt lb ob NU" , "AS deliv baby b wt lb ob NU" , "AS deliv baby a wt oz ob NU" , "AS deliv baby b wt oz ob NU" ,
"SCH_Newborn Weight - grams","SCH_Newborn Weight - lbs","SCH_Newborn Weight - oz", "Weight - lbs","Weight - kg","First Adult Weight - kg","Height in ft" , "Height remainder in inches" , "Height in cm",
"SCH_vs_Occipital-Frontal Head", "Current Weight","SCH_io_newborn_diaper count - Stool" , "SCH_io_newborn_diaper count - Urine"
)
then
if thisdatefield = " " // first timestamp
then
thisdatefield := last (first i from highValuesList);
formattedText2 := thisdatefield_formatted;
endif;
if thisdatefield <> last (first i from highValuesList) // new timestamp
then
formattedText2 := formattedText2 || "\n" || thisdatefield_formatted;
thisdatefield := last (first i from highValuesList);
else
formattedText2 := formattedText2 || " " ;
endif;
if obsName = "SCH_io_newborn_diaper count - Stool" then formattedText2 := formattedText2 || "\b Stool Diaper:\b0 ";
elseif obsName = "SCH_io_newborn_diaper count - Urine" then formattedText2 := formattedText2 || "\b Urine Diaper:\b0 ";
elseif obsName = "SCH_vs_Occipital-Frontal Head" then formattedText2 := formattedText2 || "\b H.C./cm:\b0 ";
elseif obsName = "Height in cm" then formattedText2 := formattedText2 || "\b Ht/cm:\b0 ";
elseif obsName = "Height in ft" then formattedText2 := formattedText2 || "\b Ht/ft:\b0 ";
elseif obsName = "Height remainder in inches" then formattedText2 := formattedText2 || "-";
elseif obsName = "SCH_Newborn Weight - grams" then formattedText2 := formattedText2 || "\b Wt/gm:\b0 "; curwt:= last (first i from lastValuesList);
elseif obsName = "SCH_Newborn Weight - lbs" then formattedText2 := formattedText2 || "\b Wt/lb:\b0 ";
elseif obsName = "SCH_Newborn Weight - oz" then formattedText2 := formattedText2 || "-";
elseif obsName = "AS deliv baby a wt gm ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/gm:\b0 "; delwt:= last (first i from lastValuesList);
elseif obsName = "AS deliv baby b wt gm ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/gm:\b0 "; delwt:= last (first i from lastValuesList);
elseif obsName = "AS deliv baby a wt lb ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/lb:\b0 ";
elseif obsName = "AS deliv baby a wt oz ob NU" then formattedText2 := formattedText2 || "-";
elseif obsName = "AS deliv baby b wt lb ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/lb:\b0 ";
elseif obsName = "AS deliv baby b wt oz ob NU" then formattedText2 := formattedText2 || "-";
elseif obsName = "Weight - lbs" then formattedText2 := formattedText2 || "\b Wt/lb:\b0 ";
elseif obsName = "Weight - kg" then formattedText2 := formattedText2 || "\b Wt/kg:\b0 "; lastwt := last (first i from lastValuesList);
elseif obsName = "First Adult Weight - kg" then formattedText2 := formattedText2 || "\b First Wt/kg:\b0 "; firstwt:= last (first i from lastValuesList);
endif;
formattedText2 := formattedText2 || " ";
formattedText2 := formattedText2 || last (first i from lastValuesList);
endif; // Obsname amongst the Additional Information observations
enddo;
// Calculate the weight change
If exist delwt // Baby since birth weight
then
wtlabel := "Wt change since birth: \b0 ";
wtscale := " gm ";
wtchange := ((curwt as number) - (delwt as number)) formatted with " %.2f %";
wtchangepcnt := (((curwt as number) - (delwt as number))/(delwt as number) * 100) formatted with " %.2f %%";
else // Adult since first weighing
wtlabel := "Wt change since first weighing: \b0 ";
wtscale := " kg ";
wtchange := ((lastwt as number) - (firstwt as number)) formatted with " %.2f %";
wtchangepcnt := (((lastwt as number) - (firstwt as number)) /(firstwt as number) * 100) formatted with " %.2f %%";
endif;
If wtchange is not null
then
wtchange := " \n\n\b " || wtlabel || wtchange || wtscale || wtchangepcnt ;
else
wtchange := " ";
endif;
formattedText2 := header2 || formattedText2 || wtchange;
formattedTextAll:= formattedText1 || formattedText2;
endif; // Document Open
*/
// Write to the Structured Note Text Box
If formattedTextAll is not null
then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,311 @@
maintenance:
title: DOC_FUNC_Last_24hrs_Ostomy;;
mlmname: DOC_FUNC_Last_24hrs_Ostomy;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Shawn Head;;
specialist: ;;
date: 2014-12-24;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
06.15.2016 STH CSR# 34735 Created to show last 24 hours Ostomy totals from Physician Progress Note. {Go-Live 6/21/2016}
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// OBSERVATION CHANGE
if thisDocumentCommunication.EventType = "ChartObservation"
then
( lastValuesList, highValuesList ) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), value varchar(500), timstmp datetime ) "
|| " INSERT INTO #tmp_aaa (value,timstmp) "
|| " select Sum(Convert(Integer, obsx.OutValue)) as Value , od.RecordedDtm "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " Inner Join CV3ObservationXInfo AS obsx "
|| " ON (obsx.ObservationXInfoGUID = o.GUID AND obsx.ArcType = o.ArcType And obsx.BagVolumeUnit is Not Null ) "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}io_output_colostomy{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_gastrostomy{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_ileostomy{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_jejunostomy{{{SINGLE-QUOTE}}} ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}2. Intake and Output{{{SINGLE-QUOTE}}}) "
|| " Group By od.RecordedDtm "
|| " Order By od.RecordedDtm Desc "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
// || " delete from #tmp_aaa where timstmp2 is not null "
|| " "
|| " select value, timstmp from #tmp_aaa "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Ostomy Output - Observations in Past 24 Hours -All Charted \b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (highValuesList);
for i in indexList do
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
/*if obsName = "SCH_io_Straight Catheter" then formattedText1 := formattedText1 || "\b Straight Cath:\b0 ";
elseif obsName = "SCH_io_Foley Catheter" then formattedText1 := formattedText1 || "\b Foley Cath:\b0 ";
elseif obsName = "io_output_condom_catheter" then formattedText1 := formattedText1 || "\b Condom Cath:\b0 ";
elseif obsName = "io_output_voided" then formattedText1 := formattedText1 || "\b Voided:\b0 ";
elseif obsName = "io_output_nephrostomy" then formattedText1 := formattedText1 || "\b Nephro:\b0 ";
/*elseif obsName = "Noninvasive Mean BP" then formattedText1 := formattedText1 || "\b Mean BP:\b0 ";
elseif obsName = "Noninvasive BP Source 1" then formattedText1 := formattedText1 || "/";
elseif obsName = "SCH_vs_pulse ox saturation" then formattedText1 := formattedText1 || "\b Pulse Ox:\b0 ";
elseif obsName = "SCH_vs_pulse ox source" then formattedText1 := formattedText1 || "/" ; //b O2 L/min:\b0 ";
endif; */
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]) || " ml";
endif; // Obsname amongst the Vital Signs observations
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif;
/* if thisDocumentCommunication.EventType = "ChartObservation"
then
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, Convert(Integer, obsx.OutValue) as Value, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_Straight Catheter{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_Foley Catheter{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}io_output_condom_catheter{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}io_output_voided{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}io_output_nephrostomy{{{SINGLE-QUOTE}}} THEN 05 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " Inner Join CV3ObservationXInfo AS obsx "
|| " ON (obsx.ObservationXInfoGUID = o.GUID AND obsx.ArcType = o.ArcType And obsx.BagVolumeUnit is Not Null ) "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}SCH_io_Foley Catheter{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_condom_catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_io_Straight Catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}io_output_voided{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}io_output_nephrostomy{{{SINGLE-QUOTE}}} ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}2. Intake and Output{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
// || " delete from #tmp_aaa where timstmp2 is not null "
|| " "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Urine Output - Observations in Past 24 Hours -All Charted \b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := (obsNamesList[i]);
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("SCH_io_Foley Catheter","io_output_condom_catheter", "SCH_io_Straight Catheter", "io_output_voided" , "io_output_nephrostomy")
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "SCH_io_Straight Catheter" then formattedText1 := formattedText1 || "\b Straight Cath:\b0 ";
elseif obsName = "SCH_io_Foley Catheter" then formattedText1 := formattedText1 || "\b Foley Cath:\b0 ";
elseif obsName = "io_output_condom_catheter" then formattedText1 := formattedText1 || "\b Condom Cath:\b0 ";
elseif obsName = "io_output_voided" then formattedText1 := formattedText1 || "\b Voided:\b0 ";
elseif obsName = "io_output_nephrostomy" then formattedText1 := formattedText1 || "\b Nephro:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]);
endif; // Obsname amongst the Vital Signs observations
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif; */
// Write to the Structured Note Text Box
If formattedTextAll is not null
then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,312 @@
maintenance:
title: Vital Signs - Highs and Lows;;
mlmname: DOC_FUNC_Last_24hrs_Urine;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Shivprasad Jadhav;;
specialist: Shivprasad Jadhav ;;
date: 2015-01-21;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
20.12.2014 DW CSR# 32476 Created to show last 24 hours Urine observations from Physician Progress Note.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// OBSERVATION CHANGE
if thisDocumentCommunication.EventType = "ChartObservation"
then
( lastValuesList, highValuesList ) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), value varchar(500), timstmp datetime ) "
|| " INSERT INTO #tmp_aaa (value,timstmp) "
|| " select Sum(Convert(Integer, obsx.OutValue)) as Value , od.RecordedDtm "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " Inner Join CV3ObservationXInfo AS obsx "
|| " ON (obsx.ObservationXInfoGUID = o.GUID AND obsx.ArcType = o.ArcType And obsx.BagVolumeUnit is Not Null ) "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}SCH_io_Foley Catheter{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_condom_catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_io_Straight Catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}io_output_voided{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}io_output_nephrostomy{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}SCH_io_Suprapubic Catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_io_Urostomy{{{SINGLE-QUOTE}}} ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}2. Intake and Output{{{SINGLE-QUOTE}}}) "
|| " Group By od.RecordedDtm "
|| " Order By od.RecordedDtm Desc "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
// || " delete from #tmp_aaa where timstmp2 is not null "
|| " "
|| " select value, timstmp from #tmp_aaa "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Urine Output - Observations in Past 24 Hours -All Charted \b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (highValuesList);
for i in indexList do
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
/*if obsName = "SCH_io_Straight Catheter" then formattedText1 := formattedText1 || "\b Straight Cath:\b0 ";
elseif obsName = "SCH_io_Foley Catheter" then formattedText1 := formattedText1 || "\b Foley Cath:\b0 ";
elseif obsName = "io_output_condom_catheter" then formattedText1 := formattedText1 || "\b Condom Cath:\b0 ";
elseif obsName = "io_output_voided" then formattedText1 := formattedText1 || "\b Voided:\b0 ";
elseif obsName = "io_output_nephrostomy" then formattedText1 := formattedText1 || "\b Nephro:\b0 ";
/*elseif obsName = "Noninvasive Mean BP" then formattedText1 := formattedText1 || "\b Mean BP:\b0 ";
elseif obsName = "Noninvasive BP Source 1" then formattedText1 := formattedText1 || "/";
elseif obsName = "SCH_vs_pulse ox saturation" then formattedText1 := formattedText1 || "\b Pulse Ox:\b0 ";
elseif obsName = "SCH_vs_pulse ox source" then formattedText1 := formattedText1 || "/" ; //b O2 L/min:\b0 ";
endif; */
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]) || " ml";
endif; // Obsname amongst the Vital Signs observations
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif;
/* if thisDocumentCommunication.EventType = "ChartObservation"
then
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, Convert(Integer, obsx.OutValue) as Value, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_Straight Catheter{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_Foley Catheter{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}io_output_condom_catheter{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}io_output_voided{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}io_output_nephrostomy{{{SINGLE-QUOTE}}} THEN 05 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " Inner Join CV3ObservationXInfo AS obsx "
|| " ON (obsx.ObservationXInfoGUID = o.GUID AND obsx.ArcType = o.ArcType And obsx.BagVolumeUnit is Not Null ) "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}SCH_io_Foley Catheter{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_condom_catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_io_Straight Catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}io_output_voided{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}io_output_nephrostomy{{{SINGLE-QUOTE}}} ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}2. Intake and Output{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
// || " delete from #tmp_aaa where timstmp2 is not null "
|| " "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Urine Output - Observations in Past 24 Hours -All Charted \b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := (obsNamesList[i]);
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("SCH_io_Foley Catheter","io_output_condom_catheter", "SCH_io_Straight Catheter", "io_output_voided" , "io_output_nephrostomy")
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "SCH_io_Straight Catheter" then formattedText1 := formattedText1 || "\b Straight Cath:\b0 ";
elseif obsName = "SCH_io_Foley Catheter" then formattedText1 := formattedText1 || "\b Foley Cath:\b0 ";
elseif obsName = "io_output_condom_catheter" then formattedText1 := formattedText1 || "\b Condom Cath:\b0 ";
elseif obsName = "io_output_voided" then formattedText1 := formattedText1 || "\b Voided:\b0 ";
elseif obsName = "io_output_nephrostomy" then formattedText1 := formattedText1 || "\b Nephro:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]);
endif; // Obsname amongst the Vital Signs observations
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif; */
// Write to the Structured Note Text Box
If formattedTextAll is not null
then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,160 @@
maintenance:
title: Doc_Func_Launch_Add_CareProviders;;
filename: Doc_Func_Launch_Add_CareProviders;;
arden: version 2;;
version: 1.00;;
institution: Eclipsys Corp;;
author: Eclipsys Corp;;
specialist: Shawn Head;;
date: 2015-11-16;;
validation: testing;;
library:
purpose: This mlm launches the AddCareProviders Objects+ custom application from a document
;;
explanation: The Add Care Providers was designed for use by the Physician Progress Note, but could be useful in other areas of SCM
Change history
10.14.2015 STH CSR#: 33715 - Add care providers {Go-Live 12/10/2015}
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; //used to parse string data into a list
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
using "AddCareProviders";
using namespace "AddProviders";
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Reset the launch button
theParameterx := first of (thisparameters where thisparameters.Name = "SCH_Launch CP Window");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameterx.ParameterGUID);
rtbCommentsParam := first of (thisparameters where thisparameters.Name = "SCH_MDPN_CareProviders");
rtbCommentsObs := first of (thisobservations where thisobservations.ParameterGUID = rtbCommentsParam.ParameterGUID);
//first of (thisparameters where thisparameters.Name = "SCH_MDPN_Other Results");
//rtbCommentsObs := first of (thisobservations where thisobservations.ParameterGUID = rtbCommentsParam.ParameterGUID);
if this_documentCommunication.CurrentObservationObj.parameterguid = theParameterx.ParameterGUID then
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_Launch CP Window");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := false;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
docname := this_documentCommunication.DocumentName as string;
LaunchCP := new net_object {{{SINGLE-QUOTE}}}AddCareProviders.Form1{{{SINGLE-QUOTE}}};
;;
evoke: // No evoke statement
;;
logic:
tstCPLaunch := CALL LaunchCP.ShowDialog;
lstresults := ();
lstitems := ();
lstFromObj := ();
//lstFromObj := LaunchCP.lstProviders4Note;
txtfromobj := LaunchCP.providers4note as string;
lstresults := call str_parse with (txtfromobj,"|");
ctlistitems := count(lstresults);
a := lstresults[0];
b := lstresults[1];
c := lstresults[2];
d := lstresults[3];
finalresults := "";
resultcategory := "";
currentcategory := "";
ccproviders := "";
nonccproviders := "";
sendtonote := "";
for x in (1 seqto count(lstresults)) do
if((trim(lstresults[x]) is not null) and (trim(lstresults[x]) <> "")) then
lstitems := call str_parse with (lstresults[x],"^");
if((trim(lstitems[2]) is not null) and (trim(lstitems[2]) <> "")) then
if((lstitems[1] = "electronic") and (lstitems[4] = "true")) then
sendtonote := " (ELECTRONICALLY SENT TO PHYSICIAN PRACTICE)";
elseif((lstitems[1] = "fax") and (lstitems[4] = "true")) then
sendtonote := " (FAXED DOCUMENT TO " || lstitems[3] || ")";
else
sendtonote := "";
endif;
if(lstitems[4] = "true") then
ccproviders := ccproviders || "\b \li720" || "CC: " || lstitems[2] || "\b0 \i " || sendtonote || "\i0 \n";
else
nonccproviders := nonccproviders || "\b \li720" || lstitems[2] || "\b0 \i " || sendtonote || " \i0 \n";
endif;
endif;
endif;
enddo;
messagefornote := "";
//messagefornote := "\b \ul \li0" || "ADDITIONAL CARE PROVIDERS" || "\b0 \ul0 \n";
if(ccproviders <> "") then
messagefornote := messagefornote || "\n \b \ul \li360 THE FOLLOWING CARE PROVIDERS RECEIVED A COPY OF THIS NOTE \b0 \ul0 \n\n" || ccproviders;
endif;
if(nonccproviders <> "") then
messagefornote := messagefornote || "\n \b \ul \li360 THE FOLLOWING CARE PROVIDERS DID NOT RECEIVE A COPY OF THIS NOTE \b0 \ul0 \n\n" || nonccproviders;
endif;
rtbCommentObj := NEW ObservationType;
rtbCommentObj.ClientdocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
rtbCommentObj.ParameterGUID := rtbCommentsParam.ParameterGUID;
rtbCommentObj.DataType := "FreeTextValue";
rtbCommentObj.ValueObj := NEW FreeTextValueType;
rtbCommentObj.ValueObj.Value := messagefornote;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, rtbCommentObj);
conclude true; // always concludes TRUE
;;
action:
return this_documentCommunication;
;;
end:

View File

@@ -0,0 +1,123 @@
maintenance:
title: Doc_Func_Launch_ExitCare;;
mlmname: Doc_Func_Launch_ExitCare;;
arden: version 2.5;;
version: 5.05;;
institution: St.Clair Hospital;;
author: Peggy Karish;;
specialist: Don Warnick ;;
date: 2013-03-12;;
validation: testing;;
library:
purpose: Standardize the document mlm responsible for initiation.
;;
explanation: none
Change history
03.12.2013 DJW CSR# 31118 Created from a sample MLM shared by Dr. Mansour
07.15.2019 STH CSR# 37676 18.4 Upgrade requires changing "getconnectionstring" to "getsecureconnectionstring".
;;
keywords: RTF, Document Called MLM , list
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
/*******************Make Changes To Spelling And Flags In This Section******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := false;
/* Create variable for tab*/
TAB := 9 formatted with "%c" ;
/***************************************************************************************/
//*** Variable Declaration ***//
(this_structuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(this_parameters) := this_structuredNoteDoc.ParametersList;
(this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList;
(this_authoredDateTime) := this_structuredNoteDoc.AuthoredDateTime ;
(this_authoredByGuid) := this_structuredNoteDoc.AuthoredByGuid ;
(this_Doc_IsNew) := this_structuredNoteDoc.IsNew ;
(this_Doc_IsIncomplete) := this_structuredNoteDoc.IsIncomplete ;
(this_Doc_IsResultsPending) := this_structuredNoteDoc.IsResultsPending ;
(this_Doc_IsPriority) := this_structuredNoteDoc.IsPriority ;
(this_event) := this_documentCommunication.EventType ;
(this_currentObj) := this_documentCommunication.CurrentObservationObj ;
(client_guid) := this_documentCommunication.ClientGUID;
(client_chart_guid) := this_documentCommunication.ChartGUID;
(client_visit_guid) := this_documentCommunication.ClientVisitGUID;
(client_document_guid) := this_documentCommunication.DocumentConfigurationObj.ClientDocumentGUID ;
(this_document_name) := this_documentCommunication.DocumentName ;
(this_parameters_display_name) := this_parameters.DisplayName ;
IF this_event = "ChartObservation" THEN // could be "DocumentOpening", "ChartObservation", OR "DocumentClosing"
current_parameter := FIRST OF (this_Parameters
WHERE this_parameters.ParameterGUID = this_CurrentObj.ParameterGUID);
current_parameter_name := current_parameter.name ;
current_parameter_guid := current_parameter.ParameterGuid ;
current_parameter_DataType := current_parameter.DataType ;
IF current_parameter_DataType IS IN("FreeTextValue","NumericValue","DateValue") THEN
current_value := this_currentObj.ValueObj.value;
ELSEIF current_parameter_DataType = "ListValue" THEN
selectedItems := (this_currentObj.ValueObj.ListItemsList
WHERE this_currentObj.ValueObj.ListItemsList.IsSelected =
true);
currentObj_selectedItems := selectedItems.value ;
countOf_selectedItems := count of currentObj_selectedItems ;
current_value := FIRST OF currentObj_selectedItems ;
ENDIF;
ENDIF;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
Debug:=FALSE;
try
using "SCMLib";
using namespace "SCMLib.HVCLogon";
using "SXA.ED.DischargeInstructions";
using namespace "SXA.ED.DischargeInstructions";
using "SXA.Framework" ;
using Namespace "Eclipsys.SunriseXA.Framework.WinClient" ;
shellinterface := new NET_OBJECT {{{SINGLE-QUOTE}}}XAShellInterface{{{SINGLE-QUOTE}}} ;
shellinterface := new NET_OBJECT {{{SINGLE-QUOTE}}}XAShellInterface{{{SINGLE-QUOTE}}} ;
connstring := call {{{SINGLE-QUOTE}}}HVCLogonObj{{{SINGLE-QUOTE}}}.GetSecureConnectionString;
dis_instr := new NET_OBJECT {{{SINGLE-QUOTE}}}DischargeInstructions{{{SINGLE-QUOTE}}} ;
Exit_Care_Diaglog := call dis_instr.LaunchDischargeInstructions
with (shellinterface, true) ;
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}Cannot start ExitCare Application: {{-R}}\n"
|| ex.Message || "\n\n";
msg := error_message || msg;
if ( dis_instr is NOT NULL ) then
void:= call dis_instr.Dispose;
dis_instr:= null;
endif;
endcatch;
If Debug = TRUE THEN
this_documentCommunication.DisplayMessage := FALSE;
this_documentCommunication.Message := sMessage ;
ENDIF;
;;
evoke:
;;
logic:
conclude true;
;;
action:
return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,529 @@
maintenance:
title: Doc_Func_Launch_Physician_Charge_Builder;;
filename: Doc_Func_Launch_Physician_Charge_Builder;;
arden: version 2;;
version: 1.00;;
institution: Eclipsys Corp;;
author: Eclipsys Corp;;
specialist: Don Warnick;;
date: 2015-03-04;;
validation: testing;;
library:
purpose: This mlm launches the Physician Charge Builder Objects+ custom application from a document
;;
explanation: The Physician Charge Builder was designed for use by the Physician Progress Note, but could be useful in other areas of SCM
Change history
03.04.2015 DW CSR# 32359 - Physician CPT codes - Created
06.22.2015 DW CSR# 32359 - Address the PA / CRNP who enters on behalf of a physician
11.11.2015 DW CSR# 32359 - Change ICD9 to ICD10 (was a meaningless comment until we began electronically filing charges via the interface)
11.13.2015 DW CSR# 33842 - Physician Charging for Specialists
01.14.2015 DW CSR# 32359 - Limit the Problem modifer count to 12.
07.14.2016 DW CSR# 34389 - Adjusted for Nursing Assess.& Disch Summ which is created once per visit. DOS = Today when launched from this document
11.30.2016 DW CSR# 35130 - Upgrade SCM to version 16.3
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
log_execution_info := FALSE;
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
problemlist := " ";
launchtheapp:= "yes";
(thisStructuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
launchtheapp:= "no";
// Only lauch the app on button click or document close (of a new document...not upon modification)
If (this_documentCommunication.EventType = "DocumentClosing" and thisStructuredNoteDoc.ClientDocumentGUID is null) or this_documentCommunication.EventType = "ChartObservation"
then
If this_documentCommunication.EventType = "DocumentClosing"
then
(OccCode, userName) := read last {" select OccupationCode, IDCode from CV3USER with (nolock) where guid = " || sql(this_documentCommunication.UserGUID) };
// if ( OccCode = "IT" AND userName = "jlaw") then
// break;
// endif;
problemlist := "DocumentClose";
// Determine if the HIS Only - Charges Addressed button is selected
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_Charge Addressed");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
If true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Rounding Charges")
then charges_addressed_button_selected := "true";
else charges_addressed_button_selected := "false";
endif;
else
problemlist := "EPNUserLaunch";
endif;
// Proceed if the Rounding Charges Button was selected or the EPN is closing and charging had not been addressed
If (problemlist = "EPNUserLaunch") or (problemlist = "DocumentClose" and charges_addressed_button_selected = "false")
then
// If the document is created one time per visit, use today as the date of service instead of Authored Date
if this_documentCommunication.DocumentName = "Newborn Assessment and Discharge Summary"
then
EPNAuthoredDate:= Substring 10 Characters Starting at 1 from (NOW as string);
else
EPNAuthoredDate:= Substring 10 Characters Starting at 1 from (thisStructuredNoteDoc.AuthoredDateTime as string);
endif;
problemlist := problemlist || EPNAuthoredDate;
launchtheapp:= "yes";
// Gather the problems into a variable to be passed to the Charge Builder App
for i in 1 seqto 12 do
fieldname := "SCH_MDPN_Problem " || i ;
theParameter := first of (thisParameters where thisParameters.Name = fieldname );
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is not null
then
if problemlist = " "
then problemlist := problemlist || thisfield;
else problemlist := problemlist || "#" || thisfield;
endif;
endif;
enddo;
problemlistlen := length (problemlist);
// If problemlist = "EPNUserLaunch" or problemlist = "DocumentClose"
if problemlistlen = 23
then problemlist := problemlist || "#" || "No Problems were documented";
endif;
// Launch the Charge Builder App
using "PhysicianChargeBuilder";
test:= new net_object {{{SINGLE-QUOTE}}}PhysicianChargeBuilder.PhysicianChargeBuilderForm{{{SINGLE-QUOTE}}} with (problemlist);
client_visit_guid := this_documentCommunication.clientvisitguid;
client_guid := this_documentCommunication.clientguid;
chart_guid := this_documentCommunication.chartguid;
user_guid := this_documentCommunication.UserGUID;
document_guid := thisStructuredNoteDoc.ClientDocumentGUID;
user_name := read last {"SET CONCAT_NULL_YIELDS_NULL off SELECT firstname + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + middlename + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + lastname "
|| " FROM CV3User with (nolock) "
|| " WHERE GUID = " || Sql(user_guid)}
;
locationGuid := read last {"SELECT CurrentLocationGUID, touchedWhen"
|| " FROM CV3ClientVisit with (nolock)"
|| " WHERE GUID = " || Sql(client_visit_guid)
|| " AND ClientGUID = " || Sql(client_guid)
, primaryTime = touchedWhen};
// Find the co-signer or authoured by selected by PA{{{SINGLE-QUOTE}}}s/CRNP{{{SINGLE-QUOTE}}}s
if document_guid is not null // is a modified document
then
cosigner,cosignerid := read last {" SET CONCAT_NULL_YIELDS_NULL off select u.LastName + {{{SINGLE-QUOTE}}}^{{{SINGLE-QUOTE}}} + u.FirstName + {{{SINGLE-QUOTE}}}^{{{SINGLE-QUOTE}}} + u.MiddleName, cpid.IDCode "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocProviderXrefCUR cdpxr with (nolock) on cdpxr.ClientDocGUID = cd.GUID "
|| " join CV3CareProvider cp with (nolock) on cp.guid = cdpxr.providerguid "
|| " join CV3CareProviderID cpid with (nolock) on cp.GUID = cpid.ProviderGUID "
|| " join cv3user u with (nolock) on u.guid = cp.GUID "
|| " where cd.guid = " || Sql(document_guid) || " and cdpxr.ProviderGUID <> cd.UserGUID "
|| " and cpid.ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
elseif thisStructuredNoteDoc.Cosigner1GUID is not null // it is a new document with a co-signer
then
cosigner_guid := thisStructuredNoteDoc.Cosigner1GUID;
cosigner,cosignerid := read last {" SET CONCAT_NULL_YIELDS_NULL off select u.LastName + {{{SINGLE-QUOTE}}}^{{{SINGLE-QUOTE}}} + FirstName + {{{SINGLE-QUOTE}}}^{{{SINGLE-QUOTE}}} + u.MiddleName, cpid.IDCode "
|| " from CV3CareProvider cp with (nolock) "
|| " join CV3CareProviderID cpid with (nolock) on cp.GUID = cpid.ProviderGUID "
|| " join cv3user u with (nolock) on u.guid = cp.GUID "
|| " where cp.guid = " || Sql(cosigner_guid) || " and cpid.ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
elseif this_documentCommunication.UserGUID <> thisStructuredNoteDoc.AuthoredByGUID // it is a new document with authoured by selected
then
cosigner_guid := thisStructuredNoteDoc.AuthoredByGUID;
cosigner,cosignerid := read last {" SET CONCAT_NULL_YIELDS_NULL off select u.LastName + {{{SINGLE-QUOTE}}}^{{{SINGLE-QUOTE}}} + FirstName + {{{SINGLE-QUOTE}}}^{{{SINGLE-QUOTE}}} + u.MiddleName, cpid.IDCode "
|| " from CV3CareProvider cp with (nolock) "
|| " join CV3CareProviderID cpid with (nolock) on cp.GUID = cpid.ProviderGUID "
|| " join cv3user u with (nolock) on u.guid = cp.GUID "
|| " where cp.guid = " || Sql(cosigner_guid) || " and cpid.ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"};
endif;
if cosigner is null then cosigner := " "; cosignerid := " "; endif; // set the fields from null to blank
if cosigner <> " " then cosigner := cosignerid || "^" || cosigner; endif; // if something is found concatonat the name with the id
else
launchtheapp:= "no";
endif; // Launch Button was selected or the EPN is closing with charges unaddressed
endif; // this_documentCommunication.EventType = "DocumentClose" or "ChartObservation"
// Reset the launch button
theParameterx := first of (thisparameters where thisparameters.Name = "SCH_MDPN_Launch Charge Entry");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameterx.ParameterGUID);
if this_documentCommunication.CurrentObservationObj.parameterguid = theParameterx.ParameterGUID then
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Launch Charge Entry");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := false;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
;;
evoke: // No evoke statement
;;
logic:
if launchtheapp = "yes"
then
oeUnsigned:=CALL test.ShowDialog;
return_string:= test.text;
// Parse the individual charges
calc_map_list :=(return_string);
itemlist := call str_parse with calc_map_list,"|";
calc_element_list := call str_parse with calc_map_list, "|";
for i in 1 seqto count itemlist do
chargemessage := calc_element_list[i];
chargecomponents := call str_parse with chargemessage, "~";
order_item_name := chargecomponents[1]; // Order
order_item_code := chargecomponents[2]; // Code
charge_date := chargecomponents[3]; // Date
diagnosis_list := chargecomponents[4]; // Diagnosis List
alternate_charge := chargecomponents[5]; // Alternate Charge
referring_physician:= chargecomponents[6]; // Referring Physician
diagnosis_list_caret:= diagnosis_list;
// Called by editor
if called_by_editor
then placeorder := "no"; else placeorder := "yes";
endif;
If placeorder = "yes" then
// Closed the app (no entry)
If order_item_name matches pattern "%Rounding Charge Builder%"
then
xxx:= "User Exited the Form using the Close Control (X button)....do nothing";
// Bypassed Charge
elseif order_item_name = "Bypass charge entry"
then
// Make an AVL entry
zzz:= ((extract year NOW) as string) || ((extract month NOW) as string) || ((extract day NOW) as string) || ((extract hour NOW) as string) || ((extract minute NOW) as string);
zzz:= zzz || client_visit_guid;
bypassdetail := user_guid || "|" || diagnosis_list;
dos:= NOW;
bypassdocument := this_documentCommunication.DocumentName || "-" || this_documentCommunication.DocumentTopic;
try
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((client_visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData with (client_visit_obj, "Physician Encounter Charging Bypassed", zzz) ;
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}} with "BypassedChargesEncounterInformation" , bypassdetail ;
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}} with "BypassedChargesDoctorName" , user_name ;
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<String>{{{SINGLE-QUOTE}}} with "BypassedChargesDocumentName" , bypassdocument ;
void := call advanced_visit_list_data_obj.{{{SINGLE-QUOTE}}}SetValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}} with ("BypassedChargesServiceDate", dos as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}});
void := call advanced_visit_list_data_obj.Save;
endtry;
catch Exception ex
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
endcatch;
// Addressed a Bypassed Charge
elseif order_item_name matches pattern "%Charge entry was bypassed on%"
then
// Delete the Bypass AVL Entry
chargingaddressed := "yes";
discontinue_Comment_GUID := diagnosis_list;
try
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((client_visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
advanced_visit_list_data_obj := call {{{SINGLE-QUOTE}}}AdvancedVisitListData{{{SINGLE-QUOTE}}}.CreateAdvancedVisitListData with (client_visit_obj, "Physician Encounter Charging Bypassed", discontinue_Comment_GUID) ;
void := call advanced_visit_list_data_obj.Deactivate;
void := call advanced_visit_list_data_obj.Purge;
void := call advanced_visit_list_data_obj.Save;
endtry;
catch Exception ex
error_occurred := true; error_message := "{{+R}}Error Message:{{-R}}\n" || ex.Message || "\n\n";
if ( advanced_visit_list_data_obj is NOT NULL ) then void:= call advanced_visit_list_data_obj.Dispose; advanced_visit_list_data_obj:= null; endif;
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
endcatch;
else
// Create a Charge
chargingaddressed := "yes";
try
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((client_visit_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
care_provider_obj:= call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((user_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_catalog_obj:= call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with (order_item_name);
endtry;
catch Exception ex
error_occurred := true;
error_message := "{{+R}}CommonData: {{-R}}\n" || ex.Message || "\n\n";
if order_catalog_obj is NOT Null then void := call order_catalog_obj.Dispose; order_catalog_obj := null; endif;
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;
try
Order_Creation_Reason := "Physician Charge";
RequestingSource := "";
SessionType := "Standard";
SessionReason := "";
Order_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
with client_visit_obj,
order_catalog_obj,
Order_Creation_Reason,
care_provider_obj,
RequestingSource,
SessionType,
SessionReason,
location_obj,
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
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;
diagnosis_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "CHG_MDBill_Dx","ICD10 " || diagnosis_list_caret;
// 35130 Upgrade SCM to version 16.3
// dateofsvc_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}} with "CHG_SVC_DATE",charge_date as time;
dateofsvc_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}} with "CHG_SVC_DATE",(charge_date as time)as{{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}};
conditchg_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "CHG_MDBill_Comment",alternate_charge;
cosigner_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "CHG_Cosigner",cosigner;
referring_val := call Order_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "CHG_MDBill_Referring Physician",referring_physician;
void := call Order_Obj.Save;
if order_catalog_obj IS NOT Null then void := call order_catalog_obj.Dispose; order_catalog_obj := null; endif;
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;
endif; // Comment VS Order creation
endif; // End of Place Order = Yes section
enddo;
if chargingaddressed = "yes"
then
// Select the Charges Addressed Button
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Charge Addressed");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := true;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
endif; // launchtheapp = "yes"
conclude true; // always concludes TRUE
;;
action:
return this_documentCommunication;
;;
end:

View File

@@ -0,0 +1,244 @@
maintenance:
title: Doc_Func_Launch_Progress_Notes_Problem_List_Builder;;
filename: Doc_Func_Launch_Progress_Notes_Problem_List_Builder;;
arden: version 2;;
version: 1.00;;
institution: Eclipsys Corp;;
author: Eclipsys Corp;;
specialist: Don Warnick;;
date: 2012-05-11;;
validation: testing;;
library:
purpose: This mlm launches the Problem List Selector Objects+ custom application from a document.
;;
explanation: The Problem List Selector was designed for use by the Physician Progress Note.
Change history
08.08.2013 DW CSR#31743 Created
01.26.2015 JML CSR# 32617 - Modify Problem List Selector window to combine HI Search with one used for Admit/Discharge Dx
02.24.2015 JML Moved to Production.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication, selectedbutton) := argument;
log_execution_info := FALSE;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
// WriteToNote_MLM := MLM{{{SINGLE-QUOTE}}}Called_RPM_DOM_MLM{{{SINGLE-QUOTE}}};
WriteToNote_MLM := MLM{{{SINGLE-QUOTE}}}STD_DOC_FUNC_CHART_OBSERVATION_HELPER_JAB{{{SINGLE-QUOTE}}};
target_parameter_name := "" ;newValue:= "" ;sugg_txt_value:="";REPLACE_APPEND := "Replace";
// THIS_MLM_NAME:= "Doc_Func_Launch_Progress_Notes_Problem_List_Builder"; //. unsure of the reason for this line, so I commented it out
openfields := "0";
opencounter := 0;
// This section determines which of the fields are vacant
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 1");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_1 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 2");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_2 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 3");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_3 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 4");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_4 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 5");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_5 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 6");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_6 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 7");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_7 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 8");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_8 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 9");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_9 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 10");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_10 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 11");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_11 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 12");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_12 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 13");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_13 := "open"; opencounter := opencounter + 1; endif;
theParameter := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Problem 14");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
thisfield := theObservation.ValueObj.Value;
if thisfield is null then field_14 := "open"; opencounter := opencounter + 1; endif;
openfields := opencounter as string;
//using "ProgressNoteProblemListBuilder";
using "Problem List Selector 1.2";
using namespace "ProblemListBuilder";
test := new net_object {{{SINGLE-QUOTE}}}ProblemListBuilder.ProblemListBuilderForm{{{SINGLE-QUOTE}}} with (openfields);
//using namespace "xxx";
//test:= new net_object {{{SINGLE-QUOTE}}}ProblemListBuilder.ProblemListBuilderForm{{{SINGLE-QUOTE}}} with (openfields);
;;
evoke: // No evoke statement
;;
logic:
oeUnsigned:=CALL test.ShowDialog; // launch as a modal window to enable text to pass back to the MLM
return_string:= test.text; // returns information gathered from the app to the MLM
sugg_txt_value:="";
// This secton parses the data passed from the app (format = "problem|problem|problem" etc..)
calc_map_list :=(return_string);
itemlist := call str_parse with calc_map_list,"|";
calc_element_list := call str_parse with calc_map_list, "|";
problem1 := calc_element_list[1];
problem2 := calc_element_list[2];
problem3 := calc_element_list[3];
problem4 := calc_element_list[4];
problem5 := calc_element_list[5];
problem6 := calc_element_list[6];
problem7 := calc_element_list[7];
problem8 := calc_element_list[8];
problem9 := calc_element_list[9];
problem10:= calc_element_list[10];
problem11:= calc_element_list[11];
problem12:= calc_element_list[12];
problem13:= calc_element_list[13];
problem14:= calc_element_list[14];
// Populate the variable, "prob" with a problem (if it is pass 1, use problem1)
for i in 1 seqto count itemlist do
if i = 1 then prob := problem1;
elseif i = 2 then prob := problem2;
elseif i = 3 then prob := problem3;
elseif i = 4 then prob := problem4;
elseif i = 5 then prob := problem5;
elseif i = 6 then prob := problem6;
elseif i = 7 then prob := problem7;
elseif i = 8 then prob := problem8;
elseif i = 9 then prob := problem9;
elseif i = 10 then prob := problem10;
elseif i = 11 then prob := problem11;
elseif i = 12 then prob := problem12;
elseif i = 13 then prob := problem13;
elseif i = 14 then prob := problem14;
endif;
// Place the problem in the first available text field...and mark it as "occupied"
if field_1 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 1"; field_1 := "occupied";
elseif field_2 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 2"; field_2 := "occupied";
elseif field_3 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 3"; field_3 := "occupied";
elseif field_4 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 4"; field_4 := "occupied";
elseif field_5 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 5"; field_5 := "occupied";
elseif field_6 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 6"; field_6 := "occupied";
elseif field_7 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 7"; field_7 := "occupied";
elseif field_8 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 8"; field_8 := "occupied";
elseif field_9 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 9"; field_9 := "occupied";
elseif field_10 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 10"; field_10 := "occupied";
elseif field_11 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 11"; field_11 := "occupied";
elseif field_12 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 12"; field_12 := "occupied";
elseif field_13 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 13"; field_13 := "occupied";
elseif field_14 = "open" then target_parameter_name1:= "SCH_MDPN_Problem 14"; field_14 := "occupied";
endif;
// Write to the text field
if exist prob and (length of (TRIM prob)) > 1 and prob <> "<<CLICK HERE TO CLOSE WINDOW>>" then
target_parameter_name := target_parameter_name1;
newValue := prob;
REPLACE_APPEND := "Replace";
// this_documentCommunication := CALL WriteToNote_MLM WITH (this_documentCommunication, target_parameter_name,newValue,sugg_txt_value,REPLACE_APPEND);
this_documentCommunication := CALL WriteToNote_MLM WITH (this_documentCommunication, target_parameter_name,newValue,REPLACE_APPEND);
endif;
enddo;
conclude true; // always concludes TRUE
;;
action:
return this_documentCommunication;
;;
end:

View File

@@ -0,0 +1,167 @@
maintenance:
title: Doc_Func_Launch_Results_Quick_Viewer;;
filename: Doc_Func_Launch_Results_Quick_Viewer;;
arden: version 2;;
version: 1.00;;
institution: Eclipsys Corp;;
author: Eclipsys Corp;;
specialist: Don Warnick;;
date: 2012-05-11;;
validation: testing;;
library:
purpose: This mlm launches the Results Quick Viewer Objects+ custom application from a document
;;
explanation: The Results Quick Viewer was designed for use by the Physician Progress Note, but could be useful in other areas of SCM
Change history
05.11.2011 DW Created
10.17.2015 SH CSR#: 33714 - Updating results quickviewer objects plus to allow adding results to the progress notes.
3.2.2016 STH CSR#: 34201 - Update formatting of results as the RTF formatting didnt have a space so when a numeric value followed RTF formatting you would loose both the formatting and the numeric value. {Go-Live 3/16/2016}
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(this_documentCommunication) := argument;
/*******************Make Changes To Spelling And Flags In This Section*******************/
/* Set to true if a decision.log is needed.*/
log_execution_info := FALSE;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; //used to parse string data into a list
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
using "ResultsQuickViewer";
using namespace "ResutlsQuickViewer";
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Reset the launch button
theParameterx := first of (thisparameters where thisparameters.Name = "SCH_Launch FT Window");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameterx.ParameterGUID);
rtbCommentsParam := first of (thisparameters where thisparameters.Name = "SCH_MDPN_Other Results");
rtbCommentsObs := first of (thisobservations where thisobservations.ParameterGUID = rtbCommentsParam.ParameterGUID);
//first of (thisparameters where thisparameters.Name = "SCH_MDPN_Other Results");
//rtbCommentsObs := first of (thisobservations where thisobservations.ParameterGUID = rtbCommentsParam.ParameterGUID);
if this_documentCommunication.CurrentObservationObj.parameterguid = theParameterx.ParameterGUID then
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_Launch FT Window");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
selectedItem.IsSelected := false;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif;
docname := this_documentCommunication.DocumentName as string;
test:= new net_object {{{SINGLE-QUOTE}}}ResultsQuickViewer.ResultsQuickViewerForm{{{SINGLE-QUOTE}}} with (docname);
;;
evoke: // No evoke statement
;;
logic:
lstFromObj := LaunchCP.lstProviders4Note;
oeUnsigned:=CALL test.ShowDialog;
lstFromObj := ();
lstFromObj := test.lstResults4note;
txtfromobj := test.Results4Note as string;
lstresults := call str_parse with (txtfromobj,"|");
ctlistitems := count(lstresults);
a := lstresults[0];
b := lstresults[1];
c := lstresults[2];
d := lstresults[3];
finalresults := "";
resultcategory := "";
currentcategory := "";
for x in (1 seqto (ctlistitems)) do
lstitems := call str_parse with (lstresults[x],"^");
currentcategory := lstitems[2];
if currentcategory <> resultcategory then
if (lstitems is not null and lstitems <> "") then
finalresults := finalresults || "\n____________________________________________________________";
endif;
finalresults := finalresults || "\b \ul \li0 " || lstitems[2] || "\b0 \ul0 \n";
resultcategory := currentcategory;
endif;
if lstitems[1] is not null and lstitems[1] <> "" then
finalresults := finalresults || "\b \li360 " || lstitems[1] || " - " || lstitems[3] || " [" || lstitems[4] || "]" || "\b0 " || "\n" || "\li720 " || (trim left(lstitems[5])) || "\n \li0 ";
if x < ctlistitems then
finalresults := finalresults || "\li360 ------------------------------------------------------------" || "\n \li0 ";
else
finalresults := finalresults || "\n";
endif;
endif;
enddo;
rtbCommentObj := NEW ObservationType;
rtbCommentObj.ClientdocumentGUID := thisStructuredNoteDoc.ClientDocumentGUID;
rtbCommentObj.ParameterGUID := rtbCommentsParam.ParameterGUID;
rtbCommentObj.DataType := "FreeTextValue";
rtbCommentObj.ValueObj := NEW FreeTextValueType;
rtbCommentObj.ValueObj.Value := finalresults;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, rtbCommentObj);
/*
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
*/
conclude true; // always concludes TRUE
;;
action:
return this_documentCommunication;
;;
end:

View File

@@ -0,0 +1,104 @@
maintenance:
title: DOC_FUNC_LAY_CAREGIVER_NAME ;;
mlmname: DOC_FUNC_LAY_CAREGIVER_NAME;;
arden: version 2.5;;
version: 1.00;;
institution: St.Clair Hospital ;;
author: Sandy Zhang, PharmD ;;
specialist: Janet Nordin ;;
date: 2017-06-13;;
validation: testing;;
library:
purpose: This MLM takes the patient{{{SINGLE-QUOTE}}}s Lay Caregiver name and populates it into Discharge Checklist
;;
explanation:
Change History
06.13.2017 SZ CSR# 35709 - Start of project
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Standard includes
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// SQL returns Lay Caregiver{{{SINGLE-QUOTE}}}s name. This name is inserted into discharge checklist unless it matches "NO, CAREGIVER, NO_CAREGIVER or name returns null"
(laygiver_name) := read last {
"select Name"
||" from CV3ClientContact"
||" where TypeCode = {{{SINGLE-QUOTE}}}Lay Caregiver{{{SINGLE-QUOTE}}}"
||" and ClientGUID = " || sql(clientGuid)
||" and Active = 1"
};
if thisdocumentCommunication.EventType = "DocumentOpening" then
// Lay Caregiver name in Discharge Checklist returns N/A if it matches: "NO, CAREGIVER, NO_CAREGIVER or name returns null" from SQL
if (laygiver_name = "NO, CAREGIVER") or (laygiver_name = "NO_CAREGIVER") or (laygiver_name is null) then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_PDC_ Designated Lay Caregiver Name");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := "N/A";
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
// If it doens{{{SINGLE-QUOTE}}}t match up to any of the above no-names then the Discharge Checklist returns the name of the Lay Caregiver
else
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_PDC_ Designated Lay Caregiver Name");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := laygiver_name;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
endif;
;;
priority: 50
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,222 @@
maintenance:
title: DOC_FUNC_Max_Temperature ;;
mlmname: DOC_FUNC_Max_Temperature ;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Shivprasad Jadhav;;
specialist: ;;
date: 2015-04-27;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
27.04.2015 DW CSR:33155- Created to show last 24 hours Max Temperature observations from Physician Progress Note.
14.08.2015 GOS Added document name [{{{SINGLE-QUOTE}}}B1. Newborn Vital Signs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}1. Vital Signs - Critical Care{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}1.Vital Signs - Critical Care{{{SINGLE-QUOTE}}} ]
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
local_session := cds_session.local;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
(this_currentObj) := thisdocumentCommunication.CurrentObservationObj;
comm_obj := thisDocumentCommunication.primaryobj;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
Infectious_Dis := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Grouping Disease");
selectedItems := (this_currentObj.ValueObj.ListItemsList WHERE this_currentObj.ValueObj.ListItemsList.IsSelected = true);
currentObj_selectedItems := selectedItems.value ; //,Infectious Disease
// OBSERVATION CHANGE
if thisDocumentCommunication.EventType = "ChartObservation"
then
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value decimal(5,2), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, o.ValueText, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}} THEN 01 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}}) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}1.Vital Signs - Basic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}B1. Newborn Vital Signs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}1. Vital Signs - Critical Care{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}1.Vital Signs - Critical Care{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
|| " delete from #tmp_aaa where Value is null Delete from #tmp_aaa Where Convert(datetime,timstmp) < dateadd(hour, -24,getdate()) "
|| " "
|| " select Top 1 name, value, timstmp, sortseq from #tmp_aaa Where Value= (Select Max(Value ) From #tmp_aaa ) order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Vital Signs - Max Temperature in Past 24 Hours\b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := (obsNamesList[i]);
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("farenheit" )
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "Farenheit" then formattedText1 := formattedText1 || "\b T:\b0 ";
//elseif obsName = "SCH_vs_pulse ox source" then formattedText1 := formattedText1 || "/" ; //b O2 L/min:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]);
endif; // Obsname amongst the Vital Signs observations
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif;
// for Passing the Value in Base MLm via Session Variable =====
If formattedText1 is Not Null Then
abc:= Call (formattedText1 as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with "T:" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, "" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
Else
abc:= formattedText1 ;
Endif;
local_session.ACS_FormatedText := Null ;
local_session.ACS_FormatedText := " " || abc ;
//End =========================================================
If formattedTextAll is not null
then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
/*for current_item in currentObj_selectedItems do
If current_item ="Infectious Disease" Then
vitalSignsHL1 := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Groupings");
newObservation1 := NEW ObservationType;
newObservation1.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation1.ParameterGUID := vitalSignsHL1.ParameterGUID;
newObservation1.DataType := "FreeTextValue";
newObservation1.ValueObj := NEW FreeTextValueType;
newObservation1.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation1);
Endif;
enddo;*/
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,349 @@
maintenance:
title: DOC_Func_MD_ProgressNote_CoreMeasures ;;
mlmname: DOC_Func_MD_ProgressNote_CoreMeasures ;;
arden: version 2.5;;
version: 5.50;;
institution: St. Clair;;
author: ACS;;
specialist: Allscripts Custom Services;;
date: 2011-09-05;;
validation: testing;;
library:
purpose: Called upon opening of the Physician Progress note to assess compliance with the Core Measures
;;
explanation: This MLM looks at the patient{{{SINGLE-QUOTE}}}s health issues and medictions to determine Core Measure Compliance
Change history
05.08.2012 DW CSR# 26409 - Built from Core Measure code extracted from DOC_ST_Clair_MAIN_PN_MLM
10.24.2013 DW CSR# 31693 - Probiotic Protocol CSR required a change to the Create Order Functional MLM. I now pass session type = "standard"
11.13.2013 DW CSR# 31693 - Pass Order Source Value to Order Creation Functional MLM
;;
keywords:
;;
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_documentCommunication) := argument;
//Initialize Variables and Constants Declaration
(this_structuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj;
(this_parameters) := this_structuredNoteDoc.ParametersList;
(this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList;
(this_currentObj) := this_documentCommunication.CurrentObservationObj;
(client_guid) := this_documentCommunication.ClientGUID;
(client_chart_guid) := this_documentCommunication.ChartGUID;
(client_visit_guid) := this_documentCommunication.ClientVisitGUID;
(client_document_guid) := this_structuredNoteDoc.ClientDocumentGUID ;
(doc_name) := this_documentCommunication.DocumentName ;
(this_parameter_name) := this_parameters.DisplayName ;
(theEvent) :=this_documentCommunication.EventType ;
(this_parameter_nameis) :=this_parameters.Name ;
current_parameter := FIRST OF (this_Parameters WHERE this_parameters.ParameterGUID = this_CurrentObj.ParameterGUID);
current_parameter_name := current_parameter.name ;
current_parameter_guid := current_parameter.ParameterGuid ;
current_parameter_DataType := current_parameter.DataType ;
selectedItems := (this_currentObj.ValueObj.ListItemsList WHERE this_currentObj.ValueObj.ListItemsList.IsSelected = true);
currentObj_selectedItems := selectedItems.value ;
countOf_selectedItems := COUNT OF currentObj_selectedItems ;
DocumentTopic := this_structuredNoteDoc.DocumentTopic;
//List Variables
All_Attributes_Lst:=(); //List object attributes retrieved (“name”, “itemname”, etc.)
All_Values_Lst:=(); //List of values for the attribute(s)
All_UoM_Lst:=(); //List of UOMs (units of measure) for the attributes
All_Med_Rel_Dttm_Lst:=(); //List of medically relevant times /(“performeddtm”,“significantdtm”, etc.)
All_Start_Time_Lst:=(); //List of start times (if relevant)
All_Stop_Time_Lst:=(); //List of stop tiames (if relevant)
All_User_Guid_Lst:=(); //List of userguids who entered data.
All_Significant_Data_Lst:=(); //List of other “significant data” as a text field.
All_Sig_Count_Lst := (); //List of significant counts.
current_item_list := (); // items currently to be processed
//SET THE DEFAULT VALUES of Variables to be passed to ACS_Generic_Lookup MLM
Is_Historical := "Historical" ; //“historical” or “current” (indicates whether to use SQL or current object navigation)
Retreive_Object := ""; //Object to retrieve (“HealthIssue”, “order”, “allergy”, “observation”, etc.)
Retreive_Attribute := ""; //Attribute to retrieve (“name”, “itemname”, etc.)
Filterable_Attribute := ""; //Filterable attribute (“name”,“itemname”,“typecode”, etc.)
Filterable_Operator := ""; //Filterable operator (“=”, “in”, “matches pattern”, etc.)
Filterable_Value :=""; //Filterable value(s) (“chronic”, “antibiotic”, “(480.00,480.30)”, etc.)
Additional_condition := ""; //Additional condition(s) (“orderstatuslevelnum between 55 and 60”, “performedtm > dateadd(-24, hh, getdate()”, etc.)
topic_var:= ""; //this_documentCommunication.DocumentTopic;
msg := ""; //message
Selected_groups := (); // for groupings section, uses the local_config object;
//Tab definitions and formating
TAB := 9 FORMATTED WITH "%C" ;
TAB2 := TAB || TAB ;
TAB3 := TAB || TAB || TAB;
Token:= ""; //Token for deciding which list item is selected
Result_String := ""; //String which is return from this MLM
CR := 13 formatted with "%c";
LF := 10 formatted with "%c";
CRLF:= CR||LF;
SP:= 32 formatted with "%c";
SP2:= SP||SP;
SP3:= SP||SP||SP;
// "hidden" terminator characters for parsing/deleting text:
(blt_char, par_char) := read first{"select char(8), char(20)"};
//********************Lookup Site Specific Configured items***************************//
//Called MLM{{{SINGLE-QUOTE}}}s
Get_mlm_Generic_Lookup_data := MLM {{{SINGLE-QUOTE}}}ACS_Generic_Lookup{{{SINGLE-QUOTE}}};
Called_DOM_mlm := MLM {{{SINGLE-QUOTE}}}STD_DOC_FUNC_CHART_OBSERVATION_HELPER_JAB{{{SINGLE-QUOTE}}};
parse_mlm:= MLM {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
set_contingency_question := mlm {{{SINGLE-QUOTE}}}ACS_obs_select_func_on_lookup{{{SINGLE-QUOTE}}};
create_CHF_order := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_CREATE_ORDER{{{SINGLE-QUOTE}}};
// TOKEN \ RTF FIELD\ THER OR MED SEARCH \ MED SEARH OPERATOR \ MED SEARCH VALUE \ QUALIFYING HIs \ THER SEARCH TYPEs
map_list :=(
"|CM_AMI|\SCH_MDPN_CM AMI FT\TherandMed\like\{{{SINGLE-QUOTE}}}305.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V15.82{{{SINGLE-QUOTE}}}\{{{SINGLE-QUOTE}}}cardiovascular agents | angiotensin converting enzyme inhibitors{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}cardiovascular agents | angiotensin II inhibitors{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}cardiovascular agents | beta-adrenergic blocking agents{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}metabolic agents | antihyperlipidemic agents{{{SINGLE-QUOTE}}}"
,"|cm_vte|\SCH_MDPN_CM VTE FT\MedOnly\like\{{{SINGLE-QUOTE}}}453{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.0{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.2{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.3{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.40{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.41{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.42{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.50{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.51{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.52{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.6{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.71{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.72{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.73{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.74{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.75{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.76{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.77{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.79{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.8{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.81{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.82{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.83{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.84{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.85{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.86{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.87{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.89{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}453.9{{{SINGLE-QUOTE}}}\"
,"|cm_chf|\SCH_MDPN_CM HF FT\TherOnly\\{{{SINGLE-QUOTE}}}428{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.0{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.00{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.20{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.21{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.22{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.23{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.30{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.31{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.32{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.33{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.40{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.41{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.42{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.43{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428.9{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}428@758.5{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}V15.82{{{SINGLE-QUOTE}}}\{{{SINGLE-QUOTE}}}cardiovascular agents | angiotensin converting enzyme inhibitors{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}cardiovascular agents | angiotensin II inhibitors{{{SINGLE-QUOTE}}}"
,"|cm_stroke|\SCH_MDPN_CM Stroke FT\MedOnly\like\{{{SINGLE-QUOTE}}}434.91{{{SINGLE-QUOTE}}}\"
);
if (theEvent = "DocumentOpening") then
(OccCode, userName) := read last {" select OccupationCode, IDCode from CV3USER with (nolock) where guid = " || sql(this_documentCommunication.UserGUID) };
// if ( OccCode = "IT" AND userName = "jlaw" ) then
// break;
// endif;
for i in 1 seqto count map_list do
element_list := call parse_mlm with map_list[i], "\";
Token := element_list[1];
target_parameter_name := element_list[2];
medsearchtype := element_list[3];
add_med_name_operator := element_list[4];
Filterable_Value := element_list[5];
med_ther_cat_filter := element_list[6];
Is_Historical := "Historical";
Retreive_Object := "HealthIssue";
Retreive_Attribute := "hi.shortname";
Filterable_Attribute := "ch.code";
Filterable_Operator := "IN" ;
Additional_condition := "";
Result_String := "";
// Need to update this field afterward as some have values surrounded with double quotes
if Token = "|CM_AMI|" then
add_med_name_filter := "%aspirin%";
endif;
if Token = "|cm_vte|" then
add_med_name_filter := "Heparin", "Coumadin", "Warfarin", "Lovenox","Enoxaparin", "Pradaxa", "Dabigatran", "Argatroban";
endif;
if Token = "|cm_stroke|" then
add_med_name_filter := "Aspirin", "Aggrenox", "Plavix", "Pradaxa", "Jantoven", "Argatroban", "Acuprin", "Ascriptin", "Coumadin", "Lovenox", "Warfarin", "Heparin";
endif;
// clear target area
this_documentCommunication := CALL Called_DOM_Mlm WITH (this_documentCommunication, target_parameter_name, ("","Replace"));
// Get Related Health Issues
ther_cat_not_found := ();
add_meds_not_found := ();
all_not_found := ();
// Call ACS_Generic_Lookup MLM to retrieve patient data
(All_Attributes_Lst, All_Values_Lst, All_UoM_Lst, All_Med_Rel_Dttm_Lst, All_Start_Time_Lst, All_Stop_Time_Lst,
All_User_Guid_Lst, All_Significant_Data_Lst, this_documentCommunication, All_Sig_Count_Lst) := CALL Get_mlm_Generic_Lookup_data WITH
(this_documentCommunication, client_guid, client_visit_guid,client_chart_guid, Is_Historical,Retreive_Object,Retreive_Attribute,
Filterable_Attribute, Filterable_Operator,Filterable_Value, Additional_condition);
// Core Measure Qualifying Health Issues Section
Result_string := Result_String || "\n Core Measure: " || token || "\n\n Related Health Issue: " || All_Attributes_Lst || "\n\n" ; // Core Measure Name & Health Issue
If Exists All_Values_Lst Then
CoreMeasurePatient := "True";
Else CoreMeasurePatient := "False";
endif;
// If Patient qualifies for this Core Measure, look for related medications
If CoreMeasurePatient = "True" then
All_Attributes_Lst := ();
// Check for Core Measure Related Medications by therapeutic class
if medsearchtype = "TherOnly" or medsearchtype = "TherandMed" then
Retreive_Object := "Orders"; //"Therap_Cat_Orders";
Filterable_Attribute := "ocmi.TherapeuticCategory";
Filterable_Operator := "IN" ;
Filterable_Value := med_ther_cat_filter;
Additional_condition := "";
// Call ACS_Generic_Lookup MLM to retrieve patient data
(All_Attributes_Lst, All_Values_Lst, All_UoM_Lst, All_Med_Rel_Dttm_Lst, All_Start_Time_Lst, All_Stop_Time_Lst,
All_User_Guid_Lst, All_Significant_Data_Lst, this_documentCommunication, All_Sig_Count_Lst) := CALL Get_mlm_Generic_Lookup_data WITH
(this_documentCommunication, client_guid, client_visit_guid,client_chart_guid, Is_Historical,Retreive_Object,Retreive_Attribute,
Filterable_Attribute, Filterable_Operator,Filterable_Value, Additional_condition);
// Make the SQL list readable by Arden and compare with returned data
arden_mtcf_parsed := call parse_mlm with med_ther_cat_filter, "{{{SINGLE-QUOTE}}}";
arden_med_ther_cat_filter := arden_mtcf_parsed where (length it > 1);
ther_cat_not_found := arden_med_ther_cat_filter where (it is not in All_UoM_Lst);
//NOTE: Under CHF, {{{SINGLE-QUOTE}}}no{{{SINGLE-QUOTE}}} still checking IF patient has a med
// because ther_cat_not_found is being set to one of two theraputic categories
// when a med from only 1 is required
// If no related medications are found, update the not found field
if exists ther_cat_not_found then
if ((Token = "|CM_CHF|" AND (count ther_cat_not_found > 1)) OR (Token <> "|CM_CHF|")) then
all_not_found := all_not_found, ther_cat_not_found;
endif;
endif;
endif;
// Check for Core Measure Related Medications by indiviual medication name
if medsearchtype = "MedOnly" or medsearchtype = "TherandMed" then
Retreive_Object := "Orders";
Filterable_Attribute := "o.name";
Filterable_Operator := add_med_name_operator ;
Filterable_Value := add_med_name_filter;
Additional_condition := " o.typecode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} ";
// Call ACS_Generic_Lookup MLM to retrieve patient data
(more_Attributes_Lst, more_Values_Lst, more_UoM_Lst, more_Med_Rel_Dttm_Lst, more_Start_Time_Lst, more_Stop_Time_Lst,
more_User_Guid_Lst, more_Significant_Data_Lst, this_documentCommunication) := CALL Get_mlm_Generic_Lookup_data WITH
(this_documentCommunication, client_guid, client_visit_guid, client_chart_guid, Is_Historical, Retreive_Object,
Retreive_Attribute, Filterable_Attribute, Filterable_Operator, Filterable_Value, Additional_condition);
// If no related medications are found, update the not found field
if (not exists more_Attributes_Lst) then
add_meds_not_found := "(ANY)";
all_not_found := all_not_found,add_meds_not_found;
endif;
endif; //exists add_med_name_filter
// Compose the message related to the med being found or not
If ((medsearchtype = "TherOnly" or medsearchtype = "TherandMed") and exists All_Attributes_Lst) OR
((medsearchtype = "MedOnly" or medsearchtype = "TherandMed") and exists more_Attributes_Lst) Then
Result_string := Result_String || All_Attributes_Lst || "\n " || more_Attributes_Lst || " \n\n Medications found - no deficiency";
Else
Result_string := Result_String || " \n\n No Medications related to the Core Measure were found - deficiency";
endif;
// If no medications were found, Call {{{SINGLE-QUOTE}}}ACS_obs_select_func_on_lookup{{{SINGLE-QUOTE}}} to select the appropriate box
if exists all_not_found then
this_documentCommunication := CALL set_contingency_question with (this_documentCommunication, token, all_not_found);
endif;
EndIf;
// Calls the STD_DOC_FUNC_CHART_OBSERVATION_HELPER_JAB which writes data to the note
if Result_String <> "" then
this_documentCommunication:= CALL Called_DOM_Mlm WITH (this_documentCommunication,target_parameter_name,(Result_String,"Append")); //Appending the result with existing value.
endif;
enddo;
elseif (theEvent = "ChartObservation") then
if (current_parameter_name = "SCH_MDPN_CM_HF_Orders ACE") then
SelectedList := OBJECT[ ListGUID, SelectedValues, SuggestiveText ];
PN_sel_list := NEW SelectedList;
newValue := ();
if (countOf_selectedItems > 1) then
for i in 1 seqto countOf_selectedItems do
if (currentObj_selectedItems[i] <> "no") then
//Need to uncheck {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}
newValue := newValue, currentObj_selectedItems[i];
endif;
enddo;
//PN_sel_list.ListGUID := currentObj_ParameterObj.ListGUID;
PN_sel_list.ListGUID := current_parameter.ConfigurationObj.ListGUID;
list_name := current_parameter_name;
PN_sel_list.SelectedValues := newValue;
PN_sel_list.SuggestiveText := null;
if (exists newValue) then
this_documentCommunication := CALL Called_DOM_mlm WITH (this_documentCommunication, list_name, PN_sel_list);
endif;
endif;
endif;
elseif (theEvent = "DocumentClosing") then
(OccCode, userName) := read last {" select OccupationCode, IDCode from CV3USER with (nolock) where guid = " || sql(this_documentCommunication.UserGUID) };
// if ( OccCode = "IT" AND userName = "jlaw" ) then
// break;
// endif;
cm_chf_ace_list := first of (this_parameters WHERE this_parameters.Name = "SCH_MDPN_CM_HF_Orders ACE");
if (exists cm_chf_ace_list) then
cm_chf_ace_list_obs := first of (this_chartedObservationsList
WHERE this_chartedObservationsList.ParameterGUID = cm_chf_ace_list.ParameterGUID);
if (exists cm_chf_ace_list_obs) then
selectedValues := (cm_chf_ace_list_obs.ValueObj.ListItemsList.Value
WHERE cm_chf_ace_list_obs.ValueObj.ListItemsList.IsSelected = true);
if ((count selectedValues) >= 1) then
for i IN 1 seqto (count selectedValues) do
parameter_med := (SUBSTRING (FIND "po" IN STRING LOWERCASE selectedValues[i])-1 CHARACTERS FROM selectedValues[i]);
if (selectedValues[i] matches pattern "%daily%") then
parameter_freq := "Daily (09)";
elseif (selectedValues[i] matches pattern "%BID%") then
parameter_freq := "BID (09-21)";
else
parameter_freq := "Daily (09)";
endif;
genericMedName := read {"SELECT ocmi.Name, ocmi.touchedWhen "
|| " FROM CV3OrderCatalogMasterItem ocmi with (nolock) "
|| " JOIN CV3CatalogItemName cin with (nolock) "
|| " ON ocmi.GUID = cin.OrderMasterItemGUID "
|| " WHERE cin.Name = {{{SINGLE-QUOTE}}}" || parameter_med || "{{{SINGLE-QUOTE}}}"
, primaryTime = touchedWhen};
SessionType := "Standard";
if (exists genericMedName) then
var := call create_CHF_order WITH (client_visit_guid, this_documentCommunication.UserGUID,
client_guid, SessionType,"", genericMedName[1], "-", "Medication", parameter_freq);
endif;
enddo;
endif;
endif;
endif;
//Clear target area
this_documentCommunication := CALL Called_DOM_Mlm WITH (this_documentCommunication, "SCH_MDPN_CM_HF_Orders ACE", ("","Replace"));
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return this_documentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,226 @@
maintenance:
title: MRSA Screening Logic;;
mlmname: DOC_FUNC_MRSA_Screen;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Teresa Spicuzza;;
specialist: ;;
date: 2010-12-21;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
12.21.2010 TS Created
05.04.2011 TS Added logic to check if patient has ever had screen done. If yes, do not order another if
updates made to patient profile.
09.27.2016 TS Eliminate current location of "St. Clair Hospital Anc" from proceeding through logic. Some
outpatient departments are using the Adult Patient Profile and screens are getting ordered
if patient has a history of MRSA. HD Ticket # 2372719
;;
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";
// Receive arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
clientvisitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
todays_date := now;
// Get the current location
CurrentLocation := read last
{"Select CurrentLocation "
||" From cv3Clientvisit "
||" Where Guid = " || SQL(clientvisitguid)
||" and VisitStatus = {{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}}" };
// Chart Observation Section
IF thisdocumentCommunication.EventType is in ("ChartObservation", "DocumentClosing") and CurrentLocation <> "St. Clair Hospital Anc" then
//Obtain data items from standard mlm
MRSA_Rules_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_MRSA_Order{{{SINGLE-QUOTE}}};
(ScreeningUnit, OrderedToday, OrderedWithin3, Positivescreen, SignificantDTM, StatusCode, ResultValue, MRSAHistory, NursingHomeResidency, AntiInfectivewithin7)
:= call MRSA_Rules_MLM with (ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation);
//Obtain Value of Is Patient from Nursing Home from structured note
NursingHome := "";
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_MRSA nursing home");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
If true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
then NursingHome := "yes";
else NursingHome := "no";
endif;
//Set Order Screening Flag if patient meets criteria
formattedTextMRSA := " ";
If (MRSAHistory = "Yes" or NursingHome = "Yes" or ScreeningUnit ="Yes") and StatusCode is null //OrderedWithin3 = "No"
then OrderScreen := "Yes";
formattedTextMRSA := "Patient meets one or more Criteria for MRSA Screening and has not had a Nasal Screen ordered. Order is being placed for Nasal Screen for MRSA.";
endif;
If (MRSAHistory = "Yes" or NursingHome = "Yes" or ScreeningUnit ="Yes") and StatusCode is not null //OrderedWithin3 = "No"
then OrderScreen := "No";
formattedTextMRSA := "Patient meets one or more Criteria for MRSA Screening, but has a Nasal Screen already ordered or resulted.";
endif;
//Set which child order to enter based upon if patient has received antibiotics within 7 days
If AntiInfectivewithin7 = "Yes"
then Catalog_Item_ModifierVar := "MRSA Screen Antibiotics";
else Catalog_Item_ModifierVar := "Ordered Per Protocol";
endif;
//Mark the parameter to order screen based upon Screening Parameters on the structured note
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_MRSA order");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "ListValue";
this_currentObj.ValueObj := New ListValueType;
this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID;
listItems := ();
FOR item IN this_parametername.ConfigurationObj.ListItemsList DO
selectedItem := NEW ListValueListItemType;
selectedItem.ListItemGUID := item.ListItemGUID;
selectedItem.Value := item.Value;
if selectedItem.Value = "yes" and orderscreen = "yes" then selectedItem.IsSelected := true; endif;
if selectedItem.Value = "no" and orderscreen = "no" then selectedItem.IsSelected := true; endif;
listItems := (listItems, selectedItem);
ENDDO;
this_currentobj.ValueObj.ListItemsList := listItems;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the Info box
this_parametername := first of (thisParameters where thisParameters.Name = "SCHCK_MRSA Order Info");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := formattedTextMRSA;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif; //If event is ChartObservation or DocumentClosing
// Document Closing Event
IF thisdocumentCommunication.EventType = "DocumentClosing" and CurrentLocation <> "St. Clair Hospital Anc" then
// Determine if an order is to be placed
/*
theParameter := first of (thisparameters where thisparameters.Name = "SCHCK_MRSA order");
theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "no")
then orderscreen := "no"; endif;
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "yes")
then orderscreen := "yes"; endif;
*/
// Place order for Nasal Screen for MRSA
if OrderScreen = "yes" then
SessionType := "Standard";
SessionReason := "";
RequestingSource := "";
user_IDType := "Edstan Number (physician)";
order_Creation_Reason := "From Protocol";
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((thisdocumentCommunication.ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
user_IDCode := "infectioncontrol";
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) );
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || thisdocumentCommunication.ClientGUID};
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
// Create a new Laboratory order from a Pre-Filled item
try
Catalog_Item_Name := "Nasal Screen for MRSA (Infection Control)";
Catalog_Item_Modifier := Catalog_Item_ModifierVar ;
Catalog_Item_Version := "";
Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with Catalog_Item_Name;
PreFilled_DiagnosticOrder_obj := call {{{SINGLE-QUOTE}}}DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
with
client_visit_obj, // ClientVisit ObjectsPlus object
Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
Catalog_Item_Modifier, // string ItemNameModifier
Catalog_Item_Version, // string ItemNameModifierVersion
order_Creation_Reason, // string CreateReason
RequestingCareProvider_obj , // RequestedBy ObjectsPlus object
RequestingSource, // string RequestedBySource (must be in dictionary)
SessionType, // string SessionType
SessionReason, // string SessionReason
location_obj, // Location ReleaseLocGrpID
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
if ( Laboratory_catalog_item is NOT NULL ) then
void := call PreFilled_DiagnosticOrder_obj.Save;
void := call PreFilled_DiagnosticOrder_obj.Dispose;
void := call Laboratory_catalog_item.Dispose;
Laboratory_catalog_item:= null;
endif;
endtry;
catch Exception ex error_occurred := true; error_message := "{{+R}}New PreFilled Diagnostic order:{{-R}}\n" || ex.Message || "\n\n";
if ( Laboratory_catalog_item is NOT NULL ) then void:= call Laboratory_catalog_item.Dispose; Laboratory_catalog_item:= null; endif;
if ( PreFilled_DiagnosticOrder_obj is NOT NULL ) then void:= call PreFilled_DiagnosticOrder_obj.Dispose; PreFilled_DiagnosticOrder_obj:= null; endif;
PreFilled_DiagnosticOrder_dest := null;
endcatch;
endif; // End of Place order for Nasal Screen for MRSA
endif; // End of Document Closing Event
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,324 @@
maintenance:
title: DOC_FUNC_NEWBORN_ASSESSSMENT;;
mlmname: DOC_FUNC_NEWBORN_ASSESSSMENT;;
arden: version 5.0;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Peggy Karish;;
specialist: Don Warnick ;;
date: 2014-07-30;;
validation: testing;;
library:
purpose:
;;
explanation: This MLM manages will popultate fields on the Newborn Assessment Structured Note
Change history
07.30.2014 DW CSR# 32407 - Created
08.03.2015 GOS CSR#32427 - added code for Vital Sign in Newborn Assessment flowsheet
03.16.2016 DW HD#1681011 - The newborn assessment MLM is not retrieving the Transcutaneous Bilirubin Level into the Newborn Assessment TCB Screen field
;;
keywords:
;;
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";
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
DateValueType := OBJECT [Value];
ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue];
ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
userGuid := thisDocumentCommunication.UserGUID;
// DOCUMENT OPENING SECTION
IF thisdocumentCommunication.EventType = "DocumentOpening"
then
// GATHER DATA
(NewbornData) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), touchedwhen datetime, data varchar(200), latestdate datetime, field int) "
|| " SET CONCAT_NULL_YIELDS_NULL off "
|| " INSERT INTO #tmp_aaa (field,touchedwhen,data) "
|| " select "
|| " case when ocmi.name in "
|| " ( "
|| " {{{SINGLE-QUOTE}}}as deliv vag type ob{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCHCK deliv csect performed{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}INV deliv vag assist type ob{{{SINGLE-QUOTE}}} "
|| " ) "
|| " then 1 "
|| " when ocmi.name in "
|| " ( "
|| " {{{SINGLE-QUOTE}}}PRO blood type routine panel{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}PRO group b strep ob DT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO group b strep ob{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}PRO group a status{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO group b status{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}PRO hbsag routine panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO rubella routine panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO vdrl routine panel{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Pro pos tmt routine panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO vdrl post treat routine panel{{{SINGLE-QUOTE}}} "
|| " ) "
|| " then 2 "
|| " when ocmi.name in "
|| " ( "
|| " {{{SINGLE-QUOTE}}}as deliv baby a time ob DT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}as deliv baby b time ob DT{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a sex ob{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b sex ob{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b wt gm ob NU{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a wt lb ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b wt lb ob CAL{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a wt oz ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b wt oz ob CAL{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a length inch ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b length inch ob CAL{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a length cm ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b length cm ob CAL{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a head circum ob NU{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b head circum ob NU{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a gestational age ob NU{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b gestational age ob NU{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS SC deliv apgar a1 score ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS SC deliv apgar b1 score ob CAL{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS SC deliv apgar a5 score ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS SC deliv apgar b5 score ob CAL{{{SINGLE-QUOTE}}} "
|| " ) "
|| " then 3 "
|| " when ocmi.name in "
|| " ( "
|| " {{{SINGLE-QUOTE}}}SCH_FBC_Init_Pulse Ox_Rt Hand{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_Init_Pulse Ox_Foot{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_Second_Pulse Ox_Rt Hand{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}SCH_FBC_Second_Pulse Ox_Foot{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_CHDS_Init_Pass Fail{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_CHDS_Second_Pass Fail{{{SINGLE-QUOTE}}} "
|| " ) "
|| " then 4 "
|| " when ocmi.name in "
|| " ( "
|| " {{{SINGLE-QUOTE}}}SCH_FBC_Bilimeter_gestational age{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_Bilimeter_Hourly Age{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_Bilimeter_Screen Date Time{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_Bilimeter_TCB Level{{{SINGLE-QUOTE}}}"
|| " ) "
|| " then 5 "
|| " when ocmi.name in "
|| " ( "
|| " {{{SINGLE-QUOTE}}}PRO screen hear result infant{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCHCK rescreen hear result infant{{{SINGLE-QUOTE}}}"
|| " ) "
|| " then 6 "
|| " when ocmi.name in "
|| " ( "
|| " {{{SINGLE-QUOTE}}}PRO feeding plan infant ob{{{SINGLE-QUOTE}}} "
|| " ) "
|| " then 7 "
|| " end , "
|| " cd.entered , CHAR(10) + CHAR(13) + ocmi.LeftJustifiedLabel + {{{SINGLE-QUOTE}}} : {{{SINGLE-QUOTE}}} + o.ValueText + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + fsl.value "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || ClientGuid || " and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || ClientGuid || " ) "
|| " where cd.clientguid = " || ClientGuid || " and cd.ChartGUID = " || ChartGuid || " and cd.ClientVisitGUID= " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.documentname in ({{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}B1. Newborn Vital Signs{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Newborn Hearing Screen{{{SINGLE-QUOTE}}}) "
|| " and (o.ValueText + fsl.value) is not null "
|| " and ocmi.name in "
|| " ( "
|| " {{{SINGLE-QUOTE}}}as deliv vag type ob{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCHCK deliv csect performed{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}INV deliv vag assist type ob{{{SINGLE-QUOTE}}} "
|| " , "
|| " {{{SINGLE-QUOTE}}}PRO blood type routine panel{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}PRO group b strep ob DT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO group b strep ob{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO group a status{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO group b status{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}PRO hbsag routine panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO rubella routine panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO vdrl routine panel{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Pro pos tmt routine panel{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRO vdrl post treat routine panel{{{SINGLE-QUOTE}}} "
|| " , "
|| " {{{SINGLE-QUOTE}}}as deliv baby a time ob DT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}as deliv baby b time ob DT{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a sex ob{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b sex ob{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b wt gm ob NU{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a wt lb ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b wt lb ob CAL{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a wt oz ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b wt oz ob CAL{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a length inch ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b length inch ob CAL{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a length cm ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b length cm ob CAL{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a head circum ob NU{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b head circum ob NU{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a gestational age ob NU{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS deliv baby b gestational age ob NU{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS SC deliv apgar a1 score ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS SC deliv apgar b1 score ob CAL{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS SC deliv apgar a5 score ob CAL{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AS SC deliv apgar b5 score ob CAL{{{SINGLE-QUOTE}}} "
|| " , "
|| " {{{SINGLE-QUOTE}}}SCH_FBC_Init_Pulse Ox_Rt Hand{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_Init_Pulse Ox_Foot{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_Second_Pulse Ox_Rt Hand{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}SCH_FBC_Second_Pulse Ox_Foot{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_CHDS_Init_Pass Fail{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_CHDS_Second_Pass Fail{{{SINGLE-QUOTE}}} "
|| " , "
|| " {{{SINGLE-QUOTE}}}SCH_FBC_Bilimeter_gestational age{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_Bilimeter_Hourly Age{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_Bilimeter_Screen Date Time{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_FBC_Bilimeter_TCB Level{{{SINGLE-QUOTE}}} "
|| " , "
|| " {{{SINGLE-QUOTE}}}PRO screen hear result infant{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCHCK rescreen hear result infant{{{SINGLE-QUOTE}}} "
|| " , "
|| " {{{SINGLE-QUOTE}}}PRO feeding plan infant ob{{{SINGLE-QUOTE}}} "
|| " ) "
|| " order by cd.touchedwhen desc "
|| " select cast (field as varchar) + {{{SINGLE-QUOTE}}}...{{{SINGLE-QUOTE}}} + data from #tmp_aaa order by field "
|| " drop table #tmp_aaa "
};
if exists NewbornData
then
NewbornDataText := " " || NewbornData;
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
calc_map_list := call str_parse with NewbornDataText,",";
TextFormatted1 := ".";
TextFormatted2 := ".";
TextFormatted3 := ".";
TextFormatted4 := ".";
TextFormatted5 := ".";
TextFormatted6 := ".";
TextFormatted7 := ".";
for i in 1 seqto count calc_map_list do
textbox := Substring 1 characters starting at 2 from calc_map_list[i] ;
if textbox = "1" then
TextFormatted1 := TextFormatted1 || (Substring 100 characters starting at 6 from calc_map_list[i]) ;
elseif textbox = "2" then
TextFormatted2 := TextFormatted2 || (Substring 100 characters starting at 6 from calc_map_list[i]) ;
elseif textbox = "3" then
TextFormatted3 := TextFormatted3 || (Substring 100 characters starting at 6 from calc_map_list[i]) ;
elseif textbox = "4" then
TextFormatted4 := TextFormatted4 || (Substring 100 characters starting at 6 from calc_map_list[i]) ;
elseif textbox = "5" then
TextFormatted5 := TextFormatted5 || (Substring 100 characters starting at 6 from calc_map_list[i]) ;
elseif textbox = "6" then
TextFormatted6 := TextFormatted6 || (Substring 100 characters starting at 6 from calc_map_list[i]) ;
elseif textbox = "7" then
TextFormatted7 := TextFormatted7 || (Substring 100 characters starting at 6 from calc_map_list[i]) ;
endif;
enddo;
// POPULATE THE FIELDS WITH THE DATA
// Populate the Delivery Information field
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_NEWBORN_MLM Mom Info");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := TextFormatted1;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the Prenatal Lab Information field
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_NEWBORN_MLM Prenatal Lab Info");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := TextFormatted2;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the Birth Information field
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_NEWBORN_MLM Baby Info");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := TextFormatted3;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the Newborn Screening Information field
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_NEWBORN_MLM Baby Screen Info");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := TextFormatted4;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the Newborn TCB Screening Information field
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_NEWBORN_MLM Baby Screen TcB");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := TextFormatted5;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the Newborn Hearing Screening Information field
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_NEWBORN_MLM Baby Screen Hearing");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := TextFormatted6;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
// Populate the Newborn Feeding Plan Information field
this_parametername := first of (thisParameters where thisParameters.Name = "SCH_NEWBORN_MLM Baby Feeding");
this_currentObj := NEW ObservationType;
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
this_currentObj.DataType := "FreeTextValue";
this_currentObj.ValueObj := New FreeTextValueType;
this_currentObj.ValueObj.Value := TextFormatted7;
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
endif; // Exists NewbornData
//Added below section show data in Vital sign I & O (Vikas) CSR : 33427 - Vital Sign for Newborn Assessment
if thisDocumentCommunication.DocumentName = "Newborn Assessment and Discharge Summary" then
DocVitalsHL2 := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_NEWBORN_VS_24hrs{{{SINGLE-QUOTE}}};
thisDocumentCommunication := CALL DocVitalsHL2 WITH thisDocumentCommunication;
endif;
endif; // EventType = "DocumentOpening"
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,488 @@
maintenance:
title: Vital Signs - Highs and Lows;;
mlmname: DOC_FUNC_Newborn_Last_24hrs;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Vikaskumar Yadav;;
specialist: ;;
date: 2015-06-16;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
Dev 06/16/2015 DW Created to show last 24 hours Vital Sign observations from B1. Newborn Vital Signs.
In Devlopment
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// OBSERVATION CHANGE
if thisDocumentCommunication.EventType = "ChartObservation"
then
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, o.ValueText, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}} THEN 05 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Mean BP{{{SINGLE-QUOTE}}} THEN 06 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive BP Source 1{{{SINGLE-QUOTE}}} THEN 07 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}} THEN 08 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_pulse ox source{{{SINGLE-QUOTE}}} THEN 09 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Mean BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive BP Source 1{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_vs_pulse ox source{{{SINGLE-QUOTE}}} ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}B1. Newborn Vital Signs{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
|| " delete from #tmp_aaa where Value is null "
|| " "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Vital Signs - Basic in Past 24 Hours -All Charted \b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := (obsNamesList[i]);
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("farenheit" , "Heart Rate" , "Resp Rate" , "Noninvasive Diastolic BP" , "Noninvasive Systolic BP" ,
"Noninvasive Mean BP", "Noninvasive BP Source 1", "SCH_vs_pulse ox saturation", "SCH_vs_pulse ox source")
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "Heart Rate" then formattedText1 := formattedText1 || "\b HR:\b0 ";
elseif obsName = "Farenheit" then formattedText1 := formattedText1 || "\b T:\b0 ";
elseif obsName = "Resp Rate" then formattedText1 := formattedText1 || "\b R:\b0 ";
elseif obsName = "Noninvasive Systolic BP" then formattedText1 := formattedText1 || "\b BP:\b0 ";
elseif obsName = "Noninvasive Diastolic BP" then formattedText1 := formattedText1 || "/";
elseif obsName = "Noninvasive Mean BP" then formattedText1 := formattedText1 || "\b Mean BP:\b0 ";
elseif obsName = "Noninvasive BP Source 1" then formattedText1 := formattedText1 || "/";
elseif obsName = "SCH_vs_pulse ox saturation" then formattedText1 := formattedText1 || "\b Pulse Ox:\b0 ";
//elseif obsName = "SCH_vs_pulse ox source" then formattedText1 := formattedText1 || "/" ; //b O2 L/min:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]);
endif; // Obsname amongst the Vital Signs observations
// for Urine
// SCH_io_Foley Catheter, io_output_condom_catheter, SCH_io_Straight Catheter
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif;
// DOCUMENT OPEN
/*
if thisdocumentCommunication.EventType = "DocumentOpening"
then
// Query the database for the vitals info
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, o.ValueText, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}Farenheit{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}} THEN 05 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Systolic BP - Radial{{{SINGLE-QUOTE}}} THEN 06 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Diastolic BP - Radial{{{SINGLE-QUOTE}}} THEN 07 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Systolic BP - Second Line{{{SINGLE-QUOTE}}} THEN 08 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Diastolic - Second Line{{{SINGLE-QUOTE}}} THEN 09 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}} THEN 10 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}L/min{{{SINGLE-QUOTE}}} THEN 11 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height in cm{{{SINGLE-QUOTE}}} THEN 20 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height in ft{{{SINGLE-QUOTE}}} THEN 21 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height remainder in inches{{{SINGLE-QUOTE}}} THEN 22 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}} THEN 23 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt gm ob NU{{{SINGLE-QUOTE}}} THEN 24 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt lb ob NU{{{SINGLE-QUOTE}}} THEN 25 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt oz ob NU{{{SINGLE-QUOTE}}} THEN 26 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt lb ob NU{{{SINGLE-QUOTE}}} THEN 27 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt oz ob NU{{{SINGLE-QUOTE}}} THEN 28 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - grams{{{SINGLE-QUOTE}}} THEN 29 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - lbs{{{SINGLE-QUOTE}}} THEN 40 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - oz{{{SINGLE-QUOTE}}} THEN 41 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Weight - lbs{{{SINGLE-QUOTE}}} THEN 42 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}} THEN 43 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_Occipital-Frontal Head{{{SINGLE-QUOTE}}} THEN 44 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Stool{{{SINGLE-QUOTE}}}THEN 45 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Urine{{{SINGLE-QUOTE}}}THEN 46 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ( "
|| " {{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}L/min{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Systolic BP - Radial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Diastolic BP - Radial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Systolic BP - Second Line{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Arterial Diastolic - Second Line{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby b wt gm ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby a wt lb ob NU{{{SINGLE-QUOTE}}} , "
|| " {{{SINGLE-QUOTE}}}AS deliv baby b wt lb ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby a wt oz ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby b wt oz ob NU{{{SINGLE-QUOTE}}} , "
|| " {{{SINGLE-QUOTE}}}SCH_Newborn Weight - grams{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Newborn Weight - lbs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Newborn Weight - oz{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Weight - lbs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Height in ft{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Height remainder in inches{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Height in cm{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_vs_Occipital-Frontal Head{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Current Weight{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Stool{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Urine{{{SINGLE-QUOTE}}} "
|| " ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}B1. Newborn Vital Signs{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}B2. Newborn Assessment/Intervention{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}1.Vital Signs - Basic{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}1.Vital Signs - Critical Care{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
|| " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
|| " update t2 set timstmp2 = {{{SINGLE-QUOTE}}}first weight{{{SINGLE-QUOTE}}}, name = {{{SINGLE-QUOTE}}}First Adult Weight - kg{{{SINGLE-QUOTE}}} from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq <> t2.sortseq and t2.name = {{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}} "
|| " delete from #tmp_aaa where timstmp2 is not null and timstmp2 <> {{{SINGLE-QUOTE}}}first weight{{{SINGLE-QUOTE}}} "
|| " "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// Process the First Group Data Elements (past 24 hours)
header1 :="\b Vital Signs in Past 24 Hours - Last Charted \b0\n\n";
formattedText1:= " ";
thisdatefield := " ";
yesterday:= now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := last (first i from obsNamesList);
// Reformat the Time Stamp
thisdatefield_unformatted := last (first i from highValuesList);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("farenheit","Heart Rate","Resp Rate","SCH_vs_pulse ox saturation","L/min",
"Noninvasive Diastolic BP","Noninvasive Systolic BP","Arterial Systolic BP - Radial","Arterial Diastolic BP - Radial",
"Arterial Systolic BP - Second Line","Arterial Diastolic - Second Line" )
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := last (first i from highValuesList);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> last (first i from highValuesList) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := last (first i from highValuesList);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "Heart Rate" then formattedText1 := formattedText1 || "\b HR:\b0 ";
elseif obsName = "Farenheit" then formattedText1 := formattedText1 || "\b T:\b0 ";
elseif obsName = "Noninvasive Systolic BP" then formattedText1 := formattedText1 || "\b BP:\b0 ";
elseif obsName = "Noninvasive Diastolic BP" then formattedText1 := formattedText1 || "/";
elseif obsName = "Arterial Systolic BP - Radial" then formattedText1 := formattedText1 || "\b ART BP:\b0 ";
elseif obsName = "Arterial Diastolic BP - Radial" then formattedText1 := formattedText1 || "/";
elseif obsName = "Arterial Systolic BP - Second Line" then formattedText1 := formattedText1 || "\b ART BP Second:\b0 ";
elseif obsName = "Arterial Diastolic - Second Line" then formattedText1 := formattedText1 || "/";
elseif obsName = "Resp Rate" then formattedText1 := formattedText1 || "\b R:\b0 ";
elseif obsName = "SCH_vs_pulse ox saturation" then formattedText1 := formattedText1 || "\b Pulse Ox:\b0 ";
elseif obsName = "L/min" then formattedText1 := formattedText1 || "\b O2 L/min:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || last (first i from lastValuesList);
endif; // Obsname amongst the Vital Signs observations
enddo;
formattedText1 := header1 || formattedText1;
// Process the Second Group Data Elements (Start of Chart)
header2 :="\n\n \b Additional Information - Last Charted \b0 \n\n";
formattedText2:= " ";
thisdatefield := " ";
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := last (first i from obsNamesList);
// Reformat the Time Stamp
thisdatefield_unformatted := last (first i from highValuesList);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the second group
if obsName in (
"AS deliv baby a wt gm ob NU" , "AS deliv baby b wt gm ob NU" , "AS deliv baby a wt lb ob NU" , "AS deliv baby b wt lb ob NU" , "AS deliv baby a wt oz ob NU" , "AS deliv baby b wt oz ob NU" ,
"SCH_Newborn Weight - grams","SCH_Newborn Weight - lbs","SCH_Newborn Weight - oz", "Weight - lbs","Weight - kg","First Adult Weight - kg","Height in ft" , "Height remainder in inches" , "Height in cm",
"SCH_vs_Occipital-Frontal Head", "Current Weight","SCH_io_newborn_diaper count - Stool" , "SCH_io_newborn_diaper count - Urine"
)
then
if thisdatefield = " " // first timestamp
then
thisdatefield := last (first i from highValuesList);
formattedText2 := thisdatefield_formatted;
endif;
if thisdatefield <> last (first i from highValuesList) // new timestamp
then
formattedText2 := formattedText2 || "\n" || thisdatefield_formatted;
thisdatefield := last (first i from highValuesList);
else
formattedText2 := formattedText2 || " " ;
endif;
if obsName = "SCH_io_newborn_diaper count - Stool" then formattedText2 := formattedText2 || "\b Stool Diaper:\b0 ";
elseif obsName = "SCH_io_newborn_diaper count - Urine" then formattedText2 := formattedText2 || "\b Urine Diaper:\b0 ";
elseif obsName = "SCH_vs_Occipital-Frontal Head" then formattedText2 := formattedText2 || "\b H.C./cm:\b0 ";
elseif obsName = "Height in cm" then formattedText2 := formattedText2 || "\b Ht/cm:\b0 ";
elseif obsName = "Height in ft" then formattedText2 := formattedText2 || "\b Ht/ft:\b0 ";
elseif obsName = "Height remainder in inches" then formattedText2 := formattedText2 || "-";
elseif obsName = "SCH_Newborn Weight - grams" then formattedText2 := formattedText2 || "\b Wt/gm:\b0 "; curwt:= last (first i from lastValuesList);
elseif obsName = "SCH_Newborn Weight - lbs" then formattedText2 := formattedText2 || "\b Wt/lb:\b0 ";
elseif obsName = "SCH_Newborn Weight - oz" then formattedText2 := formattedText2 || "-";
elseif obsName = "AS deliv baby a wt gm ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/gm:\b0 "; delwt:= last (first i from lastValuesList);
elseif obsName = "AS deliv baby b wt gm ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/gm:\b0 "; delwt:= last (first i from lastValuesList);
elseif obsName = "AS deliv baby a wt lb ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/lb:\b0 ";
elseif obsName = "AS deliv baby a wt oz ob NU" then formattedText2 := formattedText2 || "-";
elseif obsName = "AS deliv baby b wt lb ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/lb:\b0 ";
elseif obsName = "AS deliv baby b wt oz ob NU" then formattedText2 := formattedText2 || "-";
elseif obsName = "Weight - lbs" then formattedText2 := formattedText2 || "\b Wt/lb:\b0 ";
elseif obsName = "Weight - kg" then formattedText2 := formattedText2 || "\b Wt/kg:\b0 "; lastwt := last (first i from lastValuesList);
elseif obsName = "First Adult Weight - kg" then formattedText2 := formattedText2 || "\b First Wt/kg:\b0 "; firstwt:= last (first i from lastValuesList);
endif;
formattedText2 := formattedText2 || " ";
formattedText2 := formattedText2 || last (first i from lastValuesList);
endif; // Obsname amongst the Additional Information observations
enddo;
// Calculate the weight change
If exist delwt // Baby since birth weight
then
wtlabel := "Wt change since birth: \b0 ";
wtscale := " gm ";
wtchange := ((curwt as number) - (delwt as number)) formatted with " %.2f %";
wtchangepcnt := (((curwt as number) - (delwt as number))/(delwt as number) * 100) formatted with " %.2f %%";
else // Adult since first weighing
wtlabel := "Wt change since first weighing: \b0 ";
wtscale := " kg ";
wtchange := ((lastwt as number) - (firstwt as number)) formatted with " %.2f %";
wtchangepcnt := (((lastwt as number) - (firstwt as number)) /(firstwt as number) * 100) formatted with " %.2f %%";
endif;
If wtchange is not null
then
wtchange := " \n\n\b " || wtlabel || wtchange || wtscale || wtchangepcnt ;
else
wtchange := " ";
endif;
formattedText2 := header2 || formattedText2 || wtchange;
formattedTextAll:= formattedText1 || formattedText2;
endif; // Document Open
*/
// Write to the Structured Note Text Box
If formattedTextAll is not null
then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,315 @@
maintenance:
title: DOC_FUNC_Last_24hrs_Ostomy;;
mlmname: DOC_FUNC_Newborn_Last_24hrs_Ostomy;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Shawn Head;;
specialist: ;;
date: 2016-06-16;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
06.15.2016 STH CSR# 34735 Created to show last 24 hours Ostomy observations from B2. Newborn Intake and Output. {Go-Live 6/21/2016}
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// OBSERVATION CHANGE
if thisDocumentCommunication.EventType = "ChartObservation"
then
( lastValuesList, highValuesList ) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), value varchar(500), timstmp datetime ) "
|| " INSERT INTO #tmp_aaa (value,timstmp) "
|| " select Sum(Convert(Integer, obsx.OutValue)) + sum(convert(integer,o.ValueText)) as Value , od.RecordedDtm "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " left Join CV3ObservationXInfo AS obsx "
|| " ON (obsx.ObservationXInfoGUID = o.GUID AND obsx.ArcType = o.ArcType And obsx.BagVolumeUnit is Not Null ) "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}io_output_colostomy{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_gastrostomy{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_ileostomy{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_jejunostomy{{{SINGLE-QUOTE}}} ) "
|| " and (obsx.OutValue is not null or o.ValueText is not null) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}B2. Newborn Intake and Output{{{SINGLE-QUOTE}}})"
|| " Group By od.RecordedDtm "
|| " Order By od.RecordedDtm Desc "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
// || " delete from #tmp_aaa where timstmp2 is not null "
|| " "
|| " select value, timstmp from #tmp_aaa "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Ostomy Output - Observations in Past 24 Hours -All Charted \b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (highValuesList);
for i in indexList do
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
/*if obsName = "SCH_io_Straight Catheter" then formattedText1 := formattedText1 || "\b Straight Cath:\b0 ";
elseif obsName = "SCH_io_Foley Catheter" then formattedText1 := formattedText1 || "\b Foley Cath:\b0 ";
elseif obsName = "io_output_condom_catheter" then formattedText1 := formattedText1 || "\b Condom Cath:\b0 ";
elseif obsName = "io_output_voided" then formattedText1 := formattedText1 || "\b Voided:\b0 ";
elseif obsName = "io_output_nephrostomy" then formattedText1 := formattedText1 || "\b Nephro:\b0 ";
/*elseif obsName = "Noninvasive Mean BP" then formattedText1 := formattedText1 || "\b Mean BP:\b0 ";
elseif obsName = "Noninvasive BP Source 1" then formattedText1 := formattedText1 || "/";
elseif obsName = "SCH_vs_pulse ox saturation" then formattedText1 := formattedText1 || "\b Pulse Ox:\b0 ";
elseif obsName = "SCH_vs_pulse ox source" then formattedText1 := formattedText1 || "/" ; //b O2 L/min:\b0 ";
endif; */
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]) || " ml";
endif; // Obsname amongst the Vital Signs observations
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif;
/* if thisDocumentCommunication.EventType = "ChartObservation"
then
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, Convert(Integer, obsx.OutValue) as Value, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_Straight Catheter{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_Foley Catheter{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}io_output_condom_catheter{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}io_output_voided{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}io_output_nephrostomy{{{SINGLE-QUOTE}}} THEN 05 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " Inner Join CV3ObservationXInfo AS obsx "
|| " ON (obsx.ObservationXInfoGUID = o.GUID AND obsx.ArcType = o.ArcType And obsx.BagVolumeUnit is Not Null ) "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}SCH_io_Foley Catheter{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_condom_catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_io_Straight Catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}io_output_voided{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}io_output_nephrostomy{{{SINGLE-QUOTE}}} ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}2. Intake and Output{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
// || " delete from #tmp_aaa where timstmp2 is not null "
|| " "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Urine Output - Observations in Past 24 Hours -All Charted \b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := (obsNamesList[i]);
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("SCH_io_Foley Catheter","io_output_condom_catheter", "SCH_io_Straight Catheter", "io_output_voided" , "io_output_nephrostomy")
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "SCH_io_Straight Catheter" then formattedText1 := formattedText1 || "\b Straight Cath:\b0 ";
elseif obsName = "SCH_io_Foley Catheter" then formattedText1 := formattedText1 || "\b Foley Cath:\b0 ";
elseif obsName = "io_output_condom_catheter" then formattedText1 := formattedText1 || "\b Condom Cath:\b0 ";
elseif obsName = "io_output_voided" then formattedText1 := formattedText1 || "\b Voided:\b0 ";
elseif obsName = "io_output_nephrostomy" then formattedText1 := formattedText1 || "\b Nephro:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]);
endif; // Obsname amongst the Vital Signs observations
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif; */
// Write to the Structured Note Text Box
If formattedTextAll is not null
then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,268 @@
maintenance:
title: DOC_FUNC_Last_24hrs_Urine;;
mlmname: DOC_FUNC_Newborn_Last_24hrs_Urine;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Vikaskumar Yadav;;
specialist: ;;
date: 2016-06-16;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
16.06.2015 - VY CSR# 32476 Created to show last 24 hours Urine observations from B2. Newborn Intake and Output.
11/26/2018 - DJW HD# 2481782 - Newborn Urine issue (ML was being added to diaper count)
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// OBSERVATION CHANGE
if thisDocumentCommunication.EventType = "ChartObservation"
then
// I&O Section
( lastValuesList, highValuesList ) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), value varchar(500), timstmp datetime ) "
|| " INSERT INTO #tmp_aaa (value,timstmp) "
|| " select Sum(Convert(Integer, obsx.OutValue)) as Value , od.RecordedDtm "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " left Join CV3ObservationXInfo AS obsx "
|| " ON (obsx.ObservationXInfoGUID = o.GUID AND obsx.ArcType = o.ArcType And obsx.BagVolumeUnit is Not Null ) "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}SCH_io_Foley Catheter{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}io_output_condom_catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_io_Straight Catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}io_output_voided{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}io_output_nephrostomy{{{SINGLE-QUOTE}}} ,{{{SINGLE-QUOTE}}}SCH_io_Suprapubic Catheter{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_io_Urostomy{{{SINGLE-QUOTE}}} ) "
|| " and (obsx.OutValue is not null or o.ValueText is not null) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}B2. Newborn Intake and Output{{{SINGLE-QUOTE}}})"
|| " Group By od.RecordedDtm "
|| " Order By od.RecordedDtm Desc "
|| " "
|| " "
|| " select value, timstmp from #tmp_aaa "
|| " drop table #tmp_aaa "
};
header1 :="\n\n\b Urine Output - Observations in Past 24 Hours -All Charted \b0\n\n";
formattedText1 := "";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (highValuesList);
for i in indexList do
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted || " ";
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]) || " ml";
endif; // Obsname amongst the Vital Signs observations
enddo;
// Diaper Count Section (DW 11/26/2018 - HD# 2481782 - Newborn Urine)
( lastValuesList, highValuesList ) := read
{ "
select obsparam.ValueText , obsparam.RecordedDtm
from CV3ObsCatalogMasterItem ocmi with (nolock)
inner join SXACDObservationParameter obsparam with (nolock) on obsparam.ClientGUID = " || clientGuid || " and obsparam.ClientVisitGUID = " || visitGuid || " and obsparam.ChartGUID = " || chartGuid || " and obsparam.ObsMasterItemGUID = ocmi.GUID
join CV3Flowsheet fs with (nolock) on fs.GUID = obsparam.FlowsheetGUID
where ocmi.name = {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Urine{{{SINGLE-QUOTE}}} and fs.name = {{{SINGLE-QUOTE}}}SCH_Intake and Output_Newborn Version{{{SINGLE-QUOTE}}} and obsparam.IsCanceled = 0 and obsparam.ValueText is not null
order by obsparam.RecordedDtm desc "
};
if exists lastValuesList
then
if formattedText1 <> "" then formattedText1 := formattedText1 || "\n\n"; endif; // add extra spaces after the ML section
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (highValuesList);
for i in indexList do
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := formattedText1 || thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted || " ";
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]) || " Diaper(s)";
endif; // Obsname amongst the Vital Signs observations
enddo;
endif; // Diaper Count Found ?
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif; // Charted Observation ?
// Write to the Structured Note Text Box
If formattedTextAll is not null
then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,225 @@
maintenance:
title: DOC_FUNC_Max_Temperature ;;
mlmname: DOC_FUNC_Newborn_Max_Temperature ;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Vikaskumar Yadav;;
specialist: Shivprasad Jadhav ;;
date: 2015-06-16;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
Dev 16.06.2015 DW CSR:33155- Created to show last 24 hours Max Temperature observations from B1. Newborn Vital Signs.
In Development
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
local_session := cds_session.local;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
(this_currentObj) := thisdocumentCommunication.CurrentObservationObj;
comm_obj := thisDocumentCommunication.primaryobj;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
Infectious_Dis := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Grouping Disease");
selectedItems := (this_currentObj.ValueObj.ListItemsList WHERE this_currentObj.ValueObj.ListItemsList.IsSelected = true);
currentObj_selectedItems := selectedItems.value ; //,Infectious Disease
// OBSERVATION CHANGE
if thisDocumentCommunication.EventType = "ChartObservation"
then
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value decimal(5,2), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, o.ValueText, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}} THEN 01 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}}) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}B1. Newborn Vital Signs{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
// || " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
// || " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
|| " delete from #tmp_aaa where Value is null Delete from #tmp_aaa Where Convert(datetime,timstmp) < dateadd(hour, -24,getdate()) "
|| " "
|| " select Top 1 name, value, timstmp, sortseq from #tmp_aaa Where Value= (Select Max(Value ) From #tmp_aaa ) order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
// update #tmp_aaa Set #tmp_aaa.timstmp = Dateadd(hour, -4, Getdate())
header1 :="\n\n\b Vital Signs - Max Temperature in Past 24 Hours\b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := (obsNamesList[i]);
// Reformat the Time Stamp
thisdatefield_unformatted := (highValuesList[i]);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("farenheit" )
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := (highValuesList[i]);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> (highValuesList[i]) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := (highValuesList[i]);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "Farenheit" then formattedText1 := formattedText1 || "\b T:\b0 ";
//elseif obsName = "SCH_vs_pulse ox source" then formattedText1 := formattedText1 || "/" ; //b O2 L/min:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || (lastValuesList[i]);
endif; // Obsname amongst the Vital Signs observations
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif;
// for Passing the Value in Base MLm via Session Variable =====
If formattedText1 is Not Null Then
abc:= Call (formattedText1 as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with "T:" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, "" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
Else
abc:= formattedText1 ;
Endif;
local_session.ACS_FormatedText := " " || abc ;
//End =========================================================
If formattedTextAll is not null
then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
/*for current_item in currentObj_selectedItems do
If current_item ="Infectious Disease" Then
vitalSignsHL1 := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Groupings");
newObservation1 := NEW ObservationType;
newObservation1.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation1.ParameterGUID := vitalSignsHL1.ParameterGUID;
newObservation1.DataType := "FreeTextValue";
newObservation1.ValueObj := NEW FreeTextValueType;
newObservation1.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation1);
Endif;
enddo;*/
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

View File

@@ -0,0 +1,523 @@
maintenance:
title: Vital Signs - Highs and Lows;;
mlmname: DOC_FUNC_NewBorn_VS_24hrs;;
arden: version 4.5;;
version: 2.00;;
institution: St.Clair Hospital;;
author: Vikaskumar Yadav;;
specialist: ;;
date: 2015-06-16;;
validation: testing;;
library:
purpose:
;;
explanation:
Change history
06-16-2015 - VY Created MLM to pull the data of all the vital signs charted on the patient in last 24 hours from the "B1. Newborn Vital Signs " flowsheet.
10.26.2015 SJ
01.03.2017 DW HD# 2469756 - Upgrade SCM to version 16.3 uncovered an issue with missing ounces
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
// Recieve arguments from the structured note
(thisDocumentCommunication) := argument;
// Extract interesting parts of the object model
(thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj;
(thisParameters) := thisStructuredNoteDoc.ParametersList;
(thisObservations) := thisStructuredNoteDoc.ChartedObservationsList;
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
FreeTextValueType := OBJECT [Value];
// Get the client and visit GUIDs
clientGuid := thisDocumentCommunication.ClientGUID;
visitGuid := thisDocumentCommunication.ClientVisitGUID;
chartGuid := thisDocumentCommunication.ChartGUID;
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
using "ObjectsPlusXA.SCM.Forms";
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
// OBSERVATION CHANGE
if thisDocumentCommunication.EventType = "ChartObservation"
then
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, o.ValueText, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}Supine Systolic BP{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Supine Diastolic BP{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Sitting Systolic BP{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Sitting Diastolic BP{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Standing Systolic BP{{{SINGLE-QUOTE}}} THEN 05 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Standing Diastolic BP{{{SINGLE-QUOTE}}} THEN 06 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - supine{{{SINGLE-QUOTE}}} THEN 07 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - sitting{{{SINGLE-QUOTE}}} THEN 08 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - standing{{{SINGLE-QUOTE}}} THEN 09 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ({{{SINGLE-QUOTE}}}Supine Systolic BP{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Supine Diastolic BP{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Sitting Systolic BP{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Sitting Diastolic BP{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Standing Systolic BP{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Standing Diastolic BP{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - supine{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - sitting{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}sch_orthostatic heart rate - standing{{{SINGLE-QUOTE}}} ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}B1. Newborn Vital Signs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
|| " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
|| " delete from #tmp_aaa where timstmp2 is not null "
|| " "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
header1 :="\n\n\b Orthostatic Vital Signs in Past 24 Hours - Last Charted \b0\n\n";
formattedText1 := " ";
thisdatefield := " ";
yesterday := now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := last (first i from obsNamesList);
// Reformat the Time Stamp
thisdatefield_unformatted := last (first i from highValuesList);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
if obsName in ("Supine Systolic BP" , "Supine Diastolic BP" , "Sitting Systolic BP" , "Sitting Diastolic BP" , "Standing Systolic BP" , "Standing Diastolic BP","sch_orthostatic heart rate - supine",
"sch_orthostatic heart rate - sitting","sch_orthostatic heart rate - standing" )
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := last (first i from highValuesList);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> last (first i from highValuesList) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := last (first i from highValuesList);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "Supine Systolic BP" then formattedText1 := formattedText1 || "\b Supine BP:\b0 ";
elseif obsName = "Supine Diastolic BP" then formattedText1 := formattedText1 || "/";
elseif obsName = "Sitting Systolic BP" then formattedText1 := formattedText1 || "\b Sitting BP:\b0 ";
elseif obsName = "Sitting Diastolic BP" then formattedText1 := formattedText1 || "/";
elseif obsName = "Standing Systolic BP" then formattedText1 := formattedText1 || "\b Standing BP:\b0 ";
elseif obsName = "Standing Diastolic BP" then formattedText1 := formattedText1 || "/";
elseif obsName = "sch_orthostatic heart rate - supine" then formattedText1 := formattedText1 || "\b Ortho HR Supine:\b0 ";
elseif obsName = "sch_orthostatic heart rate - sitting" then formattedText1 := formattedText1 || "\b Ortho HR Sitting:\b0 ";
elseif obsName = "sch_orthostatic heart rate - standing" then formattedText1 := formattedText1 || "\b Ortho HR Standing:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || last (first i from lastValuesList);
endif; // Obsname amongst the Vital Signs observations
enddo;
// Gather the existing contents of the textbox
theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_FT VS, I & O");
obs := FIRST OF (thisObservations WHERE thisObservations.parameterGUID = theParameter.parameterGUID);
priorcontents := obs.ValueObj.Value;
formattedTextAll:= priorcontents || header1 || formattedText1;
endif;
// DOCUMENT OPEN
if thisdocumentCommunication.EventType = "DocumentOpening"
then
// Query the database for the vitals info
(obsNamesList, lastValuesList, highValuesList, lowValuesList) := read
{
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), name varchar(200), value varchar(500), timstmp datetime, sortseq int, timstmp2 varchar(30) ) "
|| " INSERT INTO #tmp_aaa (name,value,timstmp, sortseq) "
|| " select ocmi.Name, o.ValueText, od.RecordedDtm, "
|| " CASE WHEN Name = {{{SINGLE-QUOTE}}}Farenheit{{{SINGLE-QUOTE}}} THEN 01 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}} THEN 02 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}} THEN 03 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}} THEN 04 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}} THEN 05 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Systolic BP - Radial{{{SINGLE-QUOTE}}} THEN 06 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Diastolic BP - Radial{{{SINGLE-QUOTE}}} THEN 07 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Systolic BP - Second Line{{{SINGLE-QUOTE}}} THEN 08 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Arterial Diastolic - Second Line{{{SINGLE-QUOTE}}} THEN 09 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}} THEN 10 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}L/min{{{SINGLE-QUOTE}}} THEN 11 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height in cm{{{SINGLE-QUOTE}}} THEN 20 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height in ft{{{SINGLE-QUOTE}}} THEN 21 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Height remainder in inches{{{SINGLE-QUOTE}}} THEN 22 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}} THEN 23 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt gm ob NU{{{SINGLE-QUOTE}}} THEN 24 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt lb ob NU{{{SINGLE-QUOTE}}} THEN 25 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby a wt oz ob NU{{{SINGLE-QUOTE}}} THEN 26 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt lb ob NU{{{SINGLE-QUOTE}}} THEN 27 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}AS deliv baby b wt oz ob NU{{{SINGLE-QUOTE}}} THEN 28 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - grams{{{SINGLE-QUOTE}}} THEN 29 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - lbs{{{SINGLE-QUOTE}}} THEN 40 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - oz{{{SINGLE-QUOTE}}} THEN 41 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Weight - lbs{{{SINGLE-QUOTE}}} THEN 42 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}} THEN 43 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_vs_Occipital-Frontal Head{{{SINGLE-QUOTE}}} THEN 44 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Stool{{{SINGLE-QUOTE}}}THEN 45 "
|| " WHEN Name = {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Urine{{{SINGLE-QUOTE}}}THEN 46 "
|| " ELSE 99 "
|| " END AS SortSeq "
|| " "
|| " from CV3ClientDocument cd with (nolock) "
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = cd.clientguid and cdd.active = 1) "
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|| " AND ocmi.Name in ( "
|| " {{{SINGLE-QUOTE}}}farenheit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Heart Rate{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Resp Rate{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_vs_pulse ox saturation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}L/min{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Noninvasive Diastolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Noninvasive Systolic BP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Systolic BP - Radial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Diastolic BP - Radial{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Arterial Systolic BP - Second Line{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Arterial Diastolic - Second Line{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}AS deliv baby a wt gm ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby b wt gm ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby a wt lb ob NU{{{SINGLE-QUOTE}}} , "
|| " {{{SINGLE-QUOTE}}}AS deliv baby b wt lb ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby a wt oz ob NU{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}AS deliv baby b wt oz ob NU{{{SINGLE-QUOTE}}} , "
|| " {{{SINGLE-QUOTE}}}SCH_Newborn Weight - grams{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Newborn Weight - lbs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_Newborn Weight - oz{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Weight - lbs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Height in ft{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Height remainder in inches{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Height in cm{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}SCH_vs_Occipital-Frontal Head{{{SINGLE-QUOTE}}}, "
|| " {{{SINGLE-QUOTE}}}Current Weight{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Stool{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}SCH_io_newborn_diaper count - Urine{{{SINGLE-QUOTE}}} "
|| " ) "
|| " where cd.chartguid = " || ChartGuid || " and cd.clientguid = " || ClientGuid || " and cd.clientvisitguid = " || VisitGuid || " "
|| " and cd.iscanceled = 0 "
|| " and cd.DocumentName IN ({{{SINGLE-QUOTE}}}B1. Newborn Vital Signs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Newborn Patient Profile{{{SINGLE-QUOTE}}}) "
|| " order by sortseq , cd.touchedwhen "
|| " "
|| " update t1 set timstmp2 = t2.timstmp from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq = t2.sortseq "
|| " update t2 set timstmp2 = {{{SINGLE-QUOTE}}}first weight{{{SINGLE-QUOTE}}}, name = {{{SINGLE-QUOTE}}}First Adult Weight - kg{{{SINGLE-QUOTE}}} from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq <> t2.sortseq and t2.name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - grams{{{SINGLE-QUOTE}}} " //{{{SINGLE-QUOTE}}}Weight - kg{{{SINGLE-QUOTE}}}
|| " update t2 set timstmp2 = {{{SINGLE-QUOTE}}}first weight lbs{{{SINGLE-QUOTE}}}, name = {{{SINGLE-QUOTE}}}First Adult Weight - lbs{{{SINGLE-QUOTE}}} from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq <> t2.sortseq and t2.name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - lbs{{{SINGLE-QUOTE}}} " //{{{SINGLE-QUOTE}}}Weight - lbs{{{SINGLE-QUOTE}}}
|| " update t2 set timstmp2 = {{{SINGLE-QUOTE}}}first weight oz{{{SINGLE-QUOTE}}}, name = {{{SINGLE-QUOTE}}}First Adult Weight - oz{{{SINGLE-QUOTE}}} from #tmp_aaa t1 "
|| " inner join #tmp_aaa t2 on t2.id = t1.id +1 and t1.sortseq <> t2.sortseq and t2.name = {{{SINGLE-QUOTE}}}SCH_Newborn Weight - oz{{{SINGLE-QUOTE}}} " //{{{SINGLE-QUOTE}}}Weight - oz{{{SINGLE-QUOTE}}}
|| " delete from #tmp_aaa where timstmp2 is not null and timstmp2 not in ({{{SINGLE-QUOTE}}}first weight{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}first weight lbs{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}first weight oz{{{SINGLE-QUOTE}}}) "
|| " "
|| " select name, value, timstmp, sortseq from #tmp_aaa order by timstmp desc, sortseq "
|| " drop table #tmp_aaa "
};
//break;
// Process the First Group Data Elements (past 24 hours)
header1 :="\b Vital Signs in Past 24 Hours - Last Charted \b0\n\n";
formattedText1:= " ";
thisdatefield := " ";
yesterday:= now-24 hours;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := last (first i from obsNamesList);
// Reformat the Time Stamp
thisdatefield_unformatted := last (first i from highValuesList);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the first group and charted in the past 24 hours
//break;
if obsName in ("farenheit","Heart Rate","Resp Rate","SCH_vs_pulse ox saturation","L/min",
"Noninvasive Diastolic BP","Noninvasive Systolic BP","Arterial Systolic BP - Radial","Arterial Diastolic BP - Radial",
"Arterial Systolic BP - Second Line","Arterial Diastolic - Second Line" )
and
thisdatefield_unformatted > yesterday
then
if thisdatefield = " " // first timestamp
then
thisdatefield := last (first i from highValuesList);
formattedText1 := thisdatefield_formatted;
endif;
if thisdatefield <> last (first i from highValuesList) // new timestamp
then
formattedText1 := formattedText1 || "\n" || thisdatefield_formatted;
thisdatefield := last (first i from highValuesList);
else
formattedText1 := formattedText1 || " " ;
endif;
if obsName = "Heart Rate" then formattedText1 := formattedText1 || "\b HR:\b0 ";
elseif obsName = "Farenheit" then formattedText1 := formattedText1 || "\b T:\b0 ";
elseif obsName = "Noninvasive Systolic BP" then formattedText1 := formattedText1 || "\b BP:\b0 ";
elseif obsName = "Noninvasive Diastolic BP" then formattedText1 := formattedText1 || "/";
elseif obsName = "Arterial Systolic BP - Radial" then formattedText1 := formattedText1 || "\b ART BP:\b0 ";
elseif obsName = "Arterial Diastolic BP - Radial" then formattedText1 := formattedText1 || "/";
elseif obsName = "Arterial Systolic BP - Second Line" then formattedText1 := formattedText1 || "\b ART BP Second:\b0 ";
elseif obsName = "Arterial Diastolic - Second Line" then formattedText1 := formattedText1 || "/";
elseif obsName = "Resp Rate" then formattedText1 := formattedText1 || "\b R:\b0 ";
elseif obsName = "SCH_vs_pulse ox saturation" then formattedText1 := formattedText1 || "\b Pulse Ox:\b0 ";
elseif obsName = "L/min" then formattedText1 := formattedText1 || "\b O2 L/min:\b0 ";
endif;
formattedText1 := formattedText1 || " ";
formattedText1 := formattedText1 || last (first i from lastValuesList);
endif; // Obsname amongst the Vital Signs observations
enddo;
formattedText1 := header1 || formattedText1;
// Process the Second Group Data Elements (Start of Chart)
header2 :="\n\n \b Additional Information - Last Charted \b0 \n\n";
formattedText2:= " ";
thisdatefield := " ";
//break;
indexList := 1 seqto count (obsNamesList);
for i in indexList do
obsName := last (first i from obsNamesList);
// Reformat the Time Stamp
thisdatefield_unformatted := last (first i from highValuesList);
yy:= extract year thisdatefield_unformatted;
mm := extract month thisdatefield_unformatted ; if mm < 10 then mm:= 0 || mm; endif;
dd := extract day thisdatefield_unformatted ; if dd < 10 then dd:= 0 || dd; endif;
hh := extract hour thisdatefield_unformatted ; if hh < 10 then hh:= 0 || hh; endif;
mn := extract minute thisdatefield_unformatted ; if mn < 10 then mn:= 0 || mn; endif;
thisdatefield_formatted := mm || "/" || dd || "/" || yy || " " || hh || ":" || mn;
// Proceed if the data part of the second group
//break;
if obsName in (
"AS deliv baby a wt gm ob NU" , "AS deliv baby b wt gm ob NU" , "AS deliv baby a wt lb ob NU" , "AS deliv baby b wt lb ob NU" , "AS deliv baby a wt oz ob NU" , "AS deliv baby b wt oz ob NU" ,
"SCH_Newborn Weight - grams","SCH_Newborn Weight - lbs","SCH_Newborn Weight - oz", "Weight - lbs","Weight - kg","First Adult Weight - kg","Height in ft" , "Height remainder in inches" , "Height in cm",
"SCH_vs_Occipital-Frontal Head", "Current Weight","SCH_io_newborn_diaper count - Stool" , "SCH_io_newborn_diaper count - Urine","First Adult Weight - lbs","First Adult Weight - oz"
)
then
if thisdatefield = " " // first timestamp
then
thisdatefield := last (first i from highValuesList);
formattedText2 := thisdatefield_formatted;
endif;
if thisdatefield <> last (first i from highValuesList) // new timestamp
then
formattedText2 := formattedText2 || "\n" || thisdatefield_formatted;
thisdatefield := last (first i from highValuesList);
else
formattedText2 := formattedText2 || " " ;
endif;
if obsName = "SCH_io_newborn_diaper count - Stool" then formattedText2 := formattedText2 || "\b Stool Diaper:\b0 ";
elseif obsName = "SCH_io_newborn_diaper count - Urine" then formattedText2 := formattedText2 || "\b Urine Diaper:\b0 ";
elseif obsName = "SCH_vs_Occipital-Frontal Head" then formattedText2 := formattedText2 || "\b H.C./cm:\b0 ";
elseif obsName = "Height in cm" then formattedText2 := formattedText2 || "\b Ht/cm:\b0 ";
elseif obsName = "Height in ft" then formattedText2 := formattedText2 || "\b Ht/ft:\b0 ";
elseif obsName = "Height remainder in inches" then formattedText2 := formattedText2 || "-";
elseif obsName = "SCH_Newborn Weight - grams" then formattedText2 := formattedText2 || "\b Wt/gm:\b0 ";
curwt:= last (first i from lastValuesList);
lastwt := last (first i from lastValuesList);
//delwt:= last (last i from lastValuesList); //vikas
elseif obsName = "SCH_Newborn Weight - lbs" then formattedText2 := formattedText2 || "\b Wt/lb:\b0 ";
//curwt:= last (first i from lastValuesList);
//lastwt := last (first i from lastValuesList);
elseif obsName = "SCH_Newborn Weight - oz" then formattedText2 := formattedText2 || "-";
elseif obsName = "AS deliv baby a wt gm ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/gm:\b0 "; delwt:= last (first i from lastValuesList);
elseif obsName = "AS deliv baby b wt gm ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/gm:\b0 "; delwt:= last (first i from lastValuesList);
elseif obsName = "AS deliv baby a wt lb ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/lb:\b0 ";
elseif obsName = "AS deliv baby a wt oz ob NU" then formattedText2 := formattedText2 || "-";
elseif obsName = "AS deliv baby b wt lb ob NU" then formattedText2 := formattedText2 || "\b Deliv Wt/lb:\b0 ";
elseif obsName = "AS deliv baby b wt oz ob NU" then formattedText2 := formattedText2 || "-";
elseif obsName = "Weight - lbs" then formattedText2 := formattedText2 || "\b Wt/lb:\b0 ";
elseif obsName = "Weight - kg" then formattedText2 := formattedText2 || "\b Wt/kg:\b0 "; lastwt := last (first i from lastValuesList);
elseif obsName = "First Adult Weight - kg" then formattedText2 := formattedText2 || "\b First Wt/gm:\b0 "; firstwt:= last (first i from lastValuesList);
elseif obsName = "First Adult Weight - lbs" then formattedText2 := formattedText2 || "\b First Wt/lb:\b0 "; //firstwtlbs:= last (first i from lastValuesList);
elseif obsName = "First Adult Weight - oz" then formattedText2 := formattedText2 || "-";
//break;
endif;
formattedText2 := formattedText2 || " ";
formattedText2 := formattedText2 || last (first i from lastValuesList);
endif; // Obsname amongst the Additional Information observations
enddo;
// Calculate the weight change
//break;
If exist delwt // Baby since birth weight
then
/*wtlabel := "Wt change since birth: \b0 ";
wtscale := " gm ";
wtchange := ((curwt as number) - (delwt as number)) formatted with " %.2f %";
wtchangepcnt := (((curwt as number) - (delwt as number))/(delwt as number) * 100) formatted with " %.2f %%"; */
wtlabel := "Wt change since birth: \b0 ";
wtscale := " gm ";
wtscalelbs := " lbs ";
//wtchange := (((curwt as number) - (delwt as number))/1000) formatted with " %.2f %";
wtchange := ((curwt as number) - (delwt as number)) formatted with " %.2f %";
wtchangepcnt := (((curwt as number) - (delwt as number))/(delwt as number) * 100) formatted with " %.2f %%";
Calc := (wtchange as number) * ("0.00220462" As number); //("2.20462" as number) ;// * ("1000" as number ) ;
If Calc Is Not Null Then
WtChangeLbs := Read first{" Select Format( " || Calc || " , {{{SINGLE-QUOTE}}}00.00{{{SINGLE-QUOTE}}}) " } ; // Added By Shivprasad for CSR:33428 on 19 June 2015
Endif;
else // Adult since first weighing
Void:= Null;
/*wtlabel := "Wt change since first weighing: \b0 ";
wtscale := " kg ";
wtchange := ((lastwt as number) - (firstwt as number)) formatted with " %.2f %";
wtchangepcnt := (((lastwt as number) - (firstwt as number)) /(firstwt as number) * 100) formatted with " %.2f %%";*/
/* wtlabel := "Wt change since first weighing: \b0 ";
wtscale := " kg ";
wtscalelbs := " lbs "; // Added By Shivprasad for CSR:33428 on 19 June 2015
wtchange := (((lastwt as number) - (firstwt as number))/1000) formatted with " %.2f %";
wtchangepcnt := (((lastwt as number) - (firstwt as number)) /(firstwt as number)) formatted with " %.2f %%"; // /(firstwt as number) * 100) formatted with " %.2f %%";
WtChangeLbs := (wtchange as number) * ("2.20462" as number) ; */ //Hide By Shivprasad On 11 Sept 2015
//break;
endif;
// break;
If wtchange is not null
then
//wtchange := " \n\n\b " || wtlabel || wtchange || wtscale || wtchangepcnt ;
wtchange := " \n\n\b " || wtlabel || WtChangeLbs || wtscalelbs || wtchange || wtscale || wtchangepcnt ;
else
wtchange := " ";
endif;
formattedText2 := header2 || formattedText2 || wtchange;
formattedTextAll:= formattedText1 || formattedText2;
endif; // Document Open
// Write to the Structured Note Text Box
If formattedTextAll is not null
then
vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_FT VS, I & O");
newObservation := NEW ObservationType;
newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
newObservation.ParameterGUID := vitalSignsHL.ParameterGUID;
newObservation.DataType := "FreeTextValue";
newObservation.ValueObj := NEW FreeTextValueType;
newObservation.ValueObj.Value := formattedTextAll;
thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation);
endif;
;;
evoke:
;;
logic: conclude true;
;;
action: return thisDocumentCommunication;
;;
Urgency: 50;;
end:

Some files were not shown because too many files have changed in this diff Show More