maintenance: title: DOC_FUNC_ETHICS_NOTE;; mlmname: DOC_FUNC_ETHICS_NOTE;; arden: version 4.5;; version: 2.00;; institution: St.Clair Hospital;; author: Peggy Karish;; specialist: Don Warnick ;; date: 2018-03-19;; validation: testing;; library: purpose: ;; explanation: Change history 03.19.2018 DW CSR# 36364 - Ethics Note - Created ;; keywords: ;; knowledge: type: data-driven;; data: // Recieve arguments from the structured note (thisDocumentCommunication) := argument; // Extract interesting parts of the object model (thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj; (thisParameters) := thisStructuredNoteDoc.ParametersList; (thisObservations) := thisStructuredNoteDoc.ChartedObservationsList; // Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj]; FreeTextValueType := OBJECT [Value]; DateValueType := OBJECT [Value]; ListValueType := OBJECT [ListGuid,ListItemsList, SuggestedTextValue]; ListValueListItemType:= OBJECT [ListItemGUID, Value, IsSelected]; // Get the client and visit GUIDs clientGuid := thisDocumentCommunication.ClientGUID; visitGuid := thisDocumentCommunication.ClientVisitGUID; chartGuid := thisDocumentCommunication.ChartGUID; userGuid := thisDocumentCommunication.UserGUID; standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; launchtheapp:= "no"; // Document Open if thisdocumentCommunication.EventType = "DocumentOpening" then // Vital Signs Section DocVitalsHL2 := MLM {{{SINGLE-QUOTE}}}DOC_FUNC_VS_24hrs{{{SINGLE-QUOTE}}}; thisDocumentCommunication := CALL DocVitalsHL2 WITH thisDocumentCommunication; // Code Status Section formattedText:= ""; CodeStatusOrder := read {" SET CONCAT_NULL_YIELDS_NULL off SELECT ocmi.Name + {{{SINGLE-QUOTE}}} - {{{SINGLE-QUOTE}}} + substring (o.summaryline, 3,500) FROM CV3OrderCatalogMasterItem ocmi with (nolock) JOIN CV3Order o with (nolock) ON o.OrderCatalogMasterItemGUID = ocmi.GUID AND o.ClientGUID = " || ClientGuid || " AND o.ClientVisitGUID = " || VisitGuid || " AND o.ChartGUID = " || ChartGuid || " WHERE ( ocmi.Name in ({{{SINGLE-QUOTE}}}CPR/Attempt Resuscitation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DNR/Do Not Attempt Resuscitation{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Comfort Measures Only{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Code Status: Limited Interventions{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: Full Treatment{{{SINGLE-QUOTE}}}) or ocmi.Name = {{{SINGLE-QUOTE}}}Code Status: Ethically unable to determine{{{SINGLE-QUOTE}}} ) AND o.OrderStatusLevelNum >= 15 AND o.OrderStatusLevelNum not in (69, 70) "}; if exists CodeStatusOrder then for i in 1 seqto count CodeStatusOrder do if i = 1 then formattedText:= formattedText || CodeStatusOrder[i]; else formattedText:= formattedText || "\n\n" || CodeStatusOrder[i]; endif; enddo; endif; // Write to the Structured Note Text Box If formattedText is not null then vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_MDPN_EthicsCode Status Current"); newObservation := NEW ObservationType; newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID; newObservation.ParameterGUID := vitalSignsHL.ParameterGUID; newObservation.DataType := "FreeTextValue"; newObservation.ValueObj := NEW FreeTextValueType; newObservation.ValueObj.Value := formattedText; thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation); endif; // Chart Observation ElseIf thisdocumentCommunication.EventType = "ChartObservation" // and selectedobservationname = "SCH_MDPN_Ethics ConsultReq Launch" then launchtheapp:= "yes"; using "AddCareProvidertoSN"; test:= new net_object {{{SINGLE-QUOTE}}}AddProviderToNote.AddProviderToNoteForm{{{SINGLE-QUOTE}}}; // Reset the launch button theParameterx := first of (thisparameters where thisparameters.Name = "SCH_MDPN_Ethics ConsultReq Launch"); theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameterx.ParameterGUID); if thisdocumentCommunication.CurrentObservationObj.parameterguid = theParameterx.ParameterGUID then this_parametername := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Ethics ConsultReq Launch"); this_currentObj := NEW ObservationType; this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID; this_currentObj.ParameterGUID := this_parametername.ParameterGUID; this_currentObj.DataType := "ListValue"; this_currentObj.ValueObj := New ListValueType; this_currentObj.ValueObj.ListGUID:= this_parametername.ConfigurationObj.ListGUID; listItems := (); FOR item IN this_parametername.ConfigurationObj.ListItemsList DO selectedItem := NEW ListValueListItemType; selectedItem.ListItemGUID := item.ListItemGUID; selectedItem.Value := item.Value; selectedItem.IsSelected := false; listItems := (listItems, selectedItem); ENDDO; this_currentobj.ValueObj.ListItemsList := listItems; thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj); endif; endif; ;; evoke: ;; logic: if launchtheapp = "yes" then oeUnsigned:=CALL test.ShowDialog; return_string:= test.text; endif; this_parametername := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Ethics ConsultRequestor"); this_currentObj := NEW ObservationType; this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID; this_currentObj.ParameterGUID := this_parametername.ParameterGUID; this_currentObj.DataType := "FreeTextValue"; this_currentObj.ValueObj := New FreeTextValueType; this_currentObj.ValueObj.Value := return_string; thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj); conclude true; ;; action: return thisDocumentCommunication; ;; Urgency: 50;; end: