feat(attendant): 入驻免身份证材料、城市单选、材料后补与订单池同城过滤
入驻申请只收基本信息(身份证选填、材料全可空),服务城市改为单选白名单(北京/上海/天津/西安,默认北京);新增 POST /attendant-application/mine/materials 材料后补与 PATCH /employee/me/service-area 改城市接口;订单池按陪诊师服务城市过滤(本人已接/被共享不限城市),接单与详情二次校验;appId wxapp-escort-admin 更名为 wxapp_companion。
This commit is contained in:
@@ -26,9 +26,10 @@ const ImageSchema = mongoose.Schema(
|
||||
|
||||
const HealthCertificateSchema = mongoose.Schema(
|
||||
{
|
||||
data: { type: String, required: true, comment: "健康证照片 data URL" },
|
||||
mime: { type: String, enum: ["image/jpeg", "image/png"], required: true, comment: "图片类型" },
|
||||
expireDate: { type: Date, required: true, comment: "健康证有效期至" },
|
||||
// 证件材料允许后补:照片与有效期都可能缺失,是否成对由 handler 校验
|
||||
data: { type: String, comment: "健康证照片 data URL" },
|
||||
mime: { type: String, enum: ["image/jpeg", "image/png"], comment: "图片类型" },
|
||||
expireDate: { type: Date, comment: "健康证有效期至" },
|
||||
},
|
||||
{ _id: false }
|
||||
);
|
||||
@@ -53,20 +54,20 @@ const AttendantApplicationSchema = mongoose.Schema(
|
||||
},
|
||||
idNumber: {
|
||||
type: String,
|
||||
required: true,
|
||||
trim: true,
|
||||
uppercase: true,
|
||||
match: /^\d{17}[\dX]$/,
|
||||
comment: "身份证号",
|
||||
comment: "身份证号(选填,先收基本信息,后续再补)",
|
||||
},
|
||||
sex: { type: String, enum: ["male", "female", ""], default: "", comment: "性别" },
|
||||
serviceAreas: { type: [String], default: [], comment: "服务区域/城市列表" },
|
||||
introduction: { type: String, default: "", maxlength: 200, comment: "个人简介" },
|
||||
},
|
||||
|
||||
// 证件材料允许后补:提交时可为空,审核通过后仍可补传
|
||||
materials: {
|
||||
qualification: { type: ImageSchema, required: true, comment: "资质证书照片" },
|
||||
healthCertificate: { type: HealthCertificateSchema, required: true, comment: "健康证明" },
|
||||
qualification: { type: ImageSchema, comment: "资质证书照片" },
|
||||
healthCertificate: { type: HealthCertificateSchema, comment: "健康证明" },
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -289,11 +289,23 @@ EscortRecordSchema.statics.buildRecordFilter = function (options = {}) {
|
||||
if (attendantId) filter["attendant.id"] = attendantId;
|
||||
// 陪诊师订单池:按身份合并可见范围,scope 由服务端计算,不接受前端传入。
|
||||
// - includeUnassigned:所有在职陪诊师都能看到未分配订单
|
||||
// - poolCities:未分配订单只展示本服务城市(本人已接/被共享不受城市限制)
|
||||
// - userId:正式陪诊师还能看到自己已接的订单(实习不能接单,故不传)
|
||||
// - employeeId:被共享的订单
|
||||
if (attendantVisibility) {
|
||||
const or = [];
|
||||
if (attendantVisibility.includeUnassigned) or.push({ "attendant.id": null });
|
||||
if (attendantVisibility.includeUnassigned) {
|
||||
const poolClause = { "attendant.id": null };
|
||||
const poolCities = attendantVisibility.poolCities;
|
||||
if (Array.isArray(poolCities) && poolCities.length) {
|
||||
// 历史订单可能没有省份:无法归属城市时仍保留在池中,避免存量订单消失
|
||||
poolClause.$or = [
|
||||
{ "hospital.province": { $in: poolCities } },
|
||||
{ "hospital.province": { $in: ["", null] } },
|
||||
];
|
||||
}
|
||||
or.push(poolClause);
|
||||
}
|
||||
if (attendantVisibility.userId) or.push({ "attendant.id": attendantVisibility.userId });
|
||||
if (attendantVisibility.employeeId) {
|
||||
or.push({ "attendant.sharedWith": attendantVisibility.employeeId });
|
||||
|
||||
Reference in New Issue
Block a user