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

239 lines
7.8 KiB
Plaintext

maintenance:
title: Retrieve Multum References;;
mlmname: STD_FUNC_MULTUM_REFERENCES;;
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 is used to retrieve references from the MULTUM database and format
then based on the Vancouver journal standard.
;;
explanation:
This MLM retrieves from the Multum database all the references that are linked to the parameters
that are passed in. The parameters used are dependent on the reference type that is being accessed.
render_style - Support which text formatting codes are used when creating the reference string.
RTF - Use RTF code for any formatting that is needed.
None - Only use CR, no other formatting is used. Calling MLM is assumed to do any formatting.
if NULL or blank then the default will be RTF.
reference_type - The type of reference to retrieve from the multum database. The following types
will be supported. "ddi", "drgint", "allrgy"
reference_title - A title that will be added to the top of the list of references created by a call to
this MLM. Can be empty which indicates that no title is to be included.
drug_number1 - A multum drug number, only used when the reference_type is "drgint".
drug_number2 - A multum drug number, only used when the reference_type is "drgint".
conflict_textId - A conflict Id from the multum database, only used when the reference_type is "ddi".
Three values are returned by this MLM.
outputString - This is the formatted references as a single string. If there are no references found
this string will be null.
revision_date - The date the Multum database was last updated.
refCounter - The actual number of references returned from the multum database. If there are no references
found this counter will be 0.
;;
keywords: references, Multum
;;
citations:
;;
knowledge:
type: data-driven;;
data:
(render_style,
reference_type,
reference_title,
drug_number1,
drug_number2,
conflict_textId,
allergenID,
functionId ):= ARGUMENT;
// Defaults
default_render_style := "rtf";
supported_render_styles := ("rtf", "none");
// ---------------------------------------------------------------------------------
// Do not change any code below
if render_style is null or render_style = "" or render_style not in supported_render_styles
then
render_style := default_render_style;
endif;
sqlCommand := "@type=" || SQL(reference_type);
referenceType := OBJECT [ id, author, title, journal_abbrevation, year_complete, volumn_issue, pages ];
// Determine which SQL parameters are needed to retrieve the data
if reference_type = "ddi" AND conflict_textId is not null
then
sqlCommand := sqlCommand || ", @conflictId=" || SQL(conflict_textId);
elseif reference_type = "drgint" AND drug_number1 is not null AND drug_number2 is not null
then
sqlCommand := sqlCommand || ", @drugId_1=" || SQL(drug_number1) ||
", @drugId_2=" || SQL(drug_number2);
elseif reference_type = "allrgy" AND allergenID is not null
then
sqlCommand := sqlCommand || ", @allergenID=" || SQL(allergenID);
elseif reference_type = "preglact" AND drug_number1 is not null
then
sqlCommand := sqlCommand || ", @drugId_1=" || SQL(drug_number1) || ", @functionId=" || SQL(functionId);
else // Invalid reference type
sqlCommand := null;
endif;
// Retrieve the data from the Multum database
if sqlCommand is not NULL
then
reference_list := read as referenceType { "exec SXACDSMultumReferenceSelPr " || sqlCommand };
//debug_sql := "exec SXACDSMultumReferenceSelPr " || sqlCommand;
// Get the last revision date of the Multum database, strip out time portion
revision_date := read last { "select change_date from SXAMTdatabase_infoSYN" };
revision_date := revision_date formatted with "%.2t";
endif;
;;
priority: 50
;;
evoke:
;;
logic:
refCounter := 0;
titleString := null;
outputString := null;
if not exists reference_list
then
conclude true;
endif;
// ---------------------------------------------------------
// Vancouver format style
// ---------------------------------------------------------
if reference_title is not null and length(reference_title) > 0
then
if render_style = "rtf"
then
titleString := "{{+B}}{{+g}}" || reference_title || "{{-g}}{{-B}}\n";
elseif render_style = "none"
then
titleString := reference_title || "\n";
endif;
endif;
// Build up a single reference for each row returned from Multum
for reference in reference_list do
singleReference := "";
refCounter := refCounter + 1;
if refCounter = 1 and titleString is not null then
outputString := titleString;
endif;
// Cleanup the data first
if reference.journal_abbrevation = "O" then reference.journal_abbrevation := null; endif;
if reference.year_complete = "0" then reference.year_complete := null; endif;
if reference.volumn_issue = "0" then reference.volumn_issue := null; endif;
if reference.pages = "0" then reference.pages := null; endif;
if reference.Author is not null and length(reference.Author) > 0
then
singleReference := reference.Author || ". ";
endif;
// Title is never null in the Multum database
singleReference := singleReference || reference.title || " ";
if reference.journal_abbrevation is not null and length(reference.journal_abbrevation) > 0
then
singleReference := singleReference || reference.journal_abbrevation || " ";
endif;
if reference.year_complete is not null and length(reference.year_complete) > 0
then
singleReference := singleReference || reference.year_complete || "; ";
endif;
if reference.volumn_issue is not null and length(reference.volumn_issue) > 0
then
singleReference := singleReference || reference.volumn_issue || ": ";
endif;
if reference.pages is not null and length(reference.pages) > 0
then
singleReference := singleReference || reference.pages || ". ";
endif;
if render_style is in ("rtf", "none")
then
singleReference := singleReference || "\n\n"; // double spacing between references
endif;
// Build up the final reference string
if outputString is null
then
outputString := refCounter || ". " ||singleReference;
else
outputString := outputString || refCounter || ". " || singleReference;
endif;
enddo;
if outputString is not null
then
if render_style is in ("rtf", "none")
then
outputString := outputString || "\n";
endif;
endif;
conclude true;
;;
action:
return outputString, revision_date, refCounter;
;;
Urgency: 50;;
end: