This repository has been archived by the owner on Apr 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed from the following commits commit b8394a9 Author: Jordan Byron <jordan.byron@gmail.com> Date: Mon Mar 24 16:54:35 2014 -0400 Remove outdated printer update commit 2867aa6 Author: Jordan Byron <jordan.byron@gmail.com> Date: Mon Mar 24 16:54:14 2014 -0400 Add configuration option for redis host and port commit 0663c50 Author: Jordan Byron <jordan.byron@gmail.com> Date: Tue Mar 18 14:21:00 2014 -0400 Remove dependency on redis from tests + make them :green_heart: commit 8fc0ca1 Author: Jordan Byron <jordan.byron@gmail.com> Date: Tue Mar 18 11:02:46 2014 -0400 Font awesome, fallback to old print method commit 69bc374 Author: Jordan Byron <jordan.byron@gmail.com> Date: Fri Mar 14 16:36:21 2014 -0400 Check-in printer selection commit 00e819e Author: Jordan Byron <jordan.byron@gmail.com> Date: Fri Mar 14 16:15:48 2014 -0400 Don't clear all session data after logout commit 53b3ba9 Author: Jordan Byron <jordan.byron@gmail.com> Date: Fri Mar 14 15:47:38 2014 -0400 Add tests for PatientChart commit 5db154e Author: Jordan Byron <jordan.byron@gmail.com> Date: Tue Mar 11 12:28:00 2014 -0400 Background printing for patient charts commit 95b9730 Author: Gregory Brown <gregory.t.brown@gmail.com> Date: Wed Feb 26 15:38:17 2014 -0500 Use a proxy rather than a subclass to wrap Prawn's methods commit 9a22630 Author: Jordan Byron <jordan.byron@gmail.com> Date: Sun Feb 23 14:51:01 2014 -0500 Restore tests after pdf-izing patient charts commit 1efa454 Author: Jordan Byron <jordan.byron@gmail.com> Date: Sun Feb 23 13:49:16 2014 -0500 Generate patient charts with prawn for great justice
- Loading branch information
1 parent
9db68d3
commit 309d815
Showing
29 changed files
with
397 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ tmp/* | |
.rvmrc | ||
.bundle | ||
.env | ||
dump.rdb | ||
|
||
# CSV Import Files | ||
/zipcode.csv | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
//= require jquery | ||
//= require jquery_ujs | ||
//= require jquery-ui | ||
//= require twitter/bootstrap | ||
//= require ../../../vendor/assets/javascripts | ||
//= require mom.utilities | ||
//= require_tree . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class PrinterController < ApplicationController | ||
before_filter :authenticate_user! | ||
|
||
def update | ||
session[:printer] = params[:printer] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
class PatientChart | ||
def initialize(patient) | ||
@document = Prawn::Document.new(top_margin: 20, left_margin: 20, right_margin: 20) | ||
@patient = patient | ||
chart_header | ||
chart_table | ||
end | ||
|
||
def chart_header | ||
text patient.chart_number.to_s, size: 36, style: :bold, align: :right | ||
end | ||
|
||
def chart_table | ||
table [ | ||
[ label("Last name") + patient.last_name, | ||
label("First name") + patient.first_name, | ||
label("Date of birth") + patient.dob, | ||
label("Age") + patient.age.to_s, | ||
label("Phone") + phone_number, | ||
label("Gender") + patient.sex | ||
], | ||
[ | ||
label("Address") + patient.street, | ||
label("City") + patient.city, | ||
{ content: label("State") + patient.state, colspan: 2 }, | ||
{ content: label("Zip") + patient.zip, colspan: 2 } | ||
], | ||
[ | ||
label("Reason for visit") + patient.chief_complaint, | ||
label("Last dental visit") + patient.last_dental_visit, | ||
{ content: label("In pain?") + in_pain, colspan: 2 }, | ||
{ content: label("In pain for") + pain_length, colspan: 2 } | ||
] | ||
], | ||
cell_style: { inline_format: true, border_color: 'aaaaaa' }, | ||
position: :center | ||
end | ||
|
||
# proxy unhandled calls to Prawn | ||
def method_missing(m, *a, &b) | ||
@document.send(m, *a, &b) | ||
end | ||
|
||
private | ||
|
||
attr_reader :patient | ||
|
||
def label(text) | ||
"<font size='9'><color rgb='808080'>#{text}\n</color></font>" | ||
end | ||
|
||
def pain_length | ||
return "N/A" unless patient.pain? && patient.pain_length_in_days | ||
h.distance_of_time_in_words patient.pain_length_in_days.days.ago, Date.today | ||
end | ||
|
||
def phone_number | ||
h.number_to_phone(patient.phone.to_s.gsub(/[\(\)-\.]/,""), area_code: true) | ||
end | ||
|
||
def in_pain | ||
@patient.pain? ? 'Yes' : 'No' | ||
end | ||
|
||
def h | ||
ActionController::Base.helpers | ||
end | ||
end |
Oops, something went wrong.