Quellcode durchsuchen

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

XMLWAN vor 4 Jahren
Ursprung
Commit
db50c18a10

+ 19 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Datei anzeigen

@@ -697,6 +697,25 @@ func (c *CheckWeightApiController) GetPatientList() {
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 719
 func (c *CheckWeightApiController) GetPatientInfoDialysis() {
701 720
 	id, _ := c.GetInt64("patient", 0)
702 721
 	if id <= 0 {

+ 1 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go Datei anzeigen

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

+ 1 - 9
controllers/patient_api_controller.go Datei anzeigen

@@ -3458,8 +3458,7 @@ func (c *PatientApiController) ExportPatients() {
3458 3458
 
3459 3459
 			if patientNameM["phone"] != nil || reflect.TypeOf(patientNameM["phone"]).String() == "string" {
3460 3460
 				phone, _ := patientNameM["phone"].(string)
3461
-				if VerifyMobileFormat(phone) == false { //手机号码不符合要求则生成一条导入错误日志
3462
-
3461
+				if utils.CellPhoneRegexp().MatchString(phone) == false { //手机号码不符合要求则生成一条导入错误日志
3463 3462
 					if len(phone) == 0 {
3464 3463
 						err_log := models.ExportErrLog{
3465 3464
 							LogType:    1,
@@ -3872,13 +3871,6 @@ func GetBirthDay(IDCardNo string) *time.Time {
3872 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 3874
 func IsIdCard(id string) (res bool) {
3883 3875
 	id = strings.ToUpper(id)
3884 3876
 	if len(id) != 15 && len(id) != 18 {

+ 9 - 0
models/patient_models.go Datei anzeigen

@@ -1,5 +1,14 @@
1 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 12
 type PatientListForFace struct {
4 13
 	ID          int64  `gorm:"column:id" json:"id" form:"id"`
5 14
 	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 7 - 2
service/patient_service.go Datei anzeigen

@@ -80,8 +80,8 @@ func GetAllPatientList(orgID int64) (patients []*models.Patients, total int64, e
80 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 85
 	if force == 0 {
86 86
 		db = db.Where("updated_time >= ?", syncTime)
87 87
 	}
@@ -89,6 +89,11 @@ func GetPatientListByUpdateTime(orgID int64, syncTime int64, force int64) (patie
89 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 97
 func GetPatientCount(orgID int64) (total int64) {
93 98
 	readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1", orgID).Count(&total)
94 99
 	return

+ 1 - 1
utils/tools.go Datei anzeigen

@@ -40,7 +40,7 @@ func MarkBackUrl(backUrl, defaultUrl string) string {
40 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 44
 	return
45 45
 }
46 46