|
@@ -20,6 +20,7 @@ type HisDepositApiController struct {
|
20
|
20
|
|
21
|
21
|
func HisDepositApiRegistRouters() {
|
22
|
22
|
//beego.Router("/api/his/ttt", &HisDepositApiController{}, "get:TTT") //测试接口
|
|
23
|
+ beego.Router("/api/his/gethisusertoalive", &HisDepositApiController{}, "get:GetHisUserToAlive") //获取病例中心,有效患者名称(去除了转出和死亡的)
|
23
|
24
|
beego.Router("/api/his/gethisuser", &HisDepositApiController{}, "get:GetHisUser") //获取病例中心,有效患者名称
|
24
|
25
|
beego.Router("/api/his/adddeposit", &HisDepositApiController{}, "post:AddDeposit") //新增押金
|
25
|
26
|
beego.Router("/api/his/getdepositcode", &HisDepositApiController{}, "get:GetDepositCode") //获取新增押金编号
|
|
@@ -58,9 +59,27 @@ func HisDepositApiRegistRouters() {
|
58
|
59
|
// return
|
59
|
60
|
//}
|
60
|
61
|
|
|
62
|
+//获取病例中心,有效患者名称(去除了转出和死亡的)
|
|
63
|
+func (this *HisDepositApiController) GetHisUserToAlive() {
|
|
64
|
+ orgid := this.GetAdminUserInfo().CurrentOrgId
|
|
65
|
+ list, err := service.GetHisUserToAlive(orgid)
|
|
66
|
+ if err != nil {
|
|
67
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
|
68
|
+ return
|
|
69
|
+ }
|
|
70
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
71
|
+ "list": list,
|
|
72
|
+ })
|
|
73
|
+ return
|
|
74
|
+}
|
|
75
|
+
|
61
|
76
|
//获取病例中心,有效患者名称
|
62
|
77
|
func (this *HisDepositApiController) GetHisUser() {
|
63
|
78
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
|
79
|
+ token := this.Ctx.Request.Header.Get("Cookie")
|
|
80
|
+ fmt.Println(token)
|
|
81
|
+ this.Ctx.SetCookie("ppp", "lilili")
|
|
82
|
+ this.Ctx.SetCookie("ppp01", "lilili01")
|
64
|
83
|
list, err := service.GetHisUser(orgid)
|
65
|
84
|
if err != nil {
|
66
|
85
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
|
@@ -205,7 +224,9 @@ func (this *HisDepositApiController) RechargeDetails() {
|
205
|
224
|
}
|
206
|
225
|
}
|
207
|
226
|
if start_time == "" && end_time == "" {
|
208
|
|
- stime, etime = service.GetMondayOfWeek()
|
|
227
|
+ //如果为空查询全部的
|
|
228
|
+ _, etime = service.GetMondayOfWeek()
|
|
229
|
+ stime = 0
|
209
|
230
|
} else {
|
210
|
231
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
211
|
232
|
etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
@@ -259,7 +280,8 @@ func (this *HisDepositApiController) RechargeSummary() {
|
259
|
280
|
}
|
260
|
281
|
}
|
261
|
282
|
if start_time == "" && end_time == "" {
|
262
|
|
- stime, etime = service.GetMondayOfWeek()
|
|
283
|
+ _, etime = service.GetMondayOfWeek()
|
|
284
|
+ stime = 0
|
263
|
285
|
} else {
|
264
|
286
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
265
|
287
|
etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
@@ -372,6 +394,8 @@ func (this *HisDepositApiController) DepositFlow() {
|
372
|
394
|
check := map[string][]string{
|
373
|
395
|
"id": {"must", "int", "id"},
|
374
|
396
|
"deposit_status": {"must", "int", "deposit_status"},
|
|
397
|
+ "page": {"must", "string", "page"},
|
|
398
|
+ "limit": {"must", "string", "limit"},
|
375
|
399
|
}
|
376
|
400
|
_, err := checks(this, &check)
|
377
|
401
|
if err != nil {
|
|
@@ -383,19 +407,23 @@ func (this *HisDepositApiController) DepositFlow() {
|
383
|
407
|
tmp, _ := service.GetHisUserName(orgid, id)
|
384
|
408
|
name := tmp.Name
|
385
|
409
|
deposit_status, _ := this.GetInt64("deposit_status", 0) //押金类型
|
386
|
|
- if deposit_status > 3 {
|
|
410
|
+ if deposit_status > 4 {
|
387
|
411
|
utils.ErrorLog("押金类型错误,deposit_status:", deposit_status)
|
388
|
412
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金类型错误")
|
389
|
413
|
return
|
390
|
414
|
}
|
391
|
415
|
start_time := this.GetString("start_time", "") //开始时间
|
392
|
416
|
end_time := this.GetString("end_time", "") //结束时间
|
|
417
|
+ page, _ := this.GetInt64("page") //页码
|
|
418
|
+ limit, _ := this.GetInt64("limit") //每一页查出来的条数
|
393
|
419
|
timeLayout := "2006-01-02"
|
394
|
420
|
loc, _ := time.LoadLocation("Local")
|
395
|
421
|
var stime int64 //开始时间
|
396
|
422
|
var etime int64 //结束时间
|
397
|
423
|
if start_time == "" && end_time == "" {
|
398
|
|
- stime, etime = service.GetMonth()
|
|
424
|
+ //如果为空则查全部的
|
|
425
|
+ _, etime = service.GetMonth()
|
|
426
|
+ stime = 0
|
399
|
427
|
} else {
|
400
|
428
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
401
|
429
|
etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
@@ -405,7 +433,7 @@ func (this *HisDepositApiController) DepositFlow() {
|
405
|
433
|
//获取该角色当前时间段的余额
|
406
|
434
|
decimal := service.GetMoneyforTime(id, orgid, etime)
|
407
|
435
|
//获取列表
|
408
|
|
- deposirhistory, errs := service.GetFlowList(id, orgid, stime, etime, deposit_status)
|
|
436
|
+ deposirhistory, total, errs := service.GetFlowList(page, limit, id, orgid, stime, etime, deposit_status)
|
409
|
437
|
if errs != nil {
|
410
|
438
|
utils.ErrorLog("获取列表失败,原因为:", errs.Error())
|
411
|
439
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, errs.Error())
|
|
@@ -423,6 +451,7 @@ func (this *HisDepositApiController) DepositFlow() {
|
423
|
451
|
"list": deposirhistory,
|
424
|
452
|
"name": name,
|
425
|
453
|
"decimal": decimal,
|
|
454
|
+ "total": total,
|
426
|
455
|
})
|
427
|
456
|
return
|
428
|
457
|
}
|
|
@@ -475,6 +504,7 @@ func (this *HisDepositApiController) GetUserList() {
|
475
|
504
|
//扣费明细查询
|
476
|
505
|
func (this *HisDepositApiController) DeductionDetails() {
|
477
|
506
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
|
507
|
+ orgid = 9675
|
478
|
508
|
timeLayout := "2006-01-02"
|
479
|
509
|
loc, _ := time.LoadLocation("Local")
|
480
|
510
|
keyword := this.GetString("keyword")
|
|
@@ -498,7 +528,8 @@ func (this *HisDepositApiController) DeductionDetails() {
|
498
|
528
|
}
|
499
|
529
|
}
|
500
|
530
|
if start_time == "" && end_time == "" {
|
501
|
|
- stime, etime = service.GetMondayOfWeek()
|
|
531
|
+ _, etime = service.GetMondayOfWeek()
|
|
532
|
+ stime = 0
|
502
|
533
|
} else {
|
503
|
534
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
504
|
535
|
etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
@@ -526,7 +557,8 @@ func (this *HisDepositApiController) DeductionDetails() {
|
526
|
557
|
details.Decimal = list[i].Deposit
|
527
|
558
|
details.ChargeDate = fmt.Sprintf(time.Unix(list[i].Ctime, 0).Format("2006-01-02 15:04:05"))
|
528
|
559
|
details.Chargetype = service.CodeToChargetype(orgid, details.Code)
|
529
|
|
- details.Total = service.MedicalTotal(orgid, list[i].HisPatientId, details.Code)
|
|
560
|
+ details.Total = service.MedicalTotal(orgid, tmp_id)
|
|
561
|
+ details.ButtonShow = service.IsButtonShow(list[i].DepositCode, orgid, list[i].HisPatientId)
|
530
|
562
|
detailslist = append(detailslist, details)
|
531
|
563
|
}
|
532
|
564
|
|
|
@@ -540,6 +572,7 @@ func (this *HisDepositApiController) DeductionDetails() {
|
540
|
572
|
//扣费汇总
|
541
|
573
|
func (this *HisDepositApiController) DeSummary() {
|
542
|
574
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
|
575
|
+ orgid = 9675
|
543
|
576
|
timeLayout := "2006-01-02"
|
544
|
577
|
loc, _ := time.LoadLocation("Local")
|
545
|
578
|
keyword := this.GetString("keyword")
|
|
@@ -563,7 +596,8 @@ func (this *HisDepositApiController) DeSummary() {
|
563
|
596
|
}
|
564
|
597
|
}
|
565
|
598
|
if start_time == "" && end_time == "" {
|
566
|
|
- stime, etime = service.GetMondayOfWeek()
|
|
599
|
+ _, etime = service.GetMondayOfWeek()
|
|
600
|
+ stime = 0
|
567
|
601
|
} else {
|
568
|
602
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
569
|
603
|
etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
@@ -583,7 +617,8 @@ func (this *HisDepositApiController) DeSummary() {
|
583
|
617
|
sum = sum.Add(list[i].Deposit)
|
584
|
618
|
details.Name = namemap[list[i].HisPatientId]
|
585
|
619
|
details.Decimal = list[i].Deposit
|
586
|
|
- details.Total = service.MedicalTotal(orgid, list[i].HisPatientId, list[i].DepositCode)
|
|
620
|
+ tmp_id, _ := strconv.ParseInt(list[i].DepositCode, 10, 64)
|
|
621
|
+ details.Total = service.MedicalTotal(orgid, tmp_id)
|
587
|
622
|
detailslist = append(detailslist, details)
|
588
|
623
|
}
|
589
|
624
|
maplist := make(map[string]models.DeductionSummary)
|
|
@@ -611,7 +646,7 @@ func (this *HisDepositApiController) DeSummary() {
|
611
|
646
|
Finlist = append(Finlist, maplist[tmpslice[i]])
|
612
|
647
|
}
|
613
|
648
|
this.ServeSuccessJSON(map[string]interface{}{
|
614
|
|
- "list": detailslist,
|
|
649
|
+ "list": Finlist,
|
615
|
650
|
"sum": sum,
|
616
|
651
|
})
|
617
|
652
|
return
|
|
@@ -835,6 +870,8 @@ func (this *HisDepositApiController) RefundList() {
|
835
|
870
|
check := map[string][]string{
|
836
|
871
|
"refundtype": {"must", "int", "refundtype"},
|
837
|
872
|
"examinetype": {"must", "int", "examinetype"},
|
|
873
|
+ "page": {"must", "string", "page"},
|
|
874
|
+ "limit": {"must", "string", "limit"},
|
838
|
875
|
}
|
839
|
876
|
_, err := checks(this, &check)
|
840
|
877
|
if err != nil {
|
|
@@ -847,6 +884,8 @@ func (this *HisDepositApiController) RefundList() {
|
847
|
884
|
keyword := this.GetString("keyword") //获取搜索框
|
848
|
885
|
refundtype, _ := this.GetInt64("refundtype") //获取退款类型
|
849
|
886
|
examinetype, _ := this.GetInt64("examinetype") //获取审核状态
|
|
887
|
+ page, _ := this.GetInt64("page") //页码
|
|
888
|
+ limit, _ := this.GetInt64("limit") //每一页查出来的条数
|
850
|
889
|
start_time := this.GetString("start_time")
|
851
|
890
|
end_time := this.GetString("end_time")
|
852
|
891
|
var stime int64 //开始时间
|
|
@@ -868,6 +907,7 @@ func (this *HisDepositApiController) RefundList() {
|
868
|
907
|
}
|
869
|
908
|
if start_time == "" && end_time == "" {
|
870
|
909
|
stime, etime = service.GetMondayOfWeek()
|
|
910
|
+ stime = 0
|
871
|
911
|
} else {
|
872
|
912
|
stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
873
|
913
|
etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
@@ -875,7 +915,8 @@ func (this *HisDepositApiController) RefundList() {
|
875
|
915
|
etime = etmp.Unix()
|
876
|
916
|
}
|
877
|
917
|
depo := []models.RefundList{}
|
878
|
|
- depo, err = service.RefundList(orgid, stime, etime, refundtype, examinetype, keyword, slicekey)
|
|
918
|
+ var total int64
|
|
919
|
+ depo, total, err = service.RefundList(page, limit, orgid, stime, etime, refundtype, examinetype, keyword, slicekey)
|
879
|
920
|
if err != nil {
|
880
|
921
|
utils.ErrorLog("查询失败,原因为:", err.Error())
|
881
|
922
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -891,10 +932,14 @@ func (this *HisDepositApiController) RefundList() {
|
891
|
932
|
}
|
892
|
933
|
if depo[i].DepositStatus == 4 {
|
893
|
934
|
depo[i].Name = "-"
|
|
935
|
+ tmpcode, _ := strconv.ParseInt(depo[i].DepositCode, 10, 64)
|
|
936
|
+ depo[i].DepositCode = service.FindcodeToid(tmpcode)
|
894
|
937
|
}
|
|
938
|
+
|
895
|
939
|
}
|
896
|
940
|
this.ServeSuccessJSON(map[string]interface{}{
|
897
|
|
- "list": depo,
|
|
941
|
+ "list": depo,
|
|
942
|
+ "total": total,
|
898
|
943
|
})
|
899
|
944
|
return
|
900
|
945
|
}
|