Initial Checking with all 820 MLMs
This commit is contained in:
233
MLMStripper/bin/Debug/SCH/SCH_AUTO_GENERATE_ORDERS.mlm
Normal file
233
MLMStripper/bin/Debug/SCH/SCH_AUTO_GENERATE_ORDERS.mlm
Normal file
@@ -0,0 +1,233 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Auto_Generate_Orders ;;
|
||||
mlmname: SCH_Auto_Generate_Orders ;;
|
||||
arden: version 16.3;;
|
||||
version: 16.3;;
|
||||
institution: SCH;;
|
||||
author: Shubhang Acharya;;
|
||||
specialist: ;;
|
||||
date: 2017-08-01;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create order through MLM.
|
||||
|
||||
Argument Required ::
|
||||
1) Client visit GUID
|
||||
2) client_guid
|
||||
3) user_GUID
|
||||
4) location_guid
|
||||
5) Order_Type ( Pass anyone from below three value based on performing operation )
|
||||
A. GeneralOrder
|
||||
B. MedicationOrder
|
||||
C. DiagnosticOrder
|
||||
6) orderItemName ( Pass Name of Order )
|
||||
7) order_Creation_Reason ( Pass reason for order creation. )
|
||||
8) RequestingSource ( Pass RequestedBySource (must be in dictionary) )
|
||||
9) SessionType ( Pass SessionType )
|
||||
10) SessionReason ( Pass SessionReason )
|
||||
|
||||
NOTE: There is commented code in MLM in case developer wants to set custom form field values.
|
||||
|
||||
Sample Argument ::
|
||||
|
||||
MLM_Name := MLM {{{SINGLE-QUOTE}}}SCH_Auto_Generate_Orders{{{SINGLE-QUOTE}}}; // MLM name
|
||||
|
||||
orderItemName := orderItemName; //"CBC W/O Differential"; // "Activity" // Gen_Order ;// "Dietician Consult";
|
||||
//orderItemModifier := ".";
|
||||
//orderItemVersion := "";
|
||||
order_Creation_Reason := "From MLM";
|
||||
RequestingSource := "";
|
||||
SessionType := "Standard";
|
||||
SessionReason := ""; //SessionReason should be blank for Session Type "Standard Orders"
|
||||
|
||||
//user_GUID := 9000010934301190;
|
||||
|
||||
|
||||
location_guid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit " ||
|
||||
" where ClientGUID = " || ClientGUID};
|
||||
//Filed_1 := "NUR_PatientStatus"; // set Consult Call field on order
|
||||
//Val_1 := "Inpatient";
|
||||
|
||||
Order_Type := "DiagnosticOrder";
|
||||
|
||||
Status := call MLM_Name with ClientVisitGUID,ClientGUID,user_GUID,location_guid,Order_Type,orderItemName
|
||||
,order_Creation_Reason,RequestingSource,SessionType,SessionReason;//,Filed_1,Val_1;
|
||||
|
||||
|
||||
Return Type ::
|
||||
MLM will return Success if Order created Successfully.
|
||||
MLM will return error_message if any error generate while creating Orders.
|
||||
|
||||
|
||||
Modification History:
|
||||
--------------------------------------------------
|
||||
08.01.2017 SAcharya - CSR# 35187: MLM Created.
|
||||
;;
|
||||
explanation:
|
||||
|
||||
;;
|
||||
keywords: Physician Documenation, Default date
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
//(this_documentcommunication) := argument;
|
||||
|
||||
(client_visit_guid,client_guid,user_GUID,location_guid,Order_Type,orderItemName,Catalog_Item_Modifier
|
||||
,order_Creation_Reason,RequestingSource,SessionType,SessionReason
|
||||
) := argument;
|
||||
|
||||
log_execution_info := FALSE;
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
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 := 1001,
|
||||
Rule_subgroup := "",
|
||||
Send_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
mlm_name := "SCH_Auto_Generate_Orders";
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic:
|
||||
|
||||
If Not Called_By_Editor Then
|
||||
try
|
||||
// Get the 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}}}) ; //OK
|
||||
|
||||
// get CatalogMasterItem ObjectsPlus object
|
||||
catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName //OK
|
||||
with orderItemName;
|
||||
|
||||
RequestingCareProvider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ( (user_GUID as Number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
|
||||
|
||||
// get the location object
|
||||
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
|
||||
if Order_Type = "GeneralOrder" then
|
||||
// Create the prefilled General order
|
||||
Catalog_Item_Version := "";
|
||||
Order_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
catalog_item, // CatalogMasterItem ObjectsPlus
|
||||
//object
|
||||
//Catalog_Item_Modifier, // string ItemNameModifier
|
||||
//Catalog_Item_Version, // string ItemNameModifierVersion
|
||||
order_Creation_Reason, // CreateReason
|
||||
RequestingCareProvider_obj, // RequestingProvider
|
||||
//ObjectsPlus object
|
||||
RequestingSource, // string requestingSource
|
||||
//(must be in dictionary)
|
||||
SessionType, // string SessionType
|
||||
SessionReason, // string SessionReason
|
||||
location_obj, // Location ReleaseLocGrpID
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride
|
||||
|
||||
void := call Order_obj.Save; // Create the order
|
||||
void := call Order_obj.Dispose;
|
||||
|
||||
endif;
|
||||
|
||||
if Order_Type = "MedicationOrder" then
|
||||
|
||||
Order_obj := call {{{SINGLE-QUOTE}}}MedicationOrder{{{SINGLE-QUOTE}}}.CreateMedicationOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
catalog_item, // CatalogMasterItem 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,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
|
||||
//"SignOnSubmit" as {{{SINGLE-QUOTE}}}SuppressNotificationOptions{{{SINGLE-QUOTE}}} ;
|
||||
|
||||
void := call Order_obj.Save; // Create the order
|
||||
void := call Order_obj.Dispose;
|
||||
|
||||
endif;
|
||||
|
||||
if Order_Type = "DiagnosticOrder" then
|
||||
|
||||
Order_obj := call {{{SINGLE-QUOTE}}} DiagnosticOrder{{{SINGLE-QUOTE}}}.CreateDiagnosticOrder
|
||||
with
|
||||
client_visit_obj, // ClientVisit ObjectsPlus object
|
||||
catalog_item, // CatalogMasterItem 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,
|
||||
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride eAvailabilityOverride
|
||||
//"SignOnSubmit" as {{{SINGLE-QUOTE}}}SuppressNotificationOptions{{{SINGLE-QUOTE}}} ;
|
||||
|
||||
|
||||
void := call Order_obj.Save; // Create the order
|
||||
void := call Order_obj.Dispose;
|
||||
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
catch Exception ex
|
||||
|
||||
error_occurred := true;
|
||||
error_message := error_message ||
|
||||
"{{+R}} Order {{-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 ( Order_obj is NOT NULL ) then
|
||||
void:= call Order_obj.Dispose;
|
||||
Order_obj:= null;
|
||||
endif;
|
||||
endcatch;
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
if Error_occurred 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" at error_destination;
|
||||
write error_message at error_destination;
|
||||
endif;
|
||||
|
||||
if Error_occurred then
|
||||
return error_message;
|
||||
else
|
||||
return "Success";
|
||||
endif;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user