@extends('layouts.main') @push('styles') @endpush @section('content')

{{ __('inpatient.inpatient_sheet') }}

@include('patients::allergies.header')
{{-- check for maternity delivery record if patient has one --}} @include('ward_management::inpatient.patient_delivery_record') {{-- --}}
@include('flash::message')
{{ __('inpatient.inpatient_warning') }}
@php $dob = new Carbon\Carbon(get_name($inpatient_info->patient_id, 'id', 'date_of_birth', 'patients')); $age_diff_months = $dob->diffInMonths(Carbon\Carbon::now()); $discharge_mortality = \DB::table('discharge_mortality_risk')->where('patient_id', $inpatient_info->patient_id) ->where('episode_id', $inpatient_info->episode_id) ->first(); $eyes = [2 => 'Both eyes', 0 => 'Left eye', 1 => 'Right eye']; $other_diagnoses = []; @endphp @if(is_smart_discharge_enabled() && $age_diff_months < 61 && $discharge_mortality)

Patient's post discharge risk of mortality is being monitored. You can fill in the required fields here



@if(is_null($discharge_mortality->post_discharge_mortality_risk)) {{ Form::hidden('is_under_pdrm_monitoring', 1, ['id' => 'is_under_pdrm_monitoring']) }} @else {{ Form::hidden('is_under_pdrm_monitoring', 0, ['id' => 'is_under_pdrm_monitoring']) }} @endif @endif @if(is_null($inpatient_info->bed_category_id))

{{ __('inpatient.bed_category_warning') }}

@endif {{ Form::open(['route' => 'in_patient.store']) }} @php $patient_insurance_status = patient_insurance_status($patient_id); @endphp {{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }} {{ Form::hidden('episode_id', $inpatient_info->episode_id, ['id' => 'episode_id']) }} {{ Form::hidden('inpatient_id', $inpatient_info->id, ['id' => 'inpatient_id']) }} {{ Form::hidden('patient_insurance_status', $patient_insurance_status, ['id' => 'patient_insurance_status'])}} {{ Form::hidden('redirect_to_pdrm_monitoring', 0, ['id' => 'redirect_to_pdrm_monitoring']) }}
@if($inpatient_info->discharged == 1) @else @endif
{{ __('inpatient.admitted') }} {{ __('inpatient.discharged') }} {{ __('inpatient.ward') }} {{ __('inpatient.specialty') }} {{ __('inpatient.residence') }}
{{ streamline_date($inpatient_info->admitted_on) }}{{ streamline_date($inpatient_info->discharged_on) }}{{ __('inpatient.still_admitted') }}{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} {{ Form::select('speciality',$specialities,$inpatient_info->speciality_id,['class' => 'form-control']) }} {{ patient_residence($patient->id) }}

@if (is_tuberculosis_screening_enabled()) @include('patients::consultations.tb_screening') @endif
{{ Form::hidden('info_id', $inpatient_info->id) }} {{ Form::hidden('ward_id', $inpatient_info->ward_id, ['id' => 'ward_id']) }}

{{ __('inpatient.accomodation') }}

admitted_on); $ward_bed_stay_records = \Streamline\Models\WardBedStay::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get(); $bed_category_fields = 0; $current_date = \Carbon\Carbon::now(); $duration_in_days = $admission_date->diffInDays($current_date); ?> @if(count($ward_bed_stay_records) > 0) @foreach($ward_bed_stay_records as $record) {{ Form::hidden('previous_bed_stays[]', $record->id) }} @php $bed_category_fields++; @endphp @endforeach @else @php $bed_category_fields++; @endphp @endif
{{ __('inpatient.bed_no') }} {{ __('inpatient.bed_category') }} {{ __('inpatient.ward') }} {{ __('inpatient.from') }} {{ __('inpatient.to') }} {{ __('inpatient.duration') }} {{ __('inpatient.bed_rate') }}
{{ Form::text('on_bed_number[]', $record->bed_number, ['class' => 'form-control']) }} {{ Form::select('on_bed_bedcategory[]', $bed_categories, $record->bed_category, ['class' => 'form-control bed_category', 'id' => 'bed_category_'.$bed_category_fields]) }} {{ Form::select('bed_ward[]', $wards, $record->bed_ward, ['class' => 'form-control']) }}
{{ Form::text('on_bed_from[]', $record->from, ['class' => 'form-control bed_dates','readonly','id'=>'on_bed_from_'.$bed_category_fields]) }}
@if($record->still_here == 1) @else
{{ Form::text('on_bed_upto[]', $record->to, ['class' => 'form-control bed_dates', 'readonly', 'id'=>'on_bed_upto_'.$bed_category_fields]) }}
@endif
{{ Form::text('on_bed_number[]', '', ['class' => 'form-control'])}} {{ Form::select('on_bed_bedcategory[]', $bed_categories, $inpatient_info->bed_category_id, ['class' => 'form-control bed_category', 'id' => 'bed_category_0']) }} {{ Form::select('bed_ward[]', $wards, $inpatient_info->ward_id, ['class' => 'form-control']) }}
{{ Form::text('on_bed_from[]', $admission_date->toDateString(), ['class' => 'form-control bed_dates','readonly','id'=>'on_bed_from_0']) }}
@php $current_date = \Carbon\Carbon::now(); $duration_in_days = $admission_date->diffInDays($current_date); @endphp



@php $cons_comments = \Illuminate\Support\Facades\DB::table('consultations')->where('episode_id', $episode_id)->select(['comments', 'history_comments', 'clinic_examination_comments', 'investigation_and_management_plan_comments'])->first(); $consultation_notes = \Streamline\Models\WardInpatientDetailedNote::where(['patient_id' => $patient_id, 'episode_id' => $episode_id, 'ward_id' => 0])->latest()->get(['investigation_and_management_plan_comments', 'clinic_examination_comments', 'history_comments', 'created_by','created_at']); $right_eye_diagnoses = explode(',',get_name($episode_id, 'episode_id', 'right_eye_diagnosis', 'eye_clinic_main_exam')); $left_eye_diagnoses = explode(',',get_name($episode_id, 'episode_id', 'left_eye_diagnosis', 'eye_clinic_main_exam')); $is_eye_module_enabled = is_eye_module_enabled() && is_patient_in_eye_clinic($episode_id); $diagnosis_categories_options = ""; $all_diagnosis_categories = ['' => '- select -']; foreach ($diagnosis_categories as $item){ $diagnosis_categories_options .= ""; $all_diagnosis_categories[$item->id] = $item->name; } @endphp {{-- @dd($consultation_notes->toArray()) --}} {{-- @if($cons_comments && ($cons_comments->comments || $cons_comments->history_comments || $cons_comments->clinic_examination_comments || $cons_comments->investigation_and_management_plan_comments))

{{ __('inpatient.opd_consultation_comments') }}

@if($cons_comments->comments) @endif @if($cons_comments->history_comments) @endif @if($cons_comments->clinic_examination_comments) @endif @if($cons_comments->investigation_and_management_plan_comments) @endif
{{ __('inpatient.comments') }} {{ $cons_comments->comments }}
{{ __('inpatient.history') }} {{ $cons_comments->history_comments }}
{{ __('consultations.clinical_examination') }} {{ $cons_comments->clinic_examination_comments }}
{{ __('consultations.investigation_and_mgt_plan') }} {{ $cons_comments->investigation_and_management_plan_comments }}

@endif --}} {{-- fetch consultation notes --}} @if ( count($consultation_notes) > 0 ) {{-- History consultation notes --}}

