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

Theatre module - surgery

@include('patients::allergies.header')

@if(isset($surgeries) && count($surgeries) > 0)
PREVIOUS SURGERIES FROM EPISODE STARTED ON {{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }} @foreach($surgeries as $surgery_record) @endforeach
Surgery Surgeon Anaesthetist Time Of Commencement Date
@php $procedures_array = explode(",", $surgery_record->procedure_id); @endphp @for ($i = 0; $i < count($procedures_array); $i++) - {{ get_name($procedures_array[$i],'id','name','procedures') }}
@endfor
{{ get_full_name($surgery_record->surgeon, 'id', 'first_name', 'last_name', 'users') }} {{ get_name($surgery_record->anaesthesia_id,'id','id','anaesthesias') }} {{ $surgery_record->time_surgery_completed }} {{ streamline_date($surgery_record->created_at) }} View Details
@endif
@include('flash::message') @foreach ($errors->all() as $error)
{{ $error }}
@endforeach

{{ __('surgery.edit_surgery') }}


{{ Form::model($surgery_record,['method' => 'PUT','route' => ['theatre_surgery.update',$surgery_record->id],'data-toggle'=>'validator']) }} @if(!is_null($anaesthesia)) {{Form::hidden('anaesthesia_id', $anaesthesia->id)}} @endif {{ Form::hidden('anaesthesia_complete', $anaesthesia_complete) }} {{ Form::hidden('patient_id', $patient_id) }} {{ Form::hidden('episode_id', $episode_id) }} {{ Form::hidden('surgery_id', $surgery_record->id) }}
{{ __('inpatient.primary_diagnosis') }} {{ __('inpatient.prompt') }} {{ __('inpatient.references') }}
{{ Form::select('primary_diagnosis', $diagnoses, $surgery_record ? $surgery_record->primary_diagnosis : "", ['class' => 'form-control select col-sm-12 compulsory', 'required', 'id' => 'primary_diagnosis']) }}
{{ (isset($surgery_record->primary_diagnosis) && $surgery_record->primary_diagnosis != 0) ? $diagnoses_all->firstWhere('id',$surgery_record->primary_diagnosis)->prompts : "" }} 
@if(!is_null($surgery_record) && $surgery_record->primary_diagnosis != 0) @php $reference_names = explode(",", get_name($surgery_record->primary_diagnosis, 'id', 'reference_names', 'diagnoses')); $reference_areas = explode(",", get_name($surgery_record->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

@php $other_diagnoses = []; if($surgery_record){ $other_diagnoses = @unserialize($surgery_record->other_diagnoses); } @endphp @if(empty($other_diagnoses)) @else @foreach($other_diagnoses as $diagnosis) @endforeach @endif
# {{ __('inpatient.other_diagnosis') }} {{ __('inpatient.prompt') }} {{ __('inpatient.references') }}
{{ Form::select('other_diagnosis[]', $diagnoses, '', ['class' => 'form-control col-sm-12 sec_d']) }}
 
 
{{ Form::select('other_diagnosis[]', $diagnoses, $diagnosis, ['class' => 'form-control col-sm-12 select sec_d']) }}
{{ 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 : '' }} 
{{ __('inpatient.add_row') }} {{ __('inpatient.delete_row') }}


@php $procedures_array = explode(",", $surgery_record->procedure_id); @endphp {{ Form::label('procedure_id','Surgical procedure') }} {{ Form::select('procedure_id[]',$procedures, $procedures_array,['class' => 'form-control compulsory', 'required', 'data-error'=>'','id'=>'procedure_id','multiple'=>'true']) }}
{{ Form::label('surgeon','Surgeon') }} {{ Form::select('surgeon', $doctors, $surgery_record->surgeon, ['class' => 'form-control compulsory', 'required', 'data-error'=>'', 'id'=>'surgeon', 'onchange'=>'get_cadre(this.value)']) }}
add new surgeon
{{ Form::label('cadre','Cadre') }} {{ Form::text('cadre','',['class' => 'form-control', 'data-error'=>'','id'=>'cadre','readonly'=>'true']) }}
{{ Form::label('scrub_nurse','Scrub Nurse') }} {{ Form::select('scrub_nurse', $all_staff, $surgery_record->scrub_nurse, ['class' => 'form-control compulsory required', 'data-error'=>'','id'=>'scrub_nurse']) }}
add new nurse
{{ Form::label('authorised_swab_check','Scrub check authorised by') }} {{ Form::select('authorised_swab_check', $all_staff, $surgery_record->authorised_swab_check,['class' => 'form-control compulsory required', 'data-error'=>'','id'=>'authorised_swab_check']) }}
{{ Form::label('date_surgery_completed','Date surgery completed') }}
{{ Form::text('date_surgery_completed', '', ['class' => 'form-control','readonly','id'=>'datepicker-autoclose']) }}
{{ Form::label('time_surgery_completed','Time surgery completed') }} {{ Form::time('time_surgery_completed',$surgery_record->time_surgery_completed,['class' => 'form-control', 'data-error'=>'','id'=>'time_surgery_completed']) }}
{{ Form::label('estimated_blood_loss','Estimated blood loss (mLs)') }} {{ Form::number('estimated_blood_loss',$surgery_record->estimated_blood_loss,['class' => 'form-control', 'data-error'=>'','id'=>'estimated_blood_loss']) }}
{{ Form::label('comments','Comments') }} {{ Form::textarea('comments',$surgery_record->comments,['class' => 'form-control', 'data-error'=>'','id'=>'comments']) }}
Completed by {{ auth()->user()->first_name }} {{ auth()->user()->last_name }} on {{ streamline_date(date('d-m-Y')) }}


{{ Form::label('surgery_type','Surgery Type') }}
{{ Form::radio('surgery_type', 1, false, ["required"]) }} Elective    {{ Form::radio('surgery_type', 2, false, ["required"]) }} Emergency
{{ Form::label('assistant_surgeon','Assistant surgeon') }} {{ Form::select('assistant_surgeon', $doctors, $surgery_record->assistant_surgeon, ['class' => 'form-control compulsory', 'data-error'=>'','id'=>'assistant_surgeon','required']) }}
add new assistant surgeon
{{ Form::label('scrub_nurse','Other scrub staff') }} {{ Form::select('other_scrub_staff', $all_staff, $surgery_record->other_scrub_staff,['class' => 'form-control', 'data-error'=>'','id'=>'other_scrub_staff']) }}
add new scrub staff
{{ Form::label('theatre_location','Theatre location') }} {{ Form::select('theatre_location',$theatre_locations,$surgery_record->theatre_location,['class' => 'form-control', 'data-error'=>'','id'=>'theatre_location']) }}
add new theatre location
{{ Form::label('theatre_incharge','Designated in charge for this theatre') }} {{ Form::select('theatre_incharge', $all_staff, $surgery_record->theatre_in_charge,['class' => 'form-control compulsory', 'data-error'=>'','id'=>'theatre_incharge','required']) }}
add new nurse
@php $surgery_outcome = null; if (is_null($surgery_record->outcome)) { $surgery_outcome = is_null($episode_consultation_outcome) ? null : $episode_consultation_outcome; } else { $surgery_outcome = $surgery_record->outcome; } @endphp
{{ Form::label('outcome',__('surgery.outcome')) }} {{ Form::select('outcome',$outcomes, $surgery_outcome ,['class' => 'form-control', 'data-error'=>'','id'=>'outcome','required']) }}
@php $sundries_unserialized_array = @unserialize($surgery_record->sundries_used); $used_sundries_ids_array = isset($sundries_unserialized_array['sundries']) ? $sundries_unserialized_array['sundries'] : []; $used_sundries_quantities_array = isset($sundries_unserialized_array['quantity']) ? $sundries_unserialized_array['quantity'] : []; @endphp @if(!empty($used_sundries_ids_array)) @for($i=0; $i < count($used_sundries_ids_array) ; $i++)
{{ Form::label('sundries_used','Sundries used') }} {{ Form::select('sundries_used[]',$sundries_array,$used_sundries_ids_array[$i],['class' => 'form-control sundries_sutures', 'data-error'=>'']) }}
{{ Form::label('sundries_quantity_used','Quantity used') }} {{ Form::number('sundries_quantity_used[]',$used_sundries_quantities_array[$i],['class' => 'form-control', 'data-error'=>'']) }}
@endfor @else
{{ Form::label('sundries_used','Sundries used') }} {{ Form::select('sundries_used[]',$sundries_array,'',['class' => 'form-control sundries_sutures', 'data-error'=>'','id'=>'vicryl_sutures_used']) }}
{{ Form::label('sundries_quantity_used','Quantity used') }} {{ Form::number('sundries_quantity_used[]','',['class' => 'form-control', 'data-error'=>'']) }}
@endif
Add other sundries used

@php $theatre_extras_used = @unserialize($surgery_record->extras_used); $extras_array = isset($theatre_extras_used['extras']) ? $theatre_extras_used['extras'] : []; $extras_cost_array = isset($theatre_extras_used['cost']) ? $theatre_extras_used['cost'] : []; @endphp @if(count($extras_array) > 0) @for($j = 0; $j < count($extras_array); $j++) @php $extra_item = is_null($extras_array[$j]) ? "" : $extras_array[$j]; $extra_cost = is_null($extras_cost_array[$j]) ? "" : $extras_cost_array[$j]; @endphp
{{ Form::label('extras_used','Extras used') }} {{ Form::text('extras_used[]',$extra_item,['class' => 'form-control', 'data-error'=>'']) }}
{{ Form::label('extras_cost','Cost') }} {{ Form::number('extras_cost[]',$extra_cost,['class' => 'form-control', 'data-error'=>'']) }}
@endfor @else
{{ Form::label('extras_used','Extras used') }} {{ Form::text('extras_used[]','',['class' => 'form-control', 'data-error'=>'']) }}
{{ Form::label('extras_cost','Cost') }} {{ Form::number('extras_cost[]','',['class' => 'form-control', 'data-error'=>'']) }}
@endif
Add other extras used

If any risks identified for future procedures, please note them in Alerts box on top of Patient Home page.
{{ Form::submit('Update',['class' => 'btn btn-success']) }}
{{ Form::close() }}
@endsection @push('scripts') @endpush