去除了算一算app用户绑定。主要涉及接口为登陆接口,检测用户状态
This commit is contained in:
@@ -642,21 +642,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
||||
|
||||
userData := make(map[string]interface{})
|
||||
userInfoData := make(map[string]interface{})
|
||||
appData := app.UpdateInfoRequest{
|
||||
Birthday: req.Birthday,
|
||||
IsPegnant: req.IsPregnant,
|
||||
Sex: nil,
|
||||
Weight: req.Weight,
|
||||
ExpectedDateOfChildbirth: req.ExpectedDate,
|
||||
IsHbv: nil,
|
||||
NationUuid: "",
|
||||
PatientUuid: "",
|
||||
Name: req.UserName,
|
||||
ProvId: nil,
|
||||
CityId: nil,
|
||||
CountyId: nil,
|
||||
Height: req.Height,
|
||||
}
|
||||
|
||||
// 用户名称
|
||||
if req.UserName != user.UserName {
|
||||
@@ -681,15 +666,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
||||
userData["age"] = nil
|
||||
}
|
||||
|
||||
// 性别
|
||||
if req.Sex == 1 {
|
||||
sex := 0
|
||||
appData.Sex = &sex
|
||||
} else if req.Sex == 2 {
|
||||
sex := 1
|
||||
appData.Sex = &sex
|
||||
}
|
||||
|
||||
if user.Sex != nil {
|
||||
if req.Sex != *user.Sex {
|
||||
userData["sex"] = req.Sex
|
||||
@@ -741,51 +717,16 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
||||
fmt.Println(req.NationId)
|
||||
if req.NationId != nationId {
|
||||
userInfoData["nation_id"] = req.NationId
|
||||
|
||||
// 获取民族数据
|
||||
baseNationDao := dao.BaseNationDao{}
|
||||
maps := make(map[string]interface{})
|
||||
maps["nation_id"] = req.NationId
|
||||
baseNation, err := baseNationDao.GetBaseNation(maps)
|
||||
if err != nil {
|
||||
return false, errors.New("民族错误")
|
||||
}
|
||||
appData.NationUuid = baseNation.AppIden
|
||||
}
|
||||
} else {
|
||||
userInfoData["nation_id"] = req.NationId
|
||||
|
||||
// 获取民族数据
|
||||
baseNationDao := dao.BaseNationDao{}
|
||||
maps := make(map[string]interface{})
|
||||
maps["nation_id"] = req.NationId
|
||||
baseNation, err := baseNationDao.GetBaseNation(maps)
|
||||
if err != nil {
|
||||
return false, errors.New("民族错误")
|
||||
}
|
||||
appData.NationUuid = baseNation.AppIden
|
||||
}
|
||||
} else {
|
||||
if userInfo.NationId != nil {
|
||||
userInfoData["nation_id"] = nil
|
||||
appData.NationUuid = ""
|
||||
}
|
||||
}
|
||||
|
||||
// 是否存在家族病史
|
||||
// 有无 肝硬化或肝癌家族史 0无1有2未知
|
||||
// 是否存在家族病史(0:未知 1:是 2:否)
|
||||
// 转换双方状态
|
||||
var isHbv int
|
||||
if *req.IsFamilyHistory == 0 {
|
||||
isHbv = 2
|
||||
} else if *req.IsFamilyHistory == 1 {
|
||||
isHbv = 1
|
||||
} else if *req.IsFamilyHistory == 2 {
|
||||
isHbv = 0
|
||||
}
|
||||
|
||||
appData.IsHbv = &isHbv
|
||||
if req.IsFamilyHistory != nil {
|
||||
if userInfo.IsFamilyHistory != nil {
|
||||
if *req.IsFamilyHistory != *userInfo.IsFamilyHistory {
|
||||
@@ -837,8 +778,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
||||
return false, errors.New("省份错误")
|
||||
}
|
||||
|
||||
appData.ProvId = &provinceId
|
||||
|
||||
baseAreaDao := dao.BaseAreaDao{}
|
||||
baseArea, err := baseAreaDao.GetBaseAreaById(provinceId)
|
||||
if err != nil {
|
||||
@@ -861,8 +800,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
||||
return false, errors.New("城市错误")
|
||||
}
|
||||
|
||||
appData.CityId = &cityId
|
||||
|
||||
baseArea, err = baseAreaDao.GetBaseAreaById(cityId)
|
||||
if err != nil {
|
||||
return false, errors.New("城市错误")
|
||||
@@ -884,7 +821,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
||||
if err != nil {
|
||||
return false, errors.New("区县错误")
|
||||
}
|
||||
appData.CountyId = &countyId
|
||||
|
||||
baseArea, err = baseAreaDao.GetBaseAreaById(countyId)
|
||||
if err != nil {
|
||||
@@ -928,14 +864,6 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
|
||||
}
|
||||
}
|
||||
|
||||
// app数据
|
||||
appData.PatientUuid = user.AppIden
|
||||
_, err = app.UpdateInfo(appData)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, err
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
return true, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user