Initial Checking with all 820 MLMs
This commit is contained in:
261
MLMStripper/bin/Debug/SCH/SCH_READMISSION_PHARMACY_ORDER.mlm
Normal file
261
MLMStripper/bin/Debug/SCH/SCH_READMISSION_PHARMACY_ORDER.mlm
Normal file
@@ -0,0 +1,261 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_Readmission_Pharmacy_Order;;
|
||||
mlmname: SCH_Readmission_Pharmacy_Order;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;; // FP1
|
||||
institution: SCH ;;
|
||||
author: Chintan Tilwa;;
|
||||
specialist: ;;
|
||||
date: 2012-09-19;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Create Pharmacy Risk orders and health issues based upon Admission Profile Selections
|
||||
|
||||
;;
|
||||
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
|
||||
|
||||
10.15.2012 CT CSR# 30880 - Created by GOS for Readmission Initiative Project
|
||||
04.30.2013 DW CSR# 31334 - Adjusted to support the re-configuration of Pregnancy & Lactation questions
|
||||
10.12.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 Coding Scheme [ICD10] And Duplicate Check of HI .DE
|
||||
11.21.2018 DW HD#2388518 - Dialysis Patient has duplicate Health Issues (joining on clientguid)
|
||||
|
||||
;;
|
||||
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;
|
||||
|
||||
HI_mod_mlm := MLM {{{SINGLE-QUOTE}}}SCH_Create_General_Order{{{SINGLE-QUOTE}}};
|
||||
// str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
|
||||
// Evoking Events
|
||||
|
||||
Document_Enter := event {ClientDocumentEnter User ClientDocument: where documentname in ("Readmission Risk Assessment","Adult Patient Profile","Adult Patient Profile - Observation")};
|
||||
Document_Modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Readmission Risk Assessment","Adult Patient Profile","Adult Patient Profile - Observation")};
|
||||
|
||||
// Gather the components of the Order Object
|
||||
|
||||
user_IDType := "Primary";
|
||||
careProvider_obj := read last{UserInfo: careProvider };
|
||||
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, chartguid)
|
||||
:= read last {ClientVisit: CurrentLocationGUID, GUID, clientguid, chartguid };
|
||||
|
||||
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}}}) ;
|
||||
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}}});
|
||||
WSSessionType := "Standard";
|
||||
WSSessionReason := "";
|
||||
WSRequestedBySource:= "";
|
||||
order_Creation_Reason := "From Test MLM" ;
|
||||
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;
|
||||
|
||||
|
||||
// Determine which of the questions have a response of "yes"
|
||||
|
||||
(Client_Observation_Document_Obj, GUID)
|
||||
:= read last {ClientDocument: ClientObservationDocument, GUID
|
||||
REFERENCING EvokingObject};
|
||||
|
||||
(PregnancyResponse):= read Last {ClientObservationDocument: ObsFSListValues
|
||||
REFERENCING Client_Observation_Document_Obj where Name = "SCH_PRO fem repro pg yn"};
|
||||
|
||||
(LactationResponse):= read Last {ClientObservationDocument: ObsFSListValues
|
||||
REFERENCING Client_Observation_Document_Obj where Name = "SCH_PRO fem repro breastfeed yn"};
|
||||
|
||||
(DialysisResponse) := read Last {ClientObservationDocument: ObsFSListValues
|
||||
REFERENCING Client_Observation_Document_Obj where Name = "SCH_CK_Dialysis y/n"};
|
||||
|
||||
if PregnancyResponse.value = "yes" then pregval := "Pregnant"; else pregval := ""; endif;
|
||||
if LactationResponse.value = "yes" then feedval := "Lactating"; else feedval := ""; endif;
|
||||
if DialysisResponse.value = "yes" then dialval := "On Dialysis";else dialval := ""; endif;
|
||||
|
||||
val1:= (pregval,feedval,dialval);
|
||||
|
||||
|
||||
// Loop through each of the selections.
|
||||
|
||||
|
||||
for i in 1 seqto count of val1 do
|
||||
|
||||
Selection_Name := val1[i] ;
|
||||
|
||||
if Selection_Name <> ""
|
||||
|
||||
then
|
||||
|
||||
|
||||
// Search for a health issue related to this selection and create one if it doesn{{{SINGLE-QUOTE}}}t exist
|
||||
|
||||
if Selection_Name = "Pregnant" then
|
||||
(PregnantHI) := read
|
||||
{ "select distinct hi.shortname "
|
||||
|| "from cv3healthissuedeclaration hi with (nolock) "
|
||||
|| "join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
|
||||
|| "where hi.clientvisitguid = " || Active_ClientVisitGUID || " "
|
||||
|| "and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} And hi.ICD10Code is not null " //Added By Shivprasad for CSR 23359-ICD9-10 On 16 Sept 2015
|
||||
|| "and hi.typecode = {{{SINGLE-QUOTE}}}problem-visit{{{SINGLE-QUOTE}}} and hi.shortname = {{{SINGLE-QUOTE}}}Pregnancy{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
If not exists PregnantHI then
|
||||
hitype := "Problem-Visit";
|
||||
hiname := "Pregnancy";
|
||||
hinumber:= "Z33.1"; //"V22.2"; //CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad
|
||||
hischeme:= "ICD10"; //"ICD9"; //CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad
|
||||
hitext := "Created from Patient Profile information. " ;
|
||||
|
||||
Func_Create_HI_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_Create_Health_Issue{{{SINGLE-QUOTE}}};
|
||||
void := call Func_Create_HI_MLM with (Active_ClientVisitGUID,hiname,hinumber,hitext,hitype,hischeme);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if Selection_Name = "Lactating" then
|
||||
(LactatingHI) := read
|
||||
{ "select distinct hi.shortname "
|
||||
|| "from cv3healthissuedeclaration hi with (nolock) "
|
||||
|| "join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
|
||||
|| "where hi.clientvisitguid = " || Active_ClientVisitGUID || " "
|
||||
|| "and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} And hi.ICD10Code is not null " //Added By Shivprasad for CSR 23359-ICD9-10 On 16 Sept 2015
|
||||
|| "and hi.typecode = {{{SINGLE-QUOTE}}}problem-visit{{{SINGLE-QUOTE}}} and hi.shortname = {{{SINGLE-QUOTE}}}Lactating Mother{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
if not exists LactatingHI then
|
||||
hitype := "Problem-Visit";
|
||||
hiname := "Lactating Mother";
|
||||
hinumber:= "Z39.1"; //"V24.1";//CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad
|
||||
hischeme:= "ICD10"; //"ICD9"; //CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad
|
||||
hitext := "Created from Patient Profile information. " ;
|
||||
|
||||
Func_Create_HI_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_Create_Health_Issue{{{SINGLE-QUOTE}}};
|
||||
void := call Func_Create_HI_MLM with (Active_ClientVisitGUID,hiname,hinumber,hitext,hitype,hischeme);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if Selection_Name = "On Dialysis" then
|
||||
(DialysisHI) := read
|
||||
{ "select distinct hi.shortname "
|
||||
|| "from cv3healthissuedeclaration hi with (nolock) "
|
||||
|| "join CV3CodedHealthIssue chi with (nolock) on chi.GUID = hi.CodedHealthIssueGUID "
|
||||
|| "where hi.clientguid = " || client_guid || " "
|
||||
|| "and hi.active = 1 and hi.status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}} And hi.ICD10Code is not null " //Added By Shivprasad for CSR 23359-ICD9-10 On 16 Sept 2015
|
||||
|| "and hi.typecode = {{{SINGLE-QUOTE}}}problem-chronic{{{SINGLE-QUOTE}}} and hi.shortname = {{{SINGLE-QUOTE}}}Dialysis Patient{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
// 11/21/2018 HD# 2388518 replaced this line with one that joins on client guid || "where hi.clientvisitguid = " || Active_ClientVisitGUID || " "
|
||||
|
||||
// ClientVisitGUID, client_guid, chartguid
|
||||
|
||||
if not exists DialysisHI then
|
||||
hitype := "Problem-Chronic";
|
||||
hiname := "Dialysis Patient";
|
||||
hinumber:= "Z99.2" ;//"V45.11"; //CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad
|
||||
hischeme:= "ICD10"; //"ICD9"; //CSR#23359-ICD9-ICD10 HI Change for Code Scheme ICD10- Added By shivprasad
|
||||
hitext := "Created from Patient Profile information. " ;
|
||||
|
||||
Func_Create_HI_MLM := mlm {{{SINGLE-QUOTE}}}SCH_Func_Create_Health_Issue{{{SINGLE-QUOTE}}};
|
||||
void := call Func_Create_HI_MLM with (Active_ClientVisitGUID,hiname,hinumber,hitext,hitype,hischeme);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
// Search for an order related to this selection and create one if it doesn{{{SINGLE-QUOTE}}}t exist
|
||||
|
||||
|
||||
(dup_order_list) := read last
|
||||
{ " select name "
|
||||
||" from cv3order "
|
||||
||" where ClientGUID = " || sql(client_guid)
|
||||
||" and ClientVisitGUID = " || sql(Active_ClientVisitGUID)
|
||||
||" and name = {{{SINGLE-QUOTE}}}" || Selection_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] ;
|
||||
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; // Does current order exist?
|
||||
|
||||
|
||||
endif; // Is the order name <> ""?
|
||||
|
||||
enddo;
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: Document_Enter;
|
||||
Document_Modify;
|
||||
;;
|
||||
logic:
|
||||
|
||||
if EvokingObject is null
|
||||
then
|
||||
conclude false;
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
|
||||
;;
|
||||
action:
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user