adjust some things about predict tools.

This commit is contained in:
BOHUNG 2019-12-27 13:49:20 +08:00
parent e2bc83ec2e
commit 0101f3bef0
9 changed files with 62 additions and 19 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 += '<div id="cancer_table_top"><div id="text_descibe">'+@form_to_show.text_descibe[I18n.locale.to_s] +'</div>'
@size = {'small'=>@form_to_show.small,'medium'=>@form_to_show.medium,'large'=>@form_to_show.large}
@table_str += '<div id="font_size_choices">'+'<label id="font_texts">'+t('cancerpredict.font_size')+':</label>'
@size.each{|size_key,size_value| @table_str += ('<button class="cancer_table_btn btn btn-default btn-sm" onclick="document.getElementById(\'cancer_table\').style[\'font-size\']=\''+size_value+'\'">'+t('cancerpredict.'+size_key)+'</button>' )}
@size.each{|size_key,size_value| @table_str += ('<button class="cancer_table_btn btn btn-default btn-sm" onclick="document.getElementById(\'cancer_table\').style[\'font-size\']=\''+size_value+'\';document.getElementById(\'cancer_predict_result_block\').style[\'font-size\']=\''+size_value+'\';">'+t('cancerpredict.'+size_key)+'</button>' )}
@table_str += '</div></div><div style="clear:both;"></div>'
@table_str_left = '<div id="cancer_table_left">'
@table_str_right = '<div id="cancer_table_right">'
@ -289,7 +297,7 @@ class CancerpredictsController < ApplicationController
@tab_name.each{|name| @table_result_str += '<div id="result_'+name+'_content" class="result_content"><a>'+'no content'+'</a></div>'}
@table_result_str += '</div></div></div>'
@table_button = '<div id="cancer_table_button_group">'
@submit_btn_str='<button id="cancer_table_submit">'+t('cancerpredict.table.Submit').to_s+'</button>'
@submit_btn_str='<button id="cancer_table_submit"><a class="white_text" href="#cancer_predict_result_block">'+t('cancerpredict.table.Submit').to_s+'</a></button>'
@reset_btn_str='<button id="cancer_table_reset">'+t('cancerpredict.table.Reset').to_s+'</button>'
@table_button += (@submit_btn_str+@reset_btn_str+'<div style="clear:both;"></div></div></div>')
@table_result_choice_fileds = '<div id="cancer_table_right_result">' if @form_to_show.form_result_is_right == 1

View File

@ -10,8 +10,8 @@ class Cancerpredictfields
field :form_show , :type=> Hash ,default:{0=>{:variable=>"age",:name=>{"zh_tw"=>"年齡<br/>(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"=>"腫瘤大小<br/>(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"=>"區域淋巴結檢查數目<br/>(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"=>"區域淋巴結侵犯數目<br/>(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"=>"腫瘤級數<br/>(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"=>"區域淋巴結侵犯數目<br/>(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"=>"腫瘤級數<br/>(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 狀態<br/>(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 狀態<br/>(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 狀態<br/>(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},

View File

@ -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)}

View File

@ -1,26 +1,44 @@
<table>
<thead>
<tr>
<% @result_names.each do |name|%>
<th><%=name.to_s.html_safe %></th>
<% if !@results[0].nil? %>
<% @results[0].names.each do |key,name|%>
<th><%=name[I18n.locale.to_s].to_s.html_safe %></th>
<%end%>
<%end%>
</tr>
</thead>
<tbody>
<% @key_len = @results[0].names.length %>
<% @results.each do |result| %>
<% if result.names.length != @key_len %>
</tbody>
</table>
<table>
<thead>
<tr>
<% result.names.each do |key,name|%>
<th><%=name[I18n.locale.to_s].to_s.html_safe %></th>
<%end%>
</tr>
</thead>
<tbody>
<% end %>
<tr>
<% result.result.each_with_index do |(key,value),i| %>
<% result.result.each do |key,value| %>
<% @key_len %>
<% if key != "locale" %>
<% if @choicenames[i] == "" %>
<td><%= value %></td>
<% if result.values[key][I18n.locale.to_s].length == 0 %>
<td><%= value.to_s %></td>
<% else %>
<td><%= @choicenames[i][value.to_i-1] %></td>
<td><%= result.values[key][I18n.locale.to_s][value.to_i-1] rescue value %></td>
<% end %>
<% end %>
<%end%>
</tr>
<%end%>
</tbody>
</table>
<style type="text/css">
thead > tr > th{
border:1px solid;

View File

@ -18,7 +18,7 @@ zh_tw:
table:
welcome: 歡迎使用台灣準備乳癌癒後系統!\n若要開始 請在下方輸入相關資訊
Reset: 重置
Submit: 提交
Submit: 送出
age: 確認年齡
Menopausal: 更年期狀態
ER: ER狀態

View File

@ -2,4 +2,4 @@
<script type="text/javascript" src="/assets/jquery.smartmenus.bootstrap.min.js"></script>
<script type="text/javascript" src="/assets/cancer_predict.js"></script>
{{table}}
<link href="/assets/cancer_predict.css" media="screen" rel="stylesheet">
<link href="/assets/cancer_predict.scss" media="screen" rel="stylesheet">

View File

@ -2,4 +2,4 @@
<script type="text/javascript" src="/assets/jquery.smartmenus.bootstrap.min.js"></script>
<script type="text/javascript" src="/assets/cancer_predict.js"></script>
{{table}}
<link href="/assets/cancer_predict.css" media="screen" rel="stylesheet">
<link href="/assets/cancer_predict.scss" media="screen" rel="stylesheet">