Browse Source

11月8日库存管理

XMLWAN 3 years ago
parent
commit
aee12d661d

+ 3 - 0
controllers/dialysis_api_controller.go View File

1266
 	assessment.Consciousness = data.Consciousness
1266
 	assessment.Consciousness = data.Consciousness
1267
 	assessment.Fallrisk = data.Fallrisk
1267
 	assessment.Fallrisk = data.Fallrisk
1268
 	assessment.MachineRun = data.MachineRun
1268
 	assessment.MachineRun = data.MachineRun
1269
+	assessment.AfterUrea = data.AfterUrea
1269
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1270
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1270
 
1271
 
1271
 	if assessment.ID > 0 {
1272
 	if assessment.ID > 0 {
1421
 	period, _ := c.GetInt64("period")
1422
 	period, _ := c.GetInt64("period")
1422
 	estimated_food_intake := c.GetString("estimated_food_intake")
1423
 	estimated_food_intake := c.GetString("estimated_food_intake")
1423
 	blood_pressure_during_dialysis := c.GetString("blood_pressure_during_dialysis")
1424
 	blood_pressure_during_dialysis := c.GetString("blood_pressure_during_dialysis")
1425
+	urea_befor := c.GetString("urea_befor")
1424
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1426
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1425
 		DialysisCount:                  dialysis_count,
1427
 		DialysisCount:                  dialysis_count,
1426
 		EmergencyTreatment:             emergency_treatment,
1428
 		EmergencyTreatment:             emergency_treatment,
1487
 		Period:                         period,
1489
 		Period:                         period,
1488
 		EstimatedFoodIntake:            estimated_food_intake,
1490
 		EstimatedFoodIntake:            estimated_food_intake,
1489
 		BloodPressureDuringDialysis:    blood_pressure_during_dialysis,
1491
 		BloodPressureDuringDialysis:    blood_pressure_during_dialysis,
1492
+		UreaBefor:                      urea_befor,
1490
 	}
1493
 	}
1491
 
1494
 
1492
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1495
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)

+ 2 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

1055
 	consciousness, _ := c.GetInt64("consciousness")
1055
 	consciousness, _ := c.GetInt64("consciousness")
1056
 	fallrisk, _ := c.GetInt64("fallrisk")
1056
 	fallrisk, _ := c.GetInt64("fallrisk")
1057
 	machine_run := c.GetString("machine_run")
1057
 	machine_run := c.GetString("machine_run")
1058
+	after_urea := c.GetString("after_urea")
1058
 	if id <= 0 {
1059
 	if id <= 0 {
1059
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1060
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1060
 		return
1061
 		return
1156
 		Consciousness:                consciousness,
1157
 		Consciousness:                consciousness,
1157
 		Fallrisk:                     fallrisk,
1158
 		Fallrisk:                     fallrisk,
1158
 		MachineRun:                   machine_run,
1159
 		MachineRun:                   machine_run,
1160
+		AfterUrea:                    after_urea,
1159
 	}
1161
 	}
1160
 
1162
 
1161
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1163
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)

+ 5 - 0
controllers/mobile_api_controllers/patient_api_controller.go View File

2611
 		pre_dialysis_drugs := dataBody["pre_dialysis_drugs"].(string)
2611
 		pre_dialysis_drugs := dataBody["pre_dialysis_drugs"].(string)
2612
 		evaluation.PreDialysisDrugs = pre_dialysis_drugs
2612
 		evaluation.PreDialysisDrugs = pre_dialysis_drugs
2613
 	}
2613
 	}
2614
+
2615
+	if dataBody["urea_befor"] != nil && reflect.TypeOf(dataBody["urea_befor"]).String() == "string" {
2616
+		urea_befor := dataBody["urea_befor"].(string)
2617
+		evaluation.UreaBefor = urea_befor
2618
+	}
2614
 	return
2619
 	return
2615
 }
2620
 }
2616
 
2621
 

+ 2 - 0
controllers/stock_in_api_controller.go View File

