Browse Source

11月8日库存管理

XMLWAN 3 years ago
parent
commit
aee12d661d

+ 3 - 0
controllers/dialysis_api_controller.go View File

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

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

@@ -1055,6 +1055,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1055 1055
 	consciousness, _ := c.GetInt64("consciousness")
1056 1056
 	fallrisk, _ := c.GetInt64("fallrisk")
1057 1057
 	machine_run := c.GetString("machine_run")
1058
+	after_urea := c.GetString("after_urea")
1058 1059
 	if id <= 0 {
1059 1060
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1060 1061
 		return
@@ -1156,6 +1157,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1156 1157
 		Consciousness:                consciousness,
1157 1158
 		Fallrisk:                     fallrisk,
1158 1159
 		MachineRun:                   machine_run,
1160
+		AfterUrea:                    after_urea,
1159 1161
 	}
1160 1162
 
1161 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,6 +2611,11 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2611 2611
 		pre_dialysis_drugs := dataBody["pre_dialysis_drugs"].(string)
2612 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 2619
 	return
2615 2620
 }
2616 2621
 

+ 2 - 0
controllers/stock_in_api_controller.go View File

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

+ 51 - 1
controllers/supply_order_api_contorller.go View File

@@ -27,6 +27,7 @@ func SupplyOrderApiRegistRouters() {
27 27
 	beego.Router("/api/supply/updatepurchaseorder", &SupplyOrderApiController{}, "Post:UpdatePurchaseOrder")
28 28
 	beego.Router("/api/supply/checkpurchaseorder", &SupplyOrderApiController{}, "get:UpdateSupplyWaresing")
29 29
 	beego.Router("/api/supply/getpurchaseorderdetail", &SupplyOrderApiController{}, "get:GetPurchaseOrderDetail")
30
+	beego.Router("/api/supply/addgoodorder", &SupplyOrderApiController{}, "post:AddGoodOrder")
30 31
 }
31 32
 
32 33
 func (this *SupplyOrderApiController) GetInitOrder() {
@@ -226,6 +227,14 @@ func (this *SupplyOrderApiController) SavePurchaseOrder() {
226 227
 
227 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 238
 				order := models.SupplierWarehousingInfoOrder{
230 239
 					OrderNumber:             warehousing_order,
231 240
 					IsSource:                is_source,
@@ -245,6 +254,7 @@ func (this *SupplyOrderApiController) SavePurchaseOrder() {
245 254
 					SupplyTotal:             supply_total,
246 255
 					SupplyManufacturer:      supply_manufacturer,
247 256
 					Name:                    name,
257
+					SupplyUnit:              supply_unit,
248 258
 				}
249 259
 
250 260
 				warehousingInfo = append(warehousingInfo, &order)
@@ -487,6 +497,13 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
487 497
 
488 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 507
 				if id > 0 {
491 508
 					order := models.SupplierWarehousingInfoOrder{
492 509
 						ID:                      id,
@@ -505,6 +522,7 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
505 522
 						SupplyTotal:             supply_total,
506 523
 						SupplyManufacturer:      supply_manufacturer,
507 524
 						Name:                    name,
525
+						SupplyUnit:              supply_unit,
508 526
 					}
509 527
 
510 528
 					updateWarehousingInfo = append(updateWarehousingInfo, &order)
@@ -524,13 +542,14 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
524 542
 						Status:                  1,
525 543
 						Mtime:                   0,
526 544
 						WarehousingId:           warehousing_id,
527
-						ProjectId:               id,
545
+						ProjectId:               project_id,
528 546
 						SupplyLicenseNumber:     supply_license_number,
529 547
 						SupplyType:              supply_type,
530 548
 						SupplySpecificationName: supply_specification_name,
531 549
 						SupplyTotal:             supply_total,
532 550
 						SupplyManufacturer:      supply_manufacturer,
533 551
 						Name:                    name,
552
+						SupplyUnit:              supply_unit,
534 553
 					}
535 554
 					warehousingInfo = append(warehousingInfo, &order)
536 555
 				}
@@ -589,13 +608,44 @@ func (this *SupplyOrderApiController) GetPurchaseOrderDetail() {
589 608
 	orderInfo, err := service.GetSupplyWarehousingOrderInfo(id)
590 609
 	orgId := this.GetAdminUserInfo().CurrentOrgId
591 610
 	supplyList, _ := service.GetSupplierList(orgId)
611
+	//获取药品库数据
612
+	baseList, _ := service.GetSupplyDrugList(orgId)
613
+
614
+	goodList, _ := service.GetSupplyGoodList(orgId)
592 615
 	if err == nil {
593 616
 		this.ServeSuccessJSON(map[string]interface{}{
594 617
 			"info":       info,
595 618
 			"orderInfo":  orderInfo,
596 619
 			"supplyList": supplyList,
620
+			"baseList":   baseList,
621
+			"goodList":   goodList,
597 622
 		})
598 623
 	} else {
599 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,6 +318,7 @@ type PredialysisEvaluation struct {
318 318
 	Period                         int64   `gorm:"column:period" json:"period" form:"period"`
319 319
 	EstimatedFoodIntake            string  `gorm:"column:estimated_food_intake" json:"estimated_food_intake" form:"estimated_food_intake"`
320 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 324
 func (PredialysisEvaluation) TableName() string {
@@ -632,6 +633,7 @@ type AssessmentAfterDislysis struct {
632 633
 	Consciousness                   int64   `gorm:"column:consciousness" json:"consciousness" form:"consciousness"`
633 634
 	Fallrisk                        int64   `gorm:"column:fallrisk" json:"fallrisk" form:"fallrisk"`
634 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 639
 func (AssessmentAfterDislysis) TableName() string {

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

@@ -16,6 +16,7 @@ type SpBaseDrug struct {
16 16
 	Manufacturer      int64                  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
17 17
 	OrgId             int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`
18 18
 	Number            string                 `gorm:"column:number" json:"number" form:"number"`
19
+	LastPrice         float64                `gorm:"column:last_price" json:"last_price" form:"last_price"`
19 20
 	DrugWarehouseInfo []*SpDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_warehouse_info"`
20 21
 }
21 22
 
@@ -31,6 +32,8 @@ type SpGoodInformation struct {
31 32
 	Manufacturer      int64              `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
32 33
 	OrgId             int64              `gorm:"column:org_id" json:"org_id" form:"org_id"`
33 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 37
 	GoodWarehouseInfo []*SpWarehouseInfo `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"good_warehouse_info"`
35 38
 }
36 39
 
@@ -108,6 +111,7 @@ type SupplierWarehousingInfoOrder struct {
108 111
 	SupplyTotal             string  `gorm:"column:supply_total" json:"supply_total" form:"supply_total"`
109 112
 	SupplyManufacturer      string  `gorm:"column:supply_manufacturer" json:"supply_manufacturer" form:"supply_manufacturer"`
110 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 117
 func (SupplierWarehousingInfoOrder) TableName() string {

+ 1 - 1
service/stock_service.go View File

@@ -3852,7 +3852,7 @@ func GetOrderDetialByOrderIdOne(id []string, orgid int64) (out []*models.Warehou
3852 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 3856
 	return out, err
3857 3857
 }
3858 3858
 

+ 1 - 1
service/supply_service.go View File

@@ -99,7 +99,7 @@ func ModefySupplyWarehouseInfo(id int64, info models.SupplierWarehouseInfo) erro
99 99
 
100 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 103
 	return err
104 104
 }
105 105