initial commit

This commit is contained in:
Inshal
2024-10-25 01:02:11 +05:00
commit 6e65bc3a62
1710 changed files with 273609 additions and 0 deletions

BIN
app/Console/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,216 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Appointment;
use App\Models\Cart;
use App\Models\LabKit;
use App\Models\Telemedpro;
use App\Models\Patient;
use App\Models\PatientNote;
use App\Models\PatientPlan;
use App\Models\PatientPrescription;
use App\Models\PatientRegActivity;
use App\Models\PlanV1;
use App\Models\Prescription;
use App\Models\ProfileCategory;
use App\Models\QuestionBuilder;
use Illuminate\Support\Str;
use Carbon\Carbon;
use DateTime;
use Faker\Factory as Faker;
class InsertDataForApp extends Command
{
protected $signature = 'insert:data';
protected $description = 'Insert plans data into the database based on the provided type';
public function __construct()
{
parent::__construct();
}
public function handle()
{
/* for ($i = 0; $i < 10; $i++) {
Telemedpro::create([
'name' => 'Telemedpro ' . ($i + 1),
'email' => 'telemedpro' . ($i + 1) . '@example.com',
'phone' => '123-456-789' . $i,
]);
} */
$faker = Faker::create();
for ($i = 500; $i < 800; $i++) {
$patient = Patient::create([
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'email' => $faker->unique()->safeEmail,
'phone' => $faker->phoneNumber,
'password' => bcrypt("12345"),
'address' => $faker->address,
'city' => $faker->city,
'state' => $faker->state,
'zip_code' => $faker->postcode,
'lat' => $faker->latitude,
'long' => $faker->longitude,
'dob' => $faker->date($format = 'Y-m-d', $max = 'now'),
'recording_switch' => $faker->boolean,
'country' => $faker->country,
'phone_no' => $faker->phoneNumber,
'shipping_address' => $faker->address,
'shipping_city' => $faker->city,
'shipping_state' => $faker->state,
'shipping_country' => $faker->country,
'shipping_zipcode' => $faker->postcode,
'timezone' => 'UTC',
'gender' => $faker->randomElement(['male', 'female']),
'marital_status' => $faker->randomElement(['single', 'married']),
'height' => $faker->numberBetween(150, 200), // Height in cm
'weight' => $faker->numberBetween(50, 100) // Weight in kg
]);
PatientRegActivity::create([
'patient_id' => $patient->id,
'activity' => 'patient_registered'
]);
$plans = PlanV1::all();
PatientPlan::create([
'patient_id' => $patient->id,
'plan_id' => $plans->random()->id,
]);
/* } */
$telemedpros = Telemedpro::all();
#$patients = Patient::all();
/* for ($i = 0; $i < 50; $i++) { */
$telemedpro = $telemedpros->random();
#$patient = $patients->random();
#$appointmentTime = Carbon::now()->addDays(rand(0, 30))->addHours(rand(0, 23))->addMinutes(rand(0, 59));
$appointmentTime = Carbon::now()->subMonth()->addDays(rand(0, 30))->addHours(rand(0, 23))->addMinutes(rand(0, 59));
$duration = rand(15, 120); // Duration between 15 minutes to 2 hours
$startTime = $appointmentTime;
$endTime = $startTime->copy()->addMinutes($duration);
$appointment = Appointment::create([
'telemed_pros_id' => $telemedpro->id,
'patient_id' => $patient->id,
'appointment_time' => $appointmentTime->toDateTimeString(),
'in_call' => rand(0, 1),
'meeting_id' => Str::uuid(),
'agent_call_token' => Str::random(20),
'patient_call_token' => Str::random(20),
'video_token' => Str::random(20),
'appointment_date' => $appointmentTime->toDateString(),
'patient_email' => $patient->email,
'patient_name' => $patient->name,
'timezone' => 'UTC',
'analytics' => json_encode(['metric1' => rand(0, 100), 'metric2' => rand(0, 100)]),
'start_time' => $startTime->toDateTimeString(),
'end_time' => $endTime->toDateTimeString(),
'duration' => $duration
]);
$statusOptions = ['delivered', 'pending'];
$labkit = LabKit::inRandomOrder()->first();
$cart = new Cart();
$cart->lab_kit_id = $labkit->id;
$cart->first_name = $patient->first_name;
$cart->last_name = $patient->last_name;
$cart->email = $patient->email;
$cart->phone = $patient->phone;
$cart->status = $statusOptions[array_rand($statusOptions)];
$cart->date_of_birth = $patient->dob;
$cart->patient_id = $patient->id;
$cart->shipping_address1 = $faker->streetAddress;
$cart->shipping_address2 = $faker->secondaryAddress;
$cart->shipping_city = $faker->city;
$cart->shipping_state = $faker->state;
$cart->shipping_zipcode = $faker->postcode;
$cart->shipping_country = $faker->country;
$cart->billing_address1 = $faker->streetAddress;
$cart->billing_address2 = $faker->secondaryAddress;
$cart->billing_city = $faker->city;
$cart->billing_state = $faker->state;
$cart->billing_zipcode = $faker->postcode;
$cart->billing_country = $faker->country;
$cart->shipping_amount = $faker->randomFloat(2, 5, 20); // Random shipping amount between $5 and $20
$cart->total_amount = $faker->randomFloat(2, 50, 200); // Random total amount between $50 and $200
$cart->save();
$prescription = Prescription::inRandomOrder()->first();
PatientPrescription::create([
'patient_id' => $patient->id,
'appointment_id' => $appointment->id,
'prescription_id' => $prescription->id,
'direction_one' => $faker->sentence,
'direction_two' => $faker->sentence,
'dont_substitute' => rand(0, 1),
'comments' => $faker->sentence,
'status' => $statusOptions[array_rand($statusOptions)],
]);
$addNotePatient = PatientNote::create([
'note' => "Patient didn't send back test kit yet",
'note_type' => "Notes",
'patient_id' => $patient->id,
'appointment_id' => $appointment->id,
'telemed_pros_id' => $telemedpro->id
]);
$category = ProfileCategory::where("category_link", 'weight_loss')->first();
$jsonString = '{
"weight_lb": "42",
"height_feet": "5",
"height_inches": "2",
"expecting": "not_applicable",
"evaluate_weight_loss": "yes",
"weight_management": "no",
"caloric_intake": "yes",
"physical_activity": "no",
"weightloss_goal": "yes",
"medical_evaluation": "less_then_a_year_ago",
"lab_tests_completed": "no",
"comorbidities": [
"high_cholesterol",
"fatty_liver_disease"
],
"chronic_pancreatitis": [
"none_of_the_above"
],
"smoke_alcohol": null,
"family_history_thyroid_cancer": [
"none_of_above_them"
],
"kindney_history": [
"appointment_or_consultation_with",
"history_of_solitary_kidney_or_kidney_transplant"
]
}';
$questionBuilderData = [];
// Convert JSON string to PHP array
$data = json_decode($jsonString, true);
foreach ($data as $key => $value) {
if (is_array($value)) {
$value = serialize($value);
}
if (!empty($value)) {
$questionBuilderData[] = [
'key' => $key,
'value' => $value,
'profile_category_id' => $category->id,
'customer_id' => $patient->id
];
}
}
$questionBuilder = QuestionBuilder::insert($questionBuilderData);
}
}
}

