UNPKG

fhirbuilder

Version:
159 lines (158 loc) 5.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PractitionerBuilder = 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 Practitioner * @class PractitionerBuilder * @extends {DomainResourceBuilder} * @implements {IPractitionerBuilder} * @author Roberto Araneda Espinoza */ class PractitionerBuilder extends base_1.DomainResourceBuilder { practitioner; constructor() { super(); this.practitioner = new models_1.Practitioner(); } /** * @description Sets the resource type to Practitioner * @param json - the json to parse * @returns {this} */ fromJSON(json) { const incomingData = typeof json === 'string' ? JSON.parse(json) : json; Object.assign(this.practitioner, incomingData); return this; } /** * @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.practitioner[param] = extension; return this; } /** * @description Builds the model * @returns {Practitioner} */ build() { return Object.assign(this.practitioner, super.build()); } /** * @description Adds a value to the identifier array * @description An identifier that applies to this person in this role. * @param value - the value to add * @returns {this} */ addIdentifier(value) { this.practitioner.identifier = this.practitioner.identifier || []; this.practitioner.identifier.push(value); return this; } /** * @description Sets the active value * @description Whether this practitioner's record is in active use. * @param value - the value to set * @returns {this} */ setActive(value) { this.practitioner.active = value; return this; } /** * @description Adds a value to the name array * @description The name(s) associated with the practitioner. * @param value - the value to add * @returns {this} */ addName(value) { this.practitioner.name = this.practitioner.name || []; this.practitioner.name.push(value); return this; } /** * @description Adds a value to the telecom array * @description A contact detail for the practitioner, e.g. a telephone number or an email address. * @param value - the value to add * @returns {this} */ addTelecom(value) { this.practitioner.telecom = this.practitioner.telecom || []; this.practitioner.telecom.push(value); return this; } /** * @description Adds a value to the address array * @description Address(es) of the practitioner that are not role specific (typically home address). Work addresses are not typically entered in this property as they are usually role dependent. * @param value - the value to add * @returns {this} */ addAddress(value) { this.practitioner.address = this.practitioner.address || []; this.practitioner.address.push(value); return this; } /** * @description Sets the gender value * @description Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes. * @param value - the value to set * @returns {this} */ setGender(value) { this.practitioner.gender = value; return this; } /** * @description Sets the birthDate value * @description The date of birth for the practitioner. * @param value - the value to set * @returns {this} */ setBirthDate(value) { this.practitioner.birthDate = value; return this; } /** * @description Adds a value to the photo array * @description Image of the person. * @param value - the value to add * @returns {this} */ addPhoto(value) { this.practitioner.photo = this.practitioner.photo || []; this.practitioner.photo.push(value); return this; } /** * @description Adds a value to the qualification array * @description The official certifications, training, and licenses that authorize or otherwise pertain to the provision of care by the practitioner. For example, a medical license issued by a medical board authorizing the practitioner to practice medicine within a certian locality. * @param value - the value to add * @returns {this} */ addQualification(value) { this.practitioner.qualification = this.practitioner.qualification || []; this.practitioner.qualification.push(value); return this; } /** * @description Adds a value to the communication array * @description A language the practitioner can use in patient communication. * @param value - the value to add * @returns {this} */ addCommunication(value) { this.practitioner.communication = this.practitioner.communication || []; this.practitioner.communication.push(value); return this; } } exports.PractitionerBuilder = PractitionerBuilder;