|
@@ -227,31 +227,53 @@ func (c *CoordinateController) SettleAccount() {
|
227
|
227
|
}
|
228
|
228
|
var presInfos []*models.PresInfo
|
229
|
229
|
var presDetails []*models.PresDetail
|
230
|
|
- for index, item := range prescriptions {
|
231
|
|
- var presDetail models.PresDetail
|
232
|
|
- var presInfo models.PresInfo
|
233
|
|
- presInfo.Cbmid = strconv.FormatInt(item.ID, 10)
|
234
|
|
- if item.Type == 1 {
|
235
|
|
- presInfo.Cbm06 = "0"
|
236
|
|
- } else {
|
237
|
|
- presInfo.Cbm06 = "5"
|
|
230
|
+
|
|
231
|
+ var doctoradvices []*models.HisDoctorAdviceInfo
|
|
232
|
+ var groups []int64
|
|
233
|
+ for _, item := range prescriptions {
|
|
234
|
+ for _, subItem := range item.HisDoctorAdviceInfo {
|
|
235
|
+ doctoradvices = append(doctoradvices, subItem)
|
238
|
236
|
}
|
|
237
|
+ }
|
239
|
238
|
|
240
|
|
- if item.Type == 1 {
|
241
|
|
- presInfo.Cbm07 = item.MedType
|
242
|
|
- } else {
|
243
|
|
- presInfo.Cbm07 = item.MedType
|
|
239
|
+ for _, item := range doctoradvices {
|
|
240
|
+ groups = append(groups, item.Groupno)
|
|
241
|
+ }
|
|
242
|
+ groups = RemoveRepeatedGroupElement(groups)
|
|
243
|
+
|
|
244
|
+ type DoctorAdvices struct {
|
|
245
|
+ GroupNo int64
|
|
246
|
+ item []*models.HisDoctorAdviceInfo
|
|
247
|
+ }
|
|
248
|
+ var doctoradvice []*DoctorAdvices
|
|
249
|
+
|
|
250
|
+ for _, group := range groups {
|
|
251
|
+ var da DoctorAdvices
|
|
252
|
+ da.GroupNo = group
|
|
253
|
+ for _, item := range doctoradvices {
|
|
254
|
+ if group == item.Groupno {
|
|
255
|
+ da.item = append(da.item, item)
|
|
256
|
+ }
|
244
|
257
|
}
|
|
258
|
+ doctoradvice = append(doctoradvice, &da)
|
|
259
|
+ }
|
245
|
260
|
|
246
|
|
- presDetail.Vaf59 = strconv.FormatInt(int64(index+1), 10)
|
|
261
|
+ for _, item := range doctoradvice {
|
|
262
|
+ var presDetail models.PresDetail
|
|
263
|
+ var presInfo models.PresInfo
|
|
264
|
+ presInfo.Cbmid = strconv.FormatInt(item.GroupNo, 10)
|
|
265
|
+
|
|
266
|
+ presInfo.Cbm06 = "0"
|
|
267
|
+ presInfo.Cbm07 = ""
|
|
268
|
+ presDetail.Vaf59 = strconv.FormatInt(item.GroupNo, 10)
|
247
|
269
|
var infoItems []*models.Item
|
248
|
|
- for index, subItem := range item.HisDoctorAdviceInfo {
|
|
270
|
+ for index, subItem := range item.item {
|
249
|
271
|
ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
|
250
|
272
|
|
251
|
273
|
var infoItem models.Item
|
252
|
|
- infoItem.Rownr = strconv.FormatInt(int64(index+1), 10)
|
|
274
|
+ infoItem.Rownr = strconv.FormatInt(int64(index), 10)
|
253
|
275
|
infoItem.Vaf11 = "2"
|
254
|
|
- infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
|
|
276
|
+ infoItem.Vaf36 = time.Unix(subItem.CreatedTime, 0).Format("2006-01-02 15:04:05")
|
255
|
277
|
infoItem.Bbx01 = subItem.BaseDrugLib.MedicalInsuranceNumber
|
256
|
278
|
infoItem.Bda01 = "1"
|
257
|
279
|
infoItem.Bby01 = ""
|
|
@@ -271,6 +293,58 @@ func (c *CoordinateController) SettleAccount() {
|
271
|
293
|
infoItem.Vaf61 = "1"
|
272
|
294
|
infoItems = append(infoItems, &infoItem)
|
273
|
295
|
}
|
|
296
|
+
|
|
297
|
+ presDetail.Item = infoItems
|
|
298
|
+ presDetails = append(presDetails, &presDetail)
|
|
299
|
+ presInfo.PresDetail = presDetails
|
|
300
|
+ presInfos = append(presInfos, &presInfo)
|
|
301
|
+
|
|
302
|
+ }
|
|
303
|
+
|
|
304
|
+ for index, item := range prescriptions {
|
|
305
|
+ var presDetail models.PresDetail
|
|
306
|
+ var presInfo models.PresInfo
|
|
307
|
+ presInfo.Cbmid = strconv.FormatInt(item.ID, 10)
|
|
308
|
+ if item.Type == 1 {
|
|
309
|
+ presInfo.Cbm06 = "0"
|
|
310
|
+ } else {
|
|
311
|
+ presInfo.Cbm06 = "5"
|
|
312
|
+ }
|
|
313
|
+
|
|
314
|
+ if item.Type == 1 {
|
|
315
|
+ presInfo.Cbm07 = item.MedType
|
|
316
|
+ } else {
|
|
317
|
+ presInfo.Cbm07 = item.MedType
|
|
318
|
+ }
|
|
319
|
+
|
|
320
|
+ presDetail.Vaf59 = strconv.FormatInt(int64(index+1), 10)
|
|
321
|
+ var infoItems []*models.Item
|
|
322
|
+ //for index, subItem := range item.HisDoctorAdviceInfo {
|
|
323
|
+ // ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
|
|
324
|
+ //
|
|
325
|
+ // var infoItem models.Item
|
|
326
|
+ // infoItem.Rownr = strconv.FormatInt(int64(index+1), 10)
|
|
327
|
+ // infoItem.Vaf11 = "2"
|
|
328
|
+ // infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
|
|
329
|
+ // infoItem.Bbx01 = subItem.BaseDrugLib.MedicalInsuranceNumber
|
|
330
|
+ // infoItem.Bda01 = "1"
|
|
331
|
+ // infoItem.Bby01 = ""
|
|
332
|
+ // if subItem.BaseDrugLib.MinUnit != subItem.BaseDrugLib.DoseUnit {
|
|
333
|
+ // infoItem.Vaf22 = subItem.BaseDrugLib.DrugName + " " + subItem.BaseDrugLib.Dose + subItem.BaseDrugLib.DoseUnit + "*" + strconv.FormatInt(subItem.BaseDrugLib.MinNumber, 10) + subItem.BaseDrugLib.MinUnit + "/" + subItem.BaseDrugLib.MaxUnit
|
|
334
|
+ // }
|
|
335
|
+ // infoItem.Vaf14 = subItem.BaseDrugLib.DrugName
|
|
336
|
+ // infoItem.Bdi01 = ef.Code
|
|
337
|
+ // infoItem.Vaf17 = strconv.FormatInt(subItem.Day, 10)
|
|
338
|
+ // infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
|
|
339
|
+ // infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
|
|
340
|
+ // infoItem.Vaf35 = "0"
|
|
341
|
+ // infoItem.Vaf32 = "0"
|
|
342
|
+ // infoItem.Bck01b = departmwnt.Number
|
|
343
|
+ // infoItem.Bck01d = departmwnt.Number
|
|
344
|
+ // infoItem.Vaf58 = "0"
|
|
345
|
+ // infoItem.Vaf61 = "1"
|
|
346
|
+ // infoItems = append(infoItems, &infoItem)
|
|
347
|
+ //}
|
274
|
348
|
for _, subItem := range item.HisPrescriptionProject {
|
275
|
349
|
//ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
|
276
|
350
|
|
|
@@ -279,7 +353,7 @@ func (c *CoordinateController) SettleAccount() {
|
279
|
353
|
var infoItem models.Item
|
280
|
354
|
infoItem.Rownr = "0"
|
281
|
355
|
infoItem.Vaf11 = "2"
|
282
|
|
- infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
|
|
356
|
+ infoItem.Vaf36 = time.Unix(subItem.Ctime, 0).Format("2006-01-02 15:04:05")
|
283
|
357
|
infoItem.Bbx01 = subItem.HisProject.MedicalCode
|
284
|
358
|
infoItem.Bda01 = "Z"
|
285
|
359
|
infoItem.Bby01 = ""
|
|
@@ -303,7 +377,7 @@ func (c *CoordinateController) SettleAccount() {
|
303
|
377
|
var infoItem models.Item
|
304
|
378
|
infoItem.Rownr = "0"
|
305
|
379
|
infoItem.Vaf11 = "1"
|
306
|
|
- infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
|
|
380
|
+ infoItem.Vaf36 = time.Unix(subItem.Ctime, 0).Format("2006-01-02 15:04:05")
|
307
|
381
|
infoItem.Bbx01 = subItem.HisProject.MedicalCode
|
308
|
382
|
|
309
|
383
|
if subItem.HisProject.CostClassify == 2 {
|
|
@@ -360,6 +434,7 @@ func (c *CoordinateController) SettleAccount() {
|
360
|
434
|
presInfo.PresDetail = presDetails
|
361
|
435
|
presInfos = append(presInfos, &presInfo)
|
362
|
436
|
}
|
|
437
|
+
|
363
|
438
|
info.PresInfo = presInfos
|
364
|
439
|
var result2 string
|
365
|
440
|
var request2 string
|
|
@@ -574,3 +649,20 @@ func saveLog(result string, request string, infno string, desc string, org_name
|
574
|
649
|
}
|
575
|
650
|
|
576
|
651
|
}
|
|
652
|
+
|
|
653
|
+func RemoveRepeatedGroupElement(arr []int64) (newArr []int64) {
|
|
654
|
+ newArr = make([]int64, 0)
|
|
655
|
+ for i := 0; i < len(arr); i++ {
|
|
656
|
+ repeat := false
|
|
657
|
+ for j := i + 1; j < len(arr); j++ {
|
|
658
|
+ if arr[i] == arr[j] {
|
|
659
|
+ repeat = true
|
|
660
|
+ break
|
|
661
|
+ }
|
|
662
|
+ }
|
|
663
|
+ if !repeat {
|
|
664
|
+ newArr = append(newArr, arr[i])
|
|
665
|
+ }
|
|
666
|
+ }
|
|
667
|
+ return
|
|
668
|
+}
|