根据药房查询医生列表

This commit is contained in:
haomingming
2026-09-07 15:21:06 +08:00
parent 0cff5b3f8d
commit 338d56beda
7 changed files with 260 additions and 6 deletions
+50
View File
@@ -232,3 +232,53 @@ func (r *Pharmacy) DeletePharmacy(c *gin.Context) {
responses.Ok(c)
}
// GetPharmacyDoctorPage 获取药房绑定的医生列表-分页
func (r *Pharmacy) GetPharmacyDoctorPage(c *gin.Context) {
req := requests.GetPharmacyDoctorPage{}
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
}
pharmacyService := service.PharmacyService{}
result, err := pharmacyService.GetPharmacyDoctorPage(req)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
responses.OkWithData(result, c)
}
// GetPharmacyDoctorList 获取药房绑定的医生列表
func (r *Pharmacy) GetPharmacyDoctorList(c *gin.Context) {
id := c.Param("pharmacy_id")
if id == "" {
id = c.Param("id")
}
if id == "" {
responses.FailWithMessage("缺少药房ID参数", c)
return
}
pharmacyId, err := strconv.ParseInt(id, 10, 64)
if err != nil {
responses.Fail(c)
return
}
pharmacyService := service.PharmacyService{}
list, err := pharmacyService.GetPharmacyDoctorList(pharmacyId)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
responses.OkWithData(list, c)
}