新增药品订单详情

This commit is contained in:
wucongxing 2023-09-11 15:11:23 +08:00
parent 0a51e0fcbc
commit 21812f4e96
4 changed files with 72 additions and 6 deletions

View File

@ -68,12 +68,11 @@ type GetOrderProduct struct {
PayTime model.LocalTime `json:"pay_time"` // 支付时间
Remarks string `json:"remarks"` // 订单备注
RefundStatus int `json:"refund_status"` // 商品订单退款状态0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
CancelTime model.LocalTime `json:"cancel_time"` // 订单取消时间
CancelRemarks string `json:"cancel_remarks"` // 订单取消备注(自动添加)
ReportPreStatus int `json:"report_pre_status"` // 上报处方平台状态0:未上报 1:已上报 2:上报失败))
ConsigneeNameMask string `json:"consignee_name_mask"` // 收货人姓名(掩码)
ConsigneeTelMask string `json:"consignee_tel_mask"` // 收货人电话(掩码)
PatientNameMask string `json:"patient_name_mask"` // 患者姓名-就诊人(掩码)
PatientSex int `json:"patient_sex"` // 患者性别-就诊人0:未知 1:男 2:女)
PatientAge int `json:"patient_age"` // 患者年龄-就诊人
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
OrderProductRefund *orderProductRefundResponse.OrderProductRefund `json:"order_product_refund"` // 退款数据

View File

@ -4,6 +4,7 @@ import (
"errors"
"hospital-admin-api/api/dao"
"hospital-admin-api/api/responses/orderInquiryCaseResponse"
"hospital-admin-api/utils"
"strconv"
)
@ -26,7 +27,7 @@ func (r *OrderInquiryCaseService) GetOrderInquiryCaseByOrderInquiryId(orderInqui
FamilyId: strconv.FormatInt(orderInquiryCase.FamilyId, 10),
Relation: orderInquiryCase.Relation,
Status: orderInquiryCase.Status,
Name: orderInquiryCase.Name,
Name: utils.MaskNameStr(orderInquiryCase.Name, 1),
Sex: orderInquiryCase.Sex,
Age: orderInquiryCase.Age,
Height: orderInquiryCase.Height,

View File

@ -84,9 +84,9 @@ func (r *OrderProductService) GetOrderProduct(orderProductId int64) (getOrderPro
PayTime: orderProduct.PayTime,
Remarks: orderProduct.Remarks,
RefundStatus: orderProduct.RefundStatus,
CancelTime: orderProduct.CancelTime,
CancelRemarks: orderProduct.CancelRemarks,
ReportPreStatus: orderProduct.ReportPreStatus,
ConsigneeNameMask: orderProduct.ConsigneeNameMask,
ConsigneeTelMask: orderProduct.ConsigneeTelMask,
CreatedAt: orderProduct.CreatedAt,
UpdatedAt: orderProduct.UpdatedAt,
OrderProductRefund: orderProductRefund,

66
utils/mask.go Normal file
View File

@ -0,0 +1,66 @@
package utils
import (
"regexp"
"unicode/utf8"
)
// MaskNameStr 用户名掩码
func MaskNameStr(str string, maskType int) string {
if str == "" {
return str
}
// 使用正则表达式判断是否包含中文字符
chinesePattern := "[\u4e00-\u9fa5]+"
isChinese, _ := regexp.MatchString(chinesePattern, str)
// 使用正则表达式判断是否包含英文字母
englishPattern := "[A-Za-z]+"
isEnglish, _ := regexp.MatchString(englishPattern, str)
// 判断是否包含中文字符
if isChinese {
// 按照中文字符计算长度
strLen := utf8.RuneCountInString(str)
if strLen >= 3 {
if maskType == 1 {
// 三个字符或三个字符以上掐头取尾,中间用*代替
firstChar, _ := utf8.DecodeRuneInString(str)
lastChar, _ := utf8.DecodeLastRuneInString(str)
str = string(firstChar) + "*" + string(lastChar)
} else {
// 首字母保留,后两位用*代替
firstChar, _ := utf8.DecodeRuneInString(str)
str = string(firstChar) + "**"
}
} else if strLen == 2 {
// 两个字符
firstChar, _ := utf8.DecodeRuneInString(str)
str = string(firstChar) + "*"
}
} else if isEnglish {
// 按照英文字串计算长度
strLen := utf8.RuneCountInString(str)
if strLen >= 3 {
if maskType == 1 {
// 三个字符或三个字符以上掐头取尾,中间用*代替
firstChar, _ := utf8.DecodeRuneInString(str)
lastChar, _ := utf8.DecodeLastRuneInString(str)
str = string(firstChar) + "*" + string(lastChar)
} else {
// 首字母保留,后两位用*代替
firstChar, _ := utf8.DecodeRuneInString(str)
str = string(firstChar) + "**"
}
} else if strLen == 2 {
// 两个字符
firstChar, _ := utf8.DecodeRuneInString(str)
str = string(firstChar) + "*"
}
}
return str
}