maintenance: title: DOC_FUNC_LAY_CAREGIVER_NAME ;; mlmname: DOC_FUNC_LAY_CAREGIVER_NAME;; arden: version 2.5;; version: 1.00;; institution: St.Clair Hospital ;; author: Sandy Zhang, PharmD ;; specialist: Janet Nordin ;; date: 2017-06-13;; validation: testing;; library: purpose: This MLM takes the patient{{{SINGLE-QUOTE}}}s Lay Caregiver name and populates it into Discharge Checklist ;; explanation: Change History 06.13.2017 SZ CSR# 35709 - Start of project ;; keywords: ;; citations: ;; knowledge: type: data-driven;; data: // Recieve arguments from the structured note (thisDocumentCommunication) := argument; // Get the client and visit GUIDs clientGuid := thisDocumentCommunication.ClientGUID; // Extract interesting parts of the object model (thisStructuredNoteDoc) := thisDocumentCommunication.DocumentConfigurationObj; (thisParameters) := thisStructuredNoteDoc.ParametersList; // Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj]; FreeTextValueType := OBJECT [Value]; // Standard includes standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; // SQL returns Lay Caregiver{{{SINGLE-QUOTE}}}s name. This name is inserted into discharge checklist unless it matches "NO, CAREGIVER, NO_CAREGIVER or name returns null" (laygiver_name) := read last { "select Name" ||" from CV3ClientContact" ||" where TypeCode = {{{SINGLE-QUOTE}}}Lay Caregiver{{{SINGLE-QUOTE}}}" ||" and ClientGUID = " || sql(clientGuid) ||" and Active = 1" }; if thisdocumentCommunication.EventType = "DocumentOpening" then // Lay Caregiver name in Discharge Checklist returns N/A if it matches: "NO, CAREGIVER, NO_CAREGIVER or name returns null" from SQL if (laygiver_name = "NO, CAREGIVER") or (laygiver_name = "NO_CAREGIVER") or (laygiver_name is null) then vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_PDC_ Designated Lay Caregiver Name"); newObservation := NEW ObservationType; newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID; newObservation.ParameterGUID := vitalSignsHL.ParameterGUID; newObservation.DataType := "FreeTextValue"; newObservation.ValueObj := NEW FreeTextValueType; newObservation.ValueObj.Value := "N/A"; thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation); // If it doens{{{SINGLE-QUOTE}}}t match up to any of the above no-names then the Discharge Checklist returns the name of the Lay Caregiver else vitalSignsHL := first of (thisParameters where thisParameters.Name = "SCH_PDC_ Designated Lay Caregiver Name"); newObservation := NEW ObservationType; newObservation.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID; newObservation.ParameterGUID := vitalSignsHL.ParameterGUID; newObservation.DataType := "FreeTextValue"; newObservation.ValueObj := NEW FreeTextValueType; newObservation.ValueObj.Value := laygiver_name; thisStructuredNoteDoc.ChartedObservationsList := (thisStructuredNoteDoc.ChartedObservationsList, newObservation); endif; endif; ;; priority: 50 ;; evoke: ;; logic: conclude true; ;; action: return thisDocumentCommunication; ;; Urgency: 50;; end: