药品订单列表新增厨房变好

This commit is contained in:
wucongxing 2023-09-14 15:22:15 +08:00
parent e1887b52e7
commit 3113f2471b
3 changed files with 54 additions and 43 deletions

View File

@ -96,6 +96,11 @@ 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("OrderPrescription", func(db *gorm.DB) *gorm.DB {
return db.Select("order_prescription_id", "prescription_code")
})
// 问诊订单 // 问诊订单
query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB { query = query.Preload("OrderInquiry", func(db *gorm.DB) *gorm.DB {
return db.Select("order_inquiry_id", "patient_name_mask", "patient_sex", "patient_age") return db.Select("order_inquiry_id", "patient_name_mask", "patient_sex", "patient_age")

View File

@ -8,49 +8,50 @@ import (
// OrderProduct 订单-商品订单表 // OrderProduct 订单-商品订单表
type OrderProduct struct { type OrderProduct struct {
OrderProductId int64 `gorm:"column:order_product_id;type:bigint(20);primary_key;comment:主键id" json:"order_product_id"` OrderProductId int64 `gorm:"column:order_product_id;type:bigint(20);primary_key;comment:主键id" json:"order_product_id"`
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"` OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id;NOT NULL" json:"order_prescription_id"` OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id;NOT NULL" json:"order_prescription_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"` DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"` PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id就诊用户" json:"family_id"` FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id就诊用户" json:"family_id"`
OrderProductNo string `gorm:"column:order_product_no;type:varchar(100);comment:订单编号" json:"order_product_no"` OrderProductNo string `gorm:"column:order_product_no;type:varchar(100);comment:订单编号" json:"order_product_no"`
EscrowTradeNo string `gorm:"column:escrow_trade_no;type:varchar(100);comment:第三方支付流水号" json:"escrow_trade_no"` EscrowTradeNo string `gorm:"column:escrow_trade_no;type:varchar(100);comment:第三方支付流水号" json:"escrow_trade_no"`
OrderProductStatus int `gorm:"column:order_product_status;type:tinyint(1);comment:订单状态1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)" json:"order_product_status"` OrderProductStatus int `gorm:"column:order_product_status;type:tinyint(1);comment:订单状态1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)" json:"order_product_status"`
PayChannel int `gorm:"column:pay_channel;type:tinyint(1);comment:支付渠道1:小程序支付 2:微信扫码支付);NOT NULL" json:"pay_channel"` PayChannel int `gorm:"column:pay_channel;type:tinyint(1);comment:支付渠道1:小程序支付 2:微信扫码支付);NOT NULL" json:"pay_channel"`
PayStatus int `gorm:"column:pay_status;type:tinyint(4);default:1;comment:支付状态1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)" json:"pay_status"` PayStatus int `gorm:"column:pay_status;type:tinyint(4);default:1;comment:支付状态1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)" json:"pay_status"`
IsDelete int `gorm:"column:is_delete;type:tinyint(1);default:0;comment:删除状态0:否 1:是)" json:"is_delete"` IsDelete int `gorm:"column:is_delete;type:tinyint(1);default:0;comment:删除状态0:否 1:是)" json:"is_delete"`
CancelReason int `gorm:"column:cancel_reason;type:tinyint(1);comment:订单取消原因1:主动取消 2:复核失败/库存不足 3:支付超时 4:客服取消)" json:"cancel_reason"` CancelReason int `gorm:"column:cancel_reason;type:tinyint(1);comment:订单取消原因1:主动取消 2:复核失败/库存不足 3:支付超时 4:客服取消)" json:"cancel_reason"`
AmountTotal float64 `gorm:"column:amount_total;type:decimal(10,2);default:0.00;comment:订单金额" json:"amount_total"` AmountTotal float64 `gorm:"column:amount_total;type:decimal(10,2);default:0.00;comment:订单金额" json:"amount_total"`
PaymentAmountTotal float64 `gorm:"column:payment_amount_total;type:decimal(10,2);default:0.00;comment:实际付款金额" json:"payment_amount_total"` PaymentAmountTotal float64 `gorm:"column:payment_amount_total;type:decimal(10,2);default:0.00;comment:实际付款金额" json:"payment_amount_total"`
LogisticsFee float64 `gorm:"column:logistics_fee;type:decimal(10,2);default:0.00;comment:运费金额" json:"logistics_fee"` LogisticsFee float64 `gorm:"column:logistics_fee;type:decimal(10,2);default:0.00;comment:运费金额" json:"logistics_fee"`
LogisticsNo string `gorm:"column:logistics_no;type:varchar(100);comment:物流编号" json:"logistics_no"` LogisticsNo string `gorm:"column:logistics_no;type:varchar(100);comment:物流编号" json:"logistics_no"`
LogisticsCompanyCode string `gorm:"column:logistics_company_code;type:varchar(255);comment:快递公司编码" json:"logistics_company_code"` LogisticsCompanyCode string `gorm:"column:logistics_company_code;type:varchar(255);comment:快递公司编码" json:"logistics_company_code"`
SubLogisticsStatus int `gorm:"column:sub_logistics_status;type:tinyint(1);default:0;comment:快递推送订阅状态0:未订阅/无需订阅 1:已订阅 2:订阅失败)" json:"sub_logistics_status"` SubLogisticsStatus int `gorm:"column:sub_logistics_status;type:tinyint(1);default:0;comment:快递推送订阅状态0:未订阅/无需订阅 1:已订阅 2:订阅失败)" json:"sub_logistics_status"`
DeliveryTime LocalTime `gorm:"column:delivery_time;type:datetime;comment:发货时间" json:"delivery_time"` DeliveryTime LocalTime `gorm:"column:delivery_time;type:datetime;comment:发货时间" json:"delivery_time"`
PayTime LocalTime `gorm:"column:pay_time;type:datetime;comment:支付时间" json:"pay_time"` PayTime LocalTime `gorm:"column:pay_time;type:datetime;comment:支付时间" json:"pay_time"`
Remarks string `gorm:"column:remarks;type:varchar(255);comment:订单备注" json:"remarks"` Remarks string `gorm:"column:remarks;type:varchar(255);comment:订单备注" json:"remarks"`
RefundStatus int `gorm:"column:refund_status;type:tinyint(1);default:0;comment:商品订单退款状态0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)" json:"refund_status"` RefundStatus int `gorm:"column:refund_status;type:tinyint(1);default:0;comment:商品订单退款状态0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)" json:"refund_status"`
CancelTime LocalTime `gorm:"column:cancel_time;type:datetime;comment:订单取消时间" json:"cancel_time"` CancelTime LocalTime `gorm:"column:cancel_time;type:datetime;comment:订单取消时间" json:"cancel_time"`
CancelRemarks string `gorm:"column:cancel_remarks;type:varchar(255);comment:订单取消备注(自动添加)" json:"cancel_remarks"` CancelRemarks string `gorm:"column:cancel_remarks;type:varchar(255);comment:订单取消备注(自动添加)" json:"cancel_remarks"`
ReportPreStatus int `gorm:"column:report_pre_status;type:tinyint(1);default:0;comment:上报处方平台状态0:未上报 1:已上报 2:上报失败))" json:"report_pre_status"` ReportPreStatus int `gorm:"column:report_pre_status;type:tinyint(1);default:0;comment:上报处方平台状态0:未上报 1:已上报 2:上报失败))" json:"report_pre_status"`
ReportPreTime LocalTime `gorm:"column:report_pre_time;type:datetime;comment:上报处方平台时间" json:"report_pre_time"` ReportPreTime LocalTime `gorm:"column:report_pre_time;type:datetime;comment:上报处方平台时间" json:"report_pre_time"`
ReportPreFailReason string `gorm:"column:report_pre_fail_reason;type:text;comment:上报失败原因" json:"report_pre_fail_reason"` ReportPreFailReason string `gorm:"column:report_pre_fail_reason;type:text;comment:上报失败原因" json:"report_pre_fail_reason"`
ProvinceId int `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"` ProvinceId int `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"`
Province string `gorm:"column:province;type:varchar(40);comment:省份" json:"province"` Province string `gorm:"column:province;type:varchar(40);comment:省份" json:"province"`
CityId int `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"` CityId int `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"`
City string `gorm:"column:city;type:varchar(50);comment:城市" json:"city"` City string `gorm:"column:city;type:varchar(50);comment:城市" json:"city"`
CountyId int `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"` CountyId int `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"`
County string `gorm:"column:county;type:varchar(255);comment:区县" json:"county"` County string `gorm:"column:county;type:varchar(255);comment:区县" json:"county"`
Address string `gorm:"column:address;type:varchar(255);comment:详细地址" json:"address"` Address string `gorm:"column:address;type:varchar(255);comment:详细地址" json:"address"`
AddressMask string `gorm:"column:address_mask;type:varchar(255);comment:详细地址(掩码)" json:"address_mask"` AddressMask string `gorm:"column:address_mask;type:varchar(255);comment:详细地址(掩码)" json:"address_mask"`
ConsigneeName string `gorm:"column:consignee_name;type:varchar(150);comment:收货人姓名" json:"consignee_name"` ConsigneeName string `gorm:"column:consignee_name;type:varchar(150);comment:收货人姓名" json:"consignee_name"`
ConsigneeNameMask string `gorm:"column:consignee_name_mask;type:varchar(150);comment:收货人姓名(掩码)" json:"consignee_name_mask"` ConsigneeNameMask string `gorm:"column:consignee_name_mask;type:varchar(150);comment:收货人姓名(掩码)" json:"consignee_name_mask"`
ConsigneeTel string `gorm:"column:consignee_tel;type:varchar(50);comment:收货人电话" json:"consignee_tel"` ConsigneeTel string `gorm:"column:consignee_tel;type:varchar(50);comment:收货人电话" json:"consignee_tel"`
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"` // 患者 UserPatient *UserPatient `gorm:"foreignKey:PatientId;references:patient_id" json:"user_patient"` // 患者
OrderPrescription *OrderPrescription `gorm:"foreignKey:OrderPrescriptionId;references:order_prescription_id" json:"order_prescription"` // 处方
Model Model
} }

View File

@ -35,6 +35,7 @@ type getOrderProductPage struct {
Remarks string `json:"remarks"` // 订单备注 Remarks string `json:"remarks"` // 订单备注
RefundStatus int `json:"refund_status"` // 商品订单退款状态0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常) RefundStatus int `json:"refund_status"` // 商品订单退款状态0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
ReportPreStatus int `json:"report_pre_status"` // 上报处方平台状态0:未上报 1:已上报 2:上报失败)) ReportPreStatus int `json:"report_pre_status"` // 上报处方平台状态0:未上报 1:已上报 2:上报失败))
PrescriptionCode string `json:"prescription_code"` // 处方编号
ConsigneeNameMask string `json:"consignee_name_mask"` // 收货人姓名(掩码) ConsigneeNameMask string `json:"consignee_name_mask"` // 收货人姓名(掩码)
ConsigneeTelMask string `json:"consignee_tel_mask"` // 收货人电话(掩码) ConsigneeTelMask string `json:"consignee_tel_mask"` // 收货人电话(掩码)
DoctorName string `json:"doctor_name"` // 医生姓名 DoctorName string `json:"doctor_name"` // 医生姓名
@ -154,6 +155,10 @@ func GetOrderProductPageResponse(orderProduct []*model.OrderProduct) []getOrderP
res.PatientAge = v.OrderInquiry.PatientAge res.PatientAge = v.OrderInquiry.PatientAge
} }
if v.OrderPrescription != nil {
res.PrescriptionCode = v.OrderPrescription.PrescriptionCode
}
// 将转换后的结构体添加到新切片中 // 将转换后的结构体添加到新切片中
getOrderProductPages[i] = res getOrderProductPages[i] = res
} }