fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
178 lines (177 loc) • 6.21 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EpisodeOfCareBuilder = 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 EpisodeOfCare
* @class EpisodeOfCareBuilder
* @extends {DomainResourceBuilder}
* @implements {IEpisodeOfCareBuilder}
* @author Roberto Araneda Espinoza
*/
class EpisodeOfCareBuilder extends base_1.DomainResourceBuilder {
episodeOfCare;
constructor() {
super();
this.episodeOfCare = new models_1.EpisodeOfCare();
}
/**
* @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.episodeOfCare[param] = extension;
return this;
}
/**
* @description Builds the model
* @returns {EpisodeOfCare}
*/
build() {
return Object.assign(this.episodeOfCare, super.build());
}
/**
* @description Adds a value to the identifier array
* @description The EpisodeOfCare may be known by different identifiers for different contexts of use, such as when an external agency is tracking the Episode for funding purposes.
* @param value - the value to add
* @returns {this}
*/
addIdentifier(value) {
this.episodeOfCare.identifier = this.episodeOfCare.identifier || [];
this.episodeOfCare.identifier.push(value);
return this;
}
/**
* @description Sets the status value
* @description planned | waitlist | active | onhold | finished | cancelled.
* @param value - the value to set
* @returns {this}
*/
setStatus(value) {
this.episodeOfCare.status = value;
return this;
}
/**
* @description Adds a value to the statusHistory array
* @description The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).
* @param value - the value to add
* @returns {this}
*/
addStatusHistory(value) {
this.episodeOfCare.statusHistory = this.episodeOfCare.statusHistory || [];
this.episodeOfCare.statusHistory.push(value);
return this;
}
/**
* @description Adds a value to the type array
* @description A classification of the type of episode of care; e.g. specialist referral, disease management, type of funded care.
* @param value - the value to add
* @returns {this}
*/
addType(value) {
this.episodeOfCare.type = this.episodeOfCare.type || [];
this.episodeOfCare.type.push(value);
return this;
}
/**
* @description Adds a value to the diagnosis array
* @description The list of diagnosis relevant to this episode of care.
* @param value - the value to add
* @returns {this}
*/
addDiagnosis(value) {
this.episodeOfCare.diagnosis = this.episodeOfCare.diagnosis || [];
this.episodeOfCare.diagnosis.push(value);
return this;
}
/**
* @description Sets the patient value
* @description The patient who is the focus of this episode of care.
* @param value - the value to set
* @returns {this}
*/
setPatient(value) {
this.episodeOfCare.patient = value;
return this;
}
/**
* @description Sets the managingOrganization value
* @description The organization that has assumed the specific responsibilities for the specified duration.
* @param value - the value to set
* @returns {this}
*/
setManagingOrganization(value) {
this.episodeOfCare.managingOrganization = value;
return this;
}
/**
* @description Sets the period value
* @description The interval during which the managing organization assumes the defined responsibility.
* @param value - the value to set
* @returns {this}
*/
setPeriod(value) {
this.episodeOfCare.period = value;
return this;
}
/**
* @description Adds a value to the referralRequest array
* @description Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.
* @param value - the value to add
* @returns {this}
*/
addReferralRequest(value) {
this.episodeOfCare.referralRequest = this.episodeOfCare.referralRequest || [];
this.episodeOfCare.referralRequest.push(value);
return this;
}
/**
* @description Sets the careManager value
* @description The practitioner that is the care manager/care coordinator for this patient.
* @param value - the value to set
* @returns {this}
*/
setCareManager(value) {
this.episodeOfCare.careManager = value;
return this;
}
/**
* @description Adds a value to the team array
* @description The list of practitioners that may be facilitating this episode of care for specific purposes.
* @param value - the value to add
* @returns {this}
*/
addTeam(value) {
this.episodeOfCare.team = this.episodeOfCare.team || [];
this.episodeOfCare.team.push(value);
return this;
}
/**
* @description Adds a value to the account array
* @description The set of accounts that may be used for billing for this EpisodeOfCare.
* @param value - the value to add
* @returns {this}
*/
addAccount(value) {
this.episodeOfCare.account = this.episodeOfCare.account || [];
this.episodeOfCare.account.push(value);
return this;
}
/**
* @description Sets the resource type to EpisodeOfCare
* @param json - the json to parse
* @returns {this}
*/
fromJSON(json) {
const incomingData = typeof json === 'string' ? JSON.parse(json) : json;
Object.assign(this.episodeOfCare, incomingData);
return this;
}
}
exports.EpisodeOfCareBuilder = EpisodeOfCareBuilder;