health-data-standards 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/Gemfile +9 -1
  2. data/Rakefile +14 -4
  3. data/lib/health-data-standards.rb +23 -0
  4. data/lib/health-data-standards/export/ccr.rb +55 -56
  5. data/lib/health-data-standards/export/hdata/metadata.rb +16 -0
  6. data/lib/health-data-standards/export/html.rb +21 -0
  7. data/lib/health-data-standards/export/template_helper.rb +3 -0
  8. data/lib/health-data-standards/export/view_helper.rb +29 -5
  9. data/lib/health-data-standards/import/c32/condition_importer.rb +31 -33
  10. data/lib/health-data-standards/import/c32/encounter_importer.rb +4 -6
  11. data/lib/health-data-standards/import/c32/medication_importer.rb +1 -5
  12. data/lib/health-data-standards/import/c32/organization_importer.rb +23 -0
  13. data/lib/health-data-standards/import/c32/patient_importer.rb +1 -4
  14. data/lib/health-data-standards/import/c32/provider_importer.rb +43 -30
  15. data/lib/health-data-standards/import/c32/section_importer.rb +20 -41
  16. data/lib/health-data-standards/import/ccr/patient_importer.rb +27 -10
  17. data/lib/health-data-standards/import/ccr/provider_importer.rb +29 -41
  18. data/lib/health-data-standards/import/ccr/section_importer.rb +38 -27
  19. data/lib/health-data-standards/import/green_c32/allergy_importer.rb +20 -0
  20. data/lib/health-data-standards/import/green_c32/condition_importer.rb +2 -3
  21. data/lib/health-data-standards/import/green_c32/encounter_importer.rb +42 -0
  22. data/lib/health-data-standards/import/green_c32/immunization_importer.rb +23 -0
  23. data/lib/health-data-standards/import/green_c32/medication_importer.rb +69 -0
  24. data/lib/health-data-standards/import/green_c32/procedure_importer.rb +35 -0
  25. data/lib/health-data-standards/import/green_c32/result_importer.rb +21 -8
  26. data/lib/health-data-standards/import/green_c32/section_importer.rb +55 -9
  27. data/lib/health-data-standards/import/green_c32/social_history_importer.rb +18 -0
  28. data/lib/health-data-standards/import/green_c32/vital_sign_importer.rb +21 -0
  29. data/lib/health-data-standards/import/hdata/metadata_importer.rb +82 -0
  30. data/lib/health-data-standards/import/provider_import_utils.rb +23 -0
  31. data/lib/health-data-standards/models/address.rb +11 -0
  32. data/lib/health-data-standards/models/allergy.rb +1 -0
  33. data/lib/health-data-standards/models/condition.rb +1 -1
  34. data/lib/health-data-standards/models/encounter.rb +11 -6
  35. data/lib/health-data-standards/models/entry.rb +16 -5
  36. data/lib/health-data-standards/models/fulfillment_history.rb +3 -5
  37. data/lib/health-data-standards/models/immunization.rb +7 -1
  38. data/lib/health-data-standards/models/medication.rb +4 -3
  39. data/lib/health-data-standards/models/metadata/author.rb +16 -0
  40. data/lib/health-data-standards/models/metadata/base.rb +20 -0
  41. data/lib/health-data-standards/models/metadata/change_info.rb +9 -0
  42. data/lib/health-data-standards/models/metadata/link_info.rb +9 -0
  43. data/lib/health-data-standards/models/metadata/pedigree.rb +15 -0
  44. data/lib/health-data-standards/models/organization.rb +8 -0
  45. data/lib/health-data-standards/models/procedure.rb +5 -2
  46. data/lib/health-data-standards/models/provider.rb +6 -1
  47. data/lib/health-data-standards/models/record.rb +13 -3
  48. data/lib/health-data-standards/models/social_history.rb +3 -0
  49. data/lib/health-data-standards/models/telecom.rb +9 -0
  50. data/lib/health-data-standards/models/vital_sign.rb +2 -0
  51. data/lib/health-data-standards/util/code_system_helper.rb +3 -1
  52. data/templates/_address.gc32.erb +9 -0
  53. data/templates/_allergies.c32.erb +2 -2
  54. data/templates/_allergy.gc32.erb +13 -0
  55. data/templates/_care_goals.c32.erb +1 -1
  56. data/templates/_condition.gc32.erb +6 -6
  57. data/templates/_conditions.c32.erb +2 -2
  58. data/templates/_encounter.gc32.erb +32 -0
  59. data/templates/_encounters.c32.erb +1 -1
  60. data/templates/_immunization.gc32.erb +9 -0
  61. data/templates/_immunizations.c32.erb +1 -1
  62. data/templates/_medical_equipment.c32.erb +1 -1
  63. data/templates/_medication.gc32.erb +60 -0
  64. data/templates/_medications.c32.erb +1 -1
  65. data/templates/_narrative_block.c32.erb +1 -1
  66. data/templates/_organization.gc32.erb +10 -0
  67. data/templates/_pedigree.hdata.erb +24 -0
  68. data/templates/_procedure.gc32.erb +8 -0
  69. data/templates/_procedures.c32.erb +1 -1
  70. data/templates/_provider.gc32.erb +19 -0
  71. data/templates/_results.c32.erb +1 -1
  72. data/templates/_social_history.c32.erb +1 -1
  73. data/templates/_social_history.gc32.erb +6 -0
  74. data/templates/_telecom.gc32.erb +1 -0
  75. data/templates/_vital_sign.gc32.erb +12 -0
  76. data/templates/_vital_signs.c32.erb +1 -1
  77. data/templates/metadata.hdata.erb +35 -0
  78. data/templates/show.html.erb +287 -0
  79. metadata +50 -15
