Initial Checking with all 820 MLMs

This commit is contained in:
2020-02-02 00:54:01 -05:00
parent c59dc6de2e
commit 840d0432f4
828 changed files with 239162 additions and 0 deletions

View File

@@ -0,0 +1,561 @@
maintenance:
title: SRG_CHG_SCH_ANESTHESIA_POLICY - an MLM that is assigned as a policy based on Procedure;;
mlmname: SRG_CHG_SCH_ANESTHESIA_POLICY ;;
arden: version 2.5;;
version: 16.3;;
institution: St Claire ;;
author: Allscripts Healthcare Solutions, Inc.;;
specialist: R. Johnson;;
date: 2017-04-14;;
validation: testing;;
/* P r o p r i e t a r y N o t i c e */
/* Unpublished (c) 2015 - 2015 Allscripts Healthcare, LLC. and/or its affiliates. All Rights Reserved.
P r o p r i e t a r y N o t i c e: This software has been provided pursuant to a License Agreement, with
Allscripts Healthcare, LLC. and/or its affiliates, containing restrictions on its use. This software contains
valuable trade secrets and proprietary information of Allscripts Healthcare, LLC. and/or its affiliates and
protected by trade secret and copyright law. This software may not be copied or distributed in any form or medium,
disclosed to any third parties, or used in any manner not provided for in said License Agreement except with prior
written authorization from Allscripts Healthcare, LLC. and/or its affiliates. Notice to U.S. Government Users:
This software is {{{SINGLE-QUOTE}}}Commercial Computer Software{{{SINGLE-QUOTE}}}.
All product names are the trademarks or registered trademarks of Allscripts Healthcare, LLC. and/or its affiliates.
*/
/* P r o p r i e t a r y N o t i c e */
library:
purpose:
to demonstrate an MLM that is assigned as a policy of a charging rule for Anesthesia times generating flat rate charges.
;;
explanation:
This MLM demonstrates an MLM that is assigned as a policy of a charging rule so that charging transactions
will be generated based on the number of staff attending the surgery. It returns a list of charge codes to generate
charging transactions for. A charging transaction will be created for each unique charge code in the list. The
quantity of the charging transaction will be set to the number of occurrences of the charge code in the list.
The MLM uses the following logic to determine what charge code to return.
Change history
04/14/17 - finish initial build anesth master list
04/16/17 - ready list and loops for initial load into SCH DEV 163
05/15/17 - update master list and correct for proper Anestheisa Stop Time Event
06/20/17 - updated master list for more specificity in the members
07/24/17 - added for processing ECT falt fee anesthesia
10/09/17 - addition of Anesth Types: General
11/15/17 - tightened match on anesthesia names
01/05/18 - addition of General types and Regional types
01/09/18 - added listing for Spinal + Epidural to charge for Spinal
08.20.2018 DW CSR# 37047 - Remove ECT from Surgical Charge MLM
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
/// MLM dependenciy - needed to parse Master lists
parse_MLM:= MLM {{{SINGLE-QUOTE}}}Util_String_Parse{{{SINGLE-QUOTE}}} ;
/////////////////////////////////////////////////////
/// *** SCH Master lists for Anesthesia Charge Codes *** ///
/// specific Anesthesia type codes
// mac_15:= "10323" ;
// spine_15:= "10321" ;
/// codes for > top times for anesth
//anesth_over:= "10301";
/// Ensure entries are as follows for General Anesthesia list:
/// "<charge code>|<Description", "<charge code>|<Description", etc
anesth_master:= "25012100|MAC to General",
// "25011200|MAC to General LMA",
// "25011300|MAC to General Mask",
"25012100|Spinal to General",
// "25011200|Spinal to General LMA",
// "25011300|Spinal to General Mask",
// "25011000|General ETT",
// "25011200|General LMA",
// "25011300|General Mask",
// "25011400|General Cardiac",
"25011500|Spinal",
/// 01/09/18 - added for Spinal + Epidural
"25011500|Spinal+Epidural",
/// 01/05/18 - addedd
"25011600|Local+MAC",
"25011600|MAC",
"25011700|Labor Epidural",
"25011701|Epidural",
"25011800|Regional (Block)",
///01/05/18 - addition of Rgional types
"25011800|MAC+Regional",
"25011800|Local+Regional",
/// 10/09/17 - addition of Anesth Types
/// 01/05/18 - addition of General types
"25012100|General+Epidural",
"25012100|General+Spinal",
"25012100|Local+General",
"25012100|Regional+General",
"25012100|General",
"25012200|General Major"
;
/// 07/24/17 - added for processing ECT falt fee anesthesia
ECT_master:= "25015100";
/////////////////// end of Master lists /////////////////////////////////////////////
using "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
using namespace "System";
using namespace "System.Collections.Generic";
log_execution_info := false;
// The MLM is passed one argument which is the SRGCase object of the case which charges are being generated for.
(case_obj) := argument;
if called_by_editor then
case_obj := read last { SRGCase: THIS Where CaseIdentifier = "370" }; // test, debbie = 29 flower, aster = 45 14 = sixteen, courtney
// "C00205" = SSC. Bobst c00203 "C00166" = SSC, Append - C00206 "C00163" "C00169" = SSC, HIP / C00204 "C00181" = SSC, GIBLD
// "C00259" = Sched, Charli (-6186) "c00243" etopic c00324 = Charges Two
u_name:= read last {UserInfo: IDCode};
evokingobject:= case_obj;
//caseF_obj:= read as [object] { SRGCase: Where CaseIdentifier = "114" };
//ray_obj:= caseF_obj;
endif;
// Get the case participants object from the case object
( case_participants ) := read { SRGCase: SRGCaseParticipant REFERENCING case_obj };
// Get the case participants as a list from the case participants object
( case_participants_list ) := case_participants.records__;
/// FOR SCH per minute Level charging investigation
/// 01/27/17 - added for determining Location of patient
lcode, levcode, lname, DeptGuid := read last { " select lo.code, lo.levelcode, lo.name " //, log.GUID"
||" from CV3Location lo"
//||" LEFT JOIN CV3LocationFunctionGroup log ON (log.GUID = "
//||" ( SELECT x.LocnFuncGroupGUID"
//||" FROM CV3LocationFunctionGroupXRef x"
//||" INNER JOIN CV3LocationFunctionGroup lfg on (lfg.GUID = x.LocnFuncGroupGUID) "
//||" WHERE x.LocnGroupGUID = (CASE WHEN lo.IsLocationGroup = 1 THEN lo.GUID ELSE lo.LocnGrpGUID END) "
//||" AND lfg.SysFunctionType = 19)) "
||" where lo.GUID = "|| sql(evokingobject.LocationGUID) };
/////////////////////////////////////////////////////////////////////////////
// u_name := read last {UserInfo: DisplayName};
EvokingObject:= case_obj;
// find the case event that match the time type name parameter
bu_case_obj:= evokingObject.backup;
get_status:= EVOKINGOBJECT.CaseStatusName;
get_status_type:= EVOKINGOBJECT.CaseStatusInternalType;
get_anesth:= EVOKINGOBJECT.AnesthesiaTypeName;
get_anesth_id:= EVOKINGOBJECT.AnesthesiaTypeID ;
proc_end := evokingobject.ActualEndDateTimeUTC as time;
proc_start:= evokingobject.ActualStartDateTimeUTC as time;
durat:= proc_end - proc_start;
dur_m:= durat/1 minute;
dur_m := dur_m as number;
/// testing -
/* if evokingobject.caseidentifier = "C00206" then
dur_m := 643;
endif;
*/
///////
/// 07/24/17
is_ect:= 0 ;
/// 05/18/15 added for - participant object for ROLE
srg_part:= evokingobject.SRGCaseParticipant;
get_parts:= srg_part.Records__;
ct_parts:= count get_parts;
/// 05/20/15 - added for procedure parts to find Charge codes
proc_parts:= evokingobject.SRGCaseProcedure;
get_procs:= proc_parts.Records__;
ct_procs := count get_procs;
/// 10/13/16 - for query to get charge ID
get_proc_id:= proc_parts.CaseProcedureID; //get_procs.Records__;
/// Get the Prinmary Performed Procedure
//get_proc_idp:= null;
For i in 1 seqto ct_procs DO
this_proc:= get_procs[i];
get_this_proc:= this_proc.records__;
if this_proc.IsPrimary = true and this_proc.HasBeenPerformed = true
//if get_procs[i].IsPrimary = true and get_procs[i].HasBeenPerformed = true
then
get_proc_idp:= this_proc.CaseProcedureID;
get_proc_desc:= this_proc.Description;
//break;
endif;
/// 07/24/17
if get_proc_desc matches pattern "ECT%"
then
is_ect := is_ect + 1;
endif;
/////////////////////////////////////////////////
this_proc:= null;
//break;
ENDDO ;
/// FOr items and times if needed
proc_items:= EVOKINGOBJECT.SRGCaseItem;
get_items:= proc_items.Records__;
get_surg_items:= proc_items.SRGDepartmentSurgicalItem.Records__;
///
/// 11/11/16 - for PACU and Anesthesia
event_items := EVOKINGOBJECT.SRGCaseEvent;
get_event:= event_items.Records__;
ct_ev:= count get_event;
get_times:= get_event.SRGCaseEventTime.Records__ ;
ct_times:= count get_times;
FOR i in 1 seqto ct_times DO
this_time:= get_times[i];
//// now in each event time pair
FOR m in 1 seqto count this_time DO
this_time_d:= this_time[m];
if this_time_d.EventTimeLabel = "PACU Out" then pacu_out:= this_time_d.EventDateTimeUTC ; endif;
if this_time_d.EventTimeLabel = "PACU In" then pacu_in:= this_time_d.EventDateTimeUTC ; endif;
if this_time_d.EventTimeLabel = "Anesthesia Stop" then anes_out:= this_time_d.EventDateTimeUTC ; endif;
if this_time_d.EventTimeLabel = "Anesthesia Start" then anes_in:= this_time_d.EventDateTimeUTC ; endif;
ENDDO;
//pac_out:= first of (get_times.EventDateTimeUTC where get_times.EventTimeLabel = "PACU Out" );
//pac_in:= first of (get_times.EventDateTimeUTC where get_times.EventTimeLabel = "PACU In" );
//break;
ENDDO;
/// do durations from each timing pair:
/// PACU
if exists pacu_out then
pacu_out_t := pacu_out as Time; //endif;
pacu_in_t := pacu_in as Time; // endif;
pacu_d:= (pacu_out_t - pacu_in_t)/ 1 minute;
pacu_m := pacu_d as number;
chg_code_proc2:= ""; // for PACU
endif;
/// Anesthesia
/// 12/08/16 update for only these Anest
///01/05/18 - change to "=" for Local as will need local for doubles
IF get_anesth matches pattern "Consult%"
OR
get_anesth matches pattern "N/A%"
OR
get_anesth matches pattern "Sedation%"
OR
get_anesth = "Local"
then
stop:=1;
elseif exists anes_out
then anes_out_t := anes_out as Time; // endif;
anes_in_t := anes_in as Time; //endif;
anes_d:= (anes_out_t - anes_in_t)/ 1 minute;
anes_m := anes_d as number;
get_anes_0:= (anes_m/15);
get_anes_int := int (anes_m/15);
if get_anes_0 > get_anes_int then
anes_num:= get_anes_int + 1; // round(get_qty_0);
else
anes_num := get_anes_int;
endif;
chg_code_proc:= ""; // for Anesthesia
//endif;
ENDIF;
// MLM testing area - comment out when done
If called_by_editor then
ray:=15;
// get_anesth := "Spinal";
// anes_m:= 181;
// anes_num:= 12;
endif;
////////////////////////////////
/// 11/14/16 - Logic for the charge code accumulations //////////////////////////////////////////////
get_chg_code:= "";
// chg_code_proc:= ""; // for Anesthesia
//chg_code_proc2:= ""; // for PACU
///Anesthesia
/// 07/24/17 - added for ECT to just get a flat charge
/* 08/20/2018 DW commented out for CSR# 37047 - stop passing ECT anesthesia charge
IF is_ect > 0 then
chg_code_proc:= ect_master;
ELSEIF exists chg_code_proc //get_anesth matches pattern "MAC%"
*/
IF exists chg_code_proc //get_anesth matches pattern "MAC%"
OR
get_anesth matches pattern "Spinal%"
then
/// Get appropriate master list of charges
list_use:= anesth_master ;
ct_list:=count list_use;
IF exists list_use then
/// SCH - now cycle through master list to get the matching Charge for the Duration of the Anesthesia
FOR i in 1 seqto count list_use DO
If chg_code_proc = "" then
chg_lst:= call parse_mlm with list_use[i], "|";
lst_chg:= trim (chg_lst[1]);
lst_desc:= trim (chg_lst[2]);
lst_desc_m := string(lst_desc||"%");
/// get high minute level from description
/* ext_desc:= extract characters lst_desc;
ct_ext:= count ext_desc;
find_to:= find first "-" in string(lst_desc) ;
use_to:= find_to ; // + 1;
get_top_min_0:= string (last (ct_ext - use_to) from ext_desc);
get_top_min:= call (get_top_min_0 as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with "MIN", "" as string;
/// pre_iona := call (get_src as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}).Replace with obs_nm, "" as string;
hi_minute:= get_top_min as number;
/// test for selecting correct charge
*/
/// 11/15/17 - change
IF get_anesth = lst_desc // matches pattern lst_desc_m // <= hi_minute
then
chg_code_proc:= lst_chg;
ENDIF;
/////////////////////////////////
ENDIF; // chg_code proc = ""
//// get the last upper time limit
/////////////////////////////////
ENDDO;
ENDIF;// exists List_use
//endif; // exists get_proc_idp
///Do the loop to make the per min charges if over the last charge codes
/// for testing
//dur_m := 485;
//for_over:= 420;
//over_use:= minor_over;
If exists for_over AND anes_m > for_over AND exists anesth_over
then
Get_remain:= int(anes_m - for_over) ; // as integer ;
Get_qty_0:= (get_remain/15);
get_qty_int := int (get_remain/15);
if get_qty_0 > get_qty_int then
get_qty:= get_qty_int + 1; // round(get_qty_0);
else
get_qty:= get_qty_int;
endif;
Get_gt_over:= "";
For i in 1 seqto get_qty DO
If get_gt_over = "" then
get_gt_over:= anesth_over;
else
get_gt_over:= get_gt_over, anesth_over;
endif;
Enddo;
ENDIF; // for_over and dur_m
//break;
///tally charges if dur_m > than last charge code time
if exists get_gt_over then
ct_over_a:= count get_gt_over;
If ct_over_a >= 1// exists get_gt_over and get_gt_over <> ""
then
chg_code_proc:= chg_code_proc, get_gt_over;
ENDIF;
endif; //get_gt_over
ENDIF; // if get_anesth logic
//// End of Anesthesia ///////////////////////////////////////////////////////
/// 12/08/16 new tally for both Anest and PACU
IF exists chg_code_proc or exists chg_code_proc2 // ct_chg1 > 0 OR ct_chg2 > 0 //chg_code_proc <> "" OR chg_code_proc2 <> ""
then
ray:= 11;
if not (exists chg_code_proc ) AND exists chg_code_proc2
then
chg_code_proc := chg_code_proc2 ;
elseif
exists chg_code_proc AND exists chg_code_proc2
then
chg_code_proc := chg_code_proc, chg_code_proc2 ;
///12/08/16
elseif
not (exists chg_code_proc) AND not (exists chg_code_proc2 )
then
ct_ch_co:= 0;
//chg_code_proc := chg_code_proc, chg_code_proc2 ;
endif;
else
ct_ch_co := 0;
ENDIF; // if either <> ""
if not (exists ct_ch_co) then
ct_ch_co:= count chg_code_proc;
endif;
if u_name matches pattern "services%"
then
ray:=15;
break;
endif;
idest_msg := "Evoke Charge MLM per minute";
idest:= destination{IntermediateMessage: Warning, idest_msg,
low, chart, "RuleGroupHere1", 1001, "", "" };
msg_text:= dur_m||", "||get_proc_idp||"; " ;
////
;;
priority: 50
;;
evoke:
;;
logic:
/* circulator_count := 0;
scrub_count := 0;
for case_participant in case_participants_list do
for surgery_role_name in case_participant.SurgeryRoleName do
if (surgery_role_name = "Circulator") then
circulator_count := circulator_count + 1;
endif;
if (surgery_role_name = "Scrub") then
scrub_count := scrub_count + 1;
endif;
enddo;
enddo;
*/
charge_codes := new net_object {{{SINGLE-QUOTE}}}List<String>{{{SINGLE-QUOTE}}};
///Do the loop to make the per min charges
If ct_ch_co > 0 then//exists dur_m AND
// (exists chg_code_proc AND chg_code_proc <> "") then //get_chg_code then
//ct_ch_co:= count chg_code_proc ;//dur_m := dur_m as number;
///testing
// chg_code_test:= ct_ch_cochg_code_proc;
compile:= "";
compile_ct:= "";
For i in 1 seqto ct_ch_co DO // count chg_code_proc DO
compile_ct:= compile_ct, i; //chg_code_proc;
ret := call charge_codes.Add with chg_code_proc[i] ; //get_chg_code;
compile:= compile, chg_code_proc[i];
ENDDO;
/*if (circulator_count + scrub_count > 0) then
if (circulator_count + scrub_count = 1) then
ret := call charge_codes.Add with "00";
elseif (circulator_count = 1 and scrub_count = 1) then
ret := call charge_codes.Add with "11";
elseif (circulator_count + scrub_count = 3) then
ret := call charge_codes.Add with "12";
else
ret := call charge_codes.Add with "33";
endif;
endif;
*/
msg_text:= msg_text||compile ;
ENDIF;
conclude true;
;;
action:
return //compile ; //
charge_codes;
//if exists idest then
//write msg_text at idest;
//endif;
;;
Urgency: 50
;;
end: