fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
113 lines (112 loc) • 3.68 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PatientContactBuilder = void 0;
const models_1 = require("../../models");
const base_1 = require("../base");
/**
* @version R4 (v4.0.1)
* @summary FHIR® Specification by HL7®
* @description Class for building a PatientContact
* @class PatientContactBuilder
* @extends {BackboneBuilder}
* @implements {IPatientContactBuilder}
* @author Roberto Araneda Espinoza
*/
class PatientContactBuilder extends base_1.BackboneBuilder {
patientContact;
constructor() {
super();
this.patientContact = new models_1.PatientContact();
}
/**
* @description Adds a primitive extension to the element
* @param param - the field to add the extension to
* @param extension - the extension to add
* @returns {this}
* @example addPrimitiveExtension('_value', { value: 'test' })
*/
addPrimitiveExtension(param, extension) {
this.patientContact[param] = extension;
return this;
}
/**
* @description Builds the model
* @returns {PatientContact}
*/
build() {
return Object.assign(this.patientContact, super.build());
}
/**
* @description Adds a value to the relationship array
* @description The nature of the relationship between the patient and the contact person.
* @param value - the value to add
* @returns {this}
*/
addRelationship(value) {
this.patientContact.relationship = this.patientContact.relationship || [];
this.patientContact.relationship.push(value);
return this;
}
/**
* @description Sets the name value
* @description A name associated with the contact person.
* @param value - the value to set
* @returns {this}
*/
setName(value) {
this.patientContact.name = value;
return this;
}
/**
* @description Adds a value to the telecom array
* @description A contact detail for the person, e.g. a telephone number or an email address.
* @param value - the value to add
* @returns {this}
*/
addTelecom(value) {
this.patientContact.telecom = this.patientContact.telecom || [];
this.patientContact.telecom.push(value);
return this;
}
/**
* @description Sets the address value
* @description Address for the contact person.
* @param value - the value to set
* @returns {this}
*/
setAddress(value) {
this.patientContact.address = value;
return this;
}
/**
* @description Sets the gender value
* @description Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.
* @param value - the value to set
* @returns {this}
*/
setGender(value) {
this.patientContact.gender = value;
return this;
}
/**
* @description Sets the organization value
* @description Organization on behalf of which the contact is acting or for which the contact is working.
* @param value - the value to set
* @returns {this}
*/
setOrganization(value) {
this.patientContact.organization = value;
return this;
}
/**
* @description Sets the period value
* @description The period during which this contact person or organization is valid to be contacted relating to this patient.
* @param value - the value to set
* @returns {this}
*/
setPeriod(value) {
this.patientContact.period = value;
return this;
}
}
exports.PatientContactBuilder = PatientContactBuilder;