Initial Checking with all 820 MLMs
This commit is contained in:
481
MLMStripper/bin/Debug/DOC/DOC_FUNC_CCDA_DATA.mlm
Normal file
481
MLMStripper/bin/Debug/DOC/DOC_FUNC_CCDA_DATA.mlm
Normal file
@@ -0,0 +1,481 @@
|
||||
maintenance:
|
||||
|
||||
title: DOC_FUNC_CCDA_DATA;;
|
||||
mlmname: DOC_FUNC_CCDA_DATA;;
|
||||
arden: version 5.0;;
|
||||
version: 2.00;;
|
||||
institution: St.Clair Hospital;;
|
||||
author: Don Warnick;;
|
||||
specialist: ;;
|
||||
date: 2014-04-30;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation: This MLM manages will popultate the required fields for the CCDA
|
||||
|
||||
|
||||
Change history
|
||||
|
||||
04.30.2014 DW CSR# 31688 - MU2
|
||||
07.08.2014 DW CSR# 31688 - MU2 (1)Print Discharge Instructions (2)Fill text fields upon close rather than open
|
||||
07.29.2014 DW HD# 167119 - Only the first 2 OT (and PT) observations of the latest set were being pulled
|
||||
08.20.2014 DW HD# 168587 - Needed to increase the size of the "DATA" field of the OT and PT temp SQL tables. A user exceeded 200 characters. Changed it to 1000.
|
||||
05.10.2015 STH CRS#: 32070 - Auto print Patient DC instructions and generate DC summary ONLY once discharge order reconiciliation is completed. Also alert
|
||||
users if order reconciliation is incomplete on entrying into the document.
|
||||
08.19.2015 DW CSR# 33555 - 15.1 - updated formatting of "Followup" section
|
||||
10.26.2015 STH Support case 1917862 - issue with clinic visits requing order rec completion
|
||||
;;
|
||||
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
|
||||
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;
|
||||
|
||||
// Create prototypes for the object types we{{{SINGLE-QUOTE}}}ll need to instantiate
|
||||
ObservationType := OBJECT [ObservationGUID, ClientDocumentGUID, ParameterGUID, DataType, ValueObj];
|
||||
FreeTextValueType := OBJECT [Value];
|
||||
DateValueType := 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;
|
||||
userGuid := thisDocumentCommunication.UserGUID;
|
||||
PatCurLocation := read last {"select currentlocation from cv3clientvisit with (nolock)"
|
||||
|| " where clientguid = " || sql(clientguid)
|
||||
|| " and chartguid = " || sql(chartGuid)
|
||||
|| " and guid = " || sql(visitGuid) };
|
||||
|
||||
(VisitType) := read {"select top 1 typecode from cv3clientvisit with (nolock) "
|
||||
|| " where clientguid = " || sql(clientGuid)
|
||||
|| " and chartguid = " || sql(chartGuid)
|
||||
|| " and guid = " || sql(visitGuid)};
|
||||
|
||||
//BEGIN - [STH] CSR#: 32070
|
||||
if ((PatCurLocation matches pattern "infus%") or (trim(VisitType[1]) is not in ("Inpatient","Observation"))) then
|
||||
dc_orderrec_GUID := 0;
|
||||
else
|
||||
dc_orderrec_GUID := read last {"select guid from CV3OrderReconcile with (nolock) "
|
||||
|| " where clientguid = " || sql(ClientGuid)
|
||||
|| " and chartguid = " || sql(ChartGuid)
|
||||
|| " and ClientVisitGUID = " || sql(VisitGuid)
|
||||
|| " and reconciletypecode = {{{SINGLE-QUOTE}}}discharge{{{SINGLE-QUOTE}}} "
|
||||
|| " and ReconcileStatusType = 2 "};
|
||||
endif;
|
||||
//END - [STH] CSR#: 32070
|
||||
|
||||
|
||||
|
||||
// DOCUMENT OPENING SECTION
|
||||
|
||||
|
||||
IF thisdocumentCommunication.EventType = "DocumentOpening"
|
||||
|
||||
then
|
||||
|
||||
//BEGIN [STH] - CSR#: 32070
|
||||
if dc_orderrec_guid is null or dc_orderrec_guid = "" then
|
||||
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Discharge Order Reconciliation is INCOMPLETE. You cannot print the patient’s Discharge Instructions until the Discharge Order Reconciliation is completed. Do you want to launch Order Reconciliation now?"
|
||||
,"Discharge Order Reconciliation Incomplete","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
|
||||
(thisDocumentCommunication) := argument;
|
||||
OpenMedRec := MLM {{{SINGLE-QUOTE}}}DOC_Call_Med_Rec{{{SINGLE-QUOTE}}};
|
||||
thisDocumentCommunication := CALL OpenMedRec WITH thisDocumentCommunication;
|
||||
|
||||
endif;
|
||||
endif;
|
||||
//END - [STH] - CSR#: 32070
|
||||
|
||||
// Desellect the "Print Document" button
|
||||
|
||||
theParameter := first of (thisparameters where thisparameters.Name = "CXD Transition Care Print");
|
||||
theObservation:= first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
||||
|
||||
|
||||
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Transition Care Print");
|
||||
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 := ();
|
||||
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;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
||||
|
||||
|
||||
// Set the HIS only "dummy" button to true to activate the SAVE button
|
||||
|
||||
theParameter := first of (thisparameters where thisparameters.Name = "CXD Testing MLM Only");
|
||||
theObservation:= first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
||||
|
||||
|
||||
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Testing MLM Only");
|
||||
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 := ();
|
||||
FOR item IN this_parametername.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; // EventType = "DocumentOpening"
|
||||
|
||||
|
||||
|
||||
// DOCUMENT CLOSING SECTION
|
||||
|
||||
|
||||
|
||||
IF thisdocumentCommunication.EventType = "DocumentClosing"
|
||||
|
||||
|
||||
then
|
||||
|
||||
|
||||
// GATHER DATA
|
||||
|
||||
|
||||
// Occupational Therapy Data (only the latest charted from SN or FS is to be displayed)
|
||||
|
||||
(OTGoalstData) := read
|
||||
{
|
||||
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), touchedwhen datetime, data varchar(1000), latestdate datetime) "
|
||||
|| " SET CONCAT_NULL_YIELDS_NULL off "
|
||||
|| " INSERT INTO #tmp_aaa (touchedwhen,data) "
|
||||
|| " select cd.entered , o.ValueText + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + fsl.value "
|
||||
|| " from CV3ClientDocument cd with (nolock) "
|
||||
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || ClientGuid || " and cdd.active = 1) "
|
||||
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|
||||
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|
||||
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|
||||
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || ClientGuid || " ) "
|
||||
|| " where cd.clientguid = " || ClientGuid || " and cd.ChartGUID = " || ChartGuid || " and cd.ClientVisitGUID= " || VisitGuid || " "
|
||||
|| " and cd.iscanceled = 0 "
|
||||
|| " and cd.documentname in ({{{SINGLE-QUOTE}}}occupational Therapy Initial Evaluation{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}4. Adult Goal/Outcome Evaluation{{{SINGLE-QUOTE}}}) "
|
||||
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}SCHCK_OT disc prog rec{{{SINGLE-QUOTE}}}) "
|
||||
|| " order by cd.touchedwhen desc "
|
||||
|| " declare @lastdate datetime "
|
||||
|| " set @lastdate = (select touchedwhen from #tmp_aaa where id = 1) "
|
||||
|| " update t1 set t1.latestdate = @lastdate from #tmp_aaa t1 where t1.touchedwhen = @lastdate "
|
||||
|| " delete from #tmp_aaa where latestdate is null "
|
||||
|| " select data from #tmp_aaa "
|
||||
|| " drop table #tmp_aaa "
|
||||
};
|
||||
|
||||
|
||||
if exists OTGoalstData
|
||||
then
|
||||
OTGoalstDataText := "\n OT Discharge Recommendation : " || OTGoalstData;
|
||||
else
|
||||
OTGoalstDataText := "";
|
||||
endif;
|
||||
|
||||
|
||||
// Physical Therapy Data (only the latest charted from SN or FS is to be displayed)
|
||||
|
||||
|
||||
(PTGoalstData) := read
|
||||
{
|
||||
" CREATE TABLE #tmp_aaa ( ID int IDENTITY(1, 1), touchedwhen datetime, data varchar(1000), latestdate datetime) "
|
||||
|| " SET CONCAT_NULL_YIELDS_NULL off "
|
||||
|| " INSERT INTO #tmp_aaa (touchedwhen,data) "
|
||||
|| " select cd.entered , o.ValueText + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + fsl.value "
|
||||
|| " from CV3ClientDocument cd with (nolock) "
|
||||
|| " join CV3ClientDocDetail cdd with (nolock) ON (cdd.ClientDocumentGUID = cd.GUID AND cdd.ClientGUID = " || ClientGuid || " and cdd.active = 1) "
|
||||
|| " join CV3ObservationDocument od with (nolock)ON cdd.CLientDocumentGUID = od.OwnerGUID and od.active = 1 "
|
||||
|| " join CV3Observation o with (nolock) ON o.GUID = od.ObservationGUID "
|
||||
|| " join CV3ObsCatalogMasterItem ocmi with (nolock) on od.ObsMasterItemGUID = ocmi.GUID "
|
||||
|| " left join SCMObsFSListValues fsl(nolock) ON (fsl.ParentGUID = od.ObservationDocumentGUID AND fsl.ClientGUID = " || ClientGuid || " ) "
|
||||
|| " where cd.clientguid = " || ClientGuid || " and cd.ChartGUID = " || ChartGuid || " and cd.ClientVisitGUID= " || VisitGuid || " "
|
||||
|| " and cd.iscanceled = 0 "
|
||||
|| " and cd.documentname in ({{{SINGLE-QUOTE}}}Physicial Therapy Initial Evaluation{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}4. Adult Goal/Outcome Evaluation{{{SINGLE-QUOTE}}}) "
|
||||
|| " and ocmi.name in ({{{SINGLE-QUOTE}}}SCHCK_PT disc prog rec{{{SINGLE-QUOTE}}}) "
|
||||
|| " order by cd.touchedwhen desc "
|
||||
|| " declare @lastdate datetime "
|
||||
|| " set @lastdate = (select touchedwhen from #tmp_aaa where id = 1) "
|
||||
|| " update t1 set t1.latestdate = @lastdate from #tmp_aaa t1 where t1.touchedwhen = @lastdate "
|
||||
|| " delete from #tmp_aaa where latestdate is null "
|
||||
|| " select data from #tmp_aaa "
|
||||
|| " drop table #tmp_aaa "
|
||||
};
|
||||
if exists PTGoalstData
|
||||
then
|
||||
PTGoalstDataText := "\n PT Discharge Recommendation : " || PTGoalstData;
|
||||
else
|
||||
PTGoalstDataText := "";
|
||||
endif;
|
||||
|
||||
|
||||
(DischargeOrder) := read last
|
||||
{
|
||||
" SET CONCAT_NULL_YIELDS_NULL off select {{{SINGLE-QUOTE}}}\n {{{SINGLE-QUOTE}}} + o.name + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + REPLACE(REPLACE(REPLACE(o.SummaryLine, CHAR(10), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), CHAR(13), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), CHAR(9), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) "
|
||||
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
||||
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || VisitGuid || " "
|
||||
|| " and (o.name = {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}})"
|
||||
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
|
||||
};
|
||||
|
||||
|
||||
// Concatenate the 3 values together with nice formatting
|
||||
|
||||
|
||||
If exists DischargeOrder
|
||||
then RehabGoalstDataText:= " " || DischargeOrder;
|
||||
If exists PTGoalstData
|
||||
then RehabGoalstDataText := RehabGoalstDataText || " \n ________________ " || PTGoalstDataText;
|
||||
endif;
|
||||
If exists OTGoalstData
|
||||
then RehabGoalstDataText := RehabGoalstDataText || " \n ________________ " || OTGoalstDataText;
|
||||
endif;
|
||||
|
||||
elseif exists PTGoalstData
|
||||
then RehabGoalstDataText:= " " || PTGoalstDataText;
|
||||
If exists OTGoalstData
|
||||
then RehabGoalstDataText := RehabGoalstDataText || " \n ________________ " || OTGoalstDataText;
|
||||
endif;
|
||||
|
||||
elseif exists OTGoalstData
|
||||
then RehabGoalstDataText:= " " || OTGoalstDataText;
|
||||
else
|
||||
RehabGoalstDataText:= " ";
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
// Followup Visit and Test Orders
|
||||
|
||||
(FollowupVisitsandTestsList) := read
|
||||
{
|
||||
" SET CONCAT_NULL_YIELDS_NULL off select {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + o.name + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + REPLACE(REPLACE(REPLACE(o.SummaryLine, CHAR(10), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}), CHAR(13), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}), CHAR(9), {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) "
|
||||
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
||||
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || VisitGuid || " "
|
||||
|| " and o.InitialSessionTypeCode = {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} "
|
||||
|| " and (o.name like {{{SINGLE-QUOTE}}}Lab Test%{{{SINGLE-QUOTE}}} or o.name like {{{SINGLE-QUOTE}}}Lab Test - INR%{{{SINGLE-QUOTE}}} or o.name like {{{SINGLE-QUOTE}}}Medical Imaging & Other Tests%{{{SINGLE-QUOTE}}} or o.name = {{{SINGLE-QUOTE}}}Discharge Follow-Up Visits{{{SINGLE-QUOTE}}} ) "
|
||||
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
|
||||
};
|
||||
|
||||
if exists FollowupVisitsandTestsList
|
||||
|
||||
then
|
||||
|
||||
for i in 1 seqto count FollowupVisitsandTestsList do
|
||||
if i = 1
|
||||
then FollowupVisitsandTestsListText := " \n " || FollowupVisitsandTestsList [i];
|
||||
else FollowupVisitsandTestsListText := FollowupVisitsandTestsListText || "\n _____________\n" || FollowupVisitsandTestsList [i];
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
// Check the Patient Education Box
|
||||
|
||||
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Plan of Care Instruction Type");
|
||||
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 := ();
|
||||
FOR item IN this_parametername.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);
|
||||
|
||||
else
|
||||
|
||||
FollowupVisitsandTestsListText := " ";
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
// Other Orders
|
||||
|
||||
|
||||
(OtherOrdersList) := read
|
||||
{
|
||||
" SET CONCAT_NULL_YIELDS_NULL off select {{{SINGLE-QUOTE}}}\n{{{SINGLE-QUOTE}}} + o.name + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + REPLACE(REPLACE(REPLACE(o.SummaryLine, CHAR(10), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), CHAR(13), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}), CHAR(9), {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}) "
|
||||
|| " from cv3ordercatalogmasteritem as ocmi with (nolock) "
|
||||
|| " join cv3order as o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid "
|
||||
|| " and o.ClientGUID = " || ClientGuid || " and o.ChartGUID = " || ChartGuid || " and o.ClientVisitGUID= " || VisitGuid || " "
|
||||
|| " and o.InitialSessionTypeCode = {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} and o.name <> {{{SINGLE-QUOTE}}}Discharge{{{SINGLE-QUOTE}}} and o.name <> {{{SINGLE-QUOTE}}}Discharge Follow-Up Visits{{{SINGLE-QUOTE}}} "
|
||||
|| " and o.name not like {{{SINGLE-QUOTE}}}Lab Test%{{{SINGLE-QUOTE}}} and o.name not like {{{SINGLE-QUOTE}}}Lab Test - INR%{{{SINGLE-QUOTE}}} and o.name not like {{{SINGLE-QUOTE}}}Medical Imaging & Other Tests%{{{SINGLE-QUOTE}}} "
|
||||
|| " and o.typecode <> {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} "
|
||||
|| " and o.OrderStatusLevelNum > 15 and o.OrderStatusLevelNum not in (69, 70) "
|
||||
};
|
||||
|
||||
if exists OtherOrdersList
|
||||
|
||||
then
|
||||
//
|
||||
|
||||
// Determine if the Orders have overflowed the first textbox (>2000)
|
||||
|
||||
for i in 1 seqto count OtherOrdersList do
|
||||
if i = 1
|
||||
then OtherOrders:= OtherOrdersList [i];
|
||||
else OtherOrders:= OtherOrders || "\n ___________________________" || OtherOrdersList [i];
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
if length OtherOrders <= 1900
|
||||
then
|
||||
OtherOrders1Text := (substring 1900 characters starting at 1 from OtherOrders);
|
||||
OtherOrders2Text := " ";
|
||||
else
|
||||
OtherOrders1Text := (substring 1900 characters starting at 1 from OtherOrders);
|
||||
OtherOrders2Text := (substring 2000 characters starting at 1901 from OtherOrders);
|
||||
endif;
|
||||
|
||||
|
||||
else
|
||||
|
||||
OtherOrders1Text := " ";
|
||||
OtherOrders2Text := " ";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
// POPULATE THE FIELDS WITH THE DATA
|
||||
|
||||
|
||||
|
||||
// Populate the Rehab Goals field (OT PT Discharge)
|
||||
|
||||
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Plan of Care Goals");
|
||||
this_currentObj := NEW ObservationType;
|
||||
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
||||
this_currentObj.DataType := "FreeTextValue";
|
||||
this_currentObj.ValueObj := New FreeTextValueType;
|
||||
this_currentObj.ValueObj.Value := RehabGoalstDataText;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
||||
|
||||
|
||||
// Populate the Followup Visits and Tests field
|
||||
|
||||
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Plan of Care Instructs");
|
||||
this_currentObj := NEW ObservationType;
|
||||
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
||||
this_currentObj.DataType := "FreeTextValue";
|
||||
this_currentObj.ValueObj := New FreeTextValueType;
|
||||
this_currentObj.ValueObj.Value := FollowupVisitsandTestsListText;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
||||
|
||||
|
||||
// Populate the Other Orders field
|
||||
|
||||
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Hosp DC Instructions 1");
|
||||
this_currentObj := NEW ObservationType;
|
||||
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
||||
this_currentObj.DataType := "FreeTextValue";
|
||||
this_currentObj.ValueObj := New FreeTextValueType;
|
||||
this_currentObj.ValueObj.Value := OtherOrders1Text;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
||||
|
||||
|
||||
// Populate the Other Orders #2 field
|
||||
|
||||
this_parametername := first of (thisParameters where thisParameters.Name = "CXD Hosp DC Instructions 2");
|
||||
this_currentObj := NEW ObservationType;
|
||||
this_currentObj.ClientDocumentGUID:= thisStructuredNoteDoc.ClientDocumentGUID;
|
||||
this_currentObj.ParameterGUID := this_parametername.ParameterGUID;
|
||||
this_currentObj.DataType := "FreeTextValue";
|
||||
this_currentObj.ValueObj := New FreeTextValueType;
|
||||
this_currentObj.ValueObj.Value := OtherOrders2Text;
|
||||
thisStructuredNoteDoc.ChartedObservationsList := (thisstructuredNoteDoc.ChartedObservationsList, this_currentObj);
|
||||
|
||||
|
||||
|
||||
// Print the Discharge Instructions if the button is selected
|
||||
|
||||
|
||||
theParameter := first of (thisparameters where thisparameters.Name = "CXD Transition Care Print");
|
||||
theObservation:= first of (thisobservations where thisobservations.ParameterGUID = theParameter.ParameterGUID);
|
||||
|
||||
if true in (theObservation.ValueObj.ListItemsList.IsSelected where theObservation.ValueObj.ListItemsList.Value = "Print and Send With Patient")
|
||||
then PrintDocument := "yes";
|
||||
else PrintDocument := "no";
|
||||
endif;
|
||||
|
||||
If PrintDocument = "yes"
|
||||
|
||||
then
|
||||
Report_Print_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_PRINT{{{SINGLE-QUOTE}}};
|
||||
reportname := "Discharge Instructions"; logicalprinter := "Default Report Printer"; physicalprinter:= "";
|
||||
print1 := call Report_Print_MLM with(reportname, logicalprinter, physicalprinter);
|
||||
print2 := call Report_Print_MLM with(reportname, logicalprinter, physicalprinter);
|
||||
//BEGIN - [STH] CSR#: 32070
|
||||
DCSummmary_Print_MLM := mlm {{{SINGLE-QUOTE}}}SCH_FUNC_DCSUMMARY_PRINT{{{SINGLE-QUOTE}}};
|
||||
void := CALL DCSummmary_Print_MLM with (clientguid,chartguid,visitguid,"Day of Discharge%",null);
|
||||
//END - [STH] CSR#: 32070
|
||||
endif; // Create a document
|
||||
|
||||
|
||||
endif; // Docuement Closing
|
||||
|
||||
;;
|
||||
evoke:
|
||||
;;
|
||||
logic: conclude true;
|
||||
;;
|
||||
action: return thisDocumentCommunication;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user