diff --git a/app/assets/javascripts/cancer_predict.js b/app/assets/javascripts/cancer_predict.js index 8af32b1..0d45038 100644 --- a/app/assets/javascripts/cancer_predict.js +++ b/app/assets/javascripts/cancer_predict.js @@ -215,6 +215,7 @@ $(document).ready(function(){ }; function set_result(result){ if(result.responseJSON.lpv != "error"){ + $('#choice_fields').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'); @@ -534,7 +535,7 @@ $(document).ready(function(){ 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) + if( Number(result_json['grade']) == 2 || Number(result_json['grade']) == 4) result['grade_2'] = 1; else result['grade_2'] = 0; diff --git a/app/assets/stylesheets/cancer_predict.css b/app/assets/stylesheets/cancer_predict.scss similarity index 95% rename from app/assets/stylesheets/cancer_predict.css rename to app/assets/stylesheets/cancer_predict.scss index a3ad786..e7e8321 100644 --- a/app/assets/stylesheets/cancer_predict.css +++ b/app/assets/stylesheets/cancer_predict.scss @@ -4,8 +4,10 @@ .head_logo{ height: 4em; } -@media screen and (max-width: 48em) .navbar-brand{ - width: 100%; +@media screen and (max-width: 48em){ + .navbar-brand{ + width: 100%; + } } .navbar-brand>img.head_logo{ width: 70%; @@ -21,9 +23,18 @@ .cencer_table_name{ display: inline-block; vertical-align: middle; - width: 8.25em; color:#5d7ca2; } +@media screen and (min-width: 48em){ + .cencer_table_name{ + width: 16.25em; + } +} +@media screen and (max-width: 47.875em){ + .cencer_table_name{ + width: 12.25em; + } +} .cancer_table_btn{ margin-right: 0.5em; color:#5d7ca2; @@ -262,6 +273,9 @@ input.float_num{ #result_table_content table tbody tr:first-of-type{ display: table-row; } +.white_text,.white_text:link,.white_text:visited{ + color:white; +} .cancer_th{ color: white; background-color: #003d79; diff --git a/app/controllers/cancerpredicts_controller.rb b/app/controllers/cancerpredicts_controller.rb index 341b862..85e361d 100644 --- a/app/controllers/cancerpredicts_controller.rb +++ b/app/controllers/cancerpredicts_controller.rb @@ -33,7 +33,15 @@ class CancerpredictsController < ApplicationController else @record = Cancerpredictrecord.new @record.title = @app_title - params['data'].each do |rec_key,rec_value| + @choice_keys = [] + @choice_values = [] + @choice_names = [] + @form_to_show.form_show.values.each{|choice| @choice_keys.push choice[:variable]} + @form_to_show.form_show.values.each{|choice| @choice_values.push choice[:choice_fields]} + @form_to_show.form_show.values.each{|choice| @choice_names.push choice[:name]} + @choice_keys.each_with_index{|key,i| @record.names[key] = @choice_names[i]} + @choice_keys.each_with_index{|key,i| @record.values[key] = @choice_values[i]} + params['data'].each do |rec_key,rec_value| @record.result[rec_key] = rec_value end @record.submit_time = Time.now.to_s @@ -95,7 +103,7 @@ class CancerpredictsController < ApplicationController 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 + if params['data']['grade'].to_i == 2 || params['data']['grade'].to_i == 4 result['grade_2'] = 1 else result['grade_2'] = 0 @@ -186,7 +194,7 @@ class CancerpredictsController < ApplicationController @table_str += '
'+@form_to_show.text_descibe[I18n.locale.to_s] +'
' @size = {'small'=>@form_to_show.small,'medium'=>@form_to_show.medium,'large'=>@form_to_show.large} @table_str += '
'+'' - @size.each{|size_key,size_value| @table_str += ('' )} + @size.each{|size_key,size_value| @table_str += ('' )} @table_str += '
' @table_str_left = '
' @table_str_right = '
' @@ -289,7 +297,7 @@ class CancerpredictsController < ApplicationController @tab_name.each{|name| @table_result_str += ''} @table_result_str += '
' @table_button = '
' - @submit_btn_str='' + @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 diff --git a/app/models/cancerpredictfields.rb b/app/models/cancerpredictfields.rb index 53e2e1a..2791799 100644 --- a/app/models/cancerpredictfields.rb +++ b/app/models/cancerpredictfields.rb @@ -10,8 +10,8 @@ class Cancerpredictfields field :form_show , :type=> Hash ,default:{0=>{:variable=>"age",:name=>{"zh_tw"=>"年齡
(age)","en"=>"age"},:is_num=>1, :hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>''} , :comment_text=>{'zh_tw'=>'年齡為該婦女於確診罹患乳癌時之年齡','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[18,93],:right=>0,:is_float=>0}, 1=>{:variable=>"size",:name=>{"zh_tw"=>"腫瘤大小
(tumor size)","en"=>"tumor size"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若有多個原發腫瘤,請輸入最大尺寸之原發腫瘤','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[1,300],:right=>0,:is_float=>0}, 2=>{:variable=>"lymph_nodes_examined",:name=>{"zh_tw"=>"區域淋巴結檢查數目
(Regional lymph nodes examined)","en"=>"Regional lymph nodes examined"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[0,90],:right=>0,:is_float=>0}, - 3=>{:variable=>"lymph_nodes_positive",:name=>{"zh_tw"=>"區域淋巴結侵犯數目
(Regional lymph nodes positive)","en"=>"Regional lymph nodes positive"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[0,90],:right=>0,:is_float=>0}, - 4=>{:variable=>"grade",:name=>{"zh_tw"=>"腫瘤級數
(tumor grade)","en"=>"tumor grade"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'腫瘤級數代表腫瘤組織與正常組織間的分化程度,若無分化級數資訊,請選擇“未知”選項,將以級數 1 進行預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['1','2','3','未知'],"en"=>['1','2','3','unknown']},:range=>[],:right=>0,:is_float=>0}, + 3=>{:variable=>"lymph_nodes_positive",:name=>{"zh_tw"=>"區域淋巴結侵犯數目
(Regional lymph nodes positive)","en"=>"Regional lymph nodes positive"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'此變項為預測重要變數,若無此資訊預測容易失真。','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[0,90],:right=>0,:is_float=>0}, + 4=>{:variable=>"grade",:name=>{"zh_tw"=>"腫瘤級數
(tumor grade)","en"=>"tumor grade"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'腫瘤級數代表腫瘤組織與正常組織間的分化程度,若無分化級數資訊,請選擇“未知”選項,將以級數 2 進行預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['1','2','3','未知'],"en"=>['1','2','3','unknown']},:range=>[],:right=>0,:is_float=>0}, 5=>{:variable=>"ER_status",:name=>{"zh_tw"=>"ER 狀態
(ER status)","en"=>"ER status"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'ER:雌激素受體,若無 ER 資訊請選擇未知,將以佔多數比例陽性作為後續預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['陽性','陰性','未知'],"en"=>['positive','negative','unknown']},:range=>[],:right=>1,:is_float=>0}, 6=>{:variable=>"PR_status",:name=>{"zh_tw"=>"PR 狀態
(PR status)","en"=>"PR status"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'PR:黃體素受體,若無 PR 資訊請選擇未知,將以佔多數比例陽性作為後續預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['陽性','陰性','未知'],"en"=>['positive','negative','unknown']},:range=>[],:right=>1,:is_float=>0}, 7=>{:variable=>"HER2_status",:name=>{"zh_tw"=>"HER2 狀態
(HER2 status),","en"=>"HER2 status"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'HER2:第二型人類上皮成長因子接受器蛋白,若無 HER2 資訊請選擇未知,將以佔多數比例陰性作為後續預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['陽性','陰性','未知'],"en"=>['positive','negative','unknown']},:range=>[],:right=>1,:is_float=>0}, diff --git a/app/models/cancerpredictrecord.rb b/app/models/cancerpredictrecord.rb index bb712f7..a073234 100644 --- a/app/models/cancerpredictrecord.rb +++ b/app/models/cancerpredictrecord.rb @@ -9,6 +9,8 @@ class Cancerpredictrecord field :title ,type:String ,default:"" field :submit_time ,type:String ,default:"" field :result , type:Hash , default:{} + field :names , type:Hash , default:{} + field :values , type:Hash , default:{} field :submit_numbers , type:Fixnum , default: 1 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/showSubmit.html.erb b/app/views/admin/cancerpredicts/showSubmit.html.erb index 3173200..fd99586 100644 --- a/app/views/admin/cancerpredicts/showSubmit.html.erb +++ b/app/views/admin/cancerpredicts/showSubmit.html.erb @@ -1,26 +1,44 @@ - <% @result_names.each do |name|%> - + <% if !@results[0].nil? %> + <% @results[0].names.each do |key,name|%> + + <%end%> <%end%> +<% @key_len = @results[0].names.length %> <% @results.each do |result| %> + <% if result.names.length != @key_len %> + +
<%=name.to_s.html_safe %><%=name[I18n.locale.to_s].to_s.html_safe %>
+ + + + <% result.names.each do |key,name|%> + + <%end%> + + + + <% end %> - <% result.result.each_with_index do |(key,value),i| %> + <% result.result.each do |key,value| %> + <% @key_len %> <% if key != "locale" %> - <% if @choicenames[i] == "" %> - + <% if result.values[key][I18n.locale.to_s].length == 0 %> + <% else %> - + <% end %> <% end %> <%end%> <%end%> +
<%=name[I18n.locale.to_s].to_s.html_safe %>
<%= value %><%= value.to_s %><%= @choicenames[i][value.to_i-1] %><%= result.values[key][I18n.locale.to_s][value.to_i-1] rescue value %>