Browse Source

2024/6/17

28169 1 month ago
parent
commit
729fa149f6

+ 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 {

+ 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
 }

+ 2 - 0
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 {
279
 	PackingPrice                float64                 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
280
 	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
 	GoodNumber                  string                  `gorm:"column:good_number" json:"good_number" form:"good_number"`
281
 	SocialSecurityDirectoryCode string                  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
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"`
282
 	StWarehousingInfo           []*StWarehousingInfo    `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_warehouse_info"`
284
 	StWarehousingInfo           []*StWarehousingInfo    `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_warehouse_info"`
283
 	WarehousingInfoOne          []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
285
 	WarehousingInfoOne          []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
284
 	WarehousingInfoStart        []*StartWarehousingInfo `gorm:"json:"warehouse_info_start"`
286
 	WarehousingInfoStart        []*StartWarehousingInfo `gorm:"json:"warehouse_info_start"`

+ 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{}