Browse Source

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

陈少旭 4 months ago
parent
commit
321983ece1

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10340 //机构id
86
+		subscibe.OrgId = 10697 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10340 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10697 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 17260 //4
97
 		adminUserInfo.CurrentAppId = 17260 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10340 //机构id小英9675或4
332
+		subscibe.OrgId = 10697 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10340 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10697 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 17260 //4
343
 		adminUserInfo.CurrentAppId = 17260 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 1 - 1
controllers/manager_center_api_controller.go View File

1846
 	}
1846
 	}
1847
 	err, goodInfos := service.ModifyGoodInfo(&goodInfo)
1847
 	err, goodInfos := service.ModifyGoodInfo(&goodInfo)
1848
 
1848
 
1849
-	if adminUserInfo.CurrentOrgId != 10653 && adminUserInfo.CurrentOrgId != 10644 {
1849
+	if adminUserInfo.CurrentOrgId == 10598 {
1850
 		list, _ := service.GetHisPrescripionProjectList(good_id, adminUserInfo.CurrentOrgId)
1850
 		list, _ := service.GetHisPrescripionProjectList(good_id, adminUserInfo.CurrentOrgId)
1851
 		if len(list) > 0 {
1851
 		if len(list) > 0 {
1852
 			for _, item := range list {
1852
 			for _, item := range list {

+ 14 - 13
controllers/patient_dataconfig_api_controller.go View File

1
 package controllers
1
 package controllers
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
 	"encoding/json"
4
 	"encoding/json"
9
 	"fmt"
5
 	"fmt"
10
 	"reflect"
6
 	"reflect"
12
 	"strings"
8
 	"strings"
13
 	"time"
9
 	"time"
14
 
10
 
11
+	"XT_New/enums"
12
+	"XT_New/models"
13
+	"XT_New/service"
14
+	"XT_New/utils"
15
+
15
 	"github.com/astaxie/beego"
16
 	"github.com/astaxie/beego"
16
 )
17
 )
17
 
18
 
1049
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
1050
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
1050
 
1051
 
1051
 	adminUserInfo := this.GetAdminUserInfo()
1052
 	adminUserInfo := this.GetAdminUserInfo()
1052
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
1053
-	if getPatientErr != nil {
1054
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
1055
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1056
-		return
1057
-	} else if patient == nil {
1058
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
1059
-		return
1060
-	}
1053
+	//patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
1054
+	//if getPatientErr != nil {
1055
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
1056
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1057
+	//	return
1058
+	//} else if patient == nil {
1059
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
1060
+	//	return
1061
+	//}
1061
 
1062
 
1062
 	now := time.Now().Unix()
1063
 	now := time.Now().Unix()
1063
 
1064
 

+ 26 - 12
controllers/self_drug_api_congtroller.go View File

2975
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取查询信息失败")
2975
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取查询信息失败")
2976
 		return
2976
 		return
2977
 	}
2977
 	}
2978
-
2978
+	var medicalInsuranceLevel = "医保等级"
2979
+	medicalInsuranceLevelParent, _ := service.GetDrugDataConfig(0, medicalInsuranceLevel)
2980
+	medicalInsuranceLevelList, _ := service.GetParentDataConfig(medicalInsuranceLevelParent.ID, orgId)
2979
 	this.ServeSuccessJSON(map[string]interface{}{
2981
 	this.ServeSuccessJSON(map[string]interface{}{
2980
-		"total":     total,
2981
-		"stockList": stockList,
2982
+		"total":                     total,
2983
+		"stockList":                 stockList,
2984
+		"medicalInsuranceLevelList": medicalInsuranceLevelList,
2982
 	})
2985
 	})
2983
 }
2986
 }
2984
 
2987
 
3641
 	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
3644
 	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
3642
 	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
3645
 	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
3643
 
3646
 
3647
+	var medicalInsuranceLevel = "医保等级"
3648
+	medicalInsuranceLevelParent, _ := service.GetDrugDataConfig(0, medicalInsuranceLevel)
3649
+	medicalInsuranceLevelList, _ := service.GetParentDataConfig(medicalInsuranceLevelParent.ID, orgId)
3650
+
3644
 	this.ServeSuccessJSON(map[string]interface{}{
3651
 	this.ServeSuccessJSON(map[string]interface{}{
3645
-		"total":        total,
3646
-		"drugTypeList": drugTypeList,
3647
-		"countList":    countList,
3652
+		"total":                     total,
3653
+		"drugTypeList":              drugTypeList,
3654
+		"countList":                 countList,
3655
+		"medicalInsuranceLevelList": medicalInsuranceLevelList,
3648
 	})
3656
 	})
3649
 }
3657
 }
3650
 
3658
 
3884
 
3892
 
3885
 	manufacturerList, _ := service.GetNewAllManufacturerList(orgId)
3893
 	manufacturerList, _ := service.GetNewAllManufacturerList(orgId)
3886
 
3894
 
3895
+	var medicalInsuranceLevel = "医保等级"
3896
+	medicalInsuranceLevelParent, _ := service.GetDrugDataConfig(0, medicalInsuranceLevel)
3897
+	medicalInsuranceLevelList, _ := service.GetParentDataConfig(medicalInsuranceLevelParent.ID, orgId)
3898
+
3887
 	if orgId == 10265 {
3899
 	if orgId == 10265 {
3888
 		//storeConfig, _ := service.GetAllStoreHouseConfig(orgId)
3900
 		//storeConfig, _ := service.GetAllStoreHouseConfig(orgId)
3889
 
3901
 
3947
 		}
3959
 		}
3948
 
3960
 
3949
 		this.ServeSuccessJSON(map[string]interface{}{
3961
 		this.ServeSuccessJSON(map[string]interface{}{
3950
-			"list":             list,
3951
-			"manufacturerList": manufacturerList,
3952
-			"total":            total,
3962
+			"list":                      list,
3963
+			"manufacturerList":          manufacturerList,
3964
+			"total":                     total,
3965
+			"medicalInsuranceLevelList": medicalInsuranceLevelList,
3953
 		})
3966
 		})
3954
 	}
3967
 	}
3955
 
3968
 
4046
 		}
4059
 		}
4047
 
4060
 
4048
 		this.ServeSuccessJSON(map[string]interface{}{
4061
 		this.ServeSuccessJSON(map[string]interface{}{
4049
-			"list":             list,
4050
-			"manufacturerList": manufacturerList,
4051
-			"total":            total,
4062
+			"list":                      list,
4063
+			"manufacturerList":          manufacturerList,
4064
+			"total":                     total,
4065
+			"medicalInsuranceLevelList": medicalInsuranceLevelList,
4052
 		})
4066
 		})
4053
 	}
4067
 	}
4054
 
4068
 

+ 17 - 0
controllers/stock_in_api_controller.go View File

7006
 				ProductDate:       product_date,
7006
 				ProductDate:       product_date,
7007
 				StorehouseId:      storehouse_id,
7007
 				StorehouseId:      storehouse_id,
7008
 				MaxUnit:           warehousing_unit,
7008
 				MaxUnit:           warehousing_unit,
7009
+				Status:            1,
7009
 			}
7010
 			}
7010
 
7011
 
7011
 			//查询今日该耗材是否有记录
7012
 			//查询今日该耗材是否有记录
7025
 
7026
 
7026
 		}
7027
 		}
7027
 	}
7028
 	}
7029
+
7030
+	this.ServeSuccessJSON(map[string]interface{}{
7031
+		"msg": "保存成功!",
7032
+	})
7028
 }
7033
 }
7029
 
7034
 
7030
 func (this *StockManagerApiController) GetDamageDetailByGoodId() {
7035
 func (this *StockManagerApiController) GetDamageDetailByGoodId() {
8387
 		startTime = theTime.Unix()
8392
 		startTime = theTime.Unix()
8388
 
8393
 
8389
 	}
8394
 	}
8395
+
8390
 	var endTime int64
8396
 	var endTime int64
