Browse Source

修改redis清除数据时间

csx 4 years ago
parent
commit
f6978ddc9b

+ 2 - 2
conf/app.conf View File

1
 appname = 血透
1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3
 runmode = dev
3
 runmode = dev
4
 
4
 
5
-# 1
5
+#
6
 copyrequestbody = true
6
 copyrequestbody = true
7
 sessionon = true
7
 sessionon = true
8
 sessiongcmaxlifetime = 64800
8
 sessiongcmaxlifetime = 64800

+ 14 - 6
controllers/base_api_controller.go View File

4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
 	"XT_New/models"
5
 	"XT_New/models"
6
 
6
 
7
+	//"XT_New/models"
8
+
7
 	//"XT_New/models"
9
 	//"XT_New/models"
8
 	"XT_New/service"
10
 	"XT_New/service"
11
+	"fmt"
9
 	"strconv"
12
 	"strconv"
10
 	"strings"
13
 	"strings"
11
 )
14
 )
68
 	if this.GetAdminUserInfo() == nil {
71
 	if this.GetAdminUserInfo() == nil {
69
 		var userAdmin models.AdminUser
72
 		var userAdmin models.AdminUser
70
 		userAdmin.Id = 558
73
 		userAdmin.Id = 558
71
-		userAdmin.Mobile = "13318464649"
74
+		userAdmin.Mobile = "13535547901"
72
 
75
 
73
 		//userAdmin.Id = 597
76
 		//userAdmin.Id = 597
74
 		//userAdmin.Mobile = "19874122664"
77
 		//userAdmin.Mobile = "19874122664"
78
 		userAdmin.ModifyTime = 1530786071
81
 		userAdmin.ModifyTime = 1530786071
79
 		var subscibe models.ServeSubscibe
82
 		var subscibe models.ServeSubscibe
80
 		subscibe.ID = 1
83
 		subscibe.ID = 1
81
-		subscibe.OrgId = 4
84
+		subscibe.OrgId = 3877
82
 		subscibe.PeriodStart = 1538035409
85
 		subscibe.PeriodStart = 1538035409
83
 		subscibe.PeriodEnd = 1569571409
86
 		subscibe.PeriodEnd = 1569571409
84
 		subscibe.State = 1
87
 		subscibe.State = 1
88
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
89
 		subscibes[4] = &subscibe
92
 		subscibes[4] = &subscibe
90
 		var adminUserInfo service.AdminUserInfo
93
 		var adminUserInfo service.AdminUserInfo
91
-		adminUserInfo.CurrentOrgId = 4
94
+		adminUserInfo.CurrentOrgId = 3877
92
 		adminUserInfo.CurrentAppId = 18
95
 		adminUserInfo.CurrentAppId = 18
93
 		adminUserInfo.AdminUser = &userAdmin
96
 		adminUserInfo.AdminUser = &userAdmin
94
 		adminUserInfo.Subscibes = subscibes
97
 		adminUserInfo.Subscibes = subscibes
95
 		this.SetSession("admin_user_info", &adminUserInfo)
98
 		this.SetSession("admin_user_info", &adminUserInfo)
96
-
99
+		//
97
 		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
100
 		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
98
 		//this.StopRun()
101
 		//this.StopRun()
99
 
102
 
115
 			} else {
118
 			} else {
116
 				roles = strings.Split(role.RoleIds, ",")
119
 				roles = strings.Split(role.RoleIds, ",")
117
 			}
120
 			}
121
+			fmt.Println(roles)
118
 
122
 
119
 			//获取该用户下所有角色的权限总集
123
 			//获取该用户下所有角色的权限总集
120
 			var userRolePurviews string
124
 			var userRolePurviews string
130
 			}
134
 			}
131
 			//该用户所拥有角色的权限的总集
135
 			//该用户所拥有角色的权限的总集
132
 			userRolePurviewsArr = RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
136
 			userRolePurviewsArr = RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
