XMLWAN 3 anni fa
parent
commit
ad4fd7f9d5

+ 1 - 1
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go Vedi File

@@ -89,7 +89,7 @@ func (this *XcxApiController) GetUserRegister() {
89 89
 	fmt.Println("id_card_no", id_card_no)
90 90
 	mobile := this.GetString("mobile")
91 91
 	code := this.GetString("code")
92
-	patient, errcodes := service.GetMobilePatient(id_card_no)
92
+	patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
93 93
 	fmt.Println("errcodes2323232232", errcodes)
94 94
 	if errcodes == nil {
95 95
 		role := models.XcxAdminUserRole{

+ 3 - 3
service/xcx_mobile_api_service.go Vedi File

@@ -127,11 +127,11 @@ func GetWeekDayOfWeek() (weekMonday string) {
127 127
 	return
128 128
 }
129 129
 
130
-func GetMobilePatient(mobile string) (*models.XcxPatients, error) {
130
+func GetMobilePatient(mobile string, idcard string) (*models.XcxPatients, error) {
131 131
 
132 132
 	patient := models.XcxPatients{}
133
-
134
-	err := XTReadDB().Model(&patient).Where("id_card_no = ? and status = 1", mobile).Find(&patient).Error
133
+	err := XTReadDB().Model(&patient).Where("(phone = ? or relative_phone =?) and id_card_no =?", mobile, mobile, idcard).Find(&patient).Error
134
+	//err := XTReadDB().Model(&patient).Where("id_card_no = ? and status = 1", mobile).Find(&patient).Error
135 135
 	if err == gorm.ErrRecordNotFound {
136 136
 		return nil, err
137 137
 	}