新增系统问诊配置
This commit is contained in:
@@ -146,3 +146,74 @@ func (r *InquiryConfig) AddDoctorInquiryConfig(c *gin.Context) {
|
||||
|
||||
responses.Ok(c)
|
||||
}
|
||||
|
||||
// GetSystemInquiryConfigPage 获取系统问诊配置列表-分页
|
||||
func (r *InquiryConfig) GetSystemInquiryConfigPage(c *gin.Context) {
|
||||
inquiryConfigRequest := requests.InquiryConfigRequest{}
|
||||
req := inquiryConfigRequest.GetSystemInquiryConfigPage
|
||||
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
|
||||
}
|
||||
|
||||
systemInquiryConfigDao := dao.SystemInquiryConfigDao{}
|
||||
systemInquiryConfig, total, err := systemInquiryConfigDao.GetSystemInquiryConfigPageSearch(req, req.Page, req.PageSize)
|
||||
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
res := dto.GetSystemInquiryConfigListDto(systemInquiryConfig)
|
||||
|
||||
result := make(map[string]interface{})
|
||||
result["page"] = req.Page
|
||||
result["page_size"] = req.PageSize
|
||||
result["total"] = total
|
||||
result["data"] = res
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
// GetSystemInquiryConfig 系统问诊配置详情
|
||||
func (r *InquiryConfig) GetSystemInquiryConfig(c *gin.Context) {
|
||||
id := c.Param("system_inquiry_config_id")
|
||||
if id == "" {
|
||||
responses.FailWithMessage("缺少参数", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 将 id 转换为 int64 类型
|
||||
systemInquiryConfigId, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
responses.Fail(c)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
systemInquiryConfigDao := dao.SystemInquiryConfigDao{}
|
||||
systemInquiryConfig, err := systemInquiryConfigDao.GetSystemInquiryConfigById(systemInquiryConfigId)
|
||||
if err != nil || systemInquiryConfig == nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
res := dto.GetSystemInquiryConfigDto(systemInquiryConfig)
|
||||
|
||||
responses.OkWithData(res, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user