137
+			fmt.Println(userRolePurviewsArr)
133
 			//系统所记录的权限列表
138
 			//系统所记录的权限列表
134
 			allPermission, _ := service.GetAllFunctionPurview()
139
 			allPermission, _ := service.GetAllFunctionPurview()
135
 
140
 
178
 			} else {
183
 			} else {
179
 				roles = strings.Split(role.RoleIds, ",")
184
 				roles = strings.Split(role.RoleIds, ",")
180
 			}
185
 			}
186
+			fmt.Println(roles)
181
 
187
 
182
 			//获取该用户下所有角色的权限总集
188
 			//获取该用户下所有角色的权限总集
183
 			var userRolePurviews string
189
 			var userRolePurviews string
193
 			}
199
 			}
194
 			//该用户所拥有角色的权限的总集
200
 			//该用户所拥有角色的权限的总集
195
 			userRolePurviewsArr = RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
201
 			userRolePurviewsArr = RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
202
+			fmt.Println(userRolePurviewsArr)
196
 			//系统所记录的权限列表
203
 			//系统所记录的权限列表
197
 			allPermission, _ := service.GetAllFunctionPurview()
204
 			allPermission, _ := service.GetAllFunctionPurview()
198
 
205
 
319
 		userAdmin.ModifyTime = 1530786071
326
 		userAdmin.ModifyTime = 1530786071
320
 		var subscibe models.ServeSubscibe
327
 		var subscibe models.ServeSubscibe
321
 		subscibe.ID = 1
328
 		subscibe.ID = 1
322
-		subscibe.OrgId = 4
329
+		subscibe.OrgId = 3877
323
 		subscibe.PeriodStart = 1538035409
330
 		subscibe.PeriodStart = 1538035409
324
 		subscibe.PeriodEnd = 1569571409
331
 		subscibe.PeriodEnd = 1569571409
325
 		subscibe.State = 1
332
 		subscibe.State = 1
326
 		subscibe.Status = 1
333
 		subscibe.Status = 1
327
 		subscibe.CreatedTime = 1538035409
334
 		subscibe.CreatedTime = 1538035409
328
 		subscibe.UpdatedTime = 1538035409
335
 		subscibe.UpdatedTime = 1538035409
336
+
329
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
330
 		subscibes[4] = &subscibe
338
 		subscibes[4] = &subscibe
331
 		var adminUserInfo service.AdminUserInfo
339
 		var adminUserInfo service.AdminUserInfo
332
-		adminUserInfo.CurrentOrgId = 4
340
+		adminUserInfo.CurrentOrgId = 3877
333
 		adminUserInfo.CurrentAppId = 18
341
 		adminUserInfo.CurrentAppId = 18
334
 		adminUserInfo.AdminUser = &userAdmin
342
 		adminUserInfo.AdminUser = &userAdmin
335
 		adminUserInfo.Subscibes = subscibes
343
 		adminUserInfo.Subscibes = subscibes

+ 14 - 2
controllers/dialysis_api_controller.go View File

284
 		if appRole.UserType == 2 || appRole.UserType == 1 {
284
 		if appRole.UserType == 2 || appRole.UserType == 1 {
285
 			prescription_doctor := adminUserInfo.AdminUser.Id
285
 			prescription_doctor := adminUserInfo.AdminUser.Id
286
 			prescription.PrescriptionDoctor = prescription_doctor
286
 			prescription.PrescriptionDoctor = prescription_doctor
287
+
287
 		}
288
 		}