@@ -1,11 +1,11 @@
1
- <condition <% if condition.cause_of_death %> causeOfDeath="true" <% end %> xmlns="urn:hl7-org:greencda:c32">
2
- <id><%= condition.id%></id>
3
- <%== code_display result, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT'] %>
1
+ <condition <% unless condition.cause_of_death.nil? %>causeOfDeath="<%= condition.cause_of_death %>"<% end %> xmlns="urn:hl7-org:greencda:c32">
2
+ <id><%= condition.id %></id>
3
+ <%== code_display condition, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT'] %>
4
4
  <% if condition.name %>
5
- <name><%= condition.name%></name>
5
+ <name><%= condition.name %></name>
6
6
  <% end %>
7
7
  <effectiveTime>
8
- <start><%= Time.at(condition.start_time)%></start>
9
- <end><%= Time.at(condition.end_time)%></end>
8
+ <start><%= time_if_not_nil(condition.start_time, condition.time) %></start>
9
+ <end><%= time_if_not_nil(condition.end_time) %></end>
10
10
  </effectiveTime>
11
11
  </condition>
@@ -24,7 +24,7 @@
24
24
  <statusCode code="active"/>
25
25
  <% end -%>
26
26
  <effectiveTime>
27
- <low value="<%= Time.at(entry.time).utc.to_formatted_s(:number) %>"/>
27
+ <low <%= value_or_null_flavor(entry.as_point_in_time) %>/>
28
28
  </effectiveTime>
29
29
  <entryRelationship typeCode="SUBJ" inversionInd="false">
30
30
  <observation classCode="OBS" moodCode="EVN">
@@ -38,7 +38,7 @@
38
38
  </text>
39
39
  <statusCode code="completed"/>
40
40
  <effectiveTime>
41
- <low value="<%= Time.at(entry.time).utc.to_formatted_s(:number) %>"/>
41
+ <low <%= value_or_null_flavor(entry.as_point_in_time) %>/>
42
42
  </effectiveTime>
43
43
  <%== code_display(entry, {'tag_name' => 'value', 'extra_content' => 'xsi:type="CD"', 'preferred_code_sets' => ['SNOMED-CT']}) %>
44
44
  <% if entry.status -%>
@@ -0,0 +1,32 @@
1
+ <encounter xmlns="urn:hl7-org:greencda:c32">
2
+ <id><%= encounter.id %></id>
3
+ <code />
4
+ <%== code_display encounter, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT'] %>
5
+ <% if encounter.status %>
6
+ <status code="completed"/>
7
+ <% end %>
8
+ <effectiveTime>
9
+ <start><%= Time.at(encounter.start_time) %></start>
10
+ <% if encounter.end_time %>
11
+ <end><%= Time.at(encounter.end_time) %></end>
12
+ <% end %>
13
+ </effectiveTime>
14
+ <%== code_display encounter, "tag_name" => "dishcargeDisposition", 'attribute' => "discharge_disposition" %>
15
+ <%== code_display encounter, "tag_name" => "admissionType", 'attribute' => "admit_type" %>
16
+ <% if provider %>
17
+ <%= render partial: 'provider', locals: {provider: encounter.performer, tag_name: 'performer'}%>
18
+ <% end %>
19
+ <% facility = encounter.facility %>
20
+ <% if facility %>
21
+ <facility>
22
+ <id><%= facility.id%></id>
23
+ <name><%= facility.name%></name>
24
+ <% facility.addresses.each do |addr| %>
25
+ <%= render :partial => "address", locals: {address: addr} %>
26
+ <% end %>
27
+ <% facility.telecoms.each do |tele| %>
28
+ <%= render :partial => "telecom", locals: {telecom: tele} %>
29
+ <% end %>
30
+ <% end %>
31
+ </facility>
32
+ </encounter>
@@ -21,7 +21,7 @@
21
21
  <text>
