fixing fhir-resource tests.
This commit is contained in:
parent
aa8289f30a
commit
d0c1e17896
|
@ -78,7 +78,7 @@ export class ReportMedicalHistoryConditionComponent implements OnInit {
|
|||
switch(resource.source_resource_type){
|
||||
case ResourceType.CareTeam:
|
||||
for(let participant of (resource as CareTeamModel).participants){
|
||||
let id = participant.reference || participant.display
|
||||
let id = participant.reference.reference || participant.display
|
||||
involvedInCareMap[id] = _.mergeWith(
|
||||
{},
|
||||
involvedInCareMap[id],
|
||||
|
|
|
@ -34,8 +34,23 @@ describe('CareTeamModel', () => {
|
|||
}
|
||||
expected.managing_organization = { reference: 'Organization/f001' }
|
||||
expected.participants = [
|
||||
{ display: 'Peter James Chalmers', role: undefined, periodStart: undefined, periodEnd: undefined },
|
||||
{ display: 'Dorothy Dietition', role: undefined, periodStart: undefined, periodEnd: '2013-01-01' }
|
||||
{
|
||||
display: 'Peter James Chalmers',
|
||||
role: "responsiblePerson",
|
||||
periodStart: undefined,
|
||||
periodEnd: undefined,
|
||||
reference: {reference: 'Patient/example', display: 'Peter James Chalmers' }
|
||||
},
|
||||
{
|
||||
display: 'Dorothy Dietition',
|
||||
role: 'adviser',
|
||||
periodStart: undefined,
|
||||
periodEnd: '2013-01-01',
|
||||
reference: {
|
||||
"reference": "#pr1",
|
||||
"display": "Dorothy Dietition"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
expect(new CareTeamModel(fixture)).toEqual(expected);
|
||||
|
|
|
@ -12,7 +12,7 @@ export class CareTeamModel extends FastenDisplayModel {
|
|||
period_start: string | undefined
|
||||
period_end: string | undefined
|
||||
participants: {
|
||||
reference?: string,
|
||||
reference?: ReferenceModel,
|
||||
display?:string,
|
||||
role?:string,
|
||||
periodStart?: string,
|
||||
|
@ -42,7 +42,7 @@ export class CareTeamModel extends FastenDisplayModel {
|
|||
_.get(fhirResource, 'managingOrganization');
|
||||
|
||||
this.participants = _.get(fhirResource, 'participant', []).map((item: any) => {
|
||||
const reference = _.get(item, 'member.reference');
|
||||
const reference = _.get(item, 'member') as ReferenceModel;
|
||||
const display = _.get(item, 'member.display');
|
||||
const role = _.get(item, 'role.text') || _.get(item, 'role[0].text') || _.get(item, 'role.coding.0.display');
|
||||
const periodStart = _.get(item, 'period.start');
|
||||
|
|
Loading…
Reference in New Issue