178 lines
7.2 KiB
Plaintext
178 lines
7.2 KiB
Plaintext
maintenance:
|
|
|
|
title: SCH_Result_Received_Significant_Event ;;
|
|
mlmname: SCH_Result_Received_Significant_Event ;;
|
|
arden: version 2.5;;
|
|
version: 6.10;;
|
|
institution: St. Clair Hospital ;;
|
|
author: Shivprasad Jadhav;;
|
|
specialist: Shivprasad Jadhav, GOS ;;
|
|
date: 2015-06-24;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: When order “Transfusion Reaction Evaluation.” is placed and resulted then MLM should get trigger and update the patients Significant Event.
|
|
;;
|
|
explanation:
|
|
Change History
|
|
-----------------
|
|
08.07.2015 GOS CSR# 32787 : Created
|
|
18.02.2016 GOS Made changes in MLM for Significant event when Result Received or Modified.
|
|
|
|
;;
|
|
keywords:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
|
|
BL_Observation_Enter := Event {ObservationEnter Any Observation: where ItemName in ("Transfusion Reaction Report")};
|
|
//BL_Observation_Enter := Event {OrderEnter User Order: where Name in ("Transfusion Reaction Report")};
|
|
|
|
If Called_By_Editor then
|
|
EvokingObject := Read Last{Observation: This};
|
|
Endif;
|
|
|
|
|
|
Client_Guid := EvokingObject.ClientGUID;
|
|
Chart_Guid := EvokingObject.ChartGUID;
|
|
ClientVisit_Guid := EvokingObject.ClientVisitGUID;
|
|
environmentID := read last {stateinfo: envID};
|
|
/* Get the test value, its name, and type of test result from the evoking object */
|
|
( resultValue, resultName, Status, ResultOrderGuid ) := read last { Observation: Text, ItemName, Status , OrderGuid REFERENCING EvokingObject };
|
|
|
|
|
|
OrderID := Read First {"Select o.IDCode from Cv3ClientVisit Cv(nolock) Join Cv3Order o (nolock) On cv.guid=o.ClientVisitGUID "
|
|
|| " And cv.ClientGUID=o.ClientGUID And cv.ChartGUID=o.ChartGUID "
|
|
|| " And o.GUID= " ||ResultOrderGuid
|
|
|| " And cv.GUID= " || ClientVisit_Guid|| " "};
|
|
|
|
SignficantGuid := Read First {"Select ced.Guid from Cv3ClientVisit Cv(nolock) Join CV3ClientEventDeclaration ced (Nolock) on cv.guid= ced.ClientVisitGUID "
|
|
|| " And cv.clientGuid = ced.clientGuid And ced.active =1 Where ced.ClientVisitGUID = " || ClientVisit_Guid || " And ced.Text Like {{{SINGLE-QUOTE}}}%"||OrderID||"%{{{SINGLE-QUOTE}}} "};
|
|
|
|
|
|
If resultName = "Transfusion Reaction Report" and ( resultValue in ("POSITIVE","NEGATIVE") or Status= "F" ) Then
|
|
// To Delete Earlier Significant event
|
|
If Exist SignficantGuid Then
|
|
SignificantEvent_Obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ( (SignficantGuid as number) AS {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}} );
|
|
//Void := Call SignificantEvent_Obj.Delete;
|
|
//Void := Call SignificantEvent_Obj.Save;
|
|
|
|
ElseIf ( Not Exist SignficantGuid ) Then
|
|
// To Create New Significant event
|
|
|
|
Try
|
|
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((ClientVisit_Guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ;
|
|
Endtry;
|
|
catch Exception ex
|
|
error_occurred := true;
|
|
error_message := "{{+R}}Retrieve client:{{-R}}\n" ||
|
|
ex.Message || "\n\n";
|
|
if ex.InnerException is not null net_object then
|
|
error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n";
|
|
endif;
|
|
if ( client_visit_obj is NOT NULL ) then
|
|
void:= call client_visit_obj.Dispose; client_visit_obj:= null;
|
|
endif;
|
|
Endcatch;
|
|
|
|
NewSignificantEvent_dest:= destination { ObjectsPlus } with
|
|
[ alert_type := "Warning",
|
|
short_message := "Object created by MLM",
|
|
priority := "low",
|
|
scope := "chart",
|
|
rule_group := "Significant Event Object",
|
|
rule_number := 2010 ];
|
|
|
|
//---------------------------------------------------------------
|
|
// Error destination, fields can be updated as necessary
|
|
//---------------------------------------------------------------
|
|
error_destination := destination { Alert } with [
|
|
alert_type := "Warning",
|
|
short_message := "ObjectsPlus Error from MLM",
|
|
priority := "low",
|
|
scope := "chart",
|
|
Rule_group := "ObjectsPlus Error from MLM",
|
|
Rule_number := 1001,
|
|
Rule_subgroup := "",
|
|
Send_with_order := "",
|
|
Alert_dialog_settings := "",
|
|
Display_alert := true ];
|
|
try
|
|
//-------------------------------------------------------------
|
|
// New Significant Event example
|
|
//-------------------------------------------------------------
|
|
|
|
// Type code for the new Significant Event
|
|
SigEventTypeCode := "Blood Transfusion";
|
|
SigEventText := "Transfusion Reaction Eval Performed";
|
|
SigEventDesc := OrderID ;
|
|
|
|
// Create an Instance for Significant Event
|
|
SigEvent_obj := call {{{SINGLE-QUOTE}}}SignificantEvent{{{SINGLE-QUOTE}}}.CreateSignificantEvent with
|
|
(client_visit_obj, //ClientVisit
|
|
SigEventTypeCode, //TypeCode
|
|
SigEventText); //Event
|
|
SigEvent_obj.text := SigEventDesc ;
|
|
|
|
dd := EXTRACT Day now;
|
|
mn := EXTRACT Month now;
|
|
yr := EXTRACT Year now;
|
|
|
|
// Set some properties of the healthIssue
|
|
PartialDate_obj := new net_object {{{SINGLE-QUOTE}}}PartialDate{{{SINGLE-QUOTE}}} with
|
|
(yr as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, mn as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}}, dd as {{{SINGLE-QUOTE}}}Int32{{{SINGLE-QUOTE}}} );
|
|
|
|
// Add more to the data to be inserted
|
|
//SigEvent_obj.Text := "Patient has signed Adv. Directive.";
|
|
SigEvent_obj.OnsetDate := PartialDate_obj;
|
|
|
|
NewSignificantEvent_dest.ObjectsPlus := SigEvent_obj;
|
|
void := call SigEvent_obj.save;
|
|
|
|
endtry;
|
|
catch exception ex
|
|
error_occurred := true;
|
|
error_message := error_message ||
|
|
"{{+R}}New Significant Event{{-R}}\n" ||
|
|
ex.Message || "\n\n";
|
|
if ex.InnerException is not null net_object then
|
|
error_message := error_message ||
|
|
"Inner Exception: " || ex.InnerException.Message || "\n\n";
|
|
endif;
|
|
|
|
if ( SigEvent_obj is NOT NULL ) then
|
|
void:= call SigEvent_obj.Dispose;
|
|
SigEvent_obj:= null;
|
|
endif;
|
|
|
|
NewSignificantEvent_dest := null;
|
|
endcatch;
|
|
If ( client_visit_obj is NOT NULL ) then
|
|
void:= call client_visit_obj.Dispose;
|
|
client_visit_obj:= null;
|
|
EndIf;
|
|
|
|
Endif; // End of SignificantGuid existance
|
|
EndIF; // END of 1 St IF
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:// 0 minutes after time of
|
|
BL_Observation_Enter;
|
|
;;
|
|
logic: conclude true;
|
|
;;
|
|
action: if EXISTS NewSignificantEvent_dest then
|
|
write true at NewSignificantEvent_dest;
|
|
endif;
|
|
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|