gcp-nrces-fhir
Version:
Google cloud healthcare api NRCES FHIR implimenataion
85 lines • 3.24 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RelatedPerson = void 0;
const ResourceMai_1 = __importDefault(require("./ResourceMai"));
class RelatedPerson extends ResourceMai_1.default {
toHtml() {
return __awaiter(this, void 0, void 0, function* () {
throw new Error("Method not implemented.");
});
}
getFHIR(options) {
const identifiers = [];
const getText = () => {
let ret = "";
ret += `<div>${options.name[0].text}</div>`;
return ret;
};
const body = {
"resourceType": "RelatedPerson",
"id": options.id,
"text": {
"status": "generated",
"div": getText()
},
"identifier": options.identifiers,
"active": options.active,
"patient": {
"reference": `Patient/${options.patientId}`
},
"relationship": options.relationship,
"name": options.name,
"telecom": options.telecom,
"gender": options.gender,
"birthDate": options.dob,
"address": options.address,
"communication": options.communication
};
return body;
}
convertFhirToObject(options) {
let ret = {
name: options.name,
patientId: this.getIdFromReference({ "ref": options.patient.reference, "resourceType": "Patient" })
};
if (options.identifiers) {
ret.identifiers = options.identifiers;
}
if (options.relationship) {
ret.relationship = options.relationship;
}
if (options.gender) {
ret.gender = options.gender;
}
if (options.active !== undefined) {
ret.active = options.active;
}
if (options.dob) {
ret.dob = options.birthDate;
}
if (options.telecom) {
ret.telecom = options.telecom;
}
if (options.address) {
ret.address = options.address;
}
if (options.communication) {
ret.communication = options.communication;
}
return ret;
}
}
exports.RelatedPerson = RelatedPerson;
//# sourceMappingURL=RelatedPerson.js.map