Преглед изворни кода

Merge branch '20220812' of http://git.shengws.com/csx/XT_New into 20220812

csx пре 2 година
родитељ
комит
cb60730cdf

+ 108 - 93
controllers/his_api_controller.go Прегледај датотеку

@@ -1093,14 +1093,14 @@ func (c *HisApiController) CreateHisPrescription() {
1093 1093
 								advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
1094 1094
 
1095 1095
 								//查询最新批次库存
1096
-								info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
1097
-								var batch_number_count int64
1098
-								batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
1099
-								batch_number_counts := strconv.FormatInt(batch_number_count, 10)
1096
+								//info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
1097
+								//var batch_number_count int64
1098
+								//batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
1099
+								//batch_number_counts := strconv.FormatInt(batch_number_count, 10)
1100 1100
 								//新增处方
1101 1101
 								if advicelist.ID == 0 {
1102 1102
 									all_count, _ := strconv.ParseFloat(totals, 64)
1103
-									batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
1103
+									//batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
1104 1104
 									if prescribingNumberUnit == drug.MinUnit {
1105 1105
 
1106 1106
 										if drug.IsUse != 1 {
@@ -1109,10 +1109,10 @@ func (c *HisApiController) CreateHisPrescription() {
1109 1109
 												return
1110 1110
 											}
1111 1111
 
1112
-											if prescribing_number > batch_number_all_count {
1113
-												c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1114
-												return
1115
-											}
1112
+											//if prescribing_number > batch_number_all_count {
1113
+											//	c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1114
+											//	return
1115
+											//}
1116 1116
 
1117 1117
 										}
1118 1118
 
@@ -1125,10 +1125,10 @@ func (c *HisApiController) CreateHisPrescription() {
1125 1125
 												return
1126 1126
 											}
1127 1127
 
1128
-											if num > batch_number_all_count {
1129
-												c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1130
-												return
1131
-											}
1128
+											//if num > batch_number_all_count {
1129
+											//	c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1130
+											//	return
1131
+											//}
1132 1132
 										}
1133 1133
 									}
1134 1134
 								}
@@ -1190,10 +1190,12 @@ func (c *HisApiController) CreateHisPrescription() {
1190 1190
 														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1191 1191
 														return
1192 1192
 													}
1193
-													if prescribing_number > batch_number_all_count {
1194
-														c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1195
-														return
1196
-													}
1193
+													fmt.Println("prescribing_number2332323323323", prescribing_number)
1194
+													fmt.Println("batch_number_all_count", batch_number_all_count)
1195
+													//if prescribing_number > batch_number_all_count {
1196
+													//	c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1197
+													//	return
1198
+													//}
1197 1199
 												}
1198 1200
 
1199 1201
 											} else {
@@ -1205,11 +1207,12 @@ func (c *HisApiController) CreateHisPrescription() {
1205 1207
 															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1206 1208
 															return
1207 1209
 														}
1208
-
1209
-														if prescribing_number > batch_number_all_count {
1210
-															c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1211
-															return
1212
-														}
1210
+														fmt.Println("prescribing_number2332323323323", prescribing_number)
1211
+														fmt.Println("batch_number_all_count", batch_number_all_count)
1212
+														//if prescribing_number > batch_number_all_count {
1213
+														//	c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1214
+														//	return
1215
+														//}
1213 1216
 													}
1214 1217
 
1215 1218
 												}
@@ -1254,37 +1257,44 @@ func (c *HisApiController) CreateHisPrescription() {
1254 1257
 														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1255 1258
 														return
1256 1259
 													}
1260
+													fmt.Println("number_count", number_count)
1261
+													fmt.Println("device_number", device_number)
1262
+													fmt.Println("batch_number_count", batch_number_count)
1257 1263
 
1258
-													if (number_count - device_number) > batch_number_count {
1259
-														c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1260
-														return
1261
-													}
1264
+													//if (number_count - device_number) > batch_number_count {
1265
+													//	c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1266
+													//	return
1267
+													//}
1262 1268
 
1263 1269
 													// 查询该药品最后一次出库记录
1264
-													outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
1265
-													var out_count int64
1266
-													var in_count int64
1267
-													var stock_max_number int64
1268
-													var stock_min_number int64
1269
-													for _, it := range outInfo {
1270
-														if it.CountUnit == drug.MaxUnit {
1271
-															it.Count = it.Count * drug.MinNumber
1272
-														}
1273
-														out_count += it.Count
1274
-														warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
1275
-														stock_max_number = warehouseInfoList.StockMaxNumber
1276
-														stock_min_number = warehouseInfoList.StockMinNumber
1277
-														if warehouseInfoList.MaxUnit == drug.MaxUnit {
1278
-															in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
1279
-														}
1280
-														if warehouseInfoList.MaxUnit == drug.MinUnit {
1281
-															in_count = warehouseInfoList.WarehousingCount
1282
-														}
1283
-													}
1284
-													if (out_count + (number_count - device_number)) > in_count {
1285
-														c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
1286
-														return
1287
-													}
1270
+													//outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
1271
+													//var out_count int64
1272
+													//var in_count int64
1273
+													//var stock_max_number int64
1274
+													//var stock_min_number int64
1275
+													//for _, it := range outInfo {
1276
+													//	if it.CountUnit == drug.MaxUnit {
1277
+													//		it.Count = it.Count * drug.MinNumber
1278
+													//	}
1279
+													//	out_count += it.Count
1280
+													//	warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
1281
+													//	fmt.Println("warehouseInfoList233323232332323232",warehouseInfoList)
1282
+													//	stock_max_number = warehouseInfoList.StockMaxNumber
1283
+													//	stock_min_number = warehouseInfoList.StockMinNumber
1284
+													//	if warehouseInfoList.MaxUnit == drug.MaxUnit {
1285
+													//		in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
1286
+													//	}
1287
+													//	if warehouseInfoList.MaxUnit == drug.MinUnit {
1288
+													//		in_count = warehouseInfoList.WarehousingCount
1289
+													//	}
1290
+													//}
1291
+													//fmt.Println("out_count",out_count)
1292
+													//fmt.Println("number_count - device_number",number_count - device_number)
1293
+													//fmt.Println("in_countwowowowowowow",in_count)
1294
+													//if (out_count + (number_count - device_number)) > in_count {
1295
+													//	c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
1296
+													//	return
1297
+													//}
1288 1298
 
1289 1299
 												}
1290 1300
 