View File

@@ -0,0 +1,87 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Appointment;
use App\Models\Cart;
use App\Models\LabKit;
use App\Models\Telemedpro;
use App\Models\Patient;
use App\Models\PatientNote;
use App\Models\PatientPlan;
use App\Models\PatientPrescription;
use App\Models\PatientRegActivity;
use App\Models\PlanV1;
use App\Models\Prescription;
use App\Models\ProfileCategory;
use App\Models\QuestionBuilder;
use Illuminate\Support\Str;
use Carbon\Carbon;
use DateTime;
use Faker\Factory as Faker;
class InsertDataForPatient extends Command
{
protected $signature = 'insert:data-patient';
protected $description = 'Insert plans data into the database based on the provided type';
public function __construct()
{
parent::__construct();
}
public function handle()
{
/* for ($i = 0; $i < 10; $i++) {
Telemedpro::create([
'name' => 'Telemedpro ' . ($i + 1),
'email' => 'telemedpro' . ($i + 1) . '@example.com',
'phone' => '123-456-789' . $i,
]);
} */
$faker = Faker::create();
for ($i = 10000; $i < 20000; $i++) {
$patient = Patient::create([
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'email' => $faker->unique()->safeEmail,
'phone' => $faker->phoneNumber,
'password' => bcrypt("12345"),
'address' => $faker->address,
'city' => $faker->city,
'state' => $faker->state,
'zip_code' => $faker->postcode,
'lat' => $faker->latitude,
'long' => $faker->longitude,
'dob' => $faker->date($format = 'Y-m-d', $max = 'now'),
'recording_switch' => $faker->boolean,
'country' => $faker->country,
'phone_no' => $faker->phoneNumber,
'shipping_address' => $faker->address,
'shipping_city' => $faker->city,
'shipping_state' => $faker->state,
'shipping_country' => $faker->country,
'shipping_zipcode' => $faker->postcode,
'timezone' => 'UTC',
'gender' => $faker->randomElement(['male', 'female']),
'marital_status' => $faker->randomElement(['single', 'married']),
'height' => $faker->numberBetween(150, 200), // Height in cm
'weight' => $faker->numberBetween(50, 100) // Weight in kg
]);
PatientRegActivity::create([
'patient_id' => $patient->id,
'activity' => 'patient_registered'
]);
$plans = PlanV1::all();
PatientPlan::create([
'patient_id' => $patient->id,
'plan_id' => $plans->random()->id,
]);
}
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Patient;
use App\Models\PatientRegActivity;
use App\Models\PatientPlan;
use App\Models\PlanV1;
use Illuminate\Support\Facades\DB;
use Faker\Factory as Faker;
class InsertDataForPatientBulk extends Command
{
protected $signature = 'insert:data-patient-bulk';
protected $description = 'Insert patient data into the database using bulk insert';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$faker = Faker::create();
$batchSize = 500; // Number of records to insert in each batch
$totalRecords = 20000; // Total number of records to insert
$plans = PlanV1::all();
for ($j = 0; $j < $totalRecords; $j += $batchSize) {
$patientData = [];
$patientRegActivityData = [];
$patientPlanData = [];
for ($i = 0; $i < $batchSize; $i++) {
$patientId = $j + $i + 37000; // Starting from 10001 as per your original code
$email = $faker->unique()->safeEmail;
$emailParts = explode('@', $email);
$emailParts[0] .= rand(1000, 9999); // Append a random 4-digit number
$uniqueEmail = implode('@', $emailParts);
$patientData[] = [
'id' => $patientId,
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'email' => $uniqueEmail,
//'phone' => $faker->phoneNumber,
'password' => bcrypt("12345"),
'address' => $faker->address,
'city' => $faker->city,
'state' => $faker->state,
'zip_code' => $faker->postcode,
'lat' => $faker->latitude,
'long' => $faker->longitude,
'dob' => $faker->date($format = 'Y-m-d', $max = 'now'),
'recording_switch' => $faker->boolean,
'country' => $faker->country,
'phone_no' => $faker->phoneNumber,
'shipping_address' => $faker->address,
'shipping_city' => $faker->city,
'shipping_state' => $faker->state,
'shipping_country' => $faker->country,
'shipping_zipcode' => $faker->postcode,
'timezone' => 'UTC',
'gender' => $faker->randomElement(['male', 'female']),
'marital_status' => $faker->randomElement(['single', 'married']),
'height' => $faker->numberBetween(150, 200),
'weight' => $faker->numberBetween(50, 100),
'created_at' => now(),
'updated_at' => now(),
];
$patientRegActivityData[] = [
'patient_id' => $patientId,
'activity' => 'patient_registered',
'created_at' => now(),
'updated_at' => now(),
];
$patientPlanData[] = [
'patient_id' => $patientId,
'plan_id' => $plans->random()->id,
'created_at' => now(),
'updated_at' => now(),
];
}
// Bulk insert data
DB::table('patients')->insert($patientData);
DB::table('patient_reg_activity')->insert($patientRegActivityData);
DB::table('patient_plan')->insert($patientPlanData);
$this->info("Inserted batch of $batchSize records. Total progress: " . ($j + $batchSize) . " / $totalRecords");
}
$this->info('Data insertion completed successfully.');
}
}

View File

@@ -0,0 +1,746 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\PlanV1;
class InsertPlansData extends Command
{
protected $signature = 'insert:plans {type}';
protected $description = 'Insert plans data into the database based on the provided type';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$type = $this->argument('type');
/* $plansData = [
'hgh' => [
[
'title' => 'Basic Plan',
'currency' => '$',
'price' => '195.00',
'list_one_title' => 'TRT prescription',
'list_two_title' => 'A nazial mist or a pre-filled syringe for self-injection',
'list_sub_title' => 'Either be cream or oral liquied',
'image_url' => '',
],
[
'title' => 'Pro Plan',
'currency' => '$',
'price' => '195.00',
'list_one_title' => 'TRT prescription',
'list_two_title' => 'A nazial mist or a pre-filled syringe for self-injection',
'list_sub_title' => 'Either be cream or oral liquied',
'image_url' => '',
],
[
'title' => 'Elite Plan',
'currency' => '$',
'price' => '995.00',
'list_one_title' => 'HGH & TRT prescription',
'list_two_title' => 'Growth hormone zinc and magnesium',
'list_sub_title' => 'Everything in Pro Plan',
'image_url' => '',
],
],
'peptide' => [
[
'title' => 'Semaglutide',
'currency' => '$',
'price' => '399.00',
'list_one_title' => 'RX Prescription',
'list_two_title' => 'Semaglutide, generic Ozempic and generic wegovy, is a potent medical weight loss treatment, with users typically experiencing an average loss of 15% of their body weight.',
'list_sub_title' => 'Weight Loss',
'image_url' => 'semaglutide.png',
],
[
'title' => 'Tirzepatide',
'currency' => '$',
'price' => '499.00',
'list_one_title' => 'RX Prescription',
'list_two_title' => 'Tirzepatide, generic Zepbound and generic Mounjaro, is a powerful medical weight loss treatment, often enabling individuals to lose 20% or more of their body weight, showcasing its enhanced efficacy compared to Semaglutide.',
'list_sub_title' => 'Weight Loss',
'image_url' => 'Tirzepatide.webp',
],
[
'title' => 'Sermorelin Injections',
'currency' => '$',
'price' => '249.00',
'list_one_title' => 'RX Prescription',
'list_two_title' => 'Sermorelin injections stimulate the body\'s natural production of growth hormone, promoting muscle growth, fat loss, and overall rejuvenation.',
'list_sub_title' => 'Lean Muscle Mass & Fat Loss',
'image_url' => 'Sermorelin.webp',
],
[
'title' => 'PT-141 Injections',
'currency' => '$',
'price' => '345.00',
'list_one_title' => 'RX Prescription',
'list_two_title' => 'Sexual health and Performance. Supplies are shipped with treatment',
'list_sub_title' => 'Sexual Performance',
'image_url' => 'PT-141.webp',
],
[
'title' => 'PT-141 Troche',
'currency' => '$',
'price' => '418.00',
'list_one_title' => 'RX Prescription',
'list_two_title' => 'Sexual health and Performance. Supplies are shipped with treatment',
'list_sub_title' => 'Sexual Performance',
'image_url' => 'pt-141_troche-2.webp',
],
[
'title' => 'VIP Nasal Spray',
'currency' => '$',
'price' => '210.00',
'list_one_title' => 'RX Prescription',
'list_two_title' => 'VIP nasal spray offers targeted delivery of therapeutic peptides to support digestive health, immune function, and circadian regulation.',
'list_sub_title' => 'Systemic Wellness',
'image_url' => 'vip_nasal-spray.webp',
],
[
'title' => 'SS-31 Injections',
'currency' => '$',
'price' => '1230.00',
'list_one_title' => 'RX Prescription',
'list_two_title' => 'VIP nasal spray offers targeted delivery of therapeutic peptides to support digestive health, immune function, and circadian regulation.',
'list_sub_title' => 'Longevity & Performance',
'image_url' => 'ss-31_syringes.webp',
],
],
'peptide_new' => [
[
'title' => 'AOD9604 [ 5mg]',
'currency' => '$',
'price' => '70.00',
'list_one_title' => 'Peptides',
'list_two_title' => 'AOD9604 is a peptide fragment of human growth hormone (HGH) used for its potential benefits in fat metabolism, weight loss, and joint health.',
'list_sub_title' => 'Weight Loss',
'image_url' => 'AOD9604-05mg.webp',
'slug' => 'AOD9604-5mg',
],
[
'title' => 'BPC 157',
'currency' => '$',
'price' => '199.00',
'list_one_title' => 'Peptides',
'list_two_title' => "BPC-157 is a penta-decapeptide composed of 15 amino acids. It is a partial sequence of the body protection compound (BPC) that was discovered in and isolated from human gastric juice. Animal studies have shown it to accelerate the healing of many different wounds, including muscle, tendon, and damaged ligaments. Additionally, BPC 157 has been shown to protect organs and aid in the prevention of gastric ulcers.",
'list_sub_title' => 'Body Protection Compound',
'image_url' => 'BPC-157-10mg.webp',
'slug' => 'bpc157',
],
[
'title' => 'CJC-1295, Ipamorelin Blend [ 10mg]',
'currency' => '$',
'price' => '95.00',
'list_one_title' => 'Peptides',
'list_two_title' => 'CJC-1295 causes the natural release of GH by naturally stimulating the growth hormone-releasing hormone receptor',
'list_sub_title' => 'Growth hormone',
'image_url' => 'CJC-1295-Ipamorelin-Blend-10mg.webp',
'slug' => 'CJC-1295-10mg',
],
[
'title' => 'PT-141 Injection',
'currency' => '$',
'price' => '149.00',
'list_one_title' => 'Peptides',
'list_two_title' => 'PT-141, also known as Bremelanotide, is a melanocortin receptor agonist that boosts sexual desire and arousal by stimulating specific receptors in the brain. This peptide promotes increased libido and sexual function for both men and women, offering a unique solution for enhancing intimate experiences. Enjoy the convenience of our peptide subscription, delivering in-home treatments directly to your door',
'list_sub_title' => 'Sexual Performance',
'image_url' => 'PT-141-10-mg.webp',
'slug' => 'pt-141-Injection-10mg',
],
[
'title' => 'Semaglutide [3mg]',
'currency' => '$',
'price' => '199.00',
'list_one_title' => 'Peptides',
'list_two_title' => 'Our Semaglutide weight loss program, led by board-certified physicians, can help you on a transformative journey toward a healthier lifestyle. The program includes monthly personalized Semaglutide prescriptions, regular virtual check-ins, and unlimited messaging with providers. Join the thousands of people who have already achieved their weight loss goals through this program.',
'list_sub_title' => 'Weight Loss',
'image_url' => 'Semaglutide-05mg.webp',
'slug' => 'semaglutide-3mg',
],
[
'title' => 'Semaglutide [5mg]',
'currency' => '$',
'price' => '220.00',
'list_one_title' => 'Peptides',
'list_two_title' => 'Our Semaglutide weight loss program, led by board-certified physicians, can help you on a transformative journey toward a healthier lifestyle. The program includes monthly personalized Semaglutide prescriptions, regular virtual check-ins, and unlimited messaging with providers. Join the thousands of people who have already achieved their weight loss goals through this program.',
'list_sub_title' => 'Weight Loss',
'image_url' => 'Semaglutide-05mg.webp',
'slug' => 'semaglutide-5mg',
],
[
'title' => 'TB-500 (Thymosin Beta-4) [ 10mg ]',
'currency' => '$',
'price' => '170.00',
'list_one_title' => 'Peptides',
'list_two_title' => 'TB-500, also known as Thymosin Beta-4, is a peptide consisting of 43 amino acids. In animal studies, Thymosin Beta-4 has demonstrated the ability to promote blood vessel growth, regulate wound healing, decrease inflammation, and reduce oxidative damage in the heart and central nervous system. This peptide plays a significant role in protecting tissues, and facilitating tissue repair, regeneration, and remodeling of injured or damaged tissues. Additionally, it is a subject of active research in the field of anti-aging.',
'list_sub_title' => 'Injury Recovery',
'image_url' => 'TB-500-Thymosin-Beta-4-10-mg.webp',
'slug' => 'tb-500-10mg',
],
[
'title' => 'Tesamorelin [5mg]',
'currency' => '$',
'price' => '75.00',
'list_one_title' => 'Peptides',
'list_two_title' => 'Tesamorelin is a synthetic peptide consisting of 44 amino acids that mimic the growth hormone-releasing hormone (GHRH). It is specifically designed to stimulate the production and release of endogenous growth hormone (GH) from the pituitary gland. Originally developed for the treatment of lipodystrophy in HIV-positive individuals, Tesamorelin has shown potential benefits in reducing visceral adipose tissue and improving body composition. This peptide is utilized in various research and clinical settings for its ability to enhance GH levels, which may support lean muscle mass development, fat loss, and overall metabolic health., immune function, and circadian regulation.',
'list_sub_title' => 'Weight loss',
'image_url' => 'Tesamorelin-05mg.webp',
'slug' => 'tesamorelin-5mg',
],
[
'title' => 'Tesamorelin [10mg]',
'currency' => '$',
'price' => '135.00',
'list_one_title' => 'Peptides',
'list_two_title' => 'Tesamorelin is a synthetic peptide consisting of 44 amino acids that mimic the growth hormone-releasing hormone (GHRH). It is specifically designed to stimulate the production and release of endogenous growth hormone (GH) from the pituitary gland. Originally developed for the treatment of lipodystrophy in HIV-positive individuals, Tesamorelin has shown potential benefits in reducing visceral adipose tissue and improving body composition. This peptide is utilized in various research and clinical settings for its ability to enhance GH levels, which may support lean muscle mass development, fat loss, and overall metabolic health., immune function, and circadian regulation.',
'list_sub_title' => 'Weight loss',
'image_url' => 'Tesamorelin-05mg.webp',
'slug' => 'tesamorelin-10mg',
],
[
'title' => 'Tirzepatide [ 5mg ]',
'currency' => '$',
'price' => '249.00',
'list_one_title' => 'Peptides',
'list_two_title' => 'Tirzepatide, the same active ingredient in Mounjaro®, represents the latest and most potent GLP-1 class medication for sustained weight loss. Patients have experienced an impressive average weight reduction of 24.3% over 72 weeks, in conjunction with a calorie-restricted diet and heightened physical activity. This dual-action GLP-1/GIP is for individuals with obesity (BMI ≥30) or overweight (BMI ≥27) accompanied by a weight-related condition, alongside dietary and exercise modifications.',
'list_sub_title' => 'Weight loss',
'image_url' => 'Tirzepatide-0mg.webp',
'slug' => 'tirzepatide-5mg',
],
[
'title' => 'GHK-CU',
'currency' => '$',
'price' => '0.00',
'list_one_title' => 'Peptides',
'list_two_title' => 'GHK-Cu is a natural peptide found in human blood plasma, urine, and saliva. Research in animals indicates that GHK-Cu can enhance wound healing, boost immune function, and improve skin health by stimulating collagen production, activating fibroblasts, and promoting blood vessel growth. Evidence suggests that it acts as a feedback signal generated after tissue injury. Additionally, GHK-Cu suppresses free-radical damage, making it a potent antioxidant.',
'list_sub_title' => 'Skin Regeneration',
'image_url' => 'GHK-Cu-10mg.webp',
'slug' => 'GHK-CU',
],
],
];
if (isset($plansData[$type])) {
foreach ($plansData[$type] as $plan) {
PlanV1::create($plan);
}
$this->info('Plans data inserted successfully.');
} else {
$this->error('Invalid type provided.');
} */
$data = [
[
"Category" => "Weight Loss",
"Sub-Category" => "GLP-1 Weight Loss",
"Drug" => "Semaglutide Injection",
"Supply" => "1 Month or +",
"Retail Cost" => 299,
"Plus Shipping Cost" => 22.5,
"Description" => "GLP-1 Weight Loss Injection",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Weight Loss",
"Sub-Category" => "GLP-1 Weight Loss",
"Drug" => "Semaglutide Oral Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 299,
"Plus Shipping Cost" => 22.5,
"Description" => "GLP-1 Weight Loss Injection",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Weight Loss",
"Sub-Category" => "GLP-1 Weight Loss",
"Drug" => "Semaglutide Oral Suspension",
"Supply" => "1 Month or +",
"Retail Cost" => 299,
"Plus Shipping Cost" => 22.5,
"Description" => "GLP-1 Weight Loss Injection",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Weight Loss",
"Sub-Category" => "GLP-1 Weight Loss",
"Drug" => "Semaglutide Oral Troche",
"Supply" => "1 Month or +",
"Retail Cost" => 299,
"Plus Shipping Cost" => 22.5,
"Description" => "GLP-1 Weight Loss Injection",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Weight Loss",
"Sub-Category" => "GLP-1 Weight Loss",
"Drug" => "Tirzepatide Injection",
"Supply" => "1 Month or +",
"Retail Cost" => 599,
"Plus Shipping Cost" => 22.5,
"Description" => "GLP-1 Weight Loss Injection",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Female Health & Wellness",
"Sub-Category" => "Hair Loss/Regrowth",
"Drug" => "Hair Loss Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 99,
"Plus Shipping Cost" => 12.5,
"Description" => "Stopping Hair Loss/Hair Regrowth",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Female Health & Wellness",
"Sub-Category" => "Hair Loss/Regrowth",
"Drug" => "Hair Loss Topical Solution",
"Supply" => "1 Month or +",
"Retail Cost" => 99,
"Plus Shipping Cost" => 12.5,
"Description" => "Stopping Hair Loss/Hair Regrowth",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Female Health & Wellness",
"Sub-Category" => "Menopausal",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Female Health & Wellness",
"Sub-Category" => "Pain and Mental Wellness",
"Drug" => "Low Dose Naltrexone ",
"Supply" => "1 Month or +",
"Retail Cost" => 69,
"Plus Shipping Cost" => 12.5,
"Description" => "Treats Pain, Depression, Chronic Fatigue",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Female Sexual Health",
"Sub-Category" => "Sexual Health",
"Drug" => "OXYTOCIN 250 unit, 500 unit tab triturate",
"Supply" => "Per Dose, Qty 15",
"Retail Cost" => 89,
"Plus Shipping Cost" => 12.5,
"Description" => "Female Sexual Health Solutions",
"__EMPTY" => "One time + Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Female Sexual Health",
"Sub-Category" => "Sexual Health",
"Drug" => "SCREAM CREAM (Arginine 60 mg/Pentoxifylline 50 mg/Sildenafil 10 mg/Testosterone 1 mg/gm)",
"Supply" => "1 Month or +",
"Retail Cost" => 79,
"Plus Shipping Cost" => 12.5,
"Description" => "Female Sexual Health Solutions",
"__EMPTY" => "One time + Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Female Sexual Health",
"Sub-Category" => "Sexual Health",
"Drug" => "TADALAFIL 2.5 mg/PT141 1mg/Oxytocin 250 unit tab triturate",
"Supply" => "Per Dose, Qty 15",
"Retail Cost" => 119,
"Plus Shipping Cost" => 12.5,
"Description" => "Female Sexual Health Solutions",
"__EMPTY" => "One time + Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Female Sexual Health",
"Sub-Category" => "Sexual Health",
"Drug" => "TADALAFIL 5 mg/PT141 2 mg/Oxytocin 500 unit tab triturate",
"Supply" => "Per Dose, Qty 15",
"Retail Cost" => 119,
"Plus Shipping Cost" => 12.5,
"Description" => "Female Sexual Health Solutions",
"__EMPTY" => "One time + Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hair Loss/Regrowth",
"Drug" => "Hair Loss Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 99,
"Plus Shipping Cost" => 12.5,
"Description" => "Stopping Hair Loss/Hair Regrowth",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hair Loss/Regrowth",
"Drug" => "Hair Loss Topical Solution",
"Supply" => "1 Month or +",
"Retail Cost" => 99,
"Plus Shipping Cost" => 12.5,
"Description" => "Stopping Hair Loss/Hair Regrowth",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hormone Therapy",
"Drug" => "Clomiphine Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 69,
"Plus Shipping Cost" => 12.5,
"Description" => "Low Testosterone Levels, Low Energy",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hormone Therapy",
"Drug" => "Enclomaphine Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 119,
"Plus Shipping Cost" => 12.5,
"Description" => "Low Testosterone Levels, Low Energy",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hormone Therapy",
"Drug" => "HGH (Zomacton)",
"Supply" => "1 Week",
"Retail Cost" => 549,
"Plus Shipping Cost" => 22.5,
"Description" => "Human Growth Hormone",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hormone Therapy",
"Drug" => "Nandralone Injection",
"Supply" => "1 Month or +",
"Retail Cost" => 299,
"Plus Shipping Cost" => 22.5,
"Description" => "Promotes Lean Muscle, Endurance, Healing, Increase Bone Density",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hormone Therapy",
"Drug" => "Oxandralone Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 159,
"Plus Shipping Cost" => 12.5,
"Description" => "Maintain Weight, Decrease Muscle Loss",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hormone Therapy",
"Drug" => "Sermorelin Injection",
"Supply" => "1 Month or +",
"Retail Cost" => 129,
"Plus Shipping Cost" => 22.5,
"Description" => "Growth Homrone Promotes Lean Muscle, Endurance, Healing, Sleep",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hormone Therapy",
"Drug" => "Stanozolol Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 109,
"Plus Shipping Cost" => 12.5,
"Description" => "Retention of Lean Muscle",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hormone Therapy",
"Drug" => "T3/T4 Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 69,
"Plus Shipping Cost" => 12.5,
"Description" => "Thyroid Deficiency",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hormone Therapy",
"Drug" => "Testosterone Cream",
"Supply" => "1 Month or +",
"Retail Cost" => 139,
"Plus Shipping Cost" => 12.5,
"Description" => "Low Testosterone Levels, Low Energy",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Hormone Therapy",
"Drug" => "Testosterone Injection",
"Supply" => "10 Week Supply",
"Retail Cost" => 139,
"Plus Shipping Cost" => 12.5,
"Description" => "Low Testosterone Levels, Low Energy",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Sexual Health",
"Sub-Category" => "Erectile Dysfunction",
"Drug" => "OXYTOCIN 250 unit, 500 unit tab triturate",
"Supply" => "Per Dose, Qty 15",
"Retail Cost" => 89,
"Plus Shipping Cost" => 12.5,
"Description" => "Erectile Dysfuction Solutions",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Sexual Health",
"Sub-Category" => "Erectile Dysfunction",
"Drug" => "Sildenafil (Viagra)",
"Supply" => "1 Month or +",
"Retail Cost" => 69,
"Plus Shipping Cost" => 12.5,
"Description" => "Erectile Dysfuction Solutions",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Sexual Health",
"Sub-Category" => "Erectile Dysfunction",
"Drug" => "Tadalafil (Cialas)",
"Supply" => "1 Month or +",
"Retail Cost" => 69,
"Plus Shipping Cost" => 12.5,
"Description" => "Erectile Dysfuction Solutions",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Sexual Health",
"Sub-Category" => "Erectile Dysfunction",
"Drug" => "TADALAFIL 10 mg/PT-141 2 mg/Oxytocin 250 unit tab triturate",
"Supply" => "Per Dose, Qty 15",
"Retail Cost" => 119,
"Plus Shipping Cost" => 12.5,
"Description" => "Erectile Dysfuction Solutions",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Sexual Health",
"Sub-Category" => "Erectile Dysfunction",
"Drug" => "TADALAFIL 20 mg/PT-141 2 mg/Oxytocin 500 unit tab triturate",
"Supply" => "Per Dose, Qty 15",
"Retail Cost" => 119,
"Plus Shipping Cost" => 12.5,
"Description" => "Erectile Dysfuction Solutions",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Sexual Health",
"Sub-Category" => "Erectile Dysfunction",
"Drug" => "Trimix Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 129,
"Plus Shipping Cost" => 12.5,
"Description" => "Erectile Dysfuction Solutions",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Peptides",
"Sub-Category" => "Oral Peptides",
"Drug" => "AOD 600 mcg cap",
"Supply" => "1 Month or +",
"Retail Cost" => 139,
"Plus Shipping Cost" => 12.5,
"Description" => "Weight Loss - Speed Metabolism, Burn Fat",
"__EMPTY" => "Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Peptides",
"Sub-Category" => "Oral Peptides",
"Drug" => "BPC-157 500 mcg cap",
"Supply" => "1 Month or +",
"Retail Cost" => 129,
"Plus Shipping Cost" => 12.5,
"Description" => "Promotes GI Protection, Wound Healing, Muscle Recovery, Anabolic Effects",
"__EMPTY" => "One time + Subscription"
],
[
"Category" => "Peptides",
"Sub-Category" => "Oral Peptides",
"Drug" => "DIHEXA 10mg Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 159,
"Plus Shipping Cost" => 12.5,
"Description" => "Enhances Memory and Cognition",
"__EMPTY" => "One time + Subscription"
],
[
"Category" => "Peptides",
"Sub-Category" => "Oral Peptides",
"Drug" => "DIHEXA 20mg Capsule",
"Supply" => "1 Month or +",
"Retail Cost" => 299,
"Plus Shipping Cost" => 12.5,
"Description" => "Enhances Memory and Cognition",
"__EMPTY" => "One time + Subscription"
],
[
"Category" => "Peptides",
"Sub-Category" => "Oral Peptides",
"Drug" => "DSIP 500 mcg cap",
"Supply" => "1 Month or +",
"Retail Cost" => 119,
"Plus Shipping Cost" => 12.5,
"Description" => "Promotes Sleep, Regulates Circadian Rythms, Reduces Pain, Improves Mood",
"__EMPTY" => "One time + Subscription"
],
[
"Category" => "Peptides",
"Sub-Category" => "Oral Peptides",
"Drug" => "KPV 500 mcg cap",
"Supply" => "1 Month or +",
"Retail Cost" => 129,
"Plus Shipping Cost" => 12.5,
"Description" => "Lowers Inflammation, Improves Gut Health",
"__EMPTY" => "One time + Subscription"
],
[
"Category" => "Peptides",
"Sub-Category" => "Oral Peptides",
"Drug" => "KPV 500 mcg/BPC-157 mcg cap",
"Supply" => "1 Month or +",
"Retail Cost" => 139,
"Plus Shipping Cost" => 12.5,
"Description" => "Lowers Inflammation, Improves Gut Health",
"__EMPTY" => "One time + Subscription"
],
[
"Category" => "Peptides",
"Sub-Category" => "Oral Peptides",
"Drug" => "NAD+ 300 mg/mL Nasal Spray",
"Supply" => "1 Month or +",
"Retail Cost" => 99,
"Plus Shipping Cost" => 12.5,
"Description" => "Energy, Cell Repair, Overall Health",
"__EMPTY" => "One time + Subscription"
],
[
"Category" => "Peptides",
"Sub-Category" => "Oral Peptides",
"Drug" => "NAD+ 400 mg patch",
"Supply" => "4 Patches",
"Retail Cost" => 129,
"Plus Shipping Cost" => 12.5,
"Description" => "Energy, Cell Repair, Overall Health",
"__EMPTY" => "One time + Subscription"
],
[
"Category" => "Female Health & Wellness",
"Sub-Category" => "Energy",
"Drug" => "B12 Injections",
"Supply" => "10mL",
"Retail Cost" => 129,
"Plus Shipping Cost" => 12.5,
"Description" => "Low Energy",
"__EMPTY" => "One time + Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Category" => "Male Health & Wellness",
"Sub-Category" => "Energy",
"Drug" => "B12 Injections",
"Supply" => "10mL",
"Retail Cost" => 129,
"Plus Shipping Cost" => 12.5,
"Description" => "Low Energy",
"__EMPTY" => "One time + Subscription",
"__EMPTY_1" => "Prescription required. "
],
[
"Drug" => "Rapamycin",
"__EMPTY" => "One time + Subscription",
"__EMPTY_1" => "Prescription required. "
]
];
foreach ($data as $item) {
if (!isset($item['Drug']))
continue;
if (!isset($item['Description']))
continue;
// Find the existing record based on title and list_two_title
$existingPlan = PlanV1::where('title', $item['Drug'])
->where('list_two_title', $item['Description'])
->first();
$is_prescription_required = false;
if (isset($item['__EMPTY_1']) && $item['__EMPTY_1'] == "Prescription required. ")
$is_prescription_required = true;
if ($existingPlan) {
// Update the existing record
$existingPlan->update([
'currency' => '$',
'price' => $item['Retail Cost'] ?? 0,
'shipping_cost' => $item['Plus Shipping Cost'] ?? 0,
'list_one_title' => "hgh",
'is_prescription_required' => $is_prescription_required,
'list_sub_title' => $item['Description'] ?? "",
'list_sub_title' => $item['Description'] ?? "",
'slug' => PlanV1::generateUniqueSlug($item['Drug']),
]);
} else {
// Create a new record
PlanV1::create([
'title' => $item['Drug'],
'currency' => '$',
'price' => $item['Retail Cost'] ?? 0,
'shipping_cost' => $item['shipping_cost'] ?? 0,
'list_one_title' => "hgh",
'is_prescription_required' => $is_prescription_required,
'list_two_title' => $item['Description'] ?? "",
'list_sub_title' => $item['Description'] ?? "",
'slug' => PlanV1::generateUniqueSlug($item['Drug']),
]);
}
}
return 0;
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use PhpOffice\PhpSpreadsheet\IOFactory;
class ParseQuestionsSheet extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:parse-questions-sheet';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
// Path to the Excel file
$fileName = 'doctor intake request form.xlsx';
$filePath = storage_path($fileName);
if (!file_exists($filePath)) {
$this->error('File not found: ' . $filePath);
return Command::FAILURE;
}
// Load the Excel file
$spreadsheet = IOFactory::load($filePath);
$worksheet = $spreadsheet->getSheetByName('doctor intake questions');
if (!$worksheet) {
$this->error('Sheet1 not found in the Excel file.');
return Command::FAILURE;
}
$jsonArray = [];
// Iterate through rows starting from the second row (assuming the first row contains headers)
foreach ($worksheet->getRowIterator(2) as $row) {
$cellIterator = $row->getCellIterator();
$cellIterator->setIterateOnlyExistingCells(false);
// Get the data from each cell
$label = $cellIterator->current()->getValue();
$cellIterator->next();
$key = $cellIterator->current()->getValue();
$cellIterator->next();
$type = $cellIterator->current()->getValue();
// Add data to the JSON array
$jsonArray[] = [
'label' => $label,
'key' => $key,
'type' => $type,
];
}
// Convert the array to JSON
$json = json_encode($jsonArray, JSON_PRETTY_PRINT);
// Save JSON to a file
$outputFilePath = resource_path('js/views/pages/questionere/questions_parse.json');
file_put_contents($outputFilePath, $json);
$this->info('JSON data saved to: ' . $outputFilePath);
}
}

