Files

451 lines
28 KiB
PHP
Executable File

@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-4 col-md-5 col-sm-5 col-xs-12">
<h4 class="page-title">
@if($imaging_type == 'Imaging')
{{ __('investigations.incoming_radiology_investigations') }}
@elseif($imaging_type == 'Cardio')
{{ __('investigations.incoming_cardiology_investigations') }}
@elseif($imaging_type == 'Ultrasound')
{{ __('investigations.incoming_ultrasound_investigations') }}
@elseif($imaging_type == 'Ultrasound_Obstetric')
{{ __('investigations.incoming_obstetric_ultrasound_investigations') }}
@endif
</h4>
</div>
<div class="col-lg-8 col-sm-7 col-md-7 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('investigations.dashboard') }}</a></li>
<li><a href="/investigations/index">{{ __('investigations.investigations') }}</a></li>
<li class="active">{{ __('investigations.incoming') }}</li>
</ol>
</div>
</div>
<div class="white-box">
{{ Form::open(['url' => '/investigations/incoming_imaging/' . $imaging_type, 'data-toggle' => 'validator']) }}
{{ Form::hidden('patient_id', 0, ['id' => 'patient_id']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label>{{ __('pharmacy.select_date') }}:</label>
<select class="form-control compulsory required" name="search_date_by" id="search_date_by" required>
<option value="today">{{ __('pharmacy.today') }}</option>
<option value="yesterday">{{ __('pharmacy.yesterday') }}</option>
<option value="custom_date">{{ __('pharmacy.custom_date') }}</option>
<option value="custom_date_range">{{ __('pharmacy.date_range') }}</option>
</select>
</div>
</div>
<div class="col-md-2" id="start_date_div" style="display: none;">
<div class="form-group">
{{ Form::label('start_date', __('pharmacy.date_on')) }}
<div class="input-group">
{{ Form::text('start_date', '', ['class'=>'form-control compulsory', 'readonly', 'id'=>'start_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-2" id="end_date_div" style="display: none;">
<div class="form-group">
{{ Form::label('end_date', __('pharmacy.end_date')) }}
<div class="input-group">
{{ Form::text('end_date', '', ['class'=>'form-control compulsory', 'readonly', 'id'=>'end_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-3">
{{ Form::label('search_patient', 'Search By Patient') }}
<div class="input-group">
<select class="form-control" name="patient_number" id="patient_number"></select>
</div>
</div>
<div class="col-md-2">
<div class="form-group" style="margin-top: 25px;">
{{ Form::submit(__('investigations.search'), ['class'=>'btn btn-success pull-right']) }}
</div>
</div>
</div>
{{ Form::close() }}
</div>
<div class="white-box">
<!--Flash messages at the top -->
@include('flash::message')
@if($search_text != "")
<h4>
<label class="label label-info">{{ $search_text }}</label>&nbsp;&nbsp;
@if (count($urgent_incomings) > 0)
<label class="label label-danger"> There are Urgent
@if($imaging_type == 'Imaging')
{{ __('investigations.incoming_radiology_investigations') }}
@elseif($imaging_type == 'Cardio')
{{ __('investigations.incoming_cardiology_investigations') }}
@elseif($imaging_type == 'Ultrasound')
{{ __('investigations.incoming_ultrasound_investigations') }}
@elseif($imaging_type == 'Ultrasound_Obstetric')
{{ __('investigations.incoming_obstetric_ultrasound_investigations') }}
@endif
</label>
@endif
</h4>
<br>
@endif
<div class="card">
<div class="card-header">
<ul class="nav nav-tabs" role="tablist">
@if (count($urgent_incomings)>0)
<li role="presentation" class="nav-item"> <a href="#per_results_nav_pill" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('investigations.all_incomplete') }} ({{ count($incomings) }})</a> </li>
<li role="presentation" class="nav-item active"> <a href="#urgent_incoming_imaging" class="nav-link text-danger" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('investigations.urgent_incoming_imaging_investigations') }} ({{ count($urgent_incomings) }})</a> </li>
<li role="presentation" class="nav-item"> <a href="#all_complete_nav_pill" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('investigations.all_complete') }} ({{ count($results) }})</a> </li>
@else
<li role="presentation" class="active nav-item"> <a href="#per_results_nav_pill" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('investigations.all_incomplete') }} ({{ count($incomings) }})</a> </li>
<li role="presentation" class="nav-item"> <a href="#all_complete_nav_pill" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('investigations.all_complete') }} ({{ count($results) }})</a> </li>
@endif
</ul>
</div>
<div class="card-block">
<div class="tab-content">
<div id="per_results_nav_pill" class="tab-pane <?php if(count($urgent_incomings) < 1) echo 'active'; ?>">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('investigations.patient_names') }}</th>
<th>{{ __('investigations.requested') }}</th>
<th>{{ __('investigations.source') }}</th>
<th>{{ __('investigations.payment') }}</th>
<th>{{ __('investigations.request') }}</th>
<th colspan="3" class="text-center">{{ __('investigations.actions') }}</th>
</tr>
</thead>
<tbody>
@foreach($incomings as $incoming)
<tr>
<td>
{!! insurance_flag($incoming->patient_id) !!}
({{ $incoming->patient_number }}) - ({{ $patient_categories[$incoming->patients_category_id] ?? '' }})
</td>
<td>{{ streamline_date_time_short($incoming->created_at) }}</td>
<td>
@if($incoming->inpatient == 1 || $incoming->inpatient_bill_generated == 1)
{{ get_ward_name($incoming->patient_id, $incoming->episode_id) }}
@else
OPD
@endif
</td>
<td>
@if($incoming->payment_status == 0)
@if($incoming->inpatient_bill_generated == 1)
<label class="label label-success">{{ __('investigations.inpatient_bill_generated') }}</label>
@else
<label class="label label-danger">{{ __('investigations.not_paid') }}</label>
@endif
@else
<label class="label label-success">{{ __('investigations.paid') }}</label>
@endif
</td>
<td onclick="showQuickView({{ $incoming->id }}, 1)"><i class="fa fa-search"></i> {{ count(explode(",", $incoming->investigation_id)) }} {{ __('investigations.tests') }}</td>
@if($incoming->inpatient == 0 && $incoming->inpatient_bill_generated == 0 && $incoming->payment_status == 0 && !can_investigations_be_performed($incoming->patients_category_id))
<td colspan="3" class="text-center">
<code>{{ __('investigations.patient_has_not_paid_for_ordered_investigations') }}</code>
</td>
@else
<td class="text-center">
@if($imaging_type == 'Ultrasound_Obstetric')
{{ Form::open(['route' => 'investigations.ultrasound_obstetric_report']) }}
@else
{{ Form::open(['route' => 'investigations.ordered_results']) }}
@endif
{{ Form::hidden('order_id',$incoming->id) }}
{{ Form::hidden('order_type', $imaging_type) }}
{{ Form::hidden('patient_id',$incoming->patient_id) }}
{{ Form::hidden('episode_id',$incoming->episode_id) }}
<button type="submit" class="btn btn-success btn-rounded btn-sm">{{ __('investigations.add_results') }}</button>
{{ Form::close() }}
</td>
<td>
<a href="/patient_episodes/set_patient_id/{{ $incoming->patient_id }}" class="btn btn-info btn-rounded btn-sm">{{ __('investigations.select_patient') }}</a>
</td>
<td>
<a href="/investigations/print_request/{{ $incoming->id }}" class="btn btn-rounded btn-sm" style="background-color:#03C03C; color: white"><i class="fa fa-print"></i><span style="margin-left: 10px;">{{ __('investigations.print_request') }}</span></a>
</td>
@endif
</tr>
@endforeach
@if(count($incomings) <= 0)
<tr>
<td colspan="8" class='text-center' style='color: maroon; font-weight: bold;'>{{ __('investigations.no_requests_available') }}</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div id="all_complete_nav_pill" class="tab-pane">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('investigations.patient_names') }}</th>
<th>{{ __('investigations.requested') }}</th>
<th>Performed At</th>
<th>{{ __('investigations.turn_around_time') }}</th>
<th>{{ __('investigations.source') }}</th>
<th>{{ __('investigations.payment') }}</th>
<th>{{ __('investigations.request') }}</th>
<th>{{ __('investigations.done_by') }}</th>
<th class="text-center">{{ __('investigations.actions') }}</th>
</tr>
</thead>
<tbody>
@foreach($results as $result)
<tr>
<td>
{!! insurance_flag($result->patient_id) !!}
({{ $result->patient_number }}) - ({{ $patient_categories[$result->patients_category_id] ?? '' }})
</td>
<td>
{{ streamline_date_time_short($result->created_at) }}
</td>
<td>{{ $result->results_created_at ? streamline_date_time_short($result->results_created_at) : "N/A" }}</td>
<td>{{ \Carbon\Carbon::parse($result->results_created_at)->diffForHumans(\Carbon\Carbon::parse($result->created_at)) }} request</td>
<td>
@if($result->inpatient == 1 || $result->inpatient_bill_generated == 1)
{{ get_ward_name($result->patient_id, $result->episode_id) }}
@else
OPD
@endif
</td>
<td>
@if($result->payment_status == 0)
@if($result->inpatient_bill_generated == 1)
<label class="label label-success">{{ __('investigations.inpatient_bill_generated') }}</label>
@else
<label class="label label-danger">{{ __('investigations.not_paid') }}</label>
@endif
@else
<label class="label label-success">{{ __('investigations.paid') }}</label>
@endif
</td>
<td onclick="showQuickView({{ $result->id }}, 1)"><i class="fa fa-search"></i> {{ count(explode(",", $result->investigation_id)) }} {{ __('investigations.tests') }}</td>
<td>
{{ get_full_name($result->created_by, "id", "first_name", "last_name", "users") }}
</td>
@if($result->inpatient == 0 && $result->inpatient_bill_generated == 0 && $result->payment_status == 0 && !can_investigations_be_performed($result->patients_category_id))
<td class="text-center">
<code>{{ __('investigations.patient_has_not_paid_for_ordered_investigations') }}</code>
</td>
@else
<td class="text-center">
@if($imaging_type == 'Ultrasound_Obstetric')
<a class="btn btn-success btn-sm" href="/investigations/view_patient_investigation_obstetric/{{ $result->results_value }}">{{ __('investigations.view_results') }}</a>
@else
<a class="btn btn-success btn-sm" href="/investigations/view_patient_investigation/{{ $result->results_id }}">{{ __('investigations.view_results') }}</a>
@endif
</td>
@endif
</tr>
@endforeach
@if(count($results) <= 0)
<tr>
<td colspan="6" class='text-center' style='color: maroon; font-weight: bold;'>{{ __('investigations.no_requests_available') }}</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
@if (count($urgent_incomings) > 0)
<div id="urgent_incoming_imaging" class="tab-pane active">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('investigations.patient_names') }}</th>
<th>{{ __('investigations.requested') }}</th>
<th>{{ __('investigations.source') }}</th>
<th>{{ __('investigations.payment') }}</th>
<th>{{ __('investigations.request') }}</th>
<th colspan="3" class="text-center">{{ __('investigations.actions') }}</th>
</tr>
</thead>
<tbody>
@foreach($urgent_incomings as $urgent_incoming)
<tr>
<td>
{!! insurance_flag($urgent_incoming->patient_id) !!}
({{ $urgent_incoming->patient_number }}) - ({{ $patient_categories[$urgent_incoming->patients_category_id] ?? '' }})
</td>
<td>{{ streamline_date_time_short($urgent_incoming->created_at) }}</td>
<td>
@if($urgent_incoming->inpatient == 1 || $urgent_incoming->inpatient_bill_generated == 1)
{{ get_ward_name($urgent_incoming->patient_id, $urgent_incoming->episode_id) }}
@else
OPD
@endif
</td>
<td>
@if($urgent_incoming->payment_status == 0)
@if($urgent_incoming->inpatient_bill_generated == 1)
<label class="label label-success">{{ __('investigations.inpatient_bill_generated') }}</label>
@else
<label class="label label-danger">{{ __('investigations.not_paid') }}</label>
@endif
@else
<label class="label label-success">{{ __('investigations.paid') }}</label>
@endif
</td>
<td onclick="showQuickView({{ $urgent_incoming->id }}, 1)"><i class="fa fa-search"></i> {{ count(explode(",", $urgent_incoming->investigation_id)) }} {{ __('investigations.tests') }}</td>
@if($urgent_incoming->inpatient == 0 && $urgent_incoming->inpatient_bill_generated == 0 && $urgent_incoming->payment_status == 0 && !can_investigations_be_performed($urgent_incoming->patients_category_id))
<td colspan="3" class="text-center">
<code>{{ __('investigations.patient_has_not_paid_for_ordered_investigations') }}</code>
</td>
@else
<td class="text-center">
@if($imaging_type == 'Ultrasound_Obstetric')
{{ Form::open(['route' => 'investigations.ultrasound_obstetric_report']) }}
@else
{{ Form::open(['route' => 'investigations.ordered_results']) }}
@endif
{{ Form::hidden('order_id',$urgent_incoming->id) }}
{{ Form::hidden('order_type', $imaging_type) }}
{{ Form::hidden('patient_id',$urgent_incoming->patient_id) }}
{{ Form::hidden('episode_id',$urgent_incoming->episode_id) }}
<button type="submit" class="btn btn-success btn-rounded btn-sm">{{ __('investigations.add_results') }}</button>
{{ Form::close() }}
</td>
<td>
<a href="/patient_episodes/set_patient_id/{{ $urgent_incoming->patient_id }}" class="btn btn-info btn-rounded btn-sm">{{ __('investigations.select_patient') }}</a>
</td>
<td>
<a href="/investigations/print_request/{{ $urgent_incoming->id }}" class="btn btn-rounded btn-sm" style="background-color:#03C03C; color: white"><i class="fa fa-print"></i><span style="margin-left: 10px;">{{ __('investigations.print_request') }}</span></a>
</td>
@endif
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
</div>
</div>
</div>
</div>
<div class="modal" id="modal_receive_request" tabindex="-1" role="dialog" aria-labelledby="debt_plan_modal_label" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"><b id="modal_heading"></b></h4>
</div>
<div class="modal-body">
<div class="table-responsive" id="modal_table"></div>
<div id="modal_specimen_edit"></div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script>
$('#patient_number').change(function () {
let id = $('#patient_number').val();
$('#patient_id').val(id);
});
$('#patient_number').select2({
placeholder: 'Search by patient details (names and number)',
ajax: {
url: '/patients/search_patient_by_name_number',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.first_name + " " + item.last_name + " (" + item.number + ")",
id: item.id
}
})
};
},
cache: true
}
});
$('#search_date_by').change(function() {
if($(this).val() === "custom_date"){
$("#end_date_div").hide();
$("#start_date_div").show();
} else if($(this).val() === "custom_date_range") {
$("#start_date_div").show();
$("#end_date_div").show();
} else {
$("#end_date_div").hide();
$("#start_date_div").hide();
}
});
$('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
$('#start_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
function showQuickView(id, type) {
$.ajax({
method: 'POST',
url: '/investigations/view_lab_results_quick_view',
data: {'id': id, 'type': type},
success: function(response){
let responseArray = JSON.parse(response);
$("#modal_table").html(responseArray["html"]);
$("#modal_heading").html("Investigations for " + responseArray["patient_name"] + "(" + responseArray["patient_number"] + ")");
if (type == 2) {
$("#modal_specimen_edit").html('<a class="btn btn-link btn-block" href="/investigations/edit_investigation_specimen/' + id +'">Edit Specimen</a>');
} else {
$("#modal_specimen_edit").html("");
}
$('#modal_receive_request').modal('show');
}
});
}
</script>
@endpush