diff --git a/app/assets/javascripts/cancer_predict.js b/app/assets/javascripts/cancer_predict.js index 05a146b..e8b2549 100644 --- a/app/assets/javascripts/cancer_predict.js +++ b/app/assets/javascripts/cancer_predict.js @@ -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 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(){ diff --git a/app/controllers/admin/cancerpredicts_controller.rb b/app/controllers/admin/cancerpredicts_controller.rb index a4a6679..51e00ea 100644 --- a/app/controllers/admin/cancerpredicts_controller.rb +++ b/app/controllers/admin/cancerpredicts_controller.rb @@ -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 += '
' + @table_str_left += '
' else if @field_property["range"] == [] @table_str_left += '
' @@ -325,22 +325,26 @@ class Admin::CancerpredictsController < OrbitAdminController end if @field_property["is_num"] == 1 if @field_property["is_float"] == 1 - @table_str_right += '
' + @table_str_right += '
' else - @table_str_right += '
' - @table_str_right += '' - @table_str_right += '' - @please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice" - @table_str_right += '
' + else + @table_str_right += '
' + @table_str_right += '' + @table_str_right += '' + @please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice" + @table_str_right += '
' end - for @num in @field_property["range"][0] .. @field_property["range"][1] - @table_str_right += ('') - end - @table_str_right += '' end else @table_str_right += '
' @@ -412,22 +416,26 @@ class Admin::CancerpredictsController < OrbitAdminController end if @field_property["is_num"] == 1 if @field_property["is_float"] == 1 - @table_result_choice_fileds += '
' + @table_result_choice_fileds += '
' else - @table_result_choice_fileds += '
' - @table_result_choice_fileds += '
' - @table_str_left += '' - @please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice" - @table_result_choice_fileds += '
' + else + @table_result_choice_fileds += '
' + @table_result_choice_fileds += '
' + @table_str_left += '' + @please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice" + @table_result_choice_fileds += '
' end - for @num in @field_property["range"][0] .. @field_property["range"][1] - @table_result_choice_fileds += ('') - end - @table_result_choice_fileds += '
' end else @table_result_choice_fileds += '
' diff --git a/app/controllers/cancerpredicts_controller.rb b/app/controllers/cancerpredicts_controller.rb index 262f028..1aaf2e1 100644 --- a/app/controllers/cancerpredicts_controller.rb +++ b/app/controllers/cancerpredicts_controller.rb @@ -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'] = '

'+@form_to_show.table_above_texts[locale]+'

' + result['table'] = '

'+@form_to_show.table_above_texts[locale].to_s+'

' result['table'] += (''+(locale == 'zh_tw' ? '第' : '')+'') result['years'] = @years @years.each{|year| result['table'] += ('')} @@ -179,7 +83,9 @@ class CancerpredictsController < ApplicationController end result['table'] += '' end - @texts = @form_to_show.text_above_texts[locale].gsub('
','
') + @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('
','

').gsub('{{Surgery_only}}',''+@servive_ratio.round(2).to_s+'') @texts = @texts.split('{{years}}') @texts.delete('') result['texts'] = ''+@texts[0] @@ -189,13 +95,15 @@ class CancerpredictsController < ApplicationController else result['texts'] += '' end - @lpv_calc = [-0.001476145,-0.01261639,-0.02519608] - @servive_ratio = ((Math.exp(@lpv_calc[-1])**(Math.exp(result['lpv'])))*100).round(2) - @surgery_only_texts = @form_to_show.surgery_only_texts[locale] - @surgery_only_texts.insert(0,'

') - @surgery_only_texts = @surgery_only_texts.gsub('{{Surgery_only}}',''+@servive_ratio.round.to_s+'') - @surgery_only_texts = @surgery_only_texts.gsub('{{surgery_year}}',''+@years[-1].to_s+'') - @surgery_only_texts += '' + if !@form_to_show.surgery_only_texts[locale].blank? + @surgery_only_texts = @form_to_show.surgery_only_texts[locale] + @surgery_only_texts.insert(0,'

') + @surgery_only_texts = @surgery_only_texts.gsub('{{Surgery_only}}',''+@servive_ratio.round.to_s+'') + @surgery_only_texts = @surgery_only_texts.gsub('{{surgery_year}}',''+@years[-1].to_s+'') + @surgery_only_texts += '' + else + @surgery_only_texts = '' + end result['texts'] += @surgery_only_texts result['texts'] += ''+@form_to_show.extra_texts[locale]+'