View File

@@ -0,0 +1,145 @@
<?php
namespace App\Console\Commands;
use App\Models\ProfileCategory;
use App\Models\ProfileCategoryQuestion;
use App\Models\ProfileQuestion;
use App\Models\ProfileSubQuestion;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use League\Csv\Reader;
use Symfony\Component\HttpKernel\Profiler\Profile;
class ReadCsv extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:read-csv {file?}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
function convertTextToLowerAndReplaceSpaces($text)
{
$lowercaseText = rtrim(strtolower($text), " ");
$convertedText = str_replace(' ', '_', $lowercaseText);
$convertedText = str_replace(',', '_', $lowercaseText);
$convertedText = trim(str_replace('/', '_', $lowercaseText));
return $convertedText;
}
function convertTextToLowerAndReplaceDashes($text)
{
$lowercaseText = rtrim(strtolower($text), " ");
$convertedText = str_replace(' ', '-', $lowercaseText);
$convertedText = trim(str_replace('/', '-', $lowercaseText));
return $convertedText;
}
public function handle()
{
$fileName = 'question data (5).csv'; // Change this to the name of your CSV file
$filePath = storage_path($fileName);
if (!file_exists($filePath)) {
$this->error('File not found: ' . $filePath);
return Command::FAILURE;
}
$csv = Reader::createFromPath($filePath, 'r');
$csv->setHeaderOffset(0);
$records = $csv->getRecords();
// Get the header row
$header = $csv->getHeader();
// Loop through each row
foreach ($csv->getRecords($header) as $record) {
$Category = $record['Category'];
if (count(explode(",", $Category)) > 1) {
foreach (explode(",", $Category) as $cat) {
$ProfileCategory = ProfileCategory::firstOrCreate([
'name' => trim($cat),
'icon' => $this->convertTextToLowerAndReplaceDashes($cat) . ".png",
'category_link' => $this->convertTextToLowerAndReplaceSpaces($cat)
]);
$this->insertREcord($ProfileCategory, $record);
}
} elseif ($Category) {
$ProfileCategory = ProfileCategory::firstOrCreate([
'name' => trim($Category),
'icon' => $this->convertTextToLowerAndReplaceDashes($Category) . ".png",
'category_link' => $this->convertTextToLowerAndReplaceSpaces($Category)
]);
$this->insertREcord($ProfileCategory, $record);
}
}
return Command::SUCCESS;
}
function insertREcord($ProfileCategory, $record)
{
$type = $record['type'];
$options = rtrim($record['options']);
$options = serialize(explode(",", $options));
$Question = $record['Question'];
$ProfileQuestion = ProfileQuestion::firstOrCreate([
'question' => $Question,
'question_options' => $options,
'question_type' => $type,
]);
try {
ProfileCategoryQuestion::firstOrCreate([
'category_id' => $ProfileCategory->id,
'question_id' => $ProfileQuestion->id
]);
} catch (Exception $e) {
}
$BaseQuestionR = $record['Base Question (Reference)'];
$ProfileQuestion_id = null;
if ($BaseQuestionR !== "") {
$ProfileQuestion = ProfileQuestion::where("question", $BaseQuestionR)->first();
if ($ProfileQuestion)
$ProfileQuestion_id = $ProfileQuestion->id;
}
$SubQuestionR = $record['Sub Question (Reference)'];
$parent_sub_question_id = null;
if ($SubQuestionR !== "") {
$ProfileSubQuestion = ProfileSubQuestion::where("question", $SubQuestionR)->first();
if ($ProfileSubQuestion)
$parent_sub_question_id = $ProfileSubQuestion->id;
}
$SubQuestion = $record['SubQuestion'];
$ProfileSubQuestion2 = ProfileSubQuestion::updateOrCreate([
'category_id' => $ProfileCategory->id,
'question_id' => $ProfileQuestion_id,
'question' => $SubQuestion,
'parent_sub_question_id' => $parent_sub_question_id,
'sub_question_type' => $type,
'sub_question_options' => $options,
]);
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace App\Console\Commands;
use App\Models\Patient;
use App\Models\PatientRegActivity;
use App\Notifications\AppointmentReminder;
use App\Notifications\RegistrationReminder;
use Illuminate\Console\Command;
class SendReminderEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:send-reminder-emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
$incompleteRegistrations = PatientRegActivity::where('activity', 'patient_registered')
->whereNotExists(function ($query) {
$query->select('id')
->from('patient_reg_activity')
->whereColumn('patient_reg_activity.patient_id', 'patient_reg_activity.patient_id')
->where('activity', 'patient_appointment_booked');
})->where("patient_reg_activity.email_sent", "!=", 1)->get();
foreach ($incompleteRegistrations as $patient) {
$patient->notify(new RegistrationReminder($patient->patient_id));
$patient->email_sent = 1;
$patient->save();
}
$incompleteAppointments = PatientRegActivity::where('activity', 'patient_appointment_booked')
->whereNotExists(function ($query) {
$query->select('id')
->from('patient_reg_activity')
->whereColumn('patient_reg_activity.patient_id', 'patient_reg_activity.patient_id')
->where('activity', 'patient_medical_question_entered');
})->where("patient_reg_activity.email_sent", "!=", 1)->get();
foreach ($incompleteAppointments as $patient) {
echo "Into patient_medical_question_entered";
$patient->notify(new AppointmentReminder($patient->patient_id));
$patient->email_sent = 1;
$patient->save();
}
$this->info('Reminder emails sent successfully.');
}
}

