瀏覽代碼

11月8日库存管理

XMLWAN 3 年之前
父節點
當前提交
d4ced3fa0f

+ 4 - 2
controllers/dialysis_api_controller.go 查看文件

@@ -1267,6 +1267,7 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
1267 1267
 	assessment.Fallrisk = data.Fallrisk
1268 1268
 	assessment.MachineRun = data.MachineRun
1269 1269
 	assessment.AfterUrea = data.AfterUrea
1270
+	assessment.PipCoagulation = data.PipCoagulation
1270 1271
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1271 1272
 
1272 1273
 	if assessment.ID > 0 {
@@ -1423,6 +1424,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1423 1424
 	estimated_food_intake := c.GetString("estimated_food_intake")
1424 1425
 	blood_pressure_during_dialysis := c.GetString("blood_pressure_during_dialysis")
1425 1426
 	urea_befor := c.GetString("urea_befor")
1427
+	suction := c.GetString("suction")
1426 1428
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1427 1429
 		DialysisCount:                  dialysis_count,
1428 1430
 		EmergencyTreatment:             emergency_treatment,
@@ -1490,6 +1492,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1490 1492
 		EstimatedFoodIntake:            estimated_food_intake,
1491 1493
 		BloodPressureDuringDialysis:    blood_pressure_during_dialysis,
1492 1494
 		UreaBefor:                      urea_befor,
1495
+		Suction:                        suction,
1493 1496
 	}
1494 1497
 
1495 1498
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -1602,8 +1605,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1602 1605
 				mode_id = 0
1603 1606
 			}
1604 1607
 		}
1605
-		fmt.Println("dialysisPrescribe------------------------------------", dialysisPrescribe)
1606
-		fmt.Println("dialysisSolution------------------------------------", dialysisSolution)
1608
+
1607 1609
 		// 插入透析处方
1608 1610
 		if dialysisPrescribe == nil && dialysisSolution != nil {
1609 1611
 			var newprescribe models.DialysisPrescription

+ 3 - 0
controllers/dialysis_record_api_controller.go 查看文件

@@ -534,6 +534,7 @@ type EditMonitorParamObject struct {
534 534
 	BloodThickness              float64 `gorm:"column:blood_thickness" json:"blood_thickness" form:"blood_thickness"`
535 535
 	BloodMonitor                float64 `gorm:"column:blood_monitor" json:"blood_monitor" form:"blood_monitor"`
536 536
 	HeparinAmount               float64 `gorm:"column:heparin_amount" json:"heparin_amount" form:"heparin_amount"`
537
+	Dehydration                 float64 `gorm:"column:dehydration" json:"dehydration" form:"dehydration"`
537 538
 }
538 539
 
539 540
 // /api/dislysis/monitor/edit [post]
@@ -654,6 +655,7 @@ func (this *DialysisRecordAPIController) EditMonitor() {
654 655
 			BloodThickness:              monitorParam.BloodThickness,
655 656
 			BloodMonitor:                monitorParam.BloodMonitor,
656 657
 			HeparinAmount:               monitorParam.HeparinAmount,
658
+			Dehydration:                 monitorParam.Dehydration,
657 659
 		}
658 660
 		createErr := service.CreateMonitor(&monitor)
659 661
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":monitor_records"
@@ -737,6 +739,7 @@ func (this *DialysisRecordAPIController) EditMonitor() {
737 739
 		monitor.BloodThickness = monitorParam.BloodThickness
738 740
 		monitor.BloodMonitor = monitorParam.BloodMonitor
739 741
 		monitor.HeparinAmount = monitorParam.HeparinAmount
742
+		monitor.Dehydration = monitorParam.Dehydration
740 743
 		updateErr := service.UpdateMonitor(monitor)
741 744
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(scheduleDate, 10) + ":monitor_records"
742 745
 		redis := service.RedisClient()

+ 2 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

@@ -1068,6 +1068,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1068 1068
 	fallrisk, _ := c.GetInt64("fallrisk")
1069 1069
 	machine_run := c.GetString("machine_run")
1070 1070
 	after_urea := c.GetString("after_urea")
1071
+	pip_coagulation := c.GetString("pip_coagulation")
1071 1072
 	if id <= 0 {
1072 1073
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1073 1074
 		return
@@ -1170,6 +1171,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1170 1171
 		Fallrisk:                     fallrisk,
1171 1172
 		MachineRun:                   machine_run,
1172 1173
 		AfterUrea:                    after_urea,
1174
+		PipCoagulation:               pip_coagulation,
1173 1175
 	}
1174 1176
 
1175 1177
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)

+ 7 - 0
controllers/mobile_api_controllers/dialysis_api_controller_extend.go 查看文件

@@ -103,6 +103,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
103 103
 	urea_monitoring, _ := this.GetFloat("urea_monitoring")
104 104
 	blood_thickness, _ := this.GetFloat("blood_thickness")
105 105
 	blood_monitor, _ := this.GetFloat("blood_monitor")
106
+	dehydration, _ := this.GetFloat("dehydration")
106 107
 	adminInfo := this.GetMobileAdminUserInfo()
107 108
 	patient, getPatientErr := service.MobileGetPatientById(adminInfo.Org.Id, patientID)
108 109
 	if getPatientErr != nil {
@@ -167,6 +168,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
167 168
 		BloodThickness:              blood_thickness,
168 169
 		BloodMonitor:                blood_monitor,
169 170
 		HeparinAmount:               heparin_amount,
171
+		Dehydration:                 dehydration,
170 172
 	}
171 173
 
172 174
 	err := service.CreateMonitor(&record)
@@ -277,6 +279,9 @@ func (this *DialysisAPIController) EditMonitorRecord() {
277 279
 	urea_monitoring, _ := this.GetFloat("urea_monitoring")
278 280
 	blood_thickness, _ := this.GetFloat("blood_thickness")
279 281
 	blood_monitor, _ := this.GetFloat("blood_monitor")
282
+	heparin_amount, _ := this.GetFloat("heparin_amount")
283
+	dehydration, _ := this.GetFloat("dehydration")
284
+	fmt.Println("id232323233232233223232332233223", id)
280 285
 	monitor, err := service.GetMonitor(adminInfo.Org.Id, patientID, id)
281 286
 	if err != nil {
282 287
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -333,6 +338,8 @@ func (this *DialysisAPIController) EditMonitorRecord() {
333 338
 	monitor.UreaMonitoring = urea_monitoring
334 339
 	monitor.BloodThickness = blood_thickness
335 340
 	monitor.BloodTemperature = blood_temperature
341
+	monitor.HeparinAmount = heparin_amount
342
+	monitor.Dehydration = dehydration
336 343
 	err = service.UpdateMonitor(monitor)
337 344
 	key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(date, 10) + ":monitor_records"
338 345
 	redis := service.RedisClient()

+ 6 - 0
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

@@ -2629,6 +2629,12 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2629 2629
 		urea_befor := dataBody["urea_befor"].(string)
2630 2630
 		evaluation.UreaBefor = urea_befor
2631 2631
 	}
2632
+
2633
+	if dataBody["suction"] != nil && reflect.TypeOf(dataBody["suction"]).String() == "string" {
2634
+		suction := dataBody["suction"].(string)
2635
+
2636
+		evaluation.Suction = suction
2637
+	}
2632 2638
 	return
2633 2639
 }
2634 2640
 

+ 9 - 3
controllers/supply_order_api_contorller.go 查看文件

@@ -1218,8 +1218,11 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
1218 1218
 			}
1219 1219
 
1220 1220
 		}
1221
+		//查询
1222
+		orderInfo, _ := service.GetSupplyWarehousingOrderInfo(warehousing_id)
1221 1223
 		this.ServeSuccessJSON(map[string]interface{}{
1222 1224
 			"warehousingInfo": warehousingInfo,
1225
+			"orderInfo":       orderInfo,
1223 1226
 		})
1224 1227
 
1225 1228
 	}
@@ -2044,9 +2047,11 @@ func (this *SupplyOrderApiController) UpdateGoodOrder() {
2044 2047
 	//		service.ModfySupplyWarehouseOut(item.WarehousingId, orgId)
2045 2048
 	//	}
2046 2049
 	//}
2050
+	list, _ := service.GetSupplyWarehouseOutById(warehose_out_id, orgId)
2047 2051
 	if err == nil {
2048 2052
 		this.ServeSuccessJSON(map[string]interface{}{
2049
-			"out": out,
2053
+			"out":  out,
2054
+			"list": list,
2050 2055
 		})
2051 2056
 	} else {
2052 2057
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -3451,7 +3456,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
3451 3456
 			number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
3452 3457
 			number = number + total
3453 3458
 			warehousing_out_order = "CKD" + strconv.FormatInt(number, 10)
3454
-			operation_time := time.Now().Unix()
3459
+			//operation_time := time.Now().Unix()
3455 3460
 			creater := this.GetAdminUserInfo().AdminUser.Id
3456 3461
 			recordDateStr := time.Now().Format("2006-01-02")
3457 3462
 			recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
@@ -3471,11 +3476,12 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
3471 3476
 				IsSys:                   0,
3472 3477
 			}
3473 3478
 			//查询是否生成出库单
3474
-			_, errcodes := service.FindStockOutByIsSys(orgId, 0, operation_time)
3479
+			_, errcodes := service.FindStockOutByIsSys(orgId, 0, record_date)
3475 3480
 			if errcodes == gorm.ErrRecordNotFound {
3476 3481
 				service.AddSigleWarehouseOut(&warehouseOut)
3477 3482
 			}
3478 3483
 			outWarehouse, _ := service.GetlastWarehouseOutById(orgId, record_date)
3484
+			fmt.Println("232332322332232323", outWarehouse)
3479 3485
 			goodObj, _ := service.GetGoodInformationByGoodId(item.ProjectId)
3480 3486
 			info := &models.WarehouseOutInfo{
3481 3487
 				WarehouseOutOrderNumber: outWarehouse.WarehouseOutOrderNumber,

+ 3 - 0
models/dialysis.go 查看文件

@@ -319,6 +319,7 @@ type PredialysisEvaluation struct {
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 321
 	UreaBefor                      string  `gorm:"column:urea_befor" json:"urea_befor" form:"urea_befor"`
322
+	Suction                        string  `gorm:"column:suction" json:"suction" form:"suction"`
322 323
 }
323 324
 
324 325
 func (PredialysisEvaluation) TableName() string {
@@ -634,6 +635,7 @@ type AssessmentAfterDislysis struct {
634 635
 	Fallrisk                        int64   `gorm:"column:fallrisk" json:"fallrisk" form:"fallrisk"`
635 636
 	MachineRun                      string  `gorm:"column:machine_run" json:"machine_run" form:"machine_run"`
636 637
 	AfterUrea                       string  `gorm:"column:after_urea" json:"after_urea" form:"after_urea"`
638
+	PipCoagulation                  string  `gorm:"column:pip_coagulation" json:"pip_coagulation" form:"pip_coagulation"`
637 639
 }
638 640
 
639 641
 func (AssessmentAfterDislysis) TableName() string {
@@ -744,6 +746,7 @@ type MonitoringRecord struct {
744 746
 	BloodThickness              float64 `gorm:"column:blood_thickness" json:"blood_thickness" form:"blood_thickness"`
745 747
 	BloodMonitor                float64 `gorm:"column:blood_monitor" json:"blood_monitor" form:"blood_monitor"`
746 748
 	HeparinAmount               float64 `gorm:"column:heparin_amount" json:"heparin_amount" form:"heparin_amount"`
749
+	Dehydration                 float64 `gorm:"column:dehydration" json:"dehydration" form:"dehydration"`
747 750
 }
748 751
 
749 752
 func (MonitoringRecord) TableName() string {

+ 5 - 5
service/supply_service.go 查看文件

@@ -921,7 +921,7 @@ func DeleteGoodOrderById(id int64) error {
921 921
 func GetlastWarehouseOutById(user_org_id int64, record_date int64) (models.WarehouseOut, error) {
922 922
 
923 923
 	out := models.WarehouseOut{}
924
-	err := XTReadDB().Where("org_id = ? and warehouse_out_time = ? and status = 1", user_org_id, record_date).Find(&out).Error
924
+	err := XTReadDB().Where("org_id = ? and warehouse_out_time = ? and is_sys = 0 and status = 1", user_org_id, record_date).Find(&out).Error
925 925
 	return out, err
926 926
 }
927 927
 
@@ -929,7 +929,7 @@ func GetDrugWarehouseOutById(orgid int64, record_date int64) (*models.DrugWareho
929 929
 
930 930
 	out := models.DrugWarehouseOut{}
931 931
 	var err error
932
-	err = XTReadDB().Where("org_id = ? and warehouse_out_time = ? and status =1", orgid, record_date).Find(&out).Error
932
+	err = XTReadDB().Where("org_id = ? and warehouse_out_time = ? and status =1 and is_sys = 0", orgid, record_date).Find(&out).Error
933 933
 	if err == gorm.ErrRecordNotFound {
934 934
 		return nil, err
935 935
 	}
@@ -942,7 +942,7 @@ func GetDrugWarehouseOutById(orgid int64, record_date int64) (*models.DrugWareho
942 942
 func GetLastDrugWarehouseById(orgid int64, record_date int64) (models.DrugWarehouseOut, error) {
943 943
 
944 944
 	out := models.DrugWarehouseOut{}
945
-	err := XTReadDB().Where("org_id = ? and warehouse_out_time =? and status = 1", orgid, record_date).Find(&out).Error
945
+	err := XTReadDB().Where("org_id = ? and warehouse_out_time =? and status = 1 and is_sys =0 ", orgid, record_date).Last(&out).Error
946 946
 	return out, err
947 947
 }
948 948
 
@@ -1132,7 +1132,7 @@ func GetReturnOrderById(id int64) (models.SpSupplierWarehouseCancel, error) {
1132 1132
 
1133 1133
 func GetWarehouseOutByDate(operation_time int64, orgid int64) (models.WarehouseOut, error) {
1134 1134
 	out := models.WarehouseOut{}
1135
-	err := XTReadDB().Where("warehouse_out_time = ? and org_id = ? and status = 1", operation_time, orgid).Find(&out).Error
1135
+	err := XTReadDB().Where("warehouse_out_time = ? and org_id = ? and status = 1 and is_sys= 0", operation_time, orgid).Find(&out).Error
1136 1136
 	return out, err
1137 1137
 }
1138 1138
 
@@ -1151,7 +1151,7 @@ func DeleteWarehouseOutById(id int64) error {
1151 1151
 func GetDrugWarehouseByDate(operation_time int64, orgid int64) (models.DrugWarehouseOut, error) {
1152 1152
 
1153 1153
 	out := models.DrugWarehouseOut{}
1154
-	err := XTReadDB().Where("warehouse_out_time = ? and org_id = ? and status =1 ", operation_time, orgid).Find(&out).Error
1154
+	err := XTReadDB().Where("warehouse_out_time = ? and org_id = ? and status =1 and is_sys =0 ", operation_time, orgid).Find(&out).Error
1155 1155
 	return out, err
1156 1156
 }
1157 1157
 

+ 4 - 4
service/warhouse_service.go 查看文件

@@ -2808,7 +2808,7 @@ func ConsumablesDeliveryNight(orgID int64, record_time int64, goods *models.Ware
2808 2808
 
2809 2809
 		warehouseOutInfo := &models.WarehouseOutInfo{
2810 2810
 			WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
2811
-			WarehouseOutId:          warehouseOut.ID,
2811
+			WarehouseOutId:          goods.WarehouseOutId,
2812 2812
 			WarehouseInfotId:        warehouse.ID,
2813 2813
 			Status:                  1,
2814 2814
 			Ctime:                   time.Now().Unix(),
@@ -2847,7 +2847,7 @@ func ConsumablesDeliveryNight(orgID int64, record_time int64, goods *models.Ware
2847 2847
 			ConsumableType:          2,
2848 2848
 			IsSys:                   goods.IsSys,
2849 2849
 			WarehousingOrder:        "",
2850
-			WarehouseOutId:          warehouseOut.ID,
2850
+			WarehouseOutId:          goods.WarehouseOutId,
2851 2851
 			WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
2852 2852
 			IsEdit:                  1,
2853 2853
 			CancelStockId:           0,
@@ -2893,7 +2893,7 @@ func ConsumablesDeliveryNight(orgID int64, record_time int64, goods *models.Ware
2893 2893
 		// 当该批次的库存数量小于出库数量的话,则先把该批次出库完后,再进行递归出库
2894 2894
 		warehouseOutInfo := &models.WarehouseOutInfo{
2895 2895
 			WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
2896
-			WarehouseOutId:          warehouseOut.ID,
2896
+			WarehouseOutId:          goods.WarehouseOutId,
2897 2897
 			WarehouseInfotId:        warehouse.ID,
2898 2898
 			Status:                  1,
2899 2899
 			Ctime:                   time.Now().Unix(),
@@ -2941,7 +2941,7 @@ func ConsumablesDeliveryNight(orgID int64, record_time int64, goods *models.Ware
2941 2941
 			ConsumableType:          2,
2942 2942
 			IsSys:                   0,
2943 2943
 			WarehousingOrder:        "",
2944
-			WarehouseOutId:          warehouseOut.ID,
2944
+			WarehouseOutId:          goods.WarehouseOutId,
2945 2945
 			WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
2946 2946
 			IsEdit:                  1,
2947 2947
 			CancelStockId:           0,