Browse Source

修改bug

csx 3 years ago
parent
commit
08f2c452cd
2 changed files with 30 additions and 24 deletions
  1. 1 1
      conf/app.conf
  2. 29 23
      controllers/patient_api_controller.go

+ 1 - 1
conf/app.conf View File

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode = dev
4 4
 
5 5
 # 1

+ 29 - 23
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,
@@ -3559,6 +3560,7 @@ func (c *PatientApiController) ExportPatients() {
3559 3560
 						service.CreateExportErrLog(&err_log)
3560 3561
 						continue
3561 3562
 					}
3563
+					//}
3562 3564
 					patient.IdCardNo = id_card_no
3563 3565
 					//patient.Birthday = GetBirthDay(id_card_no).Unix()
3564 3566
 					if GetBirthDay(id_card_no) == nil {
@@ -3876,29 +3878,33 @@ func IsIdCard(id string) (res bool) {
3876 3878
 	}
3877 3879
 	r := regexp.MustCompile("(\\d{15})|(\\d{17}([0-9]|X))")
3878 3880
 	if !r.MatchString(id) {
3879
-		fmt.Println("2222222")
3881
+		fmt.Println("222222")
3880 3882
 
3881 3883
 		return false
3882 3884
 	}
3883 3885
 	if len(id) == 15 {
3884 3886
 		tm2, _ := time.Parse("01/02/2006", string([]byte(id)[8:10])+"/"+string([]byte(id)[10:12])+"/"+"19"+string([]byte(id)[6:8]))
3885
-		if tm2.Unix() <= 0 {
3886
-			fmt.Println("33333333")
3887
+		if tm2.Unix() == 0 {
3888
+			fmt.Println("44444443333")
3887 3889
 
3888 3890
 			return false
3889 3891
 		}
3890 3892
 		return true
3891 3893
 	} else {
3892 3894
 		tm2, _ := time.Parse("01/02/2006", string([]byte(id)[10:12])+"/"+string([]byte(id)[12:14])+"/"+string([]byte(id)[6:10]))
3893
-		if tm2.Unix() <= 0 {
3894
-			fmt.Println("444444444")
3895
+		fmt.Println(string([]byte(id)[10:12]) + "/" + string([]byte(id)[12:14]) + "/" + string([]byte(id)[6:10]))
3896
+		fmt.Println(tm2.Unix())
3897
+
3898
+		if tm2.Unix() == 0 {
3899
+
3900
+			fmt.Println("44445555555")
3895 3901
 
3896 3902
 			return false
3897 3903
 		}
3898 3904
 		//检验18位身份证的校验码是否正确。
3899 3905
 		//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
3900 3906
 		arr_int := []int{7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}
3901
-		arr_ch := []string{",", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"}
3907
+		arr_ch := []string{"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"}
3902 3908
 		sign := 0
3903 3909
 		for k, v := range arr_int {
3904 3910
 			int_temp, _ := strconv.Atoi(string([]byte(id)[k : k+1]))
@@ -3907,7 +3913,7 @@ func IsIdCard(id string) (res bool) {
3907 3913
 		n := sign % 11
3908 3914
 		val_num := arr_ch[n]
3909 3915
 		if val_num != string([]byte(id)[17:18]) {
3910
-			fmt.Println("555555555")
3916
+			fmt.Println("5556666666")
3911 3917
 
3912 3918
 			return false
3913 3919
 		}