mainqaq 2 anos atrás
pai
commit
e208ef2a31
2 arquivos alterados com 16 adições e 4 exclusões
  1. 12 0
      controllers/pharmacy_controller.go
  2. 4 4
      service/pharmacy_service.go

+ 12 - 0
controllers/pharmacy_controller.go Ver arquivo

@@ -32,6 +32,8 @@ func PharmacyApiRegistRouters() {
32 32
 	beego.Router("/api/pharmacy/getpartitionlist", &PharmacyController{}, "get:GetPartitionList")           //获取当前机构的分区列表
33 33
 	beego.Router("/api/pharmacy/routeofadministration", &PharmacyController{}, "get:RouteOfAdministration") //获取当前机构的给药途径
34 34
 }
35
+
36
+//测试
35 37
 func (this *PharmacyController) Tlili() {
36 38
 	var err error
37 39
 	defer func() {
@@ -76,6 +78,16 @@ func (this *PharmacyController) TodayNumber() {
76 78
 	times := this.GetString("time", "")
77 79
 	timeLayout := "2006-01-02"
78 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 91
 	var stime, etime int64
80 92
 	if times == "" {
81 93
 		stime, etime = service.GetNowTime()

+ 4 - 4
service/pharmacy_service.go Ver arquivo

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