resolved conflicts

This commit is contained in:
2025-03-31 03:46:05 +03:00
6454 changed files with 1520539 additions and 9 deletions
@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('maternity_delivery_plans', function (Blueprint $table) {
$table->id();
$table->integer('patient_id');
$table->integer('episode_id');
$table->string('person_you_live_with')->nullable();
$table->integer('transport_means_to_facility')->nullable();
$table->string('person_to_accompany_you')->nullable();
$table->string('person_to_look_after_home')->nullable();
$table->text('mother_partner_screened_for')->nullable();
$table->string('family_planning_method_plan')->nullable();
$table->string('person_to_stay_at_facility')->nullable();
$table->integer('delivery_method')->nullable();
$table->string('backup_delivery_method')->nullable();
$table->integer('after_birth_disposal')->nullable();
$table->integer('created_by');
$table->integer('updated_by')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('maternity_delivery_plans');
}
};
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('obstetric_histories', function (Blueprint $table) {
$table->integer('past_pregnancy_complications')->nullable();
$table->string('past_pregnancy_comment')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('obstetric_histories', function (Blueprint $table) {
$table->dropColumn('past_pregnancy_complications');
$table->dropColumn('past_pregnancy_comment');
});
}
};
@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('maternity_mother_histories', function (Blueprint $table) {
$table->id();
$table->integer('patient_id');
$table->integer('episode_id');
$table->integer('cycle_length')->nullable();
$table->integer('menses_length')->nullable();
$table->integer('menses_amount')->nullable();
$table->integer('family_planning_method')->nullable();
$table->date('date_discontinued')->nullable();
$table->text('why_stop_family_planning')->nullable();
$table->text('medical_presentations')->nullable();
$table->string('other_medical_presentations')->nullable();
$table->text('sgbv_risk')->nullable();
$table->string('other_sgbv_risk')->nullable();
$table->string('husband_health')->nullable();
$table->integer('history_of_aph')->nullable();
$table->tinyInteger('history_of_fits')->nullable();
$table->text('other_medical_history_comment')->nullable();
$table->text('history_aph_details')->nullable();
$table->text('history_fit_details')->nullable();
$table->integer('created_by');
$table->integer('updated_by')->nullable();
$table->json('uterine_surgeries')->nullable();
$table->json('other_surgeries')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('maternity_mother_histories');
}
};
@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('pelvic_examination_and_assessments', function (Blueprint $table) {
$table->id();
$table->integer('patient_id');
$table->integer('episode_id');
$table->string('vulva')->nullable();
$table->string('vagina')->nullable();
$table->integer('cervix')->nullable();
$table->string('dilatation')->nullable();
$table->string('uterine_adnexa')->nullable();
$table->string('moniliasis')->nullable();
$table->float('diagonal_conjugate')->nullable();
$table->integer('sacrum')->nullable();
$table->integer('ischial_spinces')->nullable();
$table->integer('sub_public_angle')->nullable();
$table->integer('ischial_tuberosities')->nullable();
$table->integer('pelvic_adequate')->nullable();
$table->integer('created_by');
$table->integer('updated_by')->nullable();
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pelvic_examination_and_assessments');
}
};
@@ -0,0 +1,58 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('maternity_inpatients', function (Blueprint $table) {
$table->string('weeks_of_amenorrhoea')->nullable();
$table->text('delivery_recomendation')->nullable();
$table->text('pregnancy_complications')->nullable();
$table->text('other_pregnancy_complications')->nullable();
$table->text('physical_examination')->nullable();
$table->string('heart_physical_examination_details')->nullable();
$table->text('other_physical_examinations')->nullable();
$table->string('other_obstetric_risk_factors')->nullable();
$table->text('blood_transfusion_available')->nullable();
$table->text('fractures')->nullable();
$table->string('blood_transfusion_details')->nullable();
$table->date('pelvis_fracture_date')->nullable();
$table->string('pelvis_fracture_details')->nullable();
$table->date('spine_fracture_date')->nullable();
$table->string('spine_fracture_details')->nullable();
$table->date('femur_fracture_date')->nullable();
$table->text('other_fracture_details')->nullable();
$table->integer('primary_diagnosis')->nullable();
$table->string('other_diagnoses')->nullable();
$table->string('femur_fracture_details')->nullable();
$table->text('breasts_physical_examination_details')->nullable();
$table->text('legs_physical_examination_details')->nullable();
$table->text('lungs_physical_examination_details')->nullable();
$table->text('teeth_physical_examination_details')->nullable();
$table->integer('completed')->default(0)->comment('0=pending,1=completed');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('maternity_inpatients', function (Blueprint $table) {
$table->dropColumn('weeks_of_amenorrhoea');
$table->dropColumn('delivery_recomendation');
$table->dropColumn('pregnancy_complications');
$table->dropColumn('other_pregnancy_complications');
$table->dropColumn('physical_examination');
$table->dropColumn('heart_physical_examination_details');
$table->dropColumn('other_physical_examinations');
$table->dropColumn('other_obstetric_risk_factors');
});
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('other_facility_uterus_operations', function (Blueprint $table) {
$table->id();
$table->integer('patient_id');
$table->integer('episode_id');
$table->integer('operation_on_uterus')->nullable();
$table->date('uterus_operation_date')->nullable();
$table->string('uterus_operation_facility')->nullable();
$table->integer('created_by');
$table->integer('updated_by')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('other_facility_uterus_operations');
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('other_facility_other_operations', function (Blueprint $table) {
$table->id();
$table->integer('patient_id');
$table->integer('episode_id');
$table->text('other_operation_name')->nullable();
$table->date('other_operation_date')->nullable();
$table->text('other_operation_facility')->nullable();
$table->integer('created_by');
$table->integer('updated_by')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('other_facility_other_operations');
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('ward_item_requests', function (Blueprint $table) {
$table->string("issued_from")->nullable()->after("balance_returned")->comment("can be store or pharmacy");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('ward_item_requests', function (Blueprint $table) {
$table->dropColumn("issued_from");
});
}
};
@@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('labour_ward_admissions', function (Blueprint $table) {
$table->id();
$table->integer('patient_id');
$table->integer('episode_id');
$table->integer('labour_onset')->nullable();
$table->date('active_labour_diagnosis_date')->nullable();
$table->dateTime('membranes_rapture_at')->nullable();
$table->integer('gravida')->nullable();
$table->integer('para')->nullable();
$table->integer('abortions')->nullable();
$table->integer('ectopic_pregnancies')->nullable();
$table->integer('post_partum')->nullable();
$table->integer('history_of_aph')->nullable();
$table->integer('history_of_fits')->nullable();
$table->integer('iufd')->nullable();
$table->integer('born_before_arrival')->nullable();
$table->integer('progress')->nullable();
$table->text('other_labour_comments')->nullable();
$table->json('obstetric_risk_factors')->nullable();
$table->text('other_obstetric_risk_factors')->nullable();
$table->text('history_aph_details')->nullable();
$table->text('history_fit_details')->nullable();
$table->integer('complete')->default(0)->comment("1 = complete, 0 = incomplete");
$table->softDeletes();
$table->integer('created_by')->nullable();
$table->integer('updated_by')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('labour_ward_admissions');
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('item_batch_watcher', function (Blueprint $table) {
//
$table->integer('lab_stock')->nullable()->after('ward_stock');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('item_batch_watcher', function (Blueprint $table) {
//
});
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('requisitions', function (Blueprint $table) {
//
$table->integer('received_by')->nullable()->after('issued_on');
$table->text('received_comment')->nullable()->after('received_by');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('requisitions', function (Blueprint $table) {
//
});
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('requisitions', function (Blueprint $table) {
//
$table->text('batch_issued_out')->nullable()->after('item_ids_issued_out');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('requisitions', function (Blueprint $table) {
//
});
}
};
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Streamline\Models\User;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('gender_violences', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->foreignIdFor(User::class, 'created_by');
$table->foreignIdFor(User::class, 'updated_by')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('gender_violences');
}
};
@@ -0,0 +1,62 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Streamline\Models\GeneralSettings;
use Streamline\Services\GeneralSettingsService;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void {
$temp_settings = GeneralSettings::find(1);
if ($temp_settings) {
$temp_settings = $temp_settings->toArray();
} else {
$temp_settings = (new GeneralSettingsService())->getDefaultSettings();
}
Schema::table('general_settings', function (Blueprint $table) {
$table->dropColumn([
"allow_editing_name_of_lab_doctor", "allow_lab_number_editing", "stock_levels_to_consider", "enable_gbv_screening_tool",
"enable_hiv_screening_tool", "enable_hiv_and_gbv_screening_tool", "select_clinic_order_type", "show_symptoms_on_consultation",
"inpatient_sheet_with_detailed_notes", "full_detail_receipt_print", "enable_fingerprint", "default_hospital_clinic",
"smart_discharge_feature", "allow_issuing_out_of_stock_drugs", "allow_dispensing_out_of_stock_drugs", "apply_triage_grade",
"smart_triage_feature", "system_language", "payments_from_banks_with_lesser_balance", "eye_module_enabled",
"view_service_price_on_order", "view_sundry_price_on_order", "view_investigation_price_on_order", "view_prescription_price_on_order",
"view_procedure_price_on_order", "point_of_inventory_reduction", "enable_tuberculosis_screening",
"investigation_billing_mode", "cashier_receipts_print_format", "enable_performing_unpaid_investigations",
"add_service_to_patient_bill", "enable_dispensing_non_invoiced_prescription", "allow_prescribing_out_of_stock_drugs", "disable_out_of_stock_message",
"enable_performing_unpaid_consultations", "enable_patient_debt_reminder", "item_batch_tracking", "enable_dipensing_unpaid_prescription",
"add_lab_stamp_to_pdf_feature", "inpatient_sheet_extras", "consultation_attendance", "add_stamp_to_pdf_feature",
"chi_enabled", "batch_tracking_method", "patient_accounts_enabled", "enable_performing_unpaid_review_consultations",
"incoming_prescription_confirmation_feature", "enable_sms",
"session_expiration_time", "password_expiration_days", "currency_code", "family_account_over_consumption", "family_accounts_feature",
"show_drug_brand_name" ,"ward_prescription_model", "donor_feature", "number_of_active_users_limit"
]);
$table->longText('data')->nullable()->after('id');
});
$general_settings = GeneralSettings::find(1);
if (!$general_settings) {
$general_settings = new GeneralSettings();
}
$general_settings->data = json_encode($temp_settings);
$general_settings->save();
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};
@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Streamline\Services\GeneralSettingsService;
use Streamline\Models\GeneralSettings;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('subscriptions', function (Blueprint $table) {
$table->id();
$table->date('start_date');
$table->date('end_date');
$table->date('suspension_date');
$table->integer('duration');
$table->enum('is_active', [1, 0])->comment('1 = Yes , 0 = No');
$table->integer('created_by')->nullable();
$table->integer('updated_by')->nullable();
$table->timestamps();
$table->softDeletes();
});
$general_settings = json_decode(GeneralSettings::find(1)->data, true);
$general_settings['enable_subscription_tracking'] = 1;
$general_settings_data = GeneralSettings::find(1);
$general_settings_data->data = json_encode($general_settings);
$general_settings_data->save();
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('subscriptions');
}
};
@@ -0,0 +1,34 @@
<?php
use Doctrine\DBAL\Schema\Table;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('ward_inpatient_detailed_notes', function (Blueprint $table) {
$table->unsignedInteger('updated_by')->nullable()->after('created_at');
$table->text('clinic_examination_comments')->nullable()->after('plan');
$table->text('investigation_and_management_plan_comments')->nullable()->after('clinic_examination_comments');
$table->foreign('updated_by')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ward_inpatient_detailed_notes', function (Blueprint $table) {
$table->dropColumn('updated_by');
$table->dropColumn('clinic_examination_comments');
$table->dropColumn('investigation_and_management_plan_comments');
});
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('eye_clinic_main_exam', function (Blueprint $table) {
$table->text('referral_notes')->nullable()->after('referred_to');
$table->text('history_comments')->nullable()->after('referral_notes');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('eye_clinic_main_exam', function (Blueprint $table) {
$table->dropColumn(['referral_notes','history_comments']);
});
}
};
@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
if (!Schema::hasColumn('hmis_categories', 'editable')) {
Schema::table('hmis_categories', function (Blueprint $table) {
$table->enum('editable', [1, 0])->default(1)->after('type')->comment('1 = Editable , 0 = Uneditable');
});
}
if (!Schema::hasColumn('hmis_category_options', 'editable')) {
Schema::table('hmis_category_options', function (Blueprint $table) {
$table->enum('editable', [1, 0])->default(1)->after('parent_option')->comment('1 = Editable , 0 = Uneditable');
});
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('hmis_categories', function (Blueprint $table) {
$table->dropColumn('editable');
});
Schema::table('hmis_category_options', function (Blueprint $table) {
$table->dropColumn('editable');
});
}
};
@@ -0,0 +1,65 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddPaymentDateColumnToWardPaymentTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('ward_bed_stays', function (Blueprint $table) {
$table->date('payment_date')->nullable()->after('amount_paid');
});
Schema::table('ward_extras', function (Blueprint $table) {
$table->date('payment_date')->nullable()->after('amount_paid');
});
Schema::table('ward_consultations_and_services', function (Blueprint $table) {
$table->date('payment_date')->nullable()->after('amount_paid');
});
Schema::table('ward_procedures', function (Blueprint $table) {
$table->date('payment_date')->nullable()->after('amount_paid');
});
Schema::table('ward_investigation_pricings', function (Blueprint $table) {
$table->date('payment_date')->nullable()->after('amount_paid');
});
Schema::table('ward_sundry_dispensations', function (Blueprint $table) {
$table->date('payment_date')->nullable()->after('amount_paid');
});
Schema::table('ward_treatment_dispensations', function (Blueprint $table) {
$table->date('payment_date')->nullable()->after('amount_paid');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('ward_bed_stays', function (Blueprint $table) {
$table->dropColumn('payment_date');
});
Schema::table('ward_extras', function (Blueprint $table) {
$table->dropColumn('payment_date');
});
Schema::table('ward_consultations_and_services', function (Blueprint $table) {
$table->dropColumn('payment_date');
});
Schema::table('ward_procedures', function (Blueprint $table) {
$table->dropColumn('payment_date');
});
Schema::table('ward_investigation_pricings', function (Blueprint $table) {
$table->dropColumn('payment_date');
});
Schema::table('ward_sundry_dispensations', function (Blueprint $table) {
$table->dropColumn('payment_date');
});
Schema::table('ward_treatment_dispensations', function (Blueprint $table) {
$table->dropColumn('payment_date');
});
}
}
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddPaymentDateColumnToPatientCategoryInvoicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('patient_category_invoices', function (Blueprint $table) {
$table->date('payment_date')->nullable()->after('amount_paid_off');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('patient_category_invoices', function (Blueprint $table) {
$table->dropColumn('payment_date');
});
}
}
@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('general_stock_reconciliations', function (Blueprint $table) {
$table->id();
$table->integer('item_type')->nullable();
$table->integer('item_id')->nullable();
$table->integer('system_stock')->nullable();
$table->integer('physical_stock')->nullable();
$table->integer('difference')->nullable();
$table->integer('source')->nullable()->comment("1-stores, 2 - labs , 3 - imaging");
$table->string('reason',255)->nullable();
$table->boolean('completion_status')->nullable()->default(0)->comment("1-completed, 0 - pending");
$table->integer('stock_count_identifier')->nullable();
$table->integer('affected_account_id')->nullable();
$table->date('reconciliation_date')->nullable();
$table->string('general_comment',255)->nullable();
$table->integer('created_by');
$table->integer('updated_by')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('general_stock_reconciliations');
}
};
@@ -0,0 +1,92 @@
<?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Streamline\Models\OrderedSundry;
class AddMonetaryColumnsToOrderedSundriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('ordered_sundries', function (Blueprint $table) {
$table->text('amount_paid')->after('inpatient_bill_generated');
$table->date('payment_date')->nullable()->after('amount_paid');
$table->text('current_chart_of_account')->after('payment_date');
$table->text('unit_cost_price')->after('current_chart_of_account');
$table->text('unit_selling_prices')->after('unit_cost_price')->nullable();
$table->text('cost_of_goods_account')->after('unit_selling_prices');
$table->text('inventory_account')->after('cost_of_goods_account');
});
// migrate for old values
$ordered_sundries = OrderedSundry::where('inpatient_bill_generated', 1)->get();
foreach ($ordered_sundries as $ordered_sundry) {
$sundry_ids = explode(",", $ordered_sundry->sundries_id);
$unit_selling_prices = is_null($ordered_sundry->unit_selling_prices) ? array_fill(0, count($sundry_ids), "") : explode(",", $ordered_sundry->unit_selling_prices);
$date_of_interest = Carbon::parse($ordered_sundry->created_at)->toDateString();
$current_chart_of_account = [];
$cost_price = [];
$inventory_account = [];
$cost_of_goods_account = [];
$amount_paid_array = [];
for ($i = 0; $i < count($sundry_ids); $i++) {
$drug_details = DB::table('sundries')->find($sundry_ids[$i]);
$drug_cost_price = $drug_details->cost_price;
$drug_selling_price = $drug_details->non_insured_price;
$stock_watcher_record = DB::table('stock_watcher')->where('item_type', 2)
->where('item_id', $drug_details->id)->first();
if ($stock_watcher_record) {
$details_arr = json_decode($stock_watcher_record->details, true);
if (!isset($details_arr[$date_of_interest])) {
// just get the dates into their own array
$dates_array = array_keys($details_arr);
// search for the closest date to ours of interest and set that as our reference
$closest_date = get_closest_element_in_array($dates_array, $date_of_interest);
if ($closest_date < $date_of_interest) {
// we should only get dates less than that of interest since if it is greater calculations will be wrong
$drug_cost_price = $details_arr[$closest_date]["buying_price"];
$drug_selling_price = $details_arr[$closest_date]["selling_price"];
} else {
$drug_cost_price = 0;
$drug_selling_price = 0;
}
} else {
$drug_cost_price = $details_arr[$date_of_interest]["buying_price"];
$drug_selling_price = $details_arr[$date_of_interest]["selling_price"];
}
}
if (empty($unit_selling_prices[$i])) {
$unit_selling_prices[$i] = $drug_selling_price;
}
$current_chart_of_account[] = $drug_details->account_id;
$cost_price[] = $drug_cost_price;
$inventory_account[] = $drug_details->inventory_account;
$cost_of_goods_account[] = $drug_details->cost_of_goods_account;
$amount_paid_array[] = $drug_selling_price;
}
$ordered_sundry->amount_paid = implode(",", $amount_paid_array);
$ordered_sundry->unit_selling_prices = implode(",", $unit_selling_prices);
$ordered_sundry->current_chart_of_account = implode(",", $current_chart_of_account);
$ordered_sundry->unit_cost_price = implode(",", $cost_price);
$ordered_sundry->cost_of_goods_account = implode(",", $cost_of_goods_account);
$ordered_sundry->inventory_account = implode(",", $inventory_account);
$ordered_sundry->save();
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('ordered_sundries', function (Blueprint $table) {
$table->dropColumn(['amount_paid', 'current_chart_of_account', 'unit_cost_price', 'cost_of_goods_account', 'payment_date', 'unit_selling_prices']);
});
}
}
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('antenatal_mother_histories', function (Blueprint $table) {
$table->unsignedInteger('cycle_time')->nullable()->after('menses_amount');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('antenatal_mother_histories', function (Blueprint $table) {
$table->dropColumn('cycle_time');
});
}
};
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('antenatal_mother_histories', function (Blueprint $table) {
$table->text('uterine_surgeries')->nullable()->after('husband_health');
$table->text('other_surgeries')->nullable()->after('uterine_surgeries');
$table->text('fracture_details')->nullable()->after('fractures');
$table->string('medical_presentations_others_input')->nullable()->after('medical_presentations');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('antenatal_mother_histories', function (Blueprint $table) {
$table->dropColumn(['uterine_surgeries', 'other_surgeries','fracture_details','fracture_details','medical_presentations_others_input']);
});
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('item_batch_watcher', function (Blueprint $table) {
//
$table->integer('radiology_stock')->nullable()->after('lab_stock');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('item_batch_watcher', function (Blueprint $table) {
//
$table->dropColumn('radiology_stock');
});
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('reports_stock_value', function (Blueprint $table) {
$table->id();
$table->date('date');
$table->longText('results')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('reports_stock_value');
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('ante_natal_clinic_followups', function (Blueprint $table) {
$table->text('checklist')->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ante_natal_clinic_followups', function (Blueprint $table) {
$table->string('checklist')->change();
});
}
};
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('hospital_bills', function (Blueprint $table) {
$table->text('item_ids')->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('category_patient_dependants', function (Blueprint $table) {
$table->date('current_subscription_start_date')->after('account_balance')->nullable();
$table->date('current_subscription_end_date')->after('current_subscription_start_date')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('category_patient_dependants', function (Blueprint $table) {
$table->dropColumn(['current_subscription_start_date', 'current_subscription_end_date']);
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('ward_inpatient_detailed_notes', function (Blueprint $table) {
$table->text('history_comments')->nullable()->after('clinic_examination_comments');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ward_inpatient_detailed_notes', function (Blueprint $table) {
$table->dropColumn('history_comments');
});
}
};
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('general_forms', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->integer('item_type')->comment('1-drugs,2-sundries,3-dental,4-radiologies,5-labs,6-general_items,7-optics');
$table->integer('created_by')->nullable();
$table->integer('updated_by')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('general_forms');
}
};
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('sundries', function (Blueprint $table) {
//
$table->Integer('form_id')->nullable()->after('account_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('sundries', function (Blueprint $table) {
//
$table->dropColumn('form_id');
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('ward_chart_approvals', function (Blueprint $table) {
$table->string('cancer_protocol_order_id')->nullable()->after('incoming_ward_charts_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ward_chart_approvals', function (Blueprint $table) {
$table->dropColumn('cancer_protocol_order_id');
});
}
};
@@ -0,0 +1,104 @@
<?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$debtors = DB::table('debt_plan_payment_staffs')->get();
DB::beginTransaction();
try {
Schema::table('debt_plan_payment_staffs', function (Blueprint $table) {
$table->date('date_paid')->after('amount_paid')->nullable();
$table->string('comment')->after('date_paid')->nullable();
$table->string('receipt_number')->after('comment')->nullable();
$table->integer('received_id')->after('receipt_number')->nullable();
$table->integer('received_amount')->after('received_id')->nullable();
$table->integer('updated_by')->after('created_by')->nullable();
$table->integer('banked_id')->after('banked')->nullable();
$table->dropColumn([
'amount_paid_history', 'date_paid_history', 'staff_in_charge_history',
'comment_history', 'receipt_history', 'balance_history', 'received_id_history', 'received_amount_history',
'banked_history', 'amount_written_off_history', 'amount_written_off_by_history', 'amount_written_off_at_history',
'amount_owed', 'staff_id', 'received'
]);
});
foreach ($debtors as $debtor) {
if (!is_null($debtor->amount_paid_history)) {
$amount_paid_history_arr = unserialize($debtor->amount_paid_history);
$comment_history_arr = unserialize($debtor->comment_history);
$staff_in_charge_history_arr = unserialize($debtor->staff_in_charge_history);
$receipt_history_arr = unserialize($debtor->receipt_history);
$balance_history_arr = unserialize($debtor->balance_history);
$date_paid_history_arr = unserialize($debtor->date_paid_history);
$amount_paid_history_arr = is_array($amount_paid_history_arr) ? array_values($amount_paid_history_arr) : [];
$comment_history_arr = is_array($comment_history_arr) ? array_values($comment_history_arr) : [];
$staff_in_charge_history_arr = is_array($staff_in_charge_history_arr) ? array_values($staff_in_charge_history_arr) : [];
$receipt_history_arr = is_array($receipt_history_arr) ? array_values($receipt_history_arr) : [];
$balance_history_arr = is_array($balance_history_arr) ? array_values($balance_history_arr) : [];
$date_paid_history_arr = is_array($date_paid_history_arr) ? array_values($date_paid_history_arr) : [];
$received_amount_history_arr = is_null($debtor->received_amount_history) ? [] : array_values(unserialize($debtor->received_amount_history));
$received_id_history_arr = is_null($debtor->received_id_history) ? [] : array_values(unserialize($debtor->received_id_history));
$banked_history_arr = is_null($debtor->banked_history) ? [] : array_values(unserialize($debtor->banked_history));
for ($i = 0; $i < count($amount_paid_history_arr); $i++) {
DB::table('debt_plan_payment_staffs')->insert([
'debt_plan_id' => $debtor->debt_plan_id,
'created_by' => $staff_in_charge_history_arr[$i] ?? $debtor->created_by, 'created_at' => $debtor->created_at,
'updated_at' => $debtor->updated_at, 'amount_paid' => $amount_paid_history_arr[$i] ?? 0,
'receipt_number' => $receipt_history_arr[$i] ?? '', 'banked_id' => $banked_history_arr[$i] ?? null,
'balance' => $balance_history_arr[$i] ?? 0, 'comment' => $comment_history_arr[$i] ?? '',
'date_paid' => $date_paid_history_arr[$i] ? Carbon::parse($date_paid_history_arr[$i])->toDateString() : Carbon::parse($debtor->created_at)->toDateString(),
'received_id' => $received_id_history_arr[$i] ?? null, 'received_amount' => $received_amount_history_arr[$i] ?? null,
]);
}
}
if (!is_null($debtor->amount_written_off_history)) {
$amount_written_off = json_decode($debtor->amount_written_off_history);
$amount_written_off_by = json_decode($debtor->amount_written_off_by_history);
$amount_written_off_at = json_decode($debtor->amount_written_off_at_history);
for ($i = 0; $i < count($amount_written_off); $i++) {
DB::table('debt_plan_payment_staffs')->insert([
'debt_plan_id' => $debtor->debt_plan_id,
'created_by' => $amount_written_off_by[$i], 'created_at' => $amount_written_off_at[$i],
'updated_at' => $debtor->updated_at, 'amount_paid' => $amount_written_off[$i],
'balance' => 0, 'amount_written_off' => $amount_written_off[$i],
'date_paid' => Carbon::parse($amount_written_off_at[$i])->toDateString(),
]);
}
}
DB::table('debt_plan_payment_staffs')->where('id', $debtor->id)->delete();
}
DB::commit();
} catch (\Exception $e) {
echo $e->getMessage();
DB::rollback();
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('patient_account_consumptions', function (Blueprint $table) {
$table->integer('updated_by')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('patient_account_consumptions', function (Blueprint $table) {
$table->dropColumn('received');
});
}
};
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('patient_dependant_renewals', function (Blueprint $table) {
$table->id();
$table->integer('main_patient_id');
$table->bigInteger('renewal_amount');
$table->date('renewal_date')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('patient_dependant_renewals');
}
};
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('inpatient_info', function (Blueprint $table) {
$table->date('admitted_on')->nullable(false)->change();
$table->integer('ward_id')->nullable(false)->change();
$table->integer('outcome_id')->nullable()->change();
$table->integer('referred_to')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('tables', function (Blueprint $table) {
//
});
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
//add column
$table->integer('inactive_counter')->after('password')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
//drop column
$table->dropColumn('inactive_counter');
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('hospital_information', function (Blueprint $table) {
$table->integer('patient_number_year_prefix')->after('patient_number_abbr')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('hospital_information', function (Blueprint $table) {
$table->dropColumn('patient_number_year_prefix');
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('dependants_consumptions', function (Blueprint $table) {
$table->boolean('is_consumption_in_previous_subscription')->default(0)->after('reason')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('dependants_consumptions', function (Blueprint $table) {
$table->dropColumn('is_consumption_in_previous_subscription');
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('patients', function (Blueprint $table) {
$table->json('other_patients_info')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('patients', function (Blueprint $table) {
$table->dropColumn('other_patients_info');
});
}
};
@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('optical_stock_reconciliations', function (Blueprint $table) {
//
$table->integer('stock_count_identifier')->nullable()->after('reason_for_difference');
$table->boolean('completion_status')->nullable()->comment('1-complete, 0- not complete')->after('stock_count_identifier');
$table->longText('batches')->nullable()->after('completion_status');
$table->integer('variance')->nullable()->after('batches');
});
// migrate optical items to batch
Artisan::call('app:migrate-opticals-to-batch');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('optical_stock_reconciliations', function (Blueprint $table) {
//
$table->dropColumn(['stock_count_identifier','completion_status','batches','variance']);
});
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('reconilication_reasons', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->integer('created_by')->nullable();
$table->integer('updated_by')->nullable();
$table->timestamps();
$table->softDeletes();
});
// run reasons seeder
Artisan::call('db:seed', ['--class' => 'ReconcileReasonSeeder']);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('reconilication_reasons');
}
};
@@ -0,0 +1,45 @@
<?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Streamline\Models\Treatment;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('treatments', function (Blueprint $table) {
$table->text('balance')->nullable()->after('amount_paid');
$table->date('payment_date')->nullable()->after('balance');
});
// migrate for old values
$treatments = Treatment::where('inpatient_bill_generated', 1)->get();
foreach ($treatments as $treatment) {
$amount_paid_arr = explode(",", $treatment->amount_paid);
$treatment->balance = implode(",", array_fill(0, count($amount_paid_arr), 0));
$treatment->save();
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('treatments', function (Blueprint $table) {
$table->dropColumn(['balance']);
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('ordered_investigations', function (Blueprint $table) {
$table->text('ward_pricing_id')->nullable()->after('for_inpatient');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ordered_investigations', function (Blueprint $table) {
$table->dropColumn(['balance']);
});
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('stock_reconciliation_reasons', function (Blueprint $table) {
$table->id();
$table->integer('item_type');
$table->integer('item_id');
$table->integer('reconciliation_id')->nullable();
$table->foreignId('reason_id')->constrained('reconilication_reasons');
$table->integer('source')->comment('0-stores, 1-pharmacy');
$table->integer('created_by');
$table->integer('updated_by')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('stock_reconciliation_reasons');
}
};
@@ -0,0 +1,96 @@
<?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$ordered_services = DB::table('ordered_services')->where('inpatient_bill_generated', 1)
->get();
foreach ($ordered_services as$ordered_service) {
$service_id_arr = explode(",", $ordered_service->service_id);
$quantity_arr = explode(",", $ordered_service->quantity);
for ($i = 0; $i < count($service_id_arr); $i++) {
$details = DB::table('services')->find($service_id_arr[$i]);
$ward_id = get_name($ordered_service->episode_id, 'episode_id', 'ward_id', 'inpatient_info');
if ($details && is_numeric($ward_id)) {
DB::table('ward_consultations_and_services')
->insert([
"patient_id" => $ordered_service->patient_id, "episode_id" => $ordered_service->episode_id, "ward_id" => $ward_id,
"service_id" => $details->id, "unit_price" => $details->non_insured_price, "staff_fee" => 0, "chi_price" => 0,
"quantity_given" => $quantity_arr[$i], "dispensation_date" => Carbon::parse($ordered_service->updated_at)->toDateString(), "current_chart_of_account" => $details->account_id,
"amount_paid" => ($details->non_insured_price * $quantity_arr[$i]), "payment_date" => Carbon::parse($ordered_service->updated_at)->toDateString(), "balance" => 0, "created_by" => $ordered_service->created_by,
"created_at" => $ordered_service->updated_at
]);
}
}
}
$ordered_sundries = DB::table('ordered_sundries')->where('inpatient_bill_generated', 1)
->get();
foreach ($ordered_sundries as $ordered_sundry) {
$sundry_id_arr = explode(",", $ordered_sundry->sundries_id);
$quantity_arr = explode(",", $ordered_sundry->quantity);
for ($i = 0; $i < count($sundry_id_arr); $i++) {
$details = DB::table('sundries')->find($sundry_id_arr[$i]);
$ward_id = get_name($ordered_sundry->episode_id, 'episode_id', 'ward_id', 'inpatient_info');
if ($details && is_numeric($ward_id)) {
DB::table('ward_sundry_dispensations')
->insert([
"patient_id" => $ordered_sundry->patient_id, "episode_id" => $ordered_sundry->episode_id, "ward_id" => $ward_id,
"sundry_id" => $details->id, "price" => $details->non_insured_price, "cost_price" => $details->cost_price, "chi_price" => 0,
"quantity_given" => $quantity_arr[$i], "dispensation_date" => Carbon::parse($ordered_sundry->updated_at)->toDateString(), "current_chart_of_account" => $details->account_id,
"amount_paid" => ($details->non_insured_price * $quantity_arr[$i]), "payment_date" => Carbon::parse($ordered_sundry->updated_at)->toDateString(), "balance" => 0, "created_by" => $ordered_sundry->created_by,
"created_at" => $ordered_sundry->updated_at, "cost_of_goods_account" => $details->cost_of_goods_account, "inventory_account" => $details->inventory_account,
]);
}
}
}
$ordered_procedures = DB::table('ordered_procedures')->where('inpatient_bill_generated', 1)
->get();
foreach ($ordered_procedures as $ordered_procedure) {
$procedure_id_arr = explode(",", $ordered_procedure->procedure_id);
$performed_by = explode(",", $ordered_procedure->performed_id);
for ($i = 0; $i < count($procedure_id_arr); $i++) {
$details = DB::table('procedures')->find($procedure_id_arr[$i]);
$ward_id = get_name($ordered_procedure->episode_id, 'episode_id', 'ward_id', 'inpatient_info');
if ($details && is_numeric($ward_id)) {
DB::table('ward_procedures')
->insert([
"patient_id" => $ordered_procedure->patient_id, "episode_id" => $ordered_procedure->episode_id, "ward_id" => $ward_id,
"procedure_id" => $details->id, "hospital_fee" => $details->non_insured_price, "staff_fee" => 0, "chi_price" => 0,
"procedure_date" => Carbon::parse($ordered_procedure->updated_at)->toDateString(), "current_chart_of_account" => $details->account_id,
"amount_paid" => $details->non_insured_price, "payment_date" => Carbon::parse($ordered_procedure->updated_at)->toDateString(), "balance" => 0, "created_by" => $ordered_procedure->created_by,
"created_at" => $ordered_procedure->updated_at, 'performed_by' => $performed_by[$i] ?? NULL,
]);
}
}
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Streamline\Models\Quotation;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('quotations', function (Blueprint $table) {
$table->double('grn_number')->nullable()->comment('grn- goods_received_note')->after('quotation_number');
});
//add grn_number to previous quotations
$all_quotations = Quotation::all();
foreach ($all_quotations as $quotation) {
$quotation->grn_number = (float)$quotation->quotation_number + 0.1;
$quotation->save();
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('quotations', function (Blueprint $table) {
$table->dropColumn('grn_number');
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('obstetric_histories', function (Blueprint $table) {
if (!Schema::hasColumn('obstetric_histories','pregnancy_complication')) $table->string('pregnancy_complication')->nullable()->after('classification');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('obstetric_histories', function (Blueprint $table) {
//
});
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('ante_natal_clinic_registrations', function (Blueprint $table) {
if (!Schema::hasColumn('ante_natal_clinic_registrations','other_facility_visited_name')) $table->string('other_facility_visited_name')->nullable()->after('edd');
if (!Schema::hasColumn('ante_natal_clinic_registrations','other_facility_visit_date')) $table->date('other_facility_visit_date')->nullable()->after('other_facility_visited_name');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ante_natal_clinic_registrations', function (Blueprint $table) {
//
});
}
};
@@ -0,0 +1,52 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('ordered_services', function (Blueprint $table) {
$table->integer('is_pos')->default(0);
});
Schema::table('ordered_sundries', function (Blueprint $table) {
$table->integer('is_pos')->default(0);
});
Schema::table('ordered_eye_glasses', function (Blueprint $table) {
$table->integer('is_pos')->default(0);
});
Schema::table('treatments', function (Blueprint $table) {
$table->integer('is_pos')->default(0);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ordered_services', function (Blueprint $table) {
$table->dropColumn('is_pos');
});
Schema::table('ordered_sundries', function (Blueprint $table) {
$table->dropColumn('is_pos');
});
Schema::table('ordered_eye_glasses', function (Blueprint $table) {
$table->dropColumn('is_pos');
});
Schema::table('treatments', function (Blueprint $table) {
$table->dropColumn('is_pos');
});
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('ward_treatment_dispensations', function (Blueprint $table) {
//
$table->string('batch_id')->nullable()->after('ward_treatment_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ward_treatment_dispensations', function (Blueprint $table) {
//
$table->dropColumn('batch_id');
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('password_securities', function (Blueprint $table) {
$table->integer('password_expiry_days')->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('password_securities', function (Blueprint $table) {
$table->dropColumn('password_expiry_days');
});
}
};
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ward_treatment_batch_dispensations', function (Blueprint $table) {
$table->id();
$table->integer('patient_id');
$table->integer('item_id');
$table->integer('episode_id');
$table->integer('incoming_ward_chart_id');
$table->string('item_batch_id');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ward_treatment_batch_dispensations');
}
};
@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Streamline\Enums\IntegratedPayments;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('patient_payment_methods', function (Blueprint $table) {
$table->integer('is_ref_required')->default(0)->after('name');
$table->enum('integrated_payment', array_column(IntegratedPayments::cases(), 'value'))
->nullable()->after('is_ref_required');
});
Schema::table('payment_methods_transactions', function (Blueprint $table) {
$table->string('ref_number')->nullable()->after('amount');
$table->integer('ref_number_added_by')->nullable()->after('ref_number')
->comment('0 for user, 1 for system');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('patient_payment_methods', function (Blueprint $table) {
$table->dropColumn(['is_ref_required', 'integrated_payment']);
});
Schema::table('payment_methods_transactions', function (Blueprint $table) {
$table->dropColumn(['ref_number']);
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('lab_machines_results', function (Blueprint $table) {
$table->string('machine_id')->nullable()->after('results_time');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('lab_machines_results', function (Blueprint $table) {
$table->dropColumn(['machine_id']);
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('ward_treatment_dispensations', function (Blueprint $table) {
$table->text('dispensation_history')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ward_treatment_dispensations', function (Blueprint $table) {
$table->dropColumn('dispensation_history');
});
}
};