maintenance: title: DOC_DIET_KBC_ADULT_ASSESSMENT ;; mlmname: DOC_DIET_KBC_ADULT_ASSESSMENT;; arden: version 6.1;; version: 2.50;; institution: St.Clair Hospital;; author: Shivprasad Jadhav ;; specialist: Shivprasad Jadhav, Allscripts Corporation;; date: 2015-09-01;; validation: testing;; library: purpose: 1st senario-When user select criteria i.e {1-Patient consuming <50% of meals x 3days or 2-NPO or clear liquids >3days} from [2."Adult Assessment/Intervention"flowsheet when selecting [Risk assessment/Screenings] observation in "Nutrition Risk Screen" then MLM should creat a Dietitian Consult for the charted observation which has mention. 2nd Senario- If there is an active "Dietitian consult order with this indication i.e{1-Patient consuming <50% of meals x3 days} or {2- NPO or clear liquids >3 days} has present or charted previously and "Dietitian Consult order was created previously then MLM should not create a 2nd order for Dietitian consult . 3rd Senario- If user select othere criteria except given criteria i.e {1-Patient consuming <50% of meals x3 days} or {2- NPO or clear liquids >3 days} then MLM should not creat any "Dietitian Consult Order. ;; explanation: Change history 10-01-2015 SJ CSR 32400 : Created date. 09-28-2016 DJW HD#2113751 - Provide a message box to confirm the choice before automatically creating a Dietitian Consult Order ;; keywords: ;; knowledge: type: data-driven;; data: standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; // Receive arguments from the structured note (this_documentCommunication) := argument; //Get The Flowsheet Name (this_FS_doc) := this_documentCommunication.DocumentConfigurationObj; (this_parms) := this_FS_doc.ParametersList; (this_curr_col) := this_FS_doc.Currentcolumn; (this_currentObs) := this_documentCommunication.CurrentObservationObj; this_observations := this_curr_col.chartedobservationslist; (ClientGuid) := this_documentCommunication.ClientGUID; (ChartGuid) := this_documentCommunication.ChartGUID; (ClientVisitGuid) := this_documentCommunication.ClientVisitGUID; (UserGuid) := this_DocumentCommunication.UserGUID ; LocationGuid := read last {"SELECT CurrentLocationGUID FROM CV3ClientVisit where ClientGUID = " || ClientGuid}; // read First {" Select cv.CurrentLocationGUID from Cv3ClientVisit cv With (nolock) Where cv.guid= "||SQL(ClientVisitGuid) ||" "} ; CatalogItemName := "Dietitian Consult"; prm_med := First of (this_parms where this_parms.Name = "AS nut risk screen"); Obs_med := first of (this_observations where this_observations.ParameterGUID = prm_med.ParameterGUID ); val_med := Obs_med.ValueObj.listitemslist where Obs_med.ValueObj.listitemslist.isselected = true ; /*a:=val_med[1].Value; b:=val_med[2].Value; DataItem1:=val_med[3].Value; DataItem2:=val_med[4].Value; e:=val_med[5].Value; */ indexList := 1 seqto count (val_med); for i in indexList do If val_med[i].Value="patient consuming <50% of meals x 3 days" Then DataItem1 := "patient consuming <50% of meals x 3 days"; Elseif val_med[i].Value="NPO or clear liquids > 3 days" Then DataItem2 := "NPO or clear liquids > 3 days"; Else DataItem1 := Null ; DataItem2 := Null ; Endif; enddo; UserData := Read first { "Select Top 1 o.name " || " from cv3ClientVisit cv (nolock) Join cv3Order o (nolock) " || " On cv.guid =o.ClientVisitGUID And cv.ClientGUID=o.ClientGUID " || " Join cv3OrderUserData ud On ud.OrderGUID=o.GUID And ud.ClientGUID=cv.ClientGUID " || " And ud.UserDataCode in ({{{SINGLE-QUOTE}}}NUTR_Consult Reasons{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}NUTR_Consult Reason 2{{{SINGLE-QUOTE}}}) " || " And o.Name = {{{SINGLE-QUOTE}}}Dietitian Consult{{{SINGLE-QUOTE}}} And o.orderstatuslevelnum < 55 " || " and o.OrderStatusCode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} And o.ClientVisitGUID = " || ClientVisitGuid || " Where ud.Value in ({{{SINGLE-QUOTE}}}Patient consuming <50% of meals x 3 days{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}NPO or Clear Liquids > 3 days{{{SINGLE-QUOTE}}}) "}; If UserData is Null Then If (DataItem1 is Not Null) or ( DataItem2 is Not Null ) Then dlg_result := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n This choice will create a Dietitian Consult {{{SINGLE-QUOTE}}}" || "\n\n Click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to confirm your choice " || "\n\n Click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}} if you wish to change your choice " || "\n " ,"Create a Dietitian Consult Order ? ", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; If (dlg_result as string) = "Yes" then error_destination := destination { IntermediateMessage } with [ alert_type := "Warning", short_message := "Auto Order MLM", priority := "low", scope := "chart", Rule_group := "Auto Order MLM", Rule_number := 1001, Rule_subgroup := "", Send_alert_with_order := "", Alert_dialog_settings := "", Display_alert := true ]; user_IDType := "Edstan Number (physician)"; user_IDCode := read last {"SELECT IDCode FROM CV3CAREPROVIDERID " || " where ProviderGUID = " || UserGUID || " and ProviderIDTypeCode = {{{SINGLE-QUOTE}}}Edstan Number (physician){{{SINGLE-QUOTE}}}"}; order_Creation_Reason := "Order Created Form MLM"; try client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisitGuid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ; WSSessionType := "Standard"; WSSessionReason := ""; WSRequestedBySource := ""; WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, (user_IDCode as STRING) ); WSlocation_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 ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif; if ( WSRequestedBy_obj is NOT NULL ) then void:= call WSRequestedBy_obj.Dispose; WSRequestedBy_obj:= null; endif; if ( WSlocation_obj is NOT NULL ) then void:= call WSlocation_obj.Dispose; WSlocation_obj:= null; endif; endcatch; try // get OrderCatalogMasterItem ObjectsPlus object general_catalog_item := call {{{SINGLE-QUOTE}}}OrderCatalogMasterItem{{{SINGLE-QUOTE}}}.FindByName with CatalogItemName; // Create the prefilled General order GeneralOrder2_obj := call {{{SINGLE-QUOTE}}}GeneralOrder{{{SINGLE-QUOTE}}}.CreateGeneralOrder with client_visit_obj, // ClientVisit ObjectsPlus object general_catalog_item, // OrderCatalogMasterItem ObjectsPlus object order_Creation_Reason, // CreateReason wsRequestedBy_obj, // RequestedBy ObjectsPlus object wsRequestedBySource, // string RequestedBySource (must be in dictionary) wsSessionType, // string SessionType wsSessionReason, // string SessionReason wslocation_obj, // Location ReleaseLocGrpID "Always" as {{{SINGLE-QUOTE}}}AvailabilityOverride{{{SINGLE-QUOTE}}}; // AvailabilityOverride IF (EXISTS DataItem1 AND DataItem1 IS NOT NULL ) or (EXISTS DataItem2 AND DataItem2 IS NOT NULL ) THEN If DataItem1 is not Null Then Val := DataItem1 ; Else Val := DataItem2; Endif; Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "NUTR_Consult Reasons" , Val ; ENDIF; IF (EXISTS DataItem1 AND DataItem1 IS NOT NULL ) And (EXISTS DataItem2 AND DataItem2 IS NOT NULL ) THEN Value := call GeneralOrder2_obj.{{{SINGLE-QUOTE}}}SetEnterpriseDefinedDataItemValue{{{SINGLE-QUOTE}}} with "NUTR_Consult Reason 2" , DataItem2 ; ENDIF; if ( general_catalog_item is NOT NULL ) then void:= call general_catalog_item.Dispose; general_catalog_item:= null; endif; //GeneralOrder2_dest.ObjectsPlus := GeneralOrder2_obj; empty := Call GeneralOrder2_obj.save; endtry; catch Exception ex error_occurred := true; error_message := error_message || "{{+R}}New general order:{{-R}}\n" || ex.Message || "\n\n"; if ( general_catalog_item is NOT NULL ) then void:= call general_catalog_item.Dispose; general_catalog_item:= null; endif; if ( GeneralOrder2_obj is NOT NULL ) then void:= call GeneralOrder2_obj.Dispose; GeneralOrder2_obj:= null; endif; endcatch; if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif; if ( WSRequestedBy_obj is NOT NULL ) then void:= call WSRequestedBy_obj.Dispose; WSRequestedBy_obj:= null; endif; if ( WSlocation_obj is NOT NULL ) then void:= call WSlocation_obj.Dispose; WSlocation_obj:= null; endif; endif; // Proceed with the consult order? Endif; Endif; ;; evoke: ;; logic: conclude true; ;; action: return this_documentCommunication; ;; Urgency: 50;; end: