fix very much problems.

Let user change the texts in table and text tab.
Add the english contents.
fix print problem.
change contents before 2020/1/12
This commit is contained in:
BOHUNG 2020-01-12 13:14:58 +08:00
parent 4b8fed7e52
commit 456ce12222
13 changed files with 630 additions and 118 deletions

View File

@ -1,8 +1,11 @@
$(document).ready(function(){ $(document).ready(function(){
var head_images = $.post("/cancerpredictResult",{"header":1}) var head_data = $.post("/cancerpredictResult",{"header":1,locale:I18n.locale});
head_images.done(function(){ var data = {};
$('.header-nav').html(head_images.responseJSON['head_images']); head_data.done(function(){
$('.navbar-brand').html(head_images.responseJSON['title']) // $('.header-nav').html(head_images.responseJSON['head_images']);
// $('.navbar-brand').html(head_images.responseJSON['title'])
data['danger_texts'] = head_data.responseJSON['danger_texts'];
$('head title').text(head_data.responseJSON['page_title'])
}); });
Array.prototype.remove_item_from_array = function(){ Array.prototype.remove_item_from_array = function(){
var result_array = this; var result_array = this;
@ -216,7 +219,7 @@ $(document).ready(function(){
flag = 1; flag = 1;
for(var i = 0;i < $('#cancer_table .cancer_form_field').length;i++){ for(var i = 0;i < $('#cancer_table .cancer_form_field').length;i++){
if($('#cancer_table .cancer_form_field').eq(i).hasClass('num_only')){ if($('#cancer_table .cancer_form_field').eq(i).hasClass('num_only')){
if($('#cancer_table .cancer_form_field').eq(i).val()==""){ if($('#cancer_table .cancer_form_field').eq(i).siblings('.num_only_value').val()==""){
flag = 0; flag = 0;
$('#cancer_table .cancer_form_field').eq(i).addClass('cancertable_empty'); $('#cancer_table .cancer_form_field').eq(i).addClass('cancertable_empty');
}else{ }else{
@ -237,7 +240,7 @@ $(document).ready(function(){
}; };
if($('.cancertable_empty').length != 0){ if($('.cancertable_empty').length != 0){
flag = 0; flag = 0;
($('#danger_texts').length == 0) ? $('#cancer_table_submit').parent().before('<a id="danger_texts" style="color:red;">請注意紅框的輸入資料是否符合要求</a>') : null; ($('#danger_texts').length == 0) ? $('#cancer_table_submit').parent().before('<a id="danger_texts" style="color:red;">'+data['danger_texts']+'</a>') : null;
$('#danger_texts').css('margin-left',$(window).width()/2-$('#danger_texts').width()/2); $('#danger_texts').css('margin-left',$(window).width()/2-$('#danger_texts').width()/2);
}else{ }else{
$('#danger_texts').remove(); $('#danger_texts').remove();
@ -253,13 +256,20 @@ $(document).ready(function(){
post_json[name] = index; post_json[name] = index;
}; };
}; };
if( (post_json["ER_status"] == 2 && post_json["PR_status"] == 2) || (post_json["HER2_status"] != 1)){ if( post_json["ER_status"] == 2 && post_json["PR_status"] == 2 ){
$('#hormone_therapy .cancer_table_btn').attr('disabled','disabled'); $('#hormone_therapy .cancer_table_btn').attr('disabled','disabled');
$('[for="hormone_therapy"]').css('color','rgb(204, 204, 204)'); $('[for="hormone_therapy"]').css('color','rgb(204, 204, 204)');
}else{ }else{
$('#hormone_therapy .cancer_table_btn').removeAttr('disabled'); $('#hormone_therapy .cancer_table_btn').removeAttr('disabled');
$('[for="hormone_therapy"]').css('color',''); $('[for="hormone_therapy"]').css('color','');
} };
if(post_json["HER2_status"] != 1){
$('#Targeted_therapy .cancer_table_btn').attr('disabled','disabled');
$('[for="Targeted_therapy"]').css('color','rgb(204, 204, 204)');
}else{
$('#Targeted_therapy .cancer_table_btn').removeAttr('disabled');
$('[for="Targeted_therapy"]').css('color','');
};
return post_json; return post_json;
}else{ }else{
return null; return null;
@ -267,7 +277,7 @@ $(document).ready(function(){
}; };
function set_result(result){ function set_result(result){
if(result.responseJSON.lpv != "error"){ if(result.responseJSON.lpv != "error"){
$('#choice_fields').removeClass('active'); $('#choice_fields .cancer_table_btn').removeClass('active');
var load_heml = $('#result_table_content').html(result.responseJSON.table); var load_heml = $('#result_table_content').html(result.responseJSON.table);
load_heml.ready(function(){ load_heml.ready(function(){
$('#result_table_content .cancer_years').eq(-1).addClass('active'); $('#result_table_content .cancer_years').eq(-1).addClass('active');
@ -295,7 +305,6 @@ $(document).ready(function(){
$('#result_text_content .cancer_years').click(function(){ $('#result_text_content .cancer_years').click(function(){
try{ try{
$(this).parent().find('.cancer_years').removeClass('active'); $(this).parent().find('.cancer_years').removeClass('active');
//$('#result_table_content .cancer_years').eq($(this).attr('index')).click();
}catch{}; }catch{};
$(this).addClass('active'); $(this).addClass('active');
$('#current_year').attr('value',$(this).html()); $('#current_year').attr('value',$(this).html());
@ -339,7 +348,7 @@ $(document).ready(function(){
$('tr.tr_show').eq(-1).after($('tr.'+arguments[0])); $('tr.tr_show').eq(-1).after($('tr.'+arguments[0]));
$('tr.'+arguments[0]).addClass('tr_show'); $('tr.'+arguments[0]).addClass('tr_show');
if(this.length == 1){ if(this.length == 1){
$('.addition').css('display','block'); $('.addition').css('display','inline-block');
$('#result_text_content .extra-text').css('display','inline-block'); $('#result_text_content .extra-text').css('display','inline-block');
} }
var add_choices = this.slice(1,this.length); var add_choices = this.slice(1,this.length);
@ -348,12 +357,18 @@ $(document).ready(function(){
for(var i = 0;i<add_choices.length;i++){ for(var i = 0;i<add_choices.length;i++){
add_choices_transform.push($('[for="'+add_choices[i]+'"]').html()) add_choices_transform.push($('[for="'+add_choices[i]+'"]').html())
}; };
var add_choices_str = add_choices_transform.slice(0,add_choices_transform.length-1).join('、'); var add_choices_str = (I18n.locale == 'en' ? add_choices_transform.slice(0,add_choices_transform.length-1).join(', ') : add_choices_transform.slice(0,add_choices_transform.length-1).join('、'));
if(add_choices_transform.length >= 2) if(add_choices_transform.length >= 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 else
add_choices_str = add_choices_transform[0]; add_choices_str = add_choices_transform[0];
var new_text = '<p class="texts_show">'+'<a>100 位在術後有接受</a><a class="'+arguments[0]+' choices">'+add_choices_str+'</a><a>的婦女中,有 </a>'+'<a class="'+arguments[0]+' Overall_Survival">'+servive_ratio+'</a>'+'<a> 位婦女,術後 </a>'+'<a class="surgery_year">'+year+'</a>'+'<a>年仍為存活(多了</a>'+'<a class="'+arguments[0]+' Additional_Benefit">'+benefit+'</a><a>位)</a>'+'</p>'; var extra_therapy_texts = result.responseJSON['extra_therapy_texts'];
extra_therapy_texts = extra_therapy_texts.replace('{{extra_therapy}}','</span><span class="'+arguments[0]+' choices">'+add_choices_str+'</span><span>');
extra_therapy_texts = extra_therapy_texts.replace('{{survival_num}}','</span><span class="'+arguments[0]+' Overall_Survival">'+servive_ratio+'</span><span>');
extra_therapy_texts = extra_therapy_texts.replace('{{surgery_year}}','</span><span class="surgery_year">'+year+'</span><span>');
extra_therapy_texts = extra_therapy_texts.replace('{{Additional_Benefit}}','</span><span class="'+arguments[0]+' Additional_Benefit">'+benefit+'</span><span>');
var new_text = '<p class="texts_show"><span>';
new_text += (extra_therapy_texts+'</span></p>');
$('#result_text_content .extra-text .texts_show').eq(-1).after(new_text) $('#result_text_content .extra-text .texts_show').eq(-1).after(new_text)
return Array.prototype.push.apply(this, arguments); return Array.prototype.push.apply(this, arguments);
}else{ }else{
@ -541,7 +556,10 @@ $(document).ready(function(){
result['age1'] = Math.pow((Number(result_json['age'])/100),0.5); 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['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); result['size1'] = Math.log(Number(result_json['size'])/10);
try{result['ratio'] = Number(result_json['lymph_nodes_positive'])/Number(result_json['lymph_nodes_examined'])}catch{result['ratio'] = 0} if(Number(result_json['lymph_nodes_examined']) != 0)
try{result['ratio'] = Number(result_json['lymph_nodes_positive'])/Number(result_json['lymph_nodes_examined'])}catch{result['ratio'] = 0}
else
result['ratio'] = 0
if(result['ratio'] > 1) if(result['ratio'] > 1)
result['ratio'] = 1 result['ratio'] = 1
result['nposit'] = Math.pow(((Number(result['ratio'])+0.1)/0.1),0.5); result['nposit'] = Math.pow(((Number(result['ratio'])+0.1)/0.1),0.5);
@ -632,7 +650,10 @@ $(document).ready(function(){
post_json['locale'] = I18n.locale; post_json['locale'] = I18n.locale;
var result = $.post("/cancerpredictResult",{"data":post_json}); var result = $.post("/cancerpredictResult",{"data":post_json});
result.done(function(){ result.done(function(){
console.log(result.responseJSON);
set_result(result); set_result(result);
window.location.hash = '';
window.location.hash = '#cancer_predict_result_block';
}); });
}; };
}; };

View File

@ -2,6 +2,54 @@
Place all the styles related to the matching controller here. Place all the styles related to the matching controller here.
They will automatically be included in application.css. They will automatically be included in application.css.
*/ */
.table .expired{ thead > tr > th{
color: #BE2E2E; border:1px solid;
background: bisque;
}
tbody{
background:white;
}
tbody > tr > td{
border:1px solid;
position: relative;
}
.show_li,.show_li *{
list-style:none;
color:balck;
}
.show_li ul{
display:none;
}
#clicktosee{
color:blue;
cursor:pointer;
}
table .checkbox{
left: 50%;
position: absolute;
transform: translate(-50%, -50%) !important;
top: 50%;
}
#updatebtn{
margin-top: 1em;
right: 1em;
background-color: #0088cc;
color: white;
border: 0em;
padding: 0.125em 0.5em;
border-radius: 0.5em;
}
.show_span{
margin: 1em;
float: left;
background-color: rgb(210, 105, 0);
color: white;
border: 0em;
padding: 0.125em 0.5em;
border-radius: 0.5em;
width: fit-content;
}
.label_left{
float: left;
padding-right: 0.5em;
} }

File diff suppressed because one or more lines are too long

View File

@ -16,9 +16,17 @@ div.num_group{
width: 4.125em; width: 4.125em;
height: 2.25em; height: 2.25em;
} }
.navbar-brand>img.head_logo{ @media screen and (min-width: 93.75em){
width: 70%; .navbar-brand>img.head_logo{
height: auto; width: 50%;
height: auto;
}
}
@media screen and (min-width: 48.125em) and (max-width: 93.625em){
.navbar-brand>img.head_logo{
width: 70%;
height: auto;
}
} }
.header-nav{ .header-nav{
top:0 !important; top:0 !important;
@ -43,7 +51,7 @@ div.num_group{
} }
} }
#cancer_predict_result_block .cencer_table_name{ #cancer_predict_result_block .cencer_table_name{
width: 4em; width: 5em;
} }
.cancer_table_btn{ .cancer_table_btn{
margin-right: 0.5em; margin-right: 0.5em;
@ -64,10 +72,11 @@ div.num_group{
#font_texts{ #font_texts{
padding-right: 0.5em; padding-right: 0.5em;
} }
#text_descibe{ #text_describe{
font-weight: bold; font-weight: bold;
float: left; float: left;
max-width: 50%; max-width: 75%;
padding-bottom: 3em;
} }
#font_size_choices{ #font_size_choices{
font-weight: bold; font-weight: bold;
@ -261,6 +270,10 @@ input.float_num{
} }
#result_table_content a{ #result_table_content a{
float:left; float:left;
display: contents;
}
.result_content span{
color: #5d7ca2;
} }
.hint-texts{ .hint-texts{
color: rgb(104, 104, 104); color: rgb(104, 104, 104);
@ -357,4 +370,9 @@ div.texts_show{
.result_title{ .result_title{
margin-top: 1em; margin-top: 1em;
} }
}
@media print {
* {
-webkit-print-color-adjust: exact !important;
}
} }

View File

@ -0,0 +1,382 @@
@import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css);
button, input, optgroup, select, textarea {
margin: 0;
font: inherit;
color: inherit;
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transform: translate(0, 0);
}
.fa-question:before {
content: "\f128";
}
button {
overflow: visible;
}
button, input, select, textarea {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
#cancer_table *[data-key]{
padding: 0.375em 0;
display: inline-block;
}
.head_logo{
height: 4em;
}
div.num_group{
position: relative;
float: left;
width: 4.125em;
height: 2.25em;
}
.navbar-brand>img.head_logo{
width: 70%;
height: auto;
}
.header-nav{
top:0 !important;
}
.title_texts{
color:rgb(210, 106, 2);
display:none;
}
.cencer_table_name{
display: inline-block;
vertical-align: middle;
color:#5d7ca2;
}
#cancer_table .cencer_table_name{
width: 16.25em;
}
#cancer_predict_result_block .cencer_table_name{
width: 5em;
}
.cancer_table_btn{
margin-right: 0.5em;
color:#5d7ca2;
border-color: #5d7ca2;
font-weight: 600;
}
.cancer_table_btn::last-of-type{
margin-right:auto;
}
#cancer_table{
font-size:0.825em;
color:#5d7ca2;
}
#cancer_table_top{
padding-bottom: 4em;
}
#font_texts{
padding-right: 0.5em;
}
#text_describe{
font-weight: bold;
float: left;
max-width: 75%;
padding-bottom: 3em;
}
#font_size_choices{
font-weight: bold;
float: right;
max-width: 50%;
padding-left:1em;
}
form.for_num{
position: relative;
float:left;
}
select.select_num{
position: absolute;
width: 5.125em;
height: 1.75em;
left: 1em;
clip: rect(0.25em,4.8em,1.5em,3.875em);
border:none;
padding: 0.5em;
}
input.num_only{
color: black;
border-top: 0.125em solid rgb(221, 221, 221);
width: 5.125em;
padding: 0em 0em 0.25em;
border-left: 0.125em solid rgb(221, 221, 221);
text-align: center;
font-size: 0.875em;
background-color: rgb(255, 255, 255);
height: 2.25em;
position: absolute;
left:0.625em;
}
input.float_num{
position: relative;
}
#cancer_table_left{
width:100%;
}
#cancer_table_right{
width:100%;
}
#cancer_table_submit{
margin-left: 1em;
float: right;
background-color: rgb(210, 105, 0);
color: white;
border: 0em;
padding: 0.125em 0.5em;
border-radius: 0.5em;
font-size: 1.25em;
}
#cancer_table_reset{
float: right;
background-color: rgb(210, 105, 0);
color: white;
border: 0em;
padding: 0.125em 0.5em;
border-radius: 0.5em;
font-size: 1.25em;
}
.btn-sub{
background:url("/assets/cancerpredict/triangle_sub.png") no-repeat top transparent;
position: relative;
width: 1.875em;
border: 0;
height: 1.875em;
background-size: contain;
top:1em;
bottom: -0.7em;
padding: 0;
}
.btn-add{
background:url("/assets/cancerpredict/triangle_add.png") no-repeat top transparent;
position: relative;
width: 1.875em;
border: 0;
height: 1.875em;
background-size: contain;
right: 1.815em;
top: -0.3em;
padding: 0;
}
.cancer_table_btn:focus{
color: #5d7ca2 !important;
background-color: #9dc3e6 !important;
border-color: #8c8c8c !important;
}
.cancer_table_btn:hover{
color: #5d7ca2 !important;
background-color: #9dc3e6 !important;
border-color: #8c8c8c !important;
}
.cancer_table_btn.active{
color: #5d7ca2;
background-color: #9dc3e6;
border-color: #8c8c8c;
}
.cancertable_empty{
border: 0.25em solid pink !important;
border-radius: 0.5em !important;
padding: 0.125em !important;
}
.result_title{
background-color: rgb(210, 105, 0);
color: white;
border: 0em;
padding: 0.125em 0.5em;
border-radius: 0.5em;
font-size: 1.25em;
float: left;
}
.result_tab{
background: #023d79;
background: linear-gradient(135deg, transparent 0.3em, #023d79 0);
border: none;
float:right;
padding: 0.5em 0.125em 0.5em 0.5em;
margin-top: 0.5em;
cursor: pointer;
}
#cancer_table a:hover{
text-decoration: none;
color: #5d7ca2;
}
#result_contents{
padding-top: 2em;
}
#choice_fields{
padding: 2em 0 0 calc(20% - 1.625em);
}
.result_tab:hover{
background: #d16801;
background: linear-gradient(135deg, transparent 0.3em, #d16801 0);
padding: 0.8em 0.125em 0.5em 1em;
margin-left: -0.5em;
}
.result_tab.active{
background: #d16801;
background: linear-gradient(135deg, transparent 0.3em, #d16801 0);
padding: 0.8em 0.125em 0.5em 1em;
margin-left: -0.5em;
}
.result_tab > a{
writing-mode: vertical-lr;
-webkit-writing-mode: vertical-lr;
color: white;
}
.result_tab_group{
width: 20%;
margin: 0;
float: left;
}
.result_content_group{
width: 80%;
margin: 0;
float: right;
}
.result_content{
display: none;
min-height: 25em;
border: 0.125em solid #c0cbdd;
padding: 0.5em;
}
.result_content:first-of-type{
display: block;
}
.result_content a{
color: #5d7ca2;
}
.result_content span{
color: #5d7ca2;
}
.result_content p{
color: #5d7ca2;
clear: both;
}
.cancer_years{
float:left;
color: #5d7ca2;
background-color: #fff;
border-color: #5d7ca2;
border-width: 0.125em;
margin: 0em;
}
.cancer_years:first-of-type{
margin-left: 1em;
}
.cancer_years:last-of-type{
margin-right: 1em;
}
.cancer_form_field{
margin-left: 1em;
}
#result_table_content a{
float:left;
display: contents;
}
.hint-texts{
color: rgb(104, 104, 104);
font-size: 0.75em;
clear: both;
padding: 0.5em 0;
}
#result_text_content a{
float:left;
}
#result_table_content table{
clear: both;
width:100%;
table-layout: fixed;
overflow-wrap: break-word;
}
#result_table_content table tbody tr{
display: none;
}
#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;
border-right: 0.375em solid white;
border-top: 0.375em solid white;
}
.cancer_td {
background-color: #e9eaf5;
border-right: 0.375em solid white;
border-top: 0.375em solid white;
}
#cancer_predict_result_block{
display:none;
font-size: 0.825em;
margin-top: 3em;
border-top: #666 solid;
padding-top: 2em;
}
p.texts_show{
display: list-item;
margin-left: 1.5em;
clear: both;
}
div.texts_show{
display: block;
margin-left: 0;
}
.addition{
display: none;
}
#cancer_table_right_result .cancer_table_btn{
padding: 0.25em 1em;
}
#cancer_table_left_result .cancer_table_btn{
padding: 0.25em 1em;
}
.modal-dialog {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%) !important;
overflow: auto;
overflow-y: auto;
}
#cancer_predict_result{
width: 80%;
}
#cancer_table_right{
float:right;
width:50%;
}
#cancer_table_left{
float:left;
width:50%;
}
#cancer_table_right_result{
width: 50%;
float: right;
}
#cancer_table_left_result{
width: 50%;
float: left;
}
#cancer_predict_result{
width: 50%;
float: left;
}
.result_title{
margin-top: 1em;
}
@media print {
* {
-webkit-print-color-adjust: exact !important;
}
}

