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

179 lines
5.6 KiB
Plaintext

maintenance:
title: SCH_Access_Manager_InsuranceID_Formatting;;
mlmname: SCH_Access_Manager_InsuranceID_Formatting;;
arden: version 2.5;;
version: 5.50;;
institution: St. Clair Hospital;;
author: Dan Bredl ;;
specialist: Don Warnick;;
date: 2017-06-05;;
validation: testing;;
library:
purpose: Called from registraion event
;;
explanation: This MLM will check the format of Insurance IDs
Change history
06.05.2017 DW CSR# 26413 Access Manager - Created
01.30.2018 JML CSR# 26413 Access Manager - Modified to accept additional Medicare Insurance Number Formats
02.14.2018 DW CSR# 26413 Access Manager - Modified to accept additional an additional 12 digit pattern
03.28.2018 DW CSR# 36475 AMPFM upgrade - Comment out Medicare rules as new complex ones were introuduced on April 1. The registration department decided to remove all Medicare formatting edits for now
;;
keywords: Regsitration Event MLM
;;
knowledge:
type: data-driven;;
data:
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
error_occurred := false;
send_alert:= "DoNotSend";
mlm_alert := destination { Alert: warning, "Insurance Number Formatting Problem", high, chart, "Insurance Formatting MLM", 15042, send_alert, "No Override Allowed" };
insurance_enter_event := Event {InsuranceEnter ANY ClientVisit};
insurance_modify_event:= Event {InsuranceModify ANY ClientVisit};
ClientUserData_Obj := read last { Insurance: ClientUserData REFERENCING EvokingObject };
(CUD_User_Data_Code, CUD_Value ) := read last { ClientUserData: UserDataCode, Value REFERENCING ClientUserData_Obj };
InsuranceType := EVOKINGOBJECT.FRPName;
InsuranceNumber := ClientUserData_Obj.value;
InsuranceNumberLength := length (ClientUserData_Obj.value);
InsuranceNumberPattern := "";
MessageText := "OK";
errormessage := " ";
GenerateAlert := false;
// Medicaid Insurance
If InsuranceNumberLength < 10 and InsuranceType = "MEDICAID"
then
MessageText := " must be 10 characters in length. The number has " || InsuranceNumberLength || " characters.";
else
MessageText := "OK";
endif; // Medicaid
/*
// Medicare Insurance
If InsuranceType = "MEDICARE"
then
for x in 1 seqto InsuranceNumberLength do
InsuranceCharacter := substring 1 characters starting at x from InsuranceNumber ;
if (InsuranceCharacter as number) is null
then InsuranceCharacterType := "X";
else InsuranceCharacterType := "9";
endif;
InsuranceNumberPattern := InsuranceNumberPattern || InsuranceCharacterType ;
enddo;
If InsuranceNumberLength < 6 or InsuranceNumberLength > 12
then
MessageText := " must be between 6 and 12 characters in length. The number has " || InsuranceNumberLength || " characters.";
elseif
InsuranceNumberLength = 6
then
if InsuranceNumberPattern = "X99999"
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
endif;
elseif
InsuranceNumberLength = 7
then
if InsuranceNumberPattern = "X999999" or InsuranceNumberPattern = "XX99999"
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
endif;
elseif
InsuranceNumberLength = 8
then
if InsuranceNumberPattern = "X9999999" or InsuranceNumberPattern = "XX999999"
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
endif;
elseif
InsuranceNumberLength = 9
then
if InsuranceNumberPattern = "X99999999" or InsuranceNumberPattern = "XX9999999"
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
endif;
elseif
InsuranceNumberLength = 10
then
if InsuranceNumberPattern = "X999999999" or InsuranceNumberPattern = "XX99999999" or InsuranceNumberPattern = "999999999X" or InsuranceNumberPattern = "9999999999"
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
endif;
elseif
InsuranceNumberLength = 11
then
// JML : Added insurance number patterns
if InsuranceNumberPattern = "X9999999999" or InsuranceNumberPattern = "XX999999999" OR InsuranceNumberPattern = "999999999XX" OR InsuranceNumberPattern = "999999999X9"
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
endif;
elseif
InsuranceNumberLength = 12
then
// JML : Added insurance number patterns 02/14/2018 DW : added pattern InsuranceNumberPattern = XXX999999999
if InsuranceNumberPattern = "X99999999999" or InsuranceNumberPattern = "XX9999999999" or InsuranceNumberPattern = "XXX999999999" or InsuranceNumberPattern = "99999999999X" OR InsuranceNumberPattern = "9999999999XX"
then MessageText := "OK"; else MessageText := " is incorrectly formatted.";
endif;
else
MessageText := "OK";
endif;
endif; // Medicare
*/
// Format the error message if necessary
If MessageText <> "OK"
then
GenerateAlert := true;
errormessage := "The " || InsuranceType || " number" || MessageText || " Please correct this.";
endif;
;;
evoke:
insurance_enter_event;
insurance_modify_event;
;;
logic:
Conclude true ;
;;
action:
if GenerateAlert = true
then
write errormessage at mlm_alert;
endif;
if error_occurred then
write "An error has occured in the MLM {{+B}}SCH_Access_Manager_InsuranceID_Formatting {{-B}} " ||"Please notify your System Administrators that an error message has occurred message: \n" at mlm_alert;
write messageText at mlm_alert;
endif;
;;
Urgency: 50;;
end: