Selaa lähdekoodia

11月8日库存管理

XMLWAN 3 vuotta sitten
vanhempi
commit
8ea2c8e956

+ 2 - 2
controllers/drug_stock_api_contorller.go Näytä tiedosto

242
 				}
242
 				}
243
 
243
 
244
 				if max_unit == min_unit {
244
 				if max_unit == min_unit {
245
-					warehouseInfo.StockMaxNumber = 0
246
-					warehouseInfo.StockMinNumber = warehousing_count
245
+					warehouseInfo.StockMaxNumber = warehousing_count
246
+					warehouseInfo.StockMinNumber = 0
247
 					warehouseInfo.MaxUnit = min_unit
247
 					warehouseInfo.MaxUnit = min_unit
248
 				}
248
 				}
249
 				warehousingInfo = append(warehousingInfo, warehouseInfo)
249
 				warehousingInfo = append(warehousingInfo, warehouseInfo)

+ 3 - 0
controllers/gobal_config_api_controller.go Näytä tiedosto

2061
 	page, _ := c.GetInt64("page")
2061
 	page, _ := c.GetInt64("page")
2062
 	detail, total, err := service.GetBatchOrderDetail(drug_id, orgId, page, limit)
2062
 	detail, total, err := service.GetBatchOrderDetail(drug_id, orgId, page, limit)
2063
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
2063
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
2064
+
2065
+	drug, _ := service.GetBaseDrugMedical(drug_id)
2064
 	if err != nil {
2066
 	if err != nil {
2065
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
2067
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
2066
 		return
2068
 		return
2069
 		"detail":           detail,
2071
 		"detail":           detail,
2070
 		"total":            total,
2072
 		"total":            total,
2071
 		"manufacturerList": manufacturerList,
2073
 		"manufacturerList": manufacturerList,
2074
+		"drug":             drug,
2072
 	})
2075
 	})
2073
 }
2076
 }
2074
 
2077
 

+ 18 - 7
controllers/his_api_controller.go Näytä tiedosto

3232
 					advice.StartTime = hisAdvice.StartTime
3232
 					advice.StartTime = hisAdvice.StartTime
3233
 					advice.HospApprFlag = hisAdvice.HospApprFlag
3233
 					advice.HospApprFlag = hisAdvice.HospApprFlag
3234
 
3234
 
3235
-					if hisAdvice.SingleDose != advice.SingleDose || hisAdvice.DeliveryWay != advice.DeliveryWay || hisAdvice.ExecutionFrequency != advice.ExecutionFrequency || hisAdvice.Day != advice.Day || hisAdvice.PrescribingNumber != advice.PrescribingNumber || hisAdvice.Price != advice.Price || hisAdvice.Remark != advice.Remark || hisAdvice.PrescribingNumberUnit != advice.PrescribingNumberUnit {
3236
-						advice.ExecutionTime = 0
3237
-						advice.ExecutionStaff = 0
3238
-						advice.ExecutionState = 2
3239
-						advice.CheckTime = 0
3240
-						advice.Checker = 0
3241
-						advice.CheckState = 2
3235
+					if hisAdvice.UserOrgId == 10028 {
3236
+						if hisAdvice.DeliveryWay != advice.DeliveryWay || hisAdvice.ExecutionFrequency != advice.ExecutionFrequency || hisAdvice.Day != advice.Day || hisAdvice.PrescribingNumber != advice.PrescribingNumber || hisAdvice.Price != advice.Price || hisAdvice.Remark != advice.Remark || hisAdvice.PrescribingNumberUnit != advice.PrescribingNumberUnit {
3237
+							advice.ExecutionTime = 0
3238
+							advice.ExecutionStaff = 0
3239
+							advice.ExecutionState = 2
3240
+							advice.CheckTime = 0
3241
+							advice.Checker = 0
3242
+							advice.CheckState = 2
3243
+						}
3244
+					} else {
3245
+						if hisAdvice.SingleDose != advice.SingleDose || hisAdvice.DeliveryWay != advice.DeliveryWay || hisAdvice.ExecutionFrequency != advice.ExecutionFrequency || hisAdvice.Day != advice.Day || hisAdvice.PrescribingNumber != advice.PrescribingNumber || hisAdvice.Price != advice.Price || hisAdvice.Remark != advice.Remark || hisAdvice.PrescribingNumberUnit != advice.PrescribingNumberUnit {
3246
+							advice.ExecutionTime = 0
3247
+							advice.ExecutionStaff = 0
3248
+							advice.ExecutionState = 2
3249
+							advice.CheckTime = 0
3250
+							advice.Checker = 0
3251
+							advice.CheckState = 2
3252
+						}
3242
 					}
3253
 					}
3243
 
3254
 
3244
 					//advice.Groupno = hisAdvice.Groupno
3255
 					//advice.Groupno = hisAdvice.Groupno

+ 14 - 4
controllers/schedule_api_controller.go Näytä tiedosto

1417
 			schedule_date := time.Now().Format("2006-01-02")
1417
 			schedule_date := time.Now().Format("2006-01-02")
1418
 			date, _ := utils.ParseTimeStringToTime("2006-01-02", schedule_date)
1418
 			date, _ := utils.ParseTimeStringToTime("2006-01-02", schedule_date)
1419
 			clear_schedule_date := date.Unix() //根据日期去清除,该日期未来的排班数据
1419
 			clear_schedule_date := date.Unix() //根据日期去清除,该日期未来的排班数据
1420
-			if err == nil {
1421
 
1420
 
1421
+			if err == nil {
1422
 				for _, item := range schedules {
1422
 				for _, item := range schedules {
1423
 					if item.ScheduleDate > clear_schedule_date {
1423
 					if item.ScheduleDate > clear_schedule_date {
1424
+						//查询已经存在的所有排班
1425
+
1424
 						//查找当天日期是否存在
1426
 						//查找当天日期是否存在
1425
 						_, errcode := service.GetTodayScheduleIsExistOne(item.PatientId, item.ScheduleDate, item.UserOrgId)
1427
 						_, errcode := service.GetTodayScheduleIsExistOne(item.PatientId, item.ScheduleDate, item.UserOrgId)
1426
 						if errcode == gorm.ErrRecordNotFound {
1428
 						if errcode == gorm.ErrRecordNotFound {
1429
+							//查询该床位是否有患者
1430
+							sch, errcodes := service.GetPatientByBed(item.ScheduleDate, item.BedId, item.ScheduleType, item.UserOrgId)
1431
+
1432
+							if errcodes == gorm.ErrRecordNotFound {
1433
+								service.CreateSchedule(item)
1434
+							} else if errcodes == nil {
1435
+
1436
+								//清除当天该床位已有的患者
1437
+								service.ModeFyScheduleById(sch.ScheduleDate, sch.BedId, sch.ScheduleType, sch.UserOrgId)
1438
+								service.CreateSchedule(item)
1439
+							}
1427
 
1440
 
1428
-							//清除当天该床位已有的患者
1429
-							service.ModeFyScheduleById(item.ScheduleDate, item.BedId, item.ScheduleType, item.UserOrgId)
1430
-							service.CreateSchedule(item)
1431
 						} else if errcode == nil {
1441
 						} else if errcode == nil {
1432
 							schedule := models.XtSchedule{
1442
 							schedule := models.XtSchedule{
1433
 								PartitionId:  item.PartitionId,
1443
 								PartitionId:  item.PartitionId,

+ 6 - 27
controllers/stock_in_api_controller.go Näytä tiedosto

1738
 
1738
 
1739
 	if len(upDateWarehouseOutInfos) > 0 {
1739
 	if len(upDateWarehouseOutInfos) > 0 {
1740
 		for _, item := range upDateWarehouseOutInfos {
1740
 		for _, item := range upDateWarehouseOutInfos {
1741
-
1741
+			fmt.Println("item233223232323233223", item.Count)
1742
 			//1.查询该耗材该批次的最后一次出库记录
1742
 			//1.查询该耗材该批次的最后一次出库记录
1743
 			lastGood, _ := service.GetLastGoodInformationByGoodId(item.GoodId, item.WarehouseInfotId, item.OrgId)
1743
 			lastGood, _ := service.GetLastGoodInformationByGoodId(item.GoodId, item.WarehouseInfotId, item.OrgId)
1744
 
1744
 
1776
 
1776
 
1777
 					//判断该批次的剩余库存 和出库的库存进行比较
1777
 					//判断该批次的剩余库存 和出库的库存进行比较
1778
 					//如果出库的库存大于该批次的剩余库存,那么需要出库下一批次的库存
1778
 					//如果出库的库存大于该批次的剩余库存,那么需要出库下一批次的库存
1779
-
1779
+					fmt.Println("total233322323232332232332", total)
1780
+					fmt.Println("info333223322332323332233223", info.StockCount)
1780
 					if total > info.StockCount {
1781
 					if total > info.StockCount {
1781
 						//计算出库和该批次相差的库存
1782
 						//计算出库和该批次相差的库存
1782
 						total_count = item.Count - info.StockCount
1783
 						total_count = item.Count - info.StockCount
1789
 							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
1790
 							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
1790
 							return
1791
 							return
1791
 						}
1792
 						}
1792
-						c.ServeSuccessJSON(map[string]interface{}{
1793
-							"msg": "1",
1794
-						})
1795
 					}
1793
 					}
1796
 					//如果与上次比的库存小于或等于于该批次的剩余库存,那么需要该批次出库
1794
 					//如果与上次比的库存小于或等于于该批次的剩余库存,那么需要该批次出库
1797
 					if total <= info.StockCount {
1795
 					if total <= info.StockCount {
1837
 								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
1835
 								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
1838
 								return
1836
 								return
1839
 							}
1837
 							}
1840
-							c.ServeSuccessJSON(map[string]interface{}{
1841
-								"msg": "1",
1842
-							})
1843
-							return
1844
 						} else if errcode == nil {
1838
 						} else if errcode == nil {
1845
 							service.UpDateWarehouseOutInfo(item)
1839
 							service.UpDateWarehouseOutInfo(item)
1846
 							//更新流水
1840
 							//更新流水
1861
 								Dealer:       item.Dealer,
1855
 								Dealer:       item.Dealer,
1862
 							}
1856
 							}
1863
 							service.UpdatedGoodInfo(goodInfo, item.GoodId)
1857
 							service.UpdatedGoodInfo(goodInfo, item.GoodId)
1864
-							c.ServeSuccessJSON(map[string]interface{}{
1865
-								"msg": "1",
1866
-							})
1867
-							return
1868
 						}
1858
 						}
1869
 					}
1859
 					}
1870
 				}
1860
 				}
1931
 							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
1921
 							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
1932
 							return
1922
 							return
1933
 						}
1923
 						}
1934
-						c.ServeSuccessJSON(map[string]interface{}{
1935
-							"msg": "1",
1936
-						})
1937
-						return
1924
+
1938
 					} else if errcode == nil {
1925
 					} else if errcode == nil {
1939
 						service.UpDateWarehouseOutInfo(item)
1926
 						service.UpDateWarehouseOutInfo(item)
1940
 						flow := models.VmStockFlow{
1927
 						flow := models.VmStockFlow{
1953
 							Dealer:       item.Dealer,
1940
 							Dealer:       item.Dealer,
1954
 						}
1941
 						}
1955
 						service.UpdatedGoodInfo(goodInfo, item.GoodId)
1942
 						service.UpdatedGoodInfo(goodInfo, item.GoodId)
1956
-						return
1943
+
1957
 					}
1944
 					}
1958
 				}
1945
 				}
1959
 
1946
 
1985
 					Dealer:       item.Dealer,
1972
 					Dealer:       item.Dealer,
1986
 				}
1973
 				}
1987
 				service.UpdatedGoodInfo(goodInfo, item.GoodId)
1974
 				service.UpdatedGoodInfo(goodInfo, item.GoodId)
1988
-				if errs != nil {
1989
-					utils.ErrorLog(errs.Error())
1990
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
1991
-					return
1992
-				}
1993
-				c.ServeSuccessJSON(map[string]interface{}{
1994
-					"msg": "1",
1995
-				})
1996
-				return
1975
+
1997
 			}
1976
 			}
1998
 
1977
 
1999
 		}
1978
 		}

+ 43 - 0
controllers/supply_order_api_contorller.go Näytä tiedosto

1
+package controllers
2
+
3
+import (
4
+	"XT_New/service"
5
+	"github.com/astaxie/beego"
6
+)
7
+
8
+type SupplyOrderApiController struct {
9
+	BaseAuthAPIController
10
+}
11
+
12
+func SupplyOrderApiRegistRouters() {
13
+
14
+	beego.Router("/api/supply/getinitorder", &SupplyOrderApiController{}, "get:GetInitOrder")
15
+}
16
+
17
+func (this *SupplyOrderApiController) GetInitOrder() {
18
+
19
+	orgId := this.GetAdminUserInfo().CurrentOrgId
20
+	//获取药品库数据
21
+	baseList, _ := service.GetSupplyDrugList(orgId)
22
+
23
+	goodList, _ := service.GetSupplyGoodList(orgId)
24
+
25
+	manufactuerList, _ := service.GetAllManufacturerList(orgId)
26
+
27
+	goodTypeList, _ := service.GetAllGoodType(orgId)
28
+
29
+	supplyList, _ := service.GetSupplierList(orgId)
30
+
31
+	var drugType = "药品类型"
32
+	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
33
+	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
34
+	this.ServeSuccessJSON(map[string]interface{}{
35
+		"drugList":        baseList,
36
+		"goodList":        goodList,
37
+		"manufactuerList": manufactuerList,
38
+		"goodTypeList":    goodTypeList,
39
+		"drugTypeList":    drugTypeList,
40
+		"supplyList":      supplyList,
41
+	})
42
+	return
43
+}

