240 lines
7.4 KiB
Plaintext
240 lines
7.4 KiB
Plaintext
maintenance:
|
||
|
||
title: SCH_Special_Need_Order_Generate;;
|
||
mlmname: SCH_Special_Need_Order_Generate;;
|
||
arden: version 2.5;;
|
||
version: 5.50;; // FP1
|
||
institution: SCH ;;
|
||
author: Shivprasad Jadhav ;;
|
||
specialist: ;;
|
||
date: 2014-03-13;;
|
||
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.02.2012 GOS CSR:33112 - Created MLM
|
||
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 ("Pediatric Patient Profile","Adult Patient Profile","ED Triage Note","OB Patient Profile", "Adult Patient Profile - Observation", "Adult Patient Profile - Behavioral Health")};
|
||
Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Pediatric Patient Profile","Adult Patient Profile","ED Triage Note","OB Patient Profile", "Adult Patient Profile - Observation", "Adult Patient Profile - Behavioral Health")};
|
||
|
||
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 In ( "SCH_Ped_Special need", "sch_obpt_Special Need", "SCH_Adultpt_Special need","sch_edtriage_Special need") };
|
||
|
||
(val1) := read
|
||
{ ObsFSListValues: Value
|
||
Referencing ObsFSListValues_Obj
|
||
};
|
||
|
||
|
||
//Mobility Imapaired Duplicate Order Control Variable
|
||
|
||
Mob :=0;
|
||
//--------------------------------------------------
|
||
for i in 1 seqto count of val1 do
|
||
|
||
|
||
order_Name := val1[i] ;
|
||
|
||
/*If order_Name = "Blind" Then
|
||
order_Name:="Visually Impaired";
|
||
ElseIf order_Name = "Deaf" Then
|
||
order_Name:="Hearing Impaired";
|
||
Else */
|
||
If order_Name in ( "Immobility Risk – Service Animal","Immobility Risk – Special Call Bell" ) Then
|
||
order_Name:="Mobility Impaired";
|
||
Mob := Mob + 1 ;
|
||
EndIf;
|
||
|
||
|
||
ordName := Call (order_Name as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with "{{{SINGLE-QUOTE}}}" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}, "{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}};
|
||
|
||
(dup_order_list) := read last
|
||
{ " select name "
|
||
||" from cv3order "
|
||
||" where ClientGUID = " || sql(client_guid)
|
||
||" and ClientVisitGUID = " || sql(Active_ClientVisitGUID)
|
||
||" and name = {{{SINGLE-QUOTE}}}" || ordName || "{{{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 = "Blind" Then
|
||
Catalog_Item_Name:="Visually Impaired";
|
||
ElseIf Catalog_Item_Name = "Deaf" Then
|
||
Catalog_Item_Name:="Hearing Impaired";
|
||
Else */
|
||
If Catalog_Item_Name in ( "Immobility Risk – Service Animal","Immobility Risk – Special Call Bell" ) And Mob = 1 Then
|
||
Catalog_Item_Name:="Mobility Impaired";
|
||
EndIf;
|
||
|
||
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:
|