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

{{ __('prescriptions.treatment_for_episode') }}:{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}

@include('patients::allergies.header')
@include('flash::message') @foreach ($errors->all() as $error)
{{ $error }}
@endforeach
{{ Form::open(['route' => 'prescriptions.display_selected_drugs' , 'id'=>'prescriptions_form']) }} {!! session()->get("ward_prescription") == 1 ? "__('prescriptions.ward_prescription')" : "" !!}
{{ Form::label('drugs', __("prescriptions.prescribe_drugs")) }}
{{ Form::select('prescription_drugs[]',$drugs,'',['id'=>'prescription-drugs','multiple'=>true,'class' => 'form-control col-sm-8 compulsory prescription-drugs']) }}
{{ Form::button('Confirm Treatment',['type'=>'submit','class'=>'btn btn-secondary waves-effect waves-light m-r-10','style'=>'padding: .6rem 1.2rem;']) }}
{{ Form::close() }}
@php $fre_drop = ""; $fre_query = "select * from dosage_frequencies order by name"; $results = \DB::select($fre_query); foreach ($results as $result){ $fre_drop .= ""; } @endphp
{{ Form::open(['route' => 'prescriptions.process' , 'data-toggle' => 'validator', 'id' => 'selected_drugs_form']) }} @if($patient_prescriptions) @if(count($patient_prescriptions) > 0) @foreach($patient_prescriptions as $prescription) @php $patient_is_allergic = \Modules\Pharmacy\Http\Controllers\PrescriptionsController::checkPatientAllergies($patient_id, $prescription->category_id); @endphp @endforeach @endif @else @endif @if(count($dispensed_drugs_from_parent_episode)) @foreach($dispensed_drugs_from_parent_episode as $dispensed_treatment) @if($dispensed_treatment->altered == 0) @php $drugs_array = explode(",", $dispensed_treatment->drugs); $dosage_array = explode(",", $dispensed_treatment->doses); $dosage2_array = explode(",", $dispensed_treatment->dose2); $frequencies_array = explode(",", $dispensed_treatment->frequencies); $duration_array = explode(",", $dispensed_treatment->durations); $quantity_dispensed_array = explode(",", $dispensed_treatment->quantities_dispensed); $instructions_array = explode(",", $dispensed_treatment->instruction); @endphp @for($j = 0; $j < count($drugs_array); $j++) @php $drug_details = \Streamline\Models\Drug::find($drugs_array[$j]); $frequency_name = get_name($frequencies_array[$j], 'id', 'name', 'dosage_frequencies'); $unit = get_name($drugs_array[$j], 'id', 'name', 'drug_units'); $unit = $unit=="N/A"?"":$unit; $drug_unit = "" . $unit . ""; $dose2 = (empty($dosage2_array[$j])) ? "" : " | " . $dosage2_array[$j] . $drug_unit; @endphp @endfor @else @php $drugs_array = explode(",", get_name($dispensed_treatment->altered, 'id', 'drugs', 'patient_dispensings')); $dosage_array = explode(",", get_name($dispensed_treatment->altered, 'id', 'dose', 'patient_dispensings')); $dosage2_array = explode(",", get_name($dispensed_treatment->altered, 'id', 'dose2', 'patient_dispensings')); $frequencies_array = explode(",", get_name($dispensed_treatment->altered, 'id', 'drug_frequency', 'patient_dispensings')); $duration_array = explode(",", get_name($dispensed_treatment->altered, 'id', 'duration', 'patient_dispensings')); $quantity_dispensed_array = explode(",", get_name($dispensed_treatment->altered, 'id', 'quantity_dispensed', 'patient_dispensings')); $instructions_array = explode(",", get_name($dispensed_treatment->altered, 'id', 'instructions', 'patient_dispensings')); @endphp @for($k = 0; $k < count($drugs_array); $k++) @php $drug_details = \Streamline\Models\Drug::find($drugs_array[$k]); $frequency_name = get_name($frequencies_array[$k], 'id', 'name', 'dosage_frequencies'); $unit = get_name($drugs_array[$k], 'id', 'name', 'drug_units'); $unit = $unit=="N/A"?"":$unit; $drug_unit = "" . $unit . ""; $dose2 = (empty($dosage2_array[$k])) ? "" : " | " . $dosage2_array[$k] . $drug_unit; @endphp @endfor @endif @endforeach @endif @if($treatment) @php $drugs_array = explode(",", $treatment->drugs); $dosage_array = explode(",", $treatment->doses); $frequencies_array = explode(",", $treatment->frequencies); $duration_array = explode(",", $treatment->durations); $quantity_dispensed_array = explode(",", $treatment->quantities_dispensed); $total_drug_price = 0; $instructions_array = explode(",", $treatment->instruction); @endphp insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) ? "green" : "orange"; echo "" . "" . ""; ?> insurance_coverage == 1 && patient_insurance_status($patient_id) == 1){ $drug_price = $treament_drug->insured_price * $quantity_dispensed_array[$x]; } else { $drug_price = $treament_drug->non_insured_price * $quantity_dispensed_array[$x]; } $total_drug_price += $drug_price; echo ""; ?> "; } } $final_total = ugandan_shillings($total_drug_price); ?> @endif
# {{ __('prescriptions.drug') }} {{ __('prescriptions.dosage') }} {{ __('prescriptions.prompt') }} {{ __('prescriptions.duration') }} {{ __('prescriptions.dispense') }} {{ __('prescriptions.price') }} {{ __('prescriptions.instructions') }}
Selected
@php $total_stock = (($prescription->pharmacy_stock < 0) ? 0 : $prescription->pharmacy_stock) + (($prescription->store_stock < 0) ? 0 : $prescription->store_stock); @endphp @if ($total_stock > 0 && !$patient_is_allergic) @endif @php $insurance_color = ($prescription->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) ? "green" : "orange"; @endphp @if ($patient_is_allergic) {{ __('prescriptions.patient_is_allergic') }}   @endif @if ($total_stock <= 0) {{ __('prescriptions.out_of_stock') }} @endif {{ $prescription->name }} pharmacy_comment); $reference_array = explode(",", $prescription->reference_areas); $reference_name = explode(",", $prescription->reference_name); ?> @for ($x = 0; $x < count($reference_array); $x++) @if(isset($reference_array[$x]) && isset($reference_name[$x])) {{ $reference_name[$x] }}
@endif @endfor @if (!empty($pharm_comment))
{{ $pharm_comment }}
@endif
unit_id); ?> {{ $drugunit }}
prompt)): echo '
'; echo $prescription->prompt; echo "
"; endif; // Hidden field for Long Term echo ""; ?>
Duration in days form_id); ?> @if($prescription->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) @else @endif
{{ __('prescriptions.grand_total') }}
{{ __('prescriptions.no_drugs_searched') }}
{{ __('prescriptions.drug_refill_from') }} {{ streamline_date(get_name($parent_episode_id, 'id', 'created_at', 'patient_episodes')) }}
@php $total_stock = $drug_details->pharmacy_stock; @endphp @if ($total_stock > 0) @endif @php $insurance_color = ($drug_details->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) ? "green" : "orange"; @endphp @if ($total_stock <= 0) {{ __('prescriptions.out_of_stock') }} @endif {{ $drug_details->name }} pharmacy_comment); $reference_array = explode(",", $drug_details->reference_areas); $reference_name = explode(",", $drug_details->reference_name); ?> @for ($x = 0; $x < count($reference_array); $x++) @if(isset($reference_array[$x]) && isset($reference_name[$x])) {{ $reference_name[$x] }}
@endif @endfor @if (!empty($pharm_comment))
{{ $pharm_comment }}
@endif
unit_id); ?> {{ $drugunit }}
{{ __('prescriptions.add_dose') }}
prompt)): echo '
'; echo $drug_details->prompt; echo "
"; endif; // Hidden field for Long Term echo ""; ?>
@php $duration_with_days_text = explode(" ", $duration_array[$j]); @endphp {{ __('prescriptions.duration_in_days') }} form_id); ?> @if($drug_details->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) @else @endif
@php $total_stock = $drug_details->pharmacy_stock; @endphp @if ($total_stock > 0) @endif @php $insurance_color = ($drug_details->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) ? "green" : "orange"; @endphp @if ($total_stock <= 0) {{ __('prescriptions.out_of_stock') }} @endif {{ $drug_details->name }} pharmacy_comment); $reference_array = explode(",", $drug_details->reference_areas); $reference_name = explode(",", $drug_details->reference_name); ?> @for ($x = 0; $x < count($reference_array); $x++) @if(isset($reference_array[$x]) && isset($reference_name[$x])) {{ $reference_name[$x] }}
@endif @endfor @if (!empty($pharm_comment))
{{ $pharm_comment }}
@endif
unit_id); ?> {{ $drugunit }}
{{ __('prescriptions.add_dose') }}
prompt)): echo '
'; echo $drug_details->prompt; echo "
"; endif; // Hidden field for Long Term echo ""; ?>
@php $duration_with_days_text = explode(" ", $duration_array[$k]); @endphp {{ __('prescriptions.duration_in_days') }} form_id); ?> @if($drug_details->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) @else @endif
Pending Print
"; echo ""; echo "" . "" . $treament_drug->name . ""; $pharm_comment = trim($treament_drug->pharmacy_comment); if (!empty($pharm_comment)): echo "
" . $pharm_comment . "
"; endif; echo "
" . $treament_drug->prompt . ""; ?> Duration in days form_id); ?> @if($treament_drug->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) @else @endif " . ugandan_shillings($drug_price) . "
Grand total {{ $final_total }}
{{ Form::close() }}

Treatment Given For This Episode

@if(count($dispensed_drugs) > 0) @foreach($dispensed_drugs as $treatment) @php $drugs_array = explode(",", $treatment->drugs); $dosage_array = explode(",", $treatment->doses); $dosage2_array = explode(",", $treatment->dose2); $frequencies_array = explode(",", $treatment->frequencies); $duration_array = explode(",", $treatment->durations); $quantity_dispensed_array = explode(",", $treatment->quantities_dispensed); $instructions_array = explode(",", $treatment->instruction); @endphp @for($x = 0; $x < count($drugs_array); $x++) @php $frequency_name = get_name($frequencies_array[$x], 'id', 'name', 'dosage_frequencies'); $unit = get_name($drugs_array[$x], 'id', 'name', 'drug_units'); $unit = $unit=="N/A"?"":$unit; $drug_unit = "" . $unit . ""; $dose2 = (empty($dosage2_array[$x])) ? "" : " | " . $dosage2_array[$x] . $drug_unit; @endphp @endfor @endforeach @else @endif
DATE DRUG NAME DOSAGE DURATION QUANTITY STATUS INSTRUCTION
{{ streamline_date_time($treatment->updated_at) }} {{ get_name($drugs_array[$x], 'id', "name", 'drugs') }} {{ $dosage_array[$x] }} {!! $drug_unit !!} {{ $dose2 }}    {{ $frequency_name }} {{ $duration_array[$x] }} {{ $quantity_dispensed_array[$x] }} @if($treatment->altered == 0) {{ __('prescriptions.dispensed') }} @else {{ __('prescriptions.altered_and_dispensed') }} @endif {{ isset($instructions_array[$x]) ? trim($instructions_array[$x]) : 'N/A' }}
No treatment history for this episode
@endsection @push('scripts') @endpush