22
22
  <reference value="#encounters-desc-<%= i %>"/>
23
23
  </text>
24
- <effectiveTime value="<%= Time.at(entry.time).utc.to_formatted_s(:number) %>"/>
24
+ <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
25
25
  </encounter>
26
26
  </entry>
27
27
  <% end -%>
@@ -0,0 +1,9 @@
1
+ <immunization <% if refused %> refused="true" <% end %> xmlns="urn:hl7-org:greencda:c32">
2
+ <id><%= immunization.id %></id>
3
+ <%== code_display immunization, "preferred_code_sets" => ["RxNorm", "SNOMED-CT"] %>
4
+ <administeredDate><%= Time.at(immunization.time)%></administeredDate>
5
+ <% if immunization.series_number %>
6
+ <seriesNumber><%= immunization.series_number %></seriesNumber>
7
+ <% end %>
8
+ <%== code_display immunization, "tag_name" => "refusalReason", "attribute" => "refusal_reason", "preferred_code_sets" => ["SNOMED-CT"] %>
9
+ </immunization>
@@ -21,7 +21,7 @@
21
21
  <reference value="#immunizations-desc-<%= i %>"/>
22
22
  </text>
23
23
  <statusCode code="completed"/>
24
- <effectiveTime value="<%= Time.at(entry.time).utc.to_formatted_s(:number) %>"/>
24
+ <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
25
25
  <doseQuantity nullFlavor="UNK"/>
26
26
  <consumable>
27
27
  <manufacturedProduct>
@@ -15,7 +15,7 @@
15
15
  <!-- Supply activity template -->
16
16
  <id root="<%= UUID.generate %>"/>
17
17
  <statusCode code="completed"/>
18
- <effectiveTime value="<%= Time.at(entry.time).utc.to_formatted_s(:number) %>"/>
18
+ <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
19
19
  <participant typeCode="DEV">
20
20
  <participantRole classCode="MANU">
21
21
  <templateId root="2.16.840.1.113883.10.20.1.52"/>
