import type React from 'react'; import { type Visit, type OpenmrsResource, type Location, type Obs, type Patient } from '@openmrs/esm-framework'; import { type ColumnConfig } from '../config-schema'; export interface Attribute { attributeType: OpenmrsResource; display: string; uuid: string; value: string | number; } export interface Note { concept: OpenmrsResource; note: string; provider: { name: string; role: string; }; time: string; } export interface Order { uuid: string; dateActivated: string; dateStopped?: Date | null; action?: 'NEW' | 'REVISE' | 'DISCONTINUE' | 'RENEW' | string; previousOrder?: { uuid: string; } | null; dose: number; dosingInstructions: string | null; dosingType?: 'org.openmrs.FreeTextDosingInstructions' | 'org.openmrs.SimpleDosingInstructions'; doseUnits: { uuid: string; display: string; }; drug: { uuid: string; name: string; display: string; strength: string; }; duration: number; durationUnits: { uuid: string; display: string; }; frequency: { uuid: string; display: string; }; numRefills: number; orderNumber: string; orderReason: string | null; orderReasonNonCoded: string | null; orderer: { uuid: string; person: { uuid: string; display: string; }; }; orderType: { uuid: string; display: string; }; route: { uuid: string; display: string; }; quantity: number; quantityUnits: OpenmrsResource; } export interface OrderItem { order: Order; provider: { name: string; role: string; }; time: string; } export interface DiagnosisItem { diagnosis: string; } export interface Encounter { uuid: string; encounterDatetime: string; encounterProviders: Array<{ uuid: string; display: string; encounterRole: { uuid: string; display: string; }; provider: { uuid: string; person: { uuid: string; display: string; }; }; }>; encounterType: { uuid: string; display: string; }; obs: Array; form: OpenmrsResource; patient: OpenmrsResource; orders: Array; } export interface Observation { uuid: string; concept: { uuid: string; display: string; conceptClass: { uuid: string; display: string; }; }; display: string; groupMembers: null | Array<{ uuid: string; concept: { uuid: string; display: string; }; value: { uuid: string; display: string; }; }>; value: any; obsDatetime: string; } export interface PatientVitals { systolic?: number; diastolic?: number; pulse?: number; temperature?: number; oxygenSaturation?: number; height?: number; weight?: number; bmi?: number | null; respiratoryRate?: number; muac?: number; provider?: { name: string; role: string; }; time?: string; } export interface MappedEncounter { id: string; datetime: string; encounterType: string; form: OpenmrsResource; obs: Array; provider: string; visitUuid?: string; } export interface FormattedEncounter { id: string; datetime: string; encounterType: string; form: OpenmrsResource; obs: Array; provider: string; } export interface ObsMetaInfo { [_: string]: any; assessValue?: (value: number) => OBSERVATION_INTERPRETATION; } export type OBSERVATION_INTERPRETATION = | 'NORMAL' | 'HIGH' | 'CRITICALLY_HIGH' | 'OFF_SCALE_HIGH' | 'LOW' | 'CRITICALLY_LOW' | 'OFF_SCALE_LOW' | '--'; export interface PatientProgram { uuid: string; display: string; patient: OpenmrsResource; program: OpenmrsResource; dateEnrolled: string; dateCompleted: string; location: OpenmrsResource; } export interface QueueEntryPayload { visit: { uuid: string }; queueEntry: { status: { uuid: string }; priority: { uuid: string }; queue: { uuid: string }; patient: { uuid: string }; startedAt: Date; sortWeight: number; }; } export type AllowedPriority = OpenmrsResource; export type AllowedStatus = OpenmrsResource; export interface Provider { uuid: string; display: string; comments: string; response?: string; person: OpenmrsResource; location: string; serviceType: string; } export interface MappedQueueEntry { id: string; name: string; patientAge: string; patientSex: string; patientDob: string; patientUuid: string; queue: Queue; priority: Concept; priorityComment: string; status: Concept; visitType: string; visitUuid: string; waitTime: string; queueEntryUuid: string; queueLocation: string; sortWeight: string; } export interface EndVisitPayload { location: string; startDatetime: Date; visitType: string; stopDatetime: Date; } export interface LocationResponse { type: string; total: number; resourceType: string; meta: { lastUpdated: string; }; link: Array<{ relation: string; url: string; }>; id: string; entry: Array; } export interface LocationEntry { resource: Resource; } export interface Resource { id: string; name: string; resourceType: string; status: 'active' | 'inactive'; meta?: { tag?: Array<{ code: string; display: string; system: string; }>; }; } export interface Identifer { identifier: string; display: string; uuid: string; identifierType: { uuid: string; display: string; }; } export interface NewVisitPayload { uuid?: string; location: string; patient?: string; startDatetime: Date; visitType: string; stopDatetime?: Date; attributes?: Array<{ attributeType: string; value: string; }>; } export interface QueueRoom { uuid: string; display: string; name: string; description: string; queue: { uuid: string; display: string; }; } export interface ProvidersQueueRoom { uuid: string; provider: { uuid: string; display: string; }; queueRoom: { uuid: string; name: string; display: string; }; } export interface WaitTime { metric: string; averageWaitTime: string; } export interface QueueTableCellComponentProps { queueEntry: QueueEntry; } export type QueueTableColumn = { key: string; // key used by DataTable, MUST be unique for each column in the queue table header: string; // header of the column CellComponent: React.FC; // function to extract from the queue entry a searchable string representing the its value within this column. // May be null to make this column's content unsearchable getFilterableValue: (queueEntry: QueueEntry) => string | null; }; export type QueueTableColumnFunction = ( key: string, // a unique key for the column header?: string, config?: ColumnConfig, ) => QueueTableColumn; export interface QueueTableTabConfig { columns: QueueTableColumn[]; tabNameI18nKey?: string; } export interface Queue { uuid: string; display: string; name: string; description: string; location: Location; service: Concept; allowedPriorities: Array; allowedStatuses: Array; } export interface QueueEntry { uuid: string; display: string; endedAt: string; locationWaitingFor: Location; patient: Patient; priority: Concept; priorityComment: string | null; providerWaitingFor: Provider; queue: Queue; startedAt: string; status: Concept; visit?: Visit | null; sortWeight: number; queueComingFrom: Queue; previousQueueEntry: QueueEntry; } export interface QueueEntrySearchCriteria { queue?: Array | string; location?: Array | string; service?: Array | string; status?: Array | string; isEnded: boolean; patient?: string; } // TODO: The follow types match the types from backend. // They should be common enough to move to esm-core export interface Concept extends OpenmrsResource { setMembers?: Array; }