8391
 	if len(end_time) > 0 {
8397
 	if len(end_time) > 0 {
8392
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
8398
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
8416
 
8422
 
8417
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
8423
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
8418
 
8424
 
8425
+	//获取期初结余数量
8426
+	warehouseinfo, _ := service.GetLastMonthCount(startTime, orgId)
8427
+
8428
+	//期出结余出库数量
8429
+	warehouseOutInfo, _ := service.GetLastMonthOverCount(startTime, orgId)
8430
+
8431
+	cancelInfo, _ := service.GetLastCancelMonthCount(startTime, orgId)
8432
+
8419
 	this.ServeSuccessJSON(map[string]interface{}{
8433
 	this.ServeSuccessJSON(map[string]interface{}{
8420
 		"list":             list,
8434
 		"list":             list,
8421
 		"infoList":         infoList,
8435
 		"infoList":         infoList,
8424
 		"flowNoProList":    flowNoProList,
8438
 		"flowNoProList":    flowNoProList,
8425
 		"manufacturerList": manufacturerList,
8439
 		"manufacturerList": manufacturerList,
8426
 		"goodInfo":         goodInfo,
8440
 		"goodInfo":         goodInfo,
8441
+		"warehouseinfo":    warehouseinfo,
8442
+		"warehouseOutInfo": warehouseOutInfo,
8443
+		"cancelInfo":       cancelInfo,
8427
 	})
8444
 	})
8428
 
8445
 
8429
 }
8446
 }

+ 25 - 22
models/new_stock_models.go View File

173
 	Dealer                 int64                  `gorm:"column:dealer" json:"dealer" form:"dealer"`
173
 	Dealer                 int64                  `gorm:"column:dealer" json:"dealer" form:"dealer"`
174
 	MedicalInsuranceNumber string                 `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
174
 	MedicalInsuranceNumber string                 `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
175
 	DrugType               int64                  `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
175
 	DrugType               int64                  `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
176
+	MedicalInsuranceLevel  int64                  `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
176
 }
177
 }
177
 
178
 
178
 func (NewBaseDrugOne) TableName() string {
179
 func (NewBaseDrugOne) TableName() string {
265
 }
266
 }
266
 
267
 
267
 type GoodInfoTwenty struct {
268
 type GoodInfoTwenty struct {
268
-	ID                int64                `gorm:"column:id" json:"id" form:"id"`
269
-	SpecificationName string               `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
270
-	GoodTypeId        int64                `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
271
-	BuyPrice          float64              `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
272
-	Manufacturer      int64                `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
273
-	Dealer            int64                `gorm:"column:dealer" json:"dealer" form:"dealer"`
274
-	Status            int64                `gorm:"column:status" json:"status" form:"status"`
275
-	OrgId             int64                `gorm:"column:org_id" json:"org_id" form:"org_id"`
276
-	GoodName          string               `gorm:"column:good_name" json:"good_name" form:"good_name"`
277
-	RetailPrice       float64              `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
278
-	PackingUnit       string               `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
279
-	PackingPrice      float64              `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
280
-	GoodNumber        string               `gorm:"column:good_number" json:"good_number" form:"good_number"`
281
-	StWarehousingInfo []*StWarehousingInfo `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_warehouse_info"`
282
-
283
-	WarehousingInfoOne     []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
284
-	WarehousingInfoStart   []*StartWarehousingInfo `gorm:"json:"warehouse_info_start"`
285
-	WarehousingInfoEnd     []*StartWarehousingInfo `gorm:"json:"warehouse_info_end"`
286
-	WarehouseOutInfoEnd    []*VmStockFlowTwenty
287
-	WarehouseOutInfoStart  []*VmStockFlowTwenty
288
-	WarehouseInfoEnd       []*VmStockFlowTwenty //期末入库量
289
-	StartFlowWarehouseInfo []*VmStockFlowTwenty //本期增加
269
+	ID                          int64                   `gorm:"column:id" json:"id" form:"id"`
270
+	SpecificationName           string                  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
271
+	GoodTypeId                  int64                   `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
272
+	BuyPrice                    float64                 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
273
+	Manufacturer                int64                   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
274
+	Dealer                      int64                   `gorm:"column:dealer" json:"dealer" form:"dealer"`
275
+	Status                      int64                   `gorm:"column:status" json:"status" form:"status"`
276
+	OrgId                       int64                   `gorm:"column:org_id" json:"org_id" form:"org_id"`
277
+	GoodName                    string                  `gorm:"column:good_name" json:"good_name" form:"good_name"`
278
+	RetailPrice                 float64                 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
279
+	PackingUnit                 string                  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
280
+	PackingPrice                float64                 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
281
+	GoodNumber                  string                  `gorm:"column:good_number" json:"good_number" form:"good_number"`
282
+	SocialSecurityDirectoryCode string                  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
283
+	MedicalInsuranceLevel       int64                   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
284
+	StWarehousingInfo           []*StWarehousingInfo    `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_warehouse_info"`
285
+	WarehousingInfoOne          []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
286
+	WarehousingInfoStart        []*StartWarehousingInfo `gorm:"json:"warehouse_info_start"`
287
+	WarehousingInfoEnd          []*StartWarehousingInfo `gorm:"json:"warehouse_info_end"`
288
+	WarehouseOutInfoEnd         []*VmStockFlowTwenty
289
+	WarehouseOutInfoStart       []*VmStockFlowTwenty
290
+	WarehouseInfoEnd            []*VmStockFlowTwenty //期末入库量
291
+	StartFlowWarehouseInfo      []*VmStockFlowTwenty //本期增加
290
 
