gcp-nrces-fhir
Version:
Google cloud healthcare api NRCES FHIR implimenataion
89 lines • 3.8 kB
JavaScript
;
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.CoverageEligibilityRequestBundle = void 0;
const ResourceMai_1 = __importDefault(require("../../resources/ResourceMai"));
class CoverageEligibilityRequestBundle 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/CoverageEligibilityRequestBundle",
] : [
"https://ig.hcxprotocol.io/v0.7.1/StructureDefinition-CoverageEligibilityRequestBundle.html",
],
},
identifier: options.indentfier,
type: "collection",
timestamp: options.dateTime || new Date().toISOString(),
entry: [
{
fullUrl: `CoverageEligibilityRequest/${options.CoverageEligibilityRequest.id}`,
resource: options.CoverageEligibilityRequest,
},
{
fullUrl: `Patient/${options.patient.id}`,
resource: options.patient,
},
{
fullUrl: `Coverage/${options.coverage.id}`,
resource: options.coverage,
},
],
};
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.location) {
body.entry.push({
fullUrl: `Location/${options.location.id}`,
resource: options.location,
});
}
if (options.condition && options.condition.length > 0) {
options.condition.forEach(el => {
body.entry.push({
fullUrl: `Condition/${el.id}`,
resource: el,
});
});
}
return body;
}
}
exports.CoverageEligibilityRequestBundle = CoverageEligibilityRequestBundle;
//# sourceMappingURL=CoverageEligibiltyRequestBundle.js.map