@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']) }}
{{ __('inpatient.admitted') }}
{{ __('inpatient.discharged') }}
{{ __('inpatient.ward') }}
{{ __('inpatient.specialty') }}
{{ __('inpatient.residence') }}
{{ streamline_date($inpatient_info->admitted_on) }}
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
{{ 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') }}
{{ __('inpatient.bed_no') }}
{{ __('inpatient.bed_category') }}
{{ __('inpatient.ward') }}
{{ __('inpatient.from') }}
{{ __('inpatient.to') }}
{{ __('inpatient.duration') }}
{{ __('inpatient.bed_rate') }}
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) }}
{{ 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)
{{ __('inpatient.still_here') }}
{{ __('inpatient.select_date') }}
{{ Form::text('on_bed_upto[]',\Carbon\Carbon::now()->toDateString(),['class' => 'form-control bed_dates','readonly','id'=>'on_bed_upto_'.$bed_category_fields]) }}
@else
{{ Form::text('on_bed_upto[]', $record->to, ['class' => 'form-control bed_dates', 'readonly', 'id'=>'on_bed_upto_'.$bed_category_fields]) }}
@endif
@php $bed_category_fields++; @endphp
@endforeach
@else
{{ 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']) }}
{{ __('inpatient.still_here') }}
{{ __('inpatient.select_date') }}
{{ Form::text('on_bed_upto[]', \Carbon\Carbon::now()->toDateString(), ['class' => 'form-control bed_dates','readonly','id'=>'on_bed_upto_0']) }}
@php
$current_date = \Carbon\Carbon::now();
$duration_in_days = $admission_date->diffInDays($current_date);
@endphp
@php $bed_category_fields++; @endphp
@endif
{{ __('inpatient.add_bed') }}
@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 = "
-select- ";
$all_diagnosis_categories = ['' => '- select -'];
foreach ($diagnosis_categories as $item){
$diagnosis_categories_options .= "
$item->name ";
$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)
{{ __('inpatient.comments') }}
{{ $cons_comments->comments }}
@endif
@if($cons_comments->history_comments)
{{ __('inpatient.history') }}
{{ $cons_comments->history_comments }}
@endif
@if($cons_comments->clinic_examination_comments)
{{ __('consultations.clinical_examination') }}
{{ $cons_comments->clinic_examination_comments }}
@endif
@if($cons_comments->investigation_and_management_plan_comments)
{{ __('consultations.investigation_and_mgt_plan') }}
{{ $cons_comments->investigation_and_management_plan_comments }}
@endif
@endif --}}
{{-- fetch consultation notes --}}
@if ( count($consultation_notes) > 0 )
{{-- History consultation notes --}}
{{ __('inpatient.opd_consultation_comments') }}
{{ __('consultations.history') }}
@forelse ($consultation_notes as $consultation_note)
@if(!empty($consultation_note->history_comments))
{{ $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) ?? '' }}
@endif
@empty
{{-- {{ __('consultations.no_previous_notes') }} --}}
@endforelse
{{-- Clinic Examination consultation notes --}}
{{ __('consultations.clinical_examination') }}
@forelse ($consultation_notes as $consultation_note)
@if(!empty($consultation_note->clinic_examination_comments))
{{ $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) ?? '' }}
@endif
@empty
{{-- {{ __('consultations.no_previous_notes') }} --}}
@endforelse
{{-- Investigation and Management Plan consultation notes --}}
{{ __('consultations.investigation_and_mgt_plan') }}
@forelse ($consultation_notes as $consultation_note)
@if(!empty($consultation_note->investigation_and_management_plan_comments))
{{ $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) ?? '' }}
@endif
@empty
{{-- {{ __('consultations.no_previous_notes') }} --}}
@endforelse
@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)
{{ __('inpatient.history') }}
{{ $anc_comments->history_comments }}
@endif
@if($anc_comments->clinic_examination_comments)
{{ __('consultations.clinical_examination') }}
{{ $anc_comments->clinic_examination_comments }}
@endif
@if($anc_comments->investigation_and_management_plan_comments)
{{ __('consultations.investigation_and_mgt_plan') }}
{{ $anc_comments->investigation_and_management_plan_comments }}
@endif
@endif
@if(count($documents) > 0)
@foreach($documents as $document)
{{ $document->title }}
@endforeach
@else
{{ __('inpatient.no_documents_available') }}
@endif
{{ __('inpatient.symptoms') }}
{{ __('inpatient.duration') }}
@if($triage)
@php
$symptoms_explode = explode(",", $triage->symptoms);
$duration_explode = explode(",", $triage->symptom_duration);
@endphp
@for($i = 0; $i < count($symptoms_explode); $i++)
@if(isset($symptoms[$symptoms_explode[$i]]))
{{ $symptoms[$symptoms_explode[$i]] }}
@else
N/A
@endif
{{ $duration_explode[$i] ?? '' }}
@endfor
@else
{{ __('inpatient.no_symptoms_triage') }}
@endif
{{ __('inpatient.name') }}
{{ __('inpatient.value') }}
{{ __('inpatient.normal_range') }}
{{ __('inpatient.comment') }}
@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))
{{ $opd_investigations_date[array_search($i, $opd_investigations_position)] }}
@endif
{{ $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] }}
@endif
@endfor
@else
{{ __('inpatient.no_opd_invs') }}
@endif
{{ __('inpatient.name') }}
{{ __('inpatient.value') }}
{{ __('inpatient.normal_range') }}
{{ __('inpatient.comment') }}
@if(count($ward_investigations) > 0)
@for($i = 0; $i < count($ward_investigations['name']); $i++)
@if(in_array($i, $ward_investigations_position))
{{ $ward_investigations_date[array_search($i, $ward_investigations_position)] }}
@endif
{{ $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] }}
@endfor
@else
{{ __('inpatient.no_ward_invs') }}
@endif
{{ 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))
{{ __('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
@if( Auth::user()->can('add-new-diagnosis-from-consultation'))
{{ __('consultations.add_new_diagnosis') }}
@endif
{{ __('inpatient.other_diagnosis') }}
{{ __('inpatient.prompt') }}
{{ __('inpatient.references') }}
@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 .= "" . str_replace('"', "", $value) . " ";
}
@endphp
@if(empty($other_diagnoses))
@php echo $option_diagnoses; @endphp
@else
@foreach($other_diagnoses as $key => $diagnosis)
{{ 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 : '' }}
@endforeach
@endif
{{ __('consultations.add_row') }}
@endif
@if ($is_eye_module_enabled && Auth::user()->can('view-patient-episode-primary-diagnoses'))
@if($inpatient_info->right_eye_diagnosis)
{{ __('patient_episode.right_eye_diagnosis') }}
SECTION
DIAGNOSIS
@php
$diagnosis_id_array = explode(",", $inpatient_info->right_eye_diagnosis);
@endphp
@if(count($diagnosis_id_array) > 0)
@foreach($diagnosis_id_array as $id)
{{ get_name(get_name($id, 'id', 'diagnosis_category', 'diagnoses'), 'id', 'name', 'diagnosis_categories') }}
{{ get_name($id, 'id', 'name', 'diagnoses') }}
@endforeach
@else
No Diagnosis was registered for this patient...
@endif
{{ __('diagnoses.add_diagnosis') }}
@else
{{ __('patient_episode.right_eye_diagnosis') }}
@endif
@if($inpatient_info->left_eye_diagnosis)
{{ __('patient_episode.left_eye_diagnosis') }}
SECTION
DIAGNOSIS
@php
$diagnosis_id_array = explode(",", $inpatient_info->left_eye_diagnosis);
@endphp
@if(count($diagnosis_id_array) > 0)
@foreach($diagnosis_id_array as $id)
{{ get_name(get_name($id, 'id', 'diagnosis_category', 'diagnoses'), 'id', 'name', 'diagnosis_categories') }}
{{ get_name($id, 'id', 'name', 'diagnoses') }}
@endforeach
@else
No Diagnosis was registered for this patient...
@endif
{{ __('diagnoses.add_diagnosis') }}
@else
{{ __('patient_episode.left_eye_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
{{ ($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' }}
@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
{{ ($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' }}
@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') }}
{{ __('inpatient.procedure') }}
{{ __('inpatient.performed') }}
{{ __('inpatient.performed_by') }}
@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++)
{{ 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" }}
@endfor
@endforeach
@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') }}
{{ __('inpatient.add_procedure') }}
@endif
@php $sundries_counter = 0; @endphp
@if( Auth::user()->can('add-sundries-on-inpatient-sheet'))
@endif
@php $extras_counter = 0; @endphp
@if(Auth::user()->can('add-extras-on-inpatient-sheet') && is_inpatient_sheet_extras_enabled())
@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') }}
{{ __('inpatient.service') }}
{{ __('inpatient.quantity') }}
{{ __('inpatient.performed') }}
@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++)
{{ 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").' ' !!}
@endfor
@endforeach
@endif
{{ __('inpatient.consultation_and_services') }}
{{ __('inpatient.unit_price') }}
{{ __('inpatient.staff_fee') }}
{{ __('inpatient.date') }}
{{ __('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') }}
{{ __('inpatient.name') }}
{{ __('inpatient.dose') }}
{{ __('inpatient.duration') }}
{{ __('inpatient.status') }}
@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
{{ $x+1 }}. {{ $drug_name }}
{{ $opd_treatment_dose_array[$x] }} {{ $drug_unit }} {{ $frequency}}
{{ $opd_treatment_duration_array[$x] }}
@if($opd_treatment->dispense_status == 1)
@if(isset($opd_purchased_elsewhere_array[$x]) && $opd_purchased_elsewhere_array[$x] == 1)
Purchased From Elsewhere
@else
{{ __('inpatient.dispensed') }}
@endif
@else
{{ __('inpatient.pending_dispensing') }}
@endif
@endfor
{{ __('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) }}
@endforeach
@endif
@php
$stopped_ward_drugs_array = [];
@endphp
@if(get_ward_prescription_model() == 1)
{{ __('inpatient.ward_prescription') }}
{{ __('inpatient.name') }}
{{ __('inpatient.dose') }}
{{ __('inpatient.duration') }}
{{ ucfirst(__('inpatient.quantity')) }}
@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
{{ __('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")}}
@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
{{ $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] }}
@endfor
@if(Auth::user()->can('cancel-ward-prescription'))
Cancel prescription
@endif
@endforeach
@else
{{ __('inpatient.no_ward_drugs') }}
@endif
{{ Form::button(__('inpatient.order_ward_presc'),['type'=>'submit','class'=>'btn btn-primary btn-small pull-right','name'=>'submit-btn','value'=>'ward_prescription']) }}
{{ __('inpatient.drug') }}
{{ __('inpatient.quantity_dispensed') }}
{{ __('inpatient.quantity_administered') }}
{{ __('inpatient.ward_stock_dispensed') }}
@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
{{ 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']) }}
@if (in_array($loaded_ward_prescriptions[$j], $stopped_ward_drugs_array))
{{ Form::number('ward_quantity_dispensed[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.drug_stopped'),'step' => '.01', 'readonly' => 'true']) }}
@else
{{ Form::number('ward_quantity_dispensed[]', '', ['class' => 'form-control', 'placeholder' => __('inpatient.add_more'),'step' => '.01']) }}
@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]))
{{ 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
@endforeach
@endif
@php $ward_treatment_counter = 0; @endphp
@if(get_ward_prescription_model() == 2)
{{ __('inpatient.ward_treatments') }}
{{ __('inpatient.add_treatment') }}
@endif
Prescribed Protocols
Protocol Name
Prescription Date
Prescribed By
Status
@if(count($ordered_cancer_protocols) > 0)
@foreach($ordered_cancer_protocols as $ordered_cancer_protocol)
{{ Form::hidden('ordered_cancer_protocol_id[]', $ordered_cancer_protocol->id) }}
{{ 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
@endforeach
@else
No cancer protocols prescribed
@endif
@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') }}
{{ __('inpatient.name') }}
{{ __('inpatient.dose') }}
{{ __('inpatient.duration') }}
{{ __('inpatient.status') }}
@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
{{ __('inpatient.ordered_on') }} {{ streamline_date_time($treatment->created_at) }} {{ __('inpatient.by') }} {{ get_full_name($treatment->created_by, "id", "first_name", "last_name", "users") }}
@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
{{ $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] }}
@if(isset($purchased_elsewhere_array[$x]) && $purchased_elsewhere_array[$x] == 1)
Purchased From Elsewhere
@else
@if($treatment->dispense_status == 1)
{{ __('inpatient.dispensed') }}
@else
{{ __('inpatient.pending_dispensing') }}
@endif
@endif
@endfor
@endforeach
@else
{{ __('inpatient.no_tta_ordered') }}
@endif
{{ 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)
{{ $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') }}
@endforeach
@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)
{{ __('inpatient.print_inpatient_detailed_notes') }}
@foreach($inpatient_detailed_notes as $comment_record)
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 --}}
@endforeach
@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)
{{ __('inpatient.print_notes') }}
@foreach($sheet_comments as $comment_record)
{{ $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) }}
@endforeach
@endif
{{-- Adds Doctor's progress Notes --}}
@if( Auth::user()->can('add-comments-on-inpatient-sheet'))
@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)
{{ __('inpatient.print_notes') }}
@foreach($sheet_comments as $comment_record)
{{ $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) }}
@endforeach
@endif
{{-- Adds Nurse's progress Notes --}}
@if( Auth::user()->can('add-nurse-comments-on-inpatient-sheet'))
@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>
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')) }}
{{ __('consultations.not_assigned') }}
@foreach($users as $user)
followup_in_charge)&& $user->id == $patient_appointment->followup_in_charge) selected @endif value="{{ $user->id }}">{{ $user->first_name }} {{ $user->last_name }}
@endforeach
{{ 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_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() }}