Files
streamline-emr/docker/streamline-src/Modules/Patients/Resources/views/consultations/show.blade.php
T

1655 lines
105 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" />
@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.view_consultation_details') }}</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();
$parent_consultation_notes = \Streamline\Models\WardInpatientDetailedNote::where(['patient_id' => $episode->patient_id, 'episode_id' => $episode->parent_episode_id, 'ward_id' => 0])->get();
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
<div class="row">
<div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
<div class="row">
<div class="col-md-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">{{ __('consultations.triage_details') }}</a>
</h4>
</div>
<div id="collapse_triage">
<div class="panel-body table-bordered">
<div style="margin: 20px;">
<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>T{{ __('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>
<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
</thead>
<tbody>
@php $counter = 0; @endphp
@foreach($observations_array as $observation)
@php
$item_array = explode('=', $observation); //i.e[temp,44]
$counter++;
@endphp
@if($counter < 9)
<tr>
<td>{{ $item_array[0] }}</td>
<td>{{ $item_array[1] }}</td>
<!-- show details of past triage of original episode -->
@if(check_if_episode_is_a_followup($episode->id))
@foreach($parent_observation_array as $parent_observation)
@php
$parent_item_array = isset($parent_triage_details) ? explode('=', $parent_observation) : [];
@endphp
@if($item_array[0] == $parent_item_array[0])
<td>
{{ $parent_item_array[1] }}
</td>
@endif
@endforeach
@endif
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
<div class="col-md-6">
<table class="table color-bordered-table success-bordered-table">
<thead>
<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
</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;">'.$users[$triage->created_by].' on '.streamline_date_time($triage->created_at).'</font>' : "" !!}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 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">{{ __('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;
@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>
</tr>
</thead>
<tbody>
@foreach($used_services as $service)
@php
$service_ids = explode(",", $service->service_id);
$service_quantity = explode(",", $service->quantity);
@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>
</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(are_symptoms_on_consultation())
<div class="white-box">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th>{{ __('triage.symptoms') }}</th>
<th>{{ __('triage.duration') }}</th>
</tr>
</thead>
<tbody>
<tr>
@php
$symptoms_explode = explode(",", $consultation->symptoms);
$duration_explode = explode(",", $consultation->symptom_duration);
@endphp
@for ($i = 0; $i < count($symptoms_explode); $i++)
<tr>
<td>{{ $symptoms[$symptoms_explode[$i]] ?? '' }}</td>
<td>{{ $duration_explode[$i] ?? '' }}</td>
</tr>
@endfor
</tr>
</tbody>
</table>
</div>
@endif
@if($is_mental_health_clinic)
<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>{{ isset($mental_health_consultation->hallucinations) ? $mental_health_consultation->hallucinations : 'N/A' }}</td>
</tr>
<tr>
<th>{{ __('consultations.delusions') }}</th>
<td>{{ isset($mental_health_consultation->delusions) ? $mental_health_consultation->delusions : 'N/A' }}</td>
</tr>
<tr>
<th>{{ __('consultations.disorganised_speech') }}</th>
<td>{{ isset($mental_health_consultation->disorganised_speech) ? $mental_health_consultation->disorganised_speech : 'N/A' }}</td>
</tr>
<tr>
<th>{{ __('consultations.abnormal_phychomotor_behaviour') }}</th>
<td>{{ isset($mental_health_consultation->abnormal_psychomotor_behaviour) ? $mental_health_consultation->abnormal_psychomotor_behaviour : 'N/A' }}</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>{{ isset($mental_health_consultation->impaired_cognition) ? $mental_health_consultation->impaired_cognition : 'N/A' }}</td>
</tr>
<tr>
<th>{{ __('consultations.depression') }}</th>
<td>{{ isset($mental_health_consultation->depression) ? $mental_health_consultation->depression : 'N/A' }}</td>
</tr>
<tr>
<th>{{ __('consultations.mania') }}</th>
<td>{{ isset($mental_health_consultation->mania) ? $mental_health_consultation->mania : 'N/A' }}</td>
</tr>
<tr>
<th>{{ __('consultations.hamilton_anxiety_score') }}</th>
<td>{{ isset($mental_health_consultation->hamilton_anxiety_score) ? $mental_health_consultation->hamilton_anxiety_score : 'N/A' }}</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>{{ isset($mental_health_consultation->alcohol_screening_score) ? $mental_health_consultation->alcohol_screening_score : 'N/A' }}</td>
</tr>
</table>
</div>
<div class="col-md-4">
<table class="table table-striped table-bordered">
<tr>
<th><th>{{ __('consultations.satisfaction_score') }}</th></th>
<td></td>
</tr>
<tr>
<th>{{ __('consultations.patient') }}</th>
<td>{{ isset($mental_health_consultation->patient_satisfaction_score) ? $mental_health_consultation->patient_satisfaction_score : 'N/A' }}</td>
</tr>
<tr>
<th>{{ __('consultations.care_giver') }}</th>
<td>{{ isset($mental_health_consultation->caregiver_satisfaction_score) ? $mental_health_consultation->caregiver_satisfaction_score : 'N/A' }}</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 (is_tuberculosis_screening_enabled())
@include('patients::consultations.tb_screening')
@endif
<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>({{ __('consultations.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>
@endif
<tr>
<td style="width: 30%;">
<h4>{{ isset($diagnoses[$consultation->primary_diagnosis]) ? $diagnoses[$consultation->primary_diagnosis] : "" }}</h4>
</td>
<td style="width: 30%; color: #C85F6A;"><div class="well well-sm" id="primary_diagnosis_prompt">{{ is_object($diagnoses_all) && isset($consultation->primary_diagnosis) ? $diagnoses_all->firstWhere('id',$consultation->primary_diagnosis)->prompts : null }}&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>
<tr>
</tbody>
</table>
</div>
</div>
<div class="white-box">
<div class="panel-wrapper collapse in table-responsive table-condensed">
<table class="table table-hover color-table success-table table-bordered" id="other_diagnosis_table">
<thead>
<tr>
<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) && $other_diagnoses[0] != "")
@foreach($other_diagnoses as $diagnosis)
@if($diagnosis != "")
<tr>
<td style="width: 30%;">
<h4>{{ $diagnoses[$diagnosis] }}</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($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
@endforeach
@else
<tr>
<td colspan="3" class="text-center">No other diagnoses available</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="white-box">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th>RDT</th>
<th>RBS</th>
</tr>
</thead>
<tbody>
<tr>
<td>
@if($consultation->rdt === 1)
<label for="rdt_neg">POSITIVE</label>
@elseif($consultation->rdt === 0)
<label for="rdt_neg">NEGATIVE</label>
@elseif($consultation->rdt === null)
<label for="rdt_unknown">UNKNOWN</label>
@endif
</td>
<td>{{ $consultation->rbs }}</td>
</tr>
</tbody>
</table>
</div>
@if($consultation_with_notes)
<div class="white-box">
<h4 class="text-center">Previously Added Consultation Notes</h4>
<div class="row">
<div class="col table-responsive">
<table class="table table-hover color-table success-table table-bordered" style="table-layout:fixed;">
<thead>
<tr>
<th>{{ __('consultations.history') }}</th>
<th>{{ __('consultations.clinical_examination') }}</th>
<th>{{ __('consultations.investigation_and_mgt_plan') }}</th>
<th>{{ __('consultations.date') }}</th>
</tr>
</thead>
<tbody>
@forelse ($consultation_notes as $consultation_note)
<tr>
<td style="word-wrap:break-word;">{{ $consultation_note->history_comments }}</td>
<td style="word-wrap:break-word;">{{ $consultation_note->clinic_examination_comments }}</td>
<td style="word-wrap:break-word;">{{ $consultation_note->investigation_and_management_plan_comments}}</td>
<td style="word-wrap:break-word;">{{ streamline_date_time($consultation_note->created_at) }} <br> by {{ $users[$consultation_note->created_by]?? '' }}</td>
</tr>
@empty
<tr><td colspan="4"><code>No previously added consultation notes.</code></td></tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
@if(check_if_episode_is_a_followup($episode->id) && !empty($parent_consultation_notes))
<div class="white-box">
<div class="row">
<div class="col table-responsive">
<table class="table table-hover color-table success-table table-bordered" style="table-layout:fixed;">
<thead>
<tr><th colspan="4">Previously Added Consultation Notes {{ __('consultations.for_episode_of') }} {{ streamline_date($parent_consultation_details->created_at) }}</th></tr>
<tr>
<th>{{ __('consultations.history') }}</th>
<th>{{ __('consultations.clinical_examination') }}</th>
<th>{{ __('consultations.investigation_and_mgt_plan') }}</th>
<th>{{ __('consultations.date') }}</th>
</tr>
</thead>
<tbody>
@forelse ($parent_consultation_notes as $consultation_note)
<tr>
<td style="word-wrap:break-word;">{{ $consultation_note->history_comments }}</td>
<td style="word-wrap:break-word;">{{ $consultation_note->clinic_examination_comments }}</td>
<td style="word-wrap:break-word;">{{ $consultation_note->investigation_and_management_plan_comments}}</td>
<td style="word-wrap:break-word;">{{ streamline_date_time($consultation_note->created_at) }} <br> by {{ $users[$consultation_note->created_by]?? '' }}</td>
</tr>
@empty
<tr><td colspan="4"><code>No previously added consultation notes {{ __('consultations.for_episode_of') }} {{ streamline_date($parent_consultation_details->created_at) }}.</code></td></tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
@endif
{{-- <div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th>{{ __('consultations.history') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{!! ($consultation->history_comments) ? nl2br(e($consultation->history_comments)) : "No comments available" !!}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div> --}}
@endif
<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="5"><font color="green"><b>{{ __('consultations.investigation_for_episode_of') }}f {{ 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>
{{ $investigation->normal_ranges }}
</td>
<td>
{!! $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="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
<tr>
<td colspan="5"></td>
</tr>
@elseif(count($grand_parent_episode_ordered_investigations) > 0)
<tr>
<td colspan="5"><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>
{{ $investigation->normal_ranges }}
</td>
<td><font color="orange">{{ __('consultations.pending') }}</font></td>
<td>
{{ $investigation->comments }}
</td>
</tr>
@endfor
@endforeach
<tr>
<td colspan="5"></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>
{{ $investigation->normal_ranges }}
</td>
<td>
{!! $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="3">{{ __('consultations.authenticated_by') }}y</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>
{{ $investigation->normal_ranges }}
</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="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">
<span @if(!isset($cardio_echo)) style="display: none;" @endif>
<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>
</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($per_investigation_array[$i] == 0)
<font color="orange">{{ __("consultations.pending") }}</font>
@else
{{ isset($results_values[$i]) ? $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]) && $per_investigation_array[$i] != 0)
{{ $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-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>
@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="4"><code>{{ __('consultations.investigation_not_ordered') }}</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)
<tr>
<td colspan="2"><font color="green"><b>{{ __('consultations.sundries_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}</b></font></td>
</tr>
@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>
</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>
</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="3"><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>
</tr>
@php $parent_count++; @endphp
@endfor
@endforeach
@endif
<!-- end catering for a review episode -->
@if(count($ordered_procedures) > 0)
@php $count = 1; @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);
@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>
</tr>
@php $count++; @endphp
@endfor
@endforeach
@else
<tr>
<td colspan="4"><code>{{ __('consultations.no_procedure_has_been_ordered') }} {{ check_if_episode_is_a_followup($episode->id) ? __('consultations.during_current_review') : '' }}.</code></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-md-4">
<h4>{{ __('consultations.outcome') }}</h4>
<table class="table table-primary">
<tbody>
<tr>
@if($consultation->outcome_id == 1) <!-- admitted -->
<td>{{ get_name($consultation->outcome_id, 'id', 'name', 'outcomes') }}</td>
<td>{{ get_name($consultation->ward_id, 'id', 'name', 'wards') }}</td>
@elseif($consultation->outcome_id == 4) <!-- referred -->
<td>{{ get_name($consultation->outcome_id, 'id', 'name', 'outcomes') }}</td>
<td>
{{ get_name($consultation->referred_to, 'id', 'name', 'referral_hospitals') }}
<br><br>
<a target="_blank" href="/opd_referral_notes_print/{{$patient_id}}/{{$episode_id}}" style="color: blue; font-size: 20px;"><u>View referral notes</u></a>
</td>
@elseif($consultation->outcome_id == 3) <!-- home with follow up -->
<td>{{ get_name($consultation->outcome_id, 'id', 'name', 'outcomes') }}</td>
<td>{{ $consultation->followup_where }}</td>
<td>{{ streamline_date($consultation->followup_when) }}</td>
@else
<td>{{ get_name($consultation->outcome_id, 'id', 'name', 'outcomes') }}</td>
@endif
</tr>
</tbody>
</table>
</div>
<div class="col-md-4">
@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
@if(!$consultation_with_notes)
<h4>Consultation Comments</h4>
@if($consultation->comments)
{{ $consultation->comments }}
@else
N/A
@endif
@endif
</div>
<div class="col-md-4">
<h4>{{ __('consultations.consultation_started_by') }}</h4>
<span style="color: #009933; display: inline">
{!! "<b>".get_name($consultation->created_by, 'id', 'first_name', 'users')."</b>" !!} {!! "<b>".get_name($consultation->created_by, "id", 'last_name', "users")."</b>" !!} on {{ streamline_date_time($consultation->created_at) }}
</span>
<br><br>
@if(!is_null($consultation->updated_by))
<h4>{{ __('consultations.consultation_completed_by') }}</h4>
<span style="color: #009933; display: inline">
{!! "<b>".get_name($consultation->updated_by, 'id', 'first_name', 'users')."</b>" !!} {!! "<b>".get_name($consultation->updated_by, "id", 'last_name', "users")."</b>" !!} on {{ streamline_date_time($consultation->updated_at) }}
</span>
@endif
<br><br>
@if(Auth::user()->can('edit-patient-consultation'))
<a href="{{ url('edit_patient_consultation') }}" class="btn btn-success"> {{ __('consultations.modify_consultation') }} </a>
@endif
</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>
<script type="text/javascript">
$(document).ready(function() {
$('#outcome').click(function(e){
var outcome = $("#outcome :selected").val();
if (outcome == 1) { //1=admitted
$('#admitted_div').show();
}
else{
$('#admitted_div').hide();
}
});
})
</script>
@endpush