UNPKG

gcp-nrces-fhir

Version:

Google cloud healthcare api NRCES FHIR implimenataion

69 lines 2.97 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()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HealthDocumentBundle = void 0; const _1 = require("."); class HealthDocumentBundle extends _1.BundelMain { toHtml() { return __awaiter(this, void 0, void 0, function* () { throw new Error("Method not implemented."); }); } getFHIR(options) { return __awaiter(this, void 0, void 0, function* () { if (options.identifier) { let ret = { system: "http://www.nicehms.com", value: options.identifier.value, }; } const bundlemain = yield new _1.BundelMain(this.gcpCredetials, this.gcpPath).getentries(options.composition, options.pdfData); this.entry = bundlemain.entry; const sectionEntries = options.composition.section; yield this.getAllSectionAndAllEntries(0, sectionEntries); const body = { resourceType: "Bundle", id: options.id, meta: { lastUpdated: new Date().toISOString(), }, identifier: { system: "https://www.nicehms.com/bundle", value: options.id, }, type: "document", timestamp: options.composition.date, entry: this.entry, }; body.entry = body.entry.filter(el => { if (el.resource.resourceType != "Media") { return el; } }).map(el => { if (el.resource.resourceType == "Composition") { console.log("composition"); const composition = el; delete composition.resource.section; return composition; } else { return el; } }); return body; }); } convertFhirToObject(options) { throw new Error("Method not implemented."); } } exports.HealthDocumentBundle = HealthDocumentBundle; //# sourceMappingURL=HealthDocumnet.js.map