新增多点审核状态变更
This commit is contained in:
parent
ad5c73f52b
commit
3af20484bb
@ -2,7 +2,6 @@ package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
@ -141,7 +140,6 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
|
||||
// 获取医生绑定银行卡数据
|
||||
doctorBankCardDao := dao.DoctorBankCardDao{}
|
||||
doctorBankCard, _ := doctorBankCardDao.GetDoctorBankCardByDoctorId(doctorId)
|
||||
fmt.Println(doctorBankCard)
|
||||
|
||||
userDoctorData := make(map[string]interface{}) // 医生数据
|
||||
userDoctorInfoData := make(map[string]interface{}) // 医生详情数据
|
||||
@ -240,7 +238,6 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
|
||||
|
||||
licenseCert = strings.Join(result, ",")
|
||||
}
|
||||
|
||||
if userDoctorInfo.LicenseCert != licenseCert {
|
||||
if userDoctor.IdenAuthStatus == 3 {
|
||||
// 如果认证失败,修改属性会重新进入待审核
|
||||
@ -259,7 +256,6 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
|
||||
|
||||
qualificationCert = strings.Join(result, ",")
|
||||
}
|
||||
|
||||
if userDoctorInfo.QualificationCert != qualificationCert {
|
||||
if userDoctor.IdenAuthStatus == 3 {
|
||||
// 如果认证失败,修改属性会重新进入待审核
|
||||
@ -278,7 +274,6 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
|
||||
|
||||
workCert = strings.Join(result, ",")
|
||||
}
|
||||
|
||||
if userDoctorInfo.WorkCert != workCert {
|
||||
if userDoctor.IdenAuthStatus == 3 {
|
||||
// 如果认证失败,修改属性会重新进入待审核
|
||||
@ -288,61 +283,50 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
|
||||
}
|
||||
|
||||
// 处理身份证正面图片
|
||||
if userDoctorInfo.IdCardFront != "" && req.IdCardFront == "" {
|
||||
idCardFront := userDoctorInfo.IdCardFront
|
||||
if idCardFront != "" && req.IdCardFront == "" {
|
||||
return false, errors.New("未上传新的身份证图片")
|
||||
}
|
||||
if req.IdCardFront != "" {
|
||||
idCardFront := strings.Replace(req.IdCardFront, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
if idCardFront != userDoctorInfo.IdCardFront {
|
||||
if utils.RemoveOssDomain(req.IdCardFront) != idCardFront {
|
||||
if userDoctor.MultiPointStatus == 2 {
|
||||
return false, errors.New("多点执业审核中,请操作后进行修改")
|
||||
}
|
||||
userDoctorInfoData["id_card_front"] = idCardFront
|
||||
|
||||
idCardFront = utils.RemoveOssDomain(req.IdCardFront)
|
||||
userDoctorInfoData["id_card_front"] = utils.RemoveOssDomain(req.IdCardFront)
|
||||
}
|
||||
}
|
||||
|
||||
// 身份证背面图片
|
||||
if userDoctorInfo.IdCardBack != "" && req.IdCardBack == "" {
|
||||
idCardBack := userDoctorInfo.IdCardBack
|
||||
if idCardBack != "" && req.IdCardBack == "" {
|
||||
return false, errors.New("未上传新的身份证图片")
|
||||
}
|
||||
if req.IdCardBack != "" {
|
||||
idCardBack := strings.Replace(req.IdCardBack, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
if idCardBack != userDoctorInfo.IdCardBack {
|
||||
if utils.RemoveOssDomain(req.IdCardBack) != idCardBack {
|
||||
if userDoctor.MultiPointStatus == 2 {
|
||||
return false, errors.New("多点执业审核中,请操作后进行修改")
|
||||
}
|
||||
|
||||
userDoctorInfoData["id_card_back"] = idCardBack
|
||||
idCardBack = utils.RemoveOssDomain(req.IdCardBack)
|
||||
userDoctorInfoData["id_card_back"] = utils.RemoveOssDomain(req.IdCardBack)
|
||||
}
|
||||
}
|
||||
|
||||
// 签名图片
|
||||
if userDoctorInfo.SignImage != "" && req.SignImage == "" {
|
||||
signImage := userDoctorInfo.SignImage
|
||||
if signImage != "" && req.SignImage == "" {
|
||||
return false, errors.New("未上传新的签名图片")
|
||||
}
|
||||
if req.SignImage != "" {
|
||||
signImage := utils.RemoveOssDomain(req.SignImage)
|
||||
if signImage != userDoctorInfo.SignImage {
|
||||
if utils.RemoveOssDomain(req.SignImage) != signImage {
|
||||
if userDoctor.MultiPointStatus == 2 {
|
||||
return false, errors.New("多点执业审核中,请操作后进行修改")
|
||||
}
|
||||
|
||||
signImage = utils.RemoveOssDomain(req.SignImage)
|
||||
userDoctorInfoData["sign_image"] = signImage
|
||||
|
||||
// 检测是否存在正在审核中的处方
|
||||
orderPrescriptionDao := dao.OrderPrescriptionDao{}
|
||||
|
||||
maps := make(map[string]interface{})
|
||||
maps["doctor_id"] = doctorId
|
||||
maps["prescription_status"] = 1
|
||||
orderPrescription, err := orderPrescriptionDao.GetList(maps)
|
||||
if err != nil {
|
||||
return false, errors.New("修改失败")
|
||||
}
|
||||
|
||||
if len(orderPrescription) > 0 {
|
||||
return false, errors.New("存在审核中的处方,请勿修改签名数据")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,9 +347,13 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
|
||||
}
|
||||
}
|
||||
|
||||
// 处理多点状态--------
|
||||
// 处理多点状态更新问题
|
||||
if signImage != "" && idCardBack != "" && idCardFront != "" {
|
||||
// 任何情况下科室修改,多点进入待审核
|
||||
if userDoctor.DepartmentCustomId != departmentCustomId {
|
||||
if req.SignImage != "" && req.IdCardBack != "" && req.IdCardFront != "" {
|
||||
userDoctorData["multi_point_status"] = 2
|
||||
userDoctorData["multi_point_fail_reason"] = ""
|
||||
|
||||
// 检测是否存在正在审核中的处方
|
||||
orderPrescriptionDao := dao.OrderPrescriptionDao{}
|
||||
|
||||
@ -380,15 +368,34 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
|
||||
if len(orderPrescription) > 0 {
|
||||
return false, errors.New("存在审核中的处方,请勿修改科室数据")
|
||||
}
|
||||
}
|
||||
|
||||
// 审核失败、未审核情况下,如果数据存在修改,进入待审核
|
||||
if userDoctor.MultiPointStatus == 0 || userDoctor.MultiPointStatus == 2 {
|
||||
if signImage != userDoctorInfo.SignImage || idCardBack != userDoctorInfo.IdCardBack || idCardFront != userDoctorInfo.IdCardFront {
|
||||
userDoctorData["multi_point_status"] = 2
|
||||
userDoctorData["multi_point_fail_reason"] = ""
|
||||
|
||||
// 检测是否存在正在审核中的处方
|
||||
orderPrescriptionDao := dao.OrderPrescriptionDao{}
|
||||
|
||||
maps := make(map[string]interface{})
|
||||
maps["doctor_id"] = doctorId
|
||||
maps["prescription_status"] = 1
|
||||
orderPrescription, err := orderPrescriptionDao.GetList(maps)
|
||||
if err != nil {
|
||||
return false, errors.New("修改失败")
|
||||
}
|
||||
|
||||
if len(orderPrescription) > 0 {
|
||||
return false, errors.New("存在审核中的处方,请勿修改科室数据")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理银行卡
|
||||
if (userDoctorInfo.IdCardFront != "" || req.IdCardFront != "") && (userDoctorInfo.IdCardBack != "" || req.IdCardBack != "") && (userDoctorInfo.SignImage != "" || req.SignImage != "") {
|
||||
// 签名、身份证数据不为空的情况下,银行卡数据必填
|
||||
if (userDoctorInfo.IdCardFront != "" || req.IdCardFront != "") && (userDoctorInfo.IdCardBack != "" || req.IdCardBack != "") && (userDoctorInfo.SignImage != "" || req.SignImage != "") {
|
||||
if req.BankCardCode == "" || req.BankId == "" || req.BankCardProvinceId == 0 || req.BankCardCountyId == 0 || req.BankCardCityId == 0 {
|
||||
return false, errors.New("请填入银行卡数据")
|
||||
}
|
||||
@ -435,7 +442,8 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
|
||||
if doctorBankCard.BankCardCode != req.BankCardCode {
|
||||
bankCardCode = req.BankCardCode
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if doctorBankCard == nil {
|
||||
if req.BankCardCode != "" && req.BankId != "" && req.BankCardProvinceId != 0 && req.BankCardCountyId != 0 && req.BankCardCityId != 0 {
|
||||
provinceId = req.BankCardProvinceId
|
||||
cityId = req.BankCardCityId
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user