fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
64 lines (63 loc) • 1.75 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HumanNameBuilder = void 0;
const models_1 = require("../../models");
const ElementBuilder_1 = require("../base/ElementBuilder");
class HumanNameBuilder extends ElementBuilder_1.ElementBuilder {
humanName;
constructor() {
super();
this.humanName = new models_1.HumanName();
}
addPrimitiveExtension(param, extension) {
const includes = ['_given', '_prefix', '_suffix'];
if (includes.includes(param)) {
this.humanName[param] = extension;
}
else {
const localParam = param;
this.humanName[localParam] = extension;
}
return this;
}
setUse(value) {
this.humanName.use = value;
return this;
}
setText(value) {
this.humanName.text = value;
return this;
}
setFamily(value) {
this.humanName.family = value;
return this;
}
addGiven(value) {
this.humanName.given = this.humanName.given || [];
this.humanName.given.push(value);
return this;
}
addPrefix(value) {
this.humanName.prefix = this.humanName.prefix || [];
this.humanName.prefix.push(value);
return this;
}
addSuffix(value) {
this.humanName.suffix = this.humanName.suffix || [];
this.humanName.suffix.push(value);
return this;
}
/**
* Set period
* @param value
* @returns {HumanNameBuilder}
*/
setPeriod(value) {
this.humanName.period = value;
return this;
}
build() {
return Object.assign(this.humanName, super.build());
}
}
exports.HumanNameBuilder = HumanNameBuilder;