|
@@ -94,6 +94,8 @@ func (this *DialysisPrameterApiController) GetDialysisParameters() {
|
94
|
94
|
}
|
95
|
95
|
|
96
|
96
|
func (this *DialysisPrameterApiController) GetDialysisBatchParameters() {
|
|
97
|
+ timeLayout := "2006-01-02"
|
|
98
|
+ loc, _ := time.LoadLocation("Local")
|
97
|
99
|
adminUser := this.GetAdminUserInfo()
|
98
|
100
|
orgId := adminUser.CurrentOrgId
|
99
|
101
|
schIDStr := this.GetString("ids")
|
|
@@ -102,11 +104,40 @@ func (this *DialysisPrameterApiController) GetDialysisBatchParameters() {
|
102
|
104
|
return
|
103
|
105
|
}
|
104
|
106
|
idStrs := strings.Split(schIDStr, ",")
|
105
|
|
-
|
|
107
|
+ startime := this.GetString("startime")
|
|
108
|
+ theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
|
106
|
109
|
parameters, err := service.GetDialysisBatchParameters(idStrs, orgId)
|
|
110
|
+ var vlist []interface{}
|
|
111
|
+ var elist []interface{}
|
|
112
|
+ for _, item := range parameters {
|
|
113
|
+ //查询当前日期的病人是否存在数据
|
|
114
|
+ _, errcode := service.GetToDayDialysisPrescription(item.PatientId, orgId, theTime.Unix())
|
|
115
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
116
|
+ //查询每个病人透析处方的最后一次数据
|
|
117
|
+ prescription, _ := service.GetLastDialysisPrescription(item.PatientId, orgId)
|
|
118
|
+ vlist = append(vlist, prescription)
|
|
119
|
+ } else if errcode == nil {
|
|
120
|
+ //获取当前日期
|
|
121
|
+ prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgId, theTime.Unix())
|
|
122
|
+ vlist = append(vlist, prescription)
|
|
123
|
+ }
|
|
124
|
+
|
|
125
|
+ _, errcodes := service.GetTodayAssessmentBeforDialysis(item.PatientId, orgId, theTime.Unix())
|
|
126
|
+ if errcodes == gorm.ErrRecordNotFound {
|
|
127
|
+ //查询每个病人透前评估的最后一次数据
|
|
128
|
+ dialysis, _ := service.GetLastAssessmentBeforDialysis(item.PatientId, orgId)
|
|
129
|
+ elist = append(elist, dialysis)
|
|
130
|
+ } else if errcodes == nil {
|
|
131
|
+ dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgId, theTime.Unix())
|
|
132
|
+ elist = append(elist, dialysis)
|
|
133
|
+ }
|
|
134
|
+
|
|
135
|
+ }
|
107
|
136
|
if err == nil {
|
108
|
137
|
this.ServeSuccessJSON(map[string]interface{}{
|
109
|
|
- "schedule": parameters,
|
|
138
|
+ "schedule": parameters,
|
|
139
|
+ "prescription": vlist,
|
|
140
|
+ "dialysbefor": elist,
|
110
|
141
|
})
|
111
|
142
|
}
|
112
|
143
|
}
|
|
@@ -171,9 +202,10 @@ func (this *DialysisPrameterApiController) GetCollectList() {
|
171
|
202
|
|
172
|
203
|
//查询今日排班的病人
|
173
|
204
|
patient, err := service.GetDialysisTodaySchedulePatient(orgId, startime.Unix(), page, limit)
|
174
|
|
-
|
175
|
205
|
var vlist []interface{}
|
|
206
|
+ var clist []interface{}
|
176
|
207
|
for _, item := range patient {
|
|
208
|
+ fmt.Println("---------", item.PatientId)
|
177
|
209
|
//查询当前日期的病人是否存在数据
|
178
|
210
|
_, errcode := service.GetToDayDialysisPrescription(item.PatientId, orgId, startime.Unix())
|
179
|
211
|
if errcode == gorm.ErrRecordNotFound {
|
|
@@ -186,15 +218,27 @@ func (this *DialysisPrameterApiController) GetCollectList() {
|
186
|
218
|
vlist = append(vlist, prescription)
|
187
|
219
|
}
|
188
|
220
|
|
|
221
|
+ //查询每个病人当前日期是否存在数据
|
|
222
|
+ _, errco := service.GetAotoMaticReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
|
|
223
|
+ fmt.Println("errco--------------------------", errco)
|
|
224
|
+ if errco == gorm.ErrRecordNotFound {
|
|
225
|
+ reduece, _ := service.GetMaticReduece(item.PatientId, orgId)
|
|
226
|
+ clist = append(clist, reduece)
|
|
227
|
+ } else if errco == nil {
|
|
228
|
+ reduece, _ := service.GetMaticeReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
|
|
229
|
+ clist = append(clist, reduece)
|
|
230
|
+ }
|
189
|
231
|
}
|
190
|
232
|
//获取透析耗材数据
|
191
|
233
|
consumables, err := service.GetDialysisConsumables(startime.Unix(), endtime.Unix(), orgId)
|
|
234
|
+
|
192
|
235
|
if err == nil {
|
193
|
236
|
this.ServeSuccessJSON(map[string]interface{}{
|
194
|
|
- "schedule": schedule,
|
195
|
|
- "total": total,
|
196
|
|
- "consumables": consumables,
|
197
|
|
- "prescrption": vlist,
|
|
237
|
+ "schedule": schedule,
|
|
238
|
+ "total": total,
|
|
239
|
+ "consumables": consumables,
|
|
240
|
+ "prescription": vlist,
|
|
241
|
+ "reducelist": clist,
|
198
|
242
|
})
|
199
|
243
|
}
|
200
|
244
|
}
|
|
@@ -211,17 +255,47 @@ func (this *DialysisPrameterApiController) GetBatchCollection() {
|
211
|
255
|
schIDStr := this.GetString("ids")
|
212
|
256
|
//获取透析耗材数据
|
213
|
257
|
consumables, err := service.GetDialysisConsumables(startime.Unix(), endtime.Unix(), orgId)
|
|
258
|
+
|
214
|
259
|
if len(schIDStr) == 0 {
|
215
|
260
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
216
|
261
|
return
|
217
|
262
|
}
|
218
|
263
|
idStrs := strings.Split(schIDStr, ",")
|
219
|
264
|
fmt.Println(idStrs)
|
|
265
|
+ var vlist []interface{}
|
|
266
|
+ var clist []interface{}
|
220
|
267
|
schedule, err := service.GetBatchCollection(orgId, idStrs)
|
|
268
|
+ for _, item := range schedule {
|
|
269
|
+ //查询当前日期的病人是否存在数据
|
|
270
|
+ _, errcode := service.GetToDayDialysisPrescription(item.PatientId, orgId, startime.Unix())
|
|
271
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
272
|
+ //查询每个病人透析处方的最后一次数据
|
|
273
|
+ prescription, _ := service.GetLastDialysisPrescription(item.PatientId, orgId)
|
|
274
|
+ vlist = append(vlist, prescription)
|
|
275
|
+ } else if errcode == nil {
|
|
276
|
+ //获取当前日期
|
|
277
|
+ prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgId, startime.Unix())
|
|
278
|
+ vlist = append(vlist, prescription)
|
|
279
|
+ }
|
|
280
|
+
|
|
281
|
+ //查询每个病人当前日期是否存在数据
|
|
282
|
+ _, errco := service.GetAotoMaticReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
|
|
283
|
+ fmt.Println("errco", errco)
|
|
284
|
+ if errco == gorm.ErrRecordNotFound {
|
|
285
|
+ reduece, _ := service.GetMaticReduece(item.PatientId, orgId)
|
|
286
|
+ clist = append(clist, reduece)
|
|
287
|
+ } else if errco == nil {
|
|
288
|
+ reduece, _ := service.GetMaticeReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
|
|
289
|
+ clist = append(clist, reduece)
|
|
290
|
+ }
|
|
291
|
+
|
|
292
|
+ }
|
221
|
293
|
if err == nil {
|
222
|
294
|
this.ServeSuccessJSON(map[string]interface{}{
|
223
|
|
- "schedule": schedule,
|
224
|
|
- "consumables": consumables,
|
|
295
|
+ "schedule": schedule,
|
|
296
|
+ "consumables": consumables,
|
|
297
|
+ "prescripiton": vlist,
|
|
298
|
+ "reducelist": clist,
|
225
|
299
|
})
|
226
|
300
|
}
|
227
|
301
|
}
|
|
@@ -247,7 +321,7 @@ func (this *DialysisPrameterApiController) GetGatherList() {
|
247
|
321
|
|
248
|
322
|
//统计抗凝剂数据
|
249
|
323
|
count, err := service.GetAnticoagulantCount(startime.Unix(), endtime.Unix(), orgId)
|
250
|
|
- fmt.Println("er--------------------------------------", count)
|
|
324
|
+
|
251
|
325
|
if err == nil {
|
252
|
326
|
this.ServeSuccessJSON(map[string]interface{}{
|
253
|
327
|
"warehouselist": warehouselist,
|