maintenance: title: OBJECT_Customize_DIPA MLM ;; mlmname: UTIL_OBJECT_Customize_DIPA_MLM;; arden: version 2.5;; version: 5.50;; institution: Allscripts Corporation;; author: Jignesh Parmar;; specialist: ;; date: 2011-01-06;; validation: testing;; library: purpose: To create an generic object based on the parameters passed and define , initialize , populate and ADD it. ;; explanation: This is a Generic MLM which can use to set value to any parameter on any type of document both Flowsheet and StructureNote. ;; keywords: ;; knowledge: type: data-driven;; data: //Input parameters ( this_DocumentCommunication , // Document Communication Object Parameter_Name , // Parameter for which the value needs to be set or assign Value) // Value to be assigned. //Clear_Field) // Are we clearing the field? YES/NO.default "NO" , Specifically for Datevaluetype := ARGUMENT; //Get The Structure Note (this_Doc) := this_documentCommunication.DocumentConfigurationObj; //Get the Parameter List (this_parms) := This_Doc.ParametersList; //Get the Observation (this_observations) := This_Doc.ChartedObservationsList; //Checking for the documnet type IF this_DocumentCommunication.DocumentType = "Flowsheet" THEN IsFlowsheet := TRUE; IsStructNote := FALSE; ELSEIF this_DocumentCommunication.DocumentType = "StructureNote" THEN IsFlowsheet := FALSE; IsStructNote := TRUE; ENDIF; (this_observations) := this_documentCommunication.CurrentObservationObj; (doc_config_obj):= this_documentCommunication.DocumentConfigurationObj; /**************************************************************** Defining the all object types ****************************************************************/ //Declare the Observation ObservationType := OBJECT [ ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj ]; //Declare the NumericValue NumericValueType := OBJECT [ Value ]; //Declare the TextValue TextValueType := OBJECT [ Value ]; //Declare the DateValue DateValueType := OBJECT [ Value ]; //Decalare the ListValue ListValueType :=OBJECT [ ListGUID, ListItemsList, SuggestedTextValue ]; //Declare the ListItem ListItemType := OBJECT[ListItemGuid, Value, IsSelected]; ListValueListItemType := OBJECT [ListItemGUID, Value, IsSelected]; //FOLLOWING OBJECTS ARE ONLY FOR FLOWSHEET DOCUMENTS. IF IsFlowsheet = TRUE THEN //Declare the Listset Value ListSetValueType := OBJECT [ ListValuesList ]; //Declare the IO Value IOValueType := OBJECT [ InValue, OutValue, DayRunningValue, BagNumber, BagInitialVolume ]; //Declare the Generic Drip Value GenericDripValueType := OBJECT [DoseValue, RateValue ]; //Declare the Drip Value DripValueType := OBJECT [ Value, BagNumber, BagInitialVolume ]; ENDIF; ;; evoke: /* Call MLM */ ;; logic: /************************************************************************* Creating object of the observation. *************************************************************************/ Result_observation := NEW ObservationType; Result_observation.ClientDocumentGUID := This_Doc.ClientDocumentGUID; Result_observation.ParameterGUID := Last(Parameter_Name.ParameterGUID); Result_observation.DataType := Parameter_Name.DataType; //Checking for the datatype of the parameter. /************************************************************************* Initializing and Populating with Value *************************************************************************/ //NUMERIC VALUE IF Parameter_Name.DataType = "NUMERICVALUE" THEN //CHECKING FOR THE RESULT VALUE EXIST IF value IS NOT NULL THEN //creates the new NumericValueType object and populates the fields // - this is the value being supplied to the observation Result_observation.ValueObj := NEW NumericValueType; Result_observation.ValueObj.Value := value AS NUMBER; ENDIF; //TEXT VALUE ELSEIF Parameter_Name.DataType = "FreeTextValue" THEN //creates the new NumericValueType object and populates the fields // - this is the value being supplied to the observation Result_observation.ValueObj := NEW TextValueType; Result_observation.ValueObj.Value := value AS STRING; //DATE VALUE ELSEIF Parameter_Name.DataType = "DATEVALUE" THEN //creates the new NumericValueType object and populates the fields // - this is the value being supplied to the observation //We are setting the value object only when Clear field flag is No or NULL. If Value IS NOT NULL OR Value <> "" Then Result_observation.ValueObj := NEW DateValueType; Endif; Result_observation.ValueObj.Value := value; //LIST VALUE ELSEIF Parameter_Name.DataType = "LISTVALUE" THEN //Get the Parameter details listItems := (); items := 1 seqto ( count Value); //break; (This_List_param) := this_parms WHERE this_parms.NAME = (Parameter_Name.name as string); //Get the LitConfiguration of the parameter (this_List_Config_list) := This_List_param.ConfigurationObj; //Get the ListItemConfiguration (this_List_ListItem) := LAST(this_List_Config_list.Listitemslist); //Create ValueObj as the ListValue Result_observation.ValueObj := NEW ListValueType; //Populate the ValueObj ListGUID from the ListGUID of the ListConfiguration Result_observation.ValueObj.ListGUID := LAST(this_List_Config_list.ListGUID); //List item array declaration. listItems := FIRST OF(this_List_ListItem WHERE (this_List_ListItem.IsSelected = TRUE)); for x in items do item := Value[x]; //Creating the ListItem //Populating the ListItem newItems := (this_List_ListItem WHERE (this_List_ListItem.value = item)); for nitems in newItems do NewListItem := NEW ListItemType; NewListItem.ListItemGUID := nitems.ListItemGUID; NewListItem.Value := nitems.Value; NewListItem.IsSelected := TRUE; //Adding ListItem in the List listItems := listItems, NewListItem; //break; enddo; /* //Creating the ListItem NewListItem2 := NEW ListItemType; //Populating the ListItem Item2 := FIRST OF(this_List_ListItem WHERE (this_List_ListItem.value = "S2")); NewListItem2.ListItemGUID := item2.ListItemGUID; NewListItem2.Value := item2.Value; NewListItem2.IsSelected := TRUE; //Adding ListItem in the List */ // listItems := listItems, NewListItem ; // listItems := listItems, NewListItem2 ; enddo; //Attaching the ListItem to the ListValue of the created observation Result_observation.ValueObj.ListItemsList := listItems AS LIST; //break; /* ELSEIF Parameter_Name.DataType = "LISTSETVALUE" THEN //Get the Parameter details listItems := (); listValues := (); (This_List_param) := this_parms WHERE this_parms.NAME = (Parameter_Name.name as string); //Get the LitConfiguration of the parameter (this_List_Config_list) := This_List_param.ConfigurationObj; //Get the ListItemConfiguration (this_List_ListItem) := LAST(this_List_Config_list.Listitemslist); //Create ValueObj as the ListValue Result_observation.ValueObj := NEW ListValueType; //Populate the ValueObj ListGUID from the ListGUID of the ListConfiguration Result_observation.ValueObj.ListGUID := LAST(this_List_Config_list.ListGUID); //List item array declaration. listItems := FIRST OF(this_List_ListItem WHERE (this_List_ListItem.IsSelected = TRUE)); Peds_General_List_Set_Param := This_List_param; obs := NEW ObservationType; obs.ClientDocumentGUID := this_documentCommunication.DocumentConfigurationObj.ClientDocumentGUID; obs.ParameterGUID := Peds_General_List_Set_Param.ParameterGUID; obs.DataType := Peds_General_List_Set_Param.DataType; obs.ValueObj := NEW ListSetValueType; items := 1 seqto ( count Value); for x in items do item := Value[x]; //Creating the ListItem NewListSetItem := NEW ListSetValueType; //Populating the ListItem Item := FIRST OF(this_List_ListItem WHERE (this_List_ListItem.value = item)); NewListSetItem.ListItemGUID := item.ListItemGUID; NewListSetItem.Value := item.Value; NewListSetItem.IsSelected := TRUE; //Adding ListItem in the List listItems := listItems, NewListSetItem; */ /* */ /* For Peds_General in Peds_General_List_Set_Param.ConfigurationObj.ListConfigurationList DO BREAK; // On the level of ListConfiguration Object selectedElement := NEW ListValueType; selectedElement.ListGuid := Peds_General.ListGuid; FOR item IN Peds_General.ListItemsList DO // On the level of ListItemConfiguration Object IF item.Value = "S1" THEN this_DocumentCommunication.Message := "2"; this_DocumentCommunication.DisplayMessage := true; //Create a list item object for the selected list item selectedItem := NEW ListValueListItemType; selectedItem.ListItemGUID := item.ListItemGUID; selectedItem.Value := item.Value; selectedItem.IsSelected := true; listItems := (listItems, selectedItem); ENDIF; ENDDO; // End of ListItem selectedElement.ListItemsList:= listItems; ListValues := (ListValues,selectedElement); ENDDO;// End of ListValue // End of General enddo; //Attaching the ListItem to the ListValue of the created observation Result_observation.ValueObj.ListItemsList := listItems ; //break; */ ENDIF ; /************************************************************************* Add the new value to the document{{{SINGLE-QUOTE}}}s charted observations *************************************************************************/ //Structure Note If IsFlowsheet = FALSE AND IsStructNote = TRUE Then This_Doc.ChartedObservationsList :=(This_Doc.ChartedObservationsList, Result_observation); //Flowsheet. ElseIf IsFlowsheet = TRUE AND IsStructNote = FALSE Then This_Doc.CurrentColumn.ChartedObservationsList := ( This_Doc.CurrentColumn.ChartedObservationsList, Result_observation ); EndIf; //Conclude true CONCLUDE TRUE; ;; action: RETURN Result_observation ; ;; Urgency: 50;; end: