修改系统问诊配置

This commit is contained in:
2023-10-19 11:38:39 +08:00
parent eda63e716e
commit a50b679e6e
8 changed files with 366 additions and 12 deletions
+46
View File
@@ -212,8 +212,54 @@ func (r *InquiryConfig) GetSystemInquiryConfig(c *gin.Context) {
return
}
// 获取系统问诊时间
systemInquiryTimeDao := dao.SystemInquiryTimeDao{}
systemInquiryTimes, err := systemInquiryTimeDao.GetSystemInquiryTimeListBySystemInquiryConfigId(systemInquiryConfigId)
// 处理返回值
res := dto.GetSystemInquiryConfigDto(systemInquiryConfig)
// 加载系统问诊时间
res.LoadSystemInquiryTime(systemInquiryTimes)
responses.OkWithData(res, c)
}
// PutSystemInquiryConfig 修改系统问诊配置
func (r *InquiryConfig) PutSystemInquiryConfig(c *gin.Context) {
inquiryConfigRequest := requests.InquiryConfigRequest{}
req := inquiryConfigRequest.PutSystemInquiryConfig
if err := c.ShouldBindJSON(&req); err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
// 参数验证
if err := global.Validate.Struct(req); err != nil {
responses.FailWithMessage(utils.Translate(err), c)
return
}
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
}
// 业务处理
systemInquiryConfigService := service.SystemInquiryConfigService{}
_, err = systemInquiryConfigService.PutSystemInquiryConfig(systemInquiryConfigId, req)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
responses.Ok(c)
}