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
+2
View File
@@ -33,3 +33,5 @@ MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
DOCKER_ACTIVE=false
File diff suppressed because it is too large Load Diff
@@ -37,8 +37,17 @@ class NutritionController extends Controller {
foreach($data as $item) {
$split_item = explode(',', $item);
$lengths[] = +$split_item[0];
$formatted_data[+$split_item[0]] = [+$split_item[1], +$split_item[2], +$split_item[3], +$split_item[4], +str_replace(["\r", "\n"], "", $split_item[5])];
$lengths[] = intval($split_item[0]);
$formatted_data[intval($split_item[0])] = [intval($split_item[1]), intval($split_item[2]), intval($split_item[3]), intval($split_item[4]), intval(str_replace(["\r", "\n"], "", $split_item[5]))];
}
// check if height is out of bounds
if ($height < $lengths[0] || $height > $lengths[count($lengths) - 1]) {
$text = "Nutrition Status Not Available";
$reason = "Height is out of range";
$text_color = "red";
return $text . "&&&&" . $reason . "&&&&" . $text_color;
}
$reference_height = get_closest_element_in_array($lengths, $height);
@@ -82,8 +91,8 @@ class NutritionController extends Controller {
foreach($data as $item) {
$split_item = explode(',', $item);
$ages_in_months[] = +$split_item[0];
$formatted_data[+$split_item[0]] = [+$split_item[1], +$split_item[2], +$split_item[3], +$split_item[4], +str_replace(["\r", "\n"], "", $split_item[5])];
$ages_in_months[] = intval($split_item[0]);
$formatted_data[intval($split_item[0])] = [intval($split_item[1]), intval($split_item[2]), intval($split_item[3]), intval($split_item[4]), intval(str_replace(["\r", "\n"], "", $split_item[5]))];
}
$reference_age = get_closest_element_in_array($ages_in_months, $age_diff_months);
File diff suppressed because it is too large Load Diff
@@ -80,39 +80,40 @@ class PatientDocumentController extends Controller {
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request) {
$validator = Validator::make($request->all(), [
'documenttitle' => 'required',
request()->validate([
'documenttitle' => 'required'
]);
if ($validator->fails()) {
$string = "";
foreach ($validator->errors()->getMessages() as $item) {
$string .= "{$item[0]}<br>";
}
return back()->withErrors($validator)->withInput();
$patient_document = new PatientDocument;
$patient_document->patient_id = session()->get('patient_id');
$patient_document->episode_id = session()->get('episode_id');
$patient_document->title = $request->documenttitle;
$patient_document->description = $request->description;
if ($request->file('document')->isValid()) {
$file = $request->file('document');
$store = public_path() . '/uploads/patient-documents/';
$file_name = $file->getClientOriginalName();
$file->move($store, $file_name);
$patient_document->path = public_path() . '/uploads/patient-documents/' . $file_name;
}
$patient_document->date_taken = \Carbon\Carbon::createFromFormat('d/m/Y', $request->documentdate)->toDateString();
$patient_document->created_by = auth()->user()->id;
$patient_document->úpdated_by = auth()->user()->id;
$patient_document->save();
flash("document has been added.")->success();
// redirect to consultation or patient_episode page depending on where the user is from
if (session()->has('redirect_to_consultation')) {
$url = session()->get('redirect_to_consultation');
session()->forget('redirect_to_consultation');
return redirect($url);
} else {
$patient_document = new PatientDocument;
$patient_document->patient_id = session()->get('patient_id');
$patient_document->episode_id = session()->get('episode_id');
$patient_document->title = $request->documenttitle;
$patient_document->description = $request->description;
if ($request->file('document')->isValid()) {
$file = $request->file('document');
$store = public_path() . '/uploads/patient-documents/';
$file_name = $file->getClientOriginalName();
$file->move($store, $file_name);
$patient_document->path = public_path() . '/uploads/patient-documents/' . $file_name;
}
$patient_document->date_taken = \Carbon\Carbon::createFromFormat('d/m/Y', $request->documentdate)->toDateString();
$patient_document->created_by = auth()->user()->id;
$patient_document->úpdated_by = auth()->user()->id;
$patient_document->save();
flash("document has been added.")->success();
return redirect('/patient_episodes');
return redirect("/patient_episodes");
}
}
@@ -9,6 +9,9 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Streamline\Models\Alert;
use Streamline\Models\Allergy;
use Streamline\Models\EmergencySign;
use Streamline\Models\EyeClinicBaseExamRefraction;
use Streamline\Models\EyeClinicMainExam;
use Streamline\Models\HospitalInformation;
use Streamline\Models\Investigation;
use Streamline\Models\InvestigationResults;
@@ -27,7 +30,10 @@ use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;
use Illuminate\Support\Facades\Session;
use Streamline\Models\PrioritySign;
use Streamline\Models\ServiceDeposit;
use Streamline\Models\SlitLampTestArea;
use Streamline\Models\SlitLampTestAreaValue;
use Streamline\Models\StaffPerformedService;
use Streamline\Models\Sundry;
use Streamline\Models\Treatment;
@@ -38,9 +44,11 @@ use Streamline\Models\Consultation;
use Streamline\Models\OrderedSundry;
use Streamline\Models\Services;
class PatientEpisodeController extends Controller {
class PatientEpisodeController extends Controller
{
public function __construct() {
public function __construct()
{
$this->middleware('auth');
}
@@ -49,15 +57,16 @@ class PatientEpisodeController extends Controller {
*
* @return \Illuminate\Http\Response
*/
public function index() {
public function index()
{
$patient_id = session()->get('patient_id');
$patient_episodes = DB::table('patient_episodes')
->where(['patient_id' => $patient_id])
->whereNull('deleted_at')
->orderBy('id', 'desc')
->get();
->where(['patient_id' => $patient_id])
->whereNull('deleted_at')
->orderBy('id', 'desc')
->get();
$patient = Patient::where(['id' => $patient_id])->first();
$categories = DB::table('patient_categories')->where('available', 1)->pluck("name", "id");
$marital_statuses = DB::table('marital_statuses')->pluck("name", "id");
@@ -79,33 +88,33 @@ class PatientEpisodeController extends Controller {
//$special_clinics = DB::table('clinics')->where('slug', '!=', 'general')->pluck("name", "id")->prepend('GENERAL OPD', 'general_opd')->prepend('- select -', '');
$special_clinics = DB::table('clinics')->where('available', 1)->whereNull('deleted_at')->pluck("name", "id")->prepend('- select -', '');
$wards = DB::table('wards')->where('available', 1)->whereNull('deleted_at')->pluck("name", "id")->prepend('- select -', '');
$users_collection = DB::table('users')->orderBy("first_name","asc")->select("id")->get()->toArray();
$users_collection = DB::table('users')->orderBy("first_name", "asc")->select("id")->get()->toArray();
$users_array = [];
foreach ($users_collection as $value){
foreach ($users_collection as $value) {
$user = User::find($value->id);
if (!is_null($user)) {
if ($user->hasRole('Doctors') || $user->hasRole('Doctor')) {
$consultation_records = DB::table('services')
->join('staff_payment_configurations','staff_payment_configurations.item_id', '=', 'services.id')
->where('services.item_type', 'Consultation')
->where('staff_payment_configurations.user_id',$value->id)
->where('staff_payment_configurations.item_category',3)
->whereNull('staff_payment_configurations.deleted_at')
->orderBy('staff_payment_configurations.created_at','asc')
->select('services.*')
->get();
->join('staff_payment_configurations', 'staff_payment_configurations.item_id', '=', 'services.id')
->where('services.item_type', 'Consultation')
->where('staff_payment_configurations.user_id', $value->id)
->where('staff_payment_configurations.item_category', 3)
->whereNull('staff_payment_configurations.deleted_at')
->orderBy('staff_payment_configurations.created_at', 'asc')
->select('services.*')
->get();
foreach ($consultation_records as $record) {
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_id) {
$users_consultation_fee = get_price_list_category_price($price_list_id, 6, $record->id);
} else{
} else {
$users_consultation_fee = $record->non_insured_price;
}
//concatnate the service_record_id with the users id to form the key for the array
$users_array[$record->id."__".$value->id] = get_full_name($value->id, 'id', 'first_name', 'last_name', 'users')." (".$record->name." Fee: ".ugandan_shillings($users_consultation_fee).")";
$users_array[$record->id . "__" . $value->id] = get_full_name($value->id, 'id', 'first_name', 'last_name', 'users') . " (" . $record->name . " Fee: " . ugandan_shillings($users_consultation_fee) . ")";
}
}
}
@@ -119,7 +128,8 @@ class PatientEpisodeController extends Controller {
* Show the form for creating a new resource.
*
*/
public function create() {
public function create()
{
//
}
@@ -127,7 +137,8 @@ class PatientEpisodeController extends Controller {
* Store a newly created resource in storage.
*
*/
public function store(Request $request) {
public function store(Request $request)
{
//
}
@@ -135,7 +146,8 @@ class PatientEpisodeController extends Controller {
* Display the specified resource.
*
*/
public function show($id) {
public function show($id)
{
//
}
@@ -143,18 +155,20 @@ class PatientEpisodeController extends Controller {
* Show the form for editing the specified resource.
*
*/
public function edit($id) {
public function edit($id)
{
//
}
public function update(Request $request, $id) {
public function update(Request $request, $id)
{
/* Update Claim Number */
$episode = PatientEpisode::find($id);
$episode->claim_number = $request->claim_number;
$episode->save();
if(session()->get('edit_claim_number') == 'patient_home'){
if (session()->get('edit_claim_number') == 'patient_home') {
return redirect()->route('patient_episodes.index');
}else{
} else {
return redirect()->route('patient_finance.home');
}
}
@@ -163,7 +177,8 @@ class PatientEpisodeController extends Controller {
* Remove the specified resource from storage.
*
*/
public function destroy($id) {
public function destroy($id)
{
//
}
@@ -171,11 +186,13 @@ class PatientEpisodeController extends Controller {
* Create new episode for a patient.
*
*/
public function create_episode(Request $request) {
public function create_episode(Request $request)
{
$logged_in_user_id = Auth()->user()->id;
$episode = new PatientEpisode;
$episode->patient_id = $request->patient_id;
$episode->clinic_id = get_default_hospital_clinic();
$episode->created_by = $logged_in_user_id;
$episode->updated_by = $logged_in_user_id;
@@ -206,7 +223,8 @@ class PatientEpisodeController extends Controller {
* @param int $id
* @return \Illuminate\Http\Response
*/
public function set_patient_id($id) {
public function set_patient_id($id)
{
session()->put('patient_id', $id);
return redirect('/patient_episodes/');
@@ -218,7 +236,8 @@ class PatientEpisodeController extends Controller {
* @param int $id
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function route_patient_episode(Request $request) {
public function route_patient_episode(Request $request)
{
//set session for episode_id
session()->put('episode_id', $request->episode_id);
@@ -226,82 +245,63 @@ class PatientEpisodeController extends Controller {
switch ($request->submit) {
case 'triage':
session()->put('triage_without_etat', 0);
return redirect('/triage/');
break;
case 'triage_without_etat':
return redirect('/triage/create_without_etat');
break;
session()->put('triage_without_etat', 1);
return redirect('/triage/');
case 'investigations':
return redirect('/investigations/investigations_review');
break;
case 'consultation':
if ($is_patient_allowed_to_do_consultation == false) {
session()->put('consultation_not_paid', 'consultation_not_paid');
return redirect()->back()->withInput();
}
session()->put('consultation_with_notes', 0);
return redirect('/consultation/route');
break;
case 'consultation_with_notes':
if ($is_patient_allowed_to_do_consultation == false) {
session()->put('consultation_not_paid', 'consultation_not_paid');
return redirect()->back()->withInput();
}
return redirect('/consultation/create_with_notes');
break;
session()->put('consultation_with_notes', 1);
return redirect('/consultation/route');
case 'procedure':
return redirect('/order_procedures');
break;
case 'sundries':
return redirect('/order_sundries');
break;
case 'create_anaesthetics':
return redirect('anaesthetics/create');
break;
case 'create_surgery':
return redirect('theatre_surgery/create');
break;
case 'anaesthetics_history':
return redirect('anaesthetics/history');
break;
case 'surgery_index':
return redirect('theatre_surgery');
break;
case 'inpatient-sheet-button':
case 'maternity_summary':
return redirect('in_patient_sheet');
break;
case 'inpatient_billing':
return redirect('inpatient_billing');
break;
case 'patient_document':
return redirect('patient_documents/create');
break;
case 'death_report_btn':
return redirect('reports/nira/death');
break;
case 'eye_clinic':
return redirect('/eye_clinic/');
break;
case 'drug_refill':
session()->forget('alter_episode_id');
session()->forget('alter_patient_id');
return redirect('drug_refill');
break;
case 'services':
return redirect('order_services');
break;
case 'edit_claim_number':
session()->put(['edit_claim_number' => 'patient_home']);
return redirect('edit_claim_number');
break;
case 'prescription':
session()->forget('alter_episode_id');
session()->forget('alter_patient_id');
return redirect('/prescriptions/create/');
break;
case 'record_all_items':
return redirect('record_staff_service_performance');
break;
case 'maternity_admission':
return redirect('maternity_inpatient_sheet');
case 'delivery_record':
@@ -310,19 +310,29 @@ class PatientEpisodeController extends Controller {
return redirect('/reports/nira/birth');
case 'inpatient_attendant_pass':
return redirect('inpatient_attendant_pass');
break;
case 'main_exam':
return redirect('/eye_clinic/main_exam_route');
case 'base_refraction_exam':
return redirect('/eye_clinic/base_exam_refraction');
case 'eye_glasses':
return redirect('/eye_glasses/order');
case 'treatment_sheet':
session()->put(['treatment_sheet_route' => 'patient_home']);
return redirect('treatment_sheet/view');
default:
return redirect('/patient_episodes/');
}
}
public function edit_claim_number() {
public function edit_claim_number()
{
$episode_id = session()->get('episode_id');
$episode = PatientEpisode::find($episode_id);
return view('patients::patient_episodes.edit_claim_number', compact('episode', 'episode_id'));
}
public function internal_clinic_transfer($id) {
public function internal_clinic_transfer($id)
{
// get triage id
$triage = Triage::where('episode_id', $id)->first();
$consultation = Consultation::where('episode_id', $id)->first();
@@ -330,20 +340,21 @@ class PatientEpisodeController extends Controller {
if ($triage) {
if ($consultation) {
return $triage->id . "," . $triage->clinic_allocation . "," . get_name($triage->clinic_allocation, 'id', 'name', 'clinics') . ",". $consultation->consultation_done_by. ",". $triage->patient_id;
return $triage->id . "," . $triage->clinic_allocation . "," . get_name($triage->clinic_allocation, 'id', 'name', 'clinics') . "," . $consultation->consultation_done_by . "," . $triage->patient_id;
}
return $triage->id . "," . $triage->clinic_allocation . "," . get_name($triage->clinic_allocation, 'id', 'name', 'clinics'). ",". 0 . ",". $triage->patient_id; //no doctor was allocated so it is zero
return $triage->id . "," . $triage->clinic_allocation . "," . get_name($triage->clinic_allocation, 'id', 'name', 'clinics') . "," . 0 . "," . $triage->patient_id; //no doctor was allocated so it is zero
} elseif ($episode_details && !is_null($episode_details->clinic_id)) {
if ($consultation) {
return 0 . "," . $episode_details->clinic_id . "," . get_name($episode_details->clinic_id, 'id', 'name', 'clinics') . ",". $consultation->consultation_done_by. ",". $episode_details->patient_id;
return 0 . "," . $episode_details->clinic_id . "," . get_name($episode_details->clinic_id, 'id', 'name', 'clinics') . "," . $consultation->consultation_done_by . "," . $episode_details->patient_id;
}
return 0 . "," . $episode_details->clinic_id . "," . get_name($episode_details->clinic_id, 'id', 'name', 'clinics') . ",". 0 . ",". $episode_details->patient_id;
return 0 . "," . $episode_details->clinic_id . "," . get_name($episode_details->clinic_id, 'id', 'name', 'clinics') . "," . 0 . "," . $episode_details->patient_id;
} else {
return 0;
}
}
public function save_internal_clinic_transfer(Request $request) {
public function save_internal_clinic_transfer(Request $request)
{
$transfered_to_doctor = null;
$transfered_from_doctor = null;
@@ -384,7 +395,7 @@ class PatientEpisodeController extends Controller {
}
if ($request->transfer_to_doctor) {
$consultation = Consultation::where(['patient_id'=> $patient_id, 'episode_id' => $episode_id])->first();
$consultation = Consultation::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->first();
if ($consultation) {
// first, check if there is a previously ordered service attached to current doctor
$already_ordered_service = OrderedService::where('performed', 1)
@@ -416,8 +427,14 @@ class PatientEpisodeController extends Controller {
$consultation_record->save();
// create new ordered service record
$service_performed_id = record_staff_that_has_performed_the_service($patient_id, $episode_id, 3,
$allocated_service_id, 0, $request->transfer_to_doctor);
$service_performed_id = record_staff_that_has_performed_the_service(
$patient_id,
$episode_id,
3,
$allocated_service_id,
0,
$request->transfer_to_doctor
);
$service_order = new OrderedService;
$service_order->patient_id = $patient_id;
@@ -441,7 +458,8 @@ class PatientEpisodeController extends Controller {
}
}
public function select_patient_create_session_variables(Request $request) {
public function select_patient_create_session_variables(Request $request)
{
if (isset($request->ward_id)) {
session()->put(['ward_id' => $request->ward_id]);
session()->put(['date' => $request->date]);
@@ -477,10 +495,10 @@ class PatientEpisodeController extends Controller {
session()->put(['episode_id' => $last_inserted_id]);
flash("Patient has been allocated to ".$clinic_name)->success();
flash("Patient has been allocated to " . $clinic_name)->success();
$clinic_slug = get_name($clinic_id, "id", "slug", "clinics");
if ($clinic_slug == "art"){
if ($clinic_slug == "art") {
//return redirect("hiv_menu");
}
@@ -517,6 +535,7 @@ class PatientEpisodeController extends Controller {
$episode = new PatientEpisode;
$episode->patient_id = $request->patient_id;
$episode->clinic_id = get_default_hospital_clinic();
$episode->created_by = $logged_in_user_id;
$episode->updated_by = $logged_in_user_id;
$ward_id = $request->admission_ward_id;
@@ -538,7 +557,7 @@ class PatientEpisodeController extends Controller {
$inpatient->created_at = Carbon::now();
$inpatient->save();
flash("Patient admitted in ".$ward_name)->success();
flash("Patient admitted in " . $ward_name)->success();
return redirect('/patient_episodes/');
} catch (QueryException $e) {
$errorCode = $e->errorInfo[1];
@@ -549,7 +568,8 @@ class PatientEpisodeController extends Controller {
}
}
public function admit_patient_with_episode(Request $request) {
public function admit_patient_with_episode(Request $request)
{
$ward_id = $request->admission_ward_id;
$admitted_on = $request->ward_admission_date;
$ward_name = get_name($ward_id, 'id', 'name', 'wards');
@@ -564,7 +584,7 @@ class PatientEpisodeController extends Controller {
//$inpatient->created_at = Carbon::now();
$inpatient->save();
flash("The patient has been admitted in ".$ward_name)->success();
flash("The patient has been admitted in " . $ward_name)->success();
return redirect('/patient_episodes/');
}
@@ -580,6 +600,7 @@ class PatientEpisodeController extends Controller {
$episode = new PatientEpisode;
$episode->patient_id = $request->patient_id;
$episode->clinic_id = get_default_hospital_clinic();
$episode->created_by = $logged_in_user_id;
$episode->updated_by = $logged_in_user_id;
@@ -590,7 +611,7 @@ class PatientEpisodeController extends Controller {
session()->put(['episode_id' => $last_inserted_id]);
flash("Patient has been allocated to ".$allocated_persons_name)->success();
flash("Patient has been allocated to " . $allocated_persons_name)->success();
/* create a record in consultations table attached to allocated doctor */
$consultation_record = new Consultation;
@@ -602,8 +623,14 @@ class PatientEpisodeController extends Controller {
$consultation_record->save();
// create new ordered service record
$service_performed_id = record_staff_that_has_performed_the_service($episode->patient_id, $last_inserted_id, 3,
$allocated_service_id, 0, $allocated_user_id);
$service_performed_id = record_staff_that_has_performed_the_service(
$episode->patient_id,
$last_inserted_id,
3,
$allocated_service_id,
0,
$allocated_user_id
);
$service_order = new OrderedService;
$service_order->patient_id = $episode->patient_id;
@@ -667,8 +694,14 @@ class PatientEpisodeController extends Controller {
$consultation_record->save();
// create new ordered service record
$service_performed_id = record_staff_that_has_performed_the_service($episode->patient_id, $last_inserted_id, 3,
$allocated_service_id, 0, $allocated_user_id);
$service_performed_id = record_staff_that_has_performed_the_service(
$episode->patient_id,
$last_inserted_id,
3,
$allocated_service_id,
0,
$allocated_user_id
);
$service_order = new OrderedService;
$service_order->patient_id = $episode->patient_id;
@@ -690,7 +723,7 @@ class PatientEpisodeController extends Controller {
/**********************/
$clinic_slug = get_name($clinic_id, "id", "slug", "clinics");
if ($clinic_slug == "art"){
if ($clinic_slug == "art") {
//return redirect("hiv_menu");
}
@@ -712,7 +745,7 @@ class PatientEpisodeController extends Controller {
session()->put(['episode_id' => $last_inserted_id]);
flash("Patient has been allocated to ".$allocated_persons_name)->success();
flash("Patient has been allocated to " . $allocated_persons_name)->success();
return redirect('/patient_episodes/');
} catch (QueryException $e) {
@@ -724,11 +757,13 @@ class PatientEpisodeController extends Controller {
}
}
public function create_episode_with_lab_self_request(Request $request) {
public function create_episode_with_lab_self_request(Request $request)
{
$logged_in_user_id = auth()->user()->id;
$episode = new PatientEpisode;
$episode->patient_id = $request->patient_id;
$episode->clinic_id = get_default_hospital_clinic();
$episode->episode_type = 1; //self lab request episode
$episode->created_by = $logged_in_user_id;
$episode->updated_by = $logged_in_user_id;
@@ -748,9 +783,24 @@ class PatientEpisodeController extends Controller {
}
}
public function episode_summary($episode_id) {
public function episode_summary($episode_id)
{
$patient_id = session()->get('patient_id');
if(is_eye_module_enabled() && is_patient_in_eye_clinic($episode_id)) {
$main_exam = EyeClinicMainExam::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->first();
$base_exam = EyeClinicBaseExamRefraction::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->first();
$slit_lamp_test_areas = SlitLampTestArea::all();
$slit_lamp_test_area_values = SlitLampTestAreaValue::pluck('name', 'id')->toArray();
$slit_lamp_test_area_ids = SlitLampTestAreaValue::pluck('id')->toArray();
} else {
$main_exam = false;
$base_exam = false;
$slit_lamp_test_areas = [];
$slit_lamp_test_area_values = [];
$slit_lamp_test_area_ids = [];
}
$priority_signs = $emergent_signs =[];
$patient = DB::table('patients')->find(session()->get('patient_id'));
$episode = PatientEpisode::find($episode_id);
$hospital_information = HospitalInformation::find(1);
@@ -778,6 +828,9 @@ class PatientEpisodeController extends Controller {
// get all results
$investigation_results_order_ids = InvestigationResults::pluck('order_id', 'id')->toArray();
$dateBorn = \Carbon\Carbon::parse($patient->date_of_birth);
$years = $dateBorn->diffInYears();
//triage details
$triage = null;
if ($episode && $episode->triage_id) {
@@ -786,6 +839,7 @@ class PatientEpisodeController extends Controller {
// get all symptoms
$symptoms = DB::table('symptoms')->where('available', 1)->pluck("name", "id");
foreach ($ordered_investigations as $investigation) {
$investigation_ids = explode(",", $investigation->investigation_id);
$inpatient_status = explode(",", $investigation->for_inpatient);
@@ -812,6 +866,13 @@ class PatientEpisodeController extends Controller {
$opd_investigations['name'][] = $result->name;
$opd_investigations['value'][] = $investigation_results[$i];
$opd_investigations['comment'][] = $investigation_comments[$i];
if($result->range_type == 1) {
$opd_investigations['normal_ranges'][] = get_dynamic_normal_range($result->id, get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients'));
} else {
$opd_investigations['normal_ranges'][] = $result->normal_ranges;
}
$opd_investigations['type'][] = $result->type;
}
} else {
@@ -833,6 +894,13 @@ class PatientEpisodeController extends Controller {
$result = Investigation::where('id', $investigation_ids[$i])->first();
$opd_investigations['name'][] = $result->name;
$opd_investigations['value'][] = $investigation_results[$i];
if($result->range_type == 1) {
$opd_investigations['normal_ranges'][] = get_dynamic_normal_range($result->id, get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients'));
} else {
$opd_investigations['normal_ranges'][] = $result->normal_ranges;
}
$opd_investigations['comment'][] = $investigation_comments[$i];
$opd_investigations['type'][] = $result->type;
}
@@ -851,6 +919,13 @@ class PatientEpisodeController extends Controller {
$result = Investigation::where('id', $investigation_ids[$i])->first();
$opd_investigations['name'][] = $result->name;
$opd_investigations['value'][] = "Pending";
if($result->range_type == 1) {
$opd_investigations['normal_ranges'][] = get_dynamic_normal_range($result->id, get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients'));
} else {
$opd_investigations['normal_ranges'][] = $result->normal_ranges;
}
$opd_investigations['comment'][] = "Pending";
}
} else {
@@ -872,6 +947,13 @@ class PatientEpisodeController extends Controller {
$result = Investigation::where('id', $investigation_ids[$i])->first();
$opd_investigations['name'][] = $result->name;
$opd_investigations['value'][] = "Pending";
if($result->range_type == 1) {
$opd_investigations['normal_ranges'][] = get_dynamic_normal_range($result->id, get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients'));
} else {
$opd_investigations['normal_ranges'][] = $result->normal_ranges;
}
$opd_investigations['comment'][] = "Pending";
}
} else {
@@ -885,8 +967,33 @@ class PatientEpisodeController extends Controller {
}
}
}
if(between($years, 0, 12)) {
$priority_signs_records = PrioritySign::where('triage_id', $episode->triage_id)->first();
if ($priority_signs_records) {
$priority_signs = unserialize($priority_signs_records->signs);
}
$emergency_signs = EmergencySign::where('triage_id', $episode->triage_id)->first();
if (!empty($emergency_signs)) {
$airway = unserialize($emergency_signs->airway);
$circulation = unserialize($emergency_signs->circulation);
$neurological = unserialize($emergency_signs->neurological);
$dehydration = unserialize($emergency_signs->dehydration);
$emergencySigns= array_merge($airway,$circulation, $dehydration,$neurological);
foreach($emergencySigns as $key => $sign) if($sign == 'Yes') $emergent_signs[] = $key;
}
}
$data = [
'main_exam' => $main_exam,
'base_exam' => $base_exam,
'slit_lamp_test_areas' => $slit_lamp_test_areas,
'slit_lamp_test_area_values' => $slit_lamp_test_area_values,
'slit_lamp_test_area_ids' => $slit_lamp_test_area_ids,
'hospitalInfo' => $hospital_information,
'patient' => $patient,
'episode' => $episode,
@@ -900,13 +1007,17 @@ class PatientEpisodeController extends Controller {
'opd_investigations' => $opd_investigations,
'inpatient_infos' => $inpatient_infos,
'sundries' => $sundries,
'ordered_sundries'=>$ordered_sundries,
'services' =>$services,
'ordered_services'=>$ordered_services,
'ordered_sundries' => $ordered_sundries,
'services' => $services,
'ordered_services' => $ordered_services,
'outcomes' => $outcomes,
'antenatal_data' => $antenatal_data,
'symptoms'=> $symptoms
];
'symptoms'=> $symptoms,
'triage' =>$triage,
'priority_signs' => $priority_signs,
'emergent_signs'=> $emergent_signs,
'years'=>$years
];
$pdf = SnappyPDF::loadView('patients::patient_episodes/episode_summary', $data)
->setOrientation('portrait')
@@ -921,7 +1032,7 @@ class PatientEpisodeController extends Controller {
public function get_assigned_doctor($episode_id)
{
$patient_id = session()->get('patient_id');
$consultation = Consultation::where(['patient_id'=> $patient_id, 'episode_id' => $episode_id])->first();
$consultation = Consultation::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->first();
if ($consultation) {
$doctor_id = $consultation->consultation_done_by;
$doctor_name = get_full_name($doctor_id, "id", "first_name", "last_name", "users");
@@ -931,7 +1042,8 @@ class PatientEpisodeController extends Controller {
return 0;
}
public function save_doctor_transfer(Request $request) {
public function save_doctor_transfer(Request $request)
{
$patient_id = session()->get('patient_id');
$doctor_to_transfer_to = $request->dt_doctor_to;
$episode_id = $request->episode_id;
@@ -942,7 +1054,7 @@ class PatientEpisodeController extends Controller {
$allocated_service_id = $services_id_with_user_id_array[0];
$transfer_to_doctor = $services_id_with_user_id_array[1];
$consultation = Consultation::where(['patient_id'=> $patient_id, 'episode_id' => $request->episode_id])->first();
$consultation = Consultation::where(['patient_id' => $patient_id, 'episode_id' => $request->episode_id])->first();
if ($consultation) {
// first, check if there is a previously ordered service attached to current doctor
@@ -979,8 +1091,14 @@ class PatientEpisodeController extends Controller {
$episode_record = PatientEpisode::find($episode_id);
// create new ordered service record
$service_performed_id = record_staff_that_has_performed_the_service($patient_id, $episode_id, 3,
$allocated_service_id, 0, $transfer_to_doctor);
$service_performed_id = record_staff_that_has_performed_the_service(
$patient_id,
$episode_id,
3,
$allocated_service_id,
0,
$transfer_to_doctor
);
$service_order = new OrderedService;
$service_order->patient_id = $patient_id;
@@ -1026,12 +1144,12 @@ class PatientEpisodeController extends Controller {
// reassign the appointment_fulfilled to 1
$appointment->appointment_fulfilled = 1;
$appointment->updated_by = Auth()->user()->id;
if ($appointment->save()){
if ($appointment->save()) {
$episode = new PatientEpisode;
$episode->clinic_id = $selected_clinic_id;
$episode->patient_id = $patient_id;
$episode->parent_episode_id = $appointment->episode_id == 0 ? null : $appointment->episode_id;//the original episode_id
$episode->parent_episode_id = $appointment->episode_id == 0 ? null : $appointment->episode_id; //the original episode_id
$episode->created_by = auth()->user()->id;
$episode->updated_by = auth()->user()->id;
$episode->save();
@@ -1039,7 +1157,7 @@ class PatientEpisodeController extends Controller {
$last_inserted_id = $episode->id;
if ($services_id_with_user_id) {
$allocated_persons_name = get_full_name($allocated_user_id, "id","first_name","last_name","users");
$allocated_persons_name = get_full_name($allocated_user_id, "id", "first_name", "last_name", "users");
/* create a record in consultations table attached to allocated doctor */
$consultation_record = new Consultation;
$consultation_record->patient_id = $episode->patient_id;
@@ -1069,8 +1187,8 @@ class PatientEpisodeController extends Controller {
$previous_anc_visit = \Streamline\Models\AnteNatalClinicFollowup::where(['patient_id' => $episode->patient_id, 'episode_id' => $episode->parent_episode_id])->first();
if ($previous_anc_visit) {
create_anc_registration_record_from_previous_visit($patient_id, $episode->parent_episode_id, $episode->id);
}
}
// check where the function was called from and return there
if (isset($request->is_from_finance)) {
// return to finance home
@@ -1096,7 +1214,8 @@ class PatientEpisodeController extends Controller {
}
}
function delete_episode($episode_id) {
function delete_episode($episode_id)
{
$episode = PatientEpisode::find($episode_id);
// check if consultation record exists with that id
@@ -1118,48 +1237,48 @@ class PatientEpisodeController extends Controller {
$patient_id = session()->get('patient_id');
$patient = Patient::find($patient_id);
$episodes = PatientEpisode::where('patient_id', $patient_id)->orderBy('id','desc')->get();
$episodes = PatientEpisode::where('patient_id', $patient_id)->orderBy('id', 'desc')->get();
$diagnoses = DB::table('diagnoses')->where('available', 1)->pluck("name", "id");
$clinics = DB::table('clinics')->pluck("name", "id")->prepend('- select -', '');
$special_clinics = DB::table('clinics')->where('available', 1)->whereNull('deleted_at')->pluck("name", "id")->prepend('- select -', '');
$wards = DB::table('wards')->where('available', 1)->pluck("name", "id")->prepend('- select -', '');
$users_collection = DB::table('users')->orderBy("first_name","asc")->select("id")->get()->toArray();
$users_collection = DB::table('users')->orderBy("first_name", "asc")->select("id")->get()->toArray();
$users_array = [];
foreach ($users_collection as $value){
foreach ($users_collection as $value) {
$user = User::find($value->id);
if (!is_null($user)) {
if ($user->hasRole('Doctors') || $user->hasRole('Doctor')) {
//use this join query instead of the commented out query to cater for execution speed (N+1)
$consultation_records = DB::table('services')
->join('staff_payment_configurations','staff_payment_configurations.item_id', '=', 'services.id')
->where('services.item_type', 'Consultation')
->where('staff_payment_configurations.user_id',$value->id)
->where('staff_payment_configurations.item_category',3)
->whereNull('staff_payment_configurations.deleted_at')
->orderBy('staff_payment_configurations.created_at','asc')
->select('services.*')
->get();
->join('staff_payment_configurations', 'staff_payment_configurations.item_id', '=', 'services.id')
->where('services.item_type', 'Consultation')
->where('staff_payment_configurations.user_id', $value->id)
->where('staff_payment_configurations.item_category', 3)
->whereNull('staff_payment_configurations.deleted_at')
->orderBy('staff_payment_configurations.created_at', 'asc')
->select('services.*')
->get();
foreach ($consultation_records as $record) {
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_id) {
$users_consultation_fee = get_price_list_category_price($price_list_id, 6, $record->id);
} else{
} else {
$users_consultation_fee = $record->non_insured_price;
}
//concatnate the service_record_id with the users id to form the key for the array
$users_array[$record->id."__".$value->id] = get_full_name($value->id, 'id', 'first_name', 'last_name', 'users')." (".$record->name." Fee: ".ugandan_shillings($users_consultation_fee).")";
$users_array[$record->id . "__" . $value->id] = get_full_name($value->id, 'id', 'first_name', 'last_name', 'users') . " (" . $record->name . " Fee: " . ugandan_shillings($users_consultation_fee) . ")";
}
}
}
}
$users_array = ['' => '- select -'] + $users_array;
return view('patients::patient_episodes.merge_episodes',compact('patient', 'episodes', 'diagnoses', 'clinics', 'special_clinics', 'wards', 'users_array'));
return view('patients::patient_episodes.merge_episodes', compact('patient', 'episodes', 'diagnoses', 'clinics', 'special_clinics', 'wards', 'users_array'));
}
public function display_original_and_duplicate_episodes(Request $request)
@@ -1170,74 +1289,74 @@ class PatientEpisodeController extends Controller {
$episode_one = PatientEpisode::find($episode_id_one);
$html_text_one = "<table class='table table-bordered table-striped'>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><strong>Select which episode to keep</strong></th><td><input type='checkbox' name='all_original_fields' id='all_original_fields'> Episode started on <font color='blue'>". streamline_date_time($episode_one->created_at)."</font></td><input name='original_id' type='hidden' value='".$episode_one->id."'";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><strong>Select which episode to keep</strong></th><td><input type='checkbox' name='all_original_fields' id='all_original_fields'> Episode started on <font color='blue'>" . streamline_date_time($episode_one->created_at) . "</font></td><input name='original_id' type='hidden' value='" . $episode_one->id . "'";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Clinics</font></th><td><input type='radio' class='original_radio' name='clinic_id' value=". $episode_one->clinic_id."> " . get_name($episode_one->clinic_id, "id", "name", "clinics") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Clinics</font></th><td><input type='radio' class='original_radio' name='clinic_id' value=" . $episode_one->clinic_id . "> " . get_name($episode_one->clinic_id, "id", "name", "clinics") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Primary Diagnosis</font></th><td><input type='radio' class='original_radio' name='primary_diagnosis' value=". get_name($episode_one->consultation_id, 'id', 'primary_diagnosis', 'consultations')."> " . get_name(get_name($episode_one->consultation_id, "id", "primary_diagnosis", "consultations"), "id", "name", "diagnoses") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Primary Diagnosis</font></th><td><input type='radio' class='original_radio' name='primary_diagnosis' value=" . get_name($episode_one->consultation_id, 'id', 'primary_diagnosis', 'consultations') . "> " . get_name(get_name($episode_one->consultation_id, "id", "primary_diagnosis", "consultations"), "id", "name", "diagnoses") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Triage Comments</font></th><td><input type='radio' disabled class='original_radio' name='triage_comments' value=". get_name($episode_one->triage_id, 'id', 'comments', 'triage')."> " . get_name($episode_one->triage_id, "id", "comments", "triage") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Triage Comments</font></th><td><input type='radio' disabled class='original_radio' name='triage_comments' value=" . get_name($episode_one->triage_id, 'id', 'comments', 'triage') . "> " . get_name($episode_one->triage_id, "id", "comments", "triage") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Consultation Comments</font></th><td><input type='radio' class='original_radio' name='consultation_comments' value=". get_name($episode_one->consultation_id, 'id', 'comments', 'consultations')."> " . get_name($episode_one->consultation_id, "id", "comments", "consultations") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Consultation Comments</font></th><td><input type='radio' class='original_radio' name='consultation_comments' value=" . get_name($episode_one->consultation_id, 'id', 'comments', 'consultations') . "> " . get_name($episode_one->consultation_id, "id", "comments", "consultations") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Examination Comments</font></th><td><input type='radio' class='original_radio' name='clinic_examination_comments' value=". get_name($episode_one->consultation_id, 'id', 'clinic_examination_comments', 'consultations')."> " . get_name($episode_one->consultation_id, "id", "clinic_examination_comments", "consultations") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Examination Comments</font></th><td><input type='radio' class='original_radio' name='clinic_examination_comments' value=" . get_name($episode_one->consultation_id, 'id', 'clinic_examination_comments', 'consultations') . "> " . get_name($episode_one->consultation_id, "id", "clinic_examination_comments", "consultations") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Management Plan</font></th><td><input type='radio' class='original_radio' name='investigation_and_management_plan_comments' value=". get_name($episode_one->consultation_id, 'id', 'investigation_and_management_plan_comments', 'consultations')."> " . get_name($episode_one->consultation_id, "id", "investigation_and_management_plan_comments", "consultations") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>Management Plan</font></th><td><input type='radio' class='original_radio' name='investigation_and_management_plan_comments' value=" . get_name($episode_one->consultation_id, 'id', 'investigation_and_management_plan_comments', 'consultations') . "> " . get_name($episode_one->consultation_id, "id", "investigation_and_management_plan_comments", "consultations") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>History Comments</font></th><td><input type='radio' class='original_radio' name='history_comments' value=". get_name($episode_one->consultation_id, 'id', 'history_comments', 'consultations')."> " . get_name($episode_one->consultation_id, "id", "history_comments", "consultations") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "<tr>";
$html_text_one .= "<th><font color='black'>History Comments</font></th><td><input type='radio' class='original_radio' name='history_comments' value=" . get_name($episode_one->consultation_id, 'id', 'history_comments', 'consultations') . "> " . get_name($episode_one->consultation_id, "id", "history_comments", "consultations") . "</td>";
$html_text_one .= "</tr>";
$html_text_one .= "</table>";
$episode_two = PatientEpisode::find($episode_id_two);
$html_text_two = "<table class='table table-bordered table-striped'>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='checkbox' name='all_duplicate_fields' id='all_duplicate_fields'> Episode started on <font color='blue'>". streamline_date_time($episode_two->created_at)."</font></td><input name='duplicate_id' type='hidden' value='".$episode_two->id."'";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='checkbox' name='all_duplicate_fields' id='all_duplicate_fields'> Episode started on <font color='blue'>" . streamline_date_time($episode_two->created_at) . "</font></td><input name='duplicate_id' type='hidden' value='" . $episode_two->id . "'";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='clinic_id' value=". $episode_two->clinic_id."> " . get_name($episode_two->clinic_id, "id", "name", "clinics") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='clinic_id' value=" . $episode_two->clinic_id . "> " . get_name($episode_two->clinic_id, "id", "name", "clinics") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='primary_diagnosis' value=". get_name($episode_two->consultation_id, 'id', 'primary_diagnosis', 'consultations')."> " . get_name(get_name($episode_two->consultation_id, "id", "primary_diagnosis", "consultations"), "id", "name", "diagnoses") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='primary_diagnosis' value=" . get_name($episode_two->consultation_id, 'id', 'primary_diagnosis', 'consultations') . "> " . get_name(get_name($episode_two->consultation_id, "id", "primary_diagnosis", "consultations"), "id", "name", "diagnoses") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' disabled class='duplicate_radio' name='triage_comments' value=". get_name($episode_two->triage_id, 'id', 'comments', 'triage')."> " . get_name($episode_two->triage_id, "id", "comments", "triage") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' disabled class='duplicate_radio' name='triage_comments' value=" . get_name($episode_two->triage_id, 'id', 'comments', 'triage') . "> " . get_name($episode_two->triage_id, "id", "comments", "triage") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='consultation_comments' value=". get_name($episode_two->consultation_id, 'id', 'comments', 'consultations')."> " . get_name($episode_two->consultation_id, "id", "comments", "consultations") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='consultation_comments' value=" . get_name($episode_two->consultation_id, 'id', 'comments', 'consultations') . "> " . get_name($episode_two->consultation_id, "id", "comments", "consultations") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='clinic_examination_comments' value=". get_name($episode_two->consultation_id, 'id', 'clinic_examination_comments', 'consultations')."> " . get_name($episode_two->consultation_id, "id", "clinic_examination_comments", "consultations") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='clinic_examination_comments' value=" . get_name($episode_two->consultation_id, 'id', 'clinic_examination_comments', 'consultations') . "> " . get_name($episode_two->consultation_id, "id", "clinic_examination_comments", "consultations") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='investigation_and_management_plan_comments' value=". get_name($episode_two->consultation_id, 'id', 'investigation_and_management_plan_comments', 'consultations')."> " . get_name($episode_two->consultation_id, "id", "investigation_and_management_plan_comments", "consultations") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='investigation_and_management_plan_comments' value=" . get_name($episode_two->consultation_id, 'id', 'investigation_and_management_plan_comments', 'consultations') . "> " . get_name($episode_two->consultation_id, "id", "investigation_and_management_plan_comments", "consultations") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='history_comments' value=". get_name($episode_two->consultation_id, 'id', 'history_comments', 'consultations')."> " . get_name($episode_two->consultation_id, "id", "history_comments", "consultations") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "<tr>";
$html_text_two .= "<td><input type='radio' class='duplicate_radio' name='history_comments' value=" . get_name($episode_two->consultation_id, 'id', 'history_comments', 'consultations') . "> " . get_name($episode_two->consultation_id, "id", "history_comments", "consultations") . "</td>";
$html_text_two .= "</tr>";
$html_text_two .= "</table>";
return json_encode([
@@ -1476,15 +1595,15 @@ class PatientEpisodeController extends Controller {
$ordered_sundry->episode_id = $episode_id_to_keep;
$ordered_sundry->update();
}
$tables = ['ward_inpatient_sheet_nurse_comments','ward_inpatient_detailed_notes','ward_dispensing_per_charts','patient_documents','patient_one_off_discounts','triage_nutrition','triage_news','surgeries','sundries_deposits','smart_triage','patient_refunds','patient_account_consumptions','patient_appointments','phone_followup_patients','point_of_sale_records','procedure_deposits','cancel_patient_transactions','central_billing_deposits','chronic_patients','chi_deposits','debtors','debt_plan','dependants_consumptions','family_account_consumptions','inpatient_attendant_passes','inpatient_ward_discounts','inpatient_sheet_audits','maternity_delivery_records','maternity_inpatients','mental_health_consultation','ordered_investigations','ordered_procedures'];
$tables = ['ward_inpatient_sheet_nurse_comments', 'ward_inpatient_detailed_notes', 'ward_dispensing_per_charts', 'patient_documents', 'patient_one_off_discounts', 'triage_nutrition', 'triage_news', 'surgeries', 'sundries_deposits', 'smart_triage', 'patient_refunds', 'patient_account_consumptions', 'patient_appointments', 'phone_followup_patients', 'point_of_sale_records', 'procedure_deposits', 'cancel_patient_transactions', 'central_billing_deposits', 'chronic_patients', 'chi_deposits', 'debtors', 'debt_plan', 'dependants_consumptions', 'family_account_consumptions', 'inpatient_attendant_passes', 'inpatient_ward_discounts', 'inpatient_sheet_audits', 'maternity_delivery_records', 'maternity_inpatients', 'mental_health_consultation', 'ordered_investigations', 'ordered_procedures'];
foreach ($tables as $table) {
$episodes = DB::table($table)->where('episode_id', $episode_id_to_delete)->get();
foreach ($episodes as $episode) DB::table($table)->where('id', $episode->id)->update(['episode_id' => $episode_id_to_keep]);
foreach ($episodes as $episode) DB::table($table)->where('id', $episode->id)->update(['episode_id' => $episode_id_to_keep]);
}
$incoming_ward_charts = DB::table('incoming_ward_charts')->whereRaw('FIND_IN_SET(' . $episode_id_to_delete . ',episode_ids)')->get();
foreach ($incoming_ward_charts as $incoming_ward_chart) {
$episode_ids = explode(',',$incoming_ward_chart->episode_ids);
foreach ($episode_ids as $key => $episode_id) if( $episode_id == $episode_id_to_delete) $episode_ids[$key]=$episode_id_to_keep;
$episode_ids = explode(',', $incoming_ward_chart->episode_ids);
foreach ($episode_ids as $key => $episode_id) if ($episode_id == $episode_id_to_delete) $episode_ids[$key] = $episode_id_to_keep;
DB::table('incoming_ward_charts')->where('id', $incoming_ward_chart->id)->update(['episode_ids' => implode(',', $episode_ids)]);
}
flash("Episodes have been merged")->success();
@@ -1505,7 +1624,8 @@ class PatientEpisodeController extends Controller {
return "unpaid";
}
public function is_patient_allowed_to_have_consultation($patient_id, $episode_id) {
public function is_patient_allowed_to_have_consultation($patient_id, $episode_id)
{
$patient_details = Patient::withTrashed()->find($patient_id);
$episode_details = PatientEpisode::withTrashed()->find($episode_id);
$patient_episodes_payment_setting = $patient_details->episode_payments;
@@ -42,35 +42,29 @@ class PatientFlowMonitoringController extends Controller {
session()->put('order_by', $order_by);
}
$filters = [];
if($search_by === 0){
// last 24 hours
$last_day = Carbon::now()->subDay();
$start_date_search = Carbon::yesterday()->startOfDay()->toDateTimeString();
$end_date_search = Carbon::yesterday()->endOfDay()->toDateTimeString();
array_push($filters, ['patient_episodes.created_at', '>', $last_day]);
$date_search = "Last 24 hours";
$date_search = "Yesterday";
} elseif($search_by == 1){
// custom date
$start_date_search = Carbon::parse($reg_date)->startOfDay()->toDateTimeString();;
$end_date_search = Carbon::parse($reg_date)->endOfDay()->toDateTimeString();;
$start_date_search = Carbon::parse($reg_date)->startOfDay()->toDateTimeString();
$end_date_search = Carbon::parse($reg_date)->endOfDay()->toDateTimeString();
array_push($filters, ['patient_episodes.created_at', '>', $start_date_search]);
array_push($filters, ['patient_episodes.created_at', '<', $end_date_search]);
$date_search = streamline_date($start_date_search);
} elseif($search_by == 2){
// custom date range
$start_date_search = Carbon::parse($start_date)->startOfDay()->toDateTimeString();;
$end_date_search = Carbon::parse($end_date)->endOfDay()->toDateTimeString();;
$start_date_search = Carbon::parse($start_date)->startOfDay()->toDateTimeString();
$end_date_search = Carbon::parse($end_date)->endOfDay()->toDateTimeString();
array_push($filters, ['patient_episodes.created_at', '>', $start_date_search]);
array_push($filters, ['patient_episodes.created_at', '<', $end_date_search]);
$date_search = streamline_date($start_date_search) . " to " . streamline_date($end_date_search);
} else {
// Today
$today = Carbon::today()->toDateTimeString();
$start_date_search = Carbon::today()->startOfDay()->toDateTimeString();
$end_date_search = Carbon::today()->endOfDay()->toDateTimeString();
array_push($filters, ['patient_episodes.created_at', '>=', $today]);
$date_search = "Today";
}
@@ -106,7 +100,7 @@ class PatientFlowMonitoringController extends Controller {
->leftJoin('ante_natal_clinic_followups as a', 'patient_episodes.id', '=', 'a.episode_id')
->leftJoin('triage', 'patient_episodes.id', '=', 'triage.episode_id')
->select('patient_episodes.*', 'consultations.primary_diagnosis','consultations.outcome_id','consultations.completed','consultations.created_by as consultation_created_by','consultations.updated_by as consultation_updated_by','consultations.consultation_done_by', 'a.primary_diagnosis as antenatal_primary_diagnosis','a.outcome_id as antenatal_outcome_id','a.completion_status as antenatal_completed','a.created_by as antenatal_created_by','a.updated_by as antenatal_updated_by', 'triage.id as episode_triage_id', 'triage.severe_grade', 'triage.clinic_allocation')
->where($filters)
->whereBetween('patient_episodes.created_at', [$start_date_search, $end_date_search])
->orderByRaw($order_by_text)
->paginate(200);
$clinic_name = "OPD";
@@ -116,7 +110,8 @@ class PatientFlowMonitoringController extends Controller {
->leftJoin('consultations', 'patient_episodes.id', '=', 'consultations.episode_id')
->leftJoin('ante_natal_clinic_followups as a', 'patient_episodes.id', '=', 'a.episode_id')
->leftJoin('triage', 'patient_episodes.id', '=', 'triage.episode_id')
->where(['patient_episodes.clinic_id' => $clinic_id])->where($filters)
->where(['patient_episodes.clinic_id' => $clinic_id])
->whereBetween('patient_episodes.created_at', [$start_date_search, $end_date_search])
->orderByRaw($order_by_text)
->select('patient_episodes.*', 'consultations.primary_diagnosis','consultations.outcome_id','consultations.completed','consultations.created_by as consultation_created_by','consultations.updated_by as consultation_updated_by','consultations.consultation_done_by', 'a.primary_diagnosis as antenatal_primary_diagnosis','a.outcome_id as antenatal_outcome_id','a.completion_status as antenatal_completed','a.created_by as antenatal_created_by','a.updated_by as antenatal_updated_by','triage.id as episode_triage_id', 'triage.severe_grade', 'triage.clinic_allocation')
->paginate(200);
@@ -129,9 +124,11 @@ class PatientFlowMonitoringController extends Controller {
$clinics = [0 => 'OPD'] + $clinics;
$clinics = ['' => '- select -'] + $clinics;
$diagnoses = DB::table('diagnoses')->where('available', 1)->whereNull('deleted_at')->pluck("name", "id")->toArray();
$wards = DB::table('wards')->where('available', 1)->whereNull('deleted_at')->pluck("name", "id")->prepend('- select -', '');
return view('patients::patient_flow_monitoring.index', compact('patient_episodes', 'clinics', 'patient_categories','clinic_name','search_by', 'date_search', 'wards'));
return view('patients::patient_flow_monitoring.index', compact('patient_episodes', 'clinics', 'patient_categories','clinic_name','search_by', 'date_search', 'wards', 'diagnoses'));
}
public function patient_route($episode_id, $route){
@@ -145,7 +142,9 @@ class PatientFlowMonitoringController extends Controller {
if($route == 'triage'){
$url = '/triage';
session()->put('triage_without_etat', 0);
} elseif ($route == 'consultation'){
session()->put('consultation_with_notes', 0);
$url = '/consultation/route';
} elseif ($route == 'create_anaesthetics'){
$url = '/anaesthetics/create';
@@ -164,11 +163,17 @@ class PatientFlowMonitoringController extends Controller {
} elseif ($route == 'investigation') {
$url = '/investigations/investigations_review';
} elseif ($route == 'triage_without_etat') {
$url = '/triage/create_without_etat';
session()->put('triage_without_etat', 1);
$url = '/triage';
} elseif ($route == 'consultation_with_notes') {
$url = '/consultation/create_with_notes';
session()->put('consultation_with_notes', 1);
$url = '/consultation/route';
} elseif ($route == 'view_patient_history') {
$url = '/patient_episodes/';
} elseif ($route == 'main_exam') {
$url = '/eye_clinic/main_exam_route';
} elseif ($route == 'base_refraction_exam') {
$url = '/eye_clinic/base_exam_refraction';
}
return response()->json($url);
@@ -219,11 +224,8 @@ class PatientFlowMonitoringController extends Controller {
return redirect('/patient_episodes/');
} catch (QueryException $e) {
$errorCode = $e->errorInfo[1];
if ($errorCode == 1062) { //error code for duplicate entry to a unique field
flash("This episode already exists!")->error();
return back()->withInput();
}
flash("This episode already exists!")->error();
return back()->withInput();
}
}
}
@@ -0,0 +1,451 @@
<?php
namespace Modules\Patients\Http\Controllers;
use Barryvdh\Snappy\Facades\SnappyPdf;
use Carbon\Carbon;
use Illuminate\Database\QueryException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Streamline\Models\Drug;
use Streamline\Models\EyeGlasses;
use Streamline\Models\HospitalInformation;
use Streamline\Models\OrderedEyeGlasses;
use Streamline\Models\OrderedService;
use Streamline\Models\OrderedSundry;
use Streamline\Models\Patient;
use Streamline\Models\PatientEpisode;
use Streamline\Models\PointOfSaleRecord;
use Streamline\Models\ReferralHospital;
use Streamline\Models\Sundry;
use Streamline\Models\Services;
use Streamline\Models\Treatment;
class PointOfSaleController extends Controller {
public function index(Request $request){
$search_text = "";
switch ($request->search_date_by){
case 'yesterday':
$end_date = Carbon::yesterday()->endOfDay();
$start_date = Carbon::yesterday()->startOfDay();
$search_text .= "Yesterday ";
break;
case 'custom_date':
$end_date = Carbon::parse($request->start_date)->endOfDay();
$start_date = Carbon::parse($request->start_date)->startOfDay();
$search_text .= "From: " . streamline_date($start_date) . " ";
break;
case 'custom_date_range':
$end_date = Carbon::parse($request->end_date)->endOfDay();
$start_date = Carbon::parse($request->start_date)->startOfDay();
$search_text .= "From: " . streamline_date($start_date) . " to " . streamline_date($end_date) . " ";
break;
case 'today':
default:
$end_date = Carbon::today()->endOfDay();
$start_date = Carbon::today()->startOfDay();
$search_text .= "Today ";
break;
}
$records = PointOfSaleRecord::join('patients', 'point_of_sale_records.patient_id', '=', 'patients.id')
->whereBetween('point_of_sale_records.created_at', [$start_date, $end_date])
->limit(500)->get(['point_of_sale_records.*', 'patients.first_name', 'patients.last_name', 'patients.number']);
return view('patients::point_of_sale.index', compact('records', 'search_text'));
}
public function order_items(){
$drugs = Drug::get();
$sundries = Sundry::where('available', 1)->get();
$services = Services::where('available', 1)->get();
$eye_glasses = EyeGlasses::get();
$referral_hospitals = ReferralHospital::orderBy('name')->get();
return view('patients::point_of_sale.order_items', compact('drugs', 'eye_glasses', 'sundries', 'referral_hospitals', 'services'));
}
public function confirm_items(Request $request){
$pre_ordered_eye_glasses = [];
$manual_patient_prescriptions = [];
$automatic_patient_prescriptions = [];
$pre_ordered_sundries = [];
$pre_ordered_services = [];
if($request->patient_id) {
$patient_id = $request->patient_id;
$patient = Patient::find($patient_id);
// double check if for existing patient_id
if($patient){
$patient_number = Patient::where('id', $patient_id)->pluck('number')->first();
$episode_id = PatientEpisode::where('patient_id',$patient_id)->whereDate('created_at', Carbon::today()->toDateString())->pluck('id')->first();
if(!$episode_id){
$episode = new PatientEpisode;
$episode->patient_id = $patient_id;
$episode->paid_over = "pos";
$episode->created_by = Auth::user()->id;
$episode->updated_by = Auth::user()->id;
$episode->save();
flash('A new episode for patient with patient number ' . $patient_number . ' has been initiated.');
$episode_id = $episode->id;
}
} else {
flash('Patient not found')->error();
redirect('point_of_sale');
}
} else {
$patient = new Patient;
$patient->first_name = $request->first_name;
$patient->last_name = $request->last_name;
$patient->phone = $request->phone_number ?? "";
$patient->referred_from = $request->referral_hospital ?? 1;
$patient->category_id = 1;
$patient->created_by = Auth::user()->id;
$patient->gender = $request->gender ?? 2;
if (is_null($request->date_of_birth)) {
$age_in_years = $request->age_in_years ?? 18;
$calculated_dob = \Carbon\Carbon::now()->subYears($age_in_years);
$calculated_date_of_birth = $calculated_dob->toDateString();
$patient->date_of_birth = $calculated_date_of_birth;
} else {
$patient->date_of_birth = Carbon::createFromFormat('d/m/Y', $request->date_of_birth)->toDateString();
}
if ($patient->save()):
$prefix = DB::table('hospital_information')->where('id', 1)->value('patient_number_abbr');
$patient_id = $patient->id;
$new_id = quadLimit($patient_id);
$patient_number = $prefix . "-" . $new_id;
DB::table('patients')->where('id', $new_id)->update(['number' => $patient_number]); // Updating the patient number
else:
flash("There was an error")->error();
return back()->withInput();
endif;
$episode = new PatientEpisode;
$episode->patient_id = $patient_id;
$episode->clinic_id = get_default_hospital_clinic();
$episode->paid_over = "pos";
$episode->created_by = Auth::user()->id;
$episode->updated_by = Auth::user()->id;
try {
$episode->save();
$episode_id = $episode->id;
flash('Patient with patient number ' . $patient_number . ' has been successfully registered.')->success();
} catch (QueryException $e) {
flash("This episode already exists!")->error();
return back()->withInput();
}
}
if ($request->selected_eye_glasses) {
$pre_ordered_eye_glasses = EyeGlasses::whereIn('id', $request->selected_eye_glasses)->get();
}
if ($request->selected_drugs) {
if($request->manual_drug_select == 1){
$manual_patient_prescriptions = Drug::whereIn('id', $request->selected_drugs)->get();
}else if($request->automatic_drug_select == 1){
$automatic_patient_prescriptions = Drug::whereIn('id', $request->selected_drugs)->get();
}
}
if ($request->selected_sundries) {
$pre_ordered_sundries = Sundry::whereIn('id', $request->selected_sundries)->get();
}
if ($request->selected_services) {
$pre_ordered_services = Services::whereIn('id', $request->selected_services)->get();
}
$allergies = DB::table('allergies')->where(['patient_id' => $patient_id])->pluck('patient_id', 'names');
return view('patients::point_of_sale.confirm_items', compact('patient_id', 'episode_id', 'pre_ordered_eye_glasses',
'manual_patient_prescriptions', 'automatic_patient_prescriptions', 'allergies', 'patient', 'pre_ordered_sundries', 'pre_ordered_services'));
}
public function confirm_pricing(Request $request){
if($request->treatment_item){
$treatment = new Treatment;
$treatment->patient_id = $request->patient_id;
$treatment->episode_id = $request->episode_id;
$treatment->drugs = implode(',', $request->treatment_item);
$drugs_array = $request->treatment_item;
$duration_array = $request->duration;
$time_array = $request->time;
$time_duration = [];
$doses = $request->dose ?? [];
$frequencies = $request->frequency ?? [];
$dose_array = [];
$frequencies_array = [];
$instructions_array = [];
for ($i = 0; $i < count($drugs_array); $i++) {
if (is_drug_chronic($drugs_array[$i])) {
register_chronic_patient($request->patient_id, $request->episode_id, $drugs_array[$i]);
}
if (isset($duration_array[$i]) && isset($time_array[$i])) {
$time_duration[] = $duration_array[$i] . " " . $time_array[$i];
} else {
$time_duration[] = "1 Days";
}
if (isset($doses[$i])) {
$dose_array[] = $doses[$i];
} else {
$dose_array[] = "1";
}
if (isset($frequencies[$i])) {
$frequencies_array[] = $frequencies[$i];
} else {
$frequencies_array[] = "2";
}
$instructions_array[] = "";
}
$treatment->doses = implode(',', $dose_array);
$treatment->frequencies = implode(',', $frequencies_array);
$treatment->instruction = implode(',', $instructions_array);
$treatment->durations = implode(',', $time_duration);
$treatment->quantities_dispensed = implode(',', $request->treatment_quantity);
$treatment->dispense_status = 0;
$treatment->created_by = Auth::id();
$treatment->save();
$request->treatment_id = DB::table('treatments')->where('episode_id', $request->episode_id)->where('patient_id', $request->patient_id)->latest()->pluck('id')->first();
}
$eye_glass_ids = $request->eye_glass_item;
$eye_glass_quantity = $request->eye_glass_quantity;
if($request->eye_glass_item){
for ($i=0; $i < count($eye_glass_ids) ; $i++) {
$new_ordered_eye_glasses = new OrderedEyeGlasses;
$new_ordered_eye_glasses->patient_id = $request->patient_id;
$new_ordered_eye_glasses->episode_id = $request->episode_id;
$new_ordered_eye_glasses->eye_glasses_id = $eye_glass_ids[$i];
$new_ordered_eye_glasses->quantity = $eye_glass_quantity[$i];
$new_ordered_eye_glasses->payment_status = 0; //0 by default to mean not paid
$new_ordered_eye_glasses->created_by = auth()->user()->id;
$new_ordered_eye_glasses->save();
}
}
if($request->pos_sundry_ids){
$new_ordered_sundries = new OrderedSundry;
$new_ordered_sundries->patient_id = $request->patient_id;
$new_ordered_sundries->episode_id = $request->episode_id;
$new_ordered_sundries->sundries_id = implode(",", $request->pos_sundry_ids);
$new_ordered_sundries->quantity = implode(",", $request->sundry_quantity);
$new_ordered_sundries->created_by = auth()->user()->id;
$new_ordered_sundries->save();
}
if ($request->service_id && $request->service_id[0] != null) {
$new_ordered_service = new OrderedService;
$new_ordered_service->patient_id = $request->patient_id;
$new_ordered_service->episode_id = $request->episode_id;
$new_ordered_service->service_id = implode(",", $request->service_id);
$new_ordered_service->quantity = implode(",", $request->quantity);
$new_ordered_service->performed = 0;
$new_ordered_service->performed_id = 0;
$new_ordered_service->created_by = auth()->user()->id;
$new_ordered_service->save();
}
$request->ordered_sundry_ids = OrderedSundry::where('episode_id', $request->episode_id)->where('patient_id', $request->patient_id)
->whereDate('created_at', Carbon::today()->toDateString())->pluck('id')->toArray();
$treatment_item = $treatment_quantity = $treatment_subtotal = [];
// save for treatment
if($request->treatment_id){
$treatment_item = $request->treatment_item;
$treatment_quantity = $request->treatment_quantity;
$treatment_subtotal = $request->treatment_subtotal;
}
$eye_glasses_prices_array = $eye_glasses_quantity_array = $eye_glasses_ids_array = [];
// save for eye_glasses arrays
if($request->eye_glass_item){
$eye_glasses_prices_array = $request->eye_glass_amount;
$eye_glasses_quantity_array = $request->eye_glass_quantity;
$eye_glasses_ids_array = $request->eye_glass_item;
}
$sundry_item = $sundry_quantity = $sundry_subtotal = [];
// save for sundries array
if($request->pos_sundry_ids){
$sundry_item = $request->pos_sundry_ids;
$sundry_quantity = $request->sundry_quantity;
$sundry_subtotal = $request->sundry_subtotal;
}
// save for service arrays
$service_ids_array = [];
$service_prices_array = [];
$service_quantity_array = [];
if($request->service_id){
$service_prices_array = $request->service_item_subtotal;
$service_ids_array = $request->service_id;
$service_quantity_array = $request->quantity;
}
$pos_record = new PointOfSaleRecord();
$pos_record->patient_id = $request->patient_id;
$pos_record->episode_id = $request->episode_id;
$pos_record->treatments = count($treatment_item) > 0 ? json_encode([
"ids" => $treatment_item, "quantity" => $treatment_quantity,
"subtotal" => $treatment_subtotal
]) : NULL;
$pos_record->eye_glasses = count($eye_glasses_ids_array) > 0 ? json_encode([
"ids" => $eye_glasses_ids_array, "quantity" => $eye_glasses_quantity_array,
"subtotal" => $eye_glasses_prices_array
]) : NULL;
$pos_record->sundries = count($sundry_item) > 0 ? json_encode([
"ids" => $sundry_item, "quantity" => $sundry_quantity,
"subtotal" => $sundry_subtotal
]) : NULL;
$pos_record->services = count($service_ids_array) > 0 ? json_encode([
"ids" => $service_ids_array, "quantity" => $service_quantity_array,
"subtotal" => $service_prices_array
]) : NULL;
$pos_record->created_by = Auth::id();
$pos_record->save();
return redirect('point_of_sale/print/' . $pos_record->id);
}
public function add_referral(Request $request) {
$logged_in_user_id = Auth::user()->id;
$referral_hospital = new ReferralHospital;
$referral_hospital->name = $request->name;
$referral_hospital->created_by = $logged_in_user_id;
$referral_hospital->updated_by = $logged_in_user_id;
if ($referral_hospital->save()) {
//insert successful
return $referral_hospital->id;
} else {
return 0;
}
}
public function get_patient(Request $request){
$patient = Patient::where('id', $request->patient_id)->first();
return $patient;
}
public function print($id) {
$record = PointOfSaleRecord::find($id);
if ($record) {
if (is_cashier_receipt_type_print_html()) {
$hospital_information = HospitalInformation::first();
$patient = Patient::find($record->patient_id);
$receipt_date = $record->created_at;
$receipt_reprint_date = date('Y-m-d h:i:s');
$treatments_array = json_decode($record->treatments, true);
$sundries_array = json_decode($record->sundries, true);
$eye_glasses_array = json_decode($record->eye_glasses, true);
$services_array = json_decode($record->services, true);
$treatment_item = $treatments_array ? $treatments_array["ids"] : [];
$treatment_quantity = $treatments_array ? $treatments_array["quantity"] : [];
$treatment_subtotal = $treatments_array ? $treatments_array["subtotal"] : [];
$eye_glasses_ids_array = $eye_glasses_array ? $eye_glasses_array["ids"] : [];
$eye_glasses_quantity_array = $eye_glasses_array ? $eye_glasses_array["quantity"] : [];
$eye_glasses_prices_array = $eye_glasses_array ? $eye_glasses_array["subtotal"] : [];
$sundry_item = $sundries_array ? $sundries_array["ids"] : [];
$sundry_quantity = $sundries_array ? $sundries_array["quantity"] : [];
$sundry_subtotal = $sundries_array ? $sundries_array["subtotal"] : [];
$service_ids_array = $services_array ? $services_array["ids"] : [];
$service_quantity_array = $services_array ? $services_array["quantity"] : [];
$service_prices_array = $services_array ? $services_array["subtotal"] : [];
return view('patients::point_of_sale.receipt', compact('treatment_item', 'treatment_quantity', 'treatment_subtotal',
'eye_glasses_prices_array', 'eye_glasses_quantity_array', 'eye_glasses_ids_array', 'hospital_information', 'patient', 'receipt_date',
'sundry_item','sundry_quantity','sundry_subtotal', 'service_ids_array', 'service_prices_array', 'service_quantity_array', 'receipt_reprint_date'));
} else {
// set up the redirect link for html
session()->put('print_pos_pdf', 1);
session()->put('print_pos_pdf_id', $id);
return redirect('/point_of_sale');
}
} else {
return redirect('/point_of_sale');
}
}
public function print_pos_pdf() {
$id = session()->get("print_pos_pdf_id");
// add check for when the people try to reload the page
if (!$id) {
return redirect('/point_of_sale');
}
// lest i forget Thy love for me
session()->forget('print_pos_pdf');
session()->forget('print_pos_pdf_id');
$record = PointOfSaleRecord::find($id);
if ($record) {
$hospital_information = HospitalInformation::first();
$patient = Patient::find($record->patient_id);
$receipt_date = $record->created_at;
$receipt_reprint_date = date('Y-m-d h:i:s');
$treatments_array = json_decode($record->treatments, true);
$sundries_array = json_decode($record->sundries, true);
$eye_glasses_array = json_decode($record->eye_glasses, true);
$services_array = json_decode($record->services, true);
$treatment_item = $treatments_array ? $treatments_array["ids"] : [];
$treatment_quantity = $treatments_array ? $treatments_array["quantity"] : [];
$treatment_subtotal = $treatments_array ? $treatments_array["subtotal"] : [];
$eye_glasses_ids_array = $eye_glasses_array ? $eye_glasses_array["ids"] : [];
$eye_glasses_quantity_array = $eye_glasses_array ? $eye_glasses_array["quantity"] : [];
$eye_glasses_prices_array = $eye_glasses_array ? $eye_glasses_array["subtotal"] : [];
$sundry_item = $sundries_array ? $sundries_array["ids"] : [];
$sundry_quantity = $sundries_array ? $sundries_array["quantity"] : [];
$sundry_subtotal = $sundries_array ? $sundries_array["subtotal"] : [];
$service_ids_array = $services_array ? $services_array["ids"] : [];
$service_quantity_array = $services_array ? $services_array["quantity"] : [];
$service_prices_array = $services_array ? $services_array["subtotal"] : [];
$data = [
"patient" => $patient, "receipt_date" => $receipt_date, "receipt_reprint_date" => $receipt_reprint_date, "hospital_information" => $hospital_information,
"treatment_item" => $treatment_item, "treatment_quantity" => $treatment_quantity, "treatment_subtotal" => $treatment_subtotal,
"eye_glasses_ids_array" => $eye_glasses_ids_array, "eye_glasses_quantity_array" => $eye_glasses_quantity_array, "eye_glasses_prices_array" => $eye_glasses_prices_array,
"sundry_item" => $sundry_item, "sundry_quantity" => $sundry_quantity, "sundry_subtotal" => $sundry_subtotal,
"service_ids_array" => $service_ids_array, "service_quantity_array" => $service_quantity_array, "service_prices_array" => $service_prices_array,
];
$pdf = SnappyPDF::loadView('patients::point_of_sale.print_pos_pdf', $data)
->setOrientation('portrait')
->setPaper('a4')
->setOption('margin-bottom', 5)
->setOption('margin-top', 5)
->setOption('footer-html', '<i>&copy; ' . date('Y') . ' Stre@mline</i>');
return $pdf->inline('Patient Receipt' . date(" d-m-y h:ia") . '.pdf');
} else {
return redirect('/point_of_sale');
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,4 @@
@if (session()->has('patient_id') || session()->has('patients_id'))
@endif
@push('scripts')
@@ -9,89 +8,120 @@
@push('styles')
<style type="text/css">
/* Important part used by allergies */
.allergy-modal-dialog{
.allergy-modal-dialog {
overflow-y: initial !important
}
.allergy-modal-body{
.allergy-modal-body {
height: 250px;
overflow-y: auto;
}
@media (min-width: 768px) {
.allergy-modal-dialog {
width: 90%;
max-width:1200px;
max-width: 1200px;
}
}
</style>
@endpush
<div class="row">
<div @if(is_smart_discharge_enabled()) class="col-sm-6" @else class="col-sm-8" @endif>
<div @if (is_smart_discharge_enabled()) class="col-sm-6" @else class="col-sm-8" @endif>
<div>
@php
$known_patient_allergies = \Streamline\Models\Allergy::where('patient_id' , $patient->id)->orderBy('created_at','desc')->take(2)->get();
$known_patient_alerts = \Streamline\Models\Alert::where('patient_id' , $patient->id)->orderBy('created_at','desc')->take(2)->get();
$categories = \Streamline\Models\PatientCategory::pluck("name", "id");
$known_patient_allergies = \Streamline\Models\Allergy::where('patient_id', $patient->id)
->orderBy('created_at', 'desc')
->take(2)
->get();
$known_patient_alerts = \Streamline\Models\Alert::where('patient_id', $patient->id)
->orderBy('created_at', 'desc')
->take(2)
->get();
$categories = \Streamline\Models\PatientCategory::pluck('name', 'id');
$drug_categories_array = DB::table('drug_categories')->pluck('name', 'id');
$drug_categories = \Streamline\Models\DrugCategory::orderBy('name', 'asc')->get();
@endphp
<!-- <a href="#" class="btn-action fa fa-plus-square"><i></i></a> --><span class="count label label-inverse"><strong>{{ __('allergies.category') }} :</strong>
{{ isset($categories[$patient->category_id]) ? $categories[$patient->category_id] : "N/A" }}
</span>
<div class="row">
<div class="col-sm-10">
<table class="table-bordered table-condensed table-striped">
<tbody>
<tr>
<th style="color: black">{{ __('allergies.patient_number') }}</th>
<th style="color: black">{{ __('allergies.full_names') }}</th>
<th style="color: black">{{ __('allergies.gender') }}</th>
<th class="hidden-phone" style="color: black">{{ __('allergies.age') }}</th>
<th style="color: black">{{ __('allergies.national_id') }}</th>
</tr>
</tbody>
<tbody>
<tr>
<td>{{ $patient->number }}</td>
<td>
{!! insurance_flag($patient->id) !!}
@if(patient_insurance_status($patient->id) == 1)
<small style="color:#069">({{ __('patients.joined_chi_scheme') }} {{patient_duration_on_chi_sheme($patient->id)}})</small>
@endif
</td>
<td>{{ $patient->gender == 1 ? __('allergies.male') : __('allergies.female') }}</td>
<td>{{ get_patients_age($patient->date_of_birth) }}</td>
<td>{!! ($patient->national_id == null || $patient->national_id == "") ? "<span class='label label-info'>National ID Missing</span>" : strtoupper($patient->national_id) !!}</td>
</tr>
</tbody>
</table>
<!-- <a href="#" class="btn-action fa fa-plus-square"><i></i></a> -->
<span class="count label label-inverse mx-4 px-4">
<strong>{{ __('allergies.category') }} :</strong>
{{ $categories[$patient->category_id] ?? 'N/A' }}
</span>
<div class="row consultation-pat-row">
<div class="col-sm-9 consultation-pat mb-2" style="overflow-x: auto; overflow-y: hidden;">
<div class="row consultation-pat-table h-100 align-items-stretch" style="flex-wrap: nowrap;">
<div class="col p-0">
<div class="card h-100 m-0">
<div class="card-header w-100">{{ __('allergies.patient_number') }}</div>
<div class="card-body">{{ $patient->number }}</div>
</div>
</div>
<div class="col p-0">
<div class="card h-100 m-0">
<div class="card-header w-100">{{ __('allergies.full_names') }}</div>
<div class="card-body">{!! insurance_flag($patient->id) !!}
@if (patient_insurance_status($patient->id) == 1)
<small style="color:#069">({{ __('patients.joined_chi_scheme') }}
{{ patient_duration_on_chi_sheme($patient->id) }})</small>
@endif
</div>
</div>
</div>
<div class="col p-0">
<div class="card h-100 m-0">
<div class="card-header w-100">{{ __('allergies.gender') }}</div>
<div class="card-body">
{{ $patient->gender == 1 ? __('allergies.male') : __('allergies.female') }}</div>
</div>
</div>
<div class="col p-0">
<div class="card h-100 m-0">
<div class="card-header w-100">{{ __('allergies.age') }}</div>
<div class="card-body">{{ get_patients_age($patient->date_of_birth) }}</div>
</div>
</div>
<div class="col p-0">
<div class="card h-100 m-0">
<div class="card-header w-100">{{ __('allergies.national_id') }}</div>
<div class="card-body">{!! $patient->national_id == null || $patient->national_id == ''
? "<span class='label label-info'>National ID Missing</span>"
: strtoupper($patient->national_id) !!}</div>
</div>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="button-box">
<div class="col-sm-3 mb-2">
<div class="button-box h-100">
<a class="img" href="#modal-photo" data-toggle="modal" style="color: whitesmoke">
@if(!is_null($patient->photo) && $patient->photo != "")
<img src='{{ asset($patient->photo) }}' class="img-rounded center" style='height: 59px; width: 100%' />
@else
<img src="/uploads/streamline_images/person-place-holder.jpg" class="img-rounded center" style='height: 100%; width: 100%' />
@endif
<div class="center img-pat-profile"
style="height: 100%; width: 100%; background: url(@if (!is_null($patient->photo) && $patient->photo != '') {{ asset($patient->photo) }} @else {{ asset('/uploads/streamline_images/person-place-holder.jpg') }} @endif) center no-repeat; background-size: auto 100%; min-height: 110px; position: relative;">
<!-- img-rounded -->
<i class="fa fa-refresh"
style="display: none; position: absolute; right: -10px; top: -10px"></i>
</div>
</a>
</div>
<div class="modal fade" id="modal-photo" tabindex="-1" role="dialog" aria-labelledby="modal-photoLabel1">
<div class="modal fade" id="modal-photo" tabindex="-1" role="dialog"
aria-labelledby="modal-photoLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-photoLabel1">{{ __('allergies.insured_patient_photo') }}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-photoLabel1">
{{ __('allergies.insured_patient_photo') }}</h4>
</div>
<div class="modal-body">
<div class="col-sm-12">
<img src='{{ asset($patient->photo) }}' class="img-rounded center" style="margin: auto" />
<div class="col-sm-12 text-center">
<img src="@if (!is_null($patient->photo) && $patient->photo != '') {{ asset($patient->photo) }} @else {{ asset('/uploads/streamline_images/person-place-holder.jpg') }} @endif"
class="img-rounded center" style="margin: auto" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('allergies.close') }}</button>
<button type="button" class="btn btn-danger btn-sm"
data-dismiss="modal">{{ __('allergies.close') }}</button>
</div>
</div>
</div>
@@ -105,29 +135,36 @@
<div class="col-sm-12">
<div>
<div class="button-box">
<button type="button" class="btn btn-danger btn-rounded btn-sm" data-toggle="modal" data-target="#modal-allergies" style="line-height: 10px; font-size: 11px;">{{ __('allergies.allergies') }} <i class="fa fa-plus-circle"></i></a></button>
<button type="button"
class="btn btn-danger btn-rounded btn-sm mb-1 d-flex justify-content-between align-items-center"
data-toggle="modal" data-target="#modal-allergies"
style="line-height: 10px; font-size: 11px; gap: 10px;">{{ __('allergies.allergies') }} <i
class="fa fa-plus-circle"></i></button>
</div>
<div class="modal fade" id="modal-allergies" tabindex="-1" role="dialog" aria-labelledby="modal-allergiesLabel1">
<div class="modal fade" id="modal-allergies" tabindex="-1" role="dialog"
aria-labelledby="modal-allergiesLabel1">
<div class="modal-dialog modal-lg allergy-modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-allergiesLabel1">{{ __('allergies.add_allergies_patient') }}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-allergiesLabel1">
{{ __('allergies.add_allergies_patient') }}</h4>
</div>
<div class="modal-body allergy-modal-body">
<div class="container-fluid">
<h4>{{ __('allergies.currently_known') }}</h4>
<div class="row">
@php $allergic_drugs_ids_array = []; @endphp
@if(count($known_patient_allergies) > 0 )
@foreach($known_patient_allergies as $allergy)
@if (count($known_patient_allergies) > 0)
@foreach ($known_patient_allergies as $allergy)
@php $allergic_drugs_ids_array = explode(',' , $allergy->names); @endphp
@endforeach
@php $chunked_allergy_array = array_chunk($allergic_drugs_ids_array, 1, true) @endphp
@foreach($chunked_allergy_array as $items)
@foreach ($chunked_allergy_array as $items)
<div class="col-md-4">
@foreach($items as $item)
@if(isset($drug_categories_array[$item]))
@foreach ($items as $item)
@if (isset($drug_categories_array[$item]))
&#8226 {{ $drug_categories_array[$item] }} <br>
@endif
@endforeach
@@ -139,60 +176,70 @@
<br>
<div class="row">
<form>
<h4>{{ __('allergies.allergic_reactions') }}</h4>
@foreach($drug_categories->chunk(9) as $chunk)
@foreach($chunk as $drug_category)
@foreach ($drug_categories->chunk(9) as $chunk)
@foreach ($chunk as $drug_category)
<div class="col-md-4">
<!-- if it is a known allergy then check the checkbox -->
@if(in_array($drug_category->id,$allergic_drugs_ids_array))
<input class='patient_allergies' name='allergies[]' type='checkbox' checked="true" value='{{ $drug_category->id }}'/> {{ $drug_category->name }}
@if (in_array($drug_category->id, $allergic_drugs_ids_array))
<input class='patient_allergies' name='allergies[]'
type='checkbox' checked="true"
value='{{ $drug_category->id }}' />
{{ $drug_category->name }}
@else
<input class='patient_allergies' name='allergies[]' type='checkbox' value='{{ $drug_category->id }}'/> {{ $drug_category->name }}
<input class='patient_allergies' name='allergies[]'
type='checkbox'
value='{{ $drug_category->id }}' />
{{ $drug_category->name }}
@endif
<br/>
<br />
</div>
@endforeach
@endforeach
<!-- <hr> -->
<input type="hidden" id="allergy_patient_id" name="allergy_patient_id" value="<?php echo $patient->id; ?>">
<!-- <button type="button" id="submit_allergies" class="btn btn-success btn-sm">Submit Allergies</button>
<div class="separator bottom"></div>
<form> -->
@endforeach
<!-- <hr> -->
<input type="hidden" id="allergy_patient_id"
name="allergy_patient_id" value="<?php echo $patient->id; ?>" />
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" id="submit_allergies" class="btn btn-success btn-sm">{{ __('allergies.submit_allergies') }}</button>
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('allergies.close') }}</button>
</form>
<button type="button" id="submit_allergies"
class="btn btn-success btn-sm">{{ __('allergies.submit_allergies') }}</button>
<button type="button" class="btn btn-danger btn-sm"
data-dismiss="modal">{{ __('allergies.close') }}</button>
</div>
</div>
</div>
</div>
<table class="table-bordered table-condensed table-striped" id="allergies_drugs_table">
<table class="table-bordered table-condensed table-striped w-100 mb-3 br-5"
id="allergies_drugs_table"
style="border-collapse: collapse; border-spacing: 0; border-spacing: 0;">
<tbody>
<td style="font-weight: normal;">
<div id="patient_allergies_tab">
@if(count($allergic_drugs_ids_array) > 0)
@if(isset($allergic_drugs_ids_array[0]) && isset($drug_categories_array[$allergic_drugs_ids_array[0]]))
&#8226 <small style="color: red;">{{ $drug_categories_array[$allergic_drugs_ids_array[0]] }}</small><br>
@endif
<tr style="border-spacing: 0;">
<td style="font-weight: normal; border-spacing: 0;">
<div id="patient_allergies_tab">
@if (count($allergic_drugs_ids_array) > 0)
@if (isset($allergic_drugs_ids_array[0]) && isset($drug_categories_array[$allergic_drugs_ids_array[0]]))
&#8226 <small
style="color: red;">{{ $drug_categories_array[$allergic_drugs_ids_array[0]] }}</small><br>
@endif
@if(isset($allergic_drugs_ids_array[1]) && isset($drug_categories_array[$allergic_drugs_ids_array[1]]))
&#8226 <small style="color: red;">{{ $drug_categories_array[$allergic_drugs_ids_array[1]] }}</small><br>
@if (isset($allergic_drugs_ids_array[1]) && isset($drug_categories_array[$allergic_drugs_ids_array[1]]))
&#8226 <small
style="color: red;">{{ $drug_categories_array[$allergic_drugs_ids_array[1]] }}</small><br>
@endif
@else
<small
style="color: blue;">{{ __('allergies.no_recorded_allergies') }}</small>
@endif
@else
<small style="color: blue;">{{ __('allergies.no_recorded_allergies') }}</small>
</div>
@if (count($allergic_drugs_ids_array) > 0)
<a href="/allergies">{{ __('allergies.view_all') }}</a>
@endif
</div>
@if(count($allergic_drugs_ids_array) > 0) <a href="/allergies">{{ __('allergies.view_all') }}</a> @endif
</td>
</td>
</tr>
</tbody>
</table>
</div>
@@ -204,19 +251,27 @@
<div class="col-sm-12">
<div>
<div class="button-box">
<button type="button" class="btn btn-danger btn-rounded btn-sm" data-toggle="modal" data-target="#modal-alerts" style="line-height: 10px; font-size: 11px;">{{ __('allergies.alerts') }} <i class="fa fa-plus-circle"></i></button>
<button type="button"
class="btn btn-danger btn-rounded btn-sm mb-1 d-flex justify-content-between align-items-center"
data-toggle="modal" data-target="#modal-alerts"
style="line-height: 10px; font-size: 11px; gap: 10px;">{{ __('allergies.alerts') }} <i
class="fa fa-plus-circle"></i></button>
</div>
<div class="modal fade" id="modal-alerts" tabindex="-1" role="dialog" aria-labelledby="modal-alertsLabel1">
<div class="modal fade" id="modal-alerts" tabindex="-1" role="dialog"
aria-labelledby="modal-alertsLabel1">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-alertsLabel1">{{ __('allergies.alerts_for_patient') }}</h4>
<button type="button" class="close" data-dismiss="modal"
aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-alertsLabel1">
{{ __('allergies.alerts_for_patient') }}</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<form>
<input type="hidden" id="alert_patient_id" name="alert_patient_id" value="{{ $patient->id }}">
<input type="hidden" id="alert_patient_id" name="alert_patient_id"
value="{{ $patient->id }}">
<div class="control-group">
<label for="alerts">{{ __('allergies.enter_alert') }}</label>
@@ -229,32 +284,42 @@
</div>
</div>
<div class="modal-footer">
<input type="submit" id="submit_alerts" class = "btn btn-success btn-sm" value="{{ __('allergies.submit_alert') }}" />
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('allergies.close') }}</button>
<input type="submit" id="submit_alerts" class = "btn btn-success btn-sm"
value="{{ __('allergies.submit_alert') }}" />
<button type="button" class="btn btn-danger btn-sm"
data-dismiss="modal">{{ __('allergies.close') }}</button>
</div>
</div>
</div>
</div>
<table class="table-bordered table-condensed table-striped">
<table class="table-bordered table-condensed table-striped w-100 mb-3 br-5"
style="border-collapse: collapse; border-spacing: 0;">
<tbody>
<td style="font-weight: normal">
<div id="patient_alerts_tab">
@if(isset($known_patient_alerts) && count($known_patient_alerts) > 0)
@if(isset($known_patient_alerts[0]))
&#8226 <small style="color: red;">{{ $known_patient_alerts[0]->alerts }}</small><br>
@endif
<tr style="border-spacing: 0;">
<td style="font-weight: normal">
<div id="patient_alerts_tab">
@if (isset($known_patient_alerts) && count($known_patient_alerts) > 0)
@if (isset($known_patient_alerts[0]))
&#8226 <small
style="color: red;">{{ $known_patient_alerts[0]->alerts }}</small><br>
@endif
@if(isset($known_patient_alerts[1]))
&#8226 <small style="color: red;">{{ $known_patient_alerts[1]->alerts }}</small><br>
@endif
@else
<small style="color: blue;">{{ __('allergies.no_recorded_alerts') }}</small>
@endif
</div>
@if (isset($known_patient_alerts[1]))
&#8226 <small
style="color: red;">{{ $known_patient_alerts[1]->alerts }}</small><br>
@endif
@else
<small
style="color: blue;">{{ __('allergies.no_recorded_alerts') }}</small>
@endif
</div>
@if(isset($known_patient_alerts) && count($known_patient_alerts) > 0) <a href="/alerts/view_alerts">View All</a> @endif
</td>
@if (isset($known_patient_alerts) && count($known_patient_alerts) > 0)
<a href="/alerts/view_alerts">View All</a>
@endif
</td>
</tr>
</tbody>
</table>
</div>
@@ -268,41 +333,47 @@
$age_diff_months = $dob->diffInMonths(Carbon\Carbon::now());
@endphp
@if($age_diff_months < 61 && is_smart_discharge_enabled())
@if ($age_diff_months < 61 && is_smart_discharge_enabled())
<div class="col-sm-2">
<div class="button-box">
<a class="btn btn-danger btn-rounded btn-sm" style="line-height: 10px; font-size: 11px;">Post Discharge Risk of Mortality</a>
<a class="btn btn-danger btn-rounded btn-sm mb-1 d-flex justify-content-between align-items-center gap-2"
style="line-height: 10px; font-size: 11px; gap: 10px;">
Post Discharge Risk of Mortality
</a>
</div>
<table class="table-bordered table-condensed table-striped">
<tbody>
<tr>
<td>
@if(is_patient_currently_admitted($patient->id))
{!! get_post_discharge_mortality_risk($patient->id) !!}
@else
@php
// just generate the row without displaying anything
$disregard_this = get_post_discharge_mortality_risk($patient->id);
@endphp
Patient is not admitted
@endif
</td>
</tr>
<table class="table-bordered table-condensed table-striped w-100 br-5">
<tbody class="br-5">
<tr class="br-5">
<td class="br-5">
@if (is_patient_currently_admitted($patient->id))
{!! get_post_discharge_mortality_risk($patient->id) !!}
@else
@php
// just generate the row without displaying anything
$disregard_this = get_post_discharge_mortality_risk($patient->id);
@endphp
Patient is not admitted
@endif
</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
<div id="saved_allergies_alert" class="myadmin-alert alert-success myadmin-alert-top-right"><a href="#" class="closed">&times;</a>
<div id="saved_allergies_alert" class="myadmin-alert alert-success myadmin-alert-top-right"><a href="#"
class="closed">&times;</a>
<h4>{{ __('allergies.allergies_updated') }}</h4>
</div>
<div id="saved_alerts_alert" class="myadmin-alert alert-success myadmin-alert-top-right"><a href="#" class="closed">&times;</a>
<div id="saved_alerts_alert" class="myadmin-alert alert-success myadmin-alert-top-right"><a href="#"
class="closed">&times;</a>
<h4>{{ __('allergies.alerts_updated') }}</h4>
</div>
<div class="modal fade" id="all_allergies_modal" tabindex="-1" role="dialog" aria-labelledby="modal-successLabel1">
<div class="modal fade" id="all_allergies_modal" tabindex="-1" role="dialog"
aria-labelledby="modal-successLabel1">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
@@ -316,9 +387,9 @@
$allergy_count = count($allergic_drugs_ids_array);
@endphp
@for($i=0 ; $i < $allergy_count ; $i++)
@for ($i = 0; $i < $allergy_count; $i++)
<li class="col-sm-3">
<small>{{ isset($drug_categories_array[$allergic_drugs_ids_array[$i]]) ? $drug_categories_array[$allergic_drugs_ids_array[$i]] : "" }}</small>
<small>{{ isset($drug_categories_array[$allergic_drugs_ids_array[$i]]) ? $drug_categories_array[$allergic_drugs_ids_array[$i]] : '' }}</small>
</li>
@endfor
@@ -330,7 +401,8 @@
<div class="modal-footer">
<div class="control-group" style="vertical-align: center;">
<div class="controls">
<button type="button" class="btn btn-success" data-dismiss="modal">{{ __('allergies.ok') }}</button>
<button type="button" class="btn btn-success"
data-dismiss="modal">{{ __('allergies.ok') }}</button>
</div>
</div>
</div>
@@ -364,9 +436,12 @@
$.ajax({
type: 'POST',
url: '/store_patient_allergies',
data: {patient_allergies:patient_allergies, allergy_patient_id:allergy_patient_id},
data: {
patient_allergies: patient_allergies,
allergy_patient_id: allergy_patient_id
},
cache: false,
success: function (response) {
success: function(response) {
//display success notification modal
$("#saved_allergies_alert").fadeToggle(350);
@@ -374,19 +449,21 @@
let drug_categories_array = {!! json_encode($drug_categories_array) !!};
let patientAllergiesTabHtml = "";
if (typeof patient_allergies[0] !== 'undefined'){
patientAllergiesTabHtml += "&#8226 <small style=\"color: red;\">" + drug_categories_array[patient_allergies[0]] + "</small><br>";
if (typeof patient_allergies[0] !== 'undefined') {
patientAllergiesTabHtml += "&#8226 <small style=\"color: red;\">" +
drug_categories_array[patient_allergies[0]] + "</small><br>";
}
if (typeof patient_allergies[1] !== 'undefined'){
patientAllergiesTabHtml += "&#8226 <small style=\"color: red;\">" + drug_categories_array[patient_allergies[1]] + "</small><br>";
if (typeof patient_allergies[1] !== 'undefined') {
patientAllergiesTabHtml += "&#8226 <small style=\"color: red;\">" +
drug_categories_array[patient_allergies[1]] + "</small><br>";
}
$("#patient_allergies_tab").html(patientAllergiesTabHtml);
$('input[name="allergies[]"]').each(function() {
// loop through allergies and recheck values
if(jQuery.inArray(this.value, patient_allergies) !== -1){
if (jQuery.inArray(this.value, patient_allergies) !== -1) {
$(this).prop('checked', true);
} else {
$(this).prop('checked', false);
@@ -401,21 +478,46 @@
e.preventDefault();
$('#modal-alerts').modal('hide');
var alert_patient_id = $('#alert_patient_id').val();
var patient_alerts = $('#alerts').val();//
var patient_alerts = $('#alerts').val(); //
$.ajax({
type: 'POST',
url: '/store_patient_alerts',
data: {patient_alerts:patient_alerts, alert_patient_id:alert_patient_id},
data: {
patient_alerts: patient_alerts,
alert_patient_id: alert_patient_id
},
cache: false,
success: function (response) {
success: function(response) {
//display success notification modal
$("#saved_alerts_alert").fadeToggle(350);
}
});
});
$(window).on('load', function() {
let def_view = true;
$('.img-pat-profile').hover(
function() {
$('.img-pat-profile i').css('display', '');
},
function() {
$('.img-pat-profile i').css('display', 'none');
});
$('.img-pat-profile i').on('click tap', function(e) {
e.preventDefault();
if (def_view) {
$('.img-pat-profile').css('background-size', '100% auto');
} else {
$('.img-pat-profile').css('background-size', ' auto 100%');
}
def_view = !def_view;
})
});
</script>
@endpush
@@ -34,7 +34,7 @@
echo '<tr class="pricing">';
?>
<td class="center">{{ $patient->number }}</td>
<td class="center">{{ insurance_flag($patient->id) }}</td>
<td class="center">{!! insurance_flag($patient->id) !!}</td>
<td class="center">{{ $patient->gender == 1 ? __('allergies.male') : __('allergies.female') }}</td>
<td class="center">
<?php echo streamline_date_plain($patient->date_of_birth); ?>
@@ -0,0 +1,60 @@
<div class="modal fade" id="diagnosisModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('consultations.add_new_diagnosis') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('diagnosis_name', __('diagnoses.diagnosis_name')) }}
{{ Form::text('diagnosis_name', '', ['class' => 'form-control compulsory', 'id'=>'diagnosis_name']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('icd10_code', __('diagnoses.icd_10_code')) }}
{{ Form::text('icd10_code', '', ['class' => 'form-control','id'=>'icd10_code']) }}
</div>
<div class="form-group">
{{ Form::label('hmis_no_outpatient', __('diagnoses.hmis_out_patient_number')) }}
{{ Form::text('hmis_no_outpatient', '', ['class'=>'form-control','id'=>'hmis_no_outpatient']) }}
</div>
<div class="form-group">
{{ Form::label('hmis_no_inpatient', __('diagnoses.hmis_inpatient_category')) }}
{{ Form::text('hmis_no_inpatient', '', ['class'=>'form-control','id'=>'hmis_no_inpatient']) }}
</div>
<div class="form-group">
{{ Form::label('hmis_category', __('diagnoses.hmis_category')) }}
{{ Form::select('hmis_category', $hmis_categories, '', ['class' => 'form-control','id'=>'hmis_category']) }}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('diagnosis_prompts', __('diagnoses.diagnosis_prompt')) }}
{{ Form::textArea('diagnosis_prompts', '', ['class'=>'form-control','id'=>'diagnosis_prompts', 'rows' => 5]) }}
</div>
<div class="form-group">
{{ Form::label('', __('diagnoses.chronic_status'), ["class"=>'col-md-12']) }}
&nbsp;{{ __('diagnoses.yes') }} {{ Form::radio('chronic_status', 1, false, ['class' => 'check', 'id' => 'chronic_yes']) }}
&nbsp;{{ __('diagnoses.no') }} {{ Form::radio('chronic_status', 0, false, ['class' => 'check', 'id' => 'chronic_no']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('consultations.cancel') }}</button>
<a class="btn btn-success" onclick="submitDiagnosis()">{{ __('consultations.add_diagnosis') }}</a>
</div>
</div>
</div>
</div>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,63 @@
<div class="modal" id="document_modal" tabindex="-1" role="dialog" aria-labelledby="document_modal_label" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="debt_plan_modal_label"><b>Add Patient Document</b></h5>
</div>
<div class="modal-body">
<div class="row">
{{ Form::open(['route' => 'patient_documents.modal_store','data-toggle'=>'validator','files'=>'true']) }}
{{--<form id="add_document_form" method="post" enctype="multipart/form-data">--}}
<div class="col-sm-12">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('patientnumber','Patient Number') }}
{{ Form::text('patientnumber',$patient->number,['class' => 'form-control compulsory', 'required',
'data-error'=>'','readonly'=>'true', 'id'=>'patientnumber']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('documenttitle','Document Title') }}
{{ Form::text('documenttitle','',['class' => 'form-control compulsory', 'required', 'data-error'=>'', 'id'=>'documenttitle' ]) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('description','Description') }}
{{ Form::textArea('description','',['class' => 'form-control', 'id'=>'description']) }}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('documentdate','Date of document') }}
<div class="input-group">
{{ Form::text('documentdate','',['class' => 'form-control compulsory', 'required','readonly',
'id'=>'documentdate']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('document','Document') }}
{{ Form::file('document',['class' => 'form-control compulsory', 'required', 'id'=>'document']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel Document</button>
<button type="submit" class="btn btn-success" >Save Document</button>
</div>
{{--</form>--}}
{{ Form::close() }}
</div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,250 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Referral Notes - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
font-size: 0.8em;
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
.card-header{
padding: 5px;
}
</style>
</head>
@php
$total_deposits_paid = 0;
$total_amount_to_pay = 0;
$discount_amount = 0;
$insurance_hospital_stay = 0;
$insurance_investigations = 0;
$insurance_treatments = 0;
$insurance_sundries = 0;
$insurance_procedures = 0;
$insurance_tta = 0;
$insurance_services = 0;
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
$investigation_amount_total = 0;
@endphp
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;"> OUT-PATIENT REFERRAL NOTES</h5>
<div class="row">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>Clinic</th>
<td>
{{ get_name($consultation->clinic_id, 'id', 'name', 'clinics') }} &nbsp;
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>Consultation Date</th>
<td>
{{ streamline_date($consultation->created_at) }}
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th></th>
<td>
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<div class="row">
@if( Auth::user()->can('view-patient-episode-primary-diagnoses'))
<div class="col">
<div class="card">
<div class="card-header">
<strong>Primary Diagnosis</strong>
</div>
@php
$primary_diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($consultation->primary_diagnosis);
@endphp
<table class="table table-light table-sm">
<thead>
<tr>
<td>{{ $primary_diagnosis ? $primary_diagnosis->name : "" }}</td>
</tr>
</thead>
</table>
</div>
@php
$other_diagnoses = @unserialize($consultation->other_diagnoses);
@endphp
@if(!empty($other_diagnoses))
<div class="card">
<div class="card-header">
<strong>Secondary Diagnosis</strong>
</div>
<table class="table table-light table-sm">
<thead>
@foreach($other_diagnoses as $diagnosis)
@php
$other_diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($diagnosis);
@endphp
<tr>
<td>{{ $other_diagnosis ? $other_diagnosis->name : "" }}</td>
</tr>
@endforeach
</thead>
</table>
</div>
@endif
</div>
@endif
</div>
<br>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<strong>Investigations done</strong>
</div>
<table class="table table-light table-sm">
<thead>
@if(count($ward_investigations) > 0)
@for($i = 0; $i < count($ward_investigations['name']); $i++)
@if(in_array($i, $ward_investigations_position))
<tr>
<td colspan="3">
<h5><code>{{ $ward_investigations_date[array_search($i, $ward_investigations_position)] }}</code></h5>
</td>
</tr>
@endif
<tr>
<td>{{ $ward_investigations['name'][$i] }}</td>
<input type="hidden" name="ward_investigation_ids[]" value="{{ $ward_investigations['id'][$i] }}">
<td>
@if($ward_investigations['type'][$i] == 1 && $ward_investigations['value'][$i] != "Pending")
<i style="color: blue"> Refer to investigation report </i>
@else
{{ $ward_investigations['value'][$i] }}
@endif
</td>
<td>{{ $ward_investigations['comment'][$i] }}</td>
</tr>
@endfor
@else
<tr>
<td colspan="3">No investigations done</td>
</tr>
@endif
</thead>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<strong>Referral Notes</strong>
</div>
<table class="table table-light table-sm">
<thead>
<tr>
<td>{{ $consultation->referral_notes }}</td>
</tr>
</thead>
</table>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col">
<div class="card">
<table class="table table-light table-sm">
<thead>
<tr>
<td><b>Referred By: </b></td>
<td>{{ !is_null($consultation->consultation_done_by) ? get_full_name($consultation->consultation_done_by, "id", "first_name", "last_name", "users") : get_full_name($consultation->created_by, "id", "first_name", "last_name", "users")}} to {{ get_name($consultation->referred_to, 'id', 'name', 'referral_hospitals') }}</td>
</tr>
</thead>
</table>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
Printed By
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">
<?php echo Auth::user()->first_name . ' ' . Auth::user()->last_name; ?>
&nbsp;&nbsp;&nbsp;....................................................
&nbsp;&nbsp;&nbsp;({{ streamline_date(date("Y-m-d")) }})
</li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,88 @@
@php
$had_positive_response_to_tb_qn = false;
@endphp
@if($triage)
@if ($triage->any_tb_sysmptoms == 1)
@php
if($triage->cough_for_2_weeks == 1 || $triage->fever_for_2_weeks || $triage->tb_weight_loss || $triage->tb_poor_weight_gain || $triage->tb_excessive_night_sweats || $triage->tb_contact_with_tb_person){
$had_positive_response_to_tb_qn = true;
}
$consultation = \Streamline\Models\Consultation::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->first();
$tb_assessment_status = false;
if ($consultation) {
$tb_assessment_status = $consultation->tb_status_assessment;
}
@endphp
@endif
@endif
@if ($had_positive_response_to_tb_qn)
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<table class="table table-hover color-table info-table table-bordered">
<thead>
<tr>
<th colspan="3">Please show your assessment of the patients TB Status: </span></th>
</tr>
</thead>
<tbody>
<tr class="cough_tb_question" style="background-color: #f3f3f5;">
<td>Definite TB &nbsp;
<input type="radio" name='tb_status_assessment' id='patient_tb_status_definite_tb' class="patient_tb_status" value="1" {!! $tb_assessment_status == 1 ? "checked='true'" : "" !!} required>
</td>
<td>Possible TB &nbsp;
<input type="radio" name='tb_status_assessment' id='patient_tb_status_possible_tb' class="patient_tb_status" value="2" {!! $tb_assessment_status == 2 ? "checked='true'" : "" !!} required>
</td>
<td>Definitely not TB &nbsp;
<input type="radio" name='tb_status_assessment' id='patient_tb_status_definitely_not_tb' class="patient_tb_status" value="3" {!! $tb_assessment_status == 3 ? "checked='true'" : "" !!} required>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="TBActionModal" tabindex="-1" role="dialog" aria-labelledby="modalTBActionLabel1" style="margin-top: 10%">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<br>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1"><strong style="color: rgb(68, 165, 221);">TB Assesment</strong></h4>
</div>
<div class="modal-body">
<div class="definite_tb_message" style="display:none; font-weight:bolder; font-size:16px">
Ensure the Patient is registered in TB Treatment Unit
</div>
<div class="possible_tb_message" style="display:none; font-weight:bolder; font-size:16px">
Organise further investigations and follow up to check for TB
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
$('.patient_tb_status').change(function(){
if($("#patient_tb_status_definite_tb").is(':checked') && $("#patient_tb_status_possible_tb").is(":not(:checked)")){
$("#TBActionModal").modal("show");
$(".definite_tb_message").show();
$(".possible_tb_message").hide();
}
if($("#patient_tb_status_possible_tb").is(":checked") && $("#patient_tb_status_definite_tb").is(":not(:checked)")){
$("#TBActionModal").modal("show");
$(".possible_tb_message").show();
$(".definite_tb_message").hide();
}
})
</script>
@endpush
@endif
@@ -59,10 +59,7 @@
<td>{{ $patient->first_name }} {{ $patient->last_name}}</td>
<td>{{ $document->title }}</td>
<td>{{ $document->description }}</td>
@php
$uploaded_by = \Streamline\Models\User::find($document->created_by);
@endphp
<td>{{ $uploaded_by->first_name }} {{ $uploaded_by->last_name }}</td>
<td>{{ get_full_name($document->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td><a href="/patient_documents/{{ $document->id }}" target="_blank">{{ __('patient_documents.preview') }}</a></td>
<td>
{{ Form::model($document->id ,['method' => 'DELETE', 'route' => ['patient_documents.destroy', $document->id]]) }}
@@ -8,15 +8,12 @@
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ public_path('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Bill - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ public_path('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
font-size: 0.8em;
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
@@ -54,7 +51,7 @@
</tr>
<tr>
<th scope="row">{{ __('patient_file.age') }}</th>
<td><?php echo \Carbon\Carbon::parse($patient->date_of_birth)->age; ?> {{ __('patient_file.years') }}</td>
<td><?php echo get_patients_age($patient->date_of_birth, $episode->created_at); ?></td>
<th scope="row">{{ __('patient_file.gender') }}</th>
<td><?php echo $patient->gender == 1 ? __('patient_file.male') : __('patient_file.female') ?></td>
</tr>
@@ -71,6 +68,12 @@
@else
{{ $outcomes[$consultation->outcome_id] ?? "" }}
@endif
@elseif (!empty($main_exam->outcome_id))
@if($main_exam->outcome_id == 3)
{{ $outcomes[$main_exam->outcome_id] . ' on (' . streamline_date($main_exam->followup_when) . ')' }}
@else
{{ $outcomes[$main_exam->outcome_id] ?? "" }}
@endif
@elseif (!empty($antenatal_data->outcome_id))
@if($antenatal_data->outcome_id == 3)
{{ $outcomes[$antenatal_data->outcome_id] . ' on (' . streamline_date($antenatal_data->followup_when) . ')' }}
@@ -80,10 +83,259 @@
{{ $outcomes[$antenatal_data->outcome_id] ?? "" }}
@endif
@endif
</td>
</tr>
</table>
@if($triage)
<div class="row"><div class="col text-center"><h5>{{ __('consultations.triage_details') }}</h5></div></div>
@php
$observations_array = explode(',', $triage->observations); //i.e[temp=44,height=2]
$parent_observation_array = isset($parent_triage_details) ? explode(',', $parent_triage_details->observations): [];
@endphp
<div class="row">
<div class="col">
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr>
<th><b>{{ __('consultations.observation') }}</b></th>
<th><b>{{ __('consultations.value') }}</b></th>
@if(check_if_episode_is_a_followup($episode->id))
<th>
{{ __('consultations.previous_value') }}
</th>
@endif
</tr>
</thead>
<tbody>
@php $counter = 0; @endphp
@foreach($observations_array as $observation)
@php
$item_array = explode('=', $observation); //i.e[temp,44]
$counter++;
@endphp
@if($counter < 9)
<tr>
<td>{{ $item_array[0] }}</td>
<td>{{ $item_array[1] }}</td>
<!-- show details of past triage of original episode -->
@if(check_if_episode_is_a_followup($episode->id))
@foreach($parent_observation_array as $parent_observation)
@php
$parent_item_array = isset($parent_triage_details) ? explode('=', $parent_observation) : [];
@endphp
@if($item_array[0] == $parent_item_array[0])
<td>
{{ $parent_item_array[1] }}
</td>
@endif
@endforeach
@endif
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
<div class="col">
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr>
<th><b>{{ __('consultations.observation') }}</b></th>
<th><b>{{ __('consultations.value') }}</b></th>
@if(check_if_episode_is_a_followup($episode->id))
<th>
{{ __('consultations.previous_value') }}
</th>
@endif
</tr>
</thead>
<tbody>
@php $counter=0; @endphp
@foreach($observations_array as $observation)
@php
$item_array = explode('=', $observation); //i.e[temp,44]
$counter++;
@endphp
@if($counter >= 9)
<tr>
<td>{{ isset($item_array[0]) ? $item_array[0] : "" }}</td>
<td>{{ isset($item_array[1]) ? $item_array[1] : "" }}</td>
<!-- show details of past triage of original episode -->
@if(check_if_episode_is_a_followup($episode->id))
@foreach($parent_observation_array as $parent_observation)
@php
$parent_item_array = isset($parent_triage_details) ? explode('=', $parent_observation) : [];
@endphp
@if($item_array[0] == $parent_item_array[0])
<td>
{{ $parent_item_array[1] }}
</td>
@endif
@endforeach
@endif
</tr>
@endif
@endforeach
<tr>
<td>{{ __('consultations.triage_grade') }}</td>
<td>
@switch($triage->severe_grade)
@case (1)
<div><span class="text-success" style="font-weight: bolder;">{{ __('consultations.green') }}</span></div>
@break
@case (2)
<div><span class="text-warning" style="font-weight: bolder;">{{ __('consultations.yellow') }}</span></div>
@break
@case (3)
<div><span class="text-danger" style="font-weight: bolder;">{{ __('consultations.red') }}</span></div>
@break
@default
<code>{{ __('consultations.triage_grade_not_determined') }}</code>
@endswitch
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br><br>
@php $nutrition = DB::table('triage_nutrition')->where('patient_id', $triage->patient_id)->where('episode_id', $triage->episode_id)->first(); @endphp
@if(is_smart_triage_enabled() && $nutrition)
<table class="table table-striped table-bordered">
<tr>
<td class="text-center" colspan="2"><h4>Nutritional Status</h4></td>
</tr>
<tr class="cough_tb_question">
<td>{{ $nutrition->text }}</td>
<td>{{ $nutrition->reason }}</td>
</tr>
</table>
@endif
<strong>{{ __('consultations.comment') }}:</strong> {{ !is_null($triage) ? $triage->comments : "" }}<br>
<strong>{{ __('consultations.triage_done_by') }}:</strong> {!! '<font style="color:blue;">'.\Streamline\Models\User::withTrashed()->find($triage->created_by)->first_name. " ".\Streamline\Models\User::withTrashed()->find($triage->created_by)->last_name.' on '.streamline_date_time($triage->created_at).'</font>' !!}
<br><br>
@endif
{{-- Symptoms, Priority and Emergency Signs --}}
<div class="row">
<div class="col">
<div class="card-deck">
<div class="card border-0">
<div class="card-block">
<div class="card-header">
<h5 class="card-title text-center">{{ __('consultations.symptoms') }}</h5>
</div>
@if (!empty($triage->symptoms) || !empty($consultation->symptoms))
@php
$symptoms_explode = !empty($triage->symptoms)? explode(",", $triage->symptoms):explode(",", $consultation->symptoms);
$symptoms_duration = !empty($triage->symptom_duration)? explode(",", $triage->symptom_duration):explode(",", $consultation->symptom_duration);
@endphp
<p class="card-text">
<ul class="list-group list-group-flush">
@foreach ($symptoms_explode as $key => $symptom)
<li class="list-group-item text-center">{{ ucwords($symptoms[$symptom] ?? '') }} for {{ $symptoms_duration[$key]?? '' }}</li>
@endforeach
</ul>
</p>
@else
<p class="card-text">
<ul class="list-group list-group-flush">
<li class='list-group-item text-center font-weight-bold text-danger'>{{ __('consultations.no_symptom_recorded') }}</li>
</ul>
</p>
@endif
</div>
</div>
@if (between($years, 0, 12))
<div class="card border-0">
<div class="card-block">
<div class="card-header">
<h5 class="card-title text-center">{{ __('triage.emergency_signs') }}</h5>
</div>
@if (!empty($emergent_signs))
<p class="card-text">
<ul class="list-group list-group-flush">
@foreach ($emergent_signs as $emergent_sign)
<li class='list-group-item text-center'>{{ ucwords($emergent_sign ?? '') }}</li>
@endforeach
</ul>
</p>
@else
<p class="card-text text-success">
<ul class="list-group list-group-flush">
<li class='list-group-item text-center text-success font-weight-bold'>{{ __('layout.no_emergency_signs') }}</li>
</ul>
</p>
@endif
</div>
</div>
<div class="card border-0">
<div class="card-block">
<div class="card-header">
<h5 class="card-title text-center">{{ __('layout.priority_signs') }}</h5>
</div>
@if (count($priority_signs) > 0)
<p class="card-text">
<ul class="list-group list-group-flush">
@foreach ($priority_signs as $priority_sign)
<li class='list-group-item text-center'>{{ ucwords($priority_sign ?? '') }}</li>
@endforeach
</ul>
</p>
@else
<p class="card-text">
<ul class="list-group list-group-flush">
<li class='list-group-item text-center text-success font-weight-bold'>{{ __('layout.no_priority_signs') }}</li>
</ul>
</p>
@endif
</div>
</div>
@endif
@if (isset($triage->any_tb_sysmptoms) && $triage->any_tb_sysmptoms == 1)
<div class="card border-0">
<div class="card-block">
<div class="card-header">
<h5 class="card-title text-center">{{ __('layout.tb_screening') }}</h5>
</div>
<table class="table table-bordered">
<tr class="cough_tb_question">
<td>A cough for more than two weeks?</td>
<td>{{ $triage->cough_for_2_weeks == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="fever_tb_question">
<td>Persistent fevers for 2 weeks or more?</td>
<td>{{ $triage->fever_for_2_weeks == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="weight_loss_tb_question">
<td>Noticeable weight loss of more than 3 Kg?</td>
<td>{{ $triage->tb_weight_loss == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="weight_loss_tb_question">
<td>Poor weight gain in the last one month?</td>
<td>{{ $triage->tb_poor_weight_gain == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="excessive_night_sweats_tb_question">
<td>Excessive night sweats for three weeks or more?</td>
<td>{{ $triage->tb_excessive_night_sweats == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="excessive_night_sweats_tb_question">
<td>Contact with a person with pulmonary TB or chronic cough?</td>
<td>{{ $triage->tb_contact_with_tb_person == 1 ? "Yes" : "No" }}</td>
</tr>
</table>
</div>
</div>
@endif
</div>
</div>
</div> <br>
@if($consultation)
<table class="table table-sm table-bordered">
<thead class="thead-light">
@@ -167,8 +419,497 @@
</table>
@endif
@endif
@if($main_exam)
<div class="row">
<div class="col-6">
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th colspan="3" class="text-center">External</th>
</tr>
</thead>
<tbody>
<tr>
<th width="10%"></th>
<th width="45%" class="text-center">Right</th>
<th width="45%" class="text-center">Left</th>
</tr>
<tr>
<th>Ext</th>
<th class="text-center">{{ $main_exam->external_right }}</th>
<th class="text-center">{{ $main_exam->external_left }}</th>
</tr>
</tbody>
</table>
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th colspan="3" class="text-center">Slit Lamp</th>
</tr>
</thead>
<tbody>
<tr>
<th width="20%"><b>Section</b></th>
<th width="40%" class="text-right"><b>Right</b></th>
<th width="40%" class="text-right"><b>Left</b></th>
</tr>
@foreach($slit_lamp_test_areas as $area)
<tr>
<td><b>{{ $area->name }}</b></td>
@php
$right_slug = $area->slug."_right";
$left_slug = $area->slug."_left";
$left_other_slug = $area->slug."_other_left";
$right_other_slug = $area->slug."_other_right";
@endphp
<td class="text-center">
@if(in_array($main_exam->$right_slug, $slit_lamp_test_area_ids))
@php
$value_array = explode(',', $main_exam->$right_slug);
@endphp
@for($x = 0; $x < count($value_array); $x++)
- {{ $slit_lamp_test_area_values[$value_array[$x]] }} <br/>
@endfor
@endif
@if(isset($right_other_slug))
- {{ $main_exam->$right_other_slug }}
@endif
</td>
<td class="text-center">
@if(in_array($main_exam->$left_slug, $slit_lamp_test_area_ids))
@php
$value_array = explode(',', $main_exam->$left_slug);
@endphp
@for($x = 0; $x < count($value_array); $x++)
- {{ $slit_lamp_test_area_values[$value_array[$x]] }} <br/>
@endfor
@endif
@if(isset($left_other_slug))
- {{ $main_exam->$left_other_slug }}
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
@if (!empty($main_exam->doctors_notes))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('inpatient.doctor_comments') }} (Main Exam)</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($main_exam->doctors_notes)) !!}</td></tr>
</tbody>
</table>
@endif
</div>
<div class="col-6">
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th>EYE</th>
<th>SECTION</th>
<th>DIAGNOSIS</th>
</tr>
</thead>
<tbody>
@php
$right_diagnosis_array = explode(",", $main_exam->right_eye_diagnosis);
$left_diagnosis_array = explode(",", $main_exam->left_eye_diagnosis);
@endphp
@if(count($right_diagnosis_array) > 0)
@foreach($right_diagnosis_array as $id)
<tr>
<td>Right</td>
<td>{{ get_name(get_name($id, 'id', 'diagnosis_category', 'diagnoses'),'id','name','diagnosis_categories') }}</td>
<td>{{ get_name($id, 'id', 'name', 'diagnoses') }}</td>
</tr>
@endforeach
@else
<th>-</th>
<th>-</th>
<th>-</th>
@endif
@if(count($left_diagnosis_array) > 0)
@foreach($left_diagnosis_array as $id)
<tr>
<td>Left</td>
<td>{{ get_name(get_name($id, 'id', 'diagnosis_category', 'diagnoses'),'id','name','diagnosis_categories') }}</td>
<td>{{ get_name($id, 'id', 'name', 'diagnoses') }}</td>
</tr>
@endforeach
@else
<th>-</th>
<th>-</th>
<th>-</th>
@endif
</tbody>
</table>
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th colspan="2" class="text-center">IOP</th>
</tr>
</thead>
<tbody>
<tr>
<th width="45%" class="text-center">Right</th>
<th width="45%" class="text-center">Left</th>
</tr>
<tr>
<th class="text-center">{{ $main_exam->iop_right ?? '-' }}</th>
<th class="text-center">{{ $main_exam->iop_left ?? '-' }}</th>
</tr>
</tbody>
</table>
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th colspan="2" class="text-center">CDR</th>
</tr>
</thead>
<tbody>
<tr>
<th width="45%" class="text-center">Right</th>
<th width="45%" class="text-center">Left</th>
</tr>
<tr>
<th class="text-center">{{ $main_exam->cdr_right ?? '-' }}</th>
<th class="text-center">{{ $main_exam->cdr_left ?? '-' }}</th>
</tr>
</tbody>
</table>
</div>
</div>
@endif
@if($base_exam)
<br><br>
<div class="row">
<div class="col-6">
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th class="text-left">Visual Acuity</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<br>
<div class="row">
<div class="col-2">Distance</div>
<div class="col-5">Right</div>
<div class="col-5">Left</div>
</div>
<br>
<div class="row" style="margin-bottom: 10px">
<div class="col-2 text-center">sc</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_sc_right', $base_exam->visual_acuity_distance_sc_right, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_sc_left', $base_exam->visual_acuity_distance_sc_left, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-2 text-center">ph</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_ph_right', $base_exam->visual_acuity_distance_ph_right, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_ph_left', $base_exam->visual_acuity_distance_ph_left, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-2 text-center">cc</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_cc_right', $base_exam->visual_acuity_distance_cc_right, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_cc_left', $base_exam->visual_acuity_distance_cc_left, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<div class="row">
<div class="col-2">Near</div>
<div class="col-10"></div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-2 text-center">sc</div>
<div class="col-5">
{{ Form::text('visual_acuity_near_sc_right', $base_exam->visual_acuity_near_sc_right, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-5">
{{ Form::text('visual_acuity_near_sc_left', $base_exam->visual_acuity_near_sc_left, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<div class="row">
<div class="col-2 text-center">cc</div>
<div class="col-5">
{{ Form::text('visual_acuity_near_cc_right', $base_exam->visual_acuity_near_cc_right, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-5">
{{ Form::text('visual_acuity_near_cc_left', $base_exam->visual_acuity_near_cc_left, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
</td>
</tr>
</tbody>
</table>
Add
<div class="row">
<div class="col-md-12">
{{ Form::text('added_values',$base_exam->added_values, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<br/>
<div class="row">
<div class="col-6 form-group">
<label>Best Vision Right Eye</label>
{{ Form::text('best_right_vision',$base_exam->best_right_vision, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-6 form-group">
<label>Best Vision Left Eye</label>
{{ Form::text('best_left_vision',$base_exam->best_left_vision, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<br/>
</div>
<div class="col-6">
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th class="text-center">Refraction</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="row">
<div class="col-6">
Autorefractor
</div>
</div>
<br>
<div class="row" style="margin-bottom: 10px">
<div class="col-1"></div>
<div class="col-11">
<div class="row">
<div class="col-4">Sphere</div>
<div class="col-4">Cylinder</div>
<div class="col-4">Axis</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">R</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->manifest_auto_right_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_auto_right_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_auto_right_axis ?? "-" }}
</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">L</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->manifest_auto_left_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_auto_left_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_auto_left_axis ?? "-" }}
</div>
</div>
</div>
</div>
Keratometry
<div class="row" style="margin-bottom: 10px">
<div class="col-1"></div>
<div class="col-11">
<div class="row">
<div class="col-4">K1</div>
<div class="col-4">K2</div>
<div class="col-4">Axis</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">R</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->keratometry_k1_right ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->keratometry_k2_right ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->keratometry_axis_right ?? "-" }}
</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">L</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->keratometry_k1_left ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->keratometry_k2_left ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->keratometry_axis_left ?? "-" }}
</div>
</div>
</div>
</div>
Retinoscope
<div class="row" style="margin-bottom: 10px">
<div class="col-1"></div>
<div class="col-11">
<div class="row">
<div class="col-4">Sphere</div>
<div class="col-4">Cylinder</div>
<div class="col-4">Axis</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">R</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->manifest_ret_right_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_ret_right_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_ret_right_axis ?? "-" }}
</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">L</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->manifest_ret_left_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_ret_left_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_ret_left_axis ?? "-" }}
</div>
</div>
</div>
</div>
Subjective
<div class="row" style="margin-bottom: 10px">
<div class="col-1"></div>
<div class="col-11">
<div class="row">
<div class="col-4">Sphere</div>
<div class="col-4">Cylinder</div>
<div class="col-4">Axis</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">R</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->subjective_right_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->subjective_right_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->subjective_right_axis ?? "-" }}
</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">L</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->subjective_left_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->subjective_left_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->subjective_left_axis ?? "-" }}
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-6 form-group">
<label>PD for Right Eye</label>
{{ Form::text('pd_right_eye', $base_exam->pd_right_eye, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-6 form-group">
<label>PD for Left Eye</label>
{{ Form::text('pd_left_eye', $base_exam->pd_left_eye, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<br/>
</div>
</div>
@if (!is_null($base_exam->comment))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('inpatient.doctor_comments') }} (Base Refraction Exam)</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($base_exam->comment)) !!}</td></tr>
</tbody>
</table>
@endif
@endif
@if($antenatal_data)
<table class="table table-sm table-bordered">
<thead class="thead-light">
@@ -184,15 +925,6 @@
<tbody>
<tr>
<td>{{ $diagnoses[$primary_diagnosis] ?? "" }}</td>
{{-- <td>
@if (!is_null($antenatal_data->consultation_done_by))
{{ get_full_name($antenatal_data->consultation_done_by, 'id', 'first_name', 'last_name', 'users')}}
@elseif(!is_null($antenatal_data->updated_by))
{{ get_full_name($antenatal_data->updated_by, 'id', 'first_name', 'last_name', 'users')}}
@else
{{ get_full_name($antenatal_data->created_by, 'id', 'first_name', 'last_name', 'users')}}
@endif
</td> --}}
</tr>
@if(is_array($other_diagnoses_array))
@for($i = 0; $i < count($other_diagnoses_array); $i++)
@@ -250,7 +982,6 @@
</tbody>
</table>
@endif
@endif
<div class="row">
@@ -261,6 +992,7 @@
<tr>
<th>{{ __('patient_file.investigation') }}</th>
<th>{{ __('patient_file.result') }}</th>
<th>{{ __('patient_file.normal_ranges') }}</th>
<th>{{ __('patient_file.comment') }}</th>
</tr>
</thead>
@@ -274,10 +1006,11 @@
@if (!empty($opd_investigations['type'][$i]))
<strong><code>See attached</code></strong>
@else
{{ $opd_investigations['value'][$i] }}
@endif
{!! nl2br(e($opd_investigations['value'][$i])) !!}
@endif
</td>
<td>{{ $opd_investigations['comment'][$i] }}</td>
<td>{{ $opd_investigations['normal_ranges'][$i] }}</td>
<td>{!! nl2br(e($opd_investigations['comment'][$i])) !!}</td>
</tr>
@endif
@endfor
@@ -302,7 +1035,7 @@
<tr>
<td>{{ $procedures[$id] ?? "" }}</td>
</tr>
@endforeach
@endforeach
@endforeach
</tbody>
</table>
@@ -379,9 +1112,11 @@
<th>{{ __('patient_file.treatment') }}</th>
<th>{{ __('patient_file.dosage_freq') }}</th>
<th></th>
<th>{{ __('prescriptions.instructions') }}</th>
</tr>
</thead>
<tbody>
@php $progressive_ids = []; @endphp
@foreach($treatments as $treatment)
<?php
$drugs_array = explode(",", $treatment->drugs);
@@ -390,8 +1125,14 @@
$frequencies_array = explode(",", $treatment->frequencies);
$duration_array = explode(",", $treatment->durations);
$quantity_dispensed_array = explode(",", $treatment->quantities_dispensed);
$total_drug_price = 0;
$instructions_array = explode(",", $treatment->instruction);
$purchased_elsewhere_array = explode(",", $treatment->purchased_elsewhere);
// check if treatment is progressive and ignore
if ($treatment->is_treatment_progressive != 0) {
$progressive_ids[] = $treatment->is_treatment_progressive;
continue;
}
?>
@for ($x = 0; $x < count($drugs_array); $x++)
<?php
@@ -411,17 +1152,62 @@
<tr>
<td>
{{ get_name($drugs_array[$x], 'id', 'name', 'drugs') }}
{{ $drug_details->name }}
@if($purchased_elsewhere_array[$x] == 1)
<code>( To Be Purchased elsewhere )</code>
@endif
</td>
<td>
({{ $dosage_array[$x] }} {!! $drug_unit !!} &nbsp;&nbsp; {{ get_name($frequencies_array[$x], 'id', 'name', 'dosage_frequencies') }})
</td>
<td>
{{ $duration_array[$x] }}
</td>
<td>{{ $duration_array[$x] ?? "" }}</td>
<td>{{ $instructions_array[$x] ?? "" }}</td>
</tr>
@endfor
@endforeach
@if(count($progressive_ids) > 0)
@php
$progressive_treatments = \Illuminate\Support\Facades\DB::table('treatments_opd_progressive')->whereIn('id', $progressive_ids)->get();
@endphp
@foreach($progressive_treatments as $treatment)
<?php
$drugs_array = explode(",", $treatment->drugs);
$dosage_array = explode(",", $treatment->dose);
$frequencies_array = explode(",", $treatment->drug_frequency);
$duration_array = explode(",", $treatment->durations);
$quantity_dispensed_array = explode(",", $treatment->quantities_to_dispense);
$instructions_array = explode(",", $treatment->instruction);
?>
@for ($x = 0; $x < count($drugs_array); $x++)
<?php
$drug_details = \Streamline\Models\Drug::find($drugs_array[$x]);
if (!$drug_details) {
continue;
}
$drug_form_name = get_name($drug_details->form_id, "id", "name", "unit_of_measure");
$drug_unit = get_name($drug_details->unit_id, "id", "name", "drug_units");
$drug_strength = $drug_details->strength;
$treatment_dosage = $dosage_array[$x] ?? "";
$treatment_strength = $drug_strength ?? "";
?>
<tr>
<td>{{ $drug_details->name }}</td>
<td>
({{ $dosage_array[$x] }} {!! $drug_unit !!} &nbsp;&nbsp; {{ get_name($frequencies_array[$x], 'id', 'name', 'dosage_frequencies') }})
</td>
<td>{{ $duration_array[$x] ?? "" }}</td>
<td>{{ $instructions_array[$x] ?? "" }}</td>
</tr>
@endfor
@endforeach
@endif
</tbody>
</table>
</div>
@@ -432,11 +1218,11 @@
<tbody>
<tr>
<td style="text-align: center">
<img style="max-width: 300px; max-height: 150px;" src="{{ asset($hospitalInfo->stamp) }}" class="img-fluid mx-auto d-block mx-3" alt="{{ $hospitalInfo->name}} stamp">
<img style="max-width: 300px; max-height: 150px;" src="{{ public_path($hospitalInfo->stamp) }}" class="img-fluid mx-auto d-block mx-3" alt="{{ $hospitalInfo->name}} stamp">
</td>
</tr>
</tr>
</tbody>
</table>
</table>
@endif
</div>
</body>
File diff suppressed because it is too large Load Diff
@@ -48,7 +48,7 @@
<div class="col-md-2">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('patient_flow_monitoring.date')) }}
{{ Form::select('search_by', ['4'=>'Today', '0'=>'Last 24 hours','1'=>'Custom Date','2'=>'Custom Range'], '', ['class' => 'form-control','id'=>'search_by', 'required']) }}
{{ Form::select('search_by', ['4'=>'Today', '0'=>'Yesterday','1'=>'Custom Date','2'=>'Custom Range'], '', ['class' => 'form-control','id'=>'search_by', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
@@ -143,12 +143,12 @@
@php
$counter++;
$patient = \DB::table('patients')->where('id', $episode->patient_id)->first();
//$triage = \DB::table('triage')->where('episode_id', $episode->id)->first();
//$consultation = \DB::table('consultations')->where('episode_id', $episode->id)->first();
$investigation_results = \DB::table('investigation_results')->where('episode_id', $episode->id)->first();
$investigation_orders = \DB::table('ordered_investigations')->where('episode_id', $episode->id)->first();
$treatment_details = \DB::table('treatments')->where('episode_id', $episode->id)->orderBy('created_at', 'desc')->first();
$patient = \Illuminate\Support\Facades\DB::table('patients')->where('id', $episode->patient_id)->first();
$investigation_results = \Illuminate\Support\Facades\DB::table('investigation_results')->where('episode_id', $episode->id)->first();
$investigation_orders = \Illuminate\Support\Facades\DB::table('ordered_investigations')->where('episode_id', $episode->id)->first();
$treatment_details = \Illuminate\Support\Facades\DB::table('treatments')->where('episode_id', $episode->id)->orderBy('created_at', 'desc')->first();
$main_exam = \Illuminate\Support\Facades\DB::table('eye_clinic_main_exam')->where('episode_id', $episode->id)->first();
$is_patient_in_eye_clinic = is_patient_in_eye_clinic($episode->id);
@endphp
@if($episode->paid_over == "pos")
@@ -218,13 +218,13 @@
@elseif (in_array("1", $per_inv_explode) && in_array("0", $per_inv_explode))
<span style = "color: #33CC33; font-weight: bold;">{{ __('patient_flow_monitoring.some_results_available') }}<span>
@elseif (array_unique($per_inv_explode) == array("0"))
<span style = "color: #99CC00; font-weight: bold;">{{ __('patient_flow_monitoring.ordered') }}</span>
<span style = "color: #99CC00; font-weight: bold;">{{ __('patient_flow_monitoring.ordered') }}</span>
@endif
@elseif(isset($investigation_orders))
<span style="color: #99CC00">{{ __('patient_flow_monitoring.ordered') }}</span>
@else
N/A
@endif
@elseif(isset($investigation_orders))
<span style="color: #99CC00">{{ __('patient_flow_monitoring.ordered') }}</span>
@else
N/A
@endif
</td>
<td>
<span class="label label-info">{{ __('patient_flow_monitoring.lab_self_request') }}</span>
@@ -268,10 +268,30 @@
@endif
</td>
<td>
@if (!$episode->episode_triage_id)
N/A
@if($is_patient_in_eye_clinic)
@php $base_refraction = \Illuminate\Support\Facades\DB::table('eye_clinic_base_exam_refraction')->where('episode_id', $episode->id)->first() @endphp
@if($base_refraction)
Base Exam Completed By {{ get_full_name($base_refraction->created_by, 'id', 'first_name', 'last_name', 'users') }}
@else
<span style="background-color: #FFFF00; color: black" class="label">Pending Base Exam</span>
@endif
<hr>
@if (is_null($episode->consultation_id))
<span style="background-color: red" class="label">Pending Main Exam</span>
@elseif (!is_null($episode->consultation_id) && get_name($episode->consultation_id, 'id', 'completed', 'eye_clinic_main_exam') == 0)
<span style="background-color: #FFFF00; color: black" class="label">Ongoing Main Exam</span>
@else
Main Exam Outcome: {{ $main_exam ? get_name($main_exam->outcome_id, 'id', 'name', 'outcomes') : "N/A" }}
@endif
@else
{!! severe_grade($episode->severe_grade) !!}
@if (!$episode->episode_triage_id)
N/A
@else
{!! severe_grade($episode->severe_grade) !!}
@endif
@endif
</td>
<td>
@@ -294,11 +314,37 @@
@endif
</td>
<td>
@php
$primary_diagnosis_id = empty($episode->consultation_id)? $episode->antenatal_primary_diagnosis :get_name($episode->consultation_id, 'id', 'primary_diagnosis', 'consultations');
@endphp
@if($can_user_view_diagnosis)
{{ get_name($primary_diagnosis_id, "id", "name", "diagnoses") }}
@if($is_patient_in_eye_clinic)
@php
$right_eye_diagnoses = explode(',',get_name($episode->consultation_id, 'id', 'right_eye_diagnosis', 'eye_clinic_main_exam'));
$left_eye_diagnoses = explode(',',get_name($episode->consultation_id, 'id', 'left_eye_diagnosis', 'eye_clinic_main_exam'));
@endphp
@if(count($right_eye_diagnoses) > 0)
<h5>Right Eye Diagnosis</h5>
<ul>
@for($x = 0; $x < count($right_eye_diagnoses); $x++)
<li>{{ get_name(get_name($right_eye_diagnoses[$x], 'id', 'diagnosis_category', 'diagnoses'), 'id', 'name', 'diagnosis_categories') }} - {{ $diagnoses[$right_eye_diagnoses[$x]] ?? '' }}</li>
@endfor
</ul>
@endif
@if(count($left_eye_diagnoses) > 0)
<h5>Left Eye Diagnosis</h5>
<ul>
@for($x = 0; $x < count($left_eye_diagnoses); $x++)
<li>{{ get_name(get_name($left_eye_diagnoses[$x], 'id', 'diagnosis_category', 'diagnoses'), 'id', 'name', 'diagnosis_categories') }} - {{ $diagnoses[$left_eye_diagnoses[$x]] ?? '' }}</li>
@endfor
</ul>
@endif
@else
@php
$primary_diagnosis_id = empty($episode->consultation_id)? $episode->antenatal_primary_diagnosis :get_name($episode->consultation_id, 'id', 'primary_diagnosis', 'consultations');
@endphp
@if($can_user_view_diagnosis)
{{ get_name($primary_diagnosis_id, "id", "name", "diagnoses") }}
@endif
@endif
</td>
<td>
@@ -310,32 +356,33 @@
@elseif (in_array("1", $per_inv_explode) && in_array("0", $per_inv_explode))
<span style = "color: #33CC33; font-weight: bold;">{{ __('patient_flow_monitoring.some_results_available') }}<span>
@elseif (array_unique($per_inv_explode) == array("0"))
<span style = "color: #99CC00; font-weight: bold;">{{ __('patient_flow_monitoring.ordered') }}</span>
@endif
@elseif(isset($investigation_orders))
<span style="color: #99CC00">{{ __('patient_flow_monitoring.ordered') }}</span>
@else
N/A
@endif
<span style = "color: #99CC00; font-weight: bold;">{{ __('patient_flow_monitoring.ordered') }}</span>
@endif
@elseif(isset($investigation_orders))
<span style="color: #99CC00">{{ __('patient_flow_monitoring.ordered') }}</span>
@else
N/A
@endif
</td>
<td>
<td>
@php $outcome = "N/A"; @endphp
@if($episode->consultation_id || $episode->antenatal_outcome_id)
@if(!is_null($episode->consultation_done_by))
@if($main_exam)
{{ get_full_name($main_exam->created_by, 'id', 'first_name', 'last_name', 'users') }}
@elseif(!is_null($episode->consultation_done_by) && empty($episode->antenatal_outcome_id))
{{ get_full_name($episode->consultation_done_by, "id", "first_name", "last_name","users") }}
@else
@php
$outcome_id = !empty($episode->antenatal_outcome_id)? $episode->antenatal_outcome_id:$episode->outcome_id;
$created_by = !empty($episode->consultation_created_by)? $episode->consultation_created_by:$episode->antenatal_created_by;
$updated_by = !empty($episode->consultation_updated_by)? $episode->consultation_updated_by:$episode->antenatal_updated_by;
$outcome = get_name($outcome_id, 'id', 'name', 'outcomes'); @endphp
@php
$outcome_id = !empty($episode->antenatal_outcome_id)? $episode->antenatal_outcome_id:$episode->outcome_id;
$created_by = !empty($episode->consultation_created_by)? $episode->consultation_created_by:$episode->antenatal_created_by;
$updated_by = !empty($episode->consultation_updated_by)? $episode->consultation_updated_by:$episode->antenatal_updated_by;
$outcome = get_name($outcome_id, 'id', 'name', 'outcomes'); @endphp
@if(is_null($updated_by))
{{ get_full_name($created_by, "id", "first_name", "last_name","users") }}
{{ get_full_name($created_by, "id", "first_name", "last_name","users") }}
@else
{{ get_full_name($updated_by, "id", "first_name", "last_name", "users") }}
@endif
@endif
@else
@php $outcome = "N/A"; @endphp
@endif
</td>
<td>
@@ -354,15 +401,19 @@
<span style="background-color: #FFFF00; color: black" class="label">Ongoing Consultation (ANC)</span> --}}
@if (is_null($episode->consultation_id) && empty($episode->antenatal_primary_diagnosis))
<span style="background-color: red" class="label">{{ __('patient_flow_monitoring.pending_consultation') }}</span>
@elseif($episode->consultation_id)
@elseif($episode->consultation_id && empty($episode->antenatal_primary_diagnosis))
@if(!is_null($episode->consultation_done_by) && is_null($episode->primary_diagnosis))
<span style="background-color: red" class="label">{{ __('patient_flow_monitoring.pending_consultation') }}</span>
@elseif($episode->completed == 0)
<span style="background-color: #FFFF00; color: black" class="label">{{ __('patient_flow_monitoring.ongoing_consultation') }}</span>
@if($main_exam)
{{ get_name($main_exam->outcome_id, 'id', 'name', 'outcomes') }}
@else
<span style="background-color: #FFFF00; color: black" class="label">{{ __('patient_flow_monitoring.ongoing_consultation') }}</span>
@endif
@else
{{ get_name($episode->outcome_id, 'id', 'name', 'outcomes') }}
@endif
@elseif (!is_null($episode->consultation_id) && get_name($episode->consultation_id, 'id', 'completed', 'consultations') == 0)
@elseif (!is_null($episode->consultation_id) && get_name($episode->consultation_id, 'id', 'completed', 'consultations') == 0 && empty($episode->antenatal_primary_diagnosis))
<span style="background-color: #FFFF00; color: black" class="label">{{ __('patient_flow_monitoring.ongoing_consultation') }}</span>
@else
{{ $outcome }}
@@ -370,7 +421,7 @@
</td>
<td>
@if(is_object($patient) && is_null($patient->deleted_at))
<input type="radio" onchange="show({{ $episode->id }})" class="radio-option centered" name="episode_id" value="{{ $episode->id }}" />
<input type="radio" onchange="show({{ $episode->id }}), manage_eye_menus('{{ $is_patient_in_eye_clinic }}')" class="radio-option centered" name="episode_id" value="{{ $episode->id }}" />
@else
<b style="color: red">Patient was deleted</b>
@endif
@@ -383,14 +434,18 @@
<div class="white-box" id="menu1" style="display: none;">
<div class="row">
<div class="col-sm-2">
@if(Auth::user()->can('perform-triage'))
<button type="submit" name="triage" class="btn btn-success btn-sm col-sm-12" value="triage" id="triage">{{ __('patient_flow_monitoring.triage') }}</button>
<button type="submit" name="base_refraction_exam" class="btn btn-success btn-sm col-sm-12 eye_button" value="base_refraction_exam" id="base_refraction_exam">Base Refraction Exam</button>
@if(Auth::user()->can('perform-triage') && !is_add_attendance_to_consultation_enabled())
<button type="submit" name="triage" class="btn btn-success btn-sm col-sm-12 normal_button" value="triage" id="triage">{{ __('patient_flow_monitoring.triage') }}</button>
@endif
</div>
&nbsp;
<div class="col-sm-2">
<button type="submit" name="main_exam" class="btn btn-success btn-sm col-sm-12 eye_button" value="main_exam" id="main_exam">Main Exam</button>
@if(Auth::user()->can('create-consultation'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="consultation" id="consultation">{{ __('patient_flow_monitoring.consultation') }}</button>
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12 normal_button" value="consultation" id="consultation">{{ __('patient_flow_monitoring.consultation') }}</button>
@endif
</div>
<div class="col-sm-2">
@@ -465,14 +520,18 @@
<div class="white-box" id="menu2" style="display: none;">
<div class="row">
<div class="col-sm-2">
@if(Auth::user()->can('perform-triage'))
<button type="submit" name="triage" class="btn btn-success btn-sm col-sm-12" value="triage" id="triage">{{ __('patient_flow_monitoring.triage') }}</button>
<button type="submit" name="base_refraction_exam" class="btn btn-success btn-sm col-sm-12 eye_button" value="base_refraction_exam" id="base_refraction_exam">Base Refraction Exam</button>
@if(Auth::user()->can('perform-triage') && !is_add_attendance_to_consultation_enabled())
<button type="submit" name="triage" class="btn btn-success btn-sm col-sm-12 normal_button" value="triage" id="triage">{{ __('patient_flow_monitoring.triage') }}</button>
@endif
</div>
&nbsp;
<div class="col-sm-2">
<button type="submit" name="main_exam" class="btn btn-success btn-sm col-sm-12 eye_button" value="main_exam" id="main_exam">Main Exam</button>
@if(Auth::user()->can('create-consultation'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="consultation" id="consultation">{{ __('patient_flow_monitoring.consultation') }}</button>
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12 normal_button" value="consultation" id="consultation">{{ __('patient_flow_monitoring.consultation') }}</button>
@endif
</div>
<div class="col-sm-2">
@@ -548,7 +607,7 @@
<div class="modal-body">
{{ Form::open(['route' => 'patient_flow_monitoring.inpatient_admission']) }}
{{ Form::hidden('admission_episode_id', 0, ['id' => 'admission_episode_id']) }}
{{ Form::label('admission_ward_id', __('layout.select_ward')) }}
{{ Form::select('admission_ward_id', $wards, '', ['class' => 'form-control', 'required' => 'true']) }}
<br>
@@ -583,7 +642,7 @@
{{ Form::hidden('current_patient_id', 0, ['id' => 'current_patient_id']) }}
{{ Form::text('current_clinic', '', ['class' => 'form-control compulsory', 'readonly', 'id' => 'current_clinic_transfer']) }}
</div>
<div class="form-group">
{{ Form::label('transfer_to', __('patient_episode.transfer_to')) }}
{{ Form::select('transfer_to', $clinics, null, ['class' => 'form-control compulsory', 'required', 'id' => 'transfer_to']) }}
@@ -668,7 +727,8 @@
}
});
$('#triage,#consultation,#create_anaesthetics,#anaesthetics_history,#create_surgery,#surgery_index,#treatment,#investigation,#anc_registration_button,#anc_followup_button,#view_patient_history,#consultation_with_notes,#triage_without_etat').click(function() {
$('#triage,#consultation,#create_anaesthetics,#anaesthetics_history,#create_surgery,#surgery_index,#treatment,#investigation,#anc_registration_button,' +
'#anc_followup_button,#view_patient_history,#consultation_with_notes,#triage_without_etat,#main_exam,#base_refraction_exam').click(function() {
event.preventDefault();
let options = document.getElementsByName('episode_id');
let episodeId = 0;
@@ -751,5 +811,15 @@
});
}
});
function manage_eye_menus(is_patient_in_eye_clinic) {
if(is_patient_in_eye_clinic == 1) {
$('.eye_button').show();
$('.normal_button').hide();
} else {
$('.eye_button').hide();
$('.normal_button').show();
}
}
</script>
@endpush
@@ -187,16 +187,39 @@
</div>
<div id="ugandan_regions">
<div id="ugandan_regions">
<div class="form-group">
{{ Form::label('residence','Residence') }}
<select class="form-control col-md-12" name="residence" id="residence" style="display: block; width: 100%" required></select>
<div class="help-block with-errors"></div>
<a href="#modal_residence" data-toggle="modal" id="modal_residence_link"><font size="1">{{ __('patients.add_new_residence') }} </font></a>
</div>
<div class="form-group">
{{ Form::label('residence','Residence') }}
<select class="form-control col-md-12" name="residence" id="residence" style="display: block; width: 100%" required></select>
<div class="help-block with-errors"></div>
<a href="#modal_residence" data-toggle="modal" id="modal_residence_link"><font size="1">{{ __('patients.add_new_residence') }} </font></a>
</div>
</div>
@if (!empty($patient_registration_fields))
@foreach ($patient_registration_fields as $patient_registration_field)
<input type="hidden" name="registration_field_names[]" id="reg_field_{{$patient_registration_field->id}}" value="reg_field_{{$patient_registration_field->id}}"/>
@if (!empty($patient_registration_field->options))
<div class="form-group">
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
<select name="registration_field_values[]" id="{{$patient_registration_field->name}}" class="col-sm-12 {{ ($patient_registration_field->compulsory == 1)? 'compulsory':'' }} form-control" {{ ($patient_registration_field->compulsory == 1)? 'required':'' }}>
<option value="">--select--</option>
@php
$options = explode(',',$patient_registration_field->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
</div>
@else
<div class="form-group">
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
<input type="text" name="registration_field_values[]" class="col-sm-12 {{ ($patient_registration_field->compulsory == 1)? 'compulsory':'' }} form-control" {{ ($patient_registration_field->compulsory == 1)? 'required':'' }}>
</div>
@endif
@endforeach
@endif
@if(is_fingerprint_enabled())
<div>
{{ Form::label('fingerprint_template',__('patients.patient_fingerprint')) }}
@@ -720,10 +743,12 @@
if (citizenship == 0) {
$("#not_ugandan_regions").show();
$("#ugandan_regions").hide();
$('#residence').prop('required', false);
} else {
$("#not_ugandan_regions").hide();
$("#ugandan_regions").show();
$("#country_id").val('');
$('#residence').prop('required', true);
}
});
@@ -88,7 +88,7 @@
<div class="help-block with-errors"></div>
</div>
{{ Form::button(__('patients.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'disabled', 'id' => 'submit_button']) }}
{{ Form::button(__('patients.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id' => 'submit_button']) }}
{{ Form::button(__('patients.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
File diff suppressed because it is too large Load Diff
@@ -31,17 +31,12 @@
</div>
</div>
{{-- <div class="col-md-2">
<div class="form-group" id="first_names">
{{ Form::text('first_name', '', ['class' => 'form-control typeahead', 'placeholder' => 'First name', 'autocomplete' => 'off', 'spellcheck' => false]) }}
<div class="col-md-2" @if(!is_eye_module_enabled()) style='display: none' @endif>
<div class="form-group" id="previous_numbers">
{{ Form::text('previous_id', '', ['class' => 'form-control typeahead', 'placeholder' => 'Previous Number', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="last_names">
{{ Form::text('last_name', '', ['class' => 'form-control typeahead', 'placeholder' => 'Last name', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div> --}}
<div class="col-md-4">
<div class="form-group" id="full_names">
{{ Form::text('full_name', '', ['class' => 'form-control typeahead', 'placeholder' => 'Patient Name', 'autocomplete' => 'off', 'spellcheck' => false]) }}
@@ -54,7 +49,7 @@
</div>
</div>
<div class="col-md-4">
<div class="col-md-2">
<button type="submit" class="btn btn-rounded btn-success"><span class="glyphicon glyphicon-search"></span> {{ __('patients.search') }}</button>
<span class="label label-info float-right" style="font-size: 12.5px;"> {{ $patientCount }} {{ __('patients.patients_registered') }}</span>
</div>
@@ -170,6 +165,18 @@ $('#patient_numbers .typeahead').typeahead(
}
);
$('#previous_numbers .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'previous_numbers',
source: substringMatcher(<?php echo json_encode($previous_ids); ?>)
}
);
$('#first_names .typeahead').typeahead(
{
hint: true,
@@ -80,7 +80,7 @@
</tr>
<tr>
<th><font color="black">{{ __('patients.occupation') }}</font></th>
<td>{{ isset($occupations[$patient->occupation_id]) ? $occupations[$patient->occupation_id] : '' }}</td>
<td>{{ get_name($patient->occupation_id, 'id', 'name', 'occupations') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.insurance') }}</font></th>
@@ -88,7 +88,7 @@
</tr>
<tr>
<th><font color="black">{{ __('patients.religion') }}</font></th>
<td>{{ isset($religions[$patient->religion_id]) ? $religions[$patient->religion_id] : '' }}</td>
<td>{{ get_name($patient->religion_id, 'id', 'name', 'religions') }}</td>
</tr>
<tr>
<th><font color="black">{{__('patients.next_of_kin')}}</font></th>
@@ -96,7 +96,7 @@
</tr>
<tr>
<th><font color="black">{{ __('patients.next_of_kin_relationship') }}</font></th>
<td>{{ isset($relationships[$patient->next_of_kin_relationship]) ? $relationships[$patient->next_of_kin_relationship] : '' }}</td>
<td>{{ get_name($patient->next_of_kin_relationship, 'id', 'name', 'family_relations') }}</td>
</tr>
<tr>
<th><font color="black">{{__('patients.phone_of_next_of_kin')}}</font></th>
@@ -109,24 +109,38 @@
<table class="table-bordered table-condensed table-striped">
<tr>
<th><font color="black">{{ __('patients.district') }}</font></th>
<td>{{ isset($districts[$patient->district_id]) ? $districts[$patient->district_id] : '' }}</td>
<td>{{ get_name($patient->district_id, 'id', 'name', 'districts') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.county') }}</font></th>
<td>{{ isset($counties[$patient->county_id]) ? $counties[$patient->county_id] : '' }}</td>
<td>{{ get_name($patient->county_id, 'id', 'name', 'counties') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.sub_county') }}</font></th>
<td>{{ isset($subcounties[$patient->subcounty_id]) ? $subcounties[$patient->subcounty_id] : '' }}</td>
<td>{{ get_name($patient->subcounty_id, 'id', 'name', 'subcounties') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.parish') }}</font></th>
<td>{{ isset($parishes[$patient->parish_id]) ? $parishes[$patient->parish_id] : '' }}</td>
<td>{{ get_name($patient->parish_id, 'id', 'name', 'parishes') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.village') }}</font></th>
<td>{{ isset($villages[$patient->village_id]) ? $villages[$patient->village_id] : '' }}</td>
<td>{{ get_name($patient->village_id, 'id', 'name', 'villages') }}</td>
</tr>
<tr>
<th><font color="black">Referred From</font></th>
<td>{{ $patient->referred_from }}</td>
</tr>
@php $registration_fields = !empty($patient->registration_fields)? json_decode($patient->registration_fields, true):[]; @endphp
@foreach ($registration_fields as $key => $registration_field)
@php $keys = explode("_",$key) @endphp
@if (!empty($keys[2]))
<tr>
<th><font color="black">{{ get_name($keys[2], 'id', 'name', 'patient_registration_fields') }}</font></th>
<td>{{ $registration_field }}</td>
</tr>
@endif
@endforeach
</table>
</div>
@@ -263,7 +263,7 @@
@php
if(isset($allergies['names'])){
$allergies_explode = explode(",", $allergies['names']);
$allergy_check = \Streamline\Http\Controllers\PrescriptionsController::checkPatientAllergies($allergies_explode, $prescription->drug_category);
$allergy_check = \Modules\Pharmacy\Http\Controllers\PrescriptionsController::checkPatientAllergies($allergies_explode, $prescription->drug_category);
}
@endphp
<tr id="my_row{{ $prescription->id }}" class="to_remove">
@@ -401,7 +401,7 @@
@php
if(isset($allergies['names'])){
$allergies_explode = explode(",", $allergies['names']);
$allergy_check = \Streamline\Http\Controllers\PrescriptionsController::checkPatientAllergies($allergies_explode, $prescription->drug_category);
$allergy_check = \Modules\Pharmacy\Http\Controllers\PrescriptionsController::checkPatientAllergies($allergies_explode, $prescription->drug_category);
}
@endphp
<tr id="my_row{{ $prescription->id }}" class="to_remove">
@@ -61,14 +61,15 @@
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('point_of_sale.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.dispensed_by') }}:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.record_date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.print_date') }}:</b> {{ streamline_date_time_short($receipt_reprint_date) }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.patient_name') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.original_print_date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.reprint_date') }}:</b> {{ streamline_date_time_short(date('Y-m-d H:i:s')) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}:</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_name') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
@@ -166,6 +167,20 @@
@endfor
@endif
@if(isset($optic_item) && count($optic_item) > 0)
<tr>
<td colspan="3" class="text-center"><b>Optical Items</b></td>
</tr>
@for($i = 0; $i < count($optic_item); $i++)
<tr>
<td>{{ get_name($optic_item[$i], "id", "name", "eye_glasses") }}</td>
<td>{{ $optic_quantity[$i] }}</td>
<td>{{ ugandan_shillings($optic_subtotal[$i]) }}</td>
@php $total_amount_pay += $optic_subtotal[$i]; @endphp
</tr>
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,607 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<style>
.triage-grade li {
display: inline-block;
}
.same_width {
width: 100%;
table-layout: fixed;
}
.wrapper {
border: 1px solid #00c292;
border-radius: 6px;
padding: 20px;
margin-bottom: 20px;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">{{ __('triage.edit_triage') }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('triage.dashboard') }}</a></li>
<li><a href="{{ route('patient_episodes.index') }}">{{ __('triage.patient_home') }}</a></li>
<li class="active">{{ __('triage.triage') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
<br>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box br-5" style="padding-top: 5px;">
<h5 class="page-title"><strong>{{ __('triage.triage') }} ({{ $age_group_display }})
{{ __('triage.for_episode') }} : <font color="blue">
{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</font>
</strong></h5>
<hr>
{{ Form::model($triage, ['method' => 'PUT', 'route' => ['triage.update', $triage], 'data-toggle' => 'validator']) }}
{{ Form::hidden('episode_id', $episode_id) }}
{{ Form::hidden('patient_id', $patient_id) }}
@php
$alert1 = '<div class="alert alert-warning "> <button type="button" class="close" data-dismiss="alert">×</button>' . __('triage.sick_children_warning') . '</div>';
$alert2 = '<div class="alert alert-warning "> <button type="button" class="close" data-dismiss="alert">×</button>' . __('triage.poison_warning') . '</div>';
$symptoms_array = [];
@endphp
@php
$option_symptoms = '';
$option_symptoms_periods = '';
$symptom_counter = 1;
@endphp
@if (!are_symptoms_on_consultation())
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered" id="symptom_table">
<thead>
<tr>
<th class="text-center">{{ __('triage.symptoms') }} <a data-toggle="modal"
data-target="#symptomsmodal"
class="label labelRight label-info pull-right">{{ __('triage.add_new') }}</a>
</th>
<th class="text-center">{{ __('triage.duration') }}</th>
<th class="text-center">{{ __('triage.prompt') }}</th>
<th class="text-center">{{ __('triage.reference_text') }}</th>
<th></th>
</tr>
</thead>
<tbody class='symptoms_input_fields_wrap'>
@php
$symptoms_array = explode(',', $triage->symptoms);
$symptoms_duration_array = explode(',', $triage->symptom_duration);
foreach ($symptoms as $key => $value) {
$option_symptoms .= "<option value='$key'>" . str_replace('"', '', $value) . '</option>';
}
foreach ($symptoms_periods as $key => $value){
$option_symptoms_periods .= "<option value='$key'>$value</option>";
}
@endphp
@if(empty($symptoms_array) || count($symptoms_array) != count($symptoms_duration_array))
<tr>
<td style='width: 20%;'>
<select name='symptoms[]' id='symptoms_0' class='form-control col-sm-12 compulsory' onchange='showPrompt(this.value, 0)' required>@php echo $option_symptoms; @endphp</select>
</td>
<td style='width: 21%'>
<div class='row'>
<div class='col-sm-3'>
<input type='text' style='display: block;' name='duration[]' id='symptoms_duration_0' class='col-sm-12 form-control' required>
</div>
<div class='col-sm-9'>
<select style='display: inline-block;' name='time[]' id='symptoms_time_0' class='col-sm-12 form-control' required>@php echo $option_symptoms_periods; @endphp</select>
</div>
</div>
</td>
<td id='symptoms_prompt_0' style='width: 30%'></td>
<td id='symptoms_reference_0'></td>
<td style='width: 1%;'></td>
</tr>
@else
@for($i = 0; $i < count($symptoms_array); $i++)
@php
$duration_array = explode(" ", $symptoms_duration_array[$i]);
@endphp
<tr>
<td style='width: 20%;'>
<select name='symptoms[]' id='symptoms_0'
class='form-control col-sm-12 compulsory'
onchange='showPrompt(this.value, 0)' required>@php echo $option_symptoms; @endphp</select>
</td>
<td style='width: 21%'>
<div class='row'>
<div class='col-sm-3'>
<input type='text' style='display: block;' name='duration[]'
id='symptoms_duration_0' class='col-sm-12 form-control h-100'>
</div>
<div class='col-sm-9'>
<select style='display: inline-block;' name='time[]'
id='symptoms_time_0'
class='col-sm-12 form-control select2-hidden-accessible'>@php echo $option_symptoms_periods; @endphp</select>
</div>
</div>
</td>
<td id='symptoms_prompt_0' style='width: 30%'></td>
<td id='symptoms_reference_0'></td>
<td style='width: 1%;'></td>
</tr>
@else
@for ($i = 0; $i < count($symptoms_array); $i++)
@php
$duration_array = explode(' ', $symptoms_duration_array[$i]);
@endphp
<tr>
<td style="width: 20%;">
{{ Form::select('symptoms[]', $symptoms, $symptoms_array[$i], ['id' => 'symptoms_' . $i, 'class' => 'form-control col-sm-12 compulsory initial_symptoms_select', 'onchange' => 'showPrompt(this.value, ' . $i . ')']) }}
</td>
<td style="width: 21%">
<div class="row m-0 d-flex justify-content-between align-items-stretch">
<div class="col-sm-3 p-0">
<input type="text" style="display: block;" name="duration[]"
id="duration[]" class="col-sm-12 form-control h-100"
value="{{ $duration_array[0] }}">
</div>
<div class="col-sm-9 p-0">
<select style="display: inline-block;" name="time[]" id="time[]"
class="w-100 form-control select-2 h-100">
<option value="{{ $duration_array[1] }}" selected>
{{ $duration_array[1] }}</option>
<option value="<?php echo __('triage.hours'); ?>">{{ __('triage.hours') }}
</option>
<option value="<?php echo __('triage.days'); ?>">{{ __('triage.days') }}
</option>
<option value="<?php echo __('triage.weeks'); ?>">{{ __('triage.weeks') }}
</option>
<option value="<?php echo __('triage.months'); ?>">{{ __('triage.months') }}
</option>
<option value="<?php echo __('triage.years'); ?>">{{ __('triage.years') }}
</option>
</select>
</div>
</div>
</td>
<td id="symptoms_prompt_{{ $i }}" style="width: 30%"></td>
<td id="symptoms_reference_{{ $i }}"></td>
<td style="width: 1%;"></td>
</tr>
@endfor
@endif
</tbody>
</table>
<a class="btn btn-success btn-xs" onclick="add_symptom_row()"
id="add_row">{{ __('triage.add_row') }}</a>
<hr>
</div>
@endif
@if (is_tuberculosis_screening_enabled())
@include('patients::triage.edit.edit_tb_screening')
@endif
@if (is_hiv_screening_tool_enabled())
@include('patients::triage.edit.edit_hiv_screening')
@endif
@if (is_gbv_screening_tool_enabled())
@include('patients::triage.edit.edit_gbv_screening')
@endif
<div class="row">
<div class="col-md-8">
<div class="table-responsive">
<table class="table table-hover table-striped color-table success-table table-bordered"
id="observations_table">
<thead>
<tr>
<th>{{ __('triage.observation') }}</th>
<th>{{ __('triage.value') }}</th>
<th>{{ __('triage.normal_range') }}</th>
@if ($age_group == 5)
<th>KEWS</th>
<th>NEWS</th>
@else
<th>KEWS</th>
@endif
</tr>
</thead>
<tbody>
@include('patients::triage.edit.observations_changed')
</tbody>
</table>
</div>
@if (between($years, 16, 50))
@include('patients::triage.edit.family_planning_questions')
@endif
@if (between($years, 0, 12))
@include('patients::triage.edit.emergency_signs')
@endif
</div>
<div class="col-md-4">
@if ($age_group == 1 || $age_group == 2)
<?php echo $alert2; ?>
<?php echo $alert1; ?>
@else
<?php echo $alert2; ?>
@endif
<br>
@if (!is_add_attendance_to_consultation_enabled())
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th colspan="2" class="text-center">
{{ __('triage.patient_attendance') }}
</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2">
<font color="#C85F6A" class="text-center">{{ __('triage.re_attendance_or_new') }}</font>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="new_attendance" id="new_attendance" @if(!empty($triage->new_attendance)) checked @endif/> {{ __('triage.new_attendance') }}
</td>
<td>
<input type="checkbox" name="re_attendance" id="re_attendance" @if(!empty($triage->re_attendance)) checked @endif/> {{ __('triage.re_attendance') }}
</td>
</tr>
</tbody>
</table>
</div>
@endif
@if (between($years, 0, 12))
@include('patients::triage.edit.priority_signs')
@endif
<div style="background: #F5F5F5; padding: 10px;">
<h4 class="text-center">{{ __('triage.triage_grade') }}</h4>
<hr>
<div class="row text-center">
<div class="col-md-4 br">
{{ Form::radio('triage_grade', 1, $triage->severe_grade == 1, ['required', 'id' => 'triage_grade_green']) }}
<b style="color: #006400; font-weight: 900; font-size: 18;">{{ __('triage.green') }}
</b>
</div>
<div class="col-md-4">
{{ Form::radio('triage_grade', 2, $triage->severe_grade == 2, ['required', 'id' => 'triage_grade_yellow']) }}
<b style="color: #FFC40C; font-weight: 900; font-size: 18; ">{{ __('triage.yellow') }}
</b>
</div>
<div class="col-md-4">
{{ Form::radio('triage_grade', 3, $triage->severe_grade == 3, ['required', 'id' => 'triage_grade_red']) }}
<b style="color: #FF4500; font-weight: 900; font-size: 18;">{{ __('triage.red') }}</b>
</div>
</div>
</div>
<h4 style="background: #F5F5F5; padding: 10px;">{{ __('triage.referral_clinic_allocation') }}</h4>
<div class="form-group">
{{ Form::label('referral_hospital', __('triage.referred_by')) }}
{{ Form::select('referral_hospital', $referral_hospitals, $triage->referral, ['class' => 'form-control compulsory', 'required', 'id' => 'referral_hospital']) }}
<a class="pull-right" style="font-size: x-small" data-toggle="modal"
data-target="#referralsmodal">{{ __('triage.add_new') }}</a>
</div>
<div class="form-group">
{{ Form::label('clinic_allocation', __('triage.clinic_allocation')) }}
@if (is_numeric(get_name($episode_id, 'id', 'clinic_id', 'patient_episodes')))
{{ Form::select('clinic_allocation', $clinics, get_name($episode_id, 'id', 'clinic_id', 'patient_episodes'), ['class' => 'form-control col-sm-12 compulsory', 'required']) }}
@else
{{ Form::select('clinic_allocation', $clinics, '', ['class' => 'form-control col-sm-12 compulsory', 'required']) }}
@endif
</div>
<h4 style="background: #F5F5F5; padding: 10px;">{{ __('triage.comment') }}</h4>
<textarea name='comment' id="comment" class="col-sm-12" placeholder="<?php echo __('triage.type_comments_here'); ?>">{{ $triage->comments }}</textarea>
<br><br>
{{ Form::button(__('triage.submit_triage'), ['type' => 'submit', 'class' => 'btn btn-success col-sm-12', 'id' => 'submit_triage']) }}
<br><br>
{{ __('triage.triage_done_by') }} : <span
style="color: green; font-weight: bold;">{{ ucwords(Auth::user()->first_name) . ' ' . ucwords(Auth::user()->last_name) }}</span>
</div>
</div>
{{ Form::close() }}
</div>
</div>
</div>
<div class="modal fade" id="symptomsmodal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('triage.add_new_symptom') }}</h4>
</div>
<div class="modal-body">
{{ Form::text('symptom_name', '', ['class' => 'form-control', 'id' => 'symptom_name', 'placeholder' => __('triage.symptom_name')]) }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ __('triage.cancel') }}</button>
<a class="btn btn-success" onclick="submitSymptom()">{{ __('triage.add_symptom') }}</a>
</div>
</div>
</div>
</div>
<div class="modal fade" id="referralsmodal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('triage.add_new_referral') }}</h4>
</div>
<div class="modal-body">
{{ Form::text('referral_name', '', ['class' => 'form-control', 'id' => 'referral_name', 'placeholder' => __('triage.referral_name')]) }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ __('triage.cancel') }}</button>
<a class="btn btn-primary" onclick="submitReferral()">{{ __('triage.add_referral') }}</a>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
let max_rows = 20;
let wrapper = $(".symptoms_input_fields_wrap");
let x = {{ !empty($symptoms_array)? count($symptoms_array):1 }};
let smart_triage_variables = {};
// check if smart triage is enabled
let smart_triage_enabled = <?php echo is_smart_triage_enabled() ? 1 : 0; ?>;
let apply_triage_grade = <?php echo apply_triage_grade() ? 1 : 0; ?>;
$(wrapper).on("click", ".remove_field", function(e) {
e.preventDefault();
$(this).parent('td').parent('tr').remove();
x--;
});
function add_symptom_row() {
if (x < max_rows) {
$(wrapper).append("<tr>\
<td style='width: 20%;'>\
<select name='symptoms[]' id='symptoms_" + x + "' class='form-control col-sm-12 compulsory' onchange='showPrompt(this.value, " + x + ")' required>@php echo $option_symptoms; @endphp</select>\
</td>\
<td style='width: 21%'>\
<div class='row'>\
<div class='col-sm-3'>\
<input type='text' style='display: block;' name='duration[]' id='symptoms_duration_" + x + "' class='col-sm-12 form-control' required>\
</div>\
<div class='col-sm-9'>\
<select style='display: inline-block;' name='time[]' id='symptoms_time_" + x + "' class='col-sm-12 form-control' required>@php echo $option_symptoms_periods; @endphp</select>\
</div>\
</div>\
</td>\
<td id='symptoms_prompt_" + x + "' style='width: 30%'></td>\
<td id='symptoms_reference_" + x + "'></td>\
<td style='width: 1%;'><a class='remove_field btn btn-sm btn-rounded btn-danger' style='color: white;'><i class='fa fa-trash'></i></a></td>\
</tr>");
generalSelect2Set('symptoms_' + x);
$("#symptoms_" + x).load('/symptoms/get_symptoms');
x++;
}
}
function generalSelect2Set(id) {
$('#' + id).select2({
width: "100%"
});
}
function showPrompt(symptom_id, id) {
if (symptom_id == "") {
return;
}
$.ajax({
method: 'POST',
url: '/triage/get_prompt',
data: {
'symptom_id': symptom_id
},
success: function(response) {
let returnText = response.split('&&&&');
$('#symptoms_prompt_' + id).html('<p style="color: #C85F6A;">' + returnText[0] + '</p>');
$('#symptoms_reference_' + id).html(returnText[1]);
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
function submitSymptom() {
var symptom_name = $("#symptom_name").val();
$.ajax({
method: 'POST',
url: '/triage/add_symptom',
data: {
'symptom_name': symptom_name
},
success: function(response) {
if (response == 1) {
//reload all dropdowns
$(".1000").load('/symptoms/get_symptoms');
alert(symptom_name + ' symptom has been added.');
$('#symptomsmodal').modal('hide');
} else {
alert("<?php echo __('triage.adding_symptom_failed'); ?>");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
function submitReferral() {
var name = $("#referral_name").val();
$.ajax({
method: 'POST',
url: '/triage/add_referral',
data: {
'name': name
},
success: function(response) {
if (!isNaN(response)) {
//response = last inserted id
$('#referral_hospital').append($('<option>', {
value: response,
text: name
}));
$('#referral_hospital').val(response); //preselect the newly added referral
$('#referralsmodal').modal('hide'); //manually hide the modal
} else {
alert("<?php echo __('triage.adding_referral_failed'); ?>");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
$(document).ready(function() {
$('.initial_symptoms_select').select2({
width: "100%"
});
$('.select-2').select2({
width: "100%"
});
var cons_attendance = <?php echo is_add_attendance_to_consultation_enabled() ? 1 : 0 ?>;
$("#submit_triage").click(function(e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$(".compulsory").each(function() {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border', '1px solid #F08080');
}
});
if(cons_attendance == 0 && !$('#new_attendance').is(':checked') && !$('#re_attendance').is(':checked')){
alert('Please fill in Patient attendance.');
e.preventDefault();
return false;
$('#new_attendance, #re_attendance').css('border','1px solid #F08080');
}
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("<?php echo __('triage.compulsory_fields_warning'); ?>");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
$('#new_attendance').click(function() {
$('#re_attendance').not('#new_attendance').removeAttr('checked');
});
$('#re_attendance').click(function() {
$('#new_attendance').not('#re_attendance').removeAttr('checked');
});
});
$(document).ready(function() {
$("#child_feeling_unsafe_section").hide();
$("#tested_for_hiv_last_3_months_section").hide();
$(".hiv_positive_section").hide();
});
function hide_tested_for_hiv_last_3_months_questions() {
$("#tested_for_hiv_last_3_months_section").hide();
}
function show_tested_for_hiv_last_3_months_questions() {
$("#tested_for_hiv_last_3_months_section").show();
}
function show_feeling_unsafe_questions() {
$('#child_feeling_unsafe_section').show();
}
function hide_feeling_unsafe_questions() {
$('#child_feeling_unsafe_section').hide();
}
function show_hiv_positive_questions() {
$(".hiv_positive_section").show();
}
function hide_hiv_positive_questions() {
$(".hiv_positive_section").hide();
}
// below 15
$('input[type=radio][name=mother_hiv_positive]').change(function() {
if (this.value == '1') {
$('.child-hiv-status').removeClass('d-none').css('display', '');
$('.child-hiv-status-questions').removeClass('d-none').css('display', '');
} else if (this.value == '0') {
$('.child-hiv-status').addClass('d-none').css('display', 'none');
$('.child-hiv-status-questions').addClass('d-none').css('display', 'none');
$('.child-hiv-status-questions input[type=radio]').each(function() {
this.value('');
})
}
});
</script>
@endpush
@@ -0,0 +1,154 @@
<div class="row">
<h4>{{ __('layout.triage') }}: {{ __('layout.children') }} </h4>
</div>
<div class="row">
<h5>{{ __('layout.emergency_signs') }} *** </h5>
</div>
<div class="row">
<div class="table-responsive">
<table class="table table-bordered table-striped table-condensed">
<tbody>
<tr>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col" width="2%">{{ __('layout.yes') }}</th>
<th scope="col" width="2%">{{ __('layout.no') }}</th>
</tr>
<tr>
<th scope="row">{{ __('layout.airway_breathing') }}</th>
<td>{{ __('layout.cyanosis') }}</td>
<td>
<div class="controls">
<input type="radio" name="cyanosis" value="{{ __('layout.yes') }}" id="cyanosis_0" required @if(!empty($airway[__('layout.cyanosis')]) && $airway[__('layout.cyanosis')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="cyanosis" value="{{ __('layout.no') }}" id="cyanosis_0" required @if(!empty($airway[__('layout.cyanosis')]) && $airway[__('layout.cyanosis')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.stridor_breathing_choking') }}</td>
<td>
<div class="controls">
<input type="radio" name="stridor" value="{{ __('layout.yes') }}" id="stridor_0" required @if(!empty($airway[__('layout.stridor_breathing_choking')]) && $airway[__('layout.stridor_breathing_choking')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="stridor" value="{{ __('layout.no') }}" id="stridor_1" required @if(!empty($airway[__('layout.stridor_breathing_choking')]) && $airway[__('layout.stridor_breathing_choking')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.severe_resp_distress') }}</td>
<td>
<div class="controls">
<input type="radio" name="severe_distress" value="{{ __('layout.yes') }}" id="severe_distress_0" required @if(!empty($airway[__('layout.severe_resp_distress')]) && $airway[__('layout.severe_resp_distress')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="severe_distress" value="{{ __('layout.no') }}" id="severe_distress_1" required @if(!empty($airway[__('layout.severe_resp_distress')]) && $airway[__('layout.severe_resp_distress')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.circulation') }}</th>
<td>{{ __('layout.capillary_refill_seconds') }}</td>
<td>
<div class="controls">
<input type="radio" name="refill" value="{{ __('layout.yes') }}" id="refill_0" required @if(!empty($circulation[__('layout.capillary_refill_seconds')]) && $circulation[__('layout.capillary_refill_seconds')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="refill" value="{{ __('layout.no') }}" id="refill_1" required @if(!empty($circulation[__('layout.capillary_refill_seconds')]) && $circulation[__('layout.capillary_refill_seconds')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.severe_bleeding') }}</td>
<td>
<div class="controls">
<input type="radio" name="severe_bleeding" value="{{ __('layout.yes') }}" id="severe_bleeding_0" required @if(!empty($circulation[__('layout.severe_bleeding')]) && $circulation[__('layout.severe_bleeding')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="severe_bleeding" value="{{ __('layout.no') }}" id="severe_bleeding_1" required @if(!empty($circulation[__('layout.severe_bleeding')]) && $circulation[__('layout.severe_bleeding')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.weak_fast_pulse') }}</td>
<td>
<div class="controls">
<input type="radio" name="weak_fast_pulse" value="{{ __('layout.yes') }}" id="weak_fast_pulse_0" required @if(!empty($circulation[__('layout.weak_fast_pulse')]) && $circulation[__('layout.weak_fast_pulse')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="weak_fast_pulse" value="{{ __('layout.no') }}" id="weak_fast_pulse_1" required @if(!empty($circulation[__('layout.weak_fast_pulse')]) && $circulation[__('layout.weak_fast_pulse')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.neurological') }}</th>
<td>{{ __('layout.coma') }}</td>
<td>
<div class="controls">
<input type="radio" name="coma" value="{{ __('layout.yes') }}" id="coma_0" required @if(!empty($neurological[__('layout.coma')]) && $neurological[__('layout.coma')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="coma" value="{{ __('layout.no') }}" id="coma_1" required @if(!empty($neurological[__('layout.coma')]) && $neurological[__('layout.coma')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.convulsing_now') }}</td>
<td>
<div class="controls">
<input type="radio" name="convulsing_now" value="{{ __('layout.yes') }}" id="convulsing_now_0" required @if(!empty($neurological[__('layout.convulsing_now')]) && $neurological[__('layout.convulsing_now')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="convulsing_now" value="{{ __('layout.no') }}" id="convulsing_now_1" required @if(!empty($neurological[__('layout.convulsing_now')]) && $neurological[__('layout.convulsing_now')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.dehydration_children_diarrhoea') }}</th>
<td>{{ __('layout.diarrhoea_lethargy_sunken_eyes') }}</td>
<td>
<div class="controls">
<input type="radio" name="lethargy" value="{{ __('layout.yes') }}" id="lethargy_0" required @if(!empty($dehydration[__('layout.diarrhoea_lethargy_sunken_eyes')]) && $dehydration[__('layout.diarrhoea_lethargy_sunken_eyes')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="lethargy" value="{{ __('layout.no') }}" id="lethargy_0" required @if(!empty($dehydration[__('layout.diarrhoea_lethargy_sunken_eyes')]) && $dehydration[__('layout.diarrhoea_lethargy_sunken_eyes')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="alert alert-warning ">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('layout.positive_call_for_help') }}
</div>
@@ -0,0 +1,113 @@
<div class="row">
<h4>{{ __('layout.adult_triage') }} </h4>
</div>
<div class="row">
<h5>{{ __('layout.family_planning_questions') }}</h5>
</div>
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-4">
<input type="checkbox" class="col-sm-1" name="too_sick" id="too_sick" value="1" @if($triage->fp_too_sick == 1) checked @endif>
<span style="color: maroon; font-weight: bold">{{ __('layout.too_sick') }}</span>
</div>
</div>
<hr>
<table class="too_sick_remove table table-bordered" @if($triage->fp_too_sick == 1) style="display: none" @endif>
@if ($patient->gender == 2)
<tr class="currently_pregnant">
<td>{{ __('layout.currently_pregnant') }}</td>
<td>
<input type="radio" name='pregnant' id='pregnant_yes' class="answer_no" value="1" @if($triage->pregnant == 1) checked @endif>&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='pregnant' id='pregnant_no' class="answer_no" value="0" @if($triage->pregnant == 0) checked @endif>&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="menopause" style="display: none">
<td>{{ __('layout.had_menopause') }}</td>
<td>
<input type="radio" name='menopause' id='menopause_yes' class="answer_no" value="1" @if($triage->menopause == 1) checked @endif>&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='menopause' id='menopause_no' class="answer_no" value="0" @if($triage->menopause == 0) checked @endif>&nbsp;{{ __('layout.no') }}
</td>
</tr>
@endif
<tr class="sexually_active">
<td>{{ __('layout.sexually_active') }}</td>
<td>
<input type="radio" name='sexually_active' id='sexually_active_yes' class="answer_yes compulsory" value="1" @if($triage->sexually_active == 1) checked @endif>&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='sexually_active' id='sexually_active_no' class="answer_yes compulsory" value="0" @if($triage->sexually_active == 0) checked @endif>&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="expect_child" style="display: none">
<td>{{ __('layout.wish_to_have_child') }}</td>
<td>
<input type="radio" name='yes_no_children' id='yes_children' class="answer_no" value="1">&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='yes_no_children' id='no_children' class="answer_no" value="0">&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="fp_method" style="display: none">
<td>{{ Form::label('fp_method', __('layout.family_planning_method')) }}</td>
<td>{{ Form::select('fp_method', $family_planning_methods, $triage->fp_method, ['class' => 'form-control col-sm-8']) }}</td>
</tr>
<tr class="fp_action" style="display: none">
<td>{{ __('layout.action') }}</td>
<td>
<select name='fp_action' class="form-control col-sm-8">
<option value="{{ $triage->fp_action }}" selected>{{ $triage->fp_action }}</option>
<option value="{{ __('layout.none') }}">{{ __('layout.none') }}</option>
<option value="{{ __('layout.counseling') }}">{{ __('layout.counseling') }}</option>
<option value="{{ __('layout.referral_to_fp') }}">{{ __('layout.referral_to_fp') }}</option>
</select>
</td>
</tr>
</table>
@push('scripts')
<script>
$("#too_sick").change(function () {
if ($(this).is(':checked')) {
$(".too_sick_remove").hide();
} else {
$(".too_sick_remove").show();
}
});
$("#menopause_yes").change(function () {
$(".sexually_active").hide();
})
$("#menopause_no").change(function () {
$(".sexually_active").show();
})
$("#sexually_active_no").change(function () {
$(".expect_child").hide();
})
$("#sexually_active_yes").change(function () {
$(".expect_child").show();
})
$("#yes_children").change(function () {
$(".fp_method").hide();
$(".fp_action").hide();
})
$("#no_children").change(function () {
$(".fp_method").show();
$(".fp_action").show();
})
$("#pregnant_yes").change(function () {
$(".menopause").hide();
$(".sexually_active").hide();
})
$("#pregnant_no").change(function () {
$(".menopause").show();
$(".sexually_active").show();
})
</script>
@endpush
@@ -0,0 +1,426 @@
@if ($age_group == 1)
@push('scripts')
<script src="{{ asset('js/observations/0_28_days.js') }}"></script>
@endpush
@php $observation_counter = 0; @endphp
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->slug}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->id}}" class="col-sm-12 form-control">
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@php $observation_counter++; @endphp
@endforeach
@elseif ($age_group == 2)
@push('scripts')
<script src="{{ asset('js/observations/1_12_months.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->slug}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->id}}" class="col-sm-12 form-control">
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" class="form-control" value="{{ $observation->option_for_normal }}" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 3)
@push('scripts')
<script src="{{ asset('js/observations/1_5_years.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->slug}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->id}}" class="col-sm-12 form-control">
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 4)
@push('scripts')
<script src="{{ asset('js/observations/6_12_years.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->slug}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check to make appropriate row for BMI if the observation name is weight -->
@if($observation->slug == 'weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" required class="col-sm-12 compulsory form-control" style="width: 100%"
/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" value="{{ $observations_to_edit[$observation->name] }}" class="col-sm-12 form-control" />
</div>
</div>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->id}}" class="col-sm-12 form-control">
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 5)
@push('scripts')
<script src="{{ asset('js/observations/over_12_years.js') }}"></script>
<script src="{{ asset('js/observations/over_12_years_news.js') }}"></script>
@endpush
@php $observation_counter = 0; @endphp
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->slug}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check to make appropriate row for BMI if the observation name is weight -->
@if($observation->slug == 'weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" required class="col-sm-12 compulsory form-control" style="width: 100%"/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" value="{{ $observations_to_edit[$observation->name] }}" class="col-sm-12 form-control" />
</div>
</div>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->id}}News" name="{{$observation->id}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->id}}" class="col-sm-12 form-control">
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td colspan="3" style="width: 40%;"></td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->id}}News" name="{{$observation->id}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@endif
</tr>
@endforeach
@php $observation_counter++; @endphp
@else
<tr>
<td colspan="5" class="text-center" style="width: 100%; color: maroon">{{ __('layout.ensure_correct_dob') }}</td>
</tr>
@endif
@@ -0,0 +1,47 @@
<div class="row">
<h4 class="heading pull-right">{{ __('layout.priority_signs') }}</h4>
</div>
<div class="row">
<table class="table table-bordered table-primary table-blue table-striped table-vertical-center table-condensed">
<tbody>
<tr>
<th scope="row"><div align="left">{{ __('layout.significant_trauma') }}</div></th>
<td><input type="checkbox" name="trauma" id="trauma" value="Yes" @if(in_array("Significant trauma", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.severe_pain') }}</div></th>
<td>
<input type="checkbox" name="severe_pain" id="severe_pain" value="yes" @if(in_array("Severe pain", $priority_signs)) checked @endif>
</td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.oedema_both_feet') }}</div></th>
<td><input type="checkbox" name="oedema" id="oedema" value="yes" @if(in_array("Oedema of both feet", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.urgent_surgical_condition') }}</div></th>
<td><input type="checkbox" name="surgical_condition" id="surgical_condition" value="yes" @if(in_array("Urgent surgical condition", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.restless_irritable') }}</div></th>
<td><input type="checkbox" name="continuously_irritable" id="continuously_irritable" value="yes" @if(in_array("Restless continuously irritable, lethargic", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.malnutrition_visible_wasting') }}</div></th>
<td><input type="checkbox" name="severe_wasting" id="severe_wasting" value="yes" @if(in_array("Malnutrition: visible severe wasting", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.severe_pallor') }}</div></th>
<td><input type="checkbox" name="severe_pallor" id="severe_pallor" value="yes" @if(in_array("Severe pallor", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.burns_major') }}</div></th>
<td><input type="checkbox" name="burns" id="burns" value="yes" @if(in_array("Burns (Major)", $priority_signs)) checked @endif></td>
</tr>
</tbody>
</table>
</div>
<div class="alert alert-warning ">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('layout.positive_move_child_first') }}.
</div>
@@ -0,0 +1,225 @@
@extends('layouts.main')
@push('scripts')
<style>
.triage-grade li {
display: inline-block;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">Admission Triage</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li><a href="{{ route('patient_episodes.index') }}">Patient Home</a></li>
<li class="active">Triage</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
<br>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
<div class="white-box" style="padding-top: 5px;">
<h5 class="page-title"><strong>Triage ({{ $age_group_display }}) for Episode started on : <font color="blue">{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</font></strong></h5>
<hr>
{{ Form::open(['route' => 'triage.save_edits_for_post_discharge' , 'data-toggle' => 'validator']) }}
{{ Form::hidden('episode_id', $episode_id)}}
{{ Form::hidden('patient_id', $patient_id)}}
<div class="row">
<div class="col-md-6">
<div class="table-responsive">
<table class="table table-hover table-striped color-table success-table table-bordered" id="observations_table">
<thead>
<tr>
<th>Observation</th>
<th>Value</th>
<th>Normal Range</th>
</tr>
</thead>
<tbody>
@push('scripts')
<script src="{{ asset('js/observations/1_5_years.js') }}"></script>
@endpush
<tr>
<td>Temperature ( °C)</td>
<td><input value="{{ $temperature }}" type="number" step="0.01" required name="temperature" class="col-sm-12 compulsory form-control" style="width: 100%"/></td>
<td><p style="color: #0000FF" class="text-center"><input type="text" readonly value="36.5 - 37.4" class="form-control" style="color: blue;"></p></td>
</tr>
<tr>
<td>SaO2 (%)</td>
<td><input value="{{ $oxy_sat }}" type="number" step="0.01" required name="oxy_sat" class="col-sm-12 compulsory form-control" style="width: 100%"/></td>
<td><p style="color: #0000FF" class="text-center"><input type="text" readonly value=">94" class="form-control" style="color: blue;"></p></td>
</tr>
<tr>
<td>MUAC (cm)</td>
<td><input value="{{ $muac }}" type="number" step="0.01" required name="muac" class="col-sm-12 compulsory form-control" style="width: 100%"/></td>
<td><p style="color: #0000FF" class="text-center"><input type="text" readonly value="12.5 - 50.0" class="form-control" style="color: blue;"></p></td>
</tr>
<tr>
<td>Height (m)</td>
<td><input value="{{ $height }}" type="number" step="0.01" required name="height" id="height" class="col-sm-12 compulsory form-control" style="width: 100%"/></td>
<td></td>
</tr>
<tr>
<td>Weight (kg)</td>
<td><input value="{{ $weight }}" type="number" step="0.01" required id="weight" name="weight" class="col-sm-12 compulsory form-control" style="width: 100%"/></td>
<td>
<input type="hidden" step="0.01" readonly="readonly" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input value="{{ $bmi }}" type="number" readonly="readonly" name="bmi" id="bmi" class="col-sm-12 compulsory form-control" required />
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
@if (between($age_diff_months, 0, 5))
<table class="table table-bordered">
<tr>
<td class="text-center" colspan="2"><h4>Social Health Indicators</h4></td>
</tr>
<tr>
<td>{{ Form::label('child_with_proven_infection', 'Does the child have a proven or suspected infection e.g is the child having fever, cough, diarrhoea?') }}</td>
<td>
{{ Form::radio('child_with_proven_infection', 1, $discharge_mortality->child_with_proven_infection == 1) }} Yes
{{ Form::radio('child_with_proven_infection', 0, $discharge_mortality->child_with_proven_infection === 0) }} No
</td>
</tr>
<tr>
<td>{{ Form::label('hospital_travel_duration', 'How long did it take you to travel to the hospital?') }}</td>
<td>
{{ Form::select('hospital_travel_duration', ['' => '-- select --','1' => '< 30 mins','2' => '30 mins 1 hour','3' => '1 - 4 hours','4' => '> 4 hours'], $discharge_mortality->hospital_travel_duration_below_6, ['class' => 'form-control compulsory', 'required']) }}
</td>
</tr>
<tr>
<td>{{ Form::label('illness_duration', 'What is the duration of the present illness at the time of admission?') }}</td>
<td>
{{ Form::select('illness_duration', ['' => '-- select --','1' => '< 48 hours','2' => '48 hours - 7 days','3' => '7 days - 1 month','4' => 'More than a month'], $discharge_mortality->illness_duration_at_admission_below_6, ['class' => 'form-control compulsory', 'required']) }}
</td>
</tr>
<tr>
<td>{{ Form::label('tone_normal_6mo', 'Muscle Tone') }}</td>
<td>
{{ Form::select('tone_normal_6mo', ['' => '-- select --','1' => 'Increased (Stiff)','2' => 'Normal','3' => 'Decreased (floppy)','4' => 'Do not know'], $discharge_mortality->tone_normal_6mo, ['class' => 'form-control']) }}
</td>
</tr>
</table>
@endif
@if (between($age_diff_months, 6, 60))
<div></div>
<table class="table table-bordered">
<tr>
<td class="text-center" colspan="4"><h4>Social Health Indicators</h4></td>
</tr>
<tr>
<td colspan="2">{{ Form::label('child_with_proven_infection', 'Does the child have a proven or suspected infection e.g is the child having fever, cough, diarrhoea?') }}</td>
<td>{{ Form::radio('child_with_proven_infection', 1, $discharge_mortality->child_with_proven_infection == 1, ['required']) }} Yes</td>
<td>{{ Form::radio('child_with_proven_infection', 0, $discharge_mortality->child_with_proven_infection === 0, ['required']) }} No</td>
</tr>
<tr>
<td>
{{ Form::label('last_hospitalization', 'Time since last hospitalization') }}
</td>
<td>
{{ Form::select('last_hospitalization', ['' => '-- select --','1' => 'Less than 7 days ago','2' => '7 to 30 days ago','3' => '30 days to 1 year ago','4' => 'More than 1 year ago','5' => 'Never'], $discharge_mortality->last_hospitalization, ['class' => 'form-control compulsory', 'required']) }}
</td>
<td>
{{ Form::label('water_source', 'Primary water source for drinking water') }}
</td>
<td>
{{ Form::select('water_source', ['' => '-- select --', '1' => 'Protected spring', '2' => 'Bore hole', '3' => 'Municipal water', '4' => 'Open source (unprotected, stagnant water, dam)', '5' => 'Slow running water', '6' => 'Fast running water'], $discharge_mortality->water_source, ['class' => 'form-control compulsory', 'required']) }}
</td>
</tr>
<tr>
<td>
{{ Form::label('safe_water', 'Do you boil, filter (good sand/ceramic) or disinfect (using bleach/waterguard) all drinking water?') }}
</td>
<td>
{{ Form::radio('safe_water', 1, $discharge_mortality->filter_water == 1, ['required']) }} Yes
{{ Form::radio('safe_water', 0, $discharge_mortality->filter_water === 0, ['required']) }} No
</td>
<td>{{ Form::label('child_mosquito_net', 'Does your child sleep under a mosquito net?') }}</td>
<td>
{{ Form::select('child_mosquito_net', ['' => '-- select --','1' => 'Never','2' => 'Sometimes','3' => 'Always'], $discharge_mortality->child_mosquito_net, ['class' => 'form-control compulsory', 'required']) }}
</td>
</tr>
<tr>
<td>{{ Form::label('mother_education_level', 'What is the education level of the childs mother?') }}</td>
<td>
{{ Form::select('mother_education_level', ['' => '-- select --','1' => 'No school','2' => '<= P3','3' => 'P4-P7','4' => 'S1-S6','5' => 'Post secondary (including post S4 technical school)','6' => 'Do not know'], $discharge_mortality->mother_education_level, ['class' => 'form-control compulsory', 'required']) }}
</td>
<td>{{ Form::label('hospital_travel_duration', 'How long did it take you to travel to the hospital?') }}</td>
<td>
{{ Form::select('hospital_travel_duration', ['' => '-- select --','1' => '< 30 mins','2' => '30 mins 1 hour','3' => '1 - 4 hours','4' => '> 4 hours'], $discharge_mortality->hospital_travel_duration, ['class' => 'form-control compulsory', 'required']) }}
</td>
</tr>
<tr>
<td>{{ Form::label('maternal_hiv', 'Maternal HIV') }}</td>
<td>
{{ Form::select('maternal_hiv', ['' => '-- select --', '2' => 'HIV Positive', '1' => 'HIV Negative', '0' => 'HIV Unknown'], $discharge_mortality->maternal_hiv, ['class' => 'form-control compulsory', 'required']) }}
</td>
<td>{{ Form::label('child_hiv', 'Child HIV') }}</td>
<td>{{ Form::select('child_hiv', ['' => '-- select --','1' => 'HIV Positive','0' => 'HIV Negative / Unknown'], $discharge_mortality->child_hiv, ['class' => 'form-control compulsory', 'required']) }}</td>
</tr>
<tr>
<td>{{ Form::label('bcs_eye_movement', 'Eye movement') }}</td>
<td>{{ Form::select('bcs_eye_movement', ['' => '-- select --','1' => 'Watches or follows','0' => 'Fails to watch or follow'], $discharge_mortality->bcs_eye_movement, ['class' => 'form-control compulsory', 'required']) }}</td>
<td>{{ Form::label('bcs_best_mortal', 'Best motor response') }}</td>
<td>{{ Form::select('bcs_best_mortal', ['' => '-- select --','0' => 'No response or inappropriate response','1' => 'Withdraws limb from pain stimulus','2' => 'Localizes painful stimulus'], $discharge_mortality->bcs_best_mortal, ['class' => 'form-control compulsory', 'required']) }}</td>
</tr>
<tr>
<td>{{ Form::label('bcs_best_verbal', 'Best verbal response') }}</td>
<td>{{ Form::select('bcs_best_verbal', ['' => '-- select --','0' => 'No vocal response to pain','1' => 'Moan or abnormal cry with pain','2' => 'Cries appropriately with pain (or speaks if verbal)'], $discharge_mortality->bcs_best_verbal, ['class' => 'form-control compulsory', 'required']) }}</td>
<td>{{ Form::label('maternal_age', 'Mother\'s age') }}</td>
<td>{{ Form::number('maternal_age', $discharge_mortality->maternal_age, ['class' => 'form-control compulsory', 'required']) }}</td>
</tr>
</table>
@endif
</div>
</div>
<br><br>
{{ Form::button('Submit',['type'=>'submit', 'class'=>'btn btn-success col-sm-6']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
$(document).ready(function () {
//
});
</script>
@endpush
@@ -0,0 +1,154 @@
<div class="row">
<h4>{{ __('layout.triage') }}: {{ __('layout.children') }} </h4>
</div>
<div class="row">
<h5>{{ __('layout.emergency_signs') }} *** </h5>
</div>
<div class="row">
<div class="table-responsive">
<table class="table table-bordered table-striped table-condensed">
<tbody>
<tr>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col" width="2%">{{ __('layout.yes') }}</th>
<th scope="col" width="2%">{{ __('layout.no') }}</th>
</tr>
<tr>
<th scope="row">{{ __('layout.airway_breathing') }}</th>
<td>{{ __('layout.cyanosis') }}</td>
<td>
<div class="controls">
<input type="radio" name="cyanosis" value="{{ __('layout.yes') }}" id="cyanosis_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="cyanosis" value="{{ __('layout.no') }}" id="cyanosis_0" required>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.stridor_breathing_choking') }}</td>
<td>
<div class="controls">
<input type="radio" name="stridor" value="{{ __('layout.yes') }}" id="stridor_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="stridor" value="{{ __('layout.no') }}" id="stridor_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.severe_resp_distress') }}</td>
<td>
<div class="controls">
<input type="radio" name="severe_distress" value="{{ __('layout.yes') }}" id="severe_distress_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="severe_distress" value="{{ __('layout.no') }}" id="severe_distress_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.circulation') }}</th>
<td>{{ __('layout.capillary_refill_seconds') }}</td>
<td>
<div class="controls">
<input type="radio" name="refill" value="{{ __('layout.yes') }}" id="refill_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="refill" value="{{ __('layout.no') }}" id="refill_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.severe_bleeding') }}</td>
<td>
<div class="controls">
<input type="radio" name="severe_bleeding" value="{{ __('layout.yes') }}" id="severe_bleeding_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="severe_bleeding" value="{{ __('layout.no') }}" id="severe_bleeding_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.weak_fast_pulse') }}</td>
<td>
<div class="controls">
<input type="radio" name="weak_fast_pulse" value="{{ __('layout.yes') }}" id="weak_fast_pulse_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="weak_fast_pulse" value="{{ __('layout.no') }}" id="weak_fast_pulse_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.neurological') }}</th>
<td>{{ __('layout.coma') }}</td>
<td>
<div class="controls">
<input type="radio" name="coma" value="{{ __('layout.yes') }}" id="coma_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="coma" value="{{ __('layout.no') }}" id="coma_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.convulsing_now') }}</td>
<td>
<div class="controls">
<input type="radio" name="convulsing_now" value="{{ __('layout.yes') }}" id="convulsing_now_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="convulsing_now" value="{{ __('layout.no') }}" id="convulsing_now_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.dehydration_children_diarrhoea') }}</th>
<td>{{ __('layout.diarrhoea_lethargy_sunken_eyes') }}</td>
<td>
<div class="controls">
<input type="radio" name="lethargy" value="{{ __('layout.yes') }}" id="lethargy_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="lethargy" value="{{ __('layout.no') }}" id="lethargy_0" required>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="alert alert-warning ">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('layout.positive_call_for_help') }}
</div>
@@ -0,0 +1,113 @@
<div class="row">
<h4>{{ __('layout.adult_triage') }} </h4>
</div>
<div class="row">
<h5>{{ __('layout.family_planning_questions') }}</h5>
</div>
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-4">
<input type="checkbox" class="col-sm-1" name="too_sick" id="too_sick" value="1">
<span style="color: maroon; font-weight: bold">{{ __('layout.too_sick') }}</span>
</div>
</div>
<hr>
<table class="too_sick_remove table table-bordered">
@if ($patient->gender == 2)
<tr class="currently_pregnant">
<td>{{ __('layout.currently_pregnant') }}</td>
<td>
<input type="radio" name='pregnant' id='pregnant_yes' class="answer_no" value="1">&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='pregnant' id='pregnant_no' class="answer_no" value="0">&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="menopause" style="display: none">
<td>{{ __('layout.had_menopause') }}</td>
<td>
<input type="radio" name='menopause' id='menopause_yes' class="answer_no" value="1">&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='menopause' id='menopause_no' class="answer_no" value="0">&nbsp;{{ __('layout.no') }}
</td>
</tr>
@endif
<tr class="sexually_active">
<td>{{ __('layout.sexually_active') }}</td>
<td>
<input type="radio" name='sexually_active' id='sexually_active_yes' class="answer_yes compulsory" value="1">&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='sexually_active' id='sexually_active_no' class="answer_yes compulsory" value="0">&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="expect_child" style="display: none">
<td>{{ __('layout.wish_to_have_child') }}</td>
<td>
<input type="radio" name='yes_no_children' id='yes_children' class="answer_no" value="1">&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='yes_no_children' id='no_children' class="answer_no" value="0">&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="fp_method" style="display: none">
<td>{{ Form::label('fp_method', __('layout.family_planning_method')) }}</td>
<td>{{ Form::select('fp_method', $family_planning_methods, '', ['class' => 'form-control col-sm-8']) }}</td>
</tr>
<tr class="fp_action" style="display: none">
<td>{{ __('layout.action') }}</td>
<td>
<select name='fp_action' class="form-control col-sm-8">
<option value="">--{{ __('layout.select') }}--</option>
<option value="{{ __('layout.none') }}">{{ __('layout.none') }}</option>
<option value="{{ __('layout.counseling') }}">{{ __('layout.counseling') }}</option>
<option value="{{ __('layout.referral_to_fp') }}">{{ __('layout.referral_to_fp') }}</option>
</select>
</td>
</tr>
</table>
@push('scripts')
<script>
$("#too_sick").change(function () {
if ($(this).is(':checked')) {
$(".too_sick_remove").hide();
} else {
$(".too_sick_remove").show();
}
});
$("#menopause_yes").change(function () {
$(".sexually_active").hide();
})
$("#menopause_no").change(function () {
$(".sexually_active").show();
})
$("#sexually_active_no").change(function () {
$(".expect_child").hide();
})
$("#sexually_active_yes").change(function () {
$(".expect_child").show();
})
$("#yes_children").change(function () {
$(".fp_method").hide();
$(".fp_action").hide();
})
$("#no_children").change(function () {
$(".fp_method").show();
$(".fp_action").show();
})
$("#pregnant_yes").change(function () {
$(".menopause").hide();
$(".sexually_active").hide();
})
$("#pregnant_no").change(function () {
$(".menopause").show();
$(".sexually_active").show();
})
</script>
@endpush
@@ -0,0 +1,338 @@
<div>
<input type="hidden" name="is_hiv_and_gbv_screening_tool_enabled"
value="{{ is_hiv_and_gbv_screening_tool_enabled() }}">
</div>
@if (between($age_diff_months, 18, 168))
{{-- HIV Screening Tool (18 months to 14 years), show_hiv_positive_questions nolonger needed --}}
@endif
@if ($years >= 15)
{{-- HIV Screening Tool (=>15 years) --}}
<div class="wrapper">
<div>
<div class="pb-3">
<h5 class="font-weight-bold">HIV Screening Tool for adults (=>15 years)</h5>
</div>
<div>
<p>Does the client belong to ANY of these categories?</p>
</div>
<div class="table-responsive">
<table class="table table-striped table-sm w-100 mb-4">
<tbody>
<tr>
<td>Have you tested for HIV in the last 12 months?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="tested_for_hiv_in_past_12_months" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="tested_for_hiv_in_past_12_months" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you had TB or presumptive TB (2 weeks' history of cough, night sweats, weight loss,
fever)?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="had_tb_or_presumptive_tb" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="had_tb_or_presumptive_tb" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Do you have symptoms of Sexually Transmitted Infection (blisters, sores, unusual
urethral or vaginal discharge)?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="sti_symptoms_present" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="sti_symptoms_present" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you been diagnosed with Hepatitis B or C?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="diagnosed_with_hepatitis_b_or_c" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="diagnosed_with_hepatitis_b_or_c" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you experienced or caused Sexual violence (SGBV)?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="experienced_or_caused_sexual_violence" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="experienced_or_caused_sexual_violence" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Do you have a reactive HIV self-test result?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="reactive_hiv_self_test_result" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="reactive_hiv_self_test_result" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you been identified through an Index client?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="identified_through_index_client" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="identified_through_index_client" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you been exposed to blood or body fluids from a Known HIV positive or unknown HIV
status source?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="exposed_to_hiv_positive_or_unknown_source"
value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="exposed_to_hiv_positive_or_unknown_source"
value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you had signs and symptoms of HIV disease and not had an HIV test in the last 1
month.</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="hiv_symptoms_without_recent_test" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="hiv_symptoms_without_recent_test" value="0" />
No
</label>
</td>
</tr>
</tbody>
</table>
<hr class="invisibe my-5 text-white border-none" style="border: none;">
<div class="row m-t-10 w-100 mt-4">
<div class="col-md-4 mx-2">
<p>Have you tested for HIV in the last 3 months?</p>
</div>
<div class="col-md-4">
<label for="one" class="pl-5">
{{ Form::radio('tested_for_hiv_last_3_months', 1, false, ['onclick' => 'show_tested_for_hiv_last_3_months_questions()']) }}
Yes
</label>
<label for="one" class="pl-5">
{{ Form::radio('tested_for_hiv_last_3_months', 0, false, ['onclick' => 'hide_tested_for_hiv_last_3_months_questions()']) }}
No
</label>
</div>
</div>
<table class="table table-striped table-sm w-100" id="tested_for_hiv_last_3_months_section">
<tbody>
<tr>
<td>Have you tested for HIV in the last 12 months?</td>
<td class="text-right">
<label for="one11" class="pl-5">
Yes
<input type="radio" id="one11" name="tested_for_hiv_last_12_months"
value="1" />
</label>
<label for="one22" class="pl-5">
No
<input type="radio" id="one22" name="tested_for_hiv_last_12_months"
value="0" />
</label>
</td>
</tr>
<tr>
<td>Have you had unprotected sex with partner(s) of unknown HIV status?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="unprotected_sex_with_partner_of_unknown_hiv_status"
value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="unprotected_sex_with_partner_of_unknown_hiv_status"
value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you had unprotected sex with an HIV positive partner? (includes discordance)</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="unprotected_sex_with_hiv_positive_partner"
value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="unprotected_sex_with_hiv_positive_partner"
value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you shared injecting needles or piercing objects with anyone else?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="shared_needles_or_piercing_objects" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="shared_needles_or_piercing_objects" value="0" />
No
</label>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@elseif ($years >= 1.5 && $years < 15)
<div class="wrapper">
<div class="pb-3">
<h5 class="font-weight-bold">HIV Screening Tool (18 months to 14 years)</h5>
<div class="row m-0">
<div class="col-md p-0 mb-2">Is the child's mother HIV positive?</div>
<div class="col-md p-0 mb-2">
<label for="1_childs_mother_hiv_positive" class="pr-5">
<input type="radio" name="mother_hiv_positive" id="1_childs_mother_hiv_positive"
value="1" />
Yes
</label>
<label for="2_childs_mother_hiv_positive" class="pr-5">
<input type="radio" name="mother_hiv_positive" id="2_childs_mother_hiv_positive"
value="0" />
No / Unknown
</label>
</div>
<div class="col-md p-0 mb-2"></div>
</div>
<div class="row m-0 mt-3 pt-3 d-none child-hiv-status">
<div class="col-md p-0 mb-2"> Ask the following questions to the caregiver or child </div>
</div>
<div class="table-responsive d-none child-hiv-status-questions">
<table class="table table-striped table-sm w-100">
<tbody>
<tr>
<td>Has the child / Have you been sick in the last 3 months?</td>
<td class="text-right">
<label for="1_person_sick_last_3_months" class="pl-5">
<input type="radio" name="has_been_sick_last_3_months"
id="1_person_sick_last_3_months" value="1" />
Yes
</label>
<label for="2_person_sick_last_3_months" class="pl-5">
<input type="radio" name="has_been_sick_last_3_months"
id="2_person_sick_last_3_months" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Has the child / Have you had a recurring skin problem?</td>
<td class="text-right">
<label for="1_person_had_recurring_skin_problem" class="pl-5">
<input type="radio" name="has_recurring_skin_problem"
id="1_person_had_recurring_skin_problem" value="1" />
Yes
</label>
<label for="2_person_had_recurring_skin_problem" class="pl-5">
<input type="radio" name="has_recurring_skin_problem"
id="2_person_had_recurring_skin_problem" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Has the child / Have you loast weight in the last 3 months?</td>
<td class="text-right">
<label for="1_person_lost_weight_in_last_3_months" class="pl-5">
<input type="radio" name="has_lost_weight_last_3_months"
id="1_person_lost_weight_in_last_3_months" value="1" />
Yes
</label>
<label for="2_person_lost_weight_in_last_3_months" class="pl-5">
<input type="radio" name="has_lost_weight_last_3_months"
id="2_person_lost_weight_in_last_3_months" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Has the child / Have you ever had TB?</td>
<td class="text-right">
<label for="1_person_ever_had_tb" class="pl-5">
<input type="radio" name="has_had_tb" id="1_person_ever_had_tb"
value="1" />
Yes
</label>
<label for="2_person_ever_had_tb" class="pl-5">
<input type="radio" name="has_had_tb" id="2_person_ever_had_tb"
value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Is the child / Are you growing well ?</td>
<td class="text-right">
<label for="1_person_growing_well" class="pl-5">
<input type="radio" name="is_growing_well" id="1_person_growing_well"
value="1" />
Yes
</label>
<label for="2_person_growing_well" class="pl-5">
<input type="radio" name="is_growing_well" id="2_person_growing_well"
value="0" />
No
</label>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,555 @@
@if ($age_group == 1)
@push('scripts')
<script src="{{ asset('js/observations/0_28_days.js') }}"></script>
@endpush
@php $observation_counter = 0; @endphp
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.$observation_counter') }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.$observation_counter') }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@php $observation_counter++; @endphp
@endforeach
@elseif ($age_group == 2)
@push('scripts')
<script src="{{ asset('js/observations/1_12_months.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" class="form-control" value="{{ $observation->option_for_normal }}" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 3)
@push('scripts')
<script src="{{ asset('js/observations/1_5_years.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if($observation->slug=='weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" required class="col-sm-12 compulsory form-control" style="width: 100%"
/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" class="col-sm-12 form-control" />
</div>
</div>
</td>
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 4)
@push('scripts')
<script src="{{ asset('js/observations/6_12_years.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check to make appropriate row for BMI if the observation name is weight -->
@if($observation->slug=='weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" required class="col-sm-12 compulsory form-control" style="width: 100%"
/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" class="col-sm-12 form-control" />
</div>
</div>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 5)
@push('scripts')
<script src="{{ asset('js/observations/over_12_years.js') }}"></script>
<script src="{{ asset('js/observations/over_12_years_news.js') }}"></script>
@endpush
@php $observation_counter = 0; @endphp
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check to make appropriate row for BMI if the observation name is weight -->
@if($observation->slug=='weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" required class="col-sm-12 compulsory form-control" style="width: 100%"
/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" class="col-sm-12 form-control" />
</div>
</div>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.{$observation_counter}') }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.{$observation_counter}') }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->slug}}News" name="{{$observation->slug}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td colspan="3" style="width: 40%;"></td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->slug}}News" name="{{$observation->slug}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@endif
</tr>
@endforeach
@php $observation_counter++; @endphp
@else
{{-- <tr>
<td colspan="5" class="text-center" style="width: 100%; color: maroon">{{ __('layout.ensure_correct_dob') }}</td>
</tr> --}}
{{-- This section should ideally handle dynamically added age groups --}}
@push('scripts')
<script src="{{ asset('js/observations/over_12_years.js') }}"></script>
<script src="{{ asset('js/observations/over_12_years_news.js') }}"></script>
@endpush
@php $observation_counter = 0; @endphp
@if (count($observations) > 0)
@foreach ($observations as $observation)
@php
$observations_age_groups_array = is_null($observation->age_group) ? [] : explode(",", $observation->age_group);
@endphp
@if (in_array($age_group, $observations_age_groups_array))
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check to make appropriate row for BMI if the observation name is weight -->
@if($observation->slug=='weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" required class="col-sm-12 compulsory form-control" style="width: 100%"
/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" class="col-sm-12 form-control" />
</div>
</div>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.{$observation_counter}') }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.{$observation_counter}') }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->slug}}News" name="{{$observation->slug}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td colspan="3" style="width: 40%;"></td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->slug}}News" name="{{$observation->slug}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@endif
</tr>
@php $observation_counter++; @endphp
@endif
@endforeach
@endif
@endif
<tr id="nutritional_status_div" style="display: none">
<td class="text-center"><h5>Nutritional Status</h5></td>
<td class="text-center"><h5 style="color: darkorange" id="nutritional_status_text">MAM</h5></td>
<td class="text-center" colspan="2"><h5 style="color: darkorange" id="nutritional_status_reason">BMI 11.83 < 12.7 (BMIz -2SD)</h5></td>
</tr>
@@ -0,0 +1,47 @@
<div class="row">
<h4 class="heading pull-right">{{ __('layout.priority_signs') }}</h4>
</div>
<div class="row">
<table class="table table-bordered table-primary table-blue table-striped table-vertical-center table-condensed">
<tbody>
<tr>
<th scope="row"><div align="left">{{ __('layout.significant_trauma') }}</div></th>
<td><input type="checkbox" name="trauma" id="trauma" value="Yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.severe_pain') }}</div></th>
<td>
<input type="checkbox" name="severe_pain" id="severe_pain" value="yes">
</td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.oedema_both_feet') }}</div></th>
<td><input type="checkbox" name="oedema" id="oedema" value="yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.urgent_surgical_condition') }}</div></th>
<td><input type="checkbox" name="surgical_condition" id="surgical_condition" value="yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.restless_irritable') }}</div></th>
<td><input type="checkbox" name="continuously_irritable" id="continuously_irritable" value="yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.malnutrition_visible_wasting') }}</div></th>
<td><input type="checkbox" name="severe_wasting" id="severe_wasting" value="yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.severe_pallor') }}</div></th>
<td><input type="checkbox" name="severe_pallor" id="severe_pallor" value="yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.burns_major') }}</div></th>
<td><input type="checkbox" name="burns" id="burns" value="yes"></td>
</tr>
</tbody>
</table>
</div>
<div class="alert alert-warning ">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('layout.positive_move_child_first') }}.
</div>
@@ -0,0 +1,462 @@
@extends('layouts.main')
@section('content')
<div class="row bg-title">
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">{{ __('triage.triage_started') }}
: {{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('triage.dashboard') }}</a></li>
<li><a href="{{ route('patient_episodes.index') }}">{{ __('triage.patient_home') }}</a></li>
<li class="active">{{ __('triage.triage') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<h4>{{ __('triage.patient_details') }}</h4>
<hr>
<div class="row">
<div class="col-md-4">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th>{{ __('triage.patient_number') }}</th>
<td>{{ $patient->number }}</td>
</tr>
<tr>
<th>{{ __('triage.triage_grade') }}</th>
<td><?php echo severe_grade($triage->severe_grade) ?></td>
</tr>
<tr>
<th>{{ __('triage.clinic_allocation') }}</th>
<td>{{ isset($clinics[$triage->clinic_allocation]) ? $clinics[$triage->clinic_allocation] : '' }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-4">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th>{{ __('triage.referral') }}</th>
<td>{{ isset($referral_hospitals[$triage->referral]) ? $referral_hospitals[$triage->referral] : '' }}</td>
</tr>
<tr>
<th>{{ __('triage.triage_done_by') }}</th>
<td>@php echo get_full_name($triage->created_by, "id", "first_name", "last_name", "users"); @endphp</td>
</tr>
<tr>
<th>{{ __('triage.triage_done_on') }}</th>
<td>{{ $triage->created_at->format('jS M y \a\t g:ia') }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-4">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th>{{ __('triage.patient_attendance') }}</th>
<td>
@if($triage->new_attendance==1)
{{ __('triage.new_attendance') }}
@elseif($triage->re_attendance==1)
{{ __('triage.re_attendance') }}
@else
{{ __('triage.unknown') }}
@endif
</td>
</tr>
<tr>
<th>{{ __('triage.comment') }}</th>
<td>{{ $triage->comments }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<h4>{{ __('triage.observations') }}</h4>
<hr>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>#</th>
<th>{{ __('triage.observation') }}</th>
<th>{{ __('triage.value') }}</th>
</tr>
</thead>
<tbody>
@php $observation_explode = explode(",", $triage->observations); @endphp
@for ($x = 0; $x < count($observation_explode); $x++)
<tr>
@php $values_explode = explode("=", $observation_explode[$x]); @endphp
<td>{{ $x+1 }}</td>
@foreach ($values_explode as $value)
<td>{{ $value }}</td>
@endforeach
</tr>
@endfor
</tbody>
</table>
</div>
<div class="col-sm-4">
@if(!are_symptoms_on_consultation())
<h4>{{ __('triage.symptoms') }}</h4>
<hr>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>{{ __('triage.symptoms') }}</th>
<th>{{ __('triage.duration') }}</th>
</tr>
</thead>
<tbody>
<tr>
@php
$symptoms_explode = explode(",", $triage->symptoms);
$duration_explode = explode(",", $triage->symptom_duration);
@endphp
@for ($i = 0; $i < count($symptoms_explode); $i++)
<tr>
<td>{{ $symptoms[$symptoms_explode[$i]] ?? '' }}</td>
<td>{{ $duration_explode[$i] ?? '' }}</td>
</tr>
@endfor
</tr>
</tbody>
</table>
@endif
@if ($discharge_mortality && between($age_diff_months, 0, 6) && is_smart_discharge_enabled())
<hr>
<table class="table table-bordered table-striped">
<tr>
<td class="text-center" colspan="2"><h4>Post Discharge Mortality Risk</h4></td>
</tr>
<tr>
<td>{{ Form::label('hospital_travel_duration', 'How long did it take you to travel to the hospital?') }}</td>
<td>
@php $arr = ['1' => '< 30 mins','2' => '30 mins 1 hour','3' => '1 - 4 hours','4' => '> 4 hours']; @endphp
{{ $discharge_mortality->hospital_travel_duration_below_6 ? $arr[$discharge_mortality->hospital_travel_duration_below_6] : "Not Recorded" }}
</td>
</tr>
<tr>
<td>{{ Form::label('illness_duration', 'What is the duration of the present illness at the time of admission?') }}</td>
<td>
@php $arr = ['1' => '< 48 hours','2' => '48 hours - 7 days','3' => '7 days - 1 month','4' => 'More than a month']; @endphp
{{ $discharge_mortality->illness_duration_at_admission_below_6 ? $arr[$discharge_mortality->illness_duration_at_admission_below_6] : "Not Recorded" }}
</td>
</tr>
</table>
@endif
@if ($discharge_mortality && $discharge_mortality->child_with_proven_infection == 1 && between($age_diff_months, 7, 60) && is_smart_discharge_enabled())
<hr>
<table class="table table-bordered table-striped">
<tr>
<td class="text-center" colspan="2"><h4>Post Discharge Mortality Risk</h4></td>
</tr>
<tr>
<td>
{{ Form::label('last_hospitalization', 'Time since last hospitalization') }}
</td>
<td>
@php $arr = ['1' => 'Less than 7 days ago','2' => '7 to 30 days ago','3' => '30 days to 1 year ago','4' => 'More than 1 year ago','5' => 'Never']; @endphp
{{ $discharge_mortality->last_hospitalization ? $arr[$discharge_mortality->last_hospitalization] : "Not Recorded" }}
</td>
</tr>
<tr>
<td>
{{ Form::label('safe_water', 'Do you boil, filter (good sand/ceramic) or disinfect (using bleach/waterguard) all drinking water?') }}
</td>
<td>
@if($discharge_mortality->filter_water == 1)
Yes
@else
No
@endif
</td>
</tr>
<tr>
<td>{{ Form::label('child_mosquito_net', 'Does your child sleep under a mosquito net?') }}</td>
<td>
@php $arr = ['1' => 'Never','2' => 'Sometimes','3' => 'Always']; @endphp
{{ $discharge_mortality->child_mosquito_net ? $arr[$discharge_mortality->child_mosquito_net] : "Not Recorded" }}
</td>
</tr>
<tr>
<td>{{ Form::label('hospital_travel_duration', 'How long did it take you to travel to the hospital?') }}</td>
<td>
@php $arr = ['1' => '< 30 mins','2' => '30 mins 1 hour','3' => '1 - 4 hours','4' => '> 4 hours']; @endphp
{{ $discharge_mortality->hospital_travel_duration ? $arr[$discharge_mortality->hospital_travel_duration] : "Not Recorded" }}
</td>
</tr>
<tr>
<td>{{ Form::label('mother_education_level', 'What is the education level of the childs mother?') }}</td>
<td>
@php $arr = ['1' => 'No school','2' => '<= P3','3' => 'P4-P7','4' => 'S1-S6','5' => 'Post secondary (including post S4 technical school)','6' => 'Do not know']; @endphp
{{ $discharge_mortality->mother_education_level ? $arr[$discharge_mortality->mother_education_level] : "Not Recorded" }}
</td>
</tr>
<tr>
<td>Eye movement</td>
<td>{{ ['1' => 'Watches or follows','0' => 'Fails to watch or follow'][$discharge_mortality->bcs_eye_movement] ?? '' }}</td>
</tr>
<tr>
<td>Best motor response</td>
<td>{{ ['0' => 'No response or inappropriate response','1' => 'Withdraws limb from pain stimulus','2' => 'Localizes painful stimulus'][$discharge_mortality->bcs_best_mortal] ?? '' }}</td>
</tr>
<tr>
<td>Best verbal response</td>
<td>{{ ['0' => 'No vocal response to pain','1' => 'Moan or abnormal cry with pain','2' => 'Cries appropriately with pain (or speaks if verbal)'][$discharge_mortality->bcs_best_verbal] ?? '' }}</td>
</tr>
<tr>
<td>Mother's age</td>
<td>{{ $discharge_mortality->maternal_age }}</td>
</tr>
</table>
@endif
@if ($triage->any_tb_sysmptoms == 1)
<table class="tb_questions_table table table-striped table-bordered">
<tr>
<td class="text-center" colspan="2"><h4>TB SCREENING</h4></td>
</tr>
<tr class="cough_tb_question">
<td>A cough for more than two weeks ?</td>
<td>{{ $triage->cough_for_2_weeks == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="fever_tb_question">
<td>Persistent fevers for 2 weeks or more ?</td>
<td>{{ $triage->fever_for_2_weeks == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="weight_loss_tb_question">
<td>Noticable weight loss of more than 3 Kg?</td>
<td>{{ $triage->tb_weight_loss == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="weight_loss_tb_question">
<td>Poor weight gain in the last one month ?</td>
<td>{{ $triage->tb_poor_weight_gain == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="excessive_night_sweats_tb_question">
<td>Excessive night sweats for three weeks or more ?</td>
<td>{{ $triage->tb_excessive_night_sweats == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="excessive_night_sweats_tb_question">
<td>Contact with a person with pulmonary TB or chronic cough ?</td>
<td>{{ $triage->tb_contact_with_tb_person == 1 ? "Yes" : "No" }}</td>
</tr>
</table>
@endif
@if(is_smart_triage_enabled() && $nutrition)
<table class="table table-striped table-bordered">
<tr>
<td class="text-center" colspan="2"><h4>Nutritional Status</h4></td>
</tr>
<tr class="cough_tb_question">
<td>{{ $nutrition->text }}</td>
<td>{{ $nutrition->reason }}</td>
</tr>
</table>
@endif
</div>
<div class="col-sm-4">
@if(!$triage_without_etat)
@if (between($years, 16, 50) && $triage->fp_too_sick == 0)
<h4>{{ __('triage.family_planning') }}</h4>
<table class="table table-striped table-bordered">
<tr>
<td>1</td>
<td>{{ __('triage.too_sick') }}</td>
@if(is_null($triage->fp_too_sick))
<td> N/A</td>
@else
<td>{{ ($triage->fp_too_sick == 1) ? __('triage.yes') : __('triage.no') }}</td>
@endif
</tr>
<tr>
<td>2</td>
<td>{{ __('triage.sexually_active') }}</td>
@if(is_null($triage->sexually_active))
<td> N/A</td>
@else
<td>{{ ($triage->sexually_active == 1) ? __('triage.yes') : __('triage.no') }}</td>
@endif
</tr>
<tr>
<td>3</td>
<td>{{ __('triage.pregnant') }}</td>
@if(is_null($triage->pregnant))
<td> N/A</td>
@else
<td>{{ ($triage->pregnant == 1) ? __('triage.yes') : __('triage.no') }}</td>
@endif
</tr>
<tr>
<td>4</td>
<td>{{ __('triage.menopause') }}</td>
@if(is_null($triage->menopause))
<td> N/A</td>
@else
<td>{{ ($triage->menopause == 1) ? __('triage.yes') : __('triage.no') }}</td>
@endif
</tr>
<tr>
<td>5</td>
<td>{{ __('triage.family_planning_method') }}</td>
<td>{{ isset($triage->fp_method) ? $family_planning_methods[$triage->fp_method] : "N/A" }}</td>
</tr>
<tr>
<td>6</td>
<td>{{ __('triage.action') }}</td>
<td>{{ isset($triage->fp_action) ? $triage->fp_action : "N/A" }}</td>
</tr>
</table>
@endif
@if (between($years, 0, 12))
<h4>{{ __('triage.emergency_signs') }}</h4>
<hr>
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th colspan="2" class="text-center">{{ __('triage.airway') }}</th>
</tr>
@foreach($airway as $key => $value)
<tr>
<th>{{ $key }}</th>
<td>{{ ucfirst($value) }}</td>
</tr>
@endforeach
<tr>
<th colspan="2" class="text-center">{{ __('triage.circulation') }}</th>
</tr>
@foreach($circulation as $key => $value)
<tr>
<th>{{ $key }}</th>
<td>{{ ucfirst($value) }}</td>
</tr>
@endforeach
<tr>
<th colspan="2" class="text-center">{{ __('triage.neurological') }}</th>
</tr>
@foreach($neurological as $key => $value)
<tr>
<th>{{ $key }}</th>
<td>{{ ucfirst($value) }}</td>
</tr>
@endforeach
<tr>
<th colspan="2" class="text-center">{{ __('triage.dehydration') }}</th>
</tr>
@foreach($dehydration as $key => $value)
<tr>
<th>{{ $key }}</th>
<td>{{ ucfirst($value) }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
@if (between($years, 0, 12) && count($priority_signs) > 0)
<h4>{{ __('layout.priority_signs') }}</h4>
<hr>
<table class="table table-striped table-bordered">
<tbody>
@foreach($priority_signs as $priority_sign)
<tr>
<td>{{ $priority_sign }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
@else
<h4>Notes</h4>
<hr>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th>{{ __('triage.choose_blood_group') }}</th>
<td>{{ $triage->blood_group }}</td>
</tr>
<tr>
<th>{{ __('triage.rhesus_factor') }}</th>
<td>
@if($triage->rhesus_factor == 1)
{{ __('triage.positive') }}
@elseif($triage->rhesus_factor == 2)
{{ __('triage.negative') }}
@else
{{ __('triage.unknown') }}
@endif
</td>
</tr>
<tr>
<th>{{ __('triage.observation_notes') }}</th>
<td>{{ ($triage->observation_notes) ?? "No notes available" }}</td>
</tr>
<tr>
<th>{{ __('triage.nursing_notes') }}</th>
<td>{{ ($triage->nursing_notes) ?? "No notes available" }}</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
</div>
<hr>
<div>
@php $clinic_slug = get_name($triage->clinic_allocation, "id", "slug", "clinics"); @endphp
@if($clinic_slug == "diabetes")
{{ Form::open(['route' => 'diabetes_clinic.clinic_registration']) }}
{{ Form::button(__('triage.go_to_diabetes'),['type'=>'submit','class'=>'btn btn-success btn-block']) }}
{{ Form::close() }}
@endif
</div>
@if(Auth::user()->can('edit-patient-triage'))
<a href="/triage/{{ $triage->id }}/edit/" class="btn btn-success"> Modify Triage </a>
@endif
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
@endpush
@@ -0,0 +1,156 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">Smart Triage Report</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('triage.dashboard') }}</a></li>
<li class="active">{{ __('triage.triage') }}</li>
</ol>
</div>
</div>
<div class="white-box">
{{ Form::open(['route' => 'triage.smart_triage_report', 'method' => 'ANY']) }}
<div class="row">
<div class="col-md-3">
{{ Form::label('start_date',__('stores.start')) }}
<div class="input-group">
{{ Form::text('start_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'start_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="col-md-3">
{{ Form::label('end_date',__('stores.end')) }}
<div class="input-group">
{{ Form::text('end_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'end_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="col-md-3">
<div class="form-group" style="padding-top: 5px;"><br>
{{ Form::button(__('patient_flow_monitoring.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
</div>
{{ Form::close() }}
</div>
<div class="white-box">
<h4><p class="label label-info">From {{ streamline_date($start_date) }} to {{ streamline_date($end_date) }}</p></h4>
<hr>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table table-striped table-hover">
<thead>
<tr>
<th>Patient Info</th>
<th>Age</th>
<th>Pulse</th>
<th>Temperature</th>
<th>MUAC</th>
<th>Parent Concern</th>
<th>Respiratory Distress</th>
<th>Oedema</th>
<th>Pallor</th>
<th>Risk Score</th>
<th>Recommended Triage Grade</th>
<th>Actual Triage Grade</th>
<th>Date Recorded</th>
<th>Select</th>
</tr>
</thead>
<tbody>
@foreach($records as $record)
<tr>
<td>{{ $record->first_name . ' ' . $record->last_name }} ({{ $record->patients_number }})</td>
<td>{{ get_patients_age($record->date_of_birth) }}</td>
<td>{{ $record->pulse_rate }}</td>
<td>{{ $record->temperature }}</td>
<td>{{ $record->muac }}</td>
<td>
@if($record->parent_concern == 0)
Child Should Not Be Admitted
@else
Child Should Be Admitted
@endif
</td>
<td>
@if($record->respiratory_distress == 1)
Severe
@endif
</td>
<td>
@if($record->oedema == 1)
Oedema of both feet
@endif
</td>
<td>
@if($record->pallor == 1)
Severe pallor
@endif
</td>
<td>{{ round($record->risk_score * 100) }} %</td>
<td>
@if($record->auto_triage_grade == 2)
<b style="color: red">Emergency</b>
@elseif($record->auto_triage_grade == 1)
<b style="color: orange">Priority</b>
@else
<b style="color: green">Non-Urgent</b>
@endif
</td>
<td>
@if($record->selected_triage_grade == 2)
<b style="color: red">Emergency</b>
@elseif($record->selected_triage_grade == 1)
<b style="color: orange">Priority</b>
@else
<b style="color: green">Non-Urgent</b>
@endif
</td>
<td>{{ streamline_date_time($record->created_at) }}</td>
<td>
<a href="/patient_episodes/set_patient_id/{{ $record->patient_id }}" class="btn btn-rounded btn-primary btn-sm"><i class="fa fa-hand-pointer-o"></i> <strong>{{ __('patients.select') }}</strong></a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script>
$('#start_date,#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
$('.table').DataTable({
dom: 'Bfrtip',
ordering: false,
pageLength : 100,
});
</script>
@endpush
@@ -0,0 +1,322 @@
<div class="row m-0 py-4 px-2" style="border: 1px solid #e4e7ea; margin: 5px">
<div class="col-sm-12">
<strong>INTENSIFIED TB CASE FINDING SCREEN: ({{ $age_group_display }})</strong>
</div>
<hr>
<div class="col-sm-12">
DOES THE PATIENT HAVE ANY OF THE FOLLOWING: <input type="radio" name='any_tb_sysmptoms' id='tb_questions_yes'
class="cough_class" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='any_tb_sysmptoms' id='tb_questions_no' class="cough_class" value="0">&nbsp;No
@if ($age_group == 5 || $age_group_display == '> 12 Years')
{{-- adults i.e above 12 years --}}
<ol>
<li>
A cough for more than two weeks ?
</li>
<li>
Persistent fevers for 2 weeks or more ?
</li>
<li>
Noticeable weight loss of more than 3kg ?
</li>
<li>
Excessive night sweats for three weeks or more ?
</li>
</ol>
@elseif($age_group == 4 || $age_group_display == '6 - 12 Years')
{{-- between 6-12 years --}}
<ol>
<li>
A cough for more than two weeks ?
</li>
<li>
Persistent fevers for 2 weeks or more ?
</li>
<li>
Noticeable weight loss ?
</li>
<li>
Excessive night sweats for three weeks or more ?
</li>
</ol>
@elseif(
$age_group == 3 ||
$age_group == 2 ||
$age_group == 1 ||
$age_group_display == '1 - 12 Months' ||
$age_group_display == '0 - 28 Days')
{{-- children below 5 years --}}
<ol>
<li>
A cough for more than two weeks ?
</li>
<li>
Persistent fevers for 2 weeks or more ?
</li>
<li>
Noticeable weight loss ?
</li>
<li>
Poor weight gain in the last one month ?
<br>
<span style="color: red">
(weight loss or “very low weight” = where weight for age is less than -3 z-score, or
“underweight” =
weight for age less than -2 z-score, or “confirmed weight loss”= more than 5% since last visit,
or “growth
curve flattening”).
</span>
</li>
<li>
Contact with a person with pulmonary tuberculosis or chronic cough ?
</li>
</ol>
@endif
<br>
<table class="tb_questions_table table table-bordered" style="display: none; background-color: #f3f3f5;">
@if ($age_group == 5 || $age_group_display == '> 12 Years')
<tr class="cough_tb_question">
<td>A cough for more than two weeks ?</td>
<td>
<input type="radio" name='cough_for_2_weeks' id='cough_for_2_weeks_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='cough_for_2_weeks' id='cough_for_2_weeks_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
<tr class="fever_tb_question">
<td>Persistent fevers for 2 weeks or more ?</td>
<td>
<input type="radio" name='fever_for_2_weeks' id='fever_for_2_weeks_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='fever_for_2_weeks' id='fever_for_2_weeks_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
<tr class="weight_loss_tb_question">
<td>Noticeable weight loss of more than 3 Kg?</td>
<td>
<input type="radio" name='tb_weight_loss' id='tb_weight_loss_yes' class="tb_screening_radios"
value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='tb_weight_loss' id='tb_weight_loss_no' class="tb_screening_radios"
value="0">&nbsp;No
</td>
</tr>
<tr class="excessive_night_sweats_tb_question">
<td>Excessive night sweats for three weeks or more ?</td>
<td>
<input type="radio" name='tb_excessive_night_sweats' id='tb_excessive_night_sweats_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='tb_excessive_night_sweats' id='tb_excessive_night_sweats_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
@elseif ($age_group == 4 || $age_group_display == '6 - 12 Years')
<tr class="cough_tb_question">
<td>A cough for more than two weeks ?</td>
<td>
<input type="radio" name='cough_for_2_weeks' id='cough_for_2_weeks_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='cough_for_2_weeks' id='cough_for_2_weeks_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
<tr class="fever_tb_question">
<td>Persistent fevers for 2 weeks or more ?</td>
<td>
<input type="radio" name='fever_for_2_weeks' id='fever_for_2_weeks_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='fever_for_2_weeks' id='fever_for_2_weeks_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
<tr class="weight_loss_tb_question">
<td>Noticeable weight loss ?</td>
<td>
<input type="radio" name='tb_weight_loss' id='tb_weight_loss_yes' class="tb_screening_radios"
value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='tb_weight_loss' id='tb_weight_loss_no' class="tb_screening_radios"
value="0">&nbsp;No
</td>
</tr>
<tr class="excessive_night_sweats_tb_question">
<td>Excessive night sweats for three weeks or more ?</td>
<td>
<input type="radio" name='tb_excessive_night_sweats' id='tb_excessive_night_sweats_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='tb_excessive_night_sweats' id='tb_excessive_night_sweats_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
@elseif(
$age_group == 3 ||
$age_group == 2 ||
$age_group == 1 ||
$age_group_display == '1 - 12 Months' ||
$age_group_display == '0 - 28 Days')
{{-- children below 5 years --}}
<tr class="cough_tb_question">
<td>A cough for more than two weeks ?</td>
<td>
<input type="radio" name='cough_for_2_weeks' id='cough_for_2_weeks_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='cough_for_2_weeks' id='cough_for_2_weeks_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
<tr class="fever_tb_question">
<td>Persistent fevers for 2 weeks or more ?</td>
<td>
<input type="radio" name='fever_for_2_weeks' id='fever_for_2_weeks_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='fever_for_2_weeks' id='fever_for_2_weeks_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
<tr class="weight_loss_tb_question">
<td>Noticeable weight loss ?</td>
<td>
<input type="radio" name='tb_weight_loss' id='tb_weight_loss_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='tb_weight_loss' id='tb_weight_loss_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
<tr class="poor_weight_gain_tb_question">
<td>Poor weight gain in the last one month ?
<br>
<span style="color: red">
(weight loss or “very low weight” = where weight for age is<br> less than -3 z-score, or
“underweight” = weight for age less than<br> -2 z-score, or “confirmed weight loss”= more
than 5% since last visit, or “growth curve flattening”).
</span>
</td>
<td>
<input type="radio" name='tb_poor_weight_gain' id='tb_poor_weight_gain_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='tb_poor_weight_gain' id='tb_poor_weight_gain_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
<tr class="contact_with_tb_person_with_tb_question">
<td>Contact with a person with pulmonary TB or chronic cough ?</td>
<td>
<input type="radio" name='tb_contact_with_tb_person' id='tb_contact_with_tb_person_yes'
class="tb_screening_radios" value="1">&nbsp;Yes &nbsp;&nbsp;&nbsp;
<input type="radio" name='tb_contact_with_tb_person' id='tb_contact_with_tb_person_no'
class="tb_screening_radios" value="0">&nbsp;No
</td>
</tr>
@endif
</table>
</div>
</div>
<br>
<div class="modal fade" id="TBActionModal" tabindex="-1" role="dialog" aria-labelledby="modalTBActionLabel1"
style="margin-top: 20%">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body">
<h4 class="modal-title"><u>ACTION NEEDED: <font color=red>Possible TB</font></u></h4><br>
<div class="possible_tb_action_for_coughing" style="display:none; font: bolder">
@if ($age_group == 5 || $age_group_display == '> 12 Years')
<ol>
<li>REQUEST FOR SPUTUM TEST</li>
<li>REFER TO CLINICIAN FOR FURTHER INVESTIGATIONS</li>
<li style="color: red">DIRECT THE PATIENT TO DESIGNATED AREA FOR PEOPLE WITH CHRONIC COUGH
AWAY FROM THE MAIN QUEUE TO REDUCE THE RISK OF CROSS-INFECTION</li>
</ol>
@elseif ($age_group == 4 || $age_group_display == '6 - 12 Years')
<ol>
<li>REQUEST FOR SPUTUM TEST if child can manage</li>
<li>REFER TO CLINICIAN FOR FURTHER INVESTIGATIONS</li>
<li style="color: red">DIRECT THE PATIENT TO DESIGNATED AREA FOR PEOPLE WITH CHRONIC COUGH
AWAY FROM THE MAIN QUEUE TO REDUCE THE RISK OF CROSS-INFECTION</li>
</ol>
@elseif(
$age_group == 3 ||
$age_group == 2 ||
$age_group == 1 ||
$age_group_display == '1 - 12 Months' ||
$age_group_display == '0 - 28 Days')
{{-- children below 5 years --}}
<ol>
<li>REFER TO CLINICIAN FOR FURTHER INVESTIGATIONS</li>
<li style="color: red">DIRECT THE PATIENT TO DESIGNATED AREA FOR PEOPLE WITH CHRONIC COUGH
AWAY FROM THE MAIN QUEUE TO REDUCE THE RISK OF CROSS-INFECTION</li>
</ol>
@endif
</div>
<div class="possible_tb_action_for_non_coughing" style="display:none; font: bolder">
@if ($age_group == 5 || $age_group == 4 || $age_group_display == '6 - 12 Years' || $age_group_display == '> 12 Years')
<ol>
<li>REFER TO CLINICIAN FOR FURTHER INVESTIGATIONS</li>
</ol>
@endif
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
$("#tb_questions_no").change(function() {
$(".tb_questions_table").hide();
$(".tb_screening_radios").removeAttr("required");
console.log('no tb screening');
console.log($("#tb_questions_yes").is(':checked'));
})
$("#tb_questions_yes").change(function() {
$(".tb_questions_table").show();
$(".tb_screening_radios").attr('required', 'true');
console.log('yes tb screening');
console.log($("#tb_questions_yes").is(':checked'));
})
$('input[name="cough_for_2_weeks"]').change(function() {
if ($("#cough_for_2_weeks_yes").is(':checked')) {
//$("#TBActionModal").modal("show");
$(".possible_tb_action_for_coughing").show();
$(".possible_tb_action_for_non_coughing").hide();
}
})
$('input[name="fever_for_2_weeks"]').change(function() {
if ($("#cough_for_2_weeks_yes").is(":not(:checked)") && $("#fever_for_2_weeks_yes").is(':checked')) {
//$("#TBActionModal").modal("show");
$(".possible_tb_action_for_coughing").hide();
$(".possible_tb_action_for_non_coughing").show();
}
})
$('input[name="tb_weight_loss"]').change(function() {
var ageGroup = <?php echo $age_group; ?>;
console.log(ageGroup);
if ($("#cough_for_2_weeks_yes").is(":not(:checked)") && $("#tb_weight_loss_yes").is(':checked')) {
//$("#TBActionModal").modal("show");
$(".possible_tb_action_for_coughing").hide();
$(".possible_tb_action_for_non_coughing").show();
}
})
$('input[name="tb_excessive_night_sweats"]').change(function() {
if ($("#cough_for_2_weeks_yes").is(":not(:checked)") && $("#tb_excessive_night_sweats_yes").is(
':checked')) {
//$("#TBActionModal").modal("show");
$(".possible_tb_action_for_coughing").hide();
$(".possible_tb_action_for_non_coughing").show();
}
})
</script>
@endpush
@@ -150,6 +150,11 @@ Route::group(['middleware' => ['auth', 'disablebackbutton', 'user-locale']], fun
/* patient residences */
Route::get('patient_residence/{disctrict_id}', 'PatientController@get_residence');
Route::get('patient_residence/search_districts', 'PatientController@search_districts');
Route::get('patient_residence/search_counties', 'PatientController@search_counties');
Route::get('patient_residence/search_subcounties', 'PatientController@search_subcounties');
Route::get('patient_residence/search_parishes', 'PatientController@search_parishes');
Route::get('patient_residence/search_villages', 'PatientController@search_villages');
Route::get('patient_residence/district/{district_id}', 'PatientController@get_residence_district');
Route::get('patient_residence/county/{county_id}', 'PatientController@get_residence_county');
Route::get('patient_residence/sub_county/{sub_county_id}', 'PatientController@get_residence_sub_county');
@@ -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();
}
}
+1 -1
View File
@@ -95,7 +95,7 @@ return [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'expire' => 600,
],
],
+69 -8
View File
@@ -1,6 +1,9 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
@@ -15,7 +18,23 @@ return [
|
*/
'default' => env('LOG_CHANNEL', 'daily'),
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => false,
],
/*
|--------------------------------------------------------------------------
@@ -29,25 +48,29 @@ return [
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['errorlog', 'single'],
'channels' => ['daily'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('APP_LOG_LEVEL', 'debug'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('APP_LOG_LEVEL', 'debug'),
'days' => 7,
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
'replace_placeholders' => true,
],
'slack' => [
@@ -55,25 +78,63 @@ return [
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'stdout' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_STDOUT_HANDLER', SyslogUdpHandler::class),
'formatter' => env('LOG_STDOUT_FORMATTER'),
'with' => [
'stream' => 'php://stdout',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('APP_LOG_LEVEL', 'debug'),
'level' => env('LOG_LEVEL', 'debug'),
'facility' => LOG_USER,
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('APP_LOG_LEVEL', 'debug'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
+1 -1
View File
@@ -29,7 +29,7 @@ return [
|
*/
'lifetime' => 60,
'lifetime' => 600,
'expire_on_close' => true,
+7 -1
View File
@@ -1,5 +1,11 @@
<?php
if (env("DOCKER_ACTIVE", false) === true) {
$pdfPath = '/usr/bin/wkhtmltopdf';
} else {
$pdfPath = base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64');
}
return [
/*
|--------------------------------------------------------------------------
@@ -34,7 +40,7 @@ return [
'pdf' => [
'enabled' => true,
'binary' => base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'),
'binary' => $pdfPath,
'timeout' => false,
'options' => [],
'env' => [],
@@ -33,8 +33,8 @@ class CreateResourcesTable extends Migration
$table->increments('id');
$table->string('name');
$table->integer('active')->nullable();
$table->integer('created_by')->nullable();;
$table->integer('updated_by')->nullable();;
$table->integer('created_by')->nullable();
$table->integer('updated_by')->nullable();
$table->timestamps();
// for soft deletes to create deleted_at column

Some files were not shown because too many files have changed in this diff Show More