Initial Checking with all 820 MLMs
This commit is contained in:
208
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_UNSUBMITTED_ORDER.mlm
Normal file
208
MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_UNSUBMITTED_ORDER.mlm
Normal file
@@ -0,0 +1,208 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Func_Create_Unsubmitted_Order;;
|
||||
mlmname: SCH_Func_Create_Unsubmitted_Order;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: ;;
|
||||
author: Don Warnick ;;
|
||||
specialist: ;;
|
||||
date: 2012-10-06;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create an Unsubmitted Order using the information passed from the calling MLM.
|
||||
;;
|
||||
explanation: Called MLM that builds orders for a patient.
|
||||
|
||||
NOTE: This MLM is initially built to create Prefilled Medication Orders.
|
||||
Additional routines (i.e. Diagnostic Orders etc...) may be added using the
|
||||
Allscripts supplied MLM, "Test ObjectsPlus Orders Using A Worksheet" for reference.
|
||||
|
||||
Change history
|
||||
|
||||
10.06.2014 DW CSR# 31964 Created
|
||||
02.03.2016 JML CSR# 33934: Created
|
||||
04.20.2016 JML Moved to Production
|
||||
|
||||
;;
|
||||
keywords: Called MLM, Generic, Create Order
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
(visitGuid, userGuid, clientGuid, orderSessionType, orderSource, triggerObj) := ARGUMENT;
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
error_occurred := false;
|
||||
error_message := "";
|
||||
log_execution_info := false;
|
||||
|
||||
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}}}"};
|
||||
|
||||
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || clientGUID};
|
||||
|
||||
TriggerObj_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 := 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:
|
||||
|
||||
|
||||
if called_by_editor
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
try
|
||||
|
||||
worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent;
|
||||
|
||||
if worksheetInfo is NULL OR "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String)
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
WSSessionType := orderSessionType;
|
||||
WSSessionReason := "";
|
||||
WSRequestedBySource := orderSource;
|
||||
WSRequestedBy_obj := worksheetInfo.RequestedBy;
|
||||
WSlocation_obj := worksheetInfo.ExpectedReleaseLocationGroup;
|
||||
|
||||
endtry;
|
||||
|
||||
catch Exception ex
|
||||
error_occurred:= true;
|
||||
error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
// Dispose
|
||||
|
||||
if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif;
|
||||
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
|
||||
|
||||
Catalog_Item_Name := triggerObj.item_name;
|
||||
Catalog_Item_Modifier := triggerObj.item_modifier;
|
||||
Catalog_Item_Version := triggerObj.item_version;
|
||||
Order_Creation_Reason := "Protocol Order";
|
||||
|
||||
CatalogItem_obj := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName WITH ( Catalog_Item_Name as string ) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
|
||||
if ( triggerObj.order_type = "Diagnostic" ) then
|
||||
DiagnosticOrder_obj := call worksheetInfo.CreateDiagnosticOrder WITH
|
||||
CatalogItem_obj,
|
||||
Order_Creation_Reason,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}},
|
||||
false,
|
||||
(Active_OrderGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}},
|
||||
true;
|
||||
|
||||
if ( CatalogItem_obj IS NOT NULL ) then
|
||||
void := call CatalogItem_obj.Dispose;
|
||||
CatalogItem_obj := null;
|
||||
endif;
|
||||
|
||||
RequestedTime_obj := new net_object "RequestedTime";
|
||||
RequestedTime_obj.CodedTime := triggerObj.coded_time;
|
||||
|
||||
if ( triggerObj.coded_time <> "STAT" AND triggerObj.coded_time <> "AM Rounds" ) then
|
||||
time_obj := new net_object {{{SINGLE-QUOTE}}}Time{{{SINGLE-QUOTE}}} WITH ( triggerObj.requested_time_hour as number ) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, ( triggerObj.requested_time_min as number ) as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}};
|
||||
RequestedTime_obj.Time := time_obj;
|
||||
endif;
|
||||
|
||||
DiagnosticOrder_obj.RequestedTime := RequestedTime_obj;
|
||||
|
||||
if ( count triggerObj.order_field_name > 0 ) then
|
||||
|
||||
for i IN 1 seqto ( count triggerObj.order_field_name ) do
|
||||
diagField_obj := call DiagnosticOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} WITH
|
||||
triggerObj.order_field_name[i], ( triggerObj.order_field_value[i] as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}} );
|
||||
enddo;
|
||||
|
||||
endif;
|
||||
|
||||
void := call DiagnosticOrder_obj.Save;
|
||||
void := call DiagnosticOrder_obj.Dispose;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}New " || triggerObj.order_type || " order :{{-R}}\n" || ex.Message || "\n\n";
|
||||
|
||||
// Dispose
|
||||
if( CatalogItem_obj is NOT NULL ) then void := call CatalogItem_obj.Dispose; CatalogItem_obj := null; endif;
|
||||
if( DiagnosticOrder_obj is NOT NULL ) then void := call DiagnosticOrder_obj.Dispose; DiagnosticOrder_obj:= null; endif;
|
||||
TriggerObj_dest := null;
|
||||
|
||||
endcatch;
|
||||
|
||||
// Dispose
|
||||
if( client_visit_obj is NOT NULL ) then void := call client_visit_obj.Dispose; client_visit_obj:= null; endif;
|
||||
if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif;
|
||||
|
||||
|
||||
|
||||
Conclude true ;
|
||||
|
||||
|
||||
;;
|
||||
action:
|
||||
|
||||
if Error_occurred
|
||||
then
|
||||
|
||||
write "An error has occurred in the MLM {{+B}}TEST_OBJECTSPLUS_ORDERS_WITH_WORKSHEET{{-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 TriggerObj_dest then write true at TriggerObj_dest; endif;
|
||||
|
||||
return Error_occurred;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user