View File

@@ -0,0 +1,110 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use PhpOffice\PhpSpreadsheet\IOFactory;
class parseTypeSheet extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:parse-type-sheet';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
// Path to the Excel file
$fileName = 'doctor intake request form.xlsx';
$filePath = storage_path($fileName);
if (!file_exists($filePath)) {
$this->error('File not found: ' . $filePath);
return Command::FAILURE;
}
// Load the Excel file
$spreadsheet = IOFactory::load($filePath);
$worksheet = $spreadsheet->getSheetByName('type');
if (!$worksheet) {
$this->error('Sheet2 not found in the Excel file.');
return Command::FAILURE;
}
$objects = [];
$counter = 1; // Initialize counter
// Get the highest column number
$highestColumn = $worksheet->getHighestColumn();
// Convert the column letter to a number
$highestColumnIndex = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($highestColumn);
// Iterate through columns
for ($col = 1; $col <= $highestColumnIndex; $col += 2) {
$type = $worksheet->getCellByColumnAndRow($col, 1)->getValue(); // Get the type
$name = $worksheet->getCellByColumnAndRow($col + 1, 1)->getValue(); // Get the name
$values = [];
// Initialize row counter
$row = 2;
// Iterate through the values in the column pair using a do-while loop to ensure it executes at least once
do {
$keyCell = $worksheet->getCellByColumnAndRow($col, $row);
$valueCell = $worksheet->getCellByColumnAndRow($col + 1, $row);
// Check if key and value cells are not empty
if ($keyCell->getValue() !== null && $valueCell->getValue() !== null) {
$key = $keyCell->getValue();
$value = $valueCell->getValue();
// Add key-value pair to the values array
$values[$key] = $value;
// Increment row counter
$row++;
} else {
// If either key or value cell is empty, exit the loop
break;
}
} while (true);
// Add object to the objects array only if type and name are not null and values are not empty
if ($type !== null && $name !== null && !empty($values)) {
$objects[$type] = [
'type' => $name,
'values' => $values
];
}
}
// Convert the array to JSON
$json = json_encode($objects, JSON_PRETTY_PRINT);
// Save JSON to a file
$outputFilePath = resource_path('js/views/pages/questionere/type_parse.json');
file_put_contents($outputFilePath, $json);
$this->info('JSON data saved to: ' . $outputFilePath);
}
// Helper function to get the cell value safely
private function getCellValue($cell)
{
return $cell ? $cell->getValue() : '';
}
}

