UNPKG

gcp-nrces-fhir

Version:

Google cloud healthcare api NRCES FHIR implimenataion

81 lines 3.31 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.DocumentBundle = void 0; const crypto_1 = require("crypto"); const ResourceMai_1 = __importDefault(require("./ResourceMai")); class DocumentBundle extends ResourceMai_1.default { toHtml() { return __awaiter(this, void 0, void 0, function* () { throw new Error('Method not implemented.'); }); } getFHIR(options) { const body = { resourceType: "Bundle", id: options.id || undefined, meta: { versionId: "1", lastUpdated: new Date().toISOString(), profile: [ "https://nrces.in/ndhm/fhir/r4/StructureDefinition/DocumentBundle", ], security: [ { system: "http://terminology.hl7.org/CodeSystem/v3-Confidentiality", code: "V", display: "very restricted", }, ], }, identifier: { system: "http://hip.in", value: options.identifier || (0, crypto_1.randomUUID)(), }, type: "document", timestamp: options.date, entry: options.entry, signature: { type: [ { system: "urn:iso-astm:E1762-95:2013", code: "1.2.840.10065.1.12.1.1", display: "Author's Signature", }, ], when: options.signedDate, who: { reference: `Practitioner/${options.practitionerId}`, }, sigFormat: "image/jpeg", data: options.signJpegbase64, }, }; return body; } convertFhirToObject(options) { let ret = { date: options.timestamp, signedDate: options.signature.when, practitionerId: `${options.signature.who.reference}`.substring(13), entry: options.entry, id: options.id, identifier: options.identifier.value, signJpegbase64: options.signature.data }; return ret; } } exports.DocumentBundle = DocumentBundle; //# sourceMappingURL=DocumentBundle.js.map