Просмотр исходного кода

Merge branch '20200710_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20200710_xt_api_new_branch

张保健 4 лет назад
Родитель
Сommit
ca33c9c2fa
32 измененных файлов: 524 добавлений и 174 удалений
  1. 29 14
      conf/app.conf
  2. 4 4
      controllers/base_api_controller.go
  3. 5 5
      controllers/dialysis_api_controller.go
  4. 6 3
      controllers/dialysis_record_api_controller.go
  5. 8 1
      controllers/gobal_config_api_controller.go
  6. 6 0
      controllers/mobile_api_controllers/check_weight_api_controller.go
  7. 21 19
      controllers/mobile_api_controllers/dialysis_api_controller.go
  8. 9 1
      controllers/mobile_api_controllers/login_api_controller.go
  9. 4 1
      controllers/mobile_api_controllers/patient_api_controller.go
  10. 70 47
      controllers/new_mobile_api_controllers/common_api_controller.go
  11. 1 0
      controllers/new_mobile_api_controllers/common_api_router.go
  12. 9 1
      controllers/new_mobile_api_controllers/forget_password_controller.go
  13. 9 1
      controllers/new_mobile_api_controllers/home_api_controller.go
  14. 76 8
      controllers/new_mobile_api_controllers/index_evaluation_api_controller.go
  15. 6 3
      controllers/new_mobile_api_controllers/management_analyse_api_controller.go
  16. 25 0
      controllers/new_mobile_api_controllers/new_common_api_controller.go
  17. 1 0
      controllers/new_mobile_api_controllers/new_common_api_router.go
  18. 9 1
      controllers/new_mobile_api_controllers/new_login_api_controller.go
  19. 50 9
      controllers/pc_index_evaluation_api_controller.go
  20. 32 1
      controllers/schedule_api_controller.go
  21. 8 2
      controllers/verify_login_controller.go
  22. 8 16
      models/dialysis.go
  23. 13 2
      models/patient_models.go
  24. 1 1
      routers/router.go
  25. 11 5
      service/common_service.go
  26. 8 2
      service/data.go
  27. 1 2
      service/dialysis_service.go
  28. 17 5
      service/management_service/management_analyse_service.go
  29. 37 17
      service/mobile_dialysis_service.go
  30. 9 2
      service/statistics_service/index_evaluation_service.go
  31. 1 1
      service/stock_service.go
  32. 30 0
      utils/tools.go

+ 29 - 14
conf/app.conf Просмотреть файл

1
 appname = 血透
1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3
 runmode = dev
3
 runmode = dev
4
 
4
 
5
 # 1
5
 # 1
221
 redispasswrod = 123456
221
 redispasswrod = 123456
222
 redisdb = 0
222
 redisdb = 0
223
 
223
 
224
-niprocart =  83
225
-jms = 80
226
-fistula_needle_set = 81
227
-fistula_needle_set_16 = 82
228
-hemoperfusion = 85
229
-dialyser_sterilised = 84
230
-filtryzer = 79
231
-dialyzers = 10000
232
-injector = 10001
233
-bloodlines = 10002
234
-tubingHemodialysis = 10003
235
-package = 10004
236
-aliquid = 10005
224
+
225
+        niprocart =  63
226
+        jms = 58
227
+        fistula_needle_set = 65
228
+        fistula_needle_set_16 = 64
229
+        hemoperfusion = 55
230
+        dialyser_sterilised = 12
231
+        filtryzer = 53
232
+                dialyzers = 8
233
+                injector = 81
234
+                bloodlines = 42
235
+        tubingHemodialysis = 30
236
+        package = 82
237
+        aliquid = 83
238
+
239
+#niprocart =  83
240
+#jms = 80
241
+#fistula_needle_set = 81
242
+#fistula_needle_set_16 = 82
243
+#hemoperfusion = 85
244
+#dialyser_sterilised = 84
245
+#filtryzer = 79
246
+#dialyzers = 10000
247
+#injector = 10001
248
+#bloodlines = 10002
249
+#tubingHemodialysis = 10003
250
+#package = 10004
251
+#aliquid = 10005

+ 4 - 4
controllers/base_api_controller.go Просмотреть файл

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

+ 5 - 5
controllers/dialysis_api_controller.go Просмотреть файл

3303
 		dewater_amount = 0
3303
 		dewater_amount = 0
3304
 		if evaluation.DryWeight > 0 {
3304
 		if evaluation.DryWeight > 0 {
3305
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3305
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3306
-			if templateInfo.TemplateId == 17 {
3306
+			if templateInfo.TemplateId == 17 && templateInfo.TemplateId == 22 {
3307
 				dewater_amount = dewater_amount * 1000
3307
 				dewater_amount = dewater_amount * 1000
3308
 			}
3308
 			}
3309
 			if dewater_amount <= 0 {
3309
 			if dewater_amount <= 0 {
4863
 				record.UltrafiltrationRate = ultrafiltration_rate
4863
 				record.UltrafiltrationRate = ultrafiltration_rate
4864
 			}
4864
 			}
4865
 
4865
 
4866
-			if template.TemplateId == 20 { //adminInfo.CurrentOrgId == 9538
4866
+			if template.TemplateId == 20 || template.TemplateId == 22 { //adminInfo.CurrentOrgId == 9538
4867
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
4867
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
4868
 				record.UltrafiltrationRate = ultrafiltration_rate
4868
 				record.UltrafiltrationRate = ultrafiltration_rate
4869
 			}
4869
 			}
4870
 
4870
 
4871
 			// 只针对方济医院
4871
 			// 只针对方济医院
4872
-			if template.TemplateId == 1 {
4872
+			if template.TemplateId == 1 && adminInfo.CurrentOrgId != 9849 {
4873
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
4873
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
4874
 				ultrafiltration_rate = value
4874
 				ultrafiltration_rate = value
4875
 				record.UltrafiltrationRate = ultrafiltration_rate
4875
 				record.UltrafiltrationRate = ultrafiltration_rate
4878
 	}
4878
 	}
4879
 	// record.UltrafiltrationRate = ultrafiltration_rate
4879
 	// record.UltrafiltrationRate = ultrafiltration_rate
4880
 	record.UltrafiltrationVolume = 0
4880
 	record.UltrafiltrationVolume = 0
4881
-	if template.TemplateId == 1 {
4881
+	if template.TemplateId == 1 && adminInfo.CurrentOrgId != 9849 {
4882
 		if ultrafiltration_rate > 0 {
4882
 		if ultrafiltration_rate > 0 {
4883
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
4883
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
4884
 			record.UltrafiltrationVolume = value
4884
 			record.UltrafiltrationVolume = value
4885
 		}
4885
 		}
4886
 	}
4886
 	}
4887
 
4887
 
4888
-	if template.TemplateId == 6 || template.TemplateId == 20 {
4888
+	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 {
4889
 		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
4889
 		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
4890
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4890
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4891
 			record.UltrafiltrationVolume = ultrafiltration_volume
4891
 			record.UltrafiltrationVolume = ultrafiltration_volume

+ 6 - 3
controllers/dialysis_record_api_controller.go Просмотреть файл

741
 						}
741
 						}
742
 						//查出入库记录中最后一条记录
742
 						//查出入库记录中最后一条记录
743
 						stockInInfo, _ := service.FindLastStockInInfoRecord(prescription.Niprocart, adminUserInfo.CurrentOrgId)
743
 						stockInInfo, _ := service.FindLastStockInInfoRecord(prescription.Niprocart, adminUserInfo.CurrentOrgId)
744
+
744
 						warehouseOutInfo.Price = stockInInfo.Price
745
 						warehouseOutInfo.Price = stockInInfo.Price
745
 						warehouseOutInfo.GoodId = prescription.Niprocart
746
 						warehouseOutInfo.GoodId = prescription.Niprocart
746
 						warehouseOutInfo.GoodTypeId = niprocart
747
 						warehouseOutInfo.GoodTypeId = niprocart
748
+
747
 						err := service.AddSigleWarehouseOutInfo(warehouseOutInfo)
749
 						err := service.AddSigleWarehouseOutInfo(warehouseOutInfo)
748
 
750
 
749
 						if err == nil {
751
 						if err == nil {
762
 							service.AddSigleAutoReduceRecordInfo(details)
764
 							service.AddSigleAutoReduceRecordInfo(details)
763
 						}
765
 						}
764
 					}
766
 					}
767
+
765
 					if prescription.Jms > 0 {
768
 					if prescription.Jms > 0 {
766
 						warehouseOutInfo := &models.WarehouseOutInfo{
769
 						warehouseOutInfo := &models.WarehouseOutInfo{
767
 							WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
770
 							WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1711
 								Status:                  1,
1714
 								Status:                  1,
1712
 								RecordTime:              startDate.Unix(),
1715
 								RecordTime:              startDate.Unix(),
1713
 								OrgId:                   adminUserInfo.CurrentOrgId,
1716
 								OrgId:                   adminUserInfo.CurrentOrgId,
1714
-								GoodId:                  prescription.Dialyzer,
1717
+								GoodId:                  prescription.Dialyzers,
1715
 								GoodTypeId:              dialyzers,
1718
 								GoodTypeId:              dialyzers,
1716
 							}
1719
 							}
1717
 							service.AddSigleAutoReduceRecordInfo(details)
1720
 							service.AddSigleAutoReduceRecordInfo(details)
2155
 			if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2158
 			if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2156
 
2159
 
2157
 				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2160
 				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2158
-				if template.TemplateId == 6 || template.TemplateId == 20 {
2161
+				if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 {
2159
 					ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2162
 					ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2160
 				}
2163
 				}
2161
 				// 只针对方济医院
2164
 				// 只针对方济医院
2162
-				if template.TemplateId == 1 {
2165
+				if template.TemplateId == 1 && adminUserInfo.CurrentOrgId != 9849 {
2163
 					value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
2166
 					value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
2164
 					ultrafiltration_rate = value
2167
 					ultrafiltration_rate = value
2165
 				}
2168
 				}

+ 8 - 1
controllers/gobal_config_api_controller.go Просмотреть файл

1027
 			}
1027
 			}
1028
 		}
1028
 		}
1029
 
1029
 
1030
+		//产寻该机构是否有收缩压和舒张压
1031
+		pressure, err := service.GetDefaultSystolicPressure(tempOrg.Id)
1032
+		fmt.Println(err)
1033
+		if len(pressure) == 0 {
1034
+			err = service.BathInsertQualityControlTwo(tempOrg.Id)
1035
+		} else {
1036
+			utils.ErrorLog("字段批量插入失败:%v", err)
1037
+		}
1030
 		major, err := service.GetInspectionMajor(tempOrg.Id)
1038
 		major, err := service.GetInspectionMajor(tempOrg.Id)
1031
 		if len(major) == 0 {
1039
 		if len(major) == 0 {
1032
 			QualityeList, err := service.FindQualityByOrgId(tempOrg.Id)
1040
 			QualityeList, err := service.FindQualityByOrgId(tempOrg.Id)
1033
 			if len(QualityeList) == 0 {
1041
 			if len(QualityeList) == 0 {
1034
 				err = service.BatchInsertQualityControl(tempOrg.Id)
1042
 				err = service.BatchInsertQualityControl(tempOrg.Id)
1035
-				err = service.BathInsertQualityControlTwo(tempOrg.Id)
1036
 			} else {
1043
 			} else {
1037
 				utils.ErrorLog("字段批量插入失败:%v", err)
1044
 				utils.ErrorLog("字段批量插入失败:%v", err)
1038
 			}
1045
 			}

+ 6 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Просмотреть файл

330
 	// 	return
330
 	// 	return
331
 	// }
331
 	// }
332
 
332
 
333
+	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
334
+
335
+	if template.TemplateId == 22 {
336
+		dewater_amount = dewater_amount * 1000
337
+	}
338
+
333
 	if dialysistype == 1 {
339
 	if dialysistype == 1 {
334
 		// 保存透前相关数据
340
 		// 保存透前相关数据
335
 		// 获取透析处方
341
 		// 获取透析处方

+ 21 - 19
controllers/mobile_api_controllers/dialysis_api_controller.go Просмотреть файл

99
 				//缓存数据
99
 				//缓存数据
100
 				scheduals_json, err := json.Marshal(scheduals)
100
 				scheduals_json, err := json.Marshal(scheduals)
101
 				if err == nil {
101
 				if err == nil {
102
-					redis.Set(key, scheduals_json, time.Minute*1)
102
+					redis.Set(key, scheduals_json, time.Second*30)
103
 				}
103
 				}
104
 			}
104
 			}
105
 
105
 
111
 	} else { //缓存数据了数据,将redis缓存的json字符串转为map
111
 	} else { //缓存数据了数据,将redis缓存的json字符串转为map
112
 
112
 
113
 		var dat []map[string]interface{}
113
 		var dat []map[string]interface{}
114
+
114
 		if err := json.Unmarshal([]byte(scheduals_json_str), &dat); err == nil {
115
 		if err := json.Unmarshal([]byte(scheduals_json_str), &dat); err == nil {
115
 
116
 
116
 		} else {
117
 		} else {
161
 				//缓存数据
162
 				//缓存数据
162
 				wait_scheduals_json, err := json.Marshal(scheduals)
163
 				wait_scheduals_json, err := json.Marshal(scheduals)
163
 				if err == nil {
164
 				if err == nil {
164
-					redis.Set(key, wait_scheduals_json, time.Minute*2)
165
+					redis.Set(key, wait_scheduals_json, time.Second*30)
165
 				}
166
 				}
166
 			}
167
 			}
167
 
168
 
286
 	}
287
 	}
287
 
288
 
288
 	dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecord(adminInfo.Org.Id, patientID, date.Unix())
289
 	dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecord(adminInfo.Org.Id, patientID, date.Unix())
289
-	fmt.Println("----------------------------", getDialysisOrderErr)
290
 	if getDialysisOrderErr != nil {
290
 	if getDialysisOrderErr != nil {
291
 		this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
291
 		this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
292
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
292
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
383
 		return
383
 		return
384
 	}
384
 	}
385
 
385
 
386
-	headNurses, _ := service.GetAllSpecialPermissionAdminUsersWithoutStatus(adminInfo.Org.Id, adminInfo.App.Id, models.SpecialPermissionTypeHeadNurse)
386
+	//headNurses, _ := service.GetAllSpecialPermissionAdminUsersWithoutStatus(adminInfo.Org.Id, adminInfo.App.Id, models.SpecialPermissionTypeHeadNurse)
387
 
387
 
388
 	_, gobalConfig := service.FindAutomaticReduceRecordByOrgId(adminInfo.Org.Id)
388
 	_, gobalConfig := service.FindAutomaticReduceRecordByOrgId(adminInfo.Org.Id)
389
 	goodTypes, _ := service.FindAllGoodTypeByType(1)          //查出所有库存配置的系统类型
389
 	goodTypes, _ := service.FindAllGoodTypeByType(1)          //查出所有库存配置的系统类型
410
 		"last_predialysis_evaluation":    lastPredialysisEvaluation,
410
 		"last_predialysis_evaluation":    lastPredialysisEvaluation,
411
 		"last_assessment_after_dislysis": lastAssessmentAfterDislysis,
411
 		"last_assessment_after_dislysis": lastAssessmentAfterDislysis,
412
 		"last_monitor_record":            lastMonitorRecord,
412
 		"last_monitor_record":            lastMonitorRecord,
413
-		"special_premission":             headNurses,
414
-		"config":                         gobalConfig,
415
-		"types":                          goodTypes,
416
-		"goodInfos":                      goodInfos,
417
-		"dry_weight":                     lastDryWeightDislysis,
418
-		"system_prescription":            systemDialysisPrescribe,
413
+		//"special_premission":             headNurses,
414
+		"config":              gobalConfig,
415
+		"types":               goodTypes,
416
+		"goodInfos":           goodInfos,
417
+		"dry_weight":          lastDryWeightDislysis,
418
+		"system_prescription": systemDialysisPrescribe,
419
 	}
419
 	}
420
 	this.ServeSuccessJSON(returnData)
420
 	this.ServeSuccessJSON(returnData)
421
 }
421
 }
2751
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2751
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2752
 			}
2752
 			}
2753
 
2753
 
2754
-			if template.TemplateId == 20 { //adminUserInfo.Org.Id == 9538
2754
+			if template.TemplateId == 20 || template.TemplateId == 22 { //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
 			// 只针对方济医院
2759
-			if template.TemplateId == 1 {
2759
+			if template.TemplateId == 1 && adminUserInfo.Org.Id != 9849 {
2760
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
2760
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
2761
 				ultrafiltration_rate = value
2761
 				ultrafiltration_rate = value
2762
 			}
2762
 			}
3827
 								Status:                  1,
3827
 								Status:                  1,
3828
 								RecordTime:              startDate.Unix(),
3828
 								RecordTime:              startDate.Unix(),
3829
 								OrgId:                   adminUserInfo.Org.Id,
3829
 								OrgId:                   adminUserInfo.Org.Id,
3830
-								GoodId:                  prescription.Dialyzer,
3830
+								GoodId:                  prescription.Dialyzers,
3831
 								GoodTypeId:              dialyzers,
3831
 								GoodTypeId:              dialyzers,
3832
 							}
3832
 							}
3833
 							service.AddSigleAutoReduceRecordInfo(details)
3833
 							service.AddSigleAutoReduceRecordInfo(details)
5594
 	fristrecord, _ := service.FindFirstMonitorRecordToday(patientID, adminInfo.Org.Id, monitorDate)
5594
 	fristrecord, _ := service.FindFirstMonitorRecordToday(patientID, adminInfo.Org.Id, monitorDate)
5595
 
5595
 
5596
 	template, _ := service.GetOrgInfoTemplate(adminInfo.Org.Id)
5596
 	template, _ := service.GetOrgInfoTemplate(adminInfo.Org.Id)
5597
-	fmt.Println("1122233333")
5598
 
5597
 
5599
 	var ultrafiltration_rate float64
5598
 	var ultrafiltration_rate float64
5600
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
5599
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
5601
 	if prescription.ID > 0 {
5600
 	if prescription.ID > 0 {
5601
+		fmt.Println("444444444")
5602
+
5602
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
5603
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
5604
+			fmt.Println("4444444445555")
5603
 
5605
 
5604
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5606
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5605
 			if template.TemplateId == 6 {
5607
 			if template.TemplateId == 6 {
5608
+				fmt.Println("12222222")
5606
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
5609
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
5607
 				record.UltrafiltrationRate = ultrafiltration_rate
5610
 				record.UltrafiltrationRate = ultrafiltration_rate
5608
 			}
5611
 			}
5609
 
5612
 
5610
-			if template.TemplateId == 20 {
5613
+			if template.TemplateId == 20 || template.TemplateId == 22 {
5611
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
5614
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
5612
 				record.UltrafiltrationRate = ultrafiltration_rate
5615
 				record.UltrafiltrationRate = ultrafiltration_rate
5613
 			}
5616
 			}
5614
 
5617
 
5615
 			// 只针对方济医院
5618
 			// 只针对方济医院
5616
-			if template.TemplateId == 1 {
5619
+			if template.TemplateId == 1 && adminInfo.Org.Id != 9849 {
5617
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
5620
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
5618
 				ultrafiltration_rate = value
5621
 				ultrafiltration_rate = value
5619
 				record.UltrafiltrationRate = ultrafiltration_rate
5622
 				record.UltrafiltrationRate = ultrafiltration_rate
5622
 	}
5625
 	}
5623
 	// record.UltrafiltrationRate = ultrafiltration_rate
5626
 	// record.UltrafiltrationRate = ultrafiltration_rate
5624
 	record.UltrafiltrationVolume = 0
5627
 	record.UltrafiltrationVolume = 0
5625
-	if template.TemplateId == 1 { //adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535
5628
+	if template.TemplateId == 1 && adminInfo.Org.Id != 9849 { //adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535
5626
 		if ultrafiltration_rate > 0 {
5629
 		if ultrafiltration_rate > 0 {
5627
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
5630
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
5628
 			record.UltrafiltrationVolume = value
5631
 			record.UltrafiltrationVolume = value
5629
 		}
5632
 		}
5630
 	}
5633
 	}
5631
 
5634
 
5632
-	if template.TemplateId == 6 || template.TemplateId == 20 { //adminInfo.Org.Id == 9538
5635
+	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 { //adminInfo.Org.Id == 9538
5633
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
5636
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
5634
-			fmt.Println("11222344444444443333")
5635
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5637
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5636
 			record.UltrafiltrationVolume = ultrafiltration_volume
5638
 			record.UltrafiltrationVolume = ultrafiltration_volume
5637
 		}
5639
 		}

+ 9 - 1
controllers/mobile_api_controllers/login_api_controller.go Просмотреть файл

6
 	"XT_New/service"
6
 	"XT_New/service"
7
 	"XT_New/utils"
7
 	"XT_New/utils"
8
 	"encoding/json"
8
 	"encoding/json"
9
+	"fmt"
9
 	"io/ioutil"
10
 	"io/ioutil"
10
 	"net/http"
11
 	"net/http"
11
 	"net/url"
12
 	"net/url"
168
 				FiledList = make([]*models.FiledConfig, 0)
169
 				FiledList = make([]*models.FiledConfig, 0)
169
 			}
170
 			}
170
 		}
171
 		}
172
+		//产寻该机构是否有收缩压和舒张压
173
+		pressure, err := service.GetDefaultSystolicPressure(org.Id)
174
+		fmt.Println(err)
175
+		if len(pressure) == 0 {
176
+			err = service.BathInsertQualityControlTwo(org.Id)
177
+		} else {
178
+			utils.ErrorLog("字段批量插入失败:%v", err)
179
+		}
171
 
180
 
172
 		//批量插入质控达标统计配置
181
 		//批量插入质控达标统计配置
173
 		major, requestErr := service.GetInspectionMajor(org.Id)
182
 		major, requestErr := service.GetInspectionMajor(org.Id)
175
 			QualityeList, err := service.FindQualityByOrgId(org.Id)
