maintenance: title: DOC_FUNC_CCDA_PRINT;; mlmname: DOC_FUNC_CCDA_PRINT;; arden: version 2.5;; version: 5.50;; institution: Allscripts;; author: Renish Bhimani;; specialist: ;; date: 2014-05-21;; validation: testing;; library: purpose: print CCD-A document report from MLM ;; explanation: The MLM is called from a Document and if a Print Button is selected, it calls MLM "SCH_FUNC_CCDA_Print" which generates a CCDA document Change history 06.25.2014 DW CSR# 31688 - MU2 07.08.2014 DW CSR# 31688 - MU2 Suppress print for behavioral health patients 12.11.2018 DW HD#3548079 - Blank prints are sometimes generated. We think it is due to system latency. I changed the delay from 90 to 120 seconds to permit DOC_FUNC_CCDA_CREATE_AND_TRANSPORT to create the CCDA Summary of Care ;; keywords: ;; knowledge: type: data-driven;; data: standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; trig_event_enter := event {ClientDocumentEnter User ClientDocument: where documentname in ("Discharge Instructions (Post Hospital Care Orders)")}; trig_event_modify := event {ClientDocumentModify User ClientDocument: where documentname in ("Discharge Instructions (Post Hospital Care Orders)")}; (VisitGUID, ChartGUID, ClientGUID) := read last {ClientDocument: ClientVisitGUID, ChartGUID, ClientGUID REFERENCING EvokingObject}; ClientDocumentName := "CCDA Summary of Care"; ClientDocumentGUID := read first { " Select GUID from CV3ClientDocument with (nolock) WHERE DocumentName = " || SQL(ClientDocumentName) || " AND ClientGUID = " || sql(ClientGUID) || " AND ChartGUID = " || SQL(ChartGuid) || " AND ClientVisitGUID = " || SQL(VisitGuid) || " ORDER BY TouchedWhen DESC" }; PrintButtonSelected := read first { " select top 1 fsl.value " || " from CV3ClientDocument cd with (nolock) " || " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || sql(ClientGUID) || " and cdd.active = 1) " || " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 " || " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID " || " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || sql(ClientGUID) || " ) " || " where cd.clientguid = " || sql(ClientGUID) || " and cd.ChartGUID = " || SQL(ChartGuid) || " and cd.ClientVisitGUID= " || SQL(VisitGuid) || " " || " and cd.iscanceled = 0 " || " and cd.documentname like {{{SINGLE-QUOTE}}}%Post Hospital Care Orders%{{{SINGLE-QUOTE}}} " || " and ocmi.name in ({{{SINGLE-QUOTE}}}CXD Transition Care Print{{{SINGLE-QUOTE}}}) " || " and fsl.value is not null " || " order by cd.touchedwhen desc " }; PsychPatient := read { " Select currentlocation from cv3clientvisit with (nolock) " || " Where ClientGUID = " || sql(ClientGUID) || " AND ChartGUID = " || SQL(ChartGuid) || " AND GUID = " || SQL(VisitGuid) || " and currentlocation like {{{SINGLE-QUOTE}}}Psy%{{{SINGLE-QUOTE}}} " }; if (ClientDocumentGUID <> "" OR ClientDocumentGUID is not null) and PrintButtonSelected is not null and not exist PsychPatient then CCD_MLM := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_CCDA_Print{{{SINGLE-QUOTE}}}; void := call CCD_MLM with ClientGuid,ChartGuid,VisitGuid,ClientDocumentName; endif; // Diagnostic Alert - Can be enabled if needed // send_alert := "DoNotSend"; // alert_dest := destination { Alert: warning, "Informational" , high, chart, "Informational" , 15042, send_alert, "No Override Allowed" }; ;; priority: 50 ;; evoke: 120 seconds after time of trig_event_enter; 120 seconds after time of trig_event_modify; // trig_event_enter; // trig_event_modify; ;; logic: conclude true; ;; action: // Diagnostic Alert - Can be enabled if needed // write " Messages " || " CALL the PRINT MLM - " || NOW || " " || PrintButtonSelected at alert_dest; ;; Urgency: 50;; end: