Browse Source

库存调拨修改

28169 2 years ago
parent
commit
cf2e8a1ccc

+ 2 - 3
controllers/dialysis_api_controller.go View File

3120
 
3120
 
3121
 }
3121
 }
3122
 
3122
 
3123
-//
3124
 func (c *DialysisApiController) GetLongAdvice() {
3123
 func (c *DialysisApiController) GetLongAdvice() {
3125
 	patient_id, _ := c.GetInt64("patient_id")
3124
 	patient_id, _ := c.GetInt64("patient_id")
3126
 	adminUserInfo := c.GetAdminUserInfo()
3125
 	adminUserInfo := c.GetAdminUserInfo()
3862
 			}
3861
 			}
3863
 
3862
 
3864
 			//长沙南雅
3863
 			//长沙南雅
3865
-			if adminInfo.CurrentOrgId == 10395 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10340 || adminInfo.CurrentOrgId == 10432 || adminInfo.CurrentOrgId == 10441 || adminInfo.CurrentOrgId == 10445 {
3864
+			if adminInfo.CurrentOrgId == 10395 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10340 || adminInfo.CurrentOrgId == 10432 || adminInfo.CurrentOrgId == 10441 || adminInfo.CurrentOrgId == 10445 || adminInfo.CurrentOrgId == 9829 {
3866
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3865
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3867
 
3866
 
3868
 				record.UltrafiltrationRate = ultrafiltration_rate
3867
 				record.UltrafiltrationRate = ultrafiltration_rate
4349
 	}
4348
 	}
4350
 }
4349
 }
4351
 
4350
 
4352
-//新接口
4351
+// 新接口
4353
 func (this *DialysisApiController) GetPatientDialysisSolutionGroupList() {
4352
 func (this *DialysisApiController) GetPatientDialysisSolutionGroupList() {
4354
 
4353
 
4355
 	keyword := this.GetString("keywords")
4354
 	keyword := this.GetString("keywords")

+ 13 - 1
controllers/dialysis_record_api_controller.go View File

1181
 				record.BreathingRate = "20"
1181
 				record.BreathingRate = "20"
1182
 			}
1182
 			}
1183
 
1183
 
1184
+			//针对蓬安济民
1185
+			if adminUserInfo.CurrentOrgId == 9829 {
1186
+				record.Temperature = 36.5
1187
+				record.PulseFrequency = 80
1188
+			}
1189
+
1184
 			//针对兰溪人民医院的需求
1190
 			//针对兰溪人民医院的需求