{{ __('inpatient.opd_consultation_comments') }}

@forelse ($consultation_notes as $consultation_note) @if(!empty($consultation_note->history_comments)) @endif @empty {{-- --}} @endforelse
{{ __('consultations.history') }}
{{ $consultation_note->history_comments ?? '' }} By {{ get_full_name($consultation_note->created_by, 'id', 'first_name', 'last_name', 'users') }}   on {{ streamline_date_time($consultation_note->created_at) ?? '' }}
{{ __('consultations.no_previous_notes') }}
{{-- Clinic Examination consultation notes --}} @forelse ($consultation_notes as $consultation_note) @if(!empty($consultation_note->clinic_examination_comments)) @endif @empty {{-- --}} @endforelse
{{ __('consultations.clinical_examination') }}
{{ $consultation_note->clinic_examination_comments ?? '' }} By {{ get_full_name($consultation_note->created_by, 'id', 'first_name', 'last_name', 'users') }}   on {{ streamline_date_time($consultation_note->created_at) ?? '' }}
{{ __('consultations.no_previous_notes') }}
{{-- Investigation and Management Plan consultation notes --}} @forelse ($consultation_notes as $consultation_note) @if(!empty($consultation_note->investigation_and_management_plan_comments)) @endif @empty {{-- --}} @endforelse
{{ __('consultations.investigation_and_mgt_plan') }}
{{ $consultation_note->investigation_and_management_plan_comments ?? '' }} By {{ get_full_name($consultation_note->created_by, 'id', 'first_name', 'last_name', 'users') }}   on {{ streamline_date_time($consultation_note->created_at) ?? '' }}
{{ __('consultations.no_previous_notes') }}
@endif {{-- end fetch consultation notes --}} @if($anc_comments && ($anc_comments->history_comments || $anc_comments->clinic_examination_comments || $anc_comments->investigation_and_management_plan_comments))

{{ __('inpatient.anc_consultation_comments') }}

@if($anc_comments->history_comments) @endif @if($anc_comments->clinic_examination_comments) @endif @if($anc_comments->investigation_and_management_plan_comments) @endif
{{ __('inpatient.history') }} {{ $anc_comments->history_comments }}
{{ __('consultations.clinical_examination') }} {{ $anc_comments->clinic_examination_comments }}
{{ __('consultations.investigation_and_mgt_plan') }} {{ $anc_comments->investigation_and_management_plan_comments }}

