199 lines
6.0 KiB
Plaintext
199 lines
6.0 KiB
Plaintext
maintenance:
|
|
|
|
title: Writes a repeating lab order to the worksheet ;;
|
|
mlmname: SCH_DIAG_WRITE_ORDER;;
|
|
arden: version 2.5;;
|
|
version: 5.50;;
|
|
institution: SCH ;;
|
|
author: ;;
|
|
specialist: ;;
|
|
date: 2012-06-15;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Receive destination and write it.
|
|
Makes for multiple calls and hence writes on the order submit button.
|
|
;;
|
|
|
|
explanation:
|
|
Called from FORM_SET_REPEAT_LAB_ORDERS to create diagnostic order and place on worksheet.
|
|
Change history
|
|
06.15.2012 TMS Created in DEV
|
|
11.26.2012 TMS Moved to Production
|
|
02.25.2013 TMS Added logic to look for heparin orders for APTT heparin status
|
|
Missing from first repeat order, identified during AM Rounds project. HD Ticket 156616
|
|
|
|
;;
|
|
keywords:
|
|
;;
|
|
knowledge:
|
|
|
|
|
|
type: data-driven;;
|
|
data:
|
|
// Specify which .NET assemblies need to be loaded for ObjectsPlus
|
|
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
local_session := CDS_SESSION.local;
|
|
error_occurred := false;
|
|
error_message := "";
|
|
|
|
log_execution_info := false;
|
|
(ordername, modname,vername, worksheetInfo, stime1, stimehr, stimemin, hepstatus,
|
|
//Active_OrderGUID,
|
|
//Active_SignificiantDtm,
|
|
client_visit_obj
|
|
) := argument;
|
|
|
|
|
|
|
|
DiagnosticOrder_dest := destination { ObjectsPlus } with
|
|
[ alert_type := "Warning",
|
|
short_message := "Object created by MLM, placed on worksheet",
|
|
priority := "low",
|
|
scope := "chart",
|
|
rule_group := "Order Object",
|
|
rule_number := 2010
|
|
];
|
|
|
|
//---------------------------------------------------------------
|
|
// Error destination
|
|
//---------------------------------------------------------------
|
|
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 := 1004,
|
|
Rule_subgroup := "",
|
|
Send_with_order := "",
|
|
Alert_dialog_settings := "",
|
|
Display_alert := true
|
|
];
|
|
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:
|
|
|
|
;;
|
|
logic:
|
|
|
|
|
|
//---------------------------------------------------------------
|
|
// Create a new Laboratory order from a Pre-Filled item
|
|
// Place the order onto the order entry worksheet
|
|
//---------------------------------------------------------------
|
|
try
|
|
|
|
Catalog_Item_Name := (ordername as String);
|
|
Catalog_Item_Modifier := (modname as String);
|
|
Catalog_Item_Version := (vername as String);
|
|
order_Creation_Reason := "Repeat Lab Orders";
|
|
|
|
// get OrderCatalogMasterItem ObjectsPlus object
|
|
Laboratory_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
|
with Catalog_Item_Name;
|
|
|
|
// Create the prefilled Medication order
|
|
// Session information has been retrieved from the current worksheet if there
|
|
// already exists unsubmitted orders.
|
|
// AvailabilityOverride is set to Always.
|
|
DiagnosticOrder_obj := call worksheetInfo.CreateDiagnosticOrder
|
|
with
|
|
Laboratory_catalog_item, // OrderCatalogMasterItem ObjectsPlus object
|
|
Catalog_Item_Modifier, // string Name Modifier for prefill
|
|
Catalog_Item_Version, // string Name modifier version for prefill
|
|
order_Creation_Reason, // string Create Reason
|
|
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}, // AvailabilityOverride
|
|
false, // suppress messages
|
|
(Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}, // Companion order primary key
|
|
false; // Mandatory on Worksheet
|
|
|
|
|
|
|
|
if( Laboratory_catalog_item is NOT NULL ) then
|
|
void := call Laboratory_catalog_item.Dispose;
|
|
Laboratory_catalog_item:= null;
|
|
endif;
|
|
|
|
// answer heparin questions on order form
|
|
if OrderName = "APTT" then
|
|
|
|
If hepstatus = true then
|
|
heparinstatus:= "Yes";
|
|
heparinlabinfo:= "Continuous Heparin";
|
|
else heparinstatus:= "No";
|
|
heparinlabinfo:= "";
|
|
endif;
|
|
|
|
LabHepStatus := call DiagnosticOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
|
"LAB_VO_DI_Coag_Heparin Status",( heparinlabinfo AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
|
|
LabHepQuestion := call DiagnosticOrder_Obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
|
"Lab_ContHep_Question",( heparinstatus AS {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}});
|
|
|
|
endif;
|
|
|
|
requestedTime_obj := new net_object {{{SINGLE-QUOTE}}}RequestedTime{{{SINGLE-QUOTE}}};
|
|
requestedTime_obj.CodedTime := stime1;
|
|
|
|
if stime1 <> "AM Rounds" then
|
|
time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} with (stimehr As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, (stimemin As Number) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
|
|
requestedTime_obj.Time := time_obj;
|
|
DiagnosticOrder_obj.RequestedTime := requestedTime_obj;
|
|
endif;
|
|
|
|
|
|
void := call DiagnosticOrder_Obj.Save;
|
|
void := call DiagnosticOrder_Obj.Dispose;
|
|
|
|
endtry;
|
|
|
|
catch Exception ex
|
|
error_occurred := true;
|
|
if( Laboratory_catalog_item is NOT NULL ) then
|
|
void := call Laboratory_catalog_item.Dispose;
|
|
Laboratory_catalog_item:= null;
|
|
endif;
|
|
|
|
if( DiagnosticOrder_obj is NOT NULL ) then
|
|
void := call DiagnosticOrder_obj.Dispose;
|
|
DiagnosticOrder_obj:= null;
|
|
endif;
|
|
|
|
DiagnosticOrder_dest := null;
|
|
endcatch;
|
|
|
|
conclude true;
|
|
|
|
|
|
|
|
;;
|
|
action:
|
|
|
|
if error_occurred
|
|
then
|
|
|
|
write "An error has occurred in the MLM {{+B}}SCH_DIAG_WRITE_ORDER{{-B}} " ||
|
|
"Please notify your System Administrators that an error message has " ||
|
|
"occurred for this patient. They will review the following error(s) " ||
|
|
"message: \n" at error_destination;
|
|
write error_message at error_destination;
|
|
|
|
endif;
|
|
|
|
|
|
|
|
if EXISTS DiagnosticOrder_dest then
|
|
write true at DiagnosticOrder_dest;
|
|
endif;
|
|
|
|
return error_occurred;
|
|
|
|
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|