276 lines
11 KiB
Plaintext
276 lines
11 KiB
Plaintext
maintenance:
|
|
|
|
title: FORM_SET_MASSIVE_TRANSFUSION;;
|
|
mlmname: FORM_SET_MASSIVE_TRANSFUSION;;
|
|
arden: version 2.5;;
|
|
version: 0.00;;
|
|
institution: St. Clair Hospital;;
|
|
author: Shawn Head, Allscripts Outsourcing;;
|
|
specialist: Maria Pest, Allscripts Outsourcing;;
|
|
date: 2016-09-16;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose:
|
|
CSR#: 34827 - This MLM was developed to assist with properly ordering the necesary blood products in when treating a patient with a massive bleed.
|
|
;;
|
|
explanation:
|
|
9.16.2016 - CSR#: 34827 - STH - Created {Go-Live 11/29/2016}
|
|
10.01.2019 STH - CA Service Desk#: 3905806 - Lab System upgrade introduced a new issue with type and screen result data having a new format of date,time (previously just date).
|
|
Adjusted MLM to addres this.
|
|
;;
|
|
keywords:
|
|
LAB BB RBCs, FFP, CRYO, Platelet, type and screen
|
|
|
|
;;
|
|
citations:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
// This MLM is passed three arguments, of types
|
|
// communication_type, form_type and client info object respectively.
|
|
(this_communication, // Communication object
|
|
this_form, // Form object
|
|
client_info_obj //Arden ClientInfo object
|
|
) := argument;
|
|
// local_session := cds_session.local;
|
|
// check_Unsubmitted_typescreen := local_session.SessionUnSubTypeandScreen;
|
|
|
|
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
|
|
CR := 13 formatted with "%c";
|
|
LF := 10 formatted with "%c";
|
|
CRLF:= CR||LF;
|
|
field_list:= this_form.fields;
|
|
CallingEvent := this_communication.CallingEvent;
|
|
CallingField := this_communication.CallingFieldName;
|
|
|
|
if(Called_By_Editor) then
|
|
ClientGuid := "9000002285800200";
|
|
ChartGuid := "9000004247800170";
|
|
ClientVisitGuid := "9000004247900270";
|
|
else
|
|
ClientGuid := this_communication.ClientGUID;
|
|
ChartGuid := this_communication.ChartGUID;
|
|
ClientVisitGuid := this_communication.ClientVisitGUID;
|
|
endif;
|
|
|
|
(ClientLocation, location_GUID, Visit_Type) := read last { "select CurrentLocation, CurrentLocationGUID, TypeCode "
|
|
|| " from cv3clientvisit with (nolock) "
|
|
|| " where clientguid = " || sql(ClientGUID)
|
|
|| " and chartguid = " || sql(ChartGuid)
|
|
|| " and guid = " || sql(ClientVisitGuid) };
|
|
|
|
|
|
OBPatient_fld := last of (field_list WHERE field_list.DataItemName = "BB Massive Tx OB patient"
|
|
AND field_list.Control_MultiFieldOccNum = 1);
|
|
|
|
OBPatient_fld.Control_Read_Only := true;
|
|
if((trim(ClientLocation) matches pattern "5C-%") or (trim(ClientLocation) matches pattern "FBC-%") or (OBPatient_fld.Value=true)) then
|
|
OB_Patient := true;
|
|
else
|
|
OB_Patient := false;
|
|
endif;
|
|
TypeAndScreen_fld := last of (field_list WHERE field_list.DataItemName = "MultiOrderCheckbox"
|
|
AND field_list.Control_MultiFieldOccNum = 2);
|
|
|
|
|
|
|
|
|
|
MultiOrderGrids := (field_list WHERE field_list.DataItemName = "MultiOrderGrid");
|
|
|
|
MassiveTx_Protocol_Labs := (field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
|
|
AND field_list.Control_MultiFieldOccNum = 1);
|
|
|
|
MassiveTx_TypeScreen := (field_list WHERE field_list.DataItemName = "MultiOrderCheckBox"
|
|
AND field_list.Control_MultiFieldOccNum = 2);
|
|
|
|
|
|
|
|
OS_Entered_Ct_24hours := read last { " select distinct count(os.guid) as {{{SINGLE-QUOTE}}}OS_Entered_Ct{{{SINGLE-QUOTE}}} from CV3OrderSet os with(nolock)
|
|
where os.clientguid = " || sql(ClientGuid)
|
|
|| " and os.ChartGUID = " || sql(ChartGuid)
|
|
|| " and os.ClientVisitGUID = " || sql(ClientVisitGuid)
|
|
|| " and os.OrderSetName = {{{SINGLE-QUOTE}}}Massive Transfusion Protocol{{{SINGLE-QUOTE}}} "
|
|
|| " and os.StartDtm >= dateadd(dd,-1,getdate())
|
|
and os.GUID in (select distinct o.ordersetguid from CV3Order o with (nolock) where os.GUID = o.OrderSetGUID
|
|
and os.ClientGUID = o.ClientGUID
|
|
and os.ChartGUID = o.ChartGUID
|
|
and os.ClientVisitGUID = o.ClientVisitGUID
|
|
and o.StopDtm is null) " };
|
|
|
|
if (CallingEvent = "FormOpen") then
|
|
|
|
|
|
if((OS_Entered_Ct_24hours as number) = 0) then
|
|
|
|
(Sepciemen_Expiration_DTTM) := read { " select cv.clientguid, cv.chartguid, cv.guid, cv.TypeCode
|
|
into #tmp_cv
|
|
from cv3clientvisit cv with (nolock)
|
|
where ((cv.ClientGUID = " || sql(ClientGUID) || "
|
|
and cv.chartguid = " || sql(ChartGuid) || "
|
|
and cv.guid = " || sql(ClientVisitGuid) || ")
|
|
or (cv.ClientGUID = " || sql(ClientGUID) || "
|
|
and cv.TypeCode in ({{{SINGLE-QUOTE}}}Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Admit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SDC{{{SINGLE-QUOTE}}})
|
|
and cv.AdmitDtm > dateadd(dd,-30,getdate())
|
|
))
|
|
|
|
|
|
select
|
|
o.SignificantDtm
|
|
, (case when tol.text is null
|
|
then {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}
|
|
when tol.Text like {{{SINGLE-QUOTE}}}%,%{{{SINGLE-QUOTE}}} then dateadd(hh,7,cast(substring(tol.text,0,charindex({{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}},tol.text,0)) as datetime))
|
|
else dateadd(hh,7,cast(tol.text as datetime))
|
|
end) as {{{SINGLE-QUOTE}}}specimen_expiration_date{{{SINGLE-QUOTE}}}
|
|
,tol.TouchedWhen as {{{SINGLE-QUOTE}}}speciemen_touchedwhen{{{SINGLE-QUOTE}}}
|
|
into #tmp_TF_Spec_Exp
|
|
from #tmp_cv cv with (nolock)
|
|
inner join CV3Order o with (nolock)
|
|
on cv.clientguid = o.clientguid
|
|
and cv.ChartGUID = o.ChartGUID
|
|
and cv.guid = o.ClientVisitGUID
|
|
left outer join CV3BasicObservation bo with (nolock)
|
|
on cv.ClientGUID = bo.ClientGUID
|
|
and cv.ChartGUID = bo.ChartGUID
|
|
and cv.guid = bo.ClientVisitGUID
|
|
and bo.ItemName = {{{SINGLE-QUOTE}}}Specimen Expiration{{{SINGLE-QUOTE}}}
|
|
and bo.OrderGUID = o.GUID
|
|
and bo.IsHistory = 0
|
|
left outer join CV3TextualObservationLine tol with (nolock)
|
|
on bo.ClientGUID = tol.ClientGUID
|
|
and bo.GUID = tol.ObservationGUID
|
|
and tol.Active = 1
|
|
where o.name = {{{SINGLE-QUOTE}}}Type and screen{{{SINGLE-QUOTE}}}
|
|
and o.ClientGUID = " || sql(ClientGUID) || "
|
|
and ((
|
|
(cv.ChartGUID = " || sql(ChartGuid) || "
|
|
and cv.guid = " || sql(ClientVisitGuid) || ")
|
|
or (cv.TypeCode in ({{{SINGLE-QUOTE}}}Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Admit{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Pre Clinic{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}SDC{{{SINGLE-QUOTE}}})
|
|
and o.SignificantDtm >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), -15)
|
|
))
|
|
and ((tol.Text is not null
|
|
and tol.Active = 1)))
|
|
|
|
|
|
select specimen_expiration_date from #tmp_TF_Spec_Exp
|
|
where specimen_expiration_date >= DateAdd(Day, Datediff(Day,0, GetDate() -0), 0)
|
|
drop table #tmp_cv, #tmp_TF_Spec_Exp
|
|
"};
|
|
|
|
if(count(Sepciemen_Expiration_DTTM)>0) then
|
|
TypeAndScreen_fld.Value.IsReadOnly := true;
|
|
TypeAndScreen_fld.Value.Selected := false;
|
|
else
|
|
TypeAndScreen_fld.Value.IsSelected := true;
|
|
TypeAndScreen_fld.Value.IsReadOnly :=true;
|
|
endif;
|
|
MassiveTx_Protocol_Labs.Value.IsSelected := true;
|
|
|
|
if(OB_Patient = false) then
|
|
|
|
|
|
dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with
|
|
"Is this an OB Patient?","Alert", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
|
|
|
abc123 := dlg_result;
|
|
if((dlg_result as string) = "YES") then
|
|
OB_Patient := true;
|
|
OBPatient_fld.Value := true;
|
|
else
|
|
OB_Patient := false;
|
|
OBPatient_fld.Value := false;
|
|
endif;
|
|
else
|
|
OBPatient_fld.Value := true;
|
|
endif;
|
|
else
|
|
MassiveTx_Protocol_Labs.Value.IsSelected := false;
|
|
MassiveTx_TypeScreen.Value.IsSelected := false;
|
|
endif;
|
|
|
|
if((OS_Entered_Ct_24hours as number) in(0,4,8,12,16)) then
|
|
|
|
for x in (1 seqto count(MultiOrderGrids)) do
|
|
if(MultiOrderGrids[x].Control_MultiFieldOccNum = 1) then
|
|
if(OB_Patient) then
|
|
MultiOrderGrids[x].Value.IsSelected := true;
|
|
else
|
|
for y in (1 seqto 2) do
|
|
MultiOrderGrids[x].Value[y].IsSelected := true;
|
|
enddo;
|
|
endif;
|
|
elseif(MultiOrderGrids[x].Control_MultiFieldOccNum = 2) then
|
|
if(OB_Patient) then
|
|
MultiOrderGrids[x].Value.IsSelected := true;
|
|
else
|
|
for y in (1 seqto 8) do
|
|
MultiOrderGrids[x].Value[y].IsSelected := true;
|
|
enddo;
|
|
endif;
|
|
else
|
|
MultiOrderGrids[x].Value.IsSelected := false;
|
|
MultiOrderGrids[x].Value.IsReadOnly := true;
|
|
endif;
|
|
enddo;
|
|
|
|
elseif((OS_Entered_Ct_24hours as number) in (1,5,9,13,17)) then
|
|
for x in (1 seqto count(MultiOrderGrids)) do
|
|
if(MultiOrderGrids[x].Control_MultiFieldOccNum = 3) then
|
|
MultiOrderGrids[x].Value.IsSelected := true;
|
|
elseif(MultiOrderGrids[x].Control_MultiFieldOccNum = 4) then
|
|
MultiOrderGrids[x].Value.IsSelected := true;
|
|
else
|
|
MultiOrderGrids[x].Value.IsSelected := false;
|
|
MultiOrderGrids[x].Value.IsReadOnly := true;
|
|
endif;
|
|
enddo;
|
|
elseif((OS_Entered_Ct_24hours as number) in (2,6,10,14,18)) then
|
|
for x in (1 seqto count(MultiOrderGrids)) do
|
|
if(MultiOrderGrids[x].Control_MultiFieldOccNum = 5) then
|
|
MultiOrderGrids[x].Value.IsSelected := true;
|
|
elseif(MultiOrderGrids[x].Control_MultiFieldOccNum = 6) then
|
|
MultiOrderGrids[x].Value.IsSelected := true;
|
|
else
|
|
MultiOrderGrids[x].Value.IsSelected := false;
|
|
MultiOrderGrids[x].Value.IsReadOnly := true;
|
|
endif;
|
|
enddo;
|
|
elseif((OS_Entered_Ct_24hours as number) in (3,7,11,15,19)) then
|
|
for x in (1 seqto count(MultiOrderGrids)) do
|
|
if(MultiOrderGrids[x].Control_MultiFieldOccNum = 7) then
|
|
MultiOrderGrids[x].Value.IsSelected := true;
|
|
elseif(MultiOrderGrids[x].Control_MultiFieldOccNum = 8) then
|
|
MultiOrderGrids[x].Value.IsSelected := true;
|
|
else
|
|
MultiOrderGrids[x].Value.IsSelected := false;
|
|
MultiOrderGrids[x].Value.IsReadOnly := true;
|
|
endif;
|
|
enddo;
|
|
endif;
|
|
|
|
|
|
|
|
endif;
|
|
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke: // No evoke statement
|
|
;;
|
|
logic:
|
|
conclude true;
|
|
;;
|
|
action:
|
|
return this_communication, this_form;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|