View File

@@ -0,0 +1,61 @@
<?php
namespace App\Console\Commands;
use App\Models\Appointment;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use Carbon\CarbonTimeZone;
class send15MinAlertAppointment extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:send15-min-alert-appointment';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
$now = Carbon::now();
$appointments = Appointment::where('appointment_time', '<=', $now->addMinutes(15)->format('H:i:s'))->where('appointment_time', '>=', Carbon::now()->format('H:i:s'))->get();
foreach ($appointments as $appointment) {
// Concatenate date and time
$datetimeUtc = $appointment->appointment_date . ' ' . $appointment->appointment_time;
// Convert to UTC timezone
$dateTimeUtc = Carbon::createFromFormat('Y-m-d H:i:s', $datetimeUtc, 'UTC');
// Convert to the appointment's timezone
$appointmentTimeZone = new CarbonTimeZone($appointment->timezone);
$dateTimeInAppointmentTimeZone = $dateTimeUtc->setTimezone($appointmentTimeZone);
// Split the datetime into date and time components in the appointment timezone
$appointment->appointment_date = $appointmentDate = $dateTimeInAppointmentTimeZone->format('Y-m-d');
$appointment->appointment_time = $appointmentTime = $dateTimeInAppointmentTimeZone->format('H:i:s');
$patient = $appointment->patient;
Mail::send('emails.upcoming-meeting', ['patient' => $patient, 'appointment' => $appointment], function ($message) use ($patient) {
$message->to("muhammadawais95@gmail.com", $patient->first_name)
->subject('Upcoming Meeting Reminder');
});
}
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Console\Commands;
use App\Models\Appointment;
use Carbon\Carbon;
use Carbon\CarbonTimeZone;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
class send1MinAlertAppointment extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:send1-min-alert-appointment';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
$now = Carbon::now();
$appointments = Appointment::where('appointment_time', '<=', $now->addMinutes(1)->format('H:i:s'))->where('appointment_time', '>=', Carbon::now()->format('H:i:s'))->get();
foreach ($appointments as $appointment) {
// Concatenate date and time
$datetimeUtc = $appointment->appointment_date . ' ' . $appointment->appointment_time;
// Convert to UTC timezone
$dateTimeUtc = Carbon::createFromFormat('Y-m-d H:i:s', $datetimeUtc, 'UTC');
// Convert to the appointment's timezone
$appointmentTimeZone = new CarbonTimeZone($appointment->timezone);
$dateTimeInAppointmentTimeZone = $dateTimeUtc->setTimezone($appointmentTimeZone);
// Split the datetime into date and time components in the appointment timezone
$appointment->appointment_date = $appointmentDate = $dateTimeInAppointmentTimeZone->format('Y-m-d');
$appointment->appointment_time = $appointmentTime = $dateTimeInAppointmentTimeZone->format('H:i:s');
$patient = $appointment->patient;
Mail::send('emails.start-meeting', ['patient' => $patient, 'appointment' => $appointment], function ($message) use ($patient) {
$message->to($patient->email, $patient->first_name)
->subject('Join Our Online Appointment Now');
});
}
}
}

28
app/Console/Kernel.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
$schedule->command('app:send15-min-alert-appointment')->everyMinute();
$schedule->command('app:send1-min-alert-appointment')->everyFifteenMinutes();
}
/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__ . '/Commands');
require base_path('routes/console.php');
}
}