新增上报处方平台接口
This commit is contained in:
parent
296199e760
commit
992a51267c
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"hospital-admin-api/api/dao"
|
"hospital-admin-api/api/dao"
|
||||||
"hospital-admin-api/extend/prescription"
|
"hospital-admin-api/extend/prescription"
|
||||||
|
"hospital-admin-api/global"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -262,6 +263,32 @@ func (r *OrderService) ReportPreProduct(orderProductId int64) (bool, error) {
|
|||||||
PresList: presRequests,
|
PresList: presRequests,
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(ReportPreRequest)
|
// 开始事务
|
||||||
|
tx := global.Db.Begin()
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
tx.Rollback()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
// 上报处方
|
||||||
|
_, err = ReportPreRequest.ReportPre()
|
||||||
|
if err != nil {
|
||||||
|
tx.Rollback()
|
||||||
|
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")
|
||||||
|
|
||||||
|
err = orderProductDao.EditOrderProductById(tx, orderProductId, orderProductData)
|
||||||
|
if err != nil {
|
||||||
|
tx.Rollback()
|
||||||
|
return false, errors.New("上报处方失败2")
|
||||||
|
}
|
||||||
|
|
||||||
|
tx.Commit()
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -267,7 +267,6 @@ func NoticePreOrderCancel(orderNo string) (bool, error) {
|
|||||||
|
|
||||||
// ReportPre 上报处方
|
// ReportPre 上报处方
|
||||||
func (r ReportPreRequest) ReportPre() (bool, error) {
|
func (r ReportPreRequest) ReportPre() (bool, error) {
|
||||||
// 将 JSON 数据编码为字节数组
|
|
||||||
jsonData, err := json.Marshal(r)
|
jsonData, err := json.Marshal(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user