+ 1 - 1
models/device_models.go Näytä tiedosto

166
 	return "xt_device_number"
166
 	return "xt_device_number"
167
 }
167
 }
168
 
168
 
169
-
170
 type XtDeviceNumber struct {
169
 type XtDeviceNumber struct {
171
 	ID      int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
170
 	ID      int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
172
 	OrgId   int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
171
 	OrgId   int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
416
 	Status          int64                   `gorm:"column:status" json:"status" form:"status"`
415
 	Status          int64                   `gorm:"column:status" json:"status" form:"status"`
417
 	CreatedTime     int64                   `gorm:"column:created_time" json:"created_time" form:"created_time"`
416
 	CreatedTime     int64                   `gorm:"column:created_time" json:"created_time" form:"created_time"`
418
 	UpdatedTime     int64                   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
417
 	UpdatedTime     int64                   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
418
+	IsExport        int64                   `gorm:"column:is_export" json:"is_export" form:"is_export"`
419
 	LastAfterWeight AssessmentAfterDislysis `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
419
 	LastAfterWeight AssessmentAfterDislysis `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
420
 }
420
 }
421
 
421
 

+ 89 - 0
models/supply.models.go Näytä tiedosto

1
+package models
2
+
3
+type SpBaseDrug struct {
4
+	ID                int64                  `gorm:"column:id" json:"id" form:"id"`
5
+	DrugName          string                 `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
6
+	DrugCategory      int64                  `gorm:"column:drug_category" json:"drug_category" form:"drug_category"`
7
+	DrugSpec          string                 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
8
+	DrugType          int64                  `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
9
+	MaxUnit           string                 `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
10
+	MinNumber         int64                  `gorm:"column:min_number" json:"min_number" form:"min_number"`
11
+	MinUnit           string                 `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
12
+	Dose              float64                `gorm:"column:dose" json:"dose" form:"dose"`
13
+	DoseUnit          string                 `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
14
+	DrugDose          float64                `gorm:"column:drug_dose" json:"drug_dose" form:"drug_dose"`
15
+	DrugDoseUnit      int64                  `gorm:"column:drug_dose_unit" json:"drug_dose_unit" form:"drug_dose_unit"`
16
+	Manufacturer      int64                  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
17
+	OrgId             int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`
18
+	Number            string                 `gorm:"column:number" json:"number" form:"number"`
19
+	DrugWarehouseInfo []*SpDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_warehouse_info"`
20
+}
21
+
22
+func (SpBaseDrug) TableName() string {
23
+	return "xt_base_drug"
24
+}
25
+
26
+type SpGoodInformation struct {
27
+	ID                int64              `gorm:"column:id" json:"id" form:"id"`
28
+	SpecificationName string             `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
29
+	GoodTypeId        int64              `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
30
+	GoodUnit          int64              `gorm:"column:good_unit" json:"good_unit" form:"good_unit"`
31
+	Manufacturer      int64              `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
32
+	OrgId             int64              `gorm:"column:org_id" json:"org_id" form:"org_id"`
33
+	GoodName          string             `gorm:"column:good_name" json:"good_name" form:"good_name"`
34
+	GoodWarehouseInfo []*SpWarehouseInfo `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"good_warehouse_info"`
35
+}
36
+
37
+func (SpGoodInformation) TableName() string {
38
+	return "xt_good_information"
39
+}
40
+
41
+type SpWarehouseInfo struct {
42
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
43
+	GoodId     int64 `gorm:"column:good_id" json:"good_id" form:"good_id"`
44
+	StockCount int64 `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
45
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
46
+	OrgId      int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
47
+}
48
+
49
+func (SpWarehouseInfo) TableName() string {
50
+	return "xt_warehouse_info"
51
+}
52
+
53
+type SpDrugWarehouseInfo struct {
54
+	ID             int64  `gorm:"column:id" json:"id" form:"id"`
55
+	DrugId         int64  `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
56
+	MaxUnit        string `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
57
+	MinUnit        string `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
58
+	StockMaxNumber int64  `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
59
+	StockMinNumber int64  `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`
60
+	BatchNumber    string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
61
+	Status         int64  `gorm:"column:status" json:"status" form:"status"`
62
+	OrgId          int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
63
+}
64
+
65
+func (SpDrugWarehouseInfo) TableName() string {
66
+	return "xt_drug_warehouse_info"
67
+}
68
+
69
+type SpSupplierName struct {
70
+	ID           int64   `gorm:"column:id" json:"id" form:"id"`
71
+	SupplierCode string  `gorm:"column:supplier_code" json:"supplier_code" form:"supplier_code"`
72
+	SupplierName string  `gorm:"column:supplier_name" json:"supplier_name" form:"supplier_name"`
73
+	SupplierType int64   `gorm:"column:supplier_type" json:"supplier_type" form:"supplier_type"`
74
+	VatRate      float64 `gorm:"column:vat_rate" json:"vat_rate" form:"vat_rate"`
75
+	Number       string  `gorm:"column:number" json:"number" form:"number"`
76
+	Bank         string  `gorm:"column:bank" json:"bank" form:"bank"`
77
+	BankAccount  string  `gorm:"column:bank_account" json:"bank_account" form:"bank_account"`
78
+	UserOrgId    int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
79
+	Status       int64   `gorm:"column:status" json:"status" form:"status"`
80
+	ContactsId   string  `gorm:"column:contacts_id" json:"contacts_id" form:"contacts_id"`
81
+	Ctime        int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
82
+	Mtime        int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
83
+	Creater      int64   `gorm:"column:creater" json:"creater" form:"creater"`
84
+	Modify       int64   `gorm:"column:modify" json:"modify" form:"modify"`
85
+}
86
+
87
+func (SpSupplierName) TableName() string {
88
+	return "xt_supplier_name"
89
+}

