Skip to content

Commit

Permalink
added provider upload to patient admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hubley authored and eedrummer committed Mar 21, 2014
1 parent bd54381 commit fadef99
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 22 deletions.
17 changes: 17 additions & 0 deletions app/controllers/admin_controller.rb
Expand Up @@ -46,6 +46,23 @@ def upload_patients
redirect_to action: 'patients'
end

def upload_providers

file = params[:file]
FileUtils.mkdir_p(File.join(Dir.pwd, "tmp/import"))
file_location = File.join(Dir.pwd, "tmp/import")
file_name = "provider_upload" + Time.now.to_i.to_s + rand(1000).to_s

temp_file = File.new(file_location + "/" + file_name, "w")

File.open(temp_file.path, "wb") { |f| f.write(file.read) }

provider_tree = ProviderTreeImporter.new(File.open(temp_file))
provider_tree.load_providers(provider_tree.sub_providers)

redirect_to action: 'patients'
end

def users
@users = User.all.ordered_by_username
end
Expand Down
38 changes: 22 additions & 16 deletions app/views/admin/patients.html.erb
Expand Up @@ -5,7 +5,7 @@

$(document).ready(function() {
});

</script>
<% end -%>

Expand All @@ -16,26 +16,25 @@

<tr><td>patients loaded: </td>
<td>
<%= @patient_count %> patients
<%= @patient_count %> patients
</td>
<td>
<%= button_to "Delete Patients", "/admin/remove_patients", 'method' => 'delete', 'class' => 'btn btn-danger'%>
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>

<tr><td>cache counts: </td>
<td>
query cache: <%= @query_cache_count%> <br>
patient cache: <%= @patient_cache_count%>

</td>
<td>
<%= button_to "Delete Caches", "/admin/remove_caches", 'method' => 'delete', 'class' => 'btn btn-danger'%>
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>

<tr><td>providers loaded: </td>
<td>
<%= @provider_count %> providers
Expand All @@ -44,22 +43,29 @@
<td>
<%= button_to "Delete Providers", "/admin/remove_providers", 'method' => 'delete', 'class' => 'btn btn-danger'%>
</td>
</tr>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>

<tr><td colspan="2">&nbsp;</td></tr>

<tr><td colspan="2">&nbsp;</td></tr>
<%= form_tag("/admin/upload_patients", :method => "put", :multipart=>true) do %>
<tr><td>Upload patient zip file: </td>
<td>

<%= file_field_tag(:file)%>


</td>
<td><%= submit_tag("Upload", 'class' => "btn btn-success") %></td>
</tr>
</tr>
<% end %>


<tr><td colspan="2">&nbsp;</td></tr>
<%= form_tag("/admin/upload_providers", :method => "put", :multipart=>true) do %>
<tr><td>Upload provider opml file: </td>
<td>
<%= file_field_tag(:file)%>
</td>
<td><%= submit_tag("Upload", 'class' => "btn btn-success") %></td>
</tr>
<% end %>

</table>

</div> <!-- pageContent -->
13 changes: 7 additions & 6 deletions config/routes.rb
Expand Up @@ -12,33 +12,34 @@
post "admin/update_npi"
get "admin/patients"
put "admin/upload_patients"
put "admin/upload_providers"
delete "admin/remove_patients"
delete "admin/remove_caches"
delete "admin/remove_providers"

get "logs/index"

match 'provider/:npi', :to => "measures#index", :as => :provider_dashboard, :via => :get

match 'records', :to => 'records#create', :via => :post


root :to => 'home#index'

resources :providers do
resources :patients do
collection do
get :manage
put :update_all
end
end

member do
get :merge_list
put :merge
end
end

resources :teams

namespace :api do
Expand Down

0 comments on commit fadef99

Please sign in to comment.