215 lines
8.2 KiB
PHP
215 lines
8.2 KiB
PHP
<?php
|
|
// File: App\Helpers\DepositHelper.php
|
|
|
|
namespace App\Helpers;
|
|
|
|
use App\Models\EmployeeModel;
|
|
use App\Models\CDMasterModel;
|
|
use App\Models\EmployeePolicyModel;
|
|
use App\Models\TPAModel;
|
|
|
|
use App\Helpers\MailHelper;
|
|
|
|
class ChatbotHelper
|
|
{
|
|
|
|
//get list of policies againest an employee_id
|
|
public static function getListOfPolicies($chat_session_info)
|
|
{
|
|
|
|
// $emp_id = 12288;
|
|
// $emp_code = 'HTL-007';
|
|
// $client_id = 159;
|
|
// $policy_id = 0;
|
|
// $client_branch_id = 126;
|
|
$emp_id = $chat_session_info['emp_id'];
|
|
$emp_code = $chat_session_info['emp_code'];
|
|
$client_id = $chat_session_info['client_id'];
|
|
$client_branch_id = $chat_session_info['client_branch_id'];
|
|
// $relationship ='Father';
|
|
$EmployeeModel = new EmployeeModel();
|
|
return $EmployeeModel->getEmpFamilybyEmpCode(emp_code: $emp_code,client_id: $client_id,emp_status: ['draft'],policy_status:['draft'],client_branch_id:[ $client_branch_id ])//,relationship:[$relationship];
|
|
}
|
|
|
|
public static function getHospitalLink($client_policy_id){
|
|
// $client_policy_id = 336;
|
|
// $emp_id = 12288;
|
|
$EmployeePolicyModel = new EmployeePolicyModel();
|
|
$res = $EmployeePolicyModel->getHospitalLinkByPolicyandEmp($client_policy_id);
|
|
|
|
return is_array($res) && count($res) ? $res[0]['network_hospitals'] : null;
|
|
}
|
|
|
|
public static function getPhoneNumber(){
|
|
$emp_id = 12288;
|
|
$EmployeeModel = new EmployeeModel();
|
|
return $EmployeeModel->select('mobile')->where('id',$emp_id)->first()['mobile'];
|
|
}
|
|
|
|
public static function get_payload_data(string $key = null)
|
|
{
|
|
// Get the request object using the service helper
|
|
$request = service('request');
|
|
|
|
// Get the raw input (JSON or other data)
|
|
$rawInput = $request->getBody();
|
|
|
|
// Check if the raw input is valid JSON
|
|
$payload = json_decode($rawInput, true);
|
|
|
|
if (json_last_error() === JSON_ERROR_NONE) {
|
|
// JSON is valid, return the requested key or the entire payload
|
|
return $key ? ($payload[$key] ?? null) : $payload;
|
|
} else {
|
|
// JSON is invalid, fallback to raw input or POST data
|
|
$payload = $request->getRawInput() ?: $request->getPost();
|
|
return $key ? ($payload[$key] ?? null) : $payload;
|
|
}
|
|
}
|
|
|
|
public static function sendReimbursementProcessOverMail()
|
|
{
|
|
$emp_id = 12288;
|
|
$emp_code = 'HTL-007';
|
|
$client_id = 159;
|
|
$policy_id = 0;
|
|
$client_branch_id = 126;
|
|
$relationship ='Father';
|
|
$EmployeeModel = new EmployeeModel();
|
|
$data = $EmployeeModel->find($emp_id);
|
|
if(isset($data) && isset($data['email_corporate']))
|
|
{
|
|
$message = SELF::ReimbursementProcessMailTemplate();
|
|
|
|
$attachments = [
|
|
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
|
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
|
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
|
];
|
|
|
|
|
|
$common = ['mail_type'=>'reimbursement_mail_process_bot'];
|
|
$email_id = $data['email_corporate'];
|
|
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]);
|
|
|
|
$res = json_decode($res);
|
|
if($res->status == 'success')
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
public static function ReimbursementProcessMailTemplate()
|
|
{
|
|
$template = '<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>How to Claim Your Insurance Reimbursement</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: #f4f4f4;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
.container {
|
|
max-width: 600px;
|
|
margin: 20px auto;
|
|
background-color: #ffffff;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
}
|
|
h2 {
|
|
color: #2c3e50;
|
|
text-align: center;
|
|
}
|
|
p {
|
|
font-size: 16px;
|
|
color: #555;
|
|
line-height: 1.5;
|
|
}
|
|
.steps {
|
|
padding: 10px;
|
|
background-color: #ecf0f1;
|
|
border-radius: 5px;
|
|
margin-bottom: 20px;
|
|
}
|
|
.steps ol {
|
|
padding-left: 20px;
|
|
}
|
|
.btn {
|
|
display: block;
|
|
width: 200px;
|
|
margin: 20px auto;
|
|
padding: 12px;
|
|
text-align: center;
|
|
background-color: #3498db;
|
|
color: #ffffff;
|
|
text-decoration: none;
|
|
border-radius: 5px;
|
|
font-size: 16px;
|
|
}
|
|
.btn:hover {
|
|
background-color: #2980b9;
|
|
}
|
|
.footer {
|
|
text-align: center;
|
|
font-size: 14px;
|
|
color: #777;
|
|
margin-top: 20px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
<h2>How to Claim Your Insurance Reimbursement</h2>
|
|
<p>Dear [Customer Name],</p>
|
|
<p>We are here to assist you in claiming your insurance reimbursement smoothly. Please follow the steps below:</p>
|
|
|
|
<div class="steps">
|
|
<ol>
|
|
<li><strong>Gather Documents:</strong> Collect all required documents such as bills, invoices, and medical reports.</li>
|
|
<li><strong>Complete the Claim Form:</strong> Fill out the insurance claim form accurately.</li>
|
|
<li><strong>Attach Supporting Documents:</strong> Attach all necessary documents to support your claim.</li>
|
|
<li><strong>Submit Your Claim:</strong> Send the completed form and documents via email or through our online portal.</li>
|
|
<li><strong>Track Your Claim:</strong> Use our tracking system to monitor the status of your claim.</li>
|
|
<li><strong>Receive Reimbursement:</strong> Once approved, the reimbursement will be processed to your registered account.</li>
|
|
</ol>
|
|
</div>
|
|
|
|
<a href="[CLAIM_PORTAL_URL]" class="btn">Submit Your Claim</a>
|
|
|
|
<p>If you have any questions, feel free to contact our support team.</p>
|
|
|
|
<div class="footer">
|
|
<p>Best Regards,<br><strong>Insurance Support Team</strong><br><a href="mailto:support@example.com">support@example.com</a></p>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|
|
';
|
|
|
|
return $template;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|