UNPKG

gcp-nrces-fhir

Version:

Google cloud healthcare api NRCES FHIR implimenataion

73 lines 3.42 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.DiagnsoticReportBundle = void 0; const gcp_1 = __importDefault(require("../../classess/gcp")); const _1 = require("."); class DiagnsoticReportBundle extends _1.BundelMain { 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().getentries(options.composition, options.pdfData); const entry = bundlemain.entry; // write code to pusj medication trequest here const sectionEntries = bundlemain.compositionObj.section[0].entry; const medicationRequestId = this.getIdFromReference({ ref: sectionEntries.filter((el) => el.type == "MedicationRequest")[0] .reference, resourceType: "MedicationRequest", }); const medicationRequest = yield new gcp_1.default() .getFhirResource(medicationRequestId, "MedicationRequest") .then((res) => res.data); entry.push({ fullUrl: `MedicationRequest/${medicationRequestId}`, resource: medicationRequest, }); const body = { resourceType: "Bundle", id: options.id, 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: options.identifier, type: "document", timestamp: new Date().toISOString, entry: entry, }; return body; }); } convertFhirToObject(options) { throw new Error("Method not implemented."); } } exports.DiagnsoticReportBundle = DiagnsoticReportBundle; //# sourceMappingURL=DiagnsoticReportBundle.js.map