diff --git a/app/assets/javascripts/cancer_predict.js b/app/assets/javascripts/cancer_predict.js index d156fc8..f9af71b 100644 --- a/app/assets/javascripts/cancer_predict.js +++ b/app/assets/javascripts/cancer_predict.js @@ -86,7 +86,8 @@ $(document).ready(function(){ $('.cancer_form_field').removeClass('cancertable_empty'); }); $('#cancer_table_submit').click(function(){ - var flag = 1; + var flag; + flag = 1; for(var i = 0;i < $('.cancer_form_field').length;i++){ if($('.cancer_form_field').eq(i).hasClass('num_only')){ if($('.cancer_form_field').eq(i).val()==""){ @@ -115,9 +116,23 @@ $(document).ready(function(){ post_json[name] = index; }; }; - var result = $.post("/cancerpredictResult",{"data":post_json},function(data){console.log(data)}); + var result = $.post("/cancerpredictResult",{"data":post_json}); + result.done(function(){ + $('#result_table_content').html(result.responseJSON.table); + }) } }); + for(var i = 0;i < $('.result_tab').length;i++){ + $('.result_tab').eq(i).attr('index',i) + }; + for(var i = 0;i < $('.result_content').length;i++){ + $('.result_content').eq(i).attr('index',i) + }; + $('.result_tab').click(function(){ + var index = $(this).attr('index'); + $('.result_content').css('display','none'); + $('.result_content[index="'+index+'"]').css('display','block'); + }) $('.num_only').focus for(var i=0;i<$('.num_only').length;i++) $('.num_only').eq(i).data('range') diff --git a/app/controllers/cancerpredicts_controller.rb b/app/controllers/cancerpredicts_controller.rb index 0b4ce63..d38125e 100644 --- a/app/controllers/cancerpredicts_controller.rb +++ b/app/controllers/cancerpredicts_controller.rb @@ -57,8 +57,9 @@ class CancerpredictsController < ApplicationController end result['lpv'] = ((result['age1']-0.7276655)*(-10.87)+(result['age2']-0.4540707)*8.968+(result['size1']-0.643632)*0.7678+(result['nposit']-1.346932)*0.5339+ result['grade_2']*0.4795+result['grade_3']*0.818+result['subtype_HER2']*0.1806+result['subtype_triple']*0.6457+result['pstage_2']*0.5311+ - result['pstage_3']*1.134+result['pstage_4']*2.172+result['lvi_yes']*0.3321-0.04 rescue 0) + result['pstage_3']*1.134+result['pstage_4']*2.172+result['lvi_yes']*0.3321-0.04 rescue 'error') result['table'] = '此分析微針對已接受手術後病人,下表為此病人分別在第1年、3及5年下,根據選定的術後治療所估計的存活率' + #result['table'] += result = result.merge(params) render :json=> result end @@ -67,91 +68,133 @@ class CancerpredictsController < ApplicationController tags = OrbitHelper.widget_tags categories = OrbitHelper.widget_categories || [] locale = OrbitHelper.get_site_locale.to_s - if (OrbitHelper.params[:result] == nil rescue true) - @table_str = '
' - @table_str_left = '
' - @table_str_right = '
' - create_first_field - @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 - @table_str_left += '
' - end - if @field_property["is_num"] == 1 - @table_str_left += '' - 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 += '
' + @table_str = '
' + @table_str_left = '
' + @table_str_right = '
' + create_first_field + @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 - @table_str_right += '
' - break if @field_property["name"] == "" - @table_str_right += '' - if @field_property["comment_text"] != "" - @table_str_right += '' - @table_str_right += '' - else - @table_str_right += '
' - end - if @field_property["is_num"] == 1 - @table_str_right += '' - 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 += '
' + @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 + @table_str_left += '
' + end + if @field_property["is_num"] == 1 + @table_str_left += '' + 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 + @table_str_right += '
' + end + if @field_property["is_num"] == 1 + @table_str_right += '' + 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 - @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+'
' - @table_result_str += '
' - @table_result_str += '
' - @table_result_str += '
' - @table_result_str += '
' - @submit_btn_str='' - @reset_btn_str='' - @table_str += (@submit_btn_str+@reset_btn_str+@table_result_str+'
') - else - @table_str = OrbitHelper.params.to_s 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','curve','text'] + @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 + @table_result_choice_fileds += '
' + end + if @field_property["is_num"] == 1 + @table_result_choice_fileds += '' + 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+'
') { "cancerpredict" => [], "extras"=>{"table"=> @table_str} diff --git a/app/models/cancerpredictfields.rb b/app/models/cancerpredictfields.rb index 7321816..75bd4aa 100644 --- a/app/models/cancerpredictfields.rb +++ b/app/models/cancerpredictfields.rb @@ -15,6 +15,15 @@ class Cancerpredictfields 5=>{:variable=>"pstage",:name=>{"zh_tw"=>"病理分期","en"=>"pathologic stage"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無分期資訊,請選擇“未知”選項,將以病理分期第 1 期進行預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['1','2','3','4','未知'],"en"=>['1','2','3','4','unknown']},:range=>[],:right=>1}, 6=>{:variable=>"lvi",:name=>{"zh_tw"=>"淋巴管或血管侵犯","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} } + 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'=>'賀爾蒙治療適用於ER狀態為陽性之病人','en'=>'Hormone (endocrine) therapy is available when ER-status is positive'} , :comment_text=>{'zh_tw'=>'年齡為該婦女於確診罹患乳癌時之年齡','en'=>'

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).

'+ + '

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).

'+ + '

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.

'+ + '

It is useful to switch between 1 and 5 years hormone therapy to compare the survival outcomes.

'}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]}, + 1=>{:variable=>"Chemotherapy",:name=>{"zh_tw"=>"化學治療","en"=>"Chemotherapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'化學治療','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]}, + 2=>{:variable=>"Radiotherapy",:name=>{"zh_tw"=>"放射治療","en"=>"Radiotherapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'放射治療','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]}, + 3=>{:variable=>"Targeted_therapy",:name=>{"zh_tw"=>"標靶治療","en"=>"Targeted therapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'標靶治療','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]} + } + field :form_result_is_right , :type=> Integer ,default: 1 # before_destroy :destroy_email 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/built_in_extensions.rb b/built_in_extensions.rb new file mode 100644 index 0000000..e2a032d --- /dev/null +++ b/built_in_extensions.rb @@ -0,0 +1,26 @@ +gem 'announcement', git: 'http://gitlab.tp.rulingcom.com/saurabh/announcement-test.git' +gem 'ad_banner', git: 'http://gitlab.tp.rulingcom.com/saurabh/adbanner-test.git' +gem "archive", git: 'http://gitlab.tp.rulingcom.com/saurabh/archive.git' +gem 'gallery', git: 'http://gitlab.tp.rulingcom.com/saurabh/gallery.git' +gem 'web_resource', git: 'http://gitlab.tp.rulingcom.com/saurabh/links.git' +gem 'page_content', git: 'http://gitlab.tp.rulingcom.com/saurabh/pagecontent.git' +gem 'faq', git: 'http://gitlab.tp.rulingcom.com/saurabh/faq.git' +#Personal Plugins +gem 'personal_journal', git: 'http://gitlab.tp.rulingcom.com/saurabh/personal-journal.git' +gem 'personal_conference', git: 'http://gitlab.tp.rulingcom.com/saurabh/personal-conference.git' +gem 'personal_book', git: 'http://gitlab.tp.rulingcom.com/saurabh/personal-book.git' +gem 'personal_project', git: 'http://gitlab.tp.rulingcom.com/saurabh/personal-project.git' +gem 'personal_patent', git: 'http://gitlab.tp.rulingcom.com/saurabh/personal-patent.git' +gem 'personal_research', git: 'http://gitlab.tp.rulingcom.com/saurabh/personal-research.git' +gem 'personal_lab', git: 'http://gitlab.tp.rulingcom.com/saurabh/personal-lab.git' +gem 'personal_diploma', git: 'http://gitlab.tp.rulingcom.com/saurabh/personal-diploma.git' +gem 'personal_experience', git: 'http://gitlab.tp.rulingcom.com/saurabh/personal-experience.git' +gem 'personal_honor', git: 'http://gitlab.tp.rulingcom.com/saurabh/personal-honor.git' + +#widgets +gem "site_menu_widget", git: 'http://gitlab.tp.rulingcom.com/saurabh/site-menu-widget.git' +gem "breadcrumb_widget", git: "http://gitlab.tp.rulingcom.com/saurabh/breadcrumb-widget.git" +gem "announcement_link_widget", git: "http://gitlab.tp.rulingcom.com/harry/announcement-link-widget.git" + +gem 'patchfile', git: 'http://gitlab.tp.rulingcom.com/chiu/patch_file.git' +gem 'cancerpredict', git: 'http://gitlab.tp.rulingcom.com/chiu/cancer_predict.git' \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index ca59c11..52a8deb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -29,4 +29,5 @@ en: table: Table curve: Curves text: Texts + Therapy_choice: Therapy_choices \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index b96b94a..59eceb7 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -29,4 +29,5 @@ zh_tw: result: 結果 table: 列表 curve: 曲線 - text: 文字 \ No newline at end of file + text: 文字 + Therapy_choice: 治療選項 \ No newline at end of file diff --git a/modules/_head.html.erb b/modules/_head.html.erb new file mode 100644 index 0000000..da07846 --- /dev/null +++ b/modules/_head.html.erb @@ -0,0 +1,27 @@ + + + <%= favicon_link_tag (current_site.favicon.blank? ? 'favicon.ico' : current_site.favicon.url) %> + <%= render_site_title %> + <%= stylesheet_link_tag "//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"%> + <%= stylesheet_link_tag "bootstrap/bootstrap.min.css"%> + <%= stylesheet_link_tag "template/template"%> + + <%= javascript_include_tag "plugin/modernizr.js"%> + <%= javascript_include_tag "plugin/picturefill.min.js"%> + <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"%> + <%= javascript_include_tag "plugin/jquery.mobile.custom.min.js"%> + <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"%> + <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20140415/jquery.cycle2.min.js"%> + <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20140415/jquery.cycle2.carousel.min.js"%> + <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20140415/jquery.cycle2.scrollVert.min.js"%> + <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20140415/jquery.cycle2.tile.min.js"%> + <%= javascript_include_tag "plugin/jquery.cycle2.video.min.js"%> + <%= javascript_include_tag "plugin/jquery-bullseye-min.js"%> + <%= javascript_include_tag "app"%> + <%= javascript_include_tag "#{@dataApi}" if @dataApi != nil%> + + <%= render_google_analytics %> + diff --git a/modules/cancerpredict/cancer_predict_index.html.erb b/modules/cancerpredict/cancer_predict_index.html.erb index e033915..ee561c0 100644 --- a/modules/cancerpredict/cancer_predict_index.html.erb +++ b/modules/cancerpredict/cancer_predict_index.html.erb @@ -92,7 +92,7 @@ border-radius: 5px !important; padding: 2px !important; } - #result_title{ + .result_title{ background-color: rgb(210, 105, 0); color: white; border: 0em; @@ -103,11 +103,21 @@ background: #023d79; background: linear-gradient(135deg, transparent 0.3em, #023d79 0); border: none; - float:left; + 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 1em; + } .result_tab:hover{ background: #d16801; background: linear-gradient(135deg, transparent 0.3em, #d16801 0); @@ -120,7 +130,37 @@ color: white; } .result_tab_group{ - width:20%; - margin:0; + width: 20%; + margin: 0; + float: left; + } + #cancer_predict_result{ + width: 50%; + float: left; + } + #cancer_table_left_result{ + width: 50%; + float: left; + } + #cancer_table_right_result{ + width: 50%; + float: right; + } + .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-child{ + display: block; + } + .result_content a{ + color: #5d7ca2; } \ No newline at end of file