This commit is contained in:
lik
2026-10-06 16:48:04 +08:00
parent c8a44ee1f9
commit 4e9c19a18e
5 changed files with 467 additions and 150 deletions
+13
View File
@@ -2,6 +2,7 @@ import Router from "koa-router";
import { HandlerEscortRecord } from "../handler/escort_record.js";
import { HandlerHealthProfile } from "../handler/health_profile.js";
import { HandlerResource } from "../handler/resource.js";
import { HandlerEmployee } from "../handler/employee.js";
import ResponseUtil from "../utils/responseUtil.js";
import { getUserByToken } from "../utils/user_service.js";
@@ -40,6 +41,7 @@ function registerRoutes(app) {
const handlerEscortRecord = new HandlerEscortRecord();
const handlerHealthProfile = new HandlerHealthProfile();
const handlerResource = new HandlerResource();
const handlerEmployee = new HandlerEmployee();
// 敏感数据路由需要登录后访问
router.get("/escort-record/my", requireAuth, handlerEscortRecord.getMyRecords.bind(handlerEscortRecord));
@@ -51,6 +53,13 @@ function registerRoutes(app) {
router.patch("/escort-record/:id/status", requireAuth, handlerEscortRecord.updateStatus.bind(handlerEscortRecord));
router.delete("/escort-record/:id", requireAuth, handlerEscortRecord.deleteRecord.bind(handlerEscortRecord));
// C 端"我的健康档案":userId 一律取自 token,必须注册在 /health-profile/:id 之前
router.get("/health-profile/mine", requireAuth, handlerHealthProfile.getMyProfiles.bind(handlerHealthProfile));
router.post("/health-profile/mine", requireAuth, handlerHealthProfile.createMyProfile.bind(handlerHealthProfile));
router.get("/health-profile/mine/:id", requireAuth, handlerHealthProfile.getMyProfileById.bind(handlerHealthProfile));
router.put("/health-profile/mine/:id", requireAuth, handlerHealthProfile.updateMyProfile.bind(handlerHealthProfile));
router.delete("/health-profile/mine/:id", requireAuth, handlerHealthProfile.deleteMyProfile.bind(handlerHealthProfile));
router.get("/health-profile", requireAuth, handlerHealthProfile.getProfiles.bind(handlerHealthProfile));
router.get("/health-profile/:id", requireAuth, handlerHealthProfile.getProfileById.bind(handlerHealthProfile));
router.post("/health-profile", requireAuth, handlerHealthProfile.createProfile.bind(handlerHealthProfile));
@@ -64,6 +73,10 @@ function registerRoutes(app) {
router.get("/department-rankings", handlerResource.getDepartmentRankings.bind(handlerResource));
router.get("/ai-quick-questions", handlerResource.getAiQuickQuestions.bind(handlerResource));
// 陪诊师公示(公开):面向 C 端患者展示陪同人员信息。
// 与上面的 /service、/agreement 一样属公示类资源,不加 requireAuth
router.get("/attendant", handlerEmployee.getAttendants.bind(handlerEmployee));
app.use(router.routes());
app.use(router.allowedMethods());