5606
 
5606
 
5607
 	list, total, _ := service.GetStockFlowList(limit, page, consumable_type, orgId, startTime, endTime, good_id)
5607
 	list, total, _ := service.GetStockFlowList(limit, page, consumable_type, orgId, startTime, endTime, good_id)
5608
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
5608
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
5609
+	good, _ := service.GetGoodInformationByGoodId(good_id)
5609
 	this.ServeSuccessJSON(map[string]interface{}{
5610
 	this.ServeSuccessJSON(map[string]interface{}{
5610
 		"list":             list,
5611
 		"list":             list,
5611
 		"total":            total,
5612
 		"total":            total,
5612
 		"manufacturerList": manufacturerList,
5613
 		"manufacturerList": manufacturerList,
5614
+		"good":             good,
5613
 	})
5615
 	})
5614
 }
5616
 }
5615
 
5617
 

+ 51 - 1
controllers/supply_order_api_contorller.go View File

27
 	beego.Router("/api/supply/updatepurchaseorder", &SupplyOrderApiController{}, "Post:UpdatePurchaseOrder")
27
 	beego.Router("/api/supply/updatepurchaseorder", &SupplyOrderApiController{}, "Post:UpdatePurchaseOrder")
28
 	beego.Router("/api/supply/checkpurchaseorder", &SupplyOrderApiController{}, "get:UpdateSupplyWaresing")
28
 	beego.Router("/api/supply/checkpurchaseorder", &SupplyOrderApiController{}, "get:UpdateSupplyWaresing")
29
 	beego.Router("/api/supply/getpurchaseorderdetail", &SupplyOrderApiController{}, "get:GetPurchaseOrderDetail")
29
 	beego.Router("/api/supply/getpurchaseorderdetail", &SupplyOrderApiController{}, "get:GetPurchaseOrderDetail")
30
+	beego.Router("/api/supply/addgoodorder", &SupplyOrderApiController{}, "post:AddGoodOrder")
30
 }
31
 }
31
 
32
 
32
 func (this *SupplyOrderApiController) GetInitOrder() {
33
 func (this *SupplyOrderApiController) GetInitOrder() {
226
 
227
 
227
 				name := items["name"].(string)
228
 				name := items["name"].(string)
228
 
229
 
230
+				if items["supply_unit"] == nil || reflect.TypeOf(items["supply_unit"]).String() != "string" {
231
+					utils.ErrorLog("supply_unit")
232
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
233
+					return
234
+				}
235
+
236
+				supply_unit := items["supply_unit"].(string)
237
+
229
 				order := models.SupplierWarehousingInfoOrder{
238
 				order := models.SupplierWarehousingInfoOrder{
230
 					OrderNumber:             warehousing_order,
239
 					OrderNumber:             warehousing_order,
231
 					IsSource:                is_source,
240
 					IsSource:                is_source,
245
 					SupplyTotal:             supply_total,
254
 					SupplyTotal:             supply_total,
246
 					SupplyManufacturer:      supply_manufacturer,
255
 					SupplyManufacturer:      supply_manufacturer,
247
 					Name:                    name,
256
 					Name:                    name,
257
+					SupplyUnit:              supply_unit,
248
 				}
258
 				}
249
 
259
 
250
 				warehousingInfo = append(warehousingInfo, &order)
260
 				warehousingInfo = append(warehousingInfo, &order)
487
 
497
 
488
 				name := items["name"].(string)
498
 				name := items["name"].(string)
489
 
499
 
500
+				if items["supply_unit"] == nil || reflect.TypeOf(items["supply_unit"]).String() != "string" {
501
+					utils.ErrorLog("supply_unit")
502
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
503
+					return
504
+				}
505
+
506
+				supply_unit := items["supply_unit"].(string)
490
 				if id > 0 {
507
 				if id > 0 {
491
 					order := models.SupplierWarehousingInfoOrder{
508
 					order := models.SupplierWarehousingInfoOrder{
492
 						ID:                      id,
509
 						ID:                      id,
505
 						SupplyTotal:             supply_total,
522
 						SupplyTotal:             supply_total,
506
 						SupplyManufacturer:      supply_manufacturer,
523
 						SupplyManufacturer:      supply_manufacturer,
507
 						Name:                    name,
524
 						Name:                    name,
525
+						SupplyUnit:              supply_unit,
508
 					}
526
 					}
509
 
527
 
510
 					updateWarehousingInfo = append(updateWarehousingInfo, &order)
528
 					updateWarehousingInfo = append(updateWarehousingInfo, &order)
524
 						Status:                  1,
542
 						Status:                  1,
525
 						Mtime:                   0,
543
 						Mtime:                   0,
526
 						WarehousingId:           warehousing_id,
544
 						WarehousingId:           warehousing_id,
527
-						ProjectId:               id,
545
+						ProjectId:               project_id,
528
 						SupplyLicenseNumber:     supply_license_number,
546
 						SupplyLicenseNumber:     supply_license_number,
529
 						SupplyType:              supply_type,
547
 						SupplyType:              supply_type,
530
 						SupplySpecificationName: supply_specification_name,
548
 						SupplySpecificationName: supply_specification_name,
531
 						SupplyTotal:             supply_total,
549
 						SupplyTotal:             supply_total,
532
 						SupplyManufacturer:      supply_manufacturer,
550
 						SupplyManufacturer:      supply_manufacturer,
533
 						Name:                    name,
551
 						Name:                    name,
552
+						SupplyUnit:              supply_unit,
534
 					}
553
 					}
535
 					warehousingInfo = append(warehousingInfo, &order)
554
 					warehousingInfo = append(warehousingInfo, &order)
536
 				}
555
 				}
589
 	orderInfo, err := service.GetSupplyWarehousingOrderInfo(id)
608
 	orderInfo, err := service.GetSupplyWarehousingOrderInfo(id)
590
 	orgId := this.GetAdminUserInfo().CurrentOrgId
609
 	orgId := this.GetAdminUserInfo().CurrentOrgId
591
 	supplyList, _ := service.GetSupplierList(orgId)
610
 	supplyList, _ := service.GetSupplierList(orgId)
611
+	//获取药品库数据
612
+	baseList, _ := service.GetSupplyDrugList(orgId)
613
+
614
+	goodList, _ := service.GetSupplyGoodList(orgId)
592
 	if err == nil {
615
 	if err == nil {
593
 		this.ServeSuccessJSON(map[string]interface{}{
616
 		this.ServeSuccessJSON(map[string]interface{}{
594
 			"info":       info,
617
 			"info":       info,
595
 			"orderInfo":  orderInfo,
618
 			"orderInfo":  orderInfo,
596
 			"supplyList": supplyList,
619
 			"supplyList": supplyList,
620
+			"baseList":   baseList,
621
+			"goodList":   goodList,
597
 		})
622
 		})
598
 	} else {
623
 	} else {
599
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
624
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
600
 	}
625
 	}
601
 }
626
 }
627
+
628
+func (this *SupplyOrderApiController) AddGoodOrder() {
629
+
630
+	supplier_id, _ := this.GetInt64("supplier_id")
631
+	start_time := this.GetString("start")
632
+	timeLayout := "2006-01-02"
633
+	loc, _ := time.LoadLocation("Local")
634
+	var startTime int64
635
+	if len(start_time) > 0 {
636
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
637
+		if err != nil {
638
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
639
+			return
640
+		}
641
+		startTime = theTime.Unix()
642
+	}
643
+	good_number := this.GetString("good_number")
644
+	arrerage, _ := this.GetInt64("arrerage")
645
+	payment, _ := this.GetInt64("payment")
646
+	warehousing_id, _ := this.GetInt64("warehousing_id")
647
+	number := this.GetString("number")
648
+	rate_of_concession, _ := this.GetInt64("rate_of_concession")
649
+	discount_amount, _ := this.GetInt64("discount_amount")
650
+	fmt.Println(supplier_id, startTime, good_number, arrerage, payment, warehousing_id, number, rate_of_concession, discount_amount)
651
+}

+ 2 - 0
models/dialysis.go View File

318
 	Period                         int64   `gorm:"column:period" json:"period" form:"period"`
318
 	Period                         int64   `gorm:"column:period" json:"period" form:"period"`
319
 	EstimatedFoodIntake            string  `gorm:"column:estimated_food_intake" json:"estimated_food_intake" form:"estimated_food_intake"`
319
 	EstimatedFoodIntake            string  `gorm:"column:estimated_food_intake" json:"estimated_food_intake" form:"estimated_food_intake"`
320
 	BloodPressureDuringDialysis    string  `gorm:"column:blood_pressure_during_dialysis" json:"blood_pressure_during_dialysis" form:"blood_pressure_during_dialysis"`
320
 	BloodPressureDuringDialysis    string  `gorm:"column:blood_pressure_during_dialysis" json:"blood_pressure_during_dialysis" form:"blood_pressure_during_dialysis"`
321
+	UreaBefor                      string  `gorm:"column:urea_befor" json:"urea_befor" form:"urea_befor"`
321
 }
322
 }
322
 
323
 
323
 func (PredialysisEvaluation) TableName() string {
324
 func (PredialysisEvaluation) TableName() string {
632
 	Consciousness                   int64   `gorm:"column:consciousness" json:"consciousness" form:"consciousness"`
633
 	Consciousness                   int64   `gorm:"column:consciousness" json:"consciousness" form:"consciousness"`
633
 	Fallrisk                        int64   `gorm:"column:fallrisk" json:"fallrisk" form:"fallrisk"`
634
 	Fallrisk                        int64   `gorm:"column:fallrisk" json:"fallrisk" form:"fallrisk"`
634
 	MachineRun                      string  `gorm:"column:machine_run" json:"machine_run" form:"machine_run"`
635
 	MachineRun                      string  `gorm:"column:machine_run" json:"machine_run" form:"machine_run"`
636
+	AfterUrea                       string  `gorm:"column:after_urea" json:"after_urea" form:"after_urea"`
635
 }
637
 }
636
 
638
 
637
 func (AssessmentAfterDislysis) TableName() string {
639
 func (AssessmentAfterDislysis) TableName() string {

+ 4 - 0
models/supply.models.go View File

16
 	Manufacturer      int64                  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
16
 	Manufacturer      int64                  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
17
 	OrgId             int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`
17
 	OrgId             int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`
18
 	Number            string                 `gorm:"column:number" json:"number" form:"number"`
18
 	Number            string                 `gorm:"column:number" json:"number" form:"number"`
19
+	LastPrice         float64                `gorm:"column:last_price" json:"last_price" form:"last_price"`
19
 	DrugWarehouseInfo []*SpDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_warehouse_info"`
20
 	DrugWarehouseInfo []*SpDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_warehouse_info"`
20
 }
21
 }
21
 
22
 
31
 	Manufacturer      int64              `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
32
 	Manufacturer      int64              `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
32
 	OrgId             int64              `gorm:"column:org_id" json:"org_id" form:"org_id"`
33
 	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
 	GoodName          string             `gorm:"column:good_name" json:"good_name" form:"good_name"`
35
+	PackingUnit       string             `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
36
+	BuyPrice          float64            `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
34
 	GoodWarehouseInfo []*SpWarehouseInfo `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"good_warehouse_info"`
37
 	GoodWarehouseInfo []*SpWarehouseInfo `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"good_warehouse_info"`
35
 }
38
 }
36
 
39
 
108
 	SupplyTotal             string  `gorm:"column:supply_total" json:"supply_total" form:"supply_total"`
111
 	SupplyTotal             string  `gorm:"column:supply_total" json:"supply_total" form:"supply_total"`
