|
@@ -118,6 +118,16 @@ func (this *PharmacyController) IssuedDrug() {
|
118
|
118
|
keyword := this.GetString("keyword", "")
|
119
|
119
|
times := this.GetString("time", "")
|
120
|
120
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
|
121
|
+ shift, err := this.GetInt64("shift", 0) //班次
|
|
122
|
+ if err != nil {
|
|
123
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
124
|
+ return
|
|
125
|
+ }
|
|
126
|
+ partition, err := this.GetInt64("partition", 0) //分区
|
|
127
|
+ if err != nil {
|
|
128
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
129
|
+ return
|
|
130
|
+ }
|
121
|
131
|
timeLayout := "2006-01-02"
|
122
|
132
|
loc, _ := time.LoadLocation("Local")
|
123
|
133
|
var stime, etime int64
|
|
@@ -136,8 +146,14 @@ func (this *PharmacyController) IssuedDrug() {
|
136
|
146
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
137
|
147
|
return
|
138
|
148
|
}
|
|
149
|
+ listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
|
|
150
|
+ if err != nil {
|
|
151
|
+ utils.ErrorLog(err.Error())
|
|
152
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
153
|
+ return
|
|
154
|
+ }
|
139
|
155
|
this.ServeSuccessJSON(map[string]interface{}{
|
140
|
|
- "list": flist,
|
|
156
|
+ "list": listt,
|
141
|
157
|
})
|
142
|
158
|
return
|
143
|
159
|
}
|
|
@@ -153,6 +169,16 @@ func (this *PharmacyController) WaitingDrug() {
|
153
|
169
|
}()
|
154
|
170
|
keyword := this.GetString("keyword", "")
|
155
|
171
|
times := this.GetString("time", "")
|
|
172
|
+ shift, err := this.GetInt64("shift", 0) //班次
|
|
173
|
+ if err != nil {
|
|
174
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
175
|
+ return
|
|
176
|
+ }
|
|
177
|
+ partition, err := this.GetInt64("partition", 0) //分区
|
|
178
|
+ if err != nil {
|
|
179
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
180
|
+ return
|
|
181
|
+ }
|
156
|
182
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
157
|
183
|
timeLayout := "2006-01-02"
|
158
|
184
|
loc, _ := time.LoadLocation("Local")
|
|
@@ -172,8 +198,14 @@ func (this *PharmacyController) WaitingDrug() {
|
172
|
198
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
173
|
199
|
return
|
174
|
200
|
}
|
|
201
|
+ listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
|
|
202
|
+ if err != nil {
|
|
203
|
+ utils.ErrorLog(err.Error())
|
|
204
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
205
|
+ return
|
|
206
|
+ }
|
175
|
207
|
this.ServeSuccessJSON(map[string]interface{}{
|
176
|
|
- "list": flist,
|
|
208
|
+ "list": listt,
|
177
|
209
|
})
|
178
|
210
|
return
|
179
|
211
|
}
|
|
@@ -392,6 +424,7 @@ func (this *PharmacyController) DispenseMedicine() {
|
392
|
424
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
393
|
425
|
timeLayout := "2006-01-02"
|
394
|
426
|
loc, _ := time.LoadLocation("Local")
|
|
427
|
+ deliveryway := this.GetString("deliveryway", "")
|
395
|
428
|
var stime, etime int64
|
396
|
429
|
if times == "" {
|
397
|
430
|
stime, etime = service.GetNowTime()
|
|
@@ -408,8 +441,14 @@ func (this *PharmacyController) DispenseMedicine() {
|
408
|
441
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
409
|
442
|
return
|
410
|
443
|
}
|
|
444
|
+ llist, err := service.Administration(deliveryway, orgid, flist)
|
|
445
|
+ if err != nil {
|
|
446
|
+ utils.ErrorLog(err.Error())
|
|
447
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
448
|
+ return
|
|
449
|
+ }
|
411
|
450
|
this.ServeSuccessJSON(map[string]interface{}{
|
412
|
|
- "list": flist,
|
|
451
|
+ "list": llist,
|
413
|
452
|
})
|
414
|
453
|
return
|
415
|
454
|
}
|
|
@@ -430,6 +469,7 @@ func (this *PharmacyController) WaitingMedicine() {
|
430
|
469
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
431
|
470
|
timeLayout := "2006-01-02"
|
432
|
471
|
loc, _ := time.LoadLocation("Local")
|
|
472
|
+ deliveryway := this.GetString("deliveryway", "")
|
433
|
473
|
var stime, etime int64
|
434
|
474
|
if times == "" {
|
435
|
475
|
stime, etime = service.GetNowTime()
|
|
@@ -446,8 +486,14 @@ func (this *PharmacyController) WaitingMedicine() {
|
446
|
486
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
447
|
487
|
return
|
448
|
488
|
}
|
|
489
|
+ llist, err := service.Administration(deliveryway, orgid, flist)
|
|
490
|
+ if err != nil {
|
|
491
|
+ utils.ErrorLog(err.Error())
|
|
492
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
493
|
+ return
|
|
494
|
+ }
|
449
|
495
|
this.ServeSuccessJSON(map[string]interface{}{
|
450
|
|
- "list": flist,
|
|
496
|
+ "list": llist,
|
451
|
497
|
})
|
452
|
498
|
return
|
453
|
499
|
}
|
|
@@ -467,6 +513,21 @@ func (this *PharmacyController) GetPatientsWithDrugs() {
|
467
|
513
|
is_medicine, _ := this.GetInt64("is_medicine", 0) //0:待发药,1:已发药
|
468
|
514
|
times := this.GetString("time", "")
|
469
|
515
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
|
516
|
+ deliveryway := this.GetString("deliveryway", "")
|
|
517
|
+ if deliveryway == "" {
|
|
518
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
519
|
+ return
|
|
520
|
+ }
|
|
521
|
+ shift, err := this.GetInt64("shift", 0) //班次
|
|
522
|
+ if err != nil {
|
|
523
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
524
|
+ return
|
|
525
|
+ }
|
|
526
|
+ partition, err := this.GetInt64("partition", 0) //分区
|
|
527
|
+ if err != nil {
|
|
528
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
529
|
+ return
|
|
530
|
+ }
|
470
|
531
|
timeLayout := "2006-01-02"
|
471
|
532
|
loc, _ := time.LoadLocation("Local")
|
472
|
533
|
var stime, etime int64
|
|
@@ -484,8 +545,21 @@ func (this *PharmacyController) GetPatientsWithDrugs() {
|
484
|
545
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
485
|
546
|
return
|
486
|
547
|
}
|
|
548
|
+ listll, err := service.PartitionAndLayoutDrug(deliveryway, stime, etime, orgid, shift, partition, list)
|
|
549
|
+ if err != nil {
|
|
550
|
+ utils.ErrorLog(err.Error())
|
|
551
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
552
|
+ return
|
|
553
|
+ }
|
|
554
|
+ total, err := service.CalculateTheTotalAmount(listll, drug_id)
|
|
555
|
+ if err != nil {
|
|
556
|
+ utils.ErrorLog(err.Error())
|
|
557
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
558
|
+ return
|
|
559
|
+ }
|
487
|
560
|
this.ServeSuccessJSON(map[string]interface{}{
|
488
|
|
- "list": list,
|
|
561
|
+ "list": listll,
|
|
562
|
+ "total": total,
|
489
|
563
|
})
|
490
|
564
|
return
|
491
|
565
|
}
|
|
@@ -530,13 +604,14 @@ func (this *PharmacyController) GetPartitionList() {
|
530
|
604
|
}
|
531
|
605
|
}()
|
532
|
606
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
533
|
|
- list, err := service.GetAllValidDeviceZones(orgid)
|
|
607
|
+ tmp := []*models.DeviceZone{{ID: 0, Name: "全部分区"}}
|
|
608
|
+ list, err := service.GetAllValidDeviceZones02(orgid)
|
534
|
609
|
if err != nil {
|
535
|
610
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
536
|
611
|
return
|
537
|
612
|
}
|
538
|
613
|
this.ServeSuccessJSON(map[string]interface{}{
|
539
|
|
- "list": list,
|
|
614
|
+ "list": append(tmp, list...),
|
540
|
615
|
})
|
541
|
616
|
return
|
542
|
617
|
}
|
|
@@ -552,13 +627,14 @@ func (this *PharmacyController) RouteOfAdministration() {
|
552
|
627
|
}
|
553
|
628
|
}()
|
554
|
629
|
orgid := this.GetAdminUserInfo().CurrentOrgId
|
|
630
|
+ tmp := []*models.DrugwayDic{{ID: 0, Name: "全部"}}
|
555
|
631
|
list, _, err := service.GetDrugWayDics(orgid)
|
556
|
632
|
if err != nil {
|
557
|
633
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
558
|
634
|
return
|
559
|
635
|
}
|
560
|
636
|
this.ServeSuccessJSON(map[string]interface{}{
|
561
|
|
- "list": list,
|
|
637
|
+ "list": append(tmp, list...),
|
562
|
638
|
})
|
563
|
639
|
return
|
564
|
640
|
}
|