2
This commit is contained in:
@@ -152,7 +152,7 @@ func (r *DoctorPharmacy) UnbindDoctorPharmacy(c *gin.Context) {
|
|||||||
pharmacyIdStr := c.Query("pharmacy_id")
|
pharmacyIdStr := c.Query("pharmacy_id")
|
||||||
if pharmacyIdStr != "" {
|
if pharmacyIdStr != "" {
|
||||||
pharmacyId, err := strconv.ParseInt(pharmacyIdStr, 10, 64)
|
pharmacyId, err := strconv.ParseInt(pharmacyIdStr, 10, 64)
|
||||||
if err == nil && pharmacyId > 0 {
|
if err == nil && pharmacyId >= 0 {
|
||||||
_, err = doctorPharmacyService.UnbindDoctorPharmacy(id, pharmacyId)
|
_, err = doctorPharmacyService.UnbindDoctorPharmacy(id, pharmacyId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
@@ -236,7 +236,7 @@ func (r *DoctorPharmacy) SetDefaultDoctorPharmacy(c *gin.Context) {
|
|||||||
pharmacyIdStr := c.Query("pharmacy_id")
|
pharmacyIdStr := c.Query("pharmacy_id")
|
||||||
if pharmacyIdStr != "" {
|
if pharmacyIdStr != "" {
|
||||||
pharmacyId, err := strconv.ParseInt(pharmacyIdStr, 10, 64)
|
pharmacyId, err := strconv.ParseInt(pharmacyIdStr, 10, 64)
|
||||||
if err == nil && pharmacyId > 0 {
|
if err == nil && pharmacyId >= 0 {
|
||||||
_, err = doctorPharmacyService.SetDefaultPharmacy(id, pharmacyId)
|
_, err = doctorPharmacyService.SetDefaultPharmacy(id, pharmacyId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ func (r *DoctorPharmacyService) BindDoctorPharmacies(doctorId int64, req request
|
|||||||
}
|
}
|
||||||
|
|
||||||
pharmacyDao := dao.PharmacyDao{}
|
pharmacyDao := dao.PharmacyDao{}
|
||||||
var defaultPharmacyId int64
|
var defaultPharmacyId int64 = -1
|
||||||
if req.DefaultPharmacyId != "" {
|
if req.DefaultPharmacyId != "" {
|
||||||
defaultPharmacyId, _ = strconv.ParseInt(req.DefaultPharmacyId, 10, 64)
|
defaultPharmacyId, _ = strconv.ParseInt(req.DefaultPharmacyId, 10, 64)
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ func (r *DoctorPharmacyService) BindDoctorPharmacies(doctorId int64, req request
|
|||||||
// 遍历新增绑定
|
// 遍历新增绑定
|
||||||
for i, v := range req.PharmacyIds {
|
for i, v := range req.PharmacyIds {
|
||||||
pharmacyId, err := strconv.ParseInt(v, 10, 64)
|
pharmacyId, err := strconv.ParseInt(v, 10, 64)
|
||||||
if err != nil || pharmacyId == 0 {
|
if err != nil || pharmacyId < 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,9 +68,9 @@ func (r *DoctorPharmacyService) BindDoctorPharmacies(doctorId int64, req request
|
|||||||
}
|
}
|
||||||
|
|
||||||
isDefault := 0
|
isDefault := 0
|
||||||
if defaultPharmacyId != 0 && pharmacyId == defaultPharmacyId {
|
if defaultPharmacyId >= 0 && pharmacyId == defaultPharmacyId {
|
||||||
isDefault = 1
|
isDefault = 1
|
||||||
} else if defaultPharmacyId == 0 && i == 0 {
|
} else if defaultPharmacyId < 0 && i == 0 {
|
||||||
// 未指定默认药房时,默认第1个为默认药房
|
// 未指定默认药房时,默认第1个为默认药房
|
||||||
isDefault = 1
|
isDefault = 1
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ func (r *DoctorPharmacyService) AddDoctorPharmacy(doctorId int64, req requests.A
|
|||||||
}
|
}
|
||||||
|
|
||||||
pharmacyId, err := strconv.ParseInt(req.PharmacyId, 10, 64)
|
pharmacyId, err := strconv.ParseInt(req.PharmacyId, 10, 64)
|
||||||
if err != nil || pharmacyId == 0 {
|
if err != nil || pharmacyId < 0 {
|
||||||
return false, errors.New("药房id无效")
|
return false, errors.New("药房id无效")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ func (r *PharmacyService) GetPharmacy(pharmacyId int64) (*dto.PharmacyDto, error
|
|||||||
// GetPharmacyDoctorPage 获取药房绑定的医生列表-分页
|
// GetPharmacyDoctorPage 获取药房绑定的医生列表-分页
|
||||||
func (r *PharmacyService) GetPharmacyDoctorPage(req requests.GetPharmacyDoctorPage) (map[string]interface{}, error) {
|
func (r *PharmacyService) GetPharmacyDoctorPage(req requests.GetPharmacyDoctorPage) (map[string]interface{}, error) {
|
||||||
pharmacyId, err := strconv.ParseInt(req.PharmacyId, 10, 64)
|
pharmacyId, err := strconv.ParseInt(req.PharmacyId, 10, 64)
|
||||||
if err != nil || pharmacyId == 0 {
|
if err != nil || pharmacyId < 0 {
|
||||||
return nil, errors.New("药房id无效")
|
return nil, errors.New("药房id无效")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user