109
 	SupplyManufacturer      string  `gorm:"column:supply_manufacturer" json:"supply_manufacturer" form:"supply_manufacturer"`
112
 	SupplyManufacturer      string  `gorm:"column:supply_manufacturer" json:"supply_manufacturer" form:"supply_manufacturer"`
110
 	Name                    string  `gorm:"column:name" json:"name" form:"name"`
113
 	Name                    string  `gorm:"column:name" json:"name" form:"name"`
114
+	SupplyUnit              string  `gorm:"column:supply_unit" json:"supply_unit" form:"supply_unit"`
111
 }
115
 }
112
 
116
 
113
 func (SupplierWarehousingInfoOrder) TableName() string {
117
 func (SupplierWarehousingInfoOrder) TableName() string {

+ 1 - 1
service/stock_service.go View File

3852
 		db = db.Where("x.org_id = ?", orgid)
3852
 		db = db.Where("x.org_id = ?", orgid)
3853
 	}
3853
 	}
3854
 
3854
 
3855
-	err = db.Select("x.id,x.warehouse_out_id,x.good_id,sum(x.count) as count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.warehouse_out_order_number,x.type,x.dealer,t.manufacturer,t.social_security_directory_code,x.is_sys,x.sys_record_time,x.number,x.remark,x.license_number,t.good_name,t.good_type_id,t.specification_name,t.min_number,t.packing_unit,t.min_unit").Joins("left join xt_good_information as t on t.id=x.good_id").Group("x.warehouse_out_id,x.good_id").Order("x.ctime desc").Scan(&out).Error
3855
+	err = db.Select("x.id,x.warehouse_out_id,x.good_id,sum(x.count) as count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.warehouse_out_order_number,x.type,x.dealer,t.manufacturer,t.social_security_directory_code,x.is_sys,x.sys_record_time,x.number,x.remark,x.license_number,t.good_name,t.good_type_id,t.specification_name,t.min_number,t.packing_unit,t.min_unit,t.packing_price").Joins("left join xt_good_information as t on t.id=x.good_id").Group("x.warehouse_out_id,x.good_id").Order("x.ctime desc").Scan(&out).Error
3856
 	return out, err
3856
 	return out, err
3857
 }
3857
 }
3858
 
3858
 

+ 1 - 1
service/supply_service.go View File

99
 
99
 
100
 func ModifySupplyWarehouseOrder(order *models.SupplierWarehousingInfoOrder) error {
100
 func ModifySupplyWarehouseOrder(order *models.SupplierWarehousingInfoOrder) error {
101
 
101
 
102
-	err := XTWriteDB().Model(&models.SupplierWarehousingInfoOrder{}).Where("id = ? and status = 1", order.ID).Updates(map[string]interface{}{}).Updates(map[string]interface{}{"is_source": order.IsSource, "count": order.Count, "price": order.Price, "amount": order.Amount, "remark": order.Remark, "project_id": order.ProjectId, "supply_license_number": order.SupplyLicenseNumber, "supply_type": order.SupplyType, "supply_specification_name": order.SupplySpecificationName, "supply_total": order.SupplyTotal, "supply_manufacturer": order.SupplyManufacturer, "name": order.Name}).Error
102
+	err := XTWriteDB().Model(&models.SupplierWarehousingInfoOrder{}).Where("id = ? and status = 1", order.ID).Updates(map[string]interface{}{}).Updates(map[string]interface{}{"is_source": order.IsSource, "count": order.Count, "price": order.Price, "amount": order.Amount, "remark": order.Remark, "project_id": order.ProjectId, "supply_license_number": order.SupplyLicenseNumber, "supply_type": order.SupplyType, "supply_specification_name": order.SupplySpecificationName, "supply_total": order.SupplyTotal, "supply_manufacturer": order.SupplyManufacturer, "name": order.Name, "supply_unit": order.SupplyUnit}).Error
103
 	return err
103
 	return err
104
 }
104
 }
105
 
105