|
@@ -98,6 +98,318 @@ func HisManagerApiRegistRouters() {
|
98
|
98
|
|
99
|
99
|
beego.Router("/api/test/get", &HisApiController{}, "get:GetTestOrder")
|
100
|
100
|
|
|
101
|
+ beego.Router("/api/batch/settleaccount", &HisApiController{}, "get:GetBatchSettleAccounts")
|
|
102
|
+
|
|
103
|
+}
|
|
104
|
+
|
|
105
|
+func (c *HisApiController) GetBatchSettleAccounts() {
|
|
106
|
+ order_ids := c.GetString("order_ids")
|
|
107
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
108
|
+ adminUser := c.GetAdminUserInfo()
|
|
109
|
+ orders := strings.Split(order_ids, ",")
|
|
110
|
+ var newOrders []models.Orders
|
|
111
|
+ for _, item := range orders {
|
|
112
|
+ order, _ := service.GetHisOrderByIDTenOne(item)
|
|
113
|
+ his, _ := service.GetHisPatientByNumber(order.MdtrtId)
|
|
114
|
+ orderInfos, _ := service.GetHisOrderInfoByNumberOne(order.Number)
|
|
115
|
+ orderInfos_two, _ := service.GetHisOrderInfoByNumberTwo(order.Number)
|
|
116
|
+ orderInfos = append(orderInfos, orderInfos_two...)
|
|
117
|
+ his_hospital, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
|
|
118
|
+ //diagnosisConfig, _ := service.FindDiagnoseById(his.Diagnosis)
|
|
119
|
+ var diagnosis_ids []string
|
|
120
|
+ if his.ID > 0 {
|
|
121
|
+ diagnosis_ids = strings.Split(his.Diagnosis, ",")
|
|
122
|
+
|
|
123
|
+ } else {
|
|
124
|
+ diagnosis_ids = strings.Split(his_hospital.Diagnosis, ",")
|
|
125
|
+
|
|
126
|
+ }
|
|
127
|
+ patient, _ := service.GetPatientByIDTenTwo(adminUser.CurrentOrgId, order.PatientId)
|
|
128
|
+ var dia_config []*models.HisXtDiagnoseConfig
|
|
129
|
+ var name string
|
|
130
|
+ for _, item := range diagnosis_ids {
|
|
131
|
+ id, _ := strconv.ParseInt(item, 10, 64)
|
|
132
|
+ diagnosisConfig, _ := service.FindDiagnoseById(id)
|
|
133
|
+ dia_config = append(dia_config, diagnosisConfig)
|
|
134
|
+ if len(name) == 0 {
|
|
135
|
+ name = diagnosisConfig.ClassName
|
|
136
|
+
|
|
137
|
+ } else {
|
|
138
|
+ name = name + "," + diagnosisConfig.ClassName
|
|
139
|
+ }
|
|
140
|
+ }
|
|
141
|
+
|
|
142
|
+ var bedCostTotal float64 = 0 //床位总费
|
|
143
|
+ var bedCostSelfTotal float64 = 0 //床位自费
|
|
144
|
+ var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
|
|
145
|
+ var bedSelfTotal float64 = 0 //床位部分项目自费
|
|
146
|
+ var bedInscpTotal float64 = 0 //床位部分项目自费
|
|
147
|
+
|
|
148
|
+ var operationCostTotal float64 = 0 //手术费
|
|
149
|
+ var operationCostSelfTotal float64 = 0 //手术费
|
|
150
|
+ var operationCostPartSelfTotal float64 = 0 //手术费
|
|
151
|
+ var operationSelfTotal float64 = 0 //床位部分项目自费
|
|
152
|
+ var operationInscpTotal float64 = 0 //床位部分项目自费
|
|
153
|
+
|
|
154
|
+ var otherCostTotal float64 = 0 //其他费用
|
|
155
|
+ var otherCostSelfTotal float64 = 0 //其他费用
|
|
156
|
+ var otherCostPartSelfTotal float64 = 0 //其他费用
|
|
157
|
+ var otherSelfTotal float64 = 0 //床位部分项目自费
|
|
158
|
+ var otherInscpTotal float64 = 0 //床位部分项目自费
|
|
159
|
+
|
|
160
|
+ var materialCostTotal float64 = 0 //材料费
|
|
161
|
+ var materialCostSelfTotal float64 = 0 //材料费
|
|
162
|
+ var materialCostPartSelfTotal float64 = 0 //材料费
|
|
163
|
+ var materialSelfTotal float64 = 0 //床位部分项目自费
|
|
164
|
+ var materialInscpTotal float64 = 0 //床位部分项目自费
|
|
165
|
+
|
|
166
|
+ var westernMedicineCostTotal float64 = 0 //西药费
|
|
167
|
+ var westernMedicineCostSelfTotal float64 = 0 //西药费
|
|
168
|
+ var westernMedicineCostPartSelfTotal float64 = 0 //西药费
|
|
169
|
+ var westernMedicineSelfTotal float64 = 0 //床位部分项目自费
|
|
170
|
+ var westernMedicineInscpTotal float64 = 0 //床位部分项目自费
|
|
171
|
+
|
|
172
|
+ var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
|
|
173
|
+ var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
|
|
174
|
+ var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
|
|
175
|
+ var chineseTraditionalSelfTotal float64 = 0 //床位部分项目自费
|
|
176
|
+ var chineseTraditionalInscpTotal float64 = 0 //床位部分项目自费
|
|
177
|
+
|
|
178
|
+ var checkCostTotal float64 = 0 //检查费
|
|
179
|
+ var checkCostSelfTotal float64 = 0 //检查费
|
|
180
|
+ var checkCostPartSelfTotal float64 = 0 //检查费
|
|
181
|
+ var checkSelfTotal float64 = 0 //床位部分项目自费
|
|
182
|
+ var checkInscpTotal float64 = 0 //床位部分项目自费
|
|
183
|
+
|
|
184
|
+ var laboratoryCostTotal float64 = 0 //化验费
|
|
185
|
+ var laboratoryCostSelfTotal float64 = 0 //化验费
|
|
186
|
+ var laboratoryCostPartSelfTotal float64 = 0 //化验费
|
|
187
|
+ var laboratorySelfTotal float64 = 0 //床位部分项目自费
|
|
188
|
+ var laboratoryInscpTotal float64 = 0 //床位部分项目自费
|
|
189
|
+
|
|
190
|
+ var treatCostTotal float64 = 0 //治疗费用
|
|
191
|
+ var treatCostSelfTotal float64 = 0 //治疗费用
|
|
192
|
+ var treatCostPartSelfTotal float64 = 0 //治疗费用
|
|
193
|
+ var treatSelfTotal float64 = 0 //床位部分项目自费
|
|
194
|
+ var treatInscpTotal float64 = 0 //床位部分项目自费
|
|
195
|
+
|
|
196
|
+ decimal.DivisionPrecision = 2
|
|
197
|
+
|
|
198
|
+ for _, item := range orderInfos {
|
|
199
|
+ if item.MedChrgitmType == "01" { //床位费
|
|
200
|
+ bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
201
|
+ bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
202
|
+ bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
203
|
+ bedSelfTotal, _ = decimal.NewFromFloat(bedSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
|
204
|
+ bedInscpTotal, _ = decimal.NewFromFloat(bedInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
|
|
205
|
+
|
|
206
|
+ }
|
|
207
|
+
|
|
208
|
+ if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
|
|
209
|
+ if item.MedChrgitmType == "03" { //检查费
|
|
210
|
+ laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
211
|
+ laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
212
|
+ laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
213
|
+ laboratorySelfTotal, _ = decimal.NewFromFloat(laboratorySelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
|
214
|
+ laboratoryInscpTotal, _ = decimal.NewFromFloat(laboratoryInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
|
|
215
|
+
|
|
216
|
+ }
|
|
217
|
+ } else {
|
|
218
|
+
|
|
219
|
+ if item.MedChrgitmType == "03" { //检查费
|
|
220
|
+ checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
221
|
+ checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
222
|
+ checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
223
|
+ checkSelfTotal, _ = decimal.NewFromFloat(checkSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
|
224
|
+ checkInscpTotal, _ = decimal.NewFromFloat(checkInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
|
|
225
|
+
|
|
226
|
+ }
|
|
227
|
+
|
|
228
|
+ }
|
|
229
|
+
|
|
230
|
+ if item.MedChrgitmType == "04" { //化验费
|
|
231
|
+ laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
232
|
+ laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
233
|
+ laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
234
|
+ laboratorySelfTotal, _ = decimal.NewFromFloat(laboratorySelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
|
235
|
+ laboratoryInscpTotal, _ = decimal.NewFromFloat(laboratoryInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
|
|
236
|
+
|
|
237
|
+ }
|
|
238
|
+
|
|
239
|
+ if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
|
|
240
|
+
|
|
241
|
+ treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
242
|
+ treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
243
|
+ treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
244
|
+ treatSelfTotal, _ = decimal.NewFromFloat(treatSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
|
245
|
+ treatInscpTotal, _ = decimal.NewFromFloat(treatInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
|
|
246
|
+
|
|
247
|
+ }
|
|
248
|
+
|
|
249
|
+ if item.MedChrgitmType == "06" { //手术费
|
|
250
|
+ operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
251
|
+ operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
252
|
+ operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
253
|
+ operationSelfTotal, _ = decimal.NewFromFloat(operationSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
|
254
|
+ operationInscpTotal, _ = decimal.NewFromFloat(operationInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
|
|
255
|
+
|
|
256
|
+ }
|
|
257
|
+
|
|
258
|
+ if item.MedChrgitmType == "08" { //材料费
|
|
259
|
+ materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
260
|
+ materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
261
|
+ materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
262
|
+ materialSelfTotal, _ = decimal.NewFromFloat(materialSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
|
263
|
+ materialInscpTotal, _ = decimal.NewFromFloat(materialInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
|
|
264
|
+
|
|
265
|
+ }
|
|
266
|
+
|
|
267
|
+ if item.MedChrgitmType == "09" { //西药费
|
|
268
|
+ westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
269
|
+ westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
270
|
+ westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
271
|
+ westernMedicineSelfTotal, _ = decimal.NewFromFloat(westernMedicineSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
|
272
|
+ westernMedicineInscpTotal, _ = decimal.NewFromFloat(westernMedicineInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
|
|
273
|
+
|
|
274
|
+ }
|
|
275
|
+
|
|
276
|
+ if item.MedChrgitmType == "11" { //中成费
|
|
277
|
+ chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
278
|
+ chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
279
|
+ chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
280
|
+ chineseTraditionalSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
|
281
|
+ chineseTraditionalInscpTotal, _ = decimal.NewFromFloat(chineseTraditionalInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
|
|
282
|
+
|
|
283
|
+ }
|
|
284
|
+
|
|
285
|
+ if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
|
|
286
|
+ otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
|
|
287
|
+ otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
|
|
288
|
+ otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
|
|
289
|
+ otherSelfTotal, _ = decimal.NewFromFloat(otherSelfTotal).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
|
|
290
|
+ otherInscpTotal, _ = decimal.NewFromFloat(otherInscpTotal).Add(decimal.NewFromFloat(item.InscpScpAmt)).Float64()
|
|
291
|
+
|
|
292
|
+ }
|
|
293
|
+ }
|
|
294
|
+
|
|
295
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
296
|
+
|
|
297
|
+ printor_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
298
|
+ charge_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, order.Creator)
|
|
299
|
+
|
|
300
|
+ doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, his_hospital.Doctor)
|
|
301
|
+
|
|
302
|
+ roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
303
|
+
|
|
304
|
+ var doctor_name string
|
|
305
|
+ if roles.ID == 0 {
|
|
306
|
+ doctor_name = "管理员"
|
|
307
|
+ } else {
|
|
308
|
+ doctor_name = roles.UserName
|
|
309
|
+ }
|
|
310
|
+
|
|
311
|
+ yiliao_leibie := ""
|
|
312
|
+
|
|
313
|
+ switch order.MedType {
|
|
314
|
+ case "11":
|
|
315
|
+ yiliao_leibie = "普通门诊"
|
|
316
|
+ break
|
|
317
|
+ case "12":
|
|
318
|
+ yiliao_leibie = "门诊挂号"
|
|
319
|
+ break
|
|
320
|
+ case "13":
|
|
321
|
+ yiliao_leibie = "急诊"
|
|
322
|
+ break
|
|
323
|
+ case "14":
|
|
324
|
+ yiliao_leibie = "门诊特殊病"
|
|
325
|
+ break
|
|
326
|
+ case "15":
|
|
327
|
+ yiliao_leibie = "门诊统筹"
|
|
328
|
+ break
|
|
329
|
+ case "16":
|
|
330
|
+ yiliao_leibie = "门诊慢性病"
|
|
331
|
+ break
|
|
332
|
+ case "21":
|
|
333
|
+ yiliao_leibie = "普通住院"
|
|
334
|
+ break
|
|
335
|
+ }
|
|
336
|
+ var newOrder models.Orders
|
|
337
|
+
|
|
338
|
+ newOrder.Diagnosis = name
|
|
339
|
+ newOrder.OrderInfos = orderInfos
|
|
340
|
+ newOrder.Number = order.MdtrtId
|
|
341
|
+ newOrder.Date = order.SettleAccountsDate
|
|
342
|
+ newOrder.ChargeAdmin = charge_admin
|
|
343
|
+ newOrder.PrintorAdmin = printor_admin
|
|
344
|
+ newOrder.Order = order
|
|
345
|
+ newOrder.BedCostTotal = bedCostTotal
|
|
346
|
+ newOrder.BedCostSelfTotal = bedCostSelfTotal
|
|
347
|
+ newOrder.BedCostPartSelfTotal = bedCostPartSelfTotal
|
|
348
|
+ newOrder.BedSelfTotal = bedSelfTotal
|
|
349
|
+ newOrder.BedInscpTotal = bedInscpTotal
|
|
350
|
+ newOrder.OperationCostTotal = operationCostTotal
|
|
351
|
+ newOrder.OperationCostSelfTotal = operationCostSelfTotal
|
|
352
|
+ newOrder.OperationCostPartSelfTotal = operationCostPartSelfTotal
|
|
353
|
+ newOrder.OperationSelfTotal = operationSelfTotal
|
|
354
|
+ newOrder.OperationInscpTotal = operationInscpTotal
|
|
355
|
+ newOrder.OtherCostTotal = otherCostTotal
|
|
356
|
+ newOrder.OtherCostSelfTotal = otherCostSelfTotal
|
|
357
|
+ newOrder.OtherCostPartSelfTotal = otherCostPartSelfTotal
|
|
358
|
+ newOrder.OtherSelfTotal = otherSelfTotal
|
|
359
|
+ newOrder.OtherInscpTotal = otherInscpTotal
|
|
360
|
+
|
|
361
|
+ newOrder.MaterialCostTotal = materialCostTotal
|
|
362
|
+ newOrder.MaterialCostSelfTotal = materialCostSelfTotal
|
|
363
|
+ newOrder.MaterialCostPartSelfTotal = materialCostPartSelfTotal
|
|
364
|
+ newOrder.MaterialSelfTotal = materialSelfTotal
|
|
365
|
+ newOrder.MaterialInscpTotal = materialInscpTotal
|
|
366
|
+
|
|
367
|
+ newOrder.WesternMedicineCostTotal = westernMedicineCostTotal
|
|
368
|
+ newOrder.WesternMedicineCostSelfTotal = westernMedicineCostSelfTotal
|
|
369
|
+ newOrder.WesternMedicineCostPartSelfTotal = westernMedicineCostPartSelfTotal
|
|
370
|
+ newOrder.WesternMedicineSelfTotal = westernMedicineSelfTotal
|
|
371
|
+ newOrder.WesternMedicineInscpTotal = westernMedicineInscpTotal
|
|
372
|
+
|
|
373
|
+ newOrder.ChineseTraditionalMedicineCostTotal = chineseTraditionalMedicineCostTotal
|
|
374
|
+ newOrder.ChineseTraditionalMedicineCostSelfTotal = chineseTraditionalMedicineCostSelfTotal
|
|
375
|
+ newOrder.ChineseTraditionalMedicineCostPartSelfTotal = chineseTraditionalMedicineCostPartSelfTotal
|
|
376
|
+ newOrder.ChineseTraditionalSelfTotal = chineseTraditionalSelfTotal
|
|
377
|
+ newOrder.ChineseTraditionalInscpTotal = chineseTraditionalInscpTotal
|
|
378
|
+
|
|
379
|
+ newOrder.CheckCostTotal = checkCostTotal
|
|
380
|
+ newOrder.CheckCostSelfTotal = checkCostSelfTotal
|
|
381
|
+ newOrder.CheckCostPartSelfTotal = checkCostPartSelfTotal
|
|
382
|
+ newOrder.CheckSelfTotal = checkSelfTotal
|
|
383
|
+ newOrder.CheckInscpTotal = checkInscpTotal
|
|
384
|
+
|
|
385
|
+ newOrder.LaboratoryCostTotal = laboratoryCostTotal
|
|
386
|
+ newOrder.LaboratoryCostSelfTotal = laboratoryCostSelfTotal
|
|
387
|
+ newOrder.LaboratoryCostPartSelfTotal = laboratoryCostPartSelfTotal
|
|
388
|
+ newOrder.LaboratorySelfTotal = laboratorySelfTotal
|
|
389
|
+ newOrder.LaboratoryInscpTotal = laboratoryInscpTotal
|
|
390
|
+
|
|
391
|
+ newOrder.TreatCostTotal = treatCostTotal
|
|
392
|
+ newOrder.TreatCostSelfTotal = treatCostSelfTotal
|
|
393
|
+ newOrder.TreatCostPartSelfTotal = treatCostPartSelfTotal
|
|
394
|
+ newOrder.TreatSelfTotal = treatSelfTotal
|
|
395
|
+ newOrder.TreatInscpTotal = treatInscpTotal
|
|
396
|
+
|
|
397
|
+ newOrder.DoctorInfo = doctor_info
|
|
398
|
+ newOrder.DoctorName = doctor_name
|
|
399
|
+ newOrder.HealthCardNo = order.PsnNo
|
|
400
|
+ newOrder.YiliaoLeibie = yiliao_leibie
|
|
401
|
+ newOrder.Patient = patient
|
|
402
|
+ newOrder.OrgName = miConfig.OrgName
|
|
403
|
+ newOrder.OrgCode = miConfig.Code
|
|
404
|
+ newOrder.OrderNumber = order.Number
|
|
405
|
+ newOrder.HisPatient = his
|
|
406
|
+ newOrder.DiaConfig = dia_config
|
|
407
|
+
|
|
408
|
+ newOrders = append(newOrders, newOrder)
|
|
409
|
+ }
|
|
410
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
411
|
+ "orders": newOrders,
|
|
412
|
+ })
|
101
|
413
|
}
|
102
|
414
|
|
103
|
415
|
func (c *HisApiController) GetTestOrder() {
|
|
@@ -5569,7 +5881,7 @@ func (c *HisApiController) setAdviceTemplateWithJSON(advice *models.HisPrescript
|
5569
|
5881
|
day := int64(json["day"].(float64))
|
5570
|
5882
|
advice.Day = day
|
5571
|
5883
|
}
|
5572
|
|
-
|
|
5884
|
+ advice.FrequencyType = 1
|
5573
|
5885
|
return 0
|
5574
|
5886
|
}
|
5575
|
5887
|
|
|
@@ -5624,6 +5936,8 @@ func (c *HisApiController) setProjectTemplateWithJSON(project *models.HisPrescri
|
5624
|
5936
|
unit, _ := json["unit"].(string)
|
5625
|
5937
|
project.Unit = unit
|
5626
|
5938
|
}
|
|
5939
|
+ project.FrequencyType = 1
|
|
5940
|
+
|
5627
|
5941
|
return 0
|
5628
|
5942
|
}
|
5629
|
5943
|
|
|
@@ -5637,6 +5951,8 @@ func (c *HisApiController) GetHisOrderList() {
|
5637
|
5951
|
p_type, _ := c.GetInt64("p_type", 0)
|
5638
|
5952
|
sort_type, _ := c.GetInt64("sort_type", 0)
|
5639
|
5953
|
charge_type, _ := c.GetInt64("charge_type", 0)
|
|
5954
|
+ sch_type, _ := c.GetInt64("sch_type", 0)
|
|
5955
|
+ zone_type, _ := c.GetInt64("zone_type", 0)
|
5640
|
5956
|
|
5641
|
5957
|
timeLayout := "2006-01-02"
|
5642
|
5958
|
loc, _ := time.LoadLocation("Local")
|
|
@@ -5663,7 +5979,7 @@ func (c *HisApiController) GetHisOrderList() {
|
5663
|
5979
|
|
5664
|
5980
|
adminUser := c.GetAdminUserInfo()
|
5665
|
5981
|
org_id := adminUser.CurrentOrgId
|
5666
|
|
- order, err, total := service.GetHisOrderList(org_id, page, limit, startTime, endTime, types, keywords, p_type, sort_type, start_time, end_time, charge_type)
|
|
5982
|
+ order, err, total := service.GetHisOrderList(org_id, page, limit, startTime, endTime, types, keywords, p_type, sort_type, start_time, end_time, charge_type, sch_type, zone_type)
|
5667
|
5983
|
|
5668
|
5984
|
for _, item := range order {
|
5669
|
5985
|
info, _ := service.GetHisPrescriptionByPatientID(item.PatientId, item.UserOrgId)
|
|
@@ -9177,96 +9493,198 @@ func (c *HisApiController) CreateHisPrescriptionTemplate() {
|
9177
|
9493
|
return
|
9178
|
9494
|
}
|
9179
|
9495
|
|
9180
|
|
- err = service.CreateHisPrescriptionTemplate(template)
|
9181
|
|
- if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
9182
|
|
- prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
9183
|
|
- if len(prescriptions) > 0 {
|
9184
|
|
- for _, item := range prescriptions {
|
9185
|
|
- items := item.(map[string]interface{})
|
9186
|
|
- if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
|
9187
|
|
- utils.ErrorLog("type")
|
9188
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
9189
|
|
- return
|
9190
|
|
- }
|
9191
|
|
- types := int64(items["type"].(float64))
|
|
9496
|
+ template_one, _ := service.GetHisPrescriptionTemplateByModeId(mode_id, patient_id, c.GetAdminUserInfo().CurrentOrgId)
|
9192
|
9497
|
|
9193
|
|
- if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
|
9194
|
|
- utils.ErrorLog("med_type")
|
9195
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
9196
|
|
- return
|
9197
|
|
- }
|
9198
|
|
- med_type := strconv.Itoa(int(items["med_type"].(float64)))
|
|
9498
|
+ //如果已经存在记录则删除处方
|
|
9499
|
+ if template_one.ID > 0 {
|
|
9500
|
+ ps, _ := service.GetHisPrescriptionInfoTemplates(template_one.ID, template_one.UserOrgId)
|
|
9501
|
+ for _, item := range ps {
|
|
9502
|
+ service.DelelteHisPrescriptionInfoTemplate(item.ID, item.UserOrgId)
|
|
9503
|
+ }
|
|
9504
|
+ if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
|
9505
|
+ prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
|
9506
|
+ if len(prescriptions) > 0 {
|
|
9507
|
+ for _, item := range prescriptions {
|
|
9508
|
+ items := item.(map[string]interface{})
|
|
9509
|
+ if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
|
|
9510
|
+ utils.ErrorLog("type")
|
|
9511
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
9512
|
+ return
|
|
9513
|
+ }
|
|
9514
|
+ types := int64(items["type"].(float64))
|
9199
|
9515
|
|
9200
|
|
- ctime := time.Now().Unix()
|
9201
|
|
- prescription := &models.HisPrescriptionInfoTemplate{
|
9202
|
|
- PatientId: patient_id,
|
9203
|
|
- UserOrgId: adminInfo.CurrentOrgId,
|
9204
|
|
- Ctime: ctime,
|
9205
|
|
- Mtime: ctime,
|
9206
|
|
- Type: types,
|
9207
|
|
- Modifier: adminInfo.AdminUser.Id,
|
9208
|
|
- Creator: adminInfo.AdminUser.Id,
|
9209
|
|
- Status: 1,
|
9210
|
|
- PTemplateId: template.ID,
|
9211
|
|
- MedType: med_type,
|
9212
|
|
- }
|
9213
|
|
- service.CreateHisPrescriptionInfoTemplate(prescription)
|
|
9516
|
+ if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
|
|
9517
|
+ utils.ErrorLog("med_type")
|
|
9518
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
9519
|
+ return
|
|
9520
|
+ }
|
|
9521
|
+ med_type := strconv.Itoa(int(items["med_type"].(float64)))
|
9214
|
9522
|
|
9215
|
|
- if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
|
9216
|
|
- advices := items["advices"].([]interface{})
|
9217
|
|
- //group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
|
9218
|
9523
|
ctime := time.Now().Unix()
|
9219
|
|
- mtime := ctime
|
9220
|
|
- if len(advices) > 0 {
|
9221
|
|
- for _, advice := range advices {
|
9222
|
|
- var s models.HisPrescriptionAdviceTemplate
|
9223
|
|
- s.PrescriptionId = prescription.ID
|
9224
|
|
- s.AdviceType = 2
|
9225
|
|
- s.StopState = 2
|
9226
|
|
- s.ExecutionState = 2
|
9227
|
|
- s.Status = 1
|
9228
|
|
- s.UserOrgId = adminInfo.CurrentOrgId
|
9229
|
|
- s.CreatedTime = ctime
|
9230
|
|
- s.UpdatedTime = mtime
|
9231
|
|
- s.PatientId = patient_id
|
9232
|
|
- errcode := c.setAdviceTemplateWithJSON(&s, advice.(map[string]interface{}))
|
9233
|
|
- if errcode > 0 {
|
9234
|
|
- c.ServeFailJSONWithSGJErrorCode(errcode)
|
9235
|
|
- return
|
9236
|
|
- }
|
|
9524
|
+ prescription := &models.HisPrescriptionInfoTemplate{
|
|
9525
|
+ PatientId: patient_id,
|
|
9526
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
9527
|
+ Ctime: ctime,
|
|
9528
|
+ Mtime: ctime,
|
|
9529
|
+ Type: types,
|
|
9530
|
+ Modifier: adminInfo.AdminUser.Id,
|
|
9531
|
+ Creator: adminInfo.AdminUser.Id,
|
|
9532
|
+ Status: 1,
|
|
9533
|
+ PTemplateId: template_one.ID,
|
|
9534
|
+ MedType: med_type,
|
|
9535
|
+ }
|
|
9536
|
+ service.CreateHisPrescriptionInfoTemplate(prescription)
|
|
9537
|
+
|
|
9538
|
+ if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
|
|
9539
|
+ advices := items["advices"].([]interface{})
|
|
9540
|
+ //group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
|
|
9541
|
+ ctime := time.Now().Unix()
|
|
9542
|
+ mtime := ctime
|
|
9543
|
+ if len(advices) > 0 {
|
|
9544
|
+ for _, advice := range advices {
|
|
9545
|
+ var s models.HisPrescriptionAdviceTemplate
|
|
9546
|
+ s.PrescriptionId = prescription.ID
|
|
9547
|
+ s.AdviceType = 2
|
|
9548
|
+ s.StopState = 2
|
|
9549
|
+ s.ExecutionState = 2
|
|
9550
|
+ s.Status = 1
|
|
9551
|
+ s.UserOrgId = adminInfo.CurrentOrgId
|
|
9552
|
+ s.CreatedTime = ctime
|
|
9553
|
+ s.UpdatedTime = mtime
|
|
9554
|
+ s.PatientId = patient_id
|
|
9555
|
+ errcode := c.setAdviceTemplateWithJSON(&s, advice.(map[string]interface{}))
|
|
9556
|
+ if errcode > 0 {
|
|
9557
|
+ c.ServeFailJSONWithSGJErrorCode(errcode)
|
|
9558
|
+ return
|
|
9559
|
+ }
|
9237
|
9560
|
|
9238
|
|
- service.CreateHisPrescriptionAdviceTemplate(&s)
|
|
9561
|
+ service.CreateHisPrescriptionAdviceTemplate(&s)
|
|
9562
|
+
|
|
9563
|
+ }
|
|
9564
|
+ }
|
|
9565
|
+ }
|
|
9566
|
+ if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
|
|
9567
|
+ projects := items["project"].([]interface{})
|
|
9568
|
+ if len(projects) > 0 {
|
|
9569
|
+ for _, project := range projects {
|
|
9570
|
+ var p models.HisPrescriptionProjectTemplate
|
|
9571
|
+ p.PrescriptionId = prescription.ID
|
|
9572
|
+ p.Ctime = time.Now().Unix()
|
|
9573
|
+ p.Mtime = time.Now().Unix()
|
|
9574
|
+ p.PatientId = patient_id
|
|
9575
|
+ p.UserOrgId = adminInfo.CurrentOrgId
|
|
9576
|
+ p.Status = 1
|
|
9577
|
+ errcode := c.setProjectTemplateWithJSON(&p, project.(map[string]interface{}))
|
|
9578
|
+ if errcode > 0 {
|
|
9579
|
+ c.ServeFailJSONWithSGJErrorCode(errcode)
|
|
9580
|
+ return
|
|
9581
|
+ }
|
|
9582
|
+ service.CreateHisPrescriptionProjectTemplate(&p)
|
9239
|
9583
|
|
|
9584
|
+ }
|
9240
|
9585
|
}
|
9241
|
9586
|
}
|
|
9587
|
+
|
9242
|
9588
|
}
|
9243
|
|
- if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
|
9244
|
|
- projects := items["project"].([]interface{})
|
9245
|
|
- if len(projects) > 0 {
|
9246
|
|
- for _, project := range projects {
|
9247
|
|
- var p models.HisPrescriptionProjectTemplate
|
9248
|
|
- p.PrescriptionId = prescription.ID
|
9249
|
|
- p.Ctime = time.Now().Unix()
|
9250
|
|
- p.Mtime = time.Now().Unix()
|
9251
|
|
- p.PatientId = patient_id
|
9252
|
|
- p.UserOrgId = adminInfo.CurrentOrgId
|
9253
|
|
- p.Status = 1
|
9254
|
|
- errcode := c.setProjectTemplateWithJSON(&p, project.(map[string]interface{}))
|
9255
|
|
- if errcode > 0 {
|
9256
|
|
- c.ServeFailJSONWithSGJErrorCode(errcode)
|
9257
|
|
- return
|
|
9589
|
+
|
|
9590
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
9591
|
+ "msg": "创建成功",
|
|
9592
|
+ })
|
|
9593
|
+ }
|
|
9594
|
+ }
|
|
9595
|
+
|
|
9596
|
+ } else {
|
|
9597
|
+ err = service.CreateHisPrescriptionTemplate(template)
|
|
9598
|
+ if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
|
9599
|
+ prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
|
9600
|
+ if len(prescriptions) > 0 {
|
|
9601
|
+ for _, item := range prescriptions {
|
|
9602
|
+ items := item.(map[string]interface{})
|
|
9603
|
+ if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
|
|
9604
|
+ utils.ErrorLog("type")
|
|
9605
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
9606
|
+ return
|
|
9607
|
+ }
|
|
9608
|
+ types := int64(items["type"].(float64))
|
|
9609
|
+
|
|
9610
|
+ if items["med_type"] == nil || reflect.TypeOf(items["med_type"]).String() != "float64" {
|
|
9611
|
+ utils.ErrorLog("med_type")
|
|
9612
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
9613
|
+ return
|
|
9614
|
+ }
|
|
9615
|
+ med_type := strconv.Itoa(int(items["med_type"].(float64)))
|
|
9616
|
+
|
|
9617
|
+ ctime := time.Now().Unix()
|
|
9618
|
+ prescription := &models.HisPrescriptionInfoTemplate{
|
|
9619
|
+ PatientId: patient_id,
|
|
9620
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
9621
|
+ Ctime: ctime,
|
|
9622
|
+ Mtime: ctime,
|
|
9623
|
+ Type: types,
|
|
9624
|
+ Modifier: adminInfo.AdminUser.Id,
|
|
9625
|
+ Creator: adminInfo.AdminUser.Id,
|
|
9626
|
+ Status: 1,
|
|
9627
|
+ PTemplateId: template.ID,
|
|
9628
|
+ MedType: med_type,
|
|
9629
|
+ }
|
|
9630
|
+ service.CreateHisPrescriptionInfoTemplate(prescription)
|
|
9631
|
+
|
|
9632
|
+ if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
|
|
9633
|
+ advices := items["advices"].([]interface{})
|
|
9634
|
+ //group := service.GetMaxAdviceGroupID(adminInfo.CurrentOrgId)
|
|
9635
|
+ ctime := time.Now().Unix()
|
|
9636
|
+ mtime := ctime
|
|
9637
|
+ if len(advices) > 0 {
|
|
9638
|
+ for _, advice := range advices {
|
|
9639
|
+ var s models.HisPrescriptionAdviceTemplate
|
|
9640
|
+ s.PrescriptionId = prescription.ID
|
|
9641
|
+ s.AdviceType = 2
|
|
9642
|
+ s.StopState = 2
|
|
9643
|
+ s.ExecutionState = 2
|
|
9644
|
+ s.Status = 1
|
|
9645
|
+ s.UserOrgId = adminInfo.CurrentOrgId
|
|
9646
|
+ s.CreatedTime = ctime
|
|
9647
|
+ s.UpdatedTime = mtime
|
|
9648
|
+ s.PatientId = patient_id
|
|
9649
|
+ errcode := c.setAdviceTemplateWithJSON(&s, advice.(map[string]interface{}))
|
|
9650
|
+ if errcode > 0 {
|
|
9651
|
+ c.ServeFailJSONWithSGJErrorCode(errcode)
|
|
9652
|
+ return
|
|
9653
|
+ }
|
|
9654
|
+
|
|
9655
|
+ service.CreateHisPrescriptionAdviceTemplate(&s)
|
|
9656
|
+
|
9258
|
9657
|
}
|
9259
|
|
- service.CreateHisPrescriptionProjectTemplate(&p)
|
|
9658
|
+ }
|
|
9659
|
+ }
|
|
9660
|
+ if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
|
|
9661
|
+ projects := items["project"].([]interface{})
|
|
9662
|
+ if len(projects) > 0 {
|
|
9663
|
+ for _, project := range projects {
|
|
9664
|
+ var p models.HisPrescriptionProjectTemplate
|
|
9665
|
+ p.PrescriptionId = prescription.ID
|
|
9666
|
+ p.Ctime = time.Now().Unix()
|
|
9667
|
+ p.Mtime = time.Now().Unix()
|
|
9668
|
+ p.PatientId = patient_id
|
|
9669
|
+ p.UserOrgId = adminInfo.CurrentOrgId
|
|
9670
|
+ p.Status = 1
|
|
9671
|
+ errcode := c.setProjectTemplateWithJSON(&p, project.(map[string]interface{}))
|
|
9672
|
+ if errcode > 0 {
|
|
9673
|
+ c.ServeFailJSONWithSGJErrorCode(errcode)
|
|
9674
|
+ return
|
|
9675
|
+ }
|
|
9676
|
+ service.CreateHisPrescriptionProjectTemplate(&p)
|
9260
|
9677
|
|
|
9678
|
+ }
|
9261
|
9679
|
}
|
9262
|
9680
|
}
|
|
9681
|
+
|
9263
|
9682
|
}
|
9264
|
9683
|
|
|
9684
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
9685
|
+ "msg": "创建成功",
|
|
9686
|
+ })
|
9265
|
9687
|
}
|
9266
|
|
-
|
9267
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
9268
|
|
- "msg": "创建成功",
|
9269
|
|
- })
|
9270
|
9688
|
}
|
9271
|
9689
|
}
|
9272
|
9690
|
|