2019-11-23 09:49:18 +00:00
|
|
|
|
$(document).ready(function(){
|
2019-12-08 16:38:40 +00:00
|
|
|
|
Array.prototype.remove_item_from_array = function(){
|
|
|
|
|
var result_array = this;
|
|
|
|
|
for(var i=0;i<arguments.length;i++){
|
|
|
|
|
if(Array.isArray(arguments[i])){
|
|
|
|
|
for(var j=0;j<arguments.length;j++){
|
|
|
|
|
var index = result_array.indexOf(arguments[i][j]);
|
|
|
|
|
if(index == -1)
|
|
|
|
|
continue;
|
|
|
|
|
else{
|
|
|
|
|
result_array = result_array.slice(0, index).concat(result_array.slice(index + 1, result_array.length));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
var index = result_array.indexOf(arguments[i]);
|
|
|
|
|
if(index == -1)
|
|
|
|
|
continue;
|
|
|
|
|
else{
|
|
|
|
|
result_array = result_array.slice(0, index).concat(result_array.slice(index + 1, result_array.length));
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
result_array.push = this.push;
|
|
|
|
|
result_array.remove_item_from_array = this.remove_item_from_array;
|
|
|
|
|
return result_array;
|
|
|
|
|
};
|
2019-11-23 09:49:18 +00:00
|
|
|
|
$('.cancer_help_btn').append('<i aria-hidden="true" class="fa fa-question"></i>');
|
|
|
|
|
$('.cancer_help_btn').off("click").on('click',function(){
|
|
|
|
|
var modal_head = "";
|
|
|
|
|
try{ modal_head = $(this).parent().find(">label").html()}catch{};
|
|
|
|
|
var modal_body = "";
|
|
|
|
|
try{ modal_body = $(this).parent().find(">input.help_texts").attr('value')}catch{};
|
|
|
|
|
$('#show_help_modal').html("<div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' aria-hidden='true' class='close'>×</button><h4 class='modal-title'>"+modal_head+"</h4>"+
|
|
|
|
|
"</div><div class='modal-body'>"+modal_body+"</div><div class='modal-footer'><button type='button' class='btn btn-default'>Close</button></div></div></div>")
|
|
|
|
|
$('#show_help_modal').modal('show');
|
|
|
|
|
$('#show_help_modal .close').off("click").on('click',function(){
|
|
|
|
|
$('#show_help_modal').modal('hide');
|
|
|
|
|
});
|
|
|
|
|
$('#show_help_modal .modal-footer button').off("click").on('click',function(){
|
|
|
|
|
$('#show_help_modal').modal('hide');
|
|
|
|
|
});
|
|
|
|
|
});
|
2019-12-03 13:17:09 +00:00
|
|
|
|
$('.btn-add').click(function(){
|
|
|
|
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
|
|
|
|
if($(this).parent().find('.num_only').val()!=""){
|
|
|
|
|
var input_value = Number($(this).parent().find('.num_only').val());
|
|
|
|
|
if(Array.isArray($(this).parent().find('.num_only').data('range'))){
|
|
|
|
|
var compare_value = $(this).parent().find('.num_only').data('range')[1];
|
|
|
|
|
if(compare_value != undefined){
|
|
|
|
|
if(input_value+1 <= Number(compare_value))
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value+1);
|
|
|
|
|
else{
|
|
|
|
|
input_value = $(this).parent().find('.num_only').data('range')[0];
|
|
|
|
|
if(input_value != undefined)
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value);
|
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value+1);
|
|
|
|
|
};
|
2019-12-09 01:47:53 +00:00
|
|
|
|
compare_value = $(this).parent().find('.num_only').data('range')[0];
|
|
|
|
|
if(compare_value != undefined){
|
|
|
|
|
if($(this).parent().find('.num_only').val() >= compare_value){
|
|
|
|
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
|
|
|
|
$(this).parent().find('.num_only').css('color','#333');
|
|
|
|
|
};
|
|
|
|
|
if($('.cancertable_empty').length == 0){
|
|
|
|
|
$('#danger_texts').remove();
|
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
|
|
|
|
$(this).parent().find('.num_only').css('color','#333');
|
|
|
|
|
if($('.cancertable_empty').length == 0){
|
|
|
|
|
$('#danger_texts').remove();
|
|
|
|
|
};
|
|
|
|
|
};
|
2019-12-03 13:17:09 +00:00
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
try{
|
|
|
|
|
var input_value = $(this).parent().find('.num_only').data('range')[0];
|
|
|
|
|
if(input_value != undefined)
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value);
|
|
|
|
|
}catch{
|
|
|
|
|
$(this).parent().find('.num_only').val(0);
|
|
|
|
|
};
|
2019-12-09 01:47:53 +00:00
|
|
|
|
if($(this).parent().find('.num_only').val() != ""){
|
|
|
|
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
|
|
|
|
$(this).parent().find('.num_only').css('color','#333');
|
|
|
|
|
};
|
2019-12-03 13:17:09 +00:00
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
$('.btn-sub').click(function(){
|
|
|
|
|
if($(this).parent().find('.num_only').val()!=""){
|
|
|
|
|
var input_value = Number($(this).parent().find('.num_only').val());
|
|
|
|
|
if(Array.isArray($(this).parent().find('.num_only').data('range'))){
|
|
|
|
|
var compare_value = $(this).parent().find('.num_only').data('range')[0];
|
|
|
|
|
if(compare_value != undefined){
|
|
|
|
|
if(input_value-1 >= Number(compare_value))
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value-1);
|
|
|
|
|
else{
|
|
|
|
|
input_value = $(this).parent().find('.num_only').data('range')[1];
|
|
|
|
|
if(input_value != undefined)
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value);
|
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value-1);
|
|
|
|
|
};
|
2019-12-09 01:47:53 +00:00
|
|
|
|
compare_value = $(this).parent().find('.num_only').data('range')[1];
|
|
|
|
|
if(compare_value != undefined){
|
|
|
|
|
if($(this).parent().find('.num_only').val() <= compare_value){
|
|
|
|
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
|
|
|
|
$(this).parent().find('.num_only').css('color','#333');
|
|
|
|
|
};
|
|
|
|
|
if($('.cancertable_empty').length == 0){
|
|
|
|
|
$('#danger_texts').remove();
|
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
|
|
|
|
$(this).parent().find('.num_only').css('color','#333');
|
|
|
|
|
if($('.cancertable_empty').length == 0){
|
|
|
|
|
$('#danger_texts').remove();
|
|
|
|
|
};
|
|
|
|
|
};
|
2019-12-03 13:17:09 +00:00
|
|
|
|
};
|
|
|
|
|
}else{
|
|
|
|
|
try{
|
|
|
|
|
var input_value = $(this).parent().find('.num_only').data('range')[1];
|
2019-12-09 01:47:53 +00:00
|
|
|
|
if(input_value != undefined){
|
2019-12-03 13:17:09 +00:00
|
|
|
|
$(this).parent().find('.num_only').val(input_value);
|
2019-12-09 01:47:53 +00:00
|
|
|
|
}else{
|
|
|
|
|
input_value = $(this).parent().find('.num_only').data('range')[0];
|
|
|
|
|
if(input_value != undefined)
|
|
|
|
|
$(this).parent().find('.num_only').val(input_value);
|
|
|
|
|
}
|
2019-12-03 13:17:09 +00:00
|
|
|
|
}catch{
|
|
|
|
|
$(this).parent().find('.num_only').val(0);
|
|
|
|
|
};
|
2019-12-09 01:47:53 +00:00
|
|
|
|
if($(this).parent().find('.num_only').val() != ""){
|
|
|
|
|
$(this).parent().find('.num_only').removeClass('cancertable_empty');
|
|
|
|
|
$(this).parent().find('.num_only').css('color','#333');
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
if($('.cancertable_empty').length == 0){
|
|
|
|
|
$('#danger_texts').remove();
|
2019-12-03 13:17:09 +00:00
|
|
|
|
};
|
|
|
|
|
});
|
2019-12-07 13:01:52 +00:00
|
|
|
|
$('.cancer_table_btn').off('click').on('click',function(){
|
2019-12-03 13:17:09 +00:00
|
|
|
|
var index = $(this).index()/2;
|
2019-12-07 13:01:52 +00:00
|
|
|
|
try{
|
|
|
|
|
$(this).parent().find('>input').attr('value',0);
|
|
|
|
|
$(this).parent().find('>input').eq(index).attr('value',1);
|
|
|
|
|
$(this).parent().find('>button').removeClass('active');
|
|
|
|
|
$(this).parent().removeClass('cancertable_empty');
|
2019-12-09 01:47:53 +00:00
|
|
|
|
if($('.cancertable_empty').length == 0){
|
|
|
|
|
$('#danger_texts').remove();
|
|
|
|
|
};
|
2019-12-07 13:01:52 +00:00
|
|
|
|
}catch{};
|
2019-12-03 13:17:09 +00:00
|
|
|
|
$(this).addClass('active');
|
|
|
|
|
});
|
|
|
|
|
$('#cancer_table_reset').click(function(){
|
|
|
|
|
$('.cancer_table_btn').removeClass('active');
|
|
|
|
|
$('.cancer-btn-group input').attr('value',0);
|
|
|
|
|
$('.num_only').val('');
|
2019-12-07 13:01:52 +00:00
|
|
|
|
$('#cancer_table .cancer_form_field').removeClass('cancertable_empty');
|
2019-12-09 13:25:59 +00:00
|
|
|
|
$('#cancer_predict_result_block').css('display','none');
|
2019-12-03 13:17:09 +00:00
|
|
|
|
});
|
|
|
|
|
$('#cancer_table_submit').click(function(){
|
2019-12-07 04:12:33 +00:00
|
|
|
|
var flag;
|
|
|
|
|
flag = 1;
|
2019-12-07 13:01:52 +00:00
|
|
|
|
for(var i = 0;i < $('#cancer_table .cancer_form_field').length;i++){
|
|
|
|
|
if($('#cancer_table .cancer_form_field').eq(i).hasClass('num_only')){
|
|
|
|
|
if($('#cancer_table .cancer_form_field').eq(i).val()==""){
|
2019-12-03 13:17:09 +00:00
|
|
|
|
flag = 0;
|
2019-12-07 13:01:52 +00:00
|
|
|
|
$('#cancer_table .cancer_form_field').eq(i).addClass('cancertable_empty');
|
2019-12-03 13:17:09 +00:00
|
|
|
|
}else{
|
2019-12-07 13:01:52 +00:00
|
|
|
|
$('#cancer_table .cancer_form_field').eq(i).removeClass('cancertable_empty');
|
2019-12-03 13:17:09 +00:00
|
|
|
|
};
|
|
|
|
|
}else{
|
2019-12-07 13:01:52 +00:00
|
|
|
|
if($('#cancer_table .cancer_form_field').eq(i).find('[value="1"]').length == 0){
|
2019-12-03 13:17:09 +00:00
|
|
|
|
flag = 0;
|
2019-12-07 13:01:52 +00:00
|
|
|
|
$('#cancer_table .cancer_form_field').eq(i).addClass('cancertable_empty');
|
2019-12-03 13:17:09 +00:00
|
|
|
|
}else{
|
2019-12-07 13:01:52 +00:00
|
|
|
|
$('#cancer_table .cancer_form_field').eq(i).removeClass('cancertable_empty');
|
2019-12-03 13:17:09 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
2019-12-09 01:47:53 +00:00
|
|
|
|
if($('.cancertable_empty').length != 0){
|
|
|
|
|
flag = 0;
|
|
|
|
|
$('#cancer_table_submit').parent().before('<a id="danger_texts" style="color:red;">請注意紅框的輸入資料是否符合要求</a>');
|
|
|
|
|
$('#danger_texts').css('margin-left',$(window).width()/2-$('#danger_texts').width()/2);
|
|
|
|
|
}else{
|
|
|
|
|
$('#danger_texts').remove();
|
|
|
|
|
};
|
2019-12-03 13:17:09 +00:00
|
|
|
|
if(flag == 1){
|
|
|
|
|
var post_json= {};
|
2019-12-07 13:01:52 +00:00
|
|
|
|
for(var i = 0;i < $('#cancer_table .cancer_form_field').length;i++){
|
|
|
|
|
var name = $('#cancer_table .cancer_form_field').eq(i).attr('id')
|
|
|
|
|
if($('#cancer_table .cancer_form_field').eq(i).hasClass('num_only'))
|
|
|
|
|
post_json[name] = $('#cancer_table .cancer_form_field').eq(i).val();
|
2019-12-03 13:17:09 +00:00
|
|
|
|
else{
|
2019-12-07 13:01:52 +00:00
|
|
|
|
var index = ($('#cancer_table .cancer_form_field').eq(i).find('[value="1"]').index()+1)/2;
|
2019-12-03 13:17:09 +00:00
|
|
|
|
post_json[name] = index;
|
|
|
|
|
};
|
|
|
|
|
};
|
2019-12-08 05:32:03 +00:00
|
|
|
|
post_json['locale'] = I18n.locale;
|
2019-12-07 04:12:33 +00:00
|
|
|
|
var result = $.post("/cancerpredictResult",{"data":post_json});
|
|
|
|
|
result.done(function(){
|
2019-12-07 13:01:52 +00:00
|
|
|
|
var load_heml = $('#result_table_content').html(result.responseJSON.table);
|
|
|
|
|
load_heml.ready(function(){
|
|
|
|
|
$('#result_table_content .cancer_years').eq(0).addClass('active');
|
2019-12-08 05:32:03 +00:00
|
|
|
|
for(var i = 0;i < $('#result_table_content .cancer_years').length;i++){
|
|
|
|
|
$('#result_table_content .cancer_years').eq(i).attr('index',i)
|
|
|
|
|
};
|
|
|
|
|
$('#result_table_content .cancer_years').off('click').on('click',function(){
|
2019-12-07 13:01:52 +00:00
|
|
|
|
try{
|
2019-12-08 05:32:03 +00:00
|
|
|
|
$(this).parent().find('.cancer_years').removeClass('active');
|
|
|
|
|
//$('#result_text_content .cancer_years').eq($(this).attr('index')).click();
|
2019-12-07 13:01:52 +00:00
|
|
|
|
}catch{};
|
|
|
|
|
$(this).addClass('active');
|
2019-12-08 05:32:03 +00:00
|
|
|
|
$('#current_year').attr('index',$(this).attr('index'));
|
|
|
|
|
$('#current_year').attr('value',$(this).html());
|
|
|
|
|
$('#current_year').change();
|
2019-12-07 13:01:52 +00:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
load_heml = $('#result_text_content').html(result.responseJSON.texts);
|
|
|
|
|
load_heml.ready(function(){
|
|
|
|
|
$('#result_text_content .cancer_years').eq(0).addClass('active');
|
2019-12-08 05:32:03 +00:00
|
|
|
|
for(var i = 0;i < $('#result_text_content .cancer_years').length;i++){
|
|
|
|
|
$('#result_text_content .cancer_years').eq(i).attr('index',i)
|
|
|
|
|
};
|
|
|
|
|
$('#result_text_content .cancer_years').off('click').on('click',function(){
|
2019-12-07 13:01:52 +00:00
|
|
|
|
try{
|
2019-12-08 05:32:03 +00:00
|
|
|
|
$(this).parent().find('.cancer_years').removeClass('active');
|
|
|
|
|
//$('#result_table_content .cancer_years').eq($(this).attr('index')).click();
|
2019-12-07 13:01:52 +00:00
|
|
|
|
}catch{};
|
|
|
|
|
$(this).addClass('active');
|
2019-12-08 05:32:03 +00:00
|
|
|
|
$('#current_year').attr('value',$(this).html());
|
|
|
|
|
$('#current_year').attr('index',$(this).attr('index'));
|
2019-12-07 13:01:52 +00:00
|
|
|
|
$('.surgery_year').html($(this).html());
|
2019-12-08 05:32:03 +00:00
|
|
|
|
$('#current_year').change();
|
|
|
|
|
});
|
2019-12-09 01:47:53 +00:00
|
|
|
|
$('#cancer_table_right_result .cancer-btn-group .cancer_table_btn').removeClass('active');
|
|
|
|
|
$('#cancer_table_right_result .cancer-btn-group >input').attr('value',"0");
|
2019-12-08 12:21:32 +00:00
|
|
|
|
for(var i = 0;i < $('#cancer_table_left_result .cancer-btn-group').length;i++){
|
|
|
|
|
$('#cancer_table_right_result .cancer-btn-group').eq(i).find('.cancer_table_btn').eq(0).addClass('active');
|
|
|
|
|
$('#cancer_table_right_result .cancer-btn-group').eq(i).find('>input').eq(0).attr('value',"1");
|
|
|
|
|
};
|
|
|
|
|
for(var i = 0;i < $('#cancer_table_right_result .cancer-btn-group').length;i++){
|
|
|
|
|
$('#cancer_table_right_result .cancer-btn-group').eq(i).find('.cancer_table_btn').eq(0).addClass('active');
|
|
|
|
|
$('#cancer_table_right_result .cancer-btn-group').eq(i).find('>input').eq(0).attr('value',"1");
|
|
|
|
|
};
|
2019-12-08 05:32:03 +00:00
|
|
|
|
var treatmeny_method = result.responseJSON.treatmeny_method;
|
2019-12-08 12:21:32 +00:00
|
|
|
|
$('tr.'+treatmeny_method[0]).addClass('tr_show')
|
2019-12-08 05:32:03 +00:00
|
|
|
|
var lpv = [0,-0.8397,-0.4147,-0.3203,0.3321];
|
|
|
|
|
var servive_ratio_arr = [result.responseJSON.servive_ratio]
|
|
|
|
|
var yes = (I18n.locale=="zh_tw") ? "是" : "yes";
|
|
|
|
|
var year = $('#current_year').attr('value');
|
2019-12-08 12:21:32 +00:00
|
|
|
|
var active_treatment = ['Surgery_only'];
|
2019-12-09 01:47:53 +00:00
|
|
|
|
$('tr.'+active_treatment[0]+' .Overall_Survival').html(servive_ratio_arr[0]+'%');
|
|
|
|
|
$('#cancer_predict_result_block').css('display','block');
|
2019-12-08 05:32:03 +00:00
|
|
|
|
var lpv_real = [result.responseJSON['lpv']];
|
|
|
|
|
var lpv_dict={}
|
|
|
|
|
var lpv_calc={1:-0.001476145,3:-0.01261639,5:-0.02519608}
|
|
|
|
|
active_treatment.push = function() {
|
|
|
|
|
if(arguments.length == 1){
|
|
|
|
|
var year = $('#current_year').attr('value');
|
|
|
|
|
var lpv_current = lpv_real[lpv_real.length-1]+lpv_dict[arguments[0]];
|
|
|
|
|
lpv_real.push(lpv_current);
|
2019-12-09 13:25:59 +00:00
|
|
|
|
var servive_ratio = Math.round((Math.exp(lpv_calc[year])**Math.exp(lpv_current))*100);
|
2019-12-08 12:21:32 +00:00
|
|
|
|
var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length - 1];
|
2019-12-08 05:32:03 +00:00
|
|
|
|
servive_ratio_arr.push(servive_ratio);
|
2019-12-08 16:43:40 +00:00
|
|
|
|
$('tr.'+arguments[0]+' td.Overall_Survival').html(servive_ratio+'%');
|
|
|
|
|
$('tr.'+arguments[0]+' td.Additional_Benefit').html(benefit+'%');
|
2019-12-08 12:21:32 +00:00
|
|
|
|
$('tr.'+arguments[0]).css('display','table-row');
|
|
|
|
|
$('tr.tr_show').eq(-1).after($('tr.'+arguments[0]));
|
|
|
|
|
$('tr.'+arguments[0]).addClass('tr_show');
|
|
|
|
|
if(this.length == 1){
|
|
|
|
|
$('.addition').css('display','block');
|
|
|
|
|
$('#result_text_content .extra-text').css('display','inline-block');
|
|
|
|
|
}
|
|
|
|
|
var add_choices = this.slice(1,this.length);
|
|
|
|
|
add_choices.push(arguments[0]);
|
|
|
|
|
var add_choices_transform = [];
|
|
|
|
|
for(var i = 0;i<add_choices.length;i++){
|
|
|
|
|
add_choices_transform.push($('[for="'+add_choices[i]+'"]').html())
|
|
|
|
|
};
|
|
|
|
|
var add_choices_str = add_choices_transform.slice(0,add_choices_transform.length-1).join('、');
|
|
|
|
|
if(add_choices_transform.length >= 2)
|
|
|
|
|
add_choices_str += ('以及'+add_choices_transform[add_choices_transform.length-1])
|
|
|
|
|
else
|
|
|
|
|
add_choices_str = add_choices_transform[0];
|
2019-12-08 16:38:40 +00:00
|
|
|
|
var new_text = '<p class="texts_show">'+'<a>100 位在術後有接受</a><a class="'+arguments[0]+' choices">'+add_choices_str+'</a><a>的婦女中,有 </a>'+'<a class="'+arguments[0]+' Overall_Survival">'+servive_ratio+'</a>'+'<a> 位婦女,術後 </a>'+'<a class="surgery_year">'+year+'</a>'+'<a>年仍為存活(多了</a>'+'<a class="'+arguments[0]+' Additional_Benefit">'+benefit+'</a><a>位)</a>'+'</p>';
|
2019-12-08 12:21:32 +00:00
|
|
|
|
$('#result_text_content .extra-text .texts_show').eq(-1).after(new_text)
|
2019-12-08 05:32:03 +00:00
|
|
|
|
return Array.prototype.push.apply(this, arguments);
|
|
|
|
|
}else{
|
|
|
|
|
return Array.prototype.push.apply(this, arguments);
|
|
|
|
|
}
|
|
|
|
|
};
|
2019-12-08 16:38:40 +00:00
|
|
|
|
active_treatment.remove_item_from_array = function(){
|
|
|
|
|
if(arguments.length == 1 && !Array.isArray(arguments[0])){
|
|
|
|
|
var index = this.indexOf(arguments[0])
|
|
|
|
|
var year = $('#current_year').attr('value');
|
|
|
|
|
if(index < this.length - 1){
|
|
|
|
|
for(var i = index + 1;i < this.length; i++){
|
2019-12-09 13:25:59 +00:00
|
|
|
|
lpv_real[i] -= lpv_dict[arguments[0]];
|
|
|
|
|
var servive_ratio = Math.round((Math.exp(lpv_calc[year])**Math.exp(lpv_real[i]))*100);
|
2019-12-08 16:38:40 +00:00
|
|
|
|
var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length - 1];
|
2019-12-08 16:43:40 +00:00
|
|
|
|
$('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
|
2019-12-08 16:38:40 +00:00
|
|
|
|
$('.'+active_treatment[i]+'.Overall_Survival').html(servive_ratio);
|
2019-12-08 16:43:40 +00:00
|
|
|
|
$('tr.'+active_treatment[i]+' td.Additional_Benefit').html(benefit+'%');
|
2019-12-08 16:38:40 +00:00
|
|
|
|
$('.'+active_treatment[i]+'.Additional_Benefit').html(benefit);
|
|
|
|
|
};
|
|
|
|
|
var add_choices = [];
|
|
|
|
|
for(var i = 1;i < this.length; i++){
|
|
|
|
|
if(i != index){
|
|
|
|
|
add_choices.push(this[i]);
|
|
|
|
|
var add_choices_transform = [];
|
|
|
|
|
for(var j = 0;j<add_choices.length;j++){
|
|
|
|
|
add_choices_transform.push($('[for="'+add_choices[j]+'"]').html())
|
|
|
|
|
};
|
|
|
|
|
var add_choices_str = add_choices_transform.slice(0,add_choices_transform.length-1).join('、');
|
|
|
|
|
if(add_choices_transform.length >= 2)
|
|
|
|
|
add_choices_str += ('以及'+add_choices_transform[add_choices_transform.length-1])
|
|
|
|
|
else
|
|
|
|
|
add_choices_str = add_choices_transform[0];
|
|
|
|
|
$('.'+active_treatment[i]+'.choices').html(add_choices_str);
|
2019-12-08 12:21:32 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
2019-12-08 16:38:40 +00:00
|
|
|
|
$('tr.'+arguments[0]+' td.Overall_Survival').html('-');
|
|
|
|
|
$('tr.'+arguments[0]+' td.Additional_Benefit').html('-');
|
|
|
|
|
$('tr.'+arguments[0]).css('display','none');
|
|
|
|
|
$('tr.'+arguments[0]).removeClass('tr_show');
|
|
|
|
|
$('a.'+arguments[0]).eq(0).parent().remove();
|
|
|
|
|
lpv_real = lpv_real.remove_item_from_array(lpv_real[index]);
|
|
|
|
|
servive_ratio_arr = servive_ratio_arr.remove_item_from_array(servive_ratio_arr[index]);
|
|
|
|
|
if(this.length == 2){
|
|
|
|
|
$('.addition').css('display','none');
|
|
|
|
|
$('#result_text_content .extra-text').css('display','none');
|
2019-12-08 12:21:32 +00:00
|
|
|
|
};
|
|
|
|
|
return Array.prototype.remove_item_from_array.apply(this, arguments);
|
|
|
|
|
}else{
|
|
|
|
|
return Array.prototype.remove_item_from_array.apply(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
};
|
2019-12-08 05:32:03 +00:00
|
|
|
|
for(var i = 0;i<treatmeny_method.length;i++){
|
|
|
|
|
lpv_dict[treatmeny_method[i]] = lpv[i];
|
|
|
|
|
$('#'+treatmeny_method[i]+' .cancer_table_btn').eq(1).click(function(){
|
|
|
|
|
if(!active_treatment.includes($(this).parent().attr('id'))){
|
|
|
|
|
active_treatment.push($(this).parent().attr('id'))
|
2019-12-09 13:25:59 +00:00
|
|
|
|
console.log(active_treatment);
|
|
|
|
|
console.log(servive_ratio_arr);
|
2019-12-08 16:38:40 +00:00
|
|
|
|
};
|
|
|
|
|
});
|
2019-12-08 12:21:32 +00:00
|
|
|
|
$('#'+treatmeny_method[i]+' .cancer_table_btn').eq(0).click(function(){
|
2019-12-08 16:38:40 +00:00
|
|
|
|
if(active_treatment.includes($(this).parent().attr('id'))){
|
|
|
|
|
active_treatment = active_treatment.remove_item_from_array($(this).parent().attr('id'));
|
2019-12-09 13:25:59 +00:00
|
|
|
|
console.log(active_treatment);
|
|
|
|
|
console.log(servive_ratio_arr);
|
2019-12-08 16:38:40 +00:00
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
};
|
2019-12-08 05:32:03 +00:00
|
|
|
|
$('#current_year').change(function(){
|
|
|
|
|
$('.surgery_year').html($(this).attr('value'));
|
|
|
|
|
$('.cancer_years').removeClass('active');
|
|
|
|
|
$('#result_text_content .cancer_years').eq($(this).attr("index")).addClass('active');
|
|
|
|
|
$('#result_table_content .cancer_years').eq($(this).attr("index")).addClass('active');
|
|
|
|
|
var year = $(this).attr('value');
|
|
|
|
|
servive_ratio_arr = [];
|
|
|
|
|
for(var i = 0;i<active_treatment.length;i++){
|
2019-12-09 13:25:59 +00:00
|
|
|
|
var servive_ratio = Math.round((Math.exp(lpv_calc[year])**Math.exp(lpv_real[i]))*100);
|
2019-12-08 12:21:32 +00:00
|
|
|
|
var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length-1];
|
2019-12-08 05:32:03 +00:00
|
|
|
|
servive_ratio_arr.push(servive_ratio);
|
2019-12-08 16:43:40 +00:00
|
|
|
|
$('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
|
2019-12-08 12:21:32 +00:00
|
|
|
|
$('.'+active_treatment[i]+'.Overall_Survival').html(servive_ratio);
|
2019-12-08 16:43:40 +00:00
|
|
|
|
if(i != 0){
|
|
|
|
|
$('tr.'+active_treatment[i]+' td.Additional_Benefit').html(benefit+'%');
|
|
|
|
|
$('.'+active_treatment[i]+'.Additional_Benefit').html(benefit);
|
|
|
|
|
}
|
2019-12-08 05:32:03 +00:00
|
|
|
|
}
|
|
|
|
|
$('.'+active_treatment[0]+'.Overall_Survival').html(servive_ratio_arr[0]);
|
2019-12-08 16:43:40 +00:00
|
|
|
|
$('.survive_person').html(servive_ratio+'%');
|
2019-12-07 13:01:52 +00:00
|
|
|
|
});
|
|
|
|
|
});
|
2019-12-07 04:12:33 +00:00
|
|
|
|
})
|
2019-12-03 13:17:09 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2019-12-07 04:12:33 +00:00
|
|
|
|
for(var i = 0;i < $('.result_tab').length;i++){
|
|
|
|
|
$('.result_tab').eq(i).attr('index',i)
|
|
|
|
|
};
|
|
|
|
|
for(var i = 0;i < $('.result_content').length;i++){
|
|
|
|
|
$('.result_content').eq(i).attr('index',i)
|
|
|
|
|
};
|
|
|
|
|
$('.result_tab').click(function(){
|
|
|
|
|
var index = $(this).attr('index');
|
2019-12-07 13:01:52 +00:00
|
|
|
|
$('.result_tab').removeClass('active');
|
|
|
|
|
$(this).addClass('active');
|
2019-12-07 04:12:33 +00:00
|
|
|
|
$('.result_content').css('display','none');
|
|
|
|
|
$('.result_content[index="'+index+'"]').css('display','block');
|
|
|
|
|
})
|
2019-12-07 13:01:52 +00:00
|
|
|
|
$('.num_only').keypress(function(event){
|
2019-12-09 01:47:53 +00:00
|
|
|
|
|
2019-12-07 13:01:52 +00:00
|
|
|
|
return event.keyCode>=48&&event.keyCode<=57||(this.value.indexOf('.')<0?event.keyCode==46:false);
|
|
|
|
|
});
|
2019-12-09 01:47:53 +00:00
|
|
|
|
$('.num_only').blur(function(){
|
|
|
|
|
if( Number($(this).val()) < $(this).data('range')[0]){
|
|
|
|
|
$(this).css('color','#f24a69');
|
|
|
|
|
$(this).addClass('cancertable_empty');
|
|
|
|
|
console.log($(this).val())
|
|
|
|
|
}else{
|
|
|
|
|
$(this).css('color','#333');
|
|
|
|
|
$(this).removeClass('cancertable_empty');
|
|
|
|
|
if($('.cancertable_empty').length == 0){
|
|
|
|
|
$('#danger_texts').remove();
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
})
|
2019-11-23 09:49:18 +00:00
|
|
|
|
});
|