View File

@ -87,8 +87,21 @@ class Admin::CancerpredictsController < OrbitAdminController
end end
end end
end end
@form_to_show.form_result_is_right = params["cancerpredictfields"]["form_result_is_right"] @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']
@form_to_show.text_descibe[I18n.locale.to_s] = params["cancerpredictfields"]["text_descibe"] params_cancer = params.require("cancerpredictfields").permit!
@create_items.each do |item|
if (@form_to_show[item].class == BSON::Document) || (@form_to_show.send(item).class == Hash)
puts params_cancer[item]
item_hash = @form_to_show[item]
item_hash = item_hash.merge(params_cancer[item])
@form_to_show[item] = item_hash
elsif @form_to_show[item].class == Array
@form_to_show[item] = YAML.load(params_cancer[item])
@form_to_show[item] = [] if @form_to_show[item].class != Array
else
@form_to_show[item] = params_cancer[item]
end
end
@size = ['small','medium','large'] @size = ['small','medium','large']
@size.each{|size| @form_to_show[size] = params["cancerpredictfields"][size]} @size.each{|size| @form_to_show[size] = params["cancerpredictfields"][size]}
@file_path = Rails.root.to_s + '/app/assets/images/predict_tool' @file_path = Rails.root.to_s + '/app/assets/images/predict_tool'
@ -169,9 +182,22 @@ class Admin::CancerpredictsController < OrbitAdminController
Headimages.find_by(:id => @image_id ).destroy rescue next Headimages.find_by(:id => @image_id ).destroy rescue next
@form_to_show.title_images_id.delete(@image_id) @form_to_show.title_images_id.delete(@image_id)
end end
@form_to_show.title_texts = params['cancerpredictfields']['title_texts']
@form_to_show.save @form_to_show.save
end end
@index = 0
Dir.chdir("public") do
while File.exist?('cancerfield_back'+@index.to_s+'.txt')
@index += 1
end
end
Dir.chdir("public") do
@file_back = File.open('cancerfield_back'+@index.to_s+'.txt', 'w')
@file_back.write(@form_to_show.attributes)
@file_back.close
@file_org = File.open('cancerfield_org'+@index.to_s+'.txt', 'w')
@file_org.write(Cancerpredictfields.where("title"=>@app_title+'_back').first.attributes)
@file_org.close
end
redirect_to admin_cancerpredicts_path redirect_to admin_cancerpredicts_path
end end
def showSubmit def showSubmit

