Browse Source

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

张保健 4 years ago
parent
commit
ca33c9c2fa
32 changed files with 524 additions and 174 deletions
  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 View File

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode = dev
4 4
 
5 5
 # 1
@@ -221,16 +221,31 @@ redisport = 6379
221 221
 redispasswrod = 123456
222 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 View File

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

+ 5 - 5
controllers/dialysis_api_controller.go View File

@@ -3303,7 +3303,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3303 3303
 		dewater_amount = 0
3304 3304
 		if evaluation.DryWeight > 0 {
3305 3305
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3306
-			if templateInfo.TemplateId == 17 {
3306
+			if templateInfo.TemplateId == 17 && templateInfo.TemplateId == 22 {
3307 3307
 				dewater_amount = dewater_amount * 1000
3308 3308
 			}
3309 3309
 			if dewater_amount <= 0 {
@@ -4863,13 +4863,13 @@ func (this *DialysisApiController) GetTodayMonitor() {
4863 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 4867
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
4868 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 4873
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
4874 4874
 				ultrafiltration_rate = value
4875 4875
 				record.UltrafiltrationRate = ultrafiltration_rate
@@ -4878,14 +4878,14 @@ func (this *DialysisApiController) GetTodayMonitor() {
4878 4878
 	}
4879 4879
 	// record.UltrafiltrationRate = ultrafiltration_rate
4880 4880
 	record.UltrafiltrationVolume = 0
4881
-	if template.TemplateId == 1 {
4881
+	if template.TemplateId == 1 && adminInfo.CurrentOrgId != 9849 {
4882 4882
 		if ultrafiltration_rate > 0 {
4883 4883
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
4884 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 4889
 		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
4890 4890
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4891 4891
 			record.UltrafiltrationVolume = ultrafiltration_volume

+ 6 - 3
controllers/dialysis_record_api_controller.go View File

@@ -741,9 +741,11 @@ func (this *DialysisRecordAPIController) StartDialysis() {
741 741
 						}
742 742
 						//查出入库记录中最后一条记录
743 743
 						stockInInfo, _ := service.FindLastStockInInfoRecord(prescription.Niprocart, adminUserInfo.CurrentOrgId)
744
+
744 745
 						warehouseOutInfo.Price = stockInInfo.Price
745 746
 						warehouseOutInfo.GoodId = prescription.Niprocart
746 747
 						warehouseOutInfo.GoodTypeId = niprocart
748
+
747 749
 						err := service.AddSigleWarehouseOutInfo(warehouseOutInfo)
748 750
 
749 751
 						if err == nil {
@@ -762,6 +764,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
762 764
 							service.AddSigleAutoReduceRecordInfo(details)
763 765
 						}
764 766
 					}
767
+
765 768
 					if prescription.Jms > 0 {
766 769
 						warehouseOutInfo := &models.WarehouseOutInfo{
767 770
 							WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
@@ -1711,7 +1714,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1711 1714
 								Status:                  1,
1712 1715
 								RecordTime:              startDate.Unix(),
1713 1716
 								OrgId:                   adminUserInfo.CurrentOrgId,
1714
-								GoodId:                  prescription.Dialyzer,
1717
+								GoodId:                  prescription.Dialyzers,
1715 1718
 								GoodTypeId:              dialyzers,
1716 1719
 							}
1717 1720
 							service.AddSigleAutoReduceRecordInfo(details)
@@ -2155,11 +2158,11 @@ func (this *DialysisRecordAPIController) StartDialysis() {
2155 2158
 			if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2156 2159
 
2157 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 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 2166
 					value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
2164 2167
 					ultrafiltration_rate = value
2165 2168
 				}

+ 8 - 1
controllers/gobal_config_api_controller.go View File

@@ -1027,12 +1027,19 @@ func (this *GobalConfigApiController) ChangeOrg() {
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 1038
 		major, err := service.GetInspectionMajor(tempOrg.Id)
1031 1039
 		if len(major) == 0 {
1032 1040
 			QualityeList, err := service.FindQualityByOrgId(tempOrg.Id)
1033 1041
 			if len(QualityeList) == 0 {
1034 1042
 				err = service.BatchInsertQualityControl(tempOrg.Id)
1035
-				err = service.BathInsertQualityControlTwo(tempOrg.Id)
1036 1043
 			} else {
1037 1044
 				utils.ErrorLog("字段批量插入失败:%v", err)
1038 1045
 			}

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

@@ -330,6 +330,12 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
330 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 339
 	if dialysistype == 1 {
334 340
 		// 保存透前相关数据
335 341
 		// 获取透析处方

+ 21 - 19
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -99,7 +99,7 @@ func (this *DialysisAPIController) Scheduals() {
99 99
 				//缓存数据
100 100
 				scheduals_json, err := json.Marshal(scheduals)
101 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,6 +111,7 @@ func (this *DialysisAPIController) Scheduals() {
111 111
 	} else { //缓存数据了数据,将redis缓存的json字符串转为map
112 112
 
113 113
 		var dat []map[string]interface{}
114
+
114 115
 		if err := json.Unmarshal([]byte(scheduals_json_str), &dat); err == nil {
115 116
 
116 117
 		} else {
@@ -161,7 +162,7 @@ func (this *DialysisAPIController) WaitingScheduals() {
161 162
 				//缓存数据
162 163
 				wait_scheduals_json, err := json.Marshal(scheduals)
163 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,7 +287,6 @@ func (this *DialysisAPIController) DialysisRecord() {
286 287
 	}
287 288
 
288 289
 	dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecord(adminInfo.Org.Id, patientID, date.Unix())
289
-	fmt.Println("----------------------------", getDialysisOrderErr)
290 290
 	if getDialysisOrderErr != nil {
291 291
 		this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
292 292
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -383,7 +383,7 @@ func (this *DialysisAPIController) DialysisRecord() {
383 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 388
 	_, gobalConfig := service.FindAutomaticReduceRecordByOrgId(adminInfo.Org.Id)
389 389
 	goodTypes, _ := service.FindAllGoodTypeByType(1)          //查出所有库存配置的系统类型
@@ -410,12 +410,12 @@ func (this *DialysisAPIController) DialysisRecord() {
410 410
 		"last_predialysis_evaluation":    lastPredialysisEvaluation,
411 411
 		"last_assessment_after_dislysis": lastAssessmentAfterDislysis,
412 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 420
 	this.ServeSuccessJSON(returnData)
421 421
 }
@@ -2751,12 +2751,12 @@ func (this *DialysisAPIController) StartDialysis() {
2751 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 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 2760
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
2761 2761
 				ultrafiltration_rate = value
2762 2762
 			}
@@ -3827,7 +3827,7 @@ func (this *DialysisAPIController) StartDialysis() {
3827 3827
 								Status:                  1,
3828 3828
 								RecordTime:              startDate.Unix(),
3829 3829
 								OrgId:                   adminUserInfo.Org.Id,
3830
-								GoodId:                  prescription.Dialyzer,
3830
+								GoodId:                  prescription.Dialyzers,
3831 3831
 								GoodTypeId:              dialyzers,
3832 3832
 							}
3833 3833
 							service.AddSigleAutoReduceRecordInfo(details)
@@ -5594,26 +5594,29 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5594 5594
 	fristrecord, _ := service.FindFirstMonitorRecordToday(patientID, adminInfo.Org.Id, monitorDate)
5595 5595
 
5596 5596
 	template, _ := service.GetOrgInfoTemplate(adminInfo.Org.Id)
5597
-	fmt.Println("1122233333")
5598 5597
 
5599 5598
 	var ultrafiltration_rate float64
5600 5599
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
5601 5600
 	if prescription.ID > 0 {
5601
+		fmt.Println("444444444")
5602
+
5602 5603
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
5604
+			fmt.Println("4444444445555")
5603 5605
 
5604 5606
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5605 5607
 			if template.TemplateId == 6 {
5608
+				fmt.Println("12222222")
5606 5609
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
5607 5610
 				record.UltrafiltrationRate = ultrafiltration_rate
5608 5611
 			}
5609 5612
 
5610
-			if template.TemplateId == 20 {
5613
+			if template.TemplateId == 20 || template.TemplateId == 22 {
5611 5614
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
5612 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 5620
 				value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", prescription.TargetUltrafiltration/float64(totalMin)*60), 6)
5618 5621
 				ultrafiltration_rate = value
5619 5622
 				record.UltrafiltrationRate = ultrafiltration_rate
@@ -5622,16 +5625,15 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5622 5625
 	}
5623 5626
 	// record.UltrafiltrationRate = ultrafiltration_rate
5624 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 5629
 		if ultrafiltration_rate > 0 {
5627 5630
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
5628 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 5636
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
5634
-			fmt.Println("11222344444444443333")
5635 5637
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5636 5638
 			record.UltrafiltrationVolume = ultrafiltration_volume
5637 5639
 		}

+ 9 - 1
controllers/mobile_api_controllers/login_api_controller.go View File

@@ -6,6 +6,7 @@ import (
6 6
 	"XT_New/service"
7 7
 	"XT_New/utils"
8 8
 	"encoding/json"
9
+	"fmt"
9 10
 	"io/ioutil"
10 11
 	"net/http"
11 12
 	"net/url"
@@ -168,6 +169,14 @@ func (this *LoginAPIController) LoginByPwd() {
168 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 182
 		major, requestErr := service.GetInspectionMajor(org.Id)
@@ -175,7 +184,6 @@ func (this *LoginAPIController) LoginByPwd() {
175 184
 			QualityeList, err := service.FindQualityByOrgId(org.Id)
176 185
 			if len(QualityeList) == 0 {
177 186
 				err = service.BatchInsertQualityControl(org.Id)
178
-				err = service.BathInsertQualityControlTwo(org.Id)
179 187
 			} else {
180 188
 				utils.ErrorLog("字段批量插入失败:%v", err)
181 189
 			}

+ 4 - 1
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -885,9 +885,12 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
885 885
 	dewater_amount = 0
886 886
 	if evaluation.DryWeight > 0 {
887 887
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
888
-		if template.TemplateId == 17 {
888
+
889
+		if template.TemplateId == 17 || template.TemplateId == 22 {
889 890
 			dewater_amount = dewater_amount * 1000
891
+
890 892
 		}
893
+
891 894
 		if dewater_amount <= 0 {
892 895
 			dewater_amount = 0
893 896
 		}

+ 70 - 47
controllers/new_mobile_api_controllers/common_api_controller.go View File

@@ -219,7 +219,7 @@ func (this *CommonApiController) GetConfigurationDetail() {
219 219
 		}
220 220
 		this.ServeSuccessJSON(map[string]interface{}{
221 221
 			"configurationdetail": detail,
222
-			"vid":                 vid,
222
+			"vid": vid,
223 223
 		})
224 224
 	} else {
225 225
 		itemId, err := service.GetIdByItemId(detail.InspectionMinor, orgId)
@@ -229,7 +229,7 @@ func (this *CommonApiController) GetConfigurationDetail() {
229 229
 		}
230 230
 		this.ServeSuccessJSON(map[string]interface{}{
231 231
 			"configurationdetail": detail,
232
-			"vid":                 itemId.ID,
232
+			"vid": itemId.ID,
233 233
 		})
234 234
 	}
235 235
 
@@ -1092,29 +1092,27 @@ func (this *CommonApiController) GetFirstQuarter() {
1092 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 1103
 	normData, _ := service.GetNormData(orgid)
1104 1104
 	if err != nil {
1105 1105
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1106 1106
 		return
1107 1107
 	}
1108 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,48 +1674,48 @@ func (this *CommonApiController) GetBloodPressureList() {
1676 1674
 	fmt.Println("第四季度", fourQuarterEndStrUnix)
1677 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 1692
 		if err != nil {
1695 1693
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1696 1694
 			return
1697 1695
 		}
1698 1696
 
1699 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 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 1720
 		if err != nil {
1723 1721
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -1725,14 +1723,14 @@ func (this *CommonApiController) GetBloodPressureList() {
1725 1723
 		}
1726 1724
 
1727 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,3 +2030,28 @@ func (this *CommonApiController) GetMonthBloodList() {
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 View File

@@ -55,4 +55,5 @@ func CommonApiControllersRegisterRouters() {
55 55
 	beego.Router("/com/api/updatebloodprussre", &CommonApiController{}, "Post:UpdateBloodPrussre")
56 56
 	beego.Router("/com/api/getbloodpressurelist", &CommonApiController{}, "Get:GetBloodPressureList")
57 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 View File

@@ -7,6 +7,7 @@ import (
7 7
 	"XT_New/service"
8 8
 	"XT_New/utils"
9 9
 	"encoding/json"
10
+	"fmt"
10 11
 	"github.com/astaxie/beego"
11 12
 	"io/ioutil"
12 13
 	"net/http"
@@ -180,12 +181,19 @@ func (this *ForgetPwdController) ModifyPassword() {
180 181
 			}
181 182
 
182 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 192
 				major, requestErr := service.GetInspectionMajor(org.Id)
184 193
 				if len(major) == 0 {
185 194
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
186 195
 					if len(QualityeList) == 0 {
187 196
 						err = service.BatchInsertQualityControl(org.Id)
188
-						err = service.BathInsertQualityControlTwo(org.Id)
189 197
 					} else {
190 198
 						utils.ErrorLog("字段批量插入失败:%v", err)
191 199
 					}

+ 9 - 1
controllers/new_mobile_api_controllers/home_api_controller.go View File

@@ -7,6 +7,7 @@ import (
7 7
 	"XT_New/service"
8 8
 	"XT_New/utils"
9 9
 	"encoding/json"
10
+	"fmt"
10 11
 	"github.com/astaxie/beego"
11 12
 	"io/ioutil"
12 13
 	"net/http"
@@ -233,12 +234,19 @@ func (this *HomeController) ChangeOrg() {
233 234
 			}
234 235
 
235 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 245
 				major, err := service.GetInspectionMajor(org.Id)
237 246
 				if len(major) == 0 {
238 247
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
239 248
 					if len(QualityeList) == 0 {
240 249
 						err = service.BatchInsertQualityControl(org.Id)
241
-						err = service.BathInsertQualityControlTwo(org.Id)
242 250
 					} else {
243 251
 						utils.ErrorLog("字段批量插入失败:%v", err)
244 252
 					}

+ 76 - 8
controllers/new_mobile_api_controllers/index_evaluation_api_controller.go View File

@@ -2,6 +2,7 @@ package new_mobile_api_controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
+	"XT_New/models"
5 6
 	"XT_New/service/statistics_service"
6 7
 	"XT_New/utils"
7 8
 	"fmt"
@@ -24,11 +25,35 @@ func (this *IndexEvaluationApiController) GetAdminUser() {
24 25
 //初始化数据
25 26
 func (this *IndexEvaluationApiController) GetLaboratoryIndexInitData() {
26 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 42
 	this.ServeSuccessJSON(map[string]interface{}{
29 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,10 +63,20 @@ func (this *IndexEvaluationApiController) GetLaboratoryIndexProjectRangeValueDat
38 63
 	item_id, _ := this.GetInt64("item_id")
39 64
 	adminUserInfo := this.GetMobileAdminUserInfo()
40 65
 	var range_vaule []string
66
+	var qcs models.InspectionReference
67
+
41 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 80
 	} else {
46 81
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
47 82
 		for _, item := range inspection {
@@ -82,9 +117,33 @@ func (this *IndexEvaluationApiController) GetInspectionChartData() {
82 117
 	}
83 118
 
84 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 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 148
 	} else {
90 149
 
@@ -96,6 +155,7 @@ func (this *IndexEvaluationApiController) GetInspectionChartData() {
96 155
 				range_value = range_value + "," + item.InspectValue
97 156
 			}
98 157
 		}
158
+
99 159
 	}
100 160
 
101 161
 	data, _ := statistics_service.GetInspectionChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value)
@@ -216,9 +276,16 @@ func (this *IndexEvaluationApiController) GetPatientInspectionBarChartData() {
216 276
 
217 277
 	var range_value string
218 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 290
 	} else {
224 291
 
@@ -230,6 +297,7 @@ func (this *IndexEvaluationApiController) GetPatientInspectionBarChartData() {
230 297
 				range_value = range_value + "," + item.InspectValue
231 298
 			}
232 299
 		}
300
+
233 301
 	}
234 302
 
235 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 View File

@@ -82,10 +82,13 @@ func (this *ManagementAnalyseApiController) StatisticsPatientChart() {
82 82
 	data, total_one, _ := management_service.GetPatientChartData(adminUserInfo.Org.Id, startTime, endTime, statistics_type)
83 83
 	total, _ := management_service.GetLapsetoPatientTotal(adminUserInfo.Org.Id, statistics_type)
84 84
 
85
+	total_three, _ := management_service.GetLapsetoPatientTotal(adminUserInfo.Org.Id, 2)
86
+
85 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 View File

@@ -5,6 +5,7 @@ import (
5 5
 	"XT_New/enums"
6 6
 	"XT_New/service"
7 7
 	"XT_New/utils"
8
+	"encoding/json"
8 9
 	"fmt"
9 10
 	"time"
10 11
 )
@@ -1956,3 +1957,27 @@ func (this *NewCommonApiController) GetSystolicBloodStand() {
1956 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 View File

@@ -40,4 +40,5 @@ func NewCommonApiControllersRegisterRouters() {
40 40
 	beego.Router("/m/api/gettargetnostanddetail", &NewCommonApiController{}, "Get:GetTargetNoStandDetail")
41 41
 	beego.Router("/m/api/gettargestanddetail", &NewCommonApiController{}, "Get:GetTargetStandDetail")
42 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 View File

@@ -296,12 +296,20 @@ func (this *NewLoginApiController) LoginByCs() {
296 296
 			}
297 297
 
298 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 307
 				major, requestErr := service.GetInspectionMajor(org.Id)
300 308
 				if len(major) == 0 {
301 309
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
302 310
 					if len(QualityeList) == 0 {
303 311
 						err = service.BatchInsertQualityControl(org.Id)
304
-						err = service.BathInsertQualityControlTwo(org.Id)
312
+
305 313
 					} else {
306 314
 						utils.ErrorLog("字段批量插入失败0:%v", err)
307 315
 					}

+ 50 - 9
controllers/pc_index_evaluation_api_controller.go View File

@@ -2,6 +2,7 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
+	"XT_New/models"
5 6
 	"XT_New/service/statistics_service"
6 7
 	"XT_New/utils"
7 8
 	"github.com/astaxie/beego"
@@ -51,7 +52,20 @@ type PCIndexEvaluationApiController struct {
51 52
 //初始化数据
52 53
 func (this *PCIndexEvaluationApiController) GetLaboratoryIndexInitData() {
53 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 69
 	this.ServeSuccessJSON(map[string]interface{}{
56 70
 		"references": references,
57 71
 	})
@@ -64,10 +78,19 @@ func (this *PCIndexEvaluationApiController) GetLaboratoryIndexProjectRangeValueD
64 78
 	item_id, _ := this.GetInt64("item_id")
65 79
 	adminUserInfo := this.GetAdminUserInfo()
66 80
 	var range_vaule []string
81
+	var qcs models.InspectionReference
67 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 95
 	} else {
73 96
 
@@ -111,11 +134,21 @@ func (this *PCIndexEvaluationApiController) GetInspectionChartData() {
111 134
 	}
112 135
 
113 136
 	var range_value string
137
+
114 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 150
 	} else {
151
+
119 152
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
120 153
 		for _, item := range inspection {
121 154
 			if len(range_value) == 0 {
@@ -245,10 +278,19 @@ func (this *PCIndexEvaluationApiController) GetPatientInspectionBarChartData() {
245 278
 
246 279
 	var range_value string
247 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 292
 	} else {
293
+
252 294
 		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
253 295
 		for _, item := range inspection {
254 296
 			if len(range_value) == 0 {
@@ -259,7 +301,6 @@ func (this *PCIndexEvaluationApiController) GetPatientInspectionBarChartData() {
259 301
 		}
260 302
 
261 303
 	}
262
-
263 304
 	data, _ := statistics_service.GetPatientInspectionBarChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value, patient_id)
264 305
 	this.ServeSuccessJSON(map[string]interface{}{
265 306
 		"data": data,

+ 32 - 1
controllers/schedule_api_controller.go View File

@@ -547,6 +547,8 @@ func (c *ScheduleApiController) ChangeSchedule() {
547 547
 // @param date:string yyyy-MM-dd 要打印的那一周中的任一天
548 548
 func (this *ScheduleApiController) PrintInitData() {
549 549
 	dateStr := this.GetString("date")
550
+	//week_type, _ := this.GetInt64("type", 0)
551
+
550 552
 	var date *time.Time
551 553
 	if len(dateStr) == 0 {
552 554
 		now := time.Now()
@@ -562,7 +564,21 @@ func (this *ScheduleApiController) PrintInitData() {
562 564
 
563 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 582
 	schedules, getScheduleErr := service.GetPrinitWeekSchedules(adminUserInfo.CurrentOrgId, monday.Unix(), sunday.Unix())
567 583
 	if getScheduleErr != nil {
568 584
 		this.ErrorLog("获取周排班失败:%v", getScheduleErr)
@@ -570,9 +586,24 @@ func (this *ScheduleApiController) PrintInitData() {
570 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 603
 	this.ServeSuccessJSON(map[string]interface{}{
574 604
 		"schedules": schedules,
575 605
 		"monday":    monday.Unix(),
606
+		"days":      days,
576 607
 	})
577 608
 }
578 609
 

+ 8 - 2
controllers/verify_login_controller.go View File

@@ -157,13 +157,19 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
157 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 168
 			major, err := service.GetInspectionMajor(curOrg.Id)
162 169
 			if len(major) == 0 {
163 170
 				QualityeList, err := service.FindQualityByOrgId(curOrg.Id)
164 171
 				if len(QualityeList) == 0 {
165 172
 					err = service.BatchInsertQualityControl(curOrg.Id)
166
-					err = service.BathInsertQualityControlTwo(curOrg.Id)
167 173
 				} else {
168 174
 					utils.ErrorLog("字段批量插入失败:%v", err)
169 175
 				}

+ 8 - 16
models/dialysis.go View File

@@ -274,22 +274,14 @@ func (PredialysisEvaluation) TableName() string {
274 274
 }
275 275
 
276 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 287
 func (PredialysisEvaluationList) TableName() string {

+ 13 - 2
models/patient_models.go View File

@@ -230,11 +230,9 @@ type DialysisPrescriptionList struct {
230 230
 	ID         int64 `gorm:"column:id" json:"id"`
231 231
 	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id"`
232 232
 	PatientId  int64 `gorm:"column:patient_id" json:"patient_id"`
233
-	ModeId     int64 `gorm:"column:mode_id" json:"mode_id"`
234 233
 	RecordDate int64 `gorm:"column:record_date" json:"record_date"`
235 234
 	RecordId   int64 `gorm:"column:record_id" json:"record_id"`
236 235
 	Creater    int64 `gorm:"column:creater" json:"creater"`
237
-	Modifier   int64 `gorm:"column:modifier" json:"modifier"`
238 236
 }
239 237
 
240 238
 func (DialysisPrescriptionList) TableName() string {
@@ -746,6 +744,19 @@ func (XtInspection) TableName() string {
746 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 760
 type XtPatients struct {
750 761
 	ID                           int64   `gorm:"column:id" json:"id" form:"id"`
751 762
 	UserOrgId                    int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 1 - 1
routers/router.go View File

@@ -35,7 +35,7 @@ func init() {
35 35
 	controllers.ScheduleApiRegistRouters()
36 36
 	controllers.SignWeighAPIControllerRegistRouters()
37 37
 	controllers.InvoiceApiRegistRouters()
38
-	controllers.StockApiRegistRouters()
38
+	//controllers.StockApiRegistRouters()
39 39
 	controllers.StockGoodApiRegistRouters()
40 40
 	controllers.StockManagerApiRegistRouters()
41 41
 	controllers.PatientScheduleTemplateAPIControllerRegistRouters()

+ 11 - 5
service/common_service.go View File

@@ -334,7 +334,7 @@ func GetDialysisAgeData(orgID int64) (counts []*models.DialysisAgePieDataStruct,
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 339
 	err = XTReadDB().Where("user_org_id = ? and status =1", orgid).Order("created_time desc").Find(&patients).Error
340 340
 	return patients, err
@@ -2723,10 +2723,10 @@ func UpdateBloodPressure(st *models.XtQualityControlStandard, id int64) error {
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 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 2730
 	return record, total, err
2731 2731
 }
2732 2732
 
@@ -2737,10 +2737,10 @@ func GetStandSystolicBloodPressure(orgid int64, startime int64, endtime int64) (
2737 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 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 2744
 	return record, total, err
2745 2745
 }
2746 2746
 
@@ -3220,3 +3220,9 @@ func GetDiastolicStand(orgid int64, startime int64, endtime int64) (record []*mo
3220 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 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 View File

@@ -12,7 +12,7 @@ import (
12 12
 func GetConfigList(orgID int64) (dataconfig interface{}, err error) {
13 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 16
 	if err != nil {
17 17
 		return nil, err
18 18
 	}
@@ -173,7 +173,13 @@ func FindFiledByOrgId(org_id int64) (filedConfig []*models.FiledConfig, err erro
173 173
 
174 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 183
 	return
178 184
 }
179 185
 

+ 1 - 2
service/dialysis_service.go View File

@@ -608,7 +608,6 @@ func GetDialysisScheduals(orgID int64, scheduleDate int64) ([]*MDialysisSchedule
608 608
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
609 609
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
610 610
 		// Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
611
-		Preload("TreatmentMode", "status = 1").
612 611
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
613 612
 		Preload("AssessmentBeforeDislysis", "status = 1 AND user_org_id = ?", orgID).
614 613
 		Preload("Prescription", "status = 1 AND user_org_id = ?", orgID).
@@ -639,7 +638,7 @@ func GetDialysisWatch(orgID int64, schedulDate int64, schedulType int64, partiti
639 638
 		Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ?", orgID).
640 639
 		Preload("AssessmentAfterDislysis", "status = 1 AND  user_org_id = ?", orgID).
641 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 643
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
645 644
 		Preload("MonitorPatients", "status = 1 AND user_org_id = ?", orgID)

+ 17 - 5
service/management_service/management_analyse_service.go View File

@@ -12,12 +12,13 @@ func GetPatientChartData(user_org_id int64, start_time int64, end_time int64, st
12 12
 	db := service.XTReadDB()
13 13
 	switch statistics_type {
14 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 17
 		break
18 18
 	case 2:
19 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 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 23
 		break
23 24
 	}
@@ -44,14 +45,25 @@ func GetPatientTableData(orgID int64, page, limit, start, end int64, statistics_
44 45
 	var err error
45 46
 	var patients []*PatientTableStruct
46 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 60
 	return patients, total, err
51 61
 }
52 62
 
53 63
 func GetLapsetoPatientTotal(orgID int64, statistics_type int) (Total int64, err error) {
54 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 68
 	return Total, err
57 69
 }

+ 37 - 17
service/mobile_dialysis_service.go View File

@@ -30,12 +30,12 @@ func MobileGetDialysisScheduals(orgID int64, scheduleDate int64, scheduleType in
30 30
 		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
31 31
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
32 32
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
33
-		Preload("TreatmentMode", "status = 1").
34 33
 		Preload("Advices", "status = 1 AND user_org_id = ? AND advice_type = 2", orgID).
35 34
 		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
36 35
 		Preload("AssessmentBeforeDislysis", "status = 1 AND user_org_id = ? AND assessment_date = ? ", orgID, scheduleDate).
37 36
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
38 37
 		Preload("DialysisOrder.DeviceNumber", "status = 1 AND org_id = ?", orgID).
38
+		Preload("TreatmentSummary", "status = 1  AND user_org_id = ?", orgID).
39 39
 		// Preload("DialysisOrder.MonitoringRecords", func(rdb *gorm.DB) *gorm.DB {
40 40
 		// 	return rdb.Where("status = 1 AND user_org_id = ?", orgID).Order("operate_time DESC")
41 41
 		// }).
@@ -59,11 +59,12 @@ func MobileGetWaitingScheduals(orgID int64, scheduleDate int64) ([]*MDialysisSch
59 59
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
60 60
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
61 61
 		// Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).
62
-		Preload("TreatmentMode", "status = 1").
63 62
 		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
64 63
 		Preload("AssessmentBeforeDislysis", "status = 1 AND user_org_id = ? AND assessment_date = ? ", orgID, scheduleDate).
65 64
 		Preload("DialysisOrder", "status = 1 AND user_org_id = ?", orgID).
66 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 68
 		Where("sch.status = 1 AND sch.user_org_id = ?", orgID)
68 69
 	if scheduleDate != 0 {
69 70
 		db = db.Where("schedule_date = ?", scheduleDate)
@@ -73,6 +74,18 @@ func MobileGetWaitingScheduals(orgID int64, scheduleDate int64) ([]*MDialysisSch
73 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 89
 type MDialysisScheduleVM struct {
77 90
 	ID           int64 `gorm:"column:id" json:"id"`
78 91
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id"`
@@ -86,13 +99,11 @@ type MDialysisScheduleVM struct {
86 99
 
87 100
 	SchedualPatient          *MSchedualPatientVMList           `gorm:"ForeignKey:PatientId" json:"patient"`
88 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 102
 	DialysisOrder            *MDialysisOrderVMList             `gorm:"ForeignKey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"dialysis_order"`
92 103
 	Prescription             *models.DialysisPrescriptionList  `gorm:"ForeignKey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"prescription"`
93 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 109
 func (MDialysisScheduleVM) TableName() string {
@@ -239,23 +250,32 @@ type MDialysisOrderVMList struct {
239 250
 	// PrescriptionId int64  `gorm:"column:prescription_id" json:"prescription_id"`
240 251
 	Stage int64 `gorm:"column:stage" json:"stage"`
241 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 260
 func (MDialysisOrderVMList) TableName() string {
256 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 280
 func MobileGetDialysisRecord(orgID int64, patientID int64, recordDate int64) (*models.DialysisOrder, error) {
261 281
 	var record models.DialysisOrder

+ 9 - 2
service/statistics_service/index_evaluation_service.go View File

@@ -1431,9 +1431,9 @@ func FindOrgInspectionReferenceRangeTypeValue(user_org_id int64, project_id int6
1431 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 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 1437
 	return
1438 1438
 }
1439 1439
 
@@ -1448,6 +1448,7 @@ func GetInspectionChartData(user_org_id int64, start_time int64, end_time int64,
1448 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 1450
 	if range_type == 1 {
1451
+
1451 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 1453
 			Select("CASE WHEN inspect_value < " + range_value_arr[0] + " THEN " + "'" + "小于" + range_value_arr[0] + "'" +
1453 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,3 +1770,9 @@ func FindOrgQualityControlStandardInspectionReferenceById(user_org_id int64, pro
1769 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 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 View File

@@ -1186,7 +1186,7 @@ func FindAllGoodTypeByType(types int64) (goodType []*models.GoodsType, err error
1186 1186
 }
1187 1187
 
1188 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 1190
 	return info, err
1191 1191
 
1192 1192
 }

+ 30 - 0
utils/tools.go View File

@@ -229,3 +229,33 @@ func GetMondayAndSundayOfWeekDate(date *time.Time) (time.Time, time.Time) {
229 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 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
+}