@endif
@if(count($documents) > 0) @foreach($documents as $document)
  • {{ $document->title }}
  • @endforeach @else {{ __('inpatient.no_documents_available') }} @endif
    @if($triage) @php $symptoms_explode = explode(",", $triage->symptoms); $duration_explode = explode(",", $triage->symptom_duration); @endphp @for($i = 0; $i < count($symptoms_explode); $i++) @endfor @else @endif
    {{ __('inpatient.symptoms') }} {{ __('inpatient.duration') }}
    @if(isset($symptoms[$symptoms_explode[$i]])) {{ $symptoms[$symptoms_explode[$i]] }} @else N/A @endif {{ $duration_explode[$i] ?? '' }}
    {{ __('inpatient.no_symptoms_triage') }}
    @if(count($opd_investigations) > 0) @for($i = 0; $i < count($opd_investigations['name']); $i++) @if(isset($opd_investigations['name'][$i])) @if(in_array($i, $opd_investigations_position)) @endif @endif @endfor @else @endif
    {{ __('inpatient.name') }} {{ __('inpatient.value') }} {{ __('inpatient.normal_range') }} {{ __('inpatient.comment') }}
    {{ $opd_investigations_date[array_search($i, $opd_investigations_position)] }}
    {{ $opd_investigations['name'][$i] }} @if ($is_eye_module_enabled && isset($opd_investigations['eye'][$i]))
    {{ $eyes[$opd_investigations['eye'][$i]] }} @endif
    @if($opd_investigations['type'][$i] == 1 && $opd_investigations['value'][$i] != "Pending") View Results @else {{ $opd_investigations['value'][$i] }}
    {{ $opd_investigations['result_time'][$i]?? '' }} @endif
    {{ $opd_investigations['normal_ranges'][$i] ?? '' }} {{ $opd_investigations['comment'][$i] }}
    {{ __('inpatient.no_opd_invs') }}
    @if(count($ward_investigations) > 0) @for($i = 0; $i < count($ward_investigations['name']); $i++) @if(in_array($i, $ward_investigations_position)) @endif @endfor @else @endif
    {{ __('inpatient.name') }} {{ __('inpatient.value') }} {{ __('inpatient.normal_range') }} {{ __('inpatient.comment') }}
    {{ $ward_investigations_date[array_search($i, $ward_investigations_position)] }}
    {{ $ward_investigations['name'][$i] }} @if ($is_eye_module_enabled && isset($ward_investigations['eye'][$i]))
    {{ $eyes[$ward_investigations['eye'][$i]] }} @endif
    @if($ward_investigations['type'][$i] == 1 && $ward_investigations['value'][$i] != "Pending") View Results @else {{ $ward_investigations['value'][$i] }}
    {{ $ward_investigations['result_time'][$i]?? '' }} @endif
    {{ $ward_investigations['normal_ranges'][$i] ?? '' }} {{ $ward_investigations['comment'][$i] }}
    {{ __('inpatient.no_ward_invs') }}
    {{ __('inpatient.transfer') }} {{ $patient->first_name }} {{ $patient->last_name }} {{ __('inpatient.to_another_ward') }}

    {{ Form::label('from',__('inpatient.from')) }}
    {{ Form::text('from', $wards[$inpatient_info->ward_id], ['class' => 'form-control', 'readonly']) }}
    {{ Form::label('to',__('inpatient.to')) }}
    {{ Form::select('to',$wards,'',['class' => 'form-control', 'id' => 'to_ward']) }}
    {{ Form::label('date_of_transfer',__('inpatient.date_of_transfer')) }}
    {{ Form::text('date_of_transfer','',['class' => 'form-control','id' => 'date_of_transfer','readonly']) }}
    {{ Form::label('comments',__('inpatient.comment')) }}
    {{ Form::textarea('transfer_comments','',['class' => 'form-control','rows'=>'4','id'=>'transfer_comments']) }}
    {{ __('inpatient.complete_ward_transfer') }}
    {{ Form::button(__('inpatient.order_investigations'),['type'=>'submit','class'=>'btn btn-primary btn-small pull-right','name'=>'submit-btn','value'=>'order_investigation']) }}


    @if(Auth::user()->can('view-patient-episode-primary-diagnoses') && !($is_eye_module_enabled))
    @if( Auth::user()->can('add-new-diagnosis-from-consultation')) @endif
    {{ __('inpatient.primary_diagnosis') }} {{ __('inpatient.prompt') }} {{ __('inpatient.references') }}
    {{ Form::select('primary_diagnosis', $diagnoses, $inpatient_info->primary_diagnosis, ['class' => 'form-control select col-md-12 compulsory', 'required', 'id' => 'primary_diagnosis']) }}
    {{ (isset($inpatient_info->primary_diagnosis) && $inpatient_info->primary_diagnosis != 0) ? get_name($inpatient_info->primary_diagnosis, "id", "prompts", "diagnoses") : "" }} 
    @if(!is_null($inpatient_info->primary_diagnosis) && $inpatient_info->primary_diagnosis != 0) @php $reference_names = explode(",", get_name($inpatient_info->primary_diagnosis, 'id', 'reference_names', 'diagnoses')); $reference_areas = explode(",", get_name($inpatient_info->primary_diagnosis, 'id', 'reference_areas', 'diagnoses')); @endphp @for($i = 0; $i < count($reference_names); $i++) @if(isset($reference_areas[$i]) && isset($reference_names[$i])) {{ $reference_names[$i] }} | @endif @endfor @endif
    {{ __('consultations.add_new_diagnosis') }}

    @php $other_diagnoses = $inpatient_info->other_diagnoses ? @unserialize($inpatient_info->other_diagnoses) : []; $other_diagnoses = is_array($other_diagnoses) ? $other_diagnoses : []; $option_diagnoses = ""; foreach ($diagnoses as $key => $value){ $option_diagnoses .= ""; } @endphp @if(empty($other_diagnoses)) @else @foreach($other_diagnoses as $key => $diagnosis) @endforeach @endif
    {{ __('inpatient.other_diagnosis') }} {{ __('inpatient.prompt') }} {{ __('inpatient.references') }}
     
     
    {{ Form::select('other_diagnosis[]', $diagnoses, $diagnosis, ['class' => 'form-control col-sm-12 select sec_d','onchange'=>'other_diagnosis_prompt(this.value, '.$key.')' ]) }}
    {{ is_object($diagnoses_all->firstWhere('id',$diagnosis)) ? $diagnoses_all->firstWhere('id',$diagnosis)->prompts : '' }} 
    {{ is_object($diagnoses_all->firstWhere('id',$diagnosis)) ? $diagnoses_all->firstWhere('id',$diagnosis)->reference_names : '' }} 
    {{ __('consultations.add_row') }} @endif
    @if ($is_eye_module_enabled && Auth::user()->can('view-patient-episode-primary-diagnoses'))
    @if( Auth::user()->can('add-new-diagnosis-from-consultation')) {{ __('consultations.add_new_diagnosis') }} @endif
    @if($inpatient_info->right_eye_diagnosis)
    @php $diagnosis_id_array = explode(",", $inpatient_info->right_eye_diagnosis); @endphp @if(count($diagnosis_id_array) > 0) @foreach($diagnosis_id_array as $id) @endforeach @else
    @endif
    {{ __('patient_episode.right_eye_diagnosis') }}
    SECTION DIAGNOSIS
    {{ get_name(get_name($id, 'id', 'diagnosis_category', 'diagnoses'), 'id', 'name', 'diagnosis_categories') }} {{ get_name($id, 'id', 'name', 'diagnoses') }}
    No Diagnosis was registered for this patient...
    @else

    {{ __('patient_episode.right_eye_diagnosis') }}

    SECTION
    DIAGNOSIS
    @endif
    @if($inpatient_info->left_eye_diagnosis)
    @php $diagnosis_id_array = explode(",", $inpatient_info->left_eye_diagnosis); @endphp @if(count($diagnosis_id_array) > 0) @foreach($diagnosis_id_array as $id) @endforeach @else
    @endif
    {{ __('patient_episode.left_eye_diagnosis') }}
    SECTION DIAGNOSIS
    {{ get_name(get_name($id, 'id', 'diagnosis_category', 'diagnoses'), 'id', 'name', 'diagnosis_categories') }} {{ get_name($id, 'id', 'name', 'diagnoses') }}
    No Diagnosis was registered for this patient...
    @else

    {{ __('patient_episode.left_eye_diagnosis') }}

    SECTION
    DIAGNOSIS
    @endif


    Main Exam {{ __('patient_episode.right_eye_diagnosis') }}
    @if(count($right_eye_diagnoses) > 0 && $right_eye_diagnoses[0] !== 'N/A')
      @for($x = 0; $x < count($right_eye_diagnoses); $x++) @php $category_id = isset($right_eye_diagnoses[$x]) ? get_name($right_eye_diagnoses[$x], 'id', 'diagnosis_category', 'diagnoses') : 'N/A'; @endphp
    1. {{ ($category_id != 'N/A')? $all_diagnosis_categories[$category_id] : $category_id }} : {{ isset($right_eye_diagnoses[$x]) ? get_name($right_eye_diagnoses[$x], 'id', 'name', 'diagnoses') : 'N/A' }}
    2. @endfor
    @else No Diagnosis @endif
    Main Exam {{ __('patient_episode.left_eye_diagnosis') }}
    @if(count($left_eye_diagnoses) > 0 && $left_eye_diagnoses[0] != 'N/A')
      @for($x = 0; $x < count($left_eye_diagnoses); $x++) @php $category_id = isset($left_eye_diagnoses[$x]) ? get_name($left_eye_diagnoses[$x], 'id', 'diagnosis_category', 'diagnoses') : 'N/A'; @endphp
    1. {{ ($category_id != 'N/A')? $all_diagnosis_categories[$category_id] : $category_id }} : {{ isset($left_eye_diagnoses[$x]) ? get_name($left_eye_diagnoses[$x], 'id', 'name', 'diagnoses') : 'N/A' }}
    2. @endfor
    @else No Diagnosis @endif

    @endif
    @php $opd_ordered_procedures = \Streamline\Models\OrderedProcedure::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get(); @endphp @if (count($opd_ordered_procedures) > 0)

    {{ __('inpatient.opd_ordered_procedures') }}

    @foreach ($opd_ordered_procedures as $opd_procedures) @php $procedure_ids_array = explode(",", $opd_procedures->procedure_id); $procedure_performed_array = explode(",", $opd_procedures->performed); @endphp @for($i = 0; $i < count($procedure_ids_array); $i++) @endfor @endforeach
    {{ __('inpatient.procedure') }} {{ __('inpatient.performed') }} {{ __('inpatient.performed_by') }}
    {{ get_name($procedure_ids_array[$i], 'id', 'name', 'procedures') }} {!! $procedure_performed_array[$i] == 1 ? ''.__("consultations.performed").'' : ''. __("consultations.pending").'' !!} @php $performance_details = \Streamline\Models\StaffPerformedService::where(['episode_id' => $episode_id, 'item_category' => 1, 'item_id' => $procedure_ids_array[$i]])->first(); @endphp {{ ($procedure_performed_array[$i] == 1 && $performance_details)? get_full_name($performance_details->performed_by, "id", "first_name", "last_name", "users") : "N/A" }}
    @endif
    {{ __('inpatient.note_total_procedure_cost') }}
    {{ __('inpatient.view_procedures_details') }} @php $procedures_counter = 0; $can_edit_procedure_pricing = 0; @endphp @if( Auth::user()->can('add-procedures-on-inpatient-sheet'))
    {{ __('inpatient.procedures') }}
    {{ __('inpatient.hospital_fee') }}
    {{ __('inpatient.performed_by') }}
    {{ __('inpatient.staff_fee') }}
    {{ __('inpatient.date') }}
    @php // get the quantity given so far of this particular treatment $ward_procedures_ordered = DB::table('ward_procedures')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get(); @endphp @if(count($ward_procedures_ordered) > 0) @foreach($ward_procedures_ordered as $ward_procedure)
    {{ Form::hidden('procedure_record_id[]', $ward_procedure->id) }} {{ $procedures[$ward_procedure->procedure_id] ?? '' }} @if ($is_eye_module_enabled && isset($eyes[$ward_procedure->eye])) {{ Form::hidden('eye[]', $ward_procedure->eye) }}{{ $eyes[$ward_procedure->eye] }} @endif
    {{ Form::number('procedure_hospital_fee_display[]', $ward_procedure->hospital_fee, ['class' => 'form-control performance_fee', 'readonly'])}}
    {{ Form::hidden('procedure_done_by_display[]', $ward_procedure->performed_by) }} {{ Form::text('procedure_done_by_name_display[]', $users_array[$ward_procedure->performed_by] ?? '', ['class' => 'form-control', 'readonly']) }}
    {{ Form::number('procedure_performance_fee_display[]', $ward_procedure->staff_fee, ['class' => 'form-control performance_fee', 'readonly']) }}
    {{ Form::text('procedure_date_display[]',$ward_procedure->procedure_date,['class' => 'form-control procedure_date','readonly']) }}

    @if(Auth::user()->can('add-ward-procedures-fees')) @php $can_edit_procedure_pricing = 1; @endphp @endif @endforeach @else
    {{ Form::select('procedure_id[]', $procedures, '', ['class' => 'form-control select', 'id' => 'procedure_item_0']) }} @if ($is_eye_module_enabled)

    @endif
    @if(Auth::user()->can('add-ward-procedures-fees')) @php $can_edit_procedure_pricing = 1; @endphp {{ Form::number('procedure_hospital_fee[]', '', ['class' => 'form-control performance_fee', 'id' => 'procedure_hospital_fee_0']) }} @else {{ Form::number('procedure_hospital_fee[]', '', ['class' => 'form-control performance_fee', 'readonly', 'id' => 'procedure_hospital_fee_0']) }} @endif
    {{ Form::select('procedure_done_by[]', $users_array, '', ['class' => 'form-control select', 'id' => 'first_procedure_done_by_0'])}}
    @if( Auth::user()->can('add-ward-procedures-fees')) {{ Form::number('procedure_performance_fee[]', 0, ['class' => 'form-control performance_fee','id' => 'first_procedure_performance_fee_0']) }} @else {{ Form::number('procedure_performance_fee[]', 0, ['class' => 'form-control performance_fee', 'readonly', 'id' => 'first_procedure_performance_fee_0']) }} @endif
    {{ Form::text('procedure_date[]','',['class' => 'form-control procedure_date','readonly']) }}
    @php $procedures_counter++; @endphp @endif

    {{ __('inpatient.add_procedure') }} @endif @php $sundries_counter = 0; @endphp @if( Auth::user()->can('add-sundries-on-inpatient-sheet'))

    {{ __('inpatient.sundries') }} {{ __('inpatient.view_sundries_consumption_details') }}

    @php //get the quantity given so far of this particular sundry $ward_sundry_quantities_given = DB::table('ward_sundry_dispensations')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->groupBy('sundry_id')->selectRaw('*, sum(quantity_given) as quantity_given')->get(); @endphp
    @forelse ($ward_sundry_quantities_given as $dispensed_sundry_record) @empty @endforelse
    {{ Form::hidden('sundry_id[]', $dispensed_sundry_record->sundry_id) }} {{ $sundries[$dispensed_sundry_record->sundry_id] ?? '' }}
    {{ Form::text('sundry_date[]', $dispensed_sundry_record->dispensation_date, ['class' => 'form-control sundry_date','readonly']) }}
    {{ Form::number('sundry_quantity_dispensed_so_far[]', $dispensed_sundry_record->quantity_given, ['class' => 'form-control', 'readonly' => 'true']) }} {{ Form::number('sundry_quantity[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.add_more')]) }}
    {{ Form::select('sundry_id[]', $sundries, '', ['class' => 'form-control select']) }}
    {{ Form::text('sundry_date[]','',['class' => 'form-control sundry_date','readonly']) }}
    {{ Form::number('sundry_quantity[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.quantity')]) }}

    {{ __('inpatient.add_sundry') }}
    @endif @php $extras_counter = 0; @endphp @if(Auth::user()->can('add-extras-on-inpatient-sheet') && is_inpatient_sheet_extras_enabled())

    {{ __('inpatient.extras') }} {{ __('inpatient.view_extras_consumption_details') }}

    where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->whereNull('deleted_at')->get(); $extras_counter = 0; ?> @if(count($ward_extras_given) > 0) @foreach($ward_extras_given as $extras_record)
    {{ Form::text('extra_name[]', $extras_record->extra_item, ['class' => 'form-control', 'readonly']) }}
    {{ Form::hidden('extra_cost[]', null, ['class'=>'form-control']) }} {{ Form::number('already_extra_cost[]', $extras_record->extra_cost, ['class' => 'form-control', 'readonly']) }}
    {{ Form::text('extra_date[]', $extras_record->dispensation_date, ['class' => 'form-control extra_date','readonly']) }}
    @endforeach @endif
    {{ Form::text('extra_name[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.add_extra')]) }}
    {{ Form::number('extra_cost[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.cost')]) }}
    {{ Form::text('extra_date[]','',['class' => 'form-control extra_date','readonly']) }}

    {{ __('inpatient.add_extras') }} @endif @php $services_counter = 1; $opd_ordered_services = \Streamline\Models\OrderedService::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get(); $can_edit_services_pricing = 0; @endphp @if( Auth::user()->can('add-consultation-and-services-on-inpatient-sheet')) @if (count($opd_ordered_services) > 0)

    {{ __('inpatient.opd_ordered_services') }}

    @foreach($opd_ordered_services as $service) @php $service_ids = explode(",", $service->service_id); $service_quantity = explode(",", $service->quantity); $service_performed = explode(",", $service->performed); @endphp @for($i = 0; $i < count($service_ids); $i++) @endfor @endforeach
    {{ __('inpatient.service') }} {{ __('inpatient.quantity') }} {{ __('inpatient.performed') }}
    {{ get_name($service_ids[$i], "id", "name", "services")}} {{ $service_quantity[$i] ?? "N?A" }} {!! (isset($service_performed[$i]) && $service_performed[$i] == 1) ? ''.__("consultations.performed").'' : ''. __("consultations.pending").'' !!}
    @endif

    {{ __('inpatient.view_consultation_details') }}

    {{ __('inpatient.consultation_and_services') }}
    {{ __('inpatient.unit_price') }}
    {{ __('inpatient.staff_fee') }}
    {{ __('inpatient.date') }}
    {{ __('inpatient.quantity') }}
    whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get(); ?> @if(count($ward_service_quantities_given) > 0) @foreach($ward_service_quantities_given as $record)
    {{ Form::hidden('ward_consultations_and_services_record_id[]', $record->id) }} {{ Form::hidden('service_id[]', $record->service_id) }} {{ $service_items[$record->service_id] ?? "" }}
    {{ Form::number('service_unit_price[]', $record->unit_price, ['class' => 'form-control', 'readonly' => 'true']) }}
    {{ Form::number('service_staff_fee[]', $record->staff_fee, ['class' => 'form-control', 'readonly' => 'true']) }}
    {{ Form::text('service_date[]', $record->dispensation_date, ['class' => 'form-control service_date','readonly']) }}
    {{ Form::number('service_quantity_dispensed_so_far[]', $record->quantity_given, ['class' => 'form-control', 'readonly' => 'true']) }}
    {{ Form::number('service_quantity[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.add_more')]) }}

    @endforeach @endif
    {{ Form::select('service_id[]', $service_items, '', ['class' => 'form-control select', 'id' => 'service_item_0']) }}
    @if( Auth::user()->can('edit-services-prices-on-inpatient-sheet')) @php $can_edit_services_pricing = 1; @endphp
    {{ Form::number('service_unit_price[]', '', ['class' => 'form-control', 'placeholder' => 'unit price', 'id' => 'service_unit_price_0']) }}
    {{ Form::number('service_staff_fee[]', '', ['class' => 'form-control', 'placeholder' => 'staff fee', 'id' => 'service_staff_fee_0']) }}
    @else
    {{ Form::number('service_unit_price[]', '', ['class' => 'form-control', 'placeholder' => 'unit price', 'id' => 'service_unit_price_0', 'readonly']) }}
    {{ Form::number('service_staff_fee[]', '', ['class' => 'form-control', 'placeholder' => 'staff fee', 'id' => 'service_staff_fee_0', 'readonly']) }}
    @endif
    {{ Form::text('service_date[]','',['class' => 'form-control service_date','readonly']) }}
    {{ Form::number('service_quantity[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.quantity')]) }}

    {{ __('inpatient.add_service') }} @endif @include('ward_management::inpatient.patient_vitals')
    @php $ward_treatment_counter = 0; $opd_treatments = \Streamline\Models\Treatment::where(['patient_id' => $patient_id, 'episode_id' => $episode_id, 'tta' => 0])->get(); @endphp @if( Auth::user()->can('add-ward-treatments-on-inpatient-sheet')) @if(count($opd_treatments) > 0)

    {{ __('inpatient.opd_prescription') }}

    @foreach ($opd_treatments as $opd_treatment) @php $opd_treatment_drugs = explode(",", $opd_treatment->drugs); $opd_treatment_dose_array = isset($opd_treatment->doses) ? explode(",", $opd_treatment->doses) : []; $opd_treatment_freq_array = isset($opd_treatment->frequencies) ? explode(",", $opd_treatment->frequencies) : []; $opd_treatment_duration_array = isset($opd_treatment->durations) ? explode(",", $opd_treatment->durations) : []; $opd_purchased_elsewhere_array = is_null($opd_treatment->purchased_elsewhere) ? [] : explode(",", $opd_treatment->purchased_elsewhere); @endphp @for($x = 0; $x < count($opd_treatment_drugs); $x++) @php $drug_name = get_name($opd_treatment_drugs[$x], 'id', "name", 'drugs'); $drug_unit = get_name(get_name($opd_treatment_drugs[$x], 'id', "unit_id", 'drugs'), "id", "name", "drug_units"); $frequency = get_name($opd_treatment_freq_array[$x], "id", "name", "dosage_frequencies"); @endphp @if($opd_treatment->dispense_status == 1) @if(isset($opd_purchased_elsewhere_array[$x]) && $opd_purchased_elsewhere_array[$x] == 1) @else @endif @else @endif @endfor @endforeach
    {{ __('inpatient.name') }} {{ __('inpatient.dose') }} {{ __('inpatient.duration') }} {{ __('inpatient.status') }}
    {{ $x+1 }}. {{ $drug_name }} {{ $opd_treatment_dose_array[$x] }} {{ $drug_unit }} {{ $frequency}} {{ $opd_treatment_duration_array[$x] }}Purchased From Elsewhere{{ __('inpatient.dispensed') }}{{ __('inpatient.pending_dispensing') }}
    {{ __('inpatient.prescribed_by') }}: {{ get_full_name($opd_treatment->created_by, "id", "first_name", "last_name", "users") }} {{ __('inpatient.on') }} {{ streamline_date_time($opd_treatment->created_at) }}
    @endif @php $stopped_ward_drugs_array = []; @endphp @if(get_ward_prescription_model() == 1)

    {{ __('inpatient.ward_prescription') }}

    @if(count($ward_prescriptions) > 0) @foreach($ward_prescriptions as $ward_prescription) @php $ward_prescription_drugs = explode(",", $ward_prescription->drugs); $ward_prescription_dose_array = isset($ward_prescription->doses) ? explode(",", $ward_prescription->doses) : []; $ward_prescription_freq_array = isset($ward_prescription->frequencies) ? explode(",", $ward_prescription->frequencies) : []; $ward_prescription_duration_array = isset($ward_prescription->durations) ? explode(",", $ward_prescription->durations) : []; $ward_prescription_quantity_array = isset($ward_prescription->quantities_dispensed) ? explode(",", $ward_prescription->quantities_dispensed) : []; $ward_prescription_eye_array = isset($ward_prescription->eye) ? explode(",", $ward_prescription->eye) : []; $stopped_drugs_array = is_null($ward_prescription->stopped_drugs) ? [] : explode(",", $ward_prescription->stopped_drugs); $stopped_ward_drugs_array = array_merge($stopped_ward_drugs_array, $stopped_drugs_array); @endphp @for($x = 0; $x < count($ward_prescription_drugs); $x++) @php $drug_name = get_name($ward_prescription_drugs[$x], 'id', "name", 'drugs'); $drug_unit = get_name(get_name($ward_prescription_drugs[$x], 'id', "unit_id", 'drugs'), "id", "name", "drug_units"); $frequency = get_name($ward_prescription_freq_array[$x], "id", "name", "dosage_frequencies"); @endphp @endfor @if(Auth::user()->can('cancel-ward-prescription')) @endif @endforeach @else @endif
    {{ __('inpatient.name') }} {{ __('inpatient.dose') }} {{ __('inpatient.duration') }} {{ ucfirst(__('inpatient.quantity')) }}
    {{ __('inpatient.ordered_on') }} {{ streamline_date_time($ward_prescription->created_at) }} {{ __('inpatient.by') }} {{ get_name($ward_prescription->created_by, "id", "first_name", "users")}} {{ get_name($ward_prescription->created_by, "id", "last_name", "users")}}
    {{ $x+1 }}. {{ $drug_name }} @if ($is_eye_module_enabled && !empty($ward_prescription_eye_array))
    {{ $eyes[$ward_prescription_eye_array[$x]] }} @endif @if (in_array($ward_prescription_drugs[$x], $stopped_ward_drugs_array)) Resume Drug @else Stop Drug @endif
    {{ $ward_prescription_dose_array[$x] }} {{ $drug_unit }} {{ $frequency}} {{ $ward_prescription_duration_array[$x] }} {{ $ward_prescription_quantity_array[$x] }}
    Cancel prescription
    {{ __('inpatient.no_ward_drugs') }}
    {{ Form::button(__('inpatient.order_ward_presc'),['type'=>'submit','class'=>'btn btn-primary btn-small pull-right','name'=>'submit-btn','value'=>'ward_prescription']) }}

    {{ __('inpatient.ward_treatments') }} {{ __('inpatient.view_ward_treatment_details') }} Treatment Sheet

    @php $avoid_double_display_array = []; @endphp @if(!empty($ward_prescriptions)) @foreach($ward_prescriptions as $ward_prescription) @php $loaded_ward_prescriptions = explode(",", $ward_prescription->drugs); $loaded_ward_eyes = explode(",", $ward_prescription->eye); @endphp @for($j = 0; $j < count($loaded_ward_prescriptions); $j++) @if(!isset($avoid_double_display_array[$loaded_ward_prescriptions[$j]])) @php // get the quantity given so far of this particular treatment $ward_quantities_given = \Streamline\Models\WardTreatmentDispensation::where(['patient_id' => $patient_id, 'episode_id' => $episode_id, 'drug_id' => $loaded_ward_prescriptions[$j]])->get(); $drug_quantity_dispensed_so_far = 0; $drug_treatment_sheet_quantity_dispensed_so_far = 0; foreach($ward_quantities_given as $ward_quantity_given){ $drug_quantity_dispensed_so_far += $ward_quantity_given->quantity_given; } foreach($ward_quantities_given as $ward_quantity_given){ $drug_treatment_sheet_quantity_dispensed_so_far += $ward_quantity_given->quantity_given_treatment_sheet; } @endphp @if (in_array($loaded_ward_prescriptions[$j], $stopped_ward_drugs_array)) @else @endif @endif @endfor @endforeach @endif @php $ward_quantities_given_option = \Illuminate\Support\Facades\DB::table('ward_treatment_dispensations')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->groupBy('drug_id')->selectRaw('*, sum(quantity_given) as quantity_given, sum(quantity_given_treatment_sheet) as quantity_given_treatment_sheet')->get(); @endphp @foreach($ward_quantities_given_option as $record) @if(!isset($avoid_double_display_array[$record->drug_id])) @endif @endforeach
    {{ __('inpatient.drug') }} {{ __('inpatient.quantity_dispensed') }}    {{ __('inpatient.quantity_administered') }}    {{ __('inpatient.ward_stock_dispensed') }}
    {{ Form::hidden('ward_treatment_id[]', 0) }} {{ Form::hidden('ward_dispensed_drug_id[]', $loaded_ward_prescriptions[$j]) }} {{ Form::hidden('ward_dispensed_drug_name[]', get_name($loaded_ward_prescriptions[$j],'id','name','drugs')) }} {{ get_name($loaded_ward_prescriptions[$j],'id','name','drugs') }} @if ($is_eye_module_enabled && !empty($loaded_ward_eyes))
    {{ $eyes[$loaded_ward_eyes[$j]] }} @endif @php $avoid_double_display_array[$loaded_ward_prescriptions[$j]] = $loaded_ward_prescriptions[$j]; @endphp
    {{ Form::number('ward_quantity_dispensed_so_far[]', $drug_quantity_dispensed_so_far, ['class' => 'form-control', 'readonly' => 'true', 'step' => '.01']) }} {{ Form::number('quantity_given_treatment_sheet[]', $drug_treatment_sheet_quantity_dispensed_so_far, ['class' => 'form-control', 'readonly' => 'true']) }} {{ Form::number('ward_quantity_dispensed[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.drug_stopped'),'step' => '.01', 'readonly' => 'true']) }} {{ Form::number('ward_quantity_dispensed[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.add_more'),'step' => '.01']) }}
    {{ Form::hidden('ward_treatment_id[]', 0) }} {{ Form::hidden('ward_dispensed_drug_id[]', $record->drug_id) }} {{ Form::hidden('ward_dispensed_drug_name[]', get_name($record->drug_id,'id','name','drugs')) }} {{ get_name($record->drug_id,'id','name','drugs') }} {{ Form::number('ward_quantity_dispensed_so_far[]', $record->quantity_given, ['class' => 'form-control', 'readonly' => 'true', 'step' => '.01']) }} {{ Form::number('quantity_given_treatment_sheet[]', $record->quantity_given_treatment_sheet, ['class' => 'form-control', 'readonly' => 'true']) }} {{ Form::number('ward_quantity_dispensed[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.add_more'), 'step' => '.01']) }}
    @endif @php $ward_treatment_counter = 0; @endphp @if(get_ward_prescription_model() == 2)

    {{ __('inpatient.ward_treatments') }}

    @php $inpatient_ward_treatment = @unserialize($inpatient_info->ward_treatments); @endphp @if(empty($inpatient_ward_treatment))
    {{ Form::select('drugs[]', $drugs, '', ['class' => 'form-control select']) }}
    {{ Form::number('drugs_days[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.days')]) }}
    @else @php // for old streamline system records which were using a weird naming convention $ward_drugs = isset($inpatient_ward_treatment['drugs']) ? $inpatient_ward_treatment['drugs'] : $inpatient_ward_treatment['Drugs']; $days = isset($inpatient_ward_treatment['days']) ? $inpatient_ward_treatment['days'] : $inpatient_ward_treatment['Days']; @endphp @if(is_array($ward_drugs)) @for($i = 0; $i < count($ward_drugs); $i++) @if($ward_treatment_counter > 0)
    {{ Form::select('drugs[]', $drugs, $ward_drugs[$i], ['class' => 'form-control select']) }}
    {{ Form::number('drugs_days[]', $days[$i], ['class' => 'form-control']) }}
    @else
    {{ Form::select('drugs[]', $drugs, $ward_drugs[$i], ['class' => 'form-control select']) }}
    {{ Form::number('drugs_days[]', $days[$i], ['class' => 'form-control']) }}
    @endif @php $ward_treatment_counter++; @endphp @endfor @else
    {{ Form::select('drugs[]', $drugs, '', ['class' => 'form-control select']) }}
    {{ Form::number('drugs_days[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.days')]) }}
    @endif @endif

    {{ __('inpatient.add_treatment') }} @endif

    Prescribed Protocols

    @if(count($ordered_cancer_protocols) > 0) @foreach($ordered_cancer_protocols as $ordered_cancer_protocol) {{ Form::hidden('ordered_cancer_protocol_id[]', $ordered_cancer_protocol->id) }} @endforeach @else @endif
    Protocol Name Prescription Date Prescribed By Status
    {{ get_name($ordered_cancer_protocol->protocol_id, 'id', 'name', 'cancer_protocols') }} {{ streamline_date_time($ordered_cancer_protocol->created_at) }} {{ get_full_name($ordered_cancer_protocol->created_by, 'id', 'first_name', 'last_name', 'users') }} {{ Form::select('ordered_cancer_protocol_status[]', [0 => 'Ongoing', 1 => 'Stopped', 2 => 'Completed'], $ordered_cancer_protocol->protocol_status, ['class' => 'form-control']) }} @if($ordered_cancer_protocol->pre_chemo_status == 0 && $ordered_cancer_protocol->chemo_status == 0 && $ordered_cancer_protocol->post_chemo_status == 0) Cancel Protocol @endif
    No cancer protocols prescribed
    @if(Auth::user()->can('prescribe-cancer-protocol')) {{ Form::button("Prescribe Protocol",['type'=>'submit','class'=>'btn btn-primary btn-small pull-right','name'=>'submit-btn','value'=>'cancer_protocol']) }} @endif
    @endif @if( Auth::user()->can('add-to-take-home-drugs-on-inpatient-sheet'))

    {{ __('inpatient.tta') }}

    @if(count($treatment_to_take_away) > 0) @foreach($treatment_to_take_away as $treatment) @php $tta_drugs_array = explode(",", $treatment->drugs); $tta_dose_array = explode(",", $treatment->doses); $tta_freq_array = explode(",", $treatment->frequencies); $tta_duration_array = explode(",", $treatment->durations); $tta_eyes_array = explode(",", $treatment->eye); $purchased_elsewhere_array = is_null($treatment->purchased_elsewhere) ? [] : explode(",", $treatment->purchased_elsewhere); @endphp @for($x = 0; $x < count($tta_drugs_array); $x++) @php $drug_name = get_name($tta_drugs_array[$x], 'id', "name", 'drugs'); $drug_unit = get_name(get_name($tta_drugs_array[$x], 'id', "unit_id", 'drugs'), "id", "name", "drug_units"); $frequency = get_name($tta_freq_array[$x], "id", "name", "dosage_frequencies"); @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
    {{ __('inpatient.name') }} {{ __('inpatient.dose') }} {{ __('inpatient.duration') }} {{ __('inpatient.status') }}
    {{ __('inpatient.ordered_on') }} {{ streamline_date_time($treatment->created_at) }} {{ __('inpatient.by') }} {{ get_full_name($treatment->created_by, "id", "first_name", "last_name", "users") }}
    {{ $drug_name }} @if ($is_eye_module_enabled && !empty($tta_eyes_array))
    {{ $eyes[($tta_eyes_array[$x] ?? 0)] }} @endif
    {{ $tta_dose_array[$x] }} {{ $drug_unit }} {{ $frequency}} {{ $tta_duration_array[$x] }}Purchased From Elsewhere{{ __('inpatient.dispensed') }}{{ __('inpatient.pending_dispensing') }}
    {{ __('inpatient.no_tta_ordered') }}
    {{ Form::button(__('inpatient.order_tta'),['type'=>'submit','class'=>'btn btn-primary btn-small pull-right','name'=>'submit-btn','value'=>'order_tta']) }}

    @endif {{-- Adds Theatre Surgery Notes --}} @php $theatre_surgeries = DB::table('surgeries')->orderBy('id', 'desc')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->take(20)->get(); @endphp @if( Auth::user()->can('view-theatre-notes-from-the-inpatient-sheet') && count($theatre_surgeries) > 0) @if(!is_null($theatre_surgeries->first()->comments))

    {{ __('inpatient.theater_surgery_notes') }}

    @foreach($theatre_surgeries as $surgery) @endforeach
    {{ $surgery->comments }}
    {{ get_full_name($surgery->created_by, "id", "first_name", "last_name", "users") }} {{ __('inpatient.on') }} {{ streamline_date_time_short($surgery->created_at) }} {{ __('inpatient.print_surgery_report') }}
    @endif @endif
    {{-- In patient sheet with detailed notes --}} @if (is_inpatient_sheet_with_detailed_notes_enabled())
    @if( Auth::user()->can('view-medical-detailed-notes-on-inpatient-sheet')) @php $inpatient_detailed_notes = DB::table('ward_inpatient_detailed_notes')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get(); @endphp @if(count($inpatient_detailed_notes) > 0) @foreach($inpatient_detailed_notes as $comment_record) @endforeach
    {{ __('inpatient.print_inpatient_detailed_notes') }}
    history)) style="display:none;"@endif>{{ __('inpatient.history') }}
    {{ $comment_record->history }}
    result)) style="display:none;"@endif>{{ __('inpatient.results') }}
    {{ $comment_record->result }}
    vitals)) style="display:none;"@endif>{{ __('inpatient.vitals_and_examination') }}
    {{ $comment_record->vitals }}
    impression)) style="display:none;"@endif>{{ __('inpatient.impression') }}
    {{ $comment_record->impression }}
    plan)) style="display:none;"@endif>{{ __('inpatient.plan') }}
    {{ $comment_record->plan }}   {{ get_full_name($comment_record->created_by, "id", "first_name", "last_name", "users") }} {{ __('inpatient.on') }} {{ streamline_date_time_short($comment_record->created_at) }} {{-- edit_doctors_detailed_notes --}} @if( Auth::user()->can('edit-inpatient-detailed-notes') && (auth()->user()->id == $comment_record->created_by)) Edit @endif @if( Auth::user()->can('delete-inpatient-detailed-notes') && (auth()->user()->id == $comment_record->created_by)) {{ __('inpatient.delete') }} @endif {{-- doctors detailed notes modal --}}

    {{ __('inpatient.view_all_notes') }}

    @endif @endif
    @if( Auth::user()->can('add-medical-history-on-inpatient-sheet'))

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

    @endif @if( Auth::user()->can('add-medical-results-on-inpatient-sheet'))

    {{ __('inpatient.results') }}

    @endif @if( Auth::user()->can('add-vitals-and-examination-on-inpatient-sheet'))

    {{ __('inpatient.vitals_and_examination') }}

    @endif
    @if( Auth::user()->can('add-impression-on-inpatient-sheet'))

    {{ __('inpatient.impression') }}

    @endif @if( Auth::user()->can('add-plan-on-inpatient-sheet'))

    {{ __('inpatient.plan') }}

    @endif
    @endif

    {{ __('inpatient.doctor_progress_notes') }}

    @php $sheet_comments = DB::table('ward_inpatient_sheet_comments')->orderBy('id', 'desc')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->take(1)->get(); @endphp @if(count($sheet_comments) > 0) @foreach($sheet_comments as $comment_record) @endforeach
    {{ __('inpatient.print_notes') }}
    {{ $comment_record->ward_comments }}

    {{ get_full_name($comment_record->created_by, "id", "first_name", "last_name", "users") }} {{ __('inpatient.on') }} {{ streamline_date_time_short($comment_record->created_at) }}
    @endif {{-- Adds Doctor's progress Notes --}} @if( Auth::user()->can('add-comments-on-inpatient-sheet'))

    {{ __('inpatient.view_all_comments') }}

    @endif

    {{ __('inpatient.nurse_progress_notes') }}

    @php $sheet_comments = DB::table('ward_inpatient_sheet_nurse_comments')->orderBy('id', 'desc')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->take(1)->get(); @endphp @if(count($sheet_comments) > 0) @foreach($sheet_comments as $comment_record) @endforeach
    {{ __('inpatient.print_notes') }}
    {{ $comment_record->ward_comments }}

    {{ get_full_name($comment_record->created_by, "id", "first_name", "last_name", "users") }} on {{ streamline_date_time_short($comment_record->created_at) }}
    @endif {{-- Adds Nurse's progress Notes --}} @if( Auth::user()->can('add-nurse-comments-on-inpatient-sheet'))

    {{ __('inpatient.view_all_comments') }}

    @endif

    @if( Auth::user()->can('view-inpatient-billing')) {{ Form::button(__('inpatient.inpatient_billing'),['type'=>'submit','class' => 'btn btn-info', 'name'=>'submit-btn','value'=>'billing', 'id' => 'submitInpatientBillButton']) }} @endif
    @if( Auth::user()->can('add-inpatient-sheet-outcome'))

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

    {{ Form::select('outcome',$outcomes, $inpatient_info->outcome_id??'',['class' => 'form-control','id'=>'outcome']) }} @endif
    outcome_id !== 2) style="display: none;" @endif>
    died_on)) style="display: none;" @endif>
    {{ Form::label('died_on',__('inpatient.died_on')) }}

    {{ Form::text('died_on', '',['class' => 'form-control compulsory datepicker-autoclose', 'readonly', 'id'=>'died_on']) }}
    outcome_id !== 3) style="display: none;" @endif>
    {{ Form::label('followup_clinic_allocation', __('consultations.assigned_clinic')) }} {{ Form::select('followup_clinic_allocation', $clinics, $patient_appointment->followup_clinic_allocation?? 0, ['class' => 'form-control col-sm-12 compulsory']) }}
    {{ Form::label('followup_in_charge', __('consultations.assign_incharge')) }}
    {{ Form::label('followup_when',__('consultations.when')) }}
    {{ Form::text('followup_when', Carbon\Carbon::parse($inpatient_info->followup_when)->format('d/m/Y')?? '',['class' => 'form-control compulsory datepicker-autoclose','readonly', 'id' => 'followup_when']) }}
    {{ Form::label('followup_in_time', __('consultations.appointment_time')) }} {{ Form::time('followup_in_time',$patient_appointment->appointment_time??'',['class' => 'form-control']) }}
    outcome_id !== 4) style="display: none;" @endif>
    {{ Form::label('referral_id',__('inpatient.referred_to')) }}
    {{ Form::select('referral_id', $referrals, $inpatient_info->referred_to?? '', ['class' => 'form-control compulsory']) }}
    {{ Form::label('referral_notes', __('inpatient.referral_notes')) }}
    outcome_id !== 3 && $inpatient_info->outcome_id !== 2) style="display: none;" @endif>
    {{ Form::label('discharge_summary', __('inpatient.discharge_summary')) }}

    {{ Form::label('clinical_summary', __('inpatient.clinical_summary')) }}
    @if( Auth::user()->can('save-inpatient-sheet')) {{ Form::button(__('inpatient.save_inpatient_sheet'),['type'=>'submit','class' => 'btn btn-success', 'style'=>'float:right;','name'=>'submit-btn','value'=>'save', 'id' => 'submitInpatientButton']) }} @endif
    {{ Form::close() }}
    @include('ward_management::inpatient.treatment_sheet_details') {{-- doctor comments modal --}} @endsection @push('scripts') @endpush