|
@@ -6,6 +6,7 @@ import (
|
6
|
6
|
"XT_New/service"
|
7
|
7
|
"fmt"
|
8
|
8
|
"github.com/astaxie/beego"
|
|
9
|
+ "github.com/shopspring/decimal"
|
9
|
10
|
"math/rand"
|
10
|
11
|
"strconv"
|
11
|
12
|
"strings"
|
|
@@ -29,6 +30,7 @@ func HisHospitalManagerApiRegistRouters() {
|
29
|
30
|
beego.Router("/api/hospital/outhopitaluncheck/get", &HisHospitalApiController{}, "get:GetZHOutHospitalUnCheck")
|
30
|
31
|
beego.Router("/api/hospital/refund", &HisHospitalApiController{}, "get:ZHRefund")
|
31
|
32
|
beego.Router("/api/hospital/upload", &HisHospitalApiController{}, "get:GetUploadInfo")
|
|
33
|
+ beego.Router("/api/hospital/refunddetail", &HisHospitalApiController{}, "get:RefundDetail")
|
32
|
34
|
|
33
|
35
|
beego.Router("/api/hospitaldetail/list", &HisHospitalApiController{}, "get:GetHisHospitalDetailPatientList")
|
34
|
36
|
beego.Router("/api/hospitaldetail/info", &HisHospitalApiController{}, "get:GetHisHospitalDetailInfo")
|
|
@@ -36,6 +38,55 @@ func HisHospitalManagerApiRegistRouters() {
|
36
|
38
|
beego.Router("/api/monthhospitaldetail/get", &HisHospitalApiController{}, "get:GetHisHospitalMonthDetailInfo")
|
37
|
39
|
|
38
|
40
|
}
|
|
41
|
+func (c *HisHospitalApiController) RefundDetail() {
|
|
42
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
43
|
+ his_patient_id, _ := c.GetInt64("his_patient_id")
|
|
44
|
+ record_time := c.GetString("record_time")
|
|
45
|
+ settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
|
|
46
|
+ timeLayout := "2006-01-02"
|
|
47
|
+ loc, _ := time.LoadLocation("Local")
|
|
48
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
|
49
|
+ if err != nil {
|
|
50
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
51
|
+ return
|
|
52
|
+ }
|
|
53
|
+ recordDateTime := theTime.Unix()
|
|
54
|
+ adminUser := c.GetAdminUserInfo()
|
|
55
|
+ theTimeTwo, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 23:59:59", loc)
|
|
56
|
+ if err != nil {
|
|
57
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
58
|
+ return
|
|
59
|
+ }
|
|
60
|
+ recordDateTimeTwo := theTimeTwo.Unix()
|
|
61
|
+ if settle_accounts_type == 1 { //日结
|
|
62
|
+ err := service.UpDateOrderInfoStatus(patient_id, recordDateTime, adminUser.CurrentOrgId, recordDateTimeTwo)
|
|
63
|
+
|
|
64
|
+ if err != nil {
|
|
65
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
66
|
+ return
|
|
67
|
+ }
|
|
68
|
+ err1 := service.UpDatePrescriptionOrderStatusTwo(patient_id, recordDateTime, adminUser.CurrentOrgId)
|
|
69
|
+ if err1 != nil {
|
|
70
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
71
|
+ return
|
|
72
|
+ }
|
|
73
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
74
|
+ "msg": "撤销明细成功",
|
|
75
|
+ })
|
|
76
|
+
|
|
77
|
+ } else {
|
|
78
|
+ record, _ := service.GetInHospitalRecord(his_patient_id)
|
|
79
|
+ err := service.UpdataHospitalOrderStatusTwo(record.Number, adminUser.CurrentOrgId)
|
|
80
|
+ if err == nil {
|
|
81
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
82
|
+ "msg": "撤销明细成功",
|
|
83
|
+ })
|
|
84
|
+ } else {
|
|
85
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
86
|
+ return
|
|
87
|
+ }
|
|
88
|
+ }
|
|
89
|
+}
|
39
|
90
|
|
40
|
91
|
func (c *HisHospitalApiController) GetUploadInfo() {
|
41
|
92
|
id, _ := c.GetInt64("id")
|
|
@@ -457,13 +508,30 @@ func (c *HisHospitalApiController) GetHisHospitalChargePatientInfo() {
|
457
|
508
|
} else if order_status == 2 {
|
458
|
509
|
settle_prescriptions, _ = service.GetSettleHisHospitalPrescriptionTwo(admin.CurrentOrgId, patient_id, his_patient_info.Number)
|
459
|
510
|
}
|
|
511
|
+
|
|
512
|
+ var settle_total float64
|
|
513
|
+ for _, item := range settle_prescriptions {
|
|
514
|
+ if len(item.HisPrescriptionProject) > 0 {
|
|
515
|
+ for _, subItem := range item.HisPrescriptionProject {
|
|
516
|
+ count, _ := strconv.ParseFloat(subItem.Count, 64)
|
|
517
|
+ total, _ := decimal.NewFromFloat(count * subItem.Price).Round(2).Float64()
|
|
518
|
+ settle_total = settle_total + total
|
|
519
|
+ }
|
|
520
|
+ }
|
|
521
|
+ if len(item.HisDoctorAdviceInfo) > 0 {
|
|
522
|
+ for _, subItem := range item.HisDoctorAdviceInfo {
|
|
523
|
+ total, _ := decimal.NewFromFloat(subItem.PrescribingNumber * subItem.Price).Round(2).Float64()
|
|
524
|
+ settle_total = settle_total + total
|
|
525
|
+ }
|
|
526
|
+ }
|
|
527
|
+
|
|
528
|
+ }
|
460
|
529
|
case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
461
|
530
|
patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
|
462
|
531
|
order, _ := service.GetNewHisOrder(admin.CurrentOrgId, his_patient_info.Number, patient_id)
|
463
|
532
|
doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
|
464
|
533
|
//获取所有科室信息
|
465
|
534
|
department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
|
466
|
|
-
|
467
|
535
|
c.ServeSuccessJSON(map[string]interface{}{
|
468
|
536
|
"his_info": his_patient_info,
|
469
|
537
|
"xt_info": xt_patient_info,
|
|
@@ -475,6 +543,7 @@ func (c *HisHospitalApiController) GetHisHospitalChargePatientInfo() {
|
475
|
543
|
"doctors": doctors,
|
476
|
544
|
"department": department,
|
477
|
545
|
"settle_prescriptions": settle_prescriptions,
|
|
546
|
+ "settle_total": settle_total,
|
478
|
547
|
})
|
479
|
548
|
return
|
480
|
549
|
|
|
@@ -622,7 +691,8 @@ func (c *HisHospitalApiController) GetZHInHospitalCheck() {
|
622
|
691
|
}
|
623
|
692
|
func (this *HisHospitalApiController) GetZHOutHospitalCheck() {
|
624
|
693
|
id, _ := this.GetInt64("id")
|
625
|
|
- record_date := this.GetString("record_date")
|
|
694
|
+ record_time := this.GetString("record_time")
|
|
695
|
+ out_time := this.GetString("out_time")
|
626
|
696
|
|
627
|
697
|
record, _ := service.GetInHospitalRecord(id)
|
628
|
698
|
if record.ID == 0 {
|
|
@@ -632,15 +702,15 @@ func (this *HisHospitalApiController) GetZHOutHospitalCheck() {
|
632
|
702
|
|
633
|
703
|
timeLayout := "2006-01-02"
|
634
|
704
|
loc, _ := time.LoadLocation("Local")
|
635
|
|
- theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
705
|
+ theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
|
636
|
706
|
|
637
|
707
|
recordDateTime := theTime.Unix()
|
638
|
708
|
|
639
|
|
- timestamp := time.Now().Unix()
|
640
|
|
- tempTime := time.Unix(timestamp, 0)
|
641
|
|
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
|
|
709
|
+ //timestamp := time.Now().Unix()
|
|
710
|
+ //tempTime := time.Unix(timestamp, 0)
|
|
711
|
+ //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
|
642
|
712
|
record.OutHospitalStatus = 1
|
643
|
|
- record.OutHosptialTime = timeFormatOne
|
|
713
|
+ record.OutHosptialTime = out_time
|
644
|
714
|
record.OutWay = 1
|
645
|
715
|
service.CreateHospitalRecord(&record)
|
646
|
716
|
|