UNPKG

@eka-care/patient-ts-sdk

Version:

TypeScript SDK for Trinity Patient Profile Management System

99 lines (98 loc) 2.81 kB
/** * Patient search and lookup operations */ import { HttpClient } from '../client'; import { DataLoaderService } from '../services/data-loader'; import { Patient, SdkConfig, SearchParams } from '../types'; /** * Search and lookup methods */ export declare class SearchMethods { private client; private readonly basePath; private indexedDB; private dataLoader; private config; private isSyncComplete; constructor(client: HttpClient, config?: SdkConfig); /** * Bulk get patients by OID list * * @param oidList Comma-separated list of patient OIDs * @returns Array of patients * * @example * ```typescript * const patients = await sdk.search.bulkGet('oid1,oid2,oid3'); * // or * const patients = await sdk.search.bulkGet(['oid1', 'oid2', 'oid3']); * ``` */ bulkGet(oidList: string | string[]): Promise<Patient[]>; /** * Get patients by mobile number * * @param mobile Mobile number to search for * @returns Array of patients with matching mobile number * * @example * ```typescript * const patients = await sdk.search.getByMobile('1234567890'); * ``` */ getByMobile(mobile: string): Promise<Patient[]>; /** * Search patients using various criteria * * @param params Search parameters * @returns Array of matching patients * * @example * ```typescript * // Search by prefix (local search if available) * const patients = await sdk.search.search({ prefix: 'jo', limit: 15 }); * ``` */ search(params: SearchParams, forceApiSearch?: boolean): Promise<Patient[]>; /** * Search by general prefix * * @param prefix Search prefix * @param limit Maximum number of results (default: 50, max: 50) * @param select Optional comma-separated list of fields to return * @returns Array of matching patients */ searchByPrefix(prefix: string, limit?: number, select?: string): Promise<Patient[]>; /** * Initialize local search functionality */ initializeLocalSearch(): Promise<void>; /** * Set sync completion status */ setSyncComplete(complete: boolean): void; /** * Check if sync is complete */ isSyncCompleted(): boolean; /** * Check if local search data is available */ hasLocalSearchData(): Promise<boolean>; /** * Clear all local search data */ clearLocalSearchData(): Promise<void>; /** * Get data loader service for direct access */ getDataLoader(): DataLoaderService | null; /** * Convert local minified patients to full Patient objects */ private convertLocalToPatients; /** * Cleanup resources */ destroy(): void; }