@eka-care/medical-records-ui

中文文档
1.2.44发布于 2026/11/13TypeScriptESM + CJS近 30 天下载 4078

Framework-agnostic React SDK for the Eka Care Medical Records feature. Drop it into any React app (Next.js, Vite, Electron) to get a full records list, filters, upload flow, and document preview.

原始使用文档
文档目录14 节
  1. Installation
  2. Peer dependencies
  3. Setup
  4. 1. Import styles
  5. 2. Wrap with SdkProvider
  6. 3. Render the records view
  7. SdkProvider props
  8. SdkConfig
  9. RecordsView props
  10. Authentication
  11. PDF support
  12. Next.js
  13. Development
  14. Dev playground setup

@eka-care/medical-records-ui

Framework-agnostic React SDK for the Eka Care Medical Records feature. Drop it into any React app (Next.js, Vite, Electron) to get a full records list, filters, upload flow, and document preview.

Installation

npm install @eka-care/medical-records-ui

Peer dependencies

Make sure these are installed in your host app:

npm install react react-dom zustand lucide-react

Setup

1. Import styles

In your app's entry point (e.g. _app.tsx, main.tsx):

import '@eka-care/medical-records-ui/styles';

2. Wrap with SdkProvider

import { SdkProvider } from '@eka-care/medical-records-ui';

<SdkProvider
  config={{ environment: 'prod' }}
  bid="YOUR_BID"
  patientId="YOUR_PATIENT_ID"
>
  {/* your app or the RecordsView */}
</SdkProvider>

If bid or patientId are not yet available (e.g. no patient selected), SdkProvider renders a placeholder automatically — no extra handling needed.

3. Render the records view

import { SdkProvider, RecordsView } from '@eka-care/medical-records-ui';

export function MedicalRecordsPanel({ bid, patientId }) {
  return (
    <SdkProvider
      config={{ environment: 'prod' }}
      bid={bid}
      patientId={patientId}
    >
      <RecordsView />
    </SdkProvider>
  );
}

SdkProvider props

PropTypeRequiredDescription
configSdkConfigYesSDK configuration (see below)
bidstringNoBusiness/clinic ID. Shows placeholder when absent.
patientIdstringNoPatient ID. Shows placeholder when absent.
documentTypesDocumentTypeConfig[]NoDocument type labels from your onboarding config. Falls back to built-in labels.

SdkConfig

FieldTypeDescription
environment'prod' | 'staging'API environment
baseUrlstringOverride the API base URL (useful for proxying)
accessTokenstringAuth token. Not needed if using cookie-based auth.
onUnauthorized() => voidCalled on 401 — use to refresh the token or redirect to login
defaultHeadersRecord<string, string>Extra headers added to every request

RecordsView props

PropTypeDescription
allowUploadbooleanShow/hide the upload button. Default: true
attachedIdsstring[]Record IDs already attached to the current session context
maxAttachablenumberMax records attachable at once
onAttachToContext(records) => voidCalled when user adds a record to session context
onRemoveAttachment(documentId) => voidCalled when user removes a record from context
onCopyToNote(text, anchor?) => voidCalled when user copies a smart report to notes
onToast(message, type?) => voidHook into the host app's toast/notification system

Authentication

The SDK uses cookie-based auth automatically when running on the same domain as the Eka Care backend. For token-based auth pass accessToken in config and provide onUnauthorized to handle token refresh:

<SdkProvider
  config={{
    environment: 'prod',
    accessToken: yourToken,
    onUnauthorized: refreshToken,
  }}
  bid={bid}
  patientId={patientId}
>

PDF support

No setup required. PDF preview works out of the box — the SDK loads the pdfjs worker from CDN automatically.

Next.js

Works without any extra webpack config. react-pdf and pdfjs-dist are peer dependencies — install them in your app:

npm install react-pdf pdfjs-dist

Development

# Start the dev playground at https://test.1.eka.care:4443
npm run dev

# Build the SDK
npm run build

# Run tests
npm test

Dev playground setup

The playground runs on https://test.1.eka.care:4443 so auth cookies from the Eka Care backend are available.

  1. Add to /etc/hosts:

    127.0.0.1  test.1.eka.care
    
  2. Generate a local certificate:

    cd certificates && mkcert test.1.eka.care
    
  3. Log into the Eka Care app on test.1.eka.care so the auth cookie is set.

  4. Run npm run dev and open https://test.1.eka.care:4443.

版本与发布记录

@eka-care/medical-records-ui 共发布 69 个版本,首次发布于 2026/06/08;过去 12 个月发布了 69 个版本。

版本发布日期距今
1.2.44latest2026/11/13今天
1.2.422026/11/13今天
1.2.402026/11/121 天前
1.2.382026/11/121 天前
1.2.352026/11/121 天前
1.2.332026/11/121 天前

关于 @eka-care/medical-records-ui 的常见问题

@eka-care/medical-records-ui 是什么?

Framework-agnostic React SDK for the Eka Care Medical Records feature. Drop it into any React app (Next.js, Vite, Electron) to get a full records list, filters, upload flow, and document preview.

如何安装 @eka-care/medical-records-ui?

在项目目录运行 npm install @eka-care/medical-records-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)、zustand(>=4)、react-dom(>=18)、react-pdf(>=9)、pdfjs-dist(>=4)、lucide-react(>=0.300)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@eka-care/medical-records-ui 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eka-care/medical-records-ui 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@eka-care/medical-records-ui 可以商用吗?

@eka-care/medical-records-ui 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@eka-care/medical-records-ui 的下载量有多少?

根据 npm 官方下载统计,@eka-care/medical-records-ui 在 2026/10/13 – 2026/11/11 这 30 天内被下载 4,078 次,日均约 136 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eka-care/medical-records-ui 还在维护吗?

最新版本 1.2.44 发布于 2026/11/13(今天);至今共发布 69 个版本,其中过去 12 个月发布了 69 个;首次发布于 2026/06/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。