新增操作记录日志
This commit is contained in:
@@ -22,7 +22,7 @@ type OrderInquiryService struct {
|
||||
}
|
||||
|
||||
// CancelOrderInquiry 取消问诊订单
|
||||
func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry, orderInquiryId int64) (bool, error) {
|
||||
func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry, orderInquiryId, adminUserId int64) (bool, error) {
|
||||
// 获取订单数据
|
||||
orderInquiryDao := dao.OrderInquiryDao{}
|
||||
orderInquiry, err := orderInquiryDao.GetOrderInquiryById(orderInquiryId)
|
||||
@@ -212,6 +212,22 @@ func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 记录日志
|
||||
orderOperationLog := &model.OrderOperationLog{
|
||||
OrderId: orderInquiry.OrderInquiryId,
|
||||
OrderNo: orderInquiry.InquiryNo,
|
||||
OrderType: 1,
|
||||
OperatorId: adminUserId,
|
||||
OperationContent: "取消订单并退款",
|
||||
}
|
||||
|
||||
orderOperationLogDao := dao.OrderOperationLogDao{}
|
||||
orderOperationLog, err = orderOperationLogDao.AddOrderOperationLog(tx, orderOperationLog)
|
||||
if err != nil || orderOperationLog == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
|
||||
return true, nil
|
||||
|
||||
+20
-2
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/extend/prescription"
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
@@ -15,7 +16,7 @@ type OrderService struct {
|
||||
}
|
||||
|
||||
// ReportPreProduct 商品订单上报处方平台
|
||||
func (r *OrderService) ReportPreProduct(orderProductId int64) (bool, error) {
|
||||
func (r *OrderService) ReportPreProduct(orderProductId, adminUserId int64) (bool, error) {
|
||||
// 获取药品订单详情
|
||||
orderProductDao := dao.OrderProductDao{}
|
||||
orderProduct, err := orderProductDao.GetOrderProductPreloadById(orderProductId)
|
||||
@@ -278,6 +279,7 @@ func (r *OrderService) ReportPreProduct(orderProductId int64) (bool, error) {
|
||||
return false, errors.New("上报处方失败1")
|
||||
}
|
||||
|
||||
// 修改商品表
|
||||
orderProductData := make(map[string]interface{})
|
||||
orderProductData["report_pre_status"] = 1
|
||||
orderProductData["report_pre_time"] = time.Now().Format("2006-01-02 15:04:05")
|
||||
@@ -285,7 +287,23 @@ func (r *OrderService) ReportPreProduct(orderProductId int64) (bool, error) {
|
||||
err = orderProductDao.EditOrderProductById(tx, orderProductId, orderProductData)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("上报处方失败2")
|
||||
return false, errors.New("上报处方失败")
|
||||
}
|
||||
|
||||
// 记录日志
|
||||
orderOperationLog := &model.OrderOperationLog{
|
||||
OrderId: orderProduct.OrderProductId,
|
||||
OrderNo: orderProduct.OrderProductNo,
|
||||
OrderType: 2,
|
||||
OperatorId: adminUserId,
|
||||
OperationContent: "上报处方平台",
|
||||
}
|
||||
|
||||
orderOperationLogDao := dao.OrderOperationLogDao{}
|
||||
orderOperationLog, err = orderOperationLogDao.AddOrderOperationLog(tx, orderOperationLog)
|
||||
if err != nil || orderOperationLog == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
|
||||
@@ -119,7 +119,7 @@ func (r *OrderProductService) GetOrderProduct(orderProductId int64) (getOrderPro
|
||||
}
|
||||
|
||||
// CancelOrderProduct 取消药品订单
|
||||
func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct, orderProductId int64) (bool, error) {
|
||||
func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct, orderProductId, adminUserId int64) (bool, error) {
|
||||
// 获取药品订单详情
|
||||
orderProductDao := dao.OrderProductDao{}
|
||||
orderProduct, err := orderProductDao.GetOrderProductPreloadById(orderProductId)
|
||||
@@ -283,6 +283,22 @@ func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 记录日志
|
||||
orderOperationLog := &model.OrderOperationLog{
|
||||
OrderId: orderProduct.OrderProductId,
|
||||
OrderNo: orderProduct.OrderProductNo,
|
||||
OrderType: 2,
|
||||
OperatorId: adminUserId,
|
||||
OperationContent: "取消订单并退款",
|
||||
}
|
||||
|
||||
orderOperationLogDao := dao.OrderOperationLogDao{}
|
||||
orderOperationLog, err = orderOperationLogDao.AddOrderOperationLog(tx, orderOperationLog)
|
||||
if err != nil || orderOperationLog == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
|
||||
return true, nil
|
||||
|
||||
Reference in New Issue
Block a user