maintenance: title: ;; mlmname: DOC_FUNC_DISCHARGE_DIAG;; arden: version 2.5;; version: 0.00;; institution: ;; author: ;; specialist: ;; date: 2012-11-05;; validation: testing;; library: purpose: Pull the discharge diagnosis from progress notes using SQL/SP "SCH_PHCO_DCInst_SUB_Discharge_Diag" This MLM will limit the results to the "ProgressNote" entries excluding the items added to the health issue type Discharge Diag and will then update the discharge instructions (post hospital care orders) document to show the discharge diag from progress notes ;; explanation: 4/16/2013 - CSR #: 31547 - Update MLM and stored procedure to pull from the discharge order observation also. ;; keywords: ;; knowledge: type: data-driven;; data: //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) := thisStructeredNoteDoc.ChartedObservationsList; // Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj]; FreeTextValueType := OBJECT [Value]; IF thisdocumentCommunication.EventType = "DocumentOpening" then // Get the client and visit GUIDs clientGuid := thisDocumentCommunication.ClientGUID; visitGuid := thisDocumentCommunication.ClientVisitGUID; chartGuid := thisDocumentCommunication.ChartGUID; clientvisitGuid := thisDocumentCommunication.ClientVisitGUID; group1 := (); group2 := (); healthissues := (); locationentered := (); returnhealthissues := (); If called_by_editor then clientvisitguid := "0"; endif; ( group1, group2, healthissues, locationentered ) := read { "EXEC SCH_PHCO_DCInst_SUB_Discharge_Diag {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}},"|| sql(clientvisitGuid)};//|| SQL(current_status) }; for x in (1 seqto (count(healthissues))) do if locationentered[x] = "ProgressNote" or locationentered[x] = "DischargeOrder" then if (length(returnhealthissues) > 0) then returnhealthissues := returnhealthissues || ", " || healthissues[x]; else returnhealthissues := healthissues[x]; endif; endif; enddo; // Create our observation and give it back to the structured note DischargeDiag := first of (thisParameters where thisParameters.Name = "SCHCK_DI_Diagnosis from PN"); newObservation := NEW ObservationType; newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID; newObservation.ParameterGUID := DischargeDiag.ParameterGUID; newObservation.DataType := "FreeTextValue"; newObservation.ValueObj := NEW FreeTextValueType; newObservation.ValueObj.Value := returnhealthissues as string; thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation); endif; ;; priority: 50 ;; evoke: ;; logic: conclude true ;; action: return thisDocumentCommunication; ;; Urgency: 50;; end: