药房下线(禁用/删除)医生分流迁移

This commit is contained in:
haomingming
2026-09-17 08:51:56 +08:00
parent b349acb4b4
commit cfdac70e94
6 changed files with 405 additions and 0 deletions
+51
View File
@@ -282,3 +282,54 @@ func (r *Pharmacy) GetPharmacyDoctorList(c *gin.Context) {
responses.OkWithData(list, c)
}
// GetAffectedDoctors 获取药房下线受影响医生列表(预检接口)
func (r *Pharmacy) GetAffectedDoctors(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{}
result, err := pharmacyService.GetAffectedDoctors(pharmacyId)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
responses.OkWithData(result, c)
}
// BatchTransferAndAction 批量迁移医生默认药房并执行药房操作(禁用/删除)
func (r *Pharmacy) BatchTransferAndAction(c *gin.Context) {
pharmacyRequest := requests.PharmacyRequest{}
req := pharmacyRequest.BatchTransferAndAction
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{}
_, err := pharmacyService.BatchTransferAndAction(req)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
responses.Ok(c)
}