张保健 преди 4 месеца
родител
ревизия
e062a6ab57
променени са 32 файла, в които са добавени 904 реда и са изтрити 293 реда
  1. 0 2
      .idea/.gitignore
  2. 0 6
      .idea/misc.xml
  3. 1 1
      .idea/vcs.xml
  4. 2 2
      conf/app.conf
  5. 4 4
      controllers/dialysis_api_controller.go
  6. 4 4
      controllers/dialysis_record_api_controller.go
  7. 3 3
      controllers/mobile_api_controllers/check_weight_api_controller.go
  8. 33 33
      controllers/mobile_api_controllers/dialysis_api_controller.go
  9. 5 5
      controllers/mobile_api_controllers/dialysis_api_controller_extend.go
  10. 2 2
      controllers/mobile_api_controllers/mobile_api_base_controller.go
  11. 1 1
      controllers/mobile_api_controllers/qiniiu_api_controller.go
  12. 2 2
      controllers/new_mobile_api_controllers/forget_password_controller.go
  13. 2 2
      controllers/new_mobile_api_controllers/home_api_controller.go
  14. 2 2
      controllers/new_mobile_api_controllers/mobile_regist_controller.go
  15. 2 2
      controllers/new_mobile_api_controllers/new_dialysis_api_controller.go
  16. 4 4
      controllers/new_mobile_api_controllers/new_login_api_controller.go
  17. 1 1
      controllers/new_mobile_api_controllers/new_role_api_controller.go
  18. 8 8
      controllers/patient_api_controller.go
  19. 1 1
      controllers/qiniiu_api_controller.go
  20. 3 3
      controllers/role_controller.go
  21. 1 1
      controllers/schedule_api_controller.go
  22. 6 6
      controllers/sign_weigh_api_controller.go
  23. 2 2
      controllers/verify_login_controller.go
  24. 473 161
      controllers/xcx_mobile_api_controller.go/xcx_api_controller.go
  25. 36 0
      go.mod
  26. 53 6
      models/dialysis.go
  27. 20 0
      models/schedule_models.go
  28. 82 13
      models/xcx_user_models.go
  29. 10 8
      service/new_sms_service.go
  30. 1 1
      service/redis.go
  31. 3 3
      service/sms_service.go
  32. 137 4
      service/xcx_mobile_api_service.go

+ 0 - 2
.idea/.gitignore Целия файл

@@ -1,2 +0,0 @@
1
-# Default ignored files
2
-/workspace.xml

+ 0 - 6
.idea/misc.xml Целия файл

@@ -1,6 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="JavaScriptSettings">
4
-    <option name="languageLevel" value="ES6" />
5
-  </component>
6
-</project>

+ 1 - 1
.idea/vcs.xml Целия файл

@@ -1,6 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3 3
   <component name="VcsDirectoryMappings">
4
-    <mapping directory="$PROJECT_DIR$" vcs="Git" />
4
+    <mapping directory="" vcs="Git" />
5 5
   </component>
6 6
 </project>

+ 2 - 2
conf/app.conf Целия файл

@@ -1,5 +1,5 @@
1 1
 appname = 小程序
2
-httpport = 9529
2
+httpport = 9539
3 3
 runmode = prod
4 4
 
5 5
 #
@@ -113,7 +113,7 @@ writepatientuser = syh
113 113
 writepatientpass = xhPECP2nFObR8aUK
114 114
 writepatientname = sgj_cdm
115 115
 
116
-redishost = 349e580b2a524290.redis.rds.aliyuncs.com
116
+redishost = kuyi6666.redis.rds.aliyuncs.com
117 117
 redisport = 6379
118 118
 redispasswrod = TZtBW098WId3i27clkpj3q8dnUaVFP
119 119
 redisdb = 0

+ 4 - 4
controllers/dialysis_api_controller.go Целия файл

@@ -1348,7 +1348,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1348 1348
 	remark := c.GetString("remark")
1349 1349
 	puncture_method := c.GetString("puncture_method")
1350 1350
 
1351
-	dialysis_count:= c.GetString("dialysis_count")
1351
+	dialysis_count := c.GetString("dialysis_count")
1352 1352
 	emergency_treatment, _ := c.GetInt64("emergency_treatment", 0)
1353 1353
 	emergency_treatment_other := c.GetString("emergency_treatment_other")
1354 1354
 	ductus_arantii := c.GetString("ductus_arantii")
@@ -2159,7 +2159,7 @@ func (c *DialysisApiController) CreateMonitor() {
2159 2159
 	operate_time, _ := c.GetInt64("operate_time", 0)
2160 2160
 	// monitoring_time := c.GetString("monitoring_time")
2161 2161
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
2162
-	breathing_rated, _ := c.GetFloat("breathing_rated", 0)
2162
+	// breathing_rated, _ := c.GetFloat("breathing_rated", 0)
2163 2163
 	systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0)
2164 2164
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
2165 2165
 	blood_pressure_type, _ := c.GetInt64("blood_pressure_type", 0)
@@ -2213,8 +2213,8 @@ func (c *DialysisApiController) CreateMonitor() {
2213 2213
 		DialysisOrderId: dialysis_order_id,
2214 2214
 		OperateTime:     operate_time,
2215 2215
 		// MonitoringTime:            monitoring_time,
2216
-		PulseFrequency:            pulse_frequency,
2217
-		BreathingRate:             breathing_rated,
2216
+		PulseFrequency: pulse_frequency,
2217
+		// BreathingRate:             breathing_rated,
2218 2218
 		SystolicBloodPressure:     systolic_blood_pressure,
2219 2219
 		DiastolicBloodPressure:    diastolic_blood_pressure,
2220 2220
 		BloodPressureType:         blood_pressure_type,

+ 4 - 4
controllers/dialysis_record_api_controller.go Целия файл

@@ -436,8 +436,8 @@ func (this *DialysisRecordAPIController) EditMonitor() {
436 436
 			MonitoringDate:  monitorParam.MonitoringDate,
437 437
 			OperateTime:     monitorParam.OperateTime,
438 438
 			// MonitoringTime:         monitorParam.MonitoringTime,
439
-			PulseFrequency:              monitorParam.PulseFrequency,
440
-			BreathingRate:               monitorParam.BreathingRated,
439
+			PulseFrequency: monitorParam.PulseFrequency,
440
+			// BreathingRate:               monitorParam.BreathingRated,
441 441
 			SystolicBloodPressure:       monitorParam.SystolicBP,
442 442
 			DiastolicBloodPressure:      monitorParam.DiastolicBP,
443 443
 			BloodFlowVolume:             monitorParam.BloodFlowVolume,
@@ -514,7 +514,7 @@ func (this *DialysisRecordAPIController) EditMonitor() {
514 514
 
515 515
 		monitor.OperateTime = monitorParam.OperateTime
516 516
 		monitor.PulseFrequency = monitorParam.PulseFrequency
517
-		monitor.BreathingRate = monitorParam.BreathingRated
517
+		// monitor.BreathingRate = monitorParam.BreathingRated
518 518
 		monitor.SystolicBloodPressure = monitorParam.SystolicBP
519 519
 		monitor.DiastolicBloodPressure = monitorParam.DiastolicBP
520 520
 		monitor.BloodFlowVolume = monitorParam.BloodFlowVolume
@@ -978,7 +978,7 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
978 978
 	if fmonitorRecords.ID > 0 && endmonitorRecords.ID > 0 {
979 979
 		tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
980 980
 		tempassessmentAfterDislysis.PulseFrequency = endmonitorRecords.PulseFrequency
981
-		tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
981
+		// tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
982 982
 		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
983 983
 		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
984 984
 		if adminUserInfo.CurrentOrgId == 10101 {

+ 3 - 3
controllers/mobile_api_controllers/check_weight_api_controller.go Целия файл

@@ -717,7 +717,7 @@ func (c *CheckWeightApiController) SetSyncTime() {
717 717
 	if len(sn) > 0 {
718 718
 		redis := service.RedisClient()
719 719
 		defer redis.Close()
720
-		redis.Set(redis.Context(),sn, 0, 0)
720
+		redis.Set(sn, 0, 0)
721 721
 	}
722 722
 	serviceTime := time.Now().Unix()
723 723
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -734,13 +734,13 @@ func (c *CheckWeightApiController) GetPatientList() {
734 734
 	redis := service.RedisClient()
735 735
 	defer redis.Close()
736 736
 	if len(sn) > 0 {
737
-		syncTimeStr, _ := redis.Get(redis.Context(),sn).Result()
737
+		syncTimeStr, _ := redis.Get(sn).Result()
738 738
 		syncTime, _ = strconv.ParseInt(syncTimeStr, 10, 64)
739 739
 	}
740 740
 
741 741
 	if ftype == 1 {
742 742
 		timeNow := time.Now().Unix()
743
-		redis.Set(redis.Context(),sn, timeNow, 0)
743
+		redis.Set(sn, timeNow, 0)
744 744
 	}
745 745
 
746 746
 	adminUserInfo := c.GetMobileAdminUserInfo()

+ 33 - 33
controllers/mobile_api_controllers/dialysis_api_controller.go Целия файл

@@ -88,7 +88,7 @@ func (this *DialysisAPIController) Scheduals() {
88 88
 
89 89
 	// cur_date := time.Now().Format("2006-01-02")
90 90
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
91
-	scheduals_json_str, _ := redis.Get(redis.Context(),key).Result()
91
+	scheduals_json_str, _ := redis.Get(key).Result()
92 92
 
93 93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
94 94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
@@ -102,7 +102,7 @@ func (this *DialysisAPIController) Scheduals() {
102 102
 				//缓存数据
103 103
 				scheduals_json, err := json.Marshal(scheduals)
104 104
 				if err == nil {
105
-					redis.Set(redis.Context(),key, scheduals_json, time.Second*60)
105
+					redis.Set(key, scheduals_json, time.Second*60)
106 106
 				}
107 107
 			}
108 108
 
@@ -148,7 +148,7 @@ func (this *DialysisAPIController) WaitingScheduals() {
148 148
 	// cur_date := time.Now().Format("2006-01-02")
149 149
 	key := "wait_scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
150 150
 
151
-	wait_scheduals, _ := redis.Get(redis.Context(),key).Result()
151
+	wait_scheduals, _ := redis.Get(key).Result()
152 152
 
153 153
 	if len(wait_scheduals) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
154 154
 		scheduals, err := service.MobileGetWaitingScheduals(orgID, date.Unix())
@@ -165,7 +165,7 @@ func (this *DialysisAPIController) WaitingScheduals() {
165 165
 				//缓存数据
166 166
 				wait_scheduals_json, err := json.Marshal(scheduals)
167 167
 				if err == nil {
168
-					redis.Set(redis.Context(),key, wait_scheduals_json, time.Second*30)
168
+					redis.Set(key, wait_scheduals_json, time.Second*30)
169 169
 				}
170 170
 			}
171 171
 
@@ -795,7 +795,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
795 795
 	weightReduce, _ := c.GetFloat("weight_loss", 0)
796 796
 	temperature, _ := c.GetFloat("temperature", 0)
797 797
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
798
-	breathing_rate, _ := c.GetFloat("breathing_rate", 0)
798
+	// breathing_rate, _ := c.GetFloat("breathing_rate", 0)
799 799
 	systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0)
800 800
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
801 801
 	actual_ultrafiltration, _ := c.GetFloat("actual_ultrafiltration", 0)
@@ -808,7 +808,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
808 808
 	catheter := c.GetString("catheter")
809 809
 	complications := c.GetString("complication")
810 810
 	remark := c.GetString("remark")
811
-	dialysateVolume, _ := c.GetInt64("dialysis_intakes", 0)
811
+	//dialysateVolume, _ := c.GetInt64("dialysis_intakes", 0)
812 812
 
813 813
 	dialysis_intakes_unit, _ := c.GetInt64("dialysis_intakes_unit", 0)
814 814
 
@@ -893,27 +893,27 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
893 893
 	//_, evaluation := service.FindPredialysisEvaluationByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
894 894
 
895 895
 	assessmentAfterDislysis := models.AssessmentAfterDislysis{
896
-		UserOrgId:                    adminUserInfo.Org.Id,
897
-		PatientId:                    id,
898
-		AssessmentDate:               recordDate.Unix(),
899
-		Temperature:                  temperature,
900
-		PulseFrequency:               pulse_frequency,
901
-		BreathingRate:                breathing_rate,
902
-		SystolicBloodPressure:        systolic_blood_pressure,
903
-		DiastolicBloodPressure:       diastolic_blood_pressure,
904
-		ActualUltrafiltration:        actual_ultrafiltration,
905
-		ActualDisplacement:           actual_displacement,
906
-		ActualTreatmentHour:          actualtreatHour,
907
-		ActualTreatmentMinute:        actualtreatmin,
908
-		WeightAfter:                  weightAfter,
909
-		AdditionalWeight:             additionalWeight,
910
-		WeightLoss:                   weightReduce,
911
-		Cruor:                        cruor,
912
-		SymptomAfterDialysis:         symptomsAfterDialysi,
913
-		InternalFistula:              internalFistula,
914
-		Catheter:                     catheter,
915
-		Complication:                 complications,
916
-		DialysisIntakes:              dialysateVolume,
896
+		UserOrgId:      adminUserInfo.Org.Id,
897
+		PatientId:      id,
898
+		AssessmentDate: recordDate.Unix(),
899
+		Temperature:    temperature,
900
+		PulseFrequency: pulse_frequency,
901
+		// BreathingRate:          breathing_rate,
902
+		SystolicBloodPressure:  systolic_blood_pressure,
903
+		DiastolicBloodPressure: diastolic_blood_pressure,
904
+		ActualUltrafiltration:  actual_ultrafiltration,
905
+		ActualDisplacement:     actual_displacement,
906
+		ActualTreatmentHour:    actualtreatHour,
907
+		ActualTreatmentMinute:  actualtreatmin,
908
+		WeightAfter:            weightAfter,
909
+		AdditionalWeight:       additionalWeight,
910
+		WeightLoss:             weightReduce,
911
+		Cruor:                  cruor,
912
+		SymptomAfterDialysis:   symptomsAfterDialysi,
913
+		InternalFistula:        internalFistula,
914
+		Catheter:               catheter,
915
+		Complication:           complications,
916
+		//DialysisIntakes:              dialysateVolume,
917 917
 		CreatedTime:                  time.Now().Unix(),
918 918
 		Status:                       1,
919 919
 		Remark:                       remark,
@@ -1486,7 +1486,7 @@ func (c *DialysisAPIController) Finish() {
1486 1486
 
1487 1487
 		tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
1488 1488
 		tempassessmentAfterDislysis.PulseFrequency = endmonitorRecords.PulseFrequency
1489
-		tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
1489
+		// tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
1490 1490
 		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
1491 1491
 		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
1492 1492
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
@@ -1943,7 +1943,7 @@ func (this *DialysisAPIController) StartDialysis() {
1943 1943
 		if errcode == nil {
1944 1944
 			record.SystolicBloodPressure = befor.SystolicBloodPressure
1945 1945
 			record.DiastolicBloodPressure = befor.DiastolicBloodPressure
1946
-			record.BreathingRate = befor.BreathingRate
1946
+			// record.BreathingRate = befor.BreathingRate
1947 1947
 			record.PulseFrequency = befor.PulseFrequency
1948 1948
 			record.Temperature = befor.Temperature
1949 1949
 		}
@@ -3293,7 +3293,7 @@ func (this *DialysisAPIController) GetDialysisSchedule() {
3293 3293
 		//缓存数据
3294 3294
 		scheduals_json, err := json.Marshal(scheduals)
3295 3295
 		if err == nil {
3296
-			redis.Set(redis.Context(),key, scheduals_json, time.Second*30)
3296
+			redis.Set(key, scheduals_json, time.Second*30)
3297 3297
 		}
3298 3298
 	}
3299 3299
 	this.ServeSuccessJSON(map[string]interface{}{
@@ -4550,7 +4550,7 @@ func (c *DialysisAPIController) UpdateStockGoods() {
4550 4550
 	return
4551 4551
 }
4552 4552
 
4553
-//当前数据比上一次出库数据少
4553
+// 当前数据比上一次出库数据少
4554 4554
 func ConsumablesDeliveryTotalSeven(orgID int64, patient_id int64, record_time int64, goods []*models.DialysisBeforePrepareGoods, creater int64, count int64) (err error) {
4555 4555
 
4556 4556
 	fmt.Println("w我的中国馆公共区发电房阿道夫安抚安抚安抚安抚安抚安抚阿道夫阿道夫阿凡达阿道夫a", count)
@@ -4605,7 +4605,7 @@ func ConsumablesDeliveryTotalSeven(orgID int64, patient_id int64, record_time in
4605 4605
 	return nil
4606 4606
 }
4607 4607
 
4608
-//耗材出库删除
4608
+// 耗材出库删除
4609 4609
 func ConsumablesDeliveryDeleteFour(orgID int64, record_time int64, good_yc *models.BloodAutomaticReduceDetail, warehouseOut *models.WarehouseOut, patient_id int64, creater int64, count int64) (err error) {
4610 4610
 
4611 4611
 	fmt.Println("count2323223884584854854854u5454785487547845785478758487545475475487,count", count)
@@ -4929,7 +4929,7 @@ func ConsumablesDeliveryTotalSix(orgID int64, patient_id int64, record_time int6
4929 4929
 	return nil
4930 4930
 }
4931 4931
 
4932
-//耗材出库删除
4932
+// 耗材出库删除
4933 4933
 func ConsumablesDeliveryDeleteThree(orgID int64, record_time int64, good_yc *models.BloodAutomaticReduceDetail, warehouseOut *models.WarehouseOut) (err error) {
4934 4934
 	// 先根据相关信息查询当天该耗材的出库信息
4935 4935
 	warehouseOutInfos, err := service.FindStockOutInfoByStockOne(orgID, good_yc.GoodTypeId, good_yc.GoodId, record_time)

+ 5 - 5
controllers/mobile_api_controllers/dialysis_api_controller_extend.go Целия файл

@@ -61,7 +61,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
61 61
 	fmt.Println(operateTime)
62 62
 
63 63
 	pulseFrequency, _ := this.GetFloat("pulse_frequency")
64
-	breathingRated, _ := this.GetFloat("breathing_rated")
64
+	// breathingRated, _ := this.GetFloat("breathing_rated")
65 65
 	systolicBP, _ := this.GetFloat("systolic_bp")
66 66
 	diastolicBP, _ := this.GetFloat("diastolic_bp")
67 67
 	BPType, _ := this.GetInt("bp_type")
@@ -119,8 +119,8 @@ func (this *DialysisAPIController) AddMonitorRecord() {
119 119
 		MonitoringDate:  date,
120 120
 		OperateTime:     operateTime,
121 121
 		// MonitoringTime:            recordTime,
122
-		PulseFrequency:              pulseFrequency,
123
-		BreathingRate:               breathingRated,
122
+		PulseFrequency: pulseFrequency,
123
+		// BreathingRate:               breathingRated,
124 124
 		SystolicBloodPressure:       systolicBP,
125 125
 		DiastolicBloodPressure:      diastolicBP,
126 126
 		BloodPressureType:           int64(BPType),
@@ -227,7 +227,7 @@ func (this *DialysisAPIController) EditMonitorRecord() {
227 227
 		operateTime = 0
228 228
 	}
229 229
 	pulseFrequency, _ := this.GetFloat("pulse_frequency")
230
-	breathingRated, _ := this.GetFloat("breathing_rated")
230
+	// breathingRated, _ := this.GetFloat("breathing_rated")
231 231
 	systolicBP, _ := this.GetFloat("systolic_bp")
232 232
 	diastolicBP, _ := this.GetFloat("diastolic_bp")
233 233
 	BPType, _ := this.GetInt("bp_type")
@@ -282,7 +282,7 @@ func (this *DialysisAPIController) EditMonitorRecord() {
282 282
 	monitor.MonitoringDate = date
283 283
 	monitor.OperateTime = operateTime
284 284
 	monitor.PulseFrequency = pulseFrequency
285
-	monitor.BreathingRate = breathingRated
285
+	// monitor.BreathingRate = breathingRated
286 286
 	monitor.SystolicBloodPressure = systolicBP
287 287
 	monitor.DiastolicBloodPressure = diastolicBP
288 288
 	monitor.BloodPressureType = int64(BPType)

+ 2 - 2
controllers/mobile_api_controllers/mobile_api_base_controller.go Целия файл

@@ -125,7 +125,7 @@ func (this *MobileBaseAPIAuthController) Prepare() {
125 125
 
126 126
 			//redis key值
127 127
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
128
-			purviews_json_str, _ := redis.Get(redis.Context(),key).Result()
128
+			purviews_json_str, _ := redis.Get(key).Result()
129 129
 			//获取该用户下所有角色的权限总集
130 130
 			var userRolePurviews string
131 131
 			var userRolePurviewsArr []string
@@ -149,7 +149,7 @@ func (this *MobileBaseAPIAuthController) Prepare() {
149 149
 				//缓存数据
150 150
 				purview_json, err := json.Marshal(userRolePurviewsArr)
151 151
 				if err == nil {
152
-					redis.Set(redis.Context(),key, purview_json, time.Minute*60*60*24)
152
+					redis.Set(key, purview_json, time.Minute*60*60*24)
153 153
 				}
154 154
 			} else {
155 155
 				var dat []string

+ 1 - 1
controllers/mobile_api_controllers/qiniiu_api_controller.go Целия файл

@@ -14,7 +14,7 @@ func (c *QiNiuApiController) GetQNUpToken() {
14 14
 	redisClient := service.RedisClient()
15 15
 	defer redisClient.Close()
16 16
 
17
-	token, err := redisClient.Get(redisClient.Context(),"qn_token").Result()
17
+	token, err := redisClient.Get("qn_token").Result()
18 18
 	if err != nil {
19 19
 		defer fmt.Println(err)
20 20
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)

+ 2 - 2
controllers/new_mobile_api_controllers/forget_password_controller.go Целия файл

@@ -40,7 +40,7 @@ func (this *ForgetPwdController) ModifyPassword() {
40 40
 		// 修改成功后验证码就要使其失效
41 41
 		redisClient := service.RedisClient()
42 42
 		defer redisClient.Close()
43
-		redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
43
+		redisClient.Del("code_msg_" + mobile)
44 44
 
45 45
 		ip := utils.GetIP(this.Ctx.Request)
46 46
 		ssoDomain := beego.AppConfig.String("sso_domain")
@@ -252,7 +252,7 @@ func (this *ForgetPwdController) checkParams(mobile string, code string, passwor
252 252
 	}
253 253
 	redisClient := service.RedisClient()
254 254
 	defer redisClient.Close()
255
-	cache_code, _ := redisClient.Get(redisClient.Context(),"code_msg_" + mobile).Result()
255
+	cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
256 256
 	if cache_code != code {
257 257
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
258 258
 	}

+ 2 - 2
controllers/new_mobile_api_controllers/home_api_controller.go Целия файл

@@ -634,7 +634,7 @@ func (this *HomeController) ModifyPsw() {
634 634
 		// 修改成功后验证码就要使其失效
635 635
 		redisClient := service.RedisClient()
636 636
 		defer redisClient.Close()
637
-		redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
637
+		redisClient.Del("code_msg_" + mobile)
638 638
 		this.ServeSuccessJSON(map[string]interface{}{
639 639
 			"admin": adminUser,
640 640
 		})
@@ -657,7 +657,7 @@ func (this *HomeController) checkParam(mobile string, code string, password stri
657 657
 	}
658 658
 	redisClient := service.RedisClient()
659 659
 	defer redisClient.Close()
660
-	cache_code, _ := redisClient.Get(redisClient.Context(),"code_msg_" + mobile).Result()
660
+	cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
661 661
 	if cache_code != code {
662 662
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
663 663
 	}

+ 2 - 2
controllers/new_mobile_api_controllers/mobile_regist_controller.go Целия файл

@@ -74,7 +74,7 @@ func (this *MobileRegistController) RegistSubmit() {
74 74
 
75 75
 		redisClient := service.RedisClient()
76 76
 		defer redisClient.Close()
77
-		cache_code, _ := redisClient.Get(redisClient.Context(),"code_msg_" + mobile).Result()
77
+		cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
78 78
 		if cache_code != code {
79 79
 			//this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
80 80
 			//this.ServeJSON()
@@ -90,7 +90,7 @@ func (this *MobileRegistController) RegistSubmit() {
90 90
 			this.Ctx.SetCookie("mobile", mobile)
91 91
 			this.SetSession("mobile_admin_user", admin)
92 92
 			// 注册成功后验证码就要使其失效
93
-			redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
93
+			redisClient.Del("code_msg_" + mobile)
94 94
 
95 95
 			this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
96 96
 				"result": true,

+ 2 - 2
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Целия файл

@@ -20,9 +20,9 @@ func (this *NewDialysisApiController) GetCodeInit() {
20 20
 	req := this.Ctx.Request
21 21
 	addr := utils.GetIP(req)
22 22
 	cur_time := time.Now().Format("2006-01-02")
23
-	_, err := redisClient.Get(redisClient.Context(),"ip:host_" + cur_time + "_" + addr).Result()
23
+	_, err := redisClient.Get("ip:host_" + cur_time + "_" + addr).Result()
24 24
 	if err != nil {
25
-		redisClient.Set(redisClient.Context(),"ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
25
+		redisClient.Set("ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
26 26
 	}
27 27
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
28 28
 	aespass := utils.AESEncrypt(addr)

+ 4 - 4
controllers/new_mobile_api_controllers/new_login_api_controller.go Целия файл

@@ -136,9 +136,9 @@ func (this *NewLoginApiController) GetCodeInit() {
136 136
 	req := this.Ctx.Request
137 137
 	addr := utils.GetIP(req)
138 138
 	cur_time := time.Now().Format("2006-01-02")
139
-	_, err := redisClient.Get(redisClient.Context(),"ip:host_" + cur_time + "_" + addr).Result()
139
+	_, err := redisClient.Get("ip:host_" + cur_time + "_" + addr).Result()
140 140
 	if err != nil {
141
-		redisClient.Set(redisClient.Context(),"ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
141
+		redisClient.Set("ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
142 142
 	}
143 143
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
144 144
 	aespass := utils.AESEncrypt(addr)
@@ -378,7 +378,7 @@ func (this *NewLoginApiController) LoginByCs() {
378 378
 
379 379
 		redisClient := service.RedisClient()
380 380
 		defer redisClient.Close()
381
-		cachedCode, err := redisClient.Get(redisClient.Context(),"code_msg_" + mobile).Result()
381
+		cachedCode, err := redisClient.Get("code_msg_" + mobile).Result()
382 382
 
383 383
 		if err != nil {
384 384
 			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
@@ -486,7 +486,7 @@ func (this *NewLoginApiController) LoginByCs() {
486 486
 						TemplateInfo: &templateInfo,
487 487
 					}
488 488
 					this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
489
-					redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
489
+					redisClient.Del("code_msg_" + mobile)
490 490
 
491 491
 					mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
492 492
 					token := utils.GenerateLoginToken(mobile)

+ 1 - 1
controllers/new_mobile_api_controllers/new_role_api_controller.go Целия файл

@@ -568,7 +568,7 @@ func (this *NewRoleApiController) EditFunctionPermission() {
568 568
 	users := service.GetAllUserRole(adminUser.Org.Id)
569 569
 	for _, item := range users {
570 570
 		key := "purviews_" + strconv.FormatInt(adminUser.Org.Id, 10) + strconv.FormatInt(item.AdminUserId, 10)
571
-		redis.Set(redis.Context(),key, "", time.Second)
571
+		redis.Set(key, "", time.Second)
572 572
 	}
573 573
 
574 574
 	if err != nil {

+ 8 - 8
controllers/patient_api_controller.go Целия файл

@@ -76,7 +76,7 @@ func PatientApiRegistRouters() {
76 76
 
77 77
 }
78 78
 
79
-//GetPatientsList 取患者列表
79
+// GetPatientsList 取患者列表
80 80
 func (c *PatientApiController) GetPatientsList() {
81 81
 	page, _ := c.GetInt64("page", 1)
82 82
 	limit, _ := c.GetInt64("limit", 10)
@@ -138,7 +138,7 @@ func (c *PatientApiController) GetPatientsList() {
138 138
 
139 139
 }
140 140
 
141
-//GetPatientTotal
141
+// GetPatientTotal
142 142
 func (c *PatientApiController) GetPatientTotal() {
143 143
 	adminUserInfo := c.GetAdminUserInfo()
144 144
 
@@ -163,7 +163,7 @@ func (c *PatientApiController) GetPatientsAllList() {
163 163
 	return
164 164
 }
165 165
 
166
-//GenerateDialysisNo 生成透析号
166
+// GenerateDialysisNo 生成透析号
167 167
 func (c *PatientApiController) GenerateDialysisNo() {
168 168
 	adminUserInfo := c.GetAdminUserInfo()
169 169
 
@@ -187,7 +187,7 @@ func (c *PatientApiController) GenerateDialysisNo() {
187 187
 	return
188 188
 }
189 189
 
190
-//CreatePatient 创建患者
190
+// CreatePatient 创建患者
191 191
 func (c *PatientApiController) CreatePatient() {
192 192
 	record_date := c.GetString("record_date")
193 193
 	is_infectious, _ := c.GetInt64("is_infectious")
@@ -413,7 +413,7 @@ func (c *PatientApiController) CreatePatient() {
413 413
 
414 414
 	redis := service.RedisClient()
415 415
 	defer redis.Close()
416
-	redis.SAdd(redis.Context(),"sgj_patient:new_user_set", patient.UserId)
416
+	redis.SAdd("sgj_patient:new_user_set", patient.UserId)
417 417
 
418 418
 	c.ServeSuccessJSON(map[string]interface{}{
419 419
 		"msg": "ok",
@@ -421,7 +421,7 @@ func (c *PatientApiController) CreatePatient() {
421 421
 	return
422 422
 }
423 423
 
424
-//EditPatient 修改
424
+// EditPatient 修改
425 425
 func (c *PatientApiController) EditPatient() {
426 426
 	id, _ := c.GetInt64("id", 0)
427 427
 
@@ -985,7 +985,7 @@ func (c *PatientApiController) DeleteDialysisSolution() {
985 985
 	return
986 986
 }
987 987
 
988
-//GetDryWeights 取患者干体重调整铺
988
+// GetDryWeights 取患者干体重调整铺
989 989
 func (c *PatientApiController) GetDryWeights() {
990 990
 	page, _ := c.GetInt64("page", 1)
991 991
 	limit, _ := c.GetInt64("limit", 10)
@@ -2450,7 +2450,7 @@ func (c *PatientApiController) DeleteGroupAdvice() {
2450 2450
 	return
2451 2451
 }
2452 2452
 
2453
-//GetDoctorAdvices 医嘱列表
2453
+// GetDoctorAdvices 医嘱列表
2454 2454
 func (c *PatientApiController) GetDoctorAdvices() {
2455 2455
 	id, _ := c.GetInt64("id", 0)
2456 2456
 	adviceType, _ := c.GetInt64("advice_type", 0)

+ 1 - 1
controllers/qiniiu_api_controller.go Целия файл

@@ -21,7 +21,7 @@ func (c *QiNiuApiController) GetQNUpToken() {
21 21
 	redisClient := service.RedisClient()
22 22
 	defer redisClient.Close()
23 23
 
24
-	token, err := redisClient.Get(redisClient.Context(),"qn_token").Result()
24
+	token, err := redisClient.Get("qn_token").Result()
25 25
 	fmt.Print("token------------------------------------", token)
26 26
 	if err != nil {
27 27
 		defer fmt.Println(err)

+ 3 - 3
controllers/role_controller.go Целия файл

@@ -750,7 +750,7 @@ func (this *RoleAPIController) EditPurview() {
750 750
 	users := service.GetAllUserRole(adminUserInfo.CurrentOrgId)
751 751
 	for _, item := range users {
752 752
 		key := "purviews_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + strconv.FormatInt(item.AdminUserId, 10)
753
-		redis.Set(redis.Context(),key, "", time.Second)
753
+		redis.Set(key, "", time.Second)
754 754
 	}
755 755
 
756 756
 	err := service.SaveRolePurviewIds(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, roleId, purviewIds)
@@ -898,7 +898,7 @@ func (this *RoleAPIController) AddAdminInitData() {
898 898
 
899 899
 	redisClient := service.RedisClient()
900 900
 	defer redisClient.Close()
901
-	qntoken, _ := redisClient.Get(redisClient.Context(),"qn_token").Result()
901
+	qntoken, _ := redisClient.Get("qn_token").Result()
902 902
 
903 903
 	this.ServeSuccessJSON(map[string]interface{}{
904 904
 		"roles":           roles,
@@ -1108,7 +1108,7 @@ func (this *RoleAPIController) EditAdminInitData() {
1108 1108
 
1109 1109
 	redisClient := service.RedisClient()
1110 1110
 	defer redisClient.Close()
1111
-	qntoken, _ := redisClient.Get(redisClient.Context(),"qn_token").Result()
1111
+	qntoken, _ := redisClient.Get("qn_token").Result()
1112 1112
 
1113 1113
 	this.ServeSuccessJSON(map[string]interface{}{
1114 1114
 		"admin":           appRole,

+ 1 - 1
controllers/schedule_api_controller.go Целия файл

@@ -370,7 +370,7 @@ func (c *ScheduleApiController) CreateSchedule() {
370 370
 	err = service.CreateSchedule(&schedule)
371 371
 
372 372
 	key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
373
-	redis.Set(redis.Context(),key, "", time.Second)
373
+	redis.Set(key, "", time.Second)
374 374
 
375 375
 	fmt.Println(err)
376 376
 	if err != nil {

+ 6 - 6
controllers/sign_weigh_api_controller.go Целия файл

@@ -383,16 +383,16 @@ func (c *SignWeighAPIController) EditData() {
383 383
 	dry_weight, _ := c.GetFloat("dry_weight", 0)
384 384
 	temperature, _ := c.GetFloat("temperature", 0)
385 385
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
386
-	breathing_rate, _ := c.GetFloat("breathing_rate", 0)
386
+	// breathing_rate, _ := c.GetFloat("breathing_rate", 0)
387 387
 	systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0)
388 388
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
389 389
 
390 390
 	assessmentafterdislysis := &models.AssessmentAfterDislysis{
391
-		WeightAfter:            weight_after,
392
-		DryWeight:              dry_weight,
393
-		Temperature:            temperature,
394
-		PulseFrequency:         pulse_frequency,
395
-		BreathingRate:          breathing_rate,
391
+		WeightAfter:    weight_after,
392
+		DryWeight:      dry_weight,
393
+		Temperature:    temperature,
394
+		PulseFrequency: pulse_frequency,
395
+		// BreathingRate:          breathing_rate,
396 396
 		SystolicBloodPressure:  systolic_blood_pressure,
397 397
 		DiastolicBloodPressure: diastolic_blood_pressure,
398 398
 	}

+ 2 - 2
controllers/verify_login_controller.go Целия файл

@@ -408,7 +408,7 @@ func (this *PersonAPIController) ModifyPwd() {
408 408
 
409 409
 	redisClient := service.RedisClient()
410 410
 	defer redisClient.Close()
411
-	cachedCode, err := redisClient.Get(redisClient.Context(),"xt_modify_pwd_" + mobile).Result()
411
+	cachedCode, err := redisClient.Get("xt_modify_pwd_" + mobile).Result()
412 412
 	if err != nil {
413 413
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
414 414
 		return
@@ -425,7 +425,7 @@ func (this *PersonAPIController) ModifyPwd() {
425 425
 	}
426 426
 
427 427
 	// 清除验证码
428
-	redisClient.Del(redisClient.Context(),"xt_modify_pwd_" + mobile)
428
+	redisClient.Del("xt_modify_pwd_" + mobile)
429 429
 	this.ServeSuccessJSON(map[string]interface{}{
430 430
 		"msg": "密码已修改",
431 431
 	})

+ 473 - 161
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go Целия файл

@@ -9,6 +9,7 @@ import (
9 9
 	"fmt"
10 10
 	"github.com/astaxie/beego"
11 11
 	"github.com/jinzhu/gorm"
12
+	"github.com/shopspring/decimal"
12 13
 	"strconv"
13 14
 	"time"
14 15
 )
@@ -17,24 +18,36 @@ func XcxApiControllersRegisterRouters() {
17 18
 	////传送codeinit
18 19
 	beego.Router("/xcx/m/api/code", &XcxApiController{}, "Get:GetCodeInit")
19 20
 	//获取验证码
20
-	beego.Router("/xcx/api/mobile/code", &XcxApiController{}, "Get:GetCodeInfo")
21
+	beego.Router("/xcx/api/mobile/code", &XcxApiController{}, "Post:GetCodeInfo")
21 22
 	//用户绑定
22 23
 	beego.Router("/xcx/api/mobile/register", &XcxApiController{}, "Get:GetUserNameRegister")
23
-	//登录
24
+	//手机号登录
24 25
 	beego.Router("/xcx/api/mobile/login", &XcxApiController{}, "Get:GetLoginInfor")
25 26
 
27
+	//openid登录
28
+	beego.Router("/xcx/api/openid/login", &XcxApiController{}, "Get:GetLoginInfoByOpenid")
29
+
26 30
 	//获取二维码信息
27 31
 	beego.Router("/xcx/api/mobile/patient", &XcxApiController{}, "Get:GetPatientList")
28 32
 
29 33
 	//获取登录后的信息
30 34
 	beego.Router("/xcx/api/mobile/getdatainfo", &XcxApiController{}, "Get:GetDataInfo")
31 35
 
36
+	//获取排班数据
37
+	beego.Router("/xcx/api/mobile/schedulebyweek", &XcxApiController{}, "Post:GetSchedulesByWeek")
38
+
32 39
 	//获取排班数据
33 40
 	beego.Router("/xcx/api/mobile/schedule", &XcxApiController{}, "Get:GetScheduleInfo")
34 41
 
35 42
 	//获取透析记录
36 43
 	beego.Router("/xcx/api/mobile/dialysis", &XcxApiController{}, "Get:GetMobileSchedule")
37 44
 
45
+	//获取体重纪录
46
+	beego.Router("/xcx/api/mobile/signweight", &XcxApiController{}, "Get:GetSignsByWeight")
47
+
48
+	//获取血压纪录
49
+	beego.Router("/xcx/api/mobile/signblood", &XcxApiController{}, "Get:GetSignsByBlood")
50
+
38 51
 	//获取患者的电子病历
39 52
 	beego.Router("/xcx/api/mobile/getpatientinfo", &XcxApiController{}, "Get:GetPatientInfo")
40 53
 
@@ -56,9 +69,12 @@ func XcxApiControllersRegisterRouters() {
56 69
 	//获取数据字典数据
57 70
 	beego.Router("/xcx/api/mobile/getdataconfig", &XcxApiController{}, "Get:GetDataConfig")
58 71
 
59
-	//检验检查
72
+	//检验检查列表
60 73
 	beego.Router("/xcx/api/mobile/getinspectionlist", &XcxApiController{}, "Get:GetInspectionList")
61 74
 
75
+	//检验检查详情
76
+	beego.Router("/xcx/api/mobile/getinspectioninfo", &XcxApiController{}, "Get:GetInspectionInfo")
77
+
62 78
 	//肾有杯
63 79
 	beego.Router("/xcx/api/mobile/getarticlist", &XcxApiController{}, "Get:GetArticList")
64 80
 
@@ -68,26 +84,108 @@ func XcxApiControllersRegisterRouters() {
68 84
 
69 85
 	//获取appid
70 86
 	beego.Router("/xcx/api/mobile/getappid", &XcxApiController{}, "Get:GetAppId")
87
+
88
+	// 获取充值当前余额信息
89
+	beego.Router("/xcx/api/mobile/getbalance", &XcxApiController{}, "Get:IdToBalance")
90
+
91
+	// 获取一段时间内
92
+	beego.Router("/xcx/api/mobile/getbalanceinfo", &XcxApiController{}, "Get:DepositFlow")
71 93
 }
72 94
 
73 95
 type XcxApiController struct {
74 96
 	mobile_api_controllers.MobileBaseAPIController
75 97
 }
76 98
 
99
+// 根据id获取押金流水
100
+func (this *XcxApiController) DepositFlow() {
101
+	orgid, _ := this.GetInt64("org_id", 0)
102
+	patient_id, _ := this.GetInt64("patient_id", 0) //患者id
103
+	//获取当前患者的姓名
104
+	tmp, _ := service.GetHisUserName(orgid, patient_id)
105
+	name := tmp.Name
106
+
107
+	start_time := this.GetString("start_time", "") //开始时间
108
+	end_time := this.GetString("end_time", "")     //结束时间
109
+	timeLayout := "2006-01-02"
110
+	loc, _ := time.LoadLocation("Local")
111
+	var stime int64 //开始时间
112
+	var etime int64 //结束时间
113
+	if start_time == "" || end_time == "" {
114
+		//如果为空则查全部的
115
+		stime, etime = service.GetMonth()
116
+	} else {
117
+		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
118
+		etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
119
+		stime = stmp.Unix()
120
+		etime = etmp.Unix()
121
+	}
122
+	////获取该角色当前时间段的余额
123
+	//decimal := service.GetMoneyforTime(id, orgid, etime)
124
+	//获取列表
125
+	deposirhistory, errs := service.GetFlowList(patient_id, orgid, stime, etime)
126
+	if errs != nil {
127
+		utils.ErrorLog("获取列表失败,原因为:", errs.Error())
128
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, errs.Error())
129
+		return
130
+	}
131
+	var expenditure, recharge decimal.Decimal
132
+
133
+	for i := 0; i < len(deposirhistory); i++ {
134
+		//如果为扣费,或退费 则把订单id变为就诊号
135
+		if deposirhistory[i].DepositStatus == 1 || deposirhistory[i].DepositStatus == 3 || deposirhistory[i].DepositStatus == 4 {
136
+			recharge = recharge.Add(deposirhistory[i].Deposit)
137
+		}
138
+
139
+		if deposirhistory[i].DepositStatus == 2 {
140
+			expenditure = expenditure.Add(deposirhistory[i].Deposit)
141
+		}
142
+
143
+	}
144
+
145
+	this.ServeSuccessJSON(map[string]interface{}{
146
+		"list":        deposirhistory,
147
+		"name":        name,
148
+		"start_time":  time.Unix(stime, 0).Format("2006-01-02"),
149
+		"end_time":    time.Unix(etime, 0).Format("2006-01-02"),
150
+		"expenditure": expenditure,
151
+		"recharge":    recharge,
152
+	})
153
+	return
154
+}
155
+
156
+// 根据患者id查询患者的余额
157
+func (this *XcxApiController) IdToBalance() {
158
+
159
+	orgid, _ := this.GetInt64("org_id", 0)
160
+	his_patient_id, _ := this.GetInt64("patient_id", 0)
161
+	if orgid <= 0 || his_patient_id <= 0 {
162
+		this.ServeSuccessJSON(map[string]interface{}{
163
+			"error_code": 1001,
164
+			"error_msg":  "参数错误",
165
+		})
166
+	}
167
+	balance := service.GetUserMoney(his_patient_id, orgid)
168
+	patient, _ := service.GetPatientByIdXcx(his_patient_id)
169
+	this.ServeSuccessJSON(map[string]interface{}{
170
+		"balance": balance,
171
+		"patient": patient,
172
+	})
173
+	return
174
+}
175
+
77 176
 func (this *XcxApiController) GetCodeInit() {
78 177
 	redisClient := service.RedisClient()
79 178
 	defer redisClient.Close()
80 179
 	req := this.Ctx.Request
81 180
 	addr := utils.GetIP(req)
82 181
 	cur_time := time.Now().Format("2006-01-02")
83
-	_, err := redisClient.Get(redisClient.Context(),"ip:host_" + cur_time + "_" + addr).Result()
182
+	_, err := redisClient.Get("ip:host_" + cur_time + "_" + addr).Result()
84 183
 	if err != nil {
85
-		redisClient.Set(redisClient.Context(),"ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
184
+		redisClient.Set("ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
86 185
 	}
87 186
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
88 187
 	aespass := utils.AESEncrypt(addr)
89 188
 
90
-	fmt.Println("hhhhhhh3223323232332", aespass)
91 189
 	this.ServeSuccessJSON(map[string]interface{}{
92 190
 		"aespass": aespass,
93 191
 	})
@@ -95,65 +193,94 @@ func (this *XcxApiController) GetCodeInit() {
95 193
 }
96 194
 
97 195
 func (this *XcxApiController) GetUserNameRegister() {
98
-	name := this.GetString("name")
196
+	// name := this.GetString("name")
197
+	// relationship := this.GetString("relationship")
99 198
 	id_card_no := this.GetString("id_card_no")
100 199
 	mobile := this.GetString("mobile")
101
-	patient, errcodes := service.GetNamePatient(name, id_card_no)
200
+	// code := this.GetString("code")
201
+	openid := this.GetString("openid")
202
+
203
+	if len(mobile) == 0 || len(openid) == 0 {
204
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
205
+		return
206
+	}
207
+
208
+	// redisClient := service.RedisClient()
209
+	// defer redisClient.Close()
210
+	// cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
211
+	// utils.TraceLog("cache_code:%v code:%v", cache_code, code)
212
+	// if cache_code != code {
213
+	// 	this.ServeSuccessJSON(map[string]interface{}{
214
+	// 		"err_code": "1001",
215
+	// 		"err_msg":  "验证码错误",
216
+	// 	})
217
+	// 	return
218
+	// }
219
+
220
+	// this.Ctx.SetCookie("mobile", mobile)
221
+	// // 注册成功后验证码就要使其失效
222
+	// redisClient.Del("code_msg_" + mobile)
223
+
224
+	patient, errcodes := service.GetPatientByIdcardno(id_card_no)
102 225
 	if errcodes == nil {
103 226
 		role := models.XcxAdminUserRole{
104
-			PatientName: name,
105
-			IdCardNo:    id_card_no,
106
-			Mobile:      mobile,
107
-			Code:        "000000",
108
-			PatientId:   patient.ID,
109
-			UserOrgId:   patient.UserOrgId,
110
-			Status:      1,
111
-			Ctime:       time.Now().Unix(),
112
-			Mtime:       0,
113
-			Appid:       "",
114
-			Appsecret:   "",
115
-			SessionKey:  "",
227
+			PatientName: patient.Name,
228
+			// Relationship: relationship,
229
+			IdCardNo: id_card_no,
230
+			Mobile:   mobile,
231
+			// Code:         code,
232
+			PatientId:  patient.ID,
233
+			UserOrgId:  patient.UserOrgId,
234
+			Status:     1,
235
+			Ctime:      time.Now().Unix(),
236
+			Mtime:      0,
237
+			Appid:      "",
238
+			Appsecret:  "",
239
+			SessionKey: "",
240
+			Openid:     openid,
116 241
 		}
117 242
 		err := service.CreateXcxAdminUser(role)
118 243
 		if err == nil {
119
-			mobilePatient, _ := service.GetNamePatient(name, id_card_no)
120
-			template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
121
-				//处方
122
-			prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
123
-
124
-				//接诊评估
125
-			receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
126
-
127
-				//透前评估
128
-			dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
129
-
130
-				//透析上机
131
-			dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
132
-
133
-				//透析监测
134
-			monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
135
-
136
-				//透后评估
137
-			dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
138
-
139
-			treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
140
-			var configList interface{}
141
-			configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
244
+			//mobilePatient, _ := service.GetNamePatient(name, id_card_no)
245
+			//template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
246
+			////处方
247
+			//prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
248
+			//
249
+			////接诊评估
250
+			//receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
251
+			//
252
+			////透前评估
253
+			//dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
254
+			//
255
+			////透析上机
256
+			//dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
257
+			//
258
+			////透析监测
259
+			//monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
260
+			//
261
+			////透后评估
262
+			//dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
263
+			//
264
+			//treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
265
+			//var configList interface{}
266
+			//configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
142 267
 			this.ServeSuccessJSON(map[string]interface{}{
143
-					"role":                      role,
144
-					"is_bind":                   true,
145
-					"patient":                   mobilePatient,
146
-					"template_id":               template_id,
147
-					"user_org_id":               mobilePatient.UserOrgId,
148
-					"prescripition_config":      prescripition_config,
149
-					"receive_treatement_config": receive_treatement_config,
150
-					"dialysis_befor":            dialysis_befor,
151
-					"dialysis_order":            dialysis_order,
152
-					"monitor_record":            monitor_record,
153
-					"dialysis_after":            dialysis_after,
154
-					"treate_ment":               treate_ment,
155
-					"configList":                configList,
156
-					"result":                    false,
268
+				"role":     role,
269
+				"is_bind":  true,
270
+				"err_code": "0",
271
+				"err_msg":  "",
272
+				//"patient":                   mobilePatient,
273
+				//"template_id":               template_id,
274
+				"user_org_id": patient.UserOrgId,
275
+				//"prescripition_config":      prescripition_config,
276
+				//"receive_treatement_config": receive_treatement_config,
277
+				//"dialysis_befor":            dialysis_befor,
278
+				//"dialysis_order":            dialysis_order,
279
+				//"monitor_record":            monitor_record,
280
+				//"dialysis_after":            dialysis_after,
281
+				//"treate_ment":               treate_ment,
282
+				//"configList":                configList,
283
+				//"result":                    false,
157 284
 			})
158 285
 		} else {
159 286
 			this.ServeSuccessJSON(map[string]interface{}{
@@ -165,7 +292,7 @@ func (this *XcxApiController) GetUserNameRegister() {
165 292
 	} else {
166 293
 		this.ServeSuccessJSON(map[string]interface{}{
167 294
 			"is_bind": false,
168
-			"msg":     "绑定失败",
295
+			"msg":     "绑定失败,没有对应的患者信息",
169 296
 			"result":  false,
170 297
 		})
171 298
 	}
@@ -307,7 +434,7 @@ func (this *XcxApiController) GetUserRegister() {
307 434
 	} else {
308 435
 		redisClient := service.RedisClient()
309 436
 		defer redisClient.Close()
310
-		cache_code, _ := redisClient.Get(redisClient.Context(),"code_msg_" + mobile).Result()
437
+		cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
311 438
 		fmt.Println("cache_code9999999293323232322323", cache_code)
312 439
 		if cache_code != code {
313 440
 			this.ServeSuccessJSON(map[string]interface{}{
@@ -317,7 +444,7 @@ func (this *XcxApiController) GetUserRegister() {
317 444
 		} else {
318 445
 			this.Ctx.SetCookie("mobile", mobile)
319 446
 			// 注册成功后验证码就要使其失效
320
-			redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
447
+			redisClient.Del("code_msg_" + mobile)
321 448
 			patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
322 449
 			fmt.Println("errcodes2323232232", errcodes)
323 450
 			if errcodes == nil {
@@ -445,7 +572,9 @@ func (this *XcxApiController) GetCodeInfo() {
445 572
 
446 573
 	mobile := this.GetString("phone")
447 574
 	aespass := this.GetString("aespass")
575
+
448 576
 	utils.TraceLog("mobile:%v aespass:%v", mobile, aespass)
577
+
449 578
 	if utils.CellPhoneRegexp().MatchString(mobile) == false {
450 579
 		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeMobileFormat)
451 580
 		this.ServeJSON()
@@ -466,91 +595,50 @@ func (this *XcxApiController) GetCodeInfo() {
466 595
 	})
467 596
 }
468 597
 
469
-func (this *XcxApiController) GetLoginInfor() {
598
+func (this *XcxApiController) GetLoginInfoByOpenid() {
599
+	openid := this.GetString("openid")
600
+	user_admin, errcodes := service.GetXcxOpneidInformation(openid)
601
+	if errcodes == gorm.ErrRecordNotFound {
602
+		this.ServeSuccessJSON(map[string]interface{}{
603
+			"patient":     "",
604
+			"patient_id":  0,
605
+			"user_org_id": 0,
606
+			"role":        user_admin,
607
+			"is_bind":     false,
608
+		})
609
+	} else if errcodes == nil {
610
+		info, _ := service.GetPatientListByPatientId(user_admin.PatientId)
611
+		this.ServeSuccessJSON(map[string]interface{}{
612
+			"patient":     info,
613
+			"role":        user_admin,
614
+			"is_bind":     true,
615
+			"user_org_id": info.UserOrgId,
616
+			"patient_id":  user_admin.PatientId,
617
+		})
618
+	}
619
+}
470 620
 
621
+func (this *XcxApiController) GetLoginInfor() {
471 622
 	mobile := this.GetString("mobile")
472
-	fmt.Println(mobile)
473 623
 	user_admin, errcodes := service.GetXcxMobileInformation(mobile)
474 624
 	if errcodes == gorm.ErrRecordNotFound {
475
-		info, _ := service.GetMobilePatientInfo(mobile)
476
-		template_id, _ := service.GetTemplateMode(info.UserOrgId)
477
-		//处方
478
-		prescripition_config, _ := service.GetPrescripionFieldConfig(info.UserOrgId)
479
-
480
-		//接诊评估
481
-		receive_treatement_config, _ := service.GetReceiveTreatmentAssess(info.UserOrgId)
482
-
483
-		//透前评估
484
-		dialysis_befor, _ := service.GetDialysisBefor(info.UserOrgId)
485
-
486
-		//透析上机
487
-		dialysis_order, _ := service.GetDialysisOrderConfig(info.UserOrgId)
488
-
489
-		//透析监测
490
-		monitor_record, _ := service.GetMonitorRecordConfig(info.UserOrgId)
491
-
492
-		//透后评估
493
-		dialysis_after, _ := service.GetDialysisAfeterConfig(info.UserOrgId)
494
-
495
-		treate_ment, _ := service.GetTreatMentConfig(info.UserOrgId)
496
-		var configList interface{}
497
-		configList, _ = service.GetConfigList(info.UserOrgId)
498 625
 		this.ServeSuccessJSON(map[string]interface{}{
499
-			"patient":                   info,
500
-			"template_id":               template_id,
501
-			"user_org_id":               info.UserOrgId,
502
-			"prescripition_config":      prescripition_config,
503
-			"receive_treatement_config": receive_treatement_config,
504
-			"dialysis_befor":            dialysis_befor,
505
-			"dialysis_order":            dialysis_order,
506
-			"monitor_record":            monitor_record,
507
-			"dialysis_after":            dialysis_after,
508
-			"treate_ment":               treate_ment,
509
-			"role":                      user_admin,
510
-			"is_bind":                   false,
511
-			"list":                      configList,
626
+			"patient":     "",
627
+			"patient_id":  0,
628
+			"user_org_id": 0,
629
+			"role":        user_admin,
630
+			"is_bind":     false,
512 631
 		})
513 632
 	} else if errcodes == nil {
514 633
 		info, _ := service.GetPatientListByPatientId(user_admin.PatientId)
515
-		template_id, _ := service.GetTemplateMode(info.UserOrgId)
516
-		//处方
517
-		prescripition_config, _ := service.GetPrescripionFieldConfig(info.UserOrgId)
518
-
519
-		//接诊评估
520
-		receive_treatement_config, _ := service.GetReceiveTreatmentAssess(info.UserOrgId)
521
-
522
-		//透前评估
523
-		dialysis_befor, _ := service.GetDialysisBefor(info.UserOrgId)
524
-
525
-		//透析上机
526
-		dialysis_order, _ := service.GetDialysisOrderConfig(info.UserOrgId)
527
-
528
-		//透析监测
529
-		monitor_record, _ := service.GetMonitorRecordConfig(info.UserOrgId)
530
-
531
-		//透后评估
532
-		dialysis_after, _ := service.GetDialysisAfeterConfig(info.UserOrgId)
533
-
534
-		treate_ment, _ := service.GetTreatMentConfig(info.UserOrgId)
535
-		var configList interface{}
536
-		configList, _ = service.GetConfigList(info.UserOrgId)
537 634
 		this.ServeSuccessJSON(map[string]interface{}{
538
-			"patient":                   info,
539
-			"role":                      user_admin,
540
-			"is_bind":                   true,
541
-			"template_id":               template_id,
542
-			"user_org_id":               info.UserOrgId,
543
-			"prescripition_config":      prescripition_config,
544
-			"receive_treatement_config": receive_treatement_config,
545
-			"dialysis_befor":            dialysis_befor,
546
-			"dialysis_order":            dialysis_order,
547
-			"monitor_record":            monitor_record,
548
-			"dialysis_after":            dialysis_after,
549
-			"treate_ment":               treate_ment,
550
-			"list":                      configList,
635
+			"patient":     info,
636
+			"role":        user_admin,
637
+			"is_bind":     true,
638
+			"user_org_id": info.UserOrgId,
639
+			"patient_id":  user_admin.PatientId,
551 640
 		})
552 641
 	}
553
-
554 642
 }
555 643
 
556 644
 func (this *XcxApiController) GetPatientList() {
@@ -592,7 +680,217 @@ func (this *XcxApiController) GetDataInfo() {
592 680
 	})
593 681
 }
594 682
 
683
+func (this *XcxApiController) GetSignsByBlood() {
684
+	start := this.GetString("start", "")
685
+	end := this.GetString("end", "")
686
+	patient_id, _ := this.GetInt64("patient_id", 0)
687
+	org_id, _ := this.GetInt64("org_id", 0)
688
+
689
+	if len(start) <= 0 || len(end) <= 0 || patient_id <= 0 || org_id <= 0 {
690
+		this.ServeSuccessJSON(map[string]interface{}{
691
+			"err_code": 1001,
692
+			"err_msg":  "缺少参数",
693
+			"data":     "",
694
+		})
695
+	}
696
+	loc, _ := time.LoadLocation("Local")
697
+	startTime, _ := time.ParseInLocation("2006-01-02", start, loc)
698
+	startTimeUnix := startTime.Unix()
699
+	endTime, _ := time.ParseInLocation("2006-01-02", end, loc)
700
+	endTimeUinx := endTime.Unix()
701
+
702
+	utils.TraceLog("startTime:%v endTime:%v", startTime, endTime)
703
+	utils.TraceLog("startTimeUnix:%v endTimeUinx:%v", startTimeUnix, endTimeUinx)
704
+	if startTimeUnix < 0 || endTimeUinx < 0 {
705
+		this.ServeSuccessJSON(map[string]interface{}{
706
+			"err_code": 1001,
707
+			"err_msg":  "时间超出范围",
708
+			"data":     "",
709
+		})
710
+	}
711
+	if startTimeUnix > endTimeUinx {
712
+		this.ServeSuccessJSON(map[string]interface{}{
713
+			"err_code": 1001,
714
+			"err_msg":  "开始时间大于结束时间",
715
+			"data":     "",
716
+		})
717
+	}
718
+
719
+	if endTimeUinx-startTimeUnix > 60*60*24*60 {
720
+		this.ServeSuccessJSON(map[string]interface{}{
721
+			"err_code": 1001,
722
+			"err_msg":  "时间范围超过60天",
723
+			"data":     "",
724
+		})
725
+	}
726
+
727
+	beforeblood, _ := service.GetSignsByBlood(org_id, startTimeUnix, endTimeUinx, patient_id)
728
+	afterblood, _ := service.GetSignsByAfterBlood(org_id, startTimeUnix, endTimeUinx, patient_id)
729
+
730
+	this.ServeSuccessJSON(map[string]interface{}{
731
+		"err_code":     0,
732
+		"err_msg":      "",
733
+		"before_blood": beforeblood,
734
+		"after_blood":  afterblood,
735
+	})
736
+
737
+	//now := time.Now()
738
+	//offset := int(time.Monday - now.Weekday())
739
+	//if offset > 0 {
740
+	//	offset = -6
741
+	//}
742
+	//monday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
743
+	//endday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset+6)
744
+	//startTime := monday.Unix()
745
+	//endTime := endday.Unix()
746
+	//
747
+	//this.ServeSuccessJSON(map[string]interface{}{
748
+	//	"monday": startTime,
749
+	//	"endday": endTime,
750
+	//})
751
+}
752
+
753
+func (this *XcxApiController) GetSignsByWeight() {
754
+	start := this.GetString("start", "")
755
+	end := this.GetString("end", "")
756
+	patient_id, _ := this.GetInt64("patient_id", 0)
757
+	org_id, _ := this.GetInt64("org_id", 0)
758
+
759
+	if len(start) <= 0 || len(end) <= 0 || patient_id <= 0 || org_id <= 0 {
760
+		this.ServeSuccessJSON(map[string]interface{}{
761
+			"err_code": 1001,
762
+			"err_msg":  "缺少参数",
763
+			"data":     "",
764
+		})
765
+	}
766
+	loc, _ := time.LoadLocation("Local")
767
+	startTime, _ := time.ParseInLocation("2006-01-02", start, loc)
768
+	startTimeUnix := startTime.Unix()
769
+	endTime, _ := time.ParseInLocation("2006-01-02", end, loc)
770
+	endTimeUinx := endTime.Unix()
771
+
772
+	utils.TraceLog("startTime:%v endTime:%v", startTime, endTime)
773
+	utils.TraceLog("startTimeUnix:%v endTimeUinx:%v", startTimeUnix, endTimeUinx)
774
+	if startTimeUnix < 0 || endTimeUinx < 0 {
775
+		this.ServeSuccessJSON(map[string]interface{}{
776
+			"err_code": 1001,
777
+			"err_msg":  "时间超出范围",
778
+			"data":     "",
779
+		})
780
+	}
781
+	if startTimeUnix > endTimeUinx {
782
+		this.ServeSuccessJSON(map[string]interface{}{
783
+			"err_code": 1001,
784
+			"err_msg":  "开始时间大于结束时间",
785
+			"data":     "",
786
+		})
787
+	}
788
+
789
+	if endTimeUinx-startTimeUnix > 60*60*24*60 {
790
+		this.ServeSuccessJSON(map[string]interface{}{
791
+			"err_code": 1001,
792
+			"err_msg":  "时间范围超过60天",
793
+			"data":     "",
794
+		})
795
+	}
796
+
797
+	beforeweight, _ := service.GetSignsByWeight(org_id, startTimeUnix, endTimeUinx, patient_id)
798
+	dryweight, _ := service.GetSignsByDryWeight(org_id, startTimeUnix, endTimeUinx, patient_id)
799
+	afterweight, _ := service.GetSignsByAfterWeight(org_id, startTimeUnix, endTimeUinx, patient_id)
800
+
801
+	this.ServeSuccessJSON(map[string]interface{}{
802
+		"err_code":       0,
803
+		"err_msg":        "",
804
+		"before_eweight": beforeweight,
805
+		"dry_eweight":    dryweight,
806
+		"after_eweight":  afterweight,
807
+	})
808
+
809
+	//now := time.Now()
810
+	//offset := int(time.Monday - now.Weekday())
811
+	//if offset > 0 {
812
+	//	offset = -6
813
+	//}
814
+	//monday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
815
+	//endday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset+6)
816
+	//startTime := monday.Unix()
817
+	//endTime := endday.Unix()
818
+	//
819
+	//this.ServeSuccessJSON(map[string]interface{}{
820
+	//	"monday": startTime,
821
+	//	"endday": endTime,
822
+	//})
823
+}
824
+
825
+func (this *XcxApiController) GetSchedulesByWeek() {
826
+	start := this.GetString("start", "")
827
+	end := this.GetString("end", "")
828
+	patient_id, _ := this.GetInt64("patient_id", 0)
829
+	org_id, _ := this.GetInt64("org_id", 0)
830
+
831
+	if len(start) <= 0 || len(end) <= 0 || patient_id <= 0 || org_id <= 0 {
832
+		this.ServeSuccessJSON(map[string]interface{}{
833
+			"err_code": 1001,
834
+			"err_msg":  "缺少参数",
835
+			"data":     "",
836
+		})
837
+	}
838
+	loc, _ := time.LoadLocation("Local")
839
+	startTime, _ := time.ParseInLocation("2006-01-02", start, loc)
840
+	startTimeUnix := startTime.Unix()
841
+	endTime, _ := time.ParseInLocation("2006-01-02", end, loc)
842
+	endTimeUinx := endTime.Unix()
843
+
844
+	utils.TraceLog("startTime:%v endTime:%v", startTime, endTime)
845
+	utils.TraceLog("startTimeUnix:%v endTimeUinx:%v", startTimeUnix, endTimeUinx)
846
+	if startTimeUnix < 0 || endTimeUinx < 0 {
847
+		this.ServeSuccessJSON(map[string]interface{}{
848
+			"err_code": 1001,
849
+			"err_msg":  "时间超出范围",
850
+			"data":     "",
851
+		})
852
+	}
853
+	if startTimeUnix > endTimeUinx {
854
+		this.ServeSuccessJSON(map[string]interface{}{
855
+			"err_code": 1001,
856
+			"err_msg":  "开始时间大于结束时间",
857
+			"data":     "",
858
+		})
859
+	}
860
+
861
+	if endTimeUinx-startTimeUnix > 60*60*24*60 {
862
+		this.ServeSuccessJSON(map[string]interface{}{
863
+			"err_code": 1001,
864
+			"err_msg":  "时间范围超过60天",
865
+			"data":     "",
866
+		})
867
+	}
868
+
869
+	schedule, _ := service.GetScheduleByXcx(org_id, startTimeUnix, endTimeUinx, patient_id)
870
+	this.ServeSuccessJSON(map[string]interface{}{
871
+		"err_code": 0,
872
+		"err_msg":  "",
873
+		"data":     schedule,
874
+	})
875
+
876
+	//now := time.Now()
877
+	//offset := int(time.Monday - now.Weekday())
878
+	//if offset > 0 {
879
+	//	offset = -6
880
+	//}
881
+	//monday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
882
+	//endday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset+6)
883
+	//startTime := monday.Unix()
884
+	//endTime := endday.Unix()
885
+	//
886
+	//this.ServeSuccessJSON(map[string]interface{}{
887
+	//	"monday": startTime,
888
+	//	"endday": endTime,
889
+	//})
890
+}
891
+
595 892
 func (this *XcxApiController) GetScheduleInfo() {
893
+
596 894
 	patient_id, _ := this.GetInt64("patient_id")
597 895
 	fmt.Println(patient_id)
598 896
 	thisWeekMonday := service.GetFirstDateOfWeek()
@@ -633,7 +931,7 @@ func (this *XcxApiController) GetScheduleInfo() {
633 931
 		return
634 932
 	}
635 933
 
636
-	var one = startTime.Unix() + 86400
934
+	var one = startTime.Unix()
637 935
 	fmt.Println("one2322332", one)
638 936
 	var two = one + 86400
639 937
 	var three = two + 86400
@@ -658,7 +956,6 @@ func (this *XcxApiController) GetScheduleInfo() {
658 956
 	var lastsix = lastfive + 86400
659 957
 	var lastseven = lastsix + 86400
660 958
 
661
-	fmt.Println("各地好当家232332323232", lastseven)
662 959
 	array := []interface{}{
663 960
 		map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
664 961
 		map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
@@ -738,18 +1035,14 @@ func (this *XcxApiController) GetScheduleInfo() {
738 1035
 func (this *XcxApiController) GetMobileSchedule() {
739 1036
 
740 1037
 	patientID, _ := this.GetInt64("patient_id")
741
-	fmt.Println("1", patientID)
742 1038
 	info, _ := service.GetXcxPatientInfo(patientID)
743 1039
 	timeLayout := "2006-01-02"
744 1040
 	loc, _ := time.LoadLocation("Local")
745 1041
 	time_now := time.Now().Format("2006-01-02")
746 1042
 	timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
747
-
748
-	fmt.Println("timeNowUnix", timeNowUnix.Unix())
749 1043
 	//获取该患者最后一次排班
750 1044
 	list, _ := service.GetLastScheduleListOne(patientID, timeNowUnix.Unix())
751
-	fmt.Println("hh2332323232323223", list)
752
-	fmt.Println("list233232232332", list.ScheduleDate)
1045
+
753 1046
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
754 1047
 	if getPatientErr != nil {
755 1048
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
@@ -968,9 +1261,9 @@ func (this *XcxApiController) GetDoctorAdvice() {
968 1261
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
969 1262
 	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
970 1263
 	info, _ := service.GetXcxPatientInfo(patient_id)
971
-	config, _ := service.GetDoctorAdviceConfig(info.UserOrgId)
972
-	fmt.Println(startTime, endTime, config.IsOpenRemind)
973
-	if config.IsOpenRemind == 0 || config.IsOpenRemind == 2 {
1264
+	_, config := service.FindXTHisRecordByOrgId(info.UserOrgId)
1265
+	fmt.Println(startTime, endTime, config.IsOpen)
1266
+	if config.IsOpen == 0 {
974 1267
 		list, _ := service.GetDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
975 1268
 		advice, _ := service.GetDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
976 1269
 		for _, item := range list {
@@ -986,7 +1279,7 @@ func (this *XcxApiController) GetDoctorAdvice() {
986 1279
 		})
987 1280
 	}
988 1281
 
989
-	if config.IsOpenRemind == 1 {
1282
+	if config.IsOpen == 1 {
990 1283
 		list, _ := service.GetHisDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
991 1284
 		advice, _ := service.GetHisDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
992 1285
 		for _, item := range list {
@@ -1064,27 +1357,46 @@ func (this *XcxApiController) GetDataConfig() {
1064 1357
 
1065 1358
 func (this *XcxApiController) GetInspectionList() {
1066 1359
 
1067
-	start_time := this.GetString("start_time")
1068
-	end_time := this.GetString("end_time")
1069
-	patient_id, _ := this.GetInt64("patient_id")
1070
-	fmt.Println("patient_id", patient_id)
1071
-	timeLayout := "2006-01-02"
1072
-	loc, _ := time.LoadLocation("Local")
1073
-	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1074
-	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1360
+	page, _ := this.GetInt64("page", 0)
1361
+	number, _ := this.GetInt64("number", 10)
1362
+	patient_id, _ := this.GetInt64("patient_id", 0)
1363
+	//fmt.Println("patient_id", patient_id)
1364
+	//timeLayout := "2006-01-02"
1365
+	//loc, _ := time.LoadLocation("Local")
1366
+	//startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1367
+	//endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1368
+
1369
+	list, err := service.GetInspectionGroupListByXcx(patient_id, page, number)
1370
+
1371
+	if err == gorm.ErrRecordNotFound {
1372
+		this.ServeSuccessJSON(map[string]interface{}{
1373
+			"error_code": "1001",
1374
+			"error_msg":  "没有更多数据",
1375
+		})
1376
+	}
1075 1377
 
1076
-	list, _ := service.GetInspectionGroupList(patient_id, startTime.Unix(), endTime.Unix())
1378
+	this.ServeSuccessJSON(map[string]interface{}{
1379
+		"error_code": "0",
1380
+		"error_msg":  "",
1381
+		"list":       list,
1382
+	})
1383
+}
1077 1384
 
1078
-	insepctionList, _ := service.GetInsepctionList(patient_id, startTime.Unix(), endTime.Unix())
1385
+func (this *XcxApiController) GetInspectionInfo() {
1079 1386
 
1080
-	for _, item := range list {
1081
-		for _, it := range insepctionList {
1082
-			if item.ProjectId == it.ProjectId && item.InspectDate == it.InspectDate {
1083
-				item.Childs = append(item.Childs, it)
1084
-			}
1085
-		}
1387
+	project_id, _ := this.GetInt64("project_id", 0)
1388
+	inspect_date, _ := this.GetInt64("inspect_date", 0)
1389
+	patient_id, _ := this.GetInt64("patient_id", 0)
1390
+
1391
+	if project_id <= 0 || inspect_date <= 0 || patient_id <= 0 {
1392
+		this.ServeSuccessJSON(map[string]interface{}{
1393
+			"error_code": 1001,
1394
+			"error_msg":  "缺少参数",
1395
+		})
1086 1396
 	}
1087 1397
 
1398
+	list, _ := service.GetInspectionInfoByXcx(patient_id, project_id, inspect_date)
1399
+
1088 1400
 	this.ServeSuccessJSON(map[string]interface{}{
1089 1401
 		"list": list,
1090 1402
 	})

+ 36 - 0
go.mod Целия файл

@@ -0,0 +1,36 @@
1
+module Xcx_New
2
+
3
+go 1.19
4
+
5
+require (
6
+	github.com/astaxie/beego v1.12.3
7
+	github.com/go-redis/redis v6.15.9+incompatible
8
+	github.com/jinzhu/gorm v1.9.16
9
+	github.com/robfig/cron v1.2.0
10
+	github.com/shopspring/decimal v1.3.1
11
+	github.com/smartystreets/goconvey v1.7.2
12
+)
13
+
14
+require (
15
+	github.com/beorn7/perks v1.0.1 // indirect
16
+	github.com/cespare/xxhash/v2 v2.1.1 // indirect
17
+	github.com/go-sql-driver/mysql v1.5.0 // indirect
18
+	github.com/golang/protobuf v1.4.2 // indirect
19
+	github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
20
+	github.com/hashicorp/golang-lru v0.5.4 // indirect
21
+	github.com/jinzhu/inflection v1.0.0 // indirect
22
+	github.com/jtolds/gls v4.20.0+incompatible // indirect
23
+	github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
24
+	github.com/prometheus/client_golang v1.7.0 // indirect
25
+	github.com/prometheus/client_model v0.2.0 // indirect
26
+	github.com/prometheus/common v0.10.0 // indirect
27
+	github.com/prometheus/procfs v0.1.3 // indirect
28
+	github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
29
+	github.com/smartystreets/assertions v1.2.0 // indirect
30
+	golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd // indirect
31
+	golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
32
+	golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 // indirect
33
+	golang.org/x/text v0.3.0 // indirect
34
+	google.golang.org/protobuf v1.23.0 // indirect
35
+	gopkg.in/yaml.v2 v2.2.8 // indirect
36
+)

+ 53 - 6
models/dialysis.go Целия файл

@@ -234,6 +234,34 @@ func (DialysisSchedule) TableName() string {
234 234
 	return "xt_schedule"
235 235
 }
236 236
 
237
+type PredialysisEvaluationOne struct {
238
+	AssessmentDate int64   `gorm:"column:assessment_date" json:"assessment_date"`
239
+	WeightBefore   float64 `gorm:"column:weight_before" json:"weight_before"`
240
+}
241
+
242
+func (PredialysisEvaluationOne) TableName() string {
243
+	return "xt_assessment_before_dislysis"
244
+}
245
+
246
+type PredialysisEvaluationThree struct {
247
+	AssessmentDate         int64   `gorm:"column:assessment_date" json:"assessment_date"`
248
+	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
249
+	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
250
+}
251
+
252
+func (PredialysisEvaluationThree) TableName() string {
253
+	return "xt_assessment_before_dislysis"
254
+}
255
+
256
+type PredialysisEvaluationTwo struct {
257
+	AssessmentDate int64   `gorm:"column:assessment_date" json:"assessment_date"`
258
+	DryWeight      float64 `gorm:"column:dry_weight" json:"dry_weight"`
259
+}
260
+
261
+func (PredialysisEvaluationTwo) TableName() string {
262
+	return "xt_assessment_before_dislysis"
263
+}
264
+
237 265
 type PredialysisEvaluation struct {
238 266
 	ID                          int64   `gorm:"column:id" json:"id"`
239 267
 	UserOrgId                   int64   `gorm:"column:user_org_id" json:"user_org_id"`
@@ -287,7 +315,7 @@ type PredialysisEvaluation struct {
287 315
 	DuctusArantii                  string  `gorm:"column:ductus_arantii" json:"ductus_arantii"`
288 316
 	EmergencyTreatment             int64   `gorm:"column:emergency_treatment" json:"emergency_treatment"`
289 317
 	EmergencyTreatmentOther        string  `gorm:"column:emergency_treatment_other" json:"emergency_treatment_other"`
290
-	DialysisCount                  string   `gorm:"column:dialysis_count" json:"dialysis_count"`
318
+	DialysisCount                  string  `gorm:"column:dialysis_count" json:"dialysis_count"`
291 319
 	AssessmentDoctor               int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
292 320
 	AssessmentTime                 int64   `gorm:"column:assessment_time" json:"assessment_time"`
293 321
 	MachineType                    string  `gorm:"column:machine_type" json:"machine_type"`
@@ -301,7 +329,7 @@ type PredialysisEvaluation struct {
301 329
 	LastPostDialysisOther          string  `gorm:"column:last_post_dialysis_other" json:"last_post_dialysis_other"`
302 330
 	SymptomBeforeDialysisOther     string  `gorm:"column:symptom_before_dialysis_other" json:"symptom_before_dialysis_other"`
303 331
 	DialysisInterphaseOther        string  `gorm:"column:dialysis_interphase_other" json:"dialysis_interphase_other"`
304
-	HumorExcessiveSymptom          string   `gorm:"column:humor_excessive_symptom" json:"humor_excessive_symptom"`
332
+	HumorExcessiveSymptom          string  `gorm:"column:humor_excessive_symptom" json:"humor_excessive_symptom"`
305 333
 	Phinholing                     string  `gorm:"column:pinholing" json:"pinholing" form:"pinholing"`
306 334
 	CatheterSuture                 string  `gorm:"column:catheter_suture" json:"catheter_suture" form:"catheter_suture"`
307 335
 	CatheterSutureOther            string  `gorm:"column:catheter_suture_other" json:"catheter_suture_other" form:"catheter_suture_other"`
@@ -340,7 +368,7 @@ func (PredialysisEvaluationList) TableName() string {
340 368
 	return "xt_assessment_before_dislysis"
341 369
 }
342 370
 
343
-//更改的地方
371
+// 更改的地方
344 372
 type DoctorAdvices struct {
345 373
 	ID                         int64           `gorm:"column:id" json:"id" form:"id"`
346 374
 	GroupNo                    int64           `gorm:"column:groupno" json:"groupno" form:"groupno"`
@@ -542,6 +570,25 @@ func (DoubleCheck) TableName() string {
542 570
 	return "xt_double_check"
543 571
 }
544 572
 
573
+type AssessmentAfterDislysisOne struct {
574
+	AssessmentDate int64   `gorm:"column:assessment_date" json:"assessment_date"`
575
+	WeightAfter    float64 `gorm:"column:weight_after" json:"weight_after"`
576
+}
577
+
578
+func (AssessmentAfterDislysisOne) TableName() string {
579
+	return "xt_assessment_after_dislysis"
580
+}
581
+
582
+type AssessmentAfterDislysisTwo struct {
583
+	AssessmentDate         int64   `gorm:"column:assessment_date" json:"assessment_date"`
584
+	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
585
+	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
586
+}
587
+
588
+func (AssessmentAfterDislysisTwo) TableName() string {
589
+	return "xt_assessment_after_dislysis"
590
+}
591
+
545 592
 type AssessmentAfterDislysis struct {
546 593
 	ID                     int64   `gorm:"column:id" json:"id"`
547 594
 	UserOrgId              int64   `gorm:"column:user_org_id" json:"user_org_id"`
@@ -550,7 +597,7 @@ type AssessmentAfterDislysis struct {
550 597
 	DialysisOrderId        int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id"`
551 598
 	Temperature            float64 `gorm:"column:temperature" json:"temperature"`
552 599
 	PulseFrequency         float64 `gorm:"column:pulse_frequency" json:"pulse_frequency"`
553
-	BreathingRate          float64 `gorm:"column:breathing_rate" json:"breathing_rate"`
600
+	BreathingRate          string  `gorm:"column:breathing_rate" json:"breathing_rate"`
554 601
 	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
555 602
 	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
556 603
 	BloodPressureType      int64   `gorm:"column:blood_pressure_type" json:"blood_pressure_type"`
@@ -571,7 +618,7 @@ type AssessmentAfterDislysis struct {
571 618
 	Complication                    string  `gorm:"column:complication" json:"complication"`
572 619
 	Evaluator                       int64   `gorm:"column:evaluator" json:"evaluator"`
573 620
 	Remark                          string  `gorm:"column:remark" json:"remark"`
574
-	DialysisIntakes                 int64   `gorm:"column:dialysis_intakes" json:"dialysis_intakes"`
621
+	DialysisIntakes                 float64 `gorm:"column:dialysis_intakes" json:"dialysis_intakes"`
575 622
 	DialysisIntakesFeed             int64   `gorm:"column:dialysis_intakes_feed" json:"dialysis_intakes_feed"`
576 623
 	DialysisIntakesTransfusion      int64   `gorm:"column:dialysis_intakes_transfusion" json:"dialysis_intakes_transfusion"`
577 624
 	DialysisIntakesBloodTransfusion int64   `gorm:"column:dialysis_intakes_blood_transfusion" json:"dialysis_intakes_blood_transfusion"`
@@ -696,7 +743,7 @@ type MonitoringRecord struct {
696 743
 	OperateTime                 int64   `gorm:"column:operate_time" json:"operate_time"`
697 744
 	MonitoringTime              string  `gorm:"column:monitoring_time" json:"monitoring_time"`
698 745
 	PulseFrequency              float64 `gorm:"column:pulse_frequency" json:"pulse_frequency"`
699
-	BreathingRate               float64 `gorm:"column:breathing_rate" json:"breathing_rate"`
746
+	BreathingRate               string  `gorm:"column:breathing_rate" json:"breathing_rate"`
700 747
 	SystolicBloodPressure       float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
701 748
 	DiastolicBloodPressure      float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
702 749
 	BloodPressureType           int64   `gorm:"column:blood_pressure_type" json:"blood_pressure_type"`

+ 20 - 0
models/schedule_models.go Целия файл

@@ -29,6 +29,26 @@ func (VmSchedules) TableName() string {
29 29
 	return "xt_schedule"
30 30
 }
31 31
 
32
+type ScheduleXcx struct {
33
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
34
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
35
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
36
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
37
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
38
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
39
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
40
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
41
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
42
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
43
+	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
44
+	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
45
+	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
46
+}
47
+
48
+func (ScheduleXcx) TableName() string {
49
+	return "xt_schedule"
50
+}
51
+
32 52
 type Schedule struct {
33 53
 	ID           int64 `gorm:"column:id" json:"id" form:"id"`
34 54
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 82 - 13
models/xcx_user_models.go Целия файл

@@ -1,19 +1,23 @@
1 1
 package models
2 2
 
3
+import "github.com/shopspring/decimal"
4
+
3 5
 type XcxAdminUserRole struct {
4
-	ID          int64  `gorm:"column:id" json:"id" form:"id"`
5
-	PatientName string `gorm:"column:patient_name" json:"patient_name" form:"patient_name"`
6
-	IdCardNo    string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
7
-	Mobile      string `gorm:"column:mobile" json:"mobile" form:"mobile"`
8
-	Code        string `gorm:"column:code" json:"code" form:"code"`
9
-	PatientId   int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
10
-	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
11
-	Status      int64  `gorm:"column:status" json:"status" form:"status"`
12
-	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
13
-	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
14
-	Appid       string `gorm:"column:appid" json:"appid" form:"appid"`
15
-	Appsecret   string `gorm:"column:appsecret" json:"appsecret" form:"appsecret"`
16
-	SessionKey  string `gorm:"column:session_key" json:"session_key" form:"session_key"`
6
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
7
+	PatientName  string `gorm:"column:patient_name" json:"patient_name" form:"patient_name"`
8
+	Relationship string `gorm:"column:relationship" json:"relationship" form:"relationship"`
9
+	IdCardNo     string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
10
+	Mobile       string `gorm:"column:mobile" json:"mobile" form:"mobile"`
11
+	Code         string `gorm:"column:code" json:"code" form:"code"`
12
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
13
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
14
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
15
+	Ctime        int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
16
+	Mtime        int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
17
+	Appid        string `gorm:"column:appid" json:"appid" form:"appid"`
18
+	Appsecret    string `gorm:"column:appsecret" json:"appsecret" form:"appsecret"`
19
+	SessionKey   string `gorm:"column:session_key" json:"session_key" form:"session_key"`
20
+	Openid       string `gorm:"column:openid" json:"openid" form:"openid"`
17 21
 }
18 22
 
19 23
 func (XcxAdminUserRole) TableName() string {
@@ -541,6 +545,49 @@ func (XcxGobalTemplate) TableName() string {
541 545
 	return "xt_gobal_template"
542 546
 }
543 547
 
548
+type GetHisName struct {
549
+	ID   int64  `gorm:"column:id" json:"id" form:"id"`
550
+	Name string `gorm:"column:name" json:"name" form:"name"`
551
+}
552
+
553
+func (GetHisName) TableName() string {
554
+	return "sgj_xt.xt_patients"
555
+}
556
+
557
+type Deposit struct {
558
+	ID           int64           `gorm:"column:id" json:"id" form:"id"`
559
+	UserOrgId    int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`          //机构id
560
+	HisPatientId int64           `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"` //his病人id
561
+	Ctime        int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
562
+	Mtime        int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
563
+	Status       int64           `gorm:"column:status" json:"status" form:"status"`
564
+	Deposit      decimal.Decimal `gorm:"column:deposit" json:"deposit" form:"deposit"` //押金
565
+}
566
+
567
+func (Deposit) TableName() string {
568
+	return "sgj_xt.his_deposit"
569
+}
570
+
571
+type DepositHistory struct {
572
+	ID             int64           `gorm:"column:id" json:"id" form:"id"`
573
+	UserOrgId      int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`          //机构id
574
+	HisPatientId   int64           `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"` //his病人id
575
+	DepositCode    string          `gorm:"column:deposit_code" json:"deposit_code" form:"deposit_code"`
576
+	Deposit        decimal.Decimal `gorm:"column:deposit" json:"deposit" form:"deposit"`                         //本次操作金额
577
+	SurplusDeposit decimal.Decimal `gorm:"column:surplus_deposit" json:"surplus_deposit" form:"surplus_deposit"` //剩余金额
578
+	DepositStatus  int64           `gorm:"column:deposit_status" json:"deposit_status" form:"deposit_status"`    //1:充值,2:扣费,3:退款,4:退费
579
+	Status         int64           `gorm:"column:status" json:"status" form:"status"`
580
+	CreateId       int64           `gorm:"column:create_id" json:"create_id" form:"create_id"`
581
+	Ctime          int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
582
+	Mtime          int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
583
+	TrialStatus    int64           `gorm:"column:trial_status" json:"trial_status" form:"trial_status"` //审核状态0:未审核 ,1:已审核
584
+	Remarks        string          `gorm:"column:remarks" json:"remarks" form:"remarks"`                //备注
585
+}
586
+
587
+func (DepositHistory) TableName() string {
588
+	return "sgj_xt.his_deposit_history"
589
+}
590
+
544 591
 type XcxSchedule struct {
545 592
 	ID           int64 `gorm:"column:id" json:"id" form:"id"`
546 593
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -561,6 +608,28 @@ func (XcxSchedule) TableName() string {
561 608
 	return "xt_schedule"
562 609
 }
563 610
 
611
+type XcxInspectionTwo struct {
612
+	ID                  int64               `gorm:"column:id" json:"id" form:"id"`
613
+	PatientId           int64               `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
614
+	OrgId               int64               `gorm:"column:org_id" json:"org_id" form:"org_id"`
615
+	ProjectId           int64               `gorm:"column:project_id" json:"project_id" form:"project_id"`
616
+	ItemId              int64               `gorm:"column:item_id" json:"item_id" form:"item_id"`
617
+	ItemName            string              `gorm:"column:item_name" json:"item_name" form:"item_name"`
618
+	ProjectName         string              `gorm:"column:project_name" json:"project_name" form:"project_name"`
619
+	InspectType         int64               `gorm:"column:inspect_type" json:"inspect_type" form:"inspect_type"`
620
+	InspectValue        string              `gorm:"column:inspect_value" json:"inspect_value" form:"inspect_value"`
621
+	InspectTips         string              `gorm:"column:inspect_tips" json:"inspect_tips" form:"inspect_tips"`
622
+	InspectDate         int64               `gorm:"column:inspect_date" json:"inspect_date" form:"inspect_date"`
623
+	Status              int64               `gorm:"column:status" json:"status" form:"status"`
624
+	CreatedTime         int64               `gorm:"column:created_time" json:"created_time" form:"created_time"`
625
+	UpdatedTime         int64               `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
626
+	InspectionReference InspectionReference `json:"inspection_reference" gorm:"foreignkey:OrgId,ProjectId,ItemId;AssociationForeignKey:OrgId,ProjectId,ItemId;"`
627
+}
628
+
629
+func (XcxInspectionTwo) TableName() string {
630
+	return "xt_inspection"
631
+}
632
+
564 633
 type XcxInspection struct {
565 634
 	ID           int64            `gorm:"column:id" json:"id" form:"id"`
566 635
 	PatientId    int64            `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`

+ 10 - 8
service/new_sms_service.go Целия файл

@@ -50,12 +50,12 @@ func SendVerificationCodeSMS(mobile string, aespass string) error {
50 50
 		redisClient := RedisClient()
51 51
 		defer redisClient.Close()
52 52
 		cur_date := time.Now().Format("2006-01-02")
53
-		redisClient.Set(redisClient.Context(),"code_msg_"+mobile, code_str, time.Minute*10)
54
-		redisClient.Incr(redisClient.Context(),"code_msg_" + mobile + "_" + cur_date).Result()
53
+		redisClient.Set("code_msg_"+mobile, code_str, time.Minute*10)
54
+		redisClient.Incr("code_msg_" + mobile + "_" + cur_date).Result()
55 55
 		// 取出地址信息,因为上面已经验证过,这里就直接解密而不做错误判断了
56 56
 		bytesPass, _ := base64.StdEncoding.DecodeString(aespass)
57 57
 		tpass := utils.AESDecrypt(bytesPass)
58
-		redisClient.Incr(redisClient.Context(),"ip:host_" + cur_date + "_" + tpass).Result()
58
+		redisClient.Incr("ip:host_" + cur_date + "_" + tpass).Result()
59 59
 	}
60 60
 	return err
61 61
 }
@@ -64,25 +64,27 @@ func newCheckVerificationCodeSMSLimit(aespass string, mobile string) error {
64 64
 	redisClient := RedisClient()
65 65
 	defer redisClient.Close()
66 66
 	bytesPass, err := base64.StdEncoding.DecodeString(aespass)
67
+	utils.TraceLog("bytesPass:%v err:%v", bytesPass, err)
68
+	utils.TraceLog("aespass:%v", aespass)
67 69
 	if err != nil {
68
-		return &SMSServiceError{Err: "缺少关键参数"}
70
+		return &SMSServiceError{Err: "缺少关键参数1"}
69 71
 	}
70 72
 	tpass := utils.AESDecrypt(bytesPass)
71 73
 	if len(tpass) == 0 {
72
-		return &SMSServiceError{Err: "缺少关键参数"}
74
+		return &SMSServiceError{Err: "缺少关键参数2"}
73 75
 	}
74 76
 
75 77
 	cur_date := time.Now().Format("2006-01-02")
76
-	add_redis, err := redisClient.Get(redisClient.Context(),"ip:host_" + cur_date + "_" + tpass).Result()
78
+	add_redis, err := redisClient.Get("ip:host_" + cur_date + "_" + tpass).Result()
77 79
 	if err != nil {
78
-		return &SMSServiceError{Err: "缺少关键参数"}
80
+		return &SMSServiceError{Err: "缺少关键参数3"}
79 81
 	}
80 82
 	ip_max_send_count, _ := beego.AppConfig.Int("ip_max_send_count")
81 83
 	if add_count, _ := strconv.Atoi(add_redis); add_count >= ip_max_send_count {
82 84
 		return &SMSServiceError{Err: "当前IP发送短信超过限制"}
83 85
 	}
84 86
 
85
-	moblie_count, _ := redisClient.Get(redisClient.Context(),"code_msg_" + mobile + "_" + cur_date).Result()
87
+	moblie_count, _ := redisClient.Get("code_msg_" + mobile + "_" + cur_date).Result()
86 88
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
87 89
 	if moblie_max, _ := beego.AppConfig.Int("moblie_max_send_count"); moblie_count_int >= moblie_max {
88 90
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}

+ 1 - 1
service/redis.go Целия файл

@@ -14,7 +14,7 @@ func RedisClient() *redis.Client {
14 14
 		Password: beego.AppConfig.String("redispasswrod"), // no password set
15 15
 		DB:       0,                                       // use default DB
16 16
 	})
17
-	pong, err := client.Ping(client.Context()).Result() 
17
+	pong, err := client.Ping().Result()
18 18
 	fmt.Println(pong, err)
19 19
 	return client
20 20
 }

+ 3 - 3
service/sms_service.go Целия файл

@@ -40,8 +40,8 @@ func SMSSendVerificationCode(mobile string) error {
40 40
 		redisClient := RedisClient()
41 41
 		defer redisClient.Close()
42 42
 		cur_date := time.Now().Format("2006-01-02")
43
-		redisClient.Set(redisClient.Context(),"xt_modify_pwd_"+mobile, code_str, time.Minute*10)
44
-		redisClient.Incr(redisClient.Context(),"xt_modify_pwd_" + mobile + "_" + cur_date).Result()
43
+		redisClient.Set("xt_modify_pwd_"+mobile, code_str, time.Minute*10)
44
+		redisClient.Incr("xt_modify_pwd_" + mobile + "_" + cur_date).Result()
45 45
 	}
46 46
 	return err
47 47
 }
@@ -68,7 +68,7 @@ func checkVerificationCodeSMSLimit(mobile string) error {
68 68
 	defer redisClient.Close()
69 69
 
70 70
 	cur_date := time.Now().Format("2006-01-02")
71
-	moblie_count, _ := redisClient.Get(redisClient.Context(),"xt_modify_pwd_" + mobile + "_" + cur_date).Result()
71
+	moblie_count, _ := redisClient.Get("xt_modify_pwd_" + mobile + "_" + cur_date).Result()
72 72
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
73 73
 	if moblie_max := 5; moblie_count_int >= moblie_max {
74 74
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}

+ 137 - 4
service/xcx_mobile_api_service.go Целия файл

@@ -9,11 +9,21 @@ import (
9 9
 	"errors"
10 10
 	"fmt"
11 11
 	"github.com/jinzhu/gorm"
12
-
12
+	"github.com/shopspring/decimal"
13 13
 	"net/http"
14 14
 	"time"
15 15
 )
16 16
 
17
+// 根据患者id获取该患者当前剩余的押金
18
+func GetUserMoney(id, orgid int64) decimal.Decimal {
19
+	tmp := models.Deposit{}
20
+	err := XTReadDB().Model(&models.Deposit{}).Where("his_patient_id = ? and user_org_id = ? and status = 1", id, orgid).Find(&tmp).Error
21
+	if err != nil {
22
+		return decimal.NewFromFloat(0)
23
+	}
24
+	return tmp.Deposit
25
+}
26
+
17 27
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
18 28
 	role := models.XcxAdminUserRole{}
19 29
 
@@ -28,6 +38,20 @@ func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
28 38
 	return &role, nil
29 39
 }
30 40
 
41
+func GetXcxOpneidInformation(openid string) (*models.XcxAdminUserRole, error) {
42
+	role := models.XcxAdminUserRole{}
43
+
44
+	err := UserReadDB().Model(&role).Where("openid = ? and status = 1", openid).Find(&role).Error
45
+	if err == gorm.ErrRecordNotFound {
46
+		return nil, err
47
+	}
48
+
49
+	if err != nil {
50
+		return nil, err
51
+	}
52
+	return &role, nil
53
+}
54
+
31 55
 func CreateXcxAdminUser(role models.XcxAdminUserRole) error {
32 56
 
33 57
 	err := UserReadDB().Create(&role).Error
@@ -129,20 +153,63 @@ func GetWeekDayOfWeek() (weekMonday string) {
129 153
 	return
130 154
 }
131 155
 
132
-func GetMobilePatient(mobile string, idcard string) (*models.XcxPatients, error) {
156
+// 获取本月的起止时间戳
157
+func GetMonth() (int64, int64) {
158
+	timeNow := time.Now()
159
+	timeToday := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, timeNow.Location()) // 获取当天0点时间 time类型
160
+	timeMonthStartUnix1 := timeToday.AddDate(0, 0, -timeToday.Day()+1).Unix()                              // 获取本月第一天0点 时间戳类型
161
+	timeMonthEndUnix1 := timeToday.AddDate(0, 1, -timeToday.Day()+1).Unix() - 1                            // 获取下个月第一天/ 本月最后一天24点 时间戳类型
162
+	return timeMonthStartUnix1, timeMonthEndUnix1
163
+}
133 164
 
165
+// 押金流水
166
+func GetFlowList(patient_id, orgid, stime, etime int64) (deposit []models.DepositHistory, err error) {
167
+	err = XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and trial_status = 1 and user_org_id = ? and his_patient_id = ? and mtime >= ? and mtime <= ?", orgid, patient_id, stime, etime).Order("mtime desc").Find(&deposit).Error
168
+	return
169
+}
170
+
171
+// 获取his中的有效患者
172
+func GetHisUserName(orgid, id int64) (hisname models.GetHisName, err error) {
173
+	err = XTReadDB().Model(&models.GetHisName{}).Where("status = 1 and user_org_id = ? and id = ?", orgid, id).Find(&hisname).Error
174
+	return
175
+}
176
+
177
+func GetPatientByIdXcx(patient_id int64) (*models.XcxPatients, error) {
178
+	patient := models.XcxPatients{}
179
+	err := XTReadDB().Model(&patient).Where("id =? and status = 1", patient_id).Find(&patient).Error
180
+	if err == gorm.ErrRecordNotFound {
181
+		return nil, err
182
+	}
183
+	if err != nil {
184
+		return nil, err
185
+	}
186
+	return &patient, nil
187
+}
188
+
189
+func GetMobilePatient(mobile string, idcard string) (*models.XcxPatients, error) {
134 190
 	patient := models.XcxPatients{}
135 191
 	err := XTReadDB().Model(&patient).Where("(phone = ? or relative_phone =?) and id_card_no =?", mobile, mobile, idcard).Find(&patient).Error
136 192
 	//err := XTReadDB().Model(&patient).Where("id_card_no = ? and status = 1", mobile).Find(&patient).Error
137 193
 	if err == gorm.ErrRecordNotFound {
138 194
 		return nil, err
139 195
 	}
140
-
141 196
 	if err != nil {
142 197
 		return nil, err
143 198
 	}
144 199
 	return &patient, nil
200
+}
145 201
 
202
+func GetPatientByIdcardno(idcard string) (*models.XcxPatients, error) {
203
+	patient := models.XcxPatients{}
204
+	err := XTReadDB().Model(&patient).Where("id_card_no =?", idcard).Find(&patient).Error
205
+	//err := XTReadDB().Model(&patient).Where("id_card_no = ? and status = 1", mobile).Find(&patient).Error
206
+	if err == gorm.ErrRecordNotFound {
207
+		return nil, err
208
+	}
209
+	if err != nil {
210
+		return nil, err
211
+	}
212
+	return &patient, nil
146 213
 }
147 214
 
148 215
 func GetNamePatient(name string, idcard string) (*models.XcxPatients, error) {
@@ -220,7 +287,7 @@ func AesCBCDncrypt(encryptData, key, iv []byte) ([]byte, error) {
220 287
 	return encryptData, nil
221 288
 }
222 289
 
223
-//去除填充
290
+// 去除填充
224 291
 func PKCS7UnPadding(origData []byte) []byte {
225 292
 	length := len(origData)
226 293
 	unpadding := int(origData[length-1])
@@ -232,6 +299,50 @@ func PKCS7UnPadding(origData []byte) []byte {
232 299
 	return origData[:(length - unpadding)]
233 300
 }
234 301
 
302
+func GetScheduleByXcx(orgID, start, end, patientID int64) (schedule []*models.ScheduleXcx, err error) {
303
+	err = readDb.Model(&models.ScheduleXcx{}).Where("user_org_id=? and patient_id=? and schedule_date>=? and schedule_date<=? and status=1", orgID, patientID, start, end).Find(&schedule).Error
304
+	return
305
+}
306
+
307
+func GetSignsByBlood(orgID, start, end, patientID int64) (schedule []*models.PredialysisEvaluationThree, err error) {
308
+	err = readDb.Model(&models.PredialysisEvaluationThree{}).Where("user_org_id=? and patient_id=? and assessment_date>=? and assessment_date<=? and status=1", orgID, patientID, start, end).Find(&schedule).Error
309
+	return
310
+}
311
+
312
+func GetSignsByWeight(orgID, start, end, patientID int64) (schedule []*models.PredialysisEvaluationOne, err error) {
313
+	err = readDb.Model(&models.PredialysisEvaluationOne{}).Where("user_org_id=? and patient_id=? and assessment_date>=? and assessment_date<=? and status=1", orgID, patientID, start, end).Find(&schedule).Error
314
+	return
315
+}
316
+
317
+func GetSignsByDryWeight(orgID, start, end, patientID int64) (schedule []*models.PredialysisEvaluationTwo, err error) {
318
+	err = readDb.Model(&models.PredialysisEvaluationTwo{}).Where("user_org_id=? and patient_id=? and assessment_date>=? and assessment_date<=? and status=1", orgID, patientID, start, end).Find(&schedule).Error
319
+	return
320
+}
321
+
322
+func GetSignsByAfterWeight(orgID, start, end, patientID int64) (record []*models.AssessmentAfterDislysisOne, err error) {
323
+	err = readDb.Model(&models.AssessmentAfterDislysisOne{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date >=?  and assessment_date <=?", patientID, orgID, start, end).Find(&record).Error
324
+	if err != nil {
325
+		if err == gorm.ErrRecordNotFound {
326
+			return nil, nil
327
+		} else {
328
+			return nil, err
329
+		}
330
+	}
331
+	return
332
+}
333
+
334
+func GetSignsByAfterBlood(orgID, start, end, patientID int64) (record []*models.AssessmentAfterDislysisTwo, err error) {
335
+	err = readDb.Model(&models.AssessmentAfterDislysisTwo{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date >=?  and assessment_date <=?", patientID, orgID, start, end).Find(&record).Error
336
+	if err != nil {
337
+		if err == gorm.ErrRecordNotFound {
338
+			return nil, nil
339
+		} else {
340
+			return nil, err
341
+		}
342
+	}
343
+	return
344
+}
345
+
235 346
 func GetScheduleInfo(startime int64, endtime int64, patient_id int64) (schedule []*models.VmBloodSchedule, err error) {
236 347
 
237 348
 	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
@@ -598,6 +709,28 @@ func GetLastScheduleListOne(patient_id int64, schedule_date int64) (models.XcxSc
598 709
 	return schedule, err
599 710
 }
600 711
 
712
+func GetInspectionGroupListByXcx(patientid int64, page int64, number int64) (inspection []*models.XcxInspectionTwo, err error) {
713
+
714
+	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
715
+	if patientid > 0 {
716
+		db = db.Where("x.patient_id = ?", patientid)
717
+	}
718
+	offset := (page - 1) * number
719
+	//if startime > 0 {
720
+	//	db = db.Where("x.inspect_date >= ?", startime)
721
+	//}
722
+	//if endtime > 0 {
723
+	//	db = db.Where("x.inspect_date <= ?", endtime)
724
+	//}
725
+	err = db.Group("x.inspect_date,x.project_id").Order("x.created_time").Offset(offset).Limit(number).Scan(&inspection).Error
726
+	return inspection, err
727
+}
728
+
729
+func GetInspectionInfoByXcx(patientid int64, project_id int64, inspect_date int64) (inspection []*models.XcxInspectionTwo, err error) {
730
+	err = XTReadDB().Model(&inspection).Where("(patient_id = ? and project_id = ? and inspect_date=?) and status = 1", patientid, project_id, inspect_date).Preload("InspectionReference", "status = 1").Find(&inspection).Error
731
+	return inspection, err
732
+}
733
+
601 734
 func GetInspectionGroupList(patientid int64, startime int64, endtime int64) (inspection []*models.XcxInspection, err error) {
602 735
 
603 736
 	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")