|
@@ -209,6 +209,14 @@ func GetMonth() (int64, int64) {
|
209
|
209
|
return timeMonthStartUnix1, timeMonthEndUnix1
|
210
|
210
|
}
|
211
|
211
|
|
|
212
|
+//获取当天起止时间戳
|
|
213
|
+func GetNowTime() (int64, int64) {
|
|
214
|
+ t := time.Now()
|
|
215
|
+ addTime := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
|
|
216
|
+ timesamp := addTime.Unix()
|
|
217
|
+ return timesamp, timesamp + 86399
|
|
218
|
+}
|
|
219
|
+
|
212
|
220
|
//获取创建者的姓名
|
213
|
221
|
//原先的(sgj_users.sgj_user_admin)
|
214
|
222
|
//新加的(sgj_users.sgj_user_admin_role)
|
|
@@ -900,3 +908,18 @@ func TypeConversion02(tmp string) (s string) {
|
900
|
908
|
}
|
901
|
909
|
return s
|
902
|
910
|
}
|
|
911
|
+
|
|
912
|
+//获取本段时间内患者退款的总额
|
|
913
|
+//orgid:机构id,stime:开始时间,etime:结束时间,patient_id:患者id
|
|
914
|
+func RefundListSum(orgid, stime, etime, patient_id int64) (sum decimal.Decimal, err error) {
|
|
915
|
+ var depo []models.RefundList
|
|
916
|
+ err = XTReadDB().Model(&models.DepositHistory{}).Where("status = 1 and user_org_id = ? and trial_status = 1 and ctime >= ? and ctime <= ? and deposit_status = 3 and his_patient_id = ? ", orgid, stime, etime, patient_id).Find(&depo).Error
|
|
917
|
+ if err != nil {
|
|
918
|
+ return decimal.NewFromFloat(0), err
|
|
919
|
+ }
|
|
920
|
+ for i := 0; i < len(depo); i++ {
|
|
921
|
+ sum = sum.Add(depo[i].Deposit)
|
|
922
|
+ }
|
|
923
|
+ return
|
|
924
|
+
|
|
925
|
+}
|