Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

in progress

  • Loading branch information...
commit f1d0272973d75409915e0801c10185af96ce2b4c 1 parent f1f0469
@MikeBlyth authored
View
4 app/assets/stylesheets/ptbase.scss
@@ -36,4 +36,8 @@ select {
}
select[multiple], select[size] {
height: auto;
+}
+
+.checkbox-table {
+ margins: 1em 0 1em
}
View
19 app/controllers/visits_controller.rb
@@ -3,11 +3,22 @@ class VisitsController < ApplicationController
before_filter :authenticate_user!
active_scaffold :visit do |config|
- config.list.columns = :patient, :date,:weight, :dx, :dx2, :meds, :adm, :symptoms
- config.create.link.page = true
- config.create.link.inline = false
+ config.list.columns = :patient, :date,:weight, :dx, :dx2, :meds, :adm
+ # ToDo - when refactoring, put this lambda or a method somewhere where all the controllers can access it,
+ # if still using AS
+ as_no_inline = lambda do |action|
+ config.send(action).link.page = true
+ config.send(action).link.inline = false
+ end
+ [:create, :update, :show].each &as_no_inline
+ %w(weight dx meds adm).each {|col| config.columns[col].inplace_edit = true}
end
-
+ #
+ #def as_not_inline(config, action)
+ # config.send(action).link.page = true
+ # config.send(action).link.inline = false
+ #end
+ #
def new
patient = Patient.find params[:patient_id]
@visit = Visit.new(patient: patient) #ToDO Error checking!
View
11 app/helpers/application_helper.rb
@@ -28,7 +28,16 @@ def concat_list(alist, delim=', ', end_delim='. ', str_if_empty='' )
def patient_name_link(patient)
link_to "#{patient.name} [#{patient.ident}]", patient_path(patient)
- end
+ end
+
+ def twitter_box(id, name, label, checked)
+ #id = "#{name}_id"
+ #box = check_box_tag("#{object_name}[#{section_name}][#{field.name}]", 1, record.send(section_name)[field.name])
+ #label = label_tag "#{object_name}_#{section_name}_#{field.name}", box+field.to_label, class: 'checkbox inline'
+ is_checked = checked ? " checked='checked'" : ''
+ box = "<input type='checkbox' id='#{id}' name='#{name}' value='1' #{is_checked}>".html_safe
+ "<label for='#{id}' class='checkbox inline' >".html_safe + box + label.html_safe + "</label>".html_safe
+ end
# ToDo These should probably go into a presenter
# The following methods logically should be in visit_helper, but they're needed when the visit is
View
18 app/helpers/selectable_items_helper.rb
@@ -16,15 +16,21 @@ def check_boxes(record, section_name, columns=4) # section is attribute name fo
field = fields[i]
unless i >= fields.count
#box = check_box :visit, field.to_tag
- label = label_tag :visit, field.to_label
- box = check_box_tag("visit[#{section_name}][#{field.name}]", 1, record.send(section_name)[field.name])
+ #box = check_box_tag("visit[#{section_name}][#{field.name}]", 1, record.send(section_name)[field.name])
+ #box_with_label = label_tag "visit_#{section_name}_#{field.name}", box+field.to_label, class: 'checkbox inline'
+ # **************************
+ name = "visit[#{section_name}][#{field.name}]"
+ id = "visit_#{section_name}_#{field.name}"
+ checked = record.send(section_name)[field.name]
+ box_with_label = twitter_box(id, name, field.name, checked)
+ # **************************
comment = field.with_comment ? text_field_tag("visit[#{section_name}][#{field.name}_comment]") : nil
- row_contents << content_tag(:td, label+box+comment)
+ row_contents << content_tag(:td, box_with_label+comment)
end
end
table_contents << content_tag(:tr, row_contents)
end
- return content_tag(:table, table_contents, {class: 'table-striped', style: 'width: 100%'})
+ return content_tag(:table, table_contents, {class: 'table-striped checkbox-table', style: 'width: 100%'})
end
def selections_to_string(record, section_name)
@@ -44,8 +50,8 @@ def selectable_selected(record, section_name)
stored_hash = record.send(section_name)
return {} if stored_hash.nil?
comments, basic =stored_hash.partition {|x| x[0] =~ /_comment\Z/}
- basic.each { |b| merged[b[0]] = (b[1] == 'true') ? '' : b[1] }
- comments.each do |comment|
+ basic.each { |b| merged[b[0]] = (b[1] == 'true' || b[1] == '1') ? '' : b[1] }
+ comments.select{|comment| comment[1].present?}.each do |comment|
source_key = comment[0][0..-9]
merged[source_key] = [merged[source_key], comment[1]].join ('--')
end
View
9 app/models/visit.rb
@@ -107,6 +107,9 @@ def arv_reg_str
# X = Stop
# V = change
+ def self.arv_statuses
+ {'0'=> 'none', 'P'=>'preparing', 'B'=>'beginning', 'C'=>'Continuing', 'X' => 'stopping', 'V'=>'changing' }
+ end
def self.starting_arv
self.where("arv_status =?", 'B')
@@ -133,6 +136,12 @@ def diagnosis_labels
diagnoses_array.map{|dx| dx.to_label}
end
+ def arv_status_summary
+ %w(stable drug_toxicity opportunistic_infection nonadherence).map |status|
+ self.send "assessment_#{status}" ? status : nil
+ end.compact.join('; ')
+ end
+
# Default sort order will be on date
def <=>(x,y)
x.date <=> y.date
View
20 app/views/visits/_arv_regimen.html.haml
@@ -1,11 +1,15 @@
- visit = arv_regimen
= simple_fields_for visit do |form|
- = form.input :reg_zidovudine, label: 'zidovudine'
- = form.input :reg_stavudine, label: 'stavvudine'
- = form.input :reg_lamivudine , label: 'lamivudine'
- = form.input :reg_didanosine, label: 'didanosine'
- = form.input :reg_nevirapine , label: 'nevirapine'
- = form.input :reg_efavirenz, label: 'efavirenz'
- = form.input :reg_kaletra, label: 'kaletra'
- = form.input :arv_regimen
+ .controls-row
+ .span2= form.input :reg_zidovudine, label: 'zidovudine'
+ .span2= form.input :reg_stavudine, label: 'stavudine'
+ .controls-row
+ .span2= form.input :reg_lamivudine , label: 'lamivudine'
+ .span2= form.input :reg_didanosine, label: 'didanosine'
+ .controls-row
+ .span2= form.input :reg_nevirapine , label: 'nevirapine'
+ .span2= form.input :reg_efavirenz, label: 'efavirenz'
+ .span2= form.input :reg_kaletra, label: 'kaletra'
+ .controls-row
+ .span4= form.input :arv_regimen, label: 'ARV regimen'
%p Remember to add JS validation for ARVs, mainly for ZDV/stavudine
View
18 app/views/visits/_form.html.haml
@@ -40,17 +40,18 @@
%fieldset
%legend Physical Exam
- %p.form_instruction Tick box if this part of exam is normal.
+ %p.form_instruction Tick box if this part of exam is normal. Put findings or comments into the boxes.
= check_boxes(@visit, :physical)
.controls
- .span6= form.input :phys_exam, input_html: {rows: '1', class: "input-block-level"}
+ .span6= form.input :phys_exam, label: 'Other findings', input_html: {rows: '1', class: "input-block-level"}
%fieldset
%legend Assessment and Diagnosis
.controls-row.controls
= check_boxes(@visit, :diagnoses)
.controls-row.controls
.span6= form.input :dx, label: 'Other diagnoses', :input_html=>{:class=>'input-xlarge'}
- .span4= form.input :newdx, label: 'New diagnosis given?', :input_html=>{:class=>'input-mini'}
+ .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'}
@@ -63,6 +64,7 @@
.controls-row.controls
.span6= form.input :development, input_html: {rows: '1', class: "input-block-level"}
.controls-row.controls
+ %p.span2.pull-left <b>Diet</b>
.span2= form.input :diet_breast, label: 'Breast', :input_html=>{:class=>'input-mini'}
.span2= form.input :diet_breastmilk_substitute, label: 'Breast subst.' , :input_html=>{:class=>'input-mini'}
.span2= form.input :diet_pap, label: 'Pap', :input_html=>{:class=>'input-mini'}
@@ -70,14 +72,14 @@
.controls-row.controls
.span4= form.input :meds
.span4= form.input :comments
- .span2= form.input :anti_tb_status, label: 'Anti-TB status'
+ .span2= form.input :anti_tb_status, label: 'Anti-TB status', collection: %w(preparing beginning stopping continuing changing)
%fieldset
%legend HIV related
.controls-row.controls
- .span2= form.input :hiv_stage, :input_html=>{:class=>'input-mini'}
- .span2= form.input :arv_status, :input_html=>{:class=>'input-mini'}
- .span2= form.input :arv_missed, :input_html=>{:class=>'input-mini'}
- .span3= form.input :arv_missed_week, label: 'ARV missed weeks', :input_html=>{:class=>'input-mini'}
+ .span2= form.input :hiv_stage, label: 'HIV Stage (1-4)', :input_html=>{:class=>'input-small'}
+ .span3= form.input :arv_status, label: 'ARV Status', :input_html=>{:class=>'input-small'}, collection: %w(preparing beginning stopping continuing changing)
+ .span3= form.input :arv_missed, label: 'ARV doses missed', :input_html=>{:class=>'input-small'}
+ .span3= form.input :arv_missed_week, label: 'ARV weeks missed', :input_html=>{:class=>'input-small'}
.controls-row.controls
.span12= render(:partial => 'arv_regimen', object: @visit )
%fieldset
View
5 app/views/visits/_hiv_status_para.html.haml
@@ -0,0 +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"
View
12 app/views/visits/_physical_exam.html.haml
@@ -1,2 +1,14 @@
Physical exam:
+= "Vital signs: T #{@visit.temperature}C, P #{@visit.heart_rate}/min, Resp #{@visit.resp_rate}/min."
+- if @visit.sbp || @visit.dbp
+ = "BP #{@visit.sbp || '--'}/#{@visit.dbp || '--'}"
+ = "Weight #{@visit.weight} kg."
+- if @visit.weight
+ = "Weight #{@visit.weight} kg."
+- if @visit.height
+ = "Height #{@visit.weight} cm."
+- if @visit.mid_arm_circ
+ = "Mid-arm circ #{@visit.mid_arm_circ} cm."
+- if @visit.head_circ
+ = "Head circ #{@visit.weight} cm."
= show_exam(@visit)
View
1  app/views/visits/_visit_drugs.html.haml
@@ -0,0 +1 @@
+*** HERE ARE THE DRUGS FOR THIS VISIT
View
1  app/views/visits/_visit_labs.html.haml
@@ -0,0 +1 @@
+HERE ARE THE LABS FOR THIS VISIT
View
35 app/views/visits/show.html.haml
@@ -1,12 +1,29 @@
- @visit ||= @record
- patient = @visit.patient
%h2= "Visit for #{patient_name_link(patient)} on #{@visit.date}".html_safe
-%p= "Provider: #{@record.provider}"
-%p#diagnoses
- = render "diagnoses"
-%p#hpi
- History:
- = render "history"
-%p#exam
- Exam:
- = render "physical_exam"
+.row-fluid
+ %p.span6= "Provider: #{@record.provider}"
+ %p.span6#diagnoses
+ = render "diagnoses"
+.row-fluid
+ %p.span6#history
+ History:
+ = render "history"
+ %p.span6#exam
+ Exam:
+ = render "physical_exam"
+.row-fluid
+ %p.span6#labs
+ Labs at this visit:
+ = render "visit_labs"
+.row-fluid
+ %p.span6#hiv
+ HIV status:
+ = render "hiv_status_para"
+.row-fluid
+ %p.span6#drugs
+ Drugs prescribed:
+ = render "visit_drugs"
+ %p.span6#plan
+ Other planned treatment:
+ = @visit.plan
Please sign in to comment.
Something went wrong with that request. Please try again.