209 lines
7.8 KiB
Plaintext
209 lines
7.8 KiB
Plaintext
maintenance:
|
|
|
|
title: SCH_CREATE_MEDICARE44;;
|
|
mlmname: SCH_CREATE_MEDICARE44;;
|
|
arden: version 2.5;;
|
|
version: 0.00;;
|
|
institution: St. Clair Hospital ;;
|
|
author: Shawn Head, Allscripts/St. Clair Hospital x7468;;
|
|
specialist: Peggy Karish, Allscripts/St. Clair Hospital ;;
|
|
date: 2017-05-26;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Automatically create a duplicate Code 44 order to be sent to Physician Advison
|
|
;;
|
|
explanation: When patients are being changed to a Medicare Code status of 44 Medidare requires 2 signoff{{{SINGLE-QUOTE}}}s (Physician advisor and attending physician).
|
|
|
|
***********************CHANGE HISTORY************************
|
|
05-27-2017 - STH - CSR#: 32795 - created
|
|
|
|
*************************************************************
|
|
|
|
;;
|
|
keywords: Create Order, Medicare, Status 44
|
|
;;
|
|
citations:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
/*------------------------------BEGIN USER EDIT SECTION------------------------------*/
|
|
|
|
|
|
(UpdateStringFields) := ("NUR_GenAdditionalTxt","CM_Rationale");
|
|
(UpdateDateFields) := ("CM_ Communcation Date");
|
|
(UpdateCheckBoxFields) := ("CM_Observation CB");
|
|
|
|
|
|
/*------------------------------END USER EDIT SECTION------------------------------*/
|
|
|
|
log_execution_info:= FALSE;
|
|
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
using "ObjectsPlusXA.SCM.Forms";
|
|
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
|
|
|
on_order_enter := event {OrderWorksheetSubmit User } ;
|
|
from_order_name := "Code 44 - Attending";
|
|
CreateCode44Order := false;
|
|
UnSub_Code44_Attending_order := read last { UNSUBMITTED Order: Name where name = "Code 44 - Physician Advisor" };
|
|
if(UnSub_Code44_Attending_order is null) then
|
|
userguid,user_id :=read last {UserInfo: guid,idcode};
|
|
(ReadUnSub_Code44_AdvisorUD, CP_GUID, OrderName, sessiontype, requesteddate, requestedtime) := read last { UNSUBMITTED Order: OrderUserData , careproviderguid , name , InitialSessionTypeCode, RequestedDate, RequestedTime where name = "Code 44 - Attending"};
|
|
if(count(ReadUnSub_Code44_AdvisorUD) > 0) then
|
|
(clientGUID, chartGUID, ClientVisitGUID, LocationGUID) := read last { ClientVisit: ClientGUID, ChartGUID, GUID, CurrentLocationGUID };
|
|
(Code44_Advisor) := read last { " select guid from cv3order o with (nolock)
|
|
where o.ClientGUID = " || sql(ClientGUID)
|
|
|| " and o.chartguid = " || sql(chartGUID)
|
|
|| " and o.clientvisitguid = " || sql(ClientVisitGUID)
|
|
|| " and o.name = ({{{SINGLE-QUOTE}}}Code 44 - Physician Advisor{{{SINGLE-QUOTE}}})
|
|
and o.orderstatuscode not in ({{{SINGLE-QUOTE}}}CANC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CAND{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CANT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCD{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCR{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISCT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}HISDP{{{SINGLE-QUOTE}}}) " };
|
|
if(Code44_Advisor is null) then
|
|
(userdatacode, value ) := read { OrderUserData: UserDataCode, Value REFERENCING ReadUnSub_Code44_AdvisorUD } ;
|
|
CreateCode44Order := true;
|
|
endif;
|
|
endif;
|
|
endif;
|
|
|
|
if(CreateCode44Order) then
|
|
|
|
try
|
|
CV_Obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
|
with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
|
|
|
WSSessionType := trim(sessiontype[1]);
|
|
if(sessiontype[1] = "Hold") then
|
|
WSSessionReason := "Hold Orders";
|
|
else
|
|
WSSessionReason := "";
|
|
endif;
|
|
|
|
|
|
//This will find the care provider GUID for the "Physician Advisor" user to be used for the auto creatd order.
|
|
CP_GUID := read last { " select cp.GUID from CV3CareProvider cp with (nolock)
|
|
inner join cv3user u with (nolock)
|
|
on cp.guid = u.GUID
|
|
and u.IDCode = {{{SINGLE-QUOTE}}}zzzpacm{{{SINGLE-QUOTE}}} " };
|
|
|
|
RequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
|
with ((CP_GUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
|
|
|
location_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey
|
|
with ((LocationGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}});
|
|
|
|
endtry;
|
|
catch Exception ex
|
|
error_occurred := true;
|
|
error_message := "{{+R}}Common Data:{{-R}}\n" ||
|
|
ex.Message || "\n\n";
|
|
|
|
if ( CV_Obj is NOT NULL ) then
|
|
void:= call CV_Obj.Dispose;
|
|
CV_Obj:= null;
|
|
endif;
|
|
|
|
if ( RequestedBy_obj is NOT NULL ) then
|
|
void:= call RequestedBy_obj.Dispose;
|
|
RequestedBy_obj:= null;
|
|
endif;
|
|
|
|
if ( location_obj is NOT NULL ) then
|
|
void:= call location_obj.Dispose;
|
|
location_obj:= null;
|
|
endif;
|
|
|
|
endcatch;
|
|
|
|
|
|
try
|
|
|
|
Catalog_Item_Name := "Code 44 - Physician Advisor";
|
|
order_type := "other";
|
|
modifier := "";
|
|
modversion := "";
|
|
WSRequestedBySource := "Protocol Order";
|
|
order_Creation_Reason := from_order_name || " order.";
|
|
|
|
|
|
order_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName
|
|
with Catalog_Item_Name;
|
|
|
|
GeneralOrder_Obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder
|
|
with CV_Obj,
|
|
order_catalog_item,
|
|
order_Creation_Reason,
|
|
RequestedBy_obj,
|
|
WSRequestedBySource,
|
|
WSSessionType,
|
|
WSSessionReason,
|
|
location_obj,
|
|
"Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}};
|
|
test2 := (extract year requesteddate) formatted with "%04d" || "-" ||
|
|
(extract month requesteddate) formatted with "%02d" || "-" ||
|
|
(extract day requesteddate) formatted with "%02d";
|
|
|
|
GeneralOrder_obj.RequestedTime := requestedtime;
|
|
|
|
RequestedDate := (RequestedDate as time);
|
|
ModReqDate := (extract year RequestedDate) formatted with "%04d" || "-" ||
|
|
(extract month RequestedDate) formatted with "%02d" || "-" ||
|
|
(extract day RequestedDate) formatted with "%02d";
|
|
ModReqDate := ModReqDate as string;
|
|
|
|
|
|
GeneralOrder_obj.RequestedDate := ModReqDate;
|
|
|
|
|
|
for x in (1 seqto(count(userdatacode))) do
|
|
ud1 := userdatacode[x];
|
|
v1 := value[x];
|
|
if(userdatacode[x] in (UpdateStringFields)) then
|
|
retval := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<String>{{{SINGLE-QUOTE}}} with
|
|
userdatacode[x], value[x] ;
|
|
endif;
|
|
if(userdatacode[x] in (UpdateDateFields)) then
|
|
PatientCommunicationDate := ((value[x] as time) as {{{SINGLE-QUOTE}}}System.DateTime{{{SINGLE-QUOTE}}});
|
|
val6 := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Nullable<DateTime>>{{{SINGLE-QUOTE}}} with
|
|
userdatacode[x],PatientCommunicationDate ;
|
|
endif;
|
|
if(userdatacode[x] in (UpdateCheckBoxFields)) then
|
|
AttendingOrdObsCB := (value[x] as {{{SINGLE-QUOTE}}}Boolean{{{SINGLE-QUOTE}}});
|
|
retval := call GeneralOrder_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue<Boolean>{{{SINGLE-QUOTE}}} with
|
|
userdatacode[x], AttendingOrdObsCB;
|
|
endif;
|
|
enddo;
|
|
|
|
if( GeneralOrder_obj is NOT NULL ) then
|
|
void := call GeneralOrder_Obj.Save;
|
|
void := call GeneralOrder_Obj.Dispose;
|
|
endif;
|
|
endtry;
|
|
catch Exception ex
|
|
error_occurred := true;
|
|
error_message := "{{+R}}New General order:{{-R}}\n" ||
|
|
ex.Message || "\n\n";
|
|
endcatch;
|
|
|
|
if ( Order_catalog_item is NOT NULL ) then
|
|
void:= call Order_catalog_item.Dispose;
|
|
Order_catalog_item:= null;
|
|
endif;
|
|
|
|
endif;
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:
|
|
on_order_enter;
|
|
;;
|
|
logic:
|
|
;;
|
|
action:
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|