289
+
288
 		if dialysisPrescription.Creater == 0 { //体重称
290
 		if dialysisPrescription.Creater == 0 { //体重称
289
 			prescription.Creater = adminUserInfo.AdminUser.Id
291
 			prescription.Creater = adminUserInfo.AdminUser.Id
290
 
292
 
402
 
404
 
403
 	if appRole.UserType == 2 || appRole.UserType == 1 {
405
 	if appRole.UserType == 2 || appRole.UserType == 1 {
404
 		prescription_doctor = appRole.AdminUserId
406
 		prescription_doctor = appRole.AdminUserId
405
-	} else {
406
-		prescription_doctor = 0
407
 	}
407
 	}
408
 
408
 
409
 	if mode_id > 0 {
409
 	if mode_id > 0 {
492
 
492
 
493
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
493
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
494
 	if dialysisPrescription.ID == 0 { //新增
494
 	if dialysisPrescription.ID == 0 { //新增
495
+		if appRole.UserType == 2 || appRole.UserType == 1 {
496
+			prescription.PrescriptionDoctor = adminUserInfo.AdminUser.Id
497
+		}
498
+
495
 		prescription.Creater = adminUserInfo.AdminUser.Id
499
 		prescription.Creater = adminUserInfo.AdminUser.Id
500
+		//prescription.Creater = adminUserInfo.AdminUser.Id
496
 	} else { //修改
501
 	} else { //修改
497
 
502
 
498
 		//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
503
 		//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
508
 		//		}
513
 		//		}
509
 		//	}
514
 		//	}
510
 		//}
515
 		//}
516
+		if appRole.UserType == 2 || appRole.UserType == 1 {
517
+			prescription_doctor := adminUserInfo.AdminUser.Id
518
+			prescription.PrescriptionDoctor = prescription_doctor
519
+		} else {
520
+			prescription.PrescriptionDoctor = dialysisPrescription.PrescriptionDoctor
521
+		}
522
+
511
 		if dialysisPrescription.Creater == 0 {
523
 		if dialysisPrescription.Creater == 0 {
512
 			prescription.Creater = adminUserInfo.AdminUser.Id
524
 			prescription.Creater = adminUserInfo.AdminUser.Id
513
 		} else {
525
 		} else {

+ 20 - 21
controllers/mobile_api_controllers/patient_api_controller.go View File

552
 	//}
552
 	//}
553
 
553
 
554
 	var advice models.DoctorAdvice
554
 	var advice models.DoctorAdvice
555
+	var tempAdvices []models.DoctorAdvice
555
 
556
 
556
 	if groupno > 0 {
557
 	if groupno > 0 {
557
-		advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
558
+		advices, _ := service.FindAllDoctorAdviceByGoroupNoTwo(adminUserInfo.Org.Id, groupno)
559
+		tempAdvices = advices
558
 		for _, item := range advices {
560
 		for _, item := range advices {
559
 			if item.ExecutionState == 2 {
561
 			if item.ExecutionState == 2 {
560
 				advice = item
562
 				advice = item
562
 			}
564
 			}
563
 		}
565
 		}
564
 	} else {
566
 	} else {
565
-		advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
567
+		advices, _ := service.FindDoctorAdviceByIdsTwo(adminUserInfo.Org.Id, ids)
568
+		tempAdvices = advices
569
+
566
 		for _, item := range advices {
570
 		for _, item := range advices {
567
 			if item.ExecutionState == 2 {
571
 			if item.ExecutionState == 2 {
568
 				advice = item
572
 				advice = item
622
 
626
 
623
 	if drugStockConfig.IsOpen == 1 {
627
 	if drugStockConfig.IsOpen == 1 {
624
 		if groupno > 0 {
628
 		if groupno > 0 {
625
-			advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
629
+			//advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
626
 			isHasWay := false //用来判断是否包含来自药品库的医嘱
630
 			isHasWay := false //用来判断是否包含来自药品库的医嘱
627
 			record_time := int64(0)
631
 			record_time := int64(0)
628
-			for _, item := range advices {
632
+			for _, item := range tempAdvices {
629
 				if item.Way == 1 {
633
 				if item.Way == 1 {
630
 					isHasWay = true
634
 					isHasWay = true
631
 					record_time = item.RecordDate
635
 					record_time = item.RecordDate
662
 					if err != nil {
666
 					if err != nil {
663
 						utils.TraceLog("创建出库单失败 err = %v", err)
667
 						utils.TraceLog("创建出库单失败 err = %v", err)
664
 					} else {
668
 					} else {
665
-						for _, item := range advices {
669
+						for _, item := range tempAdvices {
666
 							if item.Way == 1 {
670
 							if item.Way == 1 {
667
 								if item.PrescribingNumber > 0 {
671
 								if item.PrescribingNumber > 0 {
668
 									warehouseOutInfo := &models.DrugWarehouseOutInfo{
672
 									warehouseOutInfo := &models.DrugWarehouseOutInfo{
707
 					}
711
 					}
708
 
712
 
709
 				} else if err == nil {
713
 				} else if err == nil {
710
-					for _, item := range advices {
714
+					for _, item := range tempAdvices {
711
 						if item.Way == 1 {
715
 						if item.Way == 1 {
712
 							outInfo, err := service.FindDrugStockOutInfoByTypeId(adminUserInfo.Org.Id, item.DrugId, out.ID, out.WarehouseOutOrderNumber)
716
 							outInfo, err := service.FindDrugStockOutInfoByTypeId(adminUserInfo.Org.Id, item.DrugId, out.ID, out.WarehouseOutOrderNumber)
713
 							if err == gorm.ErrRecordNotFound {
717
 							if err == gorm.ErrRecordNotFound {
781
 
785
 
782
 			}
786
 			}
783
 		} else {
787
 		} else {
784
-			advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
788
+			//advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
785
 			isHasWay := false //用来判断是否包含来自药品库的医嘱
789
 			isHasWay := false //用来判断是否包含来自药品库的医嘱
786
 			record_time := int64(0)
790
 			record_time := int64(0)
787
-			for _, item := range advices {
791
+			for _, item := range tempAdvices {
788
 				if item.Way == 1 {
792
 				if item.Way == 1 {
789
 					isHasWay = true
793
 					isHasWay = true
790
 					record_time = item.RecordDate
794
 					record_time = item.RecordDate
821
 					if err != nil {
825
 					if err != nil {
822
 						utils.TraceLog("创建出库单失败 err = %v", err)
826
 						utils.TraceLog("创建出库单失败 err = %v", err)
823
 					} else {
827
 					} else {
824
-						for _, item := range advices {
828
+						for _, item := range tempAdvices {
825
 							if item.Way == 1 {
829
 							if item.Way == 1 {
826
 								if item.PrescribingNumber > 0 {
830
 								if item.PrescribingNumber > 0 {
827
 									warehouseOutInfo := &models.DrugWarehouseOutInfo{
831
 									warehouseOutInfo := &models.DrugWarehouseOutInfo{
866
 					}
870
 					}
867
 
871
 
868
 				} else if err == nil {
872
 				} else if err == nil {
869
-					for _, item := range advices {
873
+					for _, item := range tempAdvices {
870
 						if item.Way == 1 {
874
 						if item.Way == 1 {
871
 							outInfo, err := service.FindDrugStockOutInfoByTypeId(adminUserInfo.Org.Id, item.DrugId, out.ID, out.WarehouseOutOrderNumber)
875
 							outInfo, err := service.FindDrugStockOutInfoByTypeId(adminUserInfo.Org.Id, item.DrugId, out.ID, out.WarehouseOutOrderNumber)
872
 							if err == gorm.ErrRecordNotFound {
876
 							if err == gorm.ErrRecordNotFound {
950
 
954
 
951
 	if privateDrugConfig != nil && privateDrugConfig.DrugStart == 1 {
955
 	if privateDrugConfig != nil && privateDrugConfig.DrugStart == 1 {
952
 		if groupno > 0 {
956
 		if groupno > 0 {
953
-			advices, _ := service.FindAllDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
954
-			for _, item := range advices {
957
+			//advices, _ := service.FindAllDoct/**/orAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
958
+			for _, item := range tempAdvices {
955
 				fmt.Println("------------进来没有22222222", item.ExecutionState)
959
 				fmt.Println("------------进来没有22222222", item.ExecutionState)
956
 				if item.ExecutionState == 1 {
960
 				if item.ExecutionState == 1 {
957
 					prescribingNumber := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
961
 					prescribingNumber := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
987
 			}
991
 			}
988
 		} else {
992
 		} else {
989
 
993
 
990
-			advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
991
-			for _, item := range advices {
994
+			//advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
995
+			for _, item := range tempAdvices {
992
 				if item.ExecutionState == 1 {
996
 				if item.ExecutionState == 1 {
993
 
997
 
994
 					prescribingNumber := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
998
 					prescribingNumber := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
2072
 		internal_fistula_skin := dataBody["internal_fistula_skin"].(string)
2076
 		internal_fistula_skin := dataBody["internal_fistula_skin"].(string)
2073
 		evaluation.InternalFistulaSkin = internal_fistula_skin
2077
 		evaluation.InternalFistulaSkin = internal_fistula_skin
2074
 	}
2078
 	}
2075
-	if dataBody["is_hemorrhage"] != nil && reflect.TypeOf(dataBody["is_hemorrhage"]).String() == "string" {
2076
-		ishemorrhage, _ := dataBody["is_hemorrhage"].(string)
2077
-		is_hemorrhage, _ := strconv.ParseInt(ishemorrhage, 10, 64)
2078
-		evaluation.IsHemorrhage = is_hemorrhage
2079
 
2079
 
2080
-		//if dataBody["is_hemorrhage"] != nil && reflect.TypeOf(dataBody["is_hemorrhage"]).String() == "float64" {
2081
-		//	is_hemorrhage := int64(dataBody["is_hemorrhage"].(float64))
2082
-		//	fmt.Println("is_hemorrhage2222222222222222",is_hemorrhage)
2080
+	if dataBody["is_hemorrhage"] != nil && reflect.TypeOf(dataBody["is_hemorrhage"]).String() == "float64" {
2081
+		is_hemorrhage := int64(dataBody["is_hemorrhage"].(float64))
2083
 		if is_hemorrhage != 1 && is_hemorrhage != 2 {
2082
 		if is_hemorrhage != 1 && is_hemorrhage != 2 {
2084
 			is_hemorrhage = 0
2083
 			is_hemorrhage = 0
2085
 		}
2084
 		}

+ 1 - 1
controllers/verify_login_controller.go View File

277
 					}
277
 					}
278
 				}
278
 				}
279
 			}
279
 			}
280
-
280
+			curAppUrlfors = append(curAppUrlfors, "/home")
281
 			for _, item := range pruviews {
281
 			for _, item := range pruviews {
282
 				if item.Module == 6 {
282
 				if item.Module == 6 {
283
 					didRegistedForSCRM = true
283
 					didRegistedForSCRM = true

+ 10 - 0
service/patient_service.go View File

1359
 	}
1359
 	}
1360
 	return
1360
 	return
1361
 }
1361
 }
1362
+
1363
+func FindAllDoctorAdviceByGoroupNoTwo(orgID int64, groupno int64) (advice []models.DoctorAdvice, err error) {
1364
+	err = readDb.Model(&models.DoctorAdvice{}).Where("user_org_id=?  AND groupno = ? AND status = 1 AND execution_state = 2", orgID, groupno).Find(&advice).Error
1365
+	return
1366
+}
1367
+
1368
+func FindDoctorAdviceByIdsTwo(orgID int64, ids []string) (advice []models.DoctorAdvice, err error) {
1369
+	err = readDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? AND status = 1 AND execution_state = 2 OR (id IN (?) AND patient_id IN (?))", orgID, ids, ids).Find(&advice).Error
1370
+	return
1371
+}