Browse Source

新功能

csx 4 years ago
parent
commit
4fb5ef468b

+ 4 - 4
controllers/base_api_controller.go View File

@@ -81,7 +81,7 @@ func (this *BaseAuthAPIController) Prepare() {
81 81
 		userAdmin.ModifyTime = 1530786071
82 82
 		var subscibe models.ServeSubscibe
83 83
 		subscibe.ID = 1
84
-		subscibe.OrgId = 9841
84
+		subscibe.OrgId = 3907
85 85
 		subscibe.PeriodStart = 1538035409
86 86
 		subscibe.PeriodEnd = 1569571409
87 87
 		subscibe.State = 1
@@ -91,7 +91,7 @@ func (this *BaseAuthAPIController) Prepare() {
91 91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92 92
 		subscibes[4] = &subscibe
93 93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 9841
94
+		adminUserInfo.CurrentOrgId = 3907
95 95
 		adminUserInfo.CurrentAppId = 18
96 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
@@ -326,7 +326,7 @@ func (this *BaseServeAPIController) Prepare() {
326 326
 		userAdmin.ModifyTime = 1530786071
327 327
 		var subscibe models.ServeSubscibe
328 328
 		subscibe.ID = 1
329
-		subscibe.OrgId = 9841
329
+		subscibe.OrgId = 3907
330 330
 		subscibe.PeriodStart = 1538035409
331 331
 		subscibe.PeriodEnd = 1569571409
332 332
 		subscibe.State = 1
@@ -336,7 +336,7 @@ func (this *BaseServeAPIController) Prepare() {
336 336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337 337
 		subscibes[4] = &subscibe
338 338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 9841
339
+		adminUserInfo.CurrentOrgId = 3907
340 340
 		adminUserInfo.CurrentAppId = 18
341 341
 		adminUserInfo.AdminUser = &userAdmin
342 342
 		adminUserInfo.Subscibes = subscibes

+ 1 - 0
controllers/dialysis_api_controller.go View File

@@ -4372,6 +4372,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
4372 4372
 	receiverTreatmentAccess, _ := service.FindReceiverTreatmentAccessRecordById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4373 4373
 
4374 4374
 	check, _ := service.FindDoubleCheckById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4375
+
4375 4376
 	dialysis_count, _ := service.GetDialysisOrderCount(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4376 4377
 	patientInfo.TotalDialysis = dialysis_count
4377 4378
 

+ 51 - 51
controllers/dialysis_record_api_controller.go View File

@@ -369,33 +369,33 @@ type EditMonitorParamObject struct {
369 369
 	MonitoringDate int64 `json:"monitoring_date"`
370 370
 	OperateTime    int64 `json:"operate_time"`
371 371
 	// MonitoringTime        string  `json:"monitoring_time"`
372
-	SystolicBP               float64 `json:"systolic_bp"`
373
-	DiastolicBP              float64 `json:"diastolic_bp"`
374
-	PulseFrequency           float64 `json:"pulse_frequency"`
375
-	BreathingRated           float64 `json:"breathing_rated"`
376
-	BloodFlowVolume          float64 `json:"blood_flow_volume"`
377
-	VenousPressure           float64 `json:"venous_pressure"`
378
-	VenousPressureType       int64 `json:"venous_pressure_type"`
379
-	TransmembranePressure    float64 `json:"transmembrane_pressure"`
380
-	TransmembranePressureType int64 `json:"transmembrane_pressure_type"`
381
-	UltrafiltrationVolume    float64 `json:"ultrafiltration_volume"`
382
-	UltrafiltrationRate      float64 `json:"ultrafiltration_rate"`
383
-	ArterialPressure         float64 `json:"arterial_pressure"`
384
-	ArterialPressureType     int64 `json:"arterial_pressure_type"`
385
-	SodiumConcentration      float64 `json:"sodium_concentration"`
386
-	DialysateTemperature     float64 `json:"dialysate_temperature"`
387
-	Temperature              float64 `json:"temperature"`
388
-	ReplacementRate          float64 `json:"replacement_rate"`
389
-	DisplacementQuantity     float64 `json:"displacement_quantity"`
390
-	KTV                      float64 `json:"ktv"`
391
-	Symptom                  string  `json:"symptom"`
392
-	Dispose                  string  `json:"dispose"`
393
-	Result                   string  `json:"result"`
394
-	Conductivity             float64 `json:"conductivity"`
395
-	DisplacementFlowQuantity float64 `json:"displacement_flow_quantity"`
396
-	BloodOxygenSaturation    string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
397
-	Heparin                  float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
398
-	DialysateFlow            float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
372
+	SystolicBP                float64 `json:"systolic_bp"`
373
+	DiastolicBP               float64 `json:"diastolic_bp"`
374
+	PulseFrequency            float64 `json:"pulse_frequency"`
375
+	BreathingRated            float64 `json:"breathing_rated"`
376
+	BloodFlowVolume           float64 `json:"blood_flow_volume"`
377
+	VenousPressure            float64 `json:"venous_pressure"`
378
+	VenousPressureType        int64   `json:"venous_pressure_type"`
379
+	TransmembranePressure     float64 `json:"transmembrane_pressure"`
380
+	TransmembranePressureType int64   `json:"transmembrane_pressure_type"`
381
+	UltrafiltrationVolume     float64 `json:"ultrafiltration_volume"`
382
+	UltrafiltrationRate       float64 `json:"ultrafiltration_rate"`
383
+	ArterialPressure          float64 `json:"arterial_pressure"`
384
+	ArterialPressureType      int64   `json:"arterial_pressure_type"`
385
+	SodiumConcentration       float64 `json:"sodium_concentration"`
386
+	DialysateTemperature      float64 `json:"dialysate_temperature"`
387
+	Temperature               float64 `json:"temperature"`
388
+	ReplacementRate           float64 `json:"replacement_rate"`
389
+	DisplacementQuantity      float64 `json:"displacement_quantity"`
390
+	KTV                       float64 `json:"ktv"`
391
+	Symptom                   string  `json:"symptom"`
392
+	Dispose                   string  `json:"dispose"`
393
+	Result                    string  `json:"result"`
394
+	Conductivity              float64 `json:"conductivity"`
395
+	DisplacementFlowQuantity  float64 `json:"displacement_flow_quantity"`
396
+	BloodOxygenSaturation     string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
397
+	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
398
+	DialysateFlow             float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
399 399
 }
400 400
 
401 401
 // /api/dislysis/monitor/edit [post]
@@ -472,31 +472,31 @@ func (this *DialysisRecordAPIController) EditMonitor() {
472 472
 			MonitoringDate:  monitorParam.MonitoringDate,
473 473
 			OperateTime:     monitorParam.OperateTime,
474 474
 			// MonitoringTime:         monitorParam.MonitoringTime,
475
-			PulseFrequency:           monitorParam.PulseFrequency,
476
-			BreathingRate:            monitorParam.BreathingRated,
477
-			SystolicBloodPressure:    monitorParam.SystolicBP,
478
-			DiastolicBloodPressure:   monitorParam.DiastolicBP,
479
-			BloodFlowVolume:          monitorParam.BloodFlowVolume,
480
-			VenousPressure:           monitorParam.VenousPressure,
481
-			VenousPressureType:       monitorParam.VenousPressureType,
482
-			ArterialPressure:         monitorParam.ArterialPressure,
483
-			ArterialPressureType:     monitorParam.ArterialPressureType,
484
-			TransmembranePressure:    monitorParam.TransmembranePressure,
475
+			PulseFrequency:            monitorParam.PulseFrequency,
476
+			BreathingRate:             monitorParam.BreathingRated,
477
+			SystolicBloodPressure:     monitorParam.SystolicBP,
478
+			DiastolicBloodPressure:    monitorParam.DiastolicBP,
479
+			BloodFlowVolume:           monitorParam.BloodFlowVolume,
480
+			VenousPressure:            monitorParam.VenousPressure,
481
+			VenousPressureType:        monitorParam.VenousPressureType,
482
+			ArterialPressure:          monitorParam.ArterialPressure,
483
+			ArterialPressureType:      monitorParam.ArterialPressureType,
484
+			TransmembranePressure:     monitorParam.TransmembranePressure,
485 485
 			TransmembranePressureType: monitorParam.TransmembranePressureType,
486
-			UltrafiltrationRate:      monitorParam.UltrafiltrationRate,
487
-			UltrafiltrationVolume:    monitorParam.UltrafiltrationVolume,
488
-			SodiumConcentration:      monitorParam.SodiumConcentration,
489
-			DialysateTemperature:     monitorParam.DialysateTemperature,
490
-			Temperature:              monitorParam.Temperature,
491
-			ReplacementRate:          monitorParam.ReplacementRate,
492
-			DisplacementQuantity:     monitorParam.DisplacementQuantity,
493
-			Ktv:                      monitorParam.KTV,
494
-			Symptom:                  monitorParam.Symptom,
495
-			Dispose:                  monitorParam.Dispose,
496
-			Result:                   monitorParam.Result,
497
-			MonitoringNurse:          adminUserInfo.AdminUser.Id,
498
-			Conductivity:             monitorParam.Conductivity,
499
-			DisplacementFlowQuantity: monitorParam.DisplacementFlowQuantity,
486
+			UltrafiltrationRate:       monitorParam.UltrafiltrationRate,
487
+			UltrafiltrationVolume:     monitorParam.UltrafiltrationVolume,
488
+			SodiumConcentration:       monitorParam.SodiumConcentration,
489
+			DialysateTemperature:      monitorParam.DialysateTemperature,
490
+			Temperature:               monitorParam.Temperature,
491
+			ReplacementRate:           monitorParam.ReplacementRate,
492
+			DisplacementQuantity:      monitorParam.DisplacementQuantity,
493
+			Ktv:                       monitorParam.KTV,
494
+			Symptom:                   monitorParam.Symptom,
495
+			Dispose:                   monitorParam.Dispose,
496
+			Result:                    monitorParam.Result,
497
+			MonitoringNurse:           adminUserInfo.AdminUser.Id,
498
+			Conductivity:              monitorParam.Conductivity,
499
+			DisplacementFlowQuantity:  monitorParam.DisplacementFlowQuantity,
500 500
 			Status:                1,
501 501
 			CreatedTime:           time.Now().Unix(),
502 502
 			UpdatedTime:           time.Now().Unix(),

+ 1 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -2752,7 +2752,7 @@ func (this *DialysisAPIController) StartDialysis() {
2752 2752
 			}
2753 2753
 
2754 2754
 			if template.TemplateId == 20 { //adminUserInfo.Org.Id == 9538
2755
-				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 )
2755
+				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
2756 2756
 			}
2757 2757
 
2758 2758
 			// 只针对方济医院

+ 40 - 12
controllers/mobile_api_controllers/mobile_api_base_controller.go View File

@@ -5,9 +5,11 @@ import (
5 5
 	"XT_New/enums"
6 6
 	"XT_New/models"
7 7
 	"XT_New/service"
8
+	"encoding/json"
8 9
 	"fmt"
9 10
 	"strconv"
10 11
 	"strings"
12
+	"time"
11 13
 )
12 14
 
13 15
 type MobileBaseAPIController struct {
@@ -117,27 +119,53 @@ func (this *MobileBaseAPIAuthController) Prepare() {
117 119
 				roles = strings.Split(role.RoleIds, ",")
118 120
 			}
119 121
 
122
+			//redis相关处理逻辑
123
+			redis := service.RedisClient()
124
+			defer redis.Close()
125
+
126
+			//redis key值
127
+			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
128
+			purviews_json_str, _ := redis.Get(key).Result()
120 129
 			//获取该用户下所有角色的权限总集
121 130
 			var userRolePurviews string
122 131
 			var userRolePurviewsArr []string
123
-			for _, item := range roles {
124
-				role_id, _ := strconv.ParseInt(item, 10, 64)
125
-				purviews, _ := service.GetRoleFuncPurviewIds(role_id)
126
-				if len(userRolePurviews) == 0 {
127
-					userRolePurviews = purviews
132
+
133
+			fmt.Println("----redis 开始----")
134
+			fmt.Println(purviews_json_str)
135
+			fmt.Println("----redis 结束----")
136
+
137
+			if len(purviews_json_str) == 0 {
138
+				for _, item := range roles {
139
+					role_id, _ := strconv.ParseInt(item, 10, 64)
140
+					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
141
+					if len(userRolePurviews) == 0 {
142
+						userRolePurviews = purviews
143
+					} else {
144
+						userRolePurviews = userRolePurviews + "," + purviews
145
+					}
146
+				}
147
+				//该用户所拥有角色的权限的总集
148
+				userRolePurviewsArr = RemoveRepeatedPurviewElement(strings.Split(userRolePurviews, ","))
149
+				//缓存数据
150
+				purview_json, err := json.Marshal(userRolePurviewsArr)
151
+				if err == nil {
152
+					redis.Set(key, purview_json, time.Minute*60*60*24)
153
+				}
154
+			} else {
155
+				var dat []string
156
+				if err := json.Unmarshal([]byte(purviews_json_str), &dat); err == nil {
157
+
128 158
 				} else {
129
-					userRolePurviews = userRolePurviews + "," + purviews
159
+
130 160
 				}
161
+				userRolePurviewsArr = dat
131 162
 			}
132
-			//该用户所拥有角色的权限的总集
133
-			userRolePurviewsArr = RemoveRepeatedPurviewElement(strings.Split(userRolePurviews, ","))
163
+
164
+			fmt.Println(userRolePurviewsArr)
165
+
134 166
 			//系统所记录的权限列表
135 167
 			allPermission, _ := service.GetAllFunctionPurview()
136
-
137 168
 			for _, item := range allPermission {
138
-				// fmt.Println(strings.Split(item.Urlfor, ",")[0])
139
-				// fmt.Println(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
140
-
141 169
 				//判断当前路由是否在权限路由列表里面
142 170
 				if strings.Split(item.Urlfor, ",")[0] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {
143 171