Files
St.Clair/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATE_HEALTH_ISSUE.mlm

114 lines
4.2 KiB
Plaintext

maintenance:
title: SCH_Func_Create_Health_Issue;;
mlmname: SCH_Func_Create_Health_Issue;;
arden: version 2.5;;
version: 5.50;;
institution: ;;
author: Don Warnick ;;
specialist: ;;
date: 2012-04-05;;
validation: testing;;
library:
purpose: Create a Health Issue using the information passed from the calling MLM.
;;
explanation: Called MLM that builds health issues for a patient.
Change history
04.05.2012 DW CSR# - Created
04.30.2013 DW CSR# 31334 - Adjusted to be more generic, enabling it to be called from any MLMs
09.30.2015 GOS CSR#23359 - Made change in MLM for ICD9-ICD10 HI Dynamic Creation with all details Like ICD10 Code, Snowmed Code etc .
;;
keywords: Called MLM, Create Health Issue
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
error_occurred := false;
(visitGuid,issuename,issuecode,issuetext,issuetype,issuescheme) := ARGUMENT;
send_alert := "DoNotSend";
alert_dest := destination { Alert: warning, "Health Issue Create", high, chart, "Health Issue Create", 15042, send_alert, "No Override Allowed" };
// Create the Client Visit Object
try
client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((visitGuid 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;
// Create the Health Issue Object and Generate the Health Issue
try
NewHealthIssueHIType := issuetype;
NewHealthIssueHICode := issuecode;
NewHealthIssueHIScheme := issuescheme;
dd := EXTRACT Day now;
mn := EXTRACT Month now;
yr := EXTRACT Year now;
//--Start: CSR 23359-ICD9-ICD10 HI Change Added By shivprasad
Terms := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.FindIMOTerms with (NewHealthIssueHIScheme,NewHealthIssueHICode);
FOR i IN 1 SEQTO (Terms.Count as Number ) DO
HI_obj := Terms[i];
HI_Name := HI_obj.TermName as string;
If HI_Name = issuename then
HI_NO := i ;
Endif;
ENDDO;
If HI_NO is Null Then
HI_NO :=1 ;
Endif;
New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, Terms[HI_NO]);
//--End Added by Shivprasad
//New_HealthIssue_obj := call {{{SINGLE-QUOTE}}}HealthIssue{{{SINGLE-QUOTE}}}.CreateCodedHealthIssue with (client_visit_obj, NewHealthIssueHIType, NewHealthIssueHIScheme, NewHealthIssueHICode );
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}}} );
New_HealthIssue_obj.OnsetDate := PartialDate_obj;
New_HealthIssue_obj.Name := issuename;
New_HealthIssue_obj.Text := issuetext;
if ( New_HealthIssue_obj is NOT NULL ) then void := call New_HealthIssue_obj.Save; void := call New_HealthIssue_obj.Dispose; endif;
if ( client_visit_obj is NOT NULL ) then void:= call client_visit_obj.Dispose; client_visit_obj:= null; endif;
endtry;
catch exception ex
error_occurred := true;
if ( New_HealthIssue_obj is NOT NULL ) then void:= call New_HealthIssue_obj.Dispose; New_HealthIssue_obj:= null; endif;
endcatch;
;;
evoke:
;;
logic:
Conclude true ;
;;
action:
if error_occurred then
write "An error has occured in the MLM {{+B}}SCH_Func_Create_Health_Issue{{-B}} " || "Please notify your System Administrators that an error message has occurred " ||
"message: \n" at alert_dest;
write messageText at alert_dest;
endif;
;;
Urgency: 50;;
end: