28169 2 months ago
parent
commit
e14ada4c69

+ 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>

+ 2 - 0
.idea/vcs.xml View File

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="$PROJECT_DIR$" vcs="Git" />
5
+    <mapping directory="$PROJECT_DIR$/golang.org/x/net" vcs="Git" />
6
+    <mapping directory="$PROJECT_DIR$/qiniupkg.com/x" vcs="Git" />
5
   </component>
7
   </component>
6
 </project>
8
 </project>

+ 44 - 50
conf/app.conf View File

50
 call_domain = https://hf.sgjyun.com
50
 call_domain = https://hf.sgjyun.com
51
 front_end_domain = "https://xt.kuyicloud.com/#"
51
 front_end_domain = "https://xt.kuyicloud.com/#"
52
 
52
 
53
-readmysqlhost = shengws1.mysql.rds.aliyuncs.com
53
+readmysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
54
 readmysqlport = 3306
54
 readmysqlport = 3306
55
 readmysqluser = syh
55
 readmysqluser = syh
56
-readmysqlpass = xhPECP2nFObR8aUK
56
+readmysqlpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
57
 readmysqlname = sgj_xt
57
 readmysqlname = sgj_xt
58
 
58
 
59
-writemysqlhost = shengws1.mysql.rds.aliyuncs.com
59
+
60
+
61
+readmysqlhost2 = read-kuyicloud2024lt.mysql.rds.aliyuncs.com
62
+readmysqlport2 = 3306
63
+readmysqluser2 = syh
64
+readmysqlpass2 = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
65
+readmysqlname2 = sgj_xt
66
+
67
+writemysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
60
 writemysqlport = 3306
68
 writemysqlport = 3306
61
 writemysqluser = syh
69
 writemysqluser = syh
62
-writemysqlpass = xhPECP2nFObR8aUK
70
+writemysqlpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
63
 writemysqlname = sgj_xt
71
 writemysqlname = sgj_xt
64
 
72
 
65
 
73
 
66
-readuserhost = shengws1.mysql.rds.aliyuncs.com
74
+readuserhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
67
 readuserport = 3306
75
 readuserport = 3306
68
 readuseruser = syh
76
 readuseruser = syh
69
-readuserpass = xhPECP2nFObR8aUK
77
+readuserpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
70
 readusername = sgj_users
78
 readusername = sgj_users
71
 
79
 
72
-writeuserhost = shengws1.mysql.rds.aliyuncs.com
80
+writeuserhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
73
 writeuserport = 3306
81
 writeuserport = 3306
74
 writeuseruser = syh
82
 writeuseruser = syh
75
-writeuserpass = xhPECP2nFObR8aUK
83
+writeuserpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
76
 writeusername = sgj_users
84
 writeusername = sgj_users
77
 
85
 
78
-readmiddlehost = shengws1.mysql.rds.aliyuncs.com
86
+readmiddlehost = kuyicloud2024lt.mysql.rds.aliyuncs.com
79
 readmiddleport = 3306
87
 readmiddleport = 3306
80
 readmiddleuser = syh
88
 readmiddleuser = syh
81
-readmiddlepass = xhPECP2nFObR8aUK
89
+readmiddlepass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
82
 readmiddlename = ky_xt_middle
90
 readmiddlename = ky_xt_middle
83
 
91
 
84
-writemiddlehost = shengws1.mysql.rds.aliyuncs.com
92
+writemiddlehost = kuyicloud2024lt.mysql.rds.aliyuncs.com
85
 writemiddleport = 3306
93
 writemiddleport = 3306
86
 writemiddleuser = syh
94
 writemiddleuser = syh
87
-writemiddlepass = xhPECP2nFObR8aUK
95
+writemiddlepass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
88
 writemiddlename = ky_xt_middle
96
 writemiddlename = ky_xt_middle
89
 
97
 
90
 
98
 
91
-readsgjpatientmysqlhost = shengws1.mysql.rds.aliyuncs.com
99
+readsgjpatientmysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
92
 readsgjpatientmysqlport = 3306
100
 readsgjpatientmysqlport = 3306
93
 readsgjpatientmysqluser = syh
101
 readsgjpatientmysqluser = syh
94
-readsgjpatientmysqlpass = xhPECP2nFObR8aUK
102
+readsgjpatientmysqlpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
95
 readsgjpatientmysqlname = sgj_patient
103
 readsgjpatientmysqlname = sgj_patient
96
 
104
 
97
-writesgjpatientmysqlhost = shengws1.mysql.rds.aliyuncs.com
105
+writesgjpatientmysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
98
 writesgjpatientmysqlport = 3306
106
 writesgjpatientmysqlport = 3306
99
 writesgjpatientmysqluser = syh
107
 writesgjpatientmysqluser = syh
100
-writesgjpatientmysqlpass = xhPECP2nFObR8aUK
108
+writesgjpatientmysqlpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
101
 writesgjpatientmysqlname = sgj_patient
109
 writesgjpatientmysqlname = sgj_patient
102
 
110
 
103
 
111
 
104
-readpatienthost = shengws1.mysql.rds.aliyuncs.com
112
+readpatienthost = kuyicloud2024lt.mysql.rds.aliyuncs.com
105
 readpatientport = 3306
113
 readpatientport = 3306
106
 readpatientuser = syh
114
 readpatientuser = syh
107
-readpatientpass = xhPECP2nFObR8aUK
115
+readpatientpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
108
 readpatientname = sgj_cdm
116
 readpatientname = sgj_cdm
109
 
117
 
110
-writepatienthost = shengws1.mysql.rds.aliyuncs.com
118
+writepatienthost = kuyicloud2024lt.mysql.rds.aliyuncs.com
111
 writepatientport = 3306
119
 writepatientport = 3306
112
 writepatientuser = syh
120
 writepatientuser = syh
113
-writepatientpass = xhPECP2nFObR8aUK
121
+writepatientpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
114
 writepatientname = sgj_cdm
122
 writepatientname = sgj_cdm
115
 
123
 
116
-
117
-readswshost = shengws1.mysql.rds.aliyuncs.com
118
-readswsport = 3306
119
-readswsuser = syh
120
-readswspass = xhPECP2nFObR8aUK
121
-readswsname = shengws
122
-
123
-
124
-
125
-writeswshost = shengws1.mysql.rds.aliyuncs.com
126
-writeswsport = 3306
127
-writeswsuser = syh
128
-writeswspass = xhPECP2nFObR8aUK
129
-writeswsname = shengws
130
-
131
-redishost = 349e580b2a524290.redis.rds.aliyuncs.com
124
+redishost = kuyicloud.redis.rds.aliyuncs.com
132
 redisport = 6379
125
 redisport = 6379
133
-redispasswrod = TZtBW098WId3i27clkpj3q8dnUaVFP
134
-redisdb = 0
135
-
136
-
137
-
138
-
139
-
140
-
126
+redispasswrod = 1Q2W3e4r!@#$
127
+redisdb = 1
141
 
128
 
129
+EnableRender= false
142
 niprocart =  63
130
 niprocart =  63
143
 jms = 58
131
 jms = 58
144
 fistula_needle_set = 65
132
 fistula_needle_set = 65
157
 
145
 
158
 [dev]
146
 [dev]
159
 mobile_token_expiration_second = 604800
147
 mobile_token_expiration_second = 604800
160
-httpdomain = http://new_mobile.xt.api.sgjyun.com
148
+# httpdomain = http://new_mobile.xt.api.sgjyun.com
149
+httpdomain = https://api.xt.test.sgjyun.com
161
 sso_domain = https://testsso.sgjyun.com
150
 sso_domain = https://testsso.sgjyun.com
162
 call_domain = http://hf.szjkhd.com
151
 call_domain = http://hf.szjkhd.com
163
 front_end_domain = "http://xt.test.sgjyun.com/#"
152
 front_end_domain = "http://xt.test.sgjyun.com/#"
164
 
153
 
154
+sign_appid ="eac17a142dd046"
155
+serviceKye = "da8b09dce3684e6ebfbb7f70dba707a0"
156
+#serviceCode ="msg0001"
157
+
158
+serviceCode ="signSDK0001S"
159
+
160
+
165
 readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
161
 readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
166
 readmysqlport = 3306
162
 readmysqlport = 3306
167
 readmysqluser = root
163
 readmysqluser = root
188
 writeusername = sgj_users
184
 writeusername = sgj_users
189
 
185
 
190
 
186
 
191
-
192
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
187
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
193
 readmiddleport = 3306
188
 readmiddleport = 3306
194
 readmiddleuser = root
189
 readmiddleuser = root
202
 writemiddlename = ky_xt_middle
197
 writemiddlename = ky_xt_middle
203
 
198
 
204
 
199
 
205
-
206
 readpatienthost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
200
 readpatienthost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
207
 readpatientport = 3306
201
 readpatientport = 3306
208
 readpatientuser = root
202
 readpatientuser = root
235
 
229
 
236
 #redishost = 120.77.235.13
230
 #redishost = 120.77.235.13
237
 #redishost = 112.74.16.180
231
 #redishost = 112.74.16.180
238
-redishost = localhost
232
+redishost = kuyi6666.redis.rds.aliyuncs.com
239
 redisport = 6379
233
 redisport = 6379
240
-redispasswrod = syh@#$%123456!
241
-redisdb = 0
234
+redispasswrod = TZtBW098WId3i27clkpj3q8dnUaVFP
235
+redisdb = 7
242
 
236
 
243
 niprocart =  83
237
 niprocart =  83
244
 jms = 80
238
 jms = 80

+ 0 - 115
conf/接口.txt View File

1
-
2
-//新增临时
3
-/m/api/dialysis/dialysisPrescription?mode=1
4
-修改临处
5
-/m/api/dialysis/dialysisPrescription?mode=2
6
-修改他人临处
7
-/m/api/dialysis/dialysisPrescription?mode=3
8
-
9
-
10
-新增接诊评估
11
-/m/api/dialysis/acceptsAssessment?mode=1
12
-修改接诊评估
13
-/m/api/dialysis/acceptsAssessment?mode=2
14
-修改他人接诊评估
15
-/m/api/dialysis/acceptsAssessment?mode=3
16
-
17
-新增透前评估
18
-/m/api/assessmentbefore/commit?mode=1
19
-修改透前评估
20
-/m/api/assessmentbefore/commit?mode=2
21
-修改他人透前评估
22
-/m/api/assessmentbefore/commit?mode=3
23
-
24
-执行上机
25
-/m/api/dialysis/start?mode=1
26
-修改执行上机
27
-/m/api/startOrder/edit?mode=2
28
-修改他人执行上机
29
-/m/api/startOrder/edit?mode=3
30
-
31
-新增透析监测
32
-/m/api/monitor/add?mode=1
33
-修改透析监测
34
-/m/api/monitor/edit?mode=2
35
-修改他人透析监测
36
-/m/api/monitor/edit?mode=3
37
-删除透析监测
38
-/m/api/monitor/delete?mode=4
39
-删除他人透析监测
40
-/m/api/monitor/delete?mode=5
41
-
42
-执行下机
43
-/m/api/dialysis/finish?mode=1
44
-修改执行下机
45
-/m/api/finishOrder/edit?mode=2
46
-修改他人执行下机
47
-/m/api/finishOrder/edit?mode=3
48
-
49
-新增透后评估
50
-/m/api/dialysis/assessmentAfterDislysis?mode=1
51
-修改透后评估
52
-/m/api/dialysis/assessmentAfterDislysis?mode=2
53
-修改他人透后评估
54
-/m/api/dialysis/assessmentAfterDislysis?mode=3
55
-
56
-新增治疗小结
57
-/m/api/dialysis/treatmentSummary?mode=1
58
-修改治疗小结
59
-/m/api/dialysis/treatmentSummary?mode=2
60
-修改他人治疗小结
61
-/m/api/dialysis/treatmentSummary?mode=3
62
-
63
-新增透析临时医嘱
64
-/m/api/advice/creategroup?mode=1
65
-修改透析临时医嘱
66
-/m/api/advice/edit?mode=2
67
-修改他人透析临时医嘱
68
-/m/api/advice/edit?mode=3
69
-删除透析临时医嘱
70
-/m/api/newadvice/delete?mode=4
71
-删除他人透析临时医嘱
72
-/m/api/newadvice/delete?mode=5
73
-执行透析临时医嘱
74
-/m/api/advice/exec?mode=6
75
-核对透析临时医嘱
76
-/m/api/advice/check?mode=7
77
-修改已执行医嘱
78
-/m/api/advice/exec/modify?mode=8
79
-
80
-
81
-移动端 : /m/api/permission/get      get 请求
82
-参数1: create_url
83
-参数2:modify_url
84
-
85
-参数3:modify_other_url
86
-
87
-参数4:del_url
88
-
89
-参数5:del_other_url
90
-
91
-参数6:exce_url
92
-
93
-参数7:check_url
94
-
95
-参数8:modify_exce_url
96
-参数9:module
97
-
98
-返回值1:is_has_create
99
-返回值2:is_has_modify
100
-
101
-返回值3:is_has_modify_other
102
-
103
-返回值4:is_has_del
104
-
105
-返回值5:is_has_del_other
106
-
107
-返回值6:is_has_exce
108
-
109
-返回值7:is_has_check
110
-
111
-返回值8:is_has_modify_exce
112
-
113
-返回值9:module
114
-
115
-

+ 5 - 5
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.GetInt64("dialysis_count", 0)
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")
1372
 	ductus_arantii_other := c.GetString("ductus_arantii_other")
1372
 	ductus_arantii_other := c.GetString("ductus_arantii_other")
1373
 	machine_type := c.GetString("machine_type")
1373
 	machine_type := c.GetString("machine_type")
1374
 	puncture_needle := c.GetString("puncture_needle")
1374
 	puncture_needle := c.GetString("puncture_needle")
1375
-	humor_excessive_symptom, _ := c.GetInt64("humor_excessive_symptom", 0)
1375
+	humor_excessive_symptom := c.GetString("humor_excessive_symptom")
1376
 	phinholing := c.GetString("pinholing")
1376
 	phinholing := c.GetString("pinholing")
1377
 
1377
 
1378
 	catheter_suture := c.GetString("catheter_suture")
1378
 	catheter_suture := c.GetString("catheter_suture")
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 {

+ 0 - 0
controllers/doctors_api_controller.go View File


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

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
 		}
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)

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

2043
 
2043
 
2044
 	if dataBody["dialysis_count"] != nil && reflect.TypeOf(dataBody["dialysis_count"]).String() == "string" {
2044
 	if dataBody["dialysis_count"] != nil && reflect.TypeOf(dataBody["dialysis_count"]).String() == "string" {
2045
 		dialysis_count, _ := dataBody["dialysis_count"].(string)
2045
 		dialysis_count, _ := dataBody["dialysis_count"].(string)
2046
-		count, _ := strconv.ParseInt(dialysis_count, 10, 64)
2047
-		evaluation.DialysisCount = count
2046
+		// count, _ := strconv.ParseInt(dialysis_count, 10, 64)
2047
+		evaluation.DialysisCount = dialysis_count
2048
 	}
2048
 	}
2049
 
2049
 
2050
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
2050
 	if dataBody["is_infect"] != nil && reflect.TypeOf(dataBody["is_infect"]).String() == "string" {
2085
 	}
2085
 	}
2086
 
2086
 
2087
 	if dataBody["humor_excessive_symptom"] != nil && reflect.TypeOf(dataBody["humor_excessive_symptom"]).String() == "float64" {
2087
 	if dataBody["humor_excessive_symptom"] != nil && reflect.TypeOf(dataBody["humor_excessive_symptom"]).String() == "float64" {
2088
-		humor_excessive_symptom := int64(dataBody["humor_excessive_symptom"].(float64))
2088
+		humor_excessive_symptom := dataBody["humor_excessive_symptom"].(string)
2089
 		evaluation.HumorExcessiveSymptom = humor_excessive_symptom
2089
 		evaluation.HumorExcessiveSymptom = humor_excessive_symptom
2090
 	}
2090
 	}
2091
 
2091
 

+ 7 - 7
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")
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)

+ 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
 	}

+ 521 - 110
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:GetUserRegister")
23
-	//登录
23
+	beego.Router("/xcx/api/mobile/register", &XcxApiController{}, "Get:GetUserNameRegister")
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
 
65
 	beego.Router("/xcx/api/mobile/getarticlistdetail", &XcxApiController{}, "Get:GetArticListDetail")
81
 	beego.Router("/xcx/api/mobile/getarticlistdetail", &XcxApiController{}, "Get:GetArticListDetail")
66
 
82
 
67
 	beego.Router("/xcx/api/mobile/getstoryscore", &XcxApiController{}, "Get:GetStoryScoreList")
83
 	beego.Router("/xcx/api/mobile/getstoryscore", &XcxApiController{}, "Get:GetStoryScoreList")
84
+
85
+	//获取appid
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")
68
 }
93
 }
69
 
94
 
70
 type XcxApiController struct {
95
 type XcxApiController struct {
71
 	mobile_api_controllers.MobileBaseAPIController
96
 	mobile_api_controllers.MobileBaseAPIController
72
 }
97
 }
73
 
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
+
74
 func (this *XcxApiController) GetCodeInit() {
176
 func (this *XcxApiController) GetCodeInit() {
75
 	redisClient := service.RedisClient()
177
 	redisClient := service.RedisClient()
76
 	defer redisClient.Close()
178
 	defer redisClient.Close()
84
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
186
 	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
85
 	aespass := utils.AESEncrypt(addr)
187
 	aespass := utils.AESEncrypt(addr)
86
 
188
 
87
-	fmt.Println("hhhhhhh3223323232332", aespass)
88
 	this.ServeSuccessJSON(map[string]interface{}{
189
 	this.ServeSuccessJSON(map[string]interface{}{
89
 		"aespass": aespass,
190
 		"aespass": aespass,
90
 	})
191
 	})
91
 
192
 
92
 }
193
 }
93
 
194
 
195
+func (this *XcxApiController) GetUserNameRegister() {
196
+	// name := this.GetString("name")
197
+	// relationship := this.GetString("relationship")
198
+	id_card_no := this.GetString("id_card_no")
199
+	mobile := this.GetString("mobile")
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)
225
+	if errcodes == nil {
226
+		role := models.XcxAdminUserRole{
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,
241
+		}
242
+		err := service.CreateXcxAdminUser(role)
243
+		if err == nil {
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)
267
+			this.ServeSuccessJSON(map[string]interface{}{
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,
284
+			})
285
+		} else {
286
+			this.ServeSuccessJSON(map[string]interface{}{
287
+				"is_bind": false,
288
+				"msg":     "绑定失败",
289
+				"result":  false,
290
+			})
291
+		}
292
+	} else {
293
+		this.ServeSuccessJSON(map[string]interface{}{
294
+			"is_bind": false,
295
+			"msg":     "绑定失败,没有对应的患者信息",
296
+			"result":  false,
297
+		})
298
+	}
299
+}
300
+
94
 func (this *XcxApiController) GetUserRegister() {
301
 func (this *XcxApiController) GetUserRegister() {
95
 
302
 
96
 	//用户绑定
303
 	//用户绑定
365
 
572
 
366
 	mobile := this.GetString("phone")
573
 	mobile := this.GetString("phone")
367
 	aespass := this.GetString("aespass")
574
 	aespass := this.GetString("aespass")
575
+
368
 	utils.TraceLog("mobile:%v aespass:%v", mobile, aespass)
576
 	utils.TraceLog("mobile:%v aespass:%v", mobile, aespass)
577
+
369
 	if utils.CellPhoneRegexp().MatchString(mobile) == false {
578
 	if utils.CellPhoneRegexp().MatchString(mobile) == false {
370
 		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeMobileFormat)
579
 		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeMobileFormat)
371
 		this.ServeJSON()
580
 		this.ServeJSON()
386
 	})
595
 	})
387
 }
596
 }
388
 
597
 
389
-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
+}
390
 
620
 
621
+func (this *XcxApiController) GetLoginInfor() {
391
 	mobile := this.GetString("mobile")
622
 	mobile := this.GetString("mobile")
392
-	fmt.Println(mobile)
393
 	user_admin, errcodes := service.GetXcxMobileInformation(mobile)
623
 	user_admin, errcodes := service.GetXcxMobileInformation(mobile)
394
 	if errcodes == gorm.ErrRecordNotFound {
624
 	if errcodes == gorm.ErrRecordNotFound {
395
-		info, _ := service.GetMobilePatientInfo(mobile)
396
-		template_id, _ := service.GetTemplateMode(info.UserOrgId)
397
-		//处方
398
-		prescripition_config, _ := service.GetPrescripionFieldConfig(info.UserOrgId)
399
-
400
-		//接诊评估
401
-		receive_treatement_config, _ := service.GetReceiveTreatmentAssess(info.UserOrgId)
402
-
403
-		//透前评估
404
-		dialysis_befor, _ := service.GetDialysisBefor(info.UserOrgId)
405
-
406
-		//透析上机
407
-		dialysis_order, _ := service.GetDialysisOrderConfig(info.UserOrgId)
408
-
409
-		//透析监测
410
-		monitor_record, _ := service.GetMonitorRecordConfig(info.UserOrgId)
411
-
412
-		//透后评估
413
-		dialysis_after, _ := service.GetDialysisAfeterConfig(info.UserOrgId)
414
-
415
-		treate_ment, _ := service.GetTreatMentConfig(info.UserOrgId)
416
-		var configList interface{}
417
-		configList, _ = service.GetConfigList(info.UserOrgId)
418
 		this.ServeSuccessJSON(map[string]interface{}{
625
 		this.ServeSuccessJSON(map[string]interface{}{
419
-			"patient":                   info,
420
-			"template_id":               template_id,
421
-			"user_org_id":               info.UserOrgId,
422
-			"prescripition_config":      prescripition_config,
423
-			"receive_treatement_config": receive_treatement_config,
424
-			"dialysis_befor":            dialysis_befor,
425
-			"dialysis_order":            dialysis_order,
426
-			"monitor_record":            monitor_record,
427
-			"dialysis_after":            dialysis_after,
428
-			"treate_ment":               treate_ment,
429
-			"role":                      user_admin,
430
-			"is_bind":                   false,
431
-			"list":                      configList,
626
+			"patient":     "",
627
+			"patient_id":  0,
628
+			"user_org_id": 0,
629
+			"role":        user_admin,
630
+			"is_bind":     false,
432
 		})
631
 		})
433
 	} else if errcodes == nil {
632
 	} else if errcodes == nil {
434
 		info, _ := service.GetPatientListByPatientId(user_admin.PatientId)
633
 		info, _ := service.GetPatientListByPatientId(user_admin.PatientId)
435
-		template_id, _ := service.GetTemplateMode(info.UserOrgId)
436
-		//处方
437
-		prescripition_config, _ := service.GetPrescripionFieldConfig(info.UserOrgId)
438
-
439
-		//接诊评估
440
-		receive_treatement_config, _ := service.GetReceiveTreatmentAssess(info.UserOrgId)
441
-
442
-		//透前评估
443
-		dialysis_befor, _ := service.GetDialysisBefor(info.UserOrgId)
444
-
445
-		//透析上机
446
-		dialysis_order, _ := service.GetDialysisOrderConfig(info.UserOrgId)
447
-
448
-		//透析监测
449
-		monitor_record, _ := service.GetMonitorRecordConfig(info.UserOrgId)
450
-
451
-		//透后评估
452
-		dialysis_after, _ := service.GetDialysisAfeterConfig(info.UserOrgId)
453
-
454
-		treate_ment, _ := service.GetTreatMentConfig(info.UserOrgId)
455
-		var configList interface{}
456
-		configList, _ = service.GetConfigList(info.UserOrgId)
457
 		this.ServeSuccessJSON(map[string]interface{}{
634
 		this.ServeSuccessJSON(map[string]interface{}{
458
-			"patient":                   info,
459
-			"role":                      user_admin,
460
-			"is_bind":                   true,
461
-			"template_id":               template_id,
462
-			"user_org_id":               info.UserOrgId,
463
-			"prescripition_config":      prescripition_config,
464
-			"receive_treatement_config": receive_treatement_config,
465
-			"dialysis_befor":            dialysis_befor,
466
-			"dialysis_order":            dialysis_order,
467
-			"monitor_record":            monitor_record,
468
-			"dialysis_after":            dialysis_after,
469
-			"treate_ment":               treate_ment,
470
-			"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,
471
 		})
640
 		})
472
 	}
641
 	}
473
-
474
 }
642
 }
475
 
643
 
476
 func (this *XcxApiController) GetPatientList() {
644
 func (this *XcxApiController) GetPatientList() {
477
-	appid := "wx20b60369111b063a"
645
+	//appid := "wx20b60369111b063a"
646
+	appid := "wxcdf53b48b7df107e"
478
 	key := "Yz1HgsFX3yJvWPJSEdwJDA=="
647
 	key := "Yz1HgsFX3yJvWPJSEdwJDA=="
479
 	strs := "uSevGQ5ShkiHjQuqz7s36SKZisVGA4fHH/dy+etg0W7ibVeidl6TyFS+kQZ6B9AI2T+1kOtKXeyveQR7q2TXJdu3fhKCFoLKVFzICNEvkiHMnchJ0T0OpRO3oT+icYq80+egvT+jMSgP7yi0cAgmiKaK/4QURD7+nvxRAj9drzz77sbeFt8KElb1LN/+Wn8dIoQzisxbON9G1VJYYtyBkQ=="
648
 	strs := "uSevGQ5ShkiHjQuqz7s36SKZisVGA4fHH/dy+etg0W7ibVeidl6TyFS+kQZ6B9AI2T+1kOtKXeyveQR7q2TXJdu3fhKCFoLKVFzICNEvkiHMnchJ0T0OpRO3oT+icYq80+egvT+jMSgP7yi0cAgmiKaK/4QURD7+nvxRAj9drzz77sbeFt8KElb1LN/+Wn8dIoQzisxbON9G1VJYYtyBkQ=="
480
 	iv := "JgsbDhJ613uaAgAoBVh0Zw=="
649
 	iv := "JgsbDhJ613uaAgAoBVh0Zw=="
511
 	})
680
 	})
512
 }
681
 }
513
 
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
+
514
 func (this *XcxApiController) GetScheduleInfo() {
892
 func (this *XcxApiController) GetScheduleInfo() {
893
+
515
 	patient_id, _ := this.GetInt64("patient_id")
894
 	patient_id, _ := this.GetInt64("patient_id")
516
 	fmt.Println(patient_id)
895
 	fmt.Println(patient_id)
517
 	thisWeekMonday := service.GetFirstDateOfWeek()
896
 	thisWeekMonday := service.GetFirstDateOfWeek()
522
 	nextWeekMonday := weekDays.AddDate(0, 0, +13)
901
 	nextWeekMonday := weekDays.AddDate(0, 0, +13)
523
 	var weekMonday = lastWeekMonday.Format("2006-01-02")
902
 	var weekMonday = lastWeekMonday.Format("2006-01-02")
524
 	var weekDay = nextWeekMonday.Format("2006-01-02")
903
 	var weekDay = nextWeekMonday.Format("2006-01-02")
525
-	fmt.Println("weekmodonday", weekMonday)
526
-	fmt.Println("nextweeekday", weekDay)
904
+	//fmt.Println("weekmodonday", weekMonday)
905
+	//fmt.Println("nextweeekday", weekDay)
527
 
906
 
528
 	timeLayout := "2006-01-02"
907
 	timeLayout := "2006-01-02"
529
 	loc, _ := time.LoadLocation("Local")
908
 	loc, _ := time.LoadLocation("Local")
541
 
920
 
542
 	//获取今日下机日期
921
 	//获取今日下机日期
543
 	order, _ := service.GetTodayDialysis(timeNowUnix.Unix(), patient_id)
922
 	order, _ := service.GetTodayDialysis(timeNowUnix.Unix(), patient_id)
544
-
923
+	devicenumber, _ := service.GetAllBedNumberListTwo(schedule[0].UserOrgId)
545
 	//获取今日的处方
924
 	//获取今日的处方
546
 	prescription, _ := service.GetTodayPrescription(timeNowUnix.Unix(), patient_id)
925
 	prescription, _ := service.GetTodayPrescription(timeNowUnix.Unix(), patient_id)
547
 
926
 
552
 		return
931
 		return
553
 	}
932
 	}
554
 
933
 
555
-	var one = startTime.Unix() + 86400
934
+	var one = startTime.Unix()
556
 	fmt.Println("one2322332", one)
935
 	fmt.Println("one2322332", one)
557
 	var two = one + 86400
936
 	var two = one + 86400
558
 	var three = two + 86400
937
 	var three = two + 86400
577
 	var lastsix = lastfive + 86400
956
 	var lastsix = lastfive + 86400
578
 	var lastseven = lastsix + 86400
957
 	var lastseven = lastsix + 86400
579
 
958
 
580
-	fmt.Println("各地好当家232332323232", lastseven)
581
 	array := []interface{}{
959
 	array := []interface{}{
582
 		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": ""},
583
 		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": ""},
645
 		map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
1023
 		map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
646
 		map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
1024
 		map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
647
 	}
1025
 	}
1026
+
648
 	this.ServeSuccessJSON(map[string]interface{}{
1027
 	this.ServeSuccessJSON(map[string]interface{}{
649
 		"list":            schedule,
1028
 		"list":            schedule,
650
 		"array":           array,
1029
 		"array":           array,
651
 		"order":           order,
1030
 		"order":           order,
652
 		"patientSchedule": patientSchedule,
1031
 		"patientSchedule": patientSchedule,
653
 		"prescription":    prescription,
1032
 		"prescription":    prescription,
1033
+		"devicenumber":    devicenumber,
654
 	})
1034
 	})
655
 }
1035
 }
656
 
1036
 
657
 func (this *XcxApiController) GetMobileSchedule() {
1037
 func (this *XcxApiController) GetMobileSchedule() {
658
 
1038
 
659
 	patientID, _ := this.GetInt64("patient_id")
1039
 	patientID, _ := this.GetInt64("patient_id")
660
-	fmt.Println("1", patientID)
661
 	info, _ := service.GetXcxPatientInfo(patientID)
1040
 	info, _ := service.GetXcxPatientInfo(patientID)
662
 	timeLayout := "2006-01-02"
1041
 	timeLayout := "2006-01-02"
663
 	loc, _ := time.LoadLocation("Local")
1042
 	loc, _ := time.LoadLocation("Local")
664
 	time_now := time.Now().Format("2006-01-02")
1043
 	time_now := time.Now().Format("2006-01-02")
665
 	timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
1044
 	timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
666
-
667
-	fmt.Println("timeNowUnix", timeNowUnix.Unix())
668
 	//获取该患者最后一次排班
1045
 	//获取该患者最后一次排班
669
 	list, _ := service.GetLastScheduleListOne(patientID, timeNowUnix.Unix())
1046
 	list, _ := service.GetLastScheduleListOne(patientID, timeNowUnix.Unix())
670
-	fmt.Println("hh2332323232323223", list)
671
-	fmt.Println("list233232232332", list.ScheduleDate)
1047
+
672
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
1048
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
673
 	if getPatientErr != nil {
1049
 	if getPatientErr != nil {
674
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
1050
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
887
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1263
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
888
 	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
1264
 	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
889
 	info, _ := service.GetXcxPatientInfo(patient_id)
1265
 	info, _ := service.GetXcxPatientInfo(patient_id)
890
-	config, _ := service.GetDoctorAdviceConfig(info.UserOrgId)
891
-	fmt.Println(startTime, endTime, config.IsOpenRemind)
892
-	if config.IsOpenRemind == 0 || config.IsOpenRemind == 2 {
1266
+	_, config := service.FindXTHisRecordByOrgId(info.UserOrgId)
1267
+	fmt.Println(startTime, endTime, config.IsOpen)
1268
+	if config.IsOpen == 0 {
893
 		list, _ := service.GetDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
1269
 		list, _ := service.GetDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
894
 		advice, _ := service.GetDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
1270
 		advice, _ := service.GetDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
895
 		for _, item := range list {
1271
 		for _, item := range list {
905
 		})
1281
 		})
906
 	}
1282
 	}
907
 
1283
 
908
-	if config.IsOpenRemind == 1 {
1284
+	if config.IsOpen == 1 {
909
 		list, _ := service.GetHisDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
1285
 		list, _ := service.GetHisDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
910
 		advice, _ := service.GetHisDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
1286
 		advice, _ := service.GetHisDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
911
 		for _, item := range list {
1287
 		for _, item := range list {
983
 
1359
 
984
 func (this *XcxApiController) GetInspectionList() {
1360
 func (this *XcxApiController) GetInspectionList() {
985
 
1361
 
986
-	start_time := this.GetString("start_time")
987
-	end_time := this.GetString("end_time")
988
-	patient_id, _ := this.GetInt64("patient_id")
989
-	fmt.Println("patient_id", patient_id)
990
-	timeLayout := "2006-01-02"
991
-	loc, _ := time.LoadLocation("Local")
992
-	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
993
-	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1362
+	page, _ := this.GetInt64("page", 0)
1363
+	number, _ := this.GetInt64("number", 10)
1364
+	patient_id, _ := this.GetInt64("patient_id", 0)
1365
+	//fmt.Println("patient_id", patient_id)
1366
+	//timeLayout := "2006-01-02"
1367
+	//loc, _ := time.LoadLocation("Local")
1368
+	//startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1369
+	//endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
994
 
1370
 
995
-	list, _ := service.GetInspectionGroupList(patient_id, startTime.Unix(), endTime.Unix())
1371
+	list, err := service.GetInspectionGroupListByXcx(patient_id, page, number)
996
 
1372
 
997
-	insepctionList, _ := service.GetInsepctionList(patient_id, startTime.Unix(), endTime.Unix())
1373
+	if err == gorm.ErrRecordNotFound {
1374
+		this.ServeSuccessJSON(map[string]interface{}{
1375
+			"error_code": "1001",
1376
+			"error_msg":  "没有更多数据",
1377
+		})
1378
+	}
998
 
1379
 
999
-	for _, item := range list {
1000
-		for _, it := range insepctionList {
1001
-			if item.ProjectId == it.ProjectId && item.InspectDate == it.InspectDate {
1002
-				item.Childs = append(item.Childs, it)
1003
-			}
1004
-		}
1380
+	this.ServeSuccessJSON(map[string]interface{}{
1381
+		"error_code": "0",
1382
+		"error_msg":  "",
1383
+		"list":       list,
1384
+	})
1385
+}
1386
+
1387
+func (this *XcxApiController) GetInspectionInfo() {
1388
+
1389
+	project_id, _ := this.GetInt64("project_id", 0)
1390
+	inspect_date, _ := this.GetInt64("inspect_date", 0)
1391
+	patient_id, _ := this.GetInt64("patient_id", 0)
1392
+
1393
+	if project_id <= 0 || inspect_date <= 0 || patient_id <= 0 {
1394
+		this.ServeSuccessJSON(map[string]interface{}{
1395
+			"error_code": 1001,
1396
+			"error_msg":  "缺少参数",
1397
+		})
1005
 	}
1398
 	}
1006
 
1399
 
1400
+	list, _ := service.GetInspectionInfoByXcx(patient_id, project_id, inspect_date)
1401
+
1007
 	this.ServeSuccessJSON(map[string]interface{}{
1402
 	this.ServeSuccessJSON(map[string]interface{}{
1008
 		"list": list,
1403
 		"list": list,
1009
 	})
1404
 	})
1041
 		"total": total,
1436
 		"total": total,
1042
 	})
1437
 	})
1043
 }
1438
 }
1439
+
1440
+func (this *XcxApiController) GetAppId() {
1441
+
1442
+	var appid = "wxcdf53b48b7df107e"
1443
+	var secret = "94e944a69ad1d43ac447f5a8769ab801"
1444
+	var grant_type = "authorization_code"
1445
+	code := this.GetString("js_code")
1446
+	//var code = "041pXnGa1eLxTB0iypFa1W6USs1pXnGK"
1447
+
1448
+	openId, _ := service.SendWxAuthAPI(appid, secret, grant_type, code)
1449
+	//session_key, _ := service.SendWxAuthAPIOne(appid, secret, grant_type, code)
1450
+	this.ServeSuccessJSON(map[string]interface{}{
1451
+		"data": openId,
1452
+		//"session_key": session_key,
1453
+	})
1454
+}

+ 0 - 5
main.go View File

11
 }
11
 }
12
 
12
 
13
 func main() {
13
 func main() {
14
-	//service.BeginAutoCreateWeekSchedulesJob()
15
-	//service.BeginAutoCreateWeekDisinfectionJob()
16
-	//service.BeginAutoCreatePlanJob()
17
-	//service.AutoClearSchedules()
18
-	//service.BeginAutoCreateStaffScheduleJob()
19
 	beego.BConfig.WebConfig.Session.SessionGCMaxLifetime = 60
14
 	beego.BConfig.WebConfig.Session.SessionGCMaxLifetime = 60
20
 	beego.Run()
15
 	beego.Run()
21
 }
16
 }

+ 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                  int64   `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          int64   `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"`

+ 84 - 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 {
119
 	ScheduleWeek int64  `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
123
 	ScheduleWeek int64  `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
120
 	ModeId       int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
124
 	ModeId       int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
121
 	Name         string `json:"name" form:"name"`
125
 	Name         string `json:"name" form:"name"`
126
+	BedId        int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
127
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
122
 }
128
 }
123
 
129
 
124
 type BloodSchedule struct {
130
 type BloodSchedule struct {
541
 	return "xt_gobal_template"
547
 	return "xt_gobal_template"
542
 }
548
 }
543
 
549
 
550
+type GetHisName struct {
551
+	ID   int64  `gorm:"column:id" json:"id" form:"id"`
552
+	Name string `gorm:"column:name" json:"name" form:"name"`
553
+}
554
+
555
+func (GetHisName) TableName() string {
556
+	return "sgj_xt.xt_patients"
557
+}
558
+
559
+type Deposit struct {
560
+	ID           int64           `gorm:"column:id" json:"id" form:"id"`
561
+	UserOrgId    int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`          //机构id
562
+	HisPatientId int64           `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"` //his病人id
563
+	Ctime        int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
564
+	Mtime        int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
565
+	Status       int64           `gorm:"column:status" json:"status" form:"status"`
566
+	Deposit      decimal.Decimal `gorm:"column:deposit" json:"deposit" form:"deposit"` //押金
567
+}
568
+
569
+func (Deposit) TableName() string {
570
+	return "sgj_xt.his_deposit"
571
+}
572
+
573
+type DepositHistory struct {
574
+	ID             int64           `gorm:"column:id" json:"id" form:"id"`
575
+	UserOrgId      int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`          //机构id
576
+	HisPatientId   int64           `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"` //his病人id
577
+	DepositCode    string          `gorm:"column:deposit_code" json:"deposit_code" form:"deposit_code"`
578
+	Deposit        decimal.Decimal `gorm:"column:deposit" json:"deposit" form:"deposit"`                         //本次操作金额
579
+	SurplusDeposit decimal.Decimal `gorm:"column:surplus_deposit" json:"surplus_deposit" form:"surplus_deposit"` //剩余金额
580
+	DepositStatus  int64           `gorm:"column:deposit_status" json:"deposit_status" form:"deposit_status"`    //1:充值,2:扣费,3:退款,4:退费
581
+	Status         int64           `gorm:"column:status" json:"status" form:"status"`
582
+	CreateId       int64           `gorm:"column:create_id" json:"create_id" form:"create_id"`
583
+	Ctime          int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
584
+	Mtime          int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
585
+	TrialStatus    int64           `gorm:"column:trial_status" json:"trial_status" form:"trial_status"` //审核状态0:未审核 ,1:已审核
586
+	Remarks        string          `gorm:"column:remarks" json:"remarks" form:"remarks"`                //备注
587
+}
588
+
589
+func (DepositHistory) TableName() string {
590
+	return "sgj_xt.his_deposit_history"
591
+}
592
+
544
 type XcxSchedule struct {
593
 type XcxSchedule struct {
545
 	ID           int64 `gorm:"column:id" json:"id" form:"id"`
594
 	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"`
595
 	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
561
 	return "xt_schedule"
610
 	return "xt_schedule"
562
 }
611
 }
563
 
612
 
613
+type XcxInspectionTwo struct {
614
+	ID                  int64               `gorm:"column:id" json:"id" form:"id"`
615
+	PatientId           int64               `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
616
+	OrgId               int64               `gorm:"column:org_id" json:"org_id" form:"org_id"`
617
+	ProjectId           int64               `gorm:"column:project_id" json:"project_id" form:"project_id"`
618
+	ItemId              int64               `gorm:"column:item_id" json:"item_id" form:"item_id"`
619
+	ItemName            string              `gorm:"column:item_name" json:"item_name" form:"item_name"`
620
+	ProjectName         string              `gorm:"column:project_name" json:"project_name" form:"project_name"`
621
+	InspectType         int64               `gorm:"column:inspect_type" json:"inspect_type" form:"inspect_type"`
622
+	InspectValue        string              `gorm:"column:inspect_value" json:"inspect_value" form:"inspect_value"`
623
+	InspectTips         string              `gorm:"column:inspect_tips" json:"inspect_tips" form:"inspect_tips"`
624
+	InspectDate         int64               `gorm:"column:inspect_date" json:"inspect_date" form:"inspect_date"`
625
+	Status              int64               `gorm:"column:status" json:"status" form:"status"`
626
+	CreatedTime         int64               `gorm:"column:created_time" json:"created_time" form:"created_time"`
627
+	UpdatedTime         int64               `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
628
+	InspectionReference InspectionReference `json:"inspection_reference" gorm:"foreignkey:OrgId,ProjectId,ItemId;AssociationForeignKey:OrgId,ProjectId,ItemId;"`
629
+}
630
+
631
+func (XcxInspectionTwo) TableName() string {
632
+	return "xt_inspection"
633
+}
634
+
564
 type XcxInspection struct {
635
 type XcxInspection struct {
565
 	ID           int64            `gorm:"column:id" json:"id" form:"id"`
636
 	ID           int64            `gorm:"column:id" json:"id" form:"id"`
566
 	PatientId    int64            `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
637
 	PatientId    int64            `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`

+ 1 - 1
routers/router.go View File

13
 func init() {
13
 func init() {
14
 	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
14
 	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
15
 		// AllowAllOrigins:  true,
15
 		// AllowAllOrigins:  true,
16
-		AllowOrigins: []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://localhost:9529", "http://localhost:9531", "http://xt.test.shengws.com", "http://new_mobile.test.sgjyun.com", "https://xt.test.shengws.com", "http://xt.test.sgjyun.com", "https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com", "https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com", "http://mobile.sgjyun.com", "http://mobile.kuyicloud.com", "http://xcx.sgjyun.com"},
16
+		AllowOrigins: []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://localhost:9529", "http://localhost:9531", "http://xt.test.shengws.com", "http://new_mobile.test.sgjyun.com", "https://xt.test.shengws.com", "http://xt.test.sgjyun.com", "https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com", "https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com", "http://mobile.sgjyun.com", "http://mobile.kuyicloud.com", "https://api.shengws.com", "http://xcx.sgjyun.com"},
17
 		//AllowOrigins:     []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://xt.test.shengws.com","https://xt.test.shengws.com", "http://xt.test.sgjyun.com","https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com","https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com","http://mobile.sgjyun.com","http://mobile.kuyicloud.com"},
17
 		//AllowOrigins:     []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://xt.test.shengws.com","https://xt.test.shengws.com", "http://xt.test.sgjyun.com","https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com","https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com","http://mobile.sgjyun.com","http://mobile.kuyicloud.com"},
18
 		AllowMethods:     []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
18
 		AllowMethods:     []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
19
 		AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type", "X-XSRF-TOKEN", "Permission"},
19
 		AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type", "X-XSRF-TOKEN", "Permission"},

+ 1 - 0
service/auto_create_stock.go View File

18
 	//spec := "0 55 23 * * ?" // 每天23点55执行一次
18
 	//spec := "0 55 23 * * ?" // 每天23点55执行一次
19
 	//spec := "0 0 0 ? * Sun"
19
 	//spec := "0 0 0 ? * Sun"
20
 	createStockCronJob.AddFunc(spec, func() {
20
 	createStockCronJob.AddFunc(spec, func() {
21
+		utils.InfoLog("开启自动更新耗材库存定时任务1111111111111")
21
 		AutoCreateStockJob()
22
 		AutoCreateStockJob()
22
 	})
23
 	})
23
 }
24
 }

+ 49 - 49
service/dialysis_service.go View File

9
 	"github.com/jinzhu/gorm"
9
 	"github.com/jinzhu/gorm"
10
 )
10
 )
11
 
11
 
12
-//GetPatientList 返回患者的列表
12
+// GetPatientList 返回患者的列表
13
 func GetSchedualPatientList(orgID int64, schedulDate int64, schedulType int64, partitionType int64, keywords string, page int64, limit int64) (schedule []*models.DialysisSchedule, err error) {
13
 func GetSchedualPatientList(orgID int64, schedulDate int64, schedulType int64, partitionType int64, keywords string, page int64, limit int64) (schedule []*models.DialysisSchedule, err error) {
14
 	var total int64
14
 	var total int64
15
 	//if len(keywords) > 0 {
15
 	//if len(keywords) > 0 {
61
 	return schedule, errors
61
 	return schedule, errors
62
 }
62
 }
63
 
63
 
64
-//用户基本信息
64
+// 用户基本信息
65
 func FindPatientInfoById(orgID int64, id int64, time int64) (patient models.SchedualPatient2, err error) {
65
 func FindPatientInfoById(orgID int64, id int64, time int64) (patient models.SchedualPatient2, err error) {
66
 	err = readDb.Preload("DialysisSchedule", func(db *gorm.DB) *gorm.DB {
66
 	err = readDb.Preload("DialysisSchedule", func(db *gorm.DB) *gorm.DB {
67
 		return db.Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).Where("patient_id = ? AND user_org_id = ? AND schedule_date = ? ", id, orgID, time)
67
 		return db.Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).Where("patient_id = ? AND user_org_id = ? AND schedule_date = ? ", id, orgID, time)
69
 	return
69
 	return
70
 }
70
 }
71
 
71
 
72
-//透析处方
72
+// 透析处方
73
 func FindPatientPrescribeById(orgID int64, patientsId int64, recordDate int64) (patient models.DialysisPrescription, err error) {
73
 func FindPatientPrescribeById(orgID int64, patientsId int64, recordDate int64) (patient models.DialysisPrescription, err error) {
74
 	err = readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id=? and status=1 and  record_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
74
 	err = readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id=? and status=1 and  record_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
75
 	return
75
 	return
76
 }
76
 }
77
 
77
 
78
-//透析方案中的透析处方
78
+// 透析方案中的透析处方
79
 func FindDialysisSolution(orgID int64, patientsId int64) (patient models.DialysisSolution, err error) {
79
 func FindDialysisSolution(orgID int64, patientsId int64) (patient models.DialysisSolution, err error) {
80
 	err = readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id=? and status=1", patientsId, orgID).Last(&patient).Error
80
 	err = readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id=? and status=1", patientsId, orgID).Last(&patient).Error
81
 	return
81
 	return
82
 }
82
 }
83
 
83
 
84
-//透析方案中的透析模式
84
+// 透析方案中的透析模式
85
 func FindTreatmentModeById(modeId int64) (mode models.TreatmentMode, err error) {
85
 func FindTreatmentModeById(modeId int64) (mode models.TreatmentMode, err error) {
86
 	err = readDb.Model(&models.TreatmentMode{}).Where("id = ? AND status=1", modeId).First(&mode).Error
86
 	err = readDb.Model(&models.TreatmentMode{}).Where("id = ? AND status=1", modeId).First(&mode).Error
87
 	return
87
 	return
88
 }
88
 }
89
 
89
 
90
-//接诊评估
90
+// 接诊评估
91
 func FindReceiverTreatmentAccessRecordById(orgID int64, patientsId int64, recordDate int64) (receiveTreatmentAsses models.ReceiveTreatmentAsses, err error) {
91
 func FindReceiverTreatmentAccessRecordById(orgID int64, patientsId int64, recordDate int64) (receiveTreatmentAsses models.ReceiveTreatmentAsses, err error) {
92
 	err = readDb.Model(&models.ReceiveTreatmentAsses{}).Where("patient_id = ? and user_org_id=? and status=1 and record_date = ?", patientsId, orgID, recordDate).First(&receiveTreatmentAsses).Error
92
 	err = readDb.Model(&models.ReceiveTreatmentAsses{}).Where("patient_id = ? and user_org_id=? and status=1 and record_date = ?", patientsId, orgID, recordDate).First(&receiveTreatmentAsses).Error
93
 	return
93
 	return
94
 }
94
 }
95
 
95
 
96
-//透前评估
96
+// 透前评估
97
 func FindPredialysisEvaluationById(orgID int64, patientsId int64, recordDate int64) (patient models.PredialysisEvaluation, err error) {
97
 func FindPredialysisEvaluationById(orgID int64, patientsId int64, recordDate int64) (patient models.PredialysisEvaluation, err error) {
98
 	err = readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date = ?", patientsId, orgID, recordDate).First(&patient).Error
98
 	err = readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date = ?", patientsId, orgID, recordDate).First(&patient).Error
99
 	return
99
 	return
105
 	return dataconfig, err
105
 	return dataconfig, err
106
 }
106
 }
107
 
107
 
108
-//临时医嘱
108
+// 临时医嘱
109
 func FindDoctorAdviceById(orgID int64, patientsId int64, recordDate int64) (patient []*models.DoctorAdvice, err error) {
109
 func FindDoctorAdviceById(orgID int64, patientsId int64, recordDate int64) (patient []*models.DoctorAdvice, err error) {
110
 	err = readDb.Model(&models.DoctorAdvice{}).Where("patient_id = ? and user_org_id=? and status=1 and record_date = ? AND  advice_type = 2", patientsId, orgID, recordDate).Find(&patient).Error
110
 	err = readDb.Model(&models.DoctorAdvice{}).Where("patient_id = ? and user_org_id=? and status=1 and record_date = ? AND  advice_type = 2", patientsId, orgID, recordDate).Find(&patient).Error
111
 	return
111
 	return
127
 	return order, total, err
127
 	return order, total, err
128
 }
128
 }
129
 
129
 
130
-//临时医嘱
130
+// 临时医嘱
131
 func FindDoctorAdviceOrderById(orgID int64, patientsId int64, recordDate int64) (patient []*models.DoctorAdvice, err error) {
131
 func FindDoctorAdviceOrderById(orgID int64, patientsId int64, recordDate int64) (patient []*models.DoctorAdvice, err error) {
132
 	err = readDb.Model(&models.DoctorAdvice{}).
132
 	err = readDb.Model(&models.DoctorAdvice{}).
133
 		Where("patient_id = ? and user_org_id=? and status=1 and record_date = ? and advice_type = 2", patientsId, orgID, recordDate).
133
 		Where("patient_id = ? and user_org_id=? and status=1 and record_date = ? and advice_type = 2", patientsId, orgID, recordDate).
136
 	return
136
 	return
137
 }
137
 }
138
 
138
 
139
-//双人核对
139
+// 双人核对
140
 func FindDoubleCheckById(orgID int64, patientsId int64, recordDate int64) (patient models.DoubleCheck, err error) {
140
 func FindDoubleCheckById(orgID int64, patientsId int64, recordDate int64) (patient models.DoubleCheck, err error) {
141
 	err = readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? and user_org_id=? and status=1 and check_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
141
 	err = readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? and user_org_id=? and status=1 and check_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
142
 	return
142
 	return
143
 }
143
 }
144
 
144
 
145
-//透析监测
145
+// 透析监测
146
 func FindAllMonitorRecord(orgID int64, patientsId int64, recordDate int64) (record []*models.MonitoringRecord, err error) {
146
 func FindAllMonitorRecord(orgID int64, patientsId int64, recordDate int64) (record []*models.MonitoringRecord, err error) {
147
 	err = readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? and user_org_id=? and status=1 and monitoring_date = ?", patientsId, orgID, recordDate).Order("operate_time ASC").Find(&record).Error
147
 	err = readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? and user_org_id=? and status=1 and monitoring_date = ?", patientsId, orgID, recordDate).Order("operate_time ASC").Find(&record).Error
148
 	return
148
 	return
153
 	return
153
 	return
154
 }
154
 }
155
 
155
 
156
-//透后评估
156
+// 透后评估
157
 func FindAssessmentAfterDislysisById(orgID int64, patientsId int64, recordDate int64) (patient models.AssessmentAfterDislysis, err error) {
157
 func FindAssessmentAfterDislysisById(orgID int64, patientsId int64, recordDate int64) (patient models.AssessmentAfterDislysis, err error) {
158
 	err = readDb.Model(&models.AssessmentAfterDislysis{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date =?", patientsId, orgID, recordDate).First(&patient).Error
158
 	err = readDb.Model(&models.AssessmentAfterDislysis{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date =?", patientsId, orgID, recordDate).First(&patient).Error
159
 	return
159
 	return
160
 }
160
 }
161
 
161
 
162
-//治疗小结
162
+// 治疗小结
163
 func FindTreatmentSummaryById(orgID int64, patientsId int64, recordDate int64) (patient models.TreatmentSummary, err error) {
163
 func FindTreatmentSummaryById(orgID int64, patientsId int64, recordDate int64) (patient models.TreatmentSummary, err error) {
164
 	err = readDb.Model(&models.TreatmentSummary{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
164
 	err = readDb.Model(&models.TreatmentSummary{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
165
 	return
165
 	return
166
 }
166
 }
167
 
167
 
168
-//机构叫号配置
168
+// 机构叫号配置
169
 func FindQueueCallInfo(orgID int64) (queueConfig models.QueueCallConfig, err error) {
169
 func FindQueueCallInfo(orgID int64) (queueConfig models.QueueCallConfig, err error) {
170
 	err = readDb.Model(&models.QueueCallConfig{}).Where("org_id=? ", orgID).First(&queueConfig).Error
170
 	err = readDb.Model(&models.QueueCallConfig{}).Where("org_id=? ", orgID).First(&queueConfig).Error
171
 	return
171
 	return
172
 }
172
 }
173
 
173
 
174
-//修改机构叫号配置
174
+// 修改机构叫号配置
175
 func UpDateQueueCallInfo(queueConfig models.QueueCallConfig) error {
175
 func UpDateQueueCallInfo(queueConfig models.QueueCallConfig) error {
176
 	err := writeDb.Save(&queueConfig).Error
176
 	err := writeDb.Save(&queueConfig).Error
177
 	return err
177
 	return err
178
 }
178
 }
179
 
179
 
180
-//所有设备信息
180
+// 所有设备信息
181
 func FindAllDeviceInfo(orgID int64) (device []*models.Device, err error) {
181
 func FindAllDeviceInfo(orgID int64) (device []*models.Device, err error) {
182
 	err = readDb.Model(&models.Device{}).Where("org_id=? and status=1 and device_type = 1", orgID).Find(&device).Error
182
 	err = readDb.Model(&models.Device{}).Where("org_id=? and status=1 and device_type = 1", orgID).Find(&device).Error
183
 	return device, err
183
 	return device, err
184
 }
184
 }
185
 
185
 
186
-//所有设备区域
186
+// 所有设备区域
187
 func GetAllDeviceZone(orgId int64) (error, []*models.DeviceZone) {
187
 func GetAllDeviceZone(orgId int64) (error, []*models.DeviceZone) {
188
 	var zone []*models.DeviceZone
188
 	var zone []*models.DeviceZone
189
 	err := readDb.Model(&zone).Where("org_id = ? AND status = 1", orgId).Find(&zone).Error
189
 	err := readDb.Model(&zone).Where("org_id = ? AND status = 1", orgId).Find(&zone).Error
191
 	return err, zone
191
 	return err, zone
192
 }
192
 }
193
 
193
 
194
-//获取所有子药物
194
+// 获取所有子药物
195
 func FindAllSubDoctorAdvice(id int64, parentId int64) (error, []models.DoctorAdvice) {
195
 func FindAllSubDoctorAdvice(id int64, parentId int64) (error, []models.DoctorAdvice) {
196
 	var subAdvies []models.DoctorAdvice
196
 	var subAdvies []models.DoctorAdvice
197
 	err := readDb.Model(&subAdvies).Where("patient_id = ? AND parent_id = ?", id, parentId).Find(&subAdvies).Error
197
 	err := readDb.Model(&subAdvies).Where("patient_id = ? AND parent_id = ?", id, parentId).Find(&subAdvies).Error
201
 
201
 
202
 func FindAdivceById(orgId int64, patientId int64, id int64) (error, models.DoctorAdvice) {
202
 func FindAdivceById(orgId int64, patientId int64, id int64) (error, models.DoctorAdvice) {
203
 	advices := models.DoctorAdvice{}
203
 	advices := models.DoctorAdvice{}
204
-	err := readDb.Model(&advices).Where("user_org_id = ? AND patient_id = ? AND id = ? AND status = 1", orgId, patientId, id).Find(&advices).Error
204
+	err := readDb.Model(&advices).Where("user_org_id = ? AND patient_id = ? AND id = ? AND status = 6", orgId, patientId, id).Find(&advices).Error
205
 	return err, advices
205
 	return err, advices
206
 }
206
 }
207
 
207
 
271
 	return errors
271
 	return errors
272
 }
272
 }
273
 
273
 
274
-//修改透析处方
274
+// 修改透析处方
275
 func UpDateDialysisPrescription(dialysisPrescription *models.DialysisPrescription) error {
275
 func UpDateDialysisPrescription(dialysisPrescription *models.DialysisPrescription) error {
276
 	err := writeDb.Save(&dialysisPrescription).Error
276
 	err := writeDb.Save(&dialysisPrescription).Error
277
 	return err
277
 	return err
278
 }
278
 }
279
 
279
 
280
-//修改接诊评估
280
+// 修改接诊评估
281
 func UpadateReceiveTreatmentAsses(receiveTreatmentAsses *models.ReceiveTreatmentAsses) error {
281
 func UpadateReceiveTreatmentAsses(receiveTreatmentAsses *models.ReceiveTreatmentAsses) error {
282
 	err := writeDb.Save(receiveTreatmentAsses).Error
282
 	err := writeDb.Save(receiveTreatmentAsses).Error
283
 	return err
283
 	return err
284
 }
284
 }
285
 
285
 
286
-//修改透前评估
286
+// 修改透前评估
287
 func UpadatePredialysisEvaluation(predialysisEvaluation *models.PredialysisEvaluation) error {
287
 func UpadatePredialysisEvaluation(predialysisEvaluation *models.PredialysisEvaluation) error {
288
 	err := writeDb.Save(&predialysisEvaluation).Error
288
 	err := writeDb.Save(&predialysisEvaluation).Error
289
 	return err
289
 	return err
290
 }
290
 }
291
 
291
 
292
-//修改双人核对
292
+// 修改双人核对
293
 func UpdateDoubleCheck(check *models.DoubleCheck) error {
293
 func UpdateDoubleCheck(check *models.DoubleCheck) error {
294
 	err := writeDb.Save(&check).Error
294
 	err := writeDb.Save(&check).Error
295
 	return err
295
 	return err
296
 }
296
 }
297
 
297
 
298
-//修改透后评估
298
+// 修改透后评估
299
 func UpdateAssessmentAfterDislysisRecord(assessmentAfterDislysis *models.AssessmentAfterDislysis) error {
299
 func UpdateAssessmentAfterDislysisRecord(assessmentAfterDislysis *models.AssessmentAfterDislysis) error {
300
 	err := writeDb.Save(&assessmentAfterDislysis).Error
300
 	err := writeDb.Save(&assessmentAfterDislysis).Error
301
 	return err
301
 	return err
318
 	return err
318
 	return err
319
 }
319
 }
320
 
320
 
321
-//修改
321
+// 修改
322
 func UpdateSummeRecord(treatmentSummary *models.TreatmentSummary) error {
322
 func UpdateSummeRecord(treatmentSummary *models.TreatmentSummary) error {
323
 	err := writeDb.Save(&treatmentSummary).Error
323
 	err := writeDb.Save(&treatmentSummary).Error
324
 	return err
324
 	return err
325
 }
325
 }
326
 
326
 
327
-// func UpdateDoctorAdviceById(m *models.DoctorAdvice, id int64, patientId int64) error {
328
-// 	tx := writeDb.Begin()
329
-// 	err := tx.Model(&models.DoctorAdvice{}).Where("patient_id = ? AND id = ? AND status = 1 ", patientId, id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1, "checker": m.Checker}).Error
330
-// 	if err != nil {
331
-// 		tx.Rollback()
332
-// 	}
333
-// 	tx.Commit()
334
-// 	return err
335
-// }
327
+//	func UpdateDoctorAdviceById(m *models.DoctorAdvice, id int64, patientId int64) error {
328
+//		tx := writeDb.Begin()
329
+//		err := tx.Model(&models.DoctorAdvice{}).Where("patient_id = ? AND id = ? AND status = 1 ", patientId, id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1, "checker": m.Checker}).Error
330
+//		if err != nil {
331
+//			tx.Rollback()
332
+//		}
333
+//		tx.Commit()
334
+//		return err
335
+//	}
336
 func ExceDoctorAdviceById(m *models.DoctorAdvice, id int64, patientId int64) error {
336
 func ExceDoctorAdviceById(m *models.DoctorAdvice, id int64, patientId int64) error {
337
 	err := writeDb.Model(&models.DoctorAdvice{}).Where("patient_id = ? AND (id = ? Or parent_id=?)  AND status = 1 ", patientId, id, id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
337
 	err := writeDb.Model(&models.DoctorAdvice{}).Where("patient_id = ? AND (id = ? Or parent_id=?)  AND status = 1 ", patientId, id, id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
338
 	return err
338
 	return err
378
 
378
 
379
 }
379
 }
380
 
380
 
381
-//创建长期处方
381
+// 创建长期处方
382
 func CreateSolution(solution *models.DialysisSolution) {
382
 func CreateSolution(solution *models.DialysisSolution) {
383
 	writeDb.Create(&solution)
383
 	writeDb.Create(&solution)
384
 }
384
 }
408
 	return
408
 	return
409
 }
409
 }
410
 
410
 
411
-//透析处方
411
+// 透析处方
412
 func FindDialysisPrescriptionByReordDate(id int64, recordDate int64, orgId int64) (error, *models.DialysisPrescription) {
412
 func FindDialysisPrescriptionByReordDate(id int64, recordDate int64, orgId int64) (error, *models.DialysisPrescription) {
413
 	dialysisPrescription := models.DialysisPrescription{}
413
 	dialysisPrescription := models.DialysisPrescription{}
414
 	err := readDb.Model(&dialysisPrescription).Where("patient_id = ? AND  record_date = ? AND status = 1 AND user_org_id = ? ", id, recordDate, orgId).Find(&dialysisPrescription).Error
414
 	err := readDb.Model(&dialysisPrescription).Where("patient_id = ? AND  record_date = ? AND status = 1 AND user_org_id = ? ", id, recordDate, orgId).Find(&dialysisPrescription).Error
421
 	return err, &receiveTreatmentAsses
421
 	return err, &receiveTreatmentAsses
422
 }
422
 }
423
 
423
 
424
-//透前评估
424
+// 透前评估
425
 func FindPredialysisEvaluationByReordDate(id int64, recordDate int64, orgId int64) (error, *models.PredialysisEvaluation) {
425
 func FindPredialysisEvaluationByReordDate(id int64, recordDate int64, orgId int64) (error, *models.PredialysisEvaluation) {
426
 	dialysisEvaluation := models.PredialysisEvaluation{}
426
 	dialysisEvaluation := models.PredialysisEvaluation{}
427
 	err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? AND  assessment_date = ? AND status = 1 AND user_org_id = ?", id, recordDate, orgId).First(&dialysisEvaluation).Error
427
 	err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? AND  assessment_date = ? AND status = 1 AND user_org_id = ?", id, recordDate, orgId).First(&dialysisEvaluation).Error
428
 	return err, &dialysisEvaluation
428
 	return err, &dialysisEvaluation
429
 }
429
 }
430
 
430
 
431
-//双人核对
431
+// 双人核对
432
 func FindDoubleCheckByReordDate(id int64, recordDate int64, orgId int64) (error, *models.DoubleCheck) {
432
 func FindDoubleCheckByReordDate(id int64, recordDate int64, orgId int64) (error, *models.DoubleCheck) {
433
 	check := models.DoubleCheck{}
433
 	check := models.DoubleCheck{}
434
 	err := readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? AND  check_date = ? AND status = 1 AND user_org_id = ?", id, recordDate, orgId).First(&check).Error
434
 	err := readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? AND  check_date = ? AND status = 1 AND user_org_id = ?", id, recordDate, orgId).First(&check).Error
531
 
531
 
532
 }
532
 }
533
 
533
 
534
-//更新透析处方记录ID
534
+// 更新透析处方记录ID
535
 func UpDateRecordIdToDialysisPrescription(patientId int64, orgId int64, recordTime int64, recordId int64) error {
535
 func UpDateRecordIdToDialysisPrescription(patientId int64, orgId int64, recordTime int64, recordId int64) error {
536
 	errors := writeDb.Model(&models.DialysisPrescription{}).Where("user_org_id = ? AND patient_id = ? AND record_date = ? ", orgId, patientId, recordTime).Updates(map[string]interface{}{"record_id": recordId}).Error
536
 	errors := writeDb.Model(&models.DialysisPrescription{}).Where("user_org_id = ? AND patient_id = ? AND record_date = ? ", orgId, patientId, recordTime).Updates(map[string]interface{}{"record_id": recordId}).Error
537
 	return errors
537
 	return errors
572
 	return errors
572
 	return errors
573
 }
573
 }
574
 
574
 
575
-//透析处方
575
+// 透析处方
576
 func FindPatientPrescribeWidyDevideById(orgID int64, patientsId int64, recordDate int64) (patient models.DialysisPrescriptionAddtional, err error) {
576
 func FindPatientPrescribeWidyDevideById(orgID int64, patientsId int64, recordDate int64) (patient models.DialysisPrescriptionAddtional, err error) {
577
 	err = readDb.Preload("Device", "status = 1 AND org_id = ?", orgID).
577
 	err = readDb.Preload("Device", "status = 1 AND org_id = ?", orgID).
578
 		Model(&models.DialysisPrescriptionAddtional{}).
578
 		Model(&models.DialysisPrescriptionAddtional{}).
640
 	return role, err
640
 	return role, err
641
 }
641
 }
642
 
642
 
643
-/////////////// 新 18-10-22
643
+// ///////////// 新 18-10-22
644
 func GetDialysisScheduals(orgID int64, scheduleDate int64) ([]*MDialysisScheduleVM, error) {
644
 func GetDialysisScheduals(orgID int64, scheduleDate int64) ([]*MDialysisScheduleVM, error) {
645
 	var vms []*MDialysisScheduleVM
645
 	var vms []*MDialysisScheduleVM
646
 	db := readDb.
646
 	db := readDb.
785
 }
785
 }
786
 
786
 
787
 func FindLastMonitorRecordToday(patient_id int64, org_id int64, monitoring_date int64) (record models.MonitoringRecord, err error) {
787
 func FindLastMonitorRecordToday(patient_id int64, org_id int64, monitoring_date int64) (record models.MonitoringRecord, err error) {
788
-	err = readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? AND status = 1 AND user_org_id = ? AND monitoring_date = ?", patient_id, org_id, monitoring_date).Last(&record).Error
788
+	err = readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? AND status = 6 AND user_org_id = ? AND monitoring_date = ?", patient_id, org_id, monitoring_date).Last(&record).Error
789
 	return
789
 	return
790
 }
790
 }
791
 
791
 
792
 func FindFirstMonitorRecordToday(patient_id int64, org_id int64, monitoring_date int64) (record models.MonitoringRecord, err error) {
792
 func FindFirstMonitorRecordToday(patient_id int64, org_id int64, monitoring_date int64) (record models.MonitoringRecord, err error) {
793
-	err = readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? AND status = 1 AND user_org_id = ? AND monitoring_date = ?", patient_id, org_id, monitoring_date).First(&record).Error
793
+	err = readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? AND status = 6 AND user_org_id = ? AND monitoring_date = ?", patient_id, org_id, monitoring_date).First(&record).Error
794
 	return
794
 	return
795
 }
795
 }
796
 
796
 
797
 func ExceDoctorAdviceByGroupNo(m *models.DoctorAdvice, groupNo int64, org_id int64) (err error) {
797
 func ExceDoctorAdviceByGroupNo(m *models.DoctorAdvice, groupNo int64, org_id int64) (err error) {
798
 	ut := writeDb.Begin()
798
 	ut := writeDb.Begin()
799
-	err = ut.Model(&models.DoctorAdvice{}).Where("groupno = ?  AND user_org_id = ? AND status = 1 AND execution_state = 2", groupNo, org_id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
799
+	err = ut.Model(&models.DoctorAdvice{}).Where("groupno = ?  AND user_org_id = ? AND status = 6 AND execution_state = 2", groupNo, org_id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
800
 	if err != nil {
800
 	if err != nil {
801
 		ut.Rollback()
801
 		ut.Rollback()
802
 		return
802
 		return
809
 func ExceOldDoctorAdvice(m *models.DoctorAdvice, advice_id int64) (err error) {
809
 func ExceOldDoctorAdvice(m *models.DoctorAdvice, advice_id int64) (err error) {
810
 
810
 
811
 	ut := writeDb.Begin()
811
 	ut := writeDb.Begin()
812
-	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND id = ?", advice_id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
812
+	err = ut.Model(&models.DoctorAdvice{}).Where("status = 6   AND id = ?", advice_id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
813
 	if err != nil {
813
 	if err != nil {
814
 		ut.Rollback()
814
 		ut.Rollback()
815
 		return
815
 		return
816
 	}
816
 	}
817
-	err = ut.Model(&models.DoctorAdvice{}).Where("status = 1   AND parent_id = ?", advice_id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
817
+	err = ut.Model(&models.DoctorAdvice{}).Where("status = 6  AND parent_id = ?", advice_id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
818
 	if err != nil {
818
 	if err != nil {
819
 		ut.Rollback()
819
 		ut.Rollback()
820
 		return
820
 		return
825
 
825
 
826
 func CheckDoctorAdviceByGroupNo(m *models.DoctorAdvice, groupNo int64, org_id int64) (err error) {
826
 func CheckDoctorAdviceByGroupNo(m *models.DoctorAdvice, groupNo int64, org_id int64) (err error) {
827
 	ut := writeDb.Begin()
827
 	ut := writeDb.Begin()
828
-	err = ut.Model(&models.DoctorAdvice{}).Where("groupno = ?  AND user_org_id = ?  AND status = 1 AND check_state = 0", groupNo, org_id).Updates(map[string]interface{}{"check_time": m.CheckTime, "checker": m.Checker, "check_state": 1}).Error
828
+	err = ut.Model(&models.DoctorAdvice{}).Where("groupno = ?  AND user_org_id = ?  AND status = 6 AND check_state = 0", groupNo, org_id).Updates(map[string]interface{}{"check_time": m.CheckTime, "checker": m.Checker, "check_state": 1}).Error
829
 	if err != nil {
829
 	if err != nil {
830
 		ut.Rollback()
830
 		ut.Rollback()
831
 		return
831
 		return
1044
 }
1044
 }
1045
 
1045
 
1046
 func GetLastLongAdviceByGroupNo(orgId int64, patient_id int64) (advice []*models.DoctorAdvice, err error) {
1046
 func GetLastLongAdviceByGroupNo(orgId int64, patient_id int64) (advice []*models.DoctorAdvice, err error) {
1047
-	err = readDb.Model(&models.DoctorAdvice{}).Where("status = 1 AND user_org_id = ? AND patient_id = ? AND advice_type = 1  AND stop_state = 2 AND parent_id = 0 AND frequency_type <> 0", orgId, patient_id).Preload("ChildDoctorAdvice", "status = 1").Find(&advice).Error
1047
+	err = readDb.Model(&models.DoctorAdvice{}).Where("status = 6 AND user_org_id = ? AND patient_id = ? AND advice_type = 1  AND stop_state = 2 AND parent_id = 0 AND frequency_type <> 0", orgId, patient_id).Preload("ChildDoctorAdvice", "status = 1").Find(&advice).Error
1048
 	return
1048
 	return
1049
 }
1049
 }
1050
 
1050
 
1051
 func GetLastLongAdviceByGroupNoThree(orgId int64, patient_id int64) (advice []*models.DoctorAdvice, err error) {
1051
 func GetLastLongAdviceByGroupNoThree(orgId int64, patient_id int64) (advice []*models.DoctorAdvice, err error) {
1052
-	err = readDb.Model(&models.DoctorAdvice{}).Where("status = 1 AND user_org_id = ? AND patient_id = ?  AND  advice_type = 1 AND frequency_type = 2 AND stop_state = 2 AND parent_id = 0 ", orgId, patient_id).Preload("ChildDoctorAdvice", "status = 1").Find(&advice).Error
1052
+	err = readDb.Model(&models.DoctorAdvice{}).Where("status = 6 AND user_org_id = ? AND patient_id = ?  AND  advice_type = 1 AND frequency_type = 2 AND stop_state = 2 AND parent_id = 0 ", orgId, patient_id).Preload("ChildDoctorAdvice", "status = 1").Find(&advice).Error
1053
 	return
1053
 	return
1054
 }
1054
 }
1055
 
1055
 

+ 4 - 4
service/mobile_dialysis_service.go View File

535
 // 透析记录
535
 // 透析记录
536
 func MobileGetSchedualDialysisRecord(orgID int64, patientID int64, recordDate int64) (*models.DialysisOrder, error) {
536
 func MobileGetSchedualDialysisRecord(orgID int64, patientID int64, recordDate int64) (*models.DialysisOrder, error) {
537
 	var record models.DialysisOrder
537
 	var record models.DialysisOrder
538
-	err := readDb.Model(&models.DialysisOrder{}).Preload("DeviceNumber", "org_id = ? AND  status = 1", orgID).Where("user_org_id = ? AND patient_id = ? AND  dialysis_date = ?", orgID, patientID, recordDate).First(&record).Error
538
+	err := readDb.Model(&models.DialysisOrder{}).Preload("DeviceNumber", "org_id = ? AND  status = 6", orgID).Where("user_org_id = ? AND patient_id = ? AND  dialysis_date = ?", orgID, patientID, recordDate).First(&record).Error
539
 	if err != nil {
539
 	if err != nil {
540
 		if err == gorm.ErrRecordNotFound {
540
 		if err == gorm.ErrRecordNotFound {
541
 			return nil, nil
541
 			return nil, nil
1265
 // 透析方案
1265
 // 透析方案
1266
 func MobileGetDialysisSolutionByModeId(orgID int64, patientID int64, mode_id int64) (*models.DialysisSolution, error) {
1266
 func MobileGetDialysisSolutionByModeId(orgID int64, patientID int64, mode_id int64) (*models.DialysisSolution, error) {
1267
 	var record models.DialysisSolution
1267
 	var record models.DialysisSolution
1268
-	err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
1268
+	err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 6 AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
1269
 	if err != nil {
1269
 	if err != nil {
1270
 		if err == gorm.ErrRecordNotFound {
1270
 		if err == gorm.ErrRecordNotFound {
1271
 			return nil, nil
1271
 			return nil, nil
1318
 
1318
 
1319
 func MobileGetLastDialysisPrescribeByModeId(orgID int64, patientID int64, mode_id int64) (*models.DialysisPrescription, error) {
1319
 func MobileGetLastDialysisPrescribeByModeId(orgID int64, patientID int64, mode_id int64) (*models.DialysisPrescription, error) {
1320
 	var record models.DialysisPrescription
1320
 	var record models.DialysisPrescription
1321
-	err := readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 1  AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
1321
+	err := readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 6  AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
1322
 	if err != nil {
1322
 	if err != nil {
1323
 		if err == gorm.ErrRecordNotFound {
1323
 		if err == gorm.ErrRecordNotFound {
1324
 			return nil, nil
1324
 			return nil, nil
1467
 
1467
 
1468
 func MobileGetSystemDialysisPrescribeByModeId(orgID int64, mode_id int64) (*models.SystemPrescription, error) {
1468
 func MobileGetSystemDialysisPrescribeByModeId(orgID int64, mode_id int64) (*models.SystemPrescription, error) {
1469
 	var record models.SystemPrescription
1469
 	var record models.SystemPrescription
1470
-	err := readDb.Model(&models.SystemPrescription{}).Where("user_org_id = ? and status = 1  AND mode_id = ?", orgID, mode_id).First(&record).Error
1470
+	err := readDb.Model(&models.SystemPrescription{}).Where("user_org_id = ? and status = 6  AND mode_id = ?", orgID, mode_id).First(&record).Error
1471
 	if err != nil {
1471
 	if err != nil {
1472
 		if err == gorm.ErrRecordNotFound {
1472
 		if err == gorm.ErrRecordNotFound {
1473
 			return nil, nil
1473
 			return nil, nil

+ 5 - 3
service/new_sms_service.go View File

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("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 {

+ 1 - 1
service/patientmanage_service.go View File

1564
 func GetLastPassWayAssessment(orgid int64, patientId int64) (models.XtPatientVascularAccess, error) {
1564
 func GetLastPassWayAssessment(orgid int64, patientId int64) (models.XtPatientVascularAccess, error) {
1565
 
1565
 
1566
 	assessment := models.XtPatientVascularAccess{}
1566
 	assessment := models.XtPatientVascularAccess{}
1567
-	err := XTReadDB().Model(&assessment).Where("user_org_id = ? and patient_id = ? and status =1 and user_status = 1", orgid, patientId).Order("start_time desc").Last(&assessment).Error
1567
+	err := XTReadDB().Model(&assessment).Where("user_org_id = ? and patient_id = ? and status =6 and user_status = 1", orgid, patientId).Order("start_time desc").Last(&assessment).Error
1568
 	return assessment, err
1568
 	return assessment, err
1569
 }
1569
 }
1570
 
1570
 

+ 211 - 17
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
+	"github.com/shopspring/decimal"
13
+	"net/http"
12
 	"time"
14
 	"time"
13
 )
15
 )
14
 
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
+
15
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
27
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
16
 	role := models.XcxAdminUserRole{}
28
 	role := models.XcxAdminUserRole{}
17
 
29
 
26
 	return &role, nil
38
 	return &role, nil
27
 }
39
 }
28
 
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
+
29
 func CreateXcxAdminUser(role models.XcxAdminUserRole) error {
55
 func CreateXcxAdminUser(role models.XcxAdminUserRole) error {
30
 
56
 
31
 	err := UserReadDB().Create(&role).Error
57
 	err := UserReadDB().Create(&role).Error
127
 	return
153
 	return
128
 }
154
 }
129
 
155
 
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
+}
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
+
130
 func GetMobilePatient(mobile string, idcard string) (*models.XcxPatients, error) {
189
 func GetMobilePatient(mobile string, idcard string) (*models.XcxPatients, error) {
190
+	patient := models.XcxPatients{}
191
+	err := XTReadDB().Model(&patient).Where("(phone = ? or relative_phone =?) and id_card_no =?", mobile, mobile, idcard).Find(&patient).Error
192
+	//err := XTReadDB().Model(&patient).Where("id_card_no = ? and status = 1", mobile).Find(&patient).Error
193
+	if err == gorm.ErrRecordNotFound {
194
+		return nil, err
195
+	}
196
+	if err != nil {
197
+		return nil, err
198
+	}
199
+	return &patient, nil
200
+}
131
 
201
 
202
+func GetPatientByIdcardno(idcard string) (*models.XcxPatients, error) {
132
 	patient := models.XcxPatients{}
203
 	patient := models.XcxPatients{}
133
-	err := XTReadDB().Model(&patient).Where("(phone = ? or relative_phone =?) and id_card_no = ?", mobile, mobile, idcard).Find(&patient).Error
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
213
+}
214
+
215
+func GetNamePatient(name string, idcard string) (*models.XcxPatients, error) {
134
 
216
 
217
+	patient := models.XcxPatients{}
218
+	err := XTReadDB().Model(&patient).Where("name = ? and id_card_no =?", name, idcard).Find(&patient).Error
219
+	//err := XTReadDB().Model(&patient).Where("id_card_no = ? and status = 1", mobile).Find(&patient).Error
135
 	if err == gorm.ErrRecordNotFound {
220
 	if err == gorm.ErrRecordNotFound {
136
 		return nil, err
221
 		return nil, err
137
 	}
222
 	}
202
 	return encryptData, nil
287
 	return encryptData, nil
203
 }
288
 }
204
 
289
 
205
-//去除填充
290
+// 去除填充
206
 func PKCS7UnPadding(origData []byte) []byte {
291
 func PKCS7UnPadding(origData []byte) []byte {
207
 	length := len(origData)
292
 	length := len(origData)
208
 	unpadding := int(origData[length-1])
293
 	unpadding := int(origData[length-1])
214
 	return origData[:(length - unpadding)]
299
 	return origData[:(length - unpadding)]
215
 }
300
 }
216
 
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
+
217
 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) {
218
 
347
 
219
 	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
348
 	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
230
 		db = db.Where("x.patient_id = ?", patient_id)
359
 		db = db.Where("x.patient_id = ?", patient_id)
231
 	}
360
 	}
232
 
361
 
233
-	err = db.Select("x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,t.name").Joins("left join xt_patients as t on t.id = x.patient_id").Scan(&schedule).Error
362
+	err = db.Select("x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,t.name,x.bed_id,x.user_org_id").Joins("left join xt_patients as t on t.id = x.patient_id").Scan(&schedule).Error
234
 	return schedule, err
363
 	return schedule, err
235
 }
364
 }
236
 
365
 
366
+func GetAllBedNumberListTwo(user_org_id int64) (list []*models.DeviceNumber, err error) {
367
+
368
+	err = XTReadDB().Where("org_id =? and status=1", user_org_id).Find(&list).Error
369
+
370
+	return list, err
371
+}
372
+
237
 func GetTodayDialysis(recordDate int64, patient_id int64) (models.XcXDialysisOrder, error) {
373
 func GetTodayDialysis(recordDate int64, patient_id int64) (models.XcXDialysisOrder, error) {
238
 
374
 
239
 	order := models.XcXDialysisOrder{}
375
 	order := models.XcXDialysisOrder{}
295
 
431
 
296
 func GetDoctorAdviceGroup(patient_id int64, startime int64, endtime int64) (advice []*models.XcxDoctorAdvice, err error) {
432
 func GetDoctorAdviceGroup(patient_id int64, startime int64, endtime int64) (advice []*models.XcxDoctorAdvice, err error) {
297
 
433
 
298
-	err = XTReadDB().Where("patient_id = ? and advice_date >=? and advice_date<=? and status = 1", patient_id, startime, endtime).Group("advice_date").Order("advice_date desc").Find(&advice).Error
434
+	err = XTReadDB().Where("patient_id = ? and advice_date >=? and advice_date<=? and status = 6", patient_id, startime, endtime).Group("advice_date").Order("advice_date desc").Find(&advice).Error
299
 	return advice, err
435
 	return advice, err
300
 }
436
 }
301
 
437
 
306
 
442
 
307
 func GetDoctorAdvice(patient_id int64, startime int64, endtime int64) (advice []*models.XcxDoctorAdvice, err error) {
443
 func GetDoctorAdvice(patient_id int64, startime int64, endtime int64) (advice []*models.XcxDoctorAdvice, err error) {
308
 
444
 
309
-	err = XTReadDB().Where("patient_id = ? and advice_date >=? and advice_date<=? and status = 1", patient_id, startime, endtime).Find(&advice).Error
445
+	err = XTReadDB().Where("patient_id = ? and advice_date >=? and advice_date<=? and status = 6", patient_id, startime, endtime).Find(&advice).Error
310
 	return advice, err
446
 	return advice, err
311
 }
447
 }
312
 
448
 
321
 	var vm MDialysisScheduleVM
457
 	var vm MDialysisScheduleVM
322
 	err := readDb.
458
 	err := readDb.
323
 		Table("xt_schedule").
459
 		Table("xt_schedule").
324
-		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
460
+		Preload("DeviceNumber", "status = 6 AND org_id = ?", orgID).
325
 		Where("status = 1 AND user_org_id = ? AND patient_id = ?", orgID, patientID).
461
 		Where("status = 1 AND user_org_id = ? AND patient_id = ?", orgID, patientID).
326
 		First(&vm).Error
462
 		First(&vm).Error
327
 	if err != nil {
463
 	if err != nil {
337
 // 接诊评估
473
 // 接诊评估
338
 func MobileGetReceiverTreatmentAccessRecordOne(orgID int64, patientID int64, record_date int64) (*models.ReceiveTreatmentAsses, error) {
474
 func MobileGetReceiverTreatmentAccessRecordOne(orgID int64, patientID int64, record_date int64) (*models.ReceiveTreatmentAsses, error) {
339
 	var record models.ReceiveTreatmentAsses
475
 	var record models.ReceiveTreatmentAsses
340
-	err = readDb.Model(&models.ReceiveTreatmentAsses{}).Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ?", patientID, orgID, record_date).Find(&record).Error
476
+	err = readDb.Model(&models.ReceiveTreatmentAsses{}).Where("patient_id = ? and user_org_id = ? and status = 6 and record_date = ?", patientID, orgID, record_date).Find(&record).Error
341
 	if err != nil {
477
 	if err != nil {
342
 		if err == gorm.ErrRecordNotFound {
478
 		if err == gorm.ErrRecordNotFound {
343
 			return nil, nil
479
 			return nil, nil
351
 // 透前评估
487
 // 透前评估
352
 func MobileGetPredialysisEvaluationOne(orgID int64, patientID int64, assessment_date int64) (*models.PredialysisEvaluation, error) {
488
 func MobileGetPredialysisEvaluationOne(orgID int64, patientID int64, assessment_date int64) (*models.PredialysisEvaluation, error) {
353
 	var record models.PredialysisEvaluation
489
 	var record models.PredialysisEvaluation
354
-	err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date = ?", patientID, orgID, assessment_date).Find(&record).Error
490
+	err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id = ? and status = 6 and assessment_date = ?", patientID, orgID, assessment_date).Find(&record).Error
355
 	if err != nil {
491
 	if err != nil {
356
 		if err == gorm.ErrRecordNotFound {
492
 		if err == gorm.ErrRecordNotFound {
357
 			return nil, nil
493
 			return nil, nil
365
 // 获取 maxDate 之前一次的透前评估记录
501
 // 获取 maxDate 之前一次的透前评估记录
366
 func MobileGetLastTimePredialysisEvaluationOne(orgID int64, patientID int64) (*models.PredialysisEvaluation, error) {
502
 func MobileGetLastTimePredialysisEvaluationOne(orgID int64, patientID int64) (*models.PredialysisEvaluation, error) {
367
 	var record models.PredialysisEvaluation
503
 	var record models.PredialysisEvaluation
368
-	err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Order("assessment_date desc").Last(&record).Error
504
+	err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id = ? and status = 6", patientID, orgID).Order("assessment_date desc").Last(&record).Error
369
 	if err != nil {
505
 	if err != nil {
370
 		if err == gorm.ErrRecordNotFound {
506
 		if err == gorm.ErrRecordNotFound {
371
 			return nil, nil
507
 			return nil, nil
380
 	var records []*models.DoctorAdvice
516
 	var records []*models.DoctorAdvice
381
 	err := readDb.
517
 	err := readDb.
382
 		Model(&models.DoctorAdvice{}).
518
 		Model(&models.DoctorAdvice{}).
383
-		Where("patient_id = ? and user_org_id = ? and status = 1  and (advice_type = 2 || advice_type = 3) and advice_date = ?", patientID, orgID, advicedate).
519
+		Where("patient_id = ? and user_org_id = ? and status = 6  and (advice_type = 2 || advice_type = 3) and advice_date = ?", patientID, orgID, advicedate).
384
 		Select("id, user_org_id, patient_id, advice_type, advice_date, record_date, start_time, advice_name,advice_desc, reminder_date, drug_spec, drug_spec_unit, single_dose, single_dose_unit, prescribing_number, prescribing_number_unit, delivery_way, execution_frequency, advice_doctor, status, created_time,updated_time, advice_affirm, remark, stop_time, stop_reason, stop_doctor, stop_state, parent_id, execution_time, execution_staff, execution_state, checker, check_state, check_time, groupno,way,drug_id,drug_name_id, IF(parent_id > 0, parent_id, id) as advice_order").
520
 		Select("id, user_org_id, patient_id, advice_type, advice_date, record_date, start_time, advice_name,advice_desc, reminder_date, drug_spec, drug_spec_unit, single_dose, single_dose_unit, prescribing_number, prescribing_number_unit, delivery_way, execution_frequency, advice_doctor, status, created_time,updated_time, advice_affirm, remark, stop_time, stop_reason, stop_doctor, stop_state, parent_id, execution_time, execution_staff, execution_state, checker, check_state, check_time, groupno,way,drug_id,drug_name_id, IF(parent_id > 0, parent_id, id) as advice_order").
385
 		Order("start_time asc, groupno desc, advice_order desc, id asc").
521
 		Order("start_time asc, groupno desc, advice_order desc, id asc").
386
 		Scan(&records).Error
522
 		Scan(&records).Error
394
 // 透析记录
530
 // 透析记录
395
 func MobileGetSchedualDialysisRecordOne(orgID int64, patientID int64, dialysis_date int64) (*models.DialysisOrder, error) {
531
 func MobileGetSchedualDialysisRecordOne(orgID int64, patientID int64, dialysis_date int64) (*models.DialysisOrder, error) {
396
 	var record models.DialysisOrder
532
 	var record models.DialysisOrder
397
-	err := readDb.Model(&models.DialysisOrder{}).Preload("DeviceNumber", "org_id = ? AND  status = 1 ", orgID).Where("user_org_id = ? AND patient_id = ? and dialysis_date = ? ", orgID, patientID, dialysis_date).Find(&record).Error
533
+	err := readDb.Model(&models.DialysisOrder{}).Preload("DeviceNumber", "org_id = ? AND  status = 1", orgID).Where("user_org_id = ? AND patient_id = ? and dialysis_date = ? and status =6", orgID, patientID, dialysis_date).Find(&record).Error
398
 	if err != nil {
534
 	if err != nil {
399
 		if err == gorm.ErrRecordNotFound {
535
 		if err == gorm.ErrRecordNotFound {
400
 			return nil, nil
536
 			return nil, nil
408
 // 双人核对
544
 // 双人核对
409
 func MobileGetDoubleCheckOne(orgID int64, patientID int64, check_date int64) (*models.DoubleCheck, error) {
545
 func MobileGetDoubleCheckOne(orgID int64, patientID int64, check_date int64) (*models.DoubleCheck, error) {
410
 	var record models.DoubleCheck
546
 	var record models.DoubleCheck
411
-	err := readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? and user_org_id = ? and status = 1 and check_date = ?", patientID, orgID, check_date).Find(&record).Error
547
+	err := readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? and user_org_id = ? and status = 6 and check_date = ?", patientID, orgID, check_date).Find(&record).Error
412
 	if err != nil {
548
 	if err != nil {
413
 		if err == gorm.ErrRecordNotFound {
549
 		if err == gorm.ErrRecordNotFound {
414
 			return nil, nil
550
 			return nil, nil
422
 // 透析监测记录
558
 // 透析监测记录
423
 func MobileGetMonitorRecordsOne(orgID int64, patientID int64, monitoring_date int64) ([]*models.MonitoringRecord, error) {
559
 func MobileGetMonitorRecordsOne(orgID int64, patientID int64, monitoring_date int64) ([]*models.MonitoringRecord, error) {
424
 	var records []*models.MonitoringRecord
560
 	var records []*models.MonitoringRecord
425
-	err := readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? and user_org_id = ? and status = 1 and monitoring_date = ?", patientID, orgID, monitoring_date).Order("operate_time asc").Find(&records).Error
561
+	err := readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? and user_org_id = ? and status = 6 and monitoring_date = ?", patientID, orgID, monitoring_date).Order("operate_time asc").Find(&records).Error
426
 	if err != nil {
562
 	if err != nil {
427
 		return nil, err
563
 		return nil, err
428
 	}
564
 	}
431
 
567
 
432
 func MobileGetLastMonitorRecordOne(orgID int64, patientID int64) (*models.MonitoringRecord, error) {
568
 func MobileGetLastMonitorRecordOne(orgID int64, patientID int64) (*models.MonitoringRecord, error) {
433
 	var record models.MonitoringRecord
569
 	var record models.MonitoringRecord
434
-	err := readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? and user_org_id = ? and status = 1", patientID, orgID).Order("operate_time desc").Last(&record).Error
570
+	err := readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? and user_org_id = ? and status = 6", patientID, orgID).Order("operate_time desc").Last(&record).Error
435
 	if err != nil {
571
 	if err != nil {
436
 		if err == gorm.ErrRecordNotFound {
572
 		if err == gorm.ErrRecordNotFound {
437
 			return nil, nil
573
 			return nil, nil
445
 // 透后评估
581
 // 透后评估
446
 func MobileGetAssessmentAfterDislysisOne(orgID int64, patientID int64, assessment_date int64) (*models.AssessmentAfterDislysis, error) {
582
 func MobileGetAssessmentAfterDislysisOne(orgID int64, patientID int64, assessment_date int64) (*models.AssessmentAfterDislysis, error) {
447
 	var record models.AssessmentAfterDislysis
583
 	var record models.AssessmentAfterDislysis
448
-	err := readDb.Model(&models.AssessmentAfterDislysis{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date =? ", patientID, orgID, assessment_date).Find(&record).Error
584
+	err := readDb.Model(&models.AssessmentAfterDislysis{}).Where("patient_id = ? and user_org_id = ? and status = 6 and assessment_date =? ", patientID, orgID, assessment_date).Find(&record).Error
449
 	if err != nil {
585
 	if err != nil {
450
 		if err == gorm.ErrRecordNotFound {
586
 		if err == gorm.ErrRecordNotFound {
451
 			return nil, nil
587
 			return nil, nil
459
 // 治疗小结
595
 // 治疗小结
460
 func MobileGetTreatmentSummaryOne(orgID int64, patientID int64, assessment_date int64) (*models.TreatmentSummary, error) {
596
 func MobileGetTreatmentSummaryOne(orgID int64, patientID int64, assessment_date int64) (*models.TreatmentSummary, error) {
461
 	var record models.TreatmentSummary
597
 	var record models.TreatmentSummary
462
-	err := readDb.Model(&models.TreatmentSummary{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date= ?", patientID, orgID, assessment_date).Find(&record).Error
598
+	err := readDb.Model(&models.TreatmentSummary{}).Where("patient_id = ? and user_org_id = ? and status = 6 and assessment_date= ?", patientID, orgID, assessment_date).Find(&record).Error
463
 	if err != nil {
599
 	if err != nil {
464
 		if err == gorm.ErrRecordNotFound {
600
 		if err == gorm.ErrRecordNotFound {
465
 			return nil, nil
601
 			return nil, nil
505
 
641
 
506
 func MobileGetDialysisPrescribeByModeIdFive(orgID int64, patientID int64, record_date int64) (*models.DialysisPrescription, error) {
642
 func MobileGetDialysisPrescribeByModeIdFive(orgID int64, patientID int64, record_date int64) (*models.DialysisPrescription, error) {
507
 	var record models.DialysisPrescription
643
 	var record models.DialysisPrescription
508
-	err := readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ?", patientID, orgID, record_date).Find(&record).Error
644
+	err := readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 6 and record_date = ?", patientID, orgID, record_date).Find(&record).Error
509
 	if err != nil {
645
 	if err != nil {
510
 		if err == gorm.ErrRecordNotFound {
646
 		if err == gorm.ErrRecordNotFound {
511
 			return nil, nil
647
 			return nil, nil
580
 	return schedule, err
716
 	return schedule, err
581
 }
717
 }
582
 
718
 
719
+func GetInspectionGroupListByXcx(patientid int64, page int64, number int64) (inspection []*models.XcxInspectionTwo, err error) {
720
+
721
+	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
722
+	if patientid > 0 {
723
+		db = db.Where("x.patient_id = ?", patientid)
724
+	}
725
+	offset := (page - 1) * number
726
+	//if startime > 0 {
727
+	//	db = db.Where("x.inspect_date >= ?", startime)
728
+	//}
729
+	//if endtime > 0 {
730
+	//	db = db.Where("x.inspect_date <= ?", endtime)
731
+	//}
732
+	err = db.Group("x.inspect_date,x.project_id").Order("x.created_time").Offset(offset).Limit(number).Scan(&inspection).Error
733
+	return inspection, err
734
+}
735
+
736
+func GetInspectionInfoByXcx(patientid int64, project_id int64, inspect_date int64) (inspection []*models.XcxInspectionTwo, err error) {
737
+	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
738
+	return inspection, err
739
+}
740
+
583
 func GetInspectionGroupList(patientid int64, startime int64, endtime int64) (inspection []*models.XcxInspection, err error) {
741
 func GetInspectionGroupList(patientid int64, startime int64, endtime int64) (inspection []*models.XcxInspection, err error) {
584
 
742
 
585
 	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
743
 	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
632
 	err = UserReadDB().Model(&score).Where("activity_id = ?", activityID).Count(&total).Offset(offset).Limit(limit).Preload("SybStory").Find(&score).Error
790
 	err = UserReadDB().Model(&score).Where("activity_id = ?", activityID).Count(&total).Offset(offset).Limit(limit).Preload("SybStory").Find(&score).Error
633
 	return score, total, err
791
 	return score, total, err
634
 }
792
 }
793
+
794
+func SendWxAuthAPI(appID string, appSecret string, grant_type string, code string) (map[string]string, error) {
795
+
796
+	var code2sessionURL = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appID + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=" + grant_type
797
+	var url = fmt.Sprintf(code2sessionURL, appID, appSecret, code)
798
+	fmt.Println("url233232323322323", url)
799
+	resp, err := http.DefaultClient.Get(code2sessionURL)
800
+	fmt.Println("resp32332232332322", resp)
801
+
802
+	var wxMap map[string]string
803
+	err = json.NewDecoder(resp.Body).Decode(&wxMap)
804
+	if err != nil {
805
+		return wxMap, err
806
+	}
807
+	defer resp.Body.Close()
808
+
809
+	return wxMap, err
810
+}
811
+
812
+func SendWxAuthAPIOne(appID string, appSecret string, grant_type string, code string) (string, error) {
813
+	var code2sessionURL = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appID + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=" + grant_type
814
+	var url = fmt.Sprintf(code2sessionURL, appID, appSecret, code)
815
+	fmt.Println(url)
816
+	resp, err := http.DefaultClient.Get(code2sessionURL)
817
+	if err != nil {
818
+		return "", err
819
+	}
820
+	var wxMap map[string]string
821
+	err = json.NewDecoder(resp.Body).Decode(&wxMap)
822
+	if err != nil {
823
+		return "", err
824
+	}
825
+	defer resp.Body.Close()
826
+	fmt.Println("2333232232", wxMap)
827
+	return wxMap["session_key"], nil
828
+}