@extends('layouts.main') @push('scripts') @endpush @push('styles') @endpush @section('content')
@if(!$is_mental_health_clinic)

{{ __('consultations.add_consultation') }}

@else

{{ __('consultations.mental_health_consultations') }}

@endif
@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
@include('patients::allergies.header')

@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 @if(count($past_episodes_info) > 0)

Previous Consultations (Upto latest 5 consultations with a diagnosis)

@foreach($past_episodes_info as $past_episode) @endforeach
Date Clinic Primary Diagnosis Other Diagnoses Consultation By
{{ $past_episode['start_date'] }}
@if(check_if_episode_is_a_followup($past_episode["episode_id"]))
({{ __('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')) }})
@endif
{{ $past_episode['clinic'] }} {{ get_name($past_episode['primary_diagnosis'], 'id', 'name', 'diagnoses') }} @if(count($past_episode['other_diagnoses']) > 0 && !(count($past_episode["other_diagnoses"]) == 1 && $past_episode["other_diagnoses"][0] == null))
    @foreach($past_episode['other_diagnoses'] as $value)
  • {{ get_name($value, 'id', 'name', 'diagnoses') }}
  • @endforeach
@endif
{{ $past_episode['doctor'] }} Details
@endif
{{ __('consultations.triage_grade') }} : @if($triage) @switch($triage->severe_grade) @case (1)
{{ __('consultations.green') }}
@break @case (2)
{{ __('consultations.yellow') }}
@break @case (3)
{{ __('consultations.red') }}
@break @default {{ __('consultations.triage_grade_not_determined') }} @endswitch @endif
{{ __('consultations.symptoms') }} : @if($triage) @php $symptoms_array = explode(",", $triage->symptoms); @endphp @php $symptoms_duration_array = explode(",", $triage->symptom_duration); @endphp
@php $counter = 0; @endphp @for($i = 0; $i < count($symptoms_array); $i++) @endfor
{{ __('consultations.symptom') }} {{ __('consultations.duration') }}
{{ isset($symptoms[$symptoms_array[$i]]) ? $symptoms[$symptoms_array[$i]] : "" }} {{ isset($symptoms_duration_array[$i]) ? $symptoms_duration_array[$i] : "" }}
@else {{ __('consultations.no_symptom_recorded') }} @endif

@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
@if(check_if_episode_is_a_followup($episode->id)) @endif @php $counter = 0; @endphp @foreach($observations_array as $observation) @php $item_array = explode('=', $observation); //i.e[temp,44] $counter++; @endphp @if($counter < 9) @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]) @endif @endforeach @endif @endif @endforeach
{{ __('consultations.observation') }} {{ __('consultations.value') }} {{ __('consultations.previous_value') }}
{{ $item_array[0] }} {{ $item_array[1] }} {{ $parent_item_array[1] }}
@if(check_if_episode_is_a_followup($episode->id)) @endif @php $counter=0; @endphp @foreach($observations_array as $observation) @php $item_array = explode('=', $observation); //i.e[temp,44] $counter++; @endphp @if($counter >= 9) @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]) @endif @endforeach @endif @endif @endforeach
{{ __('consultations.observation') }} {{ __('consultations.value') }} {{ __('consultations.previous_value') }}
{{ isset($item_array[0]) ? $item_array[0] : "" }} {{ isset($item_array[1]) ? $item_array[1] : "" }} {{ $parent_item_array[1] }}

@php $nutrition = DB::table('triage_nutrition')->where('patient_id', $patient_id)->where('episode_id', $episode_id)->first(); @endphp @if(is_smart_triage_enabled() && $nutrition)

Nutritional Status

