Permalink
Browse files

in progress

  • Loading branch information...
1 parent f2870f8 commit 2e84992b56a4f4f21ab9068e76cee12d47b81ae3 @MikeBlyth committed Jan 22, 2013
@@ -39,6 +39,33 @@ def show_exam(visit)
return noted_str + normal_str.capitalize
end
+ def hiv_status_summary(visit)
+ para = []
+ para << "HIV stage #{visit.hiv_stage || 'not noted'}"
+ para << "ARV status: #{Visit.arv_statuses[visit.arv_status] || visit.arv_status || 'not noted'}"
+ regimen = visit.arv_reg_str
+ para << "ARV regimen: #{regimen}" if regimen
+ assessment_choices = %w(stable drug_toxicity opportunistic_infection non_adherence).map do |status|
+ visit.send("assessment_#{status}") ? status.spacerize : nil
+ end.compact.join('; ').capitalize
+ para << assessment_choices if assessment_choices
+ return para.join('. ') +'.'
+ end
+
+ def visit_labs(visit)
+ visit.patient.lab_results.where(:date => (visit.date-4.hours)..(visit.date+24.hours)).
+ map {|lab| "#{lab.lab_service.abbrev}: #{lab.result}"}.join("; ")
+ end
+
+ def visit_drugs(visit)
+ visit.patient.prescriptions.where(:date => (visit.date)..(visit.date+24.hours)).map do |prescription|
+ prescription.prescription_items.map do |item|
+ "#{item.drug} #{item.dose} #{item.route} q#{item.interval} hr x #{item.duration} days."
+ end
+ end.join("; ")
+
+ end
+
def all_both(n)
case n
when 0, 1 then nil
View
@@ -136,13 +136,6 @@ def diagnosis_labels
diagnoses_array.map{|dx| dx.to_label}
end
- def arv_status_summary
- result = %w(stable drug_toxicity opportunistic_infection non_adherence).map do |status|
- self.send("assessment_#{status}") ? status : nil
- end.compact.join('; ')
- return "#{result}." if result
- end
-
# Default sort order will be on date
def <=>(x,y)
x.date <=> y.date
@@ -53,10 +53,10 @@
.span4= twitter_box('newdx', 'newdx', 'New diagnosis given?', @visit.newdx)
-#.span4= form.input :newdx, label: 'New diagnosis given?', :input_html=>{:class=>'input-mini'}
.controls-row.controls
- .span2= form.input :assessment_stable, label: "Stable", :input_html=>{:class=>'input-mini'}
- .span2= form.input :assessment_oi, label: "Active OI", :input_html=>{:class=>'input-mini'}
- .span2= form.input :assessment_drug_toxicity, label: "Drug toxicity", :input_html=>{:class=>'input-mini'}
- .span2= form.input :assessment_nonadherence, label: "Nonadherence", :input_html=>{:class=>'input-mini'}
+ .span3= form.input :assessment_stable, label: "Stable", :input_html=>{:class=>'input-mini'}
+ .span3= form.input :assessment_opportunistic_infection, label: "Active opportunistic infection", :input_html=>{:class=>'input-mini'}
+ .span3= form.input :assessment_drug_toxicity, label: "Drug toxicity", :input_html=>{:class=>'input-mini'}
+ .span3= form.input :assessment_non_adherence, label: "Non-adherence", :input_html=>{:class=>'input-mini'}
.controls-row.controls
.span8= form.input :assessment, input_html: {rows: '1', class: "input-block-level"}
%fieldset
@@ -1,5 +1,5 @@
= "HIV stage #{@visit.hiv_stage}." if @visit.hiv_stage
= "ARV status: #{Visit.arv_statuses[@visit.arv_status] || @visit.arv_status }." if @visit.arv_status
= "ARV regimen: #{@visit.arv_reg_str}."
-= "Assessment:"
-= "stabl"
+= "Assessment: #{arv_status_summary(@visit)}"
+
@@ -15,15 +15,15 @@
.row-fluid
%p.span6#labs
Labs at this visit:
- = render "visit_labs"
+ = visit_labs(@visit)
.row-fluid
%p.span6#hiv
HIV status:
- = render "hiv_status_para"
+ = hiv_status_summary(@visit)
.row-fluid
%p.span6#drugs
Drugs prescribed:
- = render "visit_drugs"
+ = visit_drugs(@visit)
%p.span6#plan
Other planned treatment:
= @visit.plan
@@ -20,6 +20,10 @@ def any?
def to_f_if_numeric
Float(self) rescue self
end
+
+ def spacerize
+ gsub!('_', ' ')
+ end
end
class NilClass

0 comments on commit 2e84992

Please sign in to comment.