636 lines
28 KiB
Plaintext
636 lines
28 KiB
Plaintext
maintenance:
|
|
|
|
title: FORM_SET_Zosyn_Extended_Infusion;;
|
|
mlmname: FORM_SET_Zosyn_Extended_Infusion;;
|
|
arden: version 2.5;;
|
|
version: 15.1;;
|
|
institution: St Clair Hospital;;
|
|
author: Teresa Spicuzza, Allscripts Corp;;
|
|
specialist: Teresa Spicuzza;;
|
|
date: 2016-09-15;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: To select the appropriate Zosyn maintenace dose based off of the Creatinine Clearance lab result.
|
|
;;
|
|
explanation: The Zosyn loading dose is 4.5gm infused over 30 minutes, then the maintenance dose is infused for 4 hours and scheduled 6 hours after
|
|
the loading dose, if the CrCl is >= 20ml/min. Otherwise the 4 hour infused maintenance dose will be scheduled 8 hours after the loading
|
|
dose, if the CrCl is < 20ml/min
|
|
|
|
Change History
|
|
2017.03.13 TMS CSR# 34822: Placed into production
|
|
;;
|
|
keywords:
|
|
;;
|
|
citations:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
|
|
(this_communication, // Communication object
|
|
this_form, // Form object
|
|
client_info_obj //Arden ClientInfo object
|
|
) := argument;
|
|
|
|
|
|
log_execution_info := FALSE;
|
|
DiscontinueOrder := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_DISCONTINUE_BY_ORDERGUID{{{SINGLE-QUOTE}}};
|
|
|
|
if Called_By_Editor Then
|
|
(ClientVisitGuid, ChartGuid, ClientGuid) := read last {ClientVisit: GUID, ChartGUID, ClientGUID};
|
|
Else
|
|
ClientVisitGuid := this_communication.ClientVisitGUID;
|
|
ChartGuid := this_communication.ChartGUID;
|
|
ClientGuid := this_communication.ClientGUID;
|
|
endif;
|
|
|
|
field_list:= this_form.fields;
|
|
CallingField := this_communication.CallingFieldName;
|
|
CallingEvent := this_communication.CallingEvent;
|
|
|
|
FormName := this_form.Name;
|
|
order_source := primary_Obj.SourceCode;
|
|
CR := 13 formatted with "%c";
|
|
LF := 10 formatted with "%c";
|
|
CRLF:= CR||LF;
|
|
TAB := 9 formatted with "%c";
|
|
|
|
|
|
Override_ABX_Sched := last of (field_list WHERE field_list.DataItemName = "PRX_Override_Abx_Scheduling"
|
|
and field_list.Control_MultiFieldOccNum = 2);
|
|
Override_EXT_Sched := last of (field_list WHERE field_list.DataItemName = "PRX_Generic_CB"
|
|
and field_list.Control_MultiFieldOccNum = 3);
|
|
Zosyn_dosage_info := last of (field_list WHERE field_list.DataItemName = "NUR_GenAdditionalTxt"
|
|
and field_list.Control_MultiFieldOccNum = 1);
|
|
Zosyn_dosage_info.Value := "For CrCl greater than or equal to 20 ml/min: "||Tab|| "Zosyn 3.375 gm IV, Q8H, starting 6 hours after loading dose. Each dose is infused over 4 hours."
|
|
|| CRLF || CRLF
|
|
|| "For CrCl less than 20 ml/min: "||Tab||Tab||Tab|| "Zosyn 3.375 gm IV, Q12H, starting 8 hours after loading dose. Each dose is infused over 4 hours.";
|
|
|
|
Load_Zosyn := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
|
|
and field_list.Control_MultiFieldOccNum = 1);
|
|
Load_Zosyn_List := Load_Zosyn.Value;
|
|
|
|
|
|
Maint_Zosyn := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
|
|
and field_list.Control_MultiFieldOccNum = 2);
|
|
Maint_Zosyn_List := Maint_Zosyn.Value;
|
|
|
|
|
|
Alternate_Zosyn := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
|
|
and field_list.Control_MultiFieldOccNum = 3);
|
|
Alternate_Zosyn_List := Alternate_Zosyn.Value;
|
|
|
|
AltLoad_Zosyn := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid"
|
|
and field_list.Control_MultiFieldOccNum = 4);
|
|
AltLoad_Zosyn_List := AltLoad_Zosyn.Value;
|
|
|
|
|
|
Load_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
|
|
and field_list.Control_MultiFieldOccNum = 3);
|
|
Load_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
|
|
and field_list.Control_MultiFieldOccNum = 3);
|
|
Load_ReqDate_Val := Load_ReqDate.Value;
|
|
Load_ReqTime_Val := Load_ReqTime.Value;
|
|
|
|
|
|
Maint_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
|
|
and field_list.Control_MultiFieldOccNum = 1);
|
|
Maint_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
|
|
and field_list.Control_MultiFieldOccNum = 1);
|
|
Maint_ReqDate_Val := Maint_ReqDate.Value;
|
|
Maint_ReqTime_Val := Maint_ReqTime.Value;
|
|
|
|
AltLoad_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
|
|
and field_list.Control_MultiFieldOccNum = 5);
|
|
AltLoad_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
|
|
and field_list.Control_MultiFieldOccNum = 5);
|
|
AltLoad_ReqDate_Val := AltLoad_ReqDate.Value;
|
|
AltLoad_ReqTime_Val := AltLoad_ReqTime.Value;
|
|
|
|
AltMaint_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
|
|
and field_list.Control_MultiFieldOccNum = 4);
|
|
AltMaint_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
|
|
and field_list.Control_MultiFieldOccNum = 4);
|
|
AltMaint_ReqDate_Val := AltMaint_ReqDate.Value;
|
|
AltMaint_ReqTime_Val := AltMaint_ReqTime.Value;
|
|
|
|
|
|
CrCl_Value := last of ( field_list WHERE field_list.DataItemName = "PRX_CrCL_Estimated"
|
|
and field_list.Control_MultiFieldOccNum = 1);
|
|
|
|
Zosyn_Freq := last of ( field_list WHERE field_list.DataItemName = "FrequencyCode"
|
|
and field_list.Control_MultiFieldOccNum = 1);
|
|
FreqValue := Zosyn_Freq.Value;
|
|
|
|
AltZosyn_Freq := last of ( field_list WHERE field_list.DataItemName = "FrequencyCode"
|
|
and field_list.Control_MultiFieldOccNum = 2);
|
|
AltFreqValue := AltZosyn_Freq.Value;
|
|
|
|
Override:= last of ( field_list WHERE field_list.DataItemName = "PRX_Generic_CB"
|
|
and field_list.Control_MultiFieldOccNum = 2);
|
|
Zosyn_Freq_Dictionary := last of ( field_list WHERE field_list.DataItemName = "PRX_Zosyn_Ext_Inf_Freq"
|
|
and field_list.Control_MultiFieldOccNum = 1);
|
|
NoLoad := false;
|
|
|
|
Creatinine_Clearance := mlm {{{SINGLE-QUOTE}}}FORM_MLM_CREATININE_CLEARANCE{{{SINGLE-QUOTE}}};
|
|
|
|
(this_communication, this_form, EstCrClval) := call Creatinine_Clearance with (this_communication, this_form, client_info_obj);
|
|
|
|
ZOSYNGuid := read last { "select guid from cv3ordercatalogmasteritem where Name = {{{SINGLE-QUOTE}}}Piperacillin/Tazobactam:{{{SINGLE-QUOTE}}}" };
|
|
StdZOSYNGuid := read last { "select guid from cv3ordercatalogmasteritem where Name = {{{SINGLE-QUOTE}}}Piperacillin/Tazobactam;{{{SINGLE-QUOTE}}}" };
|
|
CRRTGuid := read last { "select guid from cv3ordercatalogmasteritem where Name = {{{SINGLE-QUOTE}}}Renal Replacement Treatment Type{{{SINGLE-QUOTE}}}"};
|
|
|
|
CRRT := read last
|
|
{" select summaryline from cv3order where name = {{{SINGLE-QUOTE}}}Renal Replacement Treatment Type{{{SINGLE-QUOTE}}}
|
|
and ClientGUID = " || SQL(clientguid) || " and ClientVisitGUID = " || SQL(clientvisitguid) || "
|
|
and orderstatuscode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} "};
|
|
|
|
Maint_ReqTime.Control_Read_Only := true;
|
|
Maint_ReqDate.Control_Read_Only := true;
|
|
Load_ReqTime.Control_Read_Only := true;
|
|
Load_ReqDate.Control_Read_Only := true;
|
|
Zosyn_Freq.Control_Read_Only := true;
|
|
Zosyn_Freq_Dictionary.Control_Read_Only := true;
|
|
|
|
If CallingEvent = "FormOpen" then
|
|
Alternate_Zosyn_List.IsReadOnly:= True;
|
|
AltLoad_Zosyn_List.IsReadOnly:= True;
|
|
endif;
|
|
|
|
If CallingEvent = "Fieldchange" AND CallingField = "PRX_Generic_CB|3" THEN
|
|
IF Override_EXT_Sched.value = True then
|
|
Maint_Zosyn_List.IsSelected := False;
|
|
Alternate_Zosyn_List.IsSelected := True;
|
|
Load_Zosyn_List.IsSelected := False;
|
|
Load_Zosyn_List.IsReadOnly:= True;
|
|
Maint_Zosyn_List.IsReadOnly:= True;
|
|
Alternate_Zosyn_List.IsReadOnly:= False;
|
|
AltLoad_Zosyn_List.IsReadOnly:= False;
|
|
else
|
|
Maint_Zosyn_List.IsSelected := True;
|
|
Alternate_Zosyn_List.IsSelected := False;
|
|
AltLoad_Zosyn_List.IsSelected := False;
|
|
Alternate_Zosyn_List.IsReadOnly:= True;
|
|
AltLoad_Zosyn_List.IsReadOnly:= True;
|
|
Load_Zosyn_List.IsReadOnly:= False;
|
|
Maint_Zosyn_List.IsReadOnly:= False;
|
|
endif;
|
|
endif;
|
|
|
|
If CallingEvent = "Fieldchange" AND (CallingField = "MultiOrderGrid|4" or CallingField = "FrequencyCode|2" or CallingField = "RequestedTime|5") THEN
|
|
|
|
(FrequencyInterval,FrequencyTimeUOM) := read last
|
|
{
|
|
" select timefromvalue,TimeUom from CV3Frequency with (nolock) "
|
|
|| " where code = {{{SINGLE-QUOTE}}}" || AltFreqValue.FrequencySummary || "{{{SINGLE-QUOTE}}}"
|
|
};
|
|
|
|
If AltLoad_Zosyn_List.IsSelected [1] = True then
|
|
|
|
Override_ABX_Sched.value := True;
|
|
AltMaint_ReqDate.value := null;
|
|
AltMaint_ReqTime_Val.ReqTimeCode := null;
|
|
AltMaint_ReqTime_Val.ReqTimeValue := null;
|
|
|
|
elseif AltLoad_Zosyn_List.IsSelected [1] = False then
|
|
|
|
AltLoad_ReqDate.value := null;
|
|
AltLoad_ReqTime_Val.ReqTimeCode := null;
|
|
AltLoad_ReqTime_Val.ReqTimeValue := null;
|
|
Override_ABX_Sched.value := False;
|
|
endif;
|
|
|
|
If CallingField = "RequestedTime|5" and AltMaint_ReqTime_Val.ReqTimeValue is not null THEN
|
|
newaltmm := extract month AltLoad_ReqDate.Value ;
|
|
newaltdd := extract day AltLoad_ReqDate.Value ;
|
|
newaltyyyy := extract year AltLoad_ReqDate.Value ;
|
|
FmtAltLoadDate := newaltmm formatted with "%2.2d"||"-" ||newaltdd formatted with "%2.2d" ||"-" ||newaltyyyy ||" " ||AltLoad_ReqTime_Val.ReqTimeValue||":00" ;
|
|
AltLoadDoseDTM := FmtAltLoadDate as time;
|
|
AltStartDTM := FmtLoadDate as time;
|
|
else
|
|
AltStartDTM := now ;
|
|
AltStartMin := extract minute now;
|
|
|
|
If (AltStartMin as number) >= 45 then
|
|
AltLoadDoseDTM := AltStartDTM + 2 hour;
|
|
else AltLoadDoseDTM := AltStartDTM + 1 hour;
|
|
endif;
|
|
endif;
|
|
|
|
AltMaintDose := (AltLoadDoseDTM as time) + FrequencyInterval hour;
|
|
Altloadhour := extract hour AltLoadDoseDTM;
|
|
Altloadmon := extract month AltLoadDoseDTM;
|
|
Altloadday := extract day AltLoadDoseDTM;
|
|
Altloadyear := extract year AltLoadDoseDTM;
|
|
|
|
AltMainthour := extract hour AltMaintDose;
|
|
AltMaintmon := extract month AltMaintDose;
|
|
AltMaintday := extract day AltMaintDose;
|
|
AltMaintyear := extract year AltMaintDose;
|
|
|
|
|
|
AltFmtLoadTime := Altloadhour formatted with "%2.2d" || ":00";
|
|
AltFmtLoadDate := Altloadmon formatted with "%2.2d"||"-" ||Altloadday formatted with "%2.2d" ||"-" ||Altloadyear ;
|
|
|
|
AltFmtMaintTime := AltMainthour formatted with "%2.2d" || ":00";
|
|
AltFmtMaintDate := AltMaintmon formatted with "%2.2d"||"-" ||AltMaintday formatted with "%2.2d" ||"-" ||AltMaintyear ;
|
|
|
|
If Override_ABX_Sched.value = True then
|
|
|
|
AltLoad_ReqDate.value := AltFmtLoadDate;
|
|
AltLoad_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
AltLoad_ReqTime_Val.ReqTimeValue := AltFmtLoadTime;
|
|
AltMaint_ReqDate.value := AltFmtMaintDate;
|
|
AltMaint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
AltMaint_ReqTime_Val.ReqTimeValue := AltFmtMaintTime;
|
|
Endif;
|
|
endif;
|
|
|
|
If override.value = true then
|
|
|
|
// Maint_ReqTime.Control_Read_Only := false;
|
|
// Maint_ReqDate.Control_Read_Only := false;
|
|
// Load_ReqTime.Control_Read_Only := false;
|
|
// Load_ReqDate.Control_Read_Only := false;
|
|
Zosyn_Freq.Control_Read_Only := false;
|
|
Zosyn_Freq_Dictionary.Control_Read_Only := false;
|
|
|
|
endif;
|
|
|
|
If CallingEvent = "Fieldchange" and CallingField = "RequestedTime|3" and override.value = true then
|
|
newmm := extract month Load_ReqDate.Value ;
|
|
newdd := extract day Load_ReqDate.Value ;
|
|
newyyyy := extract year Load_ReqDate.Value ;
|
|
FmtLoadDate := newmm formatted with "%2.2d"||"-" ||newdd formatted with "%2.2d" ||"-" ||newyyyy ||" " ||Load_ReqTime_Val.ReqTimeValue||":00" ;
|
|
LoadDoseDTM := fmtLoadDate as time;
|
|
StartDTM := FmtLoadDate as time;
|
|
MaintDose6HR := (FmtLoadDate as time) + 6 hour;
|
|
MaintDose8HR := (FmtLoadDate as time) + 8 hour;
|
|
|
|
loadhour := extract hour LoadDoseDTM;
|
|
loadmon := extract month LoadDoseDTM;
|
|
loadday := extract day LoadDoseDTM;
|
|
loadyear := extract year LoadDoseDTM;
|
|
|
|
due6hour := extract hour MaintDose6HR;
|
|
due6mon := extract month MaintDose6HR;
|
|
due6day := extract day MaintDose6HR;
|
|
due6year := extract year MaintDose6HR;
|
|
|
|
due8hour := extract hour MaintDose8HR;
|
|
due8mon := extract month MaintDose8HR;
|
|
due8day := extract day MaintDose8HR;
|
|
due8year := extract year MaintDose8HR;
|
|
|
|
FmtLoadTime := loadhour formatted with "%2.2d" || ":00";
|
|
FmtLoadDate := loadmon formatted with "%2.2d"||"-" ||loadday formatted with "%2.2d" ||"-" ||loadyear ;
|
|
Fmt6HRTime := due6hour formatted with "%2.2d" || ":00";
|
|
Fmt6HRDate := due6mon formatted with "%2.2d"||"-" ||due6day formatted with "%2.2d" ||"-" ||due6year ;
|
|
Fmt8HRTime := due8hour formatted with "%2.2d" || ":00";
|
|
Fmt8HRDate := due8mon formatted with "%2.2d"||"-" ||due8day formatted with "%2.2d" ||"-" ||due8year ;
|
|
|
|
If Zosyn_Freq_Dictionary.Value = "Q8H" then
|
|
|
|
FreqValue.FrequencySummary := "Q8H";
|
|
Maint_ReqDate.value := Fmt6HRDate;
|
|
Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
Maint_ReqTime_Val.ReqTimeValue := Fmt6HRTime;
|
|
elseif Zosyn_Freq_Dictionary.value = "Q12H" then
|
|
FreqValue.FrequencySummary := "Q12H";
|
|
Maint_ReqDate.value := Fmt8HRDate;
|
|
Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
Maint_ReqTime_Val.ReqTimeValue := Fmt8HRTime;
|
|
|
|
endif;
|
|
endif;
|
|
|
|
IF Override_EXT_Sched.value = False or (CallingEvent = "Fieldchange" and CallingField = "PRX_Zosyn_Ext_Inf_Freq|1") THEN
|
|
|
|
LoadOrderDose, LoadOrderGuid, LoadSigDtm, LoadStopDtm, LoadOrderStatus:= read
|
|
{ " select me.dosagelow, o.guid, o.SignificantDtm, o.stopdtm, o.orderstatuscode from cv3order o
|
|
join cv3clientvisit cv on cv.guid = o.ClientVisitGUID and cv.ClientGUID = o.ClientGUID
|
|
join CV3MedicationExtension me on me.guid = o.guid
|
|
where o.ClientVisitGUID = " || SQL(clientvisitguid) || "
|
|
and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
|
|
and o.orderstatuscode in ({{{SINGLE-QUOTE}}}COMP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}})
|
|
and (me.dosagelow = {{{SINGLE-QUOTE}}}4.5{{{SINGLE-QUOTE}}} or me.dosagelow = {{{SINGLE-QUOTE}}}3.375{{{SINGLE-QUOTE}}})
|
|
and ( (o.OrderCatalogMasterItemGUID = " || zosynguid || " and o.frequencycode in ({{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}PRE OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}POST OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Pre-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Post-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Today{{{SINGLE-QUOTE}}}))
|
|
or
|
|
(o.OrderCatalogMasterItemGUID = " || stdzosynguid || " and o.frequencycode in ({{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}PRE OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}POST OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Pre-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Post-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Today{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Q6H{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Q8H{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Q12H{{{SINGLE-QUOTE}}})) )
|
|
order by o.orderstatuscode, o.SignificantDtm asc"};
|
|
|
|
|
|
MaintOrderDose, MaintOrderGuid := read
|
|
{ " select me.dosagelow, o.guid from cv3order o
|
|
join CV3MedicationExtension me on me.guid = o.guid
|
|
where ClientVisitGUID = " || SQL(clientvisitguid) || "
|
|
and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and o.OrderCatalogMasterItemGUID = " || ZosynGuid || " and o.frequencycode not in ({{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}PRE OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}POST OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Pre-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Post-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Today{{{SINGLE-QUOTE}}})
|
|
and o.orderstatuscode in ({{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}})
|
|
order by o.CreatedWhen asc"};
|
|
|
|
numorders := count LoadOrderDose;
|
|
LoadOrderList := 1 seqto numorders;
|
|
NumberMaintOrders := count MaintOrderDose;
|
|
MaintOrderList := 1 seqto NumberMaintOrders;
|
|
|
|
if NumberMaintOrders = 1 then
|
|
MaintOrderGuid := MaintOrderGuid [1];
|
|
endif;
|
|
|
|
if NumberMaintOrders > 0 then
|
|
|
|
(MaintOrderLastGiven, MaintOrderHoursSinceGiven, MaintNextScheduled, MaintTaskStatus) := read
|
|
{" select oto.performedfromdtm, DATEDIFF (HH, oto.performedfromdtm, getdate()), DATEDIFF (HH, oto.ScheduledDtm, getdate()),
|
|
oto.TaskStatusCode
|
|
from cv3ordercatalogmasteritem ocmi with (nolock)
|
|
join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid
|
|
and o.ClientGUID = " || SQL(clientguid) || "
|
|
and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.guid = " || ZosynGuid || "
|
|
join cv3ordertask ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid
|
|
join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid
|
|
and oto.ordertaskguid = ot.guid
|
|
and o.guid in (" ||MaintOrderGuid || ")
|
|
and oto.ScheduledDtm > DATEadd (HH, -14, getdate()) and oto.ScheduledDtm < DATEadd (HH, 12, getdate())
|
|
and oto.TaskStatusCode <> {{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}}
|
|
order by oto.taskstatuscode, oto.performedfromdtm, oto.ScheduledDtm desc" };
|
|
endif;
|
|
|
|
for i in 1 seqto (count MaintTaskStatus)do
|
|
if MaintTaskStatus [i] = "Overdue" then
|
|
Overduetime := MaintNextScheduled [i];
|
|
elseif MaintTaskStatus [i] = "Pending" then
|
|
Nextduetime := MaintNextScheduled [i];
|
|
elseif MaintTaskStatus [i] = "Performed" then
|
|
HoursSinceGiven := MaintOrderHoursSinceGiven [i];
|
|
LastGivenTime := MaintOrderlastGiven [i];
|
|
endif;
|
|
enddo;
|
|
|
|
|
|
if numorders = 1 then
|
|
LoadOrderGuid := LoadOrderGuid [1];
|
|
endif;
|
|
|
|
if numorders > 0 then
|
|
|
|
(LoadOrderLastGiven, LoadOrderHoursSinceGiven,
|
|
ExistingSchedule, LoadTaskStatus, LoadFrequency) := read last
|
|
{
|
|
" select top 1 oto.performedfromdtm, DATEDIFF (HH, oto.performedfromdtm, getdate()),
|
|
oto.ScheduledDtm, oto.TaskStatusCode,o.FrequencyCode
|
|
from cv3ordercatalogmasteritem ocmi
|
|
join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid
|
|
and o.ClientGUID = " || SQL(clientguid) || " and o.clientvisitguid = " || SQL(clientvisitguid) || "
|
|
join cv3ordertask ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid
|
|
join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid
|
|
where o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and (ocmi.guid = " ||ZosynGuid || " or ocmi.guid = " || StdZosynGuid || ")
|
|
and oto.ordertaskguid = ot.guid
|
|
and o.guid in (" || LoadOrderGuid || ")
|
|
and oto.SignificantDtm > DATEadd (HH, -8, getdate())
|
|
and oto.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}}
|
|
order by oto.performedfromdtm desc"
|
|
};
|
|
|
|
(LoadOrderHoursSinceScheduled, ExistingSchedule, LoadTaskStatus, LoadGuid) := read last
|
|
{
|
|
" select top 1 DATEDIFF (HH, oto.ScheduledDtm, getdate()) Timespan, oto.ScheduledDtm, oto.TaskStatusCode, o.guid
|
|
from cv3ordercatalogmasteritem ocmi with (nolock)
|
|
join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid
|
|
and o.ClientGUID = " || SQL(clientguid) || " and o.ClientVisitGUID = " || SQL(clientvisitguid) || "
|
|
join cv3ordertask ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid
|
|
join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid
|
|
where o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.guid = " || ZosynGuid || "
|
|
and oto.ordertaskguid = ot.guid
|
|
and o.guid in (" ||LoadOrderGuid || ")
|
|
and oto.SignificantDtm > DATEadd (HH, -12, getdate()) and oto.SignificantDtm < DATEadd (HH, 1, getdate())
|
|
and oto.TaskStatusCode in ({{{SINGLE-QUOTE}}}Pending{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Overdue{{{SINGLE-QUOTE}}})
|
|
order by oto.ScheduledDtm desc"
|
|
};
|
|
|
|
endif;
|
|
|
|
if LoadOrderLastGiven is not null then
|
|
Load_Zosyn_List.IsSelected := False;
|
|
Maint_Zosyn_List.IsSelected := true;
|
|
|
|
if (LoadOrderHoursSinceGiven > 6 and (EstCrClval is null or EstCrClval >=20) and override.value = false)
|
|
or (LoadOrderHoursSinceGiven > 8 and EstCrClval < 20 and override.value = false)
|
|
or (LoadOrderHoursSinceGiven > 6 and Override.value = true and Zosyn_Freq_Dictionary.value = "Q8H" )
|
|
or (LoadOrderHoursSinceGiven > 8 and Override.value = true and Zosyn_Freq_Dictionary.value = "Q12H" ) then
|
|
|
|
StartDTM := now ;
|
|
StartMin := extract minute now;
|
|
Load_Zosyn_List.IsSelected := True;
|
|
|
|
If (StartMin as number) >= 45 then
|
|
LoadDoseDTM := StartDTM + 2 hour;
|
|
else LoadDoseDTM := StartDTM + 1 hour;
|
|
endif;
|
|
|
|
else
|
|
|
|
startdtm := LoadOrderLastGiven ;
|
|
startmin := extract minute LoadOrderLastGiven;
|
|
If (StartMin as number) >= 45 then
|
|
LoadDoseDTM := StartDTM + 1 hour;
|
|
Else LoadDoseDTM := StartDTM ;
|
|
Endif;
|
|
endif;
|
|
|
|
|
|
elseif ExistingSchedule is not null then
|
|
|
|
If LoadOrderHoursSinceScheduled <= 2 then
|
|
Load_Zosyn_List.IsSelected := False;
|
|
Maint_Zosyn_List.IsSelected := True;
|
|
StartDTM := ExistingSchedule;
|
|
StartMin := extract minute ExistingSchedule;
|
|
|
|
If (StartMin as number) >= 45 then
|
|
LoadDoseDTM := StartDTM + 1 hour;
|
|
else LoadDoseDTM := StartDTM;
|
|
endif;
|
|
|
|
else
|
|
|
|
MLMMessage := "This is where we discontinue old order";
|
|
Reason := "Change Administration Times";
|
|
Source := "CPOE Clarification";
|
|
|
|
dc_call := call DiscontinueOrder with
|
|
LoadGuid,
|
|
this_communication.CareProviderGUID,
|
|
ClientVisitGUID,
|
|
Reason,
|
|
Source;
|
|
|
|
StartDTM := now ;
|
|
StartMin := extract minute now;
|
|
Load_Zosyn_List.IsSelected := True;
|
|
Maint_Zosyn_List.IsSelected := True;
|
|
|
|
If (StartMin as number) >= 45 then
|
|
LoadDoseDTM := StartDTM + 2 hour;
|
|
else LoadDoseDTM := StartDTM + 1 hour;
|
|
endif;
|
|
endif;
|
|
|
|
elseif
|
|
|
|
((HoursSinceGiven as number) > 9 and override.value = false and (EstCrClval >= 20 or EstCrClval is null)) or
|
|
((HoursSinceGiven as number) > 13 and override.value = false and EstCrClval < 20) or
|
|
// ((Overduetime as number) >= 2 and HoursSinceGiven is null) or
|
|
((HoursSinceGiven as number) > 9 and Override.value = true and Zosyn_Freq_Dictionary.value = "Q8H" ) or
|
|
((HoursSinceGiven as number) > 13 and Override.value = true and Zosyn_Freq_Dictionary.value = "Q12H" ) then
|
|
|
|
Load_Zosyn_List.IsSelected := True;
|
|
NoLoad := False;
|
|
FmtLoadDate := null;
|
|
FmtLoadTime := null;
|
|
Maint_Zosyn_List.IsSelected := True;
|
|
StartDTM := Now ;
|
|
StartMin := extract minute Now;
|
|
If (StartMin as number) >= 45 then
|
|
LoadDoseDTM := StartDTM + 2 hour;
|
|
else LoadDoseDTM := StartDTM + 1 hour;
|
|
|
|
endif;
|
|
elseif
|
|
|
|
((HoursSinceGiven as number) <= 9 and override.value = false and (EstCrClval >= 20 or EstCrClval is null)) or
|
|
((HoursSinceGiven as number) <= 13 and override.value = false and EstCrClval < 20) or
|
|
// ((Overduetime as number) < 2 ) or
|
|
((HoursSinceGiven as number) <= 9 and override.value = true and Zosyn_Freq_Dictionary.value = "Q8H") or
|
|
((HoursSinceGiven as number) <= 13 and override.value = true and Zosyn_Freq_Dictionary.value = "Q12H") then
|
|
|
|
Load_Zosyn_List.IsSelected := False;
|
|
NoLoad := True;
|
|
Maint_Zosyn_List.IsSelected := True;
|
|
Override_ABX_Sched.value := False;
|
|
StartDTM := LastGivenTime ;
|
|
StartMin := extract minute LastGivenTime;
|
|
If (StartMin as number) >= 45 then
|
|
MaintDoseDTM := StartDTM + 1 hour;
|
|
else MaintDoseDTM := StartDTM ;
|
|
endif;
|
|
|
|
else
|
|
|
|
Load_Zosyn_List.IsSelected := True;
|
|
Maint_Zosyn_List.IsSelected := True;
|
|
StartDTM := now ;
|
|
StartMin := extract minute now;
|
|
If (StartMin as number) >= 45 then
|
|
LoadDoseDTM := StartDTM + 2 hour;
|
|
else LoadDoseDTM := StartDTM + 1 hour;
|
|
endif;
|
|
endif;
|
|
|
|
MaintDose6HR := LoadDoseDTM + 6 hour;
|
|
MaintDose8HR := LoadDoseDTM + 8 hour;
|
|
MaintDoseQ8HR := MaintDoseDTM + 8 hour;
|
|
MaintDoseQ12HR := MaintDoseDTM + 12 hour;
|
|
|
|
loadhour := extract hour LoadDoseDTM;
|
|
loadmon := extract month LoadDoseDTM;
|
|
loadday := extract day LoadDoseDTM;
|
|
loadyear := extract year LoadDoseDTM;
|
|
|
|
due6hour := extract hour MaintDose6HR;
|
|
due6mon := extract month MaintDose6HR;
|
|
due6day := extract day MaintDose6HR;
|
|
due6year := extract year MaintDose6HR;
|
|
|
|
due8hour := extract hour MaintDose8HR;
|
|
due8mon := extract month MaintDose8HR;
|
|
due8day := extract day MaintDose8HR;
|
|
due8year := extract year MaintDose8HR;
|
|
|
|
maint8hour := extract hour MaintDoseQ8HR;
|
|
maint8mon := extract month MaintDoseQ8HR;
|
|
maint8day := extract day MaintDoseQ8HR;
|
|
maint8year := extract year MaintDoseQ8HR;
|
|
|
|
maint12hour := extract hour MaintDoseQ12HR;
|
|
maint12mon := extract month MaintDoseQ12HR;
|
|
maint12day := extract day MaintDoseQ12HR;
|
|
maint12year := extract year MaintDoseQ12HR;
|
|
|
|
|
|
FmtLoadTime := loadhour formatted with "%2.2d" || ":00";
|
|
FmtLoadDate := loadmon formatted with "%2.2d"||"-" ||loadday formatted with "%2.2d" ||"-" ||loadyear ;
|
|
Fmt6HRTime := due6hour formatted with "%2.2d" || ":00";
|
|
Fmt6HRDate := due6mon formatted with "%2.2d"||"-" ||due6day formatted with "%2.2d" ||"-" ||due6year ;
|
|
Fmt8HRTime := due8hour formatted with "%2.2d" || ":00";
|
|
Fmt8HRDate := due8mon formatted with "%2.2d"||"-" ||due8day formatted with "%2.2d" ||"-" ||due8year ;
|
|
FmtQ8HRTime := maint8hour formatted with "%2.2d" || ":00";
|
|
FmtQ8HRDate := maint8mon formatted with "%2.2d"||"-" ||maint8day formatted with "%2.2d" ||"-" ||maint8year ;
|
|
FmtQ12HRTime := maint12hour formatted with "%2.2d" || ":00";
|
|
FmtQ12HRDate := maint12mon formatted with "%2.2d"||"-" ||maint12day formatted with "%2.2d" ||"-" ||maint12year ;
|
|
|
|
if NoLoad = false or noload is null then;
|
|
Load_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
Load_ReqTime_Val.ReqTimeValue := FMTLoadTime;
|
|
Load_ReqDate.value := FmtLoadDate;
|
|
endif;
|
|
|
|
If ((EstCrClval >= 20 or EstCrClval is null or CrCl_value is null or CRRT is not null ) and override.value = false and NoLoad = False) or (override.value = true and Zosyn_Freq_Dictionary.value = "Q8H" and NoLoad = False ) then
|
|
|
|
Maint_ReqDate.value := Fmt6HRDate;
|
|
Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
Maint_ReqTime_Val.ReqTimeValue := Fmt6HRTime;
|
|
FreqValue.FrequencySummary := "Q8H";
|
|
Zosyn_Freq_Dictionary.value := "Q8H";
|
|
|
|
elseif (EstCrClval < 20 and CRRT is null and override.value = false and NoLoad = false) or (override.value = true and Zosyn_Freq_Dictionary.value = "Q12H" and noLoad = false) then
|
|
|
|
Maint_ReqDate.value := Fmt8HRDate;
|
|
Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
Maint_ReqTime_Val.ReqTimeValue := Fmt8HRTime;
|
|
FreqValue.FrequencySummary := "Q12H";
|
|
Zosyn_Freq_Dictionary.value := "Q12H";
|
|
elseIf ((EstCrClval >= 20 or EstCrClval is null or CrCl_value is null or CRRT is not null) and override.value = false and NoLoad = true) or (override.value = true and Zosyn_Freq_Dictionary.value = "Q8H" and NoLoad = true) then
|
|
|
|
Maint_ReqDate.value := FmtQ8HRDate;
|
|
Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
Maint_ReqTime_Val.ReqTimeValue := FmtQ8HRTime;
|
|
FreqValue.FrequencySummary := "Q8H";
|
|
Zosyn_Freq_Dictionary.value := "Q8H";
|
|
|
|
elseif (EstCrClval < 20 and CRRT is null and override.value = false and NoLoad = true) or (override.value = true and Zosyn_Freq_Dictionary.value = "Q12H" and noLoad = true ) then
|
|
|
|
Load_ReqDate.value := null;
|
|
Load_ReqTime_Val.ReqTimeCode := null;
|
|
Load_ReqTime_Val.ReqTimeValue := null;
|
|
|
|
|
|
Maint_ReqDate.value := FmtQ12HRDate;
|
|
Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
|
Maint_ReqTime_Val.ReqTimeValue := FmtQ12HRTime;
|
|
FreqValue.FrequencySummary := "Q12H";
|
|
Zosyn_Freq_Dictionary.value := "Q12H";
|
|
endif;
|
|
|
|
endif;
|
|
|
|
|
|
;;
|
|
|
|
evoke:
|
|
|
|
;;
|
|
logic:
|
|
conclude true;
|
|
;;
|
|
action:
|
|
|
|
|
|
return this_communication, this_form;
|
|
|
|
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|