62 lines
6.9 KiB
Ruby
62 lines
6.9 KiB
Ruby
class Cancerpredictfields
|
||
include Mongoid::Document
|
||
include Mongoid::Timestamps
|
||
include OrbitModel::Status
|
||
include OrbitModel::Impression
|
||
# encoding: utf-8
|
||
include OrbitTag::Taggable
|
||
include OrbitCategory::Categorizable
|
||
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},
|
||
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=>"ratio",:name=>{"zh_tw"=>"淋巴結陽性比例<br/>(node-positive ratio)","en"=>"node-positive ratio"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[0,1],:right=>0,:is_float=>1},
|
||
3=>{: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},
|
||
4=>{:variable=>"subtype",:name=>{"zh_tw"=>"乳癌分型<br/>(breast cancer subtype)","en"=>"breast cancer subtype"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'<p>HER2:第二型人類上皮成長因子接受器蛋白(HER2-enriched)過度表現型</p><p>若無分型資訊,請選擇“未知”選項,將以佔多數比例的管腔類進行預測。</p>','en'=>''}, :choice_fields=> {"zh_tw"=>['管腔類','HER2','三陰性','未知'],"en"=>['Luminal-like','HER2','Triple negative','unknown']},:range=>[],:right=>1,:is_float=>0},
|
||
5=>{:variable=>"pstage",:name=>{"zh_tw"=>"病理分期<br/>(pathologic stage)","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,:is_float=>0},
|
||
6=>{: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}
|
||
}
|
||
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'=>'<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>'+
|
||
'<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=>[]},
|
||
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)}
|
||
#before_create :set_expire
|
||
def update_user
|
||
User.find(update_user_id) rescue nil
|
||
end
|
||
def update_user=(user)
|
||
self.update_user_id = user.id
|
||
end
|
||
def email_members
|
||
MemberProfile.find(self.email_member_ids) rescue []
|
||
end
|
||
def email_addresses
|
||
addresses = self.email_members.collect{|member| member.email} rescue []
|
||
addresses = addresses +[self.other_mailaddress] if !self.other_mailaddress.blank?
|
||
addresses.flatten
|
||
end
|
||
def email
|
||
mail = Email.find(self.email_id) rescue nil
|
||
end
|
||
def expired?
|
||
(self.deadline < Time.now) rescue false
|
||
end
|
||
def destroy_email
|
||
mail = Email.find(self.email_id) rescue nil
|
||
mail.destroy if !mail.nil?
|
||
end
|
||
def self.remove_expired_status
|
||
self.where(:is_top => true, :top_end_date.ne => nil, :top_end_date.lt => Time.now).each do |b|
|
||
b.is_top = false
|
||
b.top_end_date = nil
|
||
b.save
|
||
end
|
||
end
|
||
end |