瀏覽代碼

11月8日库存管理

XMLWAN 3 年之前
父節點
當前提交
6a3fbbf34d
共有 2 個文件被更改,包括 9 次插入11 次删除
  1. 3 3
      controllers/stock_in_api_controller.go
  2. 6 8
      service/stock_service.go

+ 3 - 3
controllers/stock_in_api_controller.go 查看文件

@@ -7711,9 +7711,9 @@ func (this *StockManagerApiController) GetDrugDetailSummary() {
7711 7711
 	page, _ := this.GetInt64("page")
7712 7712
 	orgId := this.GetAdminUserInfo().CurrentOrgId
7713 7713
 	list, total, err := service.GetDrugDetailSummary(startTime, endTime, keyword, limit, page, orgId)
7714
-
7714
+	fmt.Println("list23323232233232233223232323", list)
7715 7715
 	druglist, _, _ := service.GetDrugDetailSummaryOne(startTime, endTime, keyword, limit, page, orgId)
7716
-
7716
+	fmt.Println("druglist2332322332223322323", druglist)
7717 7717
 	patients, _ := service.GetAllpatient(orgId)
7718 7718
 	var drugType = "药品类型"
7719 7719
 	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
@@ -7753,7 +7753,7 @@ func (this *StockManagerApiController) GetGoodDetailSummary() {
7753 7753
 			return
7754 7754
 		}
7755 7755
 		startTime = theTime.Unix()
7756
-		fmt.Println("开始时间", startTime)
7756
+
7757 7757
 	}
7758 7758
 	var endTime int64
7759 7759
 	if len(end_time) > 0 {

+ 6 - 8
service/stock_service.go 查看文件

@@ -6345,7 +6345,7 @@ func GetDrugDetailSummary(startime int64, endtime int64, keyword string, limit i
6345 6345
 
6346 6346
 	if len(keyword) > 0 {
6347 6347
 		likeKey := "%" + keyword + "%"
6348
-		db = db.Select("x.patient_id,x.user_org_id,x.id,x.advice_date,x.advice_date").Joins("left join sgj_xt.xt_base_drug as d on d.id = x.drug_id").Where("d.drug_name like ?", likeKey)
6348
+		db = db.Select("x.patient_id,x.user_org_id,x.id,x.advice_date,x.advice_date,x.prescribing_number_unit,x.drug_id").Joins("left join sgj_xt.xt_base_drug as d on d.id = x.drug_id").Where("d.drug_name like ?", likeKey)
6349 6349
 	}
6350 6350
 
6351 6351
 	offset := (page - 1) * limit
@@ -6372,11 +6372,10 @@ func GetDrugDetailSummaryOne(startime int64, endtime int64, keyword string, limi
6372 6372
 
6373 6373
 	if len(keyword) > 0 {
6374 6374
 		likeKey := "%" + keyword + "%"
6375
-		db = db.Select("x.patient_id,x.user_org_id,x.id,x.advice_date,x.advice_date").Joins("left join sgj_xt.xt_base_drug as d on d.id = x.drug_id").Where("d.drug_name like ?", likeKey)
6375
+		db = db.Select("x.patient_id,x.user_org_id,x.id,x.advice_date,x.advice_date,x.prescribing_number_unit,x.drug_id").Joins("left join sgj_xt.xt_base_drug as d on d.id = x.drug_id").Where("d.drug_name like ?", likeKey)
6376 6376
 	}
6377 6377
 
6378
-	offset := (page - 1) * limit
6379
-	err = db.Count(&total).Offset(offset).Limit(limit).Order("x.created_time desc").Scan(&adviceinfo).Error
6378
+	err = db.Order("x.created_time desc").Scan(&adviceinfo).Error
6380 6379
 	return adviceinfo, total, err
6381 6380
 }
6382 6381
 
@@ -6404,7 +6403,7 @@ func GetGoodDetailSummary(startime int64, endtime int64, keyword string, limit i
6404 6403
 
6405 6404
 	if len(keyword) > 0 {
6406 6405
 		likeKey := "%" + keyword + "%"
6407
-		db = db.Select("x.id,x.project_id,x.user_org_id,x.patient_id,x.record_date").Joins("left join xt_good_information as d on d.id = x.project_id").Where("d.good_name like ?", likeKey)
6406
+		db = db.Select("x.id,x.project_id,x.user_org_id,x.patient_id,x.record_date").Joins("left join xt_good_information as d on d.id = x.project_id").Where("d.good_name like ?", likeKey).Group("d.id")
6408 6407
 	}
6409 6408
 
6410 6409
 	offset := (page - 1) * limit
@@ -6430,11 +6429,10 @@ func GetGoodDetailSummaryOne(startime int64, endtime int64, keyword string, limi
6430 6429
 
6431 6430
 	if len(keyword) > 0 {
6432 6431
 		likeKey := "%" + keyword + "%"
6433
-		db = db.Select("x.id,x.project_id,x.user_org_id,x.patient_id,x.record_date").Joins("left join xt_good_information as d on d.id = x.project_id").Where("d.good_name like ? ", likeKey)
6432
+		db = db.Select("x.id,x.project_id,x.user_org_id,x.patient_id,x.record_date").Joins("left join xt_good_information as d on d.id = x.project_id").Where("d.good_name like ? ", likeKey).Group("d.id")
6434 6433
 	}
6435 6434
 
6436
-	offset := (page - 1) * limit
6437
-	err = db.Count(&total).Offset(offset).Limit(limit).Order("x.ctime desc").Group("x.id").Scan(&project).Error
6435
+	err = db.Order("x.ctime desc").Group("x.id").Scan(&project).Error
6438 6436
 	return project, total, err
6439 6437
 }
6440 6438