fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
106 lines (105 loc) • 3.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HumanName = void 0;
const builders_1 = require("../../builders");
const base_1 = require("../../../core/r4/validators/base");
const Element_1 = require("../base/Element");
/**
* @description Name of a human or other living entity - parts and usage
* @implements {IHumanName}
* @property {string} id - Unique id for inter-element referencing
* @property {IExtension[]} extension - Additional content defined by implementations
* @property {NameUseEnum} use - usual | official | temp | nickname | anonymous | old | maiden
* @property {string} text - Text representation of the full name
* @property {string} family - Family name (often called 'Surname')
* @property {string[]} given - Given names (not always 'first'). Includes middle names
* @property {string[]} prefix - Parts that come before the name
* @property {string[]} suffix - Parts that come after the name
* @property {IPeriod} period - Time period when name was/is in use
* @property {IElement} _use - Extension of use
* @property {IElement} _text - Extension of text
* @property {IElement} _family - Extension of family
* @property {IElement[]} _given - Extension of given
* @property {IElement[]} _prefix - Extension of prefix
* @property {IElement[]} _suffix - Extension of suffix
* @see {@link https://www.hl7.org/fhir/datatypes.html#HumanName HumanName}
* @author Roberto Araneda
*/
class HumanName extends Element_1.Element {
/**
* @description usual | official | temp | nickname | anonymous | old | maiden
*/
use;
/**
* @description Text representation of the full name
*/
text;
/**
* @description Family name (often called 'Surname')
*/
family;
/**
* @description Given names (not always 'first'). Includes middle names
*/
given;
/**
* @description Parts that come before the name
*/
prefix;
/**
* @description Parts that come after the name
*/
suffix;
/**
* @description Time period when name was/is in use
*/
period;
// Extensions
/**
* @description Extension of use
*/
_use;
/**
* @description Extension of text
*/
_text;
/**
* @description Extension of family
*/
_family;
/**
* @description Extension of given
*/
_given;
/**
* @description Extension of prefix
*/
_prefix;
/**
* @description Extension of suffix
*/
_suffix;
toJson() {
return JSON.parse(JSON.stringify(this));
}
toPrettyString() {
return `HumanName${JSON.stringify(this.toJson(), null, 2)}`;
}
toString() {
return `HumanName${JSON.stringify(this.toJson())}`;
}
validate() {
return (0, base_1.ConformanceValidator)('HumanName', this);
}
constructor(args) {
super();
Object.assign(this, args);
}
builderInstance() {
return new builders_1.HumanNameBuilder();
}
serialize() {
return JSON.stringify(this.toJson());
}
}
exports.HumanName = HumanName;