新增患者手机号
This commit is contained in:
parent
09b062aa5d
commit
3fcafc909a
@ -8,6 +8,7 @@ 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 获取医生列表-分页
|
||||||
@ -134,7 +135,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: v.User.Mobile,
|
PatientMobile: utils.MaskPhoneStr(v.User.Mobile),
|
||||||
CreatedAt: v.CreatedAt,
|
CreatedAt: v.CreatedAt,
|
||||||
UpdatedAt: v.UpdatedAt,
|
UpdatedAt: v.UpdatedAt,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,3 +64,26 @@ func MaskNameStr(str string, maskType int) string {
|
|||||||
|
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MaskPhoneStr 手机号、固话加密
|
||||||
|
// 固话:0510-89754815 0510-8****815
|
||||||
|
// 手机号:18221234158 18*******58
|
||||||
|
func MaskPhoneStr(phone string) string {
|
||||||
|
if phone == "" {
|
||||||
|
return phone
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用正则表达式匹配固定电话
|
||||||
|
phonePattern := `(0[0-9]{2,3}[\-]?[2-9][0-9]{6,7}[\-]?[0-9]?)`
|
||||||
|
isFixedLine := regexp.MustCompile(phonePattern).MatchString(phone)
|
||||||
|
|
||||||
|
if isFixedLine {
|
||||||
|
// 匹配到固定电话
|
||||||
|
// 替换匹配的部分为固定格式
|
||||||
|
return regexp.MustCompile(`(0[0-9]{2,3}[\-]?[2-9])[0-9]{3,4}([0-9]{3}[\-]?[0-9]?)`).ReplaceAllString(phone, "$1****$2")
|
||||||
|
} else {
|
||||||
|
// 匹配到手机号
|
||||||
|
// 替换匹配的部分为固定格式
|
||||||
|
return regexp.MustCompile(`(1[0-9]{1})[0-9]{7}([0-9]{2})`).ReplaceAllString(phone, "$1*******$2")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user