gcp-nrces-fhir
Version:
Google cloud healthcare api NRCES FHIR implimenataion
106 lines • 4.36 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.Immunization = void 0;
const ResourceMai_1 = __importDefault(require("./ResourceMai"));
const statusArray = ["completed", "entered-in-error", "not-done"];
class Immunization extends ResourceMai_1.default {
constructor() {
super(...arguments);
this.statusArray = () => {
return statusArray;
};
}
toHtml() {
return __awaiter(this, void 0, void 0, function* () {
throw new Error("Method not implemented.");
});
}
getFHIR(options) {
const patientString = `Patient/${options.patient.reference}`;
const body = Object.assign(Object.assign({}, options), { patient: { reference: patientString } });
if (body.performer) {
body.performer = body.performer.map((p) => ({
actor: { reference: `Practitioner/${p.actor.reference}` },
}));
}
return body;
}
convertFhirToObject(options) {
const ret = Object.assign(Object.assign({}, options), { patient: {
reference: this.getIdFromReference({
ref: options.patient.reference,
resourceType: "Patient",
}),
} });
if (ret.performer) {
ret.performer = ret.performer.map((p) => ({
actor: {
reference: this.getIdFromReference({
ref: p.actor.reference,
resourceType: "Practitioner",
}),
},
}));
}
if (!options.extension) {
delete options.extension;
}
if (!options.id) {
delete ret.id;
}
return ret;
}
}
exports.Immunization = Immunization;
// const body = {
// resourceType: "Immunization",
// id: "example-01",
// meta: {
// profile: ["https://nrces.in/ndhm/fhir/r4/StructureDefinition/Immunization"],
// },
// text: {
// status: "generated",
// div: "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Narrative with Details</b></p><p><b>id</b>: 1</p><p><b>status</b>: not-done</p><p><b>statusReason</b>: medical precaution <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ActReason code 'MEDPREC' = 'medical precaution', given as 'medical precaution'})</span></p><p><b>vaccineCode</b>: No consent DTP immunization <span>(Details : {http://snomed.info/sct code '314768003' = 'No consent DTP immunization'})</span></p><p><b>patient</b>: <a>Patient/1</a></p><p><b>occurrence</b>: 10/01/2013</p><p><b>primarySource</b>: true</p></div>",
// },
// extension: [
// {
// url: "https://nrces.in/ndhm/fhir/r4/StructureDefinition/BrandName",
// valueString: "Adacel®",
// },
// ],
// status: "not-done",
// statusReason: {
// coding: [
// {
// system: "http://terminology.hl7.org/CodeSystem/v3-ActReason",
// code: "MEDPREC",
// display: "medical precaution",
// },
// ],
// },
// vaccineCode: {
// coding: [
// {
// system: "http://snomed.info/sct",
// code: "314768003",
// display: "No consent DTP immunization",
// },
// ],
// },
// patient: { reference: "Patient/1" },
// occurrenceDateTime: "2013-01-10",
// primarySource: true,
// };
//# sourceMappingURL=Immunization.js.map