Merge branch 'dev'
This commit is contained in:
commit
cc4783e2b7
3
.gitignore
vendored
3
.gitignore
vendored
@ -16,4 +16,5 @@
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
.idea/
|
||||
.git/
|
||||
.git/
|
||||
.DS_Store/
|
||||
@ -440,3 +440,109 @@ func (r *UserDoctor) GetUserDoctorBankCardPage(c *gin.Context) {
|
||||
result["data"] = res
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
// GetDoctorIntroductionPage 简介审核-获取医生列表-分页
|
||||
func (r *UserDoctor) GetDoctorIntroductionPage(c *gin.Context) {
|
||||
userDoctorRequest := requests.UserDoctorRequest{}
|
||||
req := userDoctorRequest.GetDoctorIntroductionPage
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(req); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
if req.Page == 0 {
|
||||
req.Page = 1
|
||||
}
|
||||
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = 20
|
||||
}
|
||||
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, total, err := userDoctorDao.GetDoctorIntroductionPageSearch(req, req.Page, req.PageSize)
|
||||
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
res := dto.GetUserDoctorIntroductionListDto(userDoctor)
|
||||
|
||||
result := make(map[string]interface{})
|
||||
result["page"] = userDoctorRequest.GetUserDoctorPendingPage.Page
|
||||
result["page_size"] = userDoctorRequest.GetUserDoctorPendingPage.PageSize
|
||||
result["total"] = total
|
||||
result["data"] = res
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
// GetUserDoctorIntroduction 简介审核-医生详情
|
||||
func (r *UserDoctor) GetUserDoctorIntroduction(c *gin.Context) {
|
||||
id := c.Param("doctor_id")
|
||||
if id == "" {
|
||||
responses.FailWithMessage("缺少参数", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 将 id 转换为 int64 类型
|
||||
doctorId, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
responses.Fail(c)
|
||||
return
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
userDoctorService := service.UserDoctorService{}
|
||||
g, err := userDoctorService.GetUserDoctorIntroduction(doctorId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
responses.OkWithData(g, c)
|
||||
}
|
||||
|
||||
// PutDoctorIntroduction 简介审核-审核医生
|
||||
func (r *UserDoctor) PutDoctorIntroduction(c *gin.Context) {
|
||||
userDoctorRequest := requests.UserDoctorRequest{}
|
||||
if err := c.ShouldBind(&userDoctorRequest.PutDoctorIntroduction); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(userDoctorRequest.PutDoctorIntroduction); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
id := c.Param("doctor_id")
|
||||
if id == "" {
|
||||
responses.FailWithMessage("缺少参数", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 将 id 转换为 int64 类型
|
||||
doctorId, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
responses.Fail(c)
|
||||
return
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
userDoctorService := service.UserDoctorService{}
|
||||
_, err = userDoctorService.PutDoctorIntroduction(doctorId, userDoctorRequest.PutDoctorIntroduction)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
responses.Ok(c)
|
||||
}
|
||||
|
||||
72
api/dao/doctorInquiryConfigService.go
Normal file
72
api/dao/doctorInquiryConfigService.go
Normal file
@ -0,0 +1,72 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type DoctorInquiryConfigServiceDao struct {
|
||||
}
|
||||
|
||||
// GetDoctorInquiryConfigServiceByDoctorId 获取医生问诊配置数据-医生id
|
||||
func (r *DoctorInquiryConfigServiceDao) GetDoctorInquiryConfigServiceByDoctorId(doctorId int64) (m *model.DoctorInquiryConfigService, err error) {
|
||||
err = global.Db.Where("doctor_id = ?", doctorId).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetDoctorInquiryConfigServiceById 获取医生问诊配置数据-问诊配置id
|
||||
func (r *DoctorInquiryConfigServiceDao) GetDoctorInquiryConfigServiceById(ConfigServiceId int64) (m *model.DoctorInquiryConfigService, err error) {
|
||||
err = global.Db.First(&m, ConfigServiceId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DeleteDoctorInquiryConfigService 删除医生问诊配置
|
||||
func (r *DoctorInquiryConfigServiceDao) DeleteDoctorInquiryConfigService(tx *gorm.DB, maps interface{}) error {
|
||||
err := tx.Where(maps).Delete(&model.DoctorInquiryConfigService{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditDoctorInquiryConfigServiceById 修改医生问诊配置-问诊配置id
|
||||
func (r *DoctorInquiryConfigServiceDao) EditDoctorInquiryConfigServiceById(tx *gorm.DB, ConfigServiceId int64, data interface{}) error {
|
||||
err := tx.Model(&model.DoctorInquiryConfigService{}).Where("config_service_id = ?", ConfigServiceId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDoctorInquiryConfigServiceList 获取医生问诊配置列表
|
||||
func (r *DoctorInquiryConfigServiceDao) GetDoctorInquiryConfigServiceList(maps interface{}) (m []*model.DoctorInquiryConfigService, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// AddDoctorInquiryConfigService 新增医生问诊配置
|
||||
func (r *DoctorInquiryConfigServiceDao) AddDoctorInquiryConfigService(tx *gorm.DB, model *model.DoctorInquiryConfigService) (*model.DoctorInquiryConfigService, error) {
|
||||
if err := tx.Create(model).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
|
||||
// GetDoctorInquiryConfigServiceFirst 获取医生问诊配置-map-第一条
|
||||
func (r *DoctorInquiryConfigServiceDao) GetDoctorInquiryConfigServiceFirst(maps interface{}) (m *model.DoctorInquiryConfigService, err error) {
|
||||
err = global.Db.Where(maps).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
82
api/dao/doctorIntroductionRecord.go
Normal file
82
api/dao/doctorIntroductionRecord.go
Normal file
@ -0,0 +1,82 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type DoctorIntroductionRecordDao struct {
|
||||
}
|
||||
|
||||
// GetDoctorIntroductionRecordByDoctorId 获取医生简介审核数据-医生id
|
||||
func (r *DoctorIntroductionRecordDao) GetDoctorIntroductionRecordByDoctorId(doctorId int64) (m *model.DoctorIntroductionRecord, err error) {
|
||||
err = global.Db.Where("doctor_id = ?", doctorId).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetDoctorIntroductionRecordPreloadById 获取医生简介审核数据-加载全部关联-医生id
|
||||
func (r *DoctorIntroductionRecordDao) GetDoctorIntroductionRecordPreloadById(doctorId int64) (m *model.DoctorIntroductionRecord, err error) {
|
||||
err = global.Db.Preload(clause.Associations).First(&m, doctorId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// EditDoctorIntroductionRecord 修改医生简介审核
|
||||
func (r *DoctorIntroductionRecordDao) EditDoctorIntroductionRecord(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||
err := tx.Model(&model.DoctorIntroductionRecord{}).Where(maps).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditDoctorIntroductionRecordById 修改医生简介审核-医生id
|
||||
func (r *DoctorIntroductionRecordDao) EditDoctorIntroductionRecordById(tx *gorm.DB, doctorId int64, data interface{}) error {
|
||||
err := tx.Model(&model.DoctorIntroductionRecord{}).Where("doctor_id = ?", doctorId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDoctorIntroductionRecordList 获取医生简介审核列表
|
||||
func (r *DoctorIntroductionRecordDao) GetDoctorIntroductionRecordList(maps interface{}) (m []*model.DoctorIntroductionRecord, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// AddDoctorIntroductionRecord 新增医生简介审核
|
||||
func (r *DoctorIntroductionRecordDao) AddDoctorIntroductionRecord(tx *gorm.DB, model *model.DoctorIntroductionRecord) (*model.DoctorIntroductionRecord, error) {
|
||||
if err := tx.Create(model).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
|
||||
// GetDoctorIntroductionRecordLast 获取医生简介审核最后一条数据
|
||||
func (r *DoctorIntroductionRecordDao) GetDoctorIntroductionRecordLast(maps interface{}) (m *model.DoctorIntroductionRecord, err error) {
|
||||
err = global.Db.Where(maps).Last(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DeleteDoctorIntroductionRecord 删除
|
||||
func (r *DoctorIntroductionRecordDao) DeleteDoctorIntroductionRecord(tx *gorm.DB, maps interface{}) error {
|
||||
err := tx.Where(maps).Delete(&model.DoctorIntroductionRecord{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -555,3 +555,53 @@ func (r *UserDoctorDao) GetUserDoctorExportListSearch(req requests.UserDoctorExp
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetDoctorIntroductionPageSearch 简介审核-获取医生列表-分页
|
||||
func (r *UserDoctorDao) GetDoctorIntroductionPageSearch(req requests.GetDoctorIntroductionPage, page, pageSize int) (m []*model.UserDoctor, total int64, err error) {
|
||||
var totalRecords int64
|
||||
|
||||
// 构建查询条件
|
||||
query := global.Db.Model(&model.UserDoctor{}).Omit("open_id", "union_id", "wx_session_key")
|
||||
|
||||
// 用户
|
||||
query = query.Preload("User", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Omit("user_password", "salt")
|
||||
})
|
||||
|
||||
// 医院
|
||||
query = query.Preload("Hospital", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("hospital_id,hospital_name,hospital_level_name")
|
||||
})
|
||||
|
||||
// 手机号
|
||||
if req.Mobile != "" {
|
||||
subQuery := global.Db.Model(&model.User{}).
|
||||
Select("user_id").
|
||||
Where("mobile LIKE ?", "%"+req.Mobile+"%")
|
||||
|
||||
query = query.Where(gorm.Expr("user_id IN (?)", subQuery))
|
||||
}
|
||||
|
||||
// 用户名称
|
||||
if req.UserName != "" {
|
||||
query = query.Where("user_name LIKE ?", "%"+req.UserName+"%")
|
||||
}
|
||||
|
||||
// 个人简介审核状态
|
||||
if req.IntroductionStatus == nil {
|
||||
query = query.Where("introduction_status in (?)", []string{"2"})
|
||||
} else {
|
||||
query = query.Where("introduction_status = ?", req.IntroductionStatus)
|
||||
}
|
||||
|
||||
// 查询总数量
|
||||
if err := query.Count(&totalRecords).Error; err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
err = query.Scopes(model.Paginate(page, pageSize)).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
return m, totalRecords, nil
|
||||
}
|
||||
|
||||
61
api/dto/DoctorInquiryConfigService.go
Normal file
61
api/dto/DoctorInquiryConfigService.go
Normal file
@ -0,0 +1,61 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
)
|
||||
|
||||
type DoctorInquiryConfigServiceDto struct {
|
||||
ConfigServiceId string `json:"config_service_id"` // 主键id
|
||||
DoctorId string `json:"doctor_id"` // 医生id
|
||||
InquiryType int `json:"inquiry_type"` // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
InquiryMode int `json:"inquiry_mode"` // 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊 7:附赠)
|
||||
ServiceContent string `json:"service_content"` // 服务内容
|
||||
ServiceProcess string `json:"service_process"` // 服务流程
|
||||
ServicePeriod uint `json:"service_period"` // 服务周期
|
||||
ServiceRounds uint `json:"service_rounds"` // 服务回合数(0表示不限次)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
|
||||
func GetDoctorInquiryConfigServiceDto(m *model.DoctorInquiryConfigService) *DoctorInquiryConfigServiceDto {
|
||||
return &DoctorInquiryConfigServiceDto{
|
||||
ConfigServiceId: fmt.Sprintf("%d", m.ConfigServiceId),
|
||||
DoctorId: fmt.Sprintf("%d", m.DoctorId),
|
||||
InquiryType: m.InquiryType,
|
||||
InquiryMode: m.InquiryMode,
|
||||
ServiceContent: m.ServiceContent,
|
||||
ServiceProcess: m.ServiceProcess,
|
||||
ServicePeriod: m.ServicePeriod,
|
||||
ServiceRounds: m.ServiceRounds,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func GetDoctorInquiryConfigServiceListDto(m []*model.DoctorInquiryConfigService) []*DoctorInquiryConfigServiceDto {
|
||||
// 处理返回值
|
||||
responses := make([]*DoctorInquiryConfigServiceDto, len(m))
|
||||
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
response := &DoctorInquiryConfigServiceDto{
|
||||
ConfigServiceId: fmt.Sprintf("%d", v.ConfigServiceId),
|
||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||
InquiryType: v.InquiryType,
|
||||
InquiryMode: v.InquiryMode,
|
||||
ServiceContent: v.ServiceContent,
|
||||
ServiceProcess: v.ServiceProcess,
|
||||
ServicePeriod: v.ServicePeriod,
|
||||
ServiceRounds: v.ServiceRounds,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
}
|
||||
|
||||
return responses
|
||||
}
|
||||
@ -7,23 +7,24 @@ import (
|
||||
)
|
||||
|
||||
type DoctorInquiryConfigDto struct {
|
||||
InquiryConfigId string `json:"inquiry_config_id"` // 主键id
|
||||
DoctorId string `json:"doctor_id"` // 医生id
|
||||
InquiryType int `json:"inquiry_type"` // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药);NOT NULL
|
||||
InquiryMode int `json:"inquiry_mode"` // 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员);NOT NULL
|
||||
IsEnable int `json:"is_enable"` // 是否启用(0:否 1:是)
|
||||
LastEnableMethod int `json:"last_enable_method"` // 最后开启方式(1:自己 2:后台)
|
||||
WorkNumDay int `json:"work_num_day"` // 每日接诊数量
|
||||
InquiryPrice float64 `json:"inquiry_price"` // 接诊价格(专家问诊-公益问诊)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
DoctorName string `json:"doctor_name"` // 医生姓名
|
||||
MobileMask string `json:"mobile_mask"` // 医生电话(掩码)
|
||||
DepartmentCustomName string `json:"department_custom_name"` // 科室名称
|
||||
DoctorTitle *int `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
||||
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
UserDoctor *UserDoctorDto `json:"user_doctor"` // 医生数据
|
||||
DoctorInquiryTime []*DoctorInquiryTimeDto `json:"doctor_inquiry_time"` // 医生问诊时间配置
|
||||
InquiryConfigId string `json:"inquiry_config_id"` // 主键id
|
||||
DoctorId string `json:"doctor_id"` // 医生id
|
||||
InquiryType int `json:"inquiry_type"` // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药);NOT NULL
|
||||
InquiryMode int `json:"inquiry_mode"` // 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员);NOT NULL
|
||||
IsEnable int `json:"is_enable"` // 是否启用(0:否 1:是)
|
||||
LastEnableMethod int `json:"last_enable_method"` // 最后开启方式(1:自己 2:后台)
|
||||
WorkNumDay int `json:"work_num_day"` // 每日接诊数量
|
||||
InquiryPrice float64 `json:"inquiry_price"` // 接诊价格(专家问诊-公益问诊)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
DoctorName string `json:"doctor_name"` // 医生姓名
|
||||
MobileMask string `json:"mobile_mask"` // 医生电话(掩码)
|
||||
DepartmentCustomName string `json:"department_custom_name"` // 科室名称
|
||||
DoctorTitle *int `json:"doctor_title"` // 医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)
|
||||
MultiPointStatus int `json:"multi_point_status"` // 医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||
UserDoctor *UserDoctorDto `json:"user_doctor"` // 医生数据
|
||||
DoctorInquiryTime []*DoctorInquiryTimeDto `json:"doctor_inquiry_time"` // 医生问诊时间配置
|
||||
DoctorInquiryConfigService *DoctorInquiryConfigServiceDto `json:"doctor_inquiry_config_service"` // 医生问诊配置-疑难会诊
|
||||
}
|
||||
|
||||
func GetDoctorInquiryConfigDto(m *model.DoctorInquiryConfig) *DoctorInquiryConfigDto {
|
||||
@ -156,3 +157,11 @@ func (r *DoctorInquiryConfigDto) LoadDoctorInquiryTime(m []*model.DoctorInquiryT
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadDoctorInquiryConfigService 加载医生问诊配置-疑难会诊
|
||||
func (r *DoctorInquiryConfigDto) LoadDoctorInquiryConfigService(m *model.DoctorInquiryConfigService) *DoctorInquiryConfigDto {
|
||||
if m != nil {
|
||||
r.DoctorInquiryConfigService = GetDoctorInquiryConfigServiceDto(m)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ type SystemInquiryConfigDto struct {
|
||||
SystemInquiryConfigId string `json:"system_inquiry_config_id"` // 主键id
|
||||
InquiryType int `json:"inquiry_type"` // 接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)
|
||||
InquiryMode int `json:"inquiry_mode"` // 接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
DefaultWorkNumDay int `json:"default_work_num_day"` // 默认每日接诊数量
|
||||
MaxWorkNumDay int `json:"max_work_num_day"` // 每日最大接诊数量
|
||||
InquiryPrice string `json:"inquiry_price"` // 接诊价格
|
||||
MinInquiryPrice *float64 `json:"min_inquiry_price"` // 最低接诊价格(专家问诊)
|
||||
@ -32,6 +33,7 @@ func GetSystemInquiryConfigDto(m *model.SystemInquiryConfig) *SystemInquiryConfi
|
||||
SystemInquiryConfigId: fmt.Sprintf("%d", m.SystemInquiryConfigId),
|
||||
InquiryType: m.InquiryType,
|
||||
InquiryMode: m.InquiryMode,
|
||||
DefaultWorkNumDay: m.DefaultWorkNumDay,
|
||||
MaxWorkNumDay: m.MaxWorkNumDay,
|
||||
InquiryPrice: m.InquiryPrice,
|
||||
MinInquiryPrice: MinInquiryPrice,
|
||||
@ -60,6 +62,7 @@ func GetSystemInquiryConfigListDto(m []*model.SystemInquiryConfig) []*SystemInqu
|
||||
SystemInquiryConfigId: fmt.Sprintf("%d", v.SystemInquiryConfigId),
|
||||
InquiryType: v.InquiryType,
|
||||
InquiryMode: v.InquiryMode,
|
||||
DefaultWorkNumDay: v.DefaultWorkNumDay,
|
||||
MaxWorkNumDay: v.MaxWorkNumDay,
|
||||
InquiryPrice: v.InquiryPrice,
|
||||
MinInquiryPrice: MinInquiryPrice,
|
||||
|
||||
@ -17,6 +17,7 @@ type UserDto struct {
|
||||
RegisterMethod int `json:"register_method"` // 注册方式(1:微信小程序)
|
||||
Age uint `json:"age"` // 年龄
|
||||
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||||
Email string `json:"email"` // 邮箱
|
||||
Avatar string `json:"avatar"` // 头像
|
||||
IsOnline int `json:"is_online"` // 是否在线(0:不在线 1:在线)
|
||||
LoginAt model.LocalTime `json:"login_at"` // 小程序登陆时间
|
||||
@ -39,6 +40,7 @@ func GetUserDto(m *model.User) *UserDto {
|
||||
RegisterMethod: m.RegisterMethod,
|
||||
Age: m.Age,
|
||||
Sex: m.Sex,
|
||||
Email: m.Email,
|
||||
Avatar: utils.AddOssDomain(m.Avatar),
|
||||
IsOnline: m.IsOnline,
|
||||
LoginAt: m.LoginAt,
|
||||
@ -62,6 +64,7 @@ func GetMaskUserDto(m *model.User) *UserDto {
|
||||
RegisterMethod: m.RegisterMethod,
|
||||
Age: m.Age,
|
||||
Sex: m.Sex,
|
||||
Email: m.Email,
|
||||
Avatar: utils.AddOssDomain(m.Avatar),
|
||||
IsOnline: m.IsOnline,
|
||||
LoginAt: m.LoginAt,
|
||||
@ -90,6 +93,7 @@ func GetUserListDto(m []*model.User) []UserDto {
|
||||
RegisterMethod: v.RegisterMethod,
|
||||
Age: v.Age,
|
||||
Sex: v.Sex,
|
||||
Email: v.Email,
|
||||
Avatar: utils.AddOssDomain(v.Avatar),
|
||||
IsOnline: v.IsOnline,
|
||||
LoginAt: v.LoginAt,
|
||||
|
||||
@ -87,6 +87,37 @@ type UserDoctorPendingDto struct {
|
||||
UserCaCert *UserCaCertDto `json:"user_ca_cert"` // ca监管证书
|
||||
}
|
||||
|
||||
// UserDoctorIntroductionDto 简介
|
||||
type UserDoctorIntroductionDto 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:删除)
|
||||
IntroductionStatus int `json:"introduction_status"` // 个人简介审核状态(0:未审核 1:审核通过 2:审核中 3:审核失败)
|
||||
IntroductionTime model.LocalTime `json:"introduction_time"` // 审核时间
|
||||
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
|
||||
HospitalName string `json:"hospital_name"` // 医院名称
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
Age uint `json:"age"` // 年龄
|
||||
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||||
Email string `json:"email"` // 邮箱
|
||||
RegisterMethod int `json:"register_method"` // 注册方式(1:微信小程序 2:后台添加 )
|
||||
ApplyTime model.LocalTime `json:"apply_time"` // 申请时间
|
||||
BeGoodAt string `json:"be_good_at"` // 擅长
|
||||
BriefIntroduction string `json:"brief_introduction"` // 医生简介
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
User *UserDto `json:"user"` // 用户
|
||||
Hospital *HospitalDto `json:"hospital"` // 医院
|
||||
UserDoctorInfo *UserDoctorInfoDto `json:"user_doctor_info"` // 医生详情
|
||||
DoctorExpertise []*DiseaseClassExpertiseDto `json:"doctor_expertise"` // 医生专长
|
||||
}
|
||||
|
||||
func GetUserDoctorDto(m *model.UserDoctor) *UserDoctorDto {
|
||||
return &UserDoctorDto{
|
||||
DoctorID: fmt.Sprintf("%d", m.DoctorId),
|
||||
@ -259,6 +290,68 @@ func GetUserDoctorPendingListDto(m []*model.UserDoctor) []*UserDoctorDto {
|
||||
return responses
|
||||
}
|
||||
|
||||
// GetUserDoctorIntroductionListDto 简介审核列表
|
||||
func GetUserDoctorIntroductionListDto(m []*model.UserDoctor) []*UserDoctorIntroductionDto {
|
||||
// 处理返回值
|
||||
responses := make([]*UserDoctorIntroductionDto, len(m))
|
||||
|
||||
if len(m) > 0 {
|
||||
for i, v := range m {
|
||||
response := &UserDoctorIntroductionDto{
|
||||
DoctorID: fmt.Sprintf("%d", v.DoctorId),
|
||||
UserID: fmt.Sprintf("%d", v.UserId),
|
||||
UserName: v.UserName,
|
||||
Status: v.Status,
|
||||
IntroductionStatus: v.IntroductionStatus,
|
||||
IntroductionTime: v.IntroductionTime,
|
||||
DoctorTitle: v.DoctorTitle,
|
||||
DepartmentCustomName: v.DepartmentCustomName,
|
||||
HospitalID: fmt.Sprintf("%d", v.HospitalID),
|
||||
}
|
||||
|
||||
// 加载医院名称
|
||||
if v.Hospital != nil {
|
||||
response = response.LoadHospitalName(v.Hospital)
|
||||
}
|
||||
|
||||
// 加载用户属性
|
||||
if v.User != nil {
|
||||
response = response.LoadUserAttr(v.User)
|
||||
}
|
||||
|
||||
// 加载简介申请时间
|
||||
response = response.LoadDoctorIntroductionApplyTime(v.IntroductionStatus)
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
}
|
||||
|
||||
return responses
|
||||
}
|
||||
|
||||
// GetUserDoctorIntroductionDto 简介审核详情
|
||||
func GetUserDoctorIntroductionDto(m *model.UserDoctor) *UserDoctorIntroductionDto {
|
||||
return &UserDoctorIntroductionDto{
|
||||
DoctorID: fmt.Sprintf("%d", m.DoctorId),
|
||||
UserID: fmt.Sprintf("%d", m.UserId),
|
||||
UserName: m.UserName,
|
||||
Status: m.Status,
|
||||
IntroductionStatus: m.IntroductionStatus,
|
||||
IntroductionTime: m.IntroductionTime,
|
||||
Avatar: utils.AddOssDomain(m.Avatar),
|
||||
DoctorTitle: m.DoctorTitle,
|
||||
DepartmentCustomID: fmt.Sprintf("%d", m.DepartmentCustomId),
|
||||
DepartmentCustomName: m.DepartmentCustomName,
|
||||
DepartmentCustomMobile: m.DepartmentCustomMobile,
|
||||
HospitalID: fmt.Sprintf("%d", m.HospitalID),
|
||||
BeGoodAt: m.BeGoodAt,
|
||||
BriefIntroduction: m.BriefIntroduction,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
// LoadUser 加载用户
|
||||
func (r *UserDoctorDto) LoadUser(m *model.User) *UserDoctorDto {
|
||||
if m != nil {
|
||||
@ -279,6 +372,16 @@ func (r *UserDoctorPendingDto) LoadUser(m *model.User) *UserDoctorPendingDto {
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadUser 加载用户
|
||||
func (r *UserDoctorIntroductionDto) LoadUser(m *model.User) *UserDoctorIntroductionDto {
|
||||
if m != nil {
|
||||
userDto := GetUserDto(m)
|
||||
|
||||
r.User = userDto
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadUserAttr 加载用户属性
|
||||
func (r *UserDoctorDto) LoadUserAttr(m *model.User) *UserDoctorDto {
|
||||
if m != nil {
|
||||
@ -306,6 +409,14 @@ func (r *UserDoctorDto) LoadHospital(m *model.Hospital) *UserDoctorDto {
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadHospital 加载医院
|
||||
func (r *UserDoctorIntroductionDto) LoadHospital(m *model.Hospital) *UserDoctorIntroductionDto {
|
||||
if m != nil {
|
||||
r.Hospital = GetHospitalDto(m)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadDoctorInquiryType 加载医生服务类型
|
||||
func (r *UserDoctorDto) LoadDoctorInquiryType(m []*model.DoctorInquiryConfig) *UserDoctorDto {
|
||||
var inquiryTypes []string
|
||||
@ -364,6 +475,14 @@ func (r *UserDoctorDto) LoadUserDoctorInfo(m *model.UserDoctorInfo) *UserDoctorD
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadUserDoctorInfo 加载医生详情
|
||||
func (r *UserDoctorIntroductionDto) LoadUserDoctorInfo(m *model.UserDoctorInfo) *UserDoctorIntroductionDto {
|
||||
if m != nil {
|
||||
r.UserDoctorInfo = GetUserDoctorInfoDto(m)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadUserCaCert 加载医生云证书详情
|
||||
func (r *UserDoctorDto) LoadUserCaCert(m *model.UserCaCert) *UserDoctorDto {
|
||||
if m != nil {
|
||||
@ -424,3 +543,39 @@ func (r *UserDoctorDto) LoadUserOnline(m *model.User) *UserDoctorDto {
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadHospitalName 加载医院名称
|
||||
func (r *UserDoctorIntroductionDto) LoadHospitalName(m *model.Hospital) *UserDoctorIntroductionDto {
|
||||
if m != nil {
|
||||
r.HospitalName = m.HospitalName
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadUserAttr 加载用户属性
|
||||
func (r *UserDoctorIntroductionDto) LoadUserAttr(m *model.User) *UserDoctorIntroductionDto {
|
||||
if m != nil {
|
||||
r.Mobile = utils.MaskPhoneStr(m.Mobile)
|
||||
r.RegisterMethod = m.RegisterMethod
|
||||
r.Age = m.Age
|
||||
r.Sex = m.Sex
|
||||
r.Email = m.Email
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadDoctorIntroductionApplyTime 加载简介申请时间
|
||||
func (r *UserDoctorIntroductionDto) LoadDoctorIntroductionApplyTime(IntroductionStatus int) *UserDoctorIntroductionDto {
|
||||
if IntroductionStatus == 2 || IntroductionStatus == 3 {
|
||||
doctorIntroductionRecordDao := dao.DoctorIntroductionRecordDao{}
|
||||
maps := make(map[string]interface{})
|
||||
maps["doctor_id"] = r.DoctorID
|
||||
maps["introduction_status"] = IntroductionStatus
|
||||
doctorIntroductionRecord, _ := doctorIntroductionRecordDao.GetDoctorIntroductionRecordLast(maps)
|
||||
if doctorIntroductionRecord != nil {
|
||||
r.ApplyTime = doctorIntroductionRecord.CreatedAt
|
||||
}
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
37
api/model/doctorInquiryConfigService.go
Normal file
37
api/model/doctorInquiryConfigService.go
Normal file
@ -0,0 +1,37 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DoctorInquiryConfigService struct {
|
||||
ConfigServiceId int64 `gorm:"column:config_service_id;type:bigint(19);primary_key;comment:主键id" json:"config_service_id"`
|
||||
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
|
||||
InquiryType int `gorm:"column:inquiry_type;type:tinyint(1);comment:接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药);NOT NULL" json:"inquiry_type"`
|
||||
InquiryMode int `gorm:"column:inquiry_mode;type:tinyint(1);comment:接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员 6:疑难会诊 7:附赠);NOT NULL" json:"inquiry_mode"`
|
||||
ServiceContent string `gorm:"column:service_content;type:text;comment:服务内容" json:"service_content"`
|
||||
ServiceProcess string `gorm:"column:service_process;type:text;comment:服务流程" json:"service_process"`
|
||||
ServicePeriod uint `gorm:"column:service_period;type:int(10) unsigned;comment:服务周期;NOT NULL" json:"service_period"`
|
||||
ServiceRounds uint `gorm:"column:service_rounds;type:int(1) unsigned;default:0;comment:服务回合数(0表示不限次)" json:"service_rounds"`
|
||||
Model
|
||||
}
|
||||
|
||||
func (m *DoctorInquiryConfigService) TableName() string {
|
||||
return "gdxz_doctor_inquiry_config_service"
|
||||
}
|
||||
|
||||
func (m *DoctorInquiryConfigService) BeforeCreate(tx *gorm.DB) error {
|
||||
if m.ConfigServiceId == 0 {
|
||||
m.ConfigServiceId = 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
|
||||
}
|
||||
37
api/model/doctorIntroductionRecord.go
Normal file
37
api/model/doctorIntroductionRecord.go
Normal file
@ -0,0 +1,37 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DoctorIntroductionRecord struct {
|
||||
RecordId int64 `gorm:"column:record_id;type:bigint(19);primary_key;comment:主键id" json:"record_id"`
|
||||
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
|
||||
IntroductionStatus int `gorm:"column:introduction_status;type:tinyint(1);default:1;comment:个人简介审核状态(0:未审核 1:审核通过 2:审核中 3:审核失败);NOT NULL" json:"introduction_status"`
|
||||
Avatar string `gorm:"column:avatar;type:varchar(255);comment:头像" json:"avatar"`
|
||||
BeGoodAt string `gorm:"column:be_good_at;type:text;comment:擅长" json:"be_good_at"`
|
||||
BriefIntroduction string `gorm:"column:brief_introduction;type:text;comment:医生简介" json:"brief_introduction"`
|
||||
ExpertiseIds string `gorm:"column:expertise_ids;type:varchar(1000);comment:专长id,逗号分隔" json:"expertise_ids"`
|
||||
Model
|
||||
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||
}
|
||||
|
||||
func (m *DoctorIntroductionRecord) TableName() string {
|
||||
return "gdxz_doctor_introduction_record"
|
||||
}
|
||||
|
||||
func (m *DoctorIntroductionRecord) BeforeCreate(tx *gorm.DB) error {
|
||||
if m.RecordId == 0 {
|
||||
m.RecordId = 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
|
||||
}
|
||||
@ -11,6 +11,7 @@ type SystemInquiryConfig struct {
|
||||
SystemInquiryConfigId int64 `gorm:"column:system_inquiry_config_id;type:bigint(19);primary_key;comment:主键id" json:"system_inquiry_config_id"`
|
||||
InquiryType int `gorm:"column:inquiry_type;type:tinyint(1);comment:接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测)" json:"inquiry_type"`
|
||||
InquiryMode int `gorm:"column:inquiry_mode;type:tinyint(1);default:1;comment:接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)" json:"inquiry_mode"`
|
||||
DefaultWorkNumDay int `gorm:"column:default_work_num_day;type:int(10);default:0;comment:默认每日接诊数量" json:"default_work_num_day"`
|
||||
MaxWorkNumDay int `gorm:"column:max_work_num_day;type:int(11);default:0;comment:每日最大接诊数量" json:"max_work_num_day"`
|
||||
InquiryPrice string `gorm:"column:inquiry_price;type:varchar(255);comment:接诊价格" json:"inquiry_price"`
|
||||
MinInquiryPrice float64 `gorm:"column:min_inquiry_price;type:decimal(10,2);comment:最低接诊价格(专家问诊)" json:"min_inquiry_price"`
|
||||
|
||||
@ -20,6 +20,7 @@ type User struct {
|
||||
RegisterMethod int `gorm:"column:register_method;type:tinyint(1);comment:注册方式(1:微信小程序 )" json:"register_method"`
|
||||
Age uint `gorm:"column:age;type:int(10) unsigned;comment:年龄" json:"age"`
|
||||
Sex int `gorm:"column:sex;type:tinyint(1);default:0;comment:性别(0:未知 1:男 2:女)" json:"sex"`
|
||||
Email string `gorm:"column:email;type:varchar(100);comment:邮箱" json:"email"`
|
||||
Avatar string `gorm:"column:avatar;type:varchar(255);comment:头像" json:"avatar"`
|
||||
IsOnline int `gorm:"column:is_online;type:tinyint(1);default:0;comment:是否在线(0:不在线 1:在线)" json:"is_online"`
|
||||
LoginAt LocalTime `gorm:"column:login_at;type:datetime;comment:小程序登陆时间" json:"login_at"`
|
||||
|
||||
@ -22,6 +22,8 @@ type UserDoctor struct {
|
||||
MultiPointStatus int `gorm:"column:multi_point_status;type:tinyint(1);default:0;comment:医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)" json:"multi_point_status"`
|
||||
MultiPointTime LocalTime `gorm:"column:multi_point_time;type:datetime;comment:审核时间" json:"multi_point_time"`
|
||||
MultiPointFailReason string `gorm:"column:multi_point_fail_reason;type:varchar(255);comment:多点执业认证失败原因" json:"multi_point_fail_reason"`
|
||||
IntroductionStatus int `gorm:"column:introduction_status;type:tinyint(1);default:0;comment:个人简介审核状态(0:未审核 1:审核通过 2:审核中 3:审核失败)" json:"introduction_status"`
|
||||
IntroductionTime LocalTime `gorm:"column:introduction_time;type:datetime;comment:审核时间" json:"introduction_time"`
|
||||
IsBindBank int `gorm:"column:is_bind_bank;type:tinyint(1);default:0;comment:是否已绑定结算银行卡(0:否 1:是);NOT NULL" json:"is_bind_bank"`
|
||||
IsRecommend int `gorm:"column:is_recommend;type:tinyint(1);default:0;comment:是否首页推荐(0:否 1:是)" json:"is_recommend"`
|
||||
Avatar string `gorm:"column:avatar;type:varchar(255);comment:头像" json:"avatar"`
|
||||
|
||||
@ -22,13 +22,14 @@ type GetDoctorInquiryConfigPage struct {
|
||||
|
||||
// PutDoctorInquiryConfig 修改医生问诊配置
|
||||
type PutDoctorInquiryConfig struct {
|
||||
DoctorId string `json:"doctor_id" form:"doctor_id" validate:"required"` // 医生id
|
||||
InquiryType int `json:"inquiry_type" form:"inquiry_type" validate:"required,oneof=1 2 3 4 5" label:"问诊类型"` // 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测
|
||||
InquiryMode int `json:"inquiry_mode" form:"inquiry_mode" validate:"required,oneof=1 2 3 4 5" label:"问诊方式"` // 1:图文 2:视频 3:语音 4:电话 5:会员
|
||||
WorkNumDay int `json:"work_num_day" label:"每日接诊数量"`
|
||||
InquiryPrice float64 `json:"inquiry_price" label:"接诊价格"`
|
||||
IsEnable int `json:"is_enable" form:"is_enable" validate:"oneof=0 1" label:"是否启用"` // 0:否 1:是
|
||||
DoctorInquiryTime []*doctorInquiryTime `json:"doctor_inquiry_time" form:"doctor_inquiry_time" label:"医生问诊配置-时间配置"`
|
||||
DoctorId string `json:"doctor_id" form:"doctor_id" validate:"required"` // 医生id
|
||||
InquiryType int `json:"inquiry_type" form:"inquiry_type" validate:"required,oneof=1 2 3 4 5" label:"问诊类型"` // 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测
|
||||
InquiryMode int `json:"inquiry_mode" form:"inquiry_mode" validate:"required,oneof=1 2 3 4 5 6" label:"问诊方式"` // 1:图文 2:视频 3:语音 4:电话 5:会员
|
||||
WorkNumDay int `json:"work_num_day" form:"work_num_day" label:"每日接诊数量"`
|
||||
InquiryPrice float64 `json:"inquiry_price" form:"inquiry_price" label:"接诊价格"`
|
||||
IsEnable int `json:"is_enable" form:"is_enable" validate:"oneof=0 1" label:"是否启用"` // 0:否 1:是
|
||||
DoctorInquiryTime []*doctorInquiryTime `json:"doctor_inquiry_time" form:"doctor_inquiry_time" label:"医生问诊配置-时间配置"`
|
||||
DoctorInquiryConfigService *DoctorInquiryConfigService `json:"doctor_inquiry_config_service" form:"doctor_inquiry_config_service" label:"医生问诊服务配置-疑难会诊"`
|
||||
}
|
||||
|
||||
// doctorInquiryTime 医生问诊配置-时间配置
|
||||
@ -38,15 +39,24 @@ type doctorInquiryTime struct {
|
||||
EndTime string `json:"end_time" form:"end_time" label:"结束时间"`
|
||||
}
|
||||
|
||||
// DoctorInquiryConfigService 医生问诊服务配置-疑难会诊
|
||||
type DoctorInquiryConfigService struct {
|
||||
ServiceContent string `json:"service_content" form:"service_content" label:"服务内容"`
|
||||
ServiceProcess string `json:"service_process" form:"service_process" label:"服务流程"`
|
||||
ServicePeriod uint `json:"service_period" form:"service_period" label:"服务周期"`
|
||||
ServiceRounds uint `json:"service_rounds" form:"service_rounds" label:"服务回合数"` // (0表示不限次)
|
||||
}
|
||||
|
||||
// AddDoctorInquiryConfig 新增医生问诊配置
|
||||
type AddDoctorInquiryConfig struct {
|
||||
DoctorId string `json:"doctor_id" form:"doctor_id" validate:"required"` // 医生id
|
||||
InquiryType int `json:"inquiry_type" form:"inquiry_type" validate:"required,oneof=1 2 3 4 5" label:"问诊类型"` // 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测
|
||||
InquiryMode int `json:"inquiry_mode" form:"inquiry_mode" validate:"required,oneof=1 2 3 4 5" label:"问诊方式"` // 1:图文 2:视频 3:语音 4:电话 5:会员
|
||||
WorkNumDay int `json:"work_num_day" label:"每日接诊数量"`
|
||||
InquiryPrice float64 `json:"inquiry_price" label:"接诊价格"`
|
||||
IsEnable int `json:"is_enable" form:"is_enable" validate:"oneof=0 1" label:"是否启用"` // 0:否 1:是
|
||||
DoctorInquiryTime []*doctorInquiryTime `json:"doctor_inquiry_time" form:"doctor_inquiry_time" label:"医生问诊配置-时间配置"`
|
||||
DoctorId string `json:"doctor_id" form:"doctor_id" validate:"required"` // 医生id
|
||||
InquiryType int `json:"inquiry_type" form:"inquiry_type" validate:"required,oneof=1 2 3 4 5" label:"问诊类型"` // 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测
|
||||
InquiryMode int `json:"inquiry_mode" form:"inquiry_mode" validate:"required,oneof=1 2 3 4 5 6" label:"问诊方式"`
|
||||
WorkNumDay int `json:"work_num_day" label:"每日接诊数量"`
|
||||
InquiryPrice float64 `json:"inquiry_price" label:"接诊价格"`
|
||||
IsEnable int `json:"is_enable" form:"is_enable" validate:"oneof=0 1" label:"是否启用"` // 0:否 1:是
|
||||
DoctorInquiryTime []*doctorInquiryTime `json:"doctor_inquiry_time" form:"doctor_inquiry_time" label:"医生问诊配置-时间配置"`
|
||||
DoctorInquiryConfigService *DoctorInquiryConfigService `json:"doctor_inquiry_config_service" form:"doctor_inquiry_config_service" label:"医生问诊服务配置-疑难会诊"`
|
||||
}
|
||||
|
||||
// GetSystemInquiryConfigPage 获取系统问诊配置列表-分页
|
||||
@ -59,6 +69,7 @@ type GetSystemInquiryConfigPage struct {
|
||||
|
||||
// PutSystemInquiryConfig 修改系统问诊配置
|
||||
type PutSystemInquiryConfig struct {
|
||||
DefaultWorkNumDay int `json:"default_work_num_day" label:"默认每日接诊数量"`
|
||||
MaxWorkNumDay int `json:"max_work_num_day" label:"每日最大接诊数量"`
|
||||
InquiryPrice string `json:"inquiry_price" label:"接诊价格"`
|
||||
MinInquiryPrice float64 `json:"min_inquiry_price" label:"最低接诊价格"`
|
||||
@ -77,5 +88,5 @@ type SystemInquiryTime struct {
|
||||
// GetSystemInquiryConfigDetail 系统问诊配置详情-条件
|
||||
type GetSystemInquiryConfigDetail struct {
|
||||
InquiryType *int `json:"inquiry_type" form:"inquiry_type" validate:"required,oneof=1 2 3 4 5" label:"问诊类型"` // 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测
|
||||
InquiryMode *int `json:"inquiry_mode" form:"inquiry_mode" validate:"required,oneof=1 2 3 4 5" label:"问诊方式"` // 1:图文 2:视频 3:语音 4:电话 5:会员
|
||||
InquiryMode *int `json:"inquiry_mode" form:"inquiry_mode" validate:"required,oneof=1 2 3 4 5 6" label:"问诊方式"`
|
||||
}
|
||||
|
||||
@ -36,7 +36,8 @@ type GetOrderInquiryPage struct {
|
||||
|
||||
// CancelOrderInquiry 取消问诊订单
|
||||
type CancelOrderInquiry struct {
|
||||
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" validate:"required" label:"取消订单备注"`
|
||||
RefundAmount float64 `json:"refund_amount" form:"refund_amount" validate:"required" label:"退款金额"`
|
||||
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" validate:"required" label:"取消订单备注"`
|
||||
}
|
||||
|
||||
// GetOrderInquiryRecordPage 获取问诊记录列表-分页
|
||||
|
||||
@ -69,18 +69,20 @@ type AddProduct struct {
|
||||
AvailableDays float64 `json:"available_days" form:"available_days" label:"可用天数" validate:"required"` // 可用天数(3)
|
||||
ProductRemarks string `json:"product_remarks" form:"product_remarks" label:"商品备注" validate:"required"` // 商品备注
|
||||
ProductStatus *int `json:"product_status" form:"product_status" label:"商品状态" validate:"required,oneof=1 2"` // 商品状态(1:正常 2:下架)
|
||||
PrescriptionNum int `json:"prescription_num" form:"prescription_num" label:"处方可开具的数量" validate:"required"` // 处方可开具的数量
|
||||
}
|
||||
|
||||
// PutProduct 修改商品
|
||||
type PutProduct struct {
|
||||
MnemonicCode string `json:"mnemonic_code" form:"mnemonic_code" label:"商品助记码"` // 商品助记码(首字母简拼)
|
||||
ProductCoverImg string `json:"product_cover_img" form:"product_cover_img" label:"商品封面图"` // 商品封面图
|
||||
SingleUnit string `json:"single_unit" form:"single_unit" label:"单次剂量" validate:"required"` // 单次剂量(例:1次1包)
|
||||
SingleUse string `json:"single_use" form:"single_use" label:"单次用法" validate:"required"` // 单次用法(例:口服)
|
||||
PackagingUnit string `json:"packaging_unit" form:"packaging_unit" label:"基本包装单位" validate:"required"` // 基本包装单位(例:盒/瓶)
|
||||
FrequencyUse string `json:"frequency_use" form:"frequency_use" label:"使用频率" validate:"required"` // 使用频率(例:1天3次)
|
||||
AvailableDays float64 `json:"available_days" form:"available_days" label:"可用天数" validate:"required"` // 可用天数(3)
|
||||
ProductRemarks string `json:"product_remarks" form:"product_remarks" label:"商品备注" validate:"required"` // 商品备注
|
||||
MnemonicCode string `json:"mnemonic_code" form:"mnemonic_code" label:"商品助记码"` // 商品助记码(首字母简拼)
|
||||
ProductCoverImg string `json:"product_cover_img" form:"product_cover_img" label:"商品封面图"` // 商品封面图
|
||||
SingleUnit string `json:"single_unit" form:"single_unit" label:"单次剂量" validate:"required"` // 单次剂量(例:1次1包)
|
||||
SingleUse string `json:"single_use" form:"single_use" label:"单次用法" validate:"required"` // 单次用法(例:口服)
|
||||
PackagingUnit string `json:"packaging_unit" form:"packaging_unit" label:"基本包装单位" validate:"required"` // 基本包装单位(例:盒/瓶)
|
||||
FrequencyUse string `json:"frequency_use" form:"frequency_use" label:"使用频率" validate:"required"` // 使用频率(例:1天3次)
|
||||
AvailableDays float64 `json:"available_days" form:"available_days" label:"可用天数" validate:"required"` // 可用天数(3)
|
||||
ProductRemarks string `json:"product_remarks" form:"product_remarks" label:"商品备注" validate:"required"` // 商品备注
|
||||
PrescriptionNum int `json:"prescription_num" form:"prescription_num" label:"处方可开具的数量" validate:"required"` // 处方可开具的数量
|
||||
}
|
||||
|
||||
// PutProductStatus 修改商品状态(上/下架)
|
||||
|
||||
@ -12,6 +12,8 @@ type UserDoctorRequest struct {
|
||||
GetUserDoctorBankCardPage // 获取医生银行卡列表-分页
|
||||
UserDoctorExportList // 医生列表-导出
|
||||
UserDoctorBankCardExportList // 医生银行卡列表-导出
|
||||
GetDoctorIntroductionPage // 简介审核-获取医生列表-分页
|
||||
PutDoctorIntroduction // 简介审核-审核医生
|
||||
}
|
||||
|
||||
// GetUserDoctorPage 获取医生列表-分页
|
||||
@ -183,3 +185,21 @@ type UserDoctorBankCardExportList struct {
|
||||
BankCardCode string `json:"bank_card_code" form:"bank_card_code" label:"银行卡号"`
|
||||
BankName string `json:"bank_name" form:"bank_name" label:"银行名称"`
|
||||
}
|
||||
|
||||
// GetDoctorIntroductionPage 简介审核-获取医生列表-分页
|
||||
type GetDoctorIntroductionPage struct {
|
||||
Page int `json:"page" form:"page" label:"页码"`
|
||||
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||
Mobile string `json:"mobile" form:"mobile" label:"手机号"`
|
||||
UserName string `json:"user_name" form:"user_name" label:"用户名"`
|
||||
IntroductionStatus *int `json:"introduction_status" form:"introduction_status" label:"个人简介审核状态"` // (0:未审核 1:审核通过 2:审核中 3:审核失败)
|
||||
}
|
||||
|
||||
// PutDoctorIntroduction 简介审核-审核医生
|
||||
type PutDoctorIntroduction struct {
|
||||
IntroductionStatus int `json:"introduction_status" form:"introduction_status" validate:"required,oneof=1 3" label:"个人简介审核状态"` // (0:未审核 1:审核通过 2:审核中 3:审核失败)
|
||||
AvatarReason string `json:"avatar_reason" form:"avatar_reason" label:"头像失败原因"`
|
||||
BriefIntroductionReason string `json:"brief_introduction_reason" form:"brief_introduction_reason" label:"医生简介失败原因"`
|
||||
BeGoodAtReason string `json:"be_good_at_reason" form:"be_good_at_reason" label:"擅长失败原因"`
|
||||
DoctorExpertiseReason string `json:"doctor_expertise_reason" form:"doctor_expertise_reason" label:"专长失败原因"`
|
||||
}
|
||||
|
||||
@ -382,6 +382,19 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
||||
// 获取医生账户关联订单列表-分页
|
||||
accountGroup.GET("/order", api.OrderInquiry.GetOrderInquiryForAccountPage)
|
||||
}
|
||||
|
||||
// 简介审核列表
|
||||
doctorIntroductionGroup := doctorGroup.Group("/introduction")
|
||||
{
|
||||
// 简介审核-获取医生列表-分页
|
||||
doctorIntroductionGroup.GET("", api.UserDoctor.GetDoctorIntroductionPage)
|
||||
|
||||
// 简介审核-医生详情
|
||||
doctorIntroductionGroup.GET("/:doctor_id", api.UserDoctor.GetUserDoctorIntroduction)
|
||||
|
||||
// 简介审核-审核医生
|
||||
doctorIntroductionGroup.PUT("/:doctor_id", api.UserDoctor.PutDoctorIntroduction)
|
||||
}
|
||||
}
|
||||
|
||||
// 订单管理
|
||||
|
||||
@ -115,14 +115,14 @@ func (r *DoctorInquiryConfigService) GetDoctorInquiryConfig(inquiryConfigId int6
|
||||
// 获取医生问诊配置
|
||||
doctorInquiryConfig, err := doctorInquiryConfigDao.GetDoctorInquiryConfigById(inquiryConfigId)
|
||||
if err != nil || doctorInquiryConfig == nil {
|
||||
return nil, errors.New(err.Error())
|
||||
return nil, errors.New("获取失败")
|
||||
}
|
||||
|
||||
// 获取医生数据
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorById(doctorInquiryConfig.DoctorId)
|
||||
if err != nil || userDoctor == nil {
|
||||
return nil, errors.New(err.Error())
|
||||
return nil, errors.New("获取失败")
|
||||
}
|
||||
|
||||
// 获取医生医院数据
|
||||
@ -137,7 +137,7 @@ func (r *DoctorInquiryConfigService) GetDoctorInquiryConfig(inquiryConfigId int6
|
||||
maps["inquiry_mode"] = doctorInquiryConfig.InquiryMode
|
||||
systemInquiryConfig, err := systemInquiryConfigDao.GetSystemInquiryConfig(maps)
|
||||
if err != nil || systemInquiryConfig == nil {
|
||||
return nil, errors.New(err.Error())
|
||||
return nil, errors.New("获取失败")
|
||||
}
|
||||
|
||||
// 获取医生问诊时间
|
||||
@ -165,6 +165,20 @@ func (r *DoctorInquiryConfigService) GetDoctorInquiryConfig(inquiryConfigId int6
|
||||
res.LoadDoctorInquiryTime(doctorInquiryTimes)
|
||||
}
|
||||
|
||||
// 获取医生问诊配置-疑难问诊-服务设置
|
||||
if doctorInquiryConfig.InquiryType == 1 && doctorInquiryConfig.InquiryMode == 6 {
|
||||
doctorInquiryConfigServiceDao := dao.DoctorInquiryConfigServiceDao{}
|
||||
|
||||
maps = make(map[string]interface{})
|
||||
maps["doctor_id"] = doctorInquiryConfig.DoctorId
|
||||
maps["inquiry_type"] = doctorInquiryConfig.InquiryType
|
||||
maps["inquiry_mode"] = doctorInquiryConfig.InquiryMode
|
||||
doctorInquiryConfigService, err := doctorInquiryConfigServiceDao.GetDoctorInquiryConfigServiceFirst(maps)
|
||||
if doctorInquiryConfigService != nil && err == nil {
|
||||
res.LoadDoctorInquiryConfigService(doctorInquiryConfigService)
|
||||
}
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@ -244,6 +258,13 @@ func (r *DoctorInquiryConfigService) PutDoctorInquiryConfig(inquiryConfigId int6
|
||||
}
|
||||
}
|
||||
|
||||
// 验证医生服务设置-疑难会诊
|
||||
if doctorInquiryConfig.InquiryType == 1 && doctorInquiryConfig.InquiryMode == 6 {
|
||||
if req.DoctorInquiryConfigService == nil {
|
||||
return false, errors.New("请填写疑难会诊服务设置")
|
||||
}
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
@ -330,6 +351,44 @@ func (r *DoctorInquiryConfigService) PutDoctorInquiryConfig(inquiryConfigId int6
|
||||
}
|
||||
}
|
||||
|
||||
// 修改医生服务设置-疑难会诊
|
||||
if doctorInquiryConfig.InquiryType == 1 && doctorInquiryConfig.InquiryMode == 6 {
|
||||
// 获取医生服务设置-疑难会诊
|
||||
doctorInquiryConfigServiceDao := dao.DoctorInquiryConfigServiceDao{}
|
||||
|
||||
maps = make(map[string]interface{})
|
||||
maps["doctor_id"] = doctorInquiryConfig.DoctorId
|
||||
maps["inquiry_type"] = doctorInquiryConfig.InquiryType
|
||||
maps["inquiry_mode"] = doctorInquiryConfig.InquiryMode
|
||||
doctorInquiryConfigService, err := doctorInquiryConfigServiceDao.GetDoctorInquiryConfigServiceFirst(maps)
|
||||
if doctorInquiryConfigService != nil && err != nil {
|
||||
doctorInquiryConfigServiceData := make(map[string]interface{})
|
||||
|
||||
if req.DoctorInquiryConfigService.ServiceContent != doctorInquiryConfigService.ServiceContent {
|
||||
doctorInquiryConfigServiceData["service_content"] = req.DoctorInquiryConfigService.ServiceContent
|
||||
}
|
||||
|
||||
if req.DoctorInquiryConfigService.ServiceProcess != doctorInquiryConfigService.ServiceProcess {
|
||||
doctorInquiryConfigServiceData["service_process"] = req.DoctorInquiryConfigService.ServiceProcess
|
||||
}
|
||||
|
||||
if req.DoctorInquiryConfigService.ServicePeriod != doctorInquiryConfigService.ServicePeriod {
|
||||
doctorInquiryConfigServiceData["service_period"] = req.DoctorInquiryConfigService.ServicePeriod
|
||||
}
|
||||
|
||||
if req.DoctorInquiryConfigService.ServiceRounds != doctorInquiryConfigService.ServiceRounds {
|
||||
doctorInquiryConfigServiceData["service_rounds"] = req.DoctorInquiryConfigService.ServiceRounds
|
||||
}
|
||||
|
||||
err := doctorInquiryConfigServiceDao.EditDoctorInquiryConfigServiceById(tx, doctorInquiryConfigService.ConfigServiceId, doctorInquiryConfigServiceData)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("修改失败")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
return true, nil
|
||||
}
|
||||
@ -503,6 +562,27 @@ func (r *DoctorInquiryConfigService) AddDoctorInquiryConfig(req requests.AddDoct
|
||||
}
|
||||
}
|
||||
|
||||
// 新增医生服务设置-疑难会诊
|
||||
if req.InquiryType == 1 || req.InquiryMode == 6 {
|
||||
doctorInquiryConfigServiceDao := dao.DoctorInquiryConfigServiceDao{}
|
||||
|
||||
doctorInquiryConfigService := &model.DoctorInquiryConfigService{
|
||||
DoctorId: doctorId,
|
||||
InquiryType: req.InquiryType,
|
||||
InquiryMode: req.InquiryMode,
|
||||
ServiceContent: req.DoctorInquiryConfigService.ServiceContent,
|
||||
ServiceProcess: req.DoctorInquiryConfigService.ServiceProcess,
|
||||
ServicePeriod: req.DoctorInquiryConfigService.ServicePeriod,
|
||||
ServiceRounds: req.DoctorInquiryConfigService.ServiceRounds,
|
||||
}
|
||||
|
||||
doctorInquiryConfigService, err = doctorInquiryConfigServiceDao.AddDoctorInquiryConfigService(tx, doctorInquiryConfigService)
|
||||
if err != nil || doctorInquiryConfigService == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
return true, nil
|
||||
}
|
||||
@ -521,7 +601,11 @@ func (r *SystemInquiryConfigService) PutSystemInquiryConfig(systemInquiryConfigI
|
||||
return false, errors.New("每日最大接诊数量应大于0")
|
||||
}
|
||||
|
||||
if req.Duration == 0 {
|
||||
if req.DefaultWorkNumDay < 0 {
|
||||
return false, errors.New("默认每日接诊数量应大于等于0")
|
||||
}
|
||||
|
||||
if req.Duration == 0 && systemInquiryConfig.InquiryType != 1 && systemInquiryConfig.InquiryMode != 6 {
|
||||
return false, errors.New("沟通时长应大于0")
|
||||
}
|
||||
|
||||
@ -541,6 +625,14 @@ func (r *SystemInquiryConfigService) PutSystemInquiryConfig(systemInquiryConfigI
|
||||
if req.InquiryPrice == "" {
|
||||
return false, errors.New("请设置问诊价格")
|
||||
}
|
||||
} else if systemInquiryConfig.InquiryType == 1 && systemInquiryConfig.InquiryMode == 2 {
|
||||
if req.MaxInquiryPrice == 0 {
|
||||
return false, errors.New("最高接诊价格应大于0")
|
||||
}
|
||||
} else if systemInquiryConfig.InquiryType == 1 && systemInquiryConfig.InquiryMode == 6 {
|
||||
if req.MaxInquiryPrice == 0 {
|
||||
return false, errors.New("最高接诊价格应大于0")
|
||||
}
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
@ -557,6 +649,10 @@ func (r *SystemInquiryConfigService) PutSystemInquiryConfig(systemInquiryConfigI
|
||||
systemInquiryConfigData["max_work_num_day"] = req.MaxWorkNumDay
|
||||
}
|
||||
|
||||
if req.DefaultWorkNumDay != systemInquiryConfig.DefaultWorkNumDay {
|
||||
systemInquiryConfigData["default_work_num_day"] = req.DefaultWorkNumDay
|
||||
}
|
||||
|
||||
if req.TimesNumber != systemInquiryConfig.TimesNumber {
|
||||
systemInquiryConfigData["times_number"] = req.TimesNumber
|
||||
}
|
||||
|
||||
@ -70,6 +70,11 @@ func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry
|
||||
return false, errors.New("订单未支付,无需取消")
|
||||
}
|
||||
|
||||
// 检测退款金额
|
||||
if req.RefundAmount > orderInquiry.PaymentAmountTotal {
|
||||
return false, errors.New("退款金额不可超过实付金额")
|
||||
}
|
||||
|
||||
// 订单完成时间预留5分钟进行操作
|
||||
if !orderInquiry.CompleteTime.IsEmpty() {
|
||||
// 计算三天后的时间
|
||||
@ -113,6 +118,7 @@ func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry
|
||||
OutTradeNo: orderInquiry.InquiryNo,
|
||||
OutRefundNo: inquiryRefundNo,
|
||||
Reason: "客服取消",
|
||||
RefundAmount: int64(req.RefundAmount * 100),
|
||||
PaymentAmountTotal: int64(orderInquiry.PaymentAmountTotal * 100),
|
||||
NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.PatientInquiryRefundNotifyUrl,
|
||||
}
|
||||
@ -196,7 +202,7 @@ func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry
|
||||
InquiryRefundNo: inquiryRefundNo,
|
||||
RefundId: refundId,
|
||||
InquiryRefundStatus: inquiryRefundStatus,
|
||||
RefundTotal: orderInquiry.PaymentAmountTotal,
|
||||
RefundTotal: req.RefundAmount,
|
||||
RefundReason: req.CancelRemarks,
|
||||
SuccessTime: model.LocalTime(successTime),
|
||||
}
|
||||
|
||||
@ -167,6 +167,7 @@ func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct
|
||||
OutTradeNo: orderProduct.OrderProductNo,
|
||||
OutRefundNo: refundNo,
|
||||
Reason: "客服取消",
|
||||
RefundAmount: int64(orderProduct.PaymentAmountTotal * 100),
|
||||
PaymentAmountTotal: int64(orderProduct.PaymentAmountTotal * 100),
|
||||
NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.PatientProductRefundNotifyUrl,
|
||||
}
|
||||
|
||||
@ -138,6 +138,7 @@ func (r *ProductService) AddProduct(userId string, req requests.AddProduct) (boo
|
||||
FrequencyUse: req.FrequencyUse,
|
||||
AvailableDays: req.AvailableDays,
|
||||
ProductRemarks: req.ProductRemarks,
|
||||
PrescriptionNum: req.PrescriptionNum,
|
||||
}
|
||||
|
||||
product, err = productDao.AddProduct(tx, product)
|
||||
@ -229,6 +230,11 @@ func (r *ProductService) PutProduct(productId int64, req requests.PutProduct) (b
|
||||
productData["product_remarks"] = req.ProductRemarks
|
||||
}
|
||||
|
||||
// 处方可开具的数量
|
||||
if product.PrescriptionNum != req.PrescriptionNum {
|
||||
productData["prescription_num"] = req.PrescriptionNum
|
||||
}
|
||||
|
||||
// 商品封面
|
||||
if req.ProductCoverImg != "" {
|
||||
productCoverImg := utils.RemoveOssDomain(req.ProductCoverImg)
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/config"
|
||||
"hospital-admin-api/extend/aliyun"
|
||||
"hospital-admin-api/extend/ca"
|
||||
"hospital-admin-api/extend/tencentIm"
|
||||
"hospital-admin-api/extend/verifyDun"
|
||||
@ -1210,6 +1211,8 @@ func (r *UserDoctorService) PutUserDoctorPending(doctorId int64, req requests.Pu
|
||||
|
||||
userDoctorData["iden_auth_status"] = 1
|
||||
userDoctorInfoData["qualification_cert_num"] = req.QualificationCertNum
|
||||
userDoctorData["introduction_status"] = 1
|
||||
userDoctorData["introduction_time"] = time.Now().Format("2006-01-02 15:04:05")
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
@ -1600,3 +1603,319 @@ func (r *UserDoctorService) GetDoctorEstimateIncome(doctorId int64) (g float64,
|
||||
result, _ := estimateIncome.Float64()
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetUserDoctorIntroduction 简介审核-医生详情
|
||||
func (r *UserDoctorService) GetUserDoctorIntroduction(doctorId int64) (g *dto.UserDoctorIntroductionDto, err error) {
|
||||
// 获取医生数据
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorPreloadById(doctorId)
|
||||
if err != nil || userDoctor == nil {
|
||||
return nil, errors.New("用户数据错误")
|
||||
}
|
||||
|
||||
if userDoctor.IntroductionStatus != 2 {
|
||||
return nil, errors.New("非审核数据")
|
||||
}
|
||||
|
||||
// 获取简介审核数据
|
||||
doctorIntroductionRecordDao := dao.DoctorIntroductionRecordDao{}
|
||||
doctorIntroductionRecord, err := doctorIntroductionRecordDao.GetDoctorIntroductionRecordByDoctorId(userDoctor.DoctorId)
|
||||
if err != nil || doctorIntroductionRecord == nil {
|
||||
return nil, errors.New("用户数据错误")
|
||||
}
|
||||
|
||||
// 处理医生专长
|
||||
var expertiseIds []string
|
||||
if doctorIntroductionRecord.ExpertiseIds != "" {
|
||||
expertiseIds = strings.Split(doctorIntroductionRecord.ExpertiseIds, ",")
|
||||
} else {
|
||||
// 获取医生专长
|
||||
userDoctorService := UserDoctorService{}
|
||||
doctorExpertise, err := userDoctorService.GetUserDoctorExpertiseByDoctorId(doctorId)
|
||||
if err != nil {
|
||||
return nil, errors.New("用户数据错误")
|
||||
}
|
||||
|
||||
for _, expertise := range doctorExpertise {
|
||||
expertiseIds = append(expertiseIds, expertise.ExpertiseId)
|
||||
}
|
||||
}
|
||||
|
||||
var diseaseClassExpertiseDto []*dto.DiseaseClassExpertiseDto
|
||||
diseaseClassExpertiseDao := dao.DiseaseClassExpertiseDao{}
|
||||
|
||||
if len(expertiseIds) > 0 {
|
||||
for _, id := range expertiseIds {
|
||||
// 将 id 转换为 int64 类型
|
||||
expertiseId, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
return nil, errors.New("专长数据错误")
|
||||
}
|
||||
|
||||
diseaseClassExpertise, err := diseaseClassExpertiseDao.GetDiseaseClassExpertiseById(expertiseId)
|
||||
if err != nil || diseaseClassExpertise == nil {
|
||||
return nil, errors.New("专长数据错误")
|
||||
}
|
||||
|
||||
res := dto.GetDiseaseClassExpertiseDto(diseaseClassExpertise)
|
||||
|
||||
diseaseClassExpertiseDto = append(diseaseClassExpertiseDto, res)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
g = dto.GetUserDoctorIntroductionDto(userDoctor)
|
||||
|
||||
if doctorIntroductionRecord.Avatar != "" {
|
||||
g.Avatar = utils.AddOssDomain(doctorIntroductionRecord.Avatar)
|
||||
}
|
||||
|
||||
if doctorIntroductionRecord.BeGoodAt != "" {
|
||||
g.BeGoodAt = doctorIntroductionRecord.BeGoodAt
|
||||
}
|
||||
|
||||
if doctorIntroductionRecord.BriefIntroduction != "" {
|
||||
g.BriefIntroduction = doctorIntroductionRecord.BriefIntroduction
|
||||
}
|
||||
|
||||
// 加载用户
|
||||
g.LoadUser(userDoctor.User)
|
||||
|
||||
// 加载医院
|
||||
g.LoadHospital(userDoctor.Hospital)
|
||||
|
||||
// 加载医生专长
|
||||
g.DoctorExpertise = diseaseClassExpertiseDto
|
||||
|
||||
// 加载医生详情
|
||||
g.LoadUserDoctorInfo(userDoctor.UserDoctorInfo)
|
||||
|
||||
return g, nil
|
||||
}
|
||||
|
||||
// PutDoctorIntroduction 简介审核-审核医生
|
||||
func (r *UserDoctorService) PutDoctorIntroduction(doctorId int64, req requests.PutDoctorIntroduction) (bool, error) {
|
||||
// 获取医生数据
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorById(doctorId)
|
||||
if err != nil || userDoctor == nil {
|
||||
return false, errors.New("医生数据错误")
|
||||
}
|
||||
|
||||
if userDoctor.IntroductionStatus == req.IntroductionStatus {
|
||||
return false, errors.New("请勿重复操作")
|
||||
}
|
||||
|
||||
if userDoctor.IntroductionStatus == 1 {
|
||||
return false, errors.New("已审核成功,无法进行操作")
|
||||
}
|
||||
|
||||
if userDoctor.IdenAuthStatus != 1 {
|
||||
return false, errors.New("请先完成身份认证")
|
||||
}
|
||||
|
||||
// 获取用户数据
|
||||
userDao := dao.UserDao{}
|
||||
user, err := userDao.GetUserById(userDoctor.UserId)
|
||||
if err != nil || user == nil {
|
||||
return false, errors.New("医生数据错误")
|
||||
}
|
||||
|
||||
// 获取简介审核数据
|
||||
doctorIntroductionRecordDao := dao.DoctorIntroductionRecordDao{}
|
||||
doctorIntroductionRecord, err := doctorIntroductionRecordDao.GetDoctorIntroductionRecordByDoctorId(userDoctor.DoctorId)
|
||||
if err != nil || doctorIntroductionRecord == nil {
|
||||
return false, errors.New("审核失败")
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
// 修改医生数据-审核状态
|
||||
userDoctorData := make(map[string]interface{}) // 医生数据
|
||||
|
||||
doctorIdenFailDao := dao.DoctorIdenFailDao{}
|
||||
doctorExpertiseDao := dao.DoctorExpertiseDao{}
|
||||
|
||||
// 审核不通过
|
||||
if req.IntroductionStatus == 3 {
|
||||
if req.AvatarReason != "" {
|
||||
doctorIdenFail := &model.DoctorIdenFail{
|
||||
DoctorId: doctorId,
|
||||
FieldName: "avatar",
|
||||
FailReason: req.AvatarReason,
|
||||
}
|
||||
doctorIdenFail, err = doctorIdenFailDao.AddDoctorIdenFail(tx, doctorIdenFail)
|
||||
if err != nil || doctorIdenFail == nil {
|
||||
tx.Rollback()
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
|
||||
if req.BriefIntroductionReason != "" {
|
||||
doctorIdenFail := &model.DoctorIdenFail{
|
||||
DoctorId: doctorId,
|
||||
FieldName: "brief_introduction",
|
||||
FailReason: req.BriefIntroductionReason,
|
||||
}
|
||||
doctorIdenFail, err = doctorIdenFailDao.AddDoctorIdenFail(tx, doctorIdenFail)
|
||||
if err != nil || doctorIdenFail == nil {
|
||||
tx.Rollback()
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
|
||||
if req.BeGoodAtReason != "" {
|
||||
doctorIdenFail := &model.DoctorIdenFail{
|
||||
DoctorId: doctorId,
|
||||
FieldName: "be_good_at",
|
||||
FailReason: req.BeGoodAtReason,
|
||||
}
|
||||
doctorIdenFail, err = doctorIdenFailDao.AddDoctorIdenFail(tx, doctorIdenFail)
|
||||
if err != nil || doctorIdenFail == nil {
|
||||
tx.Rollback()
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
|
||||
if req.DoctorExpertiseReason != "" {
|
||||
doctorIdenFail := &model.DoctorIdenFail{
|
||||
DoctorId: doctorId,
|
||||
FieldName: "doctor_expertise",
|
||||
FailReason: req.DoctorExpertiseReason,
|
||||
}
|
||||
doctorIdenFail, err = doctorIdenFailDao.AddDoctorIdenFail(tx, doctorIdenFail)
|
||||
if err != nil || doctorIdenFail == nil {
|
||||
tx.Rollback()
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 审核通过
|
||||
if req.IntroductionStatus == 1 {
|
||||
// 审核通过删除所有不通过原因数据
|
||||
maps := make(map[string]interface{})
|
||||
maps["doctor_id"] = doctorId
|
||||
err = doctorIdenFailDao.DeleteDoctorIdenFail(tx, maps)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("审核失败")
|
||||
}
|
||||
|
||||
if doctorIntroductionRecord.BeGoodAt != "" {
|
||||
userDoctorData["be_good_at"] = doctorIntroductionRecord.BeGoodAt
|
||||
}
|
||||
|
||||
if doctorIntroductionRecord.BriefIntroduction != "" {
|
||||
userDoctorData["brief_introduction"] = doctorIntroductionRecord.BriefIntroduction
|
||||
}
|
||||
|
||||
// 医生专长
|
||||
if doctorIntroductionRecord.ExpertiseIds != "" {
|
||||
// 获取医生专长
|
||||
doctorExpertises, err := doctorExpertiseDao.GetDoctorExpertiseListByDoctorId(doctorId)
|
||||
if err != nil {
|
||||
return false, errors.New("审核失败")
|
||||
}
|
||||
|
||||
if len(doctorExpertises) > 0 {
|
||||
// 删除医生专长
|
||||
maps = make(map[string]interface{})
|
||||
maps["doctor_id"] = doctorId
|
||||
err = doctorExpertiseDao.DeleteDoctorExpertise(tx, maps)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("审核失败")
|
||||
}
|
||||
}
|
||||
|
||||
// 新增医生专长
|
||||
expertiseIds := strings.Split(doctorIntroductionRecord.ExpertiseIds, ",")
|
||||
for _, id := range expertiseIds {
|
||||
// 将 id 转换为 int64 类型
|
||||
expertiseId, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("审核失败")
|
||||
}
|
||||
|
||||
doctorExpertise := &model.DoctorExpertise{
|
||||
DoctorId: doctorId,
|
||||
ExpertiseId: expertiseId,
|
||||
}
|
||||
|
||||
doctorExpertise, err = doctorExpertiseDao.AddDoctorExpertise(tx, doctorExpertise)
|
||||
if err != nil || doctorExpertise == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("审核失败")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新医生im资料
|
||||
if doctorIntroductionRecord.Avatar != "" {
|
||||
userDoctorData["avatar"] = doctorIntroductionRecord.Avatar
|
||||
|
||||
profileItem := []tencentIm.ProfileItem{
|
||||
{
|
||||
Tag: "Tag_Profile_IM_Image",
|
||||
Value: utils.AddOssDomain(doctorIntroductionRecord.Avatar),
|
||||
},
|
||||
}
|
||||
|
||||
res, err := tencentIm.SetProfile(strconv.FormatInt(userDoctor.UserId, 10), profileItem)
|
||||
if err != nil || res != true {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// 删除审核记录表
|
||||
maps = make(map[string]interface{})
|
||||
maps["doctor_id"] = doctorId
|
||||
err = doctorIntroductionRecordDao.DeleteDoctorIntroductionRecord(tx, maps)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("审核失败")
|
||||
}
|
||||
}
|
||||
|
||||
// 更新医生表数据
|
||||
userDoctorData["introduction_status"] = req.IntroductionStatus
|
||||
userDoctorData["introduction_time"] = time.Now().Format("2006-01-02 15:04:05")
|
||||
err = userDoctorDao.EditUserDoctorById(tx, doctorId, userDoctorData)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("审核失败")
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
|
||||
if config.C.Env == "prod" {
|
||||
// 发送短信-医生修改简介审核通过
|
||||
if req.IntroductionStatus == 1 {
|
||||
templateParam := make(map[string]interface{})
|
||||
err := aliyun.SendSms(user.Mobile, "SMS_271990126", "医生修改简介审核通过", templateParam)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
|
||||
// 发送短信-医生修改简介审核拒绝
|
||||
if req.IntroductionStatus == 3 {
|
||||
templateParam := make(map[string]interface{})
|
||||
err := aliyun.SendSms(user.Mobile, "SMS_271990126", "医生修改简介审核拒绝", templateParam)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
11
config.yaml
11
config.yaml
@ -46,11 +46,16 @@ ca-online:
|
||||
ca-online-api-url: http://testmicrosrv.scca.com.cn:9527
|
||||
|
||||
# [腾讯im]
|
||||
#im:
|
||||
# im-app-id: 1400798221
|
||||
# im-secret: fc45ab469ca632a700166973d87b3a6f56a855cb92d7cffb54e4d37135c097da
|
||||
# im-base-url: https://console.tim.qq.com/
|
||||
# im-token: NDc5MzExMDMxMDY2NDMxNDg5L
|
||||
im:
|
||||
im-app-id: 1400798221
|
||||
im-secret: fc45ab469ca632a700166973d87b3a6f56a855cb92d7cffb54e4d37135c097da
|
||||
im-app-id: 1600027911
|
||||
im-secret: 8ebf5bc8557a18019f94ed1cae4fd1d78e77aedcfdf804e56c5478057b9cb93c
|
||||
im-base-url: https://console.tim.qq.com/
|
||||
im-token: NDc5MzExMDMxMDY2NDMxNDg5L
|
||||
im-token: NDc5MzExMDIYdusl2NDMxNDg5L
|
||||
|
||||
# [阿里大鱼短信]
|
||||
dysms:
|
||||
|
||||
@ -16,7 +16,8 @@ type RefundRequest struct {
|
||||
OutTradeNo string `json:"out_trade_no" comment:"商户订单号"`
|
||||
OutRefundNo string `json:"out_refund_no" comment:"退款订单号"`
|
||||
Reason string `json:"reason" comment:"退款原因"`
|
||||
PaymentAmountTotal int64 `json:"payment_amount_total" comment:"退款金额"`
|
||||
RefundAmount int64 `json:"refund_amount" comment:"退款金额"`
|
||||
PaymentAmountTotal int64 `json:"payment_amount_total" comment:"支付金额"`
|
||||
NotifyUrl string `json:"notify_url" comment:"回调地址"`
|
||||
}
|
||||
|
||||
@ -72,7 +73,7 @@ func (r RefundRequest) Refund(orderType int) (*refunddomestic.Refund, error) {
|
||||
NotifyUrl: core.String(r.NotifyUrl),
|
||||
Amount: &refunddomestic.AmountReq{
|
||||
Currency: core.String("CNY"),
|
||||
Refund: core.Int64(r.PaymentAmountTotal),
|
||||
Refund: core.Int64(r.RefundAmount),
|
||||
Total: core.Int64(r.PaymentAmountTotal),
|
||||
},
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ func RemoveOssDomain(url string) string {
|
||||
return url
|
||||
}
|
||||
|
||||
// AddOssDomain 去除oss地址中的前缀
|
||||
// AddOssDomain 增加oss地址中的前缀
|
||||
func AddOssDomain(url string) string {
|
||||
if url == "" {
|
||||
return ""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user