UNPKG

gcp-nrces-fhir

Version:

Google cloud healthcare api NRCES FHIR implimenataion

95 lines 3.72 kB
"use strict"; 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.Schedule = void 0; const Actor_1 = require("./objects/Actor"); const ResourceMai_1 = __importDefault(require("./ResourceMai")); class Schedule extends ResourceMai_1.default { toHtml() { return __awaiter(this, void 0, void 0, function* () { throw new Error("Method not implemented."); }); } getFHIR(options) { const getText = () => { let ret = ""; ret = options.comment; return ret; }; const getActors = () => { const ret = []; const actor = new Actor_1.Actor(); options.actors.forEach((el) => { actor.setObject(el); ret.push(actor.getJson()); }); return ret; }; const identifiers = []; identifiers.push({ value: options.organizationId, system: "https://www.nicehms.com/orgnization", }); const body = { resourceType: "Schedule", id: options.id || undefined, text: { status: "generated", div: getText(), }, identifier: identifiers, active: options.active, serviceCategory: options.serviceCategory, serviceType: options.serviceType, specialty: options.specialty, actor: getActors(), planningHorizon: options.planningHorizon, comment: options.comment, }; return body; } convertFhirToObject(options) { let orgIdentifierArray = (options.identifier && options.identifier.filter((el) => el.system == "https://www.nicehms.com/orgnization")) || []; let organizationId = ""; if (orgIdentifierArray.length > 0) { organizationId = orgIdentifierArray[0].value || ""; } const ret = { id: options.id, text: options.text, planningHorizon: options.planningHorizon, comment: options.comment, active: options.active, actors: options.actor.map((el) => new Actor_1.Actor().getObject(el)), organizationId: organizationId, }; if (options.serviceCategory) { ret.serviceCategory = options.serviceCategory; } if (options.serviceType) { ret.serviceType = options.serviceType; } if (options.specialty) { ret.specialty = options.specialty; } if (options.planningHorizon) { ret.planningHorizon = options.planningHorizon; } return ret; } } exports.Schedule = Schedule; //# sourceMappingURL=Schedule.js.map