working Observation components with/without units.
This commit is contained in:
parent
83d6cdea08
commit
08f8722826
|
@ -55,7 +55,12 @@ func NewNarrative() (*Narrative, error) {
|
|||
}
|
||||
return template.HTML(*s)
|
||||
},
|
||||
"parseList": func(data datatypes.JSON) []map[string]interface{} {
|
||||
"parseStringList": func(data datatypes.JSON) []string {
|
||||
var parsed []string
|
||||
_ = json.Unmarshal(data, &parsed)
|
||||
return parsed
|
||||
},
|
||||
"parseMapList": func(data datatypes.JSON) []map[string]interface{} {
|
||||
var parsed []map[string]interface{}
|
||||
_ = json.Unmarshal(data, &parsed)
|
||||
return parsed
|
||||
|
|
|
@ -26,11 +26,11 @@ Comments: AllergyIntolerance.note[x].text (separated by <br />)
|
|||
{{- /*gotype: github.com/fastenhealth/fasten-onprem/backend/pkg/utils/ips.NarrativeTemplateData*/ -}}
|
||||
{{range $index, $entry := .AllergyIntolerance }}
|
||||
<tr id="{{$entry.SourceResourceID}}">
|
||||
<td>{{pluckList "text" ($entry.Code | parseList) | uniq | join "," }}</td> {{/* Allergen */}}
|
||||
<td>{{pluckList "code" ($entry.ClinicalStatus | parseList) | uniq | join "," }}</td> {{/* Status */}}
|
||||
<td>{{pluckList "code" ($entry.Category | parseList) | uniq | join "," }}</td> {{/* Category */}}
|
||||
<td>{{pluckList "text" ($entry.Manifestation | parseList) | uniq | join "," }}</td> {{/* Reaction */}}
|
||||
<td>{{pluckList "code" ($entry.Criticality | parseList) | uniq | join ","}}</td> {{/* Severity */}}
|
||||
<td>{{pluckList "text" ($entry.Code | parseMapList) | uniq | join "," }}</td> {{/* Allergen */}}
|
||||
<td>{{pluckList "code" ($entry.ClinicalStatus | parseMapList) | uniq | join "," }}</td> {{/* Status */}}
|
||||
<td>{{pluckList "code" ($entry.Category | parseMapList) | uniq | join "," }}</td> {{/* Category */}}
|
||||
<td>{{pluckList "text" ($entry.Manifestation | parseMapList) | uniq | join "," }}</td> {{/* Reaction */}}
|
||||
<td>{{pluckList "code" ($entry.Criticality | parseMapList) | uniq | join ","}}</td> {{/* Severity */}}
|
||||
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td> {{/* Comments - TODO: use FHIRPath */}}
|
||||
<td>{{default "unknown" $entry.Onset }}</td> {{/* Onset */}}
|
||||
</tr>
|
||||
|
|
|
@ -20,8 +20,8 @@ Onset Date: Condition.onsetDateTime || Condition.onsetPeriod.start && “-“ &&
|
|||
{{- /*gotype: github.com/fastenhealth/fasten-onprem/backend/pkg/utils/ips.NarrativeTemplateData*/ -}}
|
||||
{{range $index, $entry := .Condition }}
|
||||
<tr id="{{$entry.SourceResourceID}}">
|
||||
<td>{{pluckList "text" ($entry.Code | parseList) | uniq | join "," }}</td> {{/* Medical Problem */}}
|
||||
<td>{{pluckList "code" ($entry.ClinicalStatus | parseList) | uniq | join "," }}</td> {{/* Status */}}
|
||||
<td>{{pluckList "text" ($entry.Code | parseMapList) | uniq | join "," }}</td> {{/* Medical Problem */}}
|
||||
<td>{{pluckList "code" ($entry.ClinicalStatus | parseMapList) | uniq | join "," }}</td> {{/* Status */}}
|
||||
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td> {{/* Comments - TODO: use FHIRPath */}}
|
||||
<td>{{$entry.OnsetDate | date "2006-01-02"}}</td> {{/* Onset */}}
|
||||
</tr>
|
||||
|
|
|
@ -19,7 +19,7 @@ Date: Procedure.performedDateTime || Procedure.performedPeriod.start && “-“
|
|||
{{- /*gotype: github.com/fastenhealth/fasten-onprem/backend/pkg/utils/ips.NarrativeTemplateData*/ -}}
|
||||
{{range $index, $entry := .Procedure }}
|
||||
<tr id="{{$entry.SourceResourceID}}">
|
||||
<td>{{pluckList "text" ($entry.Code | parseList) | uniq | join "," }}</td> {{/* Procedure */}}
|
||||
<td>{{pluckList "text" ($entry.Code | parseMapList) | uniq | join "," }}</td> {{/* Procedure */}}
|
||||
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td> {{/* Comments - TODO: use FHIRPath */}}
|
||||
<td>{{$entry.Date | date "2006-01-02"}}</td> {{/* Performed Date */}}
|
||||
</tr>
|
||||
|
|
|
@ -27,10 +27,10 @@ Date: Immunization.occurrenceDateTime || Immunization.occurrenceString
|
|||
{{- /*gotype: github.com/fastenhealth/fasten-onprem/backend/pkg/utils/ips.NarrativeTemplateData*/ -}}
|
||||
{{range $index, $entry := .Immunization }}
|
||||
<tr id="{{$entry.SourceResourceID}}">
|
||||
<td>{{pluckList "text" ($entry.VaccineCode | parseList) | uniq | join "," }}</td> {{/* Immunization */}}
|
||||
<td>{{pluckList "code" ($entry.Status | parseList) | uniq | join "," }}</td> {{/* Status */}}
|
||||
<td>{{pluckList "text" ($entry.VaccineCode | parseMapList) | uniq | join "," }}</td> {{/* Immunization */}}
|
||||
<td>{{pluckList "code" ($entry.Status | parseMapList) | uniq | join "," }}</td> {{/* Status */}}
|
||||
<td th:insert="~{IpsUtilityFragments :: concatDoseNumber (list=*{getProtocolApplied()})}">Dose Number</td> {{/* Comments - TODO: use FHIRPath */}}
|
||||
<td>{{pluckList "display" ($entry.Manufacturer | parseList) | uniq | join "," }}</td> {{/* Manufacturer */}}
|
||||
<td>{{pluckList "display" ($entry.Manufacturer | parseMapList) | uniq | join "," }}</td> {{/* Manufacturer */}}
|
||||
<td>{{$entry.LotNumber}}</td> {{/* Lot Number */}}
|
||||
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
|
||||
<td>{{$entry.Date | date "2006-01-02"}}</td> {{/* Performed Date */}}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{{if not (empty .ValueString) }}
|
||||
{{if not (empty (.ValueString | parseMapList)) }}
|
||||
{{.ValueString}}
|
||||
{{else if not (empty (.ValueQuantity | parseList)) }}
|
||||
{{.ValueQuantity | parseList | pluckList "unit" | join "," }}
|
||||
{{else if not (empty (.ValueQuantity | parseMapList)) }}
|
||||
{{.ValueQuantity | parseMapList | pluckList "unit" | join "," }}
|
||||
{{else if not (empty .ValueDate) }}
|
||||
{{.ValueDate | date "2006-01-02" }}
|
||||
{{else if not (empty (.ValueConcept | parseList)) }}
|
||||
{{else if not (empty (.ValueConcept | parseMapList)) }}
|
||||
{{.ValueConcept}}
|
||||
{{else if not (empty (.ComponentValueQuantity | parseList)) }}
|
||||
{{.ComponentValueQuantity | parseList | pluckList "unit" | join "," }}
|
||||
{{else if not (empty (.ComponentValueQuantity | parseMapList)) }}
|
||||
{{.ComponentValueQuantity | parseMapList | pluckList "unit" | join "," }}
|
||||
{{end}}
|
||||
|
|
|
@ -1,23 +1,27 @@
|
|||
{{if not (empty .entry.ValueString) }}
|
||||
{{.ValueString}}
|
||||
{{else if not (empty (.entry.ValueQuantity | parseList)) }}
|
||||
{{.entry.ValueQuantity | parseList | pluckList "value" | roundList 2 | join "," }}
|
||||
{{if not (empty (.entry.ValueString | parseMapList)) }}
|
||||
{{.entry.ValueString | parseStringList | join ","}}
|
||||
{{else if not (empty (.entry.ValueQuantity | parseMapList)) }}
|
||||
{{.entry.ValueQuantity | parseMapList | pluckList "value" | roundList 2 | join "," }}
|
||||
{{if (get . "include_unit")}}
|
||||
{{.entry.ValueQuantity | parseList | pluckList "unit" | join "," }}
|
||||
{{.entry.ValueQuantity | parseMapList | pluckList "unit" | join "," }}
|
||||
{{end}}
|
||||
{{else if not (empty .entry.ValueDate) }}
|
||||
{{.entry.ValueDate | date "2006-01-02" }}
|
||||
{{else if not (empty (.entry.ValueConcept | parseList)) }}
|
||||
{{else if not (empty (.entry.ValueConcept | parseMapList)) }}
|
||||
{{.entry.ValueConcept}}
|
||||
{{else if not (empty (.entry.ComponentValueQuantity | parseList)) }}
|
||||
{{$componentCodeText := $.entry.ComponentCode | parseList | pluckList "text" }}
|
||||
{{$componentValueQuantity := $.entry.ComponentValueQuantity | parseList | pluckList "value" | roundList 2 }}
|
||||
{{else if not (empty (.entry.ComponentValueQuantity | parseMapList)) }}
|
||||
{{$componentCodeText := .entry.ComponentCode | parseMapList | pluckList "text" }}
|
||||
{{$componentValueQuantity := .entry.ComponentValueQuantity | parseMapList | pluckList "value" | roundList 2 }}
|
||||
{{$componentValueQuantityUnit := .entry.ComponentValueQuantity | parseMapList | pluckList "unit" }}
|
||||
|
||||
|
||||
{{range $index, $text := $componentCodeText }}
|
||||
{{$text}} - {{index $componentValueQuantity $index}}
|
||||
{{if (get $ "include_unit")}}
|
||||
{{index $componentValueQuantityUnit $index}}
|
||||
{{end}}
|
||||
<br/>
|
||||
{{end}}
|
||||
|
||||
{{if (get . "include_unit")}}
|
||||
{{.ComponentValueQuantity | parseList | pluckList "unit" | join "," }}
|
||||
{{end}}
|
||||
|
||||
{{end}}
|
||||
|
|
|
@ -20,8 +20,8 @@ Date Recorded: DeviceUseStatement.recordedDateTime
|
|||
{{- /*gotype: github.com/fastenhealth/fasten-onprem/backend/pkg/utils/ips.NarrativeTemplateData*/ -}}
|
||||
{{range $index, $entry := .Device }}
|
||||
<tr id="{{$entry.SourceResourceID}}">
|
||||
<td>{{pluckList "text" ($entry.Type | parseList) | uniq | join "," }}</td> {{/* Device */}}
|
||||
<td>{{pluckList "code" ($entry.Status | parseList) | uniq | join "," }}</td> {{/* Status */}}
|
||||
<td>{{pluckList "text" ($entry.Type | parseMapList) | uniq | join "," }}</td> {{/* Device */}}
|
||||
<td>{{pluckList "code" ($entry.Status | parseMapList) | uniq | join "," }}</td> {{/* Status */}}
|
||||
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
|
||||
<td></td> {{/* Date Recorded */}}
|
||||
</tr>
|
||||
|
|
|
@ -23,7 +23,7 @@ Planned End: CarePlan.period.end
|
|||
{{range $index, $entry := .CarePlan }}
|
||||
<tr id="{{$entry.SourceResourceID}}">
|
||||
<td th:text="*{getDescription()}">Activity</td>
|
||||
<td>{{pluckList "code" ($entry.Intent | parseList) | uniq | join "," }}</td> {{/* Intent */}}
|
||||
<td>{{pluckList "code" ($entry.Intent | parseMapList) | uniq | join "," }}</td> {{/* Intent */}}
|
||||
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
|
||||
<td>{{$entry.Date}}</td>{{/* Planned Start */}}
|
||||
<td th:text="*{getPeriod().getEndElement().getValue()}">Planned End</td>
|
||||
|
|
|
@ -20,7 +20,7 @@ Date: Observation.effectiveDateTime || Observation.effectivePeriod.start
|
|||
{{- /*gotype: github.com/fastenhealth/fasten-onprem/backend/pkg/utils/ips.NarrativeTemplateData*/ -}}
|
||||
{{range $index, $entry := .Observation }}
|
||||
<tr id="{{$entry.SourceResourceID}}">
|
||||
<td>{{pluckList "text" ($entry.Code | parseList) | uniq | join "," }}</td> {{/* Code */}}
|
||||
<td>{{pluckList "text" ($entry.Code | parseMapList) | uniq | join "," }}</td> {{/* Code */}}
|
||||
<td>{{template "observation-value.gohtml" (dict "entry" $entry "include_unit" true)}}</td> {{/* Result */}}
|
||||
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
|
||||
<td>{{$entry.Date | date "2006-01-02"}}</td> {{/* Date */}}
|
||||
|
|
|
@ -20,8 +20,8 @@ Onset Date: Condition.onsetDateTime || Condition.onsetPeriod.start && “-“ &&
|
|||
{{- /*gotype: github.com/fastenhealth/fasten-onprem/backend/pkg/utils/ips.NarrativeTemplateData*/ -}}
|
||||
{{range $index, $entry := .Condition }}
|
||||
<tr id="{{$entry.SourceResourceID}}">
|
||||
<td>{{pluckList "text" ($entry.Code | parseList) | uniq | join "," }}</td> {{/* Medical Problems */}}
|
||||
<td>{{pluckList "code" ($entry.ClinicalStatus | parseList) | uniq | join "," }}</td> {{/* Status */}}
|
||||
<td>{{pluckList "text" ($entry.Code | parseMapList) | uniq | join "," }}</td> {{/* Medical Problems */}}
|
||||
<td>{{pluckList "code" ($entry.ClinicalStatus | parseMapList) | uniq | join "," }}</td> {{/* Status */}}
|
||||
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
|
||||
<td>{{$entry.OnsetDate | date "2006-01-02"}}</td> {{/* Onset */}}
|
||||
</tr>
|
||||
|
|
|
@ -22,7 +22,7 @@ Date: Observation.effectiveDateTime || Observation.effectivePeriod.start
|
|||
{{- /*gotype: github.com/fastenhealth/fasten-onprem/backend/pkg/utils/ips.NarrativeTemplateData*/ -}}
|
||||
{{range $index, $entry := .Observation }}
|
||||
<tr id="{{$entry.SourceResourceID}}">
|
||||
<td>{{pluckList "text" ($entry.Code | parseList) | uniq | join "," }}</td> {{/* Code */}}
|
||||
<td>{{pluckList "text" ($entry.Code | parseMapList) | uniq | join "," }}</td> {{/* Code */}}
|
||||
<td>{{template "observation-value.gohtml" (dict "entry" $entry "include_unit" false)}}</td> {{/* Result */}}
|
||||
<td th:insert="~{IpsUtilityFragments :: renderValueUnit (value=*{getValue()})}">Unit</td>
|
||||
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
|
||||
|
|
|
@ -25,7 +25,7 @@ Date: Observation.effectiveDateTime || Observation.effectivePeriod.start
|
|||
{{- /*gotype: github.com/fastenhealth/fasten-onprem/backend/pkg/utils/ips.NarrativeTemplateData*/ -}}
|
||||
{{range $index, $entry := .Observation }}
|
||||
<tr id="{{$entry.SourceResourceID}}">
|
||||
<td>{{pluckList "text" ($entry.Code | parseList) | uniq | join "," }}</td> {{/* Code */}}
|
||||
<td>{{pluckList "text" ($entry.Code | parseMapList) | uniq | join "," }}</td> {{/* Code */}}
|
||||
<td>{{template "observation-value.gohtml" (dict "entry" $entry "include_unit" false)}}</td> {{/* Result */}}
|
||||
<td>{{template "observation-unit.gohtml" $entry}}</td>
|
||||
<td th:replace="~{IpsUtilityFragments :: firstFromCodeableConceptList (list=*{getInterpretation()})}">Interpretation</td>
|
||||
|
|
Loading…
Reference in New Issue