292
 
291
 	StWarehousingInfoTwo  []*StWarehousingInfoOne  `gorm:"json:"new_warehouse_info_start"` //期间增加
293
 	StWarehousingInfoTwo  []*StWarehousingInfoOne  `gorm:"json:"new_warehouse_info_start"` //期间增加
292
 	WarehouseOutInfoTenty []*WarehouseOutInfoTenty `gorm:"json:"new_warehouse_out_info"`   //减少
294
 	WarehouseOutInfoTenty []*WarehouseOutInfoTenty `gorm:"json:"new_warehouse_out_info"`   //减少
416
 	Ctime                            int64             `gorm:"column:ctime" json:"ctime" form:"ctime"`
418
 	Ctime                            int64             `gorm:"column:ctime" json:"ctime" form:"ctime"`
417
 	Mtime                            int64             `gorm:"column:mtime" json:"mtime" form:"mtime"`
419
 	Mtime                            int64             `gorm:"column:mtime" json:"mtime" form:"mtime"`
418
 	OrgId                            int64             `gorm:"column:org_id" json:"org_id" form:"org_id"`
420
 	OrgId                            int64             `gorm:"column:org_id" json:"org_id" form:"org_id"`
421
+	MedicalInsuranceNumber           string            `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
419
 	DrugFlowWarehouseInfo            []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_flow_info"`
422
 	DrugFlowWarehouseInfo            []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_flow_info"`
420
 	DrugActFlowWarehouseInfo         []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_act_flow_info"`
423
 	DrugActFlowWarehouseInfo         []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_act_flow_info"`
421
 	DrugWarehouseInfoStart           []*DrugFlowTwenty //期初入库结余
424
 	DrugWarehouseInfoStart           []*DrugFlowTwenty //期初入库结余

+ 1 - 1
service/mobile_dialysis_service.go View File

2384
 	// cur_date := time.Now().Format("2006-01-02")
2384
 	// cur_date := time.Now().Format("2006-01-02")
2385
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_solution"
2385
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_solution"
2386
 	dialysis_solution_str, _ := redis.Get(key).Result()
2386
 	dialysis_solution_str, _ := redis.Get(key).Result()
