浏览代码

修改redis清除数据时间

csx 4 年前
父节点
当前提交
f6978ddc9b

+ 2 - 2
conf/app.conf 查看文件

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

+ 14 - 6
controllers/base_api_controller.go 查看文件

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

+ 14 - 2
controllers/dialysis_api_controller.go 查看文件

@@ -284,7 +284,9 @@ func (c *DialysisApiController) PostPrescription() {
284 284
 		if appRole.UserType == 2 || appRole.UserType == 1 {
285 285
 			prescription_doctor := adminUserInfo.AdminUser.Id
286 286
 			prescription.PrescriptionDoctor = prescription_doctor
287
+
287 288
 		}
289
+
288 290
 		if dialysisPrescription.Creater == 0 { //体重称
289 291
 			prescription.Creater = adminUserInfo.AdminUser.Id
290 292
 
@@ -402,8 +404,6 @@ func (c *DialysisApiController) PostSoulution() {
402 404
 
403 405
 	if appRole.UserType == 2 || appRole.UserType == 1 {
404 406
 		prescription_doctor = appRole.AdminUserId
405
-	} else {
406
-		prescription_doctor = 0
407 407
 	}
408 408
 
409 409
 	if mode_id > 0 {
@@ -492,7 +492,12 @@ func (c *DialysisApiController) PostSoulution() {
492 492
 
493 493
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
494 494
 	if dialysisPrescription.ID == 0 { //新增
495
+		if appRole.UserType == 2 || appRole.UserType == 1 {
496
+			prescription.PrescriptionDoctor = adminUserInfo.AdminUser.Id
497
+		}
498
+
495 499
 		prescription.Creater = adminUserInfo.AdminUser.Id
500
+		//prescription.Creater = adminUserInfo.AdminUser.Id
496 501
 	} else { //修改
497 502
 
498 503
 		//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
@@ -508,6 +513,13 @@ func (c *DialysisApiController) PostSoulution() {
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 523
 		if dialysisPrescription.Creater == 0 {
512 524
 			prescription.Creater = adminUserInfo.AdminUser.Id
513 525
 		} else {

+ 20 - 21
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

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

+ 1 - 1
controllers/verify_login_controller.go 查看文件

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

+ 10 - 0
service/patient_service.go 查看文件

@@ -1359,3 +1359,13 @@ func GetPatientsByKey(orgID int64, keywords string) (patient []*models.Patients,
1359 1359
 	}
1360 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
+}