@@ -0,0 +1,60 @@
1
+ <medication>
2
+ <id><%= medication.id%></id>
3
+ <status>completed</status>
4
+ <freeTextSig><%= medication.free_text_sig%></freeTextSig>
5
+ <%== code_display medication, "tag_name" => "route", "attribute" => "route", "preferred_code_sets" => ["NCI Thesaurus"] %>
6
+ <%== quantity_display medication.dose, :dose %>
7
+ <% if medication.dose_indicator %>
8
+ <doseIndication><%medication.dose_indicator%></doseIndication>
9
+ <% end %>
10
+
11
+ <%== code_display medication, "tag_name" => "site", "attribute" => "site", "preferred_code_sets" => ["SNOMED-CT"] %>
12
+ <% if medication.dose_restriction %>
13
+ <doseRestriction>
14
+ <numerator><%= medication.dose_restriction["numerator"]%></numerator>
15
+ <denominator><%= medication.dose_restriction["denominator"]%></denominator>
16
+ </doseRestriction>
17
+ <% end %>
18
+ <% if medication.administration_timing %>
19
+ <administrationTiming institutionSpecified="<%= medication.administration_timing[:insitution_specified] %>">
20
+ <start><%= Time.at(medication.start_time) %></start>
21
+ <end><%= Time.at(medication.end_time)%></end>
22
+ <%== quantity_display medication.administration_timing["period"], :period %>
23
+ </administrationTiming>
24
+ <% end %>
25
+ <%== code_display medication, "tag_name" => "productForm", "attribute" => "product_form", "preferred_code_sets" => ["NCI Thesaurus"] %>
26
+ <% if medication.delivery_method %>
27
+ <%== code_display medication, "tag_name" => "deliveryMethod", "attribute" => "delivery_method", "preferred_code_sets" => medication.delivery_method.keys %>
28
+ <% end %>
29
+ <%== code_display medication, "tag_name" => "type", "attribute" => "type_of_medication", "preferred_code_sets" => ["SNOMED-CT"] %>
30
+ <%== code_display medication, "tag_name" => "statusOfMedication", "attribute" => "status_of_medication", "preferred_code_sets" => ["SNOMED-CT"] %>
31
+ <%== code_display medication, "tag_name" => "indication", "attribute" => "indication", "preferred_code_sets" => ["SNOMED-CT"] %>
32
+ <%== code_display medication, "tag_name" => "vehicle", "attribute" => "vehicle", "preferred_code_sets" => ["SNOMED-CT"] %>
33
+
34
+ <% if medication.dose_indicator %>
35
+ <doseIndicator><%= medication.dose_indicator %></doseIndicator>
36
+ <% end %>
37
+
38
+ <% if medication.patient_instructions %>
39
+ <patientInstructions><%=medication.patient_instructions%></patientInstructions>
40
+ <% end %>
41
+
42
+ <% if medication.fulfillment_instructions %>
43
+ <fulfillmentInstructions><%=medication.fulfillment_instructions%></fulfillmentInstructions>
44
+ <% end %>
45
+ <% medication.fulfillment_history.each do |fh| %>
46
+ <fulfillmentHistory <%if (fh.fill_status) %> fillStatus="<%=fh.fill_status%>" <% end %>
47
+ <% if fh.fill_number %> fillNumber="<%=fh.fill_number%>" <% end %>>
48
+ <prescriptionNumber><%=fh.prescription_number%></prescriptionNumber>
49
+ <dispenseDate><%= Time.at(fh.dispense_date)%></dispenseDate>
50
+ <%== quantity_display fh.quantity_dispensed, :quantityDispensed %>
51
+ </fulfillmentHistory>
52
+ <% end %>
53
+ <% medication.order_information.each do |oi| %>
54
+ <orderInformation <% if oi.order_number %><%= "orderNumber=\"#{oi.order_number}\"" %> <% end %> <% if oi.fills %> <%= "fills=\"#{oi.fills}\"" %> <% end %>>
55
+ <%== quantity_display oi.quantity_ordered, "quantityOrdered" %>
56
+ <orderDateTime><%= Time.at(oi.order_date_time)%></orderDateTime>
57
+ <expirationDateTime><%= Time.at(oi.order_expiration_date_time)%></expirationDateTime>
58
+ </orderInformation>
59
+ <% end %>
60
+ </medication>
@@ -18,7 +18,7 @@
18
18
  <id root="<%= UUID.generate %>"/>
19
19
  <statusCode code="completed"/>
20
20
  <effectiveTime xsi:type="IVL_TS">
21
- <low value="<%= Time.at(entry.time).utc.to_formatted_s(:number) %>"/>
21
+ <low <%= value_or_null_flavor(entry.as_point_in_time) %>/>
22
22
  <high nullFlavor="UNK"/>
23
23
  </effectiveTime>
24
24
  <consumable>
@@ -18,7 +18,7 @@
18
18
  <% entries.each_with_index do |entry, i| -%>
19
19
  <tr>
20
20
  <td ID="<%= section %>-desc-<%= i %>"><%= entry.description %></td>
21
- <td ID="<%= section %>-code-<%= i %>"><%= entry.codes_to_s %></td>
21
+ <td ID="<%= section %>-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
22
22
  <td><%= entry.times_to_s %></td>
23
23
  <% if status.present? %>
24
24
  <td><%= entry.status %></td>
@@ -0,0 +1,10 @@
1
+ <organization>
2
+ <id><%= organization.id%></id>
3
+ <name><%= organization.name%></name>
4
+ <% organization.addresses.each do |addr| %>
5
+ <%= render :partial => "address", locals: {address: addr} %>
6
+ <% end %>
7
+ <% organization.telecoms.each do |tele| %>
8
+ <%= render :partial => "telecom", locals: {telecom: tele} %>
9
+ <% end %>
10
+ </organization>
@@ -0,0 +1,24 @@
1
+ <PedigreeInfo>
2
+ <% unless pedigree.source_documents.empty? && pedigree.source_documents.empty?%>
3
+ <Source derived="true">
4
+ <% pedigree.source_documents.each do |source| %>
5
+ <PedigreeInfo>
6
+ <Author><%=source.author.name%></Author>
7
+ <Organization><%= source.organization %></Organization>
8
+ </PedigreeInfo>
9
+ <% end %>
10
+ <% pedigree.source_documents.each do |doc|%>
11
+ <Document>
12
+ <Target <% if doc.extension %> targetExtension="<%=doc.extension%>" <% end %>><%= doc.uri %></Target>
13
+ </Document>
14
+ </Source>
15
+ <% end %>
16
+ <% if pedigree.author %>
17
+ <Author typeCode="<%= pedigree.author.type %>" role="<%= pedigree.author.role%>">
18
+ <%= pedigree.author.name %>
19
+ </Author>
20
+ <% end %>
21
+ <% if pedigree.organization %>
22
+ <Organization><%= pedigree.organization %></Organization>
23
+ <% end %>
24
+ </PedigreeInfo>
@@ -0,0 +1,8 @@
1
+ <procedure xmlns="urn:hl7-org:greencda:c32">
2
+ <id><%= procedure.id %></id>
3
+ <%== code_display procedure, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT'] %>
4
+ <effectiveTime>
5
+ <start><%= time_if_not_nil(procedure.start_time, procedure.time)%></start>
6
+ <end><%= time_if_not_nil(procedure.end_time)%></end>
7
+ </effectiveTime>
8
+ </procedure>
@@ -23,7 +23,7 @@
23
23
  <reference value="#procedures-desc-<%= i %>"/>
