张保健 4 months ago
parent
commit
e062a6ab57
32 changed files with 904 additions and 293 deletions
  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 View File

1
-# Default ignored files
2
-/workspace.xml

+ 0 - 6
.idea/misc.xml View File

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 View File

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

+ 2 - 2
conf/app.conf View File

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

+ 4 - 4
controllers/dialysis_api_controller.go View File

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

+ 4 - 4
controllers/dialysis_record_api_controller.go View File

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

+ 3 - 3
controllers/mobile_api_controllers/check_weight_api_controller.go View File

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

+ 33 - 33
controllers/mobile_api_controllers/dialysis_api_controller.go View File

88
 
88
 
89
 	// cur_date := time.Now().Format("2006-01-02")
89
 	// cur_date := time.Now().Format("2006-01-02")
90
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
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
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
102
 				//缓存数据
102
 				//缓存数据
103
 				scheduals_json, err := json.Marshal(scheduals)
103
 				scheduals_json, err := json.Marshal(scheduals)
104
 				if err == nil {
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
 	// cur_date := time.Now().Format("2006-01-02")
148
 	// cur_date := time.Now().Format("2006-01-02")
149
 	key := "wait_scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
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
 	if len(wait_scheduals) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
153
 	if len(wait_scheduals) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
154
 		scheduals, err := service.MobileGetWaitingScheduals(orgID, date.Unix())
154
 		scheduals, err := service.MobileGetWaitingScheduals(orgID, date.Unix())
165
 				//缓存数据
165
 				//缓存数据
166
 				wait_scheduals_json, err := json.Marshal(scheduals)
166
 				wait_scheduals_json, err := json.Marshal(scheduals)
167
 				if err == nil {
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
 	weightReduce, _ := c.GetFloat("weight_loss", 0)
795
 	weightReduce, _ := c.GetFloat("weight_loss", 0)
796
 	temperature, _ := c.GetFloat("temperature", 0)
796
 	temperature, _ := c.GetFloat("temperature", 0)
797
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
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
 	systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0)
799
 	systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0)
800
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
800
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
801
 	actual_ultrafiltration, _ := c.GetFloat("actual_ultrafiltration", 0)
801
 	actual_ultrafiltration, _ := c.GetFloat("actual_ultrafiltration", 0)
808
 	catheter := c.GetString("catheter")
808
 	catheter := c.GetString("catheter")
809
 	complications := c.GetString("complication")
809
 	complications := c.GetString("complication")
810
 	remark := c.GetString("remark")
810
 	remark := c.GetString("remark")
811
-	dialysateVolume, _ := c.GetInt64("dialysis_intakes", 0)
811
+	//dialysateVolume, _ := c.GetInt64("dialysis_intakes", 0)
812
 
812
 
813
 	dialysis_intakes_unit, _ := c.GetInt64("dialysis_intakes_unit", 0)
813
 	dialysis_intakes_unit, _ := c.GetInt64("dialysis_intakes_unit", 0)
814
 
814
 
893
 	//_, evaluation := service.FindPredialysisEvaluationByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
893
 	//_, evaluation := service.FindPredialysisEvaluationByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
894
 
894
 
895
 	assessmentAfterDislysis := models.AssessmentAfterDislysis{
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
 		CreatedTime:                  time.Now().Unix(),
917
 		CreatedTime:                  time.Now().Unix(),
918
 		Status:                       1,
918
 		Status:                       1,
919
 		Remark:                       remark,
919
 		Remark:                       remark,
1486
 
1486
 
1487
 		tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
1487
 		tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
1488
 		tempassessmentAfterDislysis.PulseFrequency = endmonitorRecords.PulseFrequency
1488
 		tempassessmentAfterDislysis.PulseFrequency = endmonitorRecords.PulseFrequency
1489
-		tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
1489
+		// tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
1490
 		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
1490
 		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
1491
 		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
1491
 		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
1492
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
1492
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
1943
 		if errcode == nil {
1943
 		if errcode == nil {
1944
 			record.SystolicBloodPressure = befor.SystolicBloodPressure
1944
 			record.SystolicBloodPressure = befor.SystolicBloodPressure
1945
 			record.DiastolicBloodPressure = befor.DiastolicBloodPressure
1945
 			record.DiastolicBloodPressure = befor.DiastolicBloodPressure
1946
-			record.BreathingRate = befor.BreathingRate
1946
+			// record.BreathingRate = befor.BreathingRate
1947
 			record.PulseFrequency = befor.PulseFrequency
1947
 			record.PulseFrequency = befor.PulseFrequency
1948
 			record.Temperature = befor.Temperature
1948
 			record.Temperature = befor.Temperature
1949
 		}
1949
 		}
3293
 		//缓存数据
3293
 		//缓存数据
3294
 		scheduals_json, err := json.Marshal(scheduals)
3294
 		scheduals_json, err := json.Marshal(scheduals)
3295
 		if err == nil {
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
 	this.ServeSuccessJSON(map[string]interface{}{
3299
 	this.ServeSuccessJSON(map[string]interface{}{
4550
 	return
4550
 	return
4551
 }
4551
 }
4552
 
4552
 
4553
-//当前数据比上一次出库数据少
4553
+// 当前数据比上一次出库数据少
4554
 func ConsumablesDeliveryTotalSeven(orgID int64, patient_id int64, record_time int64, goods []*models.DialysisBeforePrepareGoods, creater int64, count int64) (err error) {
4554
 func ConsumablesDeliveryTotalSeven(orgID int64, patient_id int64, record_time int64, goods []*models.DialysisBeforePrepareGoods, creater int64, count int64) (err error) {
4555
 
4555
 
4556
 	fmt.Println("w我的中国馆公共区发电房阿道夫安抚安抚安抚安抚安抚安抚阿道夫阿道夫阿凡达阿道夫a", count)
4556
 	fmt.Println("w我的中国馆公共区发电房阿道夫安抚安抚安抚安抚安抚安抚阿道夫阿道夫阿凡达阿道夫a", count)
4605
 	return nil
4605
 	return nil
4606
 }
4606
 }
4607
 
4607
 
4608
-//耗材出库删除
4608
+// 耗材出库删除
4609
 func ConsumablesDeliveryDeleteFour(orgID int64, record_time int64, good_yc *models.BloodAutomaticReduceDetail, warehouseOut *models.WarehouseOut, patient_id int64, creater int64, count int64) (err error) {
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
 	fmt.Println("count2323223884584854854854u5454785487547845785478758487545475475487,count", count)
4611
 	fmt.Println("count2323223884584854854854u5454785487547845785478758487545475475487,count", count)
4929
 	return nil
4929
 	return nil
4930
 }
4930
 }
4931
 
4931
 
4932
-//耗材出库删除
4932
+// 耗材出库删除
4933
 func ConsumablesDeliveryDeleteThree(orgID int64, record_time int64, good_yc *models.BloodAutomaticReduceDetail, warehouseOut *models.WarehouseOut) (err error) {
4933
 func ConsumablesDeliveryDeleteThree(orgID int64, record_time int64, good_yc *models.BloodAutomaticReduceDetail, warehouseOut *models.WarehouseOut) (err error) {
4934
 	// 先根据相关信息查询当天该耗材的出库信息
4934
 	// 先根据相关信息查询当天该耗材的出库信息
4935
 	warehouseOutInfos, err := service.FindStockOutInfoByStockOne(orgID, good_yc.GoodTypeId, good_yc.GoodId, record_time)
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 View File

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

+ 2 - 2
controllers/mobile_api_controllers/mobile_api_base_controller.go View File

125
 
125
 
126
 			//redis key值
126
 			//redis key值
127
 			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
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
 			var userRolePurviews string
130
 			var userRolePurviews string
131
 			var userRolePurviewsArr []string
131
 			var userRolePurviewsArr []string
149
 				//缓存数据
149
 				//缓存数据
150
 				purview_json, err := json.Marshal(userRolePurviewsArr)
150
 				purview_json, err := json.Marshal(userRolePurviewsArr)
151
 				if err == nil {
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
 			} else {
154
 			} else {
155
 				var dat []string
155
 				var dat []string

+ 1 - 1
controllers/mobile_api_controllers/qiniiu_api_controller.go View File

14
 	redisClient := service.RedisClient()
14
 	redisClient := service.RedisClient()
15
 	defer redisClient.Close()
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
 	if err != nil {
18
 	if err != nil {
19
 		defer fmt.Println(err)
19
 		defer fmt.Println(err)
20
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)
20
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)

+ 2 - 2
controllers/new_mobile_api_controllers/forget_password_controller.go View File

40
 		// 修改成功后验证码就要使其失效
40
 		// 修改成功后验证码就要使其失效
41
 		redisClient := service.RedisClient()
41
 		redisClient := service.RedisClient()
42
 		defer redisClient.Close()
42
 		defer redisClient.Close()
43
-		redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
43
+		redisClient.Del("code_msg_" + mobile)
44
 
44
 
45
 		ip := utils.GetIP(this.Ctx.Request)
45
 		ip := utils.GetIP(this.Ctx.Request)
46
 		ssoDomain := beego.AppConfig.String("sso_domain")
46
 		ssoDomain := beego.AppConfig.String("sso_domain")
252
 	}
252
 	}
253
 	redisClient := service.RedisClient()
253
 	redisClient := service.RedisClient()
254
 	defer redisClient.Close()
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
 	if cache_code != code {
256
 	if cache_code != code {
257
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
257
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
258
 	}
258
 	}

+ 2 - 2
controllers/new_mobile_api_controllers/home_api_controller.go View File

634
 		// 修改成功后验证码就要使其失效
634
 		// 修改成功后验证码就要使其失效
635
 		redisClient := service.RedisClient()
635
 		redisClient := service.RedisClient()
636
 		defer redisClient.Close()
636
 		defer redisClient.Close()
637
-		redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
637
+		redisClient.Del("code_msg_" + mobile)
638
 		this.ServeSuccessJSON(map[string]interface{}{
638
 		this.ServeSuccessJSON(map[string]interface{}{
639
 			"admin": adminUser,
639
 			"admin": adminUser,
640
 		})
640
 		})
657
 	}
657
 	}
658
 	redisClient := service.RedisClient()
658
 	redisClient := service.RedisClient()
659
 	defer redisClient.Close()
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
 	if cache_code != code {
661
 	if cache_code != code {
662
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
662
 		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
663
 	}
663
 	}

+ 2 - 2
controllers/new_mobile_api_controllers/mobile_regist_controller.go View File

74
 
74
 
75
 		redisClient := service.RedisClient()
75
 		redisClient := service.RedisClient()
76
 		defer redisClient.Close()
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
 		if cache_code != code {
78
 		if cache_code != code {
79
 			//this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
79
 			//this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
80
 			//this.ServeJSON()
80
 			//this.ServeJSON()
90
 			this.Ctx.SetCookie("mobile", mobile)
90
 			this.Ctx.SetCookie("mobile", mobile)
91
 			this.SetSession("mobile_admin_user", admin)
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
 			this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
95
 			this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
96
 				"result": true,
96
 				"result": true,

+ 2 - 2
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

20
 	req := this.Ctx.Request
20
 	req := this.Ctx.Request
21
 	addr := utils.GetIP(req)
21
 	addr := utils.GetIP(req)
22
 	cur_time := time.Now().Format("2006-01-02")
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
 	if err != nil {
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
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
27
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
28
 	aespass := utils.AESEncrypt(addr)
28
 	aespass := utils.AESEncrypt(addr)

+ 4 - 4
controllers/new_mobile_api_controllers/new_login_api_controller.go View File

136
 	req := this.Ctx.Request
136
 	req := this.Ctx.Request
137
 	addr := utils.GetIP(req)
137
 	addr := utils.GetIP(req)
138
 	cur_time := time.Now().Format("2006-01-02")
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
 	if err != nil {
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
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
143
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
144
 	aespass := utils.AESEncrypt(addr)
144
 	aespass := utils.AESEncrypt(addr)
378
 
378
 
379
 		redisClient := service.RedisClient()
379
 		redisClient := service.RedisClient()
380
 		defer redisClient.Close()
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
 		if err != nil {
383
 		if err != nil {
384
 			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
384
 			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
486
 						TemplateInfo: &templateInfo,
486
 						TemplateInfo: &templateInfo,
487
 					}
487
 					}
488
 					this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
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
 					mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
491
 					mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
492
 					token := utils.GenerateLoginToken(mobile)
492
 					token := utils.GenerateLoginToken(mobile)

+ 1 - 1
controllers/new_mobile_api_controllers/new_role_api_controller.go View File

568
 	users := service.GetAllUserRole(adminUser.Org.Id)
568
 	users := service.GetAllUserRole(adminUser.Org.Id)
569
 	for _, item := range users {
569
 	for _, item := range users {
570
 		key := "purviews_" + strconv.FormatInt(adminUser.Org.Id, 10) + strconv.FormatInt(item.AdminUserId, 10)
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
 	if err != nil {
574
 	if err != nil {

+ 8 - 8
controllers/patient_api_controller.go View File

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

+ 1 - 1
controllers/qiniiu_api_controller.go View File

21
 	redisClient := service.RedisClient()
21
 	redisClient := service.RedisClient()
22
 	defer redisClient.Close()
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
 	fmt.Print("token------------------------------------", token)
25
 	fmt.Print("token------------------------------------", token)
26
 	if err != nil {
26
 	if err != nil {
27
 		defer fmt.Println(err)
27
 		defer fmt.Println(err)

+ 3 - 3
controllers/role_controller.go View File

750
 	users := service.GetAllUserRole(adminUserInfo.CurrentOrgId)
750
 	users := service.GetAllUserRole(adminUserInfo.CurrentOrgId)
751
 	for _, item := range users {
751
 	for _, item := range users {
752
 		key := "purviews_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + strconv.FormatInt(item.AdminUserId, 10)
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
 	err := service.SaveRolePurviewIds(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, roleId, purviewIds)
756
 	err := service.SaveRolePurviewIds(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, roleId, purviewIds)
898
 
898
 
899
 	redisClient := service.RedisClient()
899
 	redisClient := service.RedisClient()
900
 	defer redisClient.Close()
900
 	defer redisClient.Close()
901
-	qntoken, _ := redisClient.Get(redisClient.Context(),"qn_token").Result()
901
+	qntoken, _ := redisClient.Get("qn_token").Result()
902
 
902
 
903
 	this.ServeSuccessJSON(map[string]interface{}{
903
 	this.ServeSuccessJSON(map[string]interface{}{
904
 		"roles":           roles,
904
 		"roles":           roles,
1108
 
1108
 
1109
 	redisClient := service.RedisClient()
1109
 	redisClient := service.RedisClient()
1110
 	defer redisClient.Close()
1110
 	defer redisClient.Close()
1111
-	qntoken, _ := redisClient.Get(redisClient.Context(),"qn_token").Result()
1111
+	qntoken, _ := redisClient.Get("qn_token").Result()
1112
 
1112
 
1113
 	this.ServeSuccessJSON(map[string]interface{}{
1113
 	this.ServeSuccessJSON(map[string]interface{}{
1114
 		"admin":           appRole,
1114
 		"admin":           appRole,

+ 1 - 1
controllers/schedule_api_controller.go View File

370
 	err = service.CreateSchedule(&schedule)
370
 	err = service.CreateSchedule(&schedule)
371
 
371
 
372
 	key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
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
 	fmt.Println(err)
375
 	fmt.Println(err)
376
 	if err != nil {
376
 	if err != nil {

+ 6 - 6
controllers/sign_weigh_api_controller.go View File

383
 	dry_weight, _ := c.GetFloat("dry_weight", 0)
383
 	dry_weight, _ := c.GetFloat("dry_weight", 0)
384
 	temperature, _ := c.GetFloat("temperature", 0)
384
 	temperature, _ := c.GetFloat("temperature", 0)
385
 	pulse_frequency, _ := c.GetFloat("pulse_frequency", 0)
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
 	systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0)
387
 	systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0)
388
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
388
 	diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0)
389
 
389
 
390
 	assessmentafterdislysis := &models.AssessmentAfterDislysis{
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
 		SystolicBloodPressure:  systolic_blood_pressure,
396
 		SystolicBloodPressure:  systolic_blood_pressure,
397
 		DiastolicBloodPressure: diastolic_blood_pressure,
397
 		DiastolicBloodPressure: diastolic_blood_pressure,
398
 	}
398
 	}

+ 2 - 2
controllers/verify_login_controller.go View File

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

+ 473 - 161
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go View File

9
 	"fmt"
9
 	"fmt"
10
 	"github.com/astaxie/beego"
10
 	"github.com/astaxie/beego"
11
 	"github.com/jinzhu/gorm"
11
 	"github.com/jinzhu/gorm"
12
+	"github.com/shopspring/decimal"
12
 	"strconv"
13
 	"strconv"
13
 	"time"
14
 	"time"
14
 )
15
 )
17
 	////传送codeinit
18
 	////传送codeinit
18
 	beego.Router("/xcx/m/api/code", &XcxApiController{}, "Get:GetCodeInit")
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
 	beego.Router("/xcx/api/mobile/register", &XcxApiController{}, "Get:GetUserNameRegister")
23
 	beego.Router("/xcx/api/mobile/register", &XcxApiController{}, "Get:GetUserNameRegister")
23
-	//登录
24
+	//手机号登录
24
 	beego.Router("/xcx/api/mobile/login", &XcxApiController{}, "Get:GetLoginInfor")
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
 	beego.Router("/xcx/api/mobile/patient", &XcxApiController{}, "Get:GetPatientList")
31
 	beego.Router("/xcx/api/mobile/patient", &XcxApiController{}, "Get:GetPatientList")
28
 
32
 
29
 	//获取登录后的信息
33
 	//获取登录后的信息
30
 	beego.Router("/xcx/api/mobile/getdatainfo", &XcxApiController{}, "Get:GetDataInfo")
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
 	beego.Router("/xcx/api/mobile/schedule", &XcxApiController{}, "Get:GetScheduleInfo")
40
 	beego.Router("/xcx/api/mobile/schedule", &XcxApiController{}, "Get:GetScheduleInfo")
34
 
41
 
35
 	//获取透析记录
42
 	//获取透析记录
36
 	beego.Router("/xcx/api/mobile/dialysis", &XcxApiController{}, "Get:GetMobileSchedule")
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
 	beego.Router("/xcx/api/mobile/getpatientinfo", &XcxApiController{}, "Get:GetPatientInfo")
52
 	beego.Router("/xcx/api/mobile/getpatientinfo", &XcxApiController{}, "Get:GetPatientInfo")
40
 
53
 
56
 	//获取数据字典数据
69
 	//获取数据字典数据
57
 	beego.Router("/xcx/api/mobile/getdataconfig", &XcxApiController{}, "Get:GetDataConfig")
70
 	beego.Router("/xcx/api/mobile/getdataconfig", &XcxApiController{}, "Get:GetDataConfig")
58
 
71
 
59
-	//检验检查
72
+	//检验检查列表
60
 	beego.Router("/xcx/api/mobile/getinspectionlist", &XcxApiController{}, "Get:GetInspectionList")
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
 	beego.Router("/xcx/api/mobile/getarticlist", &XcxApiController{}, "Get:GetArticList")
79
 	beego.Router("/xcx/api/mobile/getarticlist", &XcxApiController{}, "Get:GetArticList")
64
 
80
 
68
 
84
 
69
 	//获取appid
85
 	//获取appid
70
 	beego.Router("/xcx/api/mobile/getappid", &XcxApiController{}, "Get:GetAppId")
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
 type XcxApiController struct {
95
 type XcxApiController struct {
74
 	mobile_api_controllers.MobileBaseAPIController
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
 func (this *XcxApiController) GetCodeInit() {
176
 func (this *XcxApiController) GetCodeInit() {
78
 	redisClient := service.RedisClient()
177
 	redisClient := service.RedisClient()
79
 	defer redisClient.Close()
178
 	defer redisClient.Close()
80
 	req := this.Ctx.Request
179
 	req := this.Ctx.Request
81
 	addr := utils.GetIP(req)
180
 	addr := utils.GetIP(req)
82
 	cur_time := time.Now().Format("2006-01-02")
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
 	if err != nil {
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
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
186
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
88
 	aespass := utils.AESEncrypt(addr)
187
 	aespass := utils.AESEncrypt(addr)
89
 
188
 
90
-	fmt.Println("hhhhhhh3223323232332", aespass)
91
 	this.ServeSuccessJSON(map[string]interface{}{
189
 	this.ServeSuccessJSON(map[string]interface{}{
92
 		"aespass": aespass,
190
 		"aespass": aespass,
93
 	})
191
 	})
95
 }
193
 }
96
 
194
 
97
 func (this *XcxApiController) GetUserNameRegister() {
195
 func (this *XcxApiController) GetUserNameRegister() {
98
-	name := this.GetString("name")
196
+	// name := this.GetString("name")
197
+	// relationship := this.GetString("relationship")
99
 	id_card_no := this.GetString("id_card_no")
198
 	id_card_no := this.GetString("id_card_no")
100
 	mobile := this.GetString("mobile")
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
 	if errcodes == nil {
225
 	if errcodes == nil {
103
 		role := models.XcxAdminUserRole{
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
 		err := service.CreateXcxAdminUser(role)
242
 		err := service.CreateXcxAdminUser(role)
118
 		if err == nil {
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
 			this.ServeSuccessJSON(map[string]interface{}{
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
 		} else {
285
 		} else {
159
 			this.ServeSuccessJSON(map[string]interface{}{
286
 			this.ServeSuccessJSON(map[string]interface{}{
165
 	} else {
292
 	} else {
166
 		this.ServeSuccessJSON(map[string]interface{}{
293
 		this.ServeSuccessJSON(map[string]interface{}{
167
 			"is_bind": false,
294
 			"is_bind": false,
168
-			"msg":     "绑定失败",
295
+			"msg":     "绑定失败,没有对应的患者信息",
169
 			"result":  false,
296
 			"result":  false,
170
 		})
297
 		})
171
 	}
298
 	}
307
 	} else {
434
 	} else {
308
 		redisClient := service.RedisClient()
435
 		redisClient := service.RedisClient()
309
 		defer redisClient.Close()
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
 		fmt.Println("cache_code9999999293323232322323", cache_code)
438
 		fmt.Println("cache_code9999999293323232322323", cache_code)
312
 		if cache_code != code {
439
 		if cache_code != code {
313
 			this.ServeSuccessJSON(map[string]interface{}{
440
 			this.ServeSuccessJSON(map[string]interface{}{
317
 		} else {
444
 		} else {
318
 			this.Ctx.SetCookie("mobile", mobile)
445
 			this.Ctx.SetCookie("mobile", mobile)
319
 			// 注册成功后验证码就要使其失效
446
 			// 注册成功后验证码就要使其失效
320
-			redisClient.Del(redisClient.Context(),"code_msg_" + mobile)
447
+			redisClient.Del("code_msg_" + mobile)
321
 			patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
448
 			patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
322
 			fmt.Println("errcodes2323232232", errcodes)
449
 			fmt.Println("errcodes2323232232", errcodes)
323
 			if errcodes == nil {
450
 			if errcodes == nil {
445
 
572
 
446
 	mobile := this.GetString("phone")
573
 	mobile := this.GetString("phone")
447
 	aespass := this.GetString("aespass")
574
 	aespass := this.GetString("aespass")
575
+
448
 	utils.TraceLog("mobile:%v aespass:%v", mobile, aespass)
576
 	utils.TraceLog("mobile:%v aespass:%v", mobile, aespass)
577
+
449
 	if utils.CellPhoneRegexp().MatchString(mobile) == false {
578
 	if utils.CellPhoneRegexp().MatchString(mobile) == false {
450
 		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeMobileFormat)
579
 		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeMobileFormat)
451
 		this.ServeJSON()
580
 		this.ServeJSON()
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
 	mobile := this.GetString("mobile")
622
 	mobile := this.GetString("mobile")
472
-	fmt.Println(mobile)
473
 	user_admin, errcodes := service.GetXcxMobileInformation(mobile)
623
 	user_admin, errcodes := service.GetXcxMobileInformation(mobile)
474
 	if errcodes == gorm.ErrRecordNotFound {
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
 		this.ServeSuccessJSON(map[string]interface{}{
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
 	} else if errcodes == nil {
632
 	} else if errcodes == nil {
514
 		info, _ := service.GetPatientListByPatientId(user_admin.PatientId)
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
 		this.ServeSuccessJSON(map[string]interface{}{
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
 func (this *XcxApiController) GetPatientList() {
644
 func (this *XcxApiController) GetPatientList() {
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
 func (this *XcxApiController) GetScheduleInfo() {
892
 func (this *XcxApiController) GetScheduleInfo() {
893
+
596
 	patient_id, _ := this.GetInt64("patient_id")
894
 	patient_id, _ := this.GetInt64("patient_id")
597
 	fmt.Println(patient_id)
895
 	fmt.Println(patient_id)
598
 	thisWeekMonday := service.GetFirstDateOfWeek()
896
 	thisWeekMonday := service.GetFirstDateOfWeek()
633
 		return
931
 		return
634
 	}
932
 	}
635
 
933
 
636
-	var one = startTime.Unix() + 86400
934
+	var one = startTime.Unix()
637
 	fmt.Println("one2322332", one)
935
 	fmt.Println("one2322332", one)
638
 	var two = one + 86400
936
 	var two = one + 86400
639
 	var three = two + 86400
937
 	var three = two + 86400
658
 	var lastsix = lastfive + 86400
956
 	var lastsix = lastfive + 86400
659
 	var lastseven = lastsix + 86400
957
 	var lastseven = lastsix + 86400
660
 
958
 
661
-	fmt.Println("各地好当家232332323232", lastseven)
662
 	array := []interface{}{
959
 	array := []interface{}{
663
 		map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
960
 		map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
664
 		map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
961
 		map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
738
 func (this *XcxApiController) GetMobileSchedule() {
1035
 func (this *XcxApiController) GetMobileSchedule() {
739
 
1036
 
740
 	patientID, _ := this.GetInt64("patient_id")
1037
 	patientID, _ := this.GetInt64("patient_id")
741
-	fmt.Println("1", patientID)
742
 	info, _ := service.GetXcxPatientInfo(patientID)
1038
 	info, _ := service.GetXcxPatientInfo(patientID)
743
 	timeLayout := "2006-01-02"
1039
 	timeLayout := "2006-01-02"
744
 	loc, _ := time.LoadLocation("Local")
1040
 	loc, _ := time.LoadLocation("Local")
745
 	time_now := time.Now().Format("2006-01-02")
1041
 	time_now := time.Now().Format("2006-01-02")
746
 	timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
1042
 	timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
747
-
748
-	fmt.Println("timeNowUnix", timeNowUnix.Unix())
749
 	//获取该患者最后一次排班
1043
 	//获取该患者最后一次排班
750
 	list, _ := service.GetLastScheduleListOne(patientID, timeNowUnix.Unix())
1044
 	list, _ := service.GetLastScheduleListOne(patientID, timeNowUnix.Unix())
751
-	fmt.Println("hh2332323232323223", list)
752
-	fmt.Println("list233232232332", list.ScheduleDate)
1045
+
753
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
1046
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
754
 	if getPatientErr != nil {
1047
 	if getPatientErr != nil {
755
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
1048
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
968
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1261
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
969
 	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
1262
 	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
970
 	info, _ := service.GetXcxPatientInfo(patient_id)
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
 		list, _ := service.GetDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
1267
 		list, _ := service.GetDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
975
 		advice, _ := service.GetDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
1268
 		advice, _ := service.GetDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
976
 		for _, item := range list {
1269
 		for _, item := range list {
986
 		})
1279
 		})
987
 	}
1280
 	}
988
 
1281
 
989
-	if config.IsOpenRemind == 1 {
1282
+	if config.IsOpen == 1 {
990
 		list, _ := service.GetHisDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
1283
 		list, _ := service.GetHisDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
991
 		advice, _ := service.GetHisDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
1284
 		advice, _ := service.GetHisDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
992
 		for _, item := range list {
1285
 		for _, item := range list {
1064
 
1357
 
1065
 func (this *XcxApiController) GetInspectionList() {
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
 	this.ServeSuccessJSON(map[string]interface{}{
1400
 	this.ServeSuccessJSON(map[string]interface{}{
1089
 		"list": list,
1401
 		"list": list,
1090
 	})
1402
 	})

+ 36 - 0
go.mod View File

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 View File

234
 	return "xt_schedule"
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
 type PredialysisEvaluation struct {
265
 type PredialysisEvaluation struct {
238
 	ID                          int64   `gorm:"column:id" json:"id"`
266
 	ID                          int64   `gorm:"column:id" json:"id"`
239
 	UserOrgId                   int64   `gorm:"column:user_org_id" json:"user_org_id"`
267
 	UserOrgId                   int64   `gorm:"column:user_org_id" json:"user_org_id"`
287
 	DuctusArantii                  string  `gorm:"column:ductus_arantii" json:"ductus_arantii"`
315
 	DuctusArantii                  string  `gorm:"column:ductus_arantii" json:"ductus_arantii"`
288
 	EmergencyTreatment             int64   `gorm:"column:emergency_treatment" json:"emergency_treatment"`
316
 	EmergencyTreatment             int64   `gorm:"column:emergency_treatment" json:"emergency_treatment"`
289
 	EmergencyTreatmentOther        string  `gorm:"column:emergency_treatment_other" json:"emergency_treatment_other"`
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
 	AssessmentDoctor               int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
319
 	AssessmentDoctor               int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
292
 	AssessmentTime                 int64   `gorm:"column:assessment_time" json:"assessment_time"`
320
 	AssessmentTime                 int64   `gorm:"column:assessment_time" json:"assessment_time"`
293
 	MachineType                    string  `gorm:"column:machine_type" json:"machine_type"`
321
 	MachineType                    string  `gorm:"column:machine_type" json:"machine_type"`
301
 	LastPostDialysisOther          string  `gorm:"column:last_post_dialysis_other" json:"last_post_dialysis_other"`
329
 	LastPostDialysisOther          string  `gorm:"column:last_post_dialysis_other" json:"last_post_dialysis_other"`
302
 	SymptomBeforeDialysisOther     string  `gorm:"column:symptom_before_dialysis_other" json:"symptom_before_dialysis_other"`
330
 	SymptomBeforeDialysisOther     string  `gorm:"column:symptom_before_dialysis_other" json:"symptom_before_dialysis_other"`
303
 	DialysisInterphaseOther        string  `gorm:"column:dialysis_interphase_other" json:"dialysis_interphase_other"`
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
 	Phinholing                     string  `gorm:"column:pinholing" json:"pinholing" form:"pinholing"`
333
 	Phinholing                     string  `gorm:"column:pinholing" json:"pinholing" form:"pinholing"`
306
 	CatheterSuture                 string  `gorm:"column:catheter_suture" json:"catheter_suture" form:"catheter_suture"`
334
 	CatheterSuture                 string  `gorm:"column:catheter_suture" json:"catheter_suture" form:"catheter_suture"`
307
 	CatheterSutureOther            string  `gorm:"column:catheter_suture_other" json:"catheter_suture_other" form:"catheter_suture_other"`
335
 	CatheterSutureOther            string  `gorm:"column:catheter_suture_other" json:"catheter_suture_other" form:"catheter_suture_other"`
340
 	return "xt_assessment_before_dislysis"
368
 	return "xt_assessment_before_dislysis"
341
 }
369
 }
342
 
370
 
343
-//更改的地方
371
+// 更改的地方
344
 type DoctorAdvices struct {
372
 type DoctorAdvices struct {
345
 	ID                         int64           `gorm:"column:id" json:"id" form:"id"`
373
 	ID                         int64           `gorm:"column:id" json:"id" form:"id"`
346
 	GroupNo                    int64           `gorm:"column:groupno" json:"groupno" form:"groupno"`
374
 	GroupNo                    int64           `gorm:"column:groupno" json:"groupno" form:"groupno"`
542
 	return "xt_double_check"
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
 type AssessmentAfterDislysis struct {
592
 type AssessmentAfterDislysis struct {
546
 	ID                     int64   `gorm:"column:id" json:"id"`
593
 	ID                     int64   `gorm:"column:id" json:"id"`
547
 	UserOrgId              int64   `gorm:"column:user_org_id" json:"user_org_id"`
594
 	UserOrgId              int64   `gorm:"column:user_org_id" json:"user_org_id"`
550
 	DialysisOrderId        int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id"`
597
 	DialysisOrderId        int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id"`
551
 	Temperature            float64 `gorm:"column:temperature" json:"temperature"`
598
 	Temperature            float64 `gorm:"column:temperature" json:"temperature"`
552
 	PulseFrequency         float64 `gorm:"column:pulse_frequency" json:"pulse_frequency"`
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
 	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
601
 	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
555
 	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
602
 	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
556
 	BloodPressureType      int64   `gorm:"column:blood_pressure_type" json:"blood_pressure_type"`
603
 	BloodPressureType      int64   `gorm:"column:blood_pressure_type" json:"blood_pressure_type"`
571
 	Complication                    string  `gorm:"column:complication" json:"complication"`
618
 	Complication                    string  `gorm:"column:complication" json:"complication"`
572
 	Evaluator                       int64   `gorm:"column:evaluator" json:"evaluator"`
619
 	Evaluator                       int64   `gorm:"column:evaluator" json:"evaluator"`
573
 	Remark                          string  `gorm:"column:remark" json:"remark"`
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
 	DialysisIntakesFeed             int64   `gorm:"column:dialysis_intakes_feed" json:"dialysis_intakes_feed"`
622
 	DialysisIntakesFeed             int64   `gorm:"column:dialysis_intakes_feed" json:"dialysis_intakes_feed"`
576
 	DialysisIntakesTransfusion      int64   `gorm:"column:dialysis_intakes_transfusion" json:"dialysis_intakes_transfusion"`
623
 	DialysisIntakesTransfusion      int64   `gorm:"column:dialysis_intakes_transfusion" json:"dialysis_intakes_transfusion"`
577
 	DialysisIntakesBloodTransfusion int64   `gorm:"column:dialysis_intakes_blood_transfusion" json:"dialysis_intakes_blood_transfusion"`
624
 	DialysisIntakesBloodTransfusion int64   `gorm:"column:dialysis_intakes_blood_transfusion" json:"dialysis_intakes_blood_transfusion"`
696
 	OperateTime                 int64   `gorm:"column:operate_time" json:"operate_time"`
743
 	OperateTime                 int64   `gorm:"column:operate_time" json:"operate_time"`
697
 	MonitoringTime              string  `gorm:"column:monitoring_time" json:"monitoring_time"`
744
 	MonitoringTime              string  `gorm:"column:monitoring_time" json:"monitoring_time"`
698
 	PulseFrequency              float64 `gorm:"column:pulse_frequency" json:"pulse_frequency"`
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
 	SystolicBloodPressure       float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
747
 	SystolicBloodPressure       float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
701
 	DiastolicBloodPressure      float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
748
 	DiastolicBloodPressure      float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
702
 	BloodPressureType           int64   `gorm:"column:blood_pressure_type" json:"blood_pressure_type"`
749
 	BloodPressureType           int64   `gorm:"column:blood_pressure_type" json:"blood_pressure_type"`

+ 20 - 0
models/schedule_models.go View File

29
 	return "xt_schedule"
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
 type Schedule struct {
52
 type Schedule struct {
33
 	ID           int64 `gorm:"column:id" json:"id" form:"id"`
53
 	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"`
54
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 82 - 13
models/xcx_user_models.go View File

1
 package models
1
 package models
2
 
2
 
3
+import "github.com/shopspring/decimal"
4
+
3
 type XcxAdminUserRole struct {
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
 func (XcxAdminUserRole) TableName() string {
23
 func (XcxAdminUserRole) TableName() string {
541
 	return "xt_gobal_template"
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
 type XcxSchedule struct {
591
 type XcxSchedule struct {
545
 	ID           int64 `gorm:"column:id" json:"id" form:"id"`
592
 	ID           int64 `gorm:"column:id" json:"id" form:"id"`
546
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
593
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
561
 	return "xt_schedule"
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
 type XcxInspection struct {
633
 type XcxInspection struct {
565
 	ID           int64            `gorm:"column:id" json:"id" form:"id"`
634
 	ID           int64            `gorm:"column:id" json:"id" form:"id"`
566
 	PatientId    int64            `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
635
 	PatientId    int64            `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`

+ 10 - 8
service/new_sms_service.go View File

50
 		redisClient := RedisClient()
50
 		redisClient := RedisClient()
51
 		defer redisClient.Close()
51
 		defer redisClient.Close()
52
 		cur_date := time.Now().Format("2006-01-02")
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
 		bytesPass, _ := base64.StdEncoding.DecodeString(aespass)
56
 		bytesPass, _ := base64.StdEncoding.DecodeString(aespass)
57
 		tpass := utils.AESDecrypt(bytesPass)
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
 	return err
60
 	return err
61
 }
61
 }
64
 	redisClient := RedisClient()
64
 	redisClient := RedisClient()
65
 	defer redisClient.Close()
65
 	defer redisClient.Close()
66
 	bytesPass, err := base64.StdEncoding.DecodeString(aespass)
66
 	bytesPass, err := base64.StdEncoding.DecodeString(aespass)
67
+	utils.TraceLog("bytesPass:%v err:%v", bytesPass, err)
68
+	utils.TraceLog("aespass:%v", aespass)
67
 	if err != nil {
69
 	if err != nil {
68
-		return &SMSServiceError{Err: "缺少关键参数"}
70
+		return &SMSServiceError{Err: "缺少关键参数1"}
69
 	}
71
 	}
70
 	tpass := utils.AESDecrypt(bytesPass)
72
 	tpass := utils.AESDecrypt(bytesPass)
71
 	if len(tpass) == 0 {
73
 	if len(tpass) == 0 {
72
-		return &SMSServiceError{Err: "缺少关键参数"}
74
+		return &SMSServiceError{Err: "缺少关键参数2"}
73
 	}
75
 	}
74
 
76
 
75
 	cur_date := time.Now().Format("2006-01-02")
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
 	if err != nil {
79
 	if err != nil {
78
-		return &SMSServiceError{Err: "缺少关键参数"}
80
+		return &SMSServiceError{Err: "缺少关键参数3"}
79
 	}
81
 	}
80
 	ip_max_send_count, _ := beego.AppConfig.Int("ip_max_send_count")
82
 	ip_max_send_count, _ := beego.AppConfig.Int("ip_max_send_count")
81
 	if add_count, _ := strconv.Atoi(add_redis); add_count >= ip_max_send_count {
83
 	if add_count, _ := strconv.Atoi(add_redis); add_count >= ip_max_send_count {
82
 		return &SMSServiceError{Err: "当前IP发送短信超过限制"}
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
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
88
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
87
 	if moblie_max, _ := beego.AppConfig.Int("moblie_max_send_count"); moblie_count_int >= moblie_max {
89
 	if moblie_max, _ := beego.AppConfig.Int("moblie_max_send_count"); moblie_count_int >= moblie_max {
88
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}
90
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}

+ 1 - 1
service/redis.go View File

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

+ 3 - 3
service/sms_service.go View File

40
 		redisClient := RedisClient()
40
 		redisClient := RedisClient()
41
 		defer redisClient.Close()
41
 		defer redisClient.Close()
42
 		cur_date := time.Now().Format("2006-01-02")
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
 	return err
46
 	return err
47
 }
47
 }
68
 	defer redisClient.Close()
68
 	defer redisClient.Close()
69
 
69
 
70
 	cur_date := time.Now().Format("2006-01-02")
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
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
72
 	moblie_count_int, _ := strconv.Atoi(moblie_count)
73
 	if moblie_max := 5; moblie_count_int >= moblie_max {
73
 	if moblie_max := 5; moblie_count_int >= moblie_max {
74
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}
74
 		return &SMSServiceError{Err: "当前手机号发送短信超过限制"}

+ 137 - 4
service/xcx_mobile_api_service.go View File

9
 	"errors"
9
 	"errors"
10
 	"fmt"
10
 	"fmt"
11
 	"github.com/jinzhu/gorm"
11
 	"github.com/jinzhu/gorm"
12
-
12
+	"github.com/shopspring/decimal"
13
 	"net/http"
13
 	"net/http"
14
 	"time"
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
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
27
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
18
 	role := models.XcxAdminUserRole{}
28
 	role := models.XcxAdminUserRole{}
19
 
29
 
28
 	return &role, nil
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
 func CreateXcxAdminUser(role models.XcxAdminUserRole) error {
55
 func CreateXcxAdminUser(role models.XcxAdminUserRole) error {
32
 
56
 
33
 	err := UserReadDB().Create(&role).Error
57
 	err := UserReadDB().Create(&role).Error
129
 	return
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
 	patient := models.XcxPatients{}
190
 	patient := models.XcxPatients{}
135
 	err := XTReadDB().Model(&patient).Where("(phone = ? or relative_phone =?) and id_card_no =?", mobile, mobile, idcard).Find(&patient).Error
191
 	err := XTReadDB().Model(&patient).Where("(phone = ? or relative_phone =?) and id_card_no =?", mobile, mobile, idcard).Find(&patient).Error
136
 	//err := XTReadDB().Model(&patient).Where("id_card_no = ? and status = 1", mobile).Find(&patient).Error
192
 	//err := XTReadDB().Model(&patient).Where("id_card_no = ? and status = 1", mobile).Find(&patient).Error
137
 	if err == gorm.ErrRecordNotFound {
193
 	if err == gorm.ErrRecordNotFound {
138
 		return nil, err
194
 		return nil, err
139
 	}
195
 	}
140
-
141
 	if err != nil {
196
 	if err != nil {
142
 		return nil, err
197
 		return nil, err
143
 	}
198
 	}
144
 	return &patient, nil
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
 func GetNamePatient(name string, idcard string) (*models.XcxPatients, error) {
215
 func GetNamePatient(name string, idcard string) (*models.XcxPatients, error) {
220
 	return encryptData, nil
287
 	return encryptData, nil
221
 }
288
 }
222
 
289
 
223
-//去除填充
290
+// 去除填充
224
 func PKCS7UnPadding(origData []byte) []byte {
291
 func PKCS7UnPadding(origData []byte) []byte {
225
 	length := len(origData)
292
 	length := len(origData)
226
 	unpadding := int(origData[length-1])
293
 	unpadding := int(origData[length-1])
232
 	return origData[:(length - unpadding)]
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
 func GetScheduleInfo(startime int64, endtime int64, patient_id int64) (schedule []*models.VmBloodSchedule, err error) {
346
 func GetScheduleInfo(startime int64, endtime int64, patient_id int64) (schedule []*models.VmBloodSchedule, err error) {
236
 
347
 
237
 	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
348
 	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
598
 	return schedule, err
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
 func GetInspectionGroupList(patientid int64, startime int64, endtime int64) (inspection []*models.XcxInspection, err error) {
734
 func GetInspectionGroupList(patientid int64, startime int64, endtime int64) (inspection []*models.XcxInspection, err error) {
602
 
735
 
603
 	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
736
 	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")