' result['extra_therapy_texts'] = @form_to_show.extra_therapy_texts[locale] rescue @form_to_show.extra_therapy_texts['zh_tw'] diff --git a/app/models/cancerpredictfields.rb b/app/models/cancerpredictfields.rb index b25711b..3db1b55 100644 --- a/app/models/cancerpredictfields.rb +++ b/app/models/cancerpredictfields.rb @@ -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"=>"性別
(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"=>"年齡
(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"=>"鈣化指數
(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"=>"性別
(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"=>"年齡
(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"=>"鈣化指數
(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"=>"歡迎使用台灣心血管疾病預後預測系統
本預測系統由全民健保資料庫2017年~2019年間共1964位病人電腦斷層影像所建立之預測模型
請在下方填入相關資訊","en"=>"Welcome to the Taiwan Breast Cancer Prediction System!
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.
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'=>"此研究分析來自已接受根除性手術後之婦女所得之結果,根據您所輸入的資訊以及治療方式,在術後
第{{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
{{years}}'} - field :surgery_only_texts ,type:Hash ,default:{'zh_tw'=>'100 位只接受根除性手術的婦女中,有{{Surgery_only}}位婦女,術後{{surgery_year}}年仍為存活','en'=>'after surgery are as follows:
{{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])} diff --git a/app/views/admin/cancerpredicts/index.html.erb b/app/views/admin/cancerpredicts/index.html.erb index 8b5548b..c22c15b 100644 --- a/app/views/admin/cancerpredicts/index.html.erb +++ b/app/views/admin/cancerpredicts/index.html.erb @@ -217,46 +217,48 @@ <% end %>
<% end %> - - - - <% @form_to_show.form_show_in_result.values[1].each do |key,vlaue|%> - - <%end%> - - - - <%= form.fields_for :form_show_in_result do |formfield|%> - <% @form_to_show.form_show_in_result.each do |num,property| %> - <%=formfield.fields_for num.to_s do |make_fields|%> - - <% property.each do |key,value|%> - <% @value= value %> - <% if @value.class == BSON::Document || @value.class == Hash %> - <% @disp_value = @value[I18n.locale.to_s] rescue "" %> - <%else%> - <% @disp_value = @value %> - <%end%> - <% if @value.class == Fixnum %> - <% if @value == 1%> - - <% else%> - + <% if (!@form_to_show.form_show_in_result.blank? rescue false) %> +
<%=key%>
<%= make_fields.check_box key,{:checked=>true,:class=>"checkbox",:style=>"float:left;"}%><%= make_fields.check_box key,{:checked=>false,:class=>"checkbox",:style=>"float:left;"}%>
+ + + <% @form_to_show.form_show_in_result.values[1].each do |key,vlaue|%> + + <%end%> + + + + <%= form.fields_for :form_show_in_result do |formfield|%> + <% @form_to_show.form_show_in_result.each do |num,property| %> + <%=formfield.fields_for num.to_s do |make_fields|%> + + <% property.each do |key,value|%> + <% @value= value %> + <% if @value.class == BSON::Document || @value.class == Hash %> + <% @disp_value = @value[I18n.locale.to_s] rescue "" %> + <%else%> + <% @disp_value = @value %> <%end%> - <% elsif @value.class == BSON::Document || @value.class == Hash %> - <%=make_fields.fields_for I18n.locale.to_s do |locale_fields|%> - + <% if @value.class == Fixnum %> + <% if @value == 1%> + + <% else%> + + <%end%> + <% elsif @value.class == BSON::Document || @value.class == Hash %> + <%=make_fields.fields_for I18n.locale.to_s do |locale_fields|%> + + <%end%> + <% else %> + <%end%> - <% else %> - <%end%> + <%end%> - <%end%> <%end%> - <%end%> - -
<%=key%>
<%= locale_fields.text_field key,{:value=>@disp_value}%><%= make_fields.check_box key,{:checked=>true,:class=>"checkbox",:style=>"float:left;"}%><%= make_fields.check_box key,{:checked=>false,:class=>"checkbox",:style=>"float:left;"}%><%= locale_fields.text_field key,{:value=>@disp_value}%><%= make_fields.text_field key,{:value=>@disp_value}%><%= make_fields.text_field key,{:value=>@disp_value}%>
+ + + <% end %> <%=form.submit "#{t(:updatefont)}",{:id=>"updatebtn"}%> <%end%>