|
@@ -22,6 +22,7 @@ func DialysisPrameteRoutes() {
|
22
|
22
|
beego.Router("/api/dialysis/getcollectlist", &DialysisPrameterApiController{}, "Get:GetCollectList")
|
23
|
23
|
beego.Router("/api/dialysis/getbatchcollection", &DialysisPrameterApiController{}, "Get:GetBatchCollection")
|
24
|
24
|
beego.Router("/api/dialysis/getgatherlist", &DialysisPrameterApiController{}, "Get:GetGatherList")
|
|
25
|
+ beego.Router("/api/dialysis/getanticoagulantcount", &DialysisPrameterApiController{}, "Get:GetAnticoagulantCount")
|
25
|
26
|
}
|
26
|
27
|
|
27
|
28
|
func (this *DialysisPrameterApiController) GetDialysisParameters() {
|
|
@@ -194,11 +195,12 @@ func (this *DialysisPrameterApiController) GetCollectList() {
|
194
|
195
|
start_time := this.GetString("start_time")
|
195
|
196
|
fmt.Println(start_time)
|
196
|
197
|
startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
198
|
+ fmt.Println("startime", startime.Unix())
|
197
|
199
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
198
|
200
|
endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 23:59:59", loc)
|
199
|
201
|
keyword := this.GetString("keyword")
|
200
|
202
|
//获取透析参数数据
|
201
|
|
- schedule, err, total := service.GetCollectList(limit, page, partitiontype, scheduletype, startime.Unix(), orgId, keyword)
|
|
203
|
+ schedule, err, _ := service.GetCollectList(limit, page, partitiontype, scheduletype, startime.Unix(), orgId, keyword)
|
202
|
204
|
|
203
|
205
|
//查询今日排班的病人
|
204
|
206
|
patient, err := service.GetDialysisTodaySchedulePatient(orgId, startime.Unix(), page, limit)
|
|
@@ -232,15 +234,76 @@ func (this *DialysisPrameterApiController) GetCollectList() {
|
232
|
234
|
//获取透析耗材数据
|
233
|
235
|
consumables, err := service.GetDialysisConsumables(startime.Unix(), endtime.Unix(), orgId)
|
234
|
236
|
|
235
|
|
- if err == nil {
|
|
237
|
+ //if err == nil {
|
|
238
|
+ // this.ServeSuccessJSON(map[string]interface{}{
|
|
239
|
+ // "schedule": schedule,
|
|
240
|
+ // "total": total,
|
|
241
|
+ // "consumables": consumables,
|
|
242
|
+ // "prescription": vlist,
|
|
243
|
+ // "reducelist": clist,
|
|
244
|
+ // })
|
|
245
|
+ //}
|
|
246
|
+
|
|
247
|
+ _, errors := service.FindStockOutByIsSys(orgId, 1, startime.Unix())
|
|
248
|
+
|
|
249
|
+ goodTypes, _ := service.FindAllGoodType(orgId) //two, err, i := service.PCGetDialysisGoodsTwo(orgId, startime.Unix(), scheduletype, partitiontype, page, limit, keyword)
|
|
250
|
+
|
|
251
|
+ if errors == gorm.ErrRecordNotFound {
|
|
252
|
+
|
|
253
|
+ dialysisGoods, _, total := service.PCGetDialysisGoodsTwo(orgId, startime.Unix(), scheduletype, partitiontype, page, limit, keyword)
|
|
254
|
+ for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
|
|
255
|
+
|
|
256
|
+ goodUser, _ := service.GetLastDialysisGoods(item.PatientId, orgId, startime.Unix())
|
|
257
|
+ lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, orgId, startime.Unix())
|
|
258
|
+ item.LastAutomaticReduceDetail = goodUser
|
|
259
|
+ item.LastDialysisBeforePrepare = lastGoodUserDetial
|
|
260
|
+ }
|
236
|
261
|
this.ServeSuccessJSON(map[string]interface{}{
|
237
|
|
- "schedule": schedule,
|
238
|
|
- "total": total,
|
239
|
|
- "consumables": consumables,
|
240
|
|
- "prescription": vlist,
|
241
|
|
- "reducelist": clist,
|
|
262
|
+ "dialysis_goods": dialysisGoods,
|
|
263
|
+ "good_type": goodTypes,
|
|
264
|
+ "total": total,
|
|
265
|
+ "schedule": schedule,
|
|
266
|
+ "consumables": consumables,
|
|
267
|
+ "prescription": vlist,
|
|
268
|
+ "reducelist": clist,
|
242
|
269
|
})
|
|
270
|
+ return
|
|
271
|
+
|
|
272
|
+ } else if err == nil {
|
|
273
|
+ //获取当天排班的每个患者的库存使用情况
|
|
274
|
+ dialysisGoods, err, total := service.PCGetDialysisGoodsTwo(orgId, startime.Unix(), scheduletype, partitiontype, page, limit, keyword)
|
|
275
|
+ for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
|
|
276
|
+ goodUser, _ := service.GetLastDialysisGoods(item.PatientId, orgId, startime.Unix())
|
|
277
|
+ lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, orgId, startime.Unix())
|
|
278
|
+
|
|
279
|
+ fmt.Println(goodUser)
|
|
280
|
+ fmt.Println(lastGoodUserDetial)
|
|
281
|
+
|
|
282
|
+ item.LastAutomaticReduceDetail = goodUser
|
|
283
|
+ item.LastDialysisBeforePrepare = lastGoodUserDetial
|
|
284
|
+ }
|
|
285
|
+ if err == nil {
|
|
286
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
287
|
+ "dialysis_goods": dialysisGoods,
|
|
288
|
+ "good_type": goodTypes,
|
|
289
|
+ "total": total,
|
|
290
|
+ "schedule": schedule,
|
|
291
|
+ "consumables": consumables,
|
|
292
|
+ "prescription": vlist,
|
|
293
|
+ "reducelist": clist,
|
|
294
|
+ })
|
|
295
|
+ return
|
|
296
|
+
|
|
297
|
+ } else {
|
|
298
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
299
|
+ return
|
|
300
|
+ }
|
|
301
|
+ } else if err != nil {
|
|
302
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
303
|
+ return
|
|
304
|
+
|
243
|
305
|
}
|
|
306
|
+
|
244
|
307
|
}
|
245
|
308
|
|
246
|
309
|
func (this *DialysisPrameterApiController) GetBatchCollection() {
|
|
@@ -330,3 +393,24 @@ func (this *DialysisPrameterApiController) GetGatherList() {
|
330
|
393
|
})
|
331
|
394
|
}
|
332
|
395
|
}
|
|
396
|
+
|
|
397
|
+func (this *DialysisPrameterApiController) GetAnticoagulantCount() {
|
|
398
|
+ timeLayout := "2006-01-02"
|
|
399
|
+ loc, _ := time.LoadLocation("Local")
|
|
400
|
+ adminUser := this.GetAdminUserInfo()
|
|
401
|
+ orgId := adminUser.CurrentOrgId
|
|
402
|
+ fmt.Println(orgId)
|
|
403
|
+ start_time := this.GetString("start_time")
|
|
404
|
+ end_time := this.GetString("end_time")
|
|
405
|
+ startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
406
|
+ endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
407
|
+ fmt.Println("开始时间2222", startime)
|
|
408
|
+ fmt.Println("结束时间3333", endtime)
|
|
409
|
+ //统计抗凝剂数据
|
|
410
|
+ count, err := service.GetAnticoagulantCount(startime.Unix(), endtime.Unix(), orgId)
|
|
411
|
+ if err == nil {
|
|
412
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
413
|
+ "count": count,
|
|
414
|
+ })
|
|
415
|
+ }
|
|
416
|
+}
|