0.0.15 • Published 12 days ago

@iwanglang/patient-fhir-helper v0.0.15

Weekly downloads
-
License
MIT
Repository
-
Last release
12 days ago

IWangLang: Patient Fhir Helper

🚀 Quick Start

Install:

# npm
npm i @iwanglang/patient-fhir-helper

# yarn
yarn add @iwanglang/patient-fhir-helper

Import:

// ESM / Typescript
import { PatientFhirHelper } from "@iwanglang/patient-fhir-helper";

// CommonJS
const { PatientFhirHelper } = require("@iwanglang/patient-fhir-helper");

🥸 How it work?

The PatientFhirHelper class is used to search for patients in Fhir Server using business identifier and convert it into an interface PatientNormalization. So if you want to get patient information and don't know about fhir, let's call functionnn

sequenceDiagram
    patientFhirHelper->>FhirServer: search by business identifier
    FhirServer->>patientFhirHelper: Response Patient Resource
    patientFhirHelper-)PatientNormalization: Convert to interface

🥸 Get Patient Information by Identifier

import { PatientFhirHelper } from "@iwanglang/patient-fhir-helper";

async function bootstrap() {
  const patientFhirHelper = new PatientFhirHelper("http://hapi.fhir.org/baseR4");

  const patient = await patientFhirHelper.findPatientByIdentifier("12345");

  console.log(patient);
  /**
   * {
    id: "1174249",
    patientReference: "Patient/1174249",
    identifier: [
      {
        use: "usual",
        type: [Object ...],
        system: "urn:oid:1.2.3.4.5",
        value: "89765a87b",
      }
    ],
    deceasedBoolean: false,
    hospitalNumber: "89765a87b",
    name: "-",
    gender: "male",
    birthdate: "1967-10-02",
    remainingAge: "56ปี 6เดือน 9วัน",
    remainingAgeYears: 56,
    remainingAgeMonths: 6,
    remainingAgeDays: 9,
    photo: undefined,
  }
  */
}

bootstrap();

🥸 Patient Information Interface

The findPatientByIdentifier() function returns a PatientNormalization object.

elementtypedescription
idstringThe patient's unique identifier in the FHIR server.
patientReferencestringThe patient's reference in the FHIR server.
identifierIdentifier[]The patient's identifier.
deceasedBooleanbooleanThe patient's deceased status.
hospitalNumberstring | nullThe patient's hospital number, or null if not found.
namestringThe patient's name.
gender('male'|'female'|'other'|'unknown')The patient's gender.
birthdatestring | nullThe patient's birthdate, or null if not found.
remainingAgestring | nullThe patient's remainingAge, or null if not found.
remainingAgeYearsnumber | nullThe patient's remainingAgeYears, or null if not found.
remainingAgeMonthsnumber | nullThe patient's remainingAgeMonths, or null if not found.
remainingAgeDaysnumber | nullThe patient's remainingAgeDays, or null if not found.
photostring | undefinedThe patient's photo, or undefined if not found.
0.0.10

12 days ago

0.0.11

12 days ago

0.0.12

12 days ago

0.0.13

12 days ago

0.0.14

12 days ago

0.0.15

12 days ago

0.0.9

12 days ago

0.0.8

14 days ago

0.0.7

21 days ago

0.0.6

21 days ago

0.0.5

23 days ago

0.0.4

23 days ago

0.0.3

23 days ago

0.0.2

23 days ago

0.0.1

23 days ago