From 62045584fc72de2be2f221c3c28688fccb21b06c Mon Sep 17 00:00:00 2001 From: BOHUNG Date: Tue, 28 Jan 2020 18:29:04 +0800 Subject: [PATCH] push from final_version to master --- app/assets/javascripts/cancer_predict.js | 39 +-- app/assets/stylesheets/cancer_predict.scss | 14 +- .../stylesheets/cancer_predict_print.scss | 14 +- .../admin/cancerpredicts_controller.rb | 246 +++++++++++++++++- app/controllers/cancerpredicts_controller.rb | 228 +--------------- app/models/cancerpredictfields.rb | 5 +- app/views/admin/cancerpredicts/index.html.erb | 2 +- .../admin/cancerpredicts/showSubmit.html.erb | 3 + config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + 10 files changed, 301 insertions(+), 252 deletions(-) diff --git a/app/assets/javascripts/cancer_predict.js b/app/assets/javascripts/cancer_predict.js index 5ddd4b2..05a146b 100644 --- a/app/assets/javascripts/cancer_predict.js +++ b/app/assets/javascripts/cancer_predict.js @@ -15,6 +15,9 @@ $(document).ready(function(){ $('#cancer_table .cencer_table_name').css('max-width','39%'); }; }; + function round(num,Digit){ + return Math.round(Number(num)*(10**Digit))/(10**Digit); + }; head_data.done(function(){ // $('.header-nav').html(head_images.responseJSON['head_images']); // $('.navbar-brand').html(head_images.responseJSON['title']) @@ -353,11 +356,11 @@ $(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.round((Math.exp(lpv_calc[year])**Math.exp(lpv_current))*100); + var servive_ratio = round((Math.exp(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+'%'); - $('tr.'+arguments[0]+' td.Additional_Benefit').html(benefit+'%'); + $('tr.'+arguments[0]+' td.Additional_Benefit').html(round(benefit,2)+'%'); $('tr.'+arguments[0]).css('display','table-row'); $('tr.tr_show').eq(-1).after($('tr.'+arguments[0])); $('tr.'+arguments[0]).addClass('tr_show'); @@ -378,9 +381,9 @@ $(document).ready(function(){ add_choices_str = add_choices_transform[0]; var extra_therapy_texts = result.responseJSON['extra_therapy_texts']; extra_therapy_texts = extra_therapy_texts.replace('{{extra_therapy}}',''+add_choices_str+''); - extra_therapy_texts = extra_therapy_texts.replace('{{survival_num}}',''+servive_ratio+''); + extra_therapy_texts = extra_therapy_texts.replace('{{survival_num}}',''+Math.round(servive_ratio)+''); extra_therapy_texts = extra_therapy_texts.replace('{{surgery_year}}',''+year+''); - extra_therapy_texts = extra_therapy_texts.replace('{{Additional_Benefit}}',''+benefit+''); + extra_therapy_texts = extra_therapy_texts.replace('{{Additional_Benefit}}',''+Math.round(benefit)+''); var new_text = '

'; new_text += (extra_therapy_texts+'

'); $('#result_text_content .extra-text .texts_show').eq(-1).after(new_text) @@ -396,13 +399,13 @@ $(document).ready(function(){ 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.round((Math.exp(lpv_calc[year])**Math.exp(lpv_real[i]))*100); + var servive_ratio = round((Math.exp(lpv_calc[year])**Math.exp(lpv_real[i]))*100,2); servive_ratio_arr[i] = servive_ratio; var benefit = servive_ratio - ((i == index+1) ? servive_ratio_arr[index - 1] : servive_ratio_arr[i - 1]); $('tr.'+active_treatment[i]+' td.Overall_Survival').html(servive_ratio+'%'); - $('.'+active_treatment[i]+'.Overall_Survival').html(servive_ratio); - $('tr.'+active_treatment[i]+' td.Additional_Benefit').html(benefit+'%'); - $('.'+active_treatment[i]+'.Additional_Benefit').html(benefit); + $('.'+active_treatment[i]+'.Overall_Survival').html(Math.round(servive_ratio)); + $('tr.'+active_treatment[i]+' td.Additional_Benefit').html(round(benefit,2)+'%'); + $('.'+active_treatment[i]+'.Additional_Benefit').html(Math.round(benefit)); }; var add_choices = []; for(var i = 1;i < this.length; i++){ @@ -412,9 +415,9 @@ $(document).ready(function(){ for(var j = 0;j= 2) - add_choices_str += ('以及'+add_choices_transform[add_choices_transform.length-1]) + add_choices_str += ((I18n.locale == 'en' ? ', and ': '以及')+add_choices_transform[add_choices_transform.length-1]) else add_choices_str = add_choices_transform[0]; $('.'+active_treatment[i]+'.choices').html(add_choices_str); @@ -425,15 +428,17 @@ $(document).ready(function(){ $('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(); + $('span.'+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'); }; + console.log(this) return Array.prototype.remove_item_from_array.apply(this, arguments); }else{ + console.log(this) return Array.prototype.remove_item_from_array.apply(this, arguments); }; }; @@ -544,17 +549,17 @@ $(document).ready(function(){ function calculate_and_change_result_value(obj){ obj.servive_ratio_arr = []; for(var i = 0;i' + @table_str += '
'+@form_to_show.text_descibe[current_locale] +'
' + @table_str += '
'+'' + @size.each{|size_key,size_value| @table_str += ('' )} + @table_str += '
' + @table_str_left = '
' + @table_str_right = '
' + @form_to_show.form_show.each do |num,property| + @field_property = {} + property.each do |key,value| + @value= value + if @value.class == BSON::Document || @value.class == Hash + @disp_value = @value[current_locale] rescue "" + else + @disp_value = @value + end + @field_property[key] = @disp_value + end + if @field_property['right'] == 0 + @table_str_left += '
' + break if @field_property["name"] == "" + @table_str_left += '' + if @field_property["comment_text"] != "" + @table_str_left += '' + @table_str_left += '' + else + @site_locales = current_site.in_use_locales + @site_locales.delete(current_locale) + @site_locales.each do |locale| + next if property["comment_text"][locale.to_s] == "" + @field_property["comment_text"] = property["comment_text"][locale.to_s] + break + end + if @field_property["comment_text"] != "" + @table_str_left += '' + @table_str_left += '' + else + @table_str_left += '
' + end + end + if @field_property["is_num"] == 1 + if @field_property["is_float"] == 1 + @table_str_left += '
' + else + @table_str_left += '
' + @table_str_left += '' + @table_str_left += '' + @please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice" + @table_str_left += '
' + end + else + @table_str_left += '
' + @field_property["choice_fields"].each do |create_choice| + @table_str_left += '' + @table_str_left += '' + end + @table_str_left += '
' + end + if @field_property["hint"].to_s != "" + @table_str_left +='
'+@field_property["hint"]+'
' + end + @table_str_left += '
' + else + @table_str_right += '
' + break if @field_property["name"] == "" + @table_str_right += '' + if @field_property["comment_text"] != "" + @table_str_right += '' + @table_str_right += '' + else + @site_locales = current_site.in_use_locales + @site_locales.delete(current_locale) + @site_locales.each do |locale| + next if property["comment_text"][locale.to_s] == "" + @field_property["comment_text"] = property["comment_text"][locale.to_s] + break + end + if @field_property["comment_text"] != "" + @table_str_right += '' + @table_str_right += '' + else + @table_str_right += '
' + end + end + if @field_property["is_num"] == 1 + if @field_property["is_float"] == 1 + @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 + else + @table_str_right += '
' + @field_property["choice_fields"].each do |create_choice| + @table_str_right += '' + @table_str_right += '' + end + @table_str_right += '
' + end + if @field_property["hint"].to_s != "" + @table_str_right +='
'+@field_property["hint"]+'
' + end + @table_str_right += '
' + end + end + @table_str_left += '
' + @table_str_right += '
' + @table_str += (@table_str_left+@table_str_right) + @table_str +='
' + @table_result_str = '
'+t("cancerpredict.table.result").to_s+'
' + @tab_name = ['table','text'] + @table_result_str +='
' + @form_to_show.texts_between_Result_and_result_block[current_locale]+'
' + @table_result_str += '
' + @tab_name.each_with_index{|name,index| @table_result_str += ('
')} + @table_result_str += '
' + @tab_name.each{|name| @table_result_str += ''} + @table_result_str += '
' + @table_button = '
' + @submit_btn_str='' + @reset_btn_str='' + @table_button += (@submit_btn_str+@reset_btn_str+'
') + @table_result_choice_fileds = '
' if @form_to_show.form_result_is_right == 1 + @table_result_choice_fileds = '
' if @form_to_show.form_result_is_right == 0 + @table_result_choice_fileds += ''+t('cancerpredict.table.Therapy_choice').to_s+'
' + @table_result_choice_fileds += '
' + @form_to_show.form_show_in_result.each do |num,property| + @field_property = {} + property.each do |key,value| + @value= value + if @value.class == BSON::Document || @value.class == Hash + @disp_value = @value[current_locale.to_s] rescue "" + else + @disp_value = @value + end + @field_property[key] = @disp_value + end + @table_result_choice_fileds += '
' + break if @field_property["name"] == "" + @table_result_choice_fileds += '' + if @field_property["comment_text"] != "" + @table_result_choice_fileds += '' + @table_result_choice_fileds += '' + else + @site_locales = current_site.in_use_locales + @site_locales.delete(current_locale) + @site_locales.each do |locale| + next if property["comment_text"][locale.to_s] == "" + @field_property["comment_text"] = property["comment_text"][locale.to_s] + break + end + if @field_property["comment_text"] != "" + @table_result_choice_fileds += '' + @table_result_choice_fileds += '' + else + @table_result_choice_fileds += '
' + end + end + if @field_property["is_num"] == 1 + if @field_property["is_float"] == 1 + @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 + else + @table_result_choice_fileds += '
' + @field_property["choice_fields"].each do |create_choice| + @table_result_choice_fileds += '' + @table_result_choice_fileds += '' + end + @table_result_choice_fileds += '
' + end + if @field_property["hint"].to_s != "" + @table_result_choice_fileds +='
'+@field_property["hint"]+'
' + end + @table_result_choice_fileds += '
' + end + @table_result_choice_fileds += '
' + @table_str += (@table_button+'
'+@table_result_str+@table_result_choice_fileds+'
'+'
') + return @table_str + end def showSubmit @results = Cancerpredictrecord.where("title"=>@app_title).take_while{true} @variables = [] @@ -243,6 +479,14 @@ class Admin::CancerpredictsController < OrbitAdminController @form_to_show.title=@app_title @form_to_show.save @form_to_show = Cancerpredictfields.where("title"=>@app_title).first + Dir.chdir("public") do + @site_locales = Site.last.in_use_locales.each do |locale| + @file_tmp = File.new('cancer_tool_table_tmp_'+locale.to_s+'.txt', 'w') + tmp_table_texts = create_table(locale) + @file_tmp.write(tmp_table_texts) + @file_tmp.close + end + end else @form_to_show = Cancerpredictfields.where("title"=>@app_title).first end diff --git a/app/controllers/cancerpredicts_controller.rb b/app/controllers/cancerpredicts_controller.rb index 7995a21..45c024b 100644 --- a/app/controllers/cancerpredicts_controller.rb +++ b/app/controllers/cancerpredicts_controller.rb @@ -108,7 +108,7 @@ class CancerpredictsController < ApplicationController 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']['ER_status'].to_i == 2 && params['data']['PR_status'].to_i == 2 && (params['data']['HER2_status'].to_i == 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 @@ -190,7 +190,7 @@ class CancerpredictsController < ApplicationController result['texts'] += '' end @lpv_calc = [-0.001476145,-0.01261639,-0.02519608] - @servive_ratio = ((Math.exp(@lpv_calc[-1])**(Math.exp(result['lpv'])))*100).round + @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+'') @@ -211,229 +211,7 @@ class CancerpredictsController < ApplicationController uid = OrbitHelper.params[:uid] rescue "" tags = OrbitHelper.widget_tags categories = OrbitHelper.widget_categories || [] - create_first_field - @size = {} - @size_name = ['small','medium','large'] - @size_name.each{|name| @size[name] = @form_to_show[name]['font_size']} - @size_active_size = '' - @size.each{|size_key,size_value| (@form_to_show[size_key]['active'].to_i == 1) ? ( @size_active_size = size_value ): nil } - @table_str = '

' - @table_str += '
'+@form_to_show.text_descibe[I18n.locale.to_s] +'
' - @table_str += '
'+'' - @size.each{|size_key,size_value| @table_str += ('' )} - @table_str += '
' - @table_str_left = '
' - @table_str_right = '
' - @form_to_show.form_show.each do |num,property| - @field_property = {} - 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 - @field_property[key] = @disp_value - end - if @field_property['right'] == 0 - @table_str_left += '
' - break if @field_property["name"] == "" - @table_str_left += '' - if @field_property["comment_text"] != "" - @table_str_left += '' - @table_str_left += '' - else - @site_locales = current_site.in_use_locales - @site_locales.delete(I18n.locale) - @site_locales.each do |locale| - next if property["comment_text"][locale.to_s] == "" - @field_property["comment_text"] = property["comment_text"][locale.to_s] - break - end - if @field_property["comment_text"] != "" - @table_str_left += '' - @table_str_left += '' - else - @table_str_left += '
' - end - end - if @field_property["is_num"] == 1 - if @field_property["is_float"] == 1 - @table_str_left += '
' - else - @table_str_left += '
' - @table_str_left += '' - @table_str_left += '' - @please_choice = (I18n.locale.to_s == "zh_tw") ? "請選擇" : "Please choice" - @table_str_left += '
' - end - else - @table_str_left += '
' - @field_property["choice_fields"].each do |create_choice| - @table_str_left += '' - @table_str_left += '' - end - @table_str_left += '
' - end - if @field_property["hint"].to_s != "" - @table_str_left +='
'+@field_property["hint"]+'
' - end - @table_str_left += '
' - else - @table_str_right += '
' - break if @field_property["name"] == "" - @table_str_right += '' - if @field_property["comment_text"] != "" - @table_str_right += '' - @table_str_right += '' - else - @site_locales = current_site.in_use_locales - @site_locales.delete(I18n.locale) - @site_locales.each do |locale| - next if property["comment_text"][locale.to_s] == "" - @field_property["comment_text"] = property["comment_text"][locale.to_s] - break - end - if @field_property["comment_text"] != "" - @table_str_right += '' - @table_str_right += '' - else - @table_str_right += '
' - end - end - if @field_property["is_num"] == 1 - if @field_property["is_float"] == 1 - @table_str_right += '
' - else - @table_str_right += '
' - @table_str_right += '' - @table_str_right += '' - @please_choice = (I18n.locale.to_s == "zh_tw") ? "請選擇" : "Please choice" - @table_str_right += '
' - end - else - @table_str_right += '
' - @field_property["choice_fields"].each do |create_choice| - @table_str_right += '' - @table_str_right += '' - end - @table_str_right += '
' - end - if @field_property["hint"].to_s != "" - @table_str_right +='
'+@field_property["hint"]+'
' - end - @table_str_right += '
' - end - end - @table_str_left += '
' - @table_str_right += '
' - @table_str += (@table_str_left+@table_str_right) - @table_str +='
' - @table_result_str = '
'+t("cancerpredict.table.result").to_s+'
' - @tab_name = ['table','text'] - @table_result_str += '
' - @tab_name.each_with_index{|name,index| @table_result_str += ('
')} - @table_result_str += '
' - @tab_name.each{|name| @table_result_str += ''} - @table_result_str += '
' - @table_button = '
' - @submit_btn_str='' - @reset_btn_str='' - @table_button += (@submit_btn_str+@reset_btn_str+'
') - @table_result_choice_fileds = '
' if @form_to_show.form_result_is_right == 1 - @table_result_choice_fileds = '
' if @form_to_show.form_result_is_right == 0 - @table_result_choice_fileds += ''+t('cancerpredict.table.Therapy_choice').to_s+'
' - @table_result_choice_fileds += '
' - @form_to_show.form_show_in_result.each do |num,property| - @field_property = {} - 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 - @field_property[key] = @disp_value - end - @table_result_choice_fileds += '
' - break if @field_property["name"] == "" - @table_result_choice_fileds += '' - if @field_property["comment_text"] != "" - @table_result_choice_fileds += '' - @table_result_choice_fileds += '' - else - @site_locales = current_site.in_use_locales - @site_locales.delete(I18n.locale) - @site_locales.each do |locale| - next if property["comment_text"][locale.to_s] == "" - @field_property["comment_text"] = property["comment_text"][locale.to_s] - break - end - if @field_property["comment_text"] != "" - @table_result_choice_fileds += '' - @table_result_choice_fileds += '' - else - @table_result_choice_fileds += '
' - end - end - if @field_property["is_num"] == 1 - if @field_property["is_float"] == 1 - @table_result_choice_fileds += '
' - else - @table_result_choice_fileds += '
' - @table_result_choice_fileds += '
' - @table_str_left += '' - @please_choice = (I18n.locale.to_s == "zh_tw") ? "請選擇" : "Please choice" - @table_result_choice_fileds += '
' - end - else - @table_result_choice_fileds += '
' - @field_property["choice_fields"].each do |create_choice| - @table_result_choice_fileds += '' - @table_result_choice_fileds += '' - end - @table_result_choice_fileds += '
' - end - if @field_property["hint"].to_s != "" - @table_result_choice_fileds +='
'+@field_property["hint"]+'
' - end - @table_result_choice_fileds += '
' - end - @table_result_choice_fileds += '
' - @table_str += (@table_button+'
'+@table_result_str+@table_result_choice_fileds+'
'+'
') + @table_str = File.read('public/cancer_tool_table_tmp_'+I18n.locale.to_s+'.txt') { "cancerpredict" => [], "extras"=>{"table"=> @table_str} diff --git a/app/models/cancerpredictfields.rb b/app/models/cancerpredictfields.rb index e675a0b..df3cc31 100644 --- a/app/models/cancerpredictfields.rb +++ b/app/models/cancerpredictfields.rb @@ -26,7 +26,7 @@ class Cancerpredictfields 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"=>"歡迎使用台灣準備乳癌預後系統!
本預測系統由台灣癌症登記資料庫2011至2015年間共90,841位乳癌病人所建立
若要開始 請在下方輸入相關資訊","en"=>"Welcome to the Taiwan Breast Cancer Prediction System!
The prediction system is constructed using 90,841 breast cancer patients’ clinical data from the Taiwan Cancer Registry database between 2011 and 2015, and validated by using 49,374 breast cancer patients’ clinical data from the US-based Surveillance, Epidemiology, and End Results (SEER) database.
To start, please enter the information below."} + field :text_descibe ,type:Hash ,default:{"zh_tw"=>"歡迎使用台灣準備乳癌預後系統!
本預測系統由台灣癌症登記資料庫2011至2015年間共90,841位乳癌病人所建立
若要開始 請在下方輸入相關資訊","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} @@ -34,12 +34,13 @@ class Cancerpredictfields 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 :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 :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 :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])} scope :is_approved, ->{where(:approved => true)} diff --git a/app/views/admin/cancerpredicts/index.html.erb b/app/views/admin/cancerpredicts/index.html.erb index b5afb3c..c6bf933 100644 --- a/app/views/admin/cancerpredicts/index.html.erb +++ b/app/views/admin/cancerpredicts/index.html.erb @@ -205,7 +205,7 @@
<%= form.check_box "form_result_is_right",{:checked=>false,:class=>"checkbox",:style=>"float: left;position: relative;left: 0;transform: none!important;margin-left: 1em;",:id=>"form_result_is_right"}%>
<%end%>
- <% @create_items = ['years','table_above_texts','text_above_texts','surgery_only_texts','extra_texts','extra_therapy_texts','danger_texts'] %> + <% @create_items = ['years','table_above_texts','text_above_texts','surgery_only_texts','extra_texts','extra_therapy_texts','danger_texts','texts_between_Result_and_result_block'] %> <% @create_items.each do |item|%> <% if @form_to_show[item].class == BSON::Document || @form_to_show[item].class == Hash %> diff --git a/app/views/admin/cancerpredicts/showSubmit.html.erb b/app/views/admin/cancerpredicts/showSubmit.html.erb index fd99586..0ddb918 100644 --- a/app/views/admin/cancerpredicts/showSubmit.html.erb +++ b/app/views/admin/cancerpredicts/showSubmit.html.erb @@ -2,6 +2,7 @@ <% if !@results[0].nil? %> + <%=((I18n.locale=="en") ? 'submit time' : '提交時間') %> <% @results[0].names.each do |key,name|%> <%=name[I18n.locale.to_s].to_s.html_safe %> <%end%> @@ -17,6 +18,7 @@ + <% result.names.each do |key,name|%> <%end%> @@ -25,6 +27,7 @@ <% end %> + <% result.result.each do |key,value| %> <% @key_len %> <% if key != "locale" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 38abef7..45486c7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -22,6 +22,7 @@ en: extra_texts: Extra texts extra_therapy_texts: Extra therapy texts danger_texts: Warning texts + texts_between_Result_and_result_block: Texts between "Result" and "Result block" table: welcome: Welcome to The after breast cancer healing system of Taiwanprepare!\nTo start, please enter the relevant information below. Reset: Reset diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index d8f1114..07c3ae3 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -22,6 +22,7 @@ zh_tw: extra_texts: 額外文字 extra_therapy_texts: 額外治療的文字 danger_texts: 警告文字 + texts_between_Result_and_result_block: 在"結果"和"結果區塊"之間的文字 table: welcome: 歡迎使用台灣準備乳癌癒後系統!\n若要開始 請在下方輸入相關資訊 Reset: 重置
<%=((I18n.locale=="en") ? 'submit time' : '提交時間') %><%=name[I18n.locale.to_s].to_s.html_safe %>
<%= result.created_at %>