Initial Checking with all 820 MLMs
This commit is contained in:
238
MLMStripper/bin/Debug/SCH/SCH_FUNC_DCSUMMARY_PRINT.mlm
Normal file
238
MLMStripper/bin/Debug/SCH/SCH_FUNC_DCSUMMARY_PRINT.mlm
Normal file
@@ -0,0 +1,238 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_FUNC_DCSUMMARY_PRINT;;
|
||||
mlmname: SCH_FUNC_DCSUMMARY_PRINT;;
|
||||
arden: version 2.5;;
|
||||
version: 5.50;;
|
||||
institution: Allscripts;;
|
||||
author: Shawn Head;;
|
||||
specialist: ;;
|
||||
date: 2015-05-11;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: print electronic DC Summary document report from MLM
|
||||
|
||||
;;
|
||||
explanation: This called MLM uses ReportRequest class to print discharge summary document report.
|
||||
It also set report{{{SINGLE-QUOTE}}}s parameter values and distribution information
|
||||
|
||||
Change history
|
||||
|
||||
05.11.2015 STH CSR# 32070 go-live 6/9/2015 - Create electronic Discharge Summary report that will be sent to PDF, then converted to interface message
|
||||
(DEV) 7.7.2015 STH CSR#: 32070 - Testing for missing reports.
|
||||
|
||||
;;
|
||||
keywords:
|
||||
Discharge Summary, Day of Discharge Note, DC Summary
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "SCMLib";
|
||||
using "SCM.Common.Interfaces";
|
||||
using namespace "SCMLib";
|
||||
using namespace "SCM.Common.Interfaces";
|
||||
|
||||
|
||||
(ClientGuid,ChartGuid,VisitGuid,DCSummary,DCSummaryGUID) := ARGUMENT;
|
||||
|
||||
|
||||
(VisitID, MRN) := read last { " select visitidcode, idcode from cv3clientvisit with (nolock) "
|
||||
|| " where clientguid = " || sql(ClientGuid)
|
||||
|| " and chartguid = " || sql(ChartGuid)
|
||||
|| " and guid = " || sql(VisitGuid) };
|
||||
ClientDocumentGUID := ();
|
||||
if DCSummaryGUID is null then
|
||||
ClientDocumentGUID := read
|
||||
{ " Select cd.guid from CV3ClientDocument cd with (nolock) "
|
||||
|| " WHERE cd.ClientGUID = " || sql(ClientGuid)
|
||||
|| " AND cd.ChartGUID = " || sql(ChartGuid)
|
||||
|| " AND cd.ClientVisitGUID = " || sql(VisitGuid)
|
||||
|| " and cd.DocumentName like " || sql(DCSummary)
|
||||
|| " and cd.IsCanceled = 0 "
|
||||
|| " and cd.Active = 1 "
|
||||
|| " and cd.guid not in (select FillerDocumentID from CV3ClientDocument cd2 with (nolock) "
|
||||
|| " where cd2.ClientGUID = cd.ClientGUID and cd2.ChartGUID = cd.ChartGUID and cd2.ClientVisitGUID = cd.ClientVisitGUID "
|
||||
|| " and cd2.documentname like {{{SINGLE-QUOTE}}}discharge summary%{{{SINGLE-QUOTE}}} and cd2.Active = 1 and cd2.IsCanceled = 0 and cast(isnull(cd2.FillerDocumentID,{{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) as varchar) = cast(cd.guid as varchar) "
|
||||
|| " and cd2.AuthoredDtm = cast(convert(varchar(19),cd.touchedwhen,20) as datetime)) "};
|
||||
else
|
||||
ClientDocumentGUID := DCSummaryGUID;
|
||||
endif;
|
||||
|
||||
error_destination := destination { Alert } with [
|
||||
alert_type := "Warning",
|
||||
short_message := "ObjectsPlus Error from MLM",
|
||||
priority := "low",
|
||||
scope := "chart",
|
||||
Rule_group := "ObjectsPlus Error from MLM",
|
||||
Rule_number := 1001,
|
||||
Rule_subgroup := "",
|
||||
Send_with_order := "",
|
||||
Alert_dialog_settings := "",
|
||||
Display_alert := true ];
|
||||
|
||||
|
||||
|
||||
PhoneNumber := read last {" set concat_null_yields_null off select p.AreaCode + p.PhoneNumber from CV3User u with (nolock) join Cv3Phone p with (nolock) on p.PersonGUID = u.GUID " ||
|
||||
" where u.displayname = {{{SINGLE-QUOTE}}}SCM, Text Messaging{{{SINGLE-QUOTE}}} and p.PhoneNote = {{{SINGLE-QUOTE}}}HIS Test{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
abc123 := abc123 || "\n\n" || "PRODUCTION";
|
||||
|
||||
for x in (1 seqto count(ClientDocumentGUID)) do
|
||||
CD_GUID := ClientDocumentGUID[x];
|
||||
|
||||
|
||||
if (CD_GUID <> "" OR CD_GUID is not null)
|
||||
then
|
||||
try
|
||||
abc123 := abc123 || "\n\n" || "Enter Try";
|
||||
|
||||
|
||||
|
||||
|
||||
report_request_obj := call {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.ReportRequest{{{SINGLE-QUOTE}}}.CreateReportRequest with ("DischargeSummary_PDF" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}});
|
||||
abc123 := abc123 || "\n\n" || "Created Report Object";
|
||||
if (report_request_obj.Parameters is not null and report_request_obj.Parameters.Count > 0)
|
||||
then
|
||||
abc123 := abc123 || "\n\n" || "Entered If parameters exists section";
|
||||
report_parameter_list := ();
|
||||
for parameterIndex in (1 seqto report_request_obj.Parameters.Count)
|
||||
do
|
||||
abc123 := abc123 || "\n\n" || "Entered for parameterindex loop count #:" || parameterIndex;
|
||||
report_parameter_list := report_parameter_list, report_request_obj.Parameters[parameterIndex];
|
||||
enddo;
|
||||
endif;
|
||||
abc123 := abc123 || "\n\n" || "set report parameter list";
|
||||
param_ClientDocGUID := first (report_parameter_list where report_parameter_list.Label = "varClientDocumentGUID");
|
||||
param_ClientGUID:= first (report_parameter_list where report_parameter_list.Label = "varClientGUID");
|
||||
param_ChartGUID := first(report_parameter_list where report_parameter_list.Label = "varClientChartGUID");
|
||||
param_VisitGUID := first(report_parameter_list where report_parameter_list.Label = "varClientVisitGUID");
|
||||
param_VisitID := first(report_parameter_list where report_parameter_list.Label = "varVisitID");
|
||||
param_VisitMRN := first(report_parameter_list where report_parameter_list.Label = "varVisitMRN");
|
||||
abc123 := abc123 || "\n\n" || "set report parameter values";
|
||||
|
||||
if param_VisitID.AllowModification then
|
||||
void := call param_VisitID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(VisitID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_VisitMRN.AllowModification then
|
||||
void := call param_VisitMRN.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(MRN) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
|
||||
if param_ClientDocGUID.AllowModification then
|
||||
void := call param_ClientDocGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(CD_GUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_ClientGUID.AllowModification then
|
||||
void := call param_ClientGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(ClientGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_ChartGUID.AllowModification then
|
||||
void := call param_ChartGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(ChartGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
|
||||
if param_VisitGUID.AllowModification then
|
||||
void := call param_VisitGUID.{{{SINGLE-QUOTE}}}SetValue<System.String>{{{SINGLE-QUOTE}}} with STRING(VisitGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}};
|
||||
endif;
|
||||
abc123 := abc123 || "\n\n" || "check parameters for modify and set them to desired values";
|
||||
report_request_obj.PrintPolicy := "Broadcast" as {{{SINGLE-QUOTE}}}PrintPolicy{{{SINGLE-QUOTE}}};
|
||||
report_request_obj.ProcessReportLocally := false;
|
||||
report_request_obj.PrintJobDestination := "PDFHL7";
|
||||
reportRequest.PrintJobPriority := "Normal" as {{{SINGLE-QUOTE}}}PrintJobPriority{{{SINGLE-QUOTE}}};
|
||||
report_request_obj.NumberOfCopies := 1;
|
||||
|
||||
abc123 := abc123 || "\n\n" || "set other report vales";
|
||||
// print the report
|
||||
void := call report_request_obj.Save;
|
||||
abc123 := abc123 || "\n\n" || "save and print report";
|
||||
// Call Dispose on report_request_obj to clean it up
|
||||
if report_request_obj is not null
|
||||
then
|
||||
void := call report_request_obj.Dispose;
|
||||
report_request_obj := null;
|
||||
endif;
|
||||
|
||||
endtry;
|
||||
|
||||
catch exception ex
|
||||
abc123 := abc123 || "\n\n" || "entered catch error exception";
|
||||
error_occurred := true;
|
||||
error_message := "{{+R}}Auto Print:{{-R}}\n" || ex.Message || "\n\n";
|
||||
if ex.InnerException is not null net_object then
|
||||
error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
|
||||
endif;
|
||||
abc123 := abc123 || "\n\n" || error_message;
|
||||
// Send a Text Message Section
|
||||
|
||||
// Call Dispose on report_request_obj to clean it up
|
||||
if report_request_obj is not null
|
||||
then
|
||||
void := call report_request_obj.Dispose;
|
||||
report_request_obj := null;
|
||||
endif;
|
||||
|
||||
endcatch;
|
||||
|
||||
endif;
|
||||
enddo;
|
||||
// Send a Text Message Section
|
||||
|
||||
|
||||
Page_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PAGE{{{SINGLE-QUOTE}}};
|
||||
MessageSubject:= "Discharge Summary MLM Alert";
|
||||
MessageBody := " ClientGUID: " || ClientGuid || "\n\n "
|
||||
|| "ChartGUID: " || ChartGuid || "\n\n "
|
||||
|| "ClientVisitGUID: " || VisitGuid || "\n\n"
|
||||
|| "DCSummaryGUID: " || DCSummaryGUID || "\n\n"
|
||||
|| "DCSummary: " || DCSummary
|
||||
|| "ClientDocGUID: " || ClientDocumentGUID || "\n\n"
|
||||
|| "cd_guid: " || CD_GUID || "\n\n"
|
||||
/*
|
||||
|| "param_VisitID: " || param_VisitID.Value || "\n\n"
|
||||
|| "param_ClientGUID " || param_ClientGUID.Value || "\n\n"
|
||||
|| "param_ChartGUID: " || param_ChartGUID.Value || "\n\n"
|
||||
|| "param_ClientDocGUID: " || param_ClientDocGUID.Value || "\n\n"
|
||||
|| "report_request_obj.Parameters: " || report_request_obj.Parameters
|
||||
*/
|
||||
|| "abc123: " || abc123;
|
||||
if error_occurred then
|
||||
void := call Page_MLM with(PhoneNumber, MessageSubject, MessageBody);
|
||||
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:
|
||||
;;
|
||||
logic:
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
if Error_occurred
|
||||
then
|
||||
write "An error has occured in the MLM {{+B}}SCH_FUNC_DCSUMMARY_PRINT{{-B}} " ||
|
||||
"Please notify your System Administrators that an error message has " ||
|
||||
"occurred for this patient. They will review the following error " ||
|
||||
"message: \n" at error_destination;
|
||||
write error_message at error_destination;
|
||||
|
||||
endif;
|
||||
|
||||
// Diagnostic Alert - Can be enabled if needed
|
||||
// write " Messages " || " Execute the Called PRINT MLM - " || NOW || " " || ClientDocumentGUID at alert_dest;
|
||||
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user