2387
-
2387
+	redis.Set(key, "", time.Second*60)
2388
 	if len(dialysis_solution_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2388
 	if len(dialysis_solution_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2389
 		err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ? and solution_status=1", patientID, orgID, mode_id).Last(&record).Error
2389
 		err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ? and solution_status=1", patientID, orgID, mode_id).Last(&record).Error
2390
 		if err != nil {
2390
 		if err != nil {

+ 1 - 0
service/patient_dataconfig_service.go View File

9
 )
9
 )
10
 
10
 
11
 func GetPatientByID(orgID int64, patientID int64) (*models.Patients, error) {
11
 func GetPatientByID(orgID int64, patientID int64) (*models.Patients, error) {
12
+
12
 	var patient models.Patients
13
 	var patient models.Patients
13
 	err := readDb.Model(&models.Patients{}).Where("id = ? and user_org_id=? and status=1 and lapseto = 1", patientID, orgID).First(&patient).Error
14
 	err := readDb.Model(&models.Patients{}).Where("id = ? and user_org_id=? and status=1 and lapseto = 1", patientID, orgID).First(&patient).Error
14
 	if err != nil {
15
 	if err != nil {

+ 6 - 0
service/self_drug_service.go View File

2852
 func GetGoodNewPurchaseStockQueryOne(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2852
 func GetGoodNewPurchaseStockQueryOne(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2853
 
2853
 
2854
 	db := XTReadDB().Model(&goodinfo).Where("status = 1")
2854
 	db := XTReadDB().Model(&goodinfo).Where("status = 1")
2855
+	if orgid == 10697 {
2856
+		db = db.Where("find_in_set('停用',good_status) = 0")
2857
+	}
2855
 	offset := (page - 1) * limit
2858
 	offset := (page - 1) * limit
2856
 	likeKey := "%" + keyword + "%"
2859
 	likeKey := "%" + keyword + "%"
2857
 	if good_type > 0 {
2860
 	if good_type > 0 {
2906
 	if good_type > 0 {
2909
 	if good_type > 0 {
2907
 		db = db.Where("drug_type = ?", good_type)
2910
 		db = db.Where("drug_type = ?", good_type)
2908
 	}
2911
 	}
2912
+	if orgid == 10697 {
2913
+		db = db.Where("find_in_set('停用',drug_status) = 0")
2914
+	}
2909
 
2915
 
2910
 	if orgid > 0 {
2916
 	if orgid > 0 {
2911
 		db = db.Where("org_id = ?", orgid)
2917
 		db = db.Where("org_id = ?", orgid)

+ 45 - 0
service/stock_service.go View File

9673
 	return flow, err
9673
 	return flow, err
9674
 }
9674
 }
9675
 
9675
 
9676
+func GetLastMonthCount(startTime int64, orgId int64) (flow []*models.VmStockFlow, err error) {
9677
+
9678
+	db := XTReadDB().Model(&flow).Where("status=1 and (consumable_type = 1 or consumable_type = 10)")
9679
+
9680
+	if startTime > 0 {
9681
+		db = db.Where("ctime <?", startTime)
9682
+	}
9683
+	if orgId > 0 {
9684
+		db = db.Where("user_org_id = ?", orgId)
9685
+	}
9686
+	err = db.Find(&flow).Error
9687
+
9688
+	return flow, err
9689
+}
9690
+
9691
+func GetLastMonthOverCount(startTime int64, orgId int64) (flow []*models.VmStockFlow, err error) {
9692
+
9693
+	db := XTReadDB().Model(&flow).Where("status=1 and (consumable_type = 2 or consumable_type=3 or consumable_type=11)")
9694
+
9695
+	if startTime > 0 {
9696
+		db = db.Where("ctime <?", startTime)
9697
+	}
9698
+	if orgId > 0 {
9699
+		db = db.Where("user_org_id = ?", orgId)
9700
+	}
9701
+	err = db.Find(&flow).Error
9702
+
9703
+	return flow, err
9704
+}
9705
+
9706
+func GetLastCancelMonthCount(startTime int64, orgId int64) (flow []*models.VmStockFlow, err error) {
9707
+
9708
+	db := XTReadDB().Model(&flow).Where("status=1 and (consumable_type = 7)")
9709
+
9710
+	if startTime > 0 {
9711
+		db = db.Where("ctime <?", startTime)
9712
+	}
9713
+	if orgId > 0 {
9714
+		db = db.Where("user_org_id = ?", orgId)
9715
+	}
9716
+	err = db.Find(&flow).Error
9717
+
9718
+	return flow, err
9719
+}
9720
+
9676
 func GetDrugCodeOpen(user_org_id int64) (models.XtDrugCodeOpen, error) {
9721
 func GetDrugCodeOpen(user_org_id int64) (models.XtDrugCodeOpen, error) {
9677
 
9722
 
9678
 	drugCodeOpen := models.XtDrugCodeOpen{}
9723
 	drugCodeOpen := models.XtDrugCodeOpen{}