+ 1 - 0
routers/router.go Näytä tiedosto

76
 	controllers.HisProjectRouters()
76
 	controllers.HisProjectRouters()
77
 	controllers.GdybRegistRouters()
77
 	controllers.GdybRegistRouters()
78
 
78
 
79
+	controllers.SupplyOrderApiRegistRouters()
79
 }
80
 }

+ 13 - 0
service/schedule_service.go Näytä tiedosto

199
 	return &scheudle, nil
199
 	return &scheudle, nil
200
 }
200
 }
201
 
201
 
202
+func GetPatientByBed(schedule_date int64, bed_id int64, scheduletype int64, orgid int64) (*models.XtSchedule, error) {
203
+	var scheudle models.XtSchedule
204
+	var err error
205
+	err = XTReadDB().Model(&scheudle).Where(" schedule_date= ? and bed_id = ? and  schedule_type = ? and  user_org_id = ? and status = 1", schedule_date, bed_id, scheduletype, orgid).Find(&scheudle).Error
206
+	if err == gorm.ErrRecordNotFound {
207
+		return nil, err
208
+	}
209
+	if err != nil {
210
+		return nil, err
211
+	}
212
+	return &scheudle, nil
213
+}
214
+
202
 func ModeFyScheduleById(schedule_date int64, bedid int64, scheduletype int64, orgid int64) error {
215
 func ModeFyScheduleById(schedule_date int64, bedid int64, scheduletype int64, orgid int64) error {
203
 
216
 
204
 	schedule := models.XtSchedule{}
217
 	schedule := models.XtSchedule{}

+ 33 - 0
service/supply_service.go Näytä tiedosto

1
+package service
2
+
3
+import "XT_New/models"
4
+
5
+func GetSupplyDrugList(orgid int64) (drug []*models.SpBaseDrug, err error) {
6
+
7
+	db := XTReadDB().Table("xt_base_drug as x").Where("x.status = 1")
8
+
9
+	if orgid > 0 {
10
+		db = db.Where("x.org_id = ?", orgid)
11
+	}
12
+
13
+	err = db.Preload("DrugWarehouseInfo", "status = 1 and org_id = ?", orgid).Find(&drug).Error
14
+	return drug, err
15
+}
16
+
17
+func GetSupplyGoodList(orgid int64) (good []*models.SpGoodInformation, err error) {
18
+
19
+	db := XTReadDB().Table("xt_good_information as x").Where("x.status = 1")
20
+
21
+	if orgid > 0 {
22
+		db = db.Where("x.org_id = ?", orgid)
23
+	}
24
+
25
+	err = db.Preload("GoodWarehouseInfo", "status = 1 and org_id = ?", orgid).Find(&good).Error
26
+	return good, err
27
+}
28
+
29
+func GetSupplierList(orgid int64) (suppler []*models.SpSupplierName, err error) {
30
+
31
+	err = XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&suppler).Error
32
+	return suppler, err
33
+}