feat: wire health workspace pages
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import AlertsPage from "../../alerts/page";
|
import { AlertsModulePage } from "@/modules/shared/components/ReservedModulePages";
|
||||||
|
|
||||||
export default function ScopedAlertsPage(): React.ReactElement {
|
export default function ScopedAlertsPage(): React.ReactElement {
|
||||||
return AlertsPage();
|
return <AlertsModulePage />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import DevicesPage from "../../devices/page";
|
import { DevicesModulePage } from "@/modules/shared/components/ReservedModulePages";
|
||||||
|
|
||||||
export default function ScopedDevicesPage(): React.ReactElement {
|
export default function ScopedDevicesPage(): React.ReactElement {
|
||||||
return DevicesPage();
|
return <DevicesModulePage />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import FamilyPage from "../../family/page";
|
import { FamilyModulePage } from "@/modules/shared/components/ReservedModulePages";
|
||||||
|
|
||||||
export default function ScopedFamilyPage(): React.ReactElement {
|
export default function ScopedFamilyPage(): React.ReactElement {
|
||||||
return FamilyPage();
|
return <FamilyModulePage />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import HealthPage from "../../health/page";
|
import { renderHealthWorkspacePage } from "@/modules/health/components/HealthWorkspacePage";
|
||||||
|
|
||||||
export default function ScopedHealthPage(): React.ReactElement {
|
export default async function ScopedHealthPage(): Promise<React.ReactElement> {
|
||||||
return HealthPage();
|
return renderHealthWorkspacePage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import NoticesPage from "../../notices/page";
|
import { NoticesModulePage } from "@/modules/shared/components/ReservedModulePages";
|
||||||
|
|
||||||
export default function ScopedNoticesPage(): React.ReactElement {
|
export default function ScopedNoticesPage(): React.ReactElement {
|
||||||
return NoticesPage();
|
return <NoticesModulePage />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
import { Radio } from "lucide-react";
|
import { AlertsModulePage } from "@/modules/shared/components/ReservedModulePages";
|
||||||
|
|
||||||
import { ModulePage } from "@/modules/shared/components/ModulePage";
|
|
||||||
|
|
||||||
export default function AlertsPage(): React.ReactElement {
|
export default function AlertsPage(): React.ReactElement {
|
||||||
return (
|
return <AlertsModulePage />;
|
||||||
<ModulePage
|
|
||||||
title="规则预警"
|
|
||||||
eyebrow="规则中心与风险识别"
|
|
||||||
description="三期计划接入健康阈值、任务逾期、设备故障、应急事件和风险老人识别规则。"
|
|
||||||
icon={Radio}
|
|
||||||
phase="三期预留"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ export default async function DashboardPage(): Promise<React.ReactElement> {
|
|||||||
careTasks={careTasks}
|
careTasks={careTasks}
|
||||||
emergencyHref={getWorkspaceHref(context.organization?.slug, "/emergency")}
|
emergencyHref={getWorkspaceHref(context.organization?.slug, "/emergency")}
|
||||||
emergencyIncidents={emergencyIncidents}
|
emergencyIncidents={emergencyIncidents}
|
||||||
healthHref={getWorkspaceHref(context.organization?.slug, "/settings/health")}
|
healthHref={getWorkspaceHref(context.organization?.slug, "/health")}
|
||||||
healthReviews={healthReviews}
|
healthReviews={healthReviews}
|
||||||
incidents={visibleIncidents}
|
incidents={visibleIncidents}
|
||||||
metrics={metrics}
|
metrics={metrics}
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
import { Wrench } from "lucide-react";
|
import { DevicesModulePage } from "@/modules/shared/components/ReservedModulePages";
|
||||||
|
|
||||||
import { ModulePage } from "@/modules/shared/components/ModulePage";
|
|
||||||
|
|
||||||
export default function DevicesPage(): React.ReactElement {
|
export default function DevicesPage(): React.ReactElement {
|
||||||
return (
|
return <DevicesModulePage />;
|
||||||
<ModulePage
|
|
||||||
title="设备运维"
|
|
||||||
eyebrow="设备台账与维修工单"
|
|
||||||
description="待接入设备台账、故障上报、维修派单、处理记录和状态恢复数据源。"
|
|
||||||
icon={Wrench}
|
|
||||||
phase="待接入"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
import { TabletSmartphone } from "lucide-react";
|
import { FamilyModulePage } from "@/modules/shared/components/ReservedModulePages";
|
||||||
|
|
||||||
import { ModulePage } from "@/modules/shared/components/ModulePage";
|
|
||||||
|
|
||||||
export default function FamilyPage(): React.ReactElement {
|
export default function FamilyPage(): React.ReactElement {
|
||||||
return (
|
return <FamilyModulePage />;
|
||||||
<ModulePage
|
|
||||||
title="家属服务"
|
|
||||||
eyebrow="家属端与探访反馈"
|
|
||||||
description="二期计划接入家属授权、老人动态、探访预约和服务反馈数据源。"
|
|
||||||
icon={TabletSmartphone}
|
|
||||||
phase="二期预留"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
import { HeartPulse } from "lucide-react";
|
import { renderHealthWorkspacePage } from "@/modules/health/components/HealthWorkspacePage";
|
||||||
|
|
||||||
import { ModulePage } from "@/modules/shared/components/ModulePage";
|
export default async function HealthPage(): Promise<React.ReactElement> {
|
||||||
|
return renderHealthWorkspacePage();
|
||||||
export default function HealthPage(): React.ReactElement {
|
|
||||||
return (
|
|
||||||
<ModulePage
|
|
||||||
title="健康照护"
|
|
||||||
eyebrow="健康档案与生命体征"
|
|
||||||
description="待接入生命体征、健康档案、慢病信息和异常复核数据源。"
|
|
||||||
icon={HeartPulse}
|
|
||||||
phase="待接入"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
import { Bell } from "lucide-react";
|
import { NoticesModulePage } from "@/modules/shared/components/ReservedModulePages";
|
||||||
|
|
||||||
import { ModulePage } from "@/modules/shared/components/ModulePage";
|
|
||||||
|
|
||||||
export default function NoticesPage(): React.ReactElement {
|
export default function NoticesPage(): React.ReactElement {
|
||||||
return (
|
return <NoticesModulePage />;
|
||||||
<ModulePage
|
|
||||||
title="公告通知"
|
|
||||||
eyebrow="公告发布与阅读状态"
|
|
||||||
description="待接入公告草稿、发布范围、阅读状态和通知记录数据源。"
|
|
||||||
icon={Bell}
|
|
||||||
phase="待接入"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,5 @@
|
|||||||
import { redirect } from "next/navigation";
|
import { renderHealthWorkspacePage } from "@/modules/health/components/HealthWorkspacePage";
|
||||||
|
|
||||||
import { getCurrentAuthContext } from "@/modules/core/server/auth";
|
|
||||||
import { hasPermission } from "@/modules/core/server/permissions";
|
|
||||||
import { listHealthAdminData } from "@/modules/health/server/operations";
|
|
||||||
import { HealthAdminClient } from "@/modules/health/components/HealthAdminClient";
|
|
||||||
import { getWorkspaceHref } from "@/modules/shared/lib/workspace-routing";
|
|
||||||
|
|
||||||
export default async function HealthSettingsPage(): Promise<React.ReactElement> {
|
export default async function HealthSettingsPage(): Promise<React.ReactElement> {
|
||||||
const context = await getCurrentAuthContext();
|
return renderHealthWorkspacePage();
|
||||||
if (!context) {
|
|
||||||
redirect("/login");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasPermission(context.permissions, "health:read")) {
|
|
||||||
redirect(getWorkspaceHref(context.organization?.slug, "/dashboard"));
|
|
||||||
}
|
|
||||||
|
|
||||||
const organizationId = context.organization?.id;
|
|
||||||
if (!organizationId) {
|
|
||||||
redirect(getWorkspaceHref(context.organization?.slug, "/dashboard"));
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = await listHealthAdminData(organizationId);
|
|
||||||
|
|
||||||
return <HealthAdminClient canManage={hasPermission(context.permissions, "health:manage")} initialData={data} />;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ export function HealthAdminClient({ canManage, initialData }: HealthAdminClientP
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto flex w-full max-w-7xl flex-col gap-5">
|
<div className="flex w-full flex-col gap-5">
|
||||||
<section className="grid gap-4 md:grid-cols-2 xl:grid-cols-4">
|
<section className="grid gap-4 md:grid-cols-2 xl:grid-cols-4">
|
||||||
<MetricCard icon={FileText} label="健康档案" value={data.metrics.eldersWithProfiles} />
|
<MetricCard icon={FileText} label="健康档案" value={data.metrics.eldersWithProfiles} />
|
||||||
<MetricCard icon={Activity} label="今日体征" value={data.metrics.vitalsToday} />
|
<MetricCard icon={Activity} label="今日体征" value={data.metrics.vitalsToday} />
|
||||||
|
|||||||
44
modules/health/components/HealthWorkspacePage.tsx
Normal file
44
modules/health/components/HealthWorkspacePage.tsx
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import { redirect } from "next/navigation";
|
||||||
|
import { HeartPulse } from "lucide-react";
|
||||||
|
|
||||||
|
import { getCurrentAuthContext } from "@/modules/core/server/auth";
|
||||||
|
import { hasPermission } from "@/modules/core/server/permissions";
|
||||||
|
import { HealthAdminClient } from "@/modules/health/components/HealthAdminClient";
|
||||||
|
import { listHealthAdminData } from "@/modules/health/server/operations";
|
||||||
|
import { getWorkspaceHref } from "@/modules/shared/lib/workspace-routing";
|
||||||
|
|
||||||
|
export async function renderHealthWorkspacePage(): Promise<React.ReactElement> {
|
||||||
|
const context = await getCurrentAuthContext();
|
||||||
|
if (!context) {
|
||||||
|
redirect("/login");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasPermission(context.permissions, "health:read")) {
|
||||||
|
redirect(getWorkspaceHref(context.organization?.slug, "/dashboard"));
|
||||||
|
}
|
||||||
|
|
||||||
|
const organizationId = context.organization?.id;
|
||||||
|
if (!organizationId) {
|
||||||
|
redirect(getWorkspaceHref(context.organization?.slug, "/dashboard"));
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await listHealthAdminData(organizationId);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="mx-auto flex w-full max-w-7xl flex-col gap-5">
|
||||||
|
<section className="flex flex-col gap-3 border-b pb-4 lg:flex-row lg:items-start lg:justify-between">
|
||||||
|
<div className="flex min-w-0 items-center gap-3">
|
||||||
|
<span className="inline-flex size-9 items-center justify-center rounded-md bg-secondary text-primary">
|
||||||
|
<HeartPulse className="size-4" aria-hidden="true" />
|
||||||
|
</span>
|
||||||
|
<div className="min-w-0">
|
||||||
|
<h1 className="truncate text-xl font-semibold tracking-normal">健康照护</h1>
|
||||||
|
<p className="mt-1 truncate text-sm text-muted-foreground">健康档案、生命体征、慢病管理与异常复核</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<HealthAdminClient canManage={hasPermission(context.permissions, "health:manage")} initialData={data} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
51
modules/shared/components/ReservedModulePages.tsx
Normal file
51
modules/shared/components/ReservedModulePages.tsx
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import { Bell, Radio, TabletSmartphone, Wrench } from "lucide-react";
|
||||||
|
|
||||||
|
import { ModulePage } from "@/modules/shared/components/ModulePage";
|
||||||
|
|
||||||
|
export function DevicesModulePage(): React.ReactElement {
|
||||||
|
return (
|
||||||
|
<ModulePage
|
||||||
|
title="设备运维"
|
||||||
|
eyebrow="设备台账与维修工单"
|
||||||
|
description="待接入设备台账、故障上报、维修派单、处理记录和状态恢复数据源。"
|
||||||
|
icon={Wrench}
|
||||||
|
phase="待接入"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function FamilyModulePage(): React.ReactElement {
|
||||||
|
return (
|
||||||
|
<ModulePage
|
||||||
|
title="家属服务"
|
||||||
|
eyebrow="家属端与探访反馈"
|
||||||
|
description="二期计划接入家属授权、老人动态、探访预约和服务反馈数据源。"
|
||||||
|
icon={TabletSmartphone}
|
||||||
|
phase="二期预留"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function NoticesModulePage(): React.ReactElement {
|
||||||
|
return (
|
||||||
|
<ModulePage
|
||||||
|
title="公告通知"
|
||||||
|
eyebrow="公告发布与阅读状态"
|
||||||
|
description="待接入公告草稿、发布范围、阅读状态和通知记录数据源。"
|
||||||
|
icon={Bell}
|
||||||
|
phase="待接入"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AlertsModulePage(): React.ReactElement {
|
||||||
|
return (
|
||||||
|
<ModulePage
|
||||||
|
title="规则预警"
|
||||||
|
eyebrow="规则中心与风险识别"
|
||||||
|
description="三期计划接入健康阈值、任务逾期、设备故障、应急事件和风险老人识别规则。"
|
||||||
|
icon={Radio}
|
||||||
|
phase="三期预留"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -55,7 +55,7 @@ export const navGroups: NavGroup[] = [
|
|||||||
path: "/health",
|
path: "/health",
|
||||||
label: "健康照护",
|
label: "健康照护",
|
||||||
icon: "health",
|
icon: "health",
|
||||||
permission: "elder:read",
|
permission: "health:read",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/care",
|
path: "/care",
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ import type { NextConfig } from "next";
|
|||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
outputFileTracingRoot: process.cwd(),
|
outputFileTracingRoot: process.cwd(),
|
||||||
|
experimental: {
|
||||||
|
devtoolSegmentExplorer: false,
|
||||||
|
},
|
||||||
webpack(config, { dev }) {
|
webpack(config, { dev }) {
|
||||||
if (dev) {
|
if (dev) {
|
||||||
config.watchOptions = {
|
config.watchOptions = {
|
||||||
|
|||||||
Reference in New Issue
Block a user