处方详情新增药品订单id字段
This commit is contained in:
parent
35bb3f9f6d
commit
a4e563ee92
@ -67,6 +67,15 @@ func (r *OrderProductDao) GetOrderProductList(maps interface{}) (m []*model.Orde
|
|||||||
return m, nil
|
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 新增药品订单
|
// AddOrderProduct 新增药品订单
|
||||||
func (r *OrderProductDao) AddOrderProduct(tx *gorm.DB, model *model.OrderProduct) (*model.OrderProduct, error) {
|
func (r *OrderProductDao) AddOrderProduct(tx *gorm.DB, model *model.OrderProduct) (*model.OrderProduct, error) {
|
||||||
if err := tx.Create(model).Error; err != nil {
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
|||||||
@ -14,6 +14,7 @@ type OrderPrescriptionDto struct {
|
|||||||
PatientId string `json:"patient_id"` // 患者id
|
PatientId string `json:"patient_id"` // 患者id
|
||||||
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
||||||
PharmacistId string `json:"pharmacist_id"` // 药师id
|
PharmacistId string `json:"pharmacist_id"` // 药师id
|
||||||
|
OrderProductId string `json:"order_product_id"` // 药品订单id
|
||||||
PrescriptionStatus int `json:"prescription_status"` // 处方状态(1:待审核 2:待使用 3:已失效 4:已使用)
|
PrescriptionStatus int `json:"prescription_status"` // 处方状态(1:待审核 2:待使用 3:已失效 4:已使用)
|
||||||
PharmacistAuditStatus int `json:"pharmacist_audit_status"` // 药师审核状态(0:审核中 1:审核成功 2:审核驳回)
|
PharmacistAuditStatus int `json:"pharmacist_audit_status"` // 药师审核状态(0:审核中 1:审核成功 2:审核驳回)
|
||||||
PharmacistVerifyTime model.LocalTime `json:"pharmacist_verify_time"` // 药师审核时间
|
PharmacistVerifyTime model.LocalTime `json:"pharmacist_verify_time"` // 药师审核时间
|
||||||
@ -197,3 +198,11 @@ func (r *OrderPrescriptionDto) LoadOrderPrescriptionProduct(m []*model.OrderPres
|
|||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadOrderProductId 加载药品订单id
|
||||||
|
func (r *OrderPrescriptionDto) LoadOrderProductId(m *model.OrderProduct) *OrderPrescriptionDto {
|
||||||
|
if m != nil {
|
||||||
|
r.OrderProductId = fmt.Sprintf("%d", m.OrderProductId)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|||||||
@ -53,6 +53,14 @@ func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int6
|
|||||||
return nil, errors.New("药师数据错误")
|
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)
|
g = dto.GetOrderPrescriptionDto(orderPrescription)
|
||||||
|
|
||||||
@ -71,5 +79,8 @@ func (r *OrderPrescriptionService) GetOrderPrescription(OrderPrescriptionId int6
|
|||||||
// 加载处方商品数据
|
// 加载处方商品数据
|
||||||
g.LoadOrderPrescriptionProduct(orderPrescriptionProducts)
|
g.LoadOrderPrescriptionProduct(orderPrescriptionProducts)
|
||||||
|
|
||||||
|
// 加载药品订单id
|
||||||
|
g.LoadOrderProductId(orderProduct)
|
||||||
|
|
||||||
return g, nil
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user