Files
streamline-emr/docker/streamline-src/Modules/EyeClinic/Resources/views/eye_clinic/consultation.blade.php
T

736 lines
39 KiB
PHP
Executable File

@extends('layouts.main')
@push('scripts')
<script src="{{ asset('js/triage/scripts.js') }}"></script>
<script src="{{ asset('js/common/scripts.js') }}"></script>
@endpush
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-6">
<h4 class="page-title">Add consultation</h4>
</div>
<div class="col-md-6">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li class="active">Consultation</li>
</ol>
</div>
</div>
@php
$patient_id = session('patient_id');
$episode_id = session('episode_id');
$episode_created_at = Carbon\Carbon::parse($episode->created_at);
@endphp
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
</div>
</div>
<br>
<div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-wrapper collapse in">
<ul class="nav customtab nav-tabs" role="tablist" style="background-color: beige;">
<li role="presentation" class="active nav-item"><a href="/eye_clinic/consultation" class="nav-link"><span class="visible-xs"><i class="ti-home"></i></span><span class="hidden-xs">General Consultation</span></a></li>
<li role="presentation" class="nav-item"><a href="/eye_clinic/main_exam" class="nav-link"><span class="visible-xs"><i class="ti-email"></i></span> <span class="hidden-xs">Main Exam</span></a></li>
</ul>
<div class="panel-body">
<div class="tab-content m-t-0">
<div role="tabpanel" class="tab-pane fade active in"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
<div class="panel-group" id="accordion">
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse_triage">Triage Details</a>
</h4>
</div>
<div id="collapse_triage">
<div class="panel-body table-bordered">
<div style="margin-left: 15px;">
<strong>TRIAGE GRADE : </strong>
@if($triage)
@switch($triage->severe_grade)
@case (1)
<div class="label label-success" style="background-color: green"><span style="font-weight: bolder; color: white;">GREEN</span></div>
@break
@case (2)
<div class="label label-warning" style="background-color: yellow"><span style="font-weight: bolder; color: black;">YELLOW</span></div>
@break
@case (3)
<div class="label label-danger" style="background-color: red"><span style="font-weight: bolder; color: white;">RED</span></div>
@break
@default
<code>Triage grade not determined</code>
@endswitch
@endif
</div>
<div style="margin-left: 15px;">
<strong>Symptoms : </strong>
@if($triage)
@php $symptoms_array = explode(",", $triage->symptoms); @endphp
@php $symptoms_duration_array = explode(",", $triage->symptom_duration); @endphp
<div class="table-responsive row">
<div class="col-md-12">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th><b>Symptom</b></th>
<th><b>Duration</b></th>
</tr>
</thead>
<tbody>
@php $counter = 0; @endphp
@for($i = 0; $i < count($symptoms_array); $i++)
<tr>
<td>{{ isset($symptoms[$symptoms_array[$i]]) ? $symptoms[$symptoms_array[$i]] : "" }}</td>
<td>{{ isset($symptoms_duration_array[$i]) ? $symptoms_duration_array[$i] : "" }}</td>
</tr>
@endfor
</tbody>
</table>
</div>
</div>
@else
<code>No symptoms recorded</code>
@endif
</div>
<div class="panel-wrapper collapse in">
<ul class="nav customtab nav-tabs" role="tablist">
<li role="presentation" class="active nav-item"><a href="#home1" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"><span class="visible-xs"><i class="ti-home"></i></span><span class="hidden-xs"> Observations</span></a></li>
<li role="presentation" class="nav-item"><a href="#profile1" class="nav-link" aria-controls="profile" role="tab" data-toggle="tab" aria-expanded="false"><span class="visible-xs"><i class="ti-user"></i></span> <span class="hidden-xs"><!-- Symptoms --></span></a></li>
<!-- <li role="presentation" class="nav-item"><a href="#messages1" class="nav-link" aria-controls="messages" role="tab" data-toggle="tab"><span class="visible-xs"><i class="ti-email"></i></span> <span class="hidden-xs">GRADE</span></a></li> -->
</ul>
<div class="panel-body">
<div class="tab-content m-t-0">
<div role="tabpanel" class="tab-pane fade active in" id="home1">
<div class="col-md-12">
@if($triage)
@php
$observations_array = explode(',', $triage->observations); //i.e[temp=44,height=2]
@endphp
<div class="table-responsive row">
<div class="col-md-6">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th><b>Observation</b></th>
<th><b>Value</b></th>
</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>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
<div class="col-md-6">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th><b>Observation</b></th>
<th><b>Value</b></th>
</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>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</div>
@else
<code>No observations recorded</code>
@endif
</div>
<div class="clearfix"></div>
</div>
<div role="tabpanel" class="tab-pane fade" id="profile1">
<div class="col-md-6">
<!-- had symptom -->
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
Triage done by {!! isset($triage) ? '<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>' : "" !!}
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<div class="panel-group" id="accordion">
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse_patient_documents">Patient Documents</a>
</h4>
</div>
<div id="collapse_patient_documents">
<div class="panel-body table-bordered">
<div class="row">
<div class="col-md-8">
@if(count($documents) > 0)
@foreach($documents as $document)
<li>
<a href="/patient_documents/{{ $document->id }}" target="_blank">{{ is_null($document->title) ? substr($document->description, 0, 5) : $document->title }}</a>
</li>
@endforeach
@else
No patient documents available
@endif
</div>
<div class="col-md-4">
<a href="{{ route('patient_documents.index') }}" class="label label-success" style="color: white">Add new</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{{ Form::open(['route' => 'consultation.store','data-toggle'=>'validator']) }}
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th>PRIMARY DIAGNOSIS</th>
<th>PROMPT</th>
<th>REFERENCES</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 30%;">
<div class="form-group">
{{ Form::select('primary_diagnosis', $diagnoses, '', ['id'=>'primary_diagnosis','class' => 'form-control col-sm-12 compulsory', 'required']) }}
</div>
</td>
<td style="width: 45%; color: #C85F6A;"><div class="well well-sm" id="primary_diagnosis_prompt">&nbsp;</div></td>
<td style="width: 25%"><div class="well well-sm" id="primary_diagnosis_reference">&nbsp;</div></td>
</tr>
<tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="panel-wrapper collapse in table-responsive table-condensed">
<table class="table color-table success-table table-condensed table-bordered" id="other_diagnosis_table">
<thead>
<tr>
<th class="text-center">#</th>
<th>OTHER DIAGNOSIS</th>
<th>PROMPT</th>
<th>REFERENCES</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox" name="chk" id="chk"></td>
<td style="width: 30%;">
{{ Form::select('other_diagnosis[]', $diagnoses, '', ['id'=>'other_diagnosis_id_1','class' => 'form-control col-sm-12 sec_d']) }}
</td>
<td style="width: 45%; color: #C85F6A;"><div class="well well-sm" id="secondary_diagnosis_prompt1">&nbsp;</div></td>
<td style="width: 25%"><div class="well well-sm" id="secondary_diagnosis_reference1">&nbsp;</div></td>
</tr>
<div id="wrapper"></div>
</tbody>
</table>
<a class="btn btn-success btn-xs m-t-10" id="add_row" onclick="addRow('other_diagnosis_table')" style="margin: 10px;">Add row</a>
<a class="btn btn-danger btn-xs m-t-10" id="delete_row" onclick="deleteRow('other_diagnosis_table')" style="margin-bottom: 10px;">Delete row</a>
</div>
</div>
</div>
</div>
<div class="white-box">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th colspan="2">RDT</th>
<th>RBS</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ Form::checkbox('rdt', 1, false, ['id'=>'rdt_pos']) }}
<label for="rdt_pos">POSITIVE</label>
</td>
<td>
{{ Form::checkbox('rdt', 0, false, ['id'=>'rdt_neg']) }}
<label for="rdt_neg">NEGATIVE</label>
</td>
<td>
{{ Form::text('rbs','',['class'=>'form-control']) }}
</td>
</tr>
</tbody>
</table>
</div>
<div class="white-box">
<div class="row">
<div class="col-md-6">
<h4>Ordered Investigations</h4>
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th>Investigation</th>
<th>Reference range</th>
<th>Value</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
@if(count($investigation_results) > 0)
@foreach($investigation_results as $result)
@php
$investigation_ids_array = explode(',', $result->investigation_id);
// authentication of investigations
$per_investigation_array = explode(',', $result->per_investigation);
$comments = explode(",", $result->comment);
$results_values = explode(",", $result->value);
@endphp
@for($i = 0 ; $i < count($investigation_ids_array) ; $i++)
@php
$investigation = \Streamline\Models\Investigation::find($investigation_ids_array[$i]);
@endphp
<tr>
<td style="border-left: 1px solid #dddddd;">
@if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1)
<font color="green">{{ $investigation->name }}</font>
@else
<font color="orange">{{ $investigation->name }}</font>
@endif
</td>
<td>
{{ $investigation->normal_ranges }}
</td>
<td>
{!! $per_investigation_array[$i] == 0 ? '<font color="orange">Pending</font>' : $results_values[$i] !!}
</td>
<td>
{!! $per_investigation_array[$i] == 0 ? '<font color="orange">Pending</font>' : $comments[$i] !!}
</td>
</tr>
@endfor
<tr>
<td colspan="2">Authenticated by</td><td colspan="2"><font color="blue">{{ get_name($result->authenticated_by, 'id', 'first_name', 'users')}} {{ get_name($result->authenticated_by, 'id', 'last_name', 'users')}}</font></td>
</tr>
@endforeach
@elseif(count($ordered_investigations) > 0)
@foreach($ordered_investigations as $investigation)
@php $investigation_ids_array = explode(',', $investigation->investigation_id); @endphp
@for($i = 0 ; $i < count($investigation_ids_array) ; $i++)
@php
$investigation = \Streamline\Models\Investigation::find($investigation_ids_array[$i]);
@endphp
<tr>
<td style="border-left: 1px solid #dddddd;">
@if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1)
<font color="green">{{ $investigation->name }}</font>
@else
<font color="orange">{{ $investigation->name }}</font>
@endif
</td>
<td>
{{ $investigation->normal_ranges }}
</td>
<td><font color="orange">Pending</font></td>
<td>
{{ $investigation->comments }}
</td>
</tr>
@endfor
@endforeach
@else
<tr>
<td colspan="4"><code>Investigations not ordered</code></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h4>Ordered Sundries</h4>
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th class="text-center">#</th>
<th>SUNDRY</th>
<th>QUANTITY</th>
</tr>
</thead>
<tbody>
@if(count($ordered_sundries) > 0)
@php $count = 1; @endphp
@foreach($ordered_sundries as $ordered_sundry)
<tr>
<td>{{ $count }}</td>
<td>
{{ \Streamline\Models\Sundry::find($ordered_sundry->sundries_id)->name }}
</td>
<td>
{!! $ordered_sundry->quantity !!}
</td>
</tr>
@php $count++; @endphp
@endforeach
@else
<tr>
<td colspan="7"><code>No sundry has been ordered.</code></td>
</tr>
@endif
<tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-md-8">
<h4>Treatment Given</h4>
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th class="text-center">#</th>
<th>DRUG NAME</th>
<th>DOSAGE</th>
<th>DURATION</th>
<th>QUANTITY</th>
<th>STATUS</th>
<th>INSTRUCTION</th>
</tr>
</thead>
<tbody>
@if(!is_null($treatment))
@if($treatment->altered == 0) <!-- if the pharmacist does not edit the prescription -->
<tr>
@php
$drugs_array = explode(",", $treatment->drugs);
$dosage_array = explode(",", $treatment->doses);
$dosage2_array = explode(",", $treatment->dose2);
$frequencies_array = explode(",", $treatment->frequencies);
$duration_array = explode(",", $treatment->durations);
$quantity_dispensed_array = explode(",", $treatment->quantities_dispensed);
$instructions_array = explode(",", $treatment->instruction);
for ($x = 0; $x < count($drugs_array); $x++) {
$frequency_name = get_name($frequencies_array[$x], 'id', 'name', 'dosage_frequencies');
$unit = get_name($drugs_array[$x], 'id', 'name', 'drug_units');
$unit = $unit=="N/A"?"":$unit;
$drug_unit = "<small>" . $unit . "</small>";
$dose2 = (empty($dosage2_array[$x])) ? "" : " | " . $dosage2_array[$x] . $drug_unit;
$row_num = $x+1;
echo "<tr class='gradeX'>"
."<td>" .$row_num."."."</td>"
. "<td>" . get_name($drugs_array[$x], 'id', "name", 'drugs') . "</td>"
. "<td>" . $dosage_array[$x] . $drug_unit . $dose2 . " &nbsp;" . $frequency_name . "</td>"
. "<td>" . $duration_array[$x] . "</td>"
. "<td>" . $quantity_dispensed_array[$x] . "</td>";
if ($treatment->dispensed == 1):
echo "<td style='color: green'>Dispensed</td>";
else:
echo "<td style='color: orange'>Pending</td>";
endif;
if(isset($instructions_array[$x])){
echo "<td>" . trim($instructions_array[$x]). "</td>";
} else {
echo "<td></td>";
}
echo "</tr>";
}
@endphp
</tr>
@endif
@else
<tr>
<td colspan="7"><code>No prescription made yet</code></td>
</tr>
@endif
<tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-4">
<h4>Ordered Procedures</h4>
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th class="text-center">#</th>
<th>PROCEDURE</th>
<th>STATUS</th>
<th>PERFORMED</th>
</tr>
</thead>
<tbody>
@if(count($ordered_procedures) > 0)
@php $count = 1; @endphp
@foreach($ordered_procedures as $ordered_procedure)
<tr>
<td>{{ $count }}</td>
<td>
{{ \Streamline\Models\Procedure::find($ordered_procedure->procedure_id)->name }}
</td>
<td>
{!! $ordered_procedure->performed == 1 ? '<font style="color:Green">Performed</font>' : '<font style="color:Orange">Pending</font>' !!}
</td>
<td class="text-center">
<input type="checkbox" name="perform[]" id="perform[]" value="{{ $ordered_procedure->procedure_id }}">
</td>
</tr>
@php $count++; @endphp
@endforeach
@else
<tr>
<td colspan="7"><code>No procedure has been ordered.</code></td>
</tr>
@endif
<tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-md-3">
<div class="row">
<div class="col-md-6">
{{ Form::button('Investigation',['type'=>'submit','class'=>'btn btn-info btn-block','name'=>'submit-btn','value'=>'investigation']) }}
</div>
<div class="col-md-6">
{{ Form::button('Treatment',['type'=>'submit','class'=>'btn btn-default btn-block','name'=>'submit-btn','value'=>'treatment']) }}
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
{{ Form::button('Procedures',['type'=>'submit','class'=>'btn btn-inverse btn-block','name'=>'submit-btn','value'=>'procedures']) }}
</div>
<div class="col-md-6">
{{ Form::button('Sundries',['type'=>'submit','class'=>'btn btn-primary btn-block','name'=>'submit-btn','value'=>'sundries']) }}
</div>
</div>
</div>
<div class="col-md-3">
<h4>Comments</h4>
<textarea class="form-control" name="comments" rows="5" placeholder=""></textarea>
</div>
<div class="col-md-3">
<h4>Outcome</h4>
<div class="form-group">
<div class="input-group">
{{ Form::select('outcome', $outcomes, '7', ['id' => 'outcome', 'class' => 'form-control compulsory']) }} <!-- default to 7 for onging -->
</div>
</div>
<div id="admitted_div" style="display: none;">
<div class="form-group">
{{ Form::label('ward_id','Select the ward') }}
<div class="input-group">
{{ Form::select('ward_id', $wards, '', ['class' => 'form-control compulsory']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('admitted_on','Admitted on') }}
<div class="input-group">
{{ Form::text('admitted_on',date('d/m/Y'),['class' => 'form-control datepicker-autoclose compulsory', 'readonly', 'id'=>'admitted_on']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div id="home_with_followup_div" style="display: none;">
<div class="form-group">
<div class="input-group">
{{ Form::text('followup_where','',['class' => 'form-control compulsory', 'placeholder'=>'Where?']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('followup_when','When') }}
<div class="input-group">
{{ Form::text('followup_when','',['class' => 'form-control compulsory datepicker-autoclose','readonly']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div id="referred_div" style="display: none;">
<div class="form-group">
{{ Form::label('referral_id','Referred to?') }}
<div class="input-group">
{{ Form::select('referral_id', $referrals, '', ['class' => 'form-control compulsory']) }}
</div>
</div>
</div>
</div>
<div class="col-md-3">
{{ Form::button('Complete consultation',['type'=>'submit','class'=>'btn btn-success btn-block','name'=>'submit-btn','value'=>'complete', 'onclick'=>'return confirm_outcome()']) }}
</div>
</div>
</div>
{{ Form::close() }}
@include('consultations.document.add')
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('js/consultation/create.js') }}"></script>
<!-- pull in select2 for auto searchable drop downs -->
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
function confirm_outcome(){
let outcome = $('#outcome').val();
if(outcome === ""){
alert("Please select an outcome before completing consultation");
return false;
} else {
// check if outcome is admitted and no ward is selected
let ward_id = $('#ward_id').val();
if (outcome == 1 && ward_id == ''){
alert("Please select a ward where the patient is going to be admitted");
return false;
} else {
return true;
}
}
}
$(document).ready(function(){
$('#add_document').click(function () {
$('#document_modal').modal('show');
});
$('#add_document_form').submit(function () {
var formData = new FormData($(this)[0]);
$.ajax({
url: '/patient_documents/modal_store',
type: 'POST',
data: formData,
success: function (data) {
alert(data)
},
error: function(error){
alert(error)
},
cache: false,
processData: false
});
});
$('#primary_diagnosis').select2({
placeholder: "-- select --"
});
$('.select2-selection.select2-selection--single').css('height','calc(3.85rem)');
$('.select2-selection.select2-selection--single').css('padding-top','5px');
$('.select2-selection.select2-selection--single').css('border-left', '3px solid #F08080');/*add compulsory class*/
$('.select2-selection.select2-selection--single.sec_d').css('border-left', '3px solid #aaa');
$('.select2-selection__arrow').css('top','3px');
/* rdt checkboxes to behave like radios */
$('#rdt_pos').click(function () {
$('#rdt_neg').not('#rdt_pos').removeAttr('checked');
});
$('#rdt_neg').click(function () {
$('#rdt_pos').not('#rdt_neg').removeAttr('checked');
});
$( "#admitted_on" ).datepicker( "setDate", new Date());
})
</script>
<script>
$('#documentdate').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
});
</script>
@endpush