213 lines
6.0 KiB
Plaintext
213 lines
6.0 KiB
Plaintext
maintenance:
|
|
|
|
title: SCH_Readmission_Discharge_Order;;
|
|
mlmname: SCH_Readmission_Discharge_Order;;
|
|
arden: version 2.5;;
|
|
version: 5.50;; // FP1
|
|
institution: SCH ;;
|
|
author: Chintan Tilwa;;
|
|
specialist: ;;
|
|
date: 2012-09-19;;
|
|
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.
|
|
|
|
|
|
Change History
|
|
|
|
06.17.2016 DW CSR# 34778 Change order source to "Standing Order"
|
|
|
|
;;
|
|
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 := "";
|
|
|
|
log_execution_info := false;
|
|
|
|
Document_Enter := event {ClientDocumentEnter User ClientDocument: where documentname in ("Readmission Risk Assessment","Adult Patient Profile")};
|
|
Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Readmission Risk Assessment","Adult Patient Profile")};
|
|
|
|
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 := "Standard";
|
|
WSSessionReason := "";
|
|
WSRequestedBySource := "Standing Order";
|
|
|
|
|
|
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 := "Standing Order";
|
|
|
|
|
|
/* Get the ClientObservationDocument object pointer */
|
|
(Client_Observation_Document_Obj, GUID):= read last
|
|
{ ClientDocument: ClientObservationDocument, GUID
|
|
REFERENCING EvokingObject };
|
|
|
|
(ObsFSListValues_Obj, oName) := read Last
|
|
{ ClientObservationDocument: ObsFSListValues, Name
|
|
REFERENCING Client_Observation_Document_Obj
|
|
where Name = "SCH_CK_Discharge Risk" };
|
|
|
|
(val1) := read
|
|
{ ObsFSListValues: Value
|
|
Referencing ObsFSListValues_Obj
|
|
};
|
|
|
|
|
|
for i in 1 seqto count of val1 do
|
|
|
|
order_Name := val1[i] ;
|
|
|
|
(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 := val1[i] ;
|
|
|
|
If (Catalog_Item_Name = "Prealbumin") then
|
|
order_type := "Diagnostic";
|
|
else
|
|
order_type := "other";
|
|
endif ;
|
|
|
|
//order_type := Read Last {" select b.OrderTypeCode from CV3OrderCatalogMasterItem a
|
|
// Join CV3OrderEntryForm b on a.EntryFormGUID = b.FormGUID and a.Name = {{{SINGLE-QUOTE}}}" || Catalog_Item_Name || "{{{SINGLE-QUOTE}}}" };
|
|
|
|
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;
|
|
enddo;
|
|
|
|
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke: Document_Enter;
|
|
Document_Modify;
|
|
;;
|
|
logic:
|
|
|
|
if EvokingObject is null
|
|
then
|
|
conclude false;
|
|
endif;
|
|
|
|
conclude true;
|
|
|
|
;;
|
|
action:
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|