UNPKG

fhirbuilder

Version:
190 lines (189 loc) 6.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CareTeamBuilder = 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 CareTeam * @class CareTeamBuilder * @extends {DomainResourceBuilder} * @implements {ICareTeamBuilder} * @author Roberto Araneda Espinoza */ class CareTeamBuilder extends base_1.DomainResourceBuilder { careTeam; constructor() { super(); this.careTeam = new models_1.CareTeam(); } /** * @description Sets the resource type to CareTeam * @param json - the json to parse * @returns {this} */ fromJSON(json) { const incomingData = typeof json === 'string' ? JSON.parse(json) : json; Object.assign(this.careTeam, 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.careTeam[param] = extension; return this; } /** * @description Builds the model * @returns {CareTeam} */ build() { return Object.assign(this.careTeam, super.build()); } /** * @description Adds a value to the identifier array * @description Business identifiers assigned to this care team by the performer or other systems which remain constant as the resource is updated and propagates from server to server. * @param value - the value to add * @returns {this} */ addIdentifier(value) { this.careTeam.identifier = this.careTeam.identifier || []; this.careTeam.identifier.push(value); return this; } /** * @description Sets the status value * @description Indicates the current state of the care team. proposed | active | suspended | inactive | entered-in-error. * @param value - the value to set * @returns {this} */ setStatus(value) { this.careTeam.status = value; return this; } /** * @description Adds a value to the category array * @description Identifies what kind of team. This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team. * @param value - the value to add * @returns {this} */ addCategory(value) { this.careTeam.category = this.careTeam.category || []; this.careTeam.category.push(value); return this; } /** * @description Sets the name value * @description A label for human use intended to distinguish like teams. E.g. the "red" vs. "green" trauma teams. * @param value - the value to set * @returns {this} */ setName(value) { this.careTeam.name = value; return this; } /** * @description Sets the subject value * @description Identifies the patient or group whose intended care is handled by the team. * @param value - the value to set * @returns {this} */ setSubject(value) { this.careTeam.subject = value; return this; } /** * @description Sets the encounter value * @description The Encounter during which this CareTeam was created or to which the creation of this record is tightly associated. * @param value - the value to set * @returns {this} */ setEncounter(value) { this.careTeam.encounter = value; return this; } /** * @description Sets the period value * @description Indicates when the team did (or is intended to) come into effect and end. * @param value - the value to set * @returns {this} */ setPeriod(value) { this.careTeam.period = value; return this; } /** * @description Adds a value to the participant array * @description Identifies all people and organizations who are expected to be involved in the care team. * @param value - the value to add * @returns {this} */ addParticipant(value) { this.careTeam.participant = this.careTeam.participant || []; this.careTeam.participant.push(value); return this; } /** * @description Adds a value to the reasonCode array * @description Describes why the care team exists. * @param value - the value to add * @returns {this} */ addReasonCode(value) { this.careTeam.reasonCode = this.careTeam.reasonCode || []; this.careTeam.reasonCode.push(value); return this; } /** * @description Adds a value to the reasonReference array * @description Condition(s) that this care team addresses. * @param value - the value to add * @returns {this} */ addReasonReference(value) { this.careTeam.reasonReference = this.careTeam.reasonReference || []; this.careTeam.reasonReference.push(value); return this; } /** * @description Adds a value to the managingOrganization array * @description The organization responsible for the care team. * @param value - the value to add * @returns {this} */ addManagingOrganization(value) { this.careTeam.managingOrganization = this.careTeam.managingOrganization || []; this.careTeam.managingOrganization.push(value); return this; } /** * @description Adds a value to the telecom array * @description A central contact detail for the care team (that applies to all members). * @param value - the value to add * @returns {this} */ addTelecom(value) { this.careTeam.telecom = this.careTeam.telecom || []; this.careTeam.telecom.push(value); return this; } /** * @description Adds a value to the note array * @description Comments made about the CareTeam. * @param value - the value to add * @returns {this} */ addNote(value) { this.careTeam.note = this.careTeam.note || []; this.careTeam.note.push(value); return this; } } exports.CareTeamBuilder = CareTeamBuilder;