mainqaq 2 years ago
parent
commit
e208ef2a31
2 changed files with 16 additions and 4 deletions
  1. 12 0
      controllers/pharmacy_controller.go
  2. 4 4
      service/pharmacy_service.go

+ 12 - 0
controllers/pharmacy_controller.go View File

32
 	beego.Router("/api/pharmacy/getpartitionlist", &PharmacyController{}, "get:GetPartitionList")           //获取当前机构的分区列表
32
 	beego.Router("/api/pharmacy/getpartitionlist", &PharmacyController{}, "get:GetPartitionList")           //获取当前机构的分区列表
33
 	beego.Router("/api/pharmacy/routeofadministration", &PharmacyController{}, "get:RouteOfAdministration") //获取当前机构的给药途径
33
 	beego.Router("/api/pharmacy/routeofadministration", &PharmacyController{}, "get:RouteOfAdministration") //获取当前机构的给药途径
34
 }
34
 }
35
+
36
+//测试
35
 func (this *PharmacyController) Tlili() {
37
 func (this *PharmacyController) Tlili() {
36
 	var err error
38
 	var err error
37
 	defer func() {
39
 	defer func() {
76
 	times := this.GetString("time", "")
78
 	times := this.GetString("time", "")
77
 	timeLayout := "2006-01-02"
79
 	timeLayout := "2006-01-02"
78
 	loc, _ := time.LoadLocation("Local")
80
 	loc, _ := time.LoadLocation("Local")
81
+	//shift, err := this.GetInt64("shift", 0) //班次
82
+	//if err != nil {
83
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
84
+	//	return
85
+	//}
86
+	//partition, err := this.GetInt64("partition", 0) //分区
87
+	//if err != nil {
88
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
89
+	//	return
90
+	//}
79
 	var stime, etime int64
91
 	var stime, etime int64
80
 	if times == "" {
92
 	if times == "" {
81
 		stime, etime = service.GetNowTime()
93
 		stime, etime = service.GetNowTime()

+ 4 - 4
service/pharmacy_service.go View File

1853
 	for _, v := range tmp {
1853
 	for _, v := range tmp {
1854
 		switch v.Unit {
1854
 		switch v.Unit {
1855
 		case t.MaxUnit:
1855
 		case t.MaxUnit:
1856
-			maxunit = v.Quantity
1856
+			maxunit = maxunit + v.Quantity
1857
 		case t.MinUnit:
1857
 		case t.MinUnit:
1858
-			minunit = v.Quantity
1858
+			minunit = minunit + v.Quantity
1859
 		default:
1859
 		default:
1860
-			terr = v.Quantity
1860
+			terr = terr + v.Quantity
1861
 			terrUnit = v.Unit
1861
 			terrUnit = v.Unit
1862
 		}
1862
 		}
1863
 	}
1863
 	}
1864
-	if minunit > minmunber {
1864
+	if minunit >= minmunber {
1865
 		if minmunber == 0 {
1865
 		if minmunber == 0 {
1866
 			err = fmt.Errorf("拆零数量不能为零")
1866
 			err = fmt.Errorf("拆零数量不能为零")
1867
 			return
1867
 			return