gcp-nrces-fhir
Version:
Google cloud healthcare api NRCES FHIR implimenataion
238 lines • 9.3 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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrescriptionBundle = void 0;
const _1 = require(".");
class PrescriptionBundle extends _1.BundelMain {
toHtml() {
return __awaiter(this, void 0, void 0, function* () {
throw new Error("Method not implemented.");
});
}
getFHIR(options) {
return __awaiter(this, void 0, void 0, function* () {
if (options.identifier) {
let ret = {
system: "http://www.nicehms.com",
value: options.identifier.value,
};
}
// options.composition.title = "OP Consultation Document";
const bundlemain = yield new _1.BundelMain(this.gcpCredetials, this.gcpPath).getentries(options.composition, options.pdfData);
this.entry = bundlemain.entry;
const sectionEntries = options.composition.section;
yield this.getAllSectionAndAllEntries(0, sectionEntries);
const body = {
resourceType: "Bundle",
id: options.id,
meta: {
lastUpdated: new Date().toISOString(),
},
identifier: {
system: "https://www.nicehms.com/bundle",
value: options.id,
},
type: "document",
timestamp: options.composition.date,
entry: this.entry,
};
const medicationRef = body.entry
.filter((el) => el.resource.resourceType == "MedicationRequest")
.map((el) => {
return {
reference: `MedicationRequest/${el.resource.id}`,
};
});
let sectionZeroNoMedicationRequest = [];
sectionZeroNoMedicationRequest = body.entry[0].resource.section[0].entry.filter((el) => el.type != "MedicationRequest");
medicationRef.forEach(el => {
sectionZeroNoMedicationRequest.push({
"reference": el.reference,
"type": "MedicationRequest"
});
});
body.entry[0].resource.section[0].entry = sectionZeroNoMedicationRequest;
// const filteredEntry =body.entry.filter(el =>el.resource.resourceType !== "DocumentReference")
// body.entry=filteredEntry;
return body;
});
}
convertFhirToObject(options) {
throw new Error("Method not implemented.");
}
}
exports.PrescriptionBundle = PrescriptionBundle;
const dem0 = {
"resourceType": "Bundle",
"id": "3739707e-1123-46fe-918f-b52d880e4e7f",
"meta": {
"lastUpdated": "2016-08-07T00:00:00.000+05:30"
},
"identifier": {
"system": "https://www.max.in/bundle",
"value": "3739707e-1123-46fe-918f-b52d880e4e7f"
},
"type": "document",
"timestamp": "2016-08-07T00:00:00.000+05:30",
"entry": [
{
"fullUrl": "Composition/c63d1435-b6b6-46c4-8163-33133bf0d9bf",
"resource": {
"resourceType": "Composition",
"id": "c63d1435-b6b6-46c4-8163-33133bf0d9bf",
"identifier": {
"system": "https://www.max.in/document",
"value": "c63d1435-b6b6-46c4-8163-33133bf0d9bf"
},
"status": "final",
"type": {
"coding": [
{
"system": "https://projecteka.in/sct",
"code": "440545006",
"display": "Prescription record"
}
]
},
"subject": {
"reference": "Patient/RVH9999"
},
"encounter": {
"reference": "Encounter/dab7fd2b-6a05-4adb-af35-bcffd6c85b81"
},
"date": "2016-08-07T00:00:00.605+05:30",
"author": [
{
"reference": "Practitioner/MAX5001",
"display": "Dr Laxmikanth J"
}
],
"title": "Prescription",
"section": [
{
"title": "OPD Prescription",
"code": {
"coding": [
{
"system": "https://projecteka.in/sct",
"code": "440545006",
"display": "Prescription record"
}
]
},
"entry": [
{
"reference": "MedicationRequest/68d9667c-00c3-455f-b75d-d580950498a0"
}
]
}
]
}
},
{
"fullUrl": "Practitioner/MAX5001",
"resource": {
"resourceType": "Practitioner",
"id": "MAX5001",
"identifier": [
{
"system": "https://www.mciindia.in/doctor",
"value": "MAX5001"
}
],
"name": [
{
"text": "Laxmikanth J",
"prefix": [
"Dr"
],
"suffix": [
"MD"
]
}
]
}
},
{
"fullUrl": "Patient/RVH9999",
"resource": {
"resourceType": "Patient",
"id": "RVH9999",
"name": [
{
"text": "Keith David"
}
],
"gender": "male"
}
},
{
"fullUrl": "Encounter/dab7fd2b-6a05-4adb-af35-bcffd6c85b81",
"resource": {
"resourceType": "Encounter",
"id": "dab7fd2b-6a05-4adb-af35-bcffd6c85b81",
"status": "finished",
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "AMB",
"display": "Outpatient visit"
},
"subject": {
"reference": "Patient/RVH9999"
},
"period": {
"start": "2016-08-07T00:00:00+05:30"
}
}
},
{
"fullUrl": "Medication/54ab5657-5e79-4461-a823-20e522eb337d",
"resource": {
"resourceType": "Medication",
"id": "54ab5657-5e79-4461-a823-20e522eb337d",
"code": {
"coding": [
{
"system": "https://projecteka.in/act",
"code": "R05CB02",
"display": "bromhexine 24 mg"
}
]
}
}
},
{
"fullUrl": "MedicationRequest/68d9667c-00c3-455f-b75d-d580950498a0",
"resource": {
"resourceType": "MedicationRequest",
"id": "68d9667c-00c3-455f-b75d-d580950498a0",
"status": "active",
"intent": "order",
"medicationReference": {
"reference": "Medication/54ab5657-5e79-4461-a823-20e522eb337d"
},
"subject": {
"reference": "Patient/RVH9999"
},
"authoredOn": "2016-08-07T00:00:00+05:30",
"requester": {
"reference": "Practitioner/MAX5001"
},
"dosageInstruction": [
{
"text": "1 capsule 2 times a day"
}
]
}
}
]
};
//# sourceMappingURL=Prescription.js.map