|
@@ -496,19 +496,19 @@ func (VMDrugWarehouseInfo) TableName() string {
|
496
|
496
|
}
|
497
|
497
|
|
498
|
498
|
type Drug struct {
|
499
|
|
- ID int64 `gorm:"column:id" json:"id" form:"id"`
|
500
|
|
- DrugName string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
|
501
|
|
- DrugSpec float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
|
502
|
|
- DrugType int64 `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
|
503
|
|
- DrugStockLimit string `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
|
504
|
|
- DrugOriginPlace string `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
|
505
|
|
- DrugDosageForm int64 `gorm:"column:drug_dosage_form" json:"drug_dosage_form" form:"drug_dosage_form"`
|
506
|
|
- Manufacturer int64 `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
|
507
|
|
- Status int64 `gorm:"column:status" json:"status" form:"status"`
|
508
|
|
- Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
509
|
|
- Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
510
|
|
- OrgId int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
|
511
|
|
- DrugCode string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
|
|
499
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
500
|
+ DrugName string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
|
|
501
|
+ DrugSpec string `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
|
|
502
|
+ DrugType int64 `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
|
|
503
|
+ DrugStockLimit string `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
|
|
504
|
+ DrugOriginPlace string `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
|
|
505
|
+ DrugDosageForm int64 `gorm:"column:drug_dosage_form" json:"drug_dosage_form" form:"drug_dosage_form"`
|
|
506
|
+ Manufacturer int64 `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
|
|
507
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
508
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
509
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
510
|
+ OrgId int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
|
|
511
|
+ DrugCode string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
|
512
|
512
|
}
|
513
|
513
|
|
514
|
514
|
func (Drug) TableName() string {
|
|
@@ -1960,6 +1960,36 @@ func FindUserDetailById(org_id int64, id int64) (user []*models.AutomaticReduceD
|
1960
|
1960
|
return
|
1961
|
1961
|
}
|
1962
|
1962
|
|
|
1963
|
+type DrugAutomaticReduceDetail struct {
|
|
1964
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
1965
|
+ WarehouseOutId int64 `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
|
|
1966
|
+ WarehouseOutOrderNumber string `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
|
|
1967
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
|
|
1968
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
1969
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
1970
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
1971
|
+ RecordTime int64 `gorm:"column:record_time" json:"record_time" form:"record_time"`
|
|
1972
|
+ OrgId int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
|
|
1973
|
+ DrugId int64 `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
|
|
1974
|
+ Count int64 `gorm:"column:count" json:"count" form:"count"`
|
|
1975
|
+ Drug *Drug `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
|
|
1976
|
+ Patients *models.Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"user"`
|
|
1977
|
+}
|
|
1978
|
+
|
|
1979
|
+func (DrugAutomaticReduceDetail) TableName() string {
|
|
1980
|
+ return "xt_drug_automatic_reduce_detail"
|
|
1981
|
+}
|
|
1982
|
+
|
|
1983
|
+func FindDrugStockUserDetailById(org_id int64, id int64) (user []*DrugAutomaticReduceDetail, err error, total int64) {
|
|
1984
|
+ db := readDb.Model(&DrugAutomaticReduceDetail{})
|
|
1985
|
+ db = db.Preload("Drug", "org_id = ? AND status = 1", org_id)
|
|
1986
|
+ db = db.Preload("Patients", "user_org_id = ? AND status = 1", org_id)
|
|
1987
|
+ db = db.Where("status = 1 AND org_id = ? AND warehouse_out_id = ? AND drug_id != 0", org_id, id)
|
|
1988
|
+ db = db.Count(&total)
|
|
1989
|
+ err = db.Find(&user).Error
|
|
1990
|
+ return
|
|
1991
|
+}
|
|
1992
|
+
|
1963
|
1993
|
func UpdateStockOutInfoCount2(org_id int64, id int64, count int64) {
|
1964
|
1994
|
writeDb.Model(&models.WarehouseOutInfo{}).Where("status = 1 AND org_id = ? AND id = ?", org_id, id).UpdateColumn("count", gorm.Expr("count + ?", count))
|
1965
|
1995
|
|