184
 			QualityeList, err := service.FindQualityByOrgId(org.Id)
176
 			if len(QualityeList) == 0 {
185
 			if len(QualityeList) == 0 {
177
 				err = service.BatchInsertQualityControl(org.Id)
186
 				err = service.BatchInsertQualityControl(org.Id)
178
-				err = service.BathInsertQualityControlTwo(org.Id)
179
 			} else {
187
 			} else {
180
 				utils.ErrorLog("字段批量插入失败:%v", err)
188
 				utils.ErrorLog("字段批量插入失败:%v", err)
181
 			}
189
 			}

+ 4 - 1
controllers/mobile_api_controllers/patient_api_controller.go Просмотреть файл

885
 	dewater_amount = 0
885
 	dewater_amount = 0
886
 	if evaluation.DryWeight > 0 {
886
 	if evaluation.DryWeight > 0 {
887
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
887
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
888
-		if template.TemplateId == 17 {
888
+
889
+		if template.TemplateId == 17 || template.TemplateId == 22 {
889
 			dewater_amount = dewater_amount * 1000
890
 			dewater_amount = dewater_amount * 1000
891
+
890
 		}
892
 		}
893
+
891
 		if dewater_amount <= 0 {
894
 		if dewater_amount <= 0 {
892
 			dewater_amount = 0
895
 			dewater_amount = 0
893
 		}
896
 		}

+ 70 - 47
controllers/new_mobile_api_controllers/common_api_controller.go Просмотреть файл

219
 		}
219
 		}
220
 		this.ServeSuccessJSON(map[string]interface{}{
220
 		this.ServeSuccessJSON(map[string]interface{}{
221
 			"configurationdetail": detail,
221
 			"configurationdetail": detail,
222
-			"vid":                 vid,
222
+			"vid": vid,
223
 		})
223
 		})
224
 	} else {
224
 	} else {
225
 		itemId, err := service.GetIdByItemId(detail.InspectionMinor, orgId)
225
 		itemId, err := service.GetIdByItemId(detail.InspectionMinor, orgId)
229
 		}
229
 		}
230
 		this.ServeSuccessJSON(map[string]interface{}{
230
 		this.ServeSuccessJSON(map[string]interface{}{
231
 			"configurationdetail": detail,
231
 			"configurationdetail": detail,
232
-			"vid":                 itemId.ID,
232
+			"vid": itemId.ID,
233
 		})
233
 		})
234
 	}
234
 	}
235
 
235
 
1092
 	countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
1092
 	countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
1093
 
1093
 
1094
 	//获取收缩压数据
1094
 	//获取收缩压数据
1095
-	_, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
1095
+	systolic, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
1096
 	//统计收缩压合格的数据
1096
 	//统计收缩压合格的数据
1097
-	systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
1097
+	//systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
1098
 
1098
 
1099
 	//获取舒张压数据
1099
 	//获取舒张压数据
1100
-	_, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
1100
+	diastolic, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
1101
 	//获取合格舒张压数据
1101
 	//获取合格舒张压数据
1102
-	diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
1102
+	//diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
1103
 	normData, _ := service.GetNormData(orgid)
1103
 	normData, _ := service.GetNormData(orgid)
1104
 	if err != nil {
1104
 	if err != nil {
1105
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1105
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1106
 		return
1106
 		return
1107
 	}
1107
 	}
1108
 	this.ServeSuccessJSON(map[string]interface{}{
1108
 	this.ServeSuccessJSON(map[string]interface{}{
1109
-		"count":          count,
1110
-		"countwo":        countwo,
1111
-		"systolic":       systolic,
1112
-		"systolicTotal":  systolicTotal,
1113
-		"sysstandTotal":  sysstandTotal,
1114
-		"diastolic":      diastolic,
1115
-		"diastotal":      diastotal,
1116
-		"diasstandtotal": diasstandtotal,
1117
-		"normData":       normData,
1109
+		"count":         count,
1110
+		"countwo":       countwo,
1111
+		"systolic":      systolic,
1112
+		"systolicTotal": systolicTotal,
1113
+		"diastolic":     diastolic,
1114
+		"diastotal":     diastotal,
1115
+		"normData":      normData,
1118
 	})
1116
 	})
1119
 }
1117
 }
1120
 
1118
 
1676
 	fmt.Println("第四季度", fourQuarterEndStrUnix)
1674
 	fmt.Println("第四季度", fourQuarterEndStrUnix)
1677
 	if bloodType == -1 {
1675
 	if bloodType == -1 {
1678
 		//统计收缩压第一季度的总数
1676
 		//统计收缩压第一季度的总数
1679
-		_, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1677
+		firstList, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1680
 		//统计收缩压第一季合格的总数
1678
 		//统计收缩压第一季合格的总数
1681
-		_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1679
+		//_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1682
 		//统计第二季收缩压总数
1680
 		//统计第二季收缩压总数
1683
-		_, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1681
+		secondelist, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1684
 		//第二季度合格总数
1682
 		//第二季度合格总数
1685
-		_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1683
+		//_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1686
 		//统计第三季收缩压总数
1684
 		//统计第三季收缩压总数
1687
-		_, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1685
+		threelist, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1688
 		//第三季度合格数
1686
 		//第三季度合格数
1689
-		_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1687
+		//_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1690
 		//第四季度总数
1688
 		//第四季度总数
1691
-		_, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1689
+		fourlist, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1692
 		//第四季度合格总数
1690
 		//第四季度合格总数
1693
-		_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1691
+		//_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1694
 		if err != nil {
1692
 		if err != nil {
1695
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1693
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1696
 			return
1694
 			return
1697
 		}
1695
 		}
1698
 
1696
 
1699
 		this.ServeSuccessJSON(map[string]interface{}{
1697
 		this.ServeSuccessJSON(map[string]interface{}{
1700
-			"firstTotal":        firstTotal,
1701
-			"firstStandTotal":   firstStandTotal,
1702
-			"secondeTotal":      secondeTotal,
1703
-			"secondeStandTotal": secondeStandTotal,
1704
-			"threeTotal":        threeTotal,
1705
-			"threeStandTotal":   threeStandTotal,
1706
-			"fourTotal":         fourTotal,
1707
-			"fourStandTotal":    fourStandTotal,
1698
+			"firstTotal":   firstTotal,
1699
+			"firstList":    firstList,
1700
+			"secondelist":  secondelist,
1701
+			"secondeTotal": secondeTotal,
1702
+			"threelist":    threelist,
1703
+			"threeTotal":   threeTotal,
1704
+			"fourTotal":    fourTotal,
1705
+			"fourlist":     fourlist,
1708
 		})
1706
 		})
1709
 	}
1707
 	}
1710
 
1708
 
1711
 	if bloodType == -2 {
1709
 	if bloodType == -2 {
1712
 		//统计舒张压第一季度的总数
1710
 		//统计舒张压第一季度的总数
1713
-		_, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1714
-		_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1715
-		_, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1716
-		_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1717
-		_, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1718
-		_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1719
-		_, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1720
-		_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1711
+		firstList, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1712
+		//_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1713
+		secondelist, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1714
+		//_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1715
+		threelist, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1716
+		//_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1717
+		fourlist, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1718
+		//_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1721
 
1719
 
1722
 		if err != nil {
1720
 		if err != nil {
1723
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1721
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1725
 		}
1723
 		}
1726
 
1724
 
1727
 		this.ServeSuccessJSON(map[string]interface{}{
1725
 		this.ServeSuccessJSON(map[string]interface{}{
1728
-			"firstTotal":        firstTotal,
1729
-			"firstStandTotal":   firstStandTotal,
1730
-			"secondeTotal":      secondeTotal,
1731
-			"secondeStandTotal": secondeStandTotal,
1732
-			"threeTotal":        threeTotal,
1733
-			"threeStandTotal":   threeStandTotal,
1734
-			"fourTotal":         fourTotal,
1735
-			"fourStandTotal":    fourStandTotal,
1726
+			"firstTotal":   firstTotal,
1727
+			"firstList":    firstList,
1728
+			"secondelist":  secondelist,
1729
+			"secondeTotal": secondeTotal,
1730
+			"threelist":    threelist,
1731
+			"threeTotal":   threeTotal,
1732
+			"fourTotal":    fourTotal,
1733
+			"fourlist":     fourlist,
1736
 		})
1734
 		})
1737
 	}
1735
 	}
1738
 }
1736
 }
2032
 		})
2030
 		})
2033
 	}
2031
 	}
2034
 }
2032
 }
2033
+
2034
+func (this *CommonApiController) GetIdsListTwo() {
2035
+	dataBody := make(map[string]interface{}, 0)
2036
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2037
+	fmt.Println(err)
2038
+	adminInfo := this.GetAdminUserInfo()
2039
+	orgId := adminInfo.CurrentOrgId
2040
+	patientid, _ := this.GetInt64("patientid")
2041
+	idlist := dataBody["ids"].([]interface{})
2042
+
2043
+	var vlist []interface{}
2044
+	for _, contagion := range idlist {
2045
+		id := int64(contagion.(float64))
2046
+		list, _ := service.GetInspectionMoninList(id, orgId, patientid)
2047
+		vlist = append(vlist, list)
2048
+	}
2049
+	if err != nil {
2050
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2051
+		return
2052
+	}
2053
+	this.ServeSuccessJSON(map[string]interface{}{
2054
+		"vlist": vlist,
2055
+	})
2056
+
2057
+}

+ 1 - 0
controllers/new_mobile_api_controllers/common_api_router.go Просмотреть файл

55
 	beego.Router("/com/api/updatebloodprussre", &CommonApiController{}, "Post:UpdateBloodPrussre")
55
 	beego.Router("/com/api/updatebloodprussre", &CommonApiController{}, "Post:UpdateBloodPrussre")
56
 	beego.Router("/com/api/getbloodpressurelist", &CommonApiController{}, "Get:GetBloodPressureList")
56
 	beego.Router("/com/api/getbloodpressurelist", &CommonApiController{}, "Get:GetBloodPressureList")
57
 	beego.Router("/com/api/getmonthbloodlist", &CommonApiController{}, "Get:GetMonthBloodList")
57
 	beego.Router("/com/api/getmonthbloodlist", &CommonApiController{}, "Get:GetMonthBloodList")
58
+	beego.Router("/com/api/getidslist", &CommonApiController{}, "Post:GetIdsListTwo")
58
 }
59
 }

+ 9 - 1
controllers/new_mobile_api_controllers/forget_password_controller.go Просмотреть файл

7
 	"XT_New/service"
7
 	"XT_New/service"
8
 	"XT_New/utils"
8
 	"XT_New/utils"
9
 	"encoding/json"
9
 	"encoding/json"
10
+	"fmt"
10
 	"github.com/astaxie/beego"
11
 	"github.com/astaxie/beego"
11
 	"io/ioutil"
12
 	"io/ioutil"
12
 	"net/http"
13
 	"net/http"
180
 			}
181
 			}
181
 
182
 
