Browse Source

修改bug

csx 4 years ago
parent
commit
5ae7727ec0
2 changed files with 35 additions and 23 deletions
  1. 7 5
      controllers/base_api_controller.go
  2. 28 18
      controllers/patient_api_controller.go

+ 7 - 5
controllers/base_api_controller.go View File

@@ -2,6 +2,8 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
+	//"XT_New/models"
6
+
5 7
 	//"XT_New/models"
6 8
 	"XT_New/service"
7 9
 	"fmt"
@@ -68,9 +70,9 @@ func (this *BaseAuthAPIController) Prepare() {
68 70
 		//var userAdmin models.AdminUser
69 71
 		//userAdmin.Id = 400
70 72
 		//userAdmin.Mobile = "13535547901"
71
-		//
72
-		//userAdmin.Id = 597
73
-		//userAdmin.Mobile = "19874122664"
73
+		////
74
+		//////userAdmin.Id = 597
75
+		//////userAdmin.Mobile = "19874122664"
74 76
 		//userAdmin.IsSuperAdmin = false
75 77
 		//userAdmin.Status = 1
76 78
 		//userAdmin.CreateTime = 1530786071
@@ -319,8 +321,8 @@ func (this *BaseServeAPIController) Prepare() {
319 321
 		//var userAdmin models.AdminUser
320 322
 		//userAdmin.Id = 400
321 323
 		//userAdmin.Mobile = "13535547901"
322
-		//userAdmin.Id = 597
323
-		//userAdmin.Mobile = "19874122664"
324
+		////userAdmin.Id = 597
325
+		////userAdmin.Mobile = "19874122664"
324 326
 		//userAdmin.IsSuperAdmin = false
325 327
 		//userAdmin.Status = 1
326 328
 		//userAdmin.CreateTime = 1530786071

+ 28 - 18
controllers/patient_api_controller.go View File

@@ -3479,16 +3479,16 @@ func (c *PatientApiController) ExportPatients() {
3479 3479
 					}
3480 3480
 
3481 3481
 				} else {
3482
-					var tempPatient *models.Patients
3483
-					for _, item := range all_patient {
3484
-						if item.Phone == phone {
3485
-							tempPatient = item
3486
-						}
3487
-					}
3482
+					//var tempPatient *models.Patients
3483
+					//for _, item := range all_patient {
3484
+					//	if item.Phone == phone {
3485
+					//		tempPatient = item
3486
+					//	}
3487
+					//}
3488 3488
 
3489 3489
 					//需要判断该号码是否已经在系统内存在了,存在了则生成一条导入错误日志
3490
-					//count := service.FindPatientPhoneIsExist(phone, c.GetAdminUserInfo().CurrentOrgId)
3491
-					if tempPatient != nil && tempPatient.ID > 0 {
3490
+					count := service.FindPatientPhoneIsExist(phone, c.GetAdminUserInfo().CurrentOrgId)
3491
+					if count >= 1 {
3492 3492
 						err_log := models.ExportErrLog{
3493 3493
 							LogType:    1,
3494 3494
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
@@ -3539,14 +3539,15 @@ func (c *PatientApiController) ExportPatients() {
3539 3539
 					}
3540 3540
 
3541 3541
 				} else {
3542
-					var tempPatient *models.Patients
3543
-					for _, item := range all_patient {
3544
-						if item.IdCardNo == id_card_no {
3545
-							tempPatient = item
3546
-						}
3547
-					}
3548
-					//count := service.FindPatientIdCardNoIsExist(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
3549
-					if tempPatient != nil && tempPatient.ID > 0 {
3542
+					//var tempPatient *models.Patients
3543
+					//for _, item := range all_patient {
3544
+					//	if item.IdCardNo == id_card_no {
3545
+					//		tempPatient = item
3546
+					//	}
3547
+					//}
3548
+					count := service.FindPatientIdCardNoIsExist(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
3549
+					if count >= 1 {
3550
+						//if tempPatient != nil && tempPatient.ID > 0 {
3550 3551
 						err_log := models.ExportErrLog{
3551 3552
 							LogType:    1,
3552 3553
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
@@ -3796,6 +3797,7 @@ func (c *PatientApiController) ExportPatients() {
3796 3797
 			patient.CreatedTime = time.Now().Unix()
3797 3798
 			patient.UpdatedTime = time.Now().Unix()
3798 3799
 			patient.Status = 1
3800
+			patient.Avatar = "https://images.shengws.com/201809182128111.png"
3799 3801
 			patient.UserOrgId = c.GetAdminUserInfo().CurrentOrgId
3800 3802
 			patient.IsExcelExport = 1
3801 3803
 			patient.PatientType = 1
@@ -3885,13 +3887,19 @@ func IsIdCard(id string) (res bool) {
3885 3887
 		return true
3886 3888
 	} else {
3887 3889
 		tm2, _ := time.Parse("01/02/2006", string([]byte(id)[10:12])+"/"+string([]byte(id)[12:14])+"/"+string([]byte(id)[6:10]))
3888
-		if tm2.Unix() <= 0 {
3890
+		fmt.Println(string([]byte(id)[10:12]) + "/" + string([]byte(id)[12:14]) + "/" + string([]byte(id)[6:10]))
3891
+		fmt.Println(tm2.Unix())
3892
+
3893
+		if tm2.Unix() == 0 {
3894
+
3895
+			fmt.Println("44445555555")
3896
+
3889 3897
 			return false
3890 3898
 		}
3891 3899
 		//检验18位身份证的校验码是否正确。
3892 3900
 		//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
3893 3901
 		arr_int := []int{7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}
3894
-		arr_ch := []string{",", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"}
3902
+		arr_ch := []string{"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"}
3895 3903
 		sign := 0
3896 3904
 		for k, v := range arr_int {
3897 3905
 			int_temp, _ := strconv.Atoi(string([]byte(id)[k : k+1]))
@@ -3900,6 +3908,8 @@ func IsIdCard(id string) (res bool) {
3900 3908
 		n := sign % 11
3901 3909
 		val_num := arr_ch[n]
3902 3910
 		if val_num != string([]byte(id)[17:18]) {
3911
+			fmt.Println("5556666666")
3912
+
3903 3913
 			return false
3904 3914
 		}
3905 3915
 		return true