Browse Source

bug修改

XMLWAN 4 years ago
parent
commit
b327b9ae18

+ 14 - 9
controllers/gobal_config_api_controller.go View File

@@ -1027,16 +1027,21 @@ func (this *GobalConfigApiController) ChangeOrg() {
1027 1027
 			}
1028 1028
 		}
1029 1029
 
1030
-		QualityeList, err := service.FindQualityByOrgId(tempOrg.Id)
1031
-		if len(QualityeList) == 0 {
1032
-			err = service.BatchInsertQualityControl(tempOrg.Id)
1033
-		} else {
1034
-			utils.ErrorLog("字段批量插入失败:%v", err)
1035
-		}
1030
+		major, err := service.GetInspectionMajor(tempOrg.Id)
1031
+		if len(major) == 0 {
1032
+			QualityeList, err := service.FindQualityByOrgId(tempOrg.Id)
1033
+			if len(QualityeList) == 0 {
1034
+				err = service.BatchInsertQualityControl(tempOrg.Id)
1035
+			} else {
1036
+				utils.ErrorLog("字段批量插入失败:%v", err)
1037
+			}
1036 1038
 
1037
-		InspectionList, err := service.FindeInspectionByOrgId(tempOrg.Id)
1038
-		if len(InspectionList) == 0 {
1039
-			err = service.BatchInspectionConfiguration(tempOrg.Id)
1039
+			InspectionList, err := service.FindeInspectionByOrgId(tempOrg.Id)
1040
+			if len(InspectionList) == 0 {
1041
+				err = service.BatchInspectionConfiguration(tempOrg.Id)
1042
+			} else {
1043
+				utils.ErrorLog("字段批量插入失败:%v", err)
1044
+			}
1040 1045
 		} else {
1041 1046
 			utils.ErrorLog("字段批量插入失败:%v", err)
1042 1047
 		}

+ 16 - 11
controllers/mobile_api_controllers/login_api_controller.go View File

@@ -168,19 +168,24 @@ func (this *LoginAPIController) LoginByPwd() {
168 168
 		}
169 169
 
170 170
 		//批量插入质控达标统计配置
171
-		QualityeList, err := service.FindQualityByOrgId(org.Id)
172
-		if len(QualityeList) == 0 {
173
-			err = service.BatchInsertQualityControl(org.Id)
174
-		} else {
175
-			utils.ErrorLog("字段批量插入失败:%v", err)
176
-		}
171
+		major, requestErr := service.GetInspectionMajor(org.Id)
172
+		if len(major) == 0 {
173
+			QualityeList, err := service.FindQualityByOrgId(org.Id)
174
+			if len(QualityeList) == 0 {
175
+				err = service.BatchInsertQualityControl(org.Id)
176
+			} else {
177
+				utils.ErrorLog("字段批量插入失败:%v", err)
178
+			}
177 179
 
178
-		//批量插入检验检查统计配置
179
-		InspectionList, err := service.FindeInspectionByOrgId(org.Id)
180
-		if len(InspectionList) == 0 {
181
-			err = service.BatchInspectionConfiguration(org.Id)
180
+			//批量插入检验检查统计配置
181
+			InspectionList, err := service.FindeInspectionByOrgId(org.Id)
182
+			if len(InspectionList) == 0 {
183
+				err = service.BatchInspectionConfiguration(org.Id)
184
+			} else {
185
+				utils.ErrorLog("字段批量插入失败:%v", err)
186
+			}
182 187
 		} else {
183
-			utils.ErrorLog("字段批量插入失败:%v", err)
188
+			utils.ErrorLog("字段批量插入失败:%v", requestErr)
184 189
 		}
185 190
 
186 191
 		this.ServeSuccessJSON(map[string]interface{}{

+ 2 - 0
controllers/new_mobile_api_controllers/common_api_controller.go View File

@@ -877,8 +877,10 @@ func (this *CommonApiController) GetNormData() {
877 877
 	orgid := this.GetAdminUserInfo().CurrentOrgId
878 878
 	//获取系统数据
879 879
 	normdata, err := service.GetNormDataByOrgId(orgid)
880
+	fmt.Println("normdata==============================", normdata)
880 881
 	if len(normdata) == 0 {
881 882
 		normdata, err := service.GetNormData(0)
883
+		fmt.Println("normdata=============================+++++", normdata)
882 884
 		if err != nil {
883 885
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
884 886
 			return

+ 16 - 10
controllers/new_mobile_api_controllers/forget_password_controller.go View File

@@ -180,19 +180,25 @@ func (this *ForgetPwdController) ModifyPassword() {
180 180
 			}
181 181
 
182 182
 			if org.Id > 0 {
183
-				QualityeList, err := service.FindQualityByOrgId(org.Id)
184
-				if len(QualityeList) == 0 {
185
-					err = service.BatchInsertQualityControl(org.Id)
186
-				} else {
187
-					utils.ErrorLog("字段批量插入失败:%v", err)
188
-				}
183
+				major, requestErr := service.GetInspectionMajor(org.Id)
184
+				if len(major) == 0 {
185
+					QualityeList, err := service.FindQualityByOrgId(org.Id)
186
+					if len(QualityeList) == 0 {
187
+						err = service.BatchInsertQualityControl(org.Id)
188
+					} else {
189
+						utils.ErrorLog("字段批量插入失败:%v", err)
190
+					}
189 191
 
190
-				InspectionList, err := service.FindeInspectionByOrgId(org.Id)
191
-				if len(InspectionList) == 0 {
192
-					err = service.BatchInspectionConfiguration(org.Id)
192
+					InspectionList, err := service.FindeInspectionByOrgId(org.Id)
193
+					if len(InspectionList) == 0 {
194
+						err = service.BatchInspectionConfiguration(org.Id)
195
+					} else {
196
+						utils.ErrorLog("字段批量插入失败:%v", err)
197
+					}
193 198
 				} else {
194
-					utils.ErrorLog("字段批量插入失败:%v", err)
199
+					utils.ErrorLog("字段批量插入失败:%v", requestErr)
195 200
 				}
201
+
196 202
 			}
197 203
 
198 204
 			this.ServeSuccessJSON(map[string]interface{}{

+ 31 - 19
controllers/new_mobile_api_controllers/home_api_controller.go View File

@@ -234,19 +234,25 @@ func (this *HomeController) ChangeOrg() {
234 234
 			}
235 235
 
236 236
 			if org.Id > 0 {
237
-				QualityeList, err := service.FindQualityByOrgId(org.Id)
238
-				if len(QualityeList) == 0 {
239
-					err = service.BatchInsertQualityControl(org.Id)
240
-				} else {
241
-					utils.ErrorLog("字段批量插入失败:%v", err)
242
-				}
237
+				major, err := service.GetInspectionMajor(org.Id)
238
+				if len(major) == 0 {
239
+					QualityeList, err := service.FindQualityByOrgId(org.Id)
240
+					if len(QualityeList) == 0 {
241
+						err = service.BatchInsertQualityControl(org.Id)
242
+					} else {
243
+						utils.ErrorLog("字段批量插入失败:%v", err)
244
+					}
243 245
 
244
-				InspectionList, err := service.FindeInspectionByOrgId(org.Id)
245
-				if len(InspectionList) == 0 {
246
-					err = service.BatchInspectionConfiguration(org.Id)
246
+					InspectionList, err := service.FindeInspectionByOrgId(org.Id)
247
+					if len(InspectionList) == 0 {
248
+						err = service.BatchInspectionConfiguration(org.Id)
249
+					} else {
250
+						utils.ErrorLog("字段批量插入失败:%v", err)
251
+					}
247 252
 				} else {
248 253
 					utils.ErrorLog("字段批量插入失败:%v", err)
249 254
 				}
255
+
250 256
 			}
251 257
 
252 258
 		}
@@ -534,19 +540,25 @@ func (this *HomeController) CreateOrg() {
534 540
 				}
535 541
 
536 542
 				if org.Id > 0 {
537
-					QualityeList, err := service.FindQualityByOrgId(org.Id)
538
-					if len(QualityeList) == 0 {
539
-						err = service.BatchInsertQualityControl(org.Id)
540
-					} else {
541
-						utils.ErrorLog("字段批量插入失败:%v", err)
542
-					}
543
+					major, requestErr := service.GetInspectionMajor(org.Id)
544
+					if len(major) == 0 {
545
+						QualityeList, err := service.FindQualityByOrgId(org.Id)
546
+						if len(QualityeList) == 0 {
547
+							err = service.BatchInsertQualityControl(org.Id)
548
+						} else {
549
+							utils.ErrorLog("字段批量插入失败:%v", err)
550
+						}
543 551
 
544
-					InspectionList, err := service.FindeInspectionByOrgId(org.Id)
545
-					if len(InspectionList) == 0 {
546
-						err = service.BatchInspectionConfiguration(org.Id)
552
+						InspectionList, err := service.FindeInspectionByOrgId(org.Id)
553
+						if len(InspectionList) == 0 {
554
+							err = service.BatchInspectionConfiguration(org.Id)
555
+						} else {
556
+							utils.ErrorLog("字段批量插入失败:%v", err)
557
+						}
547 558
 					} else {
548
-						utils.ErrorLog("字段批量插入失败:%v", err)
559
+						utils.ErrorLog("字段批量插入失败:%v", requestErr)
549 560
 					}
561
+
550 562
 				}
551 563
 
552 564
 				this.ServeSuccessJSON(map[string]interface{}{

+ 16 - 10
controllers/new_mobile_api_controllers/mobile_regist_controller.go View File

@@ -383,19 +383,25 @@ func (this *MobileRegistController) CreateOrg() {
383 383
 			}
384 384
 
385 385
 			if org.Id > 0 {
386
-				QualityeList, err := service.FindQualityByOrgId(org.Id)
387
-				if len(QualityeList) == 0 {
388
-					err = service.BatchInsertQualityControl(org.Id)
389
-				} else {
390
-					utils.ErrorLog("字段批量插入失败:%v", err)
391
-				}
386
+				major, requestErr := service.GetInspectionMajor(org.Id)
387
+				if len(major) == 0 {
388
+					QualityeList, err := service.FindQualityByOrgId(org.Id)
389
+					if len(QualityeList) == 0 {
390
+						err = service.BatchInsertQualityControl(org.Id)
391
+					} else {
392
+						utils.ErrorLog("字段批量插入失败:%v", err)
393
+					}
392 394
 
393
-				InspectionList, err := service.FindeInspectionByOrgId(org.Id)
394
-				if len(InspectionList) == 0 {
395
-					err = service.BatchInspectionConfiguration(org.Id)
395
+					InspectionList, err := service.FindeInspectionByOrgId(org.Id)
396
+					if len(InspectionList) == 0 {
397
+						err = service.BatchInspectionConfiguration(org.Id)
398
+					} else {
399
+						utils.ErrorLog("字段批量插入失败:%v", err)
400
+					}
396 401
 				} else {
397
-					utils.ErrorLog("字段批量插入失败:%v", err)
402
+					utils.ErrorLog("字段批量插入失败:%v", requestErr)
398 403
 				}
404
+
399 405
 			}
400 406
 
401 407
 			this.ServeSuccessJSON(map[string]interface{}{

+ 5 - 4
controllers/new_mobile_api_controllers/new_common_api_controller.go View File

@@ -143,15 +143,16 @@ func (this *NewCommonApiController) GetMobileTotalDialysisCount() {
143 143
 	total := service.GetPatientTotalCount(orgid)
144 144
 	fmt.Println("total", total)
145 145
 	//获取该机构下的所有病人数据
146
-	patients, err := service.GetTotalDialysisAgeCount(orgid)
146
+	ageData, err := service.GetDialysisAgeData(orgid)
147
+
147 148
 	if err != nil {
148 149
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
149 150
 		return
150 151
 	}
151 152
 	this.ServeSuccessJSON(map[string]interface{}{
152
-		"total":    total,
153
-		"patients": patients,
154
-		"nowtime":  nowtime,
153
+		"total":   total,
154
+		"ageData": ageData,
155
+		"nowtime": nowtime,
155 156
 	})
156 157
 }
157 158
 

+ 18 - 1
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

@@ -294,6 +294,16 @@ func (this *NewDialysisApiController) SavePatient() {
294 294
 		fmt.Print("报错", err)
295 295
 		patient, err := service.GetLastOldPatient(orgid)
296 296
 		fmt.Print("病人ID", patient.ID)
297
+		//添加转归
298
+		patientLapseto := models.PatientLapseto{
299
+			LapsetoType: lapseto,
300
+			LapsetoTime: time.Now().Unix(),
301
+			CreatedTime: time.Now().Unix(),
302
+			Status:      1,
303
+			PatientId:   patient.ID,
304
+		}
305
+		err = service.AddPatientLapseto(&patientLapseto)
306
+		fmt.Println("添加转归失败", err)
297 307
 		err = service.AddContagions(patient.ID, patient.CreatedTime, patient.UpdatedTime, ids)
298 308
 		fmt.Println("添加传染病失败", err)
299 309
 
@@ -1324,7 +1334,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1324 1334
 		//查询号透析号是否相同
1325 1335
 		thisPatientother, _ := service.FindPatientByDialysisNoOne(orgid, dialysis, id)
1326 1336
 		if thisPatientother.ID > 0 && thisPatientother.ID != patient.BloodId {
1327
-			fmt.Println("进来没有---------------------------------")
1337
+			fmt.Println("进来没有")
1328 1338
 			returnData := make(map[string]interface{}, 0)
1329 1339
 			returnData["msg"] = "透析号码已存在"
1330 1340
 			this.ServeSuccessJSON(returnData)
@@ -1351,6 +1361,13 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1351 1361
 			IsInfectious:      is_infectious,
1352 1362
 		}
1353 1363
 		err = service.UpdatedPatient(patients, patient.BloodId)
1364
+		patientLapseto := models.PatientLapseto{
1365
+			LapsetoType: lapseto,
1366
+			LapsetoTime: time.Now().Unix(),
1367
+			UpdatedTime: time.Now().Unix(),
1368
+		}
1369
+		err = service.UpdatePatientLapseto(patient.BloodId, patientLapseto)
1370
+		fmt.Println("编辑转归失败", err)
1354 1371
 		patientsNew := models.XtPatientsNew{
1355 1372
 			ID:                id,
1356 1373
 			Name:              name,

+ 16 - 10
controllers/new_mobile_api_controllers/new_login_api_controller.go View File

@@ -296,19 +296,25 @@ func (this *NewLoginApiController) LoginByCs() {
296 296
 			}
297 297
 
298 298
 			if org.Id > 0 {
299
-				QualityeList, err := service.FindQualityByOrgId(org.Id)
300
-				if len(QualityeList) == 0 {
301
-					err = service.BatchInsertQualityControl(org.Id)
302
-				} else {
303
-					utils.ErrorLog("字段批量插入失败0:%v", err)
304
-				}
299
+				major, requestErr := service.GetInspectionMajor(org.Id)
300
+				if len(major) == 0 {
301
+					QualityeList, err := service.FindQualityByOrgId(org.Id)
302
+					if len(QualityeList) == 0 {
303
+						err = service.BatchInsertQualityControl(org.Id)
304
+					} else {
305
+						utils.ErrorLog("字段批量插入失败0:%v", err)
306
+					}
305 307
 
306
-				InspectionList, err := service.FindeInspectionByOrgId(org.Id)
307
-				if len(InspectionList) == 0 {
308
-					err = service.BatchInspectionConfiguration(org.Id)
308
+					InspectionList, err := service.FindeInspectionByOrgId(org.Id)
309
+					if len(InspectionList) == 0 {
310
+						err = service.BatchInspectionConfiguration(org.Id)
311
+					} else {
312
+						utils.ErrorLog("字段批量插入失败0:%v", err)
313
+					}
309 314
 				} else {
310
-					utils.ErrorLog("字段批量插入失败0:%v", err)
315
+					utils.ErrorLog("字段批量插入失败0:%v", requestErr)
311 316
 				}
317
+
312 318
 			}
313 319
 
314 320
 			this.ServeSuccessJSON(map[string]interface{}{

+ 2 - 0
controllers/sign_weigh_api_controller.go View File

@@ -509,6 +509,7 @@ func (c *SignWeighAPIController) UpdateSignweight() {
509 509
 	weight_before, _ := c.GetFloat("weight_before", 0)
510 510
 	dry_weight, _ := c.GetFloat("dry_weight", 0)
511 511
 	temperature, _ := c.GetFloat("temperature", 0)
512
+	fmt.Println("温度========================", temperature)
512 513
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
513 514
 	systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0)
514 515
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
@@ -534,6 +535,7 @@ func (c *SignWeighAPIController) UpdateSignweight() {
534 535
 		service.SaveDislysisiBefore(&predialysisevaluation)
535 536
 	} else if errcode == nil {
536 537
 		fmt.Println("bbbbbbbbb")
538
+		fmt.Println("predialysisevaluation", predialysisevaluation)
537 539
 		service.UpdataDislysisiBefore(&predialysisevaluation, patientID, adminUserInfo.CurrentOrgId, dateTimeStam)
538 540
 	} else {
539 541
 		service.UpdataDislysisiBefore(&predialysisevaluation, patientID, adminUserInfo.CurrentOrgId, dateTimeStam)

+ 14 - 9
controllers/verify_login_controller.go View File

@@ -166,16 +166,21 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
166 166
 				}
167 167
 			}
168 168
 
169
-			QualityeList, err := service.FindQualityByOrgId(curOrg.Id)
170
-			if len(QualityeList) == 0 {
171
-				err = service.BatchInsertQualityControl(curOrg.Id)
172
-			} else {
173
-				utils.ErrorLog("字段批量插入失败:%v", err)
174
-			}
169
+			major, err := service.GetInspectionMajor(curOrg.Id)
170
+			if len(major) == 0 {
171
+				QualityeList, err := service.FindQualityByOrgId(curOrg.Id)
172
+				if len(QualityeList) == 0 {
173
+					err = service.BatchInsertQualityControl(curOrg.Id)
174
+				} else {
175
+					utils.ErrorLog("字段批量插入失败:%v", err)
176
+				}
175 177
 
176
-			InspectionList, err := service.FindeInspectionByOrgId(curOrg.Id)
177
-			if len(InspectionList) == 0 {
178
-				err = service.BatchInspectionConfiguration(curOrg.Id)
178
+				InspectionList, err := service.FindeInspectionByOrgId(curOrg.Id)
179
+				if len(InspectionList) == 0 {
180
+					err = service.BatchInspectionConfiguration(curOrg.Id)
181
+				} else {
182
+					utils.ErrorLog("字段批量插入失败:%v", err)
183
+				}
179 184
 			} else {
180 185
 				utils.ErrorLog("字段批量插入失败:%v", err)
181 186
 			}

+ 9 - 58
service/common_service.go View File

@@ -277,66 +277,17 @@ func GetTotalDialysisAgeCount(orgid int64) (patients []*models.XtPatients, err e
277 277
 }
278 278
 
279 279
 func GetDialysisAgeData(orgID int64) (counts []*models.DialysisAgePieDataStruct, err error) {
280
-	loc, _ := time.LoadLocation("Local")
281
-	nowTime := time.Now()
282
-	nowDay := nowTime.Format("2006-01-02")
283
-	dayTime, err := time.ParseInLocation("2006-01-02 15:04:05", nowDay+" 00:00:00", loc)
284
-	fmt.Println("datTime", dayTime)
285
-	if err != nil {
286
-		return
287
-	}
288
-	oneYearPoint := dayTime.AddDate(-12, 0, 0).Unix()
289
-
290
-	fiveYearPoint := dayTime.AddDate(-36, 0, 0).Unix()
291
-
292
-	tenYearPoint := dayTime.AddDate(-60, 0, 0).Unix()
293
-
294
-	twentyYearPoint := dayTime.AddDate(-61, 0, 0).Unix()
295
-
296
-	db := readDb.Table("xt_patients").Where("status=1")
297
-	countSQL := "SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(" +
298
-		"SELECT " +
299
-		"CASE " +
300
-		" WHEN first_dialysis_date<>0 AND first_dialysis_date>? THEN '1'" +
301
-		" WHEN first_dialysis_date<>0 AND first_dialysis_date>? && first_dialysis_date<=? THEN '2'" +
302
-		" WHEN first_dialysis_date<>0 AND first_dialysis_date>? && first_dialysis_date<=? THEN '3'" +
303
-		" WHEN first_dialysis_date<>0 AND first_dialysis_date>? && first_dialysis_date<=? THEN '4'" +
304
-		" WHEN first_dialysis_date<>0 AND first_dialysis_date<=? THEN '5'" +
305
-		" ELSE '0'" +
306
-		"END AS nnd FROM xt_patients WHERE status=1"
307
-	countParams := make([]interface{}, 0)
308
-	countParams = append(countParams, oneYearPoint)
309
-	countParams = append(countParams, fiveYearPoint)
310
-	countParams = append(countParams, oneYearPoint)
311
-	countParams = append(countParams, tenYearPoint)
312
-	countParams = append(countParams, fiveYearPoint)
313
-	countParams = append(countParams, twentyYearPoint)
314
-	countParams = append(countParams, tenYearPoint)
315
-	countParams = append(countParams, twentyYearPoint)
316 280
 
317
-	if orgID > 0 {
318
-		db = db.Where("user_org_id=?", orgID)
319
-		countSQL += " AND user_org_id=?"
320
-		countParams = append(countParams, orgID)
321
-	}
322
-
323
-	countSQL += ")a GROUP BY nnd"
324
-	err = readDb.Raw(countSQL, countParams...).Scan(&counts).Error
281
+	readDb.Raw(`SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(
282
+	SELECT
283
+	CASE
284
+	WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) >= 0 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 12 THEN '1'
285
+  WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 12 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 36 THEN '2'
286
+  WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 36 AND TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 60 THEN '3'
287
+  WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 60 THEN '4'
288
+  END AS nnd FROM xt_patients as p  where p.user_org_id=? and p.status=1)a GROUP BY nnd`, orgID).Scan(&counts)
325 289
 	return
326 290
 
327
-	//readDb.Raw(`SELECT nnd AS 'age',COUNT(*) AS 'count' FROM(
328
-	// SELECT
329
-	// CASE
330
-	//  WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) >= 0
331
-	//  WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 12 THEN '0~12' WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 12
332
-	//  WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 36 THEN '12~36' WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 36
333
-	//  WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) <= 60 THEN '36~60' WHEN TIMESTAMPDIFF( YEAR, DATE( DATE_ADD( FROM_UNIXTIME( 0 ), INTERVAL p.first_dialysis_date SECOND ) ), curdate( ) ) > 60
334
-	//  ELSE '150'
335
-	// END
336
-	// AS nnd FROM xt_patients as p  where p.user_org_id=? and p.status=1
337
-	// )a GROUP BY nnd`, orgID).Scan(&counts)
338
-	//return
339
-
340 291
 }
341 292
 
342 293
 func GetCurentOrgPatients(orgid int64) (patients []*models.XtPatients, err error) {
@@ -728,7 +679,7 @@ func GetNormDataByOrgId(orgid int64) (standard []*models.QualityControlStandard,
728 679
 func GetNormData(orgid int64) (standard []*models.QualityControlStandard, err error) {
729 680
 
730 681
 	db := XTReadDB().Table("xt_quality_control_standard as x").Where("x.status =1")
731
-	if orgid > 0 {
682
+	if orgid >= 0 {
732 683
 		db = db.Where("x.user_org_id = ?", orgid)
733 684
 	}
734 685
 	table := XTReadDB().Table("xt_inspection_reference as s")

+ 6 - 0
service/patientmanage_service.go View File

@@ -139,6 +139,12 @@ func GetLastOldPatient(orgid int64) (models.Patients, error) {
139 139
 	return patients, err
140 140
 }
141 141
 
142
+func AddPatientLapseto(lapseto *models.PatientLapseto) error {
143
+
144
+	err := XTWriteDB().Create(&lapseto).Error
145
+	return err
146
+}
147
+
142 148
 func AddContagions(patienid int64, createdtime int64, updatedtime int64, contagions []int64) (err error) {
143 149
 	utx := writeDb.Begin()
144 150
 	if len(contagions) > 0 {

+ 1 - 1
service/sign_weigh_service.go View File

@@ -234,7 +234,7 @@ func SaveDislysisiBefore(pre *models.PredialysisEvaluation) error {
234 234
 
235 235
 func UpdataDislysisiBefore(pre *models.PredialysisEvaluation, patientId int64, orgId int64, datatime int64) error {
236 236
 	writeDb.Model(pre).Where("patient_id=? and user_org_id=? and assessment_date =?", patientId, orgId, datatime).Update(map[string]interface{}{"weight_before": pre.WeightBefore,
237
-		"dry_weight": pre.DryWeight, "temperature": pre.DryWeight, "pulse_frequency": pre.PulseFrequency, "systolic_blood_pressure": pre.SystolicBloodPressure, "diastolic_blood_pressure": pre.DiastolicBloodPressure, "status": 1})
237
+		"dry_weight": pre.DryWeight, "temperature": pre.Temperature, "pulse_frequency": pre.PulseFrequency, "systolic_blood_pressure": pre.SystolicBloodPressure, "diastolic_blood_pressure": pre.DiastolicBloodPressure, "status": 1})
238 238
 	return err
239 239
 }
240 240