his_emr_api_lab 0.0.12 → 0.0.13

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: 38f48eba209b710d53ac07d89c95e335f9578a2b2b2137550b8b48f0032355f9
4
- data.tar.gz: e6930b341721036f4aaeb8ab64551eb1ed4d35e6b80314d181488265e1cda0ba
3
+ metadata.gz: '00645812f301ba486329bfe76c91406af972fb152d9b08be82ca09bedb1715a2'
4
+ data.tar.gz: 9c1f1136ed92e903059e40adb0c66aa6f4ed7057fce3d71e70b973655df08679
5
5
  SHA512:
6
- metadata.gz: 2f9873af33a53537e59143efd1bf6b36fe5af1201be7cd463c42d14417babfb31640f3a46e12bd5dc73d709fa6075ea619a1faf868143f1f3f9a641341342c85
7
- data.tar.gz: dbc656255bdb6c160a71771c06532d533ec90f38a6d7e37f5d1880564dcacf874097fe2c5ce424da60602117674135fec6859dda4380f3c4ef20cf4fd3235777
6
+ metadata.gz: 5894ad876b761667077801c771b39d4f8dd7347a0cebe10886c513d6d2c9401dec7296c6dbf66788f5e2ceff05b15368de96c1c49a4223a560c1f44e5154ea95
7
+ data.tar.gz: c85f640154e2612b0b3943cc2332f7de7ee65db3a8401a241c55e53d9061cadb5ea24e69a4ca9d4a647f6468a6d5fa6160e2a8126d0e68865f551cab85e1e2c3
@@ -139,9 +139,17 @@ module Lab
139
139
  def find_patient_by_nhid(nhid)
140
140
  national_id_type = PatientIdentifierType.where(name: ['National id', 'Old Identification Number'])
141
141
  identifiers = PatientIdentifier.where(type: national_id_type, identifier: nhid)
142
+ .joins('INNER JOIN person ON person.person_id = patient_identifier.patient_id AND person.voided = 0')
142
143
  if identifiers.count.zero?
143
- identifiers = PatientIdentifier.unscoped.where(voided: 1, type: national_id_type, identifier: nhid)
144
+ identifiers = PatientIdentifier.unscoped
145
+ .where(voided: 1, type: national_id_type, identifier: nhid)
146
+ .joins('INNER JOIN person ON person.person_id = patient_identifier.patient_id AND person.voided = 0')
144
147
  end
148
+
149
+ # Joining to person above to ensure that the person is not voided,
150
+ # it was noted at one site that there were some people that were voided
151
+ # upon merging but the patient and patient_identifier was not voided
152
+
145
153
  return nil if identifiers.count.zero?
146
154
 
147
155
  patients = Patient.where(patient_id: identifiers.select(:patient_id))
data/lib/lab/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lab
4
- VERSION = '0.0.12'
4
+ VERSION = '0.0.13'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: his_emr_api_lab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elizabeth Glaser Pediatric Foundation Malawi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-30 00:00:00.000000000 Z
11
+ date: 2021-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: couchrest