新增患者手机号
This commit is contained in:
parent
3fcafc909a
commit
a4255c5404
@ -87,11 +87,6 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
|||||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||||
})
|
})
|
||||||
|
|
||||||
// 问诊订单
|
|
||||||
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
|
||||||
return db.Select("order_inquiry_id", "patient_name_mask", "patient_sex", "patient_age")
|
|
||||||
})
|
|
||||||
|
|
||||||
// 医生姓名
|
// 医生姓名
|
||||||
if req.DoctorName != "" {
|
if req.DoctorName != "" {
|
||||||
subQuery := global.Db.Model(&model.UserDoctor{}).
|
subQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
@ -101,6 +96,16 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
|||||||
query = query.Where(gorm.Expr("doctor_id IN (?)", subQuery))
|
query = query.Where(gorm.Expr("doctor_id IN (?)", subQuery))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 问诊订单
|
||||||
|
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("order_inquiry_id", "patient_name_mask", "patient_sex", "patient_age")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 患者名称
|
||||||
|
query = query.Preload("UserPatient.User", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("user_id", "user_name", "mobile")
|
||||||
|
})
|
||||||
|
|
||||||
// 患者姓名-就诊人
|
// 患者姓名-就诊人
|
||||||
if req.PatientName != "" {
|
if req.PatientName != "" {
|
||||||
subQuery := global.Db.Model(&model.OrderInquiry{}).
|
subQuery := global.Db.Model(&model.OrderInquiry{}).
|
||||||
|
|||||||
@ -50,6 +50,7 @@ type OrderProduct struct {
|
|||||||
ConsigneeTelMask string `gorm:"column:consignee_tel_mask;type:varchar(50);comment:收货人电话(掩码)" json:"consignee_tel_mask"`
|
ConsigneeTelMask string `gorm:"column:consignee_tel_mask;type:varchar(50);comment:收货人电话(掩码)" json:"consignee_tel_mask"`
|
||||||
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||||
OrderInquiry *OrderInquiry `gorm:"foreignKey:OrderInquiryId;references:order_inquiry_id" json:"order_inquiry"` // 问诊
|
OrderInquiry *OrderInquiry `gorm:"foreignKey:OrderInquiryId;references:order_inquiry_id" json:"order_inquiry"` // 问诊
|
||||||
|
UserPatient *UserPatient `gorm:"foreignKey:PatientId;references:patient_id" json:"user_patient"` // 患者
|
||||||
Model
|
Model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
40
api/model/userPatient.go
Normal file
40
api/model/userPatient.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserPatient 用户-患者表
|
||||||
|
type UserPatient struct {
|
||||||
|
PatientId int64 `gorm:"column:patient_id;type:bigint(19);primary_key;comment:主键id" json:"patient_id"`
|
||||||
|
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id;NOT NULL" json:"user_id"`
|
||||||
|
UserName string `gorm:"column:user_name;type:varchar(100);comment:用户名称" json:"user_name"`
|
||||||
|
OpenId string `gorm:"column:open_id;type:varchar(100);comment:微信open_id" json:"open_id"`
|
||||||
|
UnionId string `gorm:"column:union_id;type:varchar(100);comment:微信开放平台唯一标识" json:"union_id"`
|
||||||
|
WxSessionKey string `gorm:"column:wx_session_key;type:varchar(255);comment:微信会话密钥" json:"wx_session_key"`
|
||||||
|
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态(0:禁用 1:正常 2:删除)" json:"status"`
|
||||||
|
IdcardStatus int `gorm:"column:idcard_status;type:tinyint(1);default:0;comment:实名认证状态(0:未认证 1:认证通过 2:认证失败)" json:"idcard_status"`
|
||||||
|
Avatar string `gorm:"column:avatar;type:varchar(255);comment:头像" json:"avatar"`
|
||||||
|
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 用户
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserPatient) TableName() string {
|
||||||
|
return "gdxz_user_patient"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserPatient) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.PatientId == 0 {
|
||||||
|
m.PatientId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@ -8,7 +8,6 @@ import (
|
|||||||
"hospital-admin-api/api/responses/orderInquiryCouponResponse"
|
"hospital-admin-api/api/responses/orderInquiryCouponResponse"
|
||||||
"hospital-admin-api/api/responses/orderInquiryRefundResponse"
|
"hospital-admin-api/api/responses/orderInquiryRefundResponse"
|
||||||
"hospital-admin-api/api/responses/userDoctorResponse"
|
"hospital-admin-api/api/responses/userDoctorResponse"
|
||||||
"hospital-admin-api/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// getOrderInquiryPage 获取医生列表-分页
|
// getOrderInquiryPage 获取医生列表-分页
|
||||||
@ -135,7 +134,7 @@ func GetOrderInquiryPageResponse(orderInquiry []*model.OrderInquiry) []getOrderI
|
|||||||
PatientNameMask: v.PatientNameMask,
|
PatientNameMask: v.PatientNameMask,
|
||||||
PatientSex: v.PatientSex,
|
PatientSex: v.PatientSex,
|
||||||
PatientAge: v.PatientAge,
|
PatientAge: v.PatientAge,
|
||||||
PatientMobile: utils.MaskPhoneStr(v.User.Mobile),
|
PatientMobile: v.User.Mobile,
|
||||||
CreatedAt: v.CreatedAt,
|
CreatedAt: v.CreatedAt,
|
||||||
UpdatedAt: v.UpdatedAt,
|
UpdatedAt: v.UpdatedAt,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@ type getOrderProductPage struct {
|
|||||||
PatientNameMask string `json:"patient_name_mask"` // 患者姓名-就诊人(掩码)
|
PatientNameMask string `json:"patient_name_mask"` // 患者姓名-就诊人(掩码)
|
||||||
PatientSex int `json:"patient_sex"` // 患者性别-就诊人(0:未知 1:男 2:女)
|
PatientSex int `json:"patient_sex"` // 患者性别-就诊人(0:未知 1:男 2:女)
|
||||||
PatientAge int `json:"patient_age"` // 患者年龄-就诊人
|
PatientAge int `json:"patient_age"` // 患者年龄-就诊人
|
||||||
|
PatientMobile string `json:"patient_mobile"` // 患者电话
|
||||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||||
}
|
}
|
||||||
@ -136,6 +137,7 @@ func GetOrderProductPageResponse(orderProduct []*model.OrderProduct) []getOrderP
|
|||||||
ReportPreStatus: v.ReportPreStatus,
|
ReportPreStatus: v.ReportPreStatus,
|
||||||
ConsigneeNameMask: v.ConsigneeNameMask,
|
ConsigneeNameMask: v.ConsigneeNameMask,
|
||||||
ConsigneeTelMask: v.ConsigneeTelMask,
|
ConsigneeTelMask: v.ConsigneeTelMask,
|
||||||
|
PatientMobile: v.UserPatient.User.Mobile,
|
||||||
CreatedAt: v.CreatedAt,
|
CreatedAt: v.CreatedAt,
|
||||||
UpdatedAt: v.UpdatedAt,
|
UpdatedAt: v.UpdatedAt,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user