初始化提交

This commit is contained in:
2023-08-31 17:32:45 +08:00
parent 88dc1bbe74
commit 7826652e11
101 changed files with 6127 additions and 2 deletions
+52
View File
@@ -0,0 +1,52 @@
package responses
import (
"github.com/gin-gonic/gin"
"hospital-open-api/consts"
"net/http"
)
type res struct {
Code int `json:"code"`
Data interface{} `json:"data"`
Message string `json:"message"`
}
func Result(code int, data interface{}, msg string, c *gin.Context) {
if data == nil {
data = gin.H{}
}
c.JSON(http.StatusOK, res{
code,
data,
msg,
})
}
func Ok(c *gin.Context) {
Result(consts.HttpSuccess, map[string]interface{}{}, "成功", c)
}
func OkWithMessage(message string, c *gin.Context) {
Result(consts.HttpSuccess, map[string]interface{}{}, message, c)
}
func OkWithData(data interface{}, c *gin.Context) {
Result(consts.HttpSuccess, data, "成功", c)
}
func OkWithDetailed(data interface{}, message string, c *gin.Context) {
Result(consts.HttpSuccess, data, message, c)
}
func Fail(c *gin.Context) {
Result(consts.HttpError, map[string]interface{}{}, "失败", c)
}
func FailWithMessage(message string, c *gin.Context) {
Result(consts.HttpError, map[string]interface{}{}, message, c)
}
func FailWithDetailed(data interface{}, message string, c *gin.Context) {
Result(consts.HttpError, data, message, c)
}
@@ -0,0 +1,81 @@
package userDoctorResponse
import (
"hospital-open-api/api/model"
"hospital-open-api/utils"
"strconv"
)
// GetMultiDoctor 获取多点执业医生详情
type GetMultiDoctor 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:认证失败)
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
Avatar string `json:"avatar"` // 头像
DoctorTitle string `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
DepartmentCustomName string `json:"department_custom_name"` // 科室名称(如未自己输入,填入标准科室名称)
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"` // 被关注数量
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:是)
QrCode string `json:"qr_code"` // 分享二维码
BeGoodAt string `json:"be_good_at"` // 擅长
BriefIntroduction string `json:"brief_introduction"` // 医生简介
Mobile string `json:"mobile"` // 手机号
Age uint `json:"age"` // 年龄
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
HospitalName string `json:"hospital_name"` // 医院名称
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
}
// GetMultiDoctorResponse 获取多点执业医生详情
func GetMultiDoctorResponse(userDoctor *model.UserDoctor) GetMultiDoctor {
res := GetMultiDoctor{
DoctorID: strconv.Itoa(int(userDoctor.DoctorId)),
UserID: strconv.Itoa(int(userDoctor.UserId)),
UserName: userDoctor.UserName,
Status: userDoctor.Status,
IDCardStatus: userDoctor.Status,
IdenAuthStatus: userDoctor.IdenAuthStatus,
MultiPointStatus: userDoctor.MultiPointStatus,
Avatar: utils.AddOssDomain(userDoctor.Avatar),
DoctorTitle: utils.DoctorTitleToStr(userDoctor.DoctorTitle),
DepartmentCustomName: userDoctor.DepartmentCustomName,
ServedPatientsNum: userDoctor.ServedPatientsNum,
PraiseRate: userDoctor.PraiseRate,
AvgResponseTime: userDoctor.AvgResponseTime,
NumberOfFans: userDoctor.NumberOfFans,
IsImgExpertReception: userDoctor.IsImgExpertReception,
IsImgWelfareReception: userDoctor.IsImgWelfareReception,
IsImgQuickReception: userDoctor.IsImgQuickReception,
IsPlatformDeepCooperation: userDoctor.IsPlatformDeepCooperation,
IsEnterpriseDeepCooperation: userDoctor.IsEnterpriseDeepCooperation,
QrCode: utils.AddOssDomain(userDoctor.QrCode),
BeGoodAt: userDoctor.BeGoodAt,
BriefIntroduction: userDoctor.BriefIntroduction,
CreatedAt: userDoctor.CreatedAt,
UpdatedAt: userDoctor.UpdatedAt,
}
if userDoctor.User != nil {
res.Mobile = userDoctor.User.Mobile
res.Age = userDoctor.User.Age
res.Sex = userDoctor.User.Sex
}
if userDoctor.Hospital != nil {
res.HospitalName = userDoctor.Hospital.HospitalName
}
return res
}