View File

@ -12,6 +12,8 @@ class CancerpredictsController < ApplicationController
create_first_field create_first_field
#begin #begin
if params['header'].to_i == 1 if params['header'].to_i == 1
locale = params['locale'].to_s rescue 'zh_tw'
locale = 'zh_tw' if locale == 'zh_cn'
result = {} result = {}
@head_images = {} @head_images = {}
@form_to_show.head_images_id.each do |image_id| @form_to_show.head_images_id.each do |image_id|
@ -28,8 +30,9 @@ class CancerpredictsController < ApplicationController
@url = @image.temp_file.to_s @url = @image.temp_file.to_s
@head_images[@image.sort_number.to_i] = ('<img class="head_logo" alt ="' + Pathname.new(@image.temp_file.file.file).basename.to_s+'" src="'+@url+'"/>') @head_images[@image.sort_number.to_i] = ('<img class="head_logo" alt ="' + Pathname.new(@image.temp_file.file.file).basename.to_s+'" src="'+@url+'"/>')
end end
result['danger_texts'] = (@form_to_show.danger_texts[locale] rescue '')
result['title'] = ((@form_to_show.title_texts == "") ? "" : '<a class="title_texts">'+@form_to_show.title_texts+'</a>')+Hash[@head_images.sort].values.join('') result['title'] = Hash[@head_images.sort].values.join('')
result['page_title'] = @form_to_show.title_texts[params[:locale]]
else else
@record = Cancerpredictrecord.new @record = Cancerpredictrecord.new
@record.title = @app_title @record.title = @app_title
@ -52,7 +55,11 @@ class CancerpredictsController < ApplicationController
result['age1'] = (params['data']['age'].to_f/100)**(0.5) 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['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)) result['size1'] = Math.log(params['data']['size'].to_f/10,Math.exp(1))
result['ratio'] = params['data']['lymph_nodes_positive'].to_f/params['data']['lymph_nodes_examined'].to_f rescue 0 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
else
result['ratio'] = 0
end
result['ratio'] = 1 if result['ratio'] > 1 result['ratio'] = 1 if result['ratio'] > 1
result['nposit'] = ((result['ratio'].to_f+0.1)/0.1)**0.5 result['nposit'] = ((result['ratio'].to_f+0.1)/0.1)**0.5
@T = '' @T = ''
@ -67,6 +74,7 @@ class CancerpredictsController < ApplicationController
else else
@T = 'T4' @T = 'T4'
end end
result['T'] = @T
@N = '' @N = ''
if params['data']['lymph_nodes_positive'].to_i == 0 if params['data']['lymph_nodes_positive'].to_i == 0
@N = 'N0' @N = 'N0'
@ -79,12 +87,14 @@ class CancerpredictsController < ApplicationController
elsif params['data']['lymph_nodes_positive'].to_i >= 10 elsif params['data']['lymph_nodes_positive'].to_i >= 10
@N = 'N3' @N = 'N3'
end end
result['N'] = @N
@M = '' @M = ''
if params['data']['Distant_Metastasis'].to_i != 1 if params['data']['Distant_Metastasis'].to_i != 1
@M = 'M0' @M = 'M0'
else else
@M = 'M1' @M = 'M1'
end end
result['M'] = @M
if @M == 'M0' if @M == 'M0'
if @T == 'T1' && (@N == 'N0' || @N == 'N1mi') if @T == 'T1' && (@N == 'N0' || @N == 'N1mi')
result['pstage'] = 1 result['pstage'] = 1
@ -146,12 +156,12 @@ class CancerpredictsController < ApplicationController
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['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['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['pstage_3']*1.134+result['pstage_4']*2.172+result['lvi_yes']*0.3321-0.04 rescue 'error')
@years = ['1','3','5'] @years = @form_to_show.years
result['table'] = '<input id="current_year" type="hidden" value="'+@years[-1]+'" index="0"/><p id="cancer_table_texts">此分析微針對已接受手術後病人下表為此病人分別在第1年、3及5年下根據選定的術後治療所估計的存活率</p>' 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'] += '<a>第</a>' result['table'] += '<a style="display: inline-block;">第</a><a style="display: inline-block;">'
result['years'] = @years result['years'] = @years
@years.each{|year| result['table'] += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm">'+year+'</button>')} @years.each{|year| result['table'] += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm">'+year.to_s+'</button>')}
result['table'] += '<a>年</a>' result['table'] += '</a><a style="display: inline-block;">年</a>'
@table_head = (locale == "zh_tw") ? ['治療','額外治療效益','總生存率(%)'] :['Treatment','Additional Benefit','Overall Survival(%)'] @table_head = (locale == "zh_tw") ? ['治療','額外治療效益','總生存率(%)'] :['Treatment','Additional Benefit','Overall Survival(%)']
@head_name = ['Treatment','Additional_Benefit','Overall_Survival'] @head_name = ['Treatment','Additional_Benefit','Overall_Survival']
@therapy_choices = (locale == "zh_tw") ? ['純手術'] :['Surgery only'] @therapy_choices = (locale == "zh_tw") ? ['純手術'] :['Surgery only']
@ -169,14 +179,26 @@ class CancerpredictsController < ApplicationController
end end
result['table'] += '</tr>' result['table'] += '</tr>'
end end
result['texts'] = '<a>此研究分析來自已接受根除性手術後之婦女所得之結果,根據您所輸入的資訊以及治療方式,</a>'+'<div style="clear:both;"></div>'+'<a>在術後第</a>' @texts = @form_to_show.text_above_texts[locale].gsub('<br/>','</span><br/><span>')
@years.each{|year| result['texts'] += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm">'+year+'</button>')} @texts = @texts.split('{{years}}')
result['texts'] += '<a>年</a>' @texts.delete('')
result['texts'] = '<span>'+@texts[0]
@years.each{|year| result['texts'] += ('<button class="cancer_years cancer_table_btn btn btn-default btn-sm" style="float:none;">'+year.to_s+'</button>')}
if @texts.count > 1
result['texts'] += (@texts[1]+'</span>') if @texts.count > 1
else
result['texts'] += '</span>'
end
@lpv_calc = [-0.001476145,-0.01261639,-0.02519608] @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
result['texts'] += ('<p class="show"><a>100 位只接受根除性手術的婦女中,有 '+ '<a class="'+@therapy_names[0]+' Overall_Survival">'+@servive_ratio.round.to_s+'</a>'+'<a> 位婦女,術後 </a>'+'<a class="surgery_year">'+@years[-1].to_s+'</a>'+'<a>年仍為存活</a></p>') @surgery_only_texts = @form_to_show.surgery_only_texts[locale]
result['texts'] += '<a class="addition">'+',此外</a><div class="extra-text" style="display:none;"><div class="texts_show" style="clear:both;"></div>' @surgery_only_texts.insert(0,'<p class="show"><span>')
result['texts'] += '</div>' @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>'
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']
result['servive_ratio'] = @servive_ratio result['servive_ratio'] = @servive_ratio
end end
result = result.merge(params) result = result.merge(params)
@ -196,7 +218,7 @@ class CancerpredictsController < ApplicationController
@size_active_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 } @size.each{|size_key,size_value| (@form_to_show[size_key]['active'].to_i == 1) ? ( @size_active_size = size_value ): nil }
@table_str = '<div id="cancer_table" style="font-size:' + @size_active_size + ';"><div id="show_help_modal" class="modal fade"></div>' @table_str = '<div id="cancer_table" style="font-size:' + @size_active_size + ';"><div id="show_help_modal" class="modal fade"></div>'
@table_str += '<div id="cancer_table_top"><div id="text_descibe">'+@form_to_show.text_descibe[I18n.locale.to_s] +'</div>' @table_str += '<div id="cancer_table_top"><div id="text_describe">'+@form_to_show.text_descibe[I18n.locale.to_s] +'</div>'
@table_str += '<div id="font_size_choices">'+'<label id="font_texts">'+t('cancerpredict.font_size')+':</label>' @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 '+((@form_to_show[size_key]['active'].to_i == 1) ? 'active' :'') + ' 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>' )} @size.each{|size_key,size_value| @table_str += ('<button class="cancer_table_btn '+((@form_to_show[size_key]['active'].to_i == 1) ? 'active' :'') + ' 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 += '</div></div><div style="clear:both;"></div>'
@ -337,7 +359,7 @@ class CancerpredictsController < ApplicationController
@tab_name.each{|name| @table_result_str += '<div id="result_'+name+'_content" class="result_content"><a>'+'no content'+'</a></div>'} @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_result_str += '</div></div></div>'
@table_button = '<div id="cancer_table_button_group">' @table_button = '<div id="cancer_table_button_group">'
@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>' @submit_btn_str='<button id="cancer_table_submit">'+t('cancerpredict.table.Submit').to_s+'</button>'
@reset_btn_str='<button id="cancer_table_reset">'+t('cancerpredict.table.Reset').to_s+'</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_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 @table_result_choice_fileds = '<div id="cancer_table_right_result">' if @form_to_show.form_result_is_right == 1

View File

@ -7,35 +7,39 @@ class Cancerpredictfields
include OrbitTag::Taggable include OrbitTag::Taggable
include OrbitCategory::Categorizable include OrbitCategory::Categorizable
field :title ,type:String ,default:"" field :title ,type:String ,default:""
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}, 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'=>'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},
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}, 1=>{:variable=>"size",:name=>{"zh_tw"=>"腫瘤大小<br/>(Tumor size)","en"=>"Tumor size"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>'The unit of tumor size is millimeter (mm)'}, :comment_text=>{'zh_tw'=>'若有多個原發腫瘤,請輸入最大尺寸之原發腫瘤','en'=>'If there was more than one primary tumor, please enter the size of the largest one.'}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[1,230],: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"=>['unknown']},:range=>[0,90],: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"=>['unknown']},: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"=>['unknown']},: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'=>'Regional lymph nodes positive is a key predictive variable. If this information is omitted, the prediction result would be biased.'}, :choice_fields=> {"zh_tw"=>['未知'],"en"=>['unknown']},: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}, 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'=>'The grade refers to how different the cancer cells are from normal cells. Please select “unknown” if there is no information about grade. The prediction model would use “grade 2” as the alternative variable.'}, :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=>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'=>'ER status describes the status of estrogen receptor. Please select “unknown” if there is no information about ER status. The prediction model would use “Positive” (the majority class) as the alternative variable.'}, :choice_fields=> {"zh_tw"=>['陽性','陰性','未知'],"en"=>['positive','negative','unknown']},:range=>[],:right=>0,: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}, 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'=>'PR status describes the status of progesterone receptor. Please select “unknown” if there is no information about PR status. The prediction model would use “Positive” (the majority class) as the alternative variable.'}, :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}, 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'=>'HER2 status describes the status of human epidermal growth factor receptor 2. Please select “unknown” if there is no information about HER2 status. The prediction model would use “Negative” (the majority class) as the alternative variable.'}, :choice_fields=> {"zh_tw"=>['陽性','陰性','未知'],"en"=>['positive','negative','unknown']},:range=>[],:right=>1,:is_float=>0},
8=>{:variable=>"Distant_Metastasis",:name=>{"zh_tw"=>"遠端轉移<br/>(DistantMetastasis)","en"=>"pathologic stage"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無遠轉移資訊請選擇未知,將以佔多數比例未遠端轉移作為後續預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['是','否','未知'],"en"=>['yes','no','unknown']},:range=>[],:right=>1,:is_float=>0}, 8=>{:variable=>"Distant_Metastasis",:name=>{"zh_tw"=>"遠端轉移<br/>(Distant Metastasis)","en"=>"Distant Metastasis"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無遠轉移資訊請選擇未知,將以佔多數比例未遠端轉移作為後續預測。','en'=>'Please select “unknown” if there is no information about distant Metastasis. The prediction model would use “No” (the majority class) as the alternative variable.'}, :choice_fields=> {"zh_tw"=>['是','否','未知'],"en"=>['yes','no','unknown']},:range=>[],:right=>1,:is_float=>0},
9=>{:variable=>"micrometastasis",:name=>{"zh_tw"=>"顯微轉移<br/>(micrometastasis)","en"=>"pathologic stage"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無顯微移資訊請選擇未知,將以無顯微轉移作為後續預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['是','否','未知'],"en"=>['yes','no','unknown']},:range=>[],:right=>1,:is_float=>0}, 9=>{:variable=>"micrometastasis",:name=>{"zh_tw"=>"淋巴結顯微轉移<br/>(Lymph nodes micrometastasis)","en"=>"Micrometastasis"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無顯微移資訊請選擇未知,將以無顯微轉移作為後續預測。','en'=>'Please select “unknown” if there is no information about lymph nodes micrometastasis. The prediction model would use “No” as the alternative variable.'}, :choice_fields=> {"zh_tw"=>['是','否','未知'],"en"=>['yes','no','unknown']},:range=>[],:right=>1,:is_float=>0},
10=>{:variable=>"tumor_direct_extension",:name=>{"zh_tw"=>"腫瘤浸潤至胸壁和/或皮膚<br/>(tumor direct extension to the chest wall and/or to the skin)","en"=>"tumor direct extension to the chest wall and/or to the skin"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無腫瘤浸潤至胸壁或皮膚資訊請選擇未知,將以佔多數比例無腫瘤浸潤至胸壁作為後續預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['是','否','未知'],"en"=>['yes','no','unknown']},:range=>[],:right=>1,:is_float=>0}, 10=>{:variable=>"tumor_direct_extension",:name=>{"zh_tw"=>"腫瘤浸潤至胸壁和/或皮膚<br/>(Tumor direct extension to the chest wall and/or to the skin)","en"=>"Tumor direct extension to the chest wall and/or to the skin"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無腫瘤浸潤至胸壁或皮膚資訊請選擇未知,將以佔多數比例無腫瘤浸潤至胸壁作為後續預測。','en'=>'Please select “unknown” if there is no information about tumor direct extension to the chest wall and/or to the skin. The prediction model would use “No” (the majority class) as the alternative variable'}, :choice_fields=> {"zh_tw"=>['是','否','未知'],"en"=>['yes','no','unknown']},:range=>[],:right=>1,:is_float=>0},
11=>{:variable=>"lvi",:name=>{"zh_tw"=>"淋巴管或血管侵犯<br/>(lymph vessel or vascular invasion, LVI)","en"=>"lymph vessel or vascular invasion, LVI"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無淋巴管或血管侵犯資訊,請選擇“未知”選項,將以佔多數比例的淋巴管或血管未侵犯進行預測','en'=>''}, :choice_fields=> {"zh_tw"=>['是','否','未知'],"en"=>['yes','no','unknown']},:range=>[],:right=>1,:is_float=>0} 11=>{:variable=>"lvi",:name=>{"zh_tw"=>"淋巴管或血管侵犯<br/>(Lymph vessel or vascular invasion, LVI)","en"=>"Lymph vessel or vascular invasion, LVI"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>'Lymph vessel or vascular invasion'}, :comment_text=>{'zh_tw'=>'若無淋巴管或血管侵犯資訊,請選擇“未知”選項,將以佔多數比例的淋巴管或血管未侵犯進行預測','en'=>'Please select “unknown” if there is no information about Lymph vessel or vascular invasion. The prediction model would use “No” (the majority class) as the alternative variable.'}, :choice_fields=> {"zh_tw"=>['是','否','未知'],"en"=>['yes','no','unknown']},:range=>[],:right=>1,: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 (endocrine) therapy is available when ER-status is positive'} , :comment_text=>{'zh_tw'=>'','en'=>'<p>Hormone therapy, or endocrine therapy, involves a woman taking drugs to prevent the growth of tumour cells that are boosted by the hormone oestrogen. Drugs of this kind include tamoxifen (brand names include Nolvadex, Istabul, Valodex, and Soltamox) and aromatase inhibitors such as anastrozole, exemestane, and letrozole (brand names Arimidex, Aromasin, and Femara).</p>'+ 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=>[]},
'<p>Some hormone therapy drugs act by blocking the action of oestrogen on the cells and some work by lowering the amount of oestrogen in the body (NB hormone therapy for breast cancer is the opposite of hormone replacement therapy or HRT, which is taken by women to help INCREASE oestrogen levels to help deal with side-effects of the menopause).</p>'+
'<p>Treatments usually have the potential to cause harm as well as benefit. It is important to weigh up the risks of potential harm against the potential benefits of treatment in order to reach a decision. Some may cause more harm than benefit to some people.</p>'+
'<p>It is useful to switch between 1 and 5 years hormone therapy to compare the survival outcomes.</p>'}, :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=>[]}, 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=>[]}, 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=>[]} 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 :form_result_is_right , :type=> Integer ,default: 0
field :text_descibe ,type:Hash ,default:{"zh_tw"=>"歡迎使用台灣準備乳癌癒後系統!<br/>若要開始 請在下方輸入相關資訊","en"=>" Welcome to The after breast cancer healing system of Taiwanprepare!\nTo start, please enter the relevant information below."} field :text_descibe ,type:Hash ,default:{"zh_tw"=>"歡迎使用台灣準備乳癌預後系統!<br/>本預測系統由台灣癌症登記資料庫2011至2015年間共90,841位乳癌病人所建立 <br/>若要開始 請在下方輸入相關資訊","en"=>"Welcome to the Taiwan Breast Cancer Prediction System!<br/>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.<br/>To start, please enter the information below."}
field :small ,type:Hash ,default:{'font_size'=>"0.825em",'active'=>0} field :small ,type:Hash ,default:{'font_size'=>"0.825em",'active'=>0}
field :medium ,type:Hash ,default:{'font_size'=>"1em",'active'=>1} field :medium ,type:Hash ,default:{'font_size'=>"1em",'active'=>1}
field :large ,type:Hash ,default:{'font_size'=>"1.25em",'active'=>0} 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 :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_images_id ,type:Array , default: [BSON::ObjectId('5df87cd88cd8924491000036')]
field :title_texts ,type:String ,default:"" 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:<br/>{{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 :image_uploader ,type:Object #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 :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)} scope :is_approved, ->{where(:approved => true)}

View File

@ -4,7 +4,10 @@
<%=form_for @form_to_show ,:url=>{:controller=>"cancerpredicts" ,:action=>"edit"} do |form|%> <%=form_for @form_to_show ,:url=>{:controller=>"cancerpredicts" ,:action=>"edit"} do |form|%>
<span class="show_span"><%= t('cancerpredict.title') %></span> <span class="show_span"><%= t('cancerpredict.title') %></span>
<div style="clear:both;"></div> <div style="clear:both;"></div>
<label class="label_left" for="title_text"><%= t('cancerpredict.title_text')+':' %></label> <%=form.text_field :title_texts ,{:value => @form_to_show.title_texts,:id=>"title_text"} %> <label class="label_left" for="title_text"><%= t('cancerpredict.title_text')+':' %></label>
<%=form.fields_for :title_texts do |locale_fields|%>
<%=locale_fields.text_field I18n.locale.to_s ,{:value => @form_to_show.title_texts[I18n.locale.to_s],:id=>"title_text"} %>
<% end %>
<% if @title_images.length != 0%> <% if @title_images.length != 0%>
<% @title_images.each_with_index do |temp_image,i| %> <% @title_images.each_with_index do |temp_image,i| %>
<%= form.fields_for "title_images" do |image_fields| %> <%= form.fields_for "title_images" do |image_fields| %>
@ -135,7 +138,9 @@
</p> </p>
<span class="show_span"><%= t('cancerpredict.text_descibe') %></span> <span class="show_span"><%= t('cancerpredict.text_descibe') %></span>
<div style="clear:both;"></div> <div style="clear:both;"></div>
<%= form.text_field 'text_descibe',{:value=> @form_to_show.text_descibe[I18n.locale.to_s],:style=>'width:100%;'} %> <%= form.fields_for 'text_descibe' do |locale_fields|%>
<%= locale_fields.text_field I18n.locale.to_s,{:value=> @form_to_show.text_descibe[I18n.locale.to_s],:style=>'width:100%;'} %>
<%end%>
<span class="show_span"><%= t('cancerpredict.font_size') %></span> <span class="show_span"><%= t('cancerpredict.font_size') %></span>
<div style="clear:both;"></div> <div style="clear:both;"></div>
<% @size=['small','medium','large'] %> <% @size=['small','medium','large'] %>
@ -199,6 +204,19 @@
<% else%> <% else%>
<div><%= 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"}%></div> <div><%= 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"}%></div>
<%end%> <%end%>
<div style="clear:both;"></div>
<% @create_items = ['years','table_above_texts','text_above_texts','surgery_only_texts','extra_texts','extra_therapy_texts','danger_texts'] %>
<% @create_items.each do |item|%>
<label for="<%=item%>" style="float: left;margin-right:1em;"><%= t('cancerpredict.'+item)+':' %></label>
<% if @form_to_show[item].class == BSON::Document || @form_to_show[item].class == Hash %>
<%= form.fields_for item do |locale_fields|%>
<%= locale_fields.text_field I18n.locale.to_s,{:value=>@form_to_show[item][I18n.locale.to_s] ,:id=> item} %>
<% end %>
<% else %>
<%= form.text_field item,{:value=>@form_to_show[item],:id=> item} %>
<% end %>
<div style="clear:both;"></div>
<% end %>
<table> <table>
<thead> <thead>
<tr> <tr>
@ -241,59 +259,7 @@
</table> </table>
<%=form.submit "#{t(:updatefont)}",{:id=>"updatebtn"}%> <%=form.submit "#{t(:updatefont)}",{:id=>"updatebtn"}%>
<%end%> <%end%>
<style type="text/css"> <link href="/assets/admin/cancerpredict.css" media="screen" rel="stylesheet">
thead > tr > th{
border:1px solid;
background: bisque;
}
tbody{
background:white;
}
tbody > tr > td{
border:1px solid;
position: relative;
}
.show_li,.show_li *{
list-style:none;
color:balck;
}
.show_li ul{
display:none;
}
#clicktosee{
color:blue;
cursor:pointer;
}
table .checkbox{
left: 50%;
position: absolute;
transform: translate(-50%, -50%) !important;
top: 50%;
}
#updatebtn{
margin-top: 1em;
right: 1em;
background-color: #0088cc;
color: white;
border: 0em;
padding: 0.125em 0.5em;
border-radius: 0.5em;
}
.show_span{
margin: 1em;
float: left;
background-color: rgb(210, 105, 0);
color: white;
border: 0em;
padding: 0.125em 0.5em;
border-radius: 0.5em;
width: fit-content;
}
.label_left{
float: left;
padding-right: 0.5em;
}
</style>
<script> <script>
$('.text_choice').click(function(){ $('.text_choice').click(function(){
$('.text_choice').prop('checked' , false); $('.text_choice').prop('checked' , false);

View File

@ -15,6 +15,13 @@ en:
title: title of the page of predict tool title: title of the page of predict tool
title_text: title texts title_text: title texts
add_image: add image add_image: add image
years: Years
table_above_texts: Texts above table
text_above_texts: Texts above text
surgery_only_texts: Surgery only texts
extra_texts: Extra texts
extra_therapy_texts: Extra therapy texts
danger_texts: Warning texts
table: table:
welcome: Welcome to The after breast cancer healing system of Taiwanprepare!\nTo start, please enter the relevant information below. welcome: Welcome to The after breast cancer healing system of Taiwanprepare!\nTo start, please enter the relevant information below.
Reset: Reset Reset: Reset
@ -39,9 +46,9 @@ en:
Hormonetherapy: Hormone therapy Hormonetherapy: Hormone therapy
Chemotherapy: Chemotherapy Chemotherapy: Chemotherapy
years: years years: years
result: result result: Results
table: Table table: Table
curve: Curves curve: Curves
text: Texts text: Texts
Therapy_choice: Therapy_choices Therapy_choice: Treatment options

View File

@ -15,6 +15,13 @@ zh_tw:
title: 預測工具頁面標題 title: 預測工具頁面標題
title_text: 標題文字 title_text: 標題文字
add_image: 新增圖片 add_image: 新增圖片
years:
table_above_texts: 在表格上方的文字
text_above_texts: 在文字區塊上方的文字
surgery_only_texts: 純手術的文字
extra_texts: 額外文字
extra_therapy_texts: 額外治療的文字
danger_texts: 警告文字
table: table:
welcome: 歡迎使用台灣準備乳癌癒後系統!\n若要開始 請在下方輸入相關資訊 welcome: 歡迎使用台灣準備乳癌癒後系統!\n若要開始 請在下方輸入相關資訊
Reset: 重置 Reset: 重置

View File

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

View File

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