新增创建者名称
This commit is contained in:
parent
af2374b87d
commit
35bb3f9f6d
@ -11,6 +11,7 @@ type Api struct {
|
|||||||
userPatientManage // 患者管理
|
userPatientManage // 患者管理
|
||||||
caseManage // 病例管理
|
caseManage // 病例管理
|
||||||
orderPrescriptionManage // 处方管理
|
orderPrescriptionManage // 处方管理
|
||||||
|
inquiryManage // 问诊管理
|
||||||
}
|
}
|
||||||
|
|
||||||
// SysSetting 系统设置
|
// SysSetting 系统设置
|
||||||
@ -59,3 +60,8 @@ type caseManage struct {
|
|||||||
type orderPrescriptionManage struct {
|
type orderPrescriptionManage struct {
|
||||||
OrderPrescription // 处方列表
|
OrderPrescription // 处方列表
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 问诊管理
|
||||||
|
type inquiryManage struct {
|
||||||
|
Inquiry // 问诊管理
|
||||||
|
}
|
||||||
|
|||||||
55
api/controller/inquiry.go
Normal file
55
api/controller/inquiry.go
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
package controller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"hospital-admin-api/api/dao"
|
||||||
|
"hospital-admin-api/api/dto"
|
||||||
|
"hospital-admin-api/api/requests"
|
||||||
|
"hospital-admin-api/api/responses"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"hospital-admin-api/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Inquiry 问诊管理
|
||||||
|
type Inquiry struct{}
|
||||||
|
|
||||||
|
// GetUserDoctorPage 获取医生列表-分页
|
||||||
|
func (r *Inquiry) GetUserDoctorPage(c *gin.Context) {
|
||||||
|
userDoctorRequest := requests.UserDoctorRequest{}
|
||||||
|
if err := c.ShouldBind(&userDoctorRequest.GetUserDoctorPage); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(userDoctorRequest.GetUserDoctorPage); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if userDoctorRequest.GetUserDoctorPage.Page == 0 {
|
||||||
|
userDoctorRequest.GetUserDoctorPage.Page = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if userDoctorRequest.GetUserDoctorPage.PageSize == 0 {
|
||||||
|
userDoctorRequest.GetUserDoctorPage.PageSize = 20
|
||||||
|
}
|
||||||
|
|
||||||
|
userDoctorDao := dao.UserDoctorDao{}
|
||||||
|
userDoctor, total, err := userDoctorDao.GetUserDoctorPageSearch(userDoctorRequest.GetUserDoctorPage, userDoctorRequest.GetUserDoctorPage.Page, userDoctorRequest.GetUserDoctorPage.PageSize)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
getUserDoctorPageResponses := dto.GetUserDoctorListDto(userDoctor)
|
||||||
|
|
||||||
|
result := make(map[string]interface{})
|
||||||
|
result["page"] = userDoctorRequest.GetUserDoctorPage.Page
|
||||||
|
result["page_size"] = userDoctorRequest.GetUserDoctorPage.PageSize
|
||||||
|
result["total"] = total
|
||||||
|
result["data"] = getUserDoctorPageResponses
|
||||||
|
responses.OkWithData(result, c)
|
||||||
|
}
|
||||||
@ -2,8 +2,10 @@ package dto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"hospital-admin-api/api/dao"
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserDoctorDto struct {
|
type UserDoctorDto struct {
|
||||||
@ -46,7 +48,8 @@ type UserDoctorDto struct {
|
|||||||
Mobile string `json:"mobile"` // 手机号
|
Mobile string `json:"mobile"` // 手机号
|
||||||
Age uint `json:"age"` // 年龄
|
Age uint `json:"age"` // 年龄
|
||||||
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
Sex int `json:"sex"` // 性别(0:未知 1:男 2:女)
|
||||||
RegisterMethod int `json:"register_method"` // 注册方式(1:微信小程序 )
|
RegisterMethod int `json:"register_method"` // 注册方式(1:微信小程序 2:后台添加 )
|
||||||
|
CreatedBy string `json:"created_by"` // 创建者
|
||||||
User *UserDto `json:"user"` // 用户
|
User *UserDto `json:"user"` // 用户
|
||||||
Hospital *HospitalDto `json:"hospital"` // 医院
|
Hospital *HospitalDto `json:"hospital"` // 医院
|
||||||
UserDoctorInfo *UserDoctorInfoDto `json:"user_doctor_info"` // 医生详情
|
UserDoctorInfo *UserDoctorInfoDto `json:"user_doctor_info"` // 医生详情
|
||||||
@ -168,6 +171,11 @@ func GetUserDoctorListDto(m []*model.UserDoctor) []*UserDoctorDto {
|
|||||||
response = response.LoadHospitalName(v.Hospital)
|
response = response.LoadHospitalName(v.Hospital)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载创建者
|
||||||
|
if v.User != nil {
|
||||||
|
response = response.LoadUserCreatedBy(v.User)
|
||||||
|
}
|
||||||
|
|
||||||
// 将转换后的结构体添加到新切片中
|
// 将转换后的结构体添加到新切片中
|
||||||
responses[i] = response
|
responses[i] = response
|
||||||
}
|
}
|
||||||
@ -324,3 +332,32 @@ func (r *UserDoctorPendingDto) LoadUserDoctorInfo(m *model.UserDoctorInfo) *User
|
|||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadUserCreatedBy 加载创建者
|
||||||
|
func (r *UserDoctorDto) LoadUserCreatedBy(m *model.User) *UserDoctorDto {
|
||||||
|
if m.CreatedBy != "" {
|
||||||
|
if m.RegisterMethod == 1 {
|
||||||
|
// 注册方式-微信小程序
|
||||||
|
r.CreatedBy = m.UserName
|
||||||
|
} else {
|
||||||
|
// 注册方式-后台添加
|
||||||
|
userId, err := strconv.ParseInt(m.CreatedBy, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户详情
|
||||||
|
AdminUserDao := dao.AdminUserDao{}
|
||||||
|
adminUser, err := AdminUserDao.GetAdminUserFirstById(userId)
|
||||||
|
if err != nil || adminUser == nil {
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
r.CreatedBy = adminUser.NickName
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 注册方式-微信小程序
|
||||||
|
r.CreatedBy = m.UserName
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|||||||
@ -457,4 +457,44 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
// 处方详情
|
// 处方详情
|
||||||
prescriptionGroup.GET("/:order_prescription_id", api.OrderPrescription.GetOrderPrescription)
|
prescriptionGroup.GET("/:order_prescription_id", api.OrderPrescription.GetOrderPrescription)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 问诊管理
|
||||||
|
inquiryGroup := adminGroup.Group("/inquiry")
|
||||||
|
{
|
||||||
|
// 问诊配置
|
||||||
|
settingGroup := inquiryGroup.Group("/setting")
|
||||||
|
{
|
||||||
|
// 医生问诊配置
|
||||||
|
doctorGroup := settingGroup.Group("/doctor")
|
||||||
|
{
|
||||||
|
// 获取开启问诊配置医生列表-分页
|
||||||
|
doctorGroup.GET("", api.UserDoctor.GetUserDoctor)
|
||||||
|
|
||||||
|
// 医生问诊配置详情
|
||||||
|
doctorGroup.GET("/:doctor_id", api.UserDoctor.GetUserDoctor)
|
||||||
|
|
||||||
|
// 修改医生问诊配置
|
||||||
|
doctorGroup.PUT("/:doctor_id", api.UserDoctor.PutUserDoctor)
|
||||||
|
|
||||||
|
// 新增医生问诊配置
|
||||||
|
doctorGroup.POST("", api.UserDoctor.AddUserDoctor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 系统问诊配置
|
||||||
|
systemGroup := settingGroup.Group("/system")
|
||||||
|
{
|
||||||
|
// 获取系统问诊配置列表-分页
|
||||||
|
systemGroup.GET("", api.UserDoctor.GetUserDoctorPage)
|
||||||
|
|
||||||
|
// 获取系统问诊配置列表
|
||||||
|
systemGroup.GET("/list", api.UserDoctor.GetUserDoctorPage)
|
||||||
|
|
||||||
|
// 系统问诊配置详情
|
||||||
|
systemGroup.GET("/:doctor_id", api.UserDoctor.GetUserDoctor)
|
||||||
|
|
||||||
|
// 修改系统问诊配置
|
||||||
|
systemGroup.PUT("/:doctor_id", api.UserDoctor.PutUserDoctor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user