fix bugs
This commit is contained in:
parent
63bfb834ac
commit
f5af46731e
|
@ -161,6 +161,7 @@ $(document).ready(function(){
|
|||
$('.cancer-btn-group input').attr('value',0);
|
||||
$('.num_only').val('');
|
||||
$('#cancer_table .cancer_form_field').removeClass('cancertable_empty');
|
||||
$('#cancer_predict_result_block').css('display','none');
|
||||
});
|
||||
$('#cancer_table_submit').click(function(){
|
||||
var flag;
|
||||
|
@ -264,7 +265,7 @@ $(document).ready(function(){
|
|||
var year = $('#current_year').attr('value');
|
||||
var lpv_current = lpv_real[lpv_real.length-1]+lpv_dict[arguments[0]];
|
||||
lpv_real.push(lpv_current);
|
||||
var servive_ratio = (Math.exp(lpv_calc[year])**lpv_current)*100;
|
||||
var servive_ratio = Math.round((Math.exp(lpv_calc[year])**Math.exp(lpv_current))*100);
|
||||
var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length - 1];
|
||||
servive_ratio_arr.push(servive_ratio);
|
||||
$('tr.'+arguments[0]+' td.Overall_Survival').html(servive_ratio+'%');
|
||||
|
@ -300,8 +301,8 @@ $(document).ready(function(){
|
|||
var year = $('#current_year').attr('value');
|
||||
if(index < this.length - 1){
|
||||
for(var i = index + 1;i < this.length; i++){
|
||||
lpv_real[i] -= lpv_dict[arguments[0]]
|
||||
var servive_ratio = (Math.exp(lpv_calc[year])**lpv_real[i])*100;
|
||||
lpv_real[i] -= lpv_dict[arguments[0]];
|
||||
var servive_ratio = Math.round((Math.exp(lpv_calc[year])**Math.exp(lpv_real[i]))*100);
|
||||
var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length - 1];
|
||||
$('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
|
||||
$('.'+active_treatment[i]+'.Overall_Survival').html(servive_ratio);
|
||||
|
@ -346,11 +347,15 @@ $(document).ready(function(){
|
|||
$('#'+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'))
|
||||
console.log(active_treatment);
|
||||
console.log(servive_ratio_arr);
|
||||
};
|
||||
});
|
||||
$('#'+treatmeny_method[i]+' .cancer_table_btn').eq(0).click(function(){
|
||||
if(active_treatment.includes($(this).parent().attr('id'))){
|
||||
active_treatment = active_treatment.remove_item_from_array($(this).parent().attr('id'));
|
||||
console.log(active_treatment);
|
||||
console.log(servive_ratio_arr);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -362,7 +367,7 @@ $(document).ready(function(){
|
|||
var year = $(this).attr('value');
|
||||
servive_ratio_arr = [];
|
||||
for(var i = 0;i<active_treatment.length;i++){
|
||||
var servive_ratio = (Math.exp(lpv_calc[year])**lpv_real[i])*100;
|
||||
var servive_ratio = Math.round((Math.exp(lpv_calc[year])**Math.exp(lpv_real[i]))*100);
|
||||
var benefit = servive_ratio - servive_ratio_arr[servive_ratio_arr.length-1];
|
||||
servive_ratio_arr.push(servive_ratio);
|
||||
$('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
|
||||
|
|
|
@ -12,10 +12,10 @@ class CancerpredictsController < ApplicationController
|
|||
create_first_field
|
||||
locale = params['data']['locale'].to_s rescue 'zh_tw'
|
||||
locale = 'zh_tw' if locale == 'zh_cn'
|
||||
result = {:result=>"123"}
|
||||
result = {}
|
||||
result['age1'] = -(params['data']['age'].to_f/100)**(-0.5)
|
||||
result['age2'] = -(params['data']['age'].to_f/100)**(-0.5)*Math.log(params['data']['age'].to_f/100,10)
|
||||
result['size1'] = -Math.log(params['data']['size'].to_f/10,10)
|
||||
result['age2'] = -((params['data']['age'].to_f/100)**(-0.5))*Math.log(params['data']['age'].to_f/100,Math.exp(1))
|
||||
result['size1'] = -Math.log(params['data']['size'].to_f/10,Math.exp(1))
|
||||
result['nposit'] = -((params['data']['ratio'].to_f+0.1)/0.1)**0.5
|
||||
if params['data']['grade'].to_i == 2
|
||||
result['grade_2'] = 1
|
||||
|
@ -57,7 +57,7 @@ class CancerpredictsController < ApplicationController
|
|||
else
|
||||
result['lvi_yes'] = 0
|
||||
end
|
||||
result['lpv'] = ((result['age1']-0.7276655)*(-10.87)+(result['age2']-0.4540707)*8.968+(result['size1']-0.643632)*0.7678+(result['nposit']-1.346932)*0.5339+
|
||||
result['lpv'] = ((result['age1']-0.7276655)*(10.87)+(result['age2']+0.4540707)*8.968+(result['size1']-0.643632)*0.7678+(result['nposit']-1.346932)*0.5339+
|
||||
result['grade_2']*0.4795+result['grade_3']*0.818+result['subtype_HER2']*0.1806+result['subtype_triple']*0.6457+result['pstage_2']*0.5311+
|
||||
result['pstage_3']*1.134+result['pstage_4']*2.172+result['lvi_yes']*0.3321-0.04 rescue 'error')
|
||||
@years = ['1','3','5']
|
||||
|
@ -79,14 +79,14 @@ class CancerpredictsController < ApplicationController
|
|||
@therapy_choices.each_with_index do |choice,i|
|
||||
result['table'] += '<tr class="'+@therapy_names[i].to_s+'">'
|
||||
@table_head.each_with_index do |head,index|
|
||||
result['table'] += ('<td class="cancer_td '+ @head_name[index]+'">' + ((index == 0) ? choice : '-') + '</td>')
|
||||
result['table'] += ('<td class="cancer_td '+ @head_name[index]+'">' + ((index == 0) ? (((i==0)? '' : '+') + choice) : '-') + '</td>')
|
||||
end
|
||||
result['table'] += '</tr>'
|
||||
end
|
||||
result['texts'] = '<a>此研究分析來自已接受根除性手術後之婦女所得之結果,根據您所輸入的資訊以及治療方式,</a>'+'<div style="clear:both;"></div>'+'<a>在術後第</a>'
|
||||
@years.each{|year| result['texts'] += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm">'+year+'</button>')}
|
||||
result['texts'] += '<a>年</a>,'
|
||||
@servive_ratio = (Math.exp(-0.001476145)**(result['lpv']))*100
|
||||
@servive_ratio = ((Math.exp(-0.001476145)**(Math.exp(result['lpv'])))*100).round
|
||||
result['texts'] += ('<p class="show"><a>100 位只接受根除性手術的婦女中,有 '+ '<a class="'+@therapy_names[0]+' Overall_Survival">'+@servive_ratio.round.to_s+'</a>'+'<a> 位婦女,術後 </a>'+'<a class="surgery_year">'+@years[0].to_s+'</a>'+'<a>年仍為存活</a></p>')
|
||||
result['texts'] += '<a class="addition">'+',此外</a><div class="extra-text" style="display:none;"><div class="texts_show" style="clear:both;"></div>'
|
||||
result['texts'] += '</div>'
|
||||
|
|
Loading…
Reference in New Issue