204 lines
7.1 KiB
Plaintext
204 lines
7.1 KiB
Plaintext
maintenance:
|
|
|
|
title: SCH_CREATE_ADMISSION_ORDER_CONFIRMATION;;
|
|
mlmname: SCH_CREATE_ADMISSION_ORDER_CONFIRMATION ;;
|
|
arden: version 2.5;;
|
|
version: 16.3;;
|
|
institution: SCH ;;
|
|
author: Juliet M. Law ;;
|
|
specialist: Janet Nordin;;
|
|
date: 2019-01-22;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Creates {{{SINGLE-QUOTE}}}Admission Order Confirmation{{{SINGLE-QUOTE}}} order when {{{SINGLE-QUOTE}}}Admit to Inpatient{{{SINGLE-QUOTE}}} or {{{SINGLE-QUOTE}}}Place in Observation{{{SINGLE-QUOTE}}} order is entered
|
|
|
|
;;
|
|
explanation: The Admission Order Confirmation order will be created by this MLM upon submittal of the order worksheet
|
|
|
|
Change History:
|
|
2019.01.22 JML CSR 37770 - Created
|
|
|
|
;;
|
|
keywords: ObjectsPlus, Orders
|
|
;;
|
|
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;
|
|
|
|
error_occurred := false;
|
|
error_message := "";
|
|
|
|
local_session := cds_session.local; // for local_session.SessionRequestBed
|
|
|
|
log_execution_info := false;
|
|
stopProcessing := false;
|
|
|
|
|
|
GeneralOrder_dest := destination { ObjectsPlus } with [
|
|
alert_type := "Warning",
|
|
short_message := "Object created by MLM",
|
|
priority := "low",
|
|
scope := "chart",
|
|
rule_group := "Order Object",
|
|
rule_number := 2010 ];
|
|
|
|
order_Creation_Reason := "Created by MLM";
|
|
|
|
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_alert_with_order := "",
|
|
Alert_dialog_settings := "",
|
|
Display_alert := true ];
|
|
|
|
Order_Submit := event {OrderWorksheetSubmit User ClientVisit } ; //Order : WHERE Name Matches pattern "Place in Observation%" } ;//Order: where Name in ("Place in Observation")};
|
|
|
|
(OrdersOnWorksheet,
|
|
WSOrderGUID) := read { UNSUBMITTED ORDER : Name, GUID WHERE Name IN ( "Place in Observation", "Admit to Inpatient" ) };
|
|
|
|
if ( ( "Place in Observation" IN OrdersOnWorksheet ) OR ( "Admit to Inpatient" IN OrdersOnWorksheet ) ) then
|
|
|
|
//Get CareProvider object of user entering the order
|
|
userIDType := "Edstan Number (physician)";
|
|
( CareProvider_obj ) := read last{ UserInfo : CareProvider };
|
|
(CareProviderID_Obj ) := read last { CareProvider : CareProviderID REFERENCING CareProvider_obj };
|
|
CareProviderEdstan := read last { CareProviderID : IDCode REFERENCING CareProviderID_Obj WHERE ProviderIDTypeCode = userIDType };
|
|
|
|
//Retrieve Edstan of Attending Physician specified when entering Admission Order
|
|
AttendingPhysician := local_session.SessionAdmissionOrderAttendingPhysician;
|
|
AttendingEdstan := SUBSTRING ( ( LENGTH OF AttendingPhysician ) - ( FIND "(" IN STRING AttendingPhysician ) ) CHARACTERS STARTING AT ( FIND "(" IN STRING AttendingPhysician ) FROM AttendingPhysician;
|
|
AttendingEdstan := Call ( ( AttendingEdstan as string ) as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace WITH "(" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, " " as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
|
|
|
|
stopProcessing := ( ( ( TRIM CareProviderEdstan ) as string ) = ( ( TRIM AttendingEdstan ) as string ) );
|
|
|
|
if ( stopProcessing = FALSE ) then
|
|
|
|
LocationGUID := EvokingObject.CurrentLocationGUID;
|
|
ClientVisitGUID := EvokingObject.GUID;
|
|
ClientGUID := EvokingObject.ClientGUID;
|
|
|
|
try
|
|
|
|
ClientVisit_OBJ := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( ( ClientVisitGUID as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
|
|
WSSessionType := "Standard";
|
|
WSSessionReason := "";
|
|
WSRequestedBySource := "Protocol Order";
|
|
|
|
WSRequestedCareProvider_OBJ := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByID with ( UserIDType, ( ( TRIM AttendingEdstan ) 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 ( ClientVisit_OBJ IS NOT NULL ) then
|
|
void := call ClientVisit_OBJ.Dispose;
|
|
ClientVisit_OBJ := null;
|
|
endif;
|
|
|
|
if ( WSRequestedCareProvider_OBJ IS NOT NULL ) then
|
|
void:= call WSRequestedCareProvider_OBJ.Dispose;
|
|
WSRequestedCareProvider_OBJ := null;
|
|
endif;
|
|
|
|
if ( WSLocation_OBJ IS NOT NULL ) then
|
|
void := call WSLocation_OBJ.Dispose;
|
|
WSLocation_OBJ := null;
|
|
endif;
|
|
|
|
endcatch;
|
|
|
|
try
|
|
|
|
CatalogItemName := "Admission Order Confirmation";
|
|
OrderCreationReason := "Order Created from MLM";
|
|
|
|
GeneralOrderItem_OBJ := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with CatalogItemName;
|
|
GeneralOrder_OBJ := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder with
|
|
ClientVisit_OBJ,
|
|
GeneralOrderItem_OBJ,
|
|
OrderCreationReason,
|
|
WSRequestedCareProvider_OBJ,
|
|
WSRequestedBySource,
|
|
WSSessionType,
|
|
WSSessionReason,
|
|
WSLocation_OBJ,
|
|
"Always" AS {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
|
|
|
//GeneralOrder_OBJ.SpecialInstructions := "\n\n" || local_session.SessionAdmissionOrderConfirmation || "\nAdmit Date/Time: " || AdmitDateTime;
|
|
dataItemValue := call GeneralOrder_OBJ.{{{SINGLE-QUOTE}}}GetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "Free Text";
|
|
|
|
stringValue := dataItemValue || " " || local_session.SessionAdmissionOrderConfirmation || " Admit Date/Time: " || local_session.SessionAdmissionOrderEffectiveDate ;
|
|
retValue := call GeneralOrder_OBJ.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with "Free Text", stringValue;
|
|
|
|
local_session.SessionAdmissionOrderConfirmation := "";
|
|
|
|
GeneralOrder_dest.ObjectsPlus := GeneralOrder_OBJ;
|
|
void := call GeneralOrder_OBJ.Save;
|
|
|
|
endtry;
|
|
|
|
catch Exception ex
|
|
|
|
error_occurred := true;
|
|
error_message := error_message || "{{+R}}New General Order:{{-R}}\n" || ex.Message || "\n\n";
|
|
|
|
if ( GeneralOrderItem_OBJ IS NOT NULL ) then
|
|
void := call GeneralOrderItem_OBJ.Dispose;
|
|
GeneralOrderItem_OBJ := null;
|
|
endif;
|
|
|
|
if ( GeneralOrder_OBJ IS NOT NULL ) then
|
|
void := call GeneralOrder_OBJ.Dispose;
|
|
GeneralOrder_OBJ := null;
|
|
endif;
|
|
|
|
endcatch;
|
|
|
|
endif;
|
|
endif;
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:
|
|
Order_Submit;
|
|
|
|
;;
|
|
logic:
|
|
|
|
if EvokingObject is null
|
|
then
|
|
conclude false;
|
|
endif;
|
|
|
|
conclude true;
|
|
|
|
;;
|
|
action:
|
|
|
|
if error_occurred then
|
|
|
|
write "An error has occurred in the MLM {{+B}}SCH_CREATE_ADMISSION_ORDER_CONFIRMATION{{-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;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|