169 lines
5.8 KiB
Plaintext
169 lines
5.8 KiB
Plaintext
maintenance:
|
|
|
|
title: SCH_CREATE_AEROCHAMBER;;
|
|
mlmname: SCH_CREATE_AEROCHAMBER;;
|
|
arden: version 2;;
|
|
version: 5.00;;
|
|
institution: St Clair Hospital;;
|
|
author: Shawn Head;;
|
|
specialist: Robert Steward;;
|
|
date: 2016-05-21;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Create Aerochamber order when the aerochamber checkbox is selected on an order item that uses one of the 2 forms PRX_IhBnDr orPRX_IhBn
|
|
;;
|
|
explanation:
|
|
06.15.2016 - STH - CSR#: 34074 - created {Go-Live 6/28/2016}
|
|
;;
|
|
keywords: Objects+, Aerochamber, Orders
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
/* Set to true if logging is needed.*/
|
|
log_execution_info:= FALSE;
|
|
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
|
|
on_order_enter := event {OrderWorksheetSubmit User } ;
|
|
from_order_name := "";
|
|
CreateAerochamberOrder := false;
|
|
UnSub_AeroOrder := read last { UNSUBMITTED Order: Name where name in ("Aerochamber") };
|
|
if(UnSub_AeroOrder is null) then
|
|
userguid,user_id :=read last {UserInfo: guid,idcode};
|
|
AeroOrderNames := read { " select ocmi.name from cv3ordercatalogmasteritem ocmi with (nolock)
|
|
inner join cv3orderentryform oef with (nolock) on ocmi.EntryFormGUID = oef.GUID
|
|
where oef.Name in ({{{SINGLE-QUOTE}}}PRX_IhBnDr{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRX_IhBn{{{SINGLE-QUOTE}}})
|
|
and ocmi.Active = 1
|
|
and ocmi.ExpiryDate is null " };
|
|
(ReadUnSub_AeroUD, CP_GUID, OrderName, sessiontype) := read { UNSUBMITTED Order: OrderUserData , careproviderguid , name , InitialSessionTypeCode where name in (AeroOrderNames)};
|
|
if(count(ReadUnSub_AeroUD) > 0) then
|
|
(clientGUID, chartGUID, ClientVisitGUID, LocationGUID) := read last { ClientVisit: ClientGUID, ChartGUID, GUID, CurrentLocationGUID };
|
|
(AeroOrderGUID) := read last { " select guid from cv3order o with (nolock)
|
|
where o.ClientGUID = " || sql(ClientGUID)
|
|
|| " and o.chartguid = " || sql(chartGUID)
|
|
|| " and o.clientvisitguid = " || sql(ClientVisitGUID)
|
|
|| " and o.name = ({{{SINGLE-QUOTE}}}Aerochamber{{{SINGLE-QUOTE}}})
|
|
and o.orderstatuscode not in ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HISDP{{{SINGLE-QUOTE}}}) " };
|
|
if(AeroOrderGUID is nulL) then
|
|
for y in (1 seqto(count(ReadUnSub_AeroUD))) do
|
|
CurOrder_UserDataFields := ReadUnSub_AeroUD[y];
|
|
(userdatacode, value ) := read last { OrderUserData: UserDataCode, Value REFERENCING CurOrder_UserDataFields where UserDataCode = "PRX_Aerochamber"} ;
|
|
if(value = "1") then
|
|
CreateAerochamberOrder := true;
|
|
from_order_name := OrderName[y];
|
|
endif;
|
|
|
|
enddo;
|
|
endif;
|
|
endif;
|
|
endif;
|
|
|
|
|
|
if(CreateAerochamberOrder) then
|
|
try
|
|
CV_Obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
|
with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
|
|
|
WSSessionType := trim(sessiontype[1]);
|
|
if(sessiontype[1] = "Hold") then
|
|
WSSessionReason := "Hold Orders";
|
|
else
|
|
WSSessionReason := "";
|
|
endif;
|
|
WSRequestedBySource := "";
|
|
|
|
|
|
RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
|
with ((CP_GUID[1] as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
|
|
|
location_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 ( CV_Obj is NOT NULL ) then
|
|
void:= call CV_Obj.Dispose;
|
|
CV_Obj:= null;
|
|
endif;
|
|
|
|
if ( RequestedBy_obj is NOT NULL ) then
|
|
void:= call RequestedBy_obj.Dispose;
|
|
RequestedBy_obj:= null;
|
|
endif;
|
|
|
|
if ( location_obj is NOT NULL ) then
|
|
void:= call location_obj.Dispose;
|
|
location_obj:= null;
|
|
endif;
|
|
|
|
endcatch;
|
|
|
|
|
|
try
|
|
Catalog_Item_Name := "Aerochamber";
|
|
order_type := "other";
|
|
modifier := "";
|
|
modversion := "";
|
|
order_Creation_Reason := from_order_name || " ordered with Aerochamber request.";
|
|
|
|
|
|
order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
|
with Catalog_Item_Name;
|
|
|
|
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
|
with CV_Obj,
|
|
order_catalog_item,
|
|
order_Creation_Reason,
|
|
RequestedBy_obj,
|
|
WSRequestedBySource,
|
|
WSSessionType,
|
|
WSSessionReason,
|
|
location_obj,
|
|
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
|
|
|
|
|
if (Order_catalog_item.Name in ("Aerochamber")) then
|
|
GeneralOrder_obj.SpecialInstructions := order_Creation_Reason;
|
|
//GeneralOrder_obj.RequestedTime := "Now";
|
|
endif;
|
|
if( GeneralOrder_obj is NOT NULL ) then
|
|
void := call GeneralOrder_Obj.Save;
|
|
void := call GeneralOrder_Obj.Dispose;
|
|
endif;
|
|
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;
|
|
|
|
;;
|
|
evoke: on_order_enter;
|
|
|
|
;;
|
|
logic:
|
|
|
|
conclude true;
|
|
|
|
;;
|
|
action:
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|