1185
 			if adminUserInfo.CurrentOrgId == 10432 {
1191
 			if adminUserInfo.CurrentOrgId == 10432 {
1186
 				befor, _ := service.GetAssessmentBefor(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1192
 				befor, _ := service.GetAssessmentBefor(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1375
 		if adminUserInfo.CurrentOrgId == 10447 || adminUserInfo.CurrentOrgId == 9675 {
1381
 		if adminUserInfo.CurrentOrgId == 10447 || adminUserInfo.CurrentOrgId == 9675 {
1376
 			tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
1382
 			tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
1377
 		}
1383
 		}
1384
+
1385
+		//针对蓬安
1386
+		if adminUserInfo.CurrentOrgId == 9829 {
1387
+			tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
1388
+			tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
1389
+		}
1378
 	}
1390
 	}
1379
 
1391
 
1380
 	if adminUserInfo.CurrentOrgId == 9583 {
1392
 	if adminUserInfo.CurrentOrgId == 9583 {
1458
 
1470
 
1459
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
1471
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
1460
 
1472
 
1461
-	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10340 || adminUserInfo.CurrentOrgId == 10414 || adminUserInfo.CurrentOrgId == 10432 || adminUserInfo.CurrentOrgId == 10445 {
1473
+	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10340 || adminUserInfo.CurrentOrgId == 10414 || adminUserInfo.CurrentOrgId == 10432 || adminUserInfo.CurrentOrgId == 10445 || adminUserInfo.CurrentOrgId == 9829 {
1462
 
1474
 
1463
 		evaluation, _ := service.MobileGetPredialysisEvaluationTwo(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1475
 		evaluation, _ := service.MobileGetPredialysisEvaluationTwo(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1464
 		if evaluation.SystolicBloodPressure == 0 {
1476
 		if evaluation.SystolicBloodPressure == 0 {

+ 22 - 9
controllers/mobile_api_controllers/dialysis_api_controller.go View File

1898
 
1898
 
1899
 	}
1899
 	}
1900
 
1900
 
1901
-	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 {
1901
+	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 {
1902
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
1902
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
1903
 		if evaluation.SystolicBloodPressure == 0 {
1903
 		if evaluation.SystolicBloodPressure == 0 {
1904
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
1904
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
1995
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
1995
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
1996
 	}
1996
 	}
1997
 
1997
 
1998
+	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 9829 {
1999
+		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
2000
+		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
2001
+	}
2002
+
1998
 	if lastAssessmentAfterDislysis != nil {
2003
 	if lastAssessmentAfterDislysis != nil {
1999
 		tempassessmentAfterDislysis.BloodPressureType = lastAssessmentAfterDislysis.BloodPressureType
2004
 		tempassessmentAfterDislysis.BloodPressureType = lastAssessmentAfterDislysis.BloodPressureType
2000
 
2005
 
2548
 			record.DiastolicBloodPressure = befor.DiastolicBloodPressure
2553
 			record.DiastolicBloodPressure = befor.DiastolicBloodPressure
2549
 			record.BreathingRate = befor.BreathingRate
2554
 			record.BreathingRate = befor.BreathingRate
2550
 		}
2555
 		}
2556
+
2557
+		if adminUserInfo.Org.Id == 9829 {
2558
+			record.PulseFrequency = 80
2559
+			record.Temperature = 36.5
2560
+		}
2551
 		err := service.CreateMonitor(&record)
2561
 		err := service.CreateMonitor(&record)
2552
 
2562
 
2553
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":monitor_records"
2563
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":monitor_records"
3164
 				record.UltrafiltrationRate = ultrafiltration_rate
3174
 				record.UltrafiltrationRate = ultrafiltration_rate
3165
 			}
3175
 			}
3166
 
3176
 
3167
-			if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10340 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 {
3177
+			if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10340 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 || adminInfo.Org.Id == 9829 {
3168
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3178
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3169
 				record.UltrafiltrationRate = ultrafiltration_rate
3179
 				record.UltrafiltrationRate = ultrafiltration_rate
3170
 			}
3180
 			}
3402
 		ScheduleRemark:         schedule_remark,
3412
 		ScheduleRemark:         schedule_remark,
3403
 	}
3413
 	}
3404
 
3414
 
3415
+	//修改床位号需要重新消毒
3405
 	if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10445 {
3416
 	if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10445 {
3406
-
3407
-		if tempDialysisRecord.BedID != bedID {
3408
-			service.UpdateDeviceInformation(tempDialysisRecord.PatientId, tempDialysisRecord.DialysisDate)
3409
-		}
3417
+		service.UpdateDeviceInformation(tempDialysisRecord.PatientId, tempDialysisRecord.DialysisDate)
3410
 	}
3418
 	}
3411
 
3419
 
3412
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)
3420
 	updateErr := service.ModifyStartDialysisOrder(dialysisRecord)
4790
 				for _, item := range consumables {
4798
 				for _, item := range consumables {
4791
 					//出库
4799
 					//出库
4792
 					err := service.ConsumablesGoodDelivery(item.UserOrgId, patient_id, record_time, item, &warehouseOut, item.Count)
4800
 					err := service.ConsumablesGoodDelivery(item.UserOrgId, patient_id, record_time, item, &warehouseOut, item.Count)
4801
+
4802
+					//err := service.ConsumableMobileDelivery(item.UserOrgId, patient_id, record_time, item, &warehouseOut, adminInfo.AdminUser.Id, item.Count)
4803
+					//fmt.Println("item----------------------------------count", item.Count)
4804
+
4793
 					if err == nil {
4805
 					if err == nil {
4794
 						goodErrcode := models.XtGoodErrcode{
4806
 						goodErrcode := models.XtGoodErrcode{
4795
 							UserOrgId:      adminInfo.Org.Id,
4807
 							UserOrgId:      adminInfo.Org.Id,
4940
 			for _, item := range consumables {
4952
 			for _, item := range consumables {
4941
 				//出库
4953
 				//出库
4942
 				err := service.ConsumablesGoodDelivery(item.UserOrgId, patient_id, record_time, item, &out, item.Count)
4954
 				err := service.ConsumablesGoodDelivery(item.UserOrgId, patient_id, record_time, item, &out, item.Count)
4955
+				//err := service.ConsumableMobileDelivery(item.UserOrgId, patient_id, record_time, item, &out, adminInfo.AdminUser.Id, item.Count)
4956
+				//fmt.Println("item----------------------------------count", item.Count)
4943
 				if err != nil {
4957
 				if err != nil {
4944
 					goodErrcode := models.XtGoodErrcode{
4958
 					goodErrcode := models.XtGoodErrcode{
4945
 						UserOrgId:      adminInfo.Org.Id,
4959
 						UserOrgId:      adminInfo.Org.Id,
5213
 
5227
 
5214
 				fmt.Println("退库长度", len(cancelbefor))
5228
 				fmt.Println("退库长度", len(cancelbefor))
5215
 				fmt.Println("出库长度", len(outbefor))
5229
 				fmt.Println("出库长度", len(outbefor))
5230
+
5216
 				//退库
5231
 				//退库
5217
 				for _, item := range cancelbefor {
5232
 				for _, item := range cancelbefor {
5218
 					warehouseOut, _ := service.FindStockOutByIsSys(adminInfo.Org.Id, 1, record_time)
5233
 					warehouseOut, _ := service.FindStockOutByIsSys(adminInfo.Org.Id, 1, record_time)
5258
 					warehouseOutInfo.LicenseNumber = stockInInfo.LicenseNumber
5273
 					warehouseOutInfo.LicenseNumber = stockInInfo.LicenseNumber
5259
 					warehouseOutInfo.WarehouseInfotId = stockInInfo.ID
5274
 					warehouseOutInfo.WarehouseInfotId = stockInInfo.ID
5260
 					//查找当天是否存在出库记录
5275
 					//查找当天是否存在出库记录
5261
-
5262
 					_, errcod := service.GetWarehouseOutInfoIsExistOne(item.GoodId, patient_id, record_time, 0)
5276
 					_, errcod := service.GetWarehouseOutInfoIsExistOne(item.GoodId, patient_id, record_time, 0)
5263
 
5277
 
5264
 					if errcod == gorm.ErrRecordNotFound {
5278
 					if errcod == gorm.ErrRecordNotFound {
5358
 							StorehouseId:            houseConfig.StorehouseOutInfo,
5372
 							StorehouseId:            houseConfig.StorehouseOutInfo,
5359
 						}
5373
 						}
5360
 						exsit, errflows := service.GetStockFlowIsExsit(warehouseOutInfos.WarehouseInfotId, patient_id, record_time, item.GoodId)
5374
 						exsit, errflows := service.GetStockFlowIsExsit(warehouseOutInfos.WarehouseInfotId, patient_id, record_time, item.GoodId)
5375
+
5361
 						if errflows == gorm.ErrRecordNotFound {
5376
 						if errflows == gorm.ErrRecordNotFound {
5362
 							//创建流水表
5377
 							//创建流水表
5363
 							service.CreateStockFlowOne(stockFlow)
5378
 							service.CreateStockFlowOne(stockFlow)
5478
 
5493
 
5479
 					}
5494
 					}
5480
 
5495
 
5481
-					//比较剩余库存 和 当前相差的数量,库存剩余量大于则正常出库
5482
-
5483
 					//查询该耗材的总库存
5496
 					//查询该耗材的总库存
5484
 					wareinfo, _ := service.GetStockGoodCount(item.GoodId)
5497
 					wareinfo, _ := service.GetStockGoodCount(item.GoodId)
5485
 					// 如果库存差大于剩余库存则提示库存不足
5498
 					// 如果库存差大于剩余库存则提示库存不足