maintenance: title: CALLED_DOM_CCC;; mlmname: CALLED_DOM_CCC;; arden: VERSION 2.5;; version: 7.02;; institution: Allscripts;; author: Allscripts;; specialist: Allscripts;; date: 2014-09-22;; validation: TESTING;; /* P r o p r i e t a r y N o t i c e */ /* Unpublished (c) 2013 - 2014 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 "Commercial Computer Software". 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: ;; explanation: /*### SCM Release Version: 6.1, 14.3, 15.1 ###*/ VERSION DATE AUTHOR REVISION --------------------------------------------------------------------------------------------------------- V6.10 2011-05-01 Initial Inclusion. V7.00 2014-04-16 SMS Incremented version. V7.01 2014-04-21 SMS Added IF block to allow charting to FS in addition to SN. V7.02 2014-09-22 SMS Added IF block to check if .ValueObj EXISTS and if it doesn{{{SINGLE-QUOTE}}}t, create it. This is a helper MLM that you can use to chart an observation by passing in the required parameters. ;; keywords: RTF, Document Called MLM , list, multi-select ;; knowledge: type: data-driven ;; data: (this_documentCommunication, parameter_name, newValue, sugg_txt_value, UpdateType, pListGUID) := ARGUMENT; /*******************Make Changes To Spelling And Flags In This Section******************/ //*** Variable and Constant Declaration ***// // Document Types FLOWSHEET := "Flowsheet"; STRUCTUREDNOTE := "StructuredNote"; (this_structuredNoteDoc) := this_documentCommunication.DocumentConfigurationObj; (this_parameters) := this_structuredNoteDoc.ParametersList; (this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList; IF this_documentCommunication.DocumentType = FLOWSHEET THEN (this_columnsList) := this_structuredNoteDoc.ColumnsList; (this_currentColumn) := this_structuredNoteDoc.CurrentColumn; (this_ClientDocumentGUID) := this_currentColumn.ClientDocumentGUID; (this_chartedObservationsList) := this_structuredNoteDoc.CurrentColumn.ChartedObservationsList; ELSEIF this_documentCommunication.DocumentType = STRUCTUREDNOTE THEN (this_ClientDocumentGUID) := this_structuredNoteDoc.ClientDocumentGUID; (this_chartedObservationsList) := this_structuredNoteDoc.ChartedObservationsList; ENDIF; this_DocumentType := this_documentCommunication.DocumentType; //if the parameter type is a text and the observation already exist the new data may be a //Replace of Append to current valueObj.Value IF NOT EXISTS UpdateType OR UpdateType NOT IN("Append","Replace") THEN UpdateType := "Replace"; ENDIF; ///////////////////////////////////////////////////////////////////////////////////////////////////////// //*** Data Structures ***// //The following data structures can be used to create new objects within the MLM itself. //Not all data structures are represented here, only ones that can be created in the MLM. // Parameter Types NUMERICVALUE := "NumericValue"; FREETEXTVALUE := "FreeTextValue"; LISTVALUE := "ListValue"; LISTSETVALUE := "ListSetValue"; DATEVALUE := "DateValue"; IOVALUE := "IOValue"; GENERICDRIPVALUE := "GenericDripValue"; DRIPVALUE := "DripValue"; ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj]; ListValueType := OBJECT [ListGUID, ListItemsList, SuggestedTextValue]; ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected]; DateValueType := OBJECT [Value]; FreeTextValueType := OBJECT [Value]; NumericValueType := OBJECT [Value]; ListSetValueType := OBJECT [ListValuesList]; // // This section of code will demonstrate how to write to FreeTextValue, DateValue,NumericValue and ListValue parameter := FIRST OF (this_Parameters WHERE this_Parameters.Name = parameter_name); IF EXISTS parameter THEN //****************************************************************************************************** // Check for existing object //******************************************************************************************************* obs := FIRST OF(this_ChartedObservationsList WHERE this_ChartedObservationsList.parameterGUID = parameter.parameterGUID); IF NOT EXISTS obs THEN //Create a new Observation for the list obs := NEW ObservationType; //obs.ClientDocumentGUID := this_documentCommunication.DocumentConfigurationObj.ClientDocumentGUID; //2014-04-21 SMS obs.ClientDocumentGUID := this_ClientDocumentGUID; obs.ParameterGUID := parameter.ParameterGUID; obs.DataType := parameter.DataType; ENDIF; //2014-09-22 SMS IF NOT EXISTS obs.ValueObj THEN //2014-09-22 SMS // Based on the parameter.DataType create the ValueObj Type and set the valueObj.value for (FREETEXTVALUETYPE,DATEVALUETYPE,NUMERICVALUETYPE) // If the DataType is LISTVALUE then creat the valueObj of LISTVALUETYPE ABD ASSIGN THE paramter.configurationObj.ListGUID IF parameter.DataType = FREETEXTVALUE THEN obs.ValueObj := NEW FreeTextValueType; ELSEIF parameter.DataType = DATEVALUE THEN obs.ValueObj := NEW DateValueType; ELSEIF parameter.DataType = NUMERICVALUE THEN obs.ValueObj := NEW NumericValueType; ELSEIF parameter.DataType = LISTVALUE THEN obs.ValueObj := NEW ListValueType; obs.ValueObj.ListGUID := parameter.ConfigurationObj.ListGUID; ELSEIF parameter.DataType = LISTSETVALUE THEN obs.ValueObj := NEW ListSetValueType; ENDIF; // if parameter.DataType = FREETEXTVALUE then //APPEND obs to the ChartedObservationsList ENDIF; IF parameter.DataType = FREETEXTVALUE AND UpdateType = "Append" THEN IF LENGTH OF obs.ValueObj.Value > 0 THEN obs.ValueObj.Value := obs.ValueObj.Value || "\n" || newValue; ELSE obs.ValueObj.Value := newValue; ENDIF; //break; ELSEIF parameter.DataType = FREETEXTVALUE AND UpdateType = "Replace" THEN IF EXISTS newValue THEN //break; obs.ValueObj.Value := newValue; ELSE obs.ValueObj := null; ENDIF; //break; ELSEIF parameter.DataType IN(DATEVALUE,NUMERICVALUE) THEN IF EXISTS newValue THEN // new code added by Stve Abel from Roswell Park obs.ValueObj.Value := newValue; //break; ELSE obs.ValueObj := null; ENDIF; // obs.ValueObj.Value := newValue; This was the code before Steve Abel addition ELSEIF parameter.DataType = LISTVALUE THEN //Populate the ListItemsList in the new observation object (obs) // loop through each item in the parameter.ConfugurationObj.ListItemsList using "item"and append the item to the newly created object ListValueListItemType //assign the item.listItemGUID to the selectedItem.ListItemGUID, the Item.value to the selectedItem.Value and set the SelectedItem.IsSelected := true listItems := (); IF newValue = "" THEN newValue := NULL; ENDIF; IF sugg_txt_value = "" THEN sugg_txt_value := NULL; ENDIF; IF (NOT EXISTS newValue) AND (NOT EXISTS sugg_txt_value) THEN obs.ValueObj := null; ELSE IF EXISTS newValue THEN FOR k IN 1 SEQTO COUNT OF parameter.ConfigurationObj.ListItemsList DO item := parameter.ConfigurationObj.ListItemsList[k]; parm := FIRST OF(newValue WHERE newValue.ListValue = item.Value); IF EXISTS parm THEN //Create a list item object for the selected list item selectedItem := NEW ListValueListItemType; selectedItem.ListItemGUID := item.ListItemGUID; selectedItem.Value := parm.ListValue; selectedItem.IsSelected := parm.IsSelected; // Arden list append statement appending the new object to the listItems object of the ListValueListItemType Object listItems := (listItems, selectedItem); // set the obs.valueObj.ListItemsList := listItems list object Obs.ValueObj.ListItemsList := listItems; ENDIF; ENDDO; ENDIF; IF EXISTS sugg_txt_value THEN obs.ValueObj.SuggestedTextValue := sugg_txt_value; ENDIF; ENDIF; ELSEIF parameter.DataType = LISTSETVALUE THEN newListValue := NEW ListValueType; newListValue.ListGUID := pListGUID; k := 0; listItems := (); ii := 0; FOR i IN 1 SEQTO COUNT OF parameter.ConfigurationObj.ListConfigurationList DO IF parameter.ConfigurationObj.ListConfigurationList[i].ListGUID = pListGUID THEN ii := i; ENDIF; ENDDO; FOR pItem IN parameter.ConfigurationObj.ListConfigurationList[ii].ListItemsList DO k := k + 1; parm := FIRST OF(newValue WHERE newValue.ListValue = pItem.Value); IF EXISTS parm THEN newItem := NEW ListValueListItemType; newItem.ListItemGUID := pItem.ListItemGUID; newItem.Value := parm.ListValue; newItem.IsSelected := parm.IsSelected; listItems := (listItems, newItem); ENDIF; ENDDO; newListValue.ListItemsList := (newListValue.ListItemsList, listItems); Obs.ValueObj.ListValuesList := (Obs.ValueObj.ListValuesList, newListValue); IF EXISTS sugg_txt_value THEN newListValue.SuggestedTextValue := sugg_txt_value; ENDIF; ENDIF; IF EXISTS obs THEN //2014-04-21 SMS IF this_DocumentType = FLOWSHEET THEN this_documentCommunication.DocumentConfigurationObj.CurrentColumn.ChartedObservationsList := this_documentCommunication.DocumentConfigurationObj.CurrentColumn.ChartedObservationsList, obs; ELSEIF this_DocumentType = STRUCTUREDNOTE THEN this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList := (this_documentCommunication.DocumentConfigurationObj.ChartedObservationsList, obs); ENDIF; ENDIF; ENDIF; //IF EXISTS parameter THEN /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ;; evoke: ;; logic: CONCLUDE TRUE; ;; action: RETURN this_documentCommunication; ;; Urgency: 50 end: