新增问诊订单详情。修改错误码格式
This commit is contained in:
parent
dc0217d191
commit
654c0fed05
@ -61,7 +61,28 @@ func (r *OrderInquiry) GetOrderInquiryPage(c *gin.Context) {
|
||||
|
||||
// GetOrderInquiry 问诊订单详情
|
||||
func (r *OrderInquiry) GetOrderInquiry(c *gin.Context) {
|
||||
responses.Ok(c)
|
||||
id := c.Param("order_inquiry_id")
|
||||
if id == "" {
|
||||
responses.FailWithMessage("缺少参数", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 将 id 转换为 int64 类型
|
||||
orderInquiryId, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
responses.Fail(c)
|
||||
return
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
orderInquiryService := service.OrderInquiryService{}
|
||||
getUserDoctorResponses, err := orderInquiryService.GetOrderInquiry(orderInquiryId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
responses.OkWithData(getUserDoctorResponses, c)
|
||||
}
|
||||
|
||||
// DeleteOrderInquiry 删除问诊订单
|
||||
|
||||
81
api/dao/orderEvaluation.go
Normal file
81
api/dao/orderEvaluation.go
Normal file
@ -0,0 +1,81 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type OrderEvaluationDao struct {
|
||||
}
|
||||
|
||||
// GetOrderEvaluationById 获取问诊订单评价数据-问诊订单评价id
|
||||
func (r *OrderEvaluationDao) GetOrderEvaluationById(EvaluationId int64) (m *model.OrderEvaluation, err error) {
|
||||
err = global.Db.First(&m, EvaluationId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (r *OrderEvaluationDao) GetOrderEvaluationByOrderInquiryId(orderInquiryId int64) (m *model.OrderEvaluation, err error) {
|
||||
err = global.Db.Where("order_inquiry_id = ?", orderInquiryId).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetOrderEvaluationPreloadById 获取问诊订单评价数据-加载全部关联-问诊订单评价id
|
||||
func (r *OrderEvaluationDao) GetOrderEvaluationPreloadById(EvaluationId int64) (m *model.OrderEvaluation, err error) {
|
||||
err = global.Db.Preload(clause.Associations).First(&m, EvaluationId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DeleteOrderEvaluation 删除问诊订单评价
|
||||
func (r *OrderEvaluationDao) DeleteOrderEvaluation(tx *gorm.DB, maps interface{}) error {
|
||||
err := tx.Where(maps).Delete(&model.OrderEvaluation{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditOrderEvaluation 修改问诊订单评价
|
||||
func (r *OrderEvaluationDao) EditOrderEvaluation(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||
err := tx.Model(&model.OrderEvaluation{}).Where(maps).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditOrderEvaluationById 修改问诊订单评价-问诊订单评价id
|
||||
func (r *OrderEvaluationDao) EditOrderEvaluationById(tx *gorm.DB, EvaluationId int64, data interface{}) error {
|
||||
err := tx.Model(&model.OrderEvaluation{}).Where("evaluation_id = ?", EvaluationId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOrderEvaluationList 获取问诊订单评价列表
|
||||
func (r *OrderEvaluationDao) GetOrderEvaluationList(maps interface{}) (m []*model.OrderEvaluation, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// AddOrderEvaluation 新增问诊订单评价
|
||||
func (r *OrderEvaluationDao) AddOrderEvaluation(tx *gorm.DB, model *model.OrderEvaluation) (*model.OrderEvaluation, error) {
|
||||
if err := tx.Create(model).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
81
api/dao/orderInquiryCase.go
Normal file
81
api/dao/orderInquiryCase.go
Normal file
@ -0,0 +1,81 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type OrderInquiryCaseDao struct {
|
||||
}
|
||||
|
||||
// GetOrderInquiryCaseById 获取问诊订单病例数据-问诊订单病例id
|
||||
func (r *OrderInquiryCaseDao) GetOrderInquiryCaseById(InquiryCaseId int64) (m *model.OrderInquiryCase, err error) {
|
||||
err = global.Db.First(&m, InquiryCaseId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (r *OrderInquiryCaseDao) GetOrderInquiryCaseByOrderInquiryId(orderInquiryId int64) (m *model.OrderInquiryCase, err error) {
|
||||
err = global.Db.Where("order_inquiry_id = ?", orderInquiryId).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryCasePreloadById 获取问诊订单病例数据-加载全部关联-问诊订单病例id
|
||||
func (r *OrderInquiryCaseDao) GetOrderInquiryCasePreloadById(InquiryCaseId int64) (m *model.OrderInquiryCase, err error) {
|
||||
err = global.Db.Preload(clause.Associations).First(&m, InquiryCaseId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DeleteOrderInquiryCase 删除问诊订单病例
|
||||
func (r *OrderInquiryCaseDao) DeleteOrderInquiryCase(tx *gorm.DB, maps interface{}) error {
|
||||
err := tx.Where(maps).Delete(&model.OrderInquiryCase{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditOrderInquiryCase 修改问诊订单病例
|
||||
func (r *OrderInquiryCaseDao) EditOrderInquiryCase(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||
err := tx.Model(&model.OrderInquiryCase{}).Where(maps).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditOrderInquiryCaseById 修改问诊订单病例-问诊订单病例id
|
||||
func (r *OrderInquiryCaseDao) EditOrderInquiryCaseById(tx *gorm.DB, InquiryCaseId int64, data interface{}) error {
|
||||
err := tx.Model(&model.OrderInquiryCase{}).Where("inquiry_case_id = ?", InquiryCaseId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryCaseList 获取问诊订单病例列表
|
||||
func (r *OrderInquiryCaseDao) GetOrderInquiryCaseList(maps interface{}) (m []*model.OrderInquiryCase, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// AddOrderInquiryCase 新增问诊订单病例
|
||||
func (r *OrderInquiryCaseDao) AddOrderInquiryCase(tx *gorm.DB, model *model.OrderInquiryCase) (*model.OrderInquiryCase, error) {
|
||||
if err := tx.Create(model).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
@ -11,8 +11,8 @@ type OrderInquiryRefundDao struct {
|
||||
}
|
||||
|
||||
// GetOrderInquiryRefundById 获取问诊退款订单数据-问诊退款订单id
|
||||
func (r *OrderInquiryRefundDao) GetOrderInquiryRefundById(doctorId int64) (m *model.OrderInquiryRefund, err error) {
|
||||
err = global.Db.First(&m, doctorId).Error
|
||||
func (r *OrderInquiryRefundDao) GetOrderInquiryRefundById(inquiryRefundId int64) (m *model.OrderInquiryRefund, err error) {
|
||||
err = global.Db.First(&m, inquiryRefundId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -28,6 +28,15 @@ func (r *OrderInquiryRefundDao) GetOrderInquiryRefundPreloadById(inquiryRefundId
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryRefundByOrderInquiryId 获取问诊退款订单数据-问诊订单id
|
||||
func (r *OrderInquiryRefundDao) GetOrderInquiryRefundByOrderInquiryId(orderInquiryId int64) (m *model.OrderInquiryRefund, err error) {
|
||||
err = global.Db.Where("order_inquiry_id = ?", orderInquiryId).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DeleteOrderInquiryRefund 删除问诊退款订单
|
||||
func (r *OrderInquiryRefundDao) DeleteOrderInquiryRefund(tx *gorm.DB, maps interface{}) error {
|
||||
err := tx.Where(maps).Delete(&model.OrderInquiryRefund{}).Error
|
||||
|
||||
@ -19,7 +19,7 @@ func Recover() gin.HandlerFunc {
|
||||
log.Printf("panic: %v\n", r)
|
||||
debug.PrintStack()
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"code": consts.SERVER_ERROR,
|
||||
"code": consts.ServerError,
|
||||
"message": errorToString(r),
|
||||
"data": "",
|
||||
})
|
||||
|
||||
@ -128,7 +128,7 @@ func Auth() gin.HandlerFunc {
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "请求路径错误",
|
||||
"code": consts.SERVER_ERROR,
|
||||
"code": consts.ServerError,
|
||||
"data": "",
|
||||
})
|
||||
|
||||
@ -147,7 +147,7 @@ func Auth() gin.HandlerFunc {
|
||||
if len(adminApis) == 0 || err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "请求路径错误",
|
||||
"code": consts.SERVER_ERROR,
|
||||
"code": consts.ServerError,
|
||||
"data": "",
|
||||
})
|
||||
c.Abort()
|
||||
@ -168,7 +168,7 @@ func Auth() gin.HandlerFunc {
|
||||
if adminRoleMenu == nil {
|
||||
c.JSON(http.StatusForbidden, gin.H{
|
||||
"message": "暂无权限",
|
||||
"code": consts.CLIENT_HTTP_UNAUTHORIZED,
|
||||
"code": consts.ClientHttpUnauthorized,
|
||||
"data": "",
|
||||
})
|
||||
c.Abort()
|
||||
@ -197,7 +197,7 @@ func Auth() gin.HandlerFunc {
|
||||
if !hasPermission {
|
||||
c.JSON(http.StatusForbidden, gin.H{
|
||||
"message": "暂无权限",
|
||||
"code": consts.CLIENT_HTTP_UNAUTHORIZED,
|
||||
"code": consts.ClientHttpUnauthorized,
|
||||
"data": "",
|
||||
})
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ func Jwt() gin.HandlerFunc {
|
||||
if authorization == "" || !strings.HasPrefix(authorization, "Bearer ") {
|
||||
c.JSON(http.StatusUnauthorized, gin.H{
|
||||
"message": "请求未授权",
|
||||
"code": consts.TOKEN_ERROR,
|
||||
"code": consts.TokenError,
|
||||
"data": "",
|
||||
})
|
||||
c.Abort()
|
||||
@ -35,7 +35,7 @@ func Jwt() gin.HandlerFunc {
|
||||
if res != "" {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "token错误/过期",
|
||||
"code": consts.TOKEN_ERROR,
|
||||
"code": consts.TokenError,
|
||||
"data": "",
|
||||
})
|
||||
|
||||
@ -48,7 +48,7 @@ func Jwt() gin.HandlerFunc {
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "token错误/过期",
|
||||
"code": consts.TOKEN_ERROR,
|
||||
"code": consts.TokenError,
|
||||
"data": "",
|
||||
})
|
||||
|
||||
@ -61,7 +61,7 @@ func Jwt() gin.HandlerFunc {
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "token错误",
|
||||
"code": consts.TOKEN_ERROR,
|
||||
"code": consts.TokenError,
|
||||
"data": "",
|
||||
})
|
||||
|
||||
@ -73,7 +73,7 @@ func Jwt() gin.HandlerFunc {
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "token错误",
|
||||
"code": consts.TOKEN_ERROR,
|
||||
"code": consts.TokenError,
|
||||
"data": "",
|
||||
})
|
||||
|
||||
@ -85,7 +85,7 @@ func Jwt() gin.HandlerFunc {
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "token错误",
|
||||
"code": consts.TOKEN_ERROR,
|
||||
"code": consts.TokenError,
|
||||
"data": "",
|
||||
})
|
||||
|
||||
@ -97,7 +97,7 @@ func Jwt() gin.HandlerFunc {
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "token错误",
|
||||
"code": consts.TOKEN_ERROR,
|
||||
"code": consts.TokenError,
|
||||
"data": "",
|
||||
})
|
||||
|
||||
|
||||
@ -19,11 +19,14 @@ func Logrus() gin.HandlerFunc {
|
||||
c.Next()
|
||||
|
||||
// 获取 请求 参数
|
||||
params, ok := c.Get("params")
|
||||
if !ok {
|
||||
params = ""
|
||||
} else {
|
||||
params = params.(map[string]interface{})
|
||||
params := make(map[string]string)
|
||||
|
||||
paramsRaw, ok := c.Get("params")
|
||||
if ok {
|
||||
requestParams, ok := paramsRaw.(map[string]string)
|
||||
if ok || len(requestParams) > 0 {
|
||||
params = requestParams
|
||||
}
|
||||
}
|
||||
|
||||
// 结束时间
|
||||
|
||||
@ -1,62 +1,71 @@
|
||||
package middlewares
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/consts"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// RequestParamsMiddleware 获取请求参数中间件
|
||||
func RequestParamsMiddleware() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
contentType := c.GetHeader("Content-Type")
|
||||
contentType := c.Request.Header.Get("Content-Type")
|
||||
|
||||
params := make(map[string]string)
|
||||
|
||||
// 判断请求参数类型
|
||||
switch contentType {
|
||||
case "application/json":
|
||||
// 解析 JSON 参数
|
||||
var params map[string]interface{}
|
||||
// 读取请求体数据
|
||||
data, err := c.GetRawData()
|
||||
// 解析 application/json 请求体
|
||||
bodyBytes, err := io.ReadAll(c.Request.Body)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to read request body"})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
// 解析 JSON 数据到 map[string]interface{}
|
||||
err = json.Unmarshal(data, ¶ms)
|
||||
// 创建新的请求对象,并设置请求体数据
|
||||
c.Request.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
||||
|
||||
var jsonParams map[string]interface{}
|
||||
err = json.Unmarshal(bodyBytes, &jsonParams)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"message": "Invalid JSON data",
|
||||
"code": consts.HTTP_ERROR,
|
||||
"code": consts.HttpError,
|
||||
"data": "",
|
||||
})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
for key, value := range jsonParams {
|
||||
params[key] = fmt.Sprintf("%v", value)
|
||||
}
|
||||
|
||||
// 存储参数到上下文
|
||||
c.Set("params", params)
|
||||
|
||||
case "application/form-data", "application/x-www-form-urlencoded":
|
||||
case "multipart/form-data", "application/form-data", "application/x-www-form-urlencoded":
|
||||
// 解析 Form 表单参数
|
||||
err := c.Request.ParseForm()
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"message": "Invalid form data",
|
||||
"code": consts.HTTP_ERROR,
|
||||
"code": consts.HttpError,
|
||||
"data": "",
|
||||
})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
// 将参数转换为 map[string]interface{}
|
||||
params := make(map[string]interface{})
|
||||
for key, values := range c.Request.Form {
|
||||
if len(values) > 0 {
|
||||
params[key] = values[0]
|
||||
params[key] = fmt.Sprintf("%v", values[0])
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,11 +76,9 @@ func RequestParamsMiddleware() gin.HandlerFunc {
|
||||
// 解析 URL 参数
|
||||
queryParams := c.Request.URL.Query()
|
||||
|
||||
// 将参数转换为 map[string]interface{}
|
||||
params := make(map[string]interface{})
|
||||
for key, values := range queryParams {
|
||||
if len(values) > 0 {
|
||||
params[key] = values[0]
|
||||
params[key] = fmt.Sprintf("%v", values[0])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
41
api/model/orderEvaluation.go
Normal file
41
api/model/orderEvaluation.go
Normal file
@ -0,0 +1,41 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// OrderEvaluation 订单-评价表
|
||||
type OrderEvaluation struct {
|
||||
EvaluationId int64 `gorm:"column:evaluation_id;type:bigint(19);primary_key;comment:主键id" json:"evaluation_id"`
|
||||
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
|
||||
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
|
||||
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
|
||||
NameMask string `gorm:"column:name_mask;type:varchar(255);comment:患者姓名(掩码)" json:"name_mask"`
|
||||
ReplyQuality float64 `gorm:"column:reply_quality;type:float(10,2);default:100.00;comment:回复质量(百分制)" json:"reply_quality"`
|
||||
ServiceAttitude float64 `gorm:"column:service_attitude;type:float(10,2);default:100.00;comment:服务态度(百分制)" json:"service_attitude"`
|
||||
ReplyProgress float64 `gorm:"column:reply_progress;type:float(10,2);default:100.00;comment:回复速度(百分制)" json:"reply_progress"`
|
||||
AvgScore float64 `gorm:"column:avg_score;type:float(10,2);default:100.00;comment:平均得分(百分制,回复质量占4、服务态度占3、回复速度占3,计算公式:每个得分 * 占比 相加)" json:"avg_score"`
|
||||
Type int `gorm:"column:type;type:tinyint(1);default:1;comment:类型(1:默认评价 2:主动评价)" json:"type"`
|
||||
Content string `gorm:"column:content;type:text;comment:评价内容" json:"content"`
|
||||
Model
|
||||
}
|
||||
|
||||
func (m *OrderEvaluation) TableName() string {
|
||||
return "gdxz_order_evaluation"
|
||||
}
|
||||
|
||||
func (m *OrderEvaluation) BeforeCreate(tx *gorm.DB) error {
|
||||
if m.EvaluationId == 0 {
|
||||
m.EvaluationId = global.Snowflake.Generate().Int64()
|
||||
}
|
||||
|
||||
m.CreatedAt = LocalTime(time.Now())
|
||||
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||
|
||||
m.UpdatedAt = LocalTime(time.Now())
|
||||
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||
|
||||
return nil
|
||||
}
|
||||
54
api/model/orderInquiryCase.go
Normal file
54
api/model/orderInquiryCase.go
Normal file
@ -0,0 +1,54 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// OrderInquiryCase 订单-问诊病例表
|
||||
type OrderInquiryCase struct {
|
||||
InquiryCaseId int64 `gorm:"column:inquiry_case_id;type:bigint(19);primary_key;comment:主键id" json:"inquiry_case_id"`
|
||||
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"`
|
||||
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
|
||||
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
|
||||
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id" json:"family_id"`
|
||||
Relation int `gorm:"column:relation;type:tinyint(1);default:1;comment:与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )" json:"relation"`
|
||||
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态(1:正常 2:删除)" json:"status"`
|
||||
Name string `gorm:"column:name;type:varchar(50);comment:患者名称" json:"name"`
|
||||
Sex int `gorm:"column:sex;type:tinyint(1);default:0;comment:患者性别(0:未知 1:男 2:女)" json:"sex"`
|
||||
Age int `gorm:"column:age;type:int(11);comment:患者年龄" json:"age"`
|
||||
Height string `gorm:"column:height;type:varchar(100);comment:身高(cm)" json:"height"`
|
||||
Weight string `gorm:"column:weight;type:varchar(100);comment:体重(kg)" json:"weight"`
|
||||
DiseaseClassId int64 `gorm:"column:disease_class_id;type:bigint(19);comment:疾病分类id-系统" json:"disease_class_id"`
|
||||
DiseaseClassName string `gorm:"column:disease_class_name;type:varchar(255);comment:疾病名称-系统" json:"disease_class_name"`
|
||||
DiagnosisDate LocalTime `gorm:"column:diagnosis_date;type:datetime;comment:确诊日期" json:"diagnosis_date"`
|
||||
DiseaseDesc string `gorm:"column:disease_desc;type:text;comment:病情描述(主诉)" json:"disease_desc"`
|
||||
DiagnoseImages string `gorm:"column:diagnose_images;type:varchar(1000);comment:复诊凭证(多个使用逗号分隔)" json:"diagnose_images"`
|
||||
IsAllergyHistory int `gorm:"column:is_allergy_history;type:tinyint(1);comment:是否存在过敏史(0:否 1:是)" json:"is_allergy_history"`
|
||||
AllergyHistory string `gorm:"column:allergy_history;type:varchar(255);comment:过敏史描述" json:"allergy_history"`
|
||||
IsFamilyHistory int `gorm:"column:is_family_history;type:tinyint(1);comment:是否存在家族病史(0:否 1:是)" json:"is_family_history"`
|
||||
FamilyHistory string `gorm:"column:family_history;type:varchar(255);comment:家族病史描述" json:"family_history"`
|
||||
IsPregnant int `gorm:"column:is_pregnant;type:tinyint(1);comment:是否备孕、妊娠、哺乳期(0:否 1:是)" json:"is_pregnant"`
|
||||
Pregnant string `gorm:"column:pregnant;type:varchar(255);comment:备孕、妊娠、哺乳期描述" json:"pregnant"`
|
||||
IsTaboo int `gorm:"column:is_taboo;type:tinyint(1);comment:是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在" json:"is_taboo"`
|
||||
Model
|
||||
}
|
||||
|
||||
func (m *OrderInquiryCase) TableName() string {
|
||||
return "gdxz_order_inquiry_case"
|
||||
}
|
||||
|
||||
func (m *OrderInquiryCase) BeforeCreate(tx *gorm.DB) error {
|
||||
if m.InquiryCaseId == 0 {
|
||||
m.InquiryCaseId = global.Snowflake.Generate().Int64()
|
||||
}
|
||||
|
||||
m.CreatedAt = LocalTime(time.Now())
|
||||
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||
|
||||
m.UpdatedAt = LocalTime(time.Now())
|
||||
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -17,7 +17,7 @@ type OrderInquiryRefund struct {
|
||||
InquiryRefundStatus int `gorm:"column:inquiry_refund_status;type:tinyint(4);comment:问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)" json:"inquiry_refund_status"`
|
||||
RefundTotal float64 `gorm:"column:refund_total;type:decimal(10,2);comment:退款金额" json:"refund_total"`
|
||||
RefundReason string `gorm:"column:refund_reason;type:varchar(255);comment:退款原因" json:"refund_reason"`
|
||||
SuccessTime time.Time `gorm:"column:success_time;type:datetime;comment:退款成功时间" json:"success_time"`
|
||||
SuccessTime LocalTime `gorm:"column:success_time;type:datetime;comment:退款成功时间" json:"success_time"`
|
||||
Model
|
||||
}
|
||||
|
||||
|
||||
21
api/responses/orderEvaluationResponse/orderEvaluation.go
Normal file
21
api/responses/orderEvaluationResponse/orderEvaluation.go
Normal file
@ -0,0 +1,21 @@
|
||||
package orderEvaluationResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
type OrderEvaluation struct {
|
||||
EvaluationId string `json:"evaluation_id"` // 主键id
|
||||
DoctorId string `json:"doctor_id"` // 医生id;NOT NULL
|
||||
PatientId string `json:"patient_id"` // 患者id;NOT NULL
|
||||
OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL
|
||||
NameMask string `json:"name_mask"` // 患者姓名(掩码)
|
||||
ReplyQuality float64 `json:"reply_quality"` // 回复质量(百分制)
|
||||
ServiceAttitude float64 `json:"service_attitude"` // 服务态度(百分制)
|
||||
ReplyProgress float64 `json:"reply_progress"` // 回复速度(百分制)
|
||||
AvgScore float64 `json:"avg_score"` // 平均得分(百分制,回复质量占4、服务态度占3、回复速度占3,计算公式:每个得分 * 占比 相加)
|
||||
Type int `json:"type"` // 类型(1:默认评价 2:主动评价)
|
||||
Content string `json:"content"` // 评价内容
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
35
api/responses/orderInquiryCaseResponse/orderInquiryCase.go
Normal file
35
api/responses/orderInquiryCaseResponse/orderInquiryCase.go
Normal file
@ -0,0 +1,35 @@
|
||||
package orderInquiryCaseResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
// OrderInquiryCase 问诊病例详情
|
||||
type OrderInquiryCase struct {
|
||||
InquiryCaseId string `json:"inquiry_case_id"` // 主键id
|
||||
UserId string `json:"user_id"` // 用户id
|
||||
PatientId string `json:"patient_id"` // 患者id
|
||||
OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL
|
||||
FamilyId string `json:"family_id"` // 家庭成员id
|
||||
Relation int `json:"relation"` // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他)
|
||||
Status int `json:"status"` // 状态(1:正常 2:删除)
|
||||
Name string `json:"name"` // 患者名称
|
||||
Sex int `json:"sex"` // 患者性别(0:未知 1:男 2:女)
|
||||
Age int `json:"age"` // 患者年龄
|
||||
Height string `json:"height"` // 身高(cm)
|
||||
Weight string `json:"weight"` // 体重(kg)
|
||||
DiseaseClassId string `json:"disease_class_id"` // 疾病分类id-系统
|
||||
DiseaseClassName string `json:"disease_class_name"` // 疾病名称-系统
|
||||
DiagnosisDate model.LocalTime `json:"diagnosis_date"` // 确诊日期
|
||||
DiseaseDesc string `json:"disease_desc"` // 病情描述(主诉)
|
||||
DiagnoseImages string `json:"diagnose_images"` // 复诊凭证(多个使用逗号分隔)
|
||||
IsAllergyHistory int `json:"is_allergy_history"` // 是否存在过敏史(0:否 1:是)
|
||||
AllergyHistory string `json:"allergy_history"` // 过敏史描述
|
||||
IsFamilyHistory int `json:"is_family_history"` // 是否存在家族病史(0:否 1:是)
|
||||
FamilyHistory string `json:"family_history"` // 家族病史描述
|
||||
IsPregnant int `json:"is_pregnant"` // 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
Pregnant string `json:"pregnant"` // 备孕、妊娠、哺乳期描述
|
||||
IsTaboo int `json:"is_taboo"` // 是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package orderInquiryCouponResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
// OrderInquiryCoupon 优惠卷详情
|
||||
type OrderInquiryCoupon struct {
|
||||
OrderCouponId string `json:"order_coupon_id"` // 主键id
|
||||
OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id
|
||||
UserCouponId string `json:"user_coupon_id"` // 用户优惠卷表
|
||||
CouponName string `json:"coupon_name"` // 优惠卷名称
|
||||
CouponUsePrice float64 `json:"coupon_use_price"` // 优惠卷使用金额
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package orderInquiryRefundResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
type OrderInquiryRefund struct {
|
||||
InquiryRefundId string `json:"inquiry_refund_id"` // 主键id
|
||||
PatientId string `json:"patient_id"` // 患者id
|
||||
OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id
|
||||
InquiryNo string `json:"inquiry_no"` // 系统订单编号
|
||||
InquiryRefundNo string `json:"inquiry_refund_no"` // 系统退款编号
|
||||
RefundId string `json:"refund_id"` // 第三方退款单号
|
||||
InquiryRefundStatus int `json:"inquiry_refund_status"` // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||||
RefundTotal float64 `json:"refund_total"` // 退款金额
|
||||
RefundReason string `json:"refund_reason"` // 退款原因
|
||||
SuccessTime model.LocalTime `json:"success_time"` // 退款成功时间
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
@ -3,6 +3,11 @@ package orderInquiryResponse
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/responses/orderEvaluationResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryCaseResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryCouponResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryRefundResponse"
|
||||
"hospital-admin-api/api/responses/userDoctorResponse"
|
||||
)
|
||||
|
||||
// getOrderInquiryPage 获取医生列表-分页
|
||||
@ -44,6 +49,49 @@ type getOrderInquiryPage struct {
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// GetOrderInquiry 问诊订单详情
|
||||
type GetOrderInquiry struct {
|
||||
OrderInquiryId string `json:"order_inquiry_id"` // 主键id
|
||||
UserId string `json:"user_id"` // 用户id-患者
|
||||
PatientId string `json:"patient_id"` // 患者id
|
||||
DoctorId string `json:"doctor_id"` // 医生id(未分配时为null)
|
||||
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
||||
InquiryType int `json:"inquiry_type"` // 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)
|
||||
InquiryMode int `json:"inquiry_mode"` // 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
InquiryStatus int `json:"inquiry_status"` // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
IsDelete int `json:"is_delete"` // 删除状态(0:否 1:是)
|
||||
InquiryRefundStatus int `json:"inquiry_refund_status"` // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||||
InquiryPayChannel int `json:"inquiry_pay_channel"` // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||
InquiryPayStatus int `json:"inquiry_pay_status"` // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
InquiryNo string `json:"inquiry_no"` // 系统订单编号
|
||||
EscrowTradeNo string `json:"escrow_trade_no"` // 第三方支付流水号
|
||||
AmountTotal float64 `json:"amount_total"` // 订单金额
|
||||
CouponAmountTotal float64 `json:"coupon_amount_total"` // 优惠卷总金额
|
||||
PaymentAmountTotal float64 `json:"payment_amount_total"` // 实际付款金额
|
||||
PayTime model.LocalTime `json:"pay_time"` // 支付时间
|
||||
ReceptionTime model.LocalTime `json:"reception_time"` // 接诊时间(已接诊)
|
||||
CompleteTime model.LocalTime `json:"complete_time"` // 订单完成时间(问诊完成时间)
|
||||
FinishTime model.LocalTime `json:"finish_time"` // 订单结束时间
|
||||
StatisticsStatus int `json:"statistics_status"` // 订单统计状态(0:未统计 1:已统计 2:统计失败)
|
||||
StatisticsTime model.LocalTime `json:"statistics_time"` // 订单统计时间
|
||||
IsWithdrawal int `json:"is_withdrawal"` // 是否提现(0:否 1:是 2:提现中)
|
||||
WithdrawalTime model.LocalTime `json:"withdrawal_time"` // 提现时间
|
||||
CancelTime model.LocalTime `json:"cancel_time"` // 订单取消时间
|
||||
CancelReason int `json:"cancel_reason"` // 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||||
CancelRemarks string `json:"cancel_remarks"` // 取消订单备注(自动添加)
|
||||
PatientName string `json:"patient_name"` // 患者姓名-就诊人
|
||||
PatientNameMask string `json:"patient_name_mask"` // 患者姓名-就诊人(掩码)
|
||||
PatientSex int `json:"patient_sex"` // 患者性别-就诊人(0:未知 1:男 2:女)
|
||||
PatientAge int `json:"patient_age"` // 患者年龄-就诊人
|
||||
OrderInquiryCoupon *orderInquiryCouponResponse.OrderInquiryCoupon `json:"order_inquiry_coupon"` // 订单优惠卷
|
||||
OrderInquiryCase *orderInquiryCaseResponse.OrderInquiryCase `json:"order_inquiry_case"` // 问诊病例
|
||||
OrderInquiryRefund *orderInquiryRefundResponse.OrderInquiryRefund `json:"order_inquiry_refund"` // 退款数据
|
||||
OrderEvaluation *orderEvaluationResponse.OrderEvaluation `json:"order_evaluation"` // 订单评价
|
||||
UserDoctor *userDoctorResponse.OrderInquiryUserDoctor `json:"user_doctor"` // 医生数据
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// GetOrderInquiryPageResponse 获取用户列表-分页
|
||||
func GetOrderInquiryPageResponse(orderInquiry []*model.OrderInquiry) []getOrderInquiryPage {
|
||||
// 处理返回值
|
||||
|
||||
@ -12,7 +12,7 @@ type res struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func Result(code int, data interface{}, msg string, c *gin.Context) {
|
||||
func result(code int, data interface{}, msg string, c *gin.Context) {
|
||||
if data == nil {
|
||||
data = gin.H{}
|
||||
}
|
||||
@ -24,29 +24,29 @@ func Result(code int, data interface{}, msg string, c *gin.Context) {
|
||||
}
|
||||
|
||||
func Ok(c *gin.Context) {
|
||||
Result(consts.HTTP_SUCCESS, map[string]interface{}{}, "成功", c)
|
||||
result(consts.HttpSuccess, map[string]interface{}{}, "成功", c)
|
||||
}
|
||||
|
||||
func OkWithMessage(message string, c *gin.Context) {
|
||||
Result(consts.HTTP_SUCCESS, map[string]interface{}{}, message, c)
|
||||
result(consts.HttpSuccess, map[string]interface{}{}, message, c)
|
||||
}
|
||||
|
||||
func OkWithData(data interface{}, c *gin.Context) {
|
||||
Result(consts.HTTP_SUCCESS, data, "成功", c)
|
||||
result(consts.HttpSuccess, data, "成功", c)
|
||||
}
|
||||
|
||||
func OkWithDetailed(data interface{}, message string, c *gin.Context) {
|
||||
Result(consts.HTTP_SUCCESS, data, message, c)
|
||||
result(consts.HttpSuccess, data, message, c)
|
||||
}
|
||||
|
||||
func Fail(c *gin.Context) {
|
||||
Result(consts.HTTP_ERROR, map[string]interface{}{}, "失败", c)
|
||||
result(consts.HttpError, map[string]interface{}{}, "失败", c)
|
||||
}
|
||||
|
||||
func FailWithMessage(message string, c *gin.Context) {
|
||||
Result(consts.HTTP_ERROR, map[string]interface{}{}, message, c)
|
||||
result(consts.HttpError, map[string]interface{}{}, message, c)
|
||||
}
|
||||
|
||||
func FailWithDetailed(data interface{}, message string, c *gin.Context) {
|
||||
Result(consts.HTTP_ERROR, data, message, c)
|
||||
result(consts.HttpError, data, message, c)
|
||||
}
|
||||
|
||||
@ -92,6 +92,50 @@ type GetUserDoctor struct {
|
||||
DoctorBankCard doctorBankCardResponse.DoctorBankCard `json:"doctor_bank_card"` // 医生银行卡
|
||||
}
|
||||
|
||||
// UserDoctor 医生详情
|
||||
type UserDoctor struct {
|
||||
DoctorID string `json:"doctor_id"` // 主键id
|
||||
UserID string `json:"user_id"` // 用户id
|
||||
UserName string `json:"user_name"` // 用户名称
|
||||
Status int `json:"status"` // 状态(0:禁用 1:正常 2:删除)
|
||||
IDCardStatus int `json:"idcard_status"` // 实名认证状态(0:未认证 1:认证通过 2:认证失败)
|
||||
IdenAuthStatus int `json:"iden_auth_status"` // 身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
IdenAuthTime model.LocalTime `json:"iden_auth_time"` // 审核时间
|
||||
IdenAuthFailReason string `json:"iden_auth_fail_reason"` // 身份认证失败原因
|
||||
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
MultiPointTime model.LocalTime `json:"multi_point_time"` // 审核时间
|
||||
MultiPointFailReason string `json:"multi_point_fail_reason"` // 多点执业认证失败原因
|
||||
IsBindBank int `json:"is_bind_bank"` // 是否已绑定结算银行卡(0:否 1:是)
|
||||
IsRecommend int `json:"is_recommend"` // 是否首页推荐(0:否 1:是)
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
DoctorTitle int `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
||||
DepartmentCustomID string `json:"department_custom_id"` // 科室id-自定义
|
||||
DepartmentCustomName string `json:"department_custom_name"` // 科室名称(如未自己输入,填入标准科室名称)
|
||||
DepartmentCustomMobile string `json:"department_custom_mobile"` // 科室电话
|
||||
HospitalID string `json:"hospital_id"` // 所属医院id
|
||||
ServedPatientsNum int `json:"served_patients_num"` // 服务患者数量(订单结束时统计)
|
||||
PraiseRate float64 `json:"praise_rate"` // 好评率(百分制。订单平均评价中超过4-5分的订单总数 / 总订单数 * 5)
|
||||
AvgResponseTime float64 `json:"avg_response_time"` // 平均响应时间(分钟制)
|
||||
NumberOfFans uint `json:"number_of_fans"` // 被关注数量
|
||||
IsOnline int `json:"is_online"` // 是否在线(0:不在线 1:在线)
|
||||
IsImgExpertReception int `json:"is_img_expert_reception"` // 是否参加专家图文接诊(0:否 1:是)
|
||||
IsImgWelfareReception int `json:"is_img_welfare_reception"` // 是否参加公益图文问诊(0:否 1:是)
|
||||
IsImgQuickReception int `json:"is_img_quick_reception"` // 是否参加快速图文接诊(0:否 1:是)
|
||||
IsPlatformDeepCooperation int `json:"is_platform_deep_cooperation"` // 是否平台深度合作医生(0:否 1:是)
|
||||
IsEnterpriseDeepCooperation int `json:"is_enterprise_deep_cooperation"` // 是否企业深度合作医生(0:否 1:是)
|
||||
IsSysDiagnoCooperation int `json:"is_sys_diagno_cooperation"` // 是否先思达合作医生(0:否 1:是)
|
||||
QrCode string `json:"qr_code"` // 分享二维码
|
||||
BeGoodAt string `json:"be_good_at"` // 擅长
|
||||
BriefIntroduction string `json:"brief_introduction"` // 医生简介
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
User *userResponse.User `json:"user"` // 用户
|
||||
Hospital *hospitalResponse.Hospital `json:"hospital"` // 医院
|
||||
UserDoctorInfo *userDoctorInfoResponse.UserDoctorInfo `json:"user_doctor_info"` // 医生详情
|
||||
DoctorExpertise []*doctorExpertiseResponse.DoctorExpertise `json:"doctor_expertise"` // 医生专长
|
||||
DoctorBankCard doctorBankCardResponse.DoctorBankCard `json:"doctor_bank_card"` // 医生银行卡
|
||||
}
|
||||
|
||||
// getUserDoctorPendingPage 身份审核-获取医生列表-分页
|
||||
type getUserDoctorPendingPage struct {
|
||||
DoctorID string `json:"doctor_id"` // 主键id
|
||||
@ -205,6 +249,24 @@ type GetMulti struct {
|
||||
UserDoctorInfo *userDoctorInfoResponse.UserDoctorInfo `json:"user_doctor_info"` // 医生详情
|
||||
}
|
||||
|
||||
// OrderInquiryUserDoctor 订单-医生详情
|
||||
type OrderInquiryUserDoctor struct {
|
||||
DoctorID string `json:"doctor_id"` // 主键id
|
||||
UserID string `json:"user_id"` // 用户id
|
||||
UserName string `json:"user_name"` // 用户名称
|
||||
Status int `json:"status"` // 状态(0:禁用 1:正常 2:删除)
|
||||
IDCardStatus int `json:"idcard_status"` // 实名认证状态(0:未认证 1:认证通过 2:认证失败)
|
||||
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
DoctorTitle int `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
||||
DepartmentCustomName string `json:"department_custom_name"` // 科室名称(如未自己输入,填入标准科室名称)
|
||||
HospitalID string `json:"hospital_id"` // 所属医院id
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
Hospital *hospitalResponse.Hospital `json:"hospital"` // 医院
|
||||
UserDoctorInfo *userDoctorInfoResponse.UserDoctorInfo `json:"user_doctor_info"` // 医生详情
|
||||
}
|
||||
|
||||
// GetUserDoctorPageResponse 获取用户列表-分页
|
||||
func GetUserDoctorPageResponse(userDoctor []*model.UserDoctor) []getUserDoctorPage {
|
||||
// 处理返回值
|
||||
|
||||
@ -21,7 +21,7 @@ func Init() *gin.Engine {
|
||||
}
|
||||
|
||||
// 获取请求参数中间件-json格式下会导致接口获取不到请求数据
|
||||
// r.Use(middlewares.RequestParamsMiddleware())
|
||||
r.Use(middlewares.RequestParamsMiddleware())
|
||||
|
||||
// 日志中间件
|
||||
r.Use(middlewares.Logrus())
|
||||
@ -35,7 +35,7 @@ func Init() *gin.Engine {
|
||||
method := c.Request.Method
|
||||
c.JSON(http.StatusNotFound, gin.H{
|
||||
"msg": fmt.Sprintf("%s %s not found", method, path),
|
||||
"code": consts.CLIENT_HTTP_NOT_FOUND,
|
||||
"code": consts.ClientHttpNotFound,
|
||||
"data": "",
|
||||
})
|
||||
})
|
||||
|
||||
@ -6,6 +6,11 @@ import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/responses/orderEvaluationResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryCaseResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryCouponResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryRefundResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryResponse"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/extend/weChat"
|
||||
"hospital-admin-api/global"
|
||||
@ -132,7 +137,6 @@ func (r *OrderInquiryService) CancelOrderInquiry(orderInquiryId int64) (bool, er
|
||||
inquiryRefundStatus = 3
|
||||
|
||||
if refund.SuccessTime != nil {
|
||||
// 使用 time.Parse 解析时间字符串为 time.Time 类型
|
||||
successTime = *refund.SuccessTime
|
||||
}
|
||||
} else if *refund.Status == "CLOSED" {
|
||||
@ -198,7 +202,7 @@ func (r *OrderInquiryService) CancelOrderInquiry(orderInquiryId int64) (bool, er
|
||||
InquiryRefundStatus: inquiryRefundStatus,
|
||||
RefundTotal: orderInquiry.PaymentAmountTotal,
|
||||
RefundReason: "客服取消",
|
||||
SuccessTime: successTime,
|
||||
SuccessTime: model.LocalTime(successTime),
|
||||
}
|
||||
|
||||
orderInquiryRefundDao := dao.OrderInquiryRefundDao{}
|
||||
@ -250,3 +254,209 @@ func ReturnInquiryCoupon(tx *gorm.DB, orderInquiryId int64) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// GetOrderInquiry 问诊订单详情
|
||||
func (r *OrderInquiryService) GetOrderInquiry(orderInquiryId int64) (getOrderInquiryResponse *orderInquiryResponse.GetOrderInquiry, err error) {
|
||||
// 获取问诊订单数据
|
||||
orderInquiryDao := dao.OrderInquiryDao{}
|
||||
orderInquiry, err := orderInquiryDao.GetOrderInquiryPreloadById(orderInquiryId)
|
||||
if err != nil || orderInquiry == nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 获取问诊订单优惠卷
|
||||
orderInquiryCoupon, err := r.GetOrderInquiryCoupon(orderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 获取问诊病例
|
||||
orderInquiryCase, err := r.GetOrderInquiryCase(orderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 获取退款数据
|
||||
orderInquiryRefund, err := r.GetOrderInquiryRefund(orderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 获取订单评价
|
||||
orderEvaluation, err := r.GetOrderEvaluation(orderInquiryId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 医生数据
|
||||
userDoctorService := UserDoctorService{}
|
||||
userDoctor, err := userDoctorService.GetOrderInquiryUserDoctor(orderInquiry.DoctorId)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 处理医生id
|
||||
var doctorId string
|
||||
if orderInquiry.DoctorId != 0 {
|
||||
doctorId = fmt.Sprintf("%v", orderInquiry.DoctorId)
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
getOrderInquiryResponse = &orderInquiryResponse.GetOrderInquiry{
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiry.OrderInquiryId, 10),
|
||||
UserId: strconv.FormatInt(orderInquiry.UserId, 10),
|
||||
DoctorId: doctorId,
|
||||
PatientId: strconv.FormatInt(orderInquiry.PatientId, 10),
|
||||
FamilyId: strconv.FormatInt(orderInquiry.FamilyId, 10),
|
||||
InquiryType: orderInquiry.InquiryType,
|
||||
InquiryMode: orderInquiry.InquiryMode,
|
||||
InquiryStatus: orderInquiry.InquiryStatus,
|
||||
IsDelete: orderInquiry.IsDelete,
|
||||
InquiryRefundStatus: orderInquiry.InquiryRefundStatus,
|
||||
InquiryPayChannel: orderInquiry.InquiryPayChannel,
|
||||
InquiryPayStatus: orderInquiry.InquiryPayStatus,
|
||||
InquiryNo: orderInquiry.InquiryNo,
|
||||
EscrowTradeNo: orderInquiry.EscrowTradeNo,
|
||||
AmountTotal: orderInquiry.AmountTotal,
|
||||
CouponAmountTotal: orderInquiry.CouponAmountTotal,
|
||||
PaymentAmountTotal: orderInquiry.PaymentAmountTotal,
|
||||
PayTime: orderInquiry.PayTime,
|
||||
ReceptionTime: orderInquiry.ReceptionTime,
|
||||
CompleteTime: orderInquiry.CompleteTime,
|
||||
FinishTime: orderInquiry.FinishTime,
|
||||
StatisticsStatus: orderInquiry.StatisticsStatus,
|
||||
StatisticsTime: orderInquiry.StatisticsTime,
|
||||
IsWithdrawal: orderInquiry.IsWithdrawal,
|
||||
WithdrawalTime: orderInquiry.WithdrawalTime,
|
||||
CancelTime: orderInquiry.CancelTime,
|
||||
CancelReason: orderInquiry.CancelReason,
|
||||
CancelRemarks: orderInquiry.CancelRemarks,
|
||||
PatientName: orderInquiry.PatientName,
|
||||
PatientNameMask: orderInquiry.PatientNameMask,
|
||||
PatientSex: orderInquiry.PatientSex,
|
||||
PatientAge: orderInquiry.PatientAge,
|
||||
OrderInquiryCoupon: orderInquiryCoupon,
|
||||
OrderInquiryCase: orderInquiryCase,
|
||||
OrderInquiryRefund: orderInquiryRefund,
|
||||
OrderEvaluation: orderEvaluation,
|
||||
UserDoctor: userDoctor,
|
||||
CreatedAt: orderInquiry.CreatedAt,
|
||||
UpdatedAt: orderInquiry.UpdatedAt,
|
||||
}
|
||||
|
||||
return getOrderInquiryResponse, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryCoupon 获取问诊订单优惠卷
|
||||
func (r *OrderInquiryService) GetOrderInquiryCoupon(orderInquiryId int64) (u *orderInquiryCouponResponse.OrderInquiryCoupon, err error) {
|
||||
orderInquiryCouponDao := dao.OrderInquiryCouponDao{}
|
||||
orderInquiryCoupon, err := orderInquiryCouponDao.GetOrderInquiryCouponByOrderInquiryId(orderInquiryId)
|
||||
if orderInquiryCoupon == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
u = &orderInquiryCouponResponse.OrderInquiryCoupon{
|
||||
OrderCouponId: strconv.FormatInt(orderInquiryCoupon.OrderCouponId, 10),
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiryCoupon.OrderInquiryId, 10),
|
||||
UserCouponId: strconv.FormatInt(orderInquiryCoupon.UserCouponId, 10),
|
||||
CouponName: orderInquiryCoupon.CouponName,
|
||||
CouponUsePrice: orderInquiryCoupon.CouponUsePrice,
|
||||
CreatedAt: orderInquiryCoupon.CreatedAt,
|
||||
UpdatedAt: orderInquiryCoupon.UpdatedAt,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryCase 获取问诊订单病例
|
||||
func (r *OrderInquiryService) GetOrderInquiryCase(orderInquiryId int64) (u *orderInquiryCaseResponse.OrderInquiryCase, err error) {
|
||||
orderInquiryCaseDao := dao.OrderInquiryCaseDao{}
|
||||
orderInquiryCase, err := orderInquiryCaseDao.GetOrderInquiryCaseByOrderInquiryId(orderInquiryId)
|
||||
if orderInquiryCase == nil {
|
||||
return nil, errors.New("数据错误,无问诊病例")
|
||||
}
|
||||
|
||||
u = &orderInquiryCaseResponse.OrderInquiryCase{
|
||||
InquiryCaseId: strconv.FormatInt(orderInquiryCase.InquiryCaseId, 10),
|
||||
UserId: strconv.FormatInt(orderInquiryCase.UserId, 10),
|
||||
PatientId: strconv.FormatInt(orderInquiryCase.PatientId, 10),
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiryCase.OrderInquiryId, 10),
|
||||
FamilyId: strconv.FormatInt(orderInquiryCase.FamilyId, 10),
|
||||
Relation: orderInquiryCase.Relation,
|
||||
Status: orderInquiryCase.Status,
|
||||
Name: orderInquiryCase.Name,
|
||||
Sex: orderInquiryCase.Sex,
|
||||
Age: orderInquiryCase.Age,
|
||||
Height: orderInquiryCase.Height,
|
||||
Weight: orderInquiryCase.Weight,
|
||||
DiseaseClassId: strconv.FormatInt(orderInquiryCase.DiseaseClassId, 10),
|
||||
DiseaseClassName: orderInquiryCase.DiseaseClassName,
|
||||
DiagnosisDate: orderInquiryCase.DiagnosisDate,
|
||||
DiseaseDesc: orderInquiryCase.DiseaseDesc,
|
||||
DiagnoseImages: orderInquiryCase.DiagnoseImages,
|
||||
IsAllergyHistory: orderInquiryCase.IsAllergyHistory,
|
||||
AllergyHistory: orderInquiryCase.AllergyHistory,
|
||||
IsFamilyHistory: orderInquiryCase.IsFamilyHistory,
|
||||
FamilyHistory: orderInquiryCase.FamilyHistory,
|
||||
IsPregnant: orderInquiryCase.IsPregnant,
|
||||
Pregnant: orderInquiryCase.Pregnant,
|
||||
IsTaboo: orderInquiryCase.IsTaboo,
|
||||
CreatedAt: orderInquiryCase.CreatedAt,
|
||||
UpdatedAt: orderInquiryCase.UpdatedAt,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryRefund 获取问诊订单退款数据
|
||||
func (r *OrderInquiryService) GetOrderInquiryRefund(orderInquiryId int64) (u *orderInquiryRefundResponse.OrderInquiryRefund, err error) {
|
||||
orderInquiryRefundDao := dao.OrderInquiryRefundDao{}
|
||||
orderInquiryRefund, err := orderInquiryRefundDao.GetOrderInquiryRefundByOrderInquiryId(orderInquiryId)
|
||||
if orderInquiryRefund == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
u = &orderInquiryRefundResponse.OrderInquiryRefund{
|
||||
InquiryRefundId: strconv.FormatInt(orderInquiryRefund.InquiryRefundId, 10),
|
||||
PatientId: strconv.FormatInt(orderInquiryRefund.PatientId, 10),
|
||||
OrderInquiryId: strconv.FormatInt(orderInquiryRefund.OrderInquiryId, 10),
|
||||
InquiryNo: orderInquiryRefund.InquiryNo,
|
||||
InquiryRefundNo: orderInquiryRefund.InquiryRefundNo,
|
||||
RefundId: orderInquiryRefund.RefundId,
|
||||
InquiryRefundStatus: orderInquiryRefund.InquiryRefundStatus,
|
||||
RefundTotal: orderInquiryRefund.RefundTotal,
|
||||
RefundReason: orderInquiryRefund.RefundReason,
|
||||
SuccessTime: orderInquiryRefund.SuccessTime,
|
||||
CreatedAt: orderInquiryRefund.CreatedAt,
|
||||
UpdatedAt: orderInquiryRefund.UpdatedAt,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// GetOrderEvaluation 获取问诊订单评价数据
|
||||
func (r *OrderInquiryService) GetOrderEvaluation(orderInquiryId int64) (u *orderEvaluationResponse.OrderEvaluation, err error) {
|
||||
orderEvaluationDao := dao.OrderEvaluationDao{}
|
||||
orderEvaluation, err := orderEvaluationDao.GetOrderEvaluationByOrderInquiryId(orderInquiryId)
|
||||
if orderEvaluation == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
u = &orderEvaluationResponse.OrderEvaluation{
|
||||
EvaluationId: strconv.FormatInt(orderEvaluation.EvaluationId, 10),
|
||||
DoctorId: strconv.FormatInt(orderEvaluation.DoctorId, 10),
|
||||
PatientId: strconv.FormatInt(orderEvaluation.PatientId, 10),
|
||||
OrderInquiryId: strconv.FormatInt(orderEvaluation.OrderInquiryId, 10),
|
||||
NameMask: orderEvaluation.NameMask,
|
||||
ReplyQuality: orderEvaluation.ReplyQuality,
|
||||
ServiceAttitude: orderEvaluation.ServiceAttitude,
|
||||
ReplyProgress: orderEvaluation.ReplyProgress,
|
||||
AvgScore: orderEvaluation.AvgScore,
|
||||
Type: orderEvaluation.Type,
|
||||
Content: orderEvaluation.Content,
|
||||
CreatedAt: orderEvaluation.CreatedAt,
|
||||
UpdatedAt: orderEvaluation.UpdatedAt,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
@ -1738,3 +1738,45 @@ func (r *UserDoctorService) PutMulti(doctorId int64, req requests.PutMulti) (boo
|
||||
tx.Commit()
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// GetOrderInquiryUserDoctor 获取医生数据-问诊订单
|
||||
func (r *UserDoctorService) GetOrderInquiryUserDoctor(doctorId int64) (u *userDoctorResponse.OrderInquiryUserDoctor, err error) {
|
||||
if doctorId == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorPreloadById(doctorId)
|
||||
if err != nil || userDoctor == nil {
|
||||
return nil, errors.New("医生数据错误")
|
||||
}
|
||||
|
||||
// 医院
|
||||
var hospital *hospitalResponse.Hospital
|
||||
if userDoctor.Hospital != nil {
|
||||
hospital = hospitalResponse.HospitalResponse(userDoctor.Hospital)
|
||||
}
|
||||
|
||||
var userDoctorInfo *userDoctorInfoResponse.UserDoctorInfo
|
||||
if userDoctor.UserDoctorInfo != nil {
|
||||
userDoctorInfo = userDoctorInfoResponse.UserDoctorInfoResponse(userDoctor.UserDoctorInfo)
|
||||
}
|
||||
|
||||
u = &userDoctorResponse.OrderInquiryUserDoctor{
|
||||
DoctorID: strconv.Itoa(int(userDoctor.DoctorId)),
|
||||
UserID: strconv.Itoa(int(userDoctor.UserId)),
|
||||
UserName: userDoctor.UserName,
|
||||
Status: userDoctor.Status,
|
||||
IDCardStatus: userDoctor.Status,
|
||||
MultiPointStatus: userDoctor.MultiPointStatus,
|
||||
Avatar: utils.AddOssDomain(userDoctor.Avatar),
|
||||
DoctorTitle: userDoctor.DoctorTitle,
|
||||
DepartmentCustomName: userDoctor.DepartmentCustomName,
|
||||
HospitalID: strconv.Itoa(int(userDoctor.HospitalID)),
|
||||
CreatedAt: userDoctor.CreatedAt,
|
||||
UpdatedAt: userDoctor.UpdatedAt,
|
||||
Hospital: hospital,
|
||||
UserDoctorInfo: userDoctorInfo,
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
||||
@ -2,23 +2,23 @@ package consts
|
||||
|
||||
// 业务状态码
|
||||
const (
|
||||
HTTP_SUCCESS = 200 // 成功
|
||||
HttpSuccess = 200 // 成功
|
||||
|
||||
HTTP_ERROR = -1 // 失败
|
||||
HttpError = -1 // 失败
|
||||
|
||||
USER_STATUS_ERROR = 201 // 用户状态异常
|
||||
UserStatusError = 201 // 用户状态异常
|
||||
|
||||
CLIENT_HTTP_ERROR = 400 // 错误请求
|
||||
ClientHttpError = 400 // 错误请求
|
||||
|
||||
CLIENT_HTTP_UNAUTHORIZED = 401 // 未授权
|
||||
ClientHttpUnauthorized = 401 // 未授权
|
||||
|
||||
HTTP_PROHIBIT = 403 // 禁止请求
|
||||
HttpProhibit = 403 // 禁止请求
|
||||
|
||||
CLIENT_HTTP_NOT_FOUND = 404 // 资源未找到
|
||||
ClientHttpNotFound = 404 // 资源未找到
|
||||
|
||||
TOKEN_ERROR = 405 // token错误/无效
|
||||
TokenError = 405 // token错误/无效
|
||||
|
||||
TOKEN_EXPTIRED = 406 // token过期
|
||||
TokenExptired = 406 // token过期
|
||||
|
||||
SERVER_ERROR = 500 // 服务器异常
|
||||
ServerError = 500 // 服务器异常
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user