Files
streamline-emr/docker/streamline-src/Modules/Patients/Resources/views/consultations/edit.blade.php
T
alec.turner 4a89356390 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.
2024-04-11 11:16:51 -07:00

2351 lines
147 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" />
<style>
.btn-default-bluish {
background: #b6cce2;
border: 1px solid #e4e7ea;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('consultations.edit_consultation') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('home.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('consultations.patient') }}</a></li>
<li class="active">{{ __('consultations.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);
$episode_has_grand_parent_episode = false;
@endphp
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
</div>
</div>
<br>
@if(check_if_episode_is_a_followup($episode->id))
@php
$parent_episode_details = \Streamline\Models\PatientEpisode::find($episode->parent_episode_id);
$parent_consultations = \Streamline\Models\Consultation::where(['episode_id' => $parent_episode_details->id])->get();
$parent_consultation_details = count($parent_consultations) > 0 ? $parent_consultations->first() : null;
$parent_triage_details = \Streamline\Models\Triage::where(['id' => $parent_episode_details->triage_id])->first();
if(check_if_episode_is_a_followup($parent_episode_details->id)){
$episode_has_grand_parent_episode = true;
$grand_parent_episode_details = \Streamline\Models\PatientEpisode::find($parent_episode_details->parent_episode_id);
$grand_parent_episode_treatments = \Streamline\Models\Treatment::where(['patient_id' => $patient_id, 'episode_id' => $grand_parent_episode_details->id, 'tta' => 0])->get();
$grand_parent_episode_ordered_procedures = \Streamline\Models\OrderedProcedure::where(['patient_id' => $patient_id, 'episode_id' => $grand_parent_episode_details->id])->get();
$grand_parent_episode_ordered_investigations = \Streamline\Models\OrderedInvestigation::where(['patient_id' => $patient_id, 'episode_id' => $grand_parent_episode_details->id])->get();
$grand_parent_episode_ordered_sundries = \Streamline\Models\OrderedSundry::where(['patient_id' => $patient_id, 'episode_id' => $grand_parent_episode_details->id])->get();
$grand_parent_episode_investigation_results = \Streamline\Models\InvestigationResults::where(['patient_id' => $patient_id, 'episode_id' => $grand_parent_episode_details->id])->get();
}
@endphp
@endif
{{ Form::model($consultation, ['route' => ['consultation.update',$consultation->id],'method'=>'PUT', 'id'=>'consultation_edit_form']) }}
@if(count($past_episodes_info) > 0)
<div class="white-box">
<h3>Previous Consultations (Upto latest 5 consultations with a diagnosis)</h3>
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Date</th>
<th>Clinic</th>
<th>Primary Diagnosis</th>
<th>Other Diagnoses</th>
<th>Consultation By</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($past_episodes_info as $past_episode)
<tr>
<td>
{{ $past_episode['start_date'] }}
<br>
@if(check_if_episode_is_a_followup($past_episode["episode_id"]))
<small style="color: green"><br>({{ __('patient_episode.review_from') }} {{ streamline_date(get_name(get_name($past_episode["episode_id"], 'id', 'parent_episode_id', 'patient_episodes'), 'id', 'created_at', 'patient_episodes')) }})</small>
@endif
</td>
<td>{{ $past_episode['clinic'] }}</td>
<td>{{ get_name($past_episode['primary_diagnosis'], 'id', 'name', 'diagnoses') }}</td>
<td>
@if(count($past_episode['other_diagnoses']) > 0 && !(count($past_episode["other_diagnoses"]) == 1 && $past_episode["other_diagnoses"][0] == null))
<ul>
@foreach($past_episode['other_diagnoses'] as $value)
<li>{{ get_name($value, 'id', 'name', 'diagnoses') }}</li>
@endforeach
</ul>
@endif
</td>
<td>{{ $past_episode['doctor'] }}</td>
<td><a class="btn btn-rounded btn-default-bluish" onclick="past_episode_row_details({{ $past_episode["episode_id"] }})">Details</a></td>
</tr>
<tr class="past_episode_row" id="past_episode_row{{ $past_episode["episode_id"] }}" style="display: none">
<td colspan="6">
<div class="row">
<div class="col-md-5">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<td><b>Temperature: </b></td>
<td>{{ $past_episode["temp"] }}</td>
<td><b>Blood Pressure: </b></td>
<td>{{ $past_episode["mmhg"] }}</td>
</tr>
<tr>
<td><b>Pulse: </b></td>
<td>{{ $past_episode["pulse"] }}</td>
<td><b>Respiration: </b></td>
<td>{{ $past_episode["resp"] }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-2">
@if($past_episode["outcome"] != 0)
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<td><b>Outcome: </b></td>
<td>{{ get_name($past_episode["outcome"], 'id', 'name', 'outcomes') }}</td>
</tr>
</tbody>
</table>
</div>
<hr>
@endif
</div>
<div class="col-md-5">
@if(count($past_episode["symptoms"]) > 0)
@php $symptoms_array = explode(",", $past_episode["symptoms"]["symptoms"]); @endphp
@php $symptoms_duration_array = explode(",", $past_episode["symptoms"]["symptom_duration"]); @endphp
<h4><b>Symptoms</b></h4>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th><b>{{ __('consultations.symptom') }}</b></th>
<th><b>{{ __('consultations.duration') }}</b></th>
</tr>
</thead>
<tbody>
@for($i = 0; $i < count($symptoms_array); $i++)
<tr>
<td>{{ $symptoms[$symptoms_array[$i]] ?? "" }}</td>
<td>{{ $symptoms_duration_array[$i] ?? "" }}</td>
</tr>
@endfor
</tbody>
</table>
</div>
<hr>
@endif
</div>
</div>
@if($past_episode["primary_diagnosis"] != 0)
<a href="/consultation/review_episode/{{ $episode->id }}/{{ $past_episode["episode_id"] }}/{{ ($consultation_with_notes) ? 1 : 0 }}" class="btn btn-rounded btn-primary text-white" onclick="return confirm('Are you sure you want to make the current episode a review of the selected episode? This action is not reversible')">Review Episode</a>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
<div class="row">
<div class="col-md-6">
<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">{{ __('consultations.triage_details') }}</a>
</h4>
</div>
<div id="collapse_triage">
<div class="panel-body table-bordered">
<div style="margin-left: 15px;">
<strong>{{ __('consultations.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;">{{ __('consultations.green') }}</span></div>
@break
@case (2)
<div class="label label-warning" style="background-color: yellow"><span style="font-weight: bolder; color: black;">{{ __('consultations.yellow') }}</span></div>
@break
@case (3)
<div class="label label-danger" style="background-color: red"><span style="font-weight: bolder; color: white;">{{ __('consultations.red') }}</span></div>
@break
@default
<code>{{ __('consultations.triage_grade_not_determined') }}</code>
@endswitch
@endif
</div>
<div style="margin-left: 15px;">
<strong>{{ __('consultations.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>{{ __('consultations.symptom') }}</b></th>
<th><b>{{ __('consultations.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>{{ __('consultations.no_symptom_recorded') }}</code>
@endif
</div>
<hr>
@if($triage)
@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="table-responsive row">
<div class="col-md-6">
<table class="table color-bordered-table success-bordered-table">
<thead>
<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++;
$parent_observation_array = isset($parent_triage_details) ? explode(',', $parent_triage_details->observations): [];
@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
</tbody>
</table>
</div>
<div class="col-md-6">
<table class="table color-bordered-table success-bordered-table">
<thead>
<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>
<strong>{{ __('consultations.comment') }}:</strong> {{ !is_null($triage) ? $triage->comments : "" }}<hr>
@else
<code>{{ __('consultations.no_observations_recorded') }}</code>
@endif
{{ __('consultations.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-md-6">
<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">{{ __('consultations.patient_documents') }}</a>
</h4>
</div>
<div id="collapse_patient_documents">
<div class="panel-body table-bordered">
@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 }} ({{ streamline_date_time($document->created_at) }})</a>
</li>
@endforeach
@else
{{ __('consultations.no_patient_documents_available') }}
@endif
<br>
<a href="{{ route('patient_documents.index') }}" class="label label-success" style="color: white">{{ __('consultations.add_new') }}</a>
</div>
</div>
</div>
</div>
<!-- used services -->
<div class="panel-group" id="accordion-services">
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse_used_services">{{ __('consultations.used_services') }}</a>
</h4>
</div>
<div id="collapse_used_services">
<div class="panel-body table-bordered">
@php
$used_services = \Streamline\Models\OrderedService::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get();
$services_counter = 1;
$service_performed_counter = 0;
@endphp
@if(count($used_services) > 0)
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th>{{ __('consultations.service') }}</th>
<th>{{ __('consultations.quantity') }}</th>
<th>{{ __('consultations.payment_status') }}</th>
<th>Performed By</th>
</tr>
</thead>
<tbody>
@foreach($used_services as $service)
@php
$service_ids = explode(",", $service->service_id);
$service_quantity = explode(",", $service->quantity);
$service_performed = explode(",", $service->performed);
@endphp
@for($i = 0; $i < count($service_ids); $i++)
<tr>
<td>
{{ get_name($service_ids[$i], "id", "name", "services")}}
</td>
<td>
{{ $service_quantity[$i] }}
</td>
<td>
{!! $service->payment_status == 0 ? "<span style='color: red'>Not Paid</span>" : "<span style='color: green'>Paid</span>" !!}
</td>
<td class="text-center">
@if($service_performed[$i] == 0)
<input type="checkbox" name="service_perform_selected[]" id="service_performed_{{ $service_ids[$i] }}" value="{{ $service_performed_counter }}" class="service_performed">
{{ Form::hidden('service_perform[]', $service_ids[$i]) }}
{{ Form::hidden('service_order_id[]', $service_ids[$i]) }}
{{ Form::hidden('service_order_perform[]', $service->id) }}
{{ Form::hidden('service_performed_position[]', $i) }}
<div id="service_performed_by_div_{{ $service_ids[$i] }}" style="display: none; width: 100%">
{{ Form::label('perfomed_by', 'Perfomed By:') }}
{{ Form::select('service_performed_by[]', $users_array, '', ['class' => 'form-control service_performed_by', 'id' => 'service_performed_by_'.$service_ids[$i]]) }}
</div>
@php $service_performed_counter++ @endphp
@endif
</td>
</tr>
@endfor
@endforeach
</tbody>
</table>
</div>
@else
{{ __('consultations.no_used_services') }}
@endif
</div>
</div>
</div>
</div>
<!-- end of used services -->
{{-- Display TB screening takend from triage --}}
@if (is_tuberculosis_screening_enabled())
<div class="panel-group" id="accordionTuberculosis">
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse_tb">TB Screening</a>
</h4>
</div>
<div id="collapse_tb">
<div class="panel-body table-bordered">
@if($triage)
@if ($triage->any_tb_sysmptoms == 1)
<table class="tb_questions_table 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>
@endif
@endif
</div>
</div>
</div>
</div>
@endif
{{-- end of tb details --}}
</div>
</div>
@if($is_mental_health_clinic && isset($mental_health_consultation->id))
{{ Form::hidden('mental_health_id', $mental_health_consultation->id) }}
<div class="white-box">
<div class="row">
<div class="col-md-4">
<table class="table table-striped table-bordered">
<tr>
<th>{{ __('consultations.psychosis_symptom_scores') }}</th>
<td></td>
</tr>
<tr>
<th>{{ __('consultations.hallucinations') }}</th>
<td>{{ Form::number('hallucinations', $mental_health_consultation->hallucinations, ['class' => 'form-control']) }}</td>
</tr>
<tr>
<th>{{ __('consultations.delusions') }}</th>
<td>{{ Form::number('delusions', $mental_health_consultation->delusions, ['class' => 'form-control']) }}</td>
</tr>
<tr>
<th>{{ __('consultations.disorganised_speech') }}</th>
<td>{{ Form::number('disorganised_speech', $mental_health_consultation->disorganised_speech, ['class' => 'form-control']) }}</td>
</tr>
<tr>
<th>{{ __('consultations.abnormal_phychomotor_behaviour') }}</th>
<td>{{ Form::number('abnormal_psychomotor_behaviour', $mental_health_consultation->abnormal_psychomotor_behaviour, ['class' => 'form-control']) }}</td>
</tr>
</table>
</div>
<div class="col-md-4">
<table class="table table-striped table-bordered">
<tr>
<th>{{ __('consultations.negative_symptoms') }}</th>
<td></td>
</tr>
<tr>
<th>{{ __('consultations.impaired_cognition') }}</th>
<td>{{ Form::number('impaired_cognition', $mental_health_consultation->impaired_cognition, ['class' => 'form-control']) }}</td>
</tr>
<tr>
<th>{{ __('consultations.depression') }}</th>
<td>{{ Form::number('depression', $mental_health_consultation->depression, ['class' => 'form-control']) }}</td>
</tr>
<tr>
<th>{{ __('consultations.mania') }}</th>
<td>{{ Form::number('mania', $mental_health_consultation->mania, ['class' => 'form-control']) }}</td>
</tr>
<tr>
<th>{{ __('consultations.hamilton_anxiety_score') }}</th>
<td>{{ Form::number('hamilton_anxiety_score', $mental_health_consultation->hamilton_anxiety_score, ['class' => 'form-control']) }}</td>
</tr>
</table>
</div>
<div class="col-md-4">
<div class="table-bordered" style="padding: 10px">
<h4>{{ __('consultations.hamilton_anxiety_score') }}</h4>
<p>0-17 = no / mild anxiety</p>
<p>18-24 = mild to moderate anxiety</p>
<p>25-30 = moderate to severe anxiety</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<table class="table table-striped table-bordered">
<tr>
<th>{{ __('consultations.alcohol_score') }}</th>
<td></td>
</tr>
<tr>
<th>{{ __('consultations.total_score') }}</th>
<td>{{ Form::number('alcohol_screening_score', $mental_health_consultation->alcohol_screening_score, ['class' => 'form-control']) }}</td>
</tr>
</table>
</div>
<div class="col-md-4">
<table class="table table-striped table-bordered">
<tr>
<th>{{ __('consultations.satisfaction_score') }}</th>
<td></td>
</tr>
<tr>
<th>{{ __('consultations.patient') }}</th>
<td>{{ Form::number('patient_satisfaction_score', $mental_health_consultation->patient_satisfaction_score, ['class' => 'form-control']) }}</td>
</tr>
<tr>
<th>{{ __('consultations.care_giver') }}</th>
<td>{{ Form::number('caregiver_satisfaction_score', $mental_health_consultation->caregiver_satisfaction_score, ['class' => 'form-control']) }}</td>
</tr>
</table>
</div>
<div class="col-md-4">
<div class="table-bordered" style="padding: 10px">
<h4>{{ __('consultations.alcohol_screening_score') }}</h4>
<p>1-7 = {{ __('consultations.low_risk') }}</p>
<p>8-19 = {{ __('consultations.harmful_drinking') }}</p>
<p>20 or above = {{ __('consultations.likely_dependency') }}</p>
</div>
</div>
</div>
</div>
@endif
@if($consultation_with_notes)
<div class="white-box">
@if(check_if_episode_is_a_followup($episode->id) && !is_null($parent_consultation_details))
@php
$parent_consultation_history = $parent_consultation_details->history_comments;
$parent_consultation_clinical_examination = $parent_consultation_details->clinic_examination_comments;
$parent_consultation_inv_and_mgt = $parent_consultation_details->investigation_and_management_plan_comments;
@endphp
<font color="green"><b>History {{ __('consultations.for_episode_of') }} {{ streamline_date($parent_consultation_details->created_at) }}</b></font>
<textarea class="form-control" name="parent_history_comments" readonly>{{ $parent_consultation_history }}</textarea>
<div class="row">
<div class="col-md-6">
<font color="green"><b>{{ __('consultations.clinical_examination') }} {{ __('consultations.for_episode_of') }} {{ streamline_date($parent_consultation_details->created_at) }}</b></font>
<textarea class="form-control" name="parent_clinic_examination_comments" readonly>{{ $parent_consultation_clinical_examination }}</textarea>
</div>
<div class="col-md-6">
<font color="green"><b>{{ __('consultations.investigation_and_mgt_plan') }} {{ __('consultations.for_episode_of') }} {{ streamline_date($parent_consultation_details->created_at) }}</b></font>
<textarea class="form-control" name="parent_investigation_and_management_plan_comments" readonly>{{ $parent_consultation_inv_and_mgt }}</textarea>
</div>
</div>
@endif
<h4>{{ __('consultations.history') }}</h4>
<textarea class="form-control" name="history_comments" rows="5" placeholder="Notes Here...">{{ $consultation->history_comments }}</textarea>
<div class="row">
<div class="col-md-6">
<h4>{{ __('consultations.clinical_examination') }}</h4>
<textarea class="form-control" name="clinic_examination_comments" rows="5" placeholder="Notes Here...">{{ $consultation->clinic_examination_comments }}</textarea>
</div>
<div class="col-md-6">
<h4>{{ __('consultations.investigation_and_mgt_plan') }}</h4>
<textarea class="form-control" name="investigation_and_management_plan_comments" rows="5" placeholder="Notes Here...">{{ $consultation->investigation_and_management_plan_comments }}</textarea>
</div>
</div>
</div>
@endif
@if (is_tuberculosis_screening_enabled())
@include('patients::consultations.tb_screening')
@endif
@php $option_symptoms = ""; $option_symptoms_periods = ""; $symptom_counter = 1; @endphp
@if(are_symptoms_on_consultation())
<div class="white-box">
<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(",", $consultation->symptoms);
$symptoms_duration_array = explode(",", $consultation->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) || $consultation->symptoms == '')
<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%;">
{{ Form::select('symptoms[]', $symptoms, $symptoms_array[$i], ['id' => 'symptoms_' . $symptom_counter, 'class' => 'form-control col-sm-12 compulsory initial_symptoms_select', 'onchange' => 'showPrompt(this.value, ' . $symptom_counter . ')']) }}
</td>
<td style="width: 21%">
<div class="row">
<div class="col-sm-3">
<input type="text" style="display: block;" name="duration[]" id="duration[]" class="col-sm-12 form-control" value="{{ $duration_array[0] }}">
</div>
<div class="col-sm-9">
<select style="display: inline-block;" name="time[]" id="time[]" class="col-sm-12 form-control">
<option value="{{ $duration_array[1] ?? 1 }}" selected>{{ $duration_array[1] ?? 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_{{ $symptom_counter }}" style="width: 30%"></td>
<td id="symptoms_reference_{{ $symptom_counter }}"></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>
</div>
@endif
<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>{{ __('consultations.PRIMARY_DIAGNOSIS') }}</th>
<th>{{ __('consultations.PROMPT') }}</th>
<th>{{ __('consultations.REFERENCES') }}</th>
</tr>
</thead>
<tbody>
@if(check_if_episode_is_a_followup($episode->id) && !is_null($parent_consultation_details) && $parent_consultation_details->primary_diagnosis != $consultation->primary_diagnosis)
<tr>
<td style="width: 30%;">
<div class="form-group row">
<div class="col-sm-12">
{{ Form::select('parent_primary_diagnosis', $diagnoses, $parent_consultation_details->primary_diagnosis, ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
</div>
<div class="col-sm-12">
<span style="color: green"><br>(As diagnosed on {{ streamline_date($parent_episode_details->created_at) }})</span>
</div>
</div>
</td>
<td style="width: 45%; color: #C85F6A;"><div class="well well-sm">
{{ isset($parent_consultation_details->primary_diagnosis) ? $diagnoses_all->firstWhere('id',$parent_consultation_details->primary_diagnosis)->prompts : "" }}&nbsp;</div></td>
<td>
<div class="well well-sm">
@if(!is_null($parent_consultation_details->primary_diagnosis))
@php
$reference_names = explode(",", get_name($parent_consultation_details->primary_diagnosis, 'id', 'reference_names', 'diagnoses'));
$reference_areas = explode(",", get_name($parent_consultation_details->primary_diagnosis, 'id', 'reference_areas', 'diagnoses'));
@endphp
@for($i = 0; $i < count($reference_areas); $i++)
@if(isset($reference_areas[$i]) && isset($reference_names[$i]))
<a href="{{ $reference_areas[$i] }}" target='_blank'> {{ $reference_names[$i] }} </a> <span style='color: red'> | </span>
@endif
@endfor
@endif
</div>
</td>
</tr>
<tr>
<td style="width: 30%;">
<div class="form-group">
{{ Form::select('primary_diagnosis', $diagnoses, $consultation->primary_diagnosis, ['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">
{{ isset($consultation->primary_diagnosis) ? $diagnoses_all->firstWhere('id',$consultation->primary_diagnosis)->prompts : "" }}&nbsp;</div></td>
<td>
<div class="well well-sm" id="primary_diagnosis_reference">
@if(!is_null($consultation->primary_diagnosis))
@php
$reference_names = explode(",", get_name($consultation->primary_diagnosis, 'id', 'reference_names', 'diagnoses'));
$reference_areas = explode(",", get_name($consultation->primary_diagnosis, 'id', 'reference_areas', 'diagnoses'));
@endphp
@for($i = 0; $i < count($reference_areas); $i++)
@if(isset($reference_areas[$i]) && isset($reference_names[$i]))
<a href="{{ $reference_areas[$i] }}" target='_blank'> {{ $reference_names[$i] }} </a> <span style='color: red'> | </span>
@endif
@endfor
@endif
</div>
</td>
</tr>
@else
<tr>
<td style="width: 30%;">
<div class="form-group">
{{ Form::select('primary_diagnosis', $diagnoses, $consultation->primary_diagnosis, ['id'=>'primary_diagnosis','class' => 'form-control col-sm-12 compulsory primaryDiagnosis', 'required']) }}
</div>
</td>
<td style="width: 45%; color: #C85F6A;"><div class="well well-sm" id="primary_diagnosis_prompt">{{ isset($consultation->primary_diagnosis) ? $diagnoses_all->firstWhere('id',$consultation->primary_diagnosis)->prompts : "" }}&nbsp;</div></td>
<td>
<div class="well well-sm" id="primary_diagnosis_reference">
@if(!is_null($consultation->primary_diagnosis))
@php
$reference_names = explode(",", get_name($consultation->primary_diagnosis, 'id', 'reference_names', 'diagnoses'));
$reference_areas = explode(",", get_name($consultation->primary_diagnosis, 'id', 'reference_areas', 'diagnoses'));
@endphp
@for($i = 0; $i < count($reference_areas); $i++)
@if(isset($reference_areas[$i]) && isset($reference_names[$i]))
<a href="{{ $reference_areas[$i] }}" target='_blank'> {{ $reference_names[$i] }} </a> <span style='color: red'> | </span>
@endif
@endfor
@endif
</div>
</td>
</tr>
@endif
@if( Auth::user()->can('add-new-diagnosis-from-consultation'))
<tr>
<td>
<a data-toggle="modal" data-target="#diagnosisModal" class="label labelLeft label-info pull-left" style="color: #fff;">{{ __('consultations.add_new_diagnosis') }}</a>
</td>
<td colspan="2"></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="table-responsive">
<table class="table color-table success-table table-condensed table-bordered" id="other_diagnosis_table">
<thead>
<tr>
<th class="text-center">#</th>
<th>{{ __('consultations.OTHER_DIAGNOSIS') }}</th>
<th>{{ __('consultations.PROMPT') }}</th>
<th>{{ __('consultations.REFERENCES') }}</th>
</tr>
</thead>
<tbody>
<!-- cater for a review episode -->
@if(check_if_episode_is_a_followup($episode->id) && !is_null($parent_consultation_details))
@php
$parent_consultation_other_diagnoses = unserialize($parent_consultation_details->other_diagnoses);
@endphp
@if(!empty($parent_consultation_other_diagnoses) && $parent_consultation_other_diagnoses[0] != "")
@foreach($parent_consultation_other_diagnoses as $diagnosis)
@if($diagnosis != "")
<tr>
<td style="width: 30%;">
<h4>{{ $diagnoses[$diagnosis] }}<small style="color: green"><br>(As diagnosed on {{ streamline_date($parent_episode_details->created_at) }})</small></h4>
</td>
<td style="width: 30%; color: #C85F6A;"><div class="well well-sm" id="secondary_diagnosis_prompt1">{{ is_object($diagnoses_all->firstWhere('id',$diagnosis)) ? $diagnoses_all->firstWhere('id',$diagnosis)->prompts : '' }}&nbsp;</div></td>
<td>
<div class="well well-sm" id="primary_diagnosis_reference">
@if(!is_null($consultation->primary_diagnosis))
@php
$reference_names = explode(",", get_name($parent_consultation_details->primary_diagnosis, 'id', 'reference_names', 'diagnoses'));
$reference_areas = explode(",", get_name($parent_consultation_details->primary_diagnosis, 'id', 'reference_areas', 'diagnoses'));
@endphp
@for($i = 0; $i < count($reference_areas); $i++)
@if(isset($reference_areas[$i]) && isset($reference_names[$i]))
<a href="{{ $reference_areas[$i] }}" target='_blank'> {{ $reference_names[$i] }} </a> <span style='color: red'> | </span>
@endif
@endfor
@endif
</div>
</td>
</tr>
@endif
@endforeach
@endif
@endif
<!-- end of catering for a review episode -->
@php
$other_diagnoses = unserialize($consultation->other_diagnoses);
@endphp
@if(empty($other_diagnoses))
<tr>
<td><input type="checkbox" name="chk" id="chk"></td>
<td style="width: 30%;">
{{ Form::select('other_diagnosis[]', $diagnoses, '', ['class' => 'sec_d form-control col-sm-12']) }}
</td>
<td style="width: 45%"><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>
@else
@foreach($other_diagnoses as $diagnosis)
@if($diagnosis != "")
<tr>
<td><input type="checkbox" name="chk" id="chk"></td>
<td style="width: 30%;">
{{ Form::select('other_diagnosis[]', $diagnoses, $diagnosis, ['class' => 'sec_d form-control col-sm-12']) }}
</td>
<td style="width: 45%; color: #C85F6A;"><div class="well well-sm" id="secondary_diagnosis_prompt1">{{ is_object($diagnoses_all->firstWhere('id',$diagnosis)) ? $diagnoses_all->firstWhere('id',$diagnosis)->prompts : '' }}&nbsp;</div></td>
<td style="width: 25%"><div class="well well-sm" id="secondary_diagnosis_reference1">{{ is_object($diagnoses_all->firstWhere('id',$diagnosis)) ? $diagnoses_all->firstWhere('id',$diagnosis)->reference_names : '' }}&nbsp;</div></td>
</tr>
@endif
@endforeach
@endif
</tbody>
</table>
</div>
<a class="btn btn-success btn-sm m-t-10" id="add_row" onclick="addRow('other_diagnosis_table')">{{ __('consultations.add_row') }}</a>
<a class="btn btn-danger btn-sm m-t-10" id="delete_row" onclick="deleteRow('other_diagnosis_table')">{{ __('consultations.delete_row') }}</a>
</div>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="{{ (is_add_attendance_to_consultation_enabled())? 'col-8':'col'}}">
<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>
@if($consultation->rdt === 1)
{{ Form::checkbox('rdt', 1, true, ['id'=>'rdt_pos']) }}
<label for="rdt_pos">POSITIVE</label>
@else
{{ Form::checkbox('rdt', 1, false, ['id'=>'rdt_pos']) }}
<label for="rdt_pos">POSITIVE</label>
@endif
</td>
<td>
@if($consultation->rdt === 0)
{{ Form::checkbox('rdt', 0, true, ['id'=>'rdt_neg']) }}
<label for="rdt_neg">NEGATIVE</label>
@else
{{ Form::checkbox('rdt', 0, false, ['id'=>'rdt_neg']) }}
<label for="rdt_neg">NEGATIVE</label>
@endif
</td>
<td>
{{ Form::text('rbs',$consultation->rbs,['class'=>'form-control', 'placeholder'=>'(mm/l)']) }}
</td>
</tr>
</tbody>
</table>
</div>
@if (is_add_attendance_to_consultation_enabled())
<div class="col-4">
<div class="form-group">
{{ Form::label('attendance',__('triage.re_attendance_or_new')) }}
<br>
{{ Form::radio('attendance', 1, ($consultation->attendance == 1)? true :false, ["required"]) }} {{ __('triage.new_attendance') }} &nbsp;&nbsp;
{{ Form::radio('attendance', 2, ($consultation->attendance == 2)? true :false, ["required"]) }} {{ __('triage.re_attendance') }}
<div class="help-block with-errors"></div>
</div>
</div>
@endif
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-md-6">
<h4>{{ __('consultations.ordered_investigations') }}</h4>
<div class="table-responsive" >
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th>{{ __('investigations.investigation_name') }}</th>
<th>{{ __('investigations.results') }}</th>
<th>{{ __('investigations.normal_ranges') }}</th>
<th>{{ __('investigations.unit') }}</th>
<th>{{ __('investigations.comment') }}</th>
</tr>
</thead>
<tbody>
<!-- cater for a review of a review episode i.e first of the 3 episode review -->
@if($episode_has_grand_parent_episode)
@if(count($grand_parent_episode_investigation_results) > 0)
<tr>
<td colspan="4"><font color="green"><b>{{ __('consultations.investigation_for_episode_of') }} {{ streamline_date($grand_parent_episode_details->created_at) }}</b></font></td>
</tr>
@foreach($grand_parent_episode_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::withTrashed()->find($investigation_ids_array[$i]);
if(!$investigation) {
continue;
}
@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>
@if($investigation->range_type == 1)
{{ get_dynamic_normal_range($investigation->id, get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients')) }}
@else
{{ $investigation->normal_ranges }}
@endif
</td>
<td>
{!! (!isset($results_values[$i]) && $per_investigation_array[$i] == 0) ? '<font color="orange">{{ __("consultations.pending") }}</font>' : $results_values[$i] !!}
</td>
<td>
@if(isset($comments[$i]) && ($per_investigation_array[$i] != 0))
{{ $comments[$i] }}
@else
<font color="orange">{{ __("consultations.pending") }}</font>
@endif
</td>
</tr>
@endfor
<tr>
<td colspan="2">{{ __('consultations.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
<tr>
<td colspan="4"></td>
</tr>
@elseif(count($grand_parent_episode_ordered_investigations) > 0)
<tr>
<td colspan="4"><font color="green"><b>{{ __('consultations.investigation_for_episode_of') }} {{ streamline_date($grand_parent_episode_details->created_at) }}</b></font></td>
</tr>
@foreach($grand_parent_episode_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::withTrashed()->find($investigation_ids_array[$i]);
if(!$investigation) {
continue;
}
@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>
@if($investigation->range_type == 1)
{{ get_dynamic_normal_range($investigation->id, get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients')) }}
@else
{{ $investigation->normal_ranges }}
@endif
</td>
<td><font color="orange">{{ __('consultations.pending') }}</font></td>
<td>
{{ $investigation->comments }}
</td>
</tr>
@endfor
@endforeach
<tr>
<td colspan="4"></td>
</tr>
@endif
@endif
<!-- end catering for first of the 3 episodes -->
<!-- cater for a review episode -->
@if(count($parent_episode_investigation_results) > 0)
<tr>
<td colspan="5"><font color="green"><b>{{ __('consultations.investigation_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}</b></font></td>
</tr>
@foreach($parent_episode_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::withTrashed()->find($investigation_ids_array[$i]);
if(!$investigation) {
continue;
}
@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>
@if($investigation->range_type == 1)
{{ get_dynamic_normal_range($investigation->id, get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients')) }}
@else
{{ $investigation->normal_ranges }}
@endif
</td>
<td>
{!! (!isset($results_values[$i]) && $per_investigation_array[$i] == 0) ? '<font color="orange">{{ __("consultations.pending") }}</font>' : $results_values[$i] !!}
</td>
<td>
@if(isset($comments[$i]) && isset($per_investigation_array[$i]) && $per_investigation_array[$i] != 0)
{{ $comments[$i] }}
@else
<font color="orange">{{ __("consultations.pending") }}</font>
@endif
</td>
</tr>
@endfor
<tr>
<td colspan="2">{{ __('consultations.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
<tr>
<td colspan="5"></td>
</tr>
@elseif(count($parent_episode_ordered_investigations) > 0)
<tr>
<td colspan="5"><font color="green"><b>{{ __('consultations.investigation_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}</b></font></td>
</tr>
@foreach($parent_episode_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::withTrashed()->find($investigation_ids_array[$i]);
if(!$investigation) {
continue;
}
@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>
@if($investigation->range_type == 1)
{{ get_dynamic_normal_range($investigation->id, get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients')) }}
@else
{{ $investigation->normal_ranges }}
@endif
</td>
<td><font color="orange">{{ __('consultations.pending') }}</font></td>
<td>
{{ $investigation->comments }}
</td>
</tr>
@endfor
@endforeach
<tr>
<td colspan="5"></td>
</tr>
@endif
<!-- end of catering for a review episode -->
@if(count($investigation_results) > 0)
@if(check_if_episode_is_a_followup($episode->id))
<tr>
<td colspan="5"><font color="green"><b>{{ __('consultations.investigation_for_review') }} ({{ streamline_date($episode->created_at)}}) </b></font></td>
</tr>
@endif
@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::withTrashed()->find($investigation_ids_array[$i]);
if(!$investigation) {
continue;
}
@endphp
@if($investigation->type == 1 && isset($results_values[$i]))
<!-- investigations with specialized variable -->
<tr>
<td style="border-left: 1px solid #dddddd;" colspan="5">
@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>
</tr>
@php
$specialised_results = \Streamline\Models\InvestigationSpecialisedResult::where('id', $results_values[$i])->first();
if($specialised_results){
$variable_id_array = explode(',', $specialised_results->specialised_variable_id);
$variable_value_array = explode(',', $specialised_results->value);
$variable_comment_array = explode(',', $specialised_results->comment);
$variable_normal_range_array = explode(',', $specialised_results->normal_ranges);
}
@endphp
@if($specialised_results)
@for($x = 0; $x < count($variable_id_array); $x++)
<tr>
<td>{{ get_name($variable_id_array[$x], 'id', 'name', 'investigation_specialised_variables') }}</td>
<td>{{ $variable_value_array[$x] }}</td>
<td>
@if(get_name($variable_id_array[$x], 'id', 'range_type', 'investigation_specialised_variables') == 1)
{{ get_dynamic_normal_range_specialized($variable_id_array[$x], get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients')) }}
@else
{{ get_name($variable_id_array[$x], 'id', 'normal_ranges', 'investigation_specialised_variables') }}
@endif
</td>
<td>
@if(get_name(get_name($variable_id_array[$x], 'id', 'units', 'investigation_specialised_variables'), 'id', 'name', 'unit_of_measure') != "N/A")
{{ get_name(get_name($variable_id_array[$x], 'id', 'units', 'investigation_specialised_variables'), 'id', 'name', 'unit_of_measure') }}
@endif
</td>
<td>{{ $variable_comment_array[$x] }}</td>
</tr>
@endfor
@endif
<!-- end of code for showing investigation with specialized variable -->
@elseif($investigation->slug == 'echo' && $results_values[$i] == "")
<tr>
<td style="border-left: 1px solid #dddddd;" colspan="3">
@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>
<span @if(!isset($cardio_echo)) style="display: none;" @endif>
<a target="_blank" class="fcbtn btn btn-sm btn-default btn-outline btn-1d" href='{{ url("/investigations/print-cardio-echo/{$patient_id}/{$episode_id}") }}'> <i class="fa fa-print"></i> <span>View Results</span></a>
</span>
</td>
</tr>
@else
<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>
@if(isset($per_investigation_array[$i]) && $per_investigation_array[$i] == 0)
<font color="orange">{{ __("consultations.pending") }}</font>
@else
{!! isset($results_values[$i]) ? nl2br(e($results_values[$i])) : "" !!}
@endif
</td>
<td>
@if($investigation->range_type == 1)
{{ get_dynamic_normal_range($investigation->id, get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients')) }}
@else
{{ $investigation->normal_ranges }}
@endif
</td>
<td>
{{ get_name(get_name($investigation->id, 'id', 'units', 'investigations'),'id', 'name', 'unit_of_measure') }}
</td>
<td>
@if(isset($comments[$i]) && isset($per_investigation_array[$i]) && $per_investigation_array[$i] != 0)
{!! nl2br(e($comments[$i])) !!}
@else
<font color="orange">{{ __("consultations.pending") }}</font>
@endif
</td>
</tr>
@endif
@endfor
<tr>
<td colspan="3">{{ __('consultations.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)
@if(check_if_episode_is_a_followup($episode->id))
<tr>
<td colspan="5"><font color="green"><b>{{ __('consultations.investigation_for_review') }} ({{ streamline_date($episode->created_at)}}) </b></font></td>
</tr>
@endif
@foreach($ordered_investigations as $investigation)
@php
$investigation_ids_array = explode(',', $investigation->investigation_id);
@endphp
@for($i = 0 ; $i < count($investigation_ids_array) ; $i++)
@if(isset($investigation_ids_array[$i]) && $investigation_ids_array[$i] != "")
@php
$investigation = \Streamline\Models\Investigation::withTrashed()->find($investigation_ids_array[$i]);
if(!$investigation) {
continue;
}
@endphp
@if($investigation->slug == 'echo')
<tr>
<td style="border-left: 1px solid #dddddd;" colspan="2">
@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 colspan="3">
@if(($cardio_echo))
<span>
<a target="_blank" class="fcbtn btn btn-sm btn-info btn-outline btn-1d" href='{{ url("/investigations/print-cardio-echo/{$patient_id}/{$episode_id}") }}'> <i class="fa fa-print"></i> <span>View results</span></a>
</span>
@else
Pending
@endif
</td>
</tr>
@else
<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><font color="orange">{{ __('consultations.pending') }}</font></td>
<td>
@if($investigation->range_type == 1)
{{ get_dynamic_normal_range($investigation->id, get_patient_age_group($patient_id), get_name($patient_id, 'id', 'gender', 'patients')) }}
@else
{{ $investigation->normal_ranges }}
@endif
</td>
<td><font color="orange"></font></td>
<td>
{{ $investigation->comments }}
</td>
</tr>
@endif
@endif
@endfor
@endforeach
@else
<tr>
<td colspan="5"><code>{{ __('consultations.investigation_not_ordered') }} {{ check_if_episode_is_a_followup($episode->id) ? 'during current review' : '' }}.</code></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h4>{{ __('consultations.ordered_sundries') }}</h4>
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th>{{ __('consultations.SUNDRY') }}</th>
<th>{{ __('consultations.QUANTITY') }}</th>
</tr>
</thead>
<tbody>
<!-- cater for a review of a review episode i.e first of the 3 episode review -->
@if($episode_has_grand_parent_episode)
@if(count($grand_parent_episode_ordered_sundries) > 0)
<tr>
<td colspan="2"><font color="green"><b>{{ __('consultations.sundries_for_episode_of') }} {{ streamline_date($grand_parent_episode_details->created_at) }}</b></font></td>
</tr>
@foreach($grand_parent_episode_ordered_sundries as $ordered_sundry)
@php
$sundry_ids = explode(",", $ordered_sundry->sundries_id);
$sundry_quantity = explode(",", $ordered_sundry->quantity);
@endphp
@for($i = 0; $i < count($sundry_ids); $i++)
<tr>
<td> {{ get_name($sundry_ids[$i], 'id', 'name', 'sundries') }} </td>
<td> {!! $sundry_quantity[$i] !!} </td>
</tr>
@endfor
@endforeach
@endif
@endif
<!-- end of catering for first of the 3 episodes -->
<!-- cater for a review episode -->
@if(count($parent_episode_ordered_sundries) > 0)
@if(check_if_episode_is_a_followup($episode->id))
<tr>
<td colspan="2"><font color="green"><b>{{ __('consultations.sundries_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}</b></font></td>
</tr>
@endif
@foreach($parent_episode_ordered_sundries as $ordered_sundry)
@php
$sundry_ids = explode(",", $ordered_sundry->sundries_id);
$sundry_quantity = explode(",", $ordered_sundry->quantity);
@endphp
@for($i = 0; $i < count($sundry_ids); $i++)
<tr>
<td> {{ get_name($sundry_ids[$i], 'id', 'name', 'sundries') }} </td>
<td> {!! $sundry_quantity[$i] !!} </td>
</tr>
@endfor
@endforeach
@endif
<!-- end catering for a review episode -->
@if(count($ordered_sundries) > 0)
@if(check_if_episode_is_a_followup($episode->id))
<tr>
<td colspan="2"><font color="green"><b>{{ __('consultations.sundries_for_episode_review') }} ({{ streamline_date($episode->created_at)}}) </b></font></td>
</tr>
@endif
@foreach($ordered_sundries as $ordered_sundry)
@php
$sundry_ids = explode(",", $ordered_sundry->sundries_id);
$sundry_quantity = explode(",", $ordered_sundry->quantity);
@endphp
@for($i = 0; $i < count($sundry_ids); $i++)
<tr>
<td> {{ get_name($sundry_ids[$i], 'id', 'name', 'sundries') }} </td>
<td> {!! $sundry_quantity[$i] !!} </td>
</tr>
@endfor
@endforeach
@else
<tr>
<td colspan="2"><code>{{ __('consultations.no_sundries_ordered') }} {{ check_if_episode_is_a_followup($episode->id) ? __('consultations.during_current_review') : '' }}.</code></td>
</tr>
@endif
<tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-md-8">
<h4>{{ __('consultations.treatment_given') }}</h4>
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th>{{ __('consultations.DRUG_NAME') }}</th>
<th>{{ __('consultations.DOSAGE') }}</th>
<th>{{ __('consultations.DURATION') }}</th>
<th>{{ __('consultations.QUANTITY') }}</th>
<th>{{ __('consultations.STATUS') }}</th>
<th>{{ __('consultations.INSTRUCTION') }}</th>
</tr>
</thead>
<tbody>
<!-- cater for a review of a review episode i.e first of the 3 episode review -->
@if($episode_has_grand_parent_episode)
@if(count($grand_parent_episode_treatments) > 0)
<tr>
<td colspan="6"><font color="green"><b>{{ __('consultations.treatment_for_episode_of') }} {{ streamline_date($grand_parent_episode_details->created_at) }}</b></font></td>
</tr>
@foreach($grand_parent_episode_treatments as $treatment)
@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);
$purchased_elsewhere_array = is_null($treatment->purchased_elsewhere) ? [] : explode(",", $treatment->purchased_elsewhere);
@endphp
@for($x = 0; $x < count($drugs_array); $x++)
@php
$frequency_name = get_name($frequencies_array[$x], 'id', 'name', 'dosage_frequencies');
$drug_unit_id = get_name($drugs_array[$x], 'id', 'unit_id', 'drugs');
$unit = get_name($drug_unit_id, 'id', 'name', 'drug_units');
$unit = $unit=="N/A"?"":$unit;
$drug_unit = "<small>" . $unit . "</small>";
$dose2 = (empty($dosage2_array[$x])) ? "" : " | " . $dosage2_array[$x] . $drug_unit;
@endphp
<tr>
<td>{{ get_name($drugs_array[$x], 'id', "name", 'drugs') }}</td>
<td>{{ $dosage_array[$x] }} {!! $drug_unit !!} {{ $dose2 }} &nbsp;&nbsp; {{ $frequency_name }}</td>
<td>{{ isset($duration_array[$x]) ? $duration_array[$x] : "" }}</td>
<td>{{ $quantity_dispensed_array[$x] }}</td>
@if(isset($purchased_elsewhere_array[$x]) && $purchased_elsewhere_array[$x] == 1)
<td style='color: orange'>Purchased From Elsewhere</td>
@else
@if($treatment->dispense_status == 1)
<td style='color: green'>{{ __('consultations.dispensed') }}</td>
@else
<td style='color: orange'>{{ __('consultations.pending') }}</td>
@endif
@endif
<td>
{{ isset($instructions_array[$x]) ? trim($instructions_array[$x]) : 'N/A' }}
</td>
</tr>
@endfor
@endforeach
@endif
@endif
<!-- end catering for first of 3 related episodes -->
<!-- cater for a review episode -->
@if(count($parent_episode_treatments) > 0)
<tr>
<td colspan="6"><font color="green"><b>{{ __('consultations.treatment_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}</b></font></td>
</tr>
@foreach($parent_episode_treatments as $treatment)
@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);
$purchased_elsewhere_array = is_null($treatment->purchased_elsewhere) ? [] : explode(",", $treatment->purchased_elsewhere);
@endphp
@for($x = 0; $x < count($drugs_array); $x++)
@php
$frequency_name = get_name($frequencies_array[$x], 'id', 'name', 'dosage_frequencies');
$drug_unit_id = get_name($drugs_array[$x], 'id', 'unit_id', 'drugs');
$unit = get_name($drug_unit_id, 'id', 'name', 'drug_units');
$unit = $unit=="N/A"?"":$unit;
$drug_unit = "<small>" . $unit . "</small>";
$dose2 = (empty($dosage2_array[$x])) ? "" : " | " . $dosage2_array[$x] . $drug_unit;
@endphp
<tr>
<td>{{ get_name($drugs_array[$x], 'id', "name", 'drugs') }}</td>
<td>{{ $dosage_array[$x] }} {!! $drug_unit !!} {{ $dose2 }} &nbsp;&nbsp; {{ $frequency_name }}</td>
<td>{{ isset($duration_array[$x]) ? $duration_array[$x] : "" }}</td>
<td>{{ $quantity_dispensed_array[$x] }}</td>
@if(isset($purchased_elsewhere_array[$x]) && $purchased_elsewhere_array[$x] == 1)
<td style='color: orange'>Purchased From Elsewhere</td>
@else
@if($treatment->dispense_status == 1)
<td style='color: green'>{{ __('consultations.dispensed') }}</td>
@else
<td style='color: orange'>{{ __('consultations.pending') }}</td>
@endif
@endif
<td>
{{ isset($instructions_array[$x]) ? trim($instructions_array[$x]) : 'N/A' }}
</td>
</tr>
@endfor
@endforeach
@endif
<!-- end of catering for review episode -->
@if(count($treatments) > 0)
@if(check_if_episode_is_a_followup($episode->id))
<tr>
<td colspan="6"><font color="green"><b>{{ __('consultations.treatment_for_episode_review') }} ({{ streamline_date($episode->created_at)}}) </b></font></td>
</tr>
@endif
@foreach($treatments as $treatment)
@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);
$purchased_elsewhere_array = is_null($treatment->purchased_elsewhere) ? [] : explode(",", $treatment->purchased_elsewhere);
@endphp
@for($x = 0; $x < count($drugs_array); $x++)
@php
$frequency_name = get_name($frequencies_array[$x], 'id', 'name', 'dosage_frequencies');
$drug_unit_id = get_name($drugs_array[$x], 'id', 'unit_id', 'drugs');
$unit = get_name($drug_unit_id, 'id', 'name', 'drug_units');
$unit = $unit=="N/A"?"":$unit;
$drug_unit = "<small>" . $unit . "</small>";
$dose2 = (empty($dosage2_array[$x])) ? "" : " | " . $dosage2_array[$x] . $drug_unit;
@endphp
<tr>
<td>
{{ get_name($drugs_array[$x], 'id', "name", 'drugs') }}
@if($treatment->is_treatment_progressive != 0)
<span style="color: #1c7430"><i>(Progressive Treatment)</i></span>
@endif
</td>
<td>{{ $dosage_array[$x] }} {!! $drug_unit !!} {{ $dose2 }} &nbsp;&nbsp; {{ $frequency_name }}</td>
<td>{{ isset($duration_array[$x]) ? $duration_array[$x] : "" }}</td>
<td>{{ $quantity_dispensed_array[$x] }}</td>
@if(isset($purchased_elsewhere_array[$x]) && $purchased_elsewhere_array[$x] == 1)
<td style='color: orange'>Purchased From Elsewhere</td>
@else
@if($treatment->dispense_status == 1)
<td style='color: green'>{{ __('consultations.dispensed') }}</td>
@else
<td style='color: orange'>{{ __('consultations.pending') }}</td>
@endif
@endif
<td>
{{ isset($instructions_array[$x]) ? trim($instructions_array[$x]) : 'N/A' }}
</td>
</tr>
@endfor
@endforeach
@else
<tr>
<td colspan="7"><code>{{ __('consultations.no_prescription_made_yet') }} {{ check_if_episode_is_a_followup($episode->id) ? __('consultations.during_current_review') : '' }}</code></td>
</tr>
@endif
<tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-4">
<h4>{{ __('consultations.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>{{ __('consultations.PROCEDURE') }}</th>
<th>{{ __('consultations.STATUS') }}</th>
<th>{{ __('consultations.PERFORMED') }}</th>
</tr>
</thead>
<tbody>
<!-- cater for a review of a review episode i.e first of the 3 episode review -->
@if($episode_has_grand_parent_episode)
@if(count($grand_parent_episode_ordered_procedures) > 0)
<tr>
<td colspan="4"><font color="green"><b>{{ __('consultations.procedures_for_episode_of') }} {{ streamline_date($grand_parent_episode_details->created_at) }}</b></font></td>
</tr>
@php $grand_parent_count = 1; @endphp
@foreach($grand_parent_episode_ordered_procedures as $ordered_procedure)
@php
$procedure_id = explode(",", $ordered_procedure->procedure_id);
$procedure_performed_array = explode(",", $ordered_procedure->performed);
@endphp
@for($i = 0; $i < count($procedure_id); $i++)
<tr>
<td>{{ $grand_parent_count }}</td>
<td>
{{ get_name($procedure_id[$i], 'id', 'name', 'procedures') }}
</td>
<td>
{!! $procedure_performed_array[$i] == 1 ? '<font style="color:Green">'.__("consultations.performed").'</font>' : '<font style="color:Orange">'. __("consultations.pending").'</font>' !!}
</td>
<td class="text-center">
<!-- <input type="checkbox" name="perform[]" id="perform[]" value="{{ $ordered_procedure->procedure_id }}"> -->
</td>
</tr>
@php $grand_parent_count++; @endphp
@endfor
@endforeach
@endif
@endif
<!-- end catering for first of the 3 episodes -->
<!-- cater for a review episode -->
@if(count($parent_episode_ordered_procedures) > 0)
<tr>
<td colspan="4"><font color="green"><b>{{ __('consultations.procedures_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}</b></font></td>
</tr>
@php $parent_count = 1; @endphp
@foreach($parent_episode_ordered_procedures as $ordered_procedure)
@php
$procedure_id = explode(",", $ordered_procedure->procedure_id);
$procedure_performed_array = explode(",", $ordered_procedure->performed);
@endphp
@for($i = 0; $i < count($procedure_id); $i++)
<tr>
<td>{{ $parent_count }}</td>
<td>
{{ get_name($procedure_id[$i], 'id', 'name', 'procedures') }}
</td>
<td>
{!! $procedure_performed_array[$i] == 1 ? '<font style="color:Green">'.__("consultations.performed").'</font>' : '<font style="color:Orange">'. __("consultations.pending").'</font>' !!}
</td>
<td class="text-center">
<!-- <input type="checkbox" name="perform[]" id="perform[]" value="{{ $ordered_procedure->procedure_id }}"> -->
</td>
</tr>
@php $parent_count++; @endphp
@endfor
@endforeach
@endif
<!-- end catering for a review episode -->
@if(count($ordered_procedures) > 0)
@php $count = 0; $procedure_performed_counter = 0; @endphp
@if(check_if_episode_is_a_followup($episode->id))
<tr>
<td colspan="4"><font color="green"><b>{{ __('consultations.procedures_for_episode_review') }} ({{ streamline_date($episode->created_at)}}) </b></font></td>
</tr>
@endif
@foreach($ordered_procedures as $ordered_procedure)
@php
$procedure_id = explode(",", $ordered_procedure->procedure_id);
$procedure_performed_array = explode(",", $ordered_procedure->performed);
$procedure_performed_id_array = explode(",", $ordered_procedure->performed_id);
@endphp
@for($i = 0; $i < count($procedure_id); $i++)
<tr>
<td>{{ ++$count }}</td>
<td>
{{ get_name($procedure_id[$i], 'id', 'name', 'procedures') }}
</td>
<td>
{!! $procedure_performed_array[$i] == 1 ? '<font style="color:Green">'.__("consultations.performed").'</font>' : '<font style="color:Orange">'. __("consultations.pending").'</font>' !!}
</td>
<td class="text-center">
@if($procedure_performed_array[$i] != 1)
<input type="checkbox" name="perform_selected[]" id="procedure_performed_{{ $procedure_id[$i] }}" value="{{ $procedure_performed_counter }}" class="procedure_performed">
{{ Form::hidden('perform[]', $procedure_id[$i]) }}
{{ Form::hidden('procedure_order_perform[]', $ordered_procedure->id) }}
{{ Form::hidden('procedure_performed_position[]', $i) }}
<div id="procedure_performed_by_div_{{ $procedure_id[$i] }}" style="display: none; width: 100%">
{{ Form::label('perfomed_by', 'Perfomed By:')}}
{{ Form::select('procedure_performed_by[]', $users_array, '', ['class' => 'form-control procedure_performed_by', 'id' => 'procedure_performed_by_'.$procedure_id[$i]]) }}
</div>
@php $procedure_performed_counter++ @endphp
@else
By {{ get_full_name(get_name($procedure_performed_id_array[$i], 'id', 'performed_by', 'staff_performed_services'), 'id', 'first_name', 'last_name', 'users') }}
@endif
</td>
</tr>
@endfor
@endforeach
@else
<tr>
<td colspan="7"><code>{{ __('consultations.no_procedure_has_been_ordered') }} {{ check_if_episode_is_a_followup($episode->id) ? __('consultations.during_current_review') : '' }}.</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(__('consultations.Investigation'),['type'=>'submit','class'=>'btn btn-info btn-block','name'=>'submit-btn','value'=>'investigation']) }}
</div>
<div class="col-md-6">
{{ Form::button(__('consultations.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(__('consultations.Procedures'),['type'=>'submit','class'=>'btn btn-inverse btn-block','name'=>'submit-btn','value'=>'procedures']) }}
</div>
<div class="col-md-6">
{{ Form::button(__('consultations.Sundries'),['type'=>'submit','class'=>'btn btn-primary btn-block','name'=>'submit-btn','value'=>'sundries']) }}
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
{{ Form::button(__('consultations.services'),['type'=>'submit','class'=>'btn btn-default-bluish btn-block','name'=>'submit-btn','value'=>'services']) }}
</div>
<div class="col-md-6">
</div>
</div>
</div>
<div class="col-md-3">
@if(isset($grand_parent_episode_details) && !is_null($grand_parent_episode_details->consultation_id))
@php
$grand_parent_consultation = \Streamline\Models\Consultation::where('episode_id',$grand_parent_episode_details->id)->first();
@endphp
@if($grand_parent_consultation->comments)
<h5>
<font color="green">{{ __('consultations.consultation_comments_on') }} {{ streamline_date($grand_parent_consultation->created_at) }}</font>
</h5>
<div style="background-color: #eceaea; padding: 5px;">
{{ $grand_parent_consultation->comments }}
</div>
@endif
@endif
@if(isset($parent_episode_details) && !is_null($parent_episode_details->consultation_id))
@php
$parent_consultation = \Streamline\Models\Consultation::where('episode_id',$parent_episode_details->id)->first();
@endphp
@if($parent_consultation->comments)
<h5>
<font color="green">{{ __('consultations.consultation_comments_on') }} {{ streamline_date($parent_consultation->created_at) }}</font>
</h5>
<div style="background-color: #eceaea; padding: 5px;">
{{ $parent_consultation->comments }}
</div>
@endif
@endif
<h4>{{ __('consultations.comments') }}</h4>
<textarea class="form-control" name="comments" rows="5">{{ $consultation->comments }}</textarea>
</div>
<div class="col-md-3">
<h4>{{ __('consultations.outcome') }}</h4>
<div class="form-group">
<div class="input-group">
{{ Form::select('outcome', $outcomes, is_null($consultation->outcome_id) ? 7 : $consultation->outcome_id, ['id' => 'outcome', 'class' => 'form-control compulsory']) }}
</div>
</div>
<div id="admitted_div" @if($consultation->outcome_id != 1) style="display: none" @endif>
<div class="form-group">
{{ Form::label('ward_id',__('consultations.select_ward')) }}
<div class="input-group">
{{ Form::select('ward_id', $wards, $consultation->ward_id, ['class' => 'form-control compulsory']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('admitted_on',__('consultations.admitted_on')) }}
<div class="input-group">
{{ Form::text('admitted_on',Carbon\Carbon::parse($consultation->admitted_on)->format('Y-m-d'),['class' => 'form-control datepicker-autoclose compulsory', 'readonly']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div id="died_div" style="display: none;">
<div class="form-group">
{{ Form::label('died_on',__('consultations.died_on')) }}
<div class="input-group">
{{ Form::text('died_on', '',['class' => 'form-control datepicker-autoclose compulsory', 'readonly', 'id'=>'died_on']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div id="home_with_followup_div" @if($consultation->outcome_id != 3) style="display: none"@endif>
<!-- <div class="form-group">
<div class="input-group">
{{ Form::text('followup_where',$consultation->followup_where,['class' => 'form-control compulsory', 'placeholder'=>'Where?']) }}
</div>
</div> -->
<div class="form-group">
{{ Form::label('followup_clinic_allocation', 'Assign Clinic') }}
{{ Form::select('followup_clinic_allocation', $clinics, 0, ['class' => 'form-control col-sm-12 compulsory']) }}
</div>
<div class="form-group">
{{ Form::label('followup_in_charge', __('consultations.assign_incharge')) }}
<select name="followup_in_charge" class="form-control col-sm-12 compulsory">
<option value="0" selected>{{ __('consultations.not_assigned') }}</option>
@foreach($users as $user)
<option value="{{ $user->id }}">{{ $user->first_name }} {{ $user->last_name }}</option>
@endforeach
</select>
</div>
<div class="form-group">
{{ Form::label('followup_when',__('consultations.when')) }}
<div class="input-group">
{{ Form::text('followup_when',Carbon\Carbon::parse($consultation->followup_when)->format('Y-m-d'),['class' => 'form-control compulsory datepicker-autoclose','readonly']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="form-group">
{{ Form::label('followup_in_time', __('consultations.appointment_time')) }}
{{ Form::time('followup_in_time',$consultation->followup_time,['class' => 'form-control']) }}
</div>
</div>
<div id="referred_div" @if($consultation->outcome_id != 4) style="display: none" @endif>
<div class="form-group">
{{ Form::label('referral_id',__('consultations.referred_to')) }}
<div class="input-group">
{{ Form::select('referral_id', $referrals, $consultation->referred_to, ['class' => 'form-control compulsory', 'id' => 'referral_hospital']) }}
</div>
<a class="pull-right" style="font-size: x-small" data-toggle="modal" data-target="#referralsmodal" >{{ __('triage.add_new') }}</a>
</div>
<hr>
<div id="referral_notes" class="form-group">
{{ Form::label('referral_notes', 'Referral Notes') }}
<textarea name="referral_notes" placeholder="Referral Notes" class="form-control" rows="5">{{ $consultation->referral_notes }}
</textarea>
</div>
</div>
<div id="internal_transfer_div" @if(get_name($consultation->outcome_id, "id", "slug", "outcomes") != "internal_transfer") style="display: none" @endif>
<div class="form-group">
{{ Form::label('current_clinic', __('patient_episode.current_clinic')) }}
{{ Form::hidden('internal_transfer_status', 0, ['id' => 'internal_transfer_status']) }}
{{ Form::hidden('current_clinic_id', $episode->clinic_id ?: 0, ['id' => 'current_clinic_id']) }}
{{ Form::hidden('current_triage_id', $triage ? $triage->id : 0, ['id' => 'current_triage_id']) }}
{{ Form::hidden('current_episode_id', $episode->id, ['id' => 'current_episode_id']) }}
{{ Form::hidden('current_patient_id', $episode->patient_id, ['id' => 'current_patient_id']) }}
{{ Form::text('current_clinic', $episode->clinic_id ? get_name($episode->clinic_id, 'id', 'name', 'clinics') : '', ['class' => 'form-control compulsory', 'readonly', 'id' => 'current_clinic_transfer']) }}
</div>
<div class="form-group">
{{ Form::label('transfer_to_clinic', __('patient_episode.transfer_to')) }}
{{ Form::select('transfer_to_clinic', $clinics, null, ['class' => 'form-control compulsory', 'required', 'id' => 'transfer_to']) }}
</div>
</div>
</div>
<div class="col-md-3">
@if(isset($consultation) && !is_null($consultation->updated_by))
{{ __('consultations.consultation_done_by') }} {!! isset($consultation) ? '<font style="color:blue; font-weight: bolder;"><b>'.\Streamline\Models\User::withTrashed()->find($consultation->updated_by)->first_name. " ".\Streamline\Models\User::withTrashed()->find($consultation->updated_by)->last_name.' on '.streamline_date_time($consultation->created_at).'</b></font>' : "" !!}
<br><br>
@else
{{ __('consultations.consultation_done_by') }} {!! isset($consultation) ? '<font style="color:blue; font-weight: bolder;"><b>'.\Streamline\Models\User::withTrashed()->find($consultation->created_by)->first_name. " ".\Streamline\Models\User::withTrashed()->find($consultation->created_by)->last_name.' on '.streamline_date_time($consultation->created_at).'</b></font>' : "" !!}
<br><br>
@endif
{{ Form::button(__('consultations.update_and_complete_consultation'),['class'=>'btn btn-success btn-block','value'=>'complete','name'=>'submit-btns', 'onclick'=>'return confirm_outcome()']) }}
<br><br>
{{ Form::button(__('consultations.save_consultation'),['type'=>'submit','class'=>'btn btn-default btn-block','name'=>'submit-btn','value'=>'save_consultation']) }}
</div>
</div>
</div>
{{ Form::close() }}
@include('patients::consultations.document.add')
@include('patients::consultations.add_diagnosis')
<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>
<div class="modal fade" id="confirm_diagnosis_modal" tabindex="-1" role="dialog" style="min-width: 400px;position: absolute;top: 80%;left: 10%;">
<div class="modal-dialog modal-dialog-centered" style="align-items: flex-end;" role="document">
<div class="modal-content">
<div class="modal-body form-group">
<h4 class="modal-title" id="exampleModalLabel1">{{ __('consultations.confirm_primary_diagnosis') }}</h4>
{{ Form::select('confirm_primary_diagnosis', $diagnoses, '', ['id'=>'confirm_primary_diagnosis','class' => 'form-control compulsory', 'required']) }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default mr-auto" data-dismiss="modal">{{ __('triage.cancel') }}</button>
<a class="btn btn-success" onclick="submit_after_confirmation()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
@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">
let symptom_max_rows = 20;
let symptom_wrapper = $(".symptoms_input_fields_wrap");
let symptom_counter = <?php echo $symptom_counter + 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 ?>;
$(symptom_wrapper).on("click", ".remove_field", function (e) {
e.preventDefault();
$(this).parent('td').parent('tr').remove();
symptom_counter--;
});
function add_symptom_row() {
if (symptom_counter < symptom_max_rows) {
$(symptom_wrapper).append("<tr>\
<td style='width: 20%;'>\
<select name='symptoms[]' id='symptoms_" + symptom_counter + "' class='form-control col-sm-12 compulsory' onchange='showSymptomPrompt(this.value, " + symptom_counter + ")' 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_" + symptom_counter + "' class='col-sm-12 form-control' required>\
</div>\
<div class='col-sm-9'>\
<select style='display: inline-block;' name='time[]' id='symptoms_time_" + symptom_counter + "' class='col-sm-12 form-control' required>@php echo $option_symptoms_periods; @endphp</select>\
</div>\
</div>\
</td>\
<td id='symptoms_prompt_" + symptom_counter + "' style='width: 30%'></td>\
<td id='symptoms_reference_" + symptom_counter + "'></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_'+symptom_counter);
$("#symptoms_"+symptom_counter).load('/symptoms/get_symptoms');
symptom_counter++;
}
}
function showSymptomPrompt(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));
}
});
}
$('.btn-block').click(function(e){
$(".procedure_performed").each(function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
if($('#procedure_performed_'+id).is(':checked')) {
if($('#procedure_performed_by_'+id).val() === "") {
alert('Please make sure you select the staff that has perfomed the procedure');
e.preventDefault();
}
}
});
$(".service_performed").each(function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
if($('#service_performed_'+id).is(':checked')) {
if($('#service_performed_by_'+id).val() === "") {
alert('Please make sure you select the staff that has perfomed the service');
e.preventDefault();
}
}
});
});
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));
}
});
}
function confirm_outcome(){
let outcome = $('#outcome').val();
if (outcome == "" || outcome == 7){ // 7 is assumed to be ongoing consultation
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();
let clinic_transfer_status = $('#internal_transfer_status').val();
let clinic_transfered_to = $('#transfer_to').val();
if (outcome == 1 && ward_id == ''){
alert("Please select a ward where the patient is going to be admitted");
return false;
} else if(clinic_transfer_status == 1 && clinic_transfered_to == 0){
alert("Please select a clinic where the patient is being transfered");
return false;
}
}
let prim_diag = $('#primary_diagnosis').val();
$('#confirm_primary_diagnosis').val(prim_diag).trigger('change');
$('#confirm_diagnosis_modal').modal('toggle');
}
function submitDiagnosis(){
var diagnosis_name = $("#diagnosis_name").val();
var icd10_code = $("#icd10_code").val();
var hmis_no_outpatient = $("#hmis_no_outpatient").val();
var hmis_no_inpatient = $("#hmis_no_inpatient").val();
var hmis_category = $("#hmis_category").val();
var diagnosis_prompts = $("#diagnosis_prompts").val();
var chronic_yes = $("#chronic_yes").val();
var chronic_no = $("#chronic_no").val();
var chronic_status = null;
if($('#chronic_yes').is(':checked')){
chronic_status = 1;
} else if($('#chronic_no').is(':checked')){
chronic_status = 0;
}
if ($("#diagnosis_name").val() === "" || !$("#diagnosis_name").val()) {
alert("Please make sure that you fill in a diagnosis name");
return false;
}
var data = {'diagnosis_name':diagnosis_name, 'icd10_code': icd10_code, 'hmis_no_outpatient': hmis_no_outpatient, 'hmis_no_inpatient': hmis_no_inpatient, 'hmis_category': hmis_category, 'diagnosis_prompts': diagnosis_prompts, chronic_status: 'chronic_status'};
$.ajax({
method: 'POST',
url: '/consultation/add_diagnosis',
data: data,
success: function(response){
if(!isNaN(response)){
//response = last inserted id
$('.primaryDiagnosis').append($('<option>', {
value: response,
text: diagnosis_name
}));
$('.primaryDiagnosis').val(response);//preselect the newly added referral
$('#diagnosisModal').modal('hide'); //manually hide the modal
} else {
alert("error occurred");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
function generalSelect2Set(id) {
$('#'+id).select2({
width: "100%"
});
}
$(document).ready(function() {
$('.initial_symptoms_select').select2({
width: "100%"
});
$('#outcome').click(function(e){
var outcome = $("#outcome :selected").val();
if (outcome == 1) { //1=admitted
$('#admitted_div').show();
$('#died_div').hide();
$('#internal_transfer_div').hide();
$('#internal_transfer_status').val(0);
}
else if (outcome == 5) { //5=died
$('#admitted_div').hide();
$('#died_div').show();
$('#internal_transfer_div').hide();
$('#internal_transfer_status').val(0);
}
else{
$('#admitted_div').hide();
$('#died_div').hide();
$('#internal_transfer_div').hide();
$('#internal_transfer_status').val(0);
}
//internal transfer
$.ajax({
url: '/get_outcome_slug/'+outcome,
data: {},
success: function(outcome_slug){
if (outcome_slug == "internal_transfer") {
$('#admitted_div').hide();
$('#home_with_followup_div').hide();
$('#referred_div').hide();
$('#died_div').hide();
$('#internal_transfer_div').show();
$('#internal_transfer_status').val(1);
}
},
error: function(response){
//
}
});
});
/* 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');
});
});
$('#primary_diagnosis, #confirm_primary_diagnosis, .procedure_performed_by').select2({
placeholder: "-- select --",
width: "100%"
});
//$(".sec_d:first-child").select2();
//$(".sec_d").click(function(){
//$(".sec_d:first-child").select2();
//});
$('.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*/
$('.sec_d>.select2-selection.select2-selection--single').css('border-left', '3px solid #aaa');
$('.select2-selection__arrow').css('top', '3px');
$("[id^='procedure_performed_']").on("change", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
if($('#procedure_performed_'+id).is(':checked')){
$("#procedure_performed_by_div_"+id).show();
$('#procedure_performed_by_'+id).addClass('compulsory');
$('#procedure_performed_by_'+id).prop('required', true);
}
else {
$("#procedure_performed_by_div_"+id).hide();
$('#procedure_performed_by_'+id).removeClass('compulsory');
$('#procedure_performed_by_'+id).prop('required', false);
$('#procedure_performed_by_'+id).val('');
}
});
$("[id^='service_performed_']").on("change", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
$("#service_performed_by_div_"+id).show();
});
let current_past_episode = 0;
function past_episode_row_details(id) {
$('.past_episode_row').hide();
if (current_past_episode !== id) {
$('#past_episode_row' + id).show();
current_past_episode = id;
} else {
current_past_episode = 0;
}
}
function submit_after_confirmation(){
let confirmed = $('#confirm_primary_diagnosis').val();
$('#primary_diagnosis').val(confirmed).trigger('change');
$("<input type='text' value='complete' />").attr("id", "complete_consultation").attr("name", "submit-btn").appendTo("#consultation_edit_form");
$('#consultation_edit_form').submit();
}
</script>
@endpush