695 lines
36 KiB
Plaintext
695 lines
36 KiB
Plaintext
maintenance:
|
|
|
|
title: Retrieve Dosage Data for Complex Order Components ;;
|
|
mlmname: STD_FUNC_DOSAGE_RETRIEVE_COMPONENTS;;
|
|
arden: version 2.5;;
|
|
version: 18.4;;
|
|
institution: Allscripts, Standard MLM;;
|
|
author: Allscripts Healthcare Solutions, Inc.;;
|
|
specialist: ;;
|
|
date: 2018-10-26;;
|
|
validation: testing;;
|
|
|
|
/* P r o p r i e t a r y N o t i c e */
|
|
/* Unpublished (c) 2013 - 2018 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 is
|
|
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: Retrieves dosage data for Complex Order components.
|
|
;;
|
|
explanation: The data for complex orders are located in several objects and tables.
|
|
This MLM retrieves data from the Evoking Object, Backup Object, Unsubmitted Orders, and the
|
|
database from the following tables: CV3Order, CV3OrderAddnIlnfo, CV3OrderUserData, and
|
|
CV3OrderVariableComponent. The data are consolidated into the Order_Variable_Component
|
|
object.
|
|
|
|
When the Master Order is first created, all the data in the CV3OrderVariableComponent
|
|
table are up to date. However, as the Child Orders are generated and later modified,
|
|
the data in the CV3OrderVariableComponent table can become out of date. This MLM uses
|
|
data from the Evoking Object, Backup Object, Unsubmitted Orders, and the Database
|
|
to create Order_Variable_Component objects that have the most current dosing information.
|
|
|
|
Two lists of Order_Variable_Component objects are created--one for the current order
|
|
and the other for the backup order. These lists are passed back to the calling MLM.
|
|
;;
|
|
keywords: single dose; average daily dose; total daily dose; dosage range
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
// Set to true if logging is needed.
|
|
log_execution_info := false;
|
|
|
|
|
|
// Get the current order
|
|
(client_guid,
|
|
order_guid,
|
|
order_name,
|
|
order_dosage_low,
|
|
order_dosage_high,
|
|
order_uom,
|
|
order_route_code,
|
|
order_frequency_code,
|
|
order_significant_dtm,
|
|
order_stop_dtm,
|
|
order_additional_info_obj,
|
|
order_user_data_obj,
|
|
order_variable_component_obj,
|
|
order_backup_obj ) := read last
|
|
{ Order: ClientGUID, GUID, Name,
|
|
DosageLow, DosageHigh, UOM, OrderRouteCode, FrequencyCode,
|
|
SignificantDtm, StopDtm,
|
|
OrderAdditionalInfo, OrderUserData,
|
|
OrderVariableComponent, Backup
|
|
REFERENCING EvokingObject};
|
|
|
|
|
|
// Get the backup order
|
|
(backup_order_name,
|
|
backup_order_dosage_low,
|
|
backup_order_dosage_high,
|
|
backup_order_uom,
|
|
backup_order_route_code,
|
|
backup_order_frequency_code,
|
|
backup_order_significant_dtm,
|
|
backup_order_stop_dtm,
|
|
backup_order_additional_info_obj,
|
|
backup_order_user_data_obj,
|
|
backup_order_variable_component_obj ) := read last
|
|
{ Order: Name,
|
|
DosageLow, DosageHigh, UOM, OrderRouteCode, FrequencyCode,
|
|
SignificantDtm, StopDtm,
|
|
OrderAdditionalInfo, OrderUserData,
|
|
OrderVariableComponent
|
|
REFERENCING order_backup_obj};
|
|
|
|
|
|
// Get the current order{{{SINGLE-QUOTE}}}s data from OrderAdditionalInfo object
|
|
(order_freq_from_time,
|
|
order_freq_to_time,
|
|
order_freq_uom,
|
|
order_stop_after_option,
|
|
order_stop_after_value,
|
|
order_dosing_option_guid ) := read last
|
|
{ OrderAdditionalInfo:
|
|
FreqFromTime, FreqToTime, FreqUom,
|
|
StopAfterOption, StopAfterValue, DosingOptionGuid
|
|
REFERENCING order_additional_info_obj };
|
|
|
|
|
|
// Get the backup order{{{SINGLE-QUOTE}}}s data from OrderAdditionalInfo object
|
|
(backup_order_freq_from_time,
|
|
backup_order_freq_to_time,
|
|
backup_order_freq_uom,
|
|
backup_order_stop_after_option,
|
|
backup_order_stop_after_value ) := read last
|
|
{ OrderAdditionalInfo:
|
|
FreqFromTime, FreqToTime, FreqUom,
|
|
StopAfterOption, StopAfterValue
|
|
REFERENCING backup_order_additional_info_obj };
|
|
|
|
// Get the current order{{{SINGLE-QUOTE}}}s data from OrderUserData object
|
|
(order_user_data_code_list,
|
|
order_user_data_value_list ) := read
|
|
{ OrderUserData: UserDataCode, Value
|
|
REFERENCING order_user_data_obj
|
|
Where UserDataCode is in ("CalcDoseMethod" , "CalcActualDose", "CalcUOMPer" ) };
|
|
|
|
|
|
// Get the backup order{{{SINGLE-QUOTE}}}s data from OrderUserData object
|
|
(backup_order_user_data_code_list,
|
|
backup_order_user_data_value_list ) := read
|
|
{ OrderUserData: UserDataCode, Value
|
|
REFERENCING backup_order_user_data_obj
|
|
Where UserDataCode is in ("CalcDoseMethod" , "CalcActualDose", "CalcUOMPer" ) };
|
|
|
|
|
|
// Get DosingOptionGridColumn Info
|
|
dosing_option_data_item_code_list := read
|
|
{"Select DataItemCode "
|
|
||" From CV3DosingOptionGridColumn "
|
|
||" Where DosingOptionGUID = " || SQLEX(order_dosing_option_guid) };
|
|
|
|
|
|
// Declare Order_Variable_Component Object
|
|
Order_Variable_Component := OBJECT
|
|
[Sequence_Number, Complex_Order_Type, GUID, Order_GUID, Child_Order_GUID,
|
|
Dosage_Low, Dosage_High, UOM, Order_Route_Code,
|
|
Frequency_Code, Freq_From_Time, Freq_To_Time, Freq_Uom,
|
|
Calculated_Start_Dtm, Estimated_Stop_Dtm,
|
|
Stop_After_Value, Stop_After_Option_Type,
|
|
Calc_Dose_Method, Calc_Actual_Dose, Calc_UOM_Per,
|
|
// The following object fields are place holders.
|
|
// The data are populated after the READ statement.
|
|
Child_Order_Status_Level_Num ];
|
|
|
|
|
|
// Populate Order_Variable_Component
|
|
current_ovc_list := read as Order_Variable_Component
|
|
{OrderVariableComponent:
|
|
SequenceNumber, ComplexOrderType, GUID, OrderGUID, ChildOrderGUID,
|
|
DosageLow, DosageHigh, UOM, OrderRouteCode,
|
|
FrequencyCode, FreqFromTime, FreqToTime, FreqUom,
|
|
CalculatedStartDtm, EstimatedStopDtm,
|
|
StopAfterValue, StopAfterOptionType,
|
|
CalcDoseMethod, CalcActualDose, CalcUOMPer
|
|
REFERENCING order_variable_component_obj};
|
|
|
|
|
|
// Populate Order_Variable_Component object with BACK Data
|
|
backup_ovc_list := read as Order_Variable_Component
|
|
{OrderVariableComponent:
|
|
SequenceNumber, ComplexOrderType, GUID, OrderGUID, ChildOrderGUID,
|
|
DosageLow, DosageHigh, UOM, OrderRouteCode,
|
|
FrequencyCode, FreqFromTime, FreqToTime, FreqUom,
|
|
CalculatedStartDtm, EstimatedStopDtm,
|
|
StopAfterValue, StopAfterOptionType,
|
|
CalcDoseMethod, CalcActualDose, CalcUOMPer
|
|
REFERENCING backup_order_variable_component_obj };
|
|
|
|
|
|
// Get the OrderVariableComponent Objects in the Correct Sequence before using the data.
|
|
// The identical CalculatedStartDtm could cause them to be out of order.
|
|
current_ovc_list := SORT sequence_number DATA current_ovc_list;
|
|
backup_ovc_list := SORT Sequence_Number DATA backup_ovc_list;
|
|
|
|
|
|
// Make a copy of the OrderVariableComponent Objects before they are changed.
|
|
// This will assist in Debugging problems
|
|
debug_current_ovc_list := CLONE current_ovc_list;
|
|
debug_backup_ovc_list := CLONE backup_ovc_list;
|
|
|
|
|
|
// Check if the Complex Order{{{SINGLE-QUOTE}}}s Master Order has any Child Orders
|
|
complex_order_child_order_guid_list := current_ovc_list.Child_Order_GUID where it is present;
|
|
|
|
// If the Complex Order Child Orders generated
|
|
// then look up DTM information on the Child Orders.
|
|
if exist complex_order_child_order_guid_list
|
|
then
|
|
|
|
// Set Flag to update OrderVariableComponent data before making comparisons
|
|
update_order_variable_component_data := TRUE;
|
|
|
|
// If there is only 1 Child Order GUID,
|
|
// Make it a singleton so that the SQL query works correctly
|
|
if count complex_order_child_order_guid_list = 1 then
|
|
complex_order_child_order_guid_list := first complex_order_child_order_guid_list;
|
|
endif;
|
|
|
|
// Retrieve Data for the Child Orders from the Database
|
|
(db_complex_child_order_guid_list,
|
|
db_complex_child_order_name_list,
|
|
db_complex_child_order_dosage_low_list,
|
|
db_complex_child_order_dosage_high_list,
|
|
db_complex_child_order_uom_list,
|
|
db_complex_child_order_route_code_list,
|
|
db_complex_child_order_frequency_code_list,
|
|
db_complex_child_order_freq_from_time_list,
|
|
db_complex_child_order_freq_to_time_list,
|
|
db_complex_child_order_freq_uom_list,
|
|
db_complex_child_order_stop_after_option_list,
|
|
db_complex_child_order_stop_after_value_list,
|
|
db_complex_child_order_significant_dtm_list,
|
|
db_complex_child_order_stop_dtm_list,
|
|
db_complex_child_order_status_level_num_list ) := read
|
|
{ "Select O.GUID, O.Name, "
|
|
||" M.DosageLow, M.DosageHigh, M.UOM, M.OrderRouteCode, O.FrequencyCode, "
|
|
||" OA.FreqFromTime, OA.FreqToTime, OA.FreqUom, OA.StopAfterOption, OA.StopAfterValue, "
|
|
||" ConvSignificantDtm.TimeValue as SignificantDtm, "
|
|
||" ConvStopDtm.TimeValue as StopDtm, "
|
|
||" O.OrderStatusLevelNum "
|
|
||" From CV3Order AS O "
|
|
||" JOIN CV3MedicationExtension AS M "
|
|
||" ON O.ClientGUID = M.ClientGUID AND O.GUID = M.GUID "
|
|
||" JOIN CV3OrderAddnlInfo as OA "
|
|
||" ON O.ClientGUID = OA.ClientGUID AND O.GUID = OA.GUID "
|
|
||" INNER JOIN CV3ClientVisit AS CV "
|
|
||" ON O.ClientVisitGUID = CV.GUID "
|
|
||" CROSS APPLY dbo.SXADBConvertLocalToOffsetTblFn(CV.TimeZone, O.SignificantDtm) AS ConvSignificantDtm "
|
|
||" CROSS APPLY dbo.SXADBConvertLocalToOffsetTblFn(CV.TimeZone, O.StopDtm) AS ConvStopDtm "
|
|
||" WHERE O.ClientGUID = "|| SQLEX(client_guid)
|
|
||" AND O.GUID in ( " || complex_order_child_order_guid_list || ")" };
|
|
|
|
|
|
// Retrieve The Child Orders{{{SINGLE-QUOTE}}} OrderUserData Information from Database
|
|
(db_complex_child_order_user_data_code_guid_list,
|
|
db_complex_child_order_user_data_code_list,
|
|
db_complex_child_order_user_data_value_list ) := read
|
|
{ "Select OrderGUID, UserDataCode, Value "
|
|
||" From CV3OrderUserData "
|
|
||" Where ClientGUID = " || SQLEX(client_guid)
|
|
||" AND OrderGUID IN ( " || complex_order_child_order_guid_list || " )"
|
|
||" AND UserDataCode IN ({{{SINGLE-QUOTE}}}CalcDoseMethod{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}CalcActualDose{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}CalcUOMPer{{{SINGLE-QUOTE}}} ) " };
|
|
|
|
|
|
// Retrieve Child Orders{{{SINGLE-QUOTE}}} OrderAdditionalInfo data from Unsubmitted Orders
|
|
(unsub_complex_child_order_guid_list,
|
|
unsub_complex_child_order_name_list,
|
|
unsub_complex_child_order_dosage_low_list,
|
|
unsub_complex_child_order_dosage_high_list,
|
|
unsub_complex_child_order_uom_list,
|
|
unsub_complex_child_order_route_code_list,
|
|
unsub_complex_child_order_frequency_code_list,
|
|
unsub_complex_child_order_significant_dtm_list,
|
|
unsub_complex_child_order_stop_dtm_list,
|
|
unsub_complex_child_order_additional_info_obj_list,
|
|
unsub_complex_child_order_user_data_obj_list ) := read
|
|
{ Unsubmitted Order:
|
|
GUID, Name,
|
|
DosageLow, DosageHigh, UOM, OrderRouteCode, FrequencyCode
|
|
SignificantDtm, StopDtm, OrderAdditionalInfo, OrderUserData
|
|
Where GUID is in (complex_order_child_order_guid_list) };
|
|
|
|
|
|
unsub_complex_child_order_additional_guid_list := ();
|
|
unsub_complex_child_order_freq_from_time_list := ();
|
|
unsub_complex_child_order_freq_to_time_list := ();
|
|
unsub_complex_child_order_freq_uom_list := ();
|
|
unsub_complex_child_order_stop_after_option_list := ();
|
|
unsub_complex_child_order_stop_after_value_list := ();
|
|
|
|
for temp_unsub_order_additional_info_obj in
|
|
unsub_complex_child_order_additional_info_obj_list do
|
|
|
|
(temp_unsub_complex_child_order_additional_guid,
|
|
temp_unsub_complex_child_order_freq_from_time,
|
|
temp_unsub_complex_child_order_freq_to_time ,
|
|
temp_unsub_complex_child_order_freq_uom,
|
|
temp_unsub_complex_child_order_stop_after_option,
|
|
temp_unsub_complex_child_order_stop_after_value ) := read last
|
|
{ OrderAdditionalInfo:
|
|
GUID, FreqFromTime, FreqToTime, FreqUom,
|
|
StopAfterOption, StopAfterValue
|
|
REFERENCING temp_unsub_order_additional_info_obj };
|
|
|
|
unsub_complex_child_order_additional_guid_list :=
|
|
unsub_complex_child_order_additional_guid_list,
|
|
temp_unsub_complex_child_order_additional_guid;
|
|
unsub_complex_child_order_freq_from_time_list :=
|
|
unsub_complex_child_order_freq_from_time_list,
|
|
temp_unsub_complex_child_order_freq_from_time;
|
|
unsub_complex_child_order_freq_to_time_list :=
|
|
unsub_complex_child_order_freq_to_time_list,
|
|
temp_unsub_complex_child_order_freq_to_time;
|
|
unsub_complex_child_order_freq_uom_list :=
|
|
unsub_complex_child_order_freq_uom_list,
|
|
temp_unsub_complex_child_order_freq_uom;
|
|
unsub_complex_child_order_stop_after_option_list :=
|
|
unsub_complex_child_order_stop_after_option_list,
|
|
temp_unsub_complex_child_order_stop_after_option;
|
|
unsub_complex_child_order_stop_after_value_list :=
|
|
unsub_complex_child_order_stop_after_value_list,
|
|
temp_unsub_complex_child_order_stop_after_value;
|
|
enddo; //for temp_unsub_order_additional_info_obj
|
|
|
|
|
|
unsub_complex_child_order_user_data_code_guid_list := ();
|
|
unsub_complex_child_order_user_data_code_list := ();
|
|
unsub_complex_child_order_user_data_value_list := ();
|
|
|
|
|
|
for temp_unsub_order_user_data_obj in unsub_complex_child_order_user_data_obj_list do
|
|
// Get the unsumbitted order{{{SINGLE-QUOTE}}}s data from OrderUserData object
|
|
(temp_unsub_complex_child_order_user_data_code_guid_list,
|
|
temp_unsub_complex_child_order_user_data_code_list,
|
|
temp_unsub_complex_child_order_user_data_value_list ) := read
|
|
{ OrderUserData: OrderGUID, UserDataCode, Value
|
|
REFERENCING temp_unsub_order_user_data_obj
|
|
Where UserDataCode is in ("CalcDoseMethod" , "CalcActualDose", "CalcUOMPer" ) };
|
|
|
|
unsub_complex_child_order_user_data_code_guid_list :=
|
|
unsub_complex_child_order_user_data_code_guid_list,
|
|
temp_unsub_complex_child_order_user_data_code_guid_list;
|
|
unsub_complex_child_order_user_data_code_list :=
|
|
unsub_complex_child_order_user_data_code_list,
|
|
temp_unsub_complex_child_order_user_data_code_list ;
|
|
unsub_complex_child_order_user_data_value_list :=
|
|
unsub_complex_child_order_user_data_value_list,
|
|
temp_unsub_complex_child_order_user_data_value_list ;
|
|
enddo; //for temp_unsub_order_user_data_obj
|
|
|
|
endif; //if exist complex_order_child_order_guid_list
|
|
;;
|
|
evoke:
|
|
;;
|
|
logic:
|
|
//----------------------------------------------------------------------------
|
|
// Update the CURRENT Order Variable Components with the Main Order Form Data
|
|
//----------------------------------------------------------------------------
|
|
// The facility can choose which dosing data will appear on the Order Option Grid
|
|
// and which will appear on the Main Order Form. This algorithm consolidates
|
|
// all the dosing data for the CURRENT Complex Order onto the OrderVariableComponent Object,
|
|
// thus eliminating the need to look in more than one place for the data.
|
|
|
|
// Loop through the Current Order Variable Components and Consolidate Data
|
|
for current_ovc in current_ovc_list do
|
|
|
|
if not exist current_ovc.dosage_low
|
|
then current_ovc.dosage_low := order_dosage_low;
|
|
endif;
|
|
if not exist current_ovc.dosage_high
|
|
then current_ovc.dosage_high := order_dosage_high;
|
|
endif;
|
|
if not exist current_ovc.uom
|
|
then current_ovc.uom := order_uom;
|
|
endif;
|
|
if not exist current_ovc.order_route_code
|
|
then current_ovc.order_route_code := order_route_code;
|
|
endif;
|
|
if not exist current_ovc.frequency_code
|
|
then current_ovc.frequency_code := order_frequency_code;
|
|
endif;
|
|
if not exist current_ovc.freq_from_time
|
|
or (current_ovc.freq_from_time AS NUMBER) = 0
|
|
then current_ovc.freq_from_time := order_freq_from_time;
|
|
endif;
|
|
if not exist current_ovc.freq_to_time
|
|
or (current_ovc.freq_to_time AS NUMBER) = 0
|
|
then current_ovc.freq_to_time := order_freq_to_time;
|
|
endif;
|
|
if not exist current_ovc.freq_uom
|
|
then current_ovc.freq_uom := order_freq_uom;
|
|
endif;
|
|
|
|
|
|
// If StopAfter or StopDate are NOT in the Dosing Option Grid
|
|
// then get the data from the Main Order Form.
|
|
if NOT ANY (("StopAfter", "StopDate") IS IN dosing_option_data_item_code_list)
|
|
then
|
|
if (current_ovc.stop_after_value AS NUMBER) = 0
|
|
then current_ovc.stop_after_value := order_stop_after_value;
|
|
endif;
|
|
if (current_ovc.stop_after_option_type AS NUMBER) = 0
|
|
then current_ovc.stop_after_option_type := order_stop_after_option;
|
|
endif;
|
|
if not exist current_ovc.estimated_stop_dtm
|
|
then current_ovc.estimated_stop_dtm := order_stop_dtm;
|
|
endif;
|
|
endif; //if NOT ANY (("StopAfter", "StopDate")
|
|
|
|
|
|
if not exist current_ovc.calc_actual_dose
|
|
and not exist current_ovc.calc_uom_per
|
|
and "CalcDoseMethod" IS IN order_user_data_code_list
|
|
and "CalcActualDose" IS IN order_user_data_code_list
|
|
and "CalcUOMPer" IS IN order_user_data_code_list
|
|
then
|
|
current_ovc.calc_actual_dose := first (order_user_data_value_list
|
|
where order_user_data_code_list = "CalcActualDose");
|
|
current_ovc.calc_dose_method := first (order_user_data_value_list
|
|
where order_user_data_code_list = "CalcDoseMethod");
|
|
current_ovc.calc_uom_per := first (order_user_data_value_list
|
|
where order_user_data_code_list = "CalcUOMPer");
|
|
endif; //if not exist current_ovc.calc_actual_dose
|
|
enddo; //for current_ovc
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Update the BACKUP Order Variable Components with the Main Order Form Data
|
|
//----------------------------------------------------------------------------
|
|
// The facility can choose which dosing data will appear on the Order Option Grid
|
|
// and which will appear on the Main Order Form. This algorithm consolidates
|
|
// all the dosing data for the BACKUP Complex Order onto the OrderVariableComponent Object,
|
|
// thus eliminating the need to look in more than one place for the data.
|
|
|
|
// Loop through the BackUp Order Variable Components and Consolidate Data
|
|
for backup_ovc in backup_ovc_list do
|
|
|
|
if not exist backup_ovc.dosage_low
|
|
then backup_ovc.dosage_low := backup_order_dosage_low;
|
|
endif;
|
|
if not exist backup_ovc.dosage_high
|
|
then backup_ovc.dosage_high := backup_order_dosage_high;
|
|
endif;
|
|
if not exist backup_ovc.uom
|
|
then backup_ovc.uom := backup_order_uom;
|
|
endif;
|
|
if not exist backup_ovc.order_route_code
|
|
then backup_ovc.order_route_code := backup_order_route_code;
|
|
endif;
|
|
if not exist backup_ovc.frequency_code
|
|
then backup_ovc.frequency_code := backup_order_frequency_code;
|
|
endif;
|
|
if not exist backup_ovc.freq_from_time
|
|
or (backup_ovc.freq_from_time AS NUMBER) = 0
|
|
then backup_ovc.freq_from_time := backup_order_freq_from_time;
|
|
endif;
|
|
if not exist backup_ovc.freq_to_time
|
|
or (backup_ovc.freq_to_time AS NUMBER) = 0
|
|
then backup_ovc.freq_to_time := backup_order_freq_to_time;
|
|
endif;
|
|
if not exist backup_ovc.freq_uom
|
|
then backup_ovc.freq_uom := backup_order_freq_uom;
|
|
endif;
|
|
|
|
|
|
// If StopAfter or StopDate are NOT in the Dosing Option Grid
|
|
// then get the data from the Main Order Form.
|
|
if NOT ANY (("StopAfter", "StopDate") IS IN dosing_option_data_item_code_list)
|
|
then
|
|
if (backup_ovc.stop_after_value AS NUMBER) = 0
|
|
then backup_ovc.stop_after_value := backup_order_stop_after_value;
|
|
endif;
|
|
if (backup_ovc.stop_after_option_type AS NUMBER) = 0
|
|
then backup_ovc.stop_after_option_type := backup_order_stop_after_option;
|
|
endif;
|
|
if not exist backup_ovc.estimated_stop_dtm
|
|
then backup_ovc.estimated_stop_dtm := backup_order_stop_dtm ;
|
|
endif;
|
|
endif; //if NOT ANY (("StopAfter", "StopDate")
|
|
|
|
|
|
if not exist backup_ovc.calc_actual_dose
|
|
and not exist backup_ovc.calc_uom_per
|
|
and "CalcActualDose" IS IN order_user_data_code_list
|
|
and "CalcUOMPer" IS IN order_user_data_code_list
|
|
and "CalcDoseMethod" IS IN order_user_data_code_list
|
|
then
|
|
backup_ovc.calc_actual_dose := first (backup_order_user_data_value_list
|
|
where backup_order_user_data_code_list = "CalcActualDose");
|
|
backup_ovc.calc_dose_method := first (backup_order_user_data_value_list
|
|
where backup_order_user_data_code_list= "CalcDoseMethod");
|
|
backup_ovc.calc_uom_per := first (backup_order_user_data_value_list
|
|
where backup_order_user_data_code_list = "CalcUOMPer");
|
|
endif; //if not exist backup_ovc.calc_actual_dose
|
|
enddo; //for backup_ovc
|
|
|
|
|
|
//---------------------------------------------------------------------------------
|
|
// Update CURRENT and BACKUP Order Variable Components with Data from the DATABASE
|
|
//---------------------------------------------------------------------------------
|
|
// When the Child Orders have been generated, the data from the Child Order are the
|
|
// actual data and are more accurate than the "estimated" data on the Master Order.
|
|
// For example, the CalculatedStartDtm and the StopDtm in the
|
|
// Complex Orders{{{SINGLE-QUOTE}}} Order Variable Component objects can get out of date,
|
|
// since it is not always updated from the Child Orders.
|
|
// This algorthim will update the Order Variable Component objects from the database.
|
|
// This algorthim will also add the Child Order{{{SINGLE-QUOTE}}}s OrderStatusLevelNum to objects.
|
|
|
|
if update_order_variable_component_data
|
|
then
|
|
|
|
// Loop Through the lists from the Database
|
|
for DD in (1 seqto count db_complex_child_order_guid_list) do
|
|
|
|
// Find the matching CURRENT Order Variable Component
|
|
found_current_ovc := current_ovc_list
|
|
where current_ovc_list.Child_Order_GUID =
|
|
db_complex_child_order_guid_list[DD];
|
|
|
|
// Find the matching BACKUP Order Variable Component
|
|
found_backup_ovc := backup_ovc_list
|
|
where backup_ovc_list.Child_Order_GUID =
|
|
db_complex_child_order_guid_list[DD];
|
|
|
|
|
|
// Add the OrderStatusLevelNum to the CURRENT Order Variable Component
|
|
found_current_ovc.child_order_status_level_num :=
|
|
db_complex_child_order_status_level_num_list[DD];
|
|
|
|
// Replace CalculatedStartDtm and StopDtm for the
|
|
// CURRENT and BACKUP Order Variable Component
|
|
found_current_ovc.calculated_start_dtm := db_complex_child_order_significant_dtm_list[DD];
|
|
found_backup_ovc.calculated_start_dtm := db_complex_child_order_significant_dtm_list[DD];
|
|
found_current_ovc.estimated_stop_dtm := db_complex_child_order_stop_dtm_list[DD];
|
|
found_backup_ovc.estimated_stop_dtm := db_complex_child_order_stop_dtm_list[DD];
|
|
|
|
|
|
//Replace the other Dosing Data for the CURRENT and BACKUP Order Variable Component
|
|
found_current_ovc.dosage_low := db_complex_child_order_dosage_low_list[DD];
|
|
found_backup_ovc.dosage_low := db_complex_child_order_dosage_low_list[DD];
|
|
|
|
found_current_ovc.dosage_high := db_complex_child_order_dosage_high_list[DD];
|
|
found_backup_ovc.dosage_high := db_complex_child_order_dosage_high_list[DD];
|
|
|
|
found_current_ovc.uom := db_complex_child_order_uom_list[DD];
|
|
found_backup_ovc.uom := db_complex_child_order_uom_list[DD];
|
|
|
|
found_current_ovc.order_route_code := db_complex_child_order_route_code_list[DD];
|
|
found_backup_ovc.order_route_code := db_complex_child_order_route_code_list[DD];
|
|
|
|
found_current_ovc.frequency_code := db_complex_child_order_frequency_code_list[DD];
|
|
found_backup_ovc.frequency_code := db_complex_child_order_frequency_code_list[DD];
|
|
|
|
found_current_ovc.freq_from_time := db_complex_child_order_freq_from_time_list[DD];
|
|
found_backup_ovc.freq_from_time := db_complex_child_order_freq_from_time_list[DD];
|
|
|
|
found_current_ovc.freq_to_time := db_complex_child_order_freq_to_time_list[DD];
|
|
found_backup_ovc.freq_to_time := db_complex_child_order_freq_to_time_list[DD];
|
|
|
|
found_current_ovc.freq_uom := db_complex_child_order_freq_uom_list[DD];
|
|
found_backup_ovc.freq_uom := db_complex_child_order_freq_uom_list[DD];
|
|
|
|
found_current_ovc.stop_after_value := db_complex_child_order_stop_after_value_list[DD];
|
|
found_backup_ovc.stop_after_value := db_complex_child_order_stop_after_value_list[DD];
|
|
|
|
found_current_ovc.stop_after_option_type :=
|
|
db_complex_child_order_stop_after_option_list[DD];
|
|
found_backup_ovc.stop_after_option_type :=
|
|
db_complex_child_order_stop_after_option_list[DD];
|
|
|
|
|
|
if "CalcActualDose" IS IN db_complex_child_order_user_data_code_list
|
|
and "CalcUOMPer" IS IN db_complex_child_order_user_data_code_list
|
|
and "CalcDoseMethod" IS IN db_complex_child_order_user_data_code_list
|
|
then
|
|
temp_db_calc_actual_dose := first (db_complex_child_order_user_data_value_list
|
|
where db_complex_child_order_user_data_code_list = "CalcActualDose"
|
|
and db_complex_child_order_user_data_code_guid_list =
|
|
db_complex_child_order_guid_list[DD]);
|
|
found_current_ovc.calc_actual_dose := temp_db_calc_actual_dose;
|
|
found_backup_ovc.calc_actual_dose := temp_db_calc_actual_dose;
|
|
|
|
|
|
temp_db_calc_dose_method := first (db_complex_child_order_user_data_value_list
|
|
where db_complex_child_order_user_data_code_list= "CalcDoseMethod"
|
|
and db_complex_child_order_user_data_code_guid_list =
|
|
db_complex_child_order_guid_list[DD]);
|
|
found_current_ovc.calc_dose_method := temp_db_calc_dose_method;
|
|
found_backup_ovc.calc_dose_method := temp_db_calc_dose_method;
|
|
|
|
|
|
temp_db_calc_uom_per := first (db_complex_child_order_user_data_value_list
|
|
where db_complex_child_order_user_data_code_list = "CalcUOMPer"
|
|
and db_complex_child_order_user_data_code_guid_list =
|
|
db_complex_child_order_guid_list[DD]);
|
|
found_current_ovc.calc_uom_per := temp_db_calc_uom_per;
|
|
found_backup_ovc.calc_uom_per := temp_db_calc_uom_per;
|
|
|
|
endif; //if "CalcActualDose"
|
|
enddo; //for DD
|
|
|
|
|
|
//-------------------------------------------------------------------------------------
|
|
// Update CURRENT Order Variable Components with Data from the UNSUBMITTED Child Order
|
|
//-------------------------------------------------------------------------------------
|
|
// When the Child Order is modified, the data from the Unsubmitted Child Order contains the
|
|
// changed data. The Child Order{{{SINGLE-QUOTE}}}s data are more accurate than the data on the Master Order.
|
|
// For example, if the Child Order{{{SINGLE-QUOTE}}}s route changed and the route field is NOT on the
|
|
// dosing option grid, then the route on the Master Order is not updated.
|
|
// The Master Order{{{SINGLE-QUOTE}}}s Order Variable Component objects can get out of date,
|
|
// since it is not always updated from the Child Orders.
|
|
// This algorthim will update the CURRENT Order Variable Component objects from the
|
|
// Unsubmitted Child Order.
|
|
// Note that the BACKUP Order Variable Component objects are not updated by this algorithm.
|
|
|
|
// Loop Through the lists from the Unsubmitted Orders
|
|
for UU in (1 seqto count unsub_complex_child_order_guid_list) do
|
|
|
|
// Find the matching CURRENT Order Variable Component
|
|
found_current_ovc := current_ovc_list
|
|
where current_ovc_list.Child_Order_GUID =
|
|
unsub_complex_child_order_guid_list[UU];
|
|
|
|
// Replace CalculatedStartDtm and StopDtm for the CURRENT Order Variable Component
|
|
// from the Unsubmitted Orders
|
|
found_current_ovc.calculated_start_dtm :=
|
|
unsub_complex_child_order_significant_dtm_list[UU];
|
|
|
|
found_current_ovc.estimated_stop_dtm :=
|
|
unsub_complex_child_order_stop_dtm_list[UU];
|
|
|
|
|
|
//Replace the other Dosing Data for the CURRENT Order Variable Component
|
|
found_current_ovc.dosage_low := unsub_complex_child_order_dosage_low_list[UU];
|
|
found_current_ovc.dosage_high := unsub_complex_child_order_dosage_high_list[UU];
|
|
found_current_ovc.uom := unsub_complex_child_order_uom_list[UU];
|
|
found_current_ovc.order_route_code := unsub_complex_child_order_route_code_list[UU];
|
|
found_current_ovc.frequency_code := unsub_complex_child_order_frequency_code_list[UU];
|
|
|
|
if exist unsub_complex_child_order_additional_guid_list
|
|
then
|
|
found_current_ovc.freq_from_time :=
|
|
first (unsub_complex_child_order_freq_from_time_list
|
|
where unsub_complex_child_order_additional_guid_list =
|
|
unsub_complex_child_order_guid_list [UU]);
|
|
|
|
found_current_ovc.freq_to_time :=
|
|
first (unsub_complex_child_order_freq_to_time_list
|
|
where unsub_complex_child_order_additional_guid_list =
|
|
unsub_complex_child_order_guid_list [UU]);
|
|
|
|
found_current_ovc.freq_uom :=
|
|
first (unsub_complex_child_order_freq_uom_list
|
|
where unsub_complex_child_order_additional_guid_list =
|
|
unsub_complex_child_order_guid_list [UU]);
|
|
|
|
found_current_ovc.stop_after_value :=
|
|
first (unsub_complex_child_order_stop_after_value_list
|
|
where unsub_complex_child_order_additional_guid_list =
|
|
unsub_complex_child_order_guid_list [UU]);
|
|
|
|
found_current_ovc.stop_after_option_type :=
|
|
first (unsub_complex_child_order_stop_after_option_list
|
|
where unsub_complex_child_order_additional_guid_list =
|
|
unsub_complex_child_order_guid_list [UU]);
|
|
endif; //if exist unsub_complex_child_order_additional_guid_list
|
|
|
|
|
|
if "CalcActualDose" IS IN unsub_complex_child_order_user_data_code_list
|
|
and "CalcUOMPer" IS IN unsub_complex_child_order_user_data_code_list
|
|
and "CalcDoseMethod" IS IN unsub_complex_child_order_user_data_code_list
|
|
then
|
|
found_current_ovc.calc_actual_dose :=
|
|
first (unsub_complex_child_order_user_data_value_list
|
|
where unsub_complex_child_order_user_data_code_list = "CalcActualDose"
|
|
and unsub_complex_child_order_user_data_code_guid_list =
|
|
unsub_complex_child_order_guid_list [UU]);
|
|
|
|
found_current_ovc.calc_dose_method :=
|
|
first (unsub_complex_child_order_user_data_value_list
|
|
where unsub_complex_child_order_user_data_code_list = "CalcDoseMethod"
|
|
and unsub_complex_child_order_user_data_code_guid_list =
|
|
unsub_complex_child_order_guid_list [UU]);
|
|
|
|
found_current_ovc.calc_uom_per :=
|
|
first (unsub_complex_child_order_user_data_value_list
|
|
where unsub_complex_child_order_user_data_code_list = "CalcUOMPer"
|
|
and unsub_complex_child_order_user_data_code_guid_list =
|
|
unsub_complex_child_order_guid_list [UU]);
|
|
endif; //if "CalcActualDose"
|
|
enddo; //for UU
|
|
endif; //if update_order_variable_component_data
|
|
|
|
//Always Conclude True
|
|
Conclude True;
|
|
;;
|
|
action:
|
|
// Return the list of CURRENT and BACKUP Order_Variable_Compenent Objects
|
|
return current_ovc_list, backup_ovc_list;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|