{{ $nutrition->text }} {{ $nutrition->reason }}
@endif
{{ __('consultations.comment') }}: {{ !is_null($triage) ? $triage->comments : "" }}
@else {{ __('consultations.no_observations_recorded') }}
@endif {{ __('consultations.triage_done_by') }} {!! isset($triage) ? ''.\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).'' : "" !!}
@if(count($documents) > 0) @foreach($documents as $document)
  • {{ is_null($document->title) ? substr($document->description, 0, 5) : $document->title }} ({{ streamline_date_time($document->created_at) }})
  • @endforeach @else {{ __('consultations.no_patient_documents_available') }} @endif
    {{ __('consultations.add_new') }}
    @php $used_services = \Streamline\Models\OrderedService::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get(); $service_performed_counter = 0; @endphp @if(count($used_services) > 0)
    @foreach($used_services as $service) @php $service_ids = explode(",", $service->service_id); $service_quantity = explode(",", $service->quantity); $service_performed = explode(",", $service->performed); $service_performed_id_array = explode(",", $service->performed_id); @endphp @for($i = 0; $i < count($service_ids); $i++) @endfor @endforeach
    {{ __('consultations.service') }} {{ __('consultations.quantity') }} {{ __('consultations.payment_status') }} Performed By
    {{ get_name($service_ids[$i], "id", "name", "services")}} {{ $service_quantity[$i] }} {!! $service->payment_status == 0 ? "Not Paid" : "Paid" !!} @if($service_performed[$i] == 0) {{ 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) }} @php $service_performed_counter++ @endphp @else By {{ get_full_name(get_name($service_performed_id_array[$i], 'id', 'performed_by', 'staff_performed_services'), 'id', 'first_name', 'last_name', 'users') }} @endif
    @else {{ __('consultations.no_used_services') }} @endif
    {{-- Display TB screening takend from triage --}} @if (is_tuberculosis_screening_enabled())
    @if($triage) @if ($triage->any_tb_sysmptoms == 1)
    A cough for more than two weeks ? {{ $triage->cough_for_2_weeks == 1 ? "Yes" : "No" }}
    Persistent fevers for 2 weeks or more ? {{ $triage->fever_for_2_weeks == 1 ? "Yes" : "No" }}
    Noticeable weight loss of more than 3 Kg? {{ $triage->tb_weight_loss == 1 ? "Yes" : "No" }}
    Poor weight gain in the last one month ? {{ $triage->tb_poor_weight_gain == 1 ? "Yes" : "No" }}
    Excessive night sweats for three weeks or more ? {{ $triage->tb_excessive_night_sweats == 1 ? "Yes" : "No" }}
    Contact with a person with pulmonary TB or chronic cough ? {{ $triage->tb_contact_with_tb_person == 1 ? "Yes" : "No" }}
    @endif @endif
    @endif {{-- end of tb details --}}
    {{ Form::open(['route' => 'consultation.store','data-toggle'=>'validator', 'id'=>'consultation_form']) }} @php $option_symptoms = ""; $option_symptoms_periods = ""; @endphp @if(are_symptoms_on_consultation())
    @php foreach ($symptoms as $key => $value){ $option_symptoms .= ""; } foreach ($symptoms_periods as $key => $value){ $option_symptoms_periods .= ""; } @endphp
    {{ __('triage.symptoms') }} @if( Auth::user()->can('symptom-create')){{ __('triage.add_new') }} @endif {{ __('triage.duration') }} {{ __('triage.prompt') }} {{ __('triage.reference_text') }}
    {{ __('triage.add_row') }}
    @endif @if($is_mental_health_clinic) {{ Form::hidden('mental_health_clinic', 1) }}
    {{ __('consultations.psychosis_symptom_scores') }}
    {{ __('consultations.hallucinations') }} {{ Form::number('hallucinations', '', ['class' => 'form-control']) }}
    {{ __('consultations.delusions') }} {{ Form::number('delusions', '', ['class' => 'form-control']) }}
    {{ __('consultations.disorganised_speech') }} {{ Form::number('disorganised_speech', '', ['class' => 'form-control']) }}
    {{ __('consultations.abnormal_phychomotor_behaviour') }} {{ Form::number('abnormal_psychomotor_behaviour', '', ['class' => 'form-control']) }}
    {{ __('consultations.negative_symptoms') }}
    {{ __('consultations.impaired_cognition') }} {{ Form::number('impaired_cognition', '', ['class' => 'form-control']) }}
    {{ __('consultations.depression') }} {{ Form::number('depression', '', ['class' => 'form-control']) }}
    {{ __('consultations.mania') }} {{ Form::number('mania', '', ['class' => 'form-control']) }}
    {{ __('consultations.hamilton_anxiety_score') }} {{ Form::number('hamilton_anxiety_score', '', ['class' => 'form-control']) }}

    {{ __('consultations.hamilton_anxiety_score') }}

    0-17 = no / mild anxiety

    18-24 = mild to moderate anxiety

    25-30 = moderate to severe anxiety

    {{ __('consultations.alcohol_score') }}
    {{ __('consultations.total_score') }} {{ Form::number('alcohol_screening_score', '', ['class' => 'form-control']) }}
    {{ __('consultations.satisfaction_score') }}
    {{ __('consultations.patient') }} {{ Form::number('patient_satisfaction_score', '', ['class' => 'form-control']) }}
    {{ __('consultations.care_giver') }} {{ Form::number('caregiver_satisfaction_score', '', ['class' => 'form-control']) }}

    {{ __('consultations.alcohol_screening_score') }}

    1-7 = {{ __('consultations.low_risk') }}

    8-19 = {{ __('consultations.harmful_drinking') }}

    20 or above = {{ __('consultations.likely_dependency') }}

    @endif @if($consultation_with_notes)
    @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 History {{ __('consultations.for_episode_of') }} {{ streamline_date($parent_consultation_details->created_at) }}
    {{ __('consultations.clinical_examination') }} {{ __('consultations.for_episode_of') }} {{ streamline_date($parent_consultation_details->created_at) }}
    {{ __('consultations.investigation_and_mgt_plan') }} {{ __('consultations.for_episode_of') }} {{ streamline_date($parent_consultation_details->created_at) }}
    @endif

    {{ __('consultations.history') }}

    {{ __('consultations.clinical_examination') }}

    {{ __('consultations.investigation_and_mgt_plan') }}

    @endif @if (is_tuberculosis_screening_enabled()) @include('patients::consultations.tb_screening') @endif
    @if(check_if_episode_is_a_followup($episode->id) && !is_null($parent_consultation_details)) @else @endif @if( Auth::user()->can('add-new-diagnosis-from-consultation')) @endif
    {{ __('consultations.PRIMARY_DIAGNOSIS') }} {{ __('consultations.PROMPT') }} {{ __('consultations.REFERENCES') }}
    {{ Form::select('primary_diagnosis', $diagnoses, $parent_consultation_details->primary_diagnosis, ['id'=>'primary_diagnosis', 'class' => 'form-control col-sm-12 compulsory']) }}

    (As diagnosed on {{ streamline_date($parent_episode_details->created_at) }})
    {{ $diagnoses_all->firstWhere('id',$parent_consultation_details->primary_diagnosis)->prompts }} 
    @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])) {{ $reference_names[$i] }} | @endif @endfor @endif
    {{ Form::select('primary_diagnosis', $diagnoses, '', ['id'=>'primary_diagnosis','class' => 'form-control col-sm-12 compulsory primaryDiagnosis', 'required', 'onchange' => 'get_diagnosis_info(this.value)']) }}
     
     
    {{ __('consultations.add_new_diagnosis') }}
    @php $option_diagnoses = ""; foreach ($diagnoses as $key => $value){ $option_diagnoses .= ""; } @endphp
    {{ __('consultations.OTHER_DIAGNOSIS') }} {{ __('consultations.PROMPT') }} {{ __('consultations.REFERENCES') }}
     
     
    {{ __('consultations.add_row') }}
    RDT RBS
    {{ Form::checkbox('rdt', 1, false, ['id'=>'rdt_pos']) }} {{ Form::checkbox('rdt', 0, false, ['id'=>'rdt_neg']) }} {{ Form::text('rbs','',['class'=>'form-control', 'placeholder'=>'(mm/l)']) }}
    @if (is_add_attendance_to_consultation_enabled())
    {{ Form::label('attendance',__('triage.re_attendance_or_new')) }}
    {{ Form::radio('attendance', 1, false, ["required"]) }} {{ __('triage.new_attendance') }}    {{ Form::radio('attendance', 2, false, ["required"]) }} {{ __('triage.re_attendance') }}
    @endif

    {{ __('consultations.ordered_investigations') }}

    @if($episode_has_grand_parent_episode) @if(count($grand_parent_episode_investigation_results) > 0) @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]); @endphp @if($investigation) @endif @endfor @endforeach @elseif(count($grand_parent_episode_ordered_investigations) > 0) @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]); @endphp @if($investigation) @endif @endfor @endforeach @endif @endif @if(count($parent_episode_investigation_results) > 0) @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]); @endphp @if($investigation) @endif @endfor @endforeach @elseif(count($parent_episode_ordered_investigations) > 0) @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]); @endphp @if($investigation) @endif @endfor @endforeach @endif @php $set_order_ids = []; @endphp @if(count($investigation_results) > 0) @if(check_if_episode_is_a_followup($episode->id)) @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); $set_order_ids[] = $result->order_id; @endphp @for($i = 0 ; $i < count($investigation_ids_array) ; $i++) @php $investigation = \Streamline\Models\Investigation::withTrashed()->find($investigation_ids_array[$i]); @endphp @if($investigation) @if($investigation->type == 1 && isset($results_values[$i])) @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++) @endfor @endif @elseif($investigation->slug == 'echo' && $results_values[$i] == "") @else @endif @endif @endfor @endforeach @endif @if(count($ordered_investigations) > 0) @if(check_if_episode_is_a_followup($episode->id)) @endif @foreach($ordered_investigations as $investigation) @php $investigation_ids_array = explode(',', $investigation->investigation_id); if (in_array($investigation->id, $set_order_ids)) { continue; } @endphp @for($i = 0 ; $i < count($investigation_ids_array) ; $i++) @php $investigation = \Streamline\Models\Investigation::withTrashed()->find($investigation_ids_array[$i]); @endphp @if($investigation) @if($investigation->slug == 'echo') @else @endif @endif @endfor @endforeach @endif @if(!(count($ordered_investigations) > 0 || count($investigation_results) > 0)) @endif
    {{ __('investigations.investigation_name') }} {{ __('investigations.results') }} {{ __('investigations.normal_ranges') }} {{ __('investigations.unit') }} {{ __('investigations.comment') }}
    {{ __('consultations.investigation_for_episode_of') }} {{ streamline_date($grand_parent_episode_details->created_at) }}
    @if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) {{ $investigation->name }} @else {{ $investigation->name }} @endif @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 {!! $per_investigation_array[$i] == 0 ? '{{ __("consultations.pending") }}' : $results_values[$i] !!} {!! $per_investigation_array[$i] == 0 ? '{{ __("consultations.pending") }}' : ($comments[$i] ?? '') !!}
    {{ __('consultations.authenticated_by') }}{{ get_name($result->authenticated_by, 'id', 'first_name', 'users')}} {{ get_name($result->authenticated_by, 'id', 'last_name', 'users')}}
    {{ __('consultations.investigation_for_episode_of') }} {{ streamline_date($grand_parent_episode_details->created_at) }}
    @if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) {{ $investigation->name }} @else {{ $investigation->name }} @endif @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 {{ __('consultations.pending') }} {{ $investigation->comments }}
    {{ __('consultations.investigation_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}
    @if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) {{ $investigation->name }} @else {{ $investigation->name }} @endif @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 {!! $per_investigation_array[$i] == 0 ? '{{ __("consultations.pending") }}' : $results_values[$i] !!} {!! $per_investigation_array[$i] == 0 ? '{{ __("consultations.pending") }}' : $comments[$i] !!}
    {{ __('consultations.authenticated_by') }}{{ get_name($result->authenticated_by, 'id', 'first_name', 'users')}} {{ get_name($result->authenticated_by, 'id', 'last_name', 'users')}}
    {{ __('consultations.investigation_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}
    @if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) {{ $investigation->name }} @else {{ $investigation->name }} @endif @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 {{ __('consultations.pending') }} {{ $investigation->comments }}
    {{ __('consultations.investigation_for_review') }} ({{ streamline_date($episode->created_at)}})
    @if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) {{ $investigation->name }} @else {{ $investigation->name }} @endif
    {{ get_name($variable_id_array[$x], 'id', 'name', 'investigation_specialised_variables') }} {{ $variable_value_array[$x] }} @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 @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 {{ $variable_comment_array[$x] }}
    @if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) {{ $investigation->name }} @else {{ $investigation->name }} @endif View Results
    @if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) {{ $investigation->name }} @else {{ $investigation->name }} @endif @if($per_investigation_array[$i] == 0) {{ __("consultations.pending") }} @else {!! isset($results_values[$i]) ? nl2br(e($results_values[$i])) : "" !!} @endif @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 {{ get_name(get_name($investigation->id, 'id', 'units', 'investigations'),'id', 'name', 'unit_of_measure') }} {!! $per_investigation_array[$i] == 0 ? '{{ __("consultations.pending") }}' : $comments[$i] !!}
    {{ __('consultations.authenticated_by') }}{{ get_name($result->authenticated_by, 'id', 'first_name', 'users')}} {{ get_name($result->authenticated_by, 'id', 'last_name', 'users')}}
    {{ __('consultations.investigation_for_review') }} ({{ streamline_date($episode->created_at)}})
    @if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) {{ $investigation->name }} @else {{ $investigation->name }} @endif @if(($cardio_echo)) View results @else Pending @endif
    @if($investigation->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) {{ $investigation->name }} @else {{ $investigation->name }} @endif {{ __('consultations.pending') }} @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 {{ $investigation->comments }}
    {{ __('consultations.investigation_not_ordered') }} {{ check_if_episode_is_a_followup($episode->id) ? __('consultations.during_current_review') : '' }}.

    {{ __('consultations.ordered_sundries') }}

    @if($episode_has_grand_parent_episode) @if(count($grand_parent_episode_ordered_sundries) > 0) @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++) @endfor @endforeach @endif @endif @if(count($parent_episode_ordered_sundries) > 0) @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++) @endfor @endforeach @endif @if(count($ordered_sundries) > 0) @if(check_if_episode_is_a_followup($episode->id)) @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++) @endfor @endforeach @else @endif
    {{ __('consultations.SUNDRY') }} {{ __('consultations.QUANTITY') }}
    {{ __('consultations.sundries_for_episode_of') }} {{ streamline_date($grand_parent_episode_details->created_at) }}
    {{ get_name($sundry_ids[$i], 'id', 'name', 'sundries') }} {!! $sundry_quantity[$i] !!}
    {{ __('consultations.sundries_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}
    {{ get_name($sundry_ids[$i], 'id', 'name', 'sundries') }} {!! $sundry_quantity[$i] !!}
    {{ __('consultations.sundries_for_episode_review') }} ({{ streamline_date($episode->created_at)}})
    {{ get_name($sundry_ids[$i], 'id', 'name', 'sundries') }} {!! $sundry_quantity[$i] !!}
    {{ __('consultations.no_sundries_ordered') }} {{ check_if_episode_is_a_followup($episode->id) ? __('consultations.during_current_review') : '' }}.

    {{ __('consultations.treatment_given') }}

    @if($episode_has_grand_parent_episode) @if(count($grand_parent_episode_treatments) > 0) @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 = "" . $unit . ""; $dose2 = (empty($dosage2_array[$x])) ? "" : " | " . $dosage2_array[$x] . $drug_unit; @endphp @if(isset($purchased_elsewhere_array[$x]) && $purchased_elsewhere_array[$x] == 1) @else @if($treatment->dispense_status == 1) @else @endif @endif @endfor @endforeach @endif @endif @if(count($parent_episode_treatments) > 0) @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 = "" . $unit . ""; $dose2 = (empty($dosage2_array[$x])) ? "" : " | " . $dosage2_array[$x] . $drug_unit; @endphp @if(isset($purchased_elsewhere_array[$x]) && $purchased_elsewhere_array[$x] == 1) @else @if($treatment->dispense_status == 1) @else @endif @endif @endfor @endforeach @endif @if(count($treatments) > 0) @if(check_if_episode_is_a_followup($episode->id)) @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 = "" . $unit . ""; $dose2 = (empty($dosage2_array[$x])) ? "" : " | " . $dosage2_array[$x] . $drug_unit; @endphp @if(isset($purchased_elsewhere_array[$x]) && $purchased_elsewhere_array[$x] == 1) @else @if($treatment->dispense_status == 1) @else @endif @endif @endfor @endforeach @else @endif
    {{ __('consultations.DRUG_NAME') }} {{ __('consultations.DOSAGE') }} {{ __('consultations.DURATION') }} {{ __('consultations.QUANTITY') }} {{ __('consultations.STATUS') }} {{ __('consultations.INSTRUCTION') }}
    {{ __('consultations.treatment_for_episode_of') }} {{ streamline_date($grand_parent_episode_details->created_at) }}
    {{ get_name($drugs_array[$x], 'id', "name", 'drugs') }} {{ $dosage_array[$x] }} {!! $drug_unit !!} {{ $dose2 }}    {{ $frequency_name }} {{ isset($duration_array[$x]) ? $duration_array[$x] : "" }} {{ isset($quantity_dispensed_array[$x]) ? $quantity_dispensed_array[$x] : 0 }}Purchased From Elsewhere{{ __('consultations.dispensed') }}{{ __('consultations.pending') }} {{ isset($instructions_array[$x]) ? trim($instructions_array[$x]) : 'N/A' }}
    {{ __('consultations.treatment_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}
    {{ get_name($drugs_array[$x], 'id', "name", 'drugs') }} {{ $dosage_array[$x] }} {!! $drug_unit !!} {{ $dose2 }}    {{ $frequency_name }} {{ isset($duration_array[$x]) ? $duration_array[$x] : "" }} {{ isset($quantity_dispensed_array[$x]) ? $quantity_dispensed_array[$x] : 0 }}Purchased From Elsewhere{{ __('consultations.dispensed') }}{{ __('consultations.pending') }} {{ isset($instructions_array[$x]) ? trim($instructions_array[$x]) : 'N/A' }}
    {{ __('consultations.treatment_for_episode_review') }} ({{ streamline_date($episode->created_at)}})
    {{ get_name($drugs_array[$x], 'id', "name", 'drugs') }} @if($treatment->is_treatment_progressive != 0) (Progressive Treatment) @endif {{ $dosage_array[$x] }} {!! $drug_unit !!} {{ $dose2 }}    {{ $frequency_name }} {{ isset($duration_array[$x]) ? $duration_array[$x] : "" }} {{ isset($quantity_dispensed_array[$x]) ? $quantity_dispensed_array[$x] : 0 }}Purchased From Elsewhere{{ __('consultations.dispensed') }}{{ __('consultations.pending') }} {{ isset($instructions_array[$x]) ? trim($instructions_array[$x]) : 'N/A' }}
    {{ __('consultations.no_prescription_made_yet') }} {{ check_if_episode_is_a_followup($episode->id) ? 'during current review' : '' }}

    {{ __('consultations.ordered_procedures') }}

    @if($episode_has_grand_parent_episode) @if(count($grand_parent_episode_ordered_procedures) > 0) @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++) @endfor @endforeach @endif @endif @if(count($parent_episode_ordered_procedures) > 0) @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++) @endfor @endforeach @endif @if(count($ordered_procedures) > 0) @php $count = 1; $procedure_performed_counter = 0; @endphp @if(check_if_episode_is_a_followup($episode->id)) @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++) @endfor @endforeach @else @endif
    {{ __('consultations.PROCEDURE') }} {{ __('consultations.STATUS') }} {{ __('consultations.PERFORMED') }}
    {{ __('consultations.procedures_for_episode_of') }} {{ streamline_date($grand_parent_episode_details->created_at) }}
    {{ get_name($procedure_id[$i], 'id', 'name', 'procedures') }} {!! $procedure_performed_array[$i] == 1 ? ''.__("consultations.performed").'' : ''. __("consultations.pending").'' !!}
    {{ __('consultations.procedures_for_episode_of') }} {{ streamline_date($parent_episode_details->created_at) }}
    {{ get_name($procedure_id[$i], 'id', 'name', 'procedures') }} {!! $procedure_performed_array[$i] == 1 ? ''.__("consultations.performed").'' : ''. __("consultations.pending").'' !!}
    {{ __('consultations.procedures_for_episode_review') }} ({{ streamline_date($episode->created_at)}})
    {{ get_name($procedure_id[$i], 'id', 'name', 'procedures') }} {!! $procedure_performed_array[$i] == 1 ? ''.__("consultations.performed").'' : ''. __("consultations.pending").'' !!} @if($procedure_performed_array[$i] != 1) {{ Form::hidden('perform[]', $procedure_id[$i]) }} {{ Form::hidden('procedure_order_perform[]', $ordered_procedure->id) }} {{ Form::hidden('procedure_performed_position[]', $i) }} @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
    {{ __('consultations.no_procedure_has_been_ordered') }} {{ check_if_episode_is_a_followup($episode->id) ? __('consultations.during_current_review') : '' }}.
    {{ Form::button(__('consultations.Investigation'),['type'=>'submit','class'=>'btn btn-info btn-block','name'=>'submit-btn','value'=>'investigation']) }}
    {{ Form::button(__('consultations.Treatment'),['type'=>'submit','class'=>'btn btn-default btn-block','name'=>'submit-btn','value'=>'treatment']) }}

    {{ Form::button(__('consultations.Procedures'),['type'=>'submit','class'=>'btn btn-inverse btn-block','name'=>'submit-btn','value'=>'procedures']) }}
    {{ Form::button(__('consultations.Sundries'),['type'=>'submit','class'=>'btn btn-primary btn-block','name'=>'submit-btn','value'=>'sundries']) }}

    {{ Form::button(__('consultations.services'),['type'=>'submit','class'=>'btn btn-default-bluish btn-block','name'=>'submit-btn','value'=>'services']) }}
    @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)
    {{ __('consultations.consultation_comments_on') }} {{ streamline_date($grand_parent_consultation->created_at) }}
    {{ $grand_parent_consultation->comments }}
    @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)
    {{ __('consultations.consultation_comments_on') }} {{ streamline_date($parent_consultation->created_at) }}
    {{ $parent_consultation->comments }}
    @endif @endif

    {{ __('consultations.comments') }}

    {{ __('consultations.outcome') }}

    {{ Form::select('outcome', $outcomes, '7', ['id' => 'outcome', 'class' => 'form-control compulsory']) }}

    {{ Form::button(__('consultations.save_consultation'),['type'=>'submit','class'=>'btn btn-default btn-block','name'=>'submit-btn','value'=>'save_consultation']) }} {{ Form::button('Complete consultation',['class'=>'btn btn-success btn-block','name'=>'submit-btns','value'=>'complete', 'id'=>'complete_consultations', 'onclick'=>'return confirm_outcome()']) }}
    {{ Form::close() }} @include('patients::consultations.document.add') @include('patients::consultations.add_diagnosis') @endsection @push('scripts') @endpush