maintenance: title: ProgressNote_PrintOnSave;; mlmname: DOC_FUNC_PRINT_ON_SAVE;; arden: version 5.0;; version: 2.00;; institution: St.Clair Hospital;; author: Robert Spence;; specialist: ;; date: 2010-04-06;; validation: testing;; library: purpose: References a radio button on the Physician Progress Notes By System On Document Open, forces the radio button to be false On Document Close, if the radio button is false asks the user if they want to print to the nursing unit If Yes, auto checks the radio button to true If No, leaves the button as false from the document open logic Document is sent out of the interface per config If interface finds the print to nursing unit references, it formats and sends to netprint for distribution ;; explanation: Change history 04-06-2010 RS Copied from DOC_FUNC_CHF for template ;; keywords: ;; knowledge: type: data-driven;; data: // RS ADD Message box standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; // Recieve arguments from the structured note (thisDocumentCommunication) := argument; // Extract interesting parts of the object model (thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj; (thisParameters) := thisStructuredNoteDoc.ParametersList; (thisObservations) := thisStructuredNoteDoc.ChartedObservationsList; // this makes pilot users only see the print option user_IDCode := read last {"SELECT IDCode FROM CV3User with (nolock) " || " where GUID = " || thisDocumentCommunication.UserGUID}; // add the pilot user login id to this list pilotusers := ("jmiller","pkarish","ccorbett"); // removed ,"lcivitarese" from pilot 07/30/2010 printallowed:= false; printallowed := user_IDCode in pilotusers; // marker end of pilot users, uncomment next line to work for all users, comment out to run for just pilot users // printallowed := true; // Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj]; FreeTextValueType := 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; IF thisdocumentCommunication.EventType = "DocumentOpening" then // Simply wish to reset the PRINT ON SAVE EVENT To False // Therefore when the close event happens, we can ask the {{{SINGLE-QUOTE}}}do you want to print at nursing unit question again // Reference the radio button this_parametername := first of (thisParameters where thisParameters.Name = "SCH_MDPN_Print on save"); // create the object 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 := (); // hard code the list object to be false 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; // send the object to the document thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj); elseif thisdocumentCommunication.EventType = "DocumentClosing" and printallowed = true then theParameter := first of (thisparameters where thisparameters.Name = "SCH_MDPN_Print on save"); theObservation := first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID); if true not in (theObservation.ValueObj.ListItemsList.IsSelected) then dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Would You Like To Print Directly To The Nursing Unit Now?" ,"Direct Printing","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}},"Button1" as {{{SINGLE-QUOTE}}}MessageBoxDefaultButton{{{SINGLE-QUOTE}}}; resulttext := dialogResult as string; if resulttext = "Yes" then this_currentObj := NEW ObservationType; this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID; this_currentObj.ParameterGUID := theParameter.ParameterGUID; this_currentObj.DataType := "ListValue"; this_currentObj.ValueObj := New ListValueType; this_currentObj.ValueObj.ListGUID:= theParameter.ConfigurationObj.ListGUID; listItems := (); FOR item IN theParameter.ConfigurationObj.ListItemsList DO selectedItem := NEW ListValueListItemType; selectedItem.ListItemGUID := item.ListItemGUID; selectedItem.Value := item.Value; selectedItem.IsSelected := true; listItems := (listItems, selectedItem); ENDDO; this_currentobj.ValueObj.ListItemsList := listItems; thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj); endif; endif; endif; ;; evoke: ;; logic: conclude true; ;; action: return thisDocumentCommunication; ;; Urgency: 50;; end: