192 lines
5.7 KiB
Plaintext
192 lines
5.7 KiB
Plaintext
maintenance:
|
|
|
|
title: SCH_Readmission_Risk_Order;;
|
|
mlmname: SCH_Readmission_Risk_Order;;
|
|
arden: version 2.5;;
|
|
version: 5.50;;
|
|
institution: SCH ;;
|
|
author: Chintan Tilwa;;
|
|
specialist: ;;
|
|
date: 2012-10-16;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Creates and saves prefilled and standard orders using ObjectsPlus.
|
|
Each order will be saved directly to the database once the order on the
|
|
worksheet is saved.
|
|
|
|
;;
|
|
explanation: This orders created by this MLM will by-pass the order entry worksheet
|
|
and will write directly to the database once the evoking object is saved.
|
|
|
|
;;
|
|
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;
|
|
|
|
//local_session := CDS_SESSION.local;
|
|
error_occurred := false;
|
|
error_message := "";
|
|
|
|
log_execution_info := false;
|
|
|
|
Document_Enter := event {ClientDocumentEnter User ClientDocument: where documentname in ("Adult Patient Profile","Adult Patient Profile - Observation")};
|
|
Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Adult Patient Profile","Adult Patient Profile - Observation")};
|
|
|
|
HI_mod_mlm := MLM {{{SINGLE-QUOTE}}}SCH_Create_General_Order{{{SINGLE-QUOTE}}};
|
|
|
|
( careProvider_obj ) := read last{ UserInfo: careProvider };
|
|
|
|
user_IDType := "Primary";
|
|
|
|
CareProviderIDs_obj := read last
|
|
{ CareProvider: CareProviderID
|
|
REFERENCING careProvider_obj };
|
|
|
|
user_IDCode := read last
|
|
{ CareProviderID: IDCode
|
|
REFERENCING CareProviderIDs_obj
|
|
where ProviderIDTypeCode = user_IDType };
|
|
|
|
|
|
(location_guid, Active_ClientVisitGUID, client_guid) := read last
|
|
{ ClientVisit: CurrentLocationGUID, GUID, clientguid };
|
|
|
|
Active_ClientVisitGUID := EvokingObject.ClientVisitGUID;
|
|
|
|
Care_Provider := EVOKINGOBJECT.AuthoredProviderGUID;
|
|
|
|
try
|
|
|
|
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
|
with ((Active_ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
|
|
|
WSSessionType := "Discharge";
|
|
WSSessionReason := "Order placed from Readmission Risk Assessment.";
|
|
WSRequestedBySource := "";
|
|
|
|
|
|
WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
|
with ((Care_Provider as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
|
|
|
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;
|
|
|
|
order_Creation_Reason := "From Test MLM" ;
|
|
WSRequestedBySource := "";
|
|
|
|
|
|
/* Get the ClientObservationDocument object pointer */
|
|
(Client_Observation_Document_Obj, GUID):= read last
|
|
{ ClientDocument: ClientObservationDocument, GUID REFERENCING EvokingObject };
|
|
|
|
( ClientObservation_obj ) := read last { ClientObservationDocument: ClientObservation REFERENCING Client_Observation_Document_Obj where Name = "SCH_CK_Total Score" };
|
|
|
|
( Obs_Name, Obs_RecordedDtm, Obs_Value ) := read last { ClientObservation: Name, RecordedDtm, ValueText REFERENCING ClientObservation_obj};
|
|
|
|
( value1 ) := Obs_Value ;
|
|
|
|
value1 := value1 as number ;
|
|
|
|
If ( value1 >= 5 ) then
|
|
|
|
//local_session.SessionReadmissionScore := value1 ;
|
|
order_Name := "Readmission Risk" ;
|
|
|
|
(dup_order_list) := read last
|
|
{ " select name "
|
|
||" from cv3order "
|
|
||" where ClientGUID = " || sql(client_guid)
|
|
||" and ClientVisitGUID = " || sql(Active_ClientVisitGUID)
|
|
||" and name = {{{SINGLE-QUOTE}}}" || order_Name || "{{{SINGLE-QUOTE}}}"
|
|
||" and orderstatuslevelnum < 55 "
|
|
||" and OrderStatusCode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} "
|
|
||" and active = 1 " };
|
|
|
|
if not exists dup_order_list then
|
|
|
|
try
|
|
|
|
Catalog_Item_Name := order_name ;
|
|
|
|
order_type := "other";
|
|
|
|
order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
|
with Catalog_Item_Name;
|
|
|
|
Obj_Error_occurred, Obj_error_message := call HI_mod_mlm with
|
|
|
|
order_type,
|
|
client_visit_obj, // ClientVisit ObjectsPlus object
|
|
Order_catalog_item, // CatalogMasterItem ObjectsPlus object
|
|
order_Creation_Reason, // string CreateReason
|
|
WSRequestedBy_obj, // RequestingProvider ObjectsPlus object
|
|
WSRequestedBySource, // string requestingSource(must be in dict)
|
|
WSSessionType, // string SessionType
|
|
WSSessionReason, // string SessionReason
|
|
WSLocation_obj;
|
|
|
|
|
|
endtry;
|
|
catch Exception ex
|
|
error_occurred := true;
|
|
error_message := "{{+R}}New General order:{{-R}}\n" ||
|
|
ex.Message || "\n\n";
|
|
endcatch;
|
|
|
|
if ( Order_catalog_item is NOT NULL ) then
|
|
void:= call Order_catalog_item.Dispose;
|
|
Order_catalog_item:= null;
|
|
endif;
|
|
endif;
|
|
endif;
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke: Document_Enter;
|
|
Document_Modify;
|
|
;;
|
|
logic:
|
|
|
|
if EvokingObject is null
|
|
then
|
|
conclude false;
|
|
endif;
|
|
|
|
conclude true;
|
|
|
|
;;
|
|
action:
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|