Initial Checking with all 820 MLMs
This commit is contained in:
194
MLMStripper/bin/Debug/SCH/SCH_CREATE_CONSULT_FROM_ORDER.mlm
Normal file
194
MLMStripper/bin/Debug/SCH/SCH_CREATE_CONSULT_FROM_ORDER.mlm
Normal file
@@ -0,0 +1,194 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_CREATE_CONSULT_FROM_ORDER;;
|
||||
mlmname: SCH_CREATE_CONSULT_FROM_ORDER;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Eclipsys;;
|
||||
specialist: ;;
|
||||
date: 2010-03-12;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create a consult careprovider when entered (either on hold or active)
|
||||
Discontinue / delete careprovider when order DC{{{SINGLE-QUOTE}}}d
|
||||
;;
|
||||
explanation: Med Rec introduction of orders as hold session
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
06.19.2017 DW CSR# 35742 MLM - Introduce Palliative Care Consult form orders
|
||||
|
||||
|
||||
;;
|
||||
keywords: Objects+, Care Provider Visit Role, Auto create care provider, auto DC care provider
|
||||
;;
|
||||
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";
|
||||
|
||||
/* link_value := "CrClCalc.exe";
|
||||
shell_to_win := INTERFACE
|
||||
{long shell32:ShellExecuteA(long, char*, char*, char*, char*, char*)};
|
||||
x := call shell_to_win with 0, "open",
|
||||
link_value,NULL, NULL, "SW_SHOWNORMAL";
|
||||
*/
|
||||
WhatAmIDoing := "";
|
||||
|
||||
on_order_enter:= event {OrderEnter User Order:
|
||||
WHERE Name in ("Physician Consult", "Anesthesia Consult","Rehabilitation Consult","Palliative Care Consult")};
|
||||
|
||||
on_order_DC := event {OrderDiscontinue User Order:
|
||||
WHERE Name in ("Physician Consult", "Anesthesia Consult","Rehabilitation Consult","Palliative Care Consult")};
|
||||
|
||||
if called_by_editor then
|
||||
EvokingObject := read last {Order: THIS
|
||||
WHERE Name in ("Physician Consult", "Anesthesia Consult","Rehabilitation Consult","Palliative Care Consult")};
|
||||
endif;
|
||||
|
||||
NewConsult_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object created by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "CareProviderVisitRole Object",
|
||||
rule_number := 2010 ];
|
||||
|
||||
Discontinue_Consult_dest := destination { ObjectsPlus } with
|
||||
[ alert_type := "Warning",
|
||||
short_message := "Object deleted by MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
rule_group := "CareProviderVisitRole Object",
|
||||
rule_number := 2040 ];
|
||||
|
||||
dose_exceeded_alert := destination { Alert: Warning, "Daily Dosage Exceeded", high,
|
||||
chart, "Dosage Administration Alert", 5010,"DoNotSend" };
|
||||
|
||||
client_GUID := read last { ClientInfo: GUID };
|
||||
userguid,user_id :=read last {UserInfo: guid,idcode};
|
||||
|
||||
(order_name,
|
||||
order_summaryline,client_visit_guid
|
||||
) := read last
|
||||
{Order: Name, summaryline,clientvisitguid REFERENCING EvokingObject };
|
||||
|
||||
substring_mlm := MLM {{{SINGLE-QUOTE}}}UTIL_STRING_BETWEEN{{{SINGLE-QUOTE}}};
|
||||
link_value:=CALL substring_mlm with (order_summaryline,"(",")");
|
||||
|
||||
if EvokingEvent = on_order_DC
|
||||
then
|
||||
|
||||
removeprovvisitrole_guid :=
|
||||
read last { " select cpvr.guid from cv3careproviderid as cpi with (nolock) "
|
||||
||" join cv3careprovidervisitrole as cpvr with (nolock) "
|
||||
||" on cpvr.clientguid = " || sql(client_GUID)
|
||||
||" and cpvr.clientvisitguid = " ||sql(client_visit_guid)
|
||||
||" and cpvr.providerguid = cpi.providerguid "
|
||||
||" and cpvr.active = 1 "
|
||||
||" and cpvr.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} "
|
||||
||" and cpvr.fromdtm <= getdate() "
|
||||
||" and (cpvr.todtm is null or cpvr.todtm >= getdate()) "
|
||||
||" and cpvr.rolecode = {{{SINGLE-QUOTE}}}Consulting{{{SINGLE-QUOTE}}} "
|
||||
||" where cpi.IDCode = " ||sql(link_value)
|
||||
||" and cpi.ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}} "
|
||||
};
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
evoke: on_order_enter
|
||||
or
|
||||
on_order_DC ;
|
||||
// on_order_modify;
|
||||
// visit_enter;
|
||||
;;
|
||||
logic:
|
||||
|
||||
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ((Client_Visit_Guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
||||
|
||||
if EvokingEvent = on_order_enter
|
||||
then
|
||||
try
|
||||
|
||||
|
||||
careprovider_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById
|
||||
with ("Edstan Number (physician)",link_value);
|
||||
|
||||
careprovidername := careprovider_obj.PrimaryID;
|
||||
|
||||
New_CareProvVisitRole_obj := call {{{SINGLE-QUOTE}}}CareProviderVisitRole{{{SINGLE-QUOTE}}}.CreateCareProviderVisitRole
|
||||
with
|
||||
(client_visit_obj, //ClientVisit
|
||||
careprovider_obj, // provider
|
||||
"Consulting" // Consulting type
|
||||
);
|
||||
|
||||
NewConsult_dest.ObjectsPlus := New_CareProvVisitRole_obj ;
|
||||
endtry;
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
|
||||
if ( New_CareProvVisitRole_obj is NOT NULL ) then
|
||||
void:= call New_CareProvVisitRole_obj.Dispose;
|
||||
New_CareProvVisitRole_obj := null;
|
||||
endif;
|
||||
|
||||
NewConsult_dest:= null;
|
||||
endcatch;
|
||||
|
||||
elseif EvokingEvent = on_order_DC
|
||||
then
|
||||
|
||||
try
|
||||
if exists removeprovvisitrole_guid
|
||||
then
|
||||
Discontinue_Consult_Obj := call {{{SINGLE-QUOTE}}}CareProviderVisitRole{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
||||
with ( (removeprovvisitrole_guid as number ) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
||||
empty := call Discontinue_Consult_Obj.Discontinue;
|
||||
Discontinue_Consult_dest.ObjectsPlus := Discontinue_Consult_Obj;
|
||||
endif;
|
||||
endtry;
|
||||
catch exception ex
|
||||
error_occurred := true;
|
||||
error_message := error_message || "{{+R}}Discontinue HI {{-R}} \n\n";
|
||||
if ex.InnerException is not null net_object then
|
||||
error_message := error_message || "Inner Exception " || ex.InnerException.Message || "\n\n";
|
||||
endif;
|
||||
|
||||
if (Discontinue_Consult_Obj is not null) then
|
||||
void := call Discontinue_Consult_Obj.Dispose;
|
||||
Discontinue_Consult_Obj := null;
|
||||
endif;
|
||||
Discontinue_Consult_dest := null;
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
if exists NewConsult_dest then
|
||||
write TRUE at NewConsult_dest ;
|
||||
endif;
|
||||
|
||||
if exists Discontinue_Consult_dest then
|
||||
write TRUE at Discontinue_Consult_dest ;
|
||||
endif;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user