Skip to content

Commit

Permalink
Practitioner UI tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Aug 12, 2023
1 parent 410696c commit 169dc28
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ export class PractitionerComponent implements OnInit, FhirResourceComponentInter
// ),
// status: isContactData,
// },
{
label: 'Address',
data: this.displayModel?.address,
enabled: !!this.displayModel?.address,
},
{
label: 'Telephone',
data: this.displayModel.telecom,
enabled: !!this.displayModel.telecom,
},
];
for(let idCoding of (this.displayModel?.identifier || [])){
this.tableData.push({
Expand All @@ -66,6 +56,28 @@ export class PractitionerComponent implements OnInit, FhirResourceComponentInter
enabled: true,
})
}
if(this.displayModel?.address){
let address = this.displayModel?.address
let addressParts = []
if(address.line){
addressParts.push(address.line.join(' '))
}
if(address.city){
addressParts.push(address.city)
}
if(address.state){
addressParts.push(address.state)
}
if(address.postalCode){
addressParts.push(address.postalCode)
}

this.tableData.push({
label: 'Address',
data: addressParts.join(", "),
enabled: !!addressParts,
})
}
for(let telecom of (this.displayModel?.telecom || [])){
this.tableData.push({
label: telecom.system,
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lib/models/datatypes/address-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export class AddressModel {


constructor(fhirData: any) {
if(!fhirData){
return
}
this.city = fhirpath.evaluate(fhirData, "city").join("")
this.line = fhirpath.evaluate(fhirData, "line")
this.state = fhirpath.evaluate(fhirData, "state").join("")
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/lib/models/resources/practitioner-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {CodingModel} from '../datatypes/coding-model';
import {FastenDisplayModel} from '../fasten/fasten-display-model';
import {FastenOptions} from '../fasten/fasten-options';
import {HumanNameModel} from '../datatypes/human-name-model';
import {AddressModel} from '../datatypes/address-model';

export class PractitionerModel extends FastenDisplayModel {

Expand All @@ -19,7 +20,7 @@ export class PractitionerModel extends FastenDisplayModel {
relationship: string
}|undefined
telecom: { system?: string, value?: string, use?: string }[]|undefined
address: string|undefined
address: AddressModel|undefined
birthdate: string|undefined
qualification: { code: string, system: string }[]|undefined

Expand Down Expand Up @@ -50,7 +51,7 @@ export class PractitionerModel extends FastenDisplayModel {

stu3DTO(fhirResource:any){
this.name = _.get(fhirResource, 'name',[]).map((name:any): HumanNameModel => new HumanNameModel(name));
this.address = _.get(fhirResource, 'address.0');
this.address = new AddressModel(_.get(fhirResource, 'address.0'));
this.telecom = _.get(fhirResource, 'telecom');
};

Expand Down

0 comments on commit 169dc28

Please sign in to comment.