UNPKG

gcp-nrces-fhir

Version:

Google cloud healthcare api NRCES FHIR implimenataion

248 lines 10.9 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.InitialAssessment = void 0; const _1 = require("."); const gcp_1 = __importDefault(require("../../classess/gcp")); class InitialAssessment extends _1.Composition { constructor() { super(...arguments); this.create = (options) => __awaiter(this, void 0, void 0, function* () { options = yield this.getOptions(options); const body = this.getFHIR(options.composition); const gcpFhirCrud = new gcp_1.default(); body.section = options.composition.section; const res = yield gcpFhirCrud.createFhirResource(body, "Composition"); return res; }); this.update = (options) => __awaiter(this, void 0, void 0, function* () { if (!options.composition.id) { throw (new Error().message = "id of composition is required"); } options = yield this.getOptions(options); const body = this.getFHIR(options.composition); body.section = options.composition.section; const gcpFhirCrud = new gcp_1.default(); const res = yield gcpFhirCrud.updateFhirResource(body, options.composition.id || "", "Composition"); return res; }); this.getOptions = (options) => __awaiter(this, void 0, void 0, function* () { var _a; let docHtml = `<div style="text-align:center;"> <h2>Initial Assessment</h2></div>`; let encounterOPIONumber = ""; if (options.encounter && options.encounter.extension) { encounterOPIONumber = ((_a = options.encounter.extension.find(el => el.url == "https://nicehms.com/OPD" || el.url == "https://nicehms.com/IPD")) === null || _a === void 0 ? void 0 : _a.valueString) || ""; } docHtml += `<div style="text-align:center;"><h5>${options.encounter.text}${encounterOPIONumber}</h5> </div>`; let diagnosis = []; yield this.getDiagnosisFromEnconter(options.composition.encounter.diagnosis, 0, diagnosis); if (diagnosis && diagnosis.length > 0) { let diagnosisString = ""; diagnosis.forEach((el, i) => diagnosisString += `(${i + 1}). ${el} `); docHtml += `<p><b>Diagnosis [ICD 11]:- </b>${diagnosisString}</p><p></p>`; } const sectionZero = { code: { coding: [ { code: "371530004", display: "InitialAssessment", system: "https://ndhm.gov.in/sct", }, ], }, entry: [], title: "InitialAssessment", }; docHtml += `<table data-pdfmake="{'widths':['32%','32%','32%']}"><tr>`; //1 weight if (options.weight) { sectionZero.entry.push({ reference: `Observation/${options.weight.id}`, type: "Observation", }); docHtml += `<td>${options.weight.text.div}</td>`; } else { docHtml += `<td></td>`; } // 2 height if (options.height) { sectionZero.entry.push({ reference: `Observation/${options.height.id}`, type: "Observation", }); docHtml += `<td>${options.height.text.div}</td>`; } else { docHtml += `<td></td>`; } // 3 pulse rate if (options.pulseRate) { sectionZero.entry.push({ reference: `Observation/${options.pulseRate.id}`, type: "Observation", }); docHtml += `<td>${options.pulseRate.text.div}</td>`; } else { docHtml += `<td></td>`; } docHtml += `</tr><tr>`; //1 Bllod Pressue if (options.bloodPressure) { sectionZero.entry.push({ reference: `Observation/${options.bloodPressure.id}`, type: "Observation", }); docHtml += `<td>${options.bloodPressure.text.div}</td>`; } else { docHtml += `<td></td>`; } // 2 SPO2 if (options.spo2) { sectionZero.entry.push({ reference: `Observation/${options.spo2.id}`, type: "Observation", }); docHtml += `<td>${options.spo2.text.div}</td>`; } else { docHtml += `<td></td>`; } // 3 Blood Glucose if (options.bloodGlucose) { sectionZero.entry.push({ reference: `Observation/${options.bloodGlucose.id}`, type: "Observation", }); docHtml += `<td>${options.bloodGlucose.text.div}</td>`; } else { docHtml += `<td></td>`; } docHtml += `</tr><tr>`; if (options.hba1c) { sectionZero.entry.push({ reference: `Observation/${options.hba1c.id}`, type: "Observation", }); docHtml += `<td>${options.hba1c.text.div}</td>`; } else { docHtml += `<td></td>`; } if (options.glasgowComaScale) { sectionZero.entry.push({ reference: `Observation/${options.glasgowComaScale.id}`, type: "Observation", }); docHtml += `<td>${options.glasgowComaScale.text.div}</td>`; } else { docHtml += `<td></td>`; } if (options.hb) { sectionZero.entry.push({ reference: `Observation/${options.hb.id}`, type: "Observation", }); docHtml += `<td>${options.hb.text.div}</td>`; } else { docHtml += `<td></td>`; } docHtml += `</tr></table>`; // AllergyIntolerance This sis string if (options.allergyIntolerance) { if (options.allergyIntolerance != "") { docHtml += `<h4>Allergy Intolerance</h4>`; docHtml += options.allergyIntolerance; } } // presentingProblems if (options.presentingProblems) { sectionZero.entry.push({ reference: `Condition/${options.presentingProblems.id}`, type: "Condition", }); if (options.presentingProblems.text.div != "") { docHtml += `<h4>Presenting Problems</h4>`; docHtml += options.presentingProblems.text.div; } } // chiefComplaints if (options.chiefComplaints) { sectionZero.entry.push({ reference: `Condition/${options.chiefComplaints.id}`, type: "Condition", }); docHtml += `<h4>Chief Complaints</h4>`; docHtml += options.chiefComplaints.text.div; } if (options.histroryOfPrsentingIllness) { sectionZero.entry.push({ reference: `Condition/${options.histroryOfPrsentingIllness.id}`, type: "Condition", }); docHtml += `<h4>History of Presenting Illness</h4>`; docHtml += options.histroryOfPrsentingIllness.text.div; } // pasthistory if (options.pasthistory) { sectionZero.entry.push({ reference: `Condition/${options.pasthistory.id}`, type: "Condition", }); docHtml += `<h4>Past History</h4>`; docHtml += options.pasthistory.text.div; } // medicationStatement if (options.medicationStatement) { sectionZero.entry.push({ reference: `MedicationStatement/${options.medicationStatement.id}`, type: "MedicationStatement", }); docHtml += `<h4>Current Medications</h4>`; docHtml += options.medicationRequest.text.div; } // familyHistory if (options.familyHistory) { sectionZero.entry.push({ reference: `Condition/${options.familyHistory.id}`, type: "Condition", }); docHtml += `<h4>Family History</h4>`; docHtml += options.familyHistory.text.div; } // medicationRequest if (options.medicationRequest) { sectionZero.entry.push({ reference: `MedicationRequest/${options.medicationRequest.id}`, type: "MedicationRequest", }); docHtml += `<h4>Advise Medicines</h4>`; docHtml += options.medicationRequest.text.div; } options.composition.documentDatahtml = docHtml; options.composition.section.push(sectionZero); return options; }); } } exports.InitialAssessment = InitialAssessment; //# sourceMappingURL=InitialAssessment.js.map