新增患者手机号搜索
This commit is contained in:
parent
a4255c5404
commit
3a82611c6f
@ -201,6 +201,25 @@ func (r *OrderInquiryDao) GetOrderInquiryPageSearch(req requests.GetOrderInquiry
|
||||
query = query.Where("patient_name LIKE ?", "%"+req.PatientName+"%")
|
||||
}
|
||||
|
||||
// 手机号-医生/患者
|
||||
if req.Mobile != "" {
|
||||
// 患者
|
||||
patientSubQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
// 医生
|
||||
doctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
doctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
Select("doctor_id").
|
||||
Where(gorm.Expr("user_id IN (?)", doctorUserSubQuery))
|
||||
|
||||
query = query.Where("user_id IN (?)", patientSubQuery).Or("doctor_id IN (?)", doctorSubQuery)
|
||||
}
|
||||
|
||||
// 排序
|
||||
query = query.Order("created_at desc")
|
||||
|
||||
|
||||
@ -220,6 +220,29 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
||||
query = query.Where("consignee_tel LIKE ?", "%"+req.ConsigneeTel+"%")
|
||||
}
|
||||
|
||||
// 手机号-医生/患者
|
||||
if req.Mobile != "" {
|
||||
// 患者
|
||||
patientUserSubQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
patientSubQuery := global.Db.Model(&model.UserPatient{}).
|
||||
Select("patient_id").
|
||||
Where(gorm.Expr("user_id IN (?)", patientUserSubQuery))
|
||||
|
||||
// 医生
|
||||
doctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile = ?", req.Mobile)
|
||||
|
||||
doctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||
Select("doctor_id").
|
||||
Where(gorm.Expr("user_id IN (?)", doctorUserSubQuery))
|
||||
|
||||
query = query.Where("user_id IN (?)", patientSubQuery).Or("doctor_id IN (?)", doctorSubQuery)
|
||||
}
|
||||
|
||||
// 排序
|
||||
query = query.Order("created_at desc")
|
||||
|
||||
|
||||
@ -24,4 +24,5 @@ type GetOrderInquiryPage struct {
|
||||
IsWithdrawal *int `json:"is_withdrawal" form:"is_withdrawal" label:"是否提现"` // 0:否 1:是 2:提现中
|
||||
CancelTime string `json:"cancel_time" form:"cancel_time" label:"订单取消时间"` // 时间区间,数组形式,下标0为开始时间,下标1为结束时间
|
||||
PatientName string `json:"patient_name" form:"patient_name" label:"患者姓名-就诊人"`
|
||||
Mobile string `json:"mobile" form:"mobile" label:"手机号-医生/患者"`
|
||||
}
|
||||
|
||||
@ -27,4 +27,5 @@ type GetOrderProductPage struct {
|
||||
ConsigneeName string `json:"consignee_name" form:"consignee_name" label:"收货人姓名"`
|
||||
ConsigneeTel string `json:"consignee_tel" form:"cancel_reason" label:"收货人电话"`
|
||||
PatientName string `json:"patient_name" form:"patient_name" label:"患者姓名-就诊人"`
|
||||
Mobile string `json:"mobile" form:"mobile" label:"手机号-医生/患者"`
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user