feat(attendant): 入驻默认实习阶段并新增阶段等级调整接口
- employee.attendantInfo 增加 stage/grade/star,存量档案按正式青铜归一化 - 入驻审批仅在新建档案时写 intern,重新激活保留原阶段 - /employee/me 返回阶段等级与 canAcceptOrder - C 端公示列表与详情排除实习陪诊师 - 新增 PATCH /employee/:id/level:转正、调级、钻石设星
This commit is contained in:
@@ -99,13 +99,30 @@ const EmployeeSchema = mongoose.Schema(
|
||||
// 陪诊员特有信息
|
||||
attendantInfo: {
|
||||
serviceAreas: { type: [String], default: [], comment: "服务区域/城市列表" },
|
||||
// 陪诊师阶段:intern=实习(只可查看,不能接单/被指派),certified=正式。
|
||||
// 存量档案没有该字段,读取时一律按 certified 处理(见 handler/employee.js)
|
||||
stage: {
|
||||
type: String,
|
||||
enum: ["intern", "certified"],
|
||||
default: "certified",
|
||||
comment: "陪诊师阶段:实习/正式",
|
||||
},
|
||||
// 等级仅用于展示与排序,不参与权限判定;默认青铜
|
||||
grade: {
|
||||
type: String,
|
||||
enum: ["bronze", "silver", "gold", "diamond"],
|
||||
default: "bronze",
|
||||
comment: "陪诊师等级:青铜/白银/黄金/钻石",
|
||||
},
|
||||
// 星级仅在钻石等级下有效(0-5),其他等级由接口归零
|
||||
star: { type: Number, default: 0, min: 0, max: 5, comment: "钻石等级下的星级" },
|
||||
specialties: { type: [String], default: [], comment: "擅长科室/领域" },
|
||||
languages: { type: [String], default: ["普通话"], comment: "掌握语言" },
|
||||
// 注意:本字段全项目没有任何写入点(恒为默认 5.0),不可作为评级来源。
|
||||
// 对外评级一律由 employee_review 真实评价聚合得出(employee_review.js),
|
||||
// 达阈值才展示,详见 .trae/documents/陪诊师公示与指定陪诊师.md
|
||||
// 达阈值才展示,详见 doc/architecture-overview.html 第 10 节「陪诊师成长与资金闭环」
|
||||
rating: { type: Number, default: 5.0, min: 1, max: 5, comment: "评分(无写入点,勿用于公示)" },
|
||||
orderCount: { type: Number, default: 0, comment: "接单数量" },
|
||||
orderCount: { type: Number, default: 0, comment: "接单数量(无写入点恒 0,公示/后台展示已摘除,勿用于排序)" },
|
||||
isOnline: { type: Boolean, default: false, comment: "是否在线" },
|
||||
},
|
||||
|
||||
@@ -239,8 +256,8 @@ EmployeeSchema.statics.updateEmployee = async function (id, update) {
|
||||
/**
|
||||
* 查询在线陪诊员列表
|
||||
*
|
||||
* 排序口径与 handler/employee.js 的公示列表保持一致:服务年限优先、累计服务次数次之。
|
||||
* 曾按 attendantInfo.rating 排,但该字段没有任何写入点(恒为 5.0),等于没排序
|
||||
* 排序口径与 handler/employee.js 的公示列表保持一致:只按服务年限。
|
||||
* 曾按 attendantInfo.rating / orderCount 排,但两者均无写入点,等于没排序
|
||||
*/
|
||||
EmployeeSchema.statics.findOnlineAttendants = async function (options = {}) {
|
||||
const { page = 1, pageSize = 20 } = options;
|
||||
@@ -250,7 +267,7 @@ EmployeeSchema.statics.findOnlineAttendants = async function (options = {}) {
|
||||
status: "active",
|
||||
"attendantInfo.isOnline": true,
|
||||
})
|
||||
.sort({ "work.workYears": -1, "attendantInfo.orderCount": -1 })
|
||||
.sort({ "work.workYears": -1 })
|
||||
.skip(skip)
|
||||
.limit(pageSize)
|
||||
.exec();
|
||||
|
||||
Reference in New Issue
Block a user