Import latest app updates from streamline

An updated set of source files and initialization was provided by streamline to
address issues observed during initial testing. These files have been updated in
order to generate a new set of app images.
This commit is contained in:
2024-04-11 11:16:51 -07:00
parent cb4c6b4c1a
commit 4a89356390
10435 changed files with 107737 additions and 1220538 deletions
@@ -0,0 +1,48 @@
<?php
namespace Streamline\Console\Commands;
use Illuminate\Console\Command;
use Modules\Stores\Http\Controllers\StoresController;
class RedesignStockTrackingCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'redesign:stock';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Redesign the structure of the stock for existing clients before July 2023';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle() {
echo "Starting stock redesign...";
$output = (new StoresController())->pre_existing_stock_tracking_redesign();
echo $output;
return 0;
}
}
@@ -7,6 +7,7 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Streamline\Console\Commands\CorrectFinanceCommand;
use Streamline\Console\Commands\ImportCsvPriceListsCommand;
use Streamline\Console\Commands\MigrateInsuranceExpenditureCommand;
use Streamline\Console\Commands\RedesignStockTrackingCommand;
use Streamline\Console\Commands\SendAppointmentRemaindersCommand;
use Streamline\Console\Commands\ImportCsvItemsCommand;
use Streamline\Console\Commands\SetupCHICommand;
@@ -26,6 +27,7 @@ class Kernel extends ConsoleKernel {
CorrectFinanceCommand::class,
SetupCHICommand::class,
MigrateInsuranceExpenditureCommand::class,
RedesignStockTrackingCommand::class,
];
/**
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace Streamline\Enums;
enum Roles: string
{
case ADMIN = 'Admin';
case SUPER_ADMIN = 'Super Admin';
case DOCTOR = 'Doctors';
}
@@ -2,24 +2,34 @@
namespace Streamline\Exceptions;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException;
use Spatie\Permission\Exceptions\UnauthorizedException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Throwable;
class Handler extends ExceptionHandler {
/**
* A list of the exception types that should not be reported.
* A list of the exception types that should not be logged in the log file
*
* @var array
*/
protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
AuthenticationException::class,
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
TokenMismatchException::class,
ValidationException::class,
];
/**
@@ -27,46 +37,47 @@ class Handler extends ExceptionHandler {
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param Throwable $exception
* @param Throwable $e
* @return void
* @throws Throwable
*/
public function report(Throwable $exception) {
parent::report($exception);
public function report(Throwable $e): void
{
parent::report($e);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param Throwable $exception
* @return \Illuminate\Http\Response
* @param Request $request
* @param Throwable $e
* @return Response | RedirectResponse
* @throws Throwable
*/
public function render($request, Throwable $exception) {
if ($exception instanceof \Spatie\Permission\Exceptions\UnauthorizedException) {
public function render($request, Throwable $e): Response|RedirectResponse
{
if ($e instanceof UnauthorizedException) {
flash('Access to that page is restricted. Contact system administrator.')->error();
return redirect()->back();
// return response()->json(['Access to this page is restricted. Please contact system administrator.']);
}
return parent::render($request, $exception);
return parent::render($request, $e);
}
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
* @param Request $request
* @param AuthenticationException $exception
* @return RedirectResponse | JsonResponse
*/
protected function unauthenticated($request, AuthenticationException $exception) {
protected function unauthenticated($request, AuthenticationException $exception): JsonResponse|RedirectResponse
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest(url('/'));//
return redirect()->guest(url('/'));
}
}
@@ -59,7 +59,7 @@ use RegistersUsers;
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \Streamline\Models\User
* @return User
*/
protected function create(array $data) {
return User::create([
@@ -3,10 +3,11 @@
namespace Streamline\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Streamline\Models\BloodDonation;
use Streamline\Models\User;
use Carbon\Carbon;
use DB;
use Illuminate\Support\Facades\DB;
class BloodDonationsController extends Controller {
@@ -76,7 +77,7 @@ class BloodDonationsController extends Controller {
$new_blood_donation = new BloodDonation;
$new_blood_donation->donor_id = $donor_id;
$new_blood_donation->last_donation_date = $donation_date;
$new_blood_donation->created_by = auth()->user()->id;
$new_blood_donation->created_by = Auth::id();
if ($new_blood_donation->save()) {
flash('New blood donation has been succesfully recorded')->success();
return redirect('blood_donations');
@@ -89,7 +89,7 @@ class DataExtractionController extends Controller {
"inventory_account" => $inventory_account,
"cost_of_goods_account" => $cost_of_goods_account,
"has_price_list" => 0,
"created_by" => auth()->user()->id,
"created_by" => Auth::id(),
"created_at" => date('Y-m-d H:i:s')
]);
@@ -140,7 +140,7 @@ class DataExtractionController extends Controller {
"inventory_account" => 0,
"cost_of_goods_account" => 0,
"has_price_list" => 1,
"created_by" => auth()->user()->id,
"created_by" => Auth::id(),
"created_at" => date('Y-m-d H:i:s')
]);
@@ -3,22 +3,31 @@
namespace Streamline\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Streamline\Models\Clinic;
use Streamline\Models\GeneralSettings;
use Streamline\Models\Services;
use Streamline\Models\PermissionCategory;
use Streamline\Models\StreamlineSetupStep;
use Streamline\Models\User;
class GeneralSettingsController extends Controller {
class GeneralSettingsController extends Controller
{
public function edit_settings(){
public function edit_settings()
{
$general_settings = GeneralSettings::find(1);
$services = Services::pluck('name', 'id')->toArray();
$services = ['' => '- select -'] + $services;
return view('general_settings.edit', compact('general_settings', 'services'));
$clinics = Clinic::pluck('name', 'id')->toArray();
$clinics = ['' => '- select -'] + $clinics;
return view('general_settings.edit', compact('general_settings', 'services', 'clinics'));
}
public function save_settings(Request $request){
public function save_settings(Request $request)
{
$general_settings = GeneralSettings::find(1);
$general_settings->donor_feature = $request->donor_feature;
@@ -32,6 +41,8 @@ class GeneralSettingsController extends Controller {
$general_settings->enable_sms = $request->enable_sms;
$general_settings->incoming_prescription_confirmation_feature = $request->incoming_prescription_confirmation_feature;
$general_settings->add_stamp_to_pdf_feature = $request->add_stamp_to_pdf_feature;
$general_settings->consultation_attendance = $request->consultation_attendance;
$general_settings->inpatient_sheet_extras= $request->inpatient_sheet_extras;
$general_settings->add_lab_stamp_to_pdf_feature = $request->add_lab_stamp_to_pdf_feature;
$general_settings->enable_dipensing_unpaid_prescription = $request->enable_dipensing_unpaid_prescription;
$general_settings->item_batch_tracking = $request->item_batch_tracking;
@@ -65,6 +76,7 @@ class GeneralSettingsController extends Controller {
$general_settings->view_investigation_price_on_order = $request->view_investigation_price_on_order;
$general_settings->view_sundry_price_on_order = $request->view_sundry_price_on_order;
$general_settings->view_service_price_on_order = $request->view_service_price_on_order;
$general_settings->eye_module_enabled = $request->eye_module_enabled;
$general_settings->payments_from_banks_with_lesser_balance = $request->payments_from_banks_with_lesser_balance;
$general_settings->system_language = $request->system_language;
$general_settings->smart_triage_feature = $request->smart_triage_feature;
@@ -72,23 +84,29 @@ class GeneralSettingsController extends Controller {
$general_settings->allow_dispensing_out_of_stock_drugs = $request->allow_dispensing_out_of_stock_drugs;
$general_settings->allow_issuing_out_of_stock_drugs = $request->allow_issuing_out_of_stock_drugs;
$general_settings->smart_discharge_feature = $request->smart_discharge_feature;
$general_settings->default_hospital_clinic = $request->default_hospital_clinic;
$general_settings->enable_fingerprint = $request->enable_fingerprint;
$general_settings->full_detail_receipt_print = $request->full_detail_receipt_print;
$general_settings->inpatient_sheet_with_detailed_notes = $request->inpatient_sheet_with_detailed_notes;
$general_settings->show_symptoms_on_consultation = $request->show_symptoms_on_consultation;
$general_settings->select_clinic_order_type = $request->select_clinic_order_type;
$general_settings->enable_hiv_and_gbv_screening_tool = $request->enable_hiv_and_gbv_screening_tool;
$general_settings->enable_hiv_screening_tool = $request->enable_hiv_screening_tool;
$general_settings->enable_gbv_screening_tool = $request->enable_gbv_screening_tool;
$general_settings->stock_levels_to_consider = $request->stock_levels_to_consider;
$general_settings->allow_lab_number_editing = $request->allow_lab_number_editing;
$general_settings->allow_editing_name_of_lab_doctor = $request->allow_editing_name_of_lab_doctor;
$general_settings->save();
flash("Settings have been updated")->success();
if (session()->has('streamline_setup')) {
if (session()->has('streamline_setup')) {
//update the streamline setup table with the new finished step
$streamline_setup = new \Streamline\Models\StreamlineSetupStep;
$streamline_setup = new StreamlineSetupStep;
$streamline_setup->step = "general settings configuration";
$streamline_setup->completion_status = 1;
$streamline_setup->save();
session()->forget('streamline_setup');
session()->forget('streamline_setup');
return redirect("home");
}
return redirect("general_settings/edit");
@@ -105,9 +123,9 @@ class GeneralSettingsController extends Controller {
{
$activated_categories_array = $request->permission_category;
$all_permission_categories = PermissionCategory::pluck('id')->toArray();
//loop through the categories and activate only the checked ones
for ($i=0; $i < count($all_permission_categories); $i++) {
for ($i = 0; $i < count($all_permission_categories); $i++) {
$category = PermissionCategory::find($all_permission_categories[$i]);
if (in_array($all_permission_categories[$i], $activated_categories_array)) {
$category->is_module_active = 1;
@@ -116,21 +134,21 @@ class GeneralSettingsController extends Controller {
}
$category->update();
}
flash("Active modules have been activated")->success();
return redirect("activate_streamline_modules");
}
public function edit_personal_settings(Request $request)
{
$general_settings = User::find(auth()->user()->id);
$general_settings = User::find(Auth::id());
return view('general_settings.personal_settings_edit', compact('general_settings'));
}
public function save_personal_settings(Request $request)
{
$user = User::find(auth()->user()->id);
$user = User::find(Auth::id());
if ($user) {
$user->system_language = $request->system_language;
$user->update();
@@ -139,7 +157,7 @@ class GeneralSettingsController extends Controller {
return redirect('personal_settings/edit');
}
flash('system could not update the settings')->success();
flash('system could not update the settings')->success();
return redirect()->back();
}
@@ -158,13 +176,10 @@ class GeneralSettingsController extends Controller {
flash('settings have been updated')->success();
return redirect()->route('general_settings.active_users_limit_settings');
} catch (\Throwable $th) {
flash('system could not update the settings')->error();
flash('system could not update the settings')->error();
return redirect()->back();
}
}
}
@@ -2,14 +2,11 @@
namespace Streamline\Http\Controllers;
use Illuminate\Http\Request;
use flash;
use Auth;
use Illuminate\Support\Facades\DB;
use Streamline\Models\InsuranceMember;
use Streamline\Models\MessageBoard;
use Streamline\Models\HospitalInformation;
use Streamline\Models\PatientEpisode;
use Streamline\Models\Patient;
use Streamline\Models\StreamlineSetupStep;
use DB;
class HomeController extends Controller
{
@@ -26,7 +23,6 @@ class HomeController extends Controller
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index() {
/*
@@ -71,19 +67,19 @@ class HomeController extends Controller
public function quick_analysis_reports()
{
$insurance_members_array = \Streamline\Models\InsuranceMember::pluck('patient_id')->toArray();
$insurance_members_array = InsuranceMember::pluck('patient_id')->toArray();
$patient_registered_per_month_under_insurance = \Streamline\Models\Patient::whereIn('id',$insurance_members_array)->whereBetween('created_at', ['2018-01-01', '2022-12-31'])->select(DB::raw('count(id) as `data`'),DB::raw("DATE_FORMAT(created_at, '%Y-%m') episodes_year_month"))
$patient_registered_per_month_under_insurance = Patient::whereIn('id',$insurance_members_array)->whereBetween('created_at', ['2018-01-01', '2022-12-31'])->select(DB::raw('count(id) as `data`'),DB::raw("DATE_FORMAT(created_at, '%Y-%m') episodes_year_month"))
->groupBy('episodes_year_month')->orderBy('episodes_year_month')->get();
return $patient_registered_per_month_under_insurance;
/* set_time_limit(0);
$patient_visits_per_month = \Streamline\Models\PatientEpisode::select(DB::raw('count(id) as `data`'),DB::raw("DATE_FORMAT(created_at, '%Y-%m') episodes_year_month"))
$patient_visits_per_month = PatientEpisode::select(DB::raw('count(id) as `data`'),DB::raw("DATE_FORMAT(created_at, '%Y-%m') episodes_year_month"))
->groupBy('episodes_year_month')->orderBy('episodes_year_month')->get();
//return $patient_visits_per_month;
$patient_visits_per_month_for_insured = \Streamline\Models\PatientEpisode::whereIn('patient_id',$insurance_members_array)->whereBetween('created_at', ['2019-01-01', '2022-12-31'])->select(DB::raw('count(id) as `data`'),DB::raw("DATE_FORMAT(created_at, '%Y-%m') episodes_year_month"))
$patient_visits_per_month_for_insured = PatientEpisode::whereIn('patient_id',$insurance_members_array)->whereBetween('created_at', ['2019-01-01', '2022-12-31'])->select(DB::raw('count(id) as `data`'),DB::raw("DATE_FORMAT(created_at, '%Y-%m') episodes_year_month"))
->groupBy('episodes_year_month')->orderBy('episodes_year_month')->get();
@@ -91,7 +87,7 @@ class HomeController extends Controller
$year_month_array = explode("-", $record->episodes_year_month);
$families_array = [];
$per_month_records = \Streamline\Models\PatientEpisode::whereIn('patient_id',$insurance_members_array)->whereYear('created_at', '=', $year_month_array[0])->whereMonth('created_at', '=', $year_month_array[1])->get();
$per_month_records = PatientEpisode::whereIn('patient_id',$insurance_members_array)->whereYear('created_at', '=', $year_month_array[0])->whereMonth('created_at', '=', $year_month_array[1])->get();
foreach ($per_month_records as $single_record) {
$family_id = get_name($single_record->patient_id, 'patient_id', 'family_id', 'insurance_members');
@@ -5,10 +5,8 @@ namespace Streamline\Http\Controllers;
use Illuminate\Http\Request;
use Streamline\Models\District;
use Streamline\Models\HospitalInformation;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
//use Log;
use Auth;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\File;
use Streamline\Models\Parish;
@@ -152,7 +150,7 @@ class HospitalInformationController extends Controller {
$current_lab_stamp = $request->current_lab_stamp;
$new_lab_stamp = $lab_stamp_destination_path . $lab_stamp_name;
$hospital_information->lab_stamp = $new_lab_stamp ? $new_lab_stamp : $current_lab_stamp;
$hospital_information->updated_by = auth()->user()->id;
$hospital_information->updated_by = Auth::id();
$hospital_information->save();
//update the streamline setup table with the new finished step
@@ -218,7 +216,6 @@ class HospitalInformationController extends Controller {
'stamp' => 'nullable|file|mimes:jpg,jpeg,bmp,png,webp,gif,svg',
'lab_stamp' => 'nullable|file|mimes:jpg,jpeg,bmp,png,gif,svg,webp',
'logo' => 'nullable|file|mimes:jpg,jpeg,bmp,png,gif,svg,webp',
'email' => 'email',
'back_date' => 'required|numeric|min:0',
]);
@@ -230,7 +227,7 @@ class HospitalInformationController extends Controller {
flash($string)->error();
return back()->withErrors($validator)->withInput();
} else {
$logged_in_user_id = Auth::user()->id;
$logged_in_user_id = Auth::id();
$hospital_information = HospitalInformation::find($id);
$hospital_information->name = $request->name;
@@ -57,11 +57,8 @@ class ModuleController extends Controller
flash($request->name . " Module has been saved")->success();
return redirect("/modules/");
} catch (QueryException $e) {
$errorCode = $e->errorInfo[1];
if ($errorCode == 1062) { //error code for duplicate entry to a unique field
flash($request->name . " Module already exists!")->error();
return back()->withInput();
}
flash($request->name . " Module already exists!")->error();
return back()->withInput();
}
}
}
@@ -3,6 +3,7 @@
namespace Streamline\Http\Controllers;
use Illuminate\Http\Request;
use Streamline\Enums\Roles;
use Streamline\Http\Controllers\Controller;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
@@ -30,7 +31,7 @@ class RoleController extends Controller {
* @return \Illuminate\Http\Response
*/
public function index(Request $request) {
if (Auth::user()->hasRole('Super Admin')) {
if (Auth::user()->hasRole(Roles::SUPER_ADMIN->value)) {
$roles = Role::withCount('users')->withCount('permissions')->orderBy('name')->get();
} else {
$roles = Role::where('name', '!=', 'Super Admin')->withCount('users')->withCount('permissions')->orderBy('name')->get();
@@ -42,7 +42,7 @@ class SecurityQuestionController extends Controller {
/**
* Display the specified resource.
*
* @param \Streamline\Models\SecurityQuestion $securityQuestion
* @param SecurityQuestion $securityQuestion
* @return \Illuminate\Http\Response
*/
public function show(SecurityQuestion $securityQuestion) {
@@ -52,7 +52,7 @@ class SecurityQuestionController extends Controller {
/**
* Show the form for editing the specified resource.
*
* @param \Streamline\Models\SecurityQuestion $securityQuestion
* @param SecurityQuestion $securityQuestion
* @return \Illuminate\Http\Response
*/
public function edit(SecurityQuestion $securityQuestion) {
@@ -63,7 +63,7 @@ class SecurityQuestionController extends Controller {
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Streamline\Models\SecurityQuestion $securityQuestion
* @param SecurityQuestion $securityQuestion
* @return \Illuminate\Http\Response
*/
public function update(Request $request, SecurityQuestion $securityQuestion) {
@@ -73,7 +73,7 @@ class SecurityQuestionController extends Controller {
/**
* Remove the specified resource from storage.
*
* @param \Streamline\Models\SecurityQuestion $securityQuestion
* @param SecurityQuestion $securityQuestion
* @return \Illuminate\Http\Response
*/
public function destroy(SecurityQuestion $securityQuestion) {
@@ -7,7 +7,10 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use OwenIt\Auditing\Models\Audit;
use Spatie\Permission\Models\Role;
use Streamline\Enums\Roles;
use Streamline\Models\GeneralSettings;
use Streamline\Models\PasswordSecurity;
use Streamline\Models\SecurityQuestion;
use Streamline\Models\StaffPositions;
@@ -291,10 +294,10 @@ class UserController extends Controller
$security_questions = SecurityQuestion::orderBy('name')->pluck('name', 'id');
$security_questions->prepend('- select -', '');
if (Auth::user()->hasRole('Super Admin')) {
if (Auth::user()->hasRole(Roles::SUPER_ADMIN->value)) {
$roles = Role::pluck('name', 'name')->all();
} else {
$roles = Role::where('name', '!=', 'Super Admin')->pluck('name', 'name')->all();
$roles = Role::where('name', '!=', Roles::SUPER_ADMIN->value)->pluck('name', 'name')->all();
}
return view('users.create', compact('positions', 'councils', 'blood_groups', 'roles', 'security_questions'));
@@ -369,7 +372,7 @@ class UserController extends Controller
// $user->assignRole($request->input('roles'));
/*========= start catering for password expiration ========*/
$general_settings = \Streamline\Models\GeneralSettings::find(1);
$general_settings = GeneralSettings::find(1);
$user_password_expiration_days = $general_settings->password_expiration_days;
$passwordSecurity = PasswordSecurity::create([
@@ -421,10 +424,10 @@ class UserController extends Controller
$security_questions->prepend('- select -', '');
$user = User::find($id);
if (Auth::user()->hasRole('Super Admin')) {
if (Auth::user()->hasRole(Roles::SUPER_ADMIN->value)) {
$roles = Role::pluck('name', 'name')->all();
} else {
$roles = Role::where('name', '!=', 'Super Admin')->pluck('name', 'name')->all();
$roles = Role::where('name', '!=', Roles::SUPER_ADMIN->value)->pluck('name', 'name')->all();
}
$userRole = $user->roles->pluck('name', 'name')->all();
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -15,11 +15,7 @@ class DisableBackButton {
*/
public function handle($request, Closure $next) {
$response = $next($request);
/*return $response->header('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate')
->header('Pragma', 'no-cache')
->header('Expires', 'Sun, 02 Jan 1990 00:00:00 GMT');*/
$response->headers->set('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate');
$response->headers->set('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate');
$response->headers->set('Pragma', 'no-cache');
$response->headers->set('Expires', 'Sun, 02 Jan 1990 00:00:00 GMT');
return $response;
@@ -13,5 +13,6 @@ class VerifyCsrfToken extends BaseVerifier
*/
protected $except = [
'lab_machines/receive_results_mindray_bc5000',
'lab_machines/receive_results_mindray',
];
}
@@ -0,0 +1,21 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class AncDeliveryPlan extends Model implements Auditable
{
use HasFactory;
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
// mutate to dates
protected $dates = ['deleted_at'];
}
@@ -0,0 +1,25 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class AntenatalMotherHistory extends Model implements Auditable
{
use HasFactory;
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
protected $guarded = ['id'];
// mutate to dates
protected $dates = ['deleted_at'];
}
@@ -0,0 +1,25 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class CaesarianSection extends Model implements Auditable
{
use HasFactory;
public $timestamps = true;
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
protected $guarded = ['id'];
// mutate to dates
protected $dates = ['deleted_at'];
}
@@ -0,0 +1,18 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class CancerProtocol extends Model implements Auditable
{
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
use HasFactory;
}
@@ -0,0 +1,19 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class CancerProtocolWardChart extends Model implements Auditable
{
use HasFactory;
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
}
@@ -3,8 +3,17 @@
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class CardioEchoTemplate extends Model {
class CardioEchoTemplate extends Model implements Auditable
{
protected $guarded = [];
protected $table = "cardio_echo_template";
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
}
@@ -0,0 +1,14 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class DiagnosisCategory extends Model implements Auditable {
use HasFactory;
use \OwenIt\Auditing\Auditable;
use SoftDeletes;
}
@@ -0,0 +1,18 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class DrugRoute extends Model implements Auditable
{
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
use HasFactory;
}
@@ -0,0 +1,26 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class EyeGlasses extends Model implements Auditable {
use HasFactory;
protected $table = 'eye_glasses';
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
public static function boot() {
parent::boot();
self::updated(function($model){
save_new_stock_level($model->id, 7);
});
}
}
@@ -0,0 +1,42 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class GenderBasedViolence extends Model implements Auditable
{
use HasFactory;
public $timestamps = true;
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
protected $fillable = [
'triage_id',
'patient_id',
'child_feeling_unsafe',
'past_12_threatened_humiliated_caused_afraid_when',
'past_12_threatened_humiliated_caused_afraid_by_whom',
'past_12_prevented_coming_clinic_medication_treatment',
'past_12_any_threatened_or_harmed',
'past_12_any_touched_private_parts_not_want',
'past_12_any_forced_sex',
'past_12_any_refused_condom_when_wanted',
'others',
'created_by',
'updated_by'
];
protected $guarded = ['id'];
// mutate to dates
protected $dates = ['deleted_at'];
}
@@ -36,6 +36,5 @@ class HivGenderBaseViolence extends Model
'experienced_unwanted_touching_of_private_parts_in_past_12_months',
'experienced_forced_sex_in_past_12_months',
'experienced_condom_refusal_in_past_12_months',
];
];
}
@@ -18,4 +18,7 @@ class HmisCategoryOptions extends Model implements Auditable
// mutate to dates
protected $dates = ['deleted_at'];
//Mass Assignment
protected $fillable = ['name', 'number','hmis_category_id','parent_option','created_by'];
}
@@ -0,0 +1,16 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class InvoicePaymentRecord extends Model implements Auditable
{
protected array $dates = ['deleted_at'];
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
use SoftDeletes;
}
@@ -0,0 +1,16 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class OpticalStockReconciliation extends Model implements Auditable {
use HasFactory;
use \OwenIt\Auditing\Auditable;
use SoftDeletes;
}
@@ -0,0 +1,18 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class OrderedCancerProtocols extends Model implements Auditable
{
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
use HasFactory;
}
@@ -0,0 +1,17 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class PatientInpatientVitals extends Model implements Auditable {
use HasFactory;
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
}
@@ -0,0 +1,19 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class PatientRegistrationField extends Model implements Auditable
{
use HasFactory;
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
}
@@ -0,0 +1,14 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class SlitLampTestArea extends Model implements Auditable {
use HasFactory;
use \OwenIt\Auditing\Auditable;
use SoftDeletes;
}
@@ -0,0 +1,14 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class SlitLampTestAreaValue extends Model implements Auditable {
use HasFactory;
use \OwenIt\Auditing\Auditable;
use SoftDeletes;
}
@@ -0,0 +1,18 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class TreatmentSheetDispensations extends Model implements Auditable
{
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
use HasFactory;
}
+19 -16
View File
@@ -4,6 +4,7 @@ namespace Streamline\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\Auth;
use Spatie\Permission\Traits\HasRoles;
use OwenIt\Auditing\Contracts\Auditable;
use Illuminate\Support\Carbon;
@@ -13,12 +14,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Authenticatable implements Auditable {
// use HasApiTokens;
use Notifiable;
use HasRoles;
/*
* use laravel-auditing to track database changes
*/
use \OwenIt\Auditing\Auditable;
use SoftDeletes;
@@ -50,12 +47,16 @@ class User extends Authenticatable implements Auditable {
/*
* Below are some mutators
*/
private string $first_name;
private string $last_name;
public function setExpiryDateAttribute($expiry_date) {
public function setExpiryDateAttribute($expiry_date): void
{
$this->attributes['expiry_date'] = empty($expiry_date) ? NULL : Carbon::createFromFormat('d/m/Y', $expiry_date)->format('Y-m-d');
}
public function setLastDonationDateAttribute($last_donation_date) {
public function setLastDonationDateAttribute($last_donation_date): void
{
$this->attributes['last_donation_date'] = empty($last_donation_date) ? NULL : Carbon::createFromFormat('d/m/Y', $last_donation_date)->format('Y-m-d');
}
@@ -63,20 +64,17 @@ class User extends Authenticatable implements Auditable {
* Accessors
*/
public function getExpiryDateAttribute($expiry_date) {
$slash_date = $expiry_date == NULL ? '' : Carbon::createFromFormat('Y-m-d', $expiry_date)->format('d/m/Y');
return $slash_date;
public function getExpiryDateAttribute($expiry_date): string
{
return $expiry_date == NULL ? '' : Carbon::createFromFormat('Y-m-d', $expiry_date)->format('d/m/Y');
}
public function getLastDonationDateAttribute($last_donation_date) {
$slash_date = '';//$last_donation_date == NULL ? '' : Carbon::createFromFormat('Y-m-d', $last_donation_date)->format('d/m/Y');
return $slash_date;
public function getLastDonationDateAttribute($last_donation_date): string
{
//$last_donation_date == NULL ? '' : Carbon::createFromFormat('Y-m-d', $last_donation_date)->format('d/m/Y');
return '';
}
/*
* Other methods
*/
public static function resolveId() {
return Auth::check() ? Auth::user()->getAuthIdentifier() : null;
}
@@ -86,4 +84,9 @@ class User extends Authenticatable implements Auditable {
return $this->hasOne('Streamline\Models\PasswordSecurity');
}
public function getFullNameAttribute(): string
{
return $this->first_name . ' ' . $this->last_name;
}
}
@@ -0,0 +1,26 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
class UterusOperation extends Model implements Auditable
{
use HasFactory;
public $timestamps = true;
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
protected $guarded = ['id'];
// mutate to dates
protected $dates = ['deleted_at'];
}
@@ -0,0 +1,21 @@
<?php
namespace Streamline\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Contracts\Auditable;
use Illuminate\Database\Eloquent\SoftDeletes;
class WardStockReconciliation extends Model implements Auditable
{
use HasFactory;
// use laravel-auditing to track database changes
use \OwenIt\Auditing\Auditable;
// use for soft deletes
use SoftDeletes;
// mutate to dates
protected $dates = ['deleted_at'];
}
@@ -2,6 +2,7 @@
namespace Streamline\Observers;
use Streamline\Models\GenderBasedViolence;
use Streamline\Models\Triage;
use Streamline\Models\HivGenderBaseViolence;
@@ -12,40 +13,62 @@ class TriageObserver
*/
public function created(Triage $triage): void
{
if(request()->is_hiv_and_gbv_screening_tool_enabled) {
$hiv_gender_base_violence = new HivGenderBaseViolence();
$hiv_gender_base_violence->triage_id = $triage->id;
$hiv_gender_base_violence->patient_id = $triage->patient_id;
$hiv_gender_base_violence->mother_hiv_positive = request()->mother_hiv_positive;
$hiv_gender_base_violence->has_been_sick_last_3_months = request()->has_been_sick_last_3_months;
$hiv_gender_base_violence->has_recurring_skin_problem = request()->has_recurring_skin_problem;
$hiv_gender_base_violence->has_lost_weight_last_3_months = request()->has_lost_weight_last_3_months;
$hiv_gender_base_violence->has_had_tb = request()->has_had_tb;
$hiv_gender_base_violence->is_growing_well = request()->is_growing_well;
// if (request()->is_hiv_and_gbv_screening_tool_enabled || request()->is_hiv_screening_tool_enabled) {
if (request()->is_hiv_screening_tool_enabled) {
$new_hiv = new HivGenderBaseViolence();
$hiv_gender_base_violence->tested_for_hiv_in_past_12_months = request()->tested_for_hiv_in_past_12_months;
$hiv_gender_base_violence->had_tb_or_presumptive_tb = request()->had_tb_or_presumptive_tb;
$hiv_gender_base_violence->sti_symptoms_present = request()->sti_symptoms_present;
$hiv_gender_base_violence->diagnosed_with_hepatitis_b_or_c = request()->diagnosed_with_hepatitis_b_or_c;
$hiv_gender_base_violence->experienced_or_caused_sexual_violence = request()->experienced_or_caused_sexual_violence;
$hiv_gender_base_violence->reactive_hiv_self_test_result = request()->reactive_hiv_self_test_result;
$hiv_gender_base_violence->identified_through_index_client = request()->identified_through_index_client;
$hiv_gender_base_violence->exposed_to_hiv_positive_or_unknown_source = request()->exposed_to_hiv_positive_or_unknown_source;
$hiv_gender_base_violence->hiv_symptoms_without_recent_test = request()->hiv_symptoms_without_recent_test;
$hiv_gender_base_violence->tested_for_hiv_last_3_months = request()->tested_for_hiv_last_3_months;
$hiv_gender_base_violence->tested_for_hiv_last_12_months = request()->tested_for_hiv_last_12_months;
$hiv_gender_base_violence->unprotected_sex_with_partner_of_unknown_hiv_status = request()->unprotected_sex_with_partner_of_unknown_hiv_status;
$hiv_gender_base_violence->unprotected_sex_with_hiv_positive_partner = request()->unprotected_sex_with_hiv_positive_partner;
$hiv_gender_base_violence->shared_needles_or_piercing_objects = request()->shared_needles_or_piercing_objects;
$new_hiv->triage_id = $triage->id;
$new_hiv->patient_id = $triage->patient_id;
$new_hiv->mother_hiv_positive = request()->mother_hiv_positive ?? 0;
$new_hiv->has_been_sick_last_3_months = request()->has_been_sick_last_3_months ?? 0;
$new_hiv->has_recurring_skin_problem = request()->has_recurring_skin_problem ?? 0;
$new_hiv->has_lost_weight_last_3_months = request()->has_lost_weight_last_3_months ?? 0;
$new_hiv->has_had_tb = request()->has_had_tb ?? 0;
$new_hiv->is_growing_well = request()->is_growing_well ?? 0;
$hiv_gender_base_violence->experienced_threats_in_past_12_months = request()->experienced_threats_in_past_12_months;
$hiv_gender_base_violence->prevented_from_accessing_healthcare_in_past_12_months = request()->prevented_from_accessing_healthcare_in_past_12_months;
$hiv_gender_base_violence->experienced_physical_violence_in_past_12_months = request()->experienced_physical_violence_in_past_12_months;
$hiv_gender_base_violence->experienced_unwanted_touching_of_private_parts_in_past_12_months = request()->experienced_unwanted_touching_of_private_parts_in_past_12_months;
$hiv_gender_base_violence->experienced_forced_sex_in_past_12_months = request()->experienced_forced_sex_in_past_12_months;
$hiv_gender_base_violence->experienced_condom_refusal_in_past_12_months = request()->experienced_condom_refusal_in_past_12_months;
$new_hiv->tested_for_hiv_in_past_12_months = request()->tested_for_hiv_in_past_12_months ?? 0;
$new_hiv->had_tb_or_presumptive_tb = request()->had_tb_or_presumptive_tb ?? 0;
$new_hiv->sti_symptoms_present = request()->sti_symptoms_present ?? 0;
$new_hiv->diagnosed_with_hepatitis_b_or_c = request()->diagnosed_with_hepatitis_b_or_c ?? 0;
$new_hiv->experienced_or_caused_sexual_violence = request()->experienced_or_caused_sexual_violence ?? 0;
$new_hiv->reactive_hiv_self_test_result = request()->reactive_hiv_self_test_result ?? 0;
$new_hiv->identified_through_index_client = request()->identified_through_index_client ?? 0;
$new_hiv->exposed_to_hiv_positive_or_unknown_source = request()->exposed_to_hiv_positive_or_unknown_source ?? 0;
$new_hiv->hiv_symptoms_without_recent_test = request()->hiv_symptoms_without_recent_test ?? 0;
$new_hiv->tested_for_hiv_last_3_months = request()->tested_for_hiv_last_3_months ?? 0;
$new_hiv->tested_for_hiv_last_12_months = request()->tested_for_hiv_last_12_months ?? 0;
$new_hiv->unprotected_sex_with_partner_of_unknown_hiv_status = request()->unprotected_sex_with_partner_of_unknown_hiv_status ?? 0;
$new_hiv->unprotected_sex_with_hiv_positive_partner = request()->unprotected_sex_with_hiv_positive_partner ?? 0;
$new_hiv->shared_needles_or_piercing_objects = request()->shared_needles_or_piercing_objects ?? 0;
$hiv_gender_base_violence->save();
$new_hiv->experienced_threats_in_past_12_months = request()->experienced_threats_in_past_12_months ?? 0;
$new_hiv->prevented_from_accessing_healthcare_in_past_12_months = request()->prevented_from_accessing_healthcare_in_past_12_months ?? 0;
$new_hiv->experienced_physical_violence_in_past_12_months = request()->experienced_physical_violence_in_past_12_months ?? 0;
$new_hiv->experienced_unwanted_touching_of_private_parts_in_past_12_months = request()->experienced_unwanted_touching_of_private_parts_in_past_12_months ?? 0;
$new_hiv->experienced_forced_sex_in_past_12_months = request()->experienced_forced_sex_in_past_12_months ?? 0;
$new_hiv->experienced_condom_refusal_in_past_12_months = request()->experienced_condom_refusal_in_past_12_months ?? 0;
$new_hiv->save();
}
if (request()->is_gbv_screening_tool_enabled) {
$new_gbv = new GenderBasedViolence();
$new_gbv->triage_id = $triage->id;
$new_gbv->patient_id = $triage->patient_id;
$new_gbv->child_feeling_unsafe = request()->child_feeling_unsafe;
$new_gbv->past_12_threatened_humiliated_caused_afraid_when = request()->past_12_threatened_humiliated_caused_afraid_when;
$new_gbv->past_12_threatened_humiliated_caused_afraid_by_whom = request()->past_12_threatened_humiliated_caused_afraid_by_whom;
$new_gbv->past_12_prevented_coming_clinic_medication_treatment = request()->past_12_prevented_coming_clinic_medication_treatment;
$new_gbv->past_12_any_threatened_or_harmed = request()->past_12_any_threatened_or_harmed;
$new_gbv->past_12_any_touched_private_parts_not_want = request()->past_12_any_touched_private_parts_not_want;
$new_gbv->past_12_any_forced_sex = request()->past_12_any_forced_sex;
$new_gbv->past_12_any_refused_condom_when_wanted = request()->past_12_any_refused_condom_when_wanted;
$new_gbv->created_by = request()->created_by;
$new_gbv->others = request()->others;
$new_gbv->created_by = request()->updated_by;
$new_gbv->save();
}
}
@@ -54,7 +77,60 @@ class TriageObserver
*/
public function updated(Triage $triage): void
{
//
if (request()->is_hiv_screening_tool_enabled) {
$got_new = HivGenderBaseViolence::where('triage_id', $triage->id)->first();
$got_new->triage_id = $triage->id;
$got_new->patient_id = $triage->patient_id;
$got_new->mother_hiv_positive = request()->mother_hiv_positive ?? $got_new->mother_hiv_positive;
$got_new->has_been_sick_last_3_months = request()->has_been_sick_last_3_months ?? $got_new->has_been_sick_last_3_months;
$got_new->has_recurring_skin_problem = request()->has_recurring_skin_problem ?? $got_new->has_recurring_skin_problem;
$got_new->has_lost_weight_last_3_months = request()->has_lost_weight_last_3_months ?? $got_new->has_lost_weight_last_3_months;
$got_new->has_had_tb = request()->has_had_tb ?? $got_new->has_had_tb;
$got_new->is_growing_well = request()->is_growing_well ?? $got_new->is_growing_well;
$got_new->tested_for_hiv_in_past_12_months = request()->tested_for_hiv_in_past_12_months ?? $got_new->tested_for_hiv_in_past_12_months;
$got_new->had_tb_or_presumptive_tb = request()->had_tb_or_presumptive_tb ?? $got_new->had_tb_or_presumptive_tb;
$got_new->sti_symptoms_present = request()->sti_symptoms_present ?? $got_new->sti_symptoms_present;
$got_new->diagnosed_with_hepatitis_b_or_c = request()->diagnosed_with_hepatitis_b_or_c ?? $got_new->diagnosed_with_hepatitis_b_or_c;
$got_new->experienced_or_caused_sexual_violence = request()->experienced_or_caused_sexual_violence ?? $got_new->experienced_or_caused_sexual_violence;
$got_new->reactive_hiv_self_test_result = request()->reactive_hiv_self_test_result ?? $got_new->reactive_hiv_self_test_result;
$got_new->identified_through_index_client = request()->identified_through_index_client ?? $got_new->identified_through_index_client;
$got_new->exposed_to_hiv_positive_or_unknown_source = request()->exposed_to_hiv_positive_or_unknown_source ?? $got_new->exposed_to_hiv_positive_or_unknown_source;
$got_new->hiv_symptoms_without_recent_test = request()->hiv_symptoms_without_recent_test ?? $got_new->hiv_symptoms_without_recent_test;
$got_new->tested_for_hiv_last_3_months = request()->tested_for_hiv_last_3_months ?? $got_new->tested_for_hiv_last_3_months;
$got_new->tested_for_hiv_last_12_months = request()->tested_for_hiv_last_12_months ?? $got_new->tested_for_hiv_last_12_months;
$got_new->unprotected_sex_with_partner_of_unknown_hiv_status = request()->unprotected_sex_with_partner_of_unknown_hiv_status ?? $got_new->unprotected_sex_with_partner_of_unknown_hiv_status;
$got_new->unprotected_sex_with_hiv_positive_partner = request()->unprotected_sex_with_hiv_positive_partner ?? $got_new->unprotected_sex_with_hiv_positive_partner;
$got_new->shared_needles_or_piercing_objects = request()->shared_needles_or_piercing_objects ?? $got_new->shared_needles_or_piercing_objects;
$got_new->experienced_threats_in_past_12_months = request()->experienced_threats_in_past_12_months ?? $got_new->experienced_threats_in_past_12_months;
$got_new->prevented_from_accessing_healthcare_in_past_12_months = request()->prevented_from_accessing_healthcare_in_past_12_months ?? $got_new->prevented_from_accessing_healthcare_in_past_12_months;
$got_new->experienced_physical_violence_in_past_12_months = request()->experienced_physical_violence_in_past_12_months ?? $got_new->experienced_physical_violence_in_past_12_months;
$got_new->experienced_unwanted_touching_of_private_parts_in_past_12_months = request()->experienced_unwanted_touching_of_private_parts_in_past_12_months ?? $got_new->experienced_unwanted_touching_of_private_parts_in_past_12_months;
$got_new->experienced_forced_sex_in_past_12_months = request()->experienced_forced_sex_in_past_12_months ?? $got_new->experienced_forced_sex_in_past_12_months;
$got_new->experienced_condom_refusal_in_past_12_months = request()->experienced_condom_refusal_in_past_12_months ?? $got_new->experienced_condom_refusal_in_past_12_months;
$got_new->save();
}
if (request()->is_gbv_screening_tool_enabled) {
$got_gbv = GenderBasedViolence::where('triage_id', $triage->id)->first();
$got_gbv->triage_id = $triage->id;
$got_gbv->patient_id = $triage->patient_id;
$got_gbv->child_feeling_unsafe = request()->child_feeling_unsafe ?? $got_gbv->child_feeling_unsafe;
$got_gbv->past_12_threatened_humiliated_caused_afraid_when = request()->past_12_threatened_humiliated_caused_afraid_when ?? $got_gbv->past_12_threatened_humiliated_caused_afraid_when;
$got_gbv->past_12_threatened_humiliated_caused_afraid_by_whom = request()->past_12_threatened_humiliated_caused_afraid_by_whom ?? $got_gbv->past_12_threatened_humiliated_caused_afraid_by_whom;
$got_gbv->past_12_prevented_coming_clinic_medication_treatment = request()->past_12_prevented_coming_clinic_medication_treatment ?? $got_gbv->past_12_prevented_coming_clinic_medication_treatment;
$got_gbv->past_12_any_threatened_or_harmed = request()->past_12_any_threatened_or_harmed ?? $got_gbv->past_12_any_threatened_or_harmed;
$got_gbv->past_12_any_touched_private_parts_not_want = request()->past_12_any_touched_private_parts_not_want ?? $got_gbv->past_12_any_touched_private_parts_not_want;
$got_gbv->past_12_any_forced_sex = request()->past_12_any_forced_sex ?? $got_gbv->past_12_any_forced_sex;
$got_gbv->past_12_any_refused_condom_when_wanted = request()->past_12_any_refused_condom_when_wanted ?? $got_gbv->past_12_any_refused_condom_when_wanted;
$got_gbv->created_by = request()->created_by ?? $got_gbv->created_by;
$got_gbv->others = request()->others ?? $got_gbv->others;
$got_gbv->created_by = request()->updated_by;
$got_gbv->save();
}
}
/**
@@ -4,13 +4,12 @@ namespace Streamline\Providers;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use App;
use Streamline\Models\HospitalInformation;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\ServiceProvider;
use Streamline\Models\Triage;
use Streamline\Observers\TriageObserver;
use Streamline\Services\StreamlineSetupService;
use Streamline\Services\StreamlineSetupServiceInterface;
class AppServiceProvider extends ServiceProvider {
@@ -22,19 +21,6 @@ class AppServiceProvider extends ServiceProvider {
public function boot() {
Schema::defaultStringLength(191);
App::singleton('hospital_information', function() {
$hospital_information = HospitalInformation::first();
return $hospital_information;
});
App::singleton('message_board', function() {
$messages = DB::table('message_board')
->orderBy('id', 'desc')
->limit(15)
->paginate(3);
return $messages;
});
Paginator::useBootstrapThree();
// for old DBs with Streamline\User
@@ -50,8 +36,9 @@ class AppServiceProvider extends ServiceProvider {
*
* @return void
*/
public function register() {
//
public function register(): void
{
$this->app->bind(StreamlineSetupServiceInterface::class, StreamlineSetupService::class);
}
}
@@ -13,7 +13,7 @@ class AuthServiceProvider extends ServiceProvider
* @var array
*/
protected $policies = [
'Streamline\Model' => 'Streamline\Policies\ModelPolicy',
// 'Streamline\Model' => 'Streamline\Policies\ModelPolicy',
];
/**
@@ -0,0 +1,23 @@
<?php
namespace Streamline\Services;
use Illuminate\Support\Facades\Auth;
use Streamline\Models\TrackReceipt;
class ReceiptService
{
public function __construct()
{
}
public function createReceipt(string $reason): string
{
$track_receipt = new TrackReceipt;
$track_receipt->reason = $reason;
$track_receipt->created_by = Auth::id();
$track_receipt->save();
return sprintf("%04u", $track_receipt->id);
}
}
@@ -0,0 +1,24 @@
<?php
namespace Streamline\Services;
use Streamline\Models\StreamlineSetupStep;
class StreamlineSetupService implements StreamlineSetupServiceInterface
{
public function __construct(){}
public function saveStep($name, $status): bool
{
$streamline_setup = new StreamlineSetupStep;
$streamline_setup->step = "clinics registration";
$streamline_setup->completion_status = 1;
try {
$streamline_setup->save();
return true;
} catch (\Exception $exception) {
return false;
}
}
}
@@ -0,0 +1,10 @@
<?php
namespace Streamline\Services;
interface StreamlineSetupServiceInterface
{
public function __construct();
public function saveStep($name, $status): bool;
}
@@ -0,0 +1,17 @@
<?php
namespace Streamline\Services;
use Illuminate\Support\Facades\DB;
class UserService
{
public function pluckUserFullName(): array
{
return DB::table('users')
->whereNull('deleted_at')
->select(DB::raw('CONCAT(first_name, " ", last_name) AS full_name, id'))
->orderBy('first_name','asc')
->pluck('full_name', 'id')->toArray();
}
}