mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 03:31:31 +00:00
updated streamline-setup v2
This commit is contained in:
+127
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Patients\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\Allergy;
|
||||
use Streamline\Models\Patient;
|
||||
use Streamline\Models\DrugCategory;
|
||||
use Streamline\Models\PatientDocument;
|
||||
use Streamline\Models\Alert;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AllergiesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$patient_id = session()->get('patient_id');
|
||||
$patient = Patient::find($patient_id);
|
||||
$categories = DB::table('patient_categories')->where('available', 1)->pluck("name", "id");
|
||||
$marital_statuses = DB::table('marital_statuses')->pluck("name", "id");
|
||||
$diagnoses = DB::table('diagnoses')->where('available', 1)->pluck("name", "id");
|
||||
$clinics = DB::table('clinics')->pluck("name", "id");
|
||||
$relationships = DB::table('family_relations')->pluck('name', 'id');
|
||||
$occupations = DB::table('occupations')->pluck('name', 'id');
|
||||
$patient_categories = DB::table('patient_categories')->where('available', 1)->pluck('name', 'id');
|
||||
$districts = DB::table('districts')->pluck('name', 'id');
|
||||
$counties = DB::table('counties')->pluck('name', 'id');
|
||||
$subcounties = DB::table('subcounties')->pluck('name', 'id');
|
||||
$parishes = DB::table('parishes')->pluck('name', 'id');
|
||||
$villages = DB::table('villages')->pluck('name', 'id');
|
||||
$drug_categories = DrugCategory::orderBy('name', 'asc')->get();
|
||||
$documents = PatientDocument::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->take(2)->get();
|
||||
$known_patient_alerts = Alert::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->take(2)->get();
|
||||
$known_patient_allergies = Allergy::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->get();
|
||||
$drug_categories_array = DB::table('drug_categories')->pluck('name', 'id');
|
||||
$drug_categories = DrugCategory::orderBy('name', 'asc')->get();
|
||||
return view('patients::allergies.index',compact('patient','known_patient_allergies','drug_categories_array','categories','drug_categories','relationships', 'occupations', 'patient_categories', 'diagnoses', 'categories', 'marital_statuses', 'districts', 'counties', 'subcounties', 'parishes', 'villages', 'drug_categories', 'documents', 'known_patient_alerts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/*
|
||||
* Add allergic drugs to a particular patient
|
||||
*/
|
||||
public function store_patient_allergies(Request $request)
|
||||
{
|
||||
$patient_id = $request->allergy_patient_id;
|
||||
$patient_allergies_array = $request->patient_allergies;
|
||||
$allergies_string = implode(',', $patient_allergies_array);
|
||||
|
||||
$existing_allergy = Allergy::where(['patient_id' => $patient_id])->first();
|
||||
$allergy = is_null($existing_allergy) ? new Allergy : $existing_allergy;
|
||||
$allergy->patient_id = $patient_id;
|
||||
$allergy->names = $allergies_string;
|
||||
$save_allergy = is_null($existing_allergy) ? $allergy->save() : $allergy->update(); /* if new patient allergy then insert else update the db table*/
|
||||
return $request->all();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user