24
24
  </text>
25
25
  <statusCode code="completed"/>
26
- <effectiveTime value="<%= Time.at(entry.time).utc.to_formatted_s(:number) %>"/>
26
+ <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
27
27
  </procedure>
28
28
  </entry>
29
29
  <% end -%>
@@ -0,0 +1,19 @@
1
+ <% tag_name ||= "provider" %>
2
+ <<%=tag_name%>>
3
+ <id><%=provider.id%></id>
4
+ <name>
5
+ <title><%=provider.title%></title>
6
+ <givenName><%= provider.given_name%></givenName>
7
+ <familyName><%= provider.family_name%></familyName>
8
+ </name>
9
+ <npi>1234567890</npi>
10
+ <specialty></specialty>
11
+ <% provider.addresses.each do |addr| %>
12
+ <%= render :partial => "address", locals: {address: addr} %>
13
+ <% end %>
14
+ <% provider.telecoms.each do |tele| %>
15
+ <%= render :partial => "telecom", locals: {telecom: tele} %>
16
+ <% end %>
17
+ <%= render :partial => "organization", locals: { organization: provider.organization } %>
18
+
19
+ </<%=tag_name%>>
@@ -44,7 +44,7 @@
44
44
  <reference value="#results-desc-<%= i %>"/>
45
45
  </text>
46
46
  <statusCode code="completed"/>
47
- <effectiveTime value="<%= Time.at(entry.time).utc.to_formatted_s(:number) %>"/>
47
+ <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
48
48
  <% if entry.value -%>
49
49
  <value xsi:type="PQ" value="<%= entry.value["scalar"] %>" <% if entry.value["units"]-%>unit="<%= entry.value["units"] %>"<% end -%>/>
50
50
  <% else -%>
@@ -18,7 +18,7 @@
18
18
  <id root="<%= UUID.generate %>"/>
19
19
  <%== code_display(entry, {:preferred_code_sets => ['SNOMED-CT']}) %>
20
20
  <statusCode code="completed"/>
21
- <effectiveTime value="<%= Time.at(entry.time).utc.to_formatted_s(:number) %>"/>
21
+ <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
22
22
  </observation>
23
23
  </entry>
24
24
  <% end -%>
@@ -0,0 +1,6 @@
1
+ <socialHistory xmlns="urn:hl7-org:greencda:c32">
2
+ <id><%= social_history.id%></id>
3
+ <status><%= social_history.status %></status>
4
+ <%== code_display social_history, 'preferred_code_sets' => ['SNOMED-CT'] %>
5
+ <%== quantity_display social_history.value %>
6
+ </socialHistory>
@@ -0,0 +1 @@
1
+ <telecom <% if telecom.use %> use="<%= telecom.use%>" <% end %> <% if telecom.value %> value="<%= telecom.value %>" <% end %> <% if telecom.preferred %> preferred="<%= telecom.preferred %>" <% end %> />
@@ -0,0 +1,12 @@
1
+ <vitalSign xmlns="urn:hl7-org:greencda:c32">
2
+ <id><%= vital_sign.id %></id>
3
+
4
+ <%== code_display vital_sign, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT'] %>
5
+ <% if vital_sign.status %>
6
+ <status code="completed"/>
7
+ <% end %>
8
+
9
+ <effectiveTime><%= Time.at(vital_sign.time) %></effectiveTime>
10
+
11
+ <value amount="<%= vital_sign.value['scalar']%>" unit="<%= vital_sign.value['units'] %>" />
12
+ </vitalSign>
@@ -33,7 +33,7 @@
33
33
  <reference value="vitals-desc-<%= i %>"/>
34
34
  </text>
