UNPKG

fhirbuilder

Version:
307 lines (306 loc) 11.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConditionBuilder = 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 Condition * @class ConditionBuilder * @extends {DomainResourceBuilder} * @implements {IConditionBuilder} * @author Roberto Araneda Espinoza */ class ConditionBuilder extends base_1.DomainResourceBuilder { condition; constructor() { super(); this.condition = new models_1.Condition(); } /** * @description Sets the resource type to Condition * @param json - the json to parse * @returns {this} */ fromJSON(json) { const incomingData = typeof json === 'string' ? JSON.parse(json) : json; Object.assign(this.condition, 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.condition[param] = extension; return this; } /** * @description Builds the model * @returns {Condition} */ build() { return Object.assign(this.condition, super.build()); } /** * @description Adds a value to the identifier array * @description Business identifiers assigned to this condition 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.condition.identifier = this.condition.identifier || []; this.condition.identifier.push(value); return this; } /** * @description Sets the clinicalStatus value * @description The clinical status of the condition. * @param value - the value to set * @returns {this} */ setClinicalStatus(value) { this.condition.clinicalStatus = value; return this; } /** * @description Sets the verificationStatus value * @description The verification status to support the clinical status of the condition. * @param value - the value to set * @returns {this} */ setVerificationStatus(value) { this.condition.verificationStatus = value; return this; } /** * @description Adds a value to the category array * @description A category assigned to the condition. * @param value - the value to add * @returns {this} */ addCategory(value) { this.condition.category = this.condition.category || []; this.condition.category.push(value); return this; } /** * @description Sets the severity value * @description A subjective assessment of the severity of the condition as evaluated by the clinician. * @param value - the value to set * @returns {this} */ setSeverity(value) { this.condition.severity = value; return this; } /** * @description Sets the code value * @description Identification of the condition, problem or diagnosis. * @param value - the value to set * @returns {this} */ setCode(value) { this.condition.code = value; return this; } /** * @description Adds a value to the bodySite array * @description The anatomical location where this condition manifests itself. * @param value - the value to add * @returns {this} */ addBodySite(value) { this.condition.bodySite = this.condition.bodySite || []; this.condition.bodySite.push(value); return this; } /** * @description Sets the subject value * @description Indicates the patient or group who the condition record is associated with. * @param value - the value to set * @returns {this} */ setSubject(value) { this.condition.subject = value; return this; } /** * @description Sets the encounter value * @description The Encounter during which this Condition was created or to which the creation of this record is tightly associated. * @param value - the value to set * @returns {this} */ setEncounter(value) { this.condition.encounter = value; return this; } /** * @description Sets the onsetDateTime value * @description Estimated or actual date or date-time the condition began, in the opinion of the clinician. * @param value - the value to set * @returns {this} */ setOnsetDateTime(value) { this.condition.onsetDateTime = value; return this; } /** * @description Sets the onsetAge value * @description Estimated or actual date or date-time the condition began, in the opinion of the clinician. * @param value - the value to set * @returns {this} */ setOnsetAge(value) { this.condition.onsetAge = value; return this; } /** * @description Sets the onsetPeriod value * @description Estimated or actual date or date-time the condition began, in the opinion of the clinician. * @param value - the value to set * @returns {this} */ setOnsetPeriod(value) { this.condition.onsetPeriod = value; return this; } /** * @description Sets the onsetRange value * @description Estimated or actual date or date-time the condition began, in the opinion of the clinician. * @param value - the value to set * @returns {this} */ setOnsetRange(value) { this.condition.onsetRange = value; return this; } /** * @description Sets the onsetString value * @description Estimated or actual date or date-time the condition began, in the opinion of the clinician. * @param value - the value to set * @returns {this} */ setOnsetString(value) { this.condition.onsetString = value; return this; } /** * @description Sets the abatementDateTime value * @description The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate. * @param value - the value to set * @returns {this} */ setAbatementDateTime(value) { this.condition.abatementDateTime = value; return this; } /** * @description Sets the abatementAge value * @description The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate. * @param value - the value to set * @returns {this} */ setAbatementAge(value) { this.condition.abatementAge = value; return this; } /** * @description Sets the abatementPeriod value * @description The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate. * @param value - the value to set * @returns {this} */ setAbatementPeriod(value) { this.condition.abatementPeriod = value; return this; } /** * @description Sets the abatementRange value * @description The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate. * @param value - the value to set * @returns {this} */ setAbatementRange(value) { this.condition.abatementRange = value; return this; } /** * @description Sets the abatementString value * @description The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate. * @param value - the value to set * @returns {this} */ setAbatementString(value) { this.condition.abatementString = value; return this; } /** * @description Sets the recordedDate value * @description The recordedDate represents when this particular Condition record was created in the system, which is often a system-generated date. * @param value - the value to set * @returns {this} */ setRecordedDate(value) { this.condition.recordedDate = value; return this; } /** * @description Sets the recorder value * @description Individual who recorded the record and takes responsibility for its content. * @param value - the value to set * @returns {this} */ setRecorder(value) { this.condition.recorder = value; return this; } /** * @description Sets the asserter value * @description Individual who is making the condition statement. * @param value - the value to set * @returns {this} */ setAsserter(value) { this.condition.asserter = value; return this; } /** * @description Adds a value to the stage array * @description Clinical stage or grade of a condition. May include formal severity assessments. * @param value - the value to add * @returns {this} */ addStage(value) { this.condition.stage = this.condition.stage || []; this.condition.stage.push(value); return this; } /** * @description Adds a value to the evidence array * @description Supporting evidence / manifestations that are the basis of the Condition's verification status, such as evidence that confirmed or refuted the condition. * @param value - the value to add * @returns {this} */ addEvidence(value) { this.condition.evidence = this.condition.evidence || []; this.condition.evidence.push(value); return this; } /** * @description Adds a value to the note array * @description Additional information about the Condition. This is a general notes/comments entry for description of the Condition, its diagnosis and prognosis. * @param value - the value to add * @returns {this} */ addNote(value) { this.condition.note = this.condition.note || []; this.condition.note.push(value); return this; } } exports.ConditionBuilder = ConditionBuilder;