resolved conflicts

This commit is contained in:
2025-03-31 03:46:05 +03:00
6454 changed files with 1520539 additions and 9 deletions
@@ -0,0 +1,5 @@
<?php
return [
'name' => 'Cancer'
];
@@ -0,0 +1,735 @@
<?php
namespace Modules\Cancer\Http\Controllers;
use Barryvdh\Snappy\Facades\SnappyPdf;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Database\QueryException;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Modules\ClinicalData\Services\Drugs\DrugRoutesService;
use Modules\ClinicalData\Services\Drugs\DrugsService;
use Modules\ClinicalData\Services\Drugs\DrugUnitsService;
use Streamline\Models\CancerProtocol;
use Streamline\Models\HospitalInformation;
use Streamline\Models\OrderedCancerProtocols;
use Streamline\Models\Patient;
class CancerProtocolController extends Controller
{
public function __construct(
protected DrugsService $drugsService,
protected DrugRoutesService $drugRoutesService,
protected DrugUnitsService $drugUnitsService
) {}
public static array $factors = [0 => 'Standard', 1 => 'BSA', 2 => 'Weight'];
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index() {
$cancer_protocols = CancerProtocol::all();
$drugs = $this->drugsService->pluckAvailableDrugs('name');
$drug_with_units = $this->drugsService->pluckAvailableDrugs('unit_id');
$drug_units = $this->drugUnitsService->pluckAvailableDrugUnits('name');
$drug_routes = $this->drugRoutesService->pluckAvailableDrugRoutes('name');
$factors = static::$factors;
return view('cancer::cancer_protocol.index', compact('cancer_protocols', 'drugs', 'drug_routes',
'factors', 'drug_units', 'drug_with_units'));
}
/**
* Show the form for creating a new resource.
* @return Renderable
*/
public function create() {
$drugs = $this->drugsService->pluckAvailableDrugs('name')->prepend('-- select drugs --', '');
$drug_routes = $this->drugRoutesService->pluckAvailableDrugRoutes('name')->prepend('-- select routes --', '');
$factors = static::$factors;
$option_drugs = "";
foreach ($drugs as $key => $value){
$drug_name = str_replace("'", '', $value);
$drug_name = str_replace("\"", '', $drug_name);
$drug_name = str_replace("+", '', $drug_name);
$option_drugs .= "<option value='$key'>$drug_name</option>";
}
$option_drug_routes = "";
foreach ($drug_routes as $key => $value){
$option_drug_routes .= "<option value='$key'>$value</option>";
}
$option_factors = "<option value=''>-select-</option>";
foreach ($factors as $key => $value){
$option_factors .= "<option value='$key'>$value</option>";
}
return view('cancer::cancer_protocol.create', compact('drugs', 'factors', 'drug_routes',
'option_drugs', 'option_drug_routes', 'option_factors'));
}
/**
* Store a newly created resource in storage.
* @param Request $request
* @return Application|\Illuminate\Foundation\Application|RedirectResponse|Redirector
*/
public function store(Request $request) {
$request->validate([
"name" => "required",
"protocol_billing_type" => "required"
]);
$protocol_billing_type = $request->protocol_billing_type;
$protocol_cost = $request->protocol_cost;
if ($protocol_billing_type == 0 && !is_numeric($protocol_cost)) {
flash("Please add a protocol cost when billing type is umbrella")->error();
return back()->withInput();
}
/* Pre Chemo Section */
$pre_chemo_row_counter_arr = $request->pre_chemo_row_counter;
$pre_chemo_drug_id_arr = $request->pre_chemo_drug_id;
$pre_chemo_drug_route_arr = $request->pre_chemo_drug_route;
$pre_chemo_drug_factor_id_arr = $request->pre_chemo_drug_factor_id;
$pre_chemo_drug_weight_range_arr = $request->pre_chemo_drug_weight_range;
$pre_chemo_drug_dose_arr = $request->pre_chemo_drug_dose;
$pre_chemo_drug_duration_arr = $request->pre_chemo_drug_duration;
$pre_chemo_drug_instructions_arr = $request->pre_chemo_drug_instructions;
$pre_chemo_child_row_id_arr = $request->pre_chemo_child_row_id;
$pre_chemo_child_drug_weight_range_arr = $request->pre_chemo_child_drug_weight_range;
$pre_chemo_child_drug_dose_arr = $request->pre_chemo_child_drug_dose;
$pre_chemo_child_drug_duration_arr = $request->pre_chemo_child_drug_duration;
$pre_chemo_child_drug_instructions_arr = $request->pre_chemo_child_drug_instructions;
$pre_chemo_drugs = [];
for ($x = 0; $x < count($pre_chemo_drug_id_arr); $x++) {
$pre_chemo_drugs[$pre_chemo_row_counter_arr[$x]] = [
"drug_id" => $pre_chemo_drug_id_arr[$x],
"drug_route" => $pre_chemo_drug_route_arr[$x],
"drug_factor" => $pre_chemo_drug_factor_id_arr[$x],
"dose" => [[
"weight_range" => $pre_chemo_drug_weight_range_arr[$x] ?? '',
"dose" => $pre_chemo_drug_dose_arr[$x] ?? '',
"duration" => $pre_chemo_drug_duration_arr[$x] ?? '',
"instructions" => $pre_chemo_drug_instructions_arr[$x] ?? '',
]],
];
}
if (is_array($pre_chemo_child_row_id_arr)) {
for ($x = 0; $x < count($pre_chemo_child_row_id_arr); $x++) {
if(isset($pre_chemo_drugs[$pre_chemo_child_row_id_arr[$x]])) {
$pre_chemo_drugs[$pre_chemo_child_row_id_arr[$x]]["dose"][] = [
"weight_range" => $pre_chemo_child_drug_weight_range_arr[$x] ?? '',
"dose" => $pre_chemo_child_drug_dose_arr[$x] ?? '',
"duration" => $pre_chemo_child_drug_duration_arr[$x] ?? '',
"instructions" => $pre_chemo_child_drug_instructions_arr[$x] ?? '',
];
}
}
}
/* Chemo Section */
$chemo_row_counter_arr = $request->chemo_row_counter;
$chemo_drug_id_arr = $request->chemo_drug_id;
$chemo_drug_route_arr = $request->chemo_drug_route;
$chemo_drug_factor_id_arr = $request->chemo_drug_factor_id;
$chemo_drug_weight_range_arr = $request->chemo_drug_weight_range;
$chemo_drug_dose_arr = $request->chemo_drug_dose;
$chemo_drug_duration_arr = $request->chemo_drug_duration;
$chemo_drug_instructions_arr = $request->chemo_drug_instructions;
$chemo_child_row_id_arr = $request->chemo_child_row_id;
$chemo_child_drug_weight_range_arr = $request->chemo_child_drug_weight_range;
$chemo_child_drug_dose_arr = $request->chemo_child_drug_dose;
$chemo_child_drug_duration_arr = $request->chemo_child_drug_duration;
$chemo_child_drug_instructions_arr = $request->chemo_child_drug_instructions;
$chemo_drugs = [];
for ($x = 0; $x < count($chemo_drug_id_arr); $x++) {
$chemo_drugs[$chemo_row_counter_arr[$x]] = [
"drug_id" => $chemo_drug_id_arr[$x],
"drug_route" => $chemo_drug_route_arr[$x],
"drug_factor" => $chemo_drug_factor_id_arr[$x],
"dose" => [[
"weight_range" => $chemo_drug_weight_range_arr[$x] ?? '',
"dose" => $chemo_drug_dose_arr[$x] ?? '',
"duration" => $chemo_drug_duration_arr[$x] ?? '',
"instructions" => $chemo_drug_instructions_arr[$x] ?? '',
]],
];
}
if (is_array($chemo_child_row_id_arr)) {
for ($x = 0; $x < count($chemo_child_row_id_arr); $x++) {
if(isset($chemo_drugs[$chemo_child_row_id_arr[$x]])) {
$chemo_drugs[$chemo_child_row_id_arr[$x]]["dose"][] = [
"weight_range" => $chemo_child_drug_weight_range_arr[$x] ?? '',
"dose" => $chemo_child_drug_dose_arr[$x] ?? '',
"duration" => $chemo_child_drug_duration_arr[$x] ?? '',
"instructions" => $chemo_child_drug_instructions_arr[$x] ?? '',
];
}
}
}
/* Post Chemo Section */
$post_chemo_row_counter_arr = $request->post_chemo_row_counter;
$post_chemo_drug_id_arr = $request->post_chemo_drug_id;
$post_chemo_drug_route_arr = $request->post_chemo_drug_route;
$post_chemo_drug_factor_id_arr = $request->post_chemo_drug_factor_id;
$post_chemo_drug_weight_range_arr = $request->post_chemo_drug_weight_range;
$post_chemo_drug_dose_arr = $request->post_chemo_drug_dose;
$post_chemo_drug_duration_arr = $request->post_chemo_drug_duration;
$post_chemo_drug_instructions_arr = $request->post_chemo_drug_instructions;
$post_chemo_child_row_id_arr = $request->post_chemo_child_row_id;
$post_chemo_child_drug_weight_range_arr = $request->post_chemo_child_drug_weight_range;
$post_chemo_child_drug_dose_arr = $request->post_chemo_child_drug_dose;
$post_chemo_child_drug_duration_arr = $request->post_chemo_child_drug_duration;
$post_chemo_child_drug_instructions_arr = $request->post_chemo_child_drug_instructions;
$post_chemo_drugs = [];
for ($x = 0; $x < count($post_chemo_drug_id_arr); $x++) {
$post_chemo_drugs[$post_chemo_row_counter_arr[$x]] = [
"drug_id" => $post_chemo_drug_id_arr[$x],
"drug_route" => $post_chemo_drug_route_arr[$x],
"drug_factor" => $post_chemo_drug_factor_id_arr[$x],
"dose" => [[
"weight_range" => $post_chemo_drug_weight_range_arr[$x] ?? '',
"dose" => $post_chemo_drug_dose_arr[$x] ?? '',
"duration" => $post_chemo_drug_duration_arr[$x] ?? '',
"instructions" => $post_chemo_drug_instructions_arr[$x] ?? '',
]],
];
}
if (is_array($post_chemo_child_row_id_arr)) {
for ($x = 0; $x < count($post_chemo_child_row_id_arr); $x++) {
if(isset($post_chemo_drugs[$post_chemo_child_row_id_arr[$x]])) {
$post_chemo_drugs[$post_chemo_child_row_id_arr[$x]]["dose"][] = [
"weight_range" => $post_chemo_child_drug_weight_range_arr[$x] ?? '',
"dose" => $post_chemo_child_drug_dose_arr[$x] ?? '',
"duration" => $post_chemo_child_drug_duration_arr[$x] ?? '',
"instructions" => $post_chemo_child_drug_instructions_arr[$x] ?? '',
];
}
}
}
$cancer_protocol = new CancerProtocol();
$cancer_protocol->name = $request->name;
$cancer_protocol->protocol_billing_type = $protocol_billing_type;
$cancer_protocol->protocol_cost = $protocol_cost;
$cancer_protocol->pre_chemo_comments = $request->pre_chemo_comments;
$cancer_protocol->pre_chemo_drugs = json_encode(array_values($pre_chemo_drugs));
$cancer_protocol->chemo_comments = $request->chemo_comments;
$cancer_protocol->chemo_drugs = json_encode(array_values($chemo_drugs));
$cancer_protocol->post_chemo_comments = $request->post_chemo_comments;
$cancer_protocol->post_chemo_drugs = json_encode(array_values($post_chemo_drugs));
$cancer_protocol->created_by = Auth::id();
try {
$cancer_protocol->save();
return redirect('/cancer_protocol/');
} catch (QueryException $exception) {
flash("An error occurred. Please try again later")->error();
return back()->withInput();
}
}
/**
* Show the specified resource.
* @param int $id
* @return Renderable
*/
public function show($id)
{
return view('cancer::show');
}
/**
* Show the form for editing the specified resource.
* @param int $id
* @return Renderable
*/
public function edit($id) {
$drugs = DB::table('drugs')->whereNull('deleted_at')
->where('available', 1)
->pluck('name', 'id')->prepend('-- select drugs --', '');
$drug_routes = DB::table('drug_routes')->whereNull('deleted_at')
->where('available', 1)
->pluck('name', 'id')->prepend('-- select routes --', '');
$factors = static::$factors;
$option_drugs = "";
foreach ($drugs as $key => $value){
$drug_name = str_replace("'", '', $value);
$drug_name = str_replace("\"", '', $drug_name);
$drug_name = str_replace("+", '', $drug_name);
$option_drugs .= "<option value='$key'>$drug_name</option>";
}
$option_drug_routes = "";
foreach ($drug_routes as $key => $value){
$option_drug_routes .= "<option value='$key'>$value</option>";
}
$option_factors = "<option value=''>-select-</option>";
foreach ($factors as $key => $value){
$option_factors .= "<option value='$key'>$value</option>";
}
$cancer_protocol = CancerProtocol::find($id);
return view('cancer::cancer_protocol.edit', compact('drugs', 'factors', 'drug_routes',
'option_drugs', 'option_drug_routes', 'option_factors', 'cancer_protocol'));
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id) {
$request->validate([
"name" => "required",
"protocol_billing_type" => "required"
]);
$protocol_billing_type = $request->protocol_billing_type;
$protocol_cost = $request->protocol_cost;
if ($protocol_billing_type == 0 && !is_numeric($protocol_cost)) {
flash("Please add a protocol cost when billing type is umbrella")->error();
return back()->withInput();
}
/* Pre Chemo Section */
$pre_chemo_row_counter_arr = $request->pre_chemo_row_counter;
$pre_chemo_drug_id_arr = $request->pre_chemo_drug_id;
$pre_chemo_drug_route_arr = $request->pre_chemo_drug_route;
$pre_chemo_drug_factor_id_arr = $request->pre_chemo_drug_factor_id;
$pre_chemo_drug_weight_range_arr = $request->pre_chemo_drug_weight_range;
$pre_chemo_drug_dose_arr = $request->pre_chemo_drug_dose;
$pre_chemo_drug_duration_arr = $request->pre_chemo_drug_duration;
$pre_chemo_drug_instructions_arr = $request->pre_chemo_drug_instructions;
$pre_chemo_child_row_id_arr = $request->pre_chemo_child_row_id;
$pre_chemo_child_drug_weight_range_arr = $request->pre_chemo_child_drug_weight_range;
$pre_chemo_child_drug_dose_arr = $request->pre_chemo_child_drug_dose;
$pre_chemo_child_drug_duration_arr = $request->pre_chemo_child_drug_duration;
$pre_chemo_child_drug_instructions_arr = $request->pre_chemo_child_drug_instructions;
$pre_chemo_drugs = [];
for ($x = 0; $x < count($pre_chemo_drug_id_arr); $x++) {
$pre_chemo_drugs[$pre_chemo_row_counter_arr[$x]] = [
"drug_id" => $pre_chemo_drug_id_arr[$x],
"drug_route" => $pre_chemo_drug_route_arr[$x],
"drug_factor" => $pre_chemo_drug_factor_id_arr[$x],
"dose" => [[
"weight_range" => $pre_chemo_drug_weight_range_arr[$x] ?? '',
"dose" => $pre_chemo_drug_dose_arr[$x] ?? '',
"duration" => $pre_chemo_drug_duration_arr[$x] ?? '',
"instructions" => $pre_chemo_drug_instructions_arr[$x] ?? '',
]],
];
}
if (is_array($pre_chemo_child_row_id_arr)) {
for ($x = 0; $x < count($pre_chemo_child_row_id_arr); $x++) {
if(isset($pre_chemo_drugs[$pre_chemo_child_row_id_arr[$x]])) {
$pre_chemo_drugs[$pre_chemo_child_row_id_arr[$x]]["dose"][] = [
"weight_range" => $pre_chemo_child_drug_weight_range_arr[$x] ?? '',
"dose" => $pre_chemo_child_drug_dose_arr[$x] ?? '',
"duration" => $pre_chemo_child_drug_duration_arr[$x] ?? '',
"instructions" => $pre_chemo_child_drug_instructions_arr[$x] ?? '',
];
}
}
}
/* Chemo Section */
$chemo_row_counter_arr = $request->chemo_row_counter;
$chemo_drug_id_arr = $request->chemo_drug_id;
$chemo_drug_route_arr = $request->chemo_drug_route;
$chemo_drug_factor_id_arr = $request->chemo_drug_factor_id;
$chemo_drug_weight_range_arr = $request->chemo_drug_weight_range;
$chemo_drug_dose_arr = $request->chemo_drug_dose;
$chemo_drug_duration_arr = $request->chemo_drug_duration;
$chemo_drug_instructions_arr = $request->chemo_drug_instructions;
$chemo_child_row_id_arr = $request->chemo_child_row_id;
$chemo_child_drug_weight_range_arr = $request->chemo_child_drug_weight_range;
$chemo_child_drug_dose_arr = $request->chemo_child_drug_dose;
$chemo_child_drug_duration_arr = $request->chemo_child_drug_duration;
$chemo_child_drug_instructions_arr = $request->chemo_child_drug_instructions;
$chemo_drugs = [];
for ($x = 0; $x < count($chemo_drug_id_arr); $x++) {
$chemo_drugs[$chemo_row_counter_arr[$x]] = [
"drug_id" => $chemo_drug_id_arr[$x],
"drug_route" => $chemo_drug_route_arr[$x],
"drug_factor" => $chemo_drug_factor_id_arr[$x],
"dose" => [[
"weight_range" => $chemo_drug_weight_range_arr[$x] ?? '',
"dose" => $chemo_drug_dose_arr[$x] ?? '',
"duration" => $chemo_drug_duration_arr[$x] ?? '',
"instructions" => $chemo_drug_instructions_arr[$x] ?? '',
]],
];
}
if (is_array($chemo_child_row_id_arr)) {
for ($x = 0; $x < count($chemo_child_row_id_arr); $x++) {
if(isset($chemo_drugs[$chemo_child_row_id_arr[$x]])) {
$chemo_drugs[$chemo_child_row_id_arr[$x]]["dose"][] = [
"weight_range" => $chemo_child_drug_weight_range_arr[$x] ?? '',
"dose" => $chemo_child_drug_dose_arr[$x] ?? '',
"duration" => $chemo_child_drug_duration_arr[$x] ?? '',
"instructions" => $chemo_child_drug_instructions_arr[$x] ?? '',
];
}
}
}
/* Post Chemo Section */
$post_chemo_row_counter_arr = $request->post_chemo_row_counter;
$post_chemo_drug_id_arr = $request->post_chemo_drug_id;
$post_chemo_drug_route_arr = $request->post_chemo_drug_route;
$post_chemo_drug_factor_id_arr = $request->post_chemo_drug_factor_id;
$post_chemo_drug_weight_range_arr = $request->post_chemo_drug_weight_range;
$post_chemo_drug_dose_arr = $request->post_chemo_drug_dose;
$post_chemo_drug_duration_arr = $request->post_chemo_drug_duration;
$post_chemo_drug_instructions_arr = $request->post_chemo_drug_instructions;
$post_chemo_child_row_id_arr = $request->post_chemo_child_row_id;
$post_chemo_child_drug_weight_range_arr = $request->post_chemo_child_drug_weight_range;
$post_chemo_child_drug_dose_arr = $request->post_chemo_child_drug_dose;
$post_chemo_child_drug_duration_arr = $request->post_chemo_child_drug_duration;
$post_chemo_child_drug_instructions_arr = $request->post_chemo_child_drug_instructions;
$post_chemo_drugs = [];
for ($x = 0; $x < count($post_chemo_drug_id_arr); $x++) {
$post_chemo_drugs[$post_chemo_row_counter_arr[$x]] = [
"drug_id" => $post_chemo_drug_id_arr[$x],
"drug_route" => $post_chemo_drug_route_arr[$x],
"drug_factor" => $post_chemo_drug_factor_id_arr[$x],
"dose" => [[
"weight_range" => $post_chemo_drug_weight_range_arr[$x] ?? '',
"dose" => $post_chemo_drug_dose_arr[$x] ?? '',
"duration" => $post_chemo_drug_duration_arr[$x] ?? '',
"instructions" => $post_chemo_drug_instructions_arr[$x] ?? '',
]],
];
}
if (is_array($post_chemo_child_row_id_arr)) {
for ($x = 0; $x < count($post_chemo_child_row_id_arr); $x++) {
if(isset($post_chemo_drugs[$post_chemo_child_row_id_arr[$x]])) {
$post_chemo_drugs[$post_chemo_child_row_id_arr[$x]]["dose"][] = [
"weight_range" => $post_chemo_child_drug_weight_range_arr[$x] ?? '',
"dose" => $post_chemo_child_drug_dose_arr[$x] ?? '',
"duration" => $post_chemo_child_drug_duration_arr[$x] ?? '',
"instructions" => $post_chemo_child_drug_instructions_arr[$x] ?? '',
];
}
}
}
$cancer_protocol = CancerProtocol::find($id);
$cancer_protocol->name = $request->name;
$cancer_protocol->protocol_billing_type = $protocol_billing_type;
$cancer_protocol->protocol_cost = $protocol_cost;
$cancer_protocol->pre_chemo_comments = $request->pre_chemo_comments;
$cancer_protocol->pre_chemo_drugs = json_encode(array_values($pre_chemo_drugs));
$cancer_protocol->chemo_comments = $request->chemo_comments;
$cancer_protocol->chemo_drugs = json_encode(array_values($chemo_drugs));
$cancer_protocol->post_chemo_comments = $request->post_chemo_comments;
$cancer_protocol->post_chemo_drugs = json_encode(array_values($post_chemo_drugs));
$cancer_protocol->updated_by = Auth::id();
try {
$cancer_protocol->save();
return redirect('/cancer_protocol/');
} catch (QueryException $exception) {
flash("An error occurred. Please try again later")->error();
return back()->withInput();
}
}
/**
* Remove the specified resource from storage.
* @param int $id
*/
public function destroy($id) {
$protocol = CancerProtocol::find($id);
if ($protocol->delete()){
flash("Protocol has been deleted.")->success();
return redirect('/cancer_protocol/');
} else {
flash("An error occurred. Please try again later")->error();
return back()->withInput();
}
}
public function inactive() {
$cancer_protocols = CancerProtocol::onlyTrashed()->get();
return view('cancer::cancer_protocol.inactive', compact('cancer_protocols'));
}
public function activate($id) {
$protocol = CancerProtocol::withTrashed()->find($id);
if ($protocol->restore()){
flash("Protocol has been activated")->success();
return redirect('/cancer_protocol/');
} else {
flash("An error occurred. Please try again later")->error();
return back()->withInput();
}
}
public function print_all_protocols() {
$cancer_protocols = CancerProtocol::all();
$hospital_information = HospitalInformation::find(1);
$drugs = $this->drugsService->pluckAvailableDrugs('name');
$drug_with_units = $this->drugsService->pluckAvailableDrugs('unit_id');
$drug_units = $this->drugUnitsService->pluckAvailableDrugUnits('name');
$drug_routes = $this->drugRoutesService->pluckAvailableDrugRoutes('name');
$factors = static::$factors;
$data = [
'drugs' => $drugs,
'hospitalInfo' => $hospital_information,
'cancer_protocols' => $cancer_protocols,
'drug_with_units' => $drug_with_units,
'drug_units' => $drug_units,
'drug_routes' => $drug_routes,
'factors' => $factors
];
$print_footer = (!is_null($hospital_information->print_footer)) ? '&nbsp&nbsp&nbsp&nbsp&nbsp<i>' . $hospital_information->print_footer . '</i>' : '';
$pdf = SnappyPDF::loadView("cancer::cancer_protocol/print_all_protocols", $data)
->setOrientation('portrait')
->setPaper('a4')
->setOption('margin-bottom', 5)
->setOption('margin-top', 5)
->setOption('footer-html', '<i>&copy; ' . date('Y') . ' Stre@mline</i>' . $print_footer);
return $pdf->inline('Cancer Protocols' . date(" d-m-y h:ia") . '.pdf');
}
public function order_protocol(Request $request) {
$patient_id = session()->get('patient_id');
$episode_id = session()->get('episode_id');
$inpatient_info_id = session()->get('inpatient_info_id');
$selected_protocols = [];
if (isset($request->cancer_protocols) && is_array($request->cancer_protocols)) {
$selected_protocols = CancerProtocol::whereIn('id', $request->cancer_protocols)->get();
}
$patient = Patient::find($patient_id);
$cancer_protocols = CancerProtocol::pluck('name', 'id');
$drugs = $this->drugsService->pluckAvailableDrugs('name');
$drug_with_units = $this->drugsService->pluckAvailableDrugs('unit_id');
$drug_units = $this->drugUnitsService->pluckAvailableDrugUnits('name');
$drug_routes = $this->drugRoutesService->pluckAvailableDrugRoutes('name');
$factors = static::$factors;
return view('cancer::cancer_protocol.order_protocol', compact('patient_id', 'episode_id', 'inpatient_info_id',
'cancer_protocols', 'patient', 'selected_protocols', 'drugs', 'drug_routes', 'drug_units', 'drug_with_units', 'factors'));
}
public function save_protocol_order(Request $request) {
$protocol_ids = $request->protocol_id;
$inpatient_id = $request->inpatient_info_id;
$patient_id = $request->patient_id;
$episode_id = $request->episode_id;
$adjusted_dose = $request->adjusted_dose;
$adjusted_dose_reason = $request->adjusted_dose_reason;
$count = 0;
foreach ($protocol_ids as $protocol_id) {
$pre_chemo_drugs_to_save = [];
$chemo_drugs_to_save = [];
$post_chemo_drugs_to_save = [];
$cancer_protocol = CancerProtocol::find($protocol_id);
$pre_chemo_drugs = json_decode($cancer_protocol->pre_chemo_drugs, true);
$chemo_drugs = json_decode($cancer_protocol->chemo_drugs, true);
$post_chemo_drugs = json_decode($cancer_protocol->post_chemo_drugs, true);
for($x = 0; $x < count($pre_chemo_drugs); $x++) {
$drug_doses = [];
for($i = 0; $i < count($pre_chemo_drugs[$x]['dose']); $i++){
$duration_array = explode(",", $pre_chemo_drugs[$x]['dose'][$i]['duration']);
$duration_array_to_store = [];
foreach ($duration_array as $duration) {
$duration_array_to_store[] = [
"name" => $duration,
"given_by" => NULL,
"given_on" => NULL,
"quantity_given" => 0,
];
}
$drug_doses[] = [
"dose" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose[$count] : $pre_chemo_drugs[$x]['dose'][$i]['dose'],
"weight_range" => $pre_chemo_drugs[$x]['dose'][$i]['weight_range'],
"duration" => $duration_array_to_store,
"instructions" => $pre_chemo_drugs[$x]['dose'][$i]['instructions'],
"adjusted_dose_reason" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose_reason[$count] : NULL
];
$count++;
}
$pre_chemo_drugs_to_save[] = [
"protocol_id" => $protocol_id,
"drug_id" => $pre_chemo_drugs[$x]['drug_id'],
"drug_route" => $pre_chemo_drugs[$x]['drug_route'],
"drug_factor" => $pre_chemo_drugs[$x]['drug_factor'],
"dose" => $drug_doses
];
}
for($x = 0; $x < count($chemo_drugs); $x++) {
$drug_doses = [];
for($i = 0; $i < count($chemo_drugs[$x]['dose']); $i++){
$duration_array = explode(",", $chemo_drugs[$x]['dose'][$i]['duration']);
$duration_array_to_store = [];
foreach ($duration_array as $duration) {
$duration_array_to_store[] = [
"name" => $duration,
"given_by" => NULL,
"given_on" => NULL,
"quantity_given" => 0,
];
}
$drug_doses[] = [
"dose" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose[$count] : $chemo_drugs[$x]['dose'][$i]['dose'],
"weight_range" => $chemo_drugs[$x]['dose'][$i]['weight_range'],
"duration" => $duration_array_to_store,
"instructions" => $chemo_drugs[$x]['dose'][$i]['instructions'],
"adjusted_dose_reason" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose_reason[$count] : NULL
];
$count++;
}
$chemo_drugs_to_save[] = [
"protocol_id" => $protocol_id,
"drug_id" => $chemo_drugs[$x]['drug_id'],
"drug_route" => $chemo_drugs[$x]['drug_route'],
"drug_factor" => $chemo_drugs[$x]['drug_factor'],
"dose" => $drug_doses
];
}
for($x = 0; $x < count($post_chemo_drugs); $x++) {
$drug_doses = [];
for($i = 0; $i < count($post_chemo_drugs[$x]['dose']); $i++){
$duration_array = explode(",", $post_chemo_drugs[$x]['dose'][$i]['duration']);
$duration_array_to_store = [];
foreach ($duration_array as $duration) {
$duration_array_to_store[] = [
"name" => $duration,
"given_by" => NULL,
"given_on" => NULL,
"quantity_given" => 0,
];
}
$drug_doses[] = [
"dose" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose[$count] : $post_chemo_drugs[$x]['dose'][$i]['dose'],
"weight_range" => $post_chemo_drugs[$x]['dose'][$i]['weight_range'],
"duration" => $duration_array_to_store,
"instructions" => $post_chemo_drugs[$x]['dose'][$i]['instructions'],
"adjusted_dose_reason" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose_reason[$count] : NULL
];
$count++;
}
$post_chemo_drugs_to_save[] = [
"protocol_id" => $protocol_id,
"drug_id" => $post_chemo_drugs[$x]['drug_id'],
"drug_route" => $post_chemo_drugs[$x]['drug_route'],
"drug_factor" => $post_chemo_drugs[$x]['drug_factor'],
"dose" => $drug_doses
];
}
$ordered_cancer_protocol = new OrderedCancerProtocols();
$ordered_cancer_protocol->protocol_id = $protocol_id;
$ordered_cancer_protocol->patient_id = $patient_id;
$ordered_cancer_protocol->episode_id = $episode_id;
$ordered_cancer_protocol->inpatient_id = $inpatient_id;
$ordered_cancer_protocol->pre_chemo_drugs = json_encode($pre_chemo_drugs_to_save);
$ordered_cancer_protocol->chemo_drugs = json_encode($chemo_drugs_to_save);
$ordered_cancer_protocol->post_chemo_drugs = json_encode($post_chemo_drugs_to_save);
$ordered_cancer_protocol->created_by = Auth::id();
try {
$ordered_cancer_protocol->save();
flash("Cancer protocol ordering successful")->success();
} catch (QueryException $e) {
flash("An error occurred when adding cancer protocols")->error();
}
}
return redirect('in_patient_sheet');
}
public function cancel_protocol_order($id) {
$protocol = OrderedCancerProtocols::find($id);
// check if any drugs have been dispensed
if ($protocol && $protocol->pre_chemo_status == 0 && $protocol->chemo_status == 0 && $protocol->post_chemo_status == 0) {
if ($protocol->delete()){
flash("Protocol has been deleted.")->success();
} else {
flash("An error occurred. Please try again later")->error();
}
} else {
flash("Drugs in the protocol have already been dispensed")->error();
}
return redirect('in_patient_sheet');
}
}
@@ -0,0 +1,114 @@
<?php
namespace Modules\Cancer\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Factory;
class CancerServiceProvider extends ServiceProvider
{
/**
* @var string $moduleName
*/
protected $moduleName = 'Cancer';
/**
* @var string $moduleNameLower
*/
protected $moduleNameLower = 'cancer';
/**
* Boot the application events.
*
* @return void
*/
public function boot()
{
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->register(RouteServiceProvider::class);
}
/**
* Register config.
*
* @return void
*/
protected function registerConfig()
{
$this->publishes([
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
], 'config');
$this->mergeConfigFrom(
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
);
}
/**
* Register views.
*
* @return void
*/
public function registerViews()
{
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
$sourcePath = module_path($this->moduleName, 'Resources/views');
$this->publishes([
$sourcePath => $viewPath
], ['views', $this->moduleNameLower . '-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
}
/**
* Register translations.
*
* @return void
*/
public function registerTranslations()
{
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'));
}
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [];
}
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (\Config::get('view.paths') as $path) {
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
$paths[] = $path . '/modules/' . $this->moduleNameLower;
}
}
return $paths;
}
}
@@ -0,0 +1,69 @@
<?php
namespace Modules\Cancer\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* The module namespace to assume when generating URLs to actions.
*
* @var string
*/
protected $moduleNamespace = 'Modules\Cancer\Http\Controllers';
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*
* @return void
*/
public function boot()
{
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->moduleNamespace)
->group(module_path('Cancer', '/Routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->moduleNamespace)
->group(module_path('Cancer', '/Routes/api.php'));
}
}
@@ -0,0 +1,560 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('cancer_protocol.add_cancer_protocol') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('cancer_protocol.dashboard') }}</a></li>
<li><a href="{{ route('cancer_protocol.index') }}">{{ __('cancer_protocol.cancer_protocols') }}</a></li>
<li class="active">{{ __('cancer_protocol.create') }}</li>
</ol>
</div>
</div>
@include('cancer::cancer_protocol.menu')
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
{{ Form::open(['route' => 'cancer_protocol.store', 'data-toggle' => 'validator']) }}
<h3>Protocol Details</h3>
<div class="row">
<div class="col-md-5">
<div class="form-group">
{{ Form::label('name', "Protocol Name") }}
{{ Form::text('name', '', ['class' => 'form-control compulsory', 'required']) }}
</div>
</div>
<div class="col-md-2"></div>
<div class="col-md-5">
<div class="form-group">
{{ Form::label('name', "Protocol Billing Type") }}
<br>
{{ Form::radio('protocol_billing_type', 0, false, ["required", "onclick" => "show('protocol_cost_div');"]) }}&nbsp; Umbrella Cost &nbsp;&nbsp;
{{ Form::radio('protocol_billing_type', 1, false, ["required", "onclick" => "hide('protocol_cost_div');"]) }}&nbsp; Bill Per Drug
</div>
<br>
<div class="form-group" id="protocol_cost_div" style="display: none">
{{ Form::label('protocol_cost', "Protocol Cost") }}
{{ Form::number('protocol_cost', '', ['class' => 'form-control compulsory', 'min' => 0]) }}
</div>
</div>
</div>
<hr>
<h3><label class="label label-warning">PRE-CHEMOTHERAPY</label></h3>
<div class="row">
<div class="col-md-6">
{{ Form::label('pre_chemo_comments', 'Comments') }}
{{ Form::textarea('pre_chemo_comments', '', ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
</div>
</div>
<br>
<table class='table color-bordered-table success-bordered-table'>
<thead>
<tr>
<th>
<div class="row">
<div class="col-3">Drug</div>
<div class="col-1">Route</div>
<div class="col-2">Factor</div>
<div class="col-1">Dose</div>
<div class="col-2">Duration(Separate with commas)</div>
<div class="col-2">Instructions</div>
<div class="col-1"></div>
</div>
</th>
</tr>
</thead>
<tbody id="pre_chemo_drugs_div">
<tr>
<td>
<div id="pre_chemo_row_0">
{{ Form::hidden('pre_chemo_row_counter[]', 0) }}
<div class="row">
<div class="col-3">
{{ Form::select('pre_chemo_drug_id[]', $drugs, '', ['class' => 'form-control compulsory drugs_id_class', 'id' => 'pre_chemo_drug_id_0', 'onchange' => 'drugs_details(0, this.value, \'pre_chemo\')', 'required']) }}
</div>
<div class="col-1">
{{ Form::select('pre_chemo_drug_route[]', $drug_routes, '', ['class' => 'form-control compulsory', 'required']) }}
</div>
<div class="col-2">
{{ Form::select('pre_chemo_drug_factor_id[]', $factors, '', ['class' => 'form-control compulsory', 'onchange' => 'check_factor(0, \'pre_chemo\')', 'required', 'id' => 'pre_chemo_drug_factor_id_0']) }}
<div id="pre_chemo_drug_weight_0" style="display: none">
<hr>
{{ Form::label('pre_chemo_drug_weight_range', 'Range (Kg)') }}
{{ Form::text('pre_chemo_drug_weight_range[]', '', ['class' => 'form-control']) }}
</div>
</div>
<div class="col-1">
{{ Form::number('pre_chemo_drug_dose[]', '', ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_unit_0'></span>
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_factor_unit_0'></span>
</div>
<div class="col-2">
{{ Form::textarea('pre_chemo_drug_duration[]', '', ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
</div>
<div class="col-2">
{{ Form::textarea('pre_chemo_drug_instructions[]', '', ['class' => 'form-control', 'rows' => '3']) }}
</div>
<div class="col-1">
<a href="#pre_chemo_row_0" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_pre_chemo_dose(0)">Add Dose</a>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<a class="btn btn-success btn-rounded btn-sm" onclick="add_pre_chemo_drug()">Add Drug</a>
<hr>
<h3><label class="label label-warning">CHEMOTHERAPY</label></h3>
<div class="row">
<div class="col-md-6">
{{ Form::label('chemo_comments', 'Comments') }}
{{ Form::textarea('chemo_comments', '', ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
</div>
</div>
<br>
<table class='table color-bordered-table success-bordered-table'>
<thead>
<tr>
<th>
<div class="row">
<div class="col-3">Drug</div>
<div class="col-1">Route</div>
<div class="col-2">Factor</div>
<div class="col-1">Dose</div>
<div class="col-2">Duration(Separate with commas)</div>
<div class="col-2">Instructions</div>
<div class="col-1"></div>
</div>
</th>
</tr>
</thead>
<tbody id="chemo_drugs_div">
<tr>
<td>
<div id="chemo_row_0">
{{ Form::hidden('chemo_row_counter[]', 0) }}
<div class="row">
<div class="col-3">
{{ Form::select('chemo_drug_id[]', $drugs, '', ['class' => 'form-control compulsory drugs_id_class', 'id' => 'chemo_drug_id_0', 'onchange' => 'drugs_details(0, this.value, \'chemo\')', 'required']) }}
</div>
<div class="col-1">
{{ Form::select('chemo_drug_route[]', $drug_routes, '', ['class' => 'form-control compulsory', 'required']) }}
</div>
<div class="col-2">
{{ Form::select('chemo_drug_factor_id[]', $factors, '', ['class' => 'form-control compulsory', 'onchange' => 'check_factor(0, \'chemo\')', 'required', 'id' => 'chemo_drug_factor_id_0']) }}
<div id="chemo_drug_weight_0" style="display: none">
<hr>
{{ Form::label('chemo_drug_weight_range', 'Range (Kg)') }}
{{ Form::text('chemo_drug_weight_range[]', '', ['class' => 'form-control']) }}
</div>
</div>
<div class="col-1">
{{ Form::number('chemo_drug_dose[]', '', ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_unit_0'></span>
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_factor_unit_0'></span>
</div>
<div class="col-2">
{{ Form::textarea('chemo_drug_duration[]', '', ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
</div>
<div class="col-2">
{{ Form::textarea('chemo_drug_instructions[]', '', ['class' => 'form-control', 'rows' => '3']) }}
</div>
<div class="col-1">
<a href="#chemo_row_0" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_chemo_dose(0)">Add Dose</a>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<a class="btn btn-success btn-rounded btn-sm" onclick="add_chemo_drug()">Add Drug</a>
<hr>
<h3><label class="label label-warning">POST-CHEMOTHERAPY</label></h3>
<div class="row">
<div class="col-md-6">
{{ Form::label('post_chemo_comments', 'Comments') }}
{{ Form::textarea('post_chemo_comments', '', ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
</div>
</div>
<br>
<table class='table color-bordered-table success-bordered-table'>
<thead>
<tr>
<th>
<div class="row">
<div class="col-3">Drug</div>
<div class="col-1">Route</div>
<div class="col-2">Factor</div>
<div class="col-1">Dose</div>
<div class="col-2">Duration(Separate with commas)</div>
<div class="col-2">Instructions</div>
<div class="col-1"></div>
</div>
</th>
</tr>
</thead>
<tbody id="post_chemo_drugs_div">
<tr>
<td>
<div id="post_chemo_row_0">
{{ Form::hidden('post_chemo_row_counter[]', 0) }}
<div class="row">
<div class="col-3">
{{ Form::select('post_chemo_drug_id[]', $drugs, '', ['class' => 'form-control compulsory drugs_id_class', 'id' => 'post_chemo_drug_id_0', 'onchange' => 'drugs_details(0, this.value, \'post_chemo\')', 'required']) }}
</div>
<div class="col-1">
{{ Form::select('post_chemo_drug_route[]', $drug_routes, '', ['class' => 'form-control compulsory', 'required']) }}
</div>
<div class="col-2">
{{ Form::select('post_chemo_drug_factor_id[]', $factors, '', ['class' => 'form-control compulsory', 'onchange' => 'check_factor(0, \'post_chemo\')', 'required', 'id' => 'post_chemo_drug_factor_id_0']) }}
<div id="post_chemo_drug_weight_0" style="display: none">
<hr>
{{ Form::label('post_chemo_drug_weight_range', 'Range (Kg)') }}
{{ Form::text('post_chemo_drug_weight_range[]', '', ['class' => 'form-control']) }}
</div>
</div>
<div class="col-1">
{{ Form::number('post_chemo_drug_dose[]', '', ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_unit_0'></span>
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_factor_unit_0'></span>
</div>
<div class="col-2">
{{ Form::textarea('post_chemo_drug_duration[]', '', ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
</div>
<div class="col-2">
{{ Form::textarea('post_chemo_drug_instructions[]', '', ['class' => 'form-control', 'rows' => '3']) }}
</div>
<div class="col-1">
<a href="#post_chemo_row_0" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_post_chemo_dose(0)">Add Dose</a>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<a class="btn btn-success btn-rounded btn-sm" onclick="add_post_chemo_drug()">Add Drug</a>
<hr>
{{ Form::button(__('cancer_protocol.submit'),['type'=>'submit','class'=>'btn btn-success btn-rounded waves-effect waves-light m-r-10']) }}
{{ Form::button(__('cancer_protocol.cancel'),['type'=>'reset','class'=>'btn btn-default btn-rounded waves-effect waves-light']) }}
{{ Form::close() }}
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
let pre_chemo_counter = 1;
let chemo_counter = 1;
let post_chemo_counter = 1;
function remove_field(id) {
$('#' + id).remove();
}
function add_pre_chemo_drug() {
$('#pre_chemo_drugs_div').append("<tr id='pre_chemo_row_delete_" + pre_chemo_counter + "'>\
<td>\
<div id='pre_chemo_row_" + pre_chemo_counter + "'>\
<input type='hidden' name='pre_chemo_row_counter[]' value='" + pre_chemo_counter + "'>\
<div class='row'>\
<div class='col-3'>\
<select name='pre_chemo_drug_id[]' id='pre_chemo_drug_id_" + pre_chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + pre_chemo_counter + ", this.value, \"pre_chemo\")'>@php echo $option_drugs; @endphp</select>\
</div>\
<div class='col-1'>\
<select name='pre_chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
</div>\
<div class='col-2'>\
<select name='pre_chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + pre_chemo_counter + ", \"pre_chemo\")' id='pre_chemo_drug_factor_id_" + pre_chemo_counter + "'>@php echo $option_factors; @endphp</select>\
<div id='pre_chemo_drug_weight_" + pre_chemo_counter + "' style='display: none'>\
<hr>\
<label>Range (Kg)</label>\
<input type='text' name='pre_chemo_drug_weight_range[]' class='form-control'>\
</div>\
</div>\
<div class='col-1'>\
<input type='number' name='pre_chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_unit_" + pre_chemo_counter + "'></span>\
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_factor_unit_" + pre_chemo_counter + "'></span>\
</div>\
<div class='col-2'>\
<textarea name='pre_chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
</div>\
<div class='col-2'>\
<textarea name='pre_chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
</div>\
<div class='col-1'>\
<a href='#pre_chemo_row_" + pre_chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_pre_chemo_dose(" + pre_chemo_counter + ")'>Add Dose</a>\
<br><br>\
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"pre_chemo_row_delete_" + pre_chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
</div>\
</div>\
</div>\
</td>\
</tr>");
generalSelect2Set('pre_chemo_drug_id_'+pre_chemo_counter);
pre_chemo_counter++;
}
function add_chemo_drug() {
$('#chemo_drugs_div').append("<tr id='chemo_row_delete_" + chemo_counter + "'>\
<td>\
<div id='chemo_row_" + chemo_counter + "'>\
<input type='hidden' name='chemo_row_counter[]' value='" + chemo_counter + "'>\
<div class='row'>\
<div class='col-3'>\
<select name='chemo_drug_id[]' id='chemo_drug_id_" + chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + chemo_counter + ", this.value, \"chemo\")'>@php echo $option_drugs; @endphp</select>\
</div>\
<div class='col-1'>\
<select name='chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
</div>\
<div class='col-2'>\
<select name='chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + chemo_counter + ", \"chemo\")' id='chemo_drug_factor_id_" + chemo_counter + "'>@php echo $option_factors; @endphp</select>\
<div id='chemo_drug_weight_" + chemo_counter + "' style='display: none'>\
<hr>\
<label>Range (Kg)</label>\
<input type='text' name='chemo_drug_weight_range[]' class='form-control'>\
</div>\
</div>\
<div class='col-1'>\
<input type='number' name='chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_unit_" + chemo_counter + "'></span>\
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_factor_unit_" + chemo_counter + "'></span>\
</div>\
<div class='col-2'>\
<textarea name='chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
</div>\
<div class='col-2'>\
<textarea name='chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
</div>\
<div class='col-1'>\
<a href='#chemo_row_" + chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_chemo_dose(" + chemo_counter + ")'>Add Dose</a>\
<br><br>\
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"chemo_row_delete_" + chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
</div>\
</div>\
</div>\
</td>\
</tr>");
generalSelect2Set('chemo_drug_id_'+chemo_counter);
chemo_counter++;
}
function add_post_chemo_drug() {
$('#post_chemo_drugs_div').append("<tr id='post_chemo_row_delete_" + post_chemo_counter + "'>\
<td>\
<div id='post_chemo_row_" + post_chemo_counter + "'>\
<input type='hidden' name='post_chemo_row_counter[]' value='" + post_chemo_counter + "'>\
<div class='row'>\
<div class='col-3'>\
<select name='post_chemo_drug_id[]' id='post_chemo_drug_id_" + post_chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + post_chemo_counter + ", this.value, \"post_chemo\")'>@php echo $option_drugs; @endphp</select>\
</div>\
<div class='col-1'>\
<select name='post_chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
</div>\
<div class='col-2'>\
<select name='post_chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + post_chemo_counter + ", \"post_chemo\")' id='post_chemo_drug_factor_id_" + post_chemo_counter + "'>@php echo $option_factors; @endphp</select>\
<div id='post_chemo_drug_weight_" + post_chemo_counter + "' style='display: none'>\
<hr>\
<label>Range (Kg)</label>\
<input type='text' name='post_chemo_drug_weight_range[]' class='form-control'>\
</div>\
</div>\
<div class='col-1'>\
<input type='number' name='post_chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_unit_" + post_chemo_counter + "'></span>\
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_factor_unit_" + post_chemo_counter + "'></span>\
</div>\
<div class='col-2'>\
<textarea name='post_chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
</div>\
<div class='col-2'>\
<textarea name='post_chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
</div>\
<div class='col-1'>\
<a href='#post_chemo_row_" + post_chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_post_chemo_dose(" + post_chemo_counter + ")'>Add Dose</a>\
<br><br>\
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"post_chemo_row_delete_" + post_chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
</div>\
</div>\
</div>\
</td>\
</tr>");
generalSelect2Set('post_chemo_drug_id_'+post_chemo_counter);
post_chemo_counter++;
}
function generalSelect2Set(id) {
$('#'+id).select2({
width: "100%"
});
}
function add_pre_chemo_dose(row_id) {
let current_count = $('.pre_chemo_child_delete_' + row_id).length + 1;
$('#pre_chemo_row_' + row_id).append('<div class="row pre_chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="pre_chemo_child_delete_' + row_id + '_' + current_count + '">\
<div class="col-5"><input type="hidden" name="pre_chemo_child_row_id[]" value="' + row_id + '"></div>\
<div class="col-2">\
<div class="pre_chemo_child_drug_weight_' + row_id + '" style="display: none">\
<label>Range (Kg)</label>\
<input type="text" name="pre_chemo_child_drug_weight_range[]" class="form-control">\
</div>\
</div>\
<div class="col-1">\
<input type="number" class="form-control compulsory" required name="pre_chemo_child_drug_dose[]" min="0" step=0.0001>\
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_unit_' + row_id + '"></span>\
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_factor_unit_' + row_id + '"></span>\
</div>\
<div class="col-2">\
<textarea name="pre_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
</div>\
<div class="col-1">\
<textarea name="pre_chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
</div>\
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'pre_chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
check_factor(row_id, "pre_chemo");
}
function add_chemo_dose(row_id) {
let current_count = $('.chemo_child_delete_' + row_id).length + 1;
$('#chemo_row_' + row_id).append('<div class="row chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="chemo_child_delete_' + row_id + '_' + current_count + '">\
<div class="col-5"><input type="hidden" name="chemo_child_row_id[]" value="' + row_id + '"></div>\
<div class="col-2">\
<div class="chemo_child_drug_weight_' + row_id + '" style="display: none">\
<label>Range (Kg)</label>\
<input type="text" name="chemo_child_drug_weight_range[]" class="form-control">\
</div>\
</div>\
<div class="col-1">\
<input type="number" class="form-control compulsory" required name="chemo_child_drug_dose[]" min="0" step=0.0001>\
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_unit_' + row_id + '"></span>\
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_factor_unit_' + row_id + '"></span>\
</div>\
<div class="col-2">\
<textarea name="chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
</div>\
<div class="col-1">\
<textarea name="chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
</div>\
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
check_factor(row_id, "chemo");
}
function add_post_chemo_dose(row_id) {
let current_count = $('.post_chemo_child_delete_' + row_id).length + 1;
$('#post_chemo_row_' + row_id).append('<div class="row post_chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="post_chemo_child_delete_' + row_id + '_' + current_count + '">\
<div class="col-5"><input type="hidden" name="post_chemo_child_row_id[]" value="' + row_id + '"></div>\
<div class="col-2">\
<div class="post_chemo_child_drug_weight_' + row_id + '" style="display: none">\
<label>Range (Kg)</label>\
<input type="text" name="post_chemo_child_drug_weight_range[]" class="form-control">\
</div>\
</div>\
<div class="col-1">\
<input type="number" class="form-control compulsory" required name="post_chemo_child_drug_dose[]" min="0" step=0.0001>\
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_unit_' + row_id + '"></span>\
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_factor_unit_' + row_id + '"></span>\
</div>\
<div class="col-2">\
<textarea name="post_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
</div>\
<div class="col-1">\
<textarea name="post_chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
</div>\
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'post_chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
check_factor(row_id, "post_chemo");
}
function drugs_details (id, drug_id, prefix) {
$.ajax({
url: '/prescriptions/get_drug_details/',
data: {'drug_id':drug_id, 'patient_id':0, 'patient_insurance_status': 0},
success: function(response){
let arr = JSON.parse(response);
$('.' + prefix + '_drug_unit_' + id).text(arr["drug_unit"]);
}
});
}
function check_factor(id, prefix) {
let factor_value = $('#' + prefix + '_drug_factor_id_' + id).val();
if (factor_value == 1) {
$('.' + prefix + '_drug_factor_unit_' + id).html('/m<sup>2</sup>');
$('#' + prefix + '_drug_weight_' + id).hide();
$('.' + prefix + '_child_drug_weight_' + id).hide();
} else if (factor_value == 2) {
$('.' + prefix + '_drug_factor_unit_' + id).text('/Kg');
$('#' + prefix + '_drug_weight_' + id).show();
$('.' + prefix + '_child_drug_weight_' + id).show();
} else {
$('.' + prefix + '_drug_factor_unit_' + id).text('');
$('#' + prefix + '_drug_weight_' + id).hide();
$('.' + prefix + '_child_drug_weight_' + id).hide();
}
}
$('.drugs_id_class').select2({
placeholder: "Select drug"
});
function show(id) {
if (document.getElementById(id).style.display == 'none') {
document.getElementById(id).style.display = '';
}
}
function hide(id) {
document.getElementById(id).style.display = 'none';
}
</script>
@endpush
@@ -0,0 +1,665 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Edit Cancer Protocol</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('cancer_protocol.dashboard') }}</a></li>
<li><a href="{{ route('cancer_protocol.index') }}">{{ __('cancer_protocol.cancer_protocols') }}</a></li>
<li class="active">Edit</li>
</ol>
</div>
</div>
@include('cancer::cancer_protocol.menu')
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
{{ Form::model($cancer_protocol, ['method' => 'PUT', 'route' => ['cancer_protocol.update',$cancer_protocol] , 'data-toggle' => 'validator']) }}
<h3>Protocol Details</h3>
<div class="row">
<div class="col-md-5">
<div class="form-group">
{{ Form::label('name', "Protocol Name") }}
{{ Form::text('name', $cancer_protocol->name, ['class' => 'form-control compulsory', 'required']) }}
</div>
</div>
<div class="col-md-2"></div>
<div class="col-md-5">
<div class="form-group">
{{ Form::label('name', "Protocol Billing Type") }}
<br>
{{ Form::radio('protocol_billing_type', 0, $cancer_protocol->protocol_billing_type == 0, ["required", "onclick" => "show('protocol_cost_div');"]) }}&nbsp; Umbrella Cost &nbsp;&nbsp;
{{ Form::radio('protocol_billing_type', 1, $cancer_protocol->protocol_billing_type == 1, ["required", "onclick" => "hide('protocol_cost_div');"]) }}&nbsp; Bill Per Drug
</div>
<br>
<div class="form-group" id="protocol_cost_div" @if($cancer_protocol->protocol_billing_type == 1) style="display: none" @endif>
{{ Form::label('protocol_cost', "Protocol Cost") }}
{{ Form::number('protocol_cost', $cancer_protocol->protocol_cost, ['class' => 'form-control compulsory', 'min' => 0]) }}
</div>
</div>
</div>
@php
$pre_chemo_drugs = json_decode($cancer_protocol->pre_chemo_drugs, true);
$chemo_drugs = json_decode($cancer_protocol->chemo_drugs, true);
$post_chemo_drugs = json_decode($cancer_protocol->post_chemo_drugs, true);
$pre_chemo_counter = 0;
$chemo_counter = 0;
$post_chemo_counter = 0;
@endphp
<hr>
<h3><label class="label label-warning">PRE-CHEMOTHERAPY</label></h3>
<div class="row">
<div class="col-md-6">
{{ Form::label('pre_chemo_comments', 'Comments') }}
{{ Form::textarea('pre_chemo_comments', $cancer_protocol->pre_chemo_comments, ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
</div>
</div>
<br>
<table class='table color-bordered-table success-bordered-table'>
<thead>
<tr>
<th>
<div class="row">
<div class="col-3">Drug</div>
<div class="col-1">Route</div>
<div class="col-2">Factor</div>
<div class="col-1">Dose</div>
<div class="col-2">Duration(Separate with commas)</div>
<div class="col-2">Instructions</div>
<div class="col-1"></div>
</div>
</th>
</tr>
</thead>
<tbody id="pre_chemo_drugs_div">
@foreach($pre_chemo_drugs as $pre_chemo_drug)
<tr id='pre_chemo_row_delete_{{ $pre_chemo_counter }}'>
<td>
<div id="pre_chemo_row_{{ $pre_chemo_counter }}">
{{ Form::hidden('pre_chemo_row_counter[]', $pre_chemo_counter) }}
<div class="row">
<div class="col-3">
{{ Form::select('pre_chemo_drug_id[]', $drugs, $pre_chemo_drug["drug_id"], ['class' => 'form-control compulsory drugs_id_class', 'id' => 'pre_chemo_drug_id_' . $pre_chemo_counter, 'onchange' => 'drugs_details(' . $pre_chemo_counter . ', this.value, \'pre_chemo\')', 'required']) }}
</div>
<div class="col-1">
{{ Form::select('pre_chemo_drug_route[]', $drug_routes, $pre_chemo_drug["drug_route"], ['class' => 'form-control compulsory', 'required']) }}
</div>
<div class="col-2">
{{ Form::select('pre_chemo_drug_factor_id[]', $factors, $pre_chemo_drug["drug_factor"], ['class' => 'form-control compulsory', 'onchange' => 'check_factor(' . $pre_chemo_counter . ', \'pre_chemo\')', 'required', 'id' => 'pre_chemo_drug_factor_id_' . $pre_chemo_counter]) }}
<div id="pre_chemo_drug_weight_{{ $pre_chemo_counter }}" @if($pre_chemo_drug["drug_factor"] != 2) style="display: none" @endif>
<hr>
{{ Form::label('pre_chemo_drug_weight_range', 'Range (Kg)') }}
{{ Form::text('pre_chemo_drug_weight_range[]', $pre_chemo_drug["dose"][0]["weight_range"], ['class' => 'form-control']) }}
</div>
</div>
<div class="col-1">
{{ Form::number('pre_chemo_drug_dose[]', $pre_chemo_drug["dose"][0]["dose"], ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_unit_{{ $pre_chemo_counter }}'></span>
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_factor_unit_{{ $pre_chemo_counter }}'></span>
</div>
<div class="col-2">
{{ Form::textarea('pre_chemo_drug_duration[]', $pre_chemo_drug["dose"][0]["duration"], ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
</div>
<div class="col-2">
{{ Form::textarea('pre_chemo_drug_instructions[]', $pre_chemo_drug["dose"][0]["instructions"], ['class' => 'form-control', 'rows' => '3']) }}
</div>
<div class="col-1">
<a href="#pre_chemo_row_{{ $pre_chemo_counter }}" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_pre_chemo_dose({{ $pre_chemo_counter }})">Add Dose</a>
@if($pre_chemo_counter != 0)
<br><br>
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field("pre_chemo_row_delete_{{ $pre_chemo_counter }}")'><i class='fa fa-trash'></i></button>
@endif
</div>
</div>
@for($x=1; $x < count($pre_chemo_drug["dose"]); $x++)
<div class="row pre_chemo_child_delete_{{ $pre_chemo_counter }}" style="margin-top: 10px" id="pre_chemo_child_delete_{{ $pre_chemo_counter }}_{{ $x }}">
<div class="col-5"><input type="hidden" name="pre_chemo_child_row_id[]" value="{{ $pre_chemo_counter }}"></div>
<div class="col-2">
<div class="pre_chemo_child_drug_weight_{{ $pre_chemo_counter }}" @if($pre_chemo_drug["drug_factor"] != 2) style="display: none" @endif>
<label>Range (Kg)</label>
<input type="text" name="pre_chemo_child_drug_weight_range[]" class="form-control" value="{{ $pre_chemo_drug["dose"][$x]["weight_range"] }}">
</div>
</div>
<div class="col-1">
<input type="number" class="form-control compulsory" required name="pre_chemo_child_drug_dose[]" min="0" value="{{ $pre_chemo_drug["dose"][$x]["dose"] }}" step='0.0001'>
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_unit_{{ $pre_chemo_counter }}"></span>
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_factor_unit_{{ $pre_chemo_counter }}"></span>
</div>
<div class="col-2">
<textarea name="pre_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3">{{ $pre_chemo_drug["dose"][$x]["duration"] }}</textarea>
</div>
<div class="col-1">
<textarea name="pre_chemo_child_drug_instructions[]" class="form-control" rows="3">{{ $pre_chemo_drug["dose"][$x]["instructions"] }}</textarea>
</div>
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field('pre_chemo_child_delete_{{ $pre_chemo_counter }}_{{ $x }}')"><i class="fa fa-trash"></i></button></div></div>
@endfor
</div>
</td>
</tr>
@php $pre_chemo_counter++; @endphp
@endforeach
</tbody>
</table>
<a class="btn btn-success btn-rounded btn-sm" onclick="add_pre_chemo_drug()">Add Drug</a>
<hr>
<h3><label class="label label-warning">CHEMOTHERAPY</label></h3>
<div class="row">
<div class="col-md-6">
{{ Form::label('chemo_comments', 'Comments') }}
{{ Form::textarea('chemo_comments', $cancer_protocol->chemo_comments, ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
</div>
</div>
<br>
<table class='table color-bordered-table success-bordered-table'>
<thead>
<tr>
<th>
<div class="row">
<div class="col-3">Drug</div>
<div class="col-1">Route</div>
<div class="col-2">Factor</div>
<div class="col-1">Dose</div>
<div class="col-2">Duration(Separate with commas)</div>
<div class="col-2">Instructions</div>
<div class="col-1"></div>
</div>
</th>
</tr>
</thead>
<tbody id="chemo_drugs_div">
@foreach($chemo_drugs as $chemo_drug)
<tr id='chemo_row_delete_{{ $chemo_counter }}'>
<td>
<div id="chemo_row_{{ $chemo_counter }}">
{{ Form::hidden('chemo_row_counter[]', $chemo_counter) }}
<div class="row">
<div class="col-3">
{{ Form::select('chemo_drug_id[]', $drugs, $chemo_drug["drug_id"], ['class' => 'form-control compulsory drugs_id_class', 'id' => 'chemo_drug_id_' . $chemo_counter, 'onchange' => 'drugs_details(' . $chemo_counter . ', this.value, \'chemo\')', 'required']) }}
</div>
<div class="col-1">
{{ Form::select('chemo_drug_route[]', $drug_routes, $chemo_drug["drug_route"], ['class' => 'form-control compulsory', 'required']) }}
</div>
<div class="col-2">
{{ Form::select('chemo_drug_factor_id[]', $factors, $chemo_drug["drug_factor"], ['class' => 'form-control compulsory', 'onchange' => 'check_factor(' . $chemo_counter . ', \'chemo\')', 'required', 'id' => 'chemo_drug_factor_id_' . $chemo_counter]) }}
<div id="chemo_drug_weight_{{ $chemo_counter }}" @if($chemo_drug["drug_factor"] != 2) style="display: none" @endif>
<hr>
{{ Form::label('chemo_drug_weight_range', 'Range (Kg)') }}
{{ Form::text('chemo_drug_weight_range[]', $chemo_drug["dose"][0]["weight_range"], ['class' => 'form-control']) }}
</div>
</div>
<div class="col-1">
{{ Form::number('chemo_drug_dose[]', $chemo_drug["dose"][0]["dose"], ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_unit_{{ $chemo_counter }}'></span>
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_factor_unit_{{ $chemo_counter }}'></span>
</div>
<div class="col-2">
{{ Form::textarea('chemo_drug_duration[]', $chemo_drug["dose"][0]["duration"], ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
</div>
<div class="col-2">
{{ Form::textarea('chemo_drug_instructions[]', $chemo_drug["dose"][0]["instructions"], ['class' => 'form-control', 'rows' => '3']) }}
</div>
<div class="col-1">
<a href="#chemo_row_{{ $chemo_counter }}" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_chemo_dose({{ $chemo_counter }})">Add Dose</a>
@if($chemo_counter != 0)
<br><br>
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field("chemo_row_delete_{{ $chemo_counter }}")'><i class='fa fa-trash'></i></button>
@endif
</div>
</div>
@for($x=1; $x < count($chemo_drug["dose"]); $x++)
<div class="row chemo_child_delete_{{ $chemo_counter }}" style="margin-top: 10px" id="chemo_child_delete_{{ $chemo_counter }}_{{ $x }}">
<div class="col-5"><input type="hidden" name="chemo_child_row_id[]" value="{{ $chemo_counter }}"></div>
<div class="col-2">
<div class="chemo_child_drug_weight_{{ $chemo_counter }}" @if($chemo_drug["drug_factor"] != 2) style="display: none" @endif>
<label>Range (Kg)</label>
<input type="text" name="chemo_child_drug_weight_range[]" class="form-control" value="{{ $chemo_drug["dose"][$x]["weight_range"] }}">
</div>
</div>
<div class="col-1">
<input type="number" class="form-control compulsory" required name="chemo_child_drug_dose[]" min="0" value="{{ $chemo_drug["dose"][$x]["dose"] }}" step='0.0001'>
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_unit_{{ $chemo_counter }}"></span>
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_factor_unit_{{ $chemo_counter }}"></span>
</div>
<div class="col-2">
<textarea name="chemo_child_drug_duration[]" class="form-control compulsory" required rows="3">{{ $chemo_drug["dose"][$x]["duration"] }}</textarea>
</div>
<div class="col-1">
<textarea name="chemo_child_drug_instructions[]" class="form-control" rows="3">{{ $chemo_drug["dose"][$x]["instructions"] }}</textarea>
</div>
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field('chemo_child_delete_{{ $chemo_counter }}_{{ $x }}')"><i class="fa fa-trash"></i></button></div></div>
@endfor
</div>
</td>
</tr>
@php $chemo_counter++; @endphp
@endforeach
</tbody>
</table>
<a class="btn btn-success btn-rounded btn-sm" onclick="add_chemo_drug()">Add Drug</a>
<hr>
<h3><label class="label label-warning">POST-CHEMOTHERAPY</label></h3>
<div class="row">
<div class="col-md-6">
{{ Form::label('post_chemo_comments', 'Comments') }}
{{ Form::textarea('post_chemo_comments', $cancer_protocol->post_chemo_comments, ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
</div>
</div>
<br>
<table class='table color-bordered-table success-bordered-table'>
<thead>
<tr>
<th>
<div class="row">
<div class="col-3">Drug</div>
<div class="col-1">Route</div>
<div class="col-2">Factor</div>
<div class="col-1">Dose</div>
<div class="col-2">Duration(Separate with commas)</div>
<div class="col-2">Instructions</div>
<div class="col-1"></div>
</div>
</th>
</tr>
</thead>
<tbody id="post_chemo_drugs_div">
@foreach($post_chemo_drugs as $post_chemo_drug)
<tr id='post_chemo_row_delete_{{ $post_chemo_counter }}'>
<td>
<div id="post_chemo_row_{{ $post_chemo_counter }}">
{{ Form::hidden('post_chemo_row_counter[]', $post_chemo_counter) }}
<div class="row">
<div class="col-3">
{{ Form::select('post_chemo_drug_id[]', $drugs, $post_chemo_drug["drug_id"], ['class' => 'form-control compulsory drugs_id_class', 'id' => 'post_chemo_drug_id_' . $post_chemo_counter, 'onchange' => 'drugs_details(' . $post_chemo_counter . ', this.value, \'post_chemo\')', 'required']) }}
</div>
<div class="col-1">
{{ Form::select('post_chemo_drug_route[]', $drug_routes, $post_chemo_drug["drug_route"], ['class' => 'form-control compulsory', 'required']) }}
</div>
<div class="col-2">
{{ Form::select('post_chemo_drug_factor_id[]', $factors, $post_chemo_drug["drug_factor"], ['class' => 'form-control compulsory', 'onchange' => 'check_factor(' . $post_chemo_counter . ', \'post_chemo\')', 'required', 'id' => 'post_chemo_drug_factor_id_' . $post_chemo_counter]) }}
<div id="post_chemo_drug_weight_{{ $post_chemo_counter }}" @if($post_chemo_drug["drug_factor"] != 2) style="display: none" @endif>
<hr>
{{ Form::label('post_chemo_drug_weight_range', 'Range (Kg)') }}
{{ Form::text('post_chemo_drug_weight_range[]', $post_chemo_drug["dose"][0]["weight_range"], ['class' => 'form-control']) }}
</div>
</div>
<div class="col-1">
{{ Form::number('post_chemo_drug_dose[]', $post_chemo_drug["dose"][0]["dose"], ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_unit_{{ $post_chemo_counter }}'></span>
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_factor_unit_{{ $post_chemo_counter }}'></span>
</div>
<div class="col-2">
{{ Form::textarea('post_chemo_drug_duration[]', $post_chemo_drug["dose"][0]["duration"], ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
</div>
<div class="col-2">
{{ Form::textarea('post_chemo_drug_instructions[]', $post_chemo_drug["dose"][0]["instructions"], ['class' => 'form-control', 'rows' => '3']) }}
</div>
<div class="col-1">
<a href="#post_chemo_row_{{ $post_chemo_counter }}" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_post_chemo_dose({{ $post_chemo_counter }})">Add Dose</a>
@if($post_chemo_counter != 0)
<br><br>
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field("post_chemo_row_delete_{{ $post_chemo_counter }}")'><i class='fa fa-trash'></i></button>
@endif
</div>
</div>
@for($x=1; $x < count($post_chemo_drug["dose"]); $x++)
<div class="row post_chemo_child_delete_{{ $post_chemo_counter }}" style="margin-top: 10px" id="post_chemo_child_delete_{{ $post_chemo_counter }}_{{ $x }}">
<div class="col-5"><input type="hidden" name="post_chemo_child_row_id[]" value="{{ $post_chemo_counter }}"></div>
<div class="col-2">
<div class="post_chemo_child_drug_weight_{{ $post_chemo_counter }}" @if($pre_chemo_drug["drug_factor"] != 2) style="display: none" @endif>
<label>Range (Kg)</label>
<input type="text" name="post_chemo_child_drug_weight_range[]" class="form-control" value="{{ $post_chemo_drug["dose"][$x]["weight_range"] }}">
</div>
</div>
<div class="col-1">
<input type="number" class="form-control compulsory" required name="post_chemo_child_drug_dose[]" min="0" value="{{ $post_chemo_drug["dose"][$x]["dose"] }}" step='0.0001'>
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_unit_{{ $post_chemo_counter }}"></span>
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_factor_unit_{{ $post_chemo_counter }}"></span>
</div>
<div class="col-2">
<textarea name="post_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3">{{ $post_chemo_drug["dose"][$x]["duration"] }}</textarea>
</div>
<div class="col-1">
<textarea name="post_chemo_child_drug_instructions[]" class="form-control" rows="3">{{ $post_chemo_drug["dose"][$x]["instructions"] }}</textarea>
</div>
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field('post_chemo_child_delete_{{ $post_chemo_counter }}_{{ $x }}')"><i class="fa fa-trash"></i></button></div></div>
@endfor
</div>
</td>
</tr>
@php $post_chemo_counter++; @endphp
@endforeach
</tbody>
</table>
<a class="btn btn-success btn-rounded btn-sm" onclick="add_post_chemo_drug()">Add Drug</a>
<hr>
{{ Form::button(__('cancer_protocol.submit'),['type'=>'submit','class'=>'btn btn-success btn-rounded waves-effect waves-light m-r-10']) }}
{{ Form::button(__('cancer_protocol.cancel'),['type'=>'reset','class'=>'btn btn-default btn-rounded waves-effect waves-light']) }}
{{ Form::close() }}
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
let pre_chemo_counter = {{ $pre_chemo_counter }};
let chemo_counter = {{ $chemo_counter }};
let post_chemo_counter = {{ $post_chemo_counter }};
function remove_field(id) {
$('#' + id).remove();
}
function add_pre_chemo_drug() {
$('#pre_chemo_drugs_div').append("<tr id='pre_chemo_row_delete_" + pre_chemo_counter + "'>\
<td>\
<div id='pre_chemo_row_" + pre_chemo_counter + "'>\
<input type='hidden' name='pre_chemo_row_counter[]' value='" + pre_chemo_counter + "'>\
<div class='row'>\
<div class='col-3'>\
<select name='pre_chemo_drug_id[]' id='pre_chemo_drug_id_" + pre_chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + pre_chemo_counter + ", this.value, \"pre_chemo\")'>@php echo $option_drugs; @endphp</select>\
</div>\
<div class='col-1'>\
<select name='pre_chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
</div>\
<div class='col-2'>\
<select name='pre_chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + pre_chemo_counter + ", \"pre_chemo\")' id='pre_chemo_drug_factor_id_" + pre_chemo_counter + "'>@php echo $option_factors; @endphp</select>\
<div id='pre_chemo_drug_weight_" + pre_chemo_counter + "' style='display: none'>\
<hr>\
<label>Range (Kg)</label>\
<input type='text' name='pre_chemo_drug_weight_range[]' class='form-control'>\
</div>\
</div>\
<div class='col-1'>\
<input type='number' name='pre_chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_unit_" + pre_chemo_counter + "'></span>\
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_factor_unit_" + pre_chemo_counter + "'></span>\
</div>\
<div class='col-2'>\
<textarea name='pre_chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
</div>\
<div class='col-2'>\
<textarea name='pre_chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
</div>\
<div class='col-1'>\
<a href='#pre_chemo_row_" + pre_chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_pre_chemo_dose(" + pre_chemo_counter + ")'>Add Dose</a>\
<br><br>\
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"pre_chemo_row_delete_" + pre_chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
</div>\
</div>\
</div>\
</td>\
</tr>");
generalSelect2Set('pre_chemo_drug_id_'+pre_chemo_counter);
pre_chemo_counter++;
}
function add_chemo_drug() {
$('#chemo_drugs_div').append("<tr id='chemo_row_delete_" + chemo_counter + "'>\
<td>\
<div id='chemo_row_" + chemo_counter + "'>\
<input type='hidden' name='chemo_row_counter[]' value='" + chemo_counter + "'>\
<div class='row'>\
<div class='col-3'>\
<select name='chemo_drug_id[]' id='chemo_drug_id_" + chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + chemo_counter + ", this.value, \"chemo\")'>@php echo $option_drugs; @endphp</select>\
</div>\
<div class='col-1'>\
<select name='chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
</div>\
<div class='col-2'>\
<select name='chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + chemo_counter + ", \"chemo\")' id='chemo_drug_factor_id_" + chemo_counter + "'>@php echo $option_factors; @endphp</select>\
<div id='chemo_drug_weight_" + chemo_counter + "' style='display: none'>\
<hr>\
<label>Range (Kg)</label>\
<input type='text' name='chemo_drug_weight_range[]' class='form-control'>\
</div>\
</div>\
<div class='col-1'>\
<input type='number' name='chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_unit_" + chemo_counter + "'></span>\
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_factor_unit_" + chemo_counter + "'></span>\
</div>\
<div class='col-2'>\
<textarea name='chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
</div>\
<div class='col-2'>\
<textarea name='chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
</div>\
<div class='col-1'>\
<a href='#chemo_row_" + chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_chemo_dose(" + chemo_counter + ")'>Add Dose</a>\
<br><br>\
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"chemo_row_delete_" + chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
</div>\
</div>\
</div>\
</td>\
</tr>");
generalSelect2Set('chemo_drug_id_'+chemo_counter);
chemo_counter++;
}
function add_post_chemo_drug() {
$('#post_chemo_drugs_div').append("<tr id='post_chemo_row_delete_" + post_chemo_counter + "'>\
<td>\
<div id='post_chemo_row_" + post_chemo_counter + "'>\
<input type='hidden' name='post_chemo_row_counter[]' value='" + post_chemo_counter + "'>\
<div class='row'>\
<div class='col-3'>\
<select name='post_chemo_drug_id[]' id='post_chemo_drug_id_" + post_chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + post_chemo_counter + ", this.value, \"post_chemo\")'>@php echo $option_drugs; @endphp</select>\
</div>\
<div class='col-1'>\
<select name='post_chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
</div>\
<div class='col-2'>\
<select name='post_chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + post_chemo_counter + ", \"post_chemo\")' id='post_chemo_drug_factor_id_" + post_chemo_counter + "'>@php echo $option_factors; @endphp</select>\
<div id='post_chemo_drug_weight_" + post_chemo_counter + "' style='display: none'>\
<hr>\
<label>Range (Kg)</label>\
<input type='text' name='post_chemo_drug_weight_range[]' class='form-control'>\
</div>\
</div>\
<div class='col-1'>\
<input type='number' name='post_chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_unit_" + post_chemo_counter + "'></span>\
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_factor_unit_" + post_chemo_counter + "'></span>\
</div>\
<div class='col-2'>\
<textarea name='post_chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
</div>\
<div class='col-2'>\
<textarea name='post_chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
</div>\
<div class='col-1'>\
<a href='#post_chemo_row_" + post_chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_post_chemo_dose(" + post_chemo_counter + ")'>Add Dose</a>\
<br><br>\
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"post_chemo_row_delete_" + post_chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
</div>\
</div>\
</div>\
</td>\
</tr>");
generalSelect2Set('post_chemo_drug_id_'+post_chemo_counter);
post_chemo_counter++;
}
function generalSelect2Set(id) {
$('#'+id).select2({
width: "100%"
});
}
function add_pre_chemo_dose(row_id) {
let current_count = $('.pre_chemo_child_delete_' + row_id).length + 1;
$('#pre_chemo_row_' + row_id).append('<div class="row pre_chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="pre_chemo_child_delete_' + row_id + '_' + current_count + '">\
<div class="col-5"><input type="hidden" name="pre_chemo_child_row_id[]" value="' + row_id + '"></div>\
<div class="col-2">\
<div class="pre_chemo_child_drug_weight_' + row_id + '" style="display: none">\
<label>Range (Kg)</label>\
<input type="text" name="pre_chemo_child_drug_weight_range[]" class="form-control">\
</div>\
</div>\
<div class="col-1">\
<input type="number" class="form-control compulsory" required name="pre_chemo_child_drug_dose[]" min="0" step=0.0001>\
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_unit_' + row_id + '"></span>\
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_factor_unit_' + row_id + '"></span>\
</div>\
<div class="col-2">\
<textarea name="pre_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
</div>\
<div class="col-1">\
<textarea name="pre_chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
</div>\
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'pre_chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
check_factor(row_id, "pre_chemo");
}
function add_chemo_dose(row_id) {
let current_count = $('.chemo_child_delete_' + row_id).length + 1;
$('#chemo_row_' + row_id).append('<div class="row chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="chemo_child_delete_' + row_id + '_' + current_count + '">\
<div class="col-5"><input type="hidden" name="chemo_child_row_id[]" value="' + row_id + '"></div>\
<div class="col-2">\
<div class="chemo_child_drug_weight_' + row_id + '" style="display: none">\
<label>Range (Kg)</label>\
<input type="text" name="chemo_child_drug_weight_range[]" class="form-control">\
</div>\
</div>\
<div class="col-1">\
<input type="number" class="form-control compulsory" required name="chemo_child_drug_dose[]" min="0" step=0.0001>\
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_unit_' + row_id + '"></span>\
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_factor_unit_' + row_id + '"></span>\
</div>\
<div class="col-2">\
<textarea name="chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
</div>\
<div class="col-1">\
<textarea name="chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
</div>\
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
check_factor(row_id, "chemo");
}
function add_post_chemo_dose(row_id) {
let current_count = $('.post_chemo_child_delete_' + row_id).length + 1;
$('#post_chemo_row_' + row_id).append('<div class="row post_chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="post_chemo_child_delete_' + row_id + '_' + current_count + '">\
<div class="col-5"><input type="hidden" name="post_chemo_child_row_id[]" value="' + row_id + '"></div>\
<div class="col-2">\
<div class="post_chemo_child_drug_weight_' + row_id + '" style="display: none">\
<label>Range (Kg)</label>\
<input type="text" name="post_chemo_child_drug_weight_range[]" class="form-control">\
</div>\
</div>\
<div class="col-1">\
<input type="number" class="form-control compulsory" required name="post_chemo_child_drug_dose[]" min="0" step=0.0001>\
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_unit_' + row_id + '"></span>\
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_factor_unit_' + row_id + '"></span>\
</div>\
<div class="col-2">\
<textarea name="post_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
</div>\
<div class="col-1">\
<textarea name="post_chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
</div>\
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'post_chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
check_factor(row_id, "post_chemo");
}
function drugs_details (id, drug_id, prefix) {
$.ajax({
url: '/prescriptions/get_drug_details/',
data: {'drug_id':drug_id, 'patient_id':0, 'patient_insurance_status': 0},
success: function(response){
let arr = JSON.parse(response);
$('.' + prefix + '_drug_unit_' + id).text(arr["drug_unit"]);
}
});
}
function check_factor(id, prefix) {
let factor_value = $('#' + prefix + '_drug_factor_id_' + id).val();
if (factor_value == 1) {
$('.' + prefix + '_drug_factor_unit_' + id).html('/m<sup>2</sup>');
$('#' + prefix + '_drug_weight_' + id).hide();
$('.' + prefix + '_child_drug_weight_' + id).hide();
} else if (factor_value == 2) {
$('.' + prefix + '_drug_factor_unit_' + id).text('/Kg');
$('#' + prefix + '_drug_weight_' + id).show();
$('.' + prefix + '_child_drug_weight_' + id).show();
} else {
$('.' + prefix + '_drug_factor_unit_' + id).text('');
$('#' + prefix + '_drug_weight_' + id).hide();
$('.' + prefix + '_child_drug_weight_' + id).hide();
}
}
$('.drugs_id_class').select2({
placeholder: "Select drug"
});
function show(id) {
if (document.getElementById(id).style.display == 'none') {
document.getElementById(id).style.display = '';
}
}
function hide(id) {
document.getElementById(id).style.display = 'none';
}
</script>
@endpush
@@ -0,0 +1,84 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Inactive Protocols</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('insurance_groups.dashboard') }}</a></li>
<li class="active">Inactive Protocols</li>
</ol>
</div>
</div>
@include('cancer::cancer_protocol.menu')
<div class="white-box">
@include('flash::message')
<div class="table-responsive">
<table id="table" class="table table-striped color-bordered-table success-bordered-table table-hover table-bordered">
<thead>
<tr>
<th>Protocol</th>
<th>Billing Type</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($cancer_protocols as $cancer_protocol)
<tr>
<td>{{ $cancer_protocol->name }}</td>
<td>
@if($cancer_protocol->protocol_billing_type == 0)
Total Cost of {{ ugandan_shillings($cancer_protocol->protocol_cost) }}
@else
Billing Per Drug
@endif
</td>
<td>
{{ Form::model($cancer_protocol->id ,['method' => 'POST', 'route' => ['cancer_protocol.activate', $cancer_protocol->id]]) }}
<button type="submit" class="btn btn-warning" onclick="return confirm('<?php echo __('age_groups.are_you_sure'); ?>')"><i class="fa fa-check"></i> {{ __('age_groups.activate') }}</button>
{{ Form::close() }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('#table').DataTable({
dom: 'Bfrtip',
bInfo: false,
bPaginate: false,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -0,0 +1,227 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Cancer Protocols</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('insurance_groups.dashboard') }}</a></li>
<li class="active">Cancer Protocols</li>
</ol>
</div>
</div>
@include('cancer::cancer_protocol.menu')
<div class="white-box">
<a href="/cancer_protocol/print_all_protocols" target="_blank" class="btn btn-success">Print Protocols</a>
@include('flash::message')
<div class="table-responsive">
<table id="table" class="table table-striped color-bordered-table success-bordered-table table-hover table-bordered">
<thead>
<tr>
<th>Protocol</th>
<th>Section</th>
<th>Section Comment</th>
<th>Drugs</th>
<th>Route</th>
<th>Factor</th>
<th>Dose</th>
<th>Duration</th>
<th>Instructions</th>
</tr>
</thead>
<tbody>
@foreach($cancer_protocols as $cancer_protocol)
@php
$pre_chemo_drugs = json_decode($cancer_protocol->pre_chemo_drugs, true);
$chemo_drugs = json_decode($cancer_protocol->chemo_drugs, true);
$post_chemo_drugs = json_decode($cancer_protocol->post_chemo_drugs, true);
$pre_chemo_drugs_count = count($pre_chemo_drugs);
$chemo_drugs_count = count($chemo_drugs);
$post_chemo_drugs_count = count($post_chemo_drugs);
$pre_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $pre_chemo_drugs));
$chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $chemo_drugs));
$post_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $post_chemo_drugs));
@endphp
<tr>
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + $chemo_drugs_count + $chemo_doses_count + $post_chemo_drugs_count + $post_chemo_doses_count + 4 }}">
<h3>{{ $cancer_protocol->name }}</h3>
<br>
@if($cancer_protocol->protocol_billing_type == 0)
Total Cost of {{ ugandan_shillings($cancer_protocol->protocol_cost) }}
@else
Billing Per Drug
@endif
<hr>
<a href="/cancer_protocol/{{ $cancer_protocol->id }}/edit/" class="btn btn-warning btn-rounded">Edit</a>
<br><br>
{{ Form::model($cancer_protocol->id ,['method' => 'DELETE', 'route' => ['cancer_protocol.destroy', $cancer_protocol->id]]) }}
<button type="submit" class="btn btn-danger btn-rounded" onclick="return confirm('<?php echo __('wards.are_you_sure');?>')"><i class="fa fa-trash"></i> {{ __('wards.delete') }}</button>
{{ Form::close() }}
</td>
</tr>
<tr>
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">Pre-Chemo</td>
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">{{ $cancer_protocol->pre_chemo_comments }}</td>
</tr>
@for($x = 0; $x < $pre_chemo_drugs_count; $x++)
<tr>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$pre_chemo_drugs[$x]['drug_id']] ?? '' }}</td>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$pre_chemo_drugs[$x]['drug_route']] ?? '' }}</td>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$pre_chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
</tr>
@php
$drug_dosage = $drug_units[$drug_with_units[$pre_chemo_drugs[$x]['drug_id']]];
if ($pre_chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($pre_chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
@for($i = 0; $i < count($pre_chemo_drugs[$x]['dose']); $i++)
<tr>
<td>
{{ $pre_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($pre_chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $pre_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
</tr>
@endfor
@endfor
<tr>
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">Chemo</td>
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">{{ $cancer_protocol->chemo_comments }}</td>
</tr>
@for($x = 0; $x < $chemo_drugs_count; $x++)
<tr>
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$chemo_drugs[$x]['drug_id']] ?? '' }}</td>
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$chemo_drugs[$x]['drug_route']] ?? '' }}</td>
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
</tr>
@php
$drug_dosage = $drug_units[$drug_with_units[$chemo_drugs[$x]['drug_id']]];
if ($chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
@for($i = 0; $i < count($chemo_drugs[$x]['dose']); $i++)
<tr>
<td>
{{ $chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
<td>{{ $chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
<td>{{ $chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
</tr>
@endfor
@endfor
<tr>
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">Post-Chemo</td>
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">{{ $cancer_protocol->post_chemo_comments }}</td>
</tr>
@for($x = 0; $x < $post_chemo_drugs_count; $x++)
<tr>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$post_chemo_drugs[$x]['drug_id']] ?? '' }}</td>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$post_chemo_drugs[$x]['drug_route']] ?? '' }}</td>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$post_chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
</tr>
@php
$drug_dosage = $drug_units[$drug_with_units[$post_chemo_drugs[$x]['drug_id']]];
if ($post_chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($post_chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
@for($i = 0; $i < count($post_chemo_drugs[$x]['dose']); $i++)
<tr>
<td>
{{ $post_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($post_chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $post_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
</tr>
@endfor
@endfor
@endforeach
</tbody>
</table>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('#table').DataTable({
dom: 'Bfrtip',
bInfo: false,
bPaginate: false,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -0,0 +1,5 @@
<div class="white-box">
@if(Auth::user()->can('cancer-protocol-create'))<a href="/cancer_protocol/create" class="nav-item btn btn-success" style="border-radius: 5px;"><i class="fa fa-plus"></i> <span style="margin-left: 10px">{{ __('cancer_protocol.add_cancer_protocol') }}</span></a>@endif
@if(Auth::user()->can('cancer-protocol-list'))<a href="/cancer_protocol/" class="nav-item btn btn-info" style="border-radius: 5px;"><i class="fa fa-eye"></i> <span style="margin-left: 10px">{{ __('cancer_protocol.view_cancer_protocols') }}</span></a>@endif
@if(Auth::user()->can('cancer-protocol-delete'))<a href="/cancer_protocol/inactive" class="nav-item btn btn-danger" style="border-radius: 5px;"><i class="fa fa-trash"></i> <span style="margin-left: 10px">{{ __('cancer_protocol.inactive_cancer_protocols') }}</span></a>@endif
</div>
@@ -0,0 +1,272 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Prescribe Protocol</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('insurance_groups.dashboard') }}</a></li>
<li class="active">Prescribe Protocol</li>
</ol>
</div>
</div>
@include('patients::allergies.header')
<div class="white-box">
@include('flash::message')
{{ Form::open(['route' => 'cancer_protocol.order_protocol' , 'data-toggle' => 'validator']) }}
{{ Form::label('cancer_protocols', 'Choose cancer protocols') }}
<div class="form-group">
{{ Form::select('cancer_protocols[]', $cancer_protocols, '',['id'=>'cancer_protocols', 'multiple', 'class' => 'form-control', 'required']) }}
</div>
{{ Form::button(__('cancer_protocol.submit'),['type'=>'submit','class'=>'btn btn-success btn-rounded waves-effect waves-light m-r-10']) }}
{{ Form::close() }}
<hr>
@php $count = 1; @endphp
@if(count($selected_protocols) > 0)
{{ Form::open(['route' => 'cancer_protocol.save_protocol_order' , 'data-toggle' => 'validator']) }}
{{ Form::hidden('patient_id', $patient_id) }}
{{ Form::hidden('episode_id', $episode_id) }}
{{ Form::hidden('inpatient_info_id', $inpatient_info_id) }}
<table id="table" class="table table-striped color-bordered-table success-bordered-table table-hover table-bordered">
<thead>
<tr>
<th>Protocol</th>
<th>Section</th>
<th>Section Comment</th>
<th>Drugs</th>
<th>Route</th>
<th>Factor</th>
<th>Dose</th>
<th width="8%">Adjusted Dose</th>
<th>Duration</th>
<th>Instructions</th>
</tr>
</thead>
<tbody>
@foreach($selected_protocols as $cancer_protocol)
@php
$pre_chemo_drugs = json_decode($cancer_protocol->pre_chemo_drugs, true);
$chemo_drugs = json_decode($cancer_protocol->chemo_drugs, true);
$post_chemo_drugs = json_decode($cancer_protocol->post_chemo_drugs, true);
$pre_chemo_drugs_count = count($pre_chemo_drugs);
$chemo_drugs_count = count($chemo_drugs);
$post_chemo_drugs_count = count($post_chemo_drugs);
$pre_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $pre_chemo_drugs));
$chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $chemo_drugs));
$post_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $post_chemo_drugs));
@endphp
<tr class="protocol_row_{{ $count }}">
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + $chemo_drugs_count + $chemo_doses_count + $post_chemo_drugs_count + $post_chemo_doses_count + 4 }}">
<h3>{{ $cancer_protocol->name }}</h3>
{{ Form::hidden('protocol_id[]', $cancer_protocol->id) }}
<br>
@if($cancer_protocol->protocol_billing_type == 0)
Total Cost of {{ ugandan_shillings($cancer_protocol->protocol_cost) }}
@else
Billing Per Drug
@endif
<hr>
<a class="btn btn-danger btn-rounded" onclick="remove_protocol({{ $count }})">Remove</a>
</td>
</tr>
<tr class="protocol_row_{{ $count }}">
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">Pre-Chemo</td>
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">{{ $cancer_protocol->pre_chemo_comments }}</td>
</tr>
@for($x = 0; $x < $pre_chemo_drugs_count; $x++)
<tr class="protocol_row_{{ $count }}">
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">
{{ $drugs[$pre_chemo_drugs[$x]['drug_id']] ?? '' }}
</td>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">
{{ $drug_routes[$pre_chemo_drugs[$x]['drug_route']] ?? '' }}
</td>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">
{{ $factors[$pre_chemo_drugs[$x]['drug_factor']] ?? '' }}
</td>
</tr>
@php
$drug_dosage = $drug_units[$drug_with_units[$pre_chemo_drugs[$x]['drug_id']]];
if ($pre_chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($pre_chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
@for($i = 0; $i < count($pre_chemo_drugs[$x]['dose']); $i++)
<tr class="protocol_row_{{ $count }}">
<td>
{{ $pre_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($pre_chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $pre_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
<td>
{{ Form::number('adjusted_dose[]', '', ['class' => 'form-control', 'step' => '0.0001']) }}
<br><br>
{{ Form::label('adjusted_dose_reason', 'Reason') }}
{{ Form::textarea('adjusted_dose_reason[]', '', ['class' => 'form-control', 'rows' => 2]) }}
</td>
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
</tr>
@endfor
@endfor
<tr class="protocol_row_{{ $count }}">
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">Chemo</td>
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">{{ $cancer_protocol->chemo_comments }}</td>
</tr>
@for($x = 0; $x < $chemo_drugs_count; $x++)
<tr class="protocol_row_{{ $count }}">
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$chemo_drugs[$x]['drug_id']] ?? '' }}</td>
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$chemo_drugs[$x]['drug_route']] ?? '' }}</td>
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
</tr>
@php
$drug_dosage = $drug_units[$drug_with_units[$chemo_drugs[$x]['drug_id']]];
if ($chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
@for($i = 0; $i < count($chemo_drugs[$x]['dose']); $i++)
<tr class="protocol_row_{{ $count }}">
<td>
{{ $chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
<td>
{{ Form::number('adjusted_dose[]', '', ['class' => 'form-control', 'step' => '0.0001']) }}
<br><br>
{{ Form::label('adjusted_dose_reason', 'Reason') }}
{{ Form::textarea('adjusted_dose_reason[]', '', ['class' => 'form-control', 'rows' => 2]) }}
</td>
<td>{{ $chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
<td>{{ $chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
</tr>
@endfor
@endfor
<tr class="protocol_row_{{ $count }}">
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">Post-Chemo</td>
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">{{ $cancer_protocol->post_chemo_comments }}</td>
</tr>
@for($x = 0; $x < $post_chemo_drugs_count; $x++)
<tr class="protocol_row_{{ $count }}">
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$post_chemo_drugs[$x]['drug_id']] ?? '' }}</td>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$post_chemo_drugs[$x]['drug_route']] ?? '' }}</td>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$post_chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
</tr>
@php
$drug_dosage = $drug_units[$drug_with_units[$post_chemo_drugs[$x]['drug_id']]];
if ($post_chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($post_chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
@for($i = 0; $i < count($post_chemo_drugs[$x]['dose']); $i++)
<tr class="protocol_row_{{ $count }}">
<td>
{{ $post_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($post_chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $post_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
<td>
{{ Form::number('adjusted_dose[]', '', ['class' => 'form-control', 'step' => '0.0001']) }}
<br><br>
{{ Form::label('adjusted_dose_reason', 'Reason') }}
{{ Form::textarea('adjusted_dose_reason[]', '', ['class' => 'form-control', 'rows' => 2]) }}
</td>
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
</tr>
@endfor
@endfor
@php $count++ @endphp
@endforeach
</tbody>
</table>
{{ Form::button(__('cancer_protocol.submit'),['type'=>'submit','class'=>'btn btn-success btn-rounded waves-effect waves-light m-r-10']) }}
{{ Form::close() }}
@else
<code class="text-center">Please select a protocol above to continue</code>
@endif
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
$('#cancer_protocols').select2({
placeholder: "Select",
width: "100%"
});
function remove_protocol(count) {
if (confirm("Are you sure you want to remove this protocol?")) {
$('.protocol_row_' + count).remove();
}
}
</script>
@endpush
@@ -0,0 +1,202 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Bill - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
font-size: 0.8em;
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid !important;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<table id="table" class="table table-striped table-bordered">
<thead>
<tr>
<th>Protocol</th>
<th>Section</th>
<th>Section Comment</th>
<th>Drugs</th>
<th>Route</th>
<th>Factor</th>
<th>Dose</th>
<th>Duration</th>
<th>Instructions</th>
</tr>
</thead>
<tbody>
@foreach($cancer_protocols as $cancer_protocol)
@php
$pre_chemo_drugs = json_decode($cancer_protocol->pre_chemo_drugs, true);
$chemo_drugs = json_decode($cancer_protocol->chemo_drugs, true);
$post_chemo_drugs = json_decode($cancer_protocol->post_chemo_drugs, true);
$pre_chemo_drugs_count = count($pre_chemo_drugs);
$chemo_drugs_count = count($chemo_drugs);
$post_chemo_drugs_count = count($post_chemo_drugs);
$pre_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $pre_chemo_drugs));
$chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $chemo_drugs));
$post_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $post_chemo_drugs));
@endphp
<tr>
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + $chemo_drugs_count + $chemo_doses_count + $post_chemo_drugs_count + $post_chemo_doses_count + 4 }}">
<h3>{{ $cancer_protocol->name }}</h3>
<br>
@if($cancer_protocol->protocol_billing_type == 0)
Total Cost of {{ ugandan_shillings($cancer_protocol->protocol_cost) }}
@else
Billing Per Drug
@endif
</td>
</tr>
<tr>
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">Pre-Chemo</td>
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">{{ $cancer_protocol->pre_chemo_comments }}</td>
</tr>
@for($x = 0; $x < $pre_chemo_drugs_count; $x++)
<tr>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$pre_chemo_drugs[$x]['drug_id']] ?? '' }}</td>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$pre_chemo_drugs[$x]['drug_route']] ?? '' }}</td>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$pre_chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
</tr>
@php
$drug_dosage = $drug_units[$drug_with_units[$pre_chemo_drugs[$x]['drug_id']]];
if ($pre_chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($pre_chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
@for($i = 0; $i < count($pre_chemo_drugs[$x]['dose']); $i++)
<tr>
<td>
{{ $pre_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($pre_chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $pre_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
</tr>
@endfor
@endfor
<tr>
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">Chemo</td>
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">{{ $cancer_protocol->chemo_comments }}</td>
</tr>
@for($x = 0; $x < $chemo_drugs_count; $x++)
<tr>
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$chemo_drugs[$x]['drug_id']] ?? '' }}</td>
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$chemo_drugs[$x]['drug_route']] ?? '' }}</td>
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
</tr>
@php
$drug_dosage = $drug_units[$drug_with_units[$chemo_drugs[$x]['drug_id']]];
if ($chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
@for($i = 0; $i < count($chemo_drugs[$x]['dose']); $i++)
<tr>
<td>
{{ $chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
<td>{{ $chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
<td>{{ $chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
</tr>
@endfor
@endfor
<tr>
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">Post-Chemo</td>
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">{{ $cancer_protocol->post_chemo_comments }}</td>
</tr>
@for($x = 0; $x < $post_chemo_drugs_count; $x++)
<tr>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$post_chemo_drugs[$x]['drug_id']] ?? '' }}</td>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$post_chemo_drugs[$x]['drug_route']] ?? '' }}</td>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$post_chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
</tr>
@php
$drug_dosage = $drug_units[$drug_with_units[$post_chemo_drugs[$x]['drug_id']]];
if ($post_chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($post_chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
@for($i = 0; $i < count($post_chemo_drugs[$x]['dose']); $i++)
<tr>
<td>
{{ $post_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($post_chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $post_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
</tr>
@endfor
@endfor
@endforeach
</tbody>
</table>
</div>
</body>
</html>
@@ -0,0 +1,18 @@
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:api')->get('/cancer', function (Request $request) {
return $request->user();
});
@@ -0,0 +1,13 @@
<?php
use Illuminate\Support\Facades\Route;
Route::group(['middleware' => ['auth', 'disablebackbutton', 'user-locale','subscription-tracking', 'password-expiry']], function () {
Route::get('cancer_protocol/inactive', 'CancerProtocolController@inactive')->name('cancer_protocol.inactive');
Route::post('cancer_protocol/activate/{id}', 'CancerProtocolController@activate')->name('cancer_protocol.activate');
Route::any('cancer_protocol/print_all_protocols', 'CancerProtocolController@print_all_protocols')->name('cancer_protocol.print_all_protocols');
Route::any('cancer_protocol/order_protocol', 'CancerProtocolController@order_protocol')->name('cancer_protocol.order_protocol');
Route::any('cancer_protocol/save_protocol_order', 'CancerProtocolController@save_protocol_order')->name('cancer_protocol.save_protocol_order');
Route::any('cancer_protocol/cancel_protocol_order/{id}', 'CancerProtocolController@cancel_protocol_order')->name('cancer_protocol.cancel_protocol_order');
Route::resource('cancer_protocol', 'CancerProtocolController');
});
@@ -0,0 +1,19 @@
image: alpine/git:latest
pipelines:
branches:
main:
- step:
name: Merge To Beta
script:
- git remote set-url origin https://Kabricks:${APP_SECRET}@bitbucket.org/dcsammi/${BITBUCKET_REPO_SLUG}
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
- git fetch
- git checkout beta
- git merge main
- git commit --amend -m "[skip ci] Merge changes from main"
- git push
- step:
name: Deploy To Test
script:
- echo "Ready to deploy to demo or production!"
@@ -0,0 +1,11 @@
{
"name": "Cancer",
"alias": "cancer",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Cancer\\Providers\\CancerServiceProvider"
],
"files": []
}