his_emr_api_radiology 0.0.2 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6576d07080687e0df1b25241687622a81da1f30f26d0a467e89e08b81db0c60
4
- data.tar.gz: 484cfc967233e854a8a8f2b69a2c16fa3a83d4808f004064393e4135c3f0e55e
3
+ metadata.gz: b46ef467aa94dd97facd3b730fee3c7b4529f66d99e2feb3d60f0a07e2a6688e
4
+ data.tar.gz: '08f811c68013cdc6510ebe239f4bdb957d5aa2a3067fdb89c5c2f63e641137e7'
5
5
  SHA512:
6
- metadata.gz: ec2834a0dea01ca698e2ae3946e159f890c1fd9c204cdb7182cff23fd62cb6bc6fc59ba7b6ee1eb2af50200c7805ccf6b39d96d6205278a2605de8c8ab8034fe
7
- data.tar.gz: d38e52206f9853f1d2c5a9b17f816fabef3df40fdac307c31b233eb5b32c9cab1c59b4ef928e59b30857f635fc77255a0f761bcd995b35b60b20720834b81d75
6
+ metadata.gz: 2a09feb5e35ac53d77b5b83ef54cb507d8198276d9bb42dcb36ed95d4c075c58f1300b02f73dddc88e0f26d42bc0008748f18a3b0cd0435db4035b2ad1a09d40
7
+ data.tar.gz: eb2a73512bfafd03e9c8bf04cb327c435d28b34a66abdbfa7e58b35f356f6bf58eb1c592ae7cb387ec81fc6824e8c071550e4e4abc0cb27618634889da57bc8e
data/MIT-LICENSE CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
@@ -1,11 +1,22 @@
1
1
  # frozen_string_literal: true
2
+ require 'zebra_printer/init'
2
3
  class Radiology::RadiologyController < ::ApplicationController
4
+ before_action :authenticate, except: %i[print_order_label ]
3
5
  def create
4
6
  patient_details, physician_details, radiology_orders = params.require %i[patient_details physician_details radiology_orders]
5
7
  radiology_orders = service.generate_msi(patient_details,physician_details, radiology_orders)
6
8
  render json: radiology_orders, status: :created
7
9
  end
8
-
10
+ def show
11
+ render json: service.get_radiology_orders(params[:id])
12
+ end
13
+ def print_order_label
14
+ label = service.print_radiology_barcode(params[:accession_number],params[:patient_national_id], params[:patient_name], params[:radio_order], params[:date_created])
15
+ send_data(label, type: 'application/label; charset=utf-8',
16
+ stream: false,
17
+ filename: "#{SecureRandom.hex(24)}.lbl",
18
+ disposition: 'inline')
19
+ end
9
20
  def service
10
21
  Radiology::RadiologyService
11
22
  end
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,38 @@ 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
56
88
  end
57
89
  end
58
90
  end
data/config/routes.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  Radiology::Engine.routes.draw do
2
- resources :radiology, path: 'api/v1/radiology'
3
- resources :radiology_properties, path: 'api/v1/radiology_properties'
4
-
5
- get '/api/v1/radiology/barcode', to: 'labels#print_order_label'
2
+ resources :radiology, path: 'api/v1/radiology/radiology_orders'
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.2'
2
+ VERSION = '0.0.7'
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.2
4
+ version: 0.0.7
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-09 00:00:00.000000000 Z
11
+ date: 2021-08-10 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
@@ -217,9 +197,7 @@ files:
217
197
  - README.md
218
198
  - Rakefile
219
199
  - app/controllers/radiology/application_controller.rb
220
- - app/controllers/radiology/labels_controller.rb
221
200
  - app/controllers/radiology/radiology_controller.rb
222
- - app/controllers/radiology/radiology_properties_controller.rb
223
201
  - app/helpers/radiology/application_helper.rb
224
202
  - app/jobs/radiology/application_job.rb
225
203
  - app/mailers/radiology/application_mailer.rb
@@ -250,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
228
  - !ruby/object:Gem::Version
251
229
  version: '0'
252
230
  requirements: []
253
- rubygems_version: 3.2.16
231
+ rubygems_version: 3.0.8
254
232
  signing_key:
255
233
  specification_version: 4
256
234
  summary: Radiology extension for the HIS-EMR-API
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Radiology
4
- class LabelsController < ApplicationController
5
- skip_before_action :authenticate
6
-
7
- def print_order_label
8
- label = service.print_radiology_barcode(params[:accession_number],params[:patient_national_id], params[:patient_name], params[:radio_order], params[:date_created])
9
- send_data(label.print, type: 'application/label; charset=utf-8',
10
- stream: false,
11
- filename: "#{SecureRandom.hex(24)}.lbl",
12
- disposition: 'inline')
13
- end
14
- end
15
- end
@@ -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