|
@@ -9,6 +9,7 @@ import (
|
9
|
9
|
"fmt"
|
10
|
10
|
"github.com/astaxie/beego"
|
11
|
11
|
"github.com/jinzhu/gorm"
|
|
12
|
+ "github.com/shopspring/decimal"
|
12
|
13
|
"math/rand"
|
13
|
14
|
"reflect"
|
14
|
15
|
"strconv"
|
|
@@ -25,6 +26,8 @@ type HisApiController struct {
|
25
|
26
|
func HisManagerApiRegistRouters() {
|
26
|
27
|
|
27
|
28
|
beego.Router("/api/hispatient/list", &HisApiController{}, "get:GetHisPatientList")
|
|
29
|
+ //beego.Router("/api/hispatient/list", &HisApiController{}, "get:GetHisPatientList")
|
|
30
|
+
|
28
|
31
|
beego.Router("/api/hispatient/get", &HisApiController{}, "get:GetHisPatientInfo")
|
29
|
32
|
beego.Router("/api/hisprescription/config", &HisApiController{}, "get:GetHisPrescriptionConfig")
|
30
|
33
|
|
|
@@ -42,13 +45,17 @@ func HisManagerApiRegistRouters() {
|
42
|
45
|
beego.Router("/api/doctorworkstation/casehistory/list", &HisApiController{}, "get:GetHisPatientCaseHistoryList")
|
43
|
46
|
beego.Router("/api/doctorworkstation/casehistory/get", &HisApiController{}, "get:GetHisPatientCaseHistory")
|
44
|
47
|
beego.Router("/api/doctorworkstation/casehistory/create", &HisApiController{}, "get:CreateHisPatientCaseHistory")
|
|
48
|
+
|
45
|
49
|
beego.Router("/api/doctorworkstation/casehistorytemplate/create", &HisApiController{}, "get:CreateCaseHistoryTemplate")
|
|
50
|
+
|
46
|
51
|
beego.Router("/api/doctorworkstation/casehistorytemplate/get", &HisApiController{}, "get:GetCaseHistoryTemplate")
|
47
|
52
|
|
48
|
53
|
beego.Router("/api/hisorder/list", &HisApiController{}, "get:GetHisOrderList")
|
|
54
|
+
|
49
|
55
|
beego.Router("/api/hisorder/get", &HisApiController{}, "get:GetHisOrder")
|
50
|
56
|
|
51
|
57
|
beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
|
|
58
|
+
|
52
|
59
|
beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
|
53
|
60
|
|
54
|
61
|
beego.Router("/api/refund/post", &HisApiController{}, "post:Refund")
|
|
@@ -58,31 +65,24 @@ func HisManagerApiRegistRouters() {
|
58
|
65
|
beego.Router("/api/doctor/list", &HisApiController{}, "get:GetAdminUsers")
|
59
|
66
|
|
60
|
67
|
//beego.Router("/api/medicalinsurance/config", &HisApiController{}, "get:GetMedicalInsuranceConfig")
|
61
|
|
-
|
62
|
68
|
//新增附加费用
|
63
|
69
|
//beego.Router("/api/his/additionalcharge", &HisApiController{}, "Post:AdditionalCharge")
|
64
|
|
-
|
65
|
70
|
//beego.Router("/api/additionalcharge/get", &HisApiController{}, "Get:GetAdditionalcharge")
|
66
|
|
-
|
67
|
71
|
beego.Router("/api/hisprescription/get", &HisApiController{}, "Get:GetLastOrNextHisPrescription")
|
68
|
|
-
|
69
|
72
|
beego.Router("/api/callhisprescription/get", &HisApiController{}, "Get:GetCallHisPrescription")
|
70
|
|
-
|
71
|
73
|
beego.Router("/api/dayprescription/get", &HisApiController{}, "get:GetHisDayPrescription")
|
72
|
|
-
|
73
|
74
|
beego.Router("/api/charge/list", &HisApiController{}, "get:GetHisChargePatientList")
|
74
|
75
|
beego.Router("/api/charge/info", &HisApiController{}, "get:GetHisChargePatientInfo")
|
75
|
|
-
|
76
|
76
|
beego.Router("/api/unregister/list", &HisApiController{}, "get:GetHisUnRegisterPatientList")
|
77
|
|
-
|
78
|
77
|
beego.Router("/api/orderdetail/get", &HisApiController{}, "get:GetAllOrderDetail")
|
79
|
78
|
beego.Router("/api/orderdetaicollect/get", &HisApiController{}, "get:GetAllOrderDetailCollect")
|
80
|
|
-
|
81
|
79
|
beego.Router("/api/cost/compare", &HisApiController{}, "get:GetMedicalInsuranceCostCompareList")
|
82
|
|
-
|
83
|
80
|
beego.Router("/api/record/list", &HisApiController{}, "get:GetPutOnRecordList")
|
84
|
81
|
|
85
|
|
- //beego.Router("/api/export/template", &HisApiController{}, "get:ExportOrderTemplate")
|
|
82
|
+ beego.Router("/api/comparedata/get", &HisApiController{}, "get:GetCompareData")
|
|
83
|
+ beego.Router("/api/fapiao/get", &HisApiController{}, "get:GetFaPiaoData")
|
|
84
|
+
|
|
85
|
+ beego.Router("/api/incomestatistics/get", &HisApiController{}, "get:GetIncomeStatisticsData")
|
86
|
86
|
|
87
|
87
|
}
|
88
|
88
|
|
|
@@ -135,11 +135,9 @@ func StrPtr(s string) uintptr {
|
135
|
135
|
}
|
136
|
136
|
|
137
|
137
|
func (c *HisApiController) GetHisPatientList() {
|
138
|
|
- types, _ := c.GetInt64("type", 0)
|
139
|
138
|
record_date := c.GetString("record_date")
|
140
|
139
|
timeLayout := "2006-01-02"
|
141
|
140
|
loc, _ := time.LoadLocation("Local")
|
142
|
|
-
|
143
|
141
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
144
|
142
|
if err != nil {
|
145
|
143
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -147,83 +145,29 @@ func (c *HisApiController) GetHisPatientList() {
|
147
|
145
|
}
|
148
|
146
|
recordDateTime := theTime.Unix()
|
149
|
147
|
adminInfo := c.GetAdminUserInfo()
|
150
|
|
- patients, _ := service.GetHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
148
|
+ patients, _ := service.GetNewHisPatientList(adminInfo.CurrentOrgId, recordDateTime)
|
151
|
149
|
patients_two, _ := service.GetScheduleHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, 0)
|
152
|
|
- patients = append(patients, patients_two...)
|
153
|
|
- patients = RemoveRepeatedPatient(patients)
|
154
|
|
-
|
155
|
|
- var total_one int64
|
156
|
|
- var total_two int64
|
157
|
|
-
|
158
|
150
|
//获取当前用户的信息
|
159
|
151
|
adminUserInfo, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, adminInfo.AdminUser.Id)
|
160
|
152
|
doctors, _ := service.GetHisAdminUserDoctors(adminInfo.CurrentOrgId)
|
161
|
153
|
//获取所有科室信息
|
162
|
154
|
department, _ := service.GetAllDepartMent(adminInfo.CurrentOrgId)
|
163
|
|
-
|
164
|
|
- for _, item := range patients {
|
165
|
|
-
|
166
|
|
- if item.HisPrescription == nil || len(item.HisPrescription) <= 0 {
|
167
|
|
- total_one = total_one + 1
|
168
|
|
- }
|
169
|
|
- if item.HisPrescription != nil && len(item.HisPrescription) > 0 {
|
170
|
|
- total_two = total_two + 1
|
171
|
|
- }
|
172
|
|
- }
|
173
|
|
-
|
174
|
|
- if types == 0 {
|
175
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
176
|
|
- "list": patients,
|
177
|
|
- "total_one": total_one,
|
178
|
|
- "total_two": total_two,
|
179
|
|
- "info": adminUserInfo,
|
180
|
|
- "doctors": doctors,
|
181
|
|
- "department": department,
|
182
|
|
- })
|
183
|
|
-
|
184
|
|
- } else if types == 1 { //未就诊
|
185
|
|
- var patientsOne []*service.Patients
|
186
|
|
- for _, item := range patients {
|
187
|
|
- if item.HisPrescription == nil || len(item.HisPrescription) <= 0 {
|
188
|
|
- patientsOne = append(patientsOne, item)
|
189
|
|
- }
|
190
|
|
- }
|
191
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
192
|
|
- "list": patientsOne,
|
193
|
|
- "total_one": total_one,
|
194
|
|
- "total_two": total_two,
|
195
|
|
- "info": adminUserInfo,
|
196
|
|
- "doctors": doctors,
|
197
|
|
- "department": department,
|
198
|
|
- })
|
199
|
|
-
|
200
|
|
- } else if types == 2 { //已就诊
|
201
|
|
- var patientsTwo []*service.Patients
|
202
|
|
- for _, item := range patients {
|
203
|
|
-
|
204
|
|
- if item.HisPrescription != nil && len(item.HisPrescription) > 0 {
|
205
|
|
- patientsTwo = append(patientsTwo, item)
|
206
|
|
- }
|
207
|
|
- }
|
208
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
209
|
|
- "list": patientsTwo,
|
210
|
|
- "total_one": total_one,
|
211
|
|
- "total_two": total_two,
|
212
|
|
- "info": adminUserInfo,
|
213
|
|
- "doctors": doctors,
|
214
|
|
- "department": department,
|
215
|
|
- })
|
216
|
|
- }
|
|
155
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
156
|
+ "list": patients,
|
|
157
|
+ "list_two": patients_two,
|
|
158
|
+ "info": adminUserInfo,
|
|
159
|
+ "doctors": doctors,
|
|
160
|
+ "department": department,
|
|
161
|
+ })
|
217
|
162
|
|
218
|
163
|
}
|
219
|
164
|
func (c *HisApiController) GetHisPatientInfo() {
|
220
|
165
|
patient_id, _ := c.GetInt64("patient_id")
|
|
166
|
+ his_patient_id, _ := c.GetInt64("his_patient_id")
|
221
|
167
|
record_date := c.GetString("record_date")
|
222
|
168
|
number := c.GetString("number")
|
223
|
|
-
|
224
|
169
|
start_time := c.GetString("start_time")
|
225
|
170
|
end_time := c.GetString("end_time")
|
226
|
|
-
|
227
|
171
|
timeLayout := "2006-01-02"
|
228
|
172
|
loc, _ := time.LoadLocation("Local")
|
229
|
173
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
@@ -232,32 +176,27 @@ func (c *HisApiController) GetHisPatientInfo() {
|
232
|
176
|
return
|
233
|
177
|
}
|
234
|
178
|
recordDateTime := theTime.Unix()
|
235
|
|
-
|
236
|
179
|
startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
237
|
180
|
if err != nil {
|
238
|
181
|
|
239
|
182
|
}
|
240
|
183
|
startRecordDateTime := startTime.Unix()
|
241
|
|
-
|
242
|
184
|
endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
243
|
185
|
if err != nil {
|
244
|
186
|
|
245
|
187
|
}
|
246
|
188
|
endRecordDateTime := endTime.Unix()
|
247
|
|
-
|
248
|
189
|
admin := c.GetAdminUserInfo()
|
249
|
|
- his_patient_info, _ := service.GetHisPatientInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
|
190
|
+ his_patient_info, _ := service.GetNewHisPatientInfoTwo(admin.CurrentOrgId, his_patient_id, recordDateTime)
|
250
|
191
|
xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
|
251
|
|
- prescriptions, _ := service.GetHisPrescription(admin.CurrentOrgId, patient_id, recordDateTime)
|
|
192
|
+ prescriptions, _ := service.GetNewHisPrescription(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime)
|
252
|
193
|
monthPrescriptions, _ := service.GetMonthHisPrescriptionTwo(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
|
253
|
194
|
case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
254
|
195
|
patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
255
|
196
|
order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
|
256
|
|
-
|
257
|
197
|
doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
|
258
|
198
|
//获取所有科室信息
|
259
|
199
|
department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
|
260
|
|
-
|
261
|
200
|
c.ServeSuccessJSON(map[string]interface{}{
|
262
|
201
|
"his_info": his_patient_info,
|
263
|
202
|
"xt_info": xt_patient_info,
|
|
@@ -392,6 +331,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
392
|
331
|
if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
393
|
332
|
prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
394
|
333
|
|
|
334
|
+ var tempPrescription *models.HisPrescription
|
395
|
335
|
if len(prescriptions) > 0 {
|
396
|
336
|
for _, item := range prescriptions {
|
397
|
337
|
items := item.(map[string]interface{})
|
|
@@ -402,6 +342,8 @@ func (c *HisApiController) CreateHisPrescription() {
|
402
|
342
|
}
|
403
|
343
|
id := int64(items["id"].(float64))
|
404
|
344
|
|
|
345
|
+ new_prescription, _ := service.GetPrescriptionById(id, adminInfo.CurrentOrgId)
|
|
346
|
+ tempPrescription = &new_prescription
|
405
|
347
|
if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
|
406
|
348
|
utils.ErrorLog("type")
|
407
|
349
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -409,6 +351,15 @@ func (c *HisApiController) CreateHisPrescription() {
|
409
|
351
|
}
|
410
|
352
|
types := int64(items["type"].(float64))
|
411
|
353
|
|
|
354
|
+ if items["order_status"] == nil || reflect.TypeOf(items["order_status"]).String() != "float64" {
|
|
355
|
+ utils.ErrorLog("order_status")
|
|
356
|
+ }
|
|
357
|
+ order_status := int64(items["order_status"].(float64))
|
|
358
|
+
|
|
359
|
+ if order_status == 0 {
|
|
360
|
+ order_status = 1
|
|
361
|
+ }
|
|
362
|
+
|
412
|
363
|
if items["pre_time"] == nil || reflect.TypeOf(items["pre_time"]).String() != "string" {
|
413
|
364
|
utils.ErrorLog("pre_time")
|
414
|
365
|
}
|
|
@@ -423,25 +374,39 @@ func (c *HisApiController) CreateHisPrescription() {
|
423
|
374
|
pTime := theTime2.Unix()
|
424
|
375
|
|
425
|
376
|
ctime := time.Now().Unix()
|
426
|
|
- prescription := &models.HisPrescription{
|
427
|
|
- ID: id,
|
428
|
|
- PatientId: patient_id,
|
429
|
|
- UserOrgId: adminInfo.CurrentOrgId,
|
430
|
|
- RecordDate: recordDateTime,
|
431
|
|
- Ctime: ctime,
|
432
|
|
- Mtime: ctime,
|
433
|
|
- Type: types,
|
434
|
|
- Modifier: adminInfo.AdminUser.Id,
|
435
|
|
- Creator: adminInfo.AdminUser.Id,
|
436
|
|
- Status: 1,
|
437
|
|
- Doctor: role.UserName,
|
438
|
|
- HisPatientId: his_patient_id,
|
439
|
|
- OrderStatus: 1,
|
440
|
|
- BatchNumber: "",
|
441
|
|
- PrescriptionNumber: hpInfo.PrescriptionNumber,
|
442
|
|
- PreTime: pTime,
|
|
377
|
+
|
|
378
|
+ if tempPrescription.ID == 0 {
|
|
379
|
+ prescription := &models.HisPrescription{
|
|
380
|
+ ID: id,
|
|
381
|
+ PatientId: patient_id,
|
|
382
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
383
|
+ RecordDate: recordDateTime,
|
|
384
|
+ Ctime: ctime,
|
|
385
|
+ Mtime: ctime,
|
|
386
|
+ Type: types,
|
|
387
|
+ Modifier: adminInfo.AdminUser.Id,
|
|
388
|
+ Creator: adminInfo.AdminUser.Id,
|
|
389
|
+ Status: 1,
|
|
390
|
+ Doctor: role.UserName,
|
|
391
|
+ HisPatientId: his_patient_id,
|
|
392
|
+ OrderStatus: order_status,
|
|
393
|
+ BatchNumber: "",
|
|
394
|
+ PrescriptionNumber: hpInfo.PrescriptionNumber,
|
|
395
|
+ PreTime: pTime,
|
|
396
|
+ }
|
|
397
|
+ tempPrescription = prescription
|
|
398
|
+ service.SaveHisPrescription(tempPrescription)
|
|
399
|
+
|
|
400
|
+ } else {
|
|
401
|
+ tempPrescription.Type = types
|
|
402
|
+ tempPrescription.Modifier = adminInfo.AdminUser.Id
|
|
403
|
+ tempPrescription.Mtime = time.Now().Unix()
|
|
404
|
+ tempPrescription.Doctor = role.UserName
|
|
405
|
+ tempPrescription.OrderStatus = order_status
|
|
406
|
+ tempPrescription.PreTime = pTime
|
|
407
|
+ service.SaveHisPrescription(tempPrescription)
|
|
408
|
+
|
443
|
409
|
}
|
444
|
|
- service.SaveHisPrescription(prescription)
|
445
|
410
|
|
446
|
411
|
//更改患者挂号状态
|
447
|
412
|
_, err2 := service.UpdateHisPatientIsReturn(patient_id, recordDateTime, adminInfo.CurrentOrgId)
|
|
@@ -455,7 +420,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
455
|
420
|
if len(advices) > 0 {
|
456
|
421
|
for _, advice := range advices {
|
457
|
422
|
var s models.HisDoctorAdviceInfo
|
458
|
|
- s.PrescriptionId = prescription.ID
|
|
423
|
+ s.PrescriptionId = tempPrescription.ID
|
459
|
424
|
s.AdviceType = 2
|
460
|
425
|
s.AdviceDoctor = doctor_id
|
461
|
426
|
s.StopState = 2
|
|
@@ -464,7 +429,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
464
|
429
|
s.Status = 1
|
465
|
430
|
s.UserOrgId = adminInfo.CurrentOrgId
|
466
|
431
|
s.RecordDate = recordDateTime
|
467
|
|
- s.StartTime = prescription.PreTime
|
|
432
|
+ s.StartTime = tempPrescription.PreTime
|
468
|
433
|
s.Groupno = groupNo
|
469
|
434
|
s.CreatedTime = ctime
|
470
|
435
|
s.UpdatedTime = mtime
|
|
@@ -492,7 +457,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
492
|
457
|
if len(projects) > 0 {
|
493
|
458
|
for _, project := range projects {
|
494
|
459
|
var p models.HisPrescriptionProject
|
495
|
|
- p.PrescriptionId = prescription.ID
|
|
460
|
+ p.PrescriptionId = tempPrescription.ID
|
496
|
461
|
p.Ctime = time.Now().Unix()
|
497
|
462
|
p.Mtime = time.Now().Unix()
|
498
|
463
|
p.PatientId = patient_id
|
|
@@ -525,7 +490,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
525
|
490
|
if len(addition) > 0 {
|
526
|
491
|
for _, item := range addition {
|
527
|
492
|
var s models.HisAdditionalCharge
|
528
|
|
- s.PrescriptionId = prescription.ID
|
|
493
|
+ s.PrescriptionId = tempPrescription.ID
|
529
|
494
|
s.Status = 1
|
530
|
495
|
s.UserOrgId = adminInfo.CurrentOrgId
|
531
|
496
|
s.RecordDate = recordDateTime
|
|
@@ -2104,14 +2069,28 @@ func (c *HisApiController) GetRegisterInfo() {
|
2104
|
2069
|
return
|
2105
|
2070
|
}
|
2106
|
2071
|
|
2107
|
|
- timeStr := time.Now().Format("2006-01-02")
|
2108
|
|
- timeArr := strings.Split(timeStr, "-")
|
2109
|
|
- var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(patient.ID, 10)
|
|
2072
|
+ his, _ := service.GetHisPatientInfoTwo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
|
|
2073
|
+ if len(his) >= 1 {
|
|
2074
|
+ order, _ := service.GetNewHisOrderTwo(adminInfo.CurrentOrgId, his[len(his)-1].Number, his[len(his)-1].PatientId, recordDateTime)
|
|
2075
|
+ if len(his) >= 1 && order.ID == 0 {
|
|
2076
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisPatientParamWrong)
|
|
2077
|
+ return
|
|
2078
|
+ }
|
|
2079
|
+ }
|
|
2080
|
+
|
|
2081
|
+ timeStr := time.Now().Format("2006-01-02 15:04:05")
|
|
2082
|
+ fmt.Println(timeStr)
|
|
2083
|
+ timeArr := strings.Split(timeStr, " ")
|
|
2084
|
+ fmt.Println(timeArr)
|
2110
|
2085
|
|
2111
|
|
- his, err := service.GetHisPatientInfo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
|
|
2086
|
+ timeArrTwo := strings.Split(timeArr[0], "-")
|
|
2087
|
+ timeArrThree := strings.Split(timeArr[1], ":")
|
|
2088
|
+ var str = timeArrTwo[0] + timeArrTwo[1] + timeArrTwo[2] + timeArrThree[0] + timeArrThree[1] + timeArrThree[2] + strconv.FormatInt(patient.ID, 10)
|
2112
|
2089
|
|
2113
|
|
- var hisPatient models.XtHisPatient
|
2114
|
|
- if err == gorm.ErrRecordNotFound || his.ID == 0 {
|
|
2090
|
+ lists, _ := service.GetHisPatientInfoList(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
|
|
2091
|
+
|
|
2092
|
+ if len(lists) == 0 {
|
|
2093
|
+ var hisPatient models.XtHisPatient
|
2115
|
2094
|
hisPatient = models.XtHisPatient{
|
2116
|
2095
|
Name: name,
|
2117
|
2096
|
Age: age,
|
|
@@ -2144,19 +2123,68 @@ func (c *HisApiController) GetRegisterInfo() {
|
2144
|
2123
|
SickType: sick_type,
|
2145
|
2124
|
}
|
2146
|
2125
|
service.CreateHisPatient(&hisPatient)
|
|
2126
|
+
|
|
2127
|
+ service.UpdateHisPrescriptionHisID(hisPatient.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
|
|
2128
|
+
|
2147
|
2129
|
c.ServeSuccessJSON(map[string]interface{}{
|
2148
|
2130
|
"his_info": hisPatient,
|
2149
|
2131
|
})
|
|
2132
|
+
|
2150
|
2133
|
} else {
|
2151
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisRegisterException)
|
2152
|
|
- return
|
|
2134
|
+
|
|
2135
|
+ //chrgBchno := rand.Intn(1000000) + 10000
|
|
2136
|
+ var hisPatient models.XtHisPatient
|
|
2137
|
+ hisPatient = models.XtHisPatient{
|
|
2138
|
+ Name: name,
|
|
2139
|
+ Age: age,
|
|
2140
|
+ Gender: gender,
|
|
2141
|
+ Birthday: birthUnix,
|
|
2142
|
+ Phone: phone,
|
|
2143
|
+ MedicalTreatmentType: medical_care,
|
|
2144
|
+ IdType: certificates,
|
|
2145
|
+ IdCardNo: id_card,
|
|
2146
|
+ BalanceAccountsType: settlementValue,
|
|
2147
|
+ SocialType: social_type,
|
|
2148
|
+ MedicalInsuranceNumber: medical_insurance_card,
|
|
2149
|
+ RegisterType: register_type,
|
|
2150
|
+ RegisterCost: registration_fee,
|
|
2151
|
+ TreatmentCost: medical_expenses,
|
|
2152
|
+ AdminUserId: adminInfo.AdminUser.Id,
|
|
2153
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
2154
|
+ Status: 1,
|
|
2155
|
+ RecordDate: recordDateTime,
|
|
2156
|
+ IsReturn: 1,
|
|
2157
|
+ PatientId: patient.ID,
|
|
2158
|
+ Ctime: time.Now().Unix(),
|
|
2159
|
+ Mtime: time.Now().Unix(),
|
|
2160
|
+ Number: str,
|
|
2161
|
+ IdCardType: id_card_type,
|
|
2162
|
+ Departments: department,
|
|
2163
|
+ Doctor: doctor,
|
|
2164
|
+ PType: reg_type,
|
|
2165
|
+ Diagnosis: diagnosis_id,
|
|
2166
|
+ SickType: sick_type,
|
|
2167
|
+ }
|
|
2168
|
+ service.CreateHisPatient(&hisPatient)
|
|
2169
|
+
|
|
2170
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2171
|
+ "his_info": hisPatient,
|
|
2172
|
+ })
|
|
2173
|
+
|
2153
|
2174
|
}
|
|
2175
|
+
|
|
2176
|
+ //timeStr := time.Now().Format("2006-01-02")
|
|
2177
|
+ //timeArr := strings.Split(timeStr, "-")
|
|
2178
|
+ //var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(patient.ID, 10)+ ""
|
|
2179
|
+
|
2154
|
2180
|
}
|
2155
|
2181
|
|
2156
|
2182
|
//上传明细----结算
|
2157
|
2183
|
func (c *HisApiController) GetUploadInfo() {
|
2158
|
2184
|
id, _ := c.GetInt64("id")
|
2159
|
2185
|
record_time := c.GetString("record_time")
|
|
2186
|
+ his_patient_id, _ := c.GetInt64("his_patient_id")
|
|
2187
|
+
|
2160
|
2188
|
pay_way, _ := c.GetInt64("pay_way")
|
2161
|
2189
|
pay_price, _ := c.GetFloat("pay_price")
|
2162
|
2190
|
pay_card_no := c.GetString("pay_card_no")
|
|
@@ -2183,7 +2211,7 @@ func (c *HisApiController) GetUploadInfo() {
|
2183
|
2211
|
|
2184
|
2212
|
if settle_accounts_type == 1 { //日结
|
2185
|
2213
|
|
2186
|
|
- prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
|
|
2214
|
+ prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, his_patient_id, recordDateTime)
|
2187
|
2215
|
|
2188
|
2216
|
} else { //月结
|
2189
|
2217
|
start_time_str := c.GetString("start_time")
|
|
@@ -2207,7 +2235,12 @@ func (c *HisApiController) GetUploadInfo() {
|
2207
|
2235
|
prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
|
2208
|
2236
|
}
|
2209
|
2237
|
|
2210
|
|
- his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
|
|
2238
|
+ his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
|
|
2239
|
+
|
|
2240
|
+ fmt.Println("~~~~~~~~~")
|
|
2241
|
+ fmt.Println(his.Number)
|
|
2242
|
+ fmt.Println("~~~~~~~~~")
|
|
2243
|
+
|
2211
|
2244
|
timestamp := time.Now().Unix()
|
2212
|
2245
|
tempTime := time.Unix(timestamp, 0)
|
2213
|
2246
|
timeFormat := tempTime.Format("20060102150405")
|
|
@@ -2250,6 +2283,7 @@ func (c *HisApiController) GetUploadInfo() {
|
2250
|
2283
|
Mtime: time.Now().Unix(),
|
2251
|
2284
|
Status: 1,
|
2252
|
2285
|
OrderStatus: 2,
|
|
2286
|
+ MdtrtId: his.Number,
|
2253
|
2287
|
Number: chrg_bchno,
|
2254
|
2288
|
MedfeeSumamt: totals,
|
2255
|
2289
|
PayWay: pay_way,
|
|
@@ -2573,17 +2607,20 @@ func (c *HisApiController) GetHisChargePatientList() {
|
2573
|
2607
|
}
|
2574
|
2608
|
recordDateTime := theTime.Unix()
|
2575
|
2609
|
adminInfo := c.GetAdminUserInfo()
|
2576
|
|
- tempPatients, _ := service.GetAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
2577
|
|
- var patients []*service.Patients
|
2578
|
|
- var patients_two []*service.Patients
|
|
2610
|
+ //tempPatients, _ := service.GetAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
2611
|
+ tempPatients, _ := service.GetNewAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
|
|
2612
|
+
|
|
2613
|
+ var patients []*service.NewTempPatients
|
|
2614
|
+ var patients_two []*service.NewTempPatients
|
2579
|
2615
|
|
2580
|
2616
|
for _, item := range tempPatients {
|
2581
|
2617
|
//过滤掉没挂号的和没开处方的
|
2582
|
|
- if item.HisPatient.ID > 0 || len(item.HisPrescription) > 0 {
|
|
2618
|
+ if len(item.HisPatient) > 0 || len(item.HisPrescription) > 0 {
|
2583
|
2619
|
patients = append(patients, item)
|
2584
|
2620
|
}
|
|
2621
|
+
|
2585
|
2622
|
//过滤掉没挂号的
|
2586
|
|
- if item.HisPatient.ID > 0 {
|
|
2623
|
+ if len(item.HisPatient) > 0 {
|
2587
|
2624
|
patients_two = append(patients_two, item)
|
2588
|
2625
|
}
|
2589
|
2626
|
}
|
|
@@ -2613,7 +2650,6 @@ func (c *HisApiController) GetHisUnRegisterPatientList() {
|
2613
|
2650
|
patients = append(patients, item)
|
2614
|
2651
|
}
|
2615
|
2652
|
}
|
2616
|
|
-
|
2617
|
2653
|
c.ServeSuccessJSON(map[string]interface{}{
|
2618
|
2654
|
"list": patients,
|
2619
|
2655
|
//"list_two": patients_two,
|
|
@@ -2640,12 +2676,10 @@ func RemoveRepeatedPatient(patient []*service.Patients) (newArr []*service.Patie
|
2640
|
2676
|
|
2641
|
2677
|
func (c *HisApiController) GetHisChargePatientInfo() {
|
2642
|
2678
|
patient_id, _ := c.GetInt64("patient_id")
|
|
2679
|
+ his_patient_id, _ := c.GetInt64("his_patient_id")
|
2643
|
2680
|
record_date := c.GetString("record_date")
|
2644
|
|
- number := c.GetString("number")
|
2645
|
|
-
|
2646
|
2681
|
start_time := c.GetString("start_time")
|
2647
|
2682
|
end_time := c.GetString("end_time")
|
2648
|
|
-
|
2649
|
2683
|
order_status, _ := c.GetInt64("type", 0)
|
2650
|
2684
|
|
2651
|
2685
|
timeLayout := "2006-01-02"
|
|
@@ -2670,30 +2704,26 @@ func (c *HisApiController) GetHisChargePatientInfo() {
|
2670
|
2704
|
endRecordDateTime := endTime.Unix()
|
2671
|
2705
|
|
2672
|
2706
|
admin := c.GetAdminUserInfo()
|
2673
|
|
- his_patient_info, _ := service.GetHisPatientInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
|
2707
|
+ his_patient_info, _ := service.GetNewHisPatientInfo(his_patient_id)
|
2674
|
2708
|
xt_patient_info, _ := service.GetXTPatientInfo(admin.CurrentOrgId, patient_id)
|
2675
|
2709
|
|
2676
|
2710
|
var prescriptions []*models.HisPrescription
|
2677
|
2711
|
|
2678
|
2712
|
if order_status == 1 || order_status == 0 {
|
2679
|
|
- prescriptions, _ = service.GetUnChargeHisPrescriptionFive(admin.CurrentOrgId, patient_id, recordDateTime)
|
|
2713
|
+ prescriptions, _ = service.GetUnChargeHisPrescriptionFive(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime)
|
2680
|
2714
|
} else if order_status == 2 {
|
2681
|
|
- prescriptions, _ = service.GetChargeHisPrescriptionFive(admin.CurrentOrgId, patient_id, recordDateTime)
|
|
2715
|
+ prescriptions, _ = service.GetChargeHisPrescriptionFive(admin.CurrentOrgId, patient_id, his_patient_id, recordDateTime)
|
2682
|
2716
|
}
|
2683
|
2717
|
|
2684
|
2718
|
var monthPrescriptions []*models.HisPrescription
|
2685
|
|
-
|
2686
|
2719
|
if order_status == 1 || order_status == 0 {
|
2687
|
2720
|
monthPrescriptions, _ = service.GetUnChargeMonthHisPrescriptionThree(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
|
2688
|
2721
|
} else if order_status == 2 {
|
2689
|
2722
|
monthPrescriptions, _ = service.GetChargeMonthHisPrescriptionFour(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
|
2690
|
|
-
|
2691
|
2723
|
}
|
2692
|
|
-
|
2693
|
2724
|
case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
2694
|
2725
|
patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime)
|
2695
|
|
- order, _ := service.GetHisOrder(admin.CurrentOrgId, number, patient_id)
|
2696
|
|
-
|
|
2726
|
+ order, _ := service.GetNewHisOrder(admin.CurrentOrgId, his_patient_info.Number, patient_id)
|
2697
|
2727
|
doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
|
2698
|
2728
|
//获取所有科室信息
|
2699
|
2729
|
department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
|
|
@@ -2758,6 +2788,24 @@ func (c *HisApiController) GetMedicalInsuranceCostCompareList() {
|
2758
|
2788
|
page, _ := c.GetInt64("page")
|
2759
|
2789
|
limit, _ := c.GetInt64("limit")
|
2760
|
2790
|
keywords := c.GetString("keywords")
|
|
2791
|
+ start_time := c.GetString("start_time")
|
|
2792
|
+ end_time := c.GetString("end_time")
|
|
2793
|
+ //clr_type := c.GetString("clr_type")
|
|
2794
|
+ insutype := c.GetString("insutype")
|
|
2795
|
+
|
|
2796
|
+ timeLayout := "2006-01-02"
|
|
2797
|
+ loc, _ := time.LoadLocation("Local")
|
|
2798
|
+
|
|
2799
|
+ var theStartTIme int64
|
|
2800
|
+ if len(start_time) > 0 {
|
|
2801
|
+ theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
2802
|
+ theStartTIme = theTime.Unix()
|
|
2803
|
+ }
|
|
2804
|
+ var theEndtTIme int64
|
|
2805
|
+ if len(end_time) > 0 {
|
|
2806
|
+ theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
2807
|
+ theEndtTIme = theTime.Unix()
|
|
2808
|
+ }
|
2761
|
2809
|
|
2762
|
2810
|
if page <= 0 {
|
2763
|
2811
|
page = 1
|
|
@@ -2765,7 +2813,7 @@ func (c *HisApiController) GetMedicalInsuranceCostCompareList() {
|
2765
|
2813
|
if limit <= 0 {
|
2766
|
2814
|
limit = 10
|
2767
|
2815
|
}
|
2768
|
|
- list, total, _ := service.GetMedicalInsuranceCostCompareList(c.GetAdminUserInfo().CurrentOrgId, page, limit, keywords)
|
|
2816
|
+ list, total, _ := service.GetMedicalInsuranceCostCompareList(c.GetAdminUserInfo().CurrentOrgId, page, limit, keywords, insutype, theStartTIme, theEndtTIme)
|
2769
|
2817
|
c.ServeSuccessJSON(map[string]interface{}{
|
2770
|
2818
|
"total": total,
|
2771
|
2819
|
"list": list,
|
|
@@ -2795,11 +2843,242 @@ func (c *HisApiController) GetPutOnRecordList() {
|
2795
|
2843
|
|
2796
|
2844
|
}
|
2797
|
2845
|
|
2798
|
|
-//func (c *HisApiController)ExportOrderTemplate(){
|
2799
|
|
-// start_time := c.GetString("start_time")
|
2800
|
|
-// end_time := c.GetString("end_time")
|
2801
|
|
-//
|
2802
|
|
-//
|
2803
|
|
-//
|
2804
|
|
-//
|
2805
|
|
-//}
|
|
2846
|
+func (c *HisApiController) GetCompareData() {
|
|
2847
|
+ start_time := c.GetString("start_time")
|
|
2848
|
+ end_time := c.GetString("end_time")
|
|
2849
|
+ insutype := c.GetString("insutype")
|
|
2850
|
+ timeLayout := "2006-01-02"
|
|
2851
|
+ loc, _ := time.LoadLocation("Local")
|
|
2852
|
+ var theStartTIme int64
|
|
2853
|
+ if len(start_time) > 0 {
|
|
2854
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
2855
|
+ if err != nil {
|
|
2856
|
+ theStartTIme = 0
|
|
2857
|
+ }
|
|
2858
|
+ theStartTIme = theTime.Unix()
|
|
2859
|
+ }
|
|
2860
|
+ var theEndtTIme int64
|
|
2861
|
+ if len(end_time) > 0 {
|
|
2862
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
2863
|
+ if err != nil {
|
|
2864
|
+ theEndtTIme = 0
|
|
2865
|
+ }
|
|
2866
|
+ theEndtTIme = theTime.Unix()
|
|
2867
|
+ }
|
|
2868
|
+ formData, err := service.GetCheckAccountFormData(theStartTIme, theEndtTIme, c.GetAdminUserInfo().CurrentOrgId, insutype)
|
|
2869
|
+ if err == nil {
|
|
2870
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2871
|
+ "list": formData,
|
|
2872
|
+ })
|
|
2873
|
+ } else {
|
|
2874
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
2875
|
+ return
|
|
2876
|
+
|
|
2877
|
+ }
|
|
2878
|
+}
|
|
2879
|
+
|
|
2880
|
+func (c *HisApiController) GetFaPiaoData() {
|
|
2881
|
+ order_id, _ := c.GetInt64("order_id")
|
|
2882
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
2883
|
+
|
|
2884
|
+ adminUser := c.GetAdminUserInfo()
|
|
2885
|
+ order, _ := service.GetHisOrderByID(order_id)
|
|
2886
|
+ orderInfos, _ := service.GetHisOrderInfoByNumber(order.Number)
|
|
2887
|
+
|
|
2888
|
+ patientPrescription, _ := service.FindLastPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, order.SettleAccountsDate)
|
|
2889
|
+
|
|
2890
|
+ department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
|
|
2891
|
+
|
|
2892
|
+ his, _ := service.GetHisPatientInfo(adminUser.CurrentOrgId, patient_id, order.SettleAccountsDate)
|
|
2893
|
+
|
|
2894
|
+ var bedCostTotal float64 = 0 //床位总费
|
|
2895
|
+ var bedCostSelfTotal float64 = 0 //床位自费
|
|
2896
|
+ var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
|
|
2897
|
+
|
|
2898
|
+ var operationCostTotal float64 = 0 //手术费
|
|
2899
|
+ var operationCostSelfTotal float64 = 0 //手术费
|
|
2900
|
+ var operationCostPartSelfTotal float64 = 0 //手术费
|
|
2901
|
+
|
|
2902
|
+ var otherCostTotal float64 = 0 //其他费用
|
|
2903
|
+ var otherCostSelfTotal float64 = 0 //其他费用
|
|
2904
|
+ var otherCostPartSelfTotal float64 = 0 //其他费用
|
|
2905
|
+
|
|
2906
|
+ var materialCostTotal float64 = 0 //材料费
|
|
2907
|
+ var materialCostSelfTotal float64 = 0 //材料费
|
|
2908
|
+ var materialCostPartSelfTotal float64 = 0 //材料费
|
|
2909
|
+
|
|
2910
|
+ var westernMedicineCostTotal float64 = 0 //西药费
|
|
2911
|
+ var westernMedicineCostSelfTotal float64 = 0 //西药费
|
|
2912
|
+ var westernMedicineCostPartSelfTotal float64 = 0 //西药费
|
|
2913
|
+
|
|
2914
|
+ var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
|
|
2915
|
+ var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
|
|
2916
|
+ var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
|
|
2917
|
+
|
|
2918
|
+ var checkCostTotal float64 = 0 //检查费
|
|
2919
|
+ var checkCostSelfTotal float64 = 0 //检查费
|
|
2920
|
+ var checkCostPartSelfTotal float64 = 0 //检查费
|
|
2921
|
+
|
|
2922
|
+ var laboratoryCostTotal float64 = 0 //化验费
|
|
2923
|
+ var laboratoryCostSelfTotal float64 = 0 //化验费
|
|
2924
|
+ var laboratoryCostPartSelfTotal float64 = 0 //化验费
|
|
2925
|
+
|
|
2926
|
+ var treatCostTotal float64 = 0 //治疗费用
|
|
2927
|
+ var treatCostSelfTotal float64 = 0 //治疗费用
|
|
2928
|
+ var treatCostPartSelfTotal float64 = 0 //治疗费用
|
|
2929
|
+
|
|
2930
|
+ decimal.DivisionPrecision = 2
|
|
2931
|
+
|
|
2932
|
+ for _, item := range orderInfos {
|
|
2933
|
+ if item.MedChrgitmType == "01" { //床位费
|
|
2934
|
+ bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
2935
|
+ bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
2936
|
+ bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
2937
|
+ }
|
|
2938
|
+
|
|
2939
|
+ if item.MedChrgitmType == "03" { //检查费
|
|
2940
|
+ checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
2941
|
+ checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
2942
|
+ checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
2943
|
+ }
|
|
2944
|
+
|
|
2945
|
+ if item.MedChrgitmType == "04" { //化验费
|
|
2946
|
+ laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
2947
|
+ laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
2948
|
+ laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
2949
|
+ }
|
|
2950
|
+
|
|
2951
|
+ if item.MedChrgitmType == "05" { //治疗费
|
|
2952
|
+ treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
2953
|
+ treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
2954
|
+ treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
2955
|
+ }
|
|
2956
|
+
|
|
2957
|
+ if item.MedChrgitmType == "06" { //手术费
|
|
2958
|
+ operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
2959
|
+ operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
2960
|
+ operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
2961
|
+ }
|
|
2962
|
+
|
|
2963
|
+ if item.MedChrgitmType == "08" { //材料费
|
|
2964
|
+ materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
2965
|
+ materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
2966
|
+ materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
2967
|
+ }
|
|
2968
|
+
|
|
2969
|
+ if item.MedChrgitmType == "09" { //西药费
|
|
2970
|
+ westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
2971
|
+ westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
2972
|
+ westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
2973
|
+ }
|
|
2974
|
+
|
|
2975
|
+ if item.MedChrgitmType == "11" { //中成费
|
|
2976
|
+ chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
2977
|
+ chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
2978
|
+ chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
2979
|
+ }
|
|
2980
|
+
|
|
2981
|
+ if item.MedChrgitmType == "14" { //其他费
|
|
2982
|
+ otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
2983
|
+ otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
2984
|
+ otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
2985
|
+ }
|
|
2986
|
+
|
|
2987
|
+ }
|
|
2988
|
+
|
|
2989
|
+ admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
|
|
2990
|
+
|
|
2991
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2992
|
+ "order_number": order.Number, //业务流水号
|
|
2993
|
+ "id_card_no": his.IdCardNo, //社会保障号
|
|
2994
|
+ "department_name": department.Name, //科室
|
|
2995
|
+ "number": his.Number, //门诊号
|
|
2996
|
+ "date": order.SettleAccountsDate, //结算日期
|
|
2997
|
+ "name": order.PsnName, //姓名
|
|
2998
|
+ "gender": order.Gend, //性别
|
|
2999
|
+ "psn_cash_money": order.PsnCashPay, //个人支付
|
|
3000
|
+ "pay_way": "门诊", //结算方式
|
|
3001
|
+ "medfee_sumamt": order.MedfeeSumamt, //总费用
|
|
3002
|
+ "admin_user_name": admin.UserName, //收款员
|
|
3003
|
+
|
|
3004
|
+ "bedCostTotal": bedCostTotal,
|
|
3005
|
+ "bedCostSelfTotal": bedCostSelfTotal,
|
|
3006
|
+ "bedCostPartSelfTotal": bedCostPartSelfTotal,
|
|
3007
|
+ "operationCostTotal": operationCostTotal,
|
|
3008
|
+ "operationCostSelfTotal": operationCostSelfTotal,
|
|
3009
|
+ "operationCostPartSelfTotal": operationCostPartSelfTotal,
|
|
3010
|
+ "otherCostTotal": otherCostTotal,
|
|
3011
|
+ "otherCostSelfTotal": otherCostSelfTotal,
|
|
3012
|
+ "otherCostPartSelfTotal": otherCostPartSelfTotal,
|
|
3013
|
+ "materialCostTotal": materialCostTotal,
|
|
3014
|
+ "materialCostSelfTotal": materialCostSelfTotal,
|
|
3015
|
+ "materialCostPartSelfTotal": materialCostPartSelfTotal,
|
|
3016
|
+ "westernMedicineCostTotal": westernMedicineCostTotal,
|
|
3017
|
+ "westernMedicineCostSelfTotal": westernMedicineCostSelfTotal,
|
|
3018
|
+ "westernMedicineCostPartSelfTotal": westernMedicineCostPartSelfTotal,
|
|
3019
|
+ "chineseTraditionalMedicineCostTotal": chineseTraditionalMedicineCostTotal,
|
|
3020
|
+ "chineseTraditionalMedicineCostSelfTotal": chineseTraditionalMedicineCostSelfTotal,
|
|
3021
|
+ "chineseTraditionalMedicineCostPartSelfTotal": chineseTraditionalMedicineCostPartSelfTotal,
|
|
3022
|
+ "checkCostTotal": checkCostTotal,
|
|
3023
|
+ "checkCostSelfTotal": checkCostSelfTotal,
|
|
3024
|
+ "checkCostPartSelfTotal": checkCostPartSelfTotal,
|
|
3025
|
+ "laboratoryCostTotal": laboratoryCostTotal,
|
|
3026
|
+ "laboratoryCostSelfTotal": laboratoryCostSelfTotal,
|
|
3027
|
+ "laboratoryCostPartSelfTotal": laboratoryCostPartSelfTotal,
|
|
3028
|
+ "treatCostTotal": treatCostTotal,
|
|
3029
|
+ "treatCostSelfTotal": treatCostSelfTotal,
|
|
3030
|
+ "treatCostPartSelfTotal": treatCostPartSelfTotal,
|
|
3031
|
+ })
|
|
3032
|
+
|
|
3033
|
+}
|
|
3034
|
+
|
|
3035
|
+func (this *HisApiController) GetIncomeStatisticsData() {
|
|
3036
|
+ start_time := this.GetString("start_time")
|
|
3037
|
+ end_time := this.GetString("end_time")
|
|
3038
|
+ key_words := this.GetString("key_words")
|
|
3039
|
+ limit, _ := this.GetInt64("limit")
|
|
3040
|
+ page, _ := this.GetInt64("page")
|
|
3041
|
+
|
|
3042
|
+ if page <= 0 {
|
|
3043
|
+ page = 1
|
|
3044
|
+ }
|
|
3045
|
+ if limit <= 0 {
|
|
3046
|
+ limit = 10
|
|
3047
|
+ }
|
|
3048
|
+ statistics_type, _ := this.GetInt64("statistics_type")
|
|
3049
|
+ admin := this.GetAdminUserInfo()
|
|
3050
|
+ timeLayout := "2006-01-02"
|
|
3051
|
+ loc, _ := time.LoadLocation("Local")
|
|
3052
|
+ var theStartTIme int64
|
|
3053
|
+ if len(start_time) > 0 {
|
|
3054
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
3055
|
+ if err != nil {
|
|
3056
|
+ theStartTIme = 0
|
|
3057
|
+ }
|
|
3058
|
+ theStartTIme = theTime.Unix()
|
|
3059
|
+ }
|
|
3060
|
+ var theEndtTIme int64
|
|
3061
|
+ if len(end_time) > 0 {
|
|
3062
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
3063
|
+ if err != nil {
|
|
3064
|
+ theEndtTIme = 0
|
|
3065
|
+ }
|
|
3066
|
+ theEndtTIme = theTime.Unix()
|
|
3067
|
+ }
|
|
3068
|
+
|
|
3069
|
+ if statistics_type == 1 {
|
|
3070
|
+ list, total, _ := service.GetDayIncomeStatisticsData(admin.CurrentOrgId, key_words, theStartTIme, theEndtTIme, page, limit)
|
|
3071
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3072
|
+ "list": list,
|
|
3073
|
+ "total": total,
|
|
3074
|
+ })
|
|
3075
|
+ } else {
|
|
3076
|
+ list, total, _ := service.GetDayIncomeDetailStatisticsData(admin.CurrentOrgId, key_words, theStartTIme, theEndtTIme, page, limit)
|
|
3077
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3078
|
+ "list": list,
|
|
3079
|
+ "total": total,
|
|
3080
|
+ })
|
|
3081
|
+
|
|
3082
|
+ }
|
|
3083
|
+
|
|
3084
|
+}
|