张保健 4 years ago
parent
commit
2c3a5e6a54
2 changed files with 48 additions and 7 deletions
  1. 7 7
      conf/app.conf
  2. 41 0
      controllers/mobile_api_controllers/check_weight_api_controller.go

+ 7 - 7
conf/app.conf View File

@@ -143,33 +143,33 @@ aliquid = 83
143 143
 [dev]
144 144
 mobile_token_expiration_second = 3600
145 145
 httpdomain = http://new_mobile.xt.api.sgjyun.com
146
-sso_domain = https://testsso.sgjyun.com
146
+sso_domain = http://testsso.sgjyun.com
147 147
 front_end_domain = "http://xt.test.sgjyun.com/#"
148 148
 
149 149
 readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
150 150
 readmysqlport = 3306
151 151
 readmysqluser = root
152 152
 readmysqlpass = 1Q2W3e4r!@#$
153
-readmysqlname = sgj_xt
153
+readmysqlname = test_xt
154 154
 
155 155
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
156 156
 writemysqlport = 3306
157 157
 writemysqluser = root
158 158
 writemysqlpass = 1Q2W3e4r!@#$
159
-writemysqlname = sgj_xt
159
+writemysqlname = test_xt
160 160
 
161 161
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
162 162
 readuserport = 3306
163 163
 readuseruser = root
164 164
 readuserpass = 1Q2W3e4r!@#$
165
-readusername = sgj_users
165
+readusername = test_users
166 166
 
167 167
 
168 168
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
169 169
 writeuserport = 3306
170 170
 writeuseruser = root
171 171
 writeuserpass = 1Q2W3e4r!@#$
172
-writeusername = sgj_users
172
+writeusername = test_users
173 173
 
174 174
 
175 175
 
@@ -215,8 +215,8 @@ writesgjpatientmysqlname = sgj_patient
215 215
 
216 216
 
217 217
 #redishost = 120.77.235.13
218
-#redishost = 112.74.16.180
219
-redishost = localhost
218
+redishost = 112.74.16.180
219
+# redishost = localhost
220 220
 redisport = 6379
221 221
 redispasswrod = 123456
222 222
 redisdb = 0

+ 41 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -846,6 +846,8 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
846 846
 	// 获取患者透前干体重或者获取患者透前体重
847 847
 	var dry_weight map[string]interface{}
848 848
 	dry_weight = make(map[string]interface{})
849
+	var after_dry_weight map[string]interface{}
850
+	after_dry_weight = make(map[string]interface{})
849 851
 	if dialysistype == 1 {
850 852
 
851 853
 		lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluation(adminUserInfo.Org.Id, id, endTime)
@@ -900,6 +902,44 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
900 902
 				dry_weight["dry_weight"] = predialysisEvaluation.WeightBefore
901 903
 			}
902 904
 		}
905
+
906
+		lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluation(adminUserInfo.Org.Id, id, endTime)
907
+		weight, err := service.FindLastDryWeightAdjust(adminUserInfo.Org.Id, id)
908
+		if err == gorm.ErrRecordNotFound {
909
+			if getLPEErr != nil {
910
+				after_dry_weight["code"] = 1
911
+				after_dry_weight["dry_weight"] = nil
912
+			} else {
913
+				if lastPredialysisEvaluation == nil {
914
+					after_dry_weight["code"] = 1
915
+					after_dry_weight["dry_weight"] = nil
916
+				} else {
917
+					// 传输的干体重实际为干体重加上衣服重
918
+					after_dry_weight["code"] = 0
919
+					after_dry_weight["dry_weight"] = lastPredialysisEvaluation.DryWeight + lastPredialysisEvaluation.AdditionalWeight
920
+				}
921
+			}
922
+		} else {
923
+			if err != nil {
924
+				after_dry_weight["code"] = 1
925
+				after_dry_weight["dry_weight"] = nil
926
+			} else {
927
+				after_dry_weight["code"] = 0
928
+				if getLPEErr != nil {
929
+					after_dry_weight["code"] = 0
930
+					after_dry_weight["dry_weight"] = weight.DryWeight
931
+				} else {
932
+					if lastPredialysisEvaluation == nil {
933
+						after_dry_weight["code"] = 1
934
+						after_dry_weight["dry_weight"] = weight.DryWeight
935
+					} else {
936
+						// 传输的干体重实际为干体重加上衣服重
937
+						after_dry_weight["code"] = 0
938
+						after_dry_weight["dry_weight"] = weight.DryWeight + lastPredialysisEvaluation.AdditionalWeight
939
+					}
940
+				}
941
+			}
942
+		}
903 943
 	}
904 944
 
905 945
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -907,6 +947,7 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
907 947
 		"patient":      dialysisinfo,
908 948
 		"schedule":     sc,
909 949
 		"dryweight":    dry_weight,
950
+		"after_dry_weight":    after_dry_weight,
910 951
 	})
911 952
 	return
912 953
 }