ruby-hl7-extensions 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: f00987811c9f22a5bb4e97052adc498c4e77c304
4
- data.tar.gz: 458ec85bb02f3ace9843fb108097436b7bebc617
3
+ metadata.gz: efaf834a166b854120c702029aa602d790d678c5
4
+ data.tar.gz: 9b19a36fe05d084582a06437d9e4391079fe7ab2
5
5
  SHA512:
6
- metadata.gz: 9c0339198f4f12038647d0662eae215f097841a1f6540c9a3a4eef17cfb273897c0622c1ec5b331b4bc441449a9b063b5dcc8550db29eb95d522d60dcdff491b
7
- data.tar.gz: 2174e08862f0c43bdf0f8e0743084a6829a7ea7f140462fce924ea71bb9dc8a553b7ad7ebef9abc77ae7afcae6098da1bce255c7719d821b0162aaa798ecee24
6
+ metadata.gz: b00d846b27efe17b7c287a370b67937775842cc4d438fd2e33851084909b4aa31725291dccd7df6ecc606da3b943266d927d4b13de0f15c9ff95a2f4aa9477a7
7
+ data.tar.gz: 8a844fa42b3a0150da77f52781e4050626abf3489fbac46eea5005cc7b85f1baed16d4929b6e3f4dee77e9e622264ea28e18c327b85191d62a67063e4f855778
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 3
4
+ :patch: 4
@@ -31,7 +31,7 @@ module Extensions
31
31
  end
32
32
 
33
33
  def event
34
- hash[:message][:content]["EVN"]
34
+ hash[:message][:content]["MSH"]["messageEvent"]
35
35
  end
36
36
 
37
37
  def sending_application
@@ -47,6 +47,12 @@ module Extensions
47
47
  Date.parse(hash["message"]["content"]["PID"]["dateTimeBirth"]).strftime("%B %d, %Y")
48
48
  end
49
49
 
50
+ def patient_mrn
51
+ pid = hash["message"]["content"]["PID"]
52
+ @pid ||= ::HL7::Message::Segment.from_hash("PID", pid)
53
+ @pid.mrn
54
+ end
55
+
50
56
  def patient_gender
51
57
  hash["message"]["content"]["PID"]["sex"]
52
58
  end
@@ -56,6 +62,11 @@ module Extensions
56
62
  a.to_enum(:each)
57
63
  end
58
64
 
65
+ def patient_visit
66
+ patient_visit = hash["message"]["content"]["PV1"]
67
+ ::HL7::Message::Segment.from_hash("PV1", patient_visit)
68
+ end
69
+
59
70
  def hash
60
71
  to_hash
61
72
  end
@@ -9,14 +9,22 @@ module Extensions
9
9
  end
10
10
 
11
11
  module InstanceMethods
12
+ def mrn
13
+ to_hash["internalId"]["id"]
14
+ end
15
+
12
16
  def to_hash
17
+ return @hash if @hash
18
+
13
19
  patient_name = self.patient_name.split("^") rescue Array.new(10) {|i| "" }
14
20
  address = self.address.split("^") rescue Array.new(10) {|i| "" }
15
21
  patientAccountNumber = self.account_number.split("^") rescue Array.new(10) {|i| "" }
16
-
22
+ internalId = self.patient_id_list.split("^") rescue Array.new(10) {|i| "" }
23
+
17
24
  @hash = {"setId" => self.set_id,
18
25
  "externalId" => self.patient_id,
19
- "internalId" => {"id" => self.patient_id_list, "type"=>""},
26
+ "internalId" => {"id" => internalId[0], "check_digit" => internalId[1], "check_digit_scheme" => internalId[2],
27
+ "assigning_authority" => internalId[3], "type" => internalId[4], "assigning_facility" => internalId[5]},
20
28
  "alternateId" => self.alt_patient_id,
21
29
  "patientName" => {"lastName" => patient_name[0], "firstName" => patient_name[1], "middleInitOrName"=> patient_name[2]},
22
30
  "mothersMaidenName" => self.mother_maiden_name,
@@ -9,6 +9,14 @@ module Extensions
9
9
  end
10
10
 
11
11
  module InstanceMethods
12
+ def [](key)
13
+ to_hash[key]
14
+ end
15
+
16
+ def account_number
17
+ to_hash["visit"]["id"]
18
+ end
19
+
12
20
  def admitting_provider_hash
13
21
  to_hash["admittingProvider"].merge("providerType" => "AD")
14
22
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ruby-hl7-extensions"
6
- s.version = "0.0.3"
6
+ s.version = "0.0.4"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-hl7-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Lega