Browse Source

Merge branch '20200710_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20200710_xt_api_new_branch

XMLWAN 4 years ago
parent
commit
db50c18a10

+ 19 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go View File

697
 	})
697
 	})
698
 }
698
 }
699
 
699
 
700
+func (c *CheckWeightApiController) GetPatientListById() {
701
+	patientId, _ := c.GetInt64("patient_id", 0)
702
+	if patientId <= 0 {
703
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
704
+		return
705
+	}
706
+
707
+	adminUserInfo := c.GetMobileAdminUserInfo()
708
+	patient, error := service.GetPatientListById(adminUserInfo.Org.Id, patientId)
709
+	if error != nil {
710
+		c.ErrorLog("获取病人详情失败:%v", error)
711
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
712
+		return
713
+	}
714
+	c.ServeSuccessJSON(map[string]interface{}{
715
+		"patientinfo": patient,
716
+	})
717
+}
718
+
700
 func (c *CheckWeightApiController) GetPatientInfoDialysis() {
719
 func (c *CheckWeightApiController) GetPatientInfoDialysis() {
701
 	id, _ := c.GetInt64("patient", 0)
720
 	id, _ := c.GetInt64("patient", 0)
702
 	if id <= 0 {
721
 	if id <= 0 {

+ 1 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go View File

12
 	beego.Router("/m/api/savebloodpressure", &CheckWeightApiController{}, "Post:SaveBloodPressure")
12
 	beego.Router("/m/api/savebloodpressure", &CheckWeightApiController{}, "Post:SaveBloodPressure")
13
 	beego.Router("/m/api/checkbeforedialysis", &CheckWeightApiController{}, "get:GetPatientInfoBeforeDialysis")
13
 	beego.Router("/m/api/checkbeforedialysis", &CheckWeightApiController{}, "get:GetPatientInfoBeforeDialysis")
14
 	beego.Router("/m/api/getpatientlist", &CheckWeightApiController{}, "get:GetPatientList")
14
 	beego.Router("/m/api/getpatientlist", &CheckWeightApiController{}, "get:GetPatientList")
15
+	beego.Router("/m/api/getpatientinfo", &CheckWeightApiController{}, "get:GetPatientListById")
15
 	beego.Router("/m/api/checkdialysis", &CheckWeightApiController{}, "get:GetPatientInfoDialysis")
16
 	beego.Router("/m/api/checkdialysis", &CheckWeightApiController{}, "get:GetPatientInfoDialysis")
16
 	beego.Router("/m/api/savecheckdialysis", &CheckWeightApiController{}, "Post:SavePatientInfoDialysis")
17
 	beego.Router("/m/api/savecheckdialysis", &CheckWeightApiController{}, "Post:SavePatientInfoDialysis")
17
 	beego.Router("/m/api/scheduals", &DialysisAPIController{}, "get:Scheduals")
18
 	beego.Router("/m/api/scheduals", &DialysisAPIController{}, "get:Scheduals")

+ 1 - 9
controllers/patient_api_controller.go View File

3458
 
3458
 
3459
 			if patientNameM["phone"] != nil || reflect.TypeOf(patientNameM["phone"]).String() == "string" {
3459
 			if patientNameM["phone"] != nil || reflect.TypeOf(patientNameM["phone"]).String() == "string" {
3460
 				phone, _ := patientNameM["phone"].(string)
3460
 				phone, _ := patientNameM["phone"].(string)
3461
-				if VerifyMobileFormat(phone) == false { //手机号码不符合要求则生成一条导入错误日志
3462
-
3461
+				if utils.CellPhoneRegexp().MatchString(phone) == false { //手机号码不符合要求则生成一条导入错误日志
3463
 					if len(phone) == 0 {
3462
 					if len(phone) == 0 {
3464
 						err_log := models.ExportErrLog{
3463
 						err_log := models.ExportErrLog{
3465
 							LogType:    1,
3464
 							LogType:    1,
3872
 	return &birthDay
3871
 	return &birthDay
3873
 }
3872
 }
3874
 
3873
 
3875
-func VerifyMobileFormat(mobileNum string) bool {
3876
-	regular := "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$"
3877
-
3878
-	reg := regexp.MustCompile(regular)
3879
-	return reg.MatchString(mobileNum)
3880
-}
3881
-
3882
 func IsIdCard(id string) (res bool) {
3874
 func IsIdCard(id string) (res bool) {
3883
 	id = strings.ToUpper(id)
3875
 	id = strings.ToUpper(id)
3884
 	if len(id) != 15 && len(id) != 18 {
3876
 	if len(id) != 15 && len(id) != 18 {

+ 9 - 0
models/patient_models.go View File

1
 package models
1
 package models
2
 
2
 
3
+type PatientListForFaceList struct {
4
+	ID          int64  `gorm:"column:id" json:"id" form:"id"`
5
+	UpdatedTime int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
6
+}
7
+
8
+func (PatientListForFaceList) TableName() string {
9
+	return "xt_patients"
10
+}
11
+
3
 type PatientListForFace struct {
12
 type PatientListForFace struct {
4
 	ID          int64  `gorm:"column:id" json:"id" form:"id"`
13
 	ID          int64  `gorm:"column:id" json:"id" form:"id"`
5
 	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
14
 	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 7 - 2
service/patient_service.go View File

80
 	return
80
 	return
81
 }
81
 }
82
 
82
 
83
-func GetPatientListByUpdateTime(orgID int64, syncTime int64, force int64) (patients []*models.PatientListForFace, total int64, err error) {
84
-	db := readDb.Model(&models.PatientListForFace{}).Where("user_org_id=? and status=1", orgID)
83
+func GetPatientListByUpdateTime(orgID int64, syncTime int64, force int64) (patients []*models.PatientListForFaceList, total int64, err error) {
84
+	db := readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=? and status=1", orgID)
85
 	if force == 0 {
85
 	if force == 0 {
86
 		db = db.Where("updated_time >= ?", syncTime)
86
 		db = db.Where("updated_time >= ?", syncTime)
87
 	}
87
 	}
89
 	return
89
 	return
90
 }
90
 }
91
 
91
 
92
+func GetPatientListById(orgID int64, patientId int64) (patients models.PatientListForFace, err error) {
93
+	err = readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=? and id = ? and status=1", orgID,patientId).First(&patients).Error
94
+	return
95
+}
96
+
92
 func GetPatientCount(orgID int64) (total int64) {
97
 func GetPatientCount(orgID int64) (total int64) {
93
 	readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1", orgID).Count(&total)
98
 	readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1", orgID).Count(&total)
94
 	return
99
 	return

+ 1 - 1
utils/tools.go View File

40
 func CheckMobile(mobile string) (match bool) {
40
 func CheckMobile(mobile string) (match bool) {
41
 
41
 
42
 	//过滤手机
42
 	//过滤手机
43
-	match, _ = regexp.MatchString("^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$", mobile)
43
+	match, _ = regexp.MatchString("^1\\d{10}$", mobile)
44
 	return
44
 	return
45
 }
45
 }
46
 
46