fix bugs and change text for ntu_coph.

This commit is contained in:
BOHUNG 2020-03-04 15:37:59 +08:00
parent 97337b7716
commit a1aeeb008a
5 changed files with 122 additions and 283 deletions

View File

@ -15,7 +15,7 @@ $(document).ready(function(){
$('#cancer_table .cencer_table_name').css('max-width','39%');
};
};
function round(num,Digit){
function round(num,Digit=0){
return Math.round(Number(num)*(10**Digit))/(10**Digit);
};
head_data.done(function(){
@ -267,7 +267,7 @@ $(document).ready(function(){
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).siblings('.num_only_value').val();
post_json[name] = Number($('#cancer_table .cancer_form_field').eq(i).siblings('.num_only_value').val());
else{
var index = ($('#cancer_table .cancer_form_field').eq(i).find('[value="1"]').index()+1)/2;
post_json[name] = index;
@ -297,7 +297,7 @@ $(document).ready(function(){
$('#choice_fields .cancer_table_btn').removeClass('active');
var load_heml = $('#result_table_content').html(result.responseJSON.table);
load_heml.ready(function(){
$('#result_table_content .cancer_years').eq(-1).addClass('active');
$('#result_table_content .cancer_years').eq(0).addClass('active');
for(var i = 0;i < $('#result_table_content .cancer_years').length;i++){
$('#result_table_content .cancer_years').eq(i).attr('index',i)
};
@ -313,7 +313,7 @@ $(document).ready(function(){
});
load_heml = $('#result_text_content').html(result.responseJSON.texts);
load_heml.ready(function(){
$('#result_text_content .cancer_years').eq(-1).addClass('active');
$('#result_text_content .cancer_years').eq(0).addClass('active');
for(var i = 0;i < $('#result_text_content .cancer_years').length;i++){
$('#result_text_content .cancer_years').eq(i).attr('index',i)
};
@ -350,13 +350,13 @@ $(document).ready(function(){
$('#cancer_predict_result_block').css('display','block');
var lpv_real = [result.responseJSON['lpv']];
var lpv_dict={}
var lpv_calc={1:-0.001476145,3:-0.01261639,5:-0.02519608}
var lpv_calc={0.5:0.9736358,1:0.9548993,1.5:0.9229336}
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);
var servive_ratio = round((Math.exp(lpv_calc[year])**Math.exp(lpv_current))*100,2);
var servive_ratio = round((1 - (lpv_calc[year]**Math.exp(lpv_current)))*100,2);
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+'%');
@ -549,17 +549,17 @@ $(document).ready(function(){
function calculate_and_change_result_value(obj){
obj.servive_ratio_arr = [];
for(var i = 0;i<obj.active_treatment.length;i++){
var servive_ratio = round((Math.exp(obj.lpv_calc[obj.year])**Math.exp(obj.lpv_real[i]))*100,2);
var servive_ratio = round((1-(obj.lpv_calc[obj.year]**Math.exp(obj.lpv_real[i])))*100,2);
var benefit = servive_ratio - obj.servive_ratio_arr[obj.servive_ratio_arr.length-1];
obj.servive_ratio_arr.push(servive_ratio);
$('tr.'+obj.active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%');
$('.'+obj.active_treatment[i]+'.Overall_Survival').html(Math.round(servive_ratio));
$('.'+obj.active_treatment[i]+'.Overall_Survival').html(servive_ratio);
if(i != 0){
$('tr.'+obj.active_treatment[i]+' td.Additional_Benefit').html(round(benefit,2)+'%');
$('.'+obj.active_treatment[i]+'.Additional_Benefit').html(Math.round(benefit));
}
}
$('.'+obj.active_treatment[0]+'.Overall_Survival').html(Math.round(obj.servive_ratio_arr[0]));
//$('.'+obj.active_treatment[0]+'.Overall_Survival').html(Math.round(obj.servive_ratio_arr[0]));
};
function after_submit_change_func(obj){
var post_json = get_input_data();
@ -572,95 +572,16 @@ $(document).ready(function(){
};
function calculate_first_lpv(result_json){
result = {}
result['age1'] = Math.pow((Number(result_json['age'])/100),0.5);
result['age2'] = Math.pow((Number(result_json['age'])/100),0.5)*Math.log(result_json['age']/100);
result['size1'] = Math.log(Number(result_json['size'])/10);
if(Number(result_json['lymph_nodes_examined']) != 0)
try{result['ratio'] = Number(result_json['lymph_nodes_positive'])/Number(result_json['lymph_nodes_examined'])}catch(e){result['ratio'] = 0}
result['sex_value'] = result_json['sex'] - 1
result['Age_value'] = result_json['age']
if(result_json['calcification_score'] < 1400)
result['cal_value'] = 0;
else
result['ratio'] = 0
if(result['ratio'] > 1)
result['ratio'] = 1
result['nposit'] = Math.pow(((Number(result['ratio'])+0.1)/0.1),0.5);
var T = '';
if(Number(result_json['tumor_direct_extension']) != 1){
if(Number(result_json['size']) <= 20)
T = 'T1';
else if(Number(result_json['size']) > 20 && Number(result_json['size']) <= 50)
T = 'T2';
else if(Number(result_json['size']) > 50)
T = 'T3';
}else{
T = 'T4';
};
var N = '';
if(Number(result_json['lymph_nodes_positive']) == 0)
N = 'N0';
else if(Number(result_json['lymph_nodes_positive']) >= 1 && Number(result_json['lymph_nodes_positive']) <= 3 && Number(result_json['micrometastasis']) != 1)
N = 'N1';
else if(Number(result_json['lymph_nodes_positive']) >= 1 && Number(result_json['lymph_nodes_positive']) <= 3 && Number(result_json['micrometastasis']) == 1)
N = 'N1mi';
else if(Number(result_json['lymph_nodes_positive']) >= 4 && Number(result_json['lymph_nodes_positive']) <= 9)
N = 'N2';
else if(Number(result_json['lymph_nodes_positive']) >= 10)
N = 'N3';
M = '';
if(Number(result_json['Distant_Metastasis']) != 1)
M = 'M0';
else
M = 'M1';
if(Number(M == 'M0'))
if(T == 'T1' && (N == 'N0' || N == 'N1mi'))
result['pstage'] = 1;
else if(((T == 'T2' || T == 'T3') && (N == 'N0')) || ((T == 'T1' || T == 'T2') && (N == 'N1')))
result['pstage'] = 2;
else if((T == 'T4' && N == 'N0') || ((T == 'T3' || T == 'T4') && N == 'N1') || (N == 'N2' || N == 'N3'))
result['pstage'] = 3;
else
result['pstage'] = 4
if((Number(result_json['ER_status']) != 2 || Number(result_json['PR_status']) != 2) && (Number(result_json['HER2_status']) != 1))
result['subtype'] = 1;
else if(Number(result_json['HER2_status']) == 1)
result['subtype'] = 2;
else if(Number(result_json['ER_status']) == 2 && Number(result_json['PR_status']) == 2 && (Number(result_json['HER2_status']) != 1))
result['subtype'] = 3;
if( Number(result_json['grade']) == 2 || Number(result_json['grade']) == 4)
result['grade_2'] = 1;
else
result['grade_2'] = 0;
if( Number(result_json['grade']) == 3)
result['grade_3'] = 1;
else
result['grade_3'] = 0;
if( Number(result['subtype']) == 2)
result['subtype_HER2'] = 1;
else
result['subtype_HER2'] = 0;
if( Number(result['subtype']) == 3)
result['subtype_triple'] = 1;
else
result['subtype_triple'] = 0;
if( Number(result['pstage']) == 2)
result['pstage_2'] = 1;
else
result['pstage_2'] = 0;
if( Number(result['pstage']) == 3)
result['pstage_3'] = 1;
else
result['pstage_3'] = 0;
if( Number(result['pstage']) == 4)
result['pstage_4'] = 1;
else
result['pstage_4'] = 0;
if( Number(result_json['lvi']) == 1)
result['lvi_yes'] = 1;
else
result['lvi_yes'] = 0;
result['cal_value'] = 1;
try{
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);
result['lpv'] = -0.51427548* (result['sex_value']- 0.508312) + 0.05764604* (result['Age_value'] - 61.894501) + 0.49138819*(result['cal_value'] - 0.334399);
}catch(e){result['lpv'] = "error"};
console.log(result['lpv']);
return result;
};
function submit_fcn(){

View File

@ -89,7 +89,7 @@ class Admin::CancerpredictsController < OrbitAdminController
@form_to_show.form_show_in_result[num.to_s][key.to_s] = value.to_i
end
end
end
end if !params["cancerpredictfields"]["form_show_in_result"].nil?
@create_items = ['title_texts','form_result_is_right','text_descibe','years','table_above_texts','text_above_texts','surgery_only_texts','extra_texts','extra_therapy_texts','danger_texts','texts_between_Result_and_result_block']
params_cancer = params.require("cancerpredictfields").permit!
@create_items.each do |item|
@ -265,7 +265,7 @@ class Admin::CancerpredictsController < OrbitAdminController
end
if @field_property["is_num"] == 1
if @field_property["is_float"] == 1
@table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/></div>'
@table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/><input class="num_only_value" type="hidden" /></div>'
else
if @field_property["range"] == []
@table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/></div>'
@ -325,7 +325,10 @@ class Admin::CancerpredictsController < OrbitAdminController
end
if @field_property["is_num"] == 1
if @field_property["is_float"] == 1
@table_str_right += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/><button class="btn-sub"></button><button class="btn-add"></button></div>'
@table_str_right += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/><input class="num_only_value" type="hidden" /></div>'
else
if @field_property["range"] == []
@table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/></div>'
else
@table_str_right += '<div class="num_group"><form class="for_num">'
@table_str_right += '<input class="num_only cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'" onkeyup="value=value.replace(/[^\d]/g,\'\') "onbeforepaste="clipboardData.setData(\'text\',clipboardData.getData(\'text\').replace(/[^\d]/g,\'\'))"/>'
@ -342,6 +345,7 @@ class Admin::CancerpredictsController < OrbitAdminController
end
@table_str_right += '</select></form></div>'
end
end
else
@table_str_right += '<div class= "cancer-btn-group cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;">'
@field_property["choice_fields"].each do |create_choice|
@ -412,7 +416,10 @@ class Admin::CancerpredictsController < OrbitAdminController
end
if @field_property["is_num"] == 1
if @field_property["is_float"] == 1
@table_result_choice_fileds += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/><button class="btn-sub"></button><button class="btn-add"></button>'
@table_result_choice_fileds += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/><input class="num_only_value" type="hidden" /></button>'
else
if @field_property["range"] == []
@table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/></div>'
else
@table_result_choice_fileds += '<div class="num_group"><form class="for_num">'
@table_result_choice_fileds += '<input class="num_only cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'" onkeyup="value=value.replace(/[^\d]/g,\'\') "onbeforepaste="clipboardData.setData(\'text\',clipboardData.getData(\'text\').replace(/[^\d]/g,\'\'))"/><button class="btn-sub"></button><button class="btn-add"></button></div>'
@ -429,6 +436,7 @@ class Admin::CancerpredictsController < OrbitAdminController
end
@table_result_choice_fileds += '</select></form></div>'
end
end
else
@table_result_choice_fileds += '<div class= "cancer-btn-group cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;">'
@field_property["choice_fields"].each do |create_choice|

View File

@ -52,112 +52,16 @@ class CancerpredictsController < ApplicationController
locale = params['data']['locale'].to_s rescue 'zh_tw'
locale = 'zh_tw' if locale == 'zh_cn'
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,Math.exp(1))
result['size1'] = Math.log(params['data']['size'].to_f/10,Math.exp(1))
if params['data']['lymph_nodes_examined'].to_i != 0
result['ratio'] = params['data']['lymph_nodes_positive'].to_f/params['data']['lymph_nodes_examined'].to_f rescue 0
result['sex_value'] = params['data']['sex'].to_i - 1
result['Age_value'] = params['data']['age'].to_i
if params['data']['calcification_score'].to_i < 1400
result['cal_value'] = 0
else
result['ratio'] = 0
result['cal_value'] = 1
end
result['ratio'] = 1 if result['ratio'] > 1
result['nposit'] = ((result['ratio'].to_f+0.1)/0.1)**0.5
@T = ''
if params['data']['tumor_direct_extension'].to_i != 1
if params['data']['size'].to_i <= 20
@T = 'T1'
elsif params['data']['size'].to_i > 20 && params['data']['size'].to_i <= 50
@T = 'T2'
elsif params['data']['size'].to_i > 50
@T = 'T3'
end
else
@T = 'T4'
end
result['T'] = @T
@N = ''
if params['data']['lymph_nodes_positive'].to_i == 0
@N = 'N0'
elsif params['data']['lymph_nodes_positive'].to_i >= 1 && params['data']['lymph_nodes_positive'].to_i <= 3 && params['data']['micrometastasis'].to_i != 1
@N = 'N1'
elsif params['data']['lymph_nodes_positive'].to_i >= 1 && params['data']['lymph_nodes_positive'].to_i <= 3 && params['data']['micrometastasis'].to_i == 1
@N = 'N1mi'
elsif params['data']['lymph_nodes_positive'].to_i >= 4 && params['data']['lymph_nodes_positive'].to_i <= 9
@N = 'N2'
elsif params['data']['lymph_nodes_positive'].to_i >= 10
@N = 'N3'
end
result['N'] = @N
@M = ''
if params['data']['Distant_Metastasis'].to_i != 1
@M = 'M0'
else
@M = 'M1'
end
result['M'] = @M
if @M == 'M0'
if @T == 'T1' && (@N == 'N0' || @N == 'N1mi')
result['pstage'] = 1
elsif ((@T == 'T2' || @T == 'T3') && (@N == 'N0')) || ((@T == 'T1' || @T == 'T2') && (@N == 'N1'))
result['pstage'] = 2
elsif (@T == 'T4' && @N == 'N0') || ((@T == 'T3' || @T == 'T4') && @N == 'N1') || (@N == 'N2' || @N == 'N3')
result['pstage'] = 3
end
else
result['pstage'] = 4
end
if (params['data']['ER_status'].to_i != 2 || params['data']['PR_status'].to_i != 2) && (params['data']['HER2_status'].to_i != 1)
result['subtype'] = 1
elsif params['data']['HER2_status'].to_i == 1
result['subtype'] = 2
elsif params['data']['ER_status'].to_i == 2 && params['data']['PR_status'].to_i == 2 && (params['data']['HER2_status'].to_i != 1)
result['subtype'] = 3
end
if params['data']['grade'].to_i == 2 || params['data']['grade'].to_i == 4
result['grade_2'] = 1
else
result['grade_2'] = 0
end
if params['data']['grade'].to_i == 3
result['grade_3'] = 1
else
result['grade_3'] = 0
end
if result['subtype'].to_i == 2
result['subtype_HER2'] = 1
else
result['subtype_HER2'] = 0
end
if result['subtype'].to_i == 3
result['subtype_triple'] = 1
else
result['subtype_triple'] = 0
end
if result['pstage'].to_i == 2
result['pstage_2'] = 1
else
result['pstage_2'] = 0
end
if result['pstage'].to_i == 3
result['pstage_3'] = 1
else
result['pstage_3'] = 0
end
if result['pstage'].to_i == 4
result['pstage_4'] = 1
else
result['pstage_4'] = 0
end
if params['data']['lvi'].to_i == 1
result['lvi_yes'] = 1
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['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')
result['lpv'] = -0.51427548* (result['sex_value']- 0.508312) + 0.05764604* (result['Age_value'] - 61.894501) + 0.49138819*(result['cal_value'] - 0.334399) rescue 'error'
@years = @form_to_show.years
result['table'] = '<input id="current_year" type="hidden" value="'+@years[-1].to_s+'" index="0"/><p id="cancer_table_texts">'+@form_to_show.table_above_texts[locale]+'</p>'
result['table'] = '<input id="current_year" type="hidden" value="'+@years[0].to_s+'" index="0"/><p id="cancer_table_texts">'+@form_to_show.table_above_texts[locale].to_s+'</p>'
result['table'] += ('<a style="display: inline-block;">'+(locale == 'zh_tw' ? '第' : '')+'</a><a style="display: inline-block;">')
result['years'] = @years
@years.each{|year| result['table'] += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm">'+year.to_s+'</button>')}
@ -179,7 +83,9 @@ class CancerpredictsController < ApplicationController
end
result['table'] += '</tr>'
end
@texts = @form_to_show.text_above_texts[locale].gsub('<br/>','</span><br/><span>')
@lpv_calc = [0.9736358,0.9548993,0.9229336]
@servive_ratio = ((1-(@lpv_calc[0]**(Math.exp(result['lpv']))))*100).round(2)
@texts = @form_to_show.text_above_texts[locale].to_s.gsub('<br/>','</span><br/><span>').gsub('{{Surgery_only}}','<span class="'+@therapy_names[0]+' Overall_Survival">'+@servive_ratio.round(2).to_s+'</span>')
@texts = @texts.split('{{years}}')
@texts.delete('')
result['texts'] = '<span>'+@texts[0]
@ -189,13 +95,15 @@ class CancerpredictsController < ApplicationController
else
result['texts'] += '</span>'
end
@lpv_calc = [-0.001476145,-0.01261639,-0.02519608]
@servive_ratio = ((Math.exp(@lpv_calc[-1])**(Math.exp(result['lpv'])))*100).round(2)
if !@form_to_show.surgery_only_texts[locale].blank?
@surgery_only_texts = @form_to_show.surgery_only_texts[locale]
@surgery_only_texts.insert(0,'<p class="show"><span>')
@surgery_only_texts = @surgery_only_texts.gsub('{{Surgery_only}}','<span class="'+@therapy_names[0]+' Overall_Survival">'+@servive_ratio.round.to_s+'</span><span>')
@surgery_only_texts = @surgery_only_texts.gsub('{{surgery_year}}','</span><span class="surgery_year">'+@years[-1].to_s+'</span><span>')
@surgery_only_texts += '</span>'
else
@surgery_only_texts = ''
end
result['texts'] += @surgery_only_texts
result['texts'] += '<span class="addition">'+@form_to_show.extra_texts[locale]+'</span><div class="extra-text" style="display:none;"><div class="texts_show" style="clear:both;"></div></div></p>'
result['extra_therapy_texts'] = @form_to_show.extra_therapy_texts[locale] rescue @form_to_show.extra_therapy_texts['zh_tw']

View File

@ -7,30 +7,30 @@ class Cancerpredictfields
include OrbitTag::Taggable
include OrbitCategory::Categorizable
field :title ,type:String ,default:""
field :form_show , :type=> Hash ,default:{0=>{:variable=>"sex",:name=>{"zh_tw"=>"性別<br/>(Sex)","en"=>"Sex"},:is_num=>0, :hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>'Age must be between 18 and 93'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['男','女'],"en"=>['Male','Female']},:range=>[],:right=>0,:is_float=>0},
1=>{:variable=>"age",:name=>{"zh_tw"=>"年齡<br/>(Age)","en"=>"Age"},:is_num=>1, :hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>'Age must be between 18 and 93'} , :comment_text=>{'zh_tw'=>'年齡為該婦女於確診罹患乳癌時之年齡','en'=>'Age at diagnosis'}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[18.93],:right=>0,:is_float=>0},
2=>{:variable=>"calcification_score",:name=>{"zh_tw"=>"鈣化指數<br/>(Calcification score)","en"=>"Calcification score"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[],:right=>0,:is_float=>0}
}
field :form_show_in_result , :type=> Hash ,default:{0=>{:variable=>"hormone_therapy",:name=>{"zh_tw"=>"賀爾蒙治療","en"=>"Hormone/Steroid therapy"},:is_num=>0, :hint=>{'zh_tw'=>'適用賀爾蒙受體陽性病人','en'=>'Hormone/ steroid therapy is available when ER status is positive'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},
1=>{:variable=>"Chemotherapy",:name=>{"zh_tw"=>"化學治療","en"=>"Chemotherapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},
2=>{:variable=>"Radiotherapy",:name=>{"zh_tw"=>"放射治療","en"=>"Radiotherapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},
3=>{:variable=>"Targeted_therapy",:name=>{"zh_tw"=>"標靶治療","en"=>"Targeted therapy"},:is_num=>0,:hint=>{'zh_tw'=>'抗HER2治療','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]}
field :form_show , :type=> Hash ,default:{0=>{:variable=>"sex",:name=>{"zh_tw"=>"性別<br/>(Sex)","en"=>"Sex"},:is_num=>0, :hint=>{'zh_tw'=>'','en'=>''} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['男','女'],"en"=>['Male','Female']},:range=>[],:right=>0,:is_float=>0},
1=>{:variable=>"age",:name=>{"zh_tw"=>"年齡<br/>(Age)","en"=>"Age"},:is_num=>1, :hint=>{'zh_tw'=>'從 20 歲(含)開始至 98 歲','en'=>'Age must be between 20 and 98'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[20,98],:right=>0,:is_float=>0},
2=>{:variable=>"calcification_score",:name=>{"zh_tw"=>"鈣化指數<br/>(Calcification score)","en"=>"Calcification score"},:is_num=>1,:hint=>{'zh_tw'=>'請輸入0到5000的數字','en'=>'Please enter a number between 0 and 5000'}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[0,5000],:right=>0,:is_float=>1}
}
field :form_show_in_result , :type=> Hash ,default:{}#{0=>{:variable=>"hormone_therapy",:name=>{"zh_tw"=>"賀爾蒙治療","en"=>"Hormone/Steroid therapy"},:is_num=>0, :hint=>{'zh_tw'=>'適用賀爾蒙受體陽性病人','en'=>'Hormone/ steroid therapy is available when ER status is positive'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},
#1=>{:variable=>"Chemotherapy",:name=>{"zh_tw"=>"化學治療","en"=>"Chemotherapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},
#2=>{:variable=>"Radiotherapy",:name=>{"zh_tw"=>"放射治療","en"=>"Radiotherapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},
#3=>{:variable=>"Targeted_therapy",:name=>{"zh_tw"=>"標靶治療","en"=>"Targeted therapy"},:is_num=>0,:hint=>{'zh_tw'=>'抗HER2治療','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]}
#}
field :form_result_is_right , :type=> Integer ,default: 0
field :text_descibe ,type:Hash ,default:{"zh_tw"=>"歡迎使用台灣心血管疾病預後預測系統<br />本預測系統由全民健保資料庫2017年~2019年間共1964位病人電腦斷層影像所建立之預測模型<br />請在下方填入相關資訊","en"=>"Welcome to the Taiwan Breast Cancer Prediction System!<br/>The prediction system is constructed using clinical data from 90,841 breast cancer patients in the Taiwan Cancer Registry database between 2011 to 2015, and validated using clinical data from 49,374 breast cancer patients in the U.S.-based Surveillance, Epidemiology and End Results (SEER) database. <br/>To start, please select the information below."}
field :small ,type:Hash ,default:{'font_size'=>"0.825em",'active'=>0}
field :medium ,type:Hash ,default:{'font_size'=>"1em",'active'=>1}
field :large ,type:Hash ,default:{'font_size'=>"1.25em",'active'=>0}
field :head_images_id ,type:Array , default: [BSON::ObjectId('5df62cfc8cd8924e79000009'), BSON::ObjectId('5df745a58cd8924491000006'), BSON::ObjectId('5df745a58cd8924491000007'), BSON::ObjectId('5df745a58cd8924491000008'), BSON::ObjectId('5df745a58cd8924491000009')]
field :title_images_id ,type:Array , default: [BSON::ObjectId('5df87cd88cd8924491000036')]
field :title_texts ,type:Hash ,default:{'zh_tw'=>'華人癌症存活預測','en'=>'Asian breast cancer prediction'}
field :table_above_texts ,type:Hash ,default:{'zh_tw'=>"下表之分析為針對手術後病人,根據選定的術後治療,分別估計在第1年、3及5年的存活率。",'en'=>'The analysis is for women who had undergone surgery.The table shows the 1-, 3- and 5-year survival rates,based on the treatment you have selected.'}
field :text_above_texts ,type:Hash ,default:{'zh_tw'=>"此研究分析來自已接受根除性手術後之婦女所得之結果,根據您所輸入的資訊以及治療方式,在術後<br/>第{{years}}年,",'en'=>'The analysis is for women who had undergone surgery. Base on the information and the treatment you have selected, the predictions of survival status<br/>{{years}}'}
field :surgery_only_texts ,type:Hash ,default:{'zh_tw'=>'100 位只接受根除性手術的婦女中,有{{Surgery_only}}位婦女,術後{{surgery_year}}年仍為存活','en'=>'after surgery are as follows:<br/>{{Surgery_only}} out of 100 women treated with surgery only are alive at {{surgery_year}} years.'}
field :head_images_id ,type:Array , default: []
field :title_images_id ,type:Array , default: []
field :title_texts ,type:Hash ,default:{'zh_tw'=>'臺灣心血管疾病存活預測','en'=>'Cardiovascular Disease Survival Forecast in Taiwan'}
field :table_above_texts ,type:Hash ,default:{'zh_tw'=>"下表之分析為針對手術後病人,根據選定的術後治療,分別估計在半年、一年及一年半的再住院或死亡機率。",'en'=>'The analysis is for women who had undergone surgery.The table shows the 0.5-, 1- and 1.5-year survival rates,based on the treatment you have selected.'}
field :text_above_texts ,type:Hash ,default:{'zh_tw'=>"此研究分析來自於照射胸部電腦斷層所得之結果,根據您所輸入的資訊,在第{{years}}年內有2.69%的機率可能再住院或死亡{{Surgery_only}}%。",'en'=>'此研究分析來自於照射胸部電腦斷層所得之結果,根據您所輸入的資訊,在第{{years}}年內有2.69%的機率可能再住院或死亡{{Surgery_only}}%。'}
field :surgery_only_texts ,type:Hash ,default:{'zh_tw'=>'','en'=>''}
field :extra_texts ,type:Hash ,default:{'zh_tw'=>',此外','en'=>''}
field :extra_therapy_texts ,type:Hash ,default:{'zh_tw'=>'100 位在術後有接受{{extra_therapy}}的婦女中,有{{survival_num}}位婦女,術後{{surgery_year}}年仍為存活(多了{{Additional_Benefit}}位)','en'=>'{{survival_num}} out of 100 women treated with {{extra_therapy}} are alive (an extra {{Additional_Benefit}})'}
field :danger_texts ,type:Hash ,default:{'zh_tw'=>'請注意紅框的輸入資料是否符合要求!','en'=>'Please check whether input data in red blocks are correct!'}
field :years ,type:Array ,default:[1,3,5]
field :years ,type:Array ,default:[0.5,1,1.5]
field :texts_between_Result_and_result_block ,type:Hash ,default:{'zh_tw'=>'如果欲將預測結果應用於臨床上,請務必與您的主治醫師討論後再做最後決定。','en'=>'Please note that the patients need to consult with their medical doctors before making any decision.'}
#field :image_uploader ,type:Object
scope :can_display, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc],[:postdate, :desc])}

View File

@ -217,6 +217,7 @@
<% end %>
<div style="clear:both;"></div>
<% end %>
<% if (!@form_to_show.form_show_in_result.blank? rescue false) %>
<table>
<thead>
<tr>
@ -257,6 +258,7 @@
<%end%>
</tbody>
</table>
<% end %>
<%=form.submit "#{t(:updatefont)}",{:id=>"updatebtn"}%>
<%end%>
<link href="/assets/admin/cancerpredict.css" media="screen" rel="stylesheet">