his_emr_api_radiology 0.0.3 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a735c1b85659230dc78dabe513a515c3d8e6414e5b07aaf52520fbb5e220ee0
4
- data.tar.gz: d41d73146551ff5b755a63c5990e916342302c95f39bd842e0f4d640b77f2e50
3
+ metadata.gz: ab64d31ea8b7ec7e8829c80a82e4a62840f300ee3ed9e8b385c9e6d73b9dbd94
4
+ data.tar.gz: 2189afd1dc6fb546fb709195a172ecaf2dd90087e62b5ee32264e788731eac60
5
5
  SHA512:
6
- metadata.gz: 66c2dab2f6776d6f1662d1cf1a6cf06b6f5390f6e4aba9442d60d5644bee3f7ba25bc73fd62d166d291b9e9472843480a519ee2a87a19460d7d63091781a91b0
7
- data.tar.gz: 5e1c592d2a6238ba937becd1edde5ecdde0a293799792fff45f1552ef4a88e5afde73c119f4a552702d3c0ff562179da5ad31e6d18cdc79b5c43e7602674b6b5
6
+ metadata.gz: 9ff060fddcaa5f0f523e70a7b7d175813a94cbdfa00f94b284cd25a49fedf657e1f275ea9efb153f89b846036fdfbc0a8723a581f9ca280437b9c915f09d8a99
7
+ data.tar.gz: '0794b58ba818afaad4a5564b3c04f35d0cf0a82396b81f2c64cf37e7c97998f141987b6a7be373f353a3825a06de4f99767d2017a1b376da60a4431241ab1fe9'
data/MIT-LICENSE CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
@@ -1,12 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
  require 'zebra_printer/init'
3
- class Radiology::RadiologyOrdersController < ::ApplicationController
3
+ class Radiology::RadiologyController < ::ApplicationController
4
4
  before_action :authenticate, except: %i[print_order_label ]
5
5
  def create
6
6
  patient_details, physician_details, radiology_orders = params.require %i[patient_details physician_details radiology_orders]
7
7
  radiology_orders = service.generate_msi(patient_details,physician_details, radiology_orders)
8
8
  render json: radiology_orders, status: :created
9
9
  end
10
+ def show
11
+ render json: service.get_radiology_orders(params[:id])
12
+ end
13
+
14
+ def index
15
+ render json: service.get_previous_orders(params[:patient_id])
16
+ end
17
+
10
18
  def print_order_label
11
19
  label = service.print_radiology_barcode(params[:accession_number],params[:patient_national_id], params[:patient_name], params[:radio_order], params[:date_created])
12
20
  send_data(label, type: 'application/label; charset=utf-8',
File without changes
File without changes
File without changes
File without changes
@@ -15,7 +15,7 @@ module Radiology
15
15
  end
16
16
 
17
17
 
18
- sample_file_path = "/var/www/BHT-EMR-API/config/sample.msi"
18
+ sample_file_path = "#{Rails.root}/config/sample.msi"
19
19
  save_file_path = "/tmp/#{patient_details[:accession_number] }_#{patient_details[:patient_name].gsub(' ', '_')}_scheduled_radiology.msi"
20
20
 
21
21
  # using eval() might decrease performance, not sure if there's a better way to do this.
@@ -29,7 +29,7 @@ module Radiology
29
29
 
30
30
  # send created msi file to ftp server
31
31
  def send_scheduled_msi(file_path)
32
- main_config = YAML.load_file('/var/www/BHT-EMR-API/config/application.yml')
32
+ main_config = YAML.load_file("#{Rails.root}/config/application.yml")
33
33
  # connect with FTP server
34
34
  # NOTE: main_config[:ftp_host], main_config[:ftp_user_name], main_config[:ftp_pw] is in application.yml file.
35
35
  Net::FTP.open(main_config['ftp_host']) do |ftp|
@@ -53,6 +53,42 @@ module Radiology
53
53
 
54
54
  label.print(1)
55
55
  end
56
+
57
+ def get_radiology_orders(group_concept_id)
58
+ stats = []
59
+ i = 0
60
+
61
+ groupData = get_concept_names(group_concept_id)
62
+ (groupData || []).each do |groupRecord|
63
+ stats << {
64
+ concept_id: groupRecord['concept_id'],
65
+ group: groupRecord['name'],
66
+ complaints: [],
67
+ }
68
+
69
+ data = get_concept_names(groupRecord['concept_id'])
70
+ (data || []).each do |record|
71
+ stats[i][:complaints] << {
72
+ concept_id: record['concept_id'],
73
+ name: record['name'],
74
+ }
75
+ end
76
+
77
+ i += 1
78
+ end
79
+
80
+ stats
81
+ end
82
+
83
+ def get_concept_names(concept_id)
84
+ ConceptName.where("s.concept_set = ?
85
+ ", concept_id).joins("INNER JOIN concept_set s ON
86
+ s.concept_id = concept_name.concept_id").group("concept_name.concept_id").order(:name)
87
+ end
88
+
89
+ def get_previous_orders(patient_id)
90
+ Observation.where("person_id = ? AND voided =0 AND concept_id = 8426",patient_id).order('obs_datetime DESC')
91
+ end
56
92
  end
57
93
  end
58
94
  end
data/config/routes.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  Radiology::Engine.routes.draw do
2
- resources :radiology, path: 'api/v1/radiology/radiology_orders'
3
- resources :radiology_properties, path: 'api/v1/radiology_properties'
4
-
2
+ resources :radiology, path: 'api/v1/radiology/radiology_orders'
5
3
  get '/api/v1/radiology/barcode', to: 'radiology#print_order_label'
4
+ get '/api/v1/list_radiology_orders', to: 'radiology#show'
6
5
 
7
6
  end
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  module Radiology
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.8'
3
3
  end
File without changes
metadata CHANGED
@@ -1,35 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: his_emr_api_radiology
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - petros
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-10 00:00:00.000000000 Z
11
+ date: 2021-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.8'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.8.3
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.8'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 1.8.3
33
13
  - !ruby/object:Gem::Dependency
34
14
  name: rails
35
15
  requirement: !ruby/object:Gem::Requirement
@@ -218,7 +198,6 @@ files:
218
198
  - Rakefile
219
199
  - app/controllers/radiology/application_controller.rb
220
200
  - app/controllers/radiology/radiology_controller.rb
221
- - app/controllers/radiology/radiology_properties_controller.rb
222
201
  - app/helpers/radiology/application_helper.rb
223
202
  - app/jobs/radiology/application_job.rb
224
203
  - app/mailers/radiology/application_mailer.rb
@@ -249,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
228
  - !ruby/object:Gem::Version
250
229
  version: '0'
251
230
  requirements: []
252
- rubygems_version: 3.2.16
231
+ rubygems_version: 3.0.8
253
232
  signing_key:
254
233
  specification_version: 4
255
234
  summary: Radiology extension for the HIS-EMR-API
@@ -1,20 +0,0 @@
1
- require 'json'
2
- class Radiology::RadiologyPropertiesController < ::ApplicationController
3
- def create(success_response_status: :created)
4
- path, value = params.require %i[path property_value]
5
-
6
- file = File.read path
7
- hash = JSON.parse file
8
- if value == 'true'
9
- hash['encounters']['radiology orders']['available'] = true
10
- hash['encounters']['view radiology results']['available'] = true
11
- else
12
- hash['encounters']['radiology orders']['available'] = false
13
- hash['encounters']['view radiology results']['available'] = false
14
- end
15
- File.open path , "w" do |f|
16
- f.puts JSON.pretty_generate hash
17
- end
18
- render json: value, status: success_response_status
19
- end
20
- end