UNPKG

gcp-nrces-fhir

Version:

Google cloud healthcare api NRCES FHIR implimenataion

105 lines 4.16 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.TaskBundle = void 0; const ResourceMai_1 = __importDefault(require("../../resources/ResourceMai")); class TaskBundle extends ResourceMai_1.default { toHtml() { return __awaiter(this, void 0, void 0, function* () { throw new Error("Method not implemented."); }); } convertFhirToObject(options) { throw new Error("Method not implemented."); } getFHIR(options) { const body = { resourceType: "Bundle", id: options.id || undefined, meta: { profile: options.hcx == "nhcx" ? ["https://nrces.in/ndhm/fhir/r4/StructureDefinition/ClaimBundle"] : [ "https://ig.hcxprotocol.io/v0.7.1/StructureDefinition-ClaimRequestBundle.html", ], }, identifier: options.indentfier, type: "collection", timestamp: options.dateTime || new Date().toISOString(), entry: [ { fullUrl: `Task/${options.task.id}`, resource: options.task, }, ], }; if (options.communication) { body.entry.push({ fullUrl: `Communication/${options.communication.id}`, resource: options.communication, }); } if (options.patient) { body.entry.push({ fullUrl: `Patient/${options.patient.id}`, resource: options.patient, }); } if (options.communicationRequest) { body.entry.push({ fullUrl: `CommunicationRequest/${options.task.id}`, resource: options.communicationRequest, }); } if (options.coverage) { body.entry.push({ fullUrl: `Coverage/${options.coverage.id}`, resource: options.coverage, }); } if (options.claim) { body.entry.push({ fullUrl: `Claim/${options.claim.id}`, resource: options.claim, }); } if (options.practitioner && options.practitioner.length > 0) { options.practitioner.forEach((el) => { body.entry.push({ fullUrl: `Practitioner/${el.id}`, resource: el, }); }); } if (options.organization && options.organization.length > 0) { options.organization.forEach((el) => { body.entry.push({ fullUrl: `Organization/${el.id}`, resource: el, }); }); } if (options.documentReference && options.documentReference.length > 0) { options.documentReference.forEach((el) => { body.entry.push({ fullUrl: `DocumentReference/${el.id}`, resource: el, }); }); } return body; } } exports.TaskBundle = TaskBundle; //# sourceMappingURL=TaskBundle.js.map