Files
streamline-emr/docker/streamline-src/Modules/Investigations/Resources/views/investigations/incoming_labs.blade.php
T

492 lines
29 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">{{ __('investigations.incoming_lab_investigations') }}</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(['method'=>'post','route' => 'investigations.incoming_labs']) }}
{{ 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">
@include('flash::message')
@if($search_text != "")
<h4>
<label class="label label-info">{{ $search_text }}</label>
@if (count($urgent_incomings) > 0)
&nbsp;&nbsp;<label class="label label-danger">{{ __('investigations.urgent_incoming_lab_investigations_warning') }}</label>
@endif
</h4>
<br>
@endif
<div class="row">
<div class="col-md-12">
<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="#results_nav_pill" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('investigations.incoming_lab_investigations') }} ({{ count($incomings) }})</a> </li>
<li role="presentation" class="nav-item active"> <a href="#urgent_incoming" class="nav-link text-danger" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('investigations.urgent_incoming_lab_investigations') }} ({{ count($urgent_incomings) }})</a> </li>
@else
<li role="presentation" class="nav-item active"> <a href="#results_nav_pill" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('investigations.incoming_lab_investigations') }} ({{ count($incomings) }})</a> </li>
@endif
</ul>
</div>
<div class="card-block">
<div class="tab-content">
<div id="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 table-bordered">
<thead>
<tr>
<th>{{ __('investigations.time') }}</th>
<th>{{ __('investigations.patient_names') }}</th>
<th>{{ __('investigations.patient_category') }}</th>
<th>{{ __('investigations.source') }}</th>
<th class="text-center">{{ __('investigations.payment') }}</th>
<th class="text-center">{{ __('investigations.actions') }}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($incomings as $incoming)
<tr>
<td>
{{ streamline_date_time_short($incoming->created_at) }}
</td>
<td>{!! insurance_flag($incoming->patient_id) !!} ({{ get_name($incoming->patient_id, 'id', 'number', 'patients') }})</td>
<td>{{ patient_category($incoming->patient_id) }}</td>
<td>
@if($incoming->inpatient == 1 || $incoming->inpatient_bill_generated == 1)
{{ get_ward_name($incoming->patient_id, $incoming->episode_id) }}
@else
<span style='font-size: x-small'>OPD</span>
@endif
</td>
<td>
@if($incoming->payment_status == 0)
@if($incoming->inpatient_bill_generated == 1)
<font color='green'>{{ __('investigations.inpatient_bill_generated') }}</font>
@else
<font color='red'>{{ __('investigations.not_paid') }}</font>
@endif
@else
<font color='green'>{{ __('investigations.paid') }}</font>
@endif
</td>
@if($incoming->inpatient == 0 && $incoming->inpatient_bill_generated == 0 && $incoming->payment_status == 0 && !can_investigations_be_performed(get_name($incoming->patient_id, 'id', 'category_id', 'patients')))
<td colspan="3" class="text-center">
<code>{{ __('investigations.patient_has_not_paid_for_ordered_investigations') }}</code>
</td>
@else
<td class="text-center">
<a href="#" class="btn btn-success btn-rounded btn-sm" onclick="receive_request({{ $incoming->id }})" disabled>{{ __('investigations.receive_request') }}</a>
</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>
@if (count($urgent_incomings)>0)
<div id="urgent_incoming" class="tab-pane active">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
<thead>
<tr>
<th>{{ __('investigations.time') }}</th>
<th>{{ __('investigations.patient_names') }}</th>
<th>{{ __('investigations.patient_category') }}</th>
<th>{{ __('investigations.source') }}</th>
<th class="text-center">{{ __('investigations.payment') }}</th>
<th class="text-center">{{ __('investigations.actions') }}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($urgent_incomings as $urgent_incoming)
<tr>
<td>
{{ streamline_date_time_short($urgent_incoming->created_at) }}
</td>
<td>{!! insurance_flag($urgent_incoming->patient_id) !!} ({{ get_name($urgent_incoming->patient_id, 'id', 'number', 'patients') }})</td>
<td>{{ patient_category($urgent_incoming->patient_id) }}</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
<span style='font-size: x-small'>OPD</span>
@endif
</td>
<td>
@if($urgent_incoming->payment_status == 0)
@if($urgent_incoming->inpatient_bill_generated == 1)
<font color='green'>{{ __('investigations.inpatient_bill_generated') }}</font>
@else
<font color='red'>{{ __('investigations.not_paid') }}</font>
@endif
@else
<font color='green'>{{ __('investigations.paid') }}</font>
@endif
</td>
@if($urgent_incoming->inpatient == 0 && $urgent_incoming->inpatient_bill_generated == 0 && $urgent_incoming->payment_status == 0 && !can_investigations_be_performed(get_name($urgent_incoming->patient_id, 'id', 'category_id', 'patients')))
<td colspan="3" class="text-center">
<code>{{ __('investigations.patient_has_not_paid_for_ordered_investigations') }}</code>
</td>
@else
<td class="text-center">
<a href="#" class="btn btn-success btn-rounded btn-sm" onclick="receive_request({{ $urgent_incoming->id }})" disabled>{{ __('investigations.receive_request') }}</a>
</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>
</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="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('modal_patient_number', __('investigations.patient_number')) }}
{{ Form::text('modal_patient_number', '', ['class'=>'form-control', 'readonly', 'id' => 'modal_patient_number']) }}
</div>
<div class="form-group">
{{ Form::label('modal_hospital_unit', __('investigations.hospital_unit')) }}
{{ Form::text('modal_hospital_unit', '', ['class'=>'form-control', 'readonly', 'id' => 'modal_hospital_unit']) }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('modal_patient_age', __('investigations.patient_age')) }}
{{ Form::text('modal_patient_age', '', ['class'=>'form-control', 'readonly', 'id' => 'modal_patient_age']) }}
</div>
<div class="form-group">
{{ Form::label('modal_patient_telephone', __('investigations.patient_telephone')) }}
{{ Form::text('modal_patient_telephone', '', ['class'=>'form-control', 'readonly', 'id' => 'modal_patient_telephone']) }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('modal_received_date', __('investigations.date_received')) }}
{{ Form::text('modal_received_date', date('d/m/Y'), ['class'=>'form-control', 'readonly', 'id'=>'modal_received_date']) }}
</div>
<div class="form-group">
{{ Form::label('modal_lab_number', __('investigations.lab_number')) }}
@if(is_lab_number_editing_enabled())
{{ Form::text('modal_lab_number', '', ['class'=>'form-control', 'id' => 'modal_lab_number']) }}
@else
{{ Form::text('modal_lab_number', '', ['class'=>'form-control', 'id' => 'modal_lab_number', 'readonly']) }}
@endif
{{ Form::hidden('modal_order_id','', ['id' => 'modal_order_id']) }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('modal_patient_gender', __('investigations.patient_gender')) }}
{{ Form::text('modal_patient_gender', '', ['class'=>'form-control', 'readonly', 'id'=>'modal_patient_gender']) }}
</div>
<div class="form-group">
{{ Form::label('modal_requested_by', __('investigations.requested_by')) }}
{{ Form::text('modal_requested_by', '', ['class'=>'form-control', 'readonly', 'id'=>'modal_requested_by']) }}
</div>
</div>
</div>
<br>
<h5 class="text-center">{{ __('investigations.tests_to_take') }}</h5>
<div class="table-responsive" id="modal_tests_table"></div>
<hr>
<div class="row">
<div class="col-md-5">
<div class="form-group" id="modal_specimen_div">
{{ Form::label('modal_specimen', __('investigations.specimen')) }}
{{ Form::select('modal_specimen[]', $specimen, null, ['class' => 'form-control modal_specimen compulsory', 'id' => 'modal_specimen']) }}
</div>
</div>
<div class="col-md-5">
<div class="form-group" id="modal_status_div">
{{ Form::label('modal_status', __('investigations.status')) }}
{{ Form::select('modal_status[]', [0 => __('investigations.select'), 1 => __('investigations.taken'), 2 => __('investigations.not_taken'), 3 => __('investigations.rejected')], null, ['class' => 'form-control modal_status compulsory', 'id' => 'modal_status']) }}
</div>
</div>
<div class="col-md-2">
<br>
<button class="btn btn-info btn-rounded" style="color: white" id="modal_add_specimen_button"><i class="fa fa-plus"></i><span style="margin-left: 10px;"> {{ __('investigations.specimen') }}</span></button>
</div>
</div>
<div class="row">
<div class="col-md-10">
{{ Form::label('modal_reason', __('investigations.reason') . "/" . __('investigations.comment')) }}
{{ Form::textarea('modal_reason[]', '', ['class' => 'form-control modal_reason', 'rows' => 2]) }}
</div>
<div class="col-md-2"></div>
</div>
<hr>
<div id="modal_more_specimen_section"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success btn-rounded waves-effect text-left" onclick="save_receive_request()">{{ __('investigations.save') }}</button>
</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 receive_request(orderId) {
$.ajax({
method: 'POST',
url: '/investigations/get_receive_request_details',
data: {'id': orderId},
success: function(response){
let response_array = JSON.parse(response);
$("#modal_tests_table").html(response_array["html"]);
$("#modal_patient_number").val(response_array["patient_number"]);
$("#modal_heading").html("<?php echo __('investigations.receiving_lab_request_for') ?> " + response_array["patient_name"]);
$("#modal_hospital_unit").val(response_array["source"]);
$("#modal_lab_number").val(response_array["lab_number"]);
$("#modal_order_id").val(response_array["order_id"]);
$("#modal_patient_age").val(response_array["patient_age"]);
$("#modal_patient_telephone").val(response_array["telephone_number"]);
$("#modal_requested_by").val(response_array["requested_by"]);
$("#modal_patient_gender").val(response_array["patient_gender"]);
$('#modal_receive_request').modal('show');
}
});
}
$('#modal_add_specimen_button').click( function () {
let html_code = "<div class='row'>" +
"<div class='col-md-5'>" + $('#modal_specimen_div').html() + "</div>" +
"<div class='col-md-5'>" + $('#modal_status_div').html() + "</div>" +
"</div> <br> <div class='row'>" +
"<div class='col-md-10'><label for='modal_reason'>Reason/Comment</label>" +
"<textarea class='form-control modal_reason' rows='2' name='modal_reason[]'></textarea>" +
"</div><div class='col-md-2'></div>" +
"</div> <hr>";
$('#modal_more_specimen_section').append(html_code);
});
function save_receive_request() {
let selectedDate = $('#modal_received_date').val();
let orderID = $('#modal_order_id').val();
let labNumber = $('#modal_lab_number').val();
let specimenArray = [];
let statusArray = [];
let reasonArray = [];
// get the selected specimen
$('.modal_specimen').each(function () {
specimenArray.push(this.value);
});
if (specimenArray.length == 1 && specimenArray[0] == 0){
alert("<?php echo __('investigations.please_select_specimen') ?>");
return;
}
// get the selected status
$('.modal_status').each(function () {
statusArray.push(this.value);
});
// get the added reason
$('.modal_reason').each(function () {
reasonArray.push(this.value.replaceAll(',', ';'));
});
$.ajax({
method: 'POST',
url: '/investigations/save_receive_request_details',
data: {
'id': orderID,
'lab_number': labNumber,
'date': selectedDate,
'specimen': specimenArray,
'status': statusArray,
'reason': reasonArray
},
success: function(response){
if (response == 1) {
alert("Request has been received successfully");
location.reload();
//window.open('/investigations/print_request_barcode/' + orderID, '_blank');
} else {
// alert("Unable to receive the request. Please try again");
alert(response);
}
}
});
}
$('#modal_received_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy'
});
</script>
@endpush