182
 			if org.Id > 0 {
183
 			if org.Id > 0 {
184
+				//产寻该机构是否有收缩压和舒张压
185
+				pressure, err := service.GetDefaultSystolicPressure(org.Id)
186
+				fmt.Println(err)
187
+				if len(pressure) == 0 {
188
+					err = service.BathInsertQualityControlTwo(org.Id)
189
+				} else {
190
+					utils.ErrorLog("字段批量插入失败:%v", err)
191
+				}
183
 				major, requestErr := service.GetInspectionMajor(org.Id)
192
 				major, requestErr := service.GetInspectionMajor(org.Id)
184
 				if len(major) == 0 {
193
 				if len(major) == 0 {
185
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
194
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
186
 					if len(QualityeList) == 0 {
195
 					if len(QualityeList) == 0 {
187
 						err = service.BatchInsertQualityControl(org.Id)
196
 						err = service.BatchInsertQualityControl(org.Id)
188
-						err = service.BathInsertQualityControlTwo(org.Id)
189
 					} else {
197
 					} else {
190
 						utils.ErrorLog("字段批量插入失败:%v", err)
198
 						utils.ErrorLog("字段批量插入失败:%v", err)
191
 					}
199
 					}

+ 9 - 1
controllers/new_mobile_api_controllers/home_api_controller.go Просмотреть файл

7
 	"XT_New/service"
7
 	"XT_New/service"
8
 	"XT_New/utils"
8
 	"XT_New/utils"
9
 	"encoding/json"
9
 	"encoding/json"
10
+	"fmt"
10
 	"github.com/astaxie/beego"
11
 	"github.com/astaxie/beego"
11
 	"io/ioutil"
12
 	"io/ioutil"
12
 	"net/http"
13
 	"net/http"
233
 			}
234
 			}
234
 
235
 
235
 			if org.Id > 0 {
236
 			if org.Id > 0 {
237
+				//产寻该机构是否有收缩压和舒张压
238
+				pressure, err := service.GetDefaultSystolicPressure(org.Id)
239
+				fmt.Println(err)
240
+				if len(pressure) == 0 {
241
+					err = service.BathInsertQualityControlTwo(org.Id)
242
+				} else {
243
+					utils.ErrorLog("字段批量插入失败:%v", err)
244
+				}
236
 				major, err := service.GetInspectionMajor(org.Id)
245
 				major, err := service.GetInspectionMajor(org.Id)
237
 				if len(major) == 0 {
246
 				if len(major) == 0 {
238
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
247
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
239
 					if len(QualityeList) == 0 {
248
 					if len(QualityeList) == 0 {
240
 						err = service.BatchInsertQualityControl(org.Id)
249
 						err = service.BatchInsertQualityControl(org.Id)
241
-						err = service.BathInsertQualityControlTwo(org.Id)
242
 					} else {
250
 					} else {
243
 						utils.ErrorLog("字段批量插入失败:%v", err)
251
 						utils.ErrorLog("字段批量插入失败:%v", err)
244
 					}
252
 					}

+ 76 - 8
controllers/new_mobile_api_controllers/index_evaluation_api_controller.go Просмотреть файл

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
+	"XT_New/models"
5
 	"XT_New/service/statistics_service"
6
 	"XT_New/service/statistics_service"
6
 	"XT_New/utils"
7
 	"XT_New/utils"
7
 	"fmt"
8
 	"fmt"
24
 //初始化数据
25
 //初始化数据
25
 func (this *IndexEvaluationApiController) GetLaboratoryIndexInitData() {
26
 func (this *IndexEvaluationApiController) GetLaboratoryIndexInitData() {
26
 	adminUserInfo := this.GetMobileAdminUserInfo()
27
 	adminUserInfo := this.GetMobileAdminUserInfo()
27
-	references, _ := statistics_service.FindOrgQualityControlStandardInspectionReference(adminUserInfo.Org.Id)
28
+	var references []*models.InspectionReference
29
+	count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
30
+	if count <= 0 {
31
+		references, _ = statistics_service.FindOrgInspectionReference(0, 1)
32
+		references2, _ := statistics_service.FindOrgInspectionReference(0, 2)
33
+		references = append(references, references2...)
34
+
35
+	} else {
36
+		references, _ = statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id, 1)
37
+		references2, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id, 2)
38
+		references = append(references, references2...)
39
+
40
+	}
41
+
28
 	this.ServeSuccessJSON(map[string]interface{}{
42
 	this.ServeSuccessJSON(map[string]interface{}{
29
 		"references": references,
43
 		"references": references,
30
 	})
44
 	})
31
 
45
 
46
+	//adminUserInfo := this.GetMobileAdminUserInfo()
47
+	//
48
+	//
49
+	//
50
+	//references, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id,1)
51
+	//references2, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id,2)
52
+	//references = append(references, references2...)
53
+	//this.ServeSuccessJSON(map[string]interface{}{
54
+	//	"references": references,
55
+	//})
56
+
32
 }
57
 }
33
 
58
 
34
 //获取取值范围
59
 //获取取值范围
38
 	item_id, _ := this.GetInt64("item_id")
63
 	item_id, _ := this.GetInt64("item_id")
39
 	adminUserInfo := this.GetMobileAdminUserInfo()
64
 	adminUserInfo := this.GetMobileAdminUserInfo()
40
 	var range_vaule []string
65
 	var range_vaule []string
66
+	var qcs models.InspectionReference
67
+
41
 	if range_type == 1 {
68
 	if range_type == 1 {
42
-		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
43
-		range_vaule = append(range_vaule, qcs.MinRange)
44
-		range_vaule = append(range_vaule, qcs.LargeRange)
69
+		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
70
+
71
+		if count <= 0 {
72
+			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
73
+		} else {
74
+			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
75
+
76
+		}
77
+		//qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
78
+		range_vaule = append(range_vaule, qcs.RangeMin)
79
+		range_vaule = append(range_vaule, qcs.RangeMax)
45
 	} else {
80
 	} else {
46
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
81
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
47
 		for _, item := range inspection {
82
 		for _, item := range inspection {
82
 	}
117
 	}
83
 
118
 
84
 	var range_value string
119
 	var range_value string
120
+	//if range_type == 1 {
121
+	//	qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
122
+	//	range_value = qcs.RangeMin + "," + qcs.RangeMax
123
+	//
124
+	//} else {
125
+	//
126
+	//	inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
127
+	//	for _, item := range inspection {
128
+	//		if len(range_value) == 0 {
129
+	//			range_value = item.InspectValue
130
+	//		} else {
131
+	//			range_value = range_value + "," + item.InspectValue
132
+	//		}
133
+	//	}
134
+	//}
135
+
85
 	if range_type == 1 {
136
 	if range_type == 1 {
86
-		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
87
-		range_value = qcs.MinRange + "," + qcs.LargeRange
137
+		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
138
+
139
+		if count <= 0 {
140
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
141
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
142
+
143
+		} else {
144
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
145
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
146
+		}
88
 
147
 
89
 	} else {
148
 	} else {
90
 
149
 
96
 				range_value = range_value + "," + item.InspectValue
155
 				range_value = range_value + "," + item.InspectValue
97
 			}
156
 			}
98
 		}
157
 		}
158
+
99
 	}
159
 	}
100
 
160
 
101
 	data, _ := statistics_service.GetInspectionChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value)
161
 	data, _ := statistics_service.GetInspectionChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value)
216
 
276
 
217
 	var range_value string
277
 	var range_value string
218
 	if range_type == 1 {
278
 	if range_type == 1 {
219
-		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
279
+		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
220
 
280
 
221
-		range_value = qcs.MinRange + "," + qcs.LargeRange
281
+		if count <= 0 {
282
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
283
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
284
+
285
+		} else {
286
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
287
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
288
+		}
222
 
289
 
223
 	} else {
290
 	} else {
224
 
291
 
230
 				range_value = range_value + "," + item.InspectValue
297
 				range_value = range_value + "," + item.InspectValue
231
 			}
298
 			}
232
 		}
299
 		}
300
+
233
 	}
301
 	}
234
 
302
 
235
 	data, _ := statistics_service.GetPatientInspectionBarChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value, patient_id)
303
 	data, _ := statistics_service.GetPatientInspectionBarChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value, patient_id)

+ 6 - 3
controllers/new_mobile_api_controllers/management_analyse_api_controller.go Просмотреть файл

82
 	data, total_one, _ := management_service.GetPatientChartData(adminUserInfo.Org.Id, startTime, endTime, statistics_type)
82
 	data, total_one, _ := management_service.GetPatientChartData(adminUserInfo.Org.Id, startTime, endTime, statistics_type)
83
 	total, _ := management_service.GetLapsetoPatientTotal(adminUserInfo.Org.Id, statistics_type)
83
 	total, _ := management_service.GetLapsetoPatientTotal(adminUserInfo.Org.Id, statistics_type)
84
 
84
 
85
+	total_three, _ := management_service.GetLapsetoPatientTotal(adminUserInfo.Org.Id, 2)
86
+
85
 	this.ServeSuccessJSON(map[string]interface{}{
87
 	this.ServeSuccessJSON(map[string]interface{}{
86
-		"chart_data": data,
87
-		"total_one":  total_one,
88
-		"total":      total,
88
+		"chart_data":  data,
89
+		"total_one":   total_one,
90
+		"total":       total,
91
+		"total_three": total + total_three,
89
 	})
92
 	})
90
 
93
 
91
 }
94
 }

+ 25 - 0
controllers/new_mobile_api_controllers/new_common_api_controller.go Просмотреть файл

5
 	"XT_New/enums"
5
 	"XT_New/enums"
6
 	"XT_New/service"
6
 	"XT_New/service"
7
 	"XT_New/utils"
7
 	"XT_New/utils"
8
+	"encoding/json"
8
 	"fmt"
9
 	"fmt"
9
 	"time"
10
 	"time"
10
 )
11
 )
1956
 		"bloodPressure": bloodPressure,
1957
 		"bloodPressure": bloodPressure,
1957
 	})
1958
 	})
1958
 }
1959
 }
1960
+
1961
+func (this *NewCommonApiController) GetMobileIdsList() {
1962
+	dataBody := make(map[string]interface{}, 0)
1963
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1964
+	fmt.Println(err)
1965
+	admin := this.GetMobileAdminUserInfo()
1966
+	orgId := admin.Org.Id
1967
+	patientid, _ := this.GetInt64("patientid")
1968
+	idlist := dataBody["ids"].([]interface{})
1969
+
1970
+	var vlist []interface{}
1971
+	for _, contagion := range idlist {
1972
+		id := int64(contagion.(float64))
1973
+		list, _ := service.GetInspectionMoninList(id, orgId, patientid)
1974
+		vlist = append(vlist, list)
1975
+	}
1976
+	if err != nil {
1977
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1978
+		return
1979
+	}
1980
+	this.ServeSuccessJSON(map[string]interface{}{
1981
+		"vlist": vlist,
1982
+	})
1983
+}

+ 1 - 0
controllers/new_mobile_api_controllers/new_common_api_router.go Просмотреть файл

40
 	beego.Router("/m/api/gettargetnostanddetail", &NewCommonApiController{}, "Get:GetTargetNoStandDetail")
40
 	beego.Router("/m/api/gettargetnostanddetail", &NewCommonApiController{}, "Get:GetTargetNoStandDetail")
41
 	beego.Router("/m/api/gettargestanddetail", &NewCommonApiController{}, "Get:GetTargetStandDetail")
41
 	beego.Router("/m/api/gettargestanddetail", &NewCommonApiController{}, "Get:GetTargetStandDetail")
42
 	beego.Router("/m/api/getsystolicbloodstand", &NewCommonApiController{}, "Get:GetSystolicBloodStand")
42
 	beego.Router("/m/api/getsystolicbloodstand", &NewCommonApiController{}, "Get:GetSystolicBloodStand")
43
+	beego.Router("/m/api/getmobileidslist", &NewCommonApiController{}, "post:GetMobileIdsList")
43
 }
44
 }

+ 9 - 1
controllers/new_mobile_api_controllers/new_login_api_controller.go Просмотреть файл

296
 			}
296
 			}
297
 
297
 
298
 			if org.Id > 0 {
298
 			if org.Id > 0 {
299
+				//产寻该机构是否有收缩压和舒张压
300
+				pressure, err := service.GetDefaultSystolicPressure(org.Id)
301
+				fmt.Println(err)
302
+				if len(pressure) == 0 {
303
+					err = service.BathInsertQualityControlTwo(org.Id)
304
+				} else {
305
+					utils.ErrorLog("字段批量插入失败:%v", err)
306
+				}
299
 				major, requestErr := service.GetInspectionMajor(org.Id)
307
 				major, requestErr := service.GetInspectionMajor(org.Id)
300
 				if len(major) == 0 {
308
 				if len(major) == 0 {
301
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
309
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
302
 					if len(QualityeList) == 0 {
310
 					if len(QualityeList) == 0 {
303
 						err = service.BatchInsertQualityControl(org.Id)
311
 						err = service.BatchInsertQualityControl(org.Id)
304
-						err = service.BathInsertQualityControlTwo(org.Id)
312
+
305
 					} else {
313
 					} else {
306
 						utils.ErrorLog("字段批量插入失败0:%v", err)
314
 						utils.ErrorLog("字段批量插入失败0:%v", err)
307
 					}
315
 					}

+ 50 - 9
controllers/pc_index_evaluation_api_controller.go Просмотреть файл

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
+	"XT_New/models"
5
 	"XT_New/service/statistics_service"
6
 	"XT_New/service/statistics_service"
6
 	"XT_New/utils"
7
 	"XT_New/utils"
7
 	"github.com/astaxie/beego"
8
 	"github.com/astaxie/beego"
51
 //初始化数据
52
 //初始化数据
52
 func (this *PCIndexEvaluationApiController) GetLaboratoryIndexInitData() {
53
 func (this *PCIndexEvaluationApiController) GetLaboratoryIndexInitData() {
53
 	adminUserInfo := this.GetAdminUserInfo()
54
 	adminUserInfo := this.GetAdminUserInfo()
54
-	references, _ := statistics_service.FindOrgQualityControlStandardInspectionReference(adminUserInfo.CurrentOrgId)
55
+
56
+	var references []*models.InspectionReference
57
+	count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
58
+	if count <= 0 {
59
+		references, _ = statistics_service.FindOrgInspectionReference(0, 1)
60
+		references2, _ := statistics_service.FindOrgInspectionReference(0, 2)
61
+		references = append(references, references2...)
62
+
63
+	} else {
64
+		references, _ = statistics_service.FindOrgInspectionReference(adminUserInfo.CurrentOrgId, 1)
65
+		references2, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.CurrentOrgId, 2)
66
+		references = append(references, references2...)
67
+
68
+	}
55
 	this.ServeSuccessJSON(map[string]interface{}{
69
 	this.ServeSuccessJSON(map[string]interface{}{
56
 		"references": references,
70
 		"references": references,
57
 	})
71
 	})
64
 	item_id, _ := this.GetInt64("item_id")
78
 	item_id, _ := this.GetInt64("item_id")
65
 	adminUserInfo := this.GetAdminUserInfo()
79
 	adminUserInfo := this.GetAdminUserInfo()
66
 	var range_vaule []string
80
 	var range_vaule []string
81
+	var qcs models.InspectionReference
67
 	if range_type == 1 {
82
 	if range_type == 1 {
68
-		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
69
-		range_vaule = append(range_vaule, qcs.MinRange)
70
-		range_vaule = append(range_vaule, qcs.LargeRange)
83
+		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
84
+
85
+		if count <= 0 {
86
+			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
87
+		} else {
88
+			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
89
+
90
+		}
91
+
92
+		range_vaule = append(range_vaule, qcs.RangeMin)
93
+		range_vaule = append(range_vaule, qcs.RangeMax)
71
 
94
 
72
 	} else {
95
 	} else {
73
 
96
 
111
 	}
134
 	}
112
 
135
 
113
 	var range_value string
136
 	var range_value string
137
+
114
 	if range_type == 1 {
138
 	if range_type == 1 {
115
-		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
116
-		range_value = qcs.MinRange + "," + qcs.LargeRange
139
+		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
140
+
141
+		if count <= 0 {
142
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
143
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
144
+
145
+		} else {
146
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
147
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
148
+		}
117
 
149
 
118
 	} else {
150
 	} else {
151
+
119
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
152
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
120
 		for _, item := range inspection {
153
 		for _, item := range inspection {
121
 			if len(range_value) == 0 {
154
 			if len(range_value) == 0 {
245
 
278
 
246
 	var range_value string
279
 	var range_value string
247
 	if range_type == 1 {
280
 	if range_type == 1 {
248
-		qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
249
-		range_value = qcs.MinRange + "," + qcs.LargeRange
281
+		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
282
+
283
+		if count <= 0 {
284
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
285
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
286
+
287
+		} else {
288
+			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
289
+			range_value = qcs.RangeMin + "," + qcs.RangeMax
290
+		}
250
 
291
 
251
 	} else {
292
 	} else {
293
+
252
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
294
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
253
 		for _, item := range inspection {
295
 		for _, item := range inspection {
254
 			if len(range_value) == 0 {
296
 			if len(range_value) == 0 {
259
 		}
301
 		}
260
 
302
 
261
 	}
303
 	}
262
-
263
 	data, _ := statistics_service.GetPatientInspectionBarChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value, patient_id)
304
 	data, _ := statistics_service.GetPatientInspectionBarChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value, patient_id)
264
 	this.ServeSuccessJSON(map[string]interface{}{
305
 	this.ServeSuccessJSON(map[string]interface{}{
265
 		"data": data,
306
 		"data": data,

+ 32 - 1
controllers/schedule_api_controller.go Просмотреть файл

547
 // @param date:string yyyy-MM-dd 要打印的那一周中的任一天
547
 // @param date:string yyyy-MM-dd 要打印的那一周中的任一天
548
 func (this *ScheduleApiController) PrintInitData() {
548
 func (this *ScheduleApiController) PrintInitData() {
549
 	dateStr := this.GetString("date")
549
 	dateStr := this.GetString("date")
550
+	//week_type, _ := this.GetInt64("type", 0)
551
+
550
 	var date *time.Time
552
 	var date *time.Time
551
 	if len(dateStr) == 0 {
553
 	if len(dateStr) == 0 {
552
 		now := time.Now()
554
 		now := time.Now()
562
 
564
 
563
 	adminUserInfo := this.GetAdminUserInfo()
565
 	adminUserInfo := this.GetAdminUserInfo()
564
 	// 获取本周的排班
566
 	// 获取本周的排班
565
-	monday, sunday := utils.GetMondayAndSundayOfWeekDate(date)
567
+	var monday time.Time
568
+	var sunday time.Time
569
+	//switch week_type {
570
+	//case 1:
571
+	monday, sunday = utils.GetMondayAndSundayOfWeekDate(date)
572
+
573
+	//	break
574
+	//case 2:
575
+	//	monday, sunday = utils.GetMondayAndSundayOfNextWeekDate(date)
576
+	//
577
+	//	break
578
+	//case 3:
579
+	//	monday, sunday = utils.GetMondayAndSundayOfNextNextWeekDate(date)
580
+	//	break
581
+	//}
566
 	schedules, getScheduleErr := service.GetPrinitWeekSchedules(adminUserInfo.CurrentOrgId, monday.Unix(), sunday.Unix())
582
 	schedules, getScheduleErr := service.GetPrinitWeekSchedules(adminUserInfo.CurrentOrgId, monday.Unix(), sunday.Unix())
567
 	if getScheduleErr != nil {
583
 	if getScheduleErr != nil {
568
 		this.ErrorLog("获取周排班失败:%v", getScheduleErr)
584
 		this.ErrorLog("获取周排班失败:%v", getScheduleErr)
570
 		return
586
 		return
571
 	}
587
 	}
572
 
588
 
589
+	thisTime := date
590
+
591
+	weekDay := int(thisTime.Weekday())
592
+	if weekDay == 0 {
593
+		weekDay = 7
594
+	}
595
+	weekEnd := 7 - weekDay
596
+	weekStart := weekEnd - 6
597
+	days := make([]string, 0)
598
+	for index := weekStart; index <= weekEnd; index++ {
599
+		theDay := thisTime.AddDate(0, 0, index)
600
+		days = append(days, theDay.Format("2006-01-02"))
601
+	}
602
+
573
 	this.ServeSuccessJSON(map[string]interface{}{
603
 	this.ServeSuccessJSON(map[string]interface{}{
574
 		"schedules": schedules,
604
 		"schedules": schedules,
575
 		"monday":    monday.Unix(),
605
 		"monday":    monday.Unix(),
606
+		"days":      days,
576
 	})
607
 	})
577
 }
608
 }
578
 
609
 

+ 8 - 2
controllers/verify_login_controller.go Просмотреть файл

157
 					utils.ErrorLog("字段批量插入失败:%v", err)
157
 					utils.ErrorLog("字段批量插入失败:%v", err)
158
 				}
158
 				}
159
 			}
159
 			}
160
-
160
+			//产寻该机构是否有收缩压和舒张压
161
+			pressure, err := service.GetDefaultSystolicPressure(curOrg.Id)
162
+			fmt.Println(err)
163
+			if len(pressure) == 0 {
164
+				err = service.BathInsertQualityControlTwo(curOrg.Id)
165
+			} else {
166
+				utils.ErrorLog("字段批量插入失败:%v", err)
167
+			}
161
 			major, err := service.GetInspectionMajor(curOrg.Id)
168
 			major, err := service.GetInspectionMajor(curOrg.Id)
162
 			if len(major) == 0 {
169
 			if len(major) == 0 {
163
 				QualityeList, err := service.FindQualityByOrgId(curOrg.Id)
170
 				QualityeList, err := service.FindQualityByOrgId(curOrg.Id)
164
 				if len(QualityeList) == 0 {
171
 				if len(QualityeList) == 0 {
165
 					err = service.BatchInsertQualityControl(curOrg.Id)
172
 					err = service.BatchInsertQualityControl(curOrg.Id)
166
-					err = service.BathInsertQualityControlTwo(curOrg.Id)
167
 				} else {
173
 				} else {
168
 					utils.ErrorLog("字段批量插入失败:%v", err)
174
 					utils.ErrorLog("字段批量插入失败:%v", err)
169
 				}
175
 				}

+ 8 - 16
models/dialysis.go Просмотреть файл

274
 }
274
 }
275
 
275
 
276
 type PredialysisEvaluationList struct {
276
 type PredialysisEvaluationList struct {
277
-	ID                          int64   `gorm:"column:id" json:"id"`
278
-	UserOrgId                   int64   `gorm:"column:user_org_id" json:"user_org_id"`
279
-	PatientId                   int64   `gorm:"column:patient_id" json:"patient_id"`
280
-	AssessmentDate              int64   `gorm:"column:assessment_date" json:"assessment_date"`
281
-	DialysisOrderId             int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id"`
282
-	DryWeight                   float64 `gorm:"column:dry_weight" json:"dry_weight"`
283
-	SystolicBloodPressure       float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
284
-	DiastolicBloodPressure      float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
285
-	WeightAfterLastTransparency float64 `gorm:"column:weight_after_last_transparency" json:"weight_after_last_transparency"`
286
-	WeighingWay                 string  `gorm:"column:weighing_way" json:"weighing_way"`
287
-	WeighingBefore              float64 `gorm:"column:weighing_before" json:"weighing_before"`
288
-	AdditionalWeight            float64 `gorm:"column:additional_weight" json:"additional_weight"`
289
-	WeightBefore                float64 `gorm:"column:weight_before" json:"weight_before"`
290
-	Evaluator                   int64   `gorm:"column:evaluator" json:"evaluator"`
291
-	Creater                     int64   `gorm:"column:creater" json:"creater"`
292
-	CreatedTime                 int64   `gorm:"column:created_time" json:"created_time"`
277
+	ID                     int64   `gorm:"column:id" json:"id"`
278
+	UserOrgId              int64   `gorm:"column:user_org_id" json:"user_org_id"`
279
+	PatientId              int64   `gorm:"column:patient_id" json:"patient_id"`
280
+	AssessmentDate         int64   `gorm:"column:assessment_date" json:"assessment_date"`
281
+	WeightBefore           float64 `gorm:"column:weight_before" json:"weight_before"`
282
+	CreatedTime            int64   `gorm:"column:created_time" json:"created_time"`
283
+	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
284
+	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
293
 }
285
 }
294
 
286
 
295
 func (PredialysisEvaluationList) TableName() string {
287
 func (PredialysisEvaluationList) TableName() string {

+ 13 - 2
models/patient_models.go Просмотреть файл

230
 	ID         int64 `gorm:"column:id" json:"id"`
230
 	ID         int64 `gorm:"column:id" json:"id"`
231
 	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id"`
231
 	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id"`
232
 	PatientId  int64 `gorm:"column:patient_id" json:"patient_id"`
232
 	PatientId  int64 `gorm:"column:patient_id" json:"patient_id"`
233
-	ModeId     int64 `gorm:"column:mode_id" json:"mode_id"`
234
 	RecordDate int64 `gorm:"column:record_date" json:"record_date"`
233
 	RecordDate int64 `gorm:"column:record_date" json:"record_date"`
235
 	RecordId   int64 `gorm:"column:record_id" json:"record_id"`
234
 	RecordId   int64 `gorm:"column:record_id" json:"record_id"`
236
 	Creater    int64 `gorm:"column:creater" json:"creater"`
235
 	Creater    int64 `gorm:"column:creater" json:"creater"`
237
-	Modifier   int64 `gorm:"column:modifier" json:"modifier"`
238
 }
236
 }
239
 
237
 
240
 func (DialysisPrescriptionList) TableName() string {
238
 func (DialysisPrescriptionList) TableName() string {
746
 	return "xt_inspection"
744
 	return "xt_inspection"
747
 }
745
 }
748
 
746
 
747
+type BloodXtPatients struct {
748
+	ID         int64  `gorm:"column:id" json:"id" form:"id"`
749
+	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
750
+	DialysisNo string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
751
+	Name       string `gorm:"column:name" json:"name" form:"name"`
752
+	IdCardNo   string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
753
+}
754
+
755
+func (BloodXtPatients) TableName() string {
756
+
757
+	return "xt_patients"
758
+}
759
+
749
 type XtPatients struct {
760
 type XtPatients struct {
750
 	ID                           int64   `gorm:"column:id" json:"id" form:"id"`
761
 	ID                           int64   `gorm:"column:id" json:"id" form:"id"`
751
 	UserOrgId                    int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
762
 	UserOrgId                    int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 1 - 1
routers/router.go Просмотреть файл

35
 	controllers.ScheduleApiRegistRouters()
35
 	controllers.ScheduleApiRegistRouters()
36
 	controllers.SignWeighAPIControllerRegistRouters()
36
 	controllers.SignWeighAPIControllerRegistRouters()
37
 	controllers.InvoiceApiRegistRouters()
37
 	controllers.InvoiceApiRegistRouters()
38
-	controllers.StockApiRegistRouters()
38
+	//controllers.StockApiRegistRouters()
39
 	controllers.StockGoodApiRegistRouters()
39
 	controllers.StockGoodApiRegistRouters()
40
 	controllers.StockManagerApiRegistRouters()
40
 	controllers.StockManagerApiRegistRouters()
41
 	controllers.PatientScheduleTemplateAPIControllerRegistRouters()
41
 	controllers.PatientScheduleTemplateAPIControllerRegistRouters()

+ 11 - 5
service/common_service.go Просмотреть файл

334
 
334
 
335
 }
335
 }
336
 
336
 
337
-func GetCurentOrgPatients(orgid int64) (patients []*models.XtPatients, err error) {
337
+func GetCurentOrgPatients(orgid int64) (patients []*models.BloodXtPatients, err error) {
338
 
338
 
339
 	err = XTReadDB().Where("user_org_id = ? and status =1", orgid).Order("created_time desc").Find(&patients).Error
339
 	err = XTReadDB().Where("user_org_id = ? and status =1", orgid).Order("created_time desc").Find(&patients).Error
340
 	return patients, err
340
 	return patients, err
2723
 
2723
 
2724
 }
2724
 }
2725
 
2725
 
2726
-func GetSystolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.XTMonitoringRecord, total int64, err error) {
2726
+func GetSystolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.VmMonitoringRecord, total int64, err error) {
2727
 
2727
 
2728
 	db := XTReadDB().Table("xt_monitoring_record as x")
2728
 	db := XTReadDB().Table("xt_monitoring_record as x")
2729
-	err = db.Select("x.id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.systolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2729
+	err = db.Select("x.id,x.systolic_blood_pressure").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.systolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2730
 	return record, total, err
2730
 	return record, total, err
2731
 }
2731
 }
2732
 
2732
 
2737
 	return record, total, err
2737
 	return record, total, err
2738
 }
2738
 }
2739
 
2739
 
2740
-func GetDiastolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.XTMonitoringRecord, total int64, err error) {
2740
+func GetDiastolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.VmMonitoringRecord, total int64, err error) {
2741
 
2741
 
2742
 	db := XTReadDB().Table("xt_monitoring_record as x")
2742
 	db := XTReadDB().Table("xt_monitoring_record as x")
2743
-	err = db.Select("x.id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.diastolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2743
+	err = db.Select("x.id,x.diastolic_blood_pressure").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.diastolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2744
 	return record, total, err
2744
 	return record, total, err
2745
 }
2745
 }
2746
 
2746
 
3220
 	err = db.Select("x.id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.patient_id,x.monitoring_date,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and (x.systolic_blood_pressure <> 0 or x.diastolic_blood_pressure)", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Scan(&record).Error
3220
 	err = db.Select("x.id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.patient_id,x.monitoring_date,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and (x.systolic_blood_pressure <> 0 or x.diastolic_blood_pressure)", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Scan(&record).Error
3221
 	return record, err
3221
 	return record, err
3222
 }
3222
 }
3223
+
3224
+func GetInspectionMoninList(id int64, orgid int64, patientid int64) (models.XtInspection, error) {
3225
+	inspection := models.XtInspection{}
3226
+	err = XTReadDB().Model(&inspection).Where("item_id=? and org_id = ? and status = 1 and patient_id = ?", id, orgid, patientid).Last(&inspection).Error
3227
+	return inspection, err
3228
+}

+ 8 - 2
service/data.go Просмотреть файл

12
 func GetConfigList(orgID int64) (dataconfig interface{}, err error) {
12
 func GetConfigList(orgID int64) (dataconfig interface{}, err error) {
13
 	var configList []*models.Dataconfig
13
 	var configList []*models.Dataconfig
14
 
14
 
15
-	err = readDb.Model(&models.Dataconfig{}).Where("(org_id in (0,?) and status = 1) or (status = 0 and delete_id_system > 0 and org_id = ?)", orgID, orgID).Order("orders desc, id asc").Find(&configList).Error
15
+	err = readDb.Model(&models.Dataconfig{}).Where("(org_id in (0,?) and status = 1) or (status = 0 and delete_id_system > 0 and org_id = ?)", orgID, orgID).Order("orders asc, id asc").Find(&configList).Error
16
 	if err != nil {
16
 	if err != nil {
17
 		return nil, err
17
 		return nil, err
18
 	}
18
 	}
173
 
173
 
174
 func FindQualityByOrgId(orgid int64) (xtquality []*models.XtQualityControlStandard, err error) {
174
 func FindQualityByOrgId(orgid int64) (xtquality []*models.XtQualityControlStandard, err error) {
175
 
175
 
176
-	err = readDb.Model(&models.XtQualityControlStandard{}).Where("user_org_id =? and status =1", orgid).Find(&xtquality).Error
176
+	err = readDb.Model(&models.XtQualityControlStandard{}).Where("user_org_id =? and status =1 and is_status = 1", orgid).Find(&xtquality).Error
177
+	return
178
+}
179
+
180
+func GetDefaultSystolicPressure(orgid int64) (xtquality []*models.XtQualityControlStandard, err error) {
181
+
182
+	err = readDb.Model(&models.XtQualityControlStandard{}).Where("user_org_id = ? and status = 1 and is_status =0", orgid).Find(&xtquality).Error
177
 	return
183
 	return
178
 }
184
 }
179
 
185
 

+ 1 - 2
service/dialysis_service.go Просмотреть файл

608
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
608
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
609
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
609
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
610
 		// Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
610
 		// Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
611
-		Preload("TreatmentMode", "status = 1").
612
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
611
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
613
 		Preload("AssessmentBeforeDislysis", "status = 1 AND user_org_id = ?", orgID).
612
 		Preload("AssessmentBeforeDislysis", "status = 1 AND user_org_id = ?", orgID).
614
 		Preload("Prescription", "status = 1 AND user_org_id = ?", orgID).
613
 		Preload("Prescription", "status = 1 AND user_org_id = ?", orgID).
639
 		Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ?", orgID).
638
 		Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ?", orgID).
640
 		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ?", orgID).
639
 		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ?", orgID).
641
 		Preload("MonitoringRecord", func(db *gorm.DB) *gorm.DB {
640
 		Preload("MonitoringRecord", func(db *gorm.DB) *gorm.DB {
642
-			return db.Where("status = 1 AND user_org_id = ?", orgID).Order("operate_time desc")
641
+			return db.Where("status = 1 AND user_org_id = ?", orgID).Order("operate_time asc")
643
 		}).
642
 		}).
644
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
643
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
645
 		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)
644
 		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)

+ 17 - 5
service/management_service/management_analyse_service.go Просмотреть файл

12
 	db := service.XTReadDB()
12
 	db := service.XTReadDB()
13
 	switch statistics_type {
13
 	switch statistics_type {
14
 	case 1:
14
 	case 1:
15
-		err = db.Raw("select from_unixtime(lapseto_time,'%m-%d') as date, count(distinct patient_id) as value  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = 1 AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?   Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
15
+		err = db.Raw("select from_unixtime(created_time,'%m-%d') as date, count(distinct id) as value  from xt_patients patient   Where  patient.user_org_id = ? AND patient.created_time >=? AND patient.created_time <=? AND patient.status = 1   AND patient.lapseto = 1  Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
16
 
16
 
17
 		break
17
 		break
18
 	case 2:
18
 	case 2:
19
 		//err = db.Raw("select from_unixtime(assessment_date,'%Y-%m-%d') as date, weight_after as value from xt_assessment_after_dislysis  Where status = 1 AND user_org_id = ? AND patient_id = ?  AND assessment_date <= ? AND  assessment_date >= ? ", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
19
 		//err = db.Raw("select from_unixtime(assessment_date,'%Y-%m-%d') as date, weight_after as value from xt_assessment_after_dislysis  Where status = 1 AND user_org_id = ? AND patient_id = ?  AND assessment_date <= ? AND  assessment_date >= ? ", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
20
 		err = db.Raw("select from_unixtime(lapseto_time,'%m-%d') as date, count(distinct patient_id) as value  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = 2 AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?   Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
20
 		err = db.Raw("select from_unixtime(lapseto_time,'%m-%d') as date, count(distinct patient_id) as value  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = 2 AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?   Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
21
+		//err = db.Raw("select from_unixtime(updated_time,'%m-%d') as date, count(distinct id) as value  from xt_patients patient   Where  patient.user_org_id = ? AND patient.updated_time >=? AND patient.updated_time <=? AND patient.status = 1   AND patient.lapseto = 2  Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
21
 
22
 
22
 		break
23
 		break
23
 	}
24
 	}
44
 	var err error
45
 	var err error
45
 	var patients []*PatientTableStruct
46
 	var patients []*PatientTableStruct
46
 	readDb := service.XTReadDB()
47
 	readDb := service.XTReadDB()
47
-	db := readDb.Raw("select from_unixtime(lapseto.`lapseto_time`,'%Y-%m-%d %H:%m') as date , patient.name as name, patient.`id_card_no` as id_card_no, patient.`gender` as gender  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = ? AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?  ", orgID, statistics_type, start, end)
48
-	err = db.Order("lapseto.lapseto_time desc").Scan(&patients).Error
49
-	//.Offset(offset).Limit(limit)
48
+	if statistics_type == 1 {
49
+		db := readDb.Raw("select from_unixtime(patient.`created_time`,'%Y-%m-%d %H:%m') as date , patient.name as name, patient.`id_card_no` as id_card_no, patient.`gender` as gender  from `xt_patients` patient Where patient.user_org_id = ? AND patient.status = 1 AND patient.lapseto = ?  AND patient.created_time >= ? AND patient.created_time <= ?  ", orgID, statistics_type, start, end)
50
+		err = db.Order("patient.created_time desc").Scan(&patients).Error
51
+
52
+	} else {
53
+
54
+		db := readDb.Raw("select from_unixtime(lapseto.`lapseto_time`,'%Y-%m-%d %H:%m') as date , patient.name as name, patient.`id_card_no` as id_card_no, patient.`gender` as gender  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = ? AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?  ", orgID, statistics_type, start, end)
55
+		//db := readDb.Raw("select from_unixtime(patient.`updated_time`,'%Y-%m-%d %H:%m') as date , patient.name as name, patient.`id_card_no` as id_card_no, patient.`gender` as gender  from `xt_patients` patient Where patient.user_org_id = ? AND patient.status = 1 AND patient.lapseto = ?  AND patient.updated_time >= ? AND patient.updated_time <= ?  ", orgID, statistics_type, start, end)
56
+		err = db.Group("lapseto.`patient_id`").Order("lapseto.lapseto_time desc").Scan(&patients).Error
57
+
58
+	}
59
+
50
 	return patients, total, err
60
 	return patients, total, err
51
 }
61
 }
52
 
62
 
53
 func GetLapsetoPatientTotal(orgID int64, statistics_type int) (Total int64, err error) {
63
 func GetLapsetoPatientTotal(orgID int64, statistics_type int) (Total int64, err error) {
54
 	readDb := service.XTReadDB()
64
 	readDb := service.XTReadDB()
55
-	err = readDb.Raw("select count(*) as total from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type =?", orgID, statistics_type).Count(&Total).Error
65
+	//err = readDb.Raw("select count(*) as total from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type =?", orgID, statistics_type).Count(&Total).Error
66
+	err = readDb.Raw("select count(*) as total from `xt_patients` patient Where patient.user_org_id = ? AND patient.status = 1 AND patient.lapseto = ?", orgID, statistics_type).Count(&Total).Error
67
+
56
 	return Total, err
68
 	return Total, err
57
 }
69
 }

+ 37 - 17
service/mobile_dialysis_service.go Просмотреть файл

30
 		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
30
 		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
31
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
31
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
32
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
32
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
33
-		Preload("TreatmentMode", "status = 1").
34
 		Preload("Advices", "status = 1 AND user_org_id = ? AND advice_type = 2", orgID).
33
 		Preload("Advices", "status = 1 AND user_org_id = ? AND advice_type = 2", orgID).
35
 		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
34
 		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
36
 		Preload("AssessmentBeforeDislysis", "status = 1 AND user_org_id = ? AND assessment_date = ? ", orgID, scheduleDate).
35
 		Preload("AssessmentBeforeDislysis", "status = 1 AND user_org_id = ? AND assessment_date = ? ", orgID, scheduleDate).
37
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
36
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
38
 		Preload("DialysisOrder.DeviceNumber", "status = 1 AND org_id = ?", orgID).
37
 		Preload("DialysisOrder.DeviceNumber", "status = 1 AND org_id = ?", orgID).
38
+		Preload("TreatmentSummary", "status = 1  AND user_org_id = ?", orgID).
39
 		// Preload("DialysisOrder.MonitoringRecords", func(rdb *gorm.DB) *gorm.DB {
39
 		// Preload("DialysisOrder.MonitoringRecords", func(rdb *gorm.DB) *gorm.DB {
40
 		// 	return rdb.Where("status = 1 AND user_org_id = ?", orgID).Order("operate_time DESC")
40
 		// 	return rdb.Where("status = 1 AND user_org_id = ?", orgID).Order("operate_time DESC")
41
 		// }).
41
 		// }).
59
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
59
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
60
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
60
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
61
 		// Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
61
 		// Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
62
-		Preload("TreatmentMode", "status = 1").
63
 		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
62
 		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
64
 		Preload("AssessmentBeforeDislysis", "status = 1 AND user_org_id = ? AND assessment_date = ? ", orgID, scheduleDate).
63
 		Preload("AssessmentBeforeDislysis", "status = 1 AND user_org_id = ? AND assessment_date = ? ", orgID, scheduleDate).
65
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
64
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
66
 		Preload("Advices", "status = 1 AND user_org_id = ? AND advice_type = 2 ", orgID).
65
 		Preload("Advices", "status = 1 AND user_org_id = ? AND advice_type = 2 ", orgID).
66
+		Preload("TreatmentMode", "status = 1").
67
+		Preload("TreatmentSummary", "status = 1  AND user_org_id = ?", orgID).
67
 		Where("sch.status = 1 AND sch.user_org_id = ?", orgID)
68
 		Where("sch.status = 1 AND sch.user_org_id = ?", orgID)
68
 	if scheduleDate != 0 {
69
 	if scheduleDate != 0 {
69
 		db = db.Where("schedule_date = ?", scheduleDate)
70
 		db = db.Where("schedule_date = ?", scheduleDate)
73
 	return vms, err
74
 	return vms, err
74
 }
75
 }
75
 
76
 
77
+type VMTreatmentSummary struct {
78
+	ID              int64  `gorm:"column:id" json:"id"`
79
+	UserOrgId       int64  `gorm:"column:user_org_id" json:"user_org_id"`
80
+	PatientId       int64  `gorm:"column:patient_id" json:"patient_id"`
81
+	AssessmentDate  int64  `gorm:"column:assessment_date" json:"assessment_date"`
82
+	DialysisSummary string `gorm:"column:dialysis_summary" json:"dialysis_summary" form:"dialysis_summary"`
83
+}
84
+
85
+func (VMTreatmentSummary) TableName() string {
86
+	return "xt_treatment_summary"
87
+}
88
+
76
 type MDialysisScheduleVM struct {
89
 type MDialysisScheduleVM struct {
77
 	ID           int64 `gorm:"column:id" json:"id"`
90
 	ID           int64 `gorm:"column:id" json:"id"`
78
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id"`
91
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id"`
86
 
99
 
87
 	SchedualPatient          *MSchedualPatientVMList           `gorm:"ForeignKey:PatientId" json:"patient"`
100
 	SchedualPatient          *MSchedualPatientVMList           `gorm:"ForeignKey:PatientId" json:"patient"`
88
 	DeviceNumber             *MDeviceNumberVM                  `gorm:"ForeignKey:BedId" json:"device_number"`
101
 	DeviceNumber             *MDeviceNumberVM                  `gorm:"ForeignKey:BedId" json:"device_number"`
89
-	DeviceZone               *models.DeviceZone                `gorm:"ForeignKey:PartitionId" json:"device_zone"`
90
-	TreatmentMode            *models.TreatmentMode             `gorm:"ForeignKey:ModeId" json:"treatment_mode"`
91
 	DialysisOrder            *MDialysisOrderVMList             `gorm:"ForeignKey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"dialysis_order"`
102
 	DialysisOrder            *MDialysisOrderVMList             `gorm:"ForeignKey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"dialysis_order"`
92
 	Prescription             *models.DialysisPrescriptionList  `gorm:"ForeignKey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"prescription"`
103
 	Prescription             *models.DialysisPrescriptionList  `gorm:"ForeignKey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"prescription"`
93
 	AssessmentBeforeDislysis *models.PredialysisEvaluationList `gorm:"ForeignKey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"assessment_before_dislysis"`
104
 	AssessmentBeforeDislysis *models.PredialysisEvaluationList `gorm:"ForeignKey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"assessment_before_dislysis"`
94
-	TreatmentSummary         *models.TreatmentSummary          `gorm:"ForeignKey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"treatment_summary"`
95
-	Advices                  []*models.DoctorAdvice            `gorm:"ForeignKey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"doctor_advice"`
105
+	Advices                  []*VMDoctorAdvice                 `gorm:"ForeignKey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"doctor_advice"`
106
+	TreatmentSummary         *VMTreatmentSummary               `gorm:"ForeignKey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"treatment_summary"`
96
 }
107
 }
97
 
108
 
98
 func (MDialysisScheduleVM) TableName() string {
109
 func (MDialysisScheduleVM) TableName() string {
239
 	// PrescriptionId int64  `gorm:"column:prescription_id" json:"prescription_id"`
250
 	// PrescriptionId int64  `gorm:"column:prescription_id" json:"prescription_id"`
240
 	Stage int64 `gorm:"column:stage" json:"stage"`
251
 	Stage int64 `gorm:"column:stage" json:"stage"`
241
 	// Remark         string `gorm:"column:remark" json:"remark"`
252
 	// Remark         string `gorm:"column:remark" json:"remark"`
242
-	BedID          int64            `gorm:"column:bed_id" json:"bed_id"`
243
-	StartNurse     int64            `gorm:"column:start_nurse" json:"start_nurse"`
244
-	FinishNurse    int64            `gorm:"column:finish_nurse" json:"finish_nurse"`
245
-	Status         int64            `gorm:"column:status" json:"status"`
246
-	PunctureNurse  int64            `gorm:"column:puncture_nurse" json:"puncture_nurse"`
247
-	DeviceNumber   *MDeviceNumberVM `gorm:"ForeignKey:BedID" json:"device_number"`
248
-	Creator        int64            `gorm:"column:creator" json:"creator"`
249
-	Modifier       int64            `gorm:"column:modifier" json:"modifier"`
250
-	FinishCreator  int64            `gorm:"column:finish_creator" json:"finish_creator"`
251
-	FinishModifier int64            `gorm:"column:finish_modifier" json:"finish_modifier"`
252
-	SchedualType   int64            `gorm:"column:schedual_type" json:"schedual_type"`
253
+	BedID        int64            `gorm:"column:bed_id" json:"bed_id"`
254
+	StartNurse   int64            `gorm:"column:start_nurse" json:"start_nurse"`
255
+	Status       int64            `gorm:"column:status" json:"status"`
256
+	DeviceNumber *MDeviceNumberVM `gorm:"ForeignKey:BedID" json:"device_number"`
257
+	Creator      int64            `gorm:"column:creator" json:"creator"`
253
 }
258
 }
254
 
259
 
255
 func (MDialysisOrderVMList) TableName() string {
260
 func (MDialysisOrderVMList) TableName() string {
256
 	return "xt_dialysis_order"
261
 	return "xt_dialysis_order"
257
 }
262
 }
258
 
263
 
264
+type VMDoctorAdvice struct {
265
+	ID             int64 `gorm:"column:id" json:"id" form:"id"`
266
+	GroupNo        int64 `gorm:"column:groupno" json:"groupno" form:"groupno"`
267
+	UserOrgId      int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
268
+	PatientId      int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
269
+	AdviceDate     int64 `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
270
+	Status         int64 `gorm:"column:status" json:"status" form:"status"`
271
+	ExecutionState int64 `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
272
+	RecordDate     int64 `gorm:"column:record_date" json:"record_date"`
273
+}
274
+
275
+func (VMDoctorAdvice) TableName() string {
276
+	return "xt_doctor_advice"
277
+}
278
+
259
 // 获取透析记录
279
 // 获取透析记录
260
 func MobileGetDialysisRecord(orgID int64, patientID int64, recordDate int64) (*models.DialysisOrder, error) {
280
 func MobileGetDialysisRecord(orgID int64, patientID int64, recordDate int64) (*models.DialysisOrder, error) {
261
 	var record models.DialysisOrder
281
 	var record models.DialysisOrder

+ 9 - 2
service/statistics_service/index_evaluation_service.go Просмотреть файл

1431
 	return
1431
 	return
1432
 }
1432
 }
1433
 
1433
 
1434
-func FindOrgConfigRangeTypeValue(user_org_id int64, project_id int64, item_id int64) (qcs QualityControlStandard, err error) {
1434
+func FindOrgConfigRangeTypeValue(user_org_id int64, project_id int64, item_id int64) (qcs models.InspectionReference, err error) {
1435
 	db := service.XTReadDB()
1435
 	db := service.XTReadDB()
1436
-	err = db.Model(&QualityControlStandard{}).Where("status = 1 AND user_org_id = ? AND inspection_major = ? AND inspection_minor = ?", user_org_id, project_id, item_id).First(&qcs).Error
1436
+	err = db.Model(&models.InspectionReference{}).Where("status = 1 AND org_id = ? AND project_id = ? AND id = ?", user_org_id, project_id, item_id).First(&qcs).Error
1437
 	return
1437
 	return
1438
 }
1438
 }
1439
 
1439
 
1448
 	db.Table("xt_inspection").Where("org_id=? and status=1 and  inspect_date >= ? and inspect_date <= ? AND project_id = ? AND item_id = ? AND inspect_value <> '' ", user_org_id, start_time, end_time, project_id, item_id).Count(&Total)
1448
 	db.Table("xt_inspection").Where("org_id=? and status=1 and  inspect_date >= ? and inspect_date <= ? AND project_id = ? AND item_id = ? AND inspect_value <> '' ", user_org_id, start_time, end_time, project_id, item_id).Count(&Total)
1449
 
1449
 
1450
 	if range_type == 1 {
1450
 	if range_type == 1 {
1451
+
1451
 		tempErr = db.Table("xt_inspection").Where("org_id=? and status=1 and  inspect_date >= ? and inspect_date <= ? AND project_id = ? AND item_id = ? AND inspect_value <> ''", user_org_id, start_time, end_time, project_id, item_id).
1452
 		tempErr = db.Table("xt_inspection").Where("org_id=? and status=1 and  inspect_date >= ? and inspect_date <= ? AND project_id = ? AND item_id = ? AND inspect_value <> ''", user_org_id, start_time, end_time, project_id, item_id).
1452
 			Select("CASE WHEN inspect_value < " + range_value_arr[0] + " THEN " + "'" + "小于" + range_value_arr[0] + "'" +
1453
 			Select("CASE WHEN inspect_value < " + range_value_arr[0] + " THEN " + "'" + "小于" + range_value_arr[0] + "'" +
1453
 				" WHEN inspect_value >= " + range_value_arr[0] + " AND  inspect_value <= " + range_value_arr[1] + " THEN " + "'" + range_value_arr[0] + "~" + range_value_arr[1] + "'" +
1454
 				" WHEN inspect_value >= " + range_value_arr[0] + " AND  inspect_value <= " + range_value_arr[1] + " THEN " + "'" + range_value_arr[0] + "~" + range_value_arr[1] + "'" +
1769
 	err = db.Raw("Select reference.project_name as project_name,qcs.inspection_major as project_id, qcs.inspection_minor as id,reference.item_name as item_name,qcs.range_type as range_type,reference.range_min as range_min, reference.range_max as range_max,reference.unit as  unit,qcs.range_value as range_value   from xt_quality_control_standard qcs Left JOIN xt_inspection_reference reference ON  qcs.inspection_major = reference.project_id and qcs.inspection_minor = reference.id and  (reference.org_id = ? OR org_id = 0)  Where qcs.user_org_id = ?  AND qcs.status = 1 AND qcs.inspection_major = ? AND qcs.inspection_minor = ?", user_org_id, user_org_id, project_id, item_id).Scan(&references).Error
1770
 	err = db.Raw("Select reference.project_name as project_name,qcs.inspection_major as project_id, qcs.inspection_minor as id,reference.item_name as item_name,qcs.range_type as range_type,reference.range_min as range_min, reference.range_max as range_max,reference.unit as  unit,qcs.range_value as range_value   from xt_quality_control_standard qcs Left JOIN xt_inspection_reference reference ON  qcs.inspection_major = reference.project_id and qcs.inspection_minor = reference.id and  (reference.org_id = ? OR org_id = 0)  Where qcs.user_org_id = ?  AND qcs.status = 1 AND qcs.inspection_major = ? AND qcs.inspection_minor = ?", user_org_id, user_org_id, project_id, item_id).Scan(&references).Error
1770
 	return
1771
 	return
1771
 }
1772
 }
1773
+
1774
+func FindOrgInspectionCount(user_org_id int64) (count int64, err error) {
1775
+	db := service.XTReadDB()
1776
+	err = db.Model(&models.InspectionReference{}).Where("status = 1 AND org_id = ?", user_org_id).Count(&count).Error
1777
+	return
1778
+}

+ 1 - 1
service/stock_service.go Просмотреть файл

1186
 }
1186
 }
1187
 
1187
 
1188
 func FindWarehouseInfoByGoodType(good_type_id int64, org_id int64) (info []*models.WarehousingInfo, err error) {
1188
 func FindWarehouseInfoByGoodType(good_type_id int64, org_id int64) (info []*models.WarehousingInfo, err error) {
1189
-	err = readDb.Model(&models.WarehousingInfo{}).Preload("GoodInfo", "status = 1 AND org_id = ?", org_id).Where("good_type_id = ? AND status = 1 AND org_id = ?", good_type_id, org_id).Find(&info).Error
1189
+	err = readDb.Model(&models.WarehousingInfo{}).Preload("GoodInfo", " org_id = ? AND good_type_id = ? AND status = 1 AND specification_name <> '' ", org_id, good_type_id).Where(" org_id = ? AND good_type_id = ?  AND status = 1 ", org_id, good_type_id).Find(&info).Error
1190
 	return info, err
1190
 	return info, err
1191
 
1191
 
1192
 }
1192
 }

+ 30 - 0
utils/tools.go Просмотреть файл

229
 	sunday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 7-weekday).Format("2006-01-02")+" 23:59:59", loc)
229
 	sunday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 7-weekday).Format("2006-01-02")+" 23:59:59", loc)
230
 	return monday, sunday
230
 	return monday, sunday
231
 }
231
 }
232
+
233
+func GetMondayAndSundayOfNextWeekDate(date *time.Time) (time.Time, time.Time) {
234
+	if date == nil {
235
+		now := time.Now()
236
+		date = &now
237
+	}
238
+	weekday := int(date.Weekday())
239
+	if weekday == 0 {
240
+		weekday = 7
241
+	}
242
+	loc, _ := time.LoadLocation("Local")
243
+	monday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 8-weekday).Format("2006-01-02")+" 00:00:00", loc)
244
+	sunday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 14-weekday).Format("2006-01-02")+" 23:59:59", loc)
245
+	return monday, sunday
246
+}
247
+
248
+func GetMondayAndSundayOfNextNextWeekDate(date *time.Time) (time.Time, time.Time) {
249
+	if date == nil {
250
+		now := time.Now()
251
+		date = &now
252
+	}
253
+	weekday := int(date.Weekday())
254
+	if weekday == 0 {
255
+		weekday = 7
256
+	}
257
+	loc, _ := time.LoadLocation("Local")
258
+	monday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 15-weekday).Format("2006-01-02")+" 00:00:00", loc)
259
+	sunday, _ := time.ParseInLocation("2006-01-02 15:04:05", date.AddDate(0, 0, 21-weekday).Format("2006-01-02")+" 23:59:59", loc)
260
+	return monday, sunday
261
+}