新增配置文件处理
This commit is contained in:
+105
-40
@@ -132,6 +132,10 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
return false, errors.New("医生数据错误")
|
||||
}
|
||||
|
||||
if userDoctor.IdenAuthStatus == 2 {
|
||||
return false, errors.New("医生身份审核中,不允许修改")
|
||||
}
|
||||
|
||||
userDoctorData := make(map[string]interface{}) // 医生数据
|
||||
userDoctorInfoData := make(map[string]interface{}) // 医生详情数据
|
||||
userData := make(map[string]interface{}) // 用户数据
|
||||
@@ -279,6 +283,9 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
if putUserDoctorRequest.IdCardFront != "" {
|
||||
idCardFront := strings.Replace(putUserDoctorRequest.IdCardFront, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
if idCardFront != userDoctorInfo.IdCardFront {
|
||||
if userDoctor.MultiPointStatus == 2 {
|
||||
return false, errors.New("多点执业审核中,请操作后进行修改")
|
||||
}
|
||||
userDoctorInfoData["id_card_front"] = idCardFront
|
||||
}
|
||||
}
|
||||
@@ -290,6 +297,10 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
if putUserDoctorRequest.IdCardBack != "" {
|
||||
idCardBack := strings.Replace(putUserDoctorRequest.IdCardBack, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
if idCardBack != userDoctorInfo.IdCardBack {
|
||||
if userDoctor.MultiPointStatus == 2 {
|
||||
return false, errors.New("多点执业审核中,请操作后进行修改")
|
||||
}
|
||||
|
||||
userDoctorInfoData["id_card_back"] = idCardBack
|
||||
}
|
||||
}
|
||||
@@ -301,6 +312,10 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
if putUserDoctorRequest.SignImage != "" {
|
||||
signImage := strings.Replace(putUserDoctorRequest.SignImage, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
if signImage != userDoctorInfo.SignImage {
|
||||
if userDoctor.MultiPointStatus == 2 {
|
||||
return false, errors.New("多点执业审核中,请操作后进行修改")
|
||||
}
|
||||
|
||||
userDoctorInfoData["sign_image"] = signImage
|
||||
}
|
||||
}
|
||||
@@ -322,6 +337,56 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
}
|
||||
}
|
||||
|
||||
// 处理多点问题
|
||||
fieldsToCheck := []string{"id_card_front", "id_card_back", "sign_image"}
|
||||
|
||||
exists := false
|
||||
for _, field := range fieldsToCheck {
|
||||
if _, ok := userDoctorInfoData[field]; ok {
|
||||
exists = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if exists {
|
||||
idCardFront := userDoctorInfo.IdCardFront
|
||||
idCardBack := userDoctorInfo.IdCardBack
|
||||
signImage := userDoctorInfo.SignImage
|
||||
|
||||
if _, ok := userDoctorInfoData["id_card_front"]; ok {
|
||||
idCardFront = userDoctorInfoData["id_card_front"].(string)
|
||||
}
|
||||
|
||||
if _, ok := userDoctorInfoData["id_card_back"]; ok {
|
||||
idCardBack = userDoctorInfoData["id_card_back"].(string)
|
||||
}
|
||||
|
||||
if _, ok := userDoctorInfoData["sign_image"]; ok {
|
||||
signImage = userDoctorInfoData["sign_image"].(string)
|
||||
}
|
||||
|
||||
if idCardFront != "" && idCardBack != "" && 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("存在审核中的处方,请勿修改签名数据")
|
||||
}
|
||||
|
||||
// 修改签名数据,重新认定为未审核
|
||||
userDoctorData["multi_point_status"] = 2
|
||||
userDoctorData["multi_point_fail_reason"] = ""
|
||||
}
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
@@ -478,46 +543,46 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
|
||||
// 判断签名图片是否修改,同步修改ca平台
|
||||
// 1、新用户,未存在证书
|
||||
if putUserDoctorRequest.SignImage != "" {
|
||||
signImage := strings.Replace(putUserDoctorRequest.SignImage, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
if signImage != userDoctorInfo.SignImage {
|
||||
// 检测是否存在云证书
|
||||
userCaCertDao := dao.UserCaCert{}
|
||||
userCaCerts, err := userCaCertDao.GetUserCaCertListByUserId(userDoctor.UserId)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("修改失败")
|
||||
}
|
||||
|
||||
if userCaCerts != nil && len(userCaCerts) > 0 {
|
||||
userCaCert := userCaCerts[0]
|
||||
// 检测是否已经添加签章配置
|
||||
if userCaCert.IsSignConfig == 1 {
|
||||
// 修改签章配置为未添加
|
||||
data := make(map[string]interface{})
|
||||
data["is_sign_config"] = 0
|
||||
err = userCaCertDao.EditUserCaCertById(tx, userCaCert.CertId, data)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 删除签章配置
|
||||
deleteUserSignConfigRequestData := &ca.DeleteUserSignConfigRequestData{
|
||||
UserId: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
ConfigKey: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
}
|
||||
|
||||
_, err := ca.DeleteUserSignConfig(deleteUserSignConfigRequestData)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// if putUserDoctorRequest.SignImage != "" {
|
||||
// signImage := strings.Replace(putUserDoctorRequest.SignImage, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
// if signImage != userDoctorInfo.SignImage {
|
||||
// // 检测是否存在云证书
|
||||
// userCaCertDao := dao.UserCaCert{}
|
||||
// userCaCerts, err := userCaCertDao.GetUserCaCertListByUserId(userDoctor.UserId)
|
||||
// if err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, errors.New("修改失败")
|
||||
// }
|
||||
//
|
||||
// if userCaCerts != nil && len(userCaCerts) > 0 {
|
||||
// userCaCert := userCaCerts[0]
|
||||
// // 检测是否已经添加签章配置
|
||||
// if userCaCert.IsSignConfig == 1 {
|
||||
// // 修改签章配置为未添加
|
||||
// data := make(map[string]interface{})
|
||||
// data["is_sign_config"] = 0
|
||||
// err = userCaCertDao.EditUserCaCertById(tx, userCaCert.CertId, data)
|
||||
// if err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, errors.New(err.Error())
|
||||
// }
|
||||
//
|
||||
// // 删除签章配置
|
||||
// deleteUserSignConfigRequestData := &ca.DeleteUserSignConfigRequestData{
|
||||
// UserId: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
// ConfigKey: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
// }
|
||||
//
|
||||
// _, err := ca.DeleteUserSignConfig(deleteUserSignConfigRequestData)
|
||||
// if err != nil {
|
||||
// tx.Rollback()
|
||||
// return false, errors.New(err.Error())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
tx.Commit()
|
||||
return true, nil
|
||||
|
||||
Reference in New Issue
Block a user