35
35
  <statusCode code="completed"/>
36
- <effectiveTime value="<%= Time.at(entry.time).utc.to_formatted_s(:number) %>"/>
36
+ <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
37
37
  <% if entry.value -%>
38
38
  <value xsi:type="PQ" value="<%= entry.value["scalar"] %>" <% if entry.value["units"]-%>unit="<%= entry.value["units"] %>"<% end -%>/>
39
39
  <% else -%>
@@ -0,0 +1,35 @@
1
+ <Document xmlns="http://www.hl7.org/schemas/hdata/2009/11/metadata">
2
+ <MediaType>application/xml</MediaType>
3
+ <MediaType>application/json</MediaType>
4
+ <% metadata.pedigrees.each do |pedigree| %>
5
+ <%= render :partial => "pedigree", locals: {pedigree: pedigree}%>
6
+ <% end %>
7
+ <Title><%= entry.id %></Title>
8
+ <LinkedDocuments>
9
+ <% metadata.linked_documents.each do |link| %>
10
+ <Link>
11
+ <Target <% if link.extension %> targetExtension="<%=link.extension%>" <% end %>><%= link.uri %></Target>
12
+ </Link>
13
+ <% end %>
14
+ </LinkedDocuments>
15
+ <RecordDate>
16
+ <CreatedDateTime><%= metadata.original_creation_time%></CreatedDateTime>
17
+ <Modified>
18
+ <% metadata.modified_dates.each do |md| %>
19
+ <ModifiedInfo>
20
+ <ChangeDateTime><%= md.timestamp %></ChangeDateTime>
21
+ <%= render :partial => "pedigree", locals: {pedigree: md.pedigree}%>
22
+ </ModifiedInfo>
23
+ <% end %>
24
+ </Modified>
25
+ <Copied>
26
+ <% metadata.copied_dates.each do |cd| %>
27
+ <CopiedInfo>
28
+ <ChangeDateTime><%= cd.timestamp %></ChangeDateTime>
29
+ <%= render :partial => "pedigree", locals: {pedigree: cd.pedigree}%>
30
+ </CopiedInfo>
31
+ <% end %>
32
+ </Copied>
33
+ </RecordDate>
34
+ <Confidentiality><%= metadata.confidentiality%></Confidentiality>
35
+ </Document>
@@ -0,0 +1,287 @@
1
+
2
+ <script language="javascript">
3
+ var cur_view = "section";
4
+ function toggle(id) {
5
+ var e = document.getElementById(id);
6
+ if (cur_view=="section"){
7
+ document.getElementById("patient_information_by_section").style.display = 'none';
8
+ document.getElementById("table_by_encounter").style.display = 'block';
9
+ document.getElementById('toggle_button').innerHTML="View By Section";
10
+ cur_view = "encounter";
11
+ }else{
12
+ document.getElementById("patient_information_by_section").style.display = 'block';
13
+ document.getElementById("table_by_encounter").style.display = 'none';
14
+ document.getElementById('toggle_button').innerHTML="View By Encounter";
15
+ cur_view = "section";
16
+ }
17
+ }
18
+ </script>
19
+ <div>
20
+ <h3><a href="#" onclick="toggle('table_by_encounter');" id='toggle_button'>View By Encounter</a></h3>
21
+ </div>
22
+ <div id="table_by_encounter" style="display:none">
23
+ <% patient.encounters.sort! { |a,b| a.start_time <=> b.start_time } %>
24
+ <% patient.encounters.each_with_index do |encounter,idx| %>
25
+
26
+ <%
27
+ encounter_allergies=0
28
+ encounter_care_goals=0
29
+ encounter_vital_signs=0
30
+ encounter_results=0
31
+ encounter_conditions=0
32
+ encounter_procedures=0
33
+ encounter_medications=0
34
+ encounter_social_history=0
35
+ encounter_immunizations=0
36
+ encounter_medical_equipment=0
37
+ %>
38
+
39
+ <br/><br/>
40
+ <h3>Encounter <%= patient.encounters.count - idx %></h3>
41
+ <table border="1" width="100%" class="narr_table">
42
+
43
+ <tbody>
44
+ <tr>
45
+ <th class="narr_th">Description</th>
46
+ <th class="narr_th">Codes</th>
47
+ <th class="narr_th">Time</th>
48
+
49
+ <th class="narr_th">Status</th>
50
+
51
+
52
+
53
+ <th class="narr_th">Value</th>
54
+
55
+ </tr>
56
+ <tr class="narr_tr">
57
+ <td ID="encounters-desc-<%= idx %>"><%= encounter.description %></td>
58
+ <td ID="encounters-code-<%= idx %>"><b><%= encounter.codes_to_s %></b><br/><i><%= encounter.specifics %></i></td>
59
+ <td><%= encounter.times_to_s %></td>
60
+ <td> </td>
61
+ <td> </td>
62
+
63
+ </tr>
64
+ <!-- Select Allergies for this Encounter -->
65
+
66
+
67
+ <% patient.allergies.each_with_index do |entry, i| %>
68
+ <% if encounter.times_to_s == entry.times_to_s -%>
69
+ <% if encounter_allergies==0 -%>
70
+ <tr class="narr_tr">
71
+ <th class="narr_th" colspan="5">Allergies</th>
72
+ </tr>
73
+ <% encounter_allergies=1 %>
74
+ <% end %>
75
+ <tr class="narr_tr">
76
+ <td ID="allergies-desc-<%= i %>"><%= entry.description %></td>
77
+ <td ID="allergies-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
78
+ <td><%= entry.times_to_s %></td>
79
+ <td> </td>
80
+ <td> </td>
81
+ </tr>
82
+ <% end %>
83
+ <% end %>
84
+
85
+
86
+ <!-- Select Car Goals for this Encounter -->
87
+
88
+
89
+ <% patient.care_goals.each_with_index do |entry, i| %>
90
+ <% if encounter.times_to_s == entry.times_to_s -%>
91
+ <% if encounter_care_goals==0 -%>
92
+ <tr class="narr_tr">
93
+ <th class="narr_th" colspan="5">Care Goals</th>
94
+ </tr>
95
+ <% encounter_care_goals=1 %>
96
+ <% end %>
97
+ <tr class="narr_tr">
98
+ <td ID="care_goals-desc-<%= i %>"><%= entry.description %></td>
99
+ <td ID="care_goals-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
100
+ <td><%= entry.times_to_s %></td>
101
+ <td> </td>
102
+ <td> </td>
103
+ </tr>
104
+ <% end %>
105
+ <% end %>
106
+
107
+
108
+ <!-- Select Vitals for this Encounter -->
109
+ <% patient.vital_signs.each_with_index do |entry, i| %>
110
+ <% if encounter.times_to_s == entry.times_to_s -%>
111
+ <% if encounter_vital_signs==0 -%>
112
+ <tr class="narr_tr">
113
+ <th class="narr_th" colspan="5">Vital Signs</th>
114
+ </tr>
115
+ <% encounter_vital_signs=1 %>
116
+ <% end %>
117
+ <tr class="narr_tr">
118
+ <td ID="vitals-desc-<%= i %>"><%= entry.description %></td>
119
+ <td ID="vitals-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
120
+ <td><%= entry.times_to_s %></td>
121
+ <td> </td>
122
+ <td><%= entry.value["scalar"] %></td>
123
+
124
+ </tr>
125
+ <% end %>
126
+ <% end %>
127
+
128
+
129
+ <!-- Select lab results for this Encounter -->
130
+ <% patient.results.each_with_index do |entry, i| %>
131
+ <% if encounter.times_to_s == entry.times_to_s -%>
132
+ <% if encounter_results==0 -%>
133
+ <tr class="narr_tr">
134
+ <th class="narr_th" colspan="5">Lab Results</th>
135
+ </tr>
136
+ <% encounter_results=1 %>
137
+ <% end %>
138
+ <tr class="narr_tr">
139
+ <td ID="results-desc-<%= i %>"><%= entry.description %></td>
140
+ <td ID="results-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
141
+ <td><%= entry.times_to_s %></td>
142
+ <td> </td>
143
+ <td><%= entry.value["scalar"] %></td>
144
+
145
+ </tr>
146
+ <% end %>
147
+ <% end %>
148
+
149
+
150
+ <!-- Select conditions for this Encounter -->
151
+
152
+
153
+ <% patient.conditions.each_with_index do |entry, i| %>
154
+ <% if encounter.times_to_s == entry.times_to_s -%>
155
+ <% if encounter_conditions==0 -%>
156
+ <tr class="narr_tr">
157
+ <th class="narr_th" colspan="5">Problems</th>
158
+ </tr>
159
+ <% encounter_conditions=1 %>
160
+ <% end %>
161
+ <tr class="narr_tr">
162
+ <td ID="conditions-desc-<%= i %>"><%= entry.description %></td>
163
+ <td ID="conditions-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
164
+ <td><%= entry.times_to_s %></td>
165
+ <td><%= entry.status %></td>
166
+ <td> </td>
167
+ </tr>
168
+ <% end %>
169
+ <% end %>
170
+
171
+ <!-- Select procedures for this Encounter -->
172
+
173
+
174
+ <% patient.procedures.each_with_index do |entry, i| %>
175
+ <% if encounter.times_to_s == entry.times_to_s -%>
176
+ <% if encounter_procedures==0 -%>
177
+ <tr class="narr_tr">
178
+ <th class="narr_th" colspan="5">Procedures</th>
179
+ </tr>
180
+ <% encounter_procedures=1 %>
181
+ <% end %>
182
+ <tr class="narr_tr">
183
+ <td ID="procedures-desc-<%= i %>"><%= entry.description %></td>
184
+ <td ID="procedures-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
185
+ <td><%= entry.times_to_s %></td>
186
+ <td> </td>
187
+ <td> </td>
188
+ </tr>
189
+ <% end %>
190
+ <% end %>
191
+
192
+
193
+ <!-- Select Medications for this Encounter -->
194
+
195
+
196
+ <% patient.medications.each_with_index do |entry, i| %>
197
+ <% if encounter.times_to_s == entry.times_to_s -%>
198
+ <% if encounter_medications==0 -%>
199
+ <tr class="narr_tr">
200
+ <th class="narr_th" colspan="5">Medications</th>
201
+ </tr>
202
+ <% encounter_medications=1 %>
203
+ <% end %>
204
+ <tr class="narr_tr">
205
+ <td ID="medications-desc-<%= i %>"><%= entry.description %></td>
206
+ <td ID="medications-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
207
+ <td><%= entry.times_to_s %></td>
208
+ <td><%= entry.status %></td>
209
+ <td> </td>
210
+ </tr>
211
+ <% end %>
212
+ <% end %>
213
+
214
+
215
+ <!-- Select Social History for this Encounter -->
216
+
217
+
218
+ <% patient.social_history.each_with_index do |entry, i| %>
219
+ <% if encounter.times_to_s == entry.times_to_s -%>
220
+ <% if encounter_social_history==0 -%>
221
+ <tr class="narr_tr">
222
+ <th class="narr_th" colspan="5">Social History</th>
223
+ </tr>
224
+ <% encounter_social_history=1 %>
225
+ <% end %>
226
+ <tr class="narr_tr">
227
+ <td ID="social_history-desc-<%= i %>"><%= entry.description %></td>
228
+ <td ID="social_history-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
229
+ <td><%= entry.times_to_s %></td>
230
+ <td> </td>
231
+ <td> </td>
232
+ </tr>
233
+ <% end %>
234
+ <% end %>
235
+
236
+
237
+ <!-- Select immunizations for this Encounter -->
238
+
239
+
240
+ <% patient.immunizations.each_with_index do |entry, i| %>
241
+ <% if encounter.times_to_s == entry.times_to_s -%>
242
+ <% if encounter_immunizations==0 -%>
243
+ <tr class="narr_tr">
244
+ <th class="narr_th" colspan="5">Immunizations</th>
245
+ </tr>
246
+ <% encounter_immunizations=1 %>
247
+ <% end %>
248
+ <tr class="narr_tr">
249
+ <td ID="immunizations-desc-<%= i %>"><%= entry.description %></td>
250
+ <td ID="immunizations-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
251
+ <td><%= entry.times_to_s %></td>
252
+ <td> </td>
253
+ <td> </td>
254
+ </tr>
255
+ <% end %>
256
+ <% end %>
257
+
258
+
259
+ <!-- Select medical_equipment for this Encounter -->
260
+
261
+
262
+ <% patient.medical_equipment.each_with_index do |entry, i| %>
263
+ <% if encounter.times_to_s == entry.times_to_s -%>
264
+ <% if encounter_medical_equipment==0 -%>
265
+ <tr class="narr_tr">
266
+ <th class="narr_th" colspan="5">Medical Equipment</th>
267
+ </tr>
268
+ <% encounter_medical_equipment=1 %>
269
+ <% end %>
270
+ <tr class="narr_tr">
271
+ <td ID="medical_equipment-desc-<%= i %>"><%= entry.description %></td>
272
+ <td ID="medical_equipment-code-<%= i %>"><b><%= entry.codes_to_s %></b><br/><i><%= entry.specifics %></i></td>
273
+ <td><%= entry.times_to_s %></td>
274
+ <td> </td>
275
+ <td> </td>
276
+ </tr>
277
+ <% end %>
278
+ <% end %>
279
+
280
+
281
+ </tbody>
282
+ </table>
283
+
284
+
285
+ <% end %>
286
+ </div>
287
+