处方详情新增药品订单id字段

This commit is contained in:
wucongxing 2023-10-09 16:22:50 +08:00
parent 35bb3f9f6d
commit a4e563ee92
3 changed files with 29 additions and 0 deletions

View File

@ -67,6 +67,15 @@ func (r *OrderProductDao) GetOrderProductList(maps interface{}) (m []*model.Orde
return m, nil
}
// GetOrderProduct 获取药品订单
func (r *OrderProductDao) GetOrderProduct(maps interface{}) (m *model.OrderProduct, err error) {
err = global.Db.Where(maps).First(&m).Error
if err != nil {
return nil, err
}
return m, nil
}
// AddOrderProduct 新增药品订单
func (r *OrderProductDao) AddOrderProduct(tx *gorm.DB, model *model.OrderProduct) (*model.OrderProduct, error) {
if err := tx.Create(model).Error; err != nil {

View File

@ -14,6 +14,7 @@ type OrderPrescriptionDto struct {
PatientId string `json:"patient_id"` // 患者id
FamilyId string `json:"family_id"` // 家庭成员id就诊用户
PharmacistId string `json:"pharmacist_id"` // 药师id
OrderProductId string `json:"order_product_id"` // 药品订单id
PrescriptionStatus int `json:"prescription_status"` // 处方状态1:待审核 2:待使用 3:已失效 4:已使用)
PharmacistAuditStatus int `json:"pharmacist_audit_status"` // 药师审核状态0:审核中 1:审核成功 2:审核驳回)
PharmacistVerifyTime model.LocalTime `json:"pharmacist_verify_time"` // 药师审核时间
@ -197,3 +198,11 @@ func (r *OrderPrescriptionDto) LoadOrderPrescriptionProduct(m []*model.OrderPres
}
return r
}
// LoadOrderProductId 加载药品订单id
func (r *OrderPrescriptionDto) LoadOrderProductId(m *model.OrderProduct) *OrderPrescriptionDto {
if m != nil {
r.OrderProductId = fmt.Sprintf("%d", m.OrderProductId)
}
return r
}

View File

@ -53,6 +53,14 @@ func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int6
return nil, errors.New("药师数据错误")
}
// 获取药品订单数据
orderProductDao := dao.OrderProductDao{}
maps := make(map[string]interface{})
maps["order_inquiry_id"] = orderPrescription.OrderInquiryId
maps["order_prescription_id"] = OrderPrescriptionId
orderProduct, err := orderProductDao.GetOrderProduct(maps)
// 处理返回值
g = dto.GetOrderPrescriptionDto(orderPrescription)
@ -71,5 +79,8 @@ func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int6
// 加载处方商品数据
g.LoadOrderPrescriptionProduct(orderPrescriptionProducts)
// 加载药品订单id
g.LoadOrderProductId(orderProduct)
return g, nil
}