tmp
This commit is contained in:
@@ -36,7 +36,7 @@ class HandlerEscortRecord {
|
|||||||
|
|
||||||
async _listRecords(ctx, forceSelf) {
|
async _listRecords(ctx, forceSelf) {
|
||||||
try {
|
try {
|
||||||
const { page = 1, pageSize = 20, status, userId, appointmentDate } = ctx.request.query;
|
const { page = 1, pageSize = 20, status, userId, appointmentDate, healthProfileId } = ctx.request.query;
|
||||||
const effectiveUserId = forceSelf ? ctx.state.user?._id : userId;
|
const effectiveUserId = forceSelf ? ctx.state.user?._id : userId;
|
||||||
|
|
||||||
// status解析成数组
|
// status解析成数组
|
||||||
@@ -51,6 +51,7 @@ class HandlerEscortRecord {
|
|||||||
status: statusArray,
|
status: statusArray,
|
||||||
userId: effectiveUserId,
|
userId: effectiveUserId,
|
||||||
appointmentDate,
|
appointmentDate,
|
||||||
|
healthProfileId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return ResponseUtil.success(ctx, { records }, "查询成功");
|
return ResponseUtil.success(ctx, { records }, "查询成功");
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ const EscortRecordSchema = mongoose.Schema(
|
|||||||
* @returns {Promise<Array>} 陪诊记录列表(按预约日期倒序)
|
* @returns {Promise<Array>} 陪诊记录列表(按预约日期倒序)
|
||||||
*/
|
*/
|
||||||
EscortRecordSchema.statics.findRecords = async function (options = {}, cb) {
|
EscortRecordSchema.statics.findRecords = async function (options = {}, cb) {
|
||||||
const { page = 1, pageSize = 20, status, userId, appointmentDate } = options;
|
const { page = 1, pageSize = 20, status, userId, appointmentDate, healthProfileId } = options;
|
||||||
const filter = {};
|
const filter = {};
|
||||||
|
|
||||||
if (status && Array.isArray(status) && status.length > 0) {
|
if (status && Array.isArray(status) && status.length > 0) {
|
||||||
@@ -177,6 +177,10 @@ EscortRecordSchema.statics.findRecords = async function (options = {}, cb) {
|
|||||||
filter.userId = userId;
|
filter.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (healthProfileId) {
|
||||||
|
filter.healthProfileId = healthProfileId;
|
||||||
|
}
|
||||||
|
|
||||||
if (appointmentDate) {
|
if (appointmentDate) {
|
||||||
const start = new Date(appointmentDate);
|
const start = new Date(appointmentDate);
|
||||||
const end = new Date(start);
|
const end = new Date(start);
|
||||||
|
|||||||
Reference in New Issue
Block a user