@@ -1384,27 +1394,27 @@ func (c *HisApiController) CreateHisPrescription() {
1384 1394
 										//新增处方
1385 1395
 										if advicelist.ID == 0 {
1386 1396
 											//查询最新批次库存
1387
-											info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
1388
-											var batch_number_count int64
1389
-											batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
1390
-											batch_number_counts := strconv.FormatInt(batch_number_count, 10)
1397
+											//info, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
1398
+											//var batch_number_count int64
1399
+											//batch_number_count = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
1400
+											//batch_number_counts := strconv.FormatInt(batch_number_count, 10)
1391 1401
 											all_count, _ := strconv.ParseFloat(totals, 64)
1392 1402
 											if prescribingNumberUnit == drug.MinUnit {
1393
-												batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
1403
+												//batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
1394 1404
 												if drug.IsUse != 1 {
1395 1405
 													if prescribing_number > all_count {
1396 1406
 														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1397 1407
 														return
1398 1408
 													}
1399
-													if prescribing_number > batch_number_all_count {
1400
-														c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1401
-														return
1402
-													}
1409
+													//if prescribing_number > batch_number_all_count {
1410
+													//	c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1411
+													//	return
1412
+													//}
1403 1413
 												}
1404 1414
 
1405 1415
 											} else {
1406 1416
 												if prescribingNumberUnit == drug.MaxUnit {
1407
-													batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
1417
+													//batch_number_all_count, _ := strconv.ParseFloat(batch_number_counts, 64)
1408 1418
 													num := prescribing_number * float64(drug.MinNumber)
1409 1419
 													if drug.IsUse != 1 {
1410 1420
 														if num > all_count {
@@ -1412,10 +1422,10 @@ func (c *HisApiController) CreateHisPrescription() {
1412 1422
 															return
1413 1423
 														}
1414 1424
 
1415
-														if prescribing_number > batch_number_all_count {
1416
-															c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1417
-															return
1418
-														}
1425
+														//if prescribing_number > batch_number_all_count {
1426
+														//	c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1427
+														//	return
1428
+														//}
1419 1429
 													}
1420 1430
 
1421 1431
 												}
@@ -1458,38 +1468,43 @@ func (c *HisApiController) CreateHisPrescription() {
1458 1468
 														c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
1459 1469
 														return
1460 1470
 													}
1461
-													if (number_count - device_number) > batch_number_count {
1462
-														c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1463
-														return
1464
-													}
1471
+													fmt.Println("number_count", number_count)
1472
+													fmt.Println("device_number", device_number)
1473
+													fmt.Println("batch_number_count", batch_number_count)
1474
+													//if (number_count - device_number) > batch_number_count {
1475
+													//	c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1476
+													//	return
1477
+													//}
1465 1478
 
1466 1479
 													//查询历史出库数据总批次
1467 1480
 													// 查询该药品最后一次出库记录
1468
-													outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
1469
-													var out_count int64
1470
-													var in_count int64
1471
-													var stock_max_number int64
1472
-													var stock_min_number int64
1473
-													for _, it := range outInfo {
1474
-														if it.CountUnit == drug.MaxUnit {
1475
-															it.Count = it.Count * drug.MinNumber
1476
-														}
1477
-														out_count += it.Count
1478
-														warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
1479
-														stock_max_number = warehouseInfoList.StockMaxNumber
1480
-														stock_min_number = warehouseInfoList.StockMinNumber
1481
-														if warehouseInfoList.MaxUnit == drug.MaxUnit {
1482
-															in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
1483
-														}
1484
-														if warehouseInfoList.MaxUnit == drug.MinUnit {
1485
-															in_count = warehouseInfoList.WarehousingCount
1486
-														}
1487
-													}
1488
-
1489
-													if (out_count + (number_count - device_number)) > in_count {
1490
-														c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
1491
-														return
1492
-													}
1481
+													//outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
1482
+													//var out_count int64
1483
+													//var in_count int64
1484
+													//var stock_max_number int64
1485
+													//var stock_min_number int64
1486
+													//for _, it := range outInfo {
1487
+													//	if it.CountUnit == drug.MaxUnit {
1488
+													//		it.Count = it.Count * drug.MinNumber
1489
+													//	}
1490
+													//	out_count += it.Count
1491
+													//	warehouseInfoList, _ := service.GetDrugWarehouseInfoById(it.WarehouseInfoId)
1492
+													//	stock_max_number = warehouseInfoList.StockMaxNumber
1493
+													//	stock_min_number = warehouseInfoList.StockMinNumber
1494
+													//	if warehouseInfoList.MaxUnit == drug.MaxUnit {
1495
+													//		in_count = warehouseInfoList.WarehousingCount * drug.MinNumber
1496
+													//	}
1497
+													//	if warehouseInfoList.MaxUnit == drug.MinUnit {
1498
+													//		in_count = warehouseInfoList.WarehousingCount
1499
+													//	}
1500
+													//}
1501
+													//fmt.Println("out_count",out_count)
1502
+													//fmt.Println("number_count - device_number",number_count - device_number)
1503
+													//fmt.Println("in_count",in_count)
1504
+													//if (out_count + (number_count - device_number)) > in_count {
1505
+													//	c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(stock_max_number, 10) + drug.MaxUnit + strconv.FormatInt(stock_min_number, 10) + drug.MinUnit)
1506
+													//	return
1507
+													//}
1493 1508
 
1494 1509
 												}
1495 1510
 											}

+ 2 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go Прегледај датотеку

@@ -562,12 +562,14 @@ func (this *DialysisAPIController) DialysisRecord() {
562 562
 
563 563
 	prescribeOne, _ = service.MobileGetDialysisPrescribeByModeIdOne(adminInfo.Org.Id, patientID, date.Unix())
564 564
 	var his_advices []*models.HisDoctorAdviceInfo
565
+	fmt.Println("w233232322332233223", is_open_config.IsOpen)
565 566
 	if is_open_config.IsOpen == 1 {
566 567
 		// 先走redis,没有走数据库
567 568
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
568 569
 	}
569 570
 
570 571
 	is_advice_open, _ := service.FindAdviceSettingById(adminInfo.Org.Id)
572
+	fmt.Println("t233232322332233223", is_advice_open.IsAdviceOpen)
571 573
 	if is_advice_open.IsAdviceOpen == 1 {
572 574
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
573 575
 	}

+ 1 - 1
service/mobile_dialysis_service.go Прегледај датотеку

@@ -2906,7 +2906,7 @@ func GetAllHisDoctorAdvice(orgid int64, patientid int64, recorddate int64) (his
2906 2906
 	defer redis.Close()
2907 2907
 	key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(recorddate, 10) + ":his_doctor_advice"
2908 2908
 	his_doctor_advice_str, _ := redis.Get(key).Result()
2909
-
2909
+	redis.Set(key, "", time.Second)
2910 2910
 	if len(his_doctor_advice_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2911 2911
 		err = readDb.Model(&models.HisDoctorAdviceInfo{}).Where("patient_id = ? AND user_org_id = ? AND status=1 AND record_date = ?", patientid, orgid, recorddate).Find(&his).Error
2912 2912
 		if err != nil {

+ 1 - 1
service/patient_service.go Прегледај датотеку

@@ -572,7 +572,7 @@ func FindPatientWithDeviceByNo(orgID int64, no string, time int64) (patient mode
572 572
 		return db.Preload("DeviceNumber", "org_id = ?", orgID).
573 573
 			Preload("DeviceZone", "org_id = ?", orgID).
574 574
 			Where("user_org_id = ? AND schedule_date = ? ", orgID, time)
575
-	}).Preload("InfectiousDiseases", "status = 1").Where("user_org_id=? and dialysis_no = ? and status=1", orgID, no).First(&patient).Error
575
+	}).Preload("InfectiousDiseases", "status = 1").Where("user_org_id=? and dialysis_no = ? and status=1 and lapseto =1", orgID, no).First(&patient).Error
576 576
 	return
577 577
 }
578 578