浏览代码

修改bug

csx 5 年前
父节点
当前提交
5ae7727ec0
共有 2 个文件被更改,包括 35 次插入23 次删除
  1. 7 5
      controllers/base_api_controller.go
  2. 28 18
      controllers/patient_api_controller.go

+ 7 - 5
controllers/base_api_controller.go 查看文件

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

+ 28 - 18
controllers/patient_api_controller.go 查看文件

3479
 					}
3479
 					}
3480
 
3480
 
3481
 				} else {
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
 						err_log := models.ExportErrLog{
3492
 						err_log := models.ExportErrLog{
3493
 							LogType:    1,
3493
 							LogType:    1,
3494
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3494
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3539
 					}
3539
 					}
3540
 
3540
 
3541
 				} else {
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
 						err_log := models.ExportErrLog{
3551
 						err_log := models.ExportErrLog{
3551
 							LogType:    1,
3552
 							LogType:    1,
3552
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3553
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3796
 			patient.CreatedTime = time.Now().Unix()
3797
 			patient.CreatedTime = time.Now().Unix()
3797
 			patient.UpdatedTime = time.Now().Unix()
3798
 			patient.UpdatedTime = time.Now().Unix()
3798
 			patient.Status = 1
3799
 			patient.Status = 1
3800
+			patient.Avatar = "https://images.shengws.com/201809182128111.png"
3799
 			patient.UserOrgId = c.GetAdminUserInfo().CurrentOrgId
3801
 			patient.UserOrgId = c.GetAdminUserInfo().CurrentOrgId
3800
 			patient.IsExcelExport = 1
3802
 			patient.IsExcelExport = 1
3801
 			patient.PatientType = 1
3803
 			patient.PatientType = 1
3885
 		return true
3887
 		return true
3886
 	} else {
3888
 	} else {
3887
 		tm2, _ := time.Parse("01/02/2006", string([]byte(id)[10:12])+"/"+string([]byte(id)[12:14])+"/"+string([]byte(id)[6:10]))
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
 			return false
3897
 			return false
3890
 		}
3898
 		}
3891
 		//检验18位身份证的校验码是否正确。
3899
 		//检验18位身份证的校验码是否正确。
3892
 		//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
3900
 		//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
3893
 		arr_int := []int{7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}
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
 		sign := 0
3903
 		sign := 0
3896
 		for k, v := range arr_int {
3904
 		for k, v := range arr_int {
3897
 			int_temp, _ := strconv.Atoi(string([]byte(id)[k : k+1]))
3905
 			int_temp, _ := strconv.Atoi(string([]byte(id)[k : k+1]))
3900
 		n := sign % 11
3908
 		n := sign % 11
3901
 		val_num := arr_ch[n]
3909
 		val_num := arr_ch[n]
3902
 		if val_num != string([]byte(id)[17:18]) {
3910
 		if val_num != string([]byte(id)[17:18]) {
3911
+			fmt.Println("5556666666")
3912
+
3903
 			return false
3913
 			return false
3904
 		}
3914
 		}
3905
 		return true
3915
 		return true