mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 11:11:31 +00:00
1205 lines
70 KiB
PHP
Executable File
1205 lines
70 KiB
PHP
Executable File
@extends('layouts.main')
|
|
|
|
@push('styles')
|
|
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
|
<style>
|
|
.btn-default-bluish {
|
|
background: #b6cce2;
|
|
border: 1px solid #e4e7ea;
|
|
}
|
|
</style>
|
|
@endpush
|
|
|
|
@section('content')
|
|
<div class="row bg-title">
|
|
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
|
|
@if(session()->has('alter_episode_id'))
|
|
<h4 class="page-title">Alter Prescriptions</h4>
|
|
@else
|
|
<h4 class="page-title">{{ __('prescriptions.treatment_for_episode') }}:<a>{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</h4>
|
|
@endif
|
|
</div>
|
|
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
|
|
<ol class="breadcrumb">
|
|
<li><a href="{{ route('home') }}">{{ __('prescriptions.dashboard') }}</a></li>
|
|
<li><a href="{{ route('patient_episodes.index') }}">{{ __('prescriptions.patient_home') }}</a></li>
|
|
<li class="active">{{ __('prescriptions.prescription') }}</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
@include('patients::allergies.header')
|
|
<br>
|
|
</div>
|
|
</div>
|
|
|
|
@if( Auth::user()->can('view-previous-patient-prescriptions'))
|
|
@if(count($previous_treatments) > 0)
|
|
<div class="white-box" style="padding-top: 2px;">
|
|
<h3>{{ __('prescriptions.previous_prescriptions') }}</h3>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-striped color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('prescriptions.date') }}</th>
|
|
<th>{{ __('prescriptions.clinic') }}</th>
|
|
<th>{{ __('prescriptions.primary_diagnosis') }}</th>
|
|
<th>{{ __('prescriptions.other_diagnoses') }}</th>
|
|
<th>{{ __('prescriptions.prescribed_by') }}</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($previous_treatments as $past_treatment)
|
|
@php
|
|
$past_drug_ids_array = explode(",", $past_treatment->drugs);
|
|
$past_dosage_array = explode(",", $past_treatment->doses);
|
|
$past_quantities_array = explode(",", $past_treatment->quantities_dispensed);
|
|
$past_frequencies_array = explode(",", $past_treatment->frequencies);
|
|
$past_durations_array = explode(",", $past_treatment->durations);
|
|
$past_instructions_array = explode(",", $past_treatment->instructions);
|
|
@endphp
|
|
<tr>
|
|
<td>
|
|
{{ streamline_date_time($past_treatment->created_at) }}
|
|
<br>
|
|
@if(check_if_episode_is_a_followup($past_treatment->episode_id))
|
|
<small style="color: green"><br>({{ __('patient_episode.review_from') }} {{ streamline_date(get_name(get_name($past_treatment->episode_id, 'id', 'parent_episode_id', 'patient_episodes'), 'id', 'created_at', 'patient_episodes')) }})</small>
|
|
@endif
|
|
</td>
|
|
<td>
|
|
{{ get_name(get_name($past_treatment->episode_id, 'id', 'clinic_id', 'patient_episodes'), "id", "name", "clinics") }}
|
|
</td>
|
|
<td>
|
|
{{ get_name(get_name($past_treatment->episode_id, 'episode_id', 'primary_diagnosis', 'consultations'), 'id', 'name', 'diagnoses') }}
|
|
</td>
|
|
<td></td>
|
|
<td>{{ get_full_name($past_treatment->created_by, "id", "first_name", "last_name", "users") }}</td>
|
|
<td>
|
|
<a class="btn btn-rounded btn-xs btn-default-bluish" onclick="past_episode_row_details({{ $past_treatment->id }})">{{ __('prescriptions.view_details') }}</a>
|
|
</td>
|
|
</tr>
|
|
<tr class="past_episode_row" id="past_episode_row{{ $past_treatment->id }}" style="display: none">
|
|
<td colspan="6">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<td><b>{{ __('prescriptions.drug') }}</b></td>
|
|
<td><b>{{ __('prescriptions.dosage') }}</b></td>
|
|
<td><b>{{ __('prescriptions.duration_in_days') }}</b></td>
|
|
<td><b>{{ __('prescriptions.quantity') }}</b></td>
|
|
<td><b>{{ __('prescriptions.instruction') }}</b></td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@for ($w = 0; $w < count($past_drug_ids_array); $w++)
|
|
@php
|
|
$past_drug_unit_id = get_name(($past_drug_ids_array[$w] ?? 0), 'id', 'unit_id', 'drugs');
|
|
$past_frequency_name = get_name(($past_frequencies_array[$w] ?? 0), 'id', 'name', 'dosage_frequencies');
|
|
$past_unit = get_name($past_drug_unit_id, 'id', 'name', 'drug_units');
|
|
$past_unit = $past_unit=="N/A"?"":$past_unit;
|
|
$past_drug_unit = "<small>" . $past_unit . "</small>";
|
|
@endphp
|
|
<tr>
|
|
<td>
|
|
{{ get_name(($past_drug_ids_array[$w] ?? "NA"), "id", "name", "drugs") }}
|
|
</td>
|
|
<td>
|
|
{{ $past_dosage_array[$w] ?? "" }} {!! $past_drug_unit !!} {{ $past_frequency_name }}
|
|
</td>
|
|
<td>
|
|
{{ $past_durations_array[$w] ?? "" }}
|
|
</td>
|
|
<td>
|
|
{{ $past_quantities_array[$w] ?? "" }}
|
|
</td>
|
|
<td>
|
|
{{ $past_instructions_array[$w] ?? "" }}
|
|
</td>
|
|
</tr>
|
|
@endfor
|
|
<tr>
|
|
<td>
|
|
<b>{{ __('prescriptions.order_comments') }}</b>
|
|
</td>
|
|
<td colspan="2">
|
|
{!! $past_treatment->order_comments == 1 !!}
|
|
</td>
|
|
<td>
|
|
<b>{{ __('prescriptions.dispensation_status') }}</b>
|
|
</td>
|
|
<td>
|
|
{!! $past_treatment->dispense_status == 1 ? "<span style='color: green'>Dispensed</span>" : "<span style='color: red'>Not dispensed</span>" !!}
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@if(Auth::user()->can('view-patients-home'))
|
|
<a href="/patient_episodes/set_patient_id/{{ $patient->id }}" class="btn btn-rounded btn-primary btn-sm"><i class="fa fa-hand-pointer-o"></i> <strong>{{ __('prescriptions.patient_home') }}</strong></a>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
@endif
|
|
|
|
{{ Form::open(['route' => 'prescriptions.process' , 'data-toggle' => 'validator', 'id' => 'selected_drugs_form']) }}
|
|
|
|
<div class="white-box">
|
|
@if (count($chronic_drugs_array) > 0)
|
|
<table class='table color-bordered-table success-bordered-table'>
|
|
<thead><tr><th colspan="2">Patient's Chronic Drugs</th></tr></thead>
|
|
<tbody>
|
|
@foreach ($chronic_drugs_array as $chronic_drug)
|
|
@if(isset($drugs[$chronic_drug->drug_id]))
|
|
<tr>
|
|
<td>{{ $drugs[$chronic_drug->drug_id] }}</td>
|
|
<td><button type="button" class="btn btn-sm btn-rounded btn-outline-primary" onclick="add_drug_to_order({{ $chronic_drug->drug_id }})">Add to current order</button></td>
|
|
</tr>
|
|
@endif
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
|
|
<hr>
|
|
@endif
|
|
|
|
<label class="label label-primary" id="setup_progressive_treatment_button" onclick="setup_progressive_treatment();">Setup Progressive Treatment</label>
|
|
|
|
{{ Form::hidden('is_progressive_treatment_setup', 0, ['id' => 'is_progressive_treatment_setup']) }}
|
|
|
|
<div id='payments_items'>
|
|
|
|
<table class='table color-bordered-table success-bordered-table'>
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
<div class='row'>
|
|
<div class='col-3'>{{ __('prescriptions.drug') }}</div>
|
|
<div class='col-3'>{{ __('prescriptions.dosage') }}</div>
|
|
<div class='col-1 prompts_div'>{{ __('prescriptions.prompt') }}</div>
|
|
<div class='col-1'>{{ __('prescriptions.duration') }}</div>
|
|
<div class='col-1'>{{ __('prescriptions.dispense') }}</div>
|
|
<div class='col-1 first_dose_quantity_div' style="display: none">{{ __('prescriptions.first_dispense_quantity') }}</div>
|
|
<div class='col-1 first_dose_quantity_div' style="display: none">{{ __('prescriptions.first_dispense_duration') }}</div>
|
|
<div class='col-1' @if(view_prescription_price_on_order()==0) style='display: none' @endif>{{ __('prescriptions.price') }}</div>
|
|
<div class='col-1'>{{ __('prescriptions.instructions') }}</div>
|
|
<div class='col-1'></div>
|
|
</div>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
@php $patient_insurance_status = patient_insurance_status($patient_id); @endphp
|
|
|
|
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }}
|
|
{{ Form::hidden('patient_insurance_status', $patient_insurance_status, ['id' => 'patient_insurance_status']) }}
|
|
|
|
@if(!is_out_of_stock_message_disabled())
|
|
{{ Form::hidden('show_out_of_stock_message', 1, ['id' => 'show_out_of_stock_message']) }}
|
|
@endif
|
|
|
|
@php
|
|
$option_drugs = "<option value=''>-select-</option>";
|
|
foreach ($drugs as $key => $value){
|
|
$drug_name = str_replace("'", '', $value);
|
|
$drug_name = str_replace("\"", '', $drug_name);
|
|
$drug_name = str_replace("+", '', $drug_name);
|
|
//$drug_name = preg_replace('/[^A-Za-z0-9\-]/', '', $drug_name);
|
|
$option_drugs .= "<option value='$key'>$drug_name</option>";
|
|
}
|
|
|
|
$option_frequencies = "<option value=''>-select-</option>";
|
|
foreach ($dosage_frequencies as $key => $value){
|
|
$option_frequencies .= "<option value='$key'>$value</option>";
|
|
}
|
|
|
|
$counter = 0;
|
|
$total_amount = 0;
|
|
$first_dose_total_amount = 0;
|
|
$treatment_opd_progressive_id = 0;
|
|
@endphp
|
|
|
|
<tbody class='input_fields_wrap'>
|
|
@if($treatment)
|
|
<input type='hidden' name ='treatment_id' value='{{ $treatment->id }}'>
|
|
|
|
@php
|
|
if ($treatment->is_treatment_progressive != 0) {
|
|
$treatment_progressive = Streamline\Models\TreatmentOpdProgressive::find($treatment->is_treatment_progressive);
|
|
}
|
|
|
|
if (isset($treatment_progressive) && $treatment_progressive->treatment_ids == $treatment->id) {
|
|
$treatment_opd_progressive_id = $treatment_progressive->id;
|
|
$progressive_quantity_dispensed_array = explode(",", $treatment->quantities_dispensed);
|
|
$progressive_durations_array = explode(",", $treatment->durations);
|
|
$treatment = $treatment_progressive;
|
|
$drugs_array = explode(",", $treatment->drugs);
|
|
$dosage_array = explode(",", $treatment->dose);
|
|
$frequencies_array = explode(",", $treatment->drug_frequency);
|
|
$duration_array = explode(",", $treatment->durations);
|
|
$quantity_dispensed_array = explode(",", $treatment->quantities_to_dispense);
|
|
$instructions_array = explode(",", $treatment->instruction);
|
|
$purchased_elsewhere_array = explode(",", $treatment->purchased_elsewhere);
|
|
} else {
|
|
$drugs_array = explode(",", $treatment->drugs);
|
|
$progressive_quantity_dispensed_array = array_fill(0, count($drugs_array), 0);
|
|
$progressive_durations_array = array_fill(0, count($drugs_array), 0);
|
|
$dosage_array = explode(",", $treatment->doses);
|
|
$frequencies_array = explode(",", $treatment->frequencies);
|
|
$duration_array = explode(",", $treatment->durations);
|
|
$quantity_dispensed_array = explode(",", $treatment->quantities_dispensed);
|
|
$instructions_array = explode(",", $treatment->instruction);
|
|
$purchased_elsewhere_array = explode(",", $treatment->purchased_elsewhere);
|
|
}
|
|
|
|
$total_drug_price = 0;
|
|
$eye_array = explode(",", $treatment->eye);
|
|
@endphp
|
|
|
|
<input type='hidden' name ='treatment_opd_progressive_id' value='{{ $treatment_opd_progressive_id }}'>
|
|
@for ($x = 0; $x < count($drugs_array); $x++)
|
|
|
|
@php
|
|
$treament_drug = \DB::table('drugs')->where('id',$drugs_array[$x])->first();
|
|
|
|
if(!is_numeric($quantity_dispensed_array[$x])) {
|
|
$quantity_dispensed_array[$x] = 0;
|
|
}
|
|
|
|
// check if the patient category is attached to a price list
|
|
$treatment_drug_price = 0;
|
|
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
|
|
|
|
if (is_numeric($drugs_array[$x])) {
|
|
if ($patient_insurance_status == 1) {
|
|
$treatment_drug_price = get_item_insurance_co_payment($patient_id, $drugs_array[$x], 4, false, 0);
|
|
} else {
|
|
if ($price_list_id) {
|
|
$treatment_drug_price = get_price_list_category_price($price_list_id, 3, $drugs_array[$x]);
|
|
} else {
|
|
$treatment_drug_price = get_name($drugs_array[$x], "id", "non_insured_price", "drugs");
|
|
}
|
|
}
|
|
|
|
if (!is_numeric($treatment_drug_price)) {
|
|
$treatment_drug_price = 0;
|
|
}
|
|
|
|
$total_amount += $treatment_drug_price * $quantity_dispensed_array[$x];
|
|
|
|
$reference_array = explode(",", $treament_drug->reference_areas);
|
|
$reference_name = explode(",", $treament_drug->reference_name);
|
|
} else {
|
|
continue;
|
|
}
|
|
@endphp
|
|
<tr>
|
|
<td>
|
|
<div class='row'>
|
|
<div class='col-3'>
|
|
<div class='form-group'>
|
|
<div class='controls' id='drugs_div_{{ $counter }}'>
|
|
{{ Form::select('drug_id[]', $drugs, $drugs_array[$x], ['class' => 'form-control compulsory drugs_id_class', 'id' => 'drugs_id_' . $counter]) }}
|
|
|
|
<input type='hidden' name='can_drug_be_prescribed[]' id='can_drug_be_prescribed_{{ $counter }}' class='can_drug_be_prescribed' value="1"/>
|
|
<input type='hidden' name='drug_form[]' id='drug_form{{ $counter }}' value="{{ get_name($treament_drug->form_id, 'id', 'name', 'unit_of_measure') }}"/>
|
|
<input type='hidden' name='selling_price[]' id='selling_price{{ $counter }}' value="{{ $treatment_drug_price }}"/>
|
|
<input type='hidden' name='pack[]' id='pack{{ $counter }}' value="{{ $treament_drug->pack }}"/>
|
|
<input type='hidden' name='strength[]' id='strength{{ $counter }}' value="{{ $treament_drug->strength }}"/>
|
|
|
|
<div id='patient_allergic_div_{{ $counter }}' style='display: none'>
|
|
<span class='badge badge-danger'>{{ __('prescriptions.patient_is_allergic') }}</span>
|
|
</div>
|
|
<div id='drug_expired_div_{{ $counter }}' style='display: none'>
|
|
<span class='badge badge-danger'>{{ __('prescriptions.drug_is_expired') }}</span>
|
|
</div>
|
|
<div id='drug_out_of_stock_div_{{ $counter }}' style='display: none'>
|
|
<span class='badge badge-danger'>{{ __('prescriptions.out_of_stock') }}</span>
|
|
</div>
|
|
@php $pharm_comment = trim($treament_drug->pharmacy_comment); @endphp
|
|
<div id='references_span_{{ $counter }}'>
|
|
@for ($j = 0; $j < count($reference_array); $j++)
|
|
@if(isset($reference_array[$j]) && isset($reference_name[$j]))
|
|
<a style='font-weight:normal;' href='{{ $reference_array[$j] }}' target='_blank'>{{ $reference_name[$j] }}</a><br>
|
|
@endif
|
|
@endfor
|
|
</div>
|
|
<div id='pharmacy_comment_div_{{ $counter }}' @if(empty($pharm_comment)) style='display: none' @endif>
|
|
<div style='padding: 1px; margin: 6px 1px 0px 1px; font-size: smaller' class='alert alert-info span12 margin-none well' id='pharmacy_comment_text_{{ $counter }}'>{{ $pharm_comment }}</div>
|
|
</div>
|
|
<div id='drug_pat_cat_coverage_div_{{ $counter }}'>
|
|
<br>
|
|
@if (!is_chi_enabled() && !is_drug_covered_by_pay_later_category(get_name($patient_id, 'id', 'category_id', 'patients'), $treament_drug->id))
|
|
<span class='badge badge-danger' id='drug_pat_cat_coverage_text_{{ $counter }}'>
|
|
Not covered by {{ get_name(get_name($patient_id, 'id', 'category_id', 'patients'), 'id', 'name', 'patient_categories') }}
|
|
</span>
|
|
@endif
|
|
</div>
|
|
<div id='drug_chi_coverage_div_{{ $counter }}'>
|
|
@if (is_chi_enabled())
|
|
@if (is_patient_item_covered($patient_id, $drugs_array[$x], 4))
|
|
<br><span style="color: darkgreen"><b>Covered by CHI</b></span>
|
|
@else
|
|
<br><span style="color: darkorange"><b>Not covered by CHI</b></span>
|
|
@endif
|
|
@endif
|
|
</div>
|
|
|
|
<div @if(!is_eye_module_enabled() || !is_patient_in_eye_clinic($episode_id)) style='display: none' @endif>
|
|
<hr>
|
|
<label><b>Eye</b></label>
|
|
{{ Form::select('eye[]', [2 => 'Both', 0 => 'Left', 1 => 'Right'], $eye_array[$x] ?? 2, ['class' => 'form-control compulsory', 'required']) }}
|
|
</div>
|
|
</div>
|
|
|
|
@if(!is_incoming_prescriptions_feature_enabled())
|
|
<hr>
|
|
Tick if drug will be purchased elsewhere <input type='checkbox' name='purchased_elsewhere[]' id="purchased_elsewhere_{{ $counter }}" @if(isset($purchased_elsewhere_array[$x]) && $purchased_elsewhere_array[$x] == 1) checked @endif/>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
<div class='col-3'>
|
|
<div class='row'>
|
|
<div class='col-4'>
|
|
<input type='number' min='0.001' step='0.001' style='margin-bottom: 0px;' value="{{$dosage_array[$x]}}" name='dose[]' id='dose{{ $counter }}' class='form-control dose_class' required />
|
|
<span style='margin-bottom: 4px; font-size: smaller;' id='drug_unit{{ $counter }}'>{{ get_name($treament_drug->unit_id, 'id', 'name', 'drug_units') }}</span>
|
|
</div>
|
|
<div class='col-8'>
|
|
{{ Form::select('frequency[]', $dosage_frequencies, $frequencies_array[$x], ['class' => 'form-control frequency_class', 'id' => 'frequency' . $counter]) }}
|
|
<span style='margin-bottom: 4px; font-size: smaller;' id='form_quantity{{ $counter }}'></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1 prompts_div' id='prompts_div_{{ $counter }}'>
|
|
<div style='padding: 3px 3px 3px 4px; color: #C85F6A;' class='well margin-none span12'>
|
|
{!! read_more($treament_drug->prompt, 'prompt_short' . $treament_drug->id, 'prompt_long' . $treament_drug->id) !!}
|
|
<div id='prompt_long{{ $treament_drug->id }}' style='display: none;'>
|
|
{{ $treament_drug->prompt }}
|
|
<br/><a class='read_more' style='color: #0099CC;' onclick='hide("prompt_long{{ $treament_drug->id }}");show("prompt_short{{ $treament_drug->id }}");'>Read Less</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1'>
|
|
<div class='form-group'>
|
|
<div class='controls'>
|
|
<?php $duration_unit = explode(" ", $duration_array[$x]); ?>
|
|
<input type='number' min='1' value='<?php echo $duration_unit[0]; ?>' name='item_duration[]' id='item_duration_{{ $counter }}' class='form-control item_duration' required/>Days
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1'>
|
|
<div class='form-group'>
|
|
<div class='controls'>
|
|
<input type='number' value="{{ $quantity_dispensed_array[$x] }}" name='item_dispense[]' id='item_dispense_{{ $counter }}' class='form-control item_dispense' required readonly/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1 first_dose_quantity_div' style="display: none">
|
|
<div class='form-group'>
|
|
<div class='controls'>
|
|
@php $first_dose_total_amount += ($treatment_drug_price * $progressive_quantity_dispensed_array[$x]);@endphp
|
|
<input type='number' value="{{ $progressive_quantity_dispensed_array[$x] }}" name='first_dose_quantity[]' id='first_dose_quantity_{{ $counter }}' class='form-control first_dose_quantity'/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1 first_dose_quantity_div' style="display: none">
|
|
<div class='form-group'>
|
|
<div class='controls'>
|
|
<?php $duration_unit = explode(" ", $progressive_durations_array[$x]); ?>
|
|
<input type='number' value='{{ $duration_unit[0] }}' name='first_dose_duration[]' id='first_dose_duration_{{ $counter }}' class='form-control first_dose_duration' required/>Days
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1' @if(view_prescription_price_on_order()==0) style='display: none' @endif>
|
|
<div class='form-group'>
|
|
<div class='controls'>
|
|
<input type='number' value="{{ $treatment_drug_price * $quantity_dispensed_array[$x] }}" name='item_price[]' id='item_price_{{ $counter }}' class='form-control item_price' readonly/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1'>
|
|
<textarea name='item_instructions[]' id='item_instructions_{{ $counter }}' class='form-control' rows='3' placeholder='<?php echo __('prescriptions.instruction_to_patient') ?>'><?php echo trim($instructions_array[$x]); ?></textarea>
|
|
</div>
|
|
<div class='col-1'>
|
|
<div class='form-group' style='margin-top: 10px;'>
|
|
@if($counter == 0)
|
|
<button class='btn btn-sm btn-rounded btn-success add_item' style='color: white; margin-left: 25px;'><i class='fa fa-plus'></i></button>
|
|
@else
|
|
<button class='remove_field btn btn-sm btn-rounded btn-danger' style='color: white; margin-left: 25px;'><i class='fa fa-trash'></i></button>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
|
|
@php $counter++; @endphp
|
|
@endfor
|
|
@else
|
|
<tr>
|
|
<td>
|
|
<div class='row'>
|
|
<div class='col-3'>
|
|
<div class='form-group'>
|
|
<div class='controls' id='drugs_div_{{ $counter }}'>
|
|
<select name='drug_id[]' id='drugs_id_{{ $counter }}' class='form-control compulsory required drugs_id_class'>@php echo $option_drugs; @endphp</select>
|
|
<input type='hidden' name='can_drug_be_prescribed[]' id='can_drug_be_prescribed_{{ $counter }}' class='can_drug_be_prescribed'/>
|
|
<input type='hidden' name='drug_form[]' id='drug_form{{ $counter }}'/>
|
|
<input type='hidden' name='selling_price[]' id='selling_price{{ $counter }}'/>
|
|
<input type='hidden' name='pack[]' id='pack{{ $counter }}'/>
|
|
<input type='hidden' name='strength[]' id='strength{{ $counter }}'/>
|
|
|
|
<div id='patient_allergic_div_{{ $counter }}' style='display: none'>
|
|
<span class='badge badge-danger'>{{ __('prescriptions.patient_is_allergic') }}</span>
|
|
</div>
|
|
<div id='drug_expired_div_{{ $counter }}' style='display: none'>
|
|
<span class='badge badge-danger'>{{ __('prescriptions.drug_is_expired') }}</span>
|
|
</div>
|
|
<div id='drug_out_of_stock_div_{{ $counter }}' style='display: none'>
|
|
<span class='badge badge-danger'>{{ __('prescriptions.out_of_stock') }}</span>
|
|
</div>
|
|
<span id="references_span_{{ $counter }}"></span>
|
|
<div id='pharmacy_comment_div_{{ $counter }}' style='display: none'>
|
|
<div style='padding: 1px; margin: 6px 1px 0px 1px; font-size: smaller' class='alert alert-info span12 margin-none well' id='pharmacy_comment_text_{{ $counter }}'></div>
|
|
</div>
|
|
<div id='drug_pat_cat_coverage_div_{{ $counter }}'> <br><span class='badge badge-danger' id='drug_pat_cat_coverage_text_{{ $counter }}'></span></div>
|
|
<div id='drug_chi_coverage_div_{{ $counter }}'></div>
|
|
|
|
<div @if(!is_eye_module_enabled() || !is_patient_in_eye_clinic($episode_id)) style='display: none' @endif>
|
|
<hr>
|
|
|
|
<label><b>Eye</b></label>
|
|
|
|
<select name='eye[]' class='form-control compulsory'>
|
|
<option value='0'>Left</option>
|
|
<option value='1'>Right</option>
|
|
<option selected value='2'>Both</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
@if(!is_incoming_prescriptions_feature_enabled())
|
|
<hr>
|
|
Tick if drug will be purchased elsewhere <input type='checkbox' name='purchased_elsewhere[]' id="purchased_elsewhere_{{ $counter }}" />
|
|
@endif
|
|
</div>
|
|
</div>
|
|
<div class='col-3'>
|
|
<div class='row'>
|
|
<div class='col-4'>
|
|
<input type='number' min='0.001' step='0.001' style='margin-bottom: 0px;' name='dose[]' id='dose{{ $counter }}' class='form-control dose_class' required />
|
|
<span style='margin-bottom: 4px; font-size: smaller;' id='drug_unit{{ $counter }}'></span>
|
|
</div>
|
|
<div class='col-8'>
|
|
<select name='frequency[]' id='frequency{{ $counter }}' class='form-control frequency_class' required>@php echo $option_frequencies; @endphp</select>
|
|
<span style='margin-bottom: 4px; font-size: smaller;' id='form_quantity{{ $counter }}'></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1 prompts_div' id='prompts_div_{{ $counter }}'></div>
|
|
<div class='col-1'>
|
|
<div class='form-group'>
|
|
<div class='controls'>
|
|
<input type='number' min='1' value='1' name='item_duration[]' id='item_duration_{{ $counter }}' class='form-control item_duration' required/>Days
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1'>
|
|
<div class='form-group'>
|
|
<div class='controls'>
|
|
<input type='number' name='item_dispense[]' id='item_dispense_{{ $counter }}' class='form-control item_dispense' required readonly/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1 first_dose_quantity_div' style="display: none">
|
|
<div class='form-group'>
|
|
<div class='controls'>
|
|
<input type='number' value="1" name='first_dose_quantity[]' id='first_dose_quantity_{{ $counter }}' class='form-control first_dose_quantity'/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1 first_dose_quantity_div' style="display: none">
|
|
<div class='form-group'>
|
|
<div class='controls'>
|
|
<input type='number' value='1' name='first_dose_duration[]' id='first_dose_duration_{{ $counter }}' class='form-control first_dose_duration'/>Days
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1' @if(view_prescription_price_on_order()==0) style='display: none' @endif>
|
|
<div class='form-group'>
|
|
<div class='controls'>
|
|
<input type='number' name='item_price[]' id='item_price_{{ $counter }}' class='form-control item_price' readonly/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-1'>
|
|
<textarea name='item_instructions[]' id='item_instructions_{{ $counter }}' class='form-control' rows='3' placeholder='<?php echo __('prescriptions.instruction_to_patient') ?>'></textarea>
|
|
</div>
|
|
<div class='col-1'>
|
|
<div class='form-group' style='margin-top: 10px;'>
|
|
<button class='btn btn-sm btn-rounded btn-success add_item' style='color: white; margin-left: 25px;'><i class='fa fa-plus'></i></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
@if( Auth::user()->can('add-row-on-prescription'))
|
|
<tr>
|
|
<td>
|
|
<div class='row'>
|
|
<div class='col-6'>
|
|
</div>
|
|
<div class='col-1 prompts_div' id='prompts_div_{{ $counter }}'></div>
|
|
<div class='col-1'>
|
|
</div>
|
|
<div class='col-1'>
|
|
</div>
|
|
<div class='col-1 first_dose_quantity_div' style="display: none">
|
|
</div>
|
|
<div class='col-1 first_dose_quantity_div' style="display: none">
|
|
</div>
|
|
<div class='col-1' @if(view_prescription_price_on_order()==0) style='display: none' @endif>
|
|
</div>
|
|
<div class='col-1'>
|
|
</div>
|
|
<div class='col-1'>
|
|
<div class='form-group' style='margin-top: 10px;'>
|
|
<button class='btn btn-sm btn-rounded btn-success add_item' style='color: white;'><span>Add row</span></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
</table>
|
|
</div>
|
|
|
|
@if(view_prescription_price_on_order())
|
|
<h3 style="font-weight: bold">Total: <span id="itemGrandTotal">{{ ugandan_shillings($total_amount) }}</span></h3>
|
|
@endif
|
|
|
|
<h3 id="first_dose_total_div" style="display: none; font-weight: bold">First Dispense Total: <span id="firstDoseGrandTotal">{{ ugandan_shillings($first_dose_total_amount) }}</span></h3>
|
|
|
|
<hr>
|
|
|
|
{{ Form::label('order_comments', 'Treatment Order Comments') }}
|
|
<textarea name="order_comments" rows="6" class="form-control" placeholder="Treatment order comment...">@if(isset($treatment->order_comments)) {{ $treatment->order_comments }} @endif</textarea>
|
|
|
|
<br><br>
|
|
|
|
@if(str_replace(url('/'), '', url()->previous()) != "/confirm_prescriptions")
|
|
<a class="btn btn-default btn-rounded" id="return_to_consultation">Ignore prescription</a>
|
|
@endif
|
|
|
|
<input type="button" id="confirm_selection_button" class = "btn btn-success pull-right" value="<?php echo __('prescriptions.confirm_selection') ?>" />
|
|
|
|
@if(!session()->has('alter_episode_id'))
|
|
<input type="submit" id="submit_prescription" style="display: none" class = "btn btn-success pull-right" value="<?php echo __('prescriptions.complete_prescription') ?>" onsubmit="return onSubmitPrescription()" />
|
|
@endif
|
|
|
|
@if(session()->has('alter_episode_id'))
|
|
<hr>
|
|
|
|
<h3>Alter Prescriptions Details</h3>
|
|
<div class="row">
|
|
<div class="col-sm-3" style="margin-top: 3%;">
|
|
<b>{{ __('pharmacy.type_of_error') }}</b>
|
|
<table class="table table-bordered table-primary table-blue table-striped table-vertical-center table-condensed">
|
|
<tbody>
|
|
<tr>
|
|
<th scope="row"><div align="left">{{ __('pharmacy.wrong_dosage') }}</div></th>
|
|
<td>
|
|
<input type="checkbox" name="wrong_dosage" id="wrong_dosage" value="<?php echo __('pharmacy.yes') ?>">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th scope="row">
|
|
<div align="left">{{ __('pharmacy.wrong_frequency') }}</div>
|
|
</th>
|
|
<td><input type="checkbox" name="wrong_frequency" id="wrong_frequency" value="<?php echo __('pharmacy.yes') ?>"></td>
|
|
</tr>
|
|
<tr>
|
|
<th scope="row">
|
|
<div align="left">{{ __('pharmacy.inadequate_funds') }}</div>
|
|
</th>
|
|
<td><input type="checkbox" name="inadequate_funds" id="inadequate_funds" value="<?php echo __('pharmacy.yes') ?>"></td>
|
|
</tr>
|
|
<tr>
|
|
<th scope="row">
|
|
<div align="left">{{ __('pharmacy.other') }}</div>
|
|
</th>
|
|
<td><input type="checkbox" name="other_error" id="other_error" value="<?php echo __('pharmacy.yes') ?>"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="col-sm-3" style="margin-top: 3%;">
|
|
<b>{{ __('pharmacy.severity_of_error') }}</b>
|
|
<table class="table table-bordered table-primary table-blue table-striped table-vertical-center table-condensed">
|
|
<tbody>
|
|
<tr>
|
|
<th scope="row"><div align="left">{{ __('pharmacy.mild') }}</div></th>
|
|
<td>
|
|
<input type="radio" name="severity_of_error" id="mild" value="<?php echo __('pharmacy.mild') ?>" required="required">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th scope="row">
|
|
<div align="left">{{ __('pharmacy.moderate') }}</div>
|
|
</th>
|
|
<td><input type="radio" name="severity_of_error" id="moderate" value="<?php echo __('pharmacy.moderate') ?>" required="required"></td>
|
|
</tr>
|
|
<tr>
|
|
<th scope="row">
|
|
<div align="left">{{ __('pharmacy.severe') }}</div>
|
|
</th>
|
|
<td><input type="radio" name="severity_of_error" id="severe" value="<?php echo __('pharmacy.severe') ?>" required="required"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="col-sm-6" style="margin-top: 3%;">
|
|
<div class="control-group">
|
|
<div class="control-label">{{ __('pharmacy.comments') }}</div>
|
|
<div class="controls">
|
|
<textarea name="comment" id="comment" class="form-control compulsory col-sm-12" rows="6" required></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<br>
|
|
|
|
<div id="submit_prescription" style="display: none">
|
|
<input type="submit" class = "btn btn-success" name="submit-btn" value="Alter Prescription" onsubmit="return onSubmitPrescription()" />
|
|
<input type="submit" class = "btn btn-warning" name="submit-btn" value="Alter and Confirm Prescription" onsubmit="return onSubmitPrescription()" />
|
|
</div>
|
|
|
|
<br><br>
|
|
@endif
|
|
</div>
|
|
|
|
{{ Form::close() }}
|
|
|
|
<div class="white-box">
|
|
<h4>{{ __('prescriptions.treatment_for_given_episode') }}</h4>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover color-table success-table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('prescriptions.date') }}</th>
|
|
<th>{{ __('prescriptions.drug') }}</th>
|
|
<th>{{ __('prescriptions.dosage') }}</th>
|
|
<th>{{ __('prescriptions.duration') }}</th>
|
|
<th>{{ __('prescriptions.quantity') }}</th>
|
|
<th>{{ __('prescriptions.status') }}</th>
|
|
<th>{{ __('prescriptions.instructions') }}</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@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);
|
|
$purchased_elsewhere_array = is_null($treatment->purchased_elsewhere) ? [] : explode(",", $treatment->purchased_elsewhere);
|
|
@endphp
|
|
@for($x = 0; $x < count($drugs_array); $x++)
|
|
@php
|
|
$frequency_name = get_name($frequencies_array[$x], 'id', 'name', 'dosage_frequencies');
|
|
$unit = get_name($drugs_array[$x], 'id', 'name', 'drug_units');
|
|
$unit = $unit=="N/A"?"":$unit;
|
|
$drug_unit = "<small>" . $unit . "</small>";
|
|
$dose2 = (empty($dosage2_array[$x])) ? "" : " | " . $dosage2_array[$x] . $drug_unit;
|
|
|
|
$status_text = "";
|
|
|
|
if($treatment->payment_status == 1) {
|
|
$status_text .= "Paid, ";
|
|
} else {
|
|
$status_text .= "Not Paid, ";
|
|
}
|
|
|
|
if($treatment->dispense_status == 1) {
|
|
$status_text .= "Dispensed";
|
|
} else {
|
|
$status_text .= "Not Dispensed";
|
|
}
|
|
|
|
if($treatment->altered == 1) {
|
|
$status_text .= ", Altered";
|
|
}
|
|
@endphp
|
|
<tr>
|
|
<td>{{ streamline_date_time($treatment->updated_at) }}</td>
|
|
<td>{{ get_name($drugs_array[$x], 'id', "name", 'drugs') }}</td>
|
|
<td>{{ $dosage_array[$x] }} {!! $drug_unit !!} {{ $dose2 }} {{ $frequency_name }}</td>
|
|
<td>{{ $duration_array[$x] }}</td>
|
|
<td>{{ $quantity_dispensed_array[$x] }}</td>
|
|
@if(isset($purchased_elsewhere_array[$x]) && $purchased_elsewhere_array[$x] == 1)
|
|
<td style='color: orange'>Purchased From Elsewhere</td>
|
|
@else
|
|
<td style='color: green'>{{ $status_text }}</td>
|
|
@endif
|
|
<td>
|
|
{{ isset($instructions_array[$x]) ? trim($instructions_array[$x]) : 'N/A' }}
|
|
</td>
|
|
<td>
|
|
@if(array_key_exists($drugs_array[$x], $drugs))
|
|
<button type="button" class="btn btn-rounded btn-outline-primary" onclick="add_drug_to_order({{ $drugs_array[$x] }})">Add to current order</button>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endfor
|
|
@endforeach
|
|
@else
|
|
<tr>
|
|
<td colspan="7" class="text-center"><code>{{ __('prescriptions.no_treatment_history') }}</code></td>
|
|
</tr>
|
|
@endif
|
|
<tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
|
<script type="text/javascript">
|
|
function show(id) {
|
|
if (document.getElementById(id).style.display == 'none') {
|
|
document.getElementById(id).style.display = '';
|
|
}
|
|
}
|
|
|
|
function hide(id) {
|
|
document.getElementById(id).style.display = 'none';
|
|
}
|
|
|
|
if (<?php echo $treatment_opd_progressive_id; ?> != 0) {
|
|
setup_progressive_treatment();
|
|
}
|
|
|
|
$('.drugs_id_class').select2({
|
|
placeholder: "Select drug"
|
|
});
|
|
|
|
var max_rows = 20;
|
|
var wrapper = $(".input_fields_wrap");
|
|
var x = <?php echo $counter + 1; ?>; // initial row count
|
|
|
|
$(".add_item").click(function (e) { // on add input button click
|
|
e.preventDefault();
|
|
add_drug_row();
|
|
});
|
|
|
|
$(wrapper).on("click", ".remove_field", function (e) {
|
|
e.preventDefault();
|
|
$(this).parent('div').parent('div').parent('div').parent('td').parent('tr').remove();
|
|
});
|
|
|
|
var show_price_setting = <?php echo view_prescription_price_on_order(); ?>;
|
|
var is_eye_module_enabled = <?php echo (!is_eye_module_enabled() || !is_patient_in_eye_clinic($episode_id)) ? 1 : 0; ?>;
|
|
|
|
function add_drug_row() {
|
|
let allow_incoming = <?php echo !is_incoming_prescriptions_feature_enabled() ? 1 : 0; ?>;
|
|
let tick_purchase = "";
|
|
|
|
if (allow_incoming === 1) {
|
|
tick_purchase = "<hr>Tick if drug will be purchased elsewhere <input type='checkbox' name='purchased_elsewhere[]' id='purchased_elsewhere_" + x + "' />";
|
|
}
|
|
|
|
if (x < max_rows) {
|
|
$(wrapper).append("\
|
|
<tr>\
|
|
<td>\
|
|
<div class='row'>\
|
|
<div class='col-3'>\
|
|
<div class='form-group'>\
|
|
<div class='controls' id='drugs_div_" + x + "'>\
|
|
<select name='drug_id[]' id='drugs_id_" + x + "' class='form-control compulsory required drugs_id_class'>@php echo $option_drugs; @endphp</select>\
|
|
<input type='hidden' name='can_drug_be_prescribed[]' id='can_drug_be_prescribed_" + x + "' class='can_drug_be_prescribed'/>\
|
|
<input type='hidden' name='drug_form[]' id='drug_form" + x + "'/>\
|
|
<input type='hidden' name='selling_price[]' id='selling_price" + x + "'/>\
|
|
<input type='hidden' name='pack[]' id='pack" + x + "'/>\
|
|
<input type='hidden' name='strength[]' id='strength" + x + "'/>\
|
|
<div id='patient_allergic_div_" + x + "' style='display: none'>\
|
|
<span class='badge badge-danger'>{{ __('prescriptions.patient_is_allergic') }}</span> \
|
|
</div>\
|
|
<div id='drug_expired_div_" + x + "' style='display: none'>\
|
|
<span class='badge badge-danger'>{{ __('prescriptions.drug_is_expired') }}</span> \
|
|
</div>\
|
|
<div id='drug_out_of_stock_div_" + x + "' style='display: none'>\
|
|
<span class='badge badge-danger'>{{ __('prescriptions.out_of_stock') }}</span>\
|
|
</div>\
|
|
<span id='references_span_"+x+"'></span>\
|
|
<div id='pharmacy_comment_div_" + x + "' style='display: none'>\
|
|
<div style='padding: 1px; margin: 6px 1px 0px 1px; font-size: smaller' class='alert alert-info span12 margin-none well' id='pharmacy_comment_text_" + x + "'></div>\
|
|
</div>\
|
|
<div id='drug_pat_cat_coverage_div_" + x + "'> <br><span class='badge badge-danger' id='drug_pat_cat_coverage_text_" + x + "'></span></div>\
|
|
<div id='drug_chi_coverage_div_" + x + "'></div>\
|
|
<div "+(is_eye_module_enabled==1?'style="display:none"':'')+"><hr><label><b>Eye</b></label>\
|
|
<select name='eye[]' class='form-control compulsory'>\
|
|
<option value='0'>Left</option>\
|
|
<option value='1'>Right</option>\
|
|
<option selected value='2'>Both</option>\
|
|
</select></div>\
|
|
</div>\
|
|
</div>\
|
|
" + tick_purchase + "\
|
|
</div>\
|
|
<div class='col-3'>\
|
|
<div class='row'>\
|
|
<div class='col-4'>\
|
|
<input type='number' min='0.001' step='0.001' style='margin-bottom: 0px;' name='dose[]' id='dose" + x + "' class='form-control dose_class' required />\
|
|
<span style='margin-bottom: 4px; font-size: smaller;' id='drug_unit" + x + "'></span>\
|
|
</div>\
|
|
<div class='col-8'>\
|
|
<select name='frequency[]' id='frequency" + x + "' class='form-control required frequency_class' required>@php echo $option_frequencies; @endphp</select>\
|
|
<span style='margin-bottom: 4px; font-size: smaller;' id='form_quantity" + x + "'></span>\
|
|
</div>\
|
|
</div>\
|
|
</div>\
|
|
<div class='col-1 prompts_div' id='prompts_div_" + x + "'></div>\
|
|
<div class='col-1'>\
|
|
<div class='form-group'>\
|
|
<div class='controls'>\
|
|
<input type='number' min='1' value='1' name='item_duration[]' id='item_duration_" + x + "' class='form-control item_duration' required/>Days\
|
|
</div>\
|
|
</div>\
|
|
</div>\
|
|
<div class='col-1'>\
|
|
<div class='form-group'>\
|
|
<div class='controls'>\
|
|
<input type='number' name='item_dispense[]' id='item_dispense_" + x + "' class='form-control item_dispense' required readonly/>\
|
|
</div>\
|
|
</div>\
|
|
</div>\
|
|
<div class='col-1 first_dose_quantity_div' style='display: none'>\
|
|
<div class='form-group'>\
|
|
<div class='controls'>\
|
|
<input type='number' value='1' name='first_dose_quantity[]' id='first_dose_quantity_" + x + "' class='form-control first_dose_quantity'/>\
|
|
</div>\
|
|
</div>\
|
|
</div>\
|
|
<div class='col-1 first_dose_quantity_div' style='display: none'>\
|
|
<div class='form-group'>\
|
|
<div class='controls'>\
|
|
<input type='number' value='1' name='first_dose_duration[]' id='first_dose_duration_" + x + "' class='form-control first_dose_duration' required/>Days\
|
|
</div>\
|
|
</div>\
|
|
</div>\
|
|
<div class='col-1'"+(show_price_setting==0?'style="display:none"':'')+"'>\
|
|
<div class='form-group'>\
|
|
<div class='controls'>\
|
|
<input type='number' name='item_price[]' id='item_price_" + x + "' class='form-control item_price' readonly/>\
|
|
</div>\
|
|
</div>\
|
|
</div>\
|
|
<div class='col-1'>\
|
|
<textarea name='item_instructions[]' id='item_instructions_" + x + "' class='form-control' rows='3' placeholder='<?php echo __('prescriptions.instruction_to_patient') ?>'></textarea>\
|
|
</div>\
|
|
<div class='col-1'>\
|
|
<div class='form-group' style='margin-top: 10px;'>\
|
|
<button class='remove_field btn btn-sm btn-rounded btn-danger' style='color: white; margin-left: 25px;'><i class='fa fa-trash'></i></button>\
|
|
</div>\
|
|
</div>\
|
|
</div>\
|
|
</td>\
|
|
</tr>");
|
|
|
|
generalSelect2Set('drugs_id_'+x);
|
|
|
|
x++;
|
|
|
|
// if the treatment order is already on progressive, continue
|
|
if ($('#is_progressive_treatment_setup').val() == 1) {
|
|
$('.prompts_div').hide();
|
|
$('.first_dose_quantity_div').show();
|
|
}
|
|
}
|
|
}
|
|
|
|
function generalSelect2Set(id) {
|
|
$('#'+id).select2({
|
|
width: "100%"
|
|
});
|
|
}
|
|
|
|
function add_drug_to_order(drug_id) {
|
|
add_drug_row();
|
|
$('#drugs_id_' + (x - 1)).select2().val(drug_id).trigger('change');
|
|
}
|
|
|
|
function numberWithCommas(x) {
|
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
}
|
|
|
|
$(".input_fields_wrap").on('change keyup', ".dose_class, .frequency_class, .item_duration", function () {
|
|
let id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
|
let drug_id = $('#drugs_id_' + id).val();
|
|
|
|
// make sure a drug has been selected
|
|
if (drug_id == "" || drug_id == 0) {
|
|
alert("Please first select a drug then edit the drug prescription");
|
|
$(this).val("");
|
|
return false;
|
|
}
|
|
|
|
let pack = parseFloat($("#pack" + id).val());
|
|
let strength = parseFloat($("#strength" + id).val()) || 0;
|
|
let dose = parseFloat($("#dose" + id).val()) || 0;
|
|
let form_quantity = dose / strength;
|
|
|
|
if (isNaN(form_quantity) || form_quantity === Infinity) {
|
|
form_quantity = 0;
|
|
}
|
|
|
|
$("#form_quantity" + id).text("( " + form_quantity + " " + $("#drug_form" + id).val() + " )");
|
|
|
|
let frequency_id = $("#frequency" + id).val() || 0;
|
|
let duration_days = +$("#item_duration_" + id).val() || 0;
|
|
|
|
$.ajax({
|
|
url: '/prescriptions/get_factor/'+frequency_id,
|
|
data: {},
|
|
success: function(data){
|
|
let factor = parseFloat(data);
|
|
let quantity = parseFloat(form_quantity * factor * duration_days) || 0;
|
|
let required = quantity / pack;
|
|
let dispense = Math.ceil(required);
|
|
|
|
$("#item_dispense_" + id).val(dispense);
|
|
|
|
let selling_price = parseInt($("#selling_price" + id).val());
|
|
let cost = dispense * selling_price;
|
|
$("#item_price_" + id).val(cost);
|
|
|
|
calculate_total_amount();
|
|
},
|
|
error: function(response){
|
|
//
|
|
}
|
|
});
|
|
});
|
|
|
|
$(".input_fields_wrap").on('change', ".drugs_id_class", function () {
|
|
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
|
var item = $(this).val();
|
|
var patient_id = $('#patient_id').val();
|
|
let patient_insurance_status = $('#patient_insurance_status').val();
|
|
|
|
$.ajax({
|
|
url: '/prescriptions/get_drug_details/',
|
|
data: {'drug_id':item, 'patient_id':patient_id, 'patient_insurance_status': patient_insurance_status},
|
|
beforeSend: function() {
|
|
$(".loader").show();
|
|
},
|
|
success: function(response){
|
|
$(".loader").hide();
|
|
let arr = JSON.parse(response);
|
|
$('#can_drug_be_prescribed_' + id).val(arr["can_drug_be_prescribed"]);
|
|
|
|
if (arr["patient_is_allergic"] == 1) {
|
|
$("#patient_allergic_div_" + id).show();
|
|
} else {
|
|
$("#patient_allergic_div_" + id).hide();
|
|
}
|
|
|
|
if (arr["drug_is_expired"] == 1) {
|
|
$("#drug_expired_div_" + id).show();
|
|
} else {
|
|
$("#drug_expired_div_" + id).hide();
|
|
}
|
|
|
|
if (arr["drug_out_of_stock"] == 1) {
|
|
$("#drug_out_of_stock_div_" + id).show();
|
|
} else {
|
|
$("#drug_out_of_stock_div_" + id).hide();
|
|
}
|
|
|
|
if (arr["drug_references"] != 0) {
|
|
$("#references_span_" + id).show();
|
|
$("#references_span_" + id).html(arr["drug_references"]);
|
|
} else {
|
|
$("#references_span_" + id).hide();
|
|
}
|
|
|
|
if (arr["pharmacy_comment"] != 0) {
|
|
$("#pharmacy_comment_div_" + id).show();
|
|
$("#pharmacy_comment_text_" + id).text(arr["pharmacy_comment"]);
|
|
} else {
|
|
$("#pharmacy_comment_div_" + id).hide();
|
|
}
|
|
|
|
if (arr["covered_by_pat_cat"] != "") {
|
|
$("#drug_pat_cat_coverage_div_" + id).show();
|
|
$("#drug_pat_cat_coverage_text_" + id).text(arr["covered_by_pat_cat"]);
|
|
} else {
|
|
$("#drug_pat_cat_coverage_div_" + id).hide();
|
|
}
|
|
|
|
if (arr["covered_by_chi"] != "") {
|
|
$("#drug_chi_coverage_div_" + id).show();
|
|
$("#drug_chi_coverage_div_" + id).html(arr["covered_by_chi"]);
|
|
} else {
|
|
$("#drug_chi_coverage_div_" + id).hide();
|
|
}
|
|
|
|
if (arr["prompt"] != 0) {
|
|
$("#prompts_div_" + id).html(arr["prompt"]);
|
|
}
|
|
|
|
if (arr["can_drug_be_prescribed"] == 0) {
|
|
// stop here with the filling in of values
|
|
$(this).val('');
|
|
}
|
|
|
|
$('#drug_unit' + id).text(arr["drug_unit"]);
|
|
$('#drug_form' + id).val(arr["drug_form"]);
|
|
$('#selling_price' + id).val(arr["selling_price"]);
|
|
$('#pack' + id).val(arr["pack"]);
|
|
$('#strength' + id).val(arr["strength"]);
|
|
$('#purchased_elsewhere_' + id).val(item);
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#return_to_consultation").click(function(e){
|
|
e.preventDefault();
|
|
let previous_url = <?php echo "'".str_replace(url('/'), '', url()->previous()). "'"; ?>;
|
|
|
|
if (previous_url == "/prescriptions/create") {
|
|
window.location.href = "/consultation/route";
|
|
} else{
|
|
window.location.href = previous_url;
|
|
}
|
|
});
|
|
|
|
$(".input_fields_wrap").on('change', ".first_dose_quantity", function () {
|
|
calculate_first_dose_totals();
|
|
});
|
|
|
|
function calculate_first_dose_totals() {
|
|
let auto_price_grand_total = 0;
|
|
$(".first_dose_quantity").each(function(){
|
|
let id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
|
let quantity = +$(this).val();
|
|
let selling_price = parseInt($("#selling_price" + id).val());
|
|
|
|
auto_price_grand_total += quantity * selling_price;
|
|
});
|
|
|
|
$("#firstDoseGrandTotal").html(numberWithCommas(auto_price_grand_total) + " Ugx");
|
|
}
|
|
|
|
function calculate_total_amount() {
|
|
//loop through the prices
|
|
let auto_price_grand_total = 0;
|
|
$(".item_price").each(function(){
|
|
var val = parseInt($(this).val())
|
|
if (isNaN(val)) val=0;
|
|
auto_price_grand_total += val;
|
|
});
|
|
|
|
// recalculate the grand total
|
|
$("#itemGrandTotal").html(numberWithCommas(auto_price_grand_total) + " Ugx");
|
|
}
|
|
|
|
$("#confirm_selection_button").click(function (e) {
|
|
let drug_id = $(".drugs_id_class" ).map(function(){
|
|
if (this.value != "") {
|
|
return this.value;
|
|
} else {
|
|
return "false";
|
|
}
|
|
}).get();
|
|
|
|
let quantity_dispensed = $(".item_dispense").map(function(){
|
|
if (this.value != "") {
|
|
return this.value;
|
|
} else {
|
|
return "false";
|
|
}
|
|
}).get();
|
|
|
|
if (!drug_id.includes("false") && !quantity_dispensed.includes("false")) {
|
|
$.ajax({
|
|
url: '/check_dispensed_drugs_quantity',
|
|
data: {'drug_id_array[]':drug_id, 'quantity_dispensed_array[]':quantity_dispensed},
|
|
success: function(response){
|
|
if (response[0] !== "0" && $('#show_out_of_stock_message').val() == 1) {
|
|
alert(response[1]);
|
|
}
|
|
|
|
// return without displaying the submit buttons
|
|
if (response[0] === "2") {
|
|
return;
|
|
}
|
|
|
|
$('#submit_prescription').show();
|
|
$('#confirm_selection_button').hide();
|
|
}
|
|
});
|
|
} else {
|
|
e.preventDefault();
|
|
alert("Please make sure you have selected a drug and entered the correct prescription information");
|
|
return false;
|
|
}
|
|
});
|
|
|
|
function setup_progressive_treatment() {
|
|
if ($('#is_progressive_treatment_setup').val() == 0) {
|
|
$('.prompts_div').hide();
|
|
$('.first_dose_quantity_div').show();
|
|
$('#first_dose_total_div').show();
|
|
$('#setup_progressive_treatment_button').text("Remove Progressive Treatment");
|
|
$('#is_progressive_treatment_setup').val(1);
|
|
calculate_first_dose_totals();
|
|
} else {
|
|
$('.prompts_div').show();
|
|
$('.first_dose_quantity_div').hide();
|
|
$('#first_dose_total_div').hide();
|
|
$('#setup_progressive_treatment_button').text("Setup Progressive Treatment");
|
|
$('#is_progressive_treatment_setup').val(0);
|
|
}
|
|
}
|
|
|
|
let current_past_episode = 0;
|
|
function past_episode_row_details(id) {
|
|
$('.past_episode_row').hide();
|
|
|
|
if (current_past_episode !== id) {
|
|
$('#past_episode_row' + id).show();
|
|
current_past_episode = id;
|
|
} else {
|
|
current_past_episode = 0;
|
|
}
|
|
}
|
|
</script>
|
|
@endpush
|