Files
St.Clair/MLMStripper/bin/Debug/STD/STD_FUNC_BUILD_RESULT_OBJECT.mlm

121 lines
3.7 KiB
Plaintext

maintenance:
title: Build a result object;;
mlmname: STD_FUNC_BUILD_RESULT_OBJECT;;
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: This MLM will create one or more Result data objects based
on parameter data and any parent/child relationships found in the
database.
This MLM should be called by any MLM that calls the STD_FUNC_INSERT_REPORTABLE_SURVEILLANCE
MLM with result data.
;;
explanation:
;;
keywords:
;;
citations:
;;
knowledge:
type: data-driven;;
data:
(parentOrderKey,
childResultGUIDs,
reasonCode) := ARGUMENT;
log_execution_info := false;
// Common code to all Bio-Surveillance MLMs
ReportableType := OBJECT
[
ParentKey,
ChildKeys,
ObjectType,
Reason
];
resultsType := OBJECT [ resultGUID, orderGUID ];
// Call SQL function to find all parent/child orders and results for the
// parent order key passed in
if (childResultGUIDs is not null AND not childResultGUIDs is list) then
childResultGUIDs := ,childResultGUIDs;
endif;
// Build the XML field used to send in the list of results used to filter
childResultGUIDsXML := null;
if childResultGUIDs is list
then
childResultGUIDsXML := "<results>";
for guid in childResultGUIDs do
childResultGUIDsXML := childResultGUIDsXML || "<guid>" || guid || "</guid>";
enddo;
childResultGUIDsXML := childResultGUIDsXML || "</results>";
endif;
// Execute the SQL function to retrieve all parent and child orders
resultsObjects := read as resultsType { "select ord.* from dbo.SXAFindAllResultsFromParentOrderFn(" || SQL(parentOrderKey) || "," ||
SQL(parentOrderKey) || "," ||
SQL(childResultGUIDsXML) || ", 0) ord " };
resultObjectList := ();
orderGUIDs := ();
// Use the list of objects returned from the SQL function and build up ReportType objects containing all orders and their
// matching results.
for obj in resultsObjects do
if obj.OrderGUID is not in orderGUIDs then
orderGUIDs := orderGUIDs,obj.OrderGUID;
resultObject := new ReportableType;
resultObject.ParentKey := obj.OrderGUID;
resultObject.ChildKeys := resultsObjects.resultGUID where resultsObjects.OrderGUID = obj.OrderGUID;
resultObject.ObjectType := "result";
resultObject.reason := reasonCode;
resultObjectList := resultObjectList, resultObject;
endif;
enddo;
;;
priority: 50
;;
evoke:
;;
logic:
conclude true;
;;
action:
// return the list of result objects
return resultObjectList;
;;
Urgency: 50;;
end: