Преглед на файлове

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

28169 преди 1 месец
родител
ревизия
44d93a64e5
променени са 2 файла, в които са добавени 359 реда и са изтрити 23 реда
  1. 358 23
      controllers/fapiao_controller.go
  2. 1 0
      models/fapiao.go

+ 358 - 23
controllers/fapiao_controller.go Целия файл

@@ -23,13 +23,349 @@ func FaPiaoApiRegistRouters() {
23 23
 	beego.Router("/api/fapiao/sms/code", &FapiaoApiController{}, "get:GetLoginUploadCode")
24 24
 	beego.Router("/api/fapiao/sms/login", &FapiaoApiController{}, "get:Login")
25 25
 	beego.Router("/api/fapiao/qrcode/get", &FapiaoApiController{}, "get:GetQRCode")
26
-
27 26
 	beego.Router("/api/fapiao/blue", &FapiaoApiController{}, "get:OpenFaPiao")
28 27
 	beego.Router("/api/fapiao/red", &FapiaoApiController{}, "get:RedFaPiao")
29
-
30 28
 	beego.Router("/api/order/fapiao/list", &FapiaoApiController{}, "get:GetOrderFaPiaoList")
31 29
 	beego.Router("/api/gdfapiao/list", &FapiaoApiController{}, "get:GetFaPiaoList")
32 30
 
31
+	beego.Router("/api/newfapiao/get", &HisApiController{}, "get:GetNewFaPiaoData")
32
+
33
+}
34
+
35
+func (c *HisApiController) GetNewFaPiaoData() {
36
+	order_ids := c.GetString("order_ids")
37
+	patient_id, _ := c.GetInt64("patient_id")
38
+	//number := c.GetString("number")
39
+
40
+	adminUser := c.GetAdminUserInfo()
41
+	orders := strings.Split(order_ids, ",")
42
+	patient, _ := service.GetFaPiaoPatientByID(adminUser.CurrentOrgId, patient_id)
43
+
44
+	var bedCostTotal float64 = 0         //床位总费
45
+	var bedCostSelfTotal float64 = 0     //床位自费
46
+	var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
47
+
48
+	var operationCostTotal float64 = 0         //手术费
49
+	var operationCostSelfTotal float64 = 0     //手术费
50
+	var operationCostPartSelfTotal float64 = 0 //手术费
51
+
52
+	var otherCostTotal float64 = 0         //其他费用
53
+	var otherCostSelfTotal float64 = 0     //其他费用
54
+	var otherCostPartSelfTotal float64 = 0 //其他费用
55
+
56
+	var materialCostTotal float64 = 0         //材料费
57
+	var materialCostSelfTotal float64 = 0     //材料费
58
+	var materialCostPartSelfTotal float64 = 0 //材料费
59
+
60
+	var westernMedicineCostTotal float64 = 0         //西药费
61
+	var westernMedicineCostSelfTotal float64 = 0     //西药费
62
+	var westernMedicineCostPartSelfTotal float64 = 0 //西药费
63
+
64
+	var chineseTraditionalMedicineCostTotal float64 = 0         //中成药
65
+	var chineseTraditionalMedicineCostSelfTotal float64 = 0     //中成药
66
+	var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
67
+
68
+	var checkCostTotal float64 = 0         //检查费
69
+	var checkCostSelfTotal float64 = 0     //检查费
70
+	var checkCostPartSelfTotal float64 = 0 //检查费
71
+
72
+	var hiliCostTotal float64 = 0     //护理费
73
+	var hiliCostSelfTotal float64 = 0 //护理费
74
+	//var hiliCostPartSelfTotal float64 = 0 //护理费
75
+
76
+	var laboratoryCostTotal float64 = 0         //化验费
77
+	var laboratoryCostSelfTotal float64 = 0     //化验费
78
+	var laboratoryCostPartSelfTotal float64 = 0 //化验费
79
+
80
+	var treatCostTotal float64 = 0         //治疗费用
81
+	var treatCostSelfTotal float64 = 0     //治疗费用
82
+	var treatCostPartSelfTotal float64 = 0 //治疗费用
83
+
84
+	var zhenChaCostTotal float64 = 0         //其他费用
85
+	var zhenChaCostSelfTotal float64 = 0     //其他费用
86
+	var zhenChaCostPartSelfTotal float64 = 0 //其他费用
87
+
88
+	decimal.DivisionPrecision = 2
89
+
90
+	var MedfeeSumamt float64 = 0  //治疗费用
91
+	var PsnCashPay float64 = 0    //治疗费用
92
+	var FundPaySumamt float64 = 0 //治疗费用
93
+
94
+	var HifpPay float64 = 0 //治疗费用
95
+	var MafPay float64 = 0  //治疗费用
96
+	var AcctPay float64 = 0 //治疗费用
97
+
98
+	for _, item := range orders {
99
+		var new_order models.HisOrder
100
+
101
+		order_id_num, _ := strconv.ParseInt(item, 10, 64)
102
+		new_order, _ = service.GetHisOrderByID(order_id_num)
103
+
104
+		MedfeeSumamt, _ = decimal.NewFromFloat(MedfeeSumamt).Add(decimal.NewFromFloat(new_order.MedfeeSumamt)).Float64()
105
+		PsnCashPay, _ = decimal.NewFromFloat(PsnCashPay).Add(decimal.NewFromFloat(new_order.PsnCashPay)).Float64()
106
+		FundPaySumamt, _ = decimal.NewFromFloat(FundPaySumamt).Add(decimal.NewFromFloat(new_order.FundPaySumamt)).Float64()
107
+		HifpPay, _ = decimal.NewFromFloat(HifpPay).Add(decimal.NewFromFloat(new_order.HifpPay)).Float64()
108
+		MafPay, _ = decimal.NewFromFloat(MafPay).Add(decimal.NewFromFloat(new_order.MafPay)).Float64()
109
+		AcctPay, _ = decimal.NewFromFloat(AcctPay).Add(decimal.NewFromFloat(new_order.AcctPay)).Float64()
110
+
111
+		orderInfos_two, _ := service.GetHisOrderDetailByNumber(new_order.Number, adminUser.CurrentOrgId)
112
+		var balanceAccountsType int64
113
+		if new_order.IsMedicineInsurance == 1 {
114
+			balanceAccountsType = 1
115
+		} else {
116
+			balanceAccountsType = 2
117
+		}
118
+
119
+		if balanceAccountsType == 2 {
120
+			//orderInfos_two, _ := service.GetHisOrderDetailByNumber(order.Number, adminUser.CurrentOrgId)
121
+			for _, item := range orderInfos_two {
122
+				item.FulamtOwnpayAmt = item.DetItemFeeSumamt
123
+				if item.HisDoctorAdviceInfo.ID > 0 && item.HisPrescriptionProject.ID == 0 { //药品
124
+					item.MedChrgitmType = "09"
125
+				}
126
+				if item.HisPrescriptionProject.ID > 0 && item.HisDoctorAdviceInfo.ID == 0 {
127
+					if item.HisPrescriptionProject.Type == 2 {
128
+						switch item.HisPrescriptionProject.VMHisProject.CostClassify {
129
+						case 1:
130
+							item.MedChrgitmType = "14"
131
+							break
132
+						case 2:
133
+							item.MedChrgitmType = "05"
134
+
135
+							break
136
+						case 3:
137
+							item.MedChrgitmType = "04"
138
+
139
+							break
140
+						case 4:
141
+							item.MedChrgitmType = "03"
142
+
143
+							break
144
+						case 5:
145
+							item.MedChrgitmType = "08"
146
+
147
+							break
148
+						case 6:
149
+							item.MedChrgitmType = "14"
150
+
151
+							break
152
+						case 7:
153
+							item.MedChrgitmType = "14"
154
+
155
+							break
156
+						case 8:
157
+							item.MedChrgitmType = "03"
158
+							break
159
+						case 9:
160
+							item.MedChrgitmType = "14"
161
+							break
162
+						}
163
+
164
+					} else if item.HisPrescriptionProject.Type == 3 {
165
+						item.MedChrgitmType = "08"
166
+					}
167
+				}
168
+			}
169
+
170
+			for _, item := range orderInfos_two {
171
+				fmt.Println(item.MedChrgitmType)
172
+				if item.MedChrgitmType == "07" { //床位费
173
+					hiliCostTotal, _ = decimal.NewFromFloat(hiliCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
174
+					hiliCostSelfTotal = hiliCostTotal
175
+				}
176
+
177
+				if item.MedChrgitmType == "01" { //床位费
178
+					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
179
+					bedCostSelfTotal = bedCostTotal
180
+				}
181
+
182
+				if item.MedChrgitmType == "02" { //诊察费
183
+					zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
184
+					zhenChaCostSelfTotal = zhenChaCostTotal
185
+				}
186
+
187
+				if item.MedChrgitmType == "03" { //检查费
188
+					checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
189
+					checkCostSelfTotal = checkCostTotal
190
+				}
191
+
192
+				if item.MedChrgitmType == "04" { //化验费
193
+					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
194
+					laboratoryCostSelfTotal = laboratoryCostTotal
195
+				}
196
+
197
+				if item.MedChrgitmType == "05" || item.MedChrgitmType == "14" || item.MedChrgitmType == "201" { //治疗费
198
+					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
199
+					treatCostSelfTotal = treatCostTotal
200
+				}
201
+
202
+				if item.MedChrgitmType == "06" { //手术费
203
+					treatCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
204
+					operationCostSelfTotal = treatCostTotal
205
+				}
206
+
207
+				if item.MedChrgitmType == "08" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" || item.MedChrgitmType == "1401" || item.MedChrgitmType == "301" { //材料费
208
+					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
209
+					materialCostSelfTotal = materialCostTotal
210
+				}
211
+
212
+				if item.MedChrgitmType == "09" || item.MedChrgitmType == "101" { //西药费
213
+					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
214
+					westernMedicineCostSelfTotal = westernMedicineCostTotal
215
+				}
216
+
217
+				if item.MedChrgitmType == "11" { //中成费
218
+					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
219
+					chineseTraditionalMedicineCostSelfTotal = chineseTraditionalMedicineCostTotal
220
+				}
221
+
222
+				if c.GetAdminUserInfo().CurrentOrgId == 10106 {
223
+					if item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
224
+						otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
225
+						otherCostSelfTotal = otherCostTotal
226
+					}
227
+				} else {
228
+					if item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
229
+						otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
230
+						otherCostSelfTotal = otherCostTotal
231
+					}
232
+
233
+				}
234
+
235
+			}
236
+
237
+		} else {
238
+			for _, item := range orderInfos_two {
239
+				if item.MedChrgitmType == "01" { //床位费
240
+					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
241
+					//bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
242
+					//bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
243
+				}
244
+
245
+				if item.MedChrgitmType == "02" { //诊察费
246
+					zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
247
+					//zhenChaCostSelfTotal, _ = decimal.NewFromFloat(zhenChaCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
248
+					//zhenChaCostPartSelfTotal, _ = decimal.NewFromFloat(zhenChaCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
249
+				}
250
+
251
+				if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
252
+					if item.MedChrgitmType == "03" { //检查费
253
+						laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
254
+						//laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
255
+						//laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
256
+
257
+					}
258
+				} else {
259
+					if item.MedChrgitmType == "03" { //检查费
260
+						checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
261
+						//checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
262
+						//checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
263
+					}
264
+
265
+				}
266
+
267
+				if item.MedChrgitmType == "04" { //化验费
268
+					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
269
+					//laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
270
+					//laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
271
+
272
+				}
273
+
274
+				if item.MedChrgitmType == "05" || item.MedChrgitmType == "14" || item.MedChrgitmType == "201" { //治疗费
275
+					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
276
+					//treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
277
+					//treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
278
+
279
+				}
280
+
281
+				if item.MedChrgitmType == "06" { //手术费
282
+					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
283
+					//operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
284
+					//operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
285
+				}
286
+
287
+				if item.MedChrgitmType == "08" || item.MedChrgitmType == "1401" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" || item.MedChrgitmType == "301" { //材料费
288
+					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
289
+					//materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
290
+					//materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
291
+				}
292
+
293
+				if item.MedChrgitmType == "07" { //护理
294
+					hiliCostTotal, _ = decimal.NewFromFloat(hiliCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
295
+					//hiliCostSelfTotal, _ = decimal.NewFromFloat(hiliCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
296
+					//hiliCostPartSelfTotal, _ = decimal.NewFromFloat(hiliCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
297
+				}
298
+
299
+				if item.MedChrgitmType == "09" || item.MedChrgitmType == "101" { //西药费
300
+					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
301
+					//westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
302
+					//westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
303
+				}
304
+
305
+				if item.MedChrgitmType == "11" { //中成费
306
+					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
307
+					//chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
308
+					//chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
309
+				}
310
+
311
+				if item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
312
+					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
313
+					//otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
314
+					//otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
315
+				}
316
+			}
317
+		}
318
+	}
319
+
320
+	//pre_pay_money := service.GetUserMoney(order.PatientId, adminUser.CurrentOrgId)
321
+	//sum, _ := service.RefundListSum(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime, order.PatientId)
322
+	admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
323
+	charge_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
324
+
325
+	c.ServeSuccessJSON(map[string]interface{}{
326
+		"charge_admin_name":                           charge_admin.UserName,
327
+		"patient":                                     patient,
328
+		"admin_user_name":                             admin.UserName, //收款员
329
+		"bedCostTotal":                                bedCostTotal,
330
+		"bedCostSelfTotal":                            bedCostSelfTotal,
331
+		"bedCostPartSelfTotal":                        bedCostPartSelfTotal,
332
+		"operationCostTotal":                          operationCostTotal,
333
+		"operationCostSelfTotal":                      operationCostSelfTotal,
334
+		"operationCostPartSelfTotal":                  operationCostPartSelfTotal,
335
+		"otherCostTotal":                              otherCostTotal,
336
+		"otherCostSelfTotal":                          otherCostSelfTotal,
337
+		"otherCostPartSelfTotal":                      otherCostPartSelfTotal,
338
+		"materialCostTotal":                           materialCostTotal,
339
+		"materialCostSelfTotal":                       materialCostSelfTotal,
340
+		"materialCostPartSelfTotal":                   materialCostPartSelfTotal,
341
+		"westernMedicineCostTotal":                    westernMedicineCostTotal,
342
+		"westernMedicineCostSelfTotal":                westernMedicineCostSelfTotal,
343
+		"westernMedicineCostPartSelfTotal":            westernMedicineCostPartSelfTotal,
344
+		"chineseTraditionalMedicineCostTotal":         chineseTraditionalMedicineCostTotal,
345
+		"chineseTraditionalMedicineCostSelfTotal":     chineseTraditionalMedicineCostSelfTotal,
346
+		"chineseTraditionalMedicineCostPartSelfTotal": chineseTraditionalMedicineCostPartSelfTotal,
347
+		"checkCostTotal":                              checkCostTotal,
348
+		"checkCostSelfTotal":                          checkCostSelfTotal,
349
+		"checkCostPartSelfTotal":                      checkCostPartSelfTotal,
350
+		"laboratoryCostTotal":                         laboratoryCostTotal,
351
+		"laboratoryCostSelfTotal":                     laboratoryCostSelfTotal,
352
+		"laboratoryCostPartSelfTotal":                 laboratoryCostPartSelfTotal,
353
+		"treatCostTotal":                              treatCostTotal,
354
+		"treatCostSelfTotal":                          treatCostSelfTotal,
355
+		"treatCostPartSelfTotal":                      treatCostPartSelfTotal,
356
+		"zhenChaCostTotal":                            zhenChaCostTotal,
357
+		"zhenChaCostSelfTotal":                        zhenChaCostSelfTotal,
358
+		"zhenChaCostPartSelfTotal":                    zhenChaCostPartSelfTotal,
359
+		"hiliCostTotal":                               hiliCostTotal,
360
+		"hiliCostSelfTotal":                           hiliCostSelfTotal,
361
+		"medfee_sumamt":                               MedfeeSumamt,
362
+		"fund_pay_sumamt":                             FundPaySumamt,
363
+		"hifp_pay":                                    HifpPay,
364
+		"maf_pay":                                     MafPay,
365
+		"acct_pay":                                    AcctPay,
366
+		"psn_cash_pay":                                PsnCashPay,
367
+	})
368
+
33 369
 }
34 370
 
35 371
 type FapiaoApiController struct {
@@ -388,15 +724,15 @@ func (c *FapiaoApiController) OpenFaPiao() {
388 724
 	//config, _ = service.FindFaPiaoConfigInfo(c.GetAdminUserInfo().CurrentOrgId)
389 725
 
390 726
 	//认证接口
391
-	sdk := invoice.NewSdk(common.HMAC_SHA256, "5058f0defd12047ee2a7", "51440fbee667ea9a53aaa68c9c408367", "", "test")
392
-	status := GetQRStatusTwo(c.GetAdminUserInfo().CurrentOrgId)
393
-	fmt.Println("11112222")
394
-
395
-	fmt.Println(status)
396
-	if status == 0 {
397
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAuthWrong)
398
-		return
399
-	}
727
+	sdk := invoice.NewSdk(common.HMAC_SHA256, "5058f0defd12047ee2a7", "51440fbee667ea9a53aaa68c9c408367", "", "")
728
+	//status := GetQRStatusTwo(c.GetAdminUserInfo().CurrentOrgId)
729
+	//fmt.Println("11112222")
730
+	//
731
+	//fmt.Println(status)
732
+	//if status == 0 {
733
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAuthWrong)
734
+	//	return
735
+	//}
400 736
 	//查询余量接口
401 737
 	//routerAddress, postData := fapiao.QueryStock(config)
402 738
 	//r, err := sdk.HttpPost("https://apigw.goldentec.com", routerAddress, postData)
@@ -642,6 +978,7 @@ func (c *FapiaoApiController) OpenFaPiao() {
642 978
 	}
643 979
 
644 980
 	postData3["items"] = items
981
+
645 982
 	routerAddress, postData4 := fapiao.Blue(postData3) //发票开具
646 983
 	r, err4 := sdk.HttpPost("https://apigw.goldentec.com", routerAddress, postData4)
647 984
 	fmt.Println("blue")
@@ -704,23 +1041,21 @@ func (c *FapiaoApiController) OpenFaPiao() {
704 1041
 						}
705 1042
 					} else {
706 1043
 						//错误处理
707
-
1044
+						c.ServeSuccessJSON(map[string]interface{}{
1045
+							"msg": "查询失败" + resp3.Message,
1046
+						})
708 1047
 					}
709 1048
 				}
710 1049
 			} else {
711 1050
 				//错误处理
712
-
1051
+				c.ServeSuccessJSON(map[string]interface{}{
1052
+					"msg": "开具失败" + resp.Message,
1053
+				})
713 1054
 			}
714 1055
 		}
715 1056
 	}
716 1057
 }
717 1058
 func (c *FapiaoApiController) RedFaPiao() {
718
-	//认证
719
-	status := GetQRStatusTwo(c.GetAdminUserInfo().CurrentOrgId)
720
-	if status == 0 {
721
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAuthWrong)
722
-		return
723
-	}
724 1059
 
725 1060
 	id, _ := c.GetInt64("id")
726 1061
 	admin_user_id, _ := c.GetInt64("admin_user_id")
@@ -776,23 +1111,23 @@ func (c *FapiaoApiController) RedFaPiao() {
776 1111
 						})
777 1112
 					} else {
778 1113
 						c.ServeSuccessJSON(map[string]interface{}{
779
-							"msg": "红冲失败",
1114
+							"msg": "系统错误,红冲失败",
780 1115
 						})
781 1116
 					}
782 1117
 				} else {
783 1118
 					c.ServeSuccessJSON(map[string]interface{}{
784
-						"msg": "红冲失败",
1119
+						"msg": resp3.Message,
785 1120
 					})
786 1121
 				}
787 1122
 			} else {
788 1123
 				c.ServeSuccessJSON(map[string]interface{}{
789
-					"msg": "红冲失败",
1124
+					"msg": resp.Message,
790 1125
 				})
791 1126
 			}
792 1127
 		} else {
793 1128
 
794 1129
 			c.ServeSuccessJSON(map[string]interface{}{
795
-				"msg": "红冲失败",
1130
+				"msg": resp.Message,
796 1131
 			})
797 1132
 		}
798 1133
 	}

+ 1 - 0
models/fapiao.go Целия файл

@@ -54,6 +54,7 @@ type HisOrderByFaPiao struct {
54 54
 	Patients           Patients       `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
55 55
 	HisPatient         HisPatient     `gorm:"ForeignKey:MdtrtId;AssociationForeignKey:Number" json:"his_patient"`
56 56
 	HisFaPiaoOrder     HisFaPiaoOrder `gorm:"ForeignKey:FaPiaoNumber;AssociationForeignKey:TicketSn" json:"result"`
57
+	Creator            int64          `gorm:"column:creator" json:"creator" form:"creator"`
57 58
 }
58 59
 
59 60
 func (HisOrderByFaPiao) TableName() string {