Browse Source

11月8日库存管理

XMLWAN 2 years ago
parent
commit
3294bac5a3

+ 34 - 5
controllers/dialysis_api_controller.go View File

@@ -62,6 +62,8 @@ func DialysisApiRegistRouters() {
62 62
 	beego.Router("/api/goodstatistics/get", &DialysisApiController{}, "Get:GetDialysisGoodsStatistics")
63 63
 	beego.Router("/api/queue/get", &DialysisApiController{}, "Get:GetQueueCall")
64 64
 	beego.Router("/api/queue/update", &DialysisApiController{}, "Get:UpdateQueueCall")
65
+
66
+	beego.Router("/api/get/getrolelist", &DialysisApiController{}, "Get:GetRoleList")
65 67
 }
66 68
 
67 69
 func (c *DialysisApiController) GetQueueCall() {
@@ -909,7 +911,7 @@ func (c *DialysisApiController) PostDouleCheck() {
909 911
 	vascular_access_desc := c.GetString("vascular_access_desc")
910 912
 	pipeline_connection_desc := c.GetString("pipeline_connection_desc")
911 913
 	collator, _ := c.GetInt64("collator", 0)
912
-
914
+	employee_number := c.GetString("employee_number")
913 915
 	if id <= 0 {
914 916
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
915 917
 		return
@@ -934,6 +936,15 @@ func (c *DialysisApiController) PostDouleCheck() {
934 936
 
935 937
 	var checkDate int64
936 938
 
939
+	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10340 {
940
+		list, _ := service.GetRoleList(adminUserInfo.CurrentOrgId, modifier)
941
+
942
+		if employee_number != list.JobNumber {
943
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorEmployeeNumber)
944
+			return
945
+		}
946
+	}
947
+
937 948
 	if len(checkTimeStr) == 0 {
938 949
 		//checkTimeStr = time.Now().Format("2006-01-02 15:04")
939 950
 		checkDate = 0
@@ -970,6 +981,7 @@ func (c *DialysisApiController) PostDouleCheck() {
970 981
 		CreatedTime:                time.Now().Unix(),
971 982
 		UpdatedTime:                time.Now().Unix(),
972 983
 		CheckDate:                  recordDate.Unix(),
984
+		EmployeeNumber:             employee_number,
973 985
 	}
974 986
 
975 987
 	_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.CurrentOrgId)
@@ -982,11 +994,11 @@ func (c *DialysisApiController) PostDouleCheck() {
982 994
 		err := service.AddSigleDoubleCheck(&doubleCheck)
983 995
 		redis := service.RedisClient()
984 996
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
985
-		fmt.Println("key2333223233223232323", key)
997
+
986 998
 		//清空key 值
987 999
 		redis.Set(key, "", time.Second)
988 1000
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
989
-		fmt.Println("keyTwo23332323223233223323232", keyTwo)
1001
+
990 1002
 		redis.Set(keyTwo, "", time.Second)
991 1003
 		keyThree := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + ":prescriptions_list_all"
992 1004
 		redis.Set(keyThree, "", time.Second)
@@ -1010,10 +1022,10 @@ func (c *DialysisApiController) PostDouleCheck() {
1010 1022
 		redis := service.RedisClient()
1011 1023
 		err := service.UpdateDoubleCheck(&doubleCheck)
1012 1024
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
1013
-		fmt.Println("key2333223233223232323", key)
1025
+
1014 1026
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1015 1027
 		redis.Set(keyTwo, "", time.Second)
1016
-		fmt.Println("keyTwo23332323223233223323232", keyTwo)
1028
+
1017 1029
 		//清空key 值
1018 1030
 		redis.Set(key, "", time.Second)
1019 1031
 		keyThree := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + ":prescriptions_list_all"
@@ -3844,3 +3856,20 @@ func (c *DialysisApiController) GetDialysisGoodsStatistics() {
3844 3856
 	}
3845 3857
 
3846 3858
 }
3859
+
3860
+func (c *DialysisApiController) GetRoleList() {
3861
+
3862
+	orgId := c.GetAdminUserInfo().CurrentOrgId
3863
+	admin_user_id, _ := c.GetInt64("admin_user_id")
3864
+	list, err := service.GetRoleList(orgId, admin_user_id)
3865
+	if err == nil {
3866
+		c.ServeSuccessJSON(map[string]interface{}{
3867
+			"adminRole": list,
3868
+		})
3869
+		return
3870
+
3871
+	} else {
3872
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3873
+		return
3874
+	}
3875
+}

+ 126 - 45
controllers/dialysis_record_api_controller.go View File

@@ -1046,7 +1046,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1046 1046
 
1047 1047
 					if evaluation.ID > 0 {
1048 1048
 						ultrafiltration_rate = math.Ceil(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
1049
-						fmt.Println("ultrafiltration_rate", ultrafiltration_rate)
1049
+
1050 1050
 					}
1051 1051
 				}
1052 1052
 
@@ -1055,7 +1055,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1055 1055
 
1056 1056
 					if evaluation.ID > 0 {
1057 1057
 						ultrafiltration_rate = math.Ceil(prescription.TargetUltrafiltration / float64(totalMin) * 60)
1058
-						fmt.Println("hhhh2323323223322323323232", ultrafiltration_rate)
1058
+
1059 1059
 					}
1060 1060
 				}
1061 1061
 			}
@@ -1138,6 +1138,10 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1138 1138
 	nurseID, _ := this.GetInt64("nurse")
1139 1139
 	end_time := this.GetString("end_time")
1140 1140
 
1141
+	puncture_point_haematoma, _ := this.GetInt64("puncture_point_haematoma")
1142
+	internal_fistula := this.GetString("internal_fistula")
1143
+	catheter := this.GetString("catheter")
1144
+	cruor := this.GetString("cruor")
1141 1145
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 {
1142 1146
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1143 1147
 		return
@@ -1343,48 +1347,118 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1343 1347
 
1344 1348
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
1345 1349
 
1346
-	if err != nil {
1347
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1348
-		return
1349
-	}
1350
+	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10215 || adminUserInfo.CurrentOrgId == 10233 || adminUserInfo.CurrentOrgId == 10223 || adminUserInfo.CurrentOrgId == 10243 || adminUserInfo.CurrentOrgId == 10340 {
1350 1351
 
1351
-	go func() {
1352
-		ssoDomain := beego.AppConfig.String("call_domain")
1353
-		api := ssoDomain + "/index/downpatient"
1354
-		values := make(url.Values)
1355
-		values.Set("org_id", strconv.FormatInt(adminUserInfo.CurrentOrgId, 10))
1356
-		values.Set("admin_user_id", strconv.FormatInt(nurseID, 10))
1357
-		values.Set("patient_id", strconv.FormatInt(patientID, 10))
1358
-		http.PostForm(api, values)
1359
-	}()
1352
+		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1353
+		if evaluation.SystolicBloodPressure == 0 {
1354
+			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
1360 1355
 
1361
-	updateErr := service.ModifyDialysisRecord(dialysisRecord.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id)
1362
-	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_order"
1363
-	redis := service.RedisClient()
1364
-	defer redis.Close()
1365
-	//清空key 值
1366
-	redis.Set(key, "", time.Second)
1356
+			pre := models.PredialysisEvaluation{
1357
+				SystolicBloodPressure: evaluation.SystolicBloodPressure,
1358
+			}
1359
+			fmt.Println("prew", pre)
1360
+			getNurseErr := service.UpdatePredialysisEvaluation(&pre, evaluation.ID)
1361
+			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1362
+			keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1367 1363
 
1368
-	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_orders_list_all"
1369
-	redis.Set(keyOne, "", time.Second)
1364
+			redis := service.RedisClient()
1365
+			redis.Set(key, "", time.Second)
1366
+			redis.Set(keyOne, "", time.Second)
1367
+			defer redis.Close()
1368
+			fmt.Println(getNurseErr)
1369
+		}
1370
+		if evaluation.DiastolicBloodPressure == 0 {
1371
+			evaluation.DiastolicBloodPressure = fmonitorRecords.DiastolicBloodPressure
1372
+			pres := models.PredialysisEvaluation{
1373
+				DiastolicBloodPressure: evaluation.DiastolicBloodPressure,
1374
+			}
1375
+			getNurseErr := service.UpdatePredialysisEvaluationTwo(&pres, evaluation.ID)
1376
+			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1370 1377
 
1371
-	if updateErr != nil {
1372
-		this.ErrorLog("下机失败:%v", updateErr)
1373
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1374
-		return
1375
-	} else {
1376
-		dialysisRecord.Stage = 2
1377
-		dialysisRecord.FinishNurse = nurseID
1378
-		dialysisRecord.FinishCreator = adminUserInfo.AdminUser.Id
1379
-		dialysisRecord.FinishModifier = adminUserInfo.AdminUser.Id
1380
-		dialysisRecord.EndTime = endDate.Unix()
1381
-		// 结束时候透析次数加1
1382
-		service.UpdateSolutionByPatientId(patientID)
1378
+			redis := service.RedisClient()
1379
+			redis.Set(key, "", time.Second)
1383 1380
 
1384
-		this.ServeSuccessJSON(map[string]interface{}{
1385
-			"dialysis_order":          dialysisRecord,
1386
-			"assessmentAfterDislysis": tempassessmentAfterDislysis,
1387
-		})
1381
+			keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1382
+			redis.Set(keyOne, "", time.Second)
1383
+			defer redis.Close()
1384
+			fmt.Println(getNurseErr)
1385
+		}
1386
+		if evaluation.PulseFrequency == 0 {
1387
+			evaluation.PulseFrequency = fmonitorRecords.PulseFrequency
1388
+			press := models.PredialysisEvaluation{
1389
+				PulseFrequency: evaluation.PulseFrequency,
1390
+			}
1391
+			getNurseErr := service.UpdatePredialysisEvaluationThree(&press, evaluation.ID)
1392
+			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1393
+
1394
+			redis := service.RedisClient()
1395
+			redis.Set(key, "", time.Second)
1396
+			keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1397
+			redis.Set(keyOne, "", time.Second)
1398
+			defer redis.Close()
1399
+			fmt.Println(getNurseErr)
1400
+		}
1401
+
1402
+		if evaluation.Temperature == 0 {
1403
+			evaluation.Temperature = fmonitorRecords.Temperature
1404
+			press := models.PredialysisEvaluation{
1405
+				Temperature: evaluation.Temperature,
1406
+			}
1407
+			getNurseErr := service.UpdatePredialysisEvaluationFour(&press, evaluation.ID)
1408
+			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1409
+
1410
+			redis := service.RedisClient()
1411
+			redis.Set(key, "", time.Second)
1412
+			keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1413
+			redis.Set(keyOne, "", time.Second)
1414
+			defer redis.Close()
1415
+			fmt.Println(getNurseErr)
1416
+		}
1417
+
1418
+		if err != nil {
1419
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1420
+			return
1421
+		}
1422
+
1423
+		go func() {
1424
+			ssoDomain := beego.AppConfig.String("call_domain")
1425
+			api := ssoDomain + "/index/downpatient"
1426
+			values := make(url.Values)
1427
+			values.Set("org_id", strconv.FormatInt(adminUserInfo.CurrentOrgId, 10))
1428
+			values.Set("admin_user_id", strconv.FormatInt(nurseID, 10))
1429
+			values.Set("patient_id", strconv.FormatInt(patientID, 10))
1430
+			http.PostForm(api, values)
1431
+		}()
1432
+
1433
+		//执行下机
1434
+		updateErr := service.ModifyDialysisRecord(dialysisRecord.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor)
1435
+		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_order"
1436
+		redis := service.RedisClient()
1437
+		defer redis.Close()
1438
+		//清空key 值
1439
+		redis.Set(key, "", time.Second)
1440
+
1441
+		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_orders_list_all"
1442
+		redis.Set(keyOne, "", time.Second)
1443
+
1444
+		if updateErr != nil {
1445
+			this.ErrorLog("下机失败:%v", updateErr)
1446
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1447
+			return
1448
+		} else {
1449
+			dialysisRecord.Stage = 2
1450
+			dialysisRecord.FinishNurse = nurseID
1451
+			dialysisRecord.FinishCreator = adminUserInfo.AdminUser.Id
1452
+			dialysisRecord.FinishModifier = adminUserInfo.AdminUser.Id
1453
+			dialysisRecord.EndTime = endDate.Unix()
1454
+			// 结束时候透析次数加1
1455
+			service.UpdateSolutionByPatientId(patientID)
1456
+
1457
+			this.ServeSuccessJSON(map[string]interface{}{
1458
+				"dialysis_order":          dialysisRecord,
1459
+				"assessmentAfterDislysis": tempassessmentAfterDislysis,
1460
+			})
1461
+		}
1388 1462
 	}
1389 1463
 }
1390 1464
 
@@ -1619,7 +1693,10 @@ func (c *DialysisRecordAPIController) ModifyFinishDialysis() {
1619 1693
 	record_id, _ := c.GetInt64("id")
1620 1694
 	nurseID, _ := c.GetInt64("nurse")
1621 1695
 	end_time := c.GetString("end_time")
1622
-
1696
+	puncture_point_haematoma, _ := c.GetInt64("puncture_point_haematoma")
1697
+	internal_fistula := c.GetString("internal_fistula")
1698
+	catheter := c.GetString("catheter")
1699
+	cruor := c.GetString("cruor")
1623 1700
 	if record_id <= 0 || nurseID <= 0 {
1624 1701
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1625 1702
 		return
@@ -1657,11 +1734,15 @@ func (c *DialysisRecordAPIController) ModifyFinishDialysis() {
1657 1734
 	//}
1658 1735
 
1659 1736
 	dialysisRecord := &models.DialysisOrder{
1660
-		ID:             record_id,
1661
-		UserOrgId:      adminUserInfo.CurrentOrgId,
1662
-		EndTime:        endDate.Unix(),
1663
-		FinishNurse:    nurseID,
1664
-		FinishModifier: adminUserInfo.AdminUser.Id,
1737
+		ID:                         record_id,
1738
+		UserOrgId:                  adminUserInfo.CurrentOrgId,
1739
+		EndTime:                    endDate.Unix(),
1740
+		FinishNurse:                nurseID,
1741
+		FinishModifier:             adminUserInfo.AdminUser.Id,
1742
+		PuncturePointHaematoma:     puncture_point_haematoma,
1743
+		BloodAccessInternalFistula: internal_fistula,
1744
+		Catheter:                   catheter,
1745
+		Cruor:                      cruor,
1665 1746
 	}
1666 1747
 
1667 1748
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)

+ 54 - 5
controllers/drug_pharmacy_management_controller.go View File

@@ -7,6 +7,7 @@ import (
7 7
 	"XT_New/utils"
8 8
 	"fmt"
9 9
 	"github.com/astaxie/beego"
10
+	"github.com/jinzhu/gorm"
10 11
 	"math"
11 12
 	"strconv"
12 13
 	"strings"
@@ -27,10 +28,15 @@ func PharmacyApiControllersRegisterRouters() {
27 28
 	beego.Router("/api/advice/updatepharmacybasedrug", &PharmacyApiController{}, "Get:UpdatePharmacyBaseDrug")
28 29
 
29 30
 	//获取今日已发药的数据
30
-	beego.Router("api/advice/getpharmacybasedruglist", &PharmacyApiController{}, "Get:GetPharmacyBaseDrugList")
31
+	beego.Router("/api/advice/getpharmacybasedruglist", &PharmacyApiController{}, "Get:GetPharmacyBaseDrugList")
31 32
 	//退药流程
32 33
 	beego.Router("/api/advice/getreturnpharmacybasedrug", &PharmacyApiController{}, "Get:GetReturnPharmacyBaseDrug")
33 34
 
35
+	//设置
36
+	beego.Router("/api/advice/savesetting", &PharmacyApiController{}, "Get:SaveSetting")
37
+
38
+	beego.Router("/api/advice/getpharmacyconfig", &PharmacyApiController{}, "Get:GetPharmacyConfig")
39
+
34 40
 }
35 41
 
36 42
 func (this *PharmacyApiController) GetTodayAdviceList() {
@@ -42,9 +48,12 @@ func (this *PharmacyApiController) GetTodayAdviceList() {
42 48
 	//获取药房发药药品库数据
43 49
 	houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
44 50
 	list, err := service.GetPharmacyDrugList(houseConfig.DrugStorehouseOut, orgId, keywords)
51
+	appId := this.GetAdminUserInfo().CurrentAppId
52
+	doctorlist, _ := service.GetAllDoctorSix(orgId, appId)
45 53
 	if err == nil {
46 54
 		this.ServeSuccessJSON(map[string]interface{}{
47
-			"list": list,
55
+			"list":       list,
56
+			"doctorlist": doctorlist,
48 57
 		})
49 58
 	} else {
50 59
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -92,6 +101,7 @@ func (this *PharmacyApiController) UpdatePharmacyBaseDrug() {
92 101
 
93 102
 	hisStr := this.GetString("hisStr")
94 103
 
104
+	admin_user_id, _ := this.GetInt64("admin_user_id")
95 105
 	if len(bloodStr) == 0 {
96 106
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
97 107
 		return
@@ -120,7 +130,6 @@ func (this *PharmacyApiController) UpdatePharmacyBaseDrug() {
120 130
 
121 131
 	//查询是否通过药房出库
122 132
 	pharmacyConfig, _ := service.FindPharmacyConfig(orgId)
123
-	creater := this.GetAdminUserInfo().AdminUser.Id
124 133
 	if pharmacyConfig.IsOpen == 1 {
125 134
 		var total int64
126 135
 		var prescribing_number_total int64
@@ -150,7 +159,7 @@ func (this *PharmacyApiController) UpdatePharmacyBaseDrug() {
150 159
 				DrugId:            item.DrugId,
151 160
 				RecordDate:        item.AdviceDate,
152 161
 				OrdreNumber:       warehousing_out_order,
153
-				Creater:           creater,
162
+				Creater:           admin_user_id,
154 163
 			}
155 164
 
156 165
 			service.CreatePharmacy(pharmacy)
@@ -282,7 +291,7 @@ func (this *PharmacyApiController) UpdatePharmacyBaseDrug() {
282 291
 				DrugId:            item.DrugId,
283 292
 				RecordDate:        item.AdviceDate,
284 293
 				OrdreNumber:       warehousing_out_order,
285
-				Creater:           creater,
294
+				Creater:           admin_user_id,
286 295
 			}
287 296
 
288 297
 			service.CreatePharmacy(pharmacy)
@@ -462,3 +471,43 @@ func (this *PharmacyApiController) GetReturnPharmacyBaseDrug() {
462 471
 	service.UpdateReturnPharmacyAdviceBaseDrug(idArray, orgId)
463 472
 	service.UpdateReturnPharmacyHisAdviceBaseDrug(idArray, orgId)
464 473
 }
474
+
475
+func (this *PharmacyApiController) SaveSetting() {
476
+
477
+	is_open, _ := this.GetInt64("is_open")
478
+
479
+	orgId := this.GetAdminUserInfo().CurrentOrgId
480
+	config := models.PharmacyConfig{
481
+		UserOrgId: orgId,
482
+		IsOpen:    is_open,
483
+		Status:    1,
484
+		Ctime:     time.Now().Unix(),
485
+	}
486
+
487
+	//查找是否存在
488
+	_, errcode := service.GetConfigSettingIsExsit(orgId)
489
+	if errcode == gorm.ErrRecordNotFound {
490
+		service.CreatePharmacyConfig(&config)
491
+	} else if errcode == nil {
492
+		service.UpdatePharmacyConfig(orgId, &config)
493
+	}
494
+
495
+	this.ServeSuccessJSON(map[string]interface{}{
496
+		"config": config,
497
+	})
498
+}
499
+
500
+func (this *PharmacyApiController) GetPharmacyConfig() {
501
+
502
+	orgId := this.GetAdminUserInfo().CurrentOrgId
503
+
504
+	config, err := service.GetPharmacyConfig(orgId)
505
+
506
+	if err == nil {
507
+		this.ServeSuccessJSON(map[string]interface{}{
508
+			"config": config,
509
+		})
510
+	} else {
511
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
512
+	}
513
+}

+ 80 - 64
controllers/drug_stock_api_contorller.go View File

@@ -2286,7 +2286,8 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
2286 2286
 
2287 2287
 				if item.CountUnit == medical.MaxUnit {
2288 2288
 					maxNumber = cha_number / medical.MinNumber
2289
-					parseDateErr := service.UpdateWarehouseInfo(maxNumber, item.DrugId, item.OrgId)
2289
+
2290
+					parseDateErr := service.UpdateWarehouseInfo(maxNumber, item.DrugId, item.OrgId, outInfo.WarehouseInfoId)
2290 2291
 
2291 2292
 					if parseDateErr != nil {
2292 2293
 						utils.ErrorLog(errs.Error())
@@ -2307,7 +2308,7 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
2307 2308
 					if minNumber < 0 {
2308 2309
 						minNumber = 0
2309 2310
 					}
2310
-					parseDateErr = service.UpdateWarehouseInfoOne(minNumber, item.DrugId, item.OrgId)
2311
+					parseDateErr = service.UpdateWarehouseInfoOne(minNumber, item.DrugId, item.OrgId, outInfo.WarehouseInfoId)
2311 2312
 
2312 2313
 					if parseDateErr != nil {
2313 2314
 						utils.ErrorLog(errs.Error())
@@ -2326,7 +2327,7 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
2326 2327
 					})
2327 2328
 				}
2328 2329
 				if item.CountUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
2329
-					parseDateErr := service.UpdateWarehouseInfoOne(cha_number, item.DrugId, item.OrgId)
2330
+					parseDateErr := service.UpdateWarehouseInfoOne(cha_number, item.DrugId, item.OrgId, outInfo.WarehouseInfoId)
2330 2331
 
2331 2332
 					if parseDateErr != nil {
2332 2333
 						utils.ErrorLog(errs.Error())
@@ -2366,68 +2367,83 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
2366 2367
 						AdminUserId:  item.AdminUserId,
2367 2368
 					}
2368 2369
 					service.UpdateDrugFlowSix(item.WarehouseOutId, item.DrugId, item.WarehouseOutOrderNumber, flow)
2369
-					if item.CountUnit == medical.MaxUnit {
2370
-						maxNumber = cha_number / medical.MinNumber
2371
-
2372
-						parseDateErr := service.UpdateWarehouseInfoTwo(maxNumber, item.DrugId, item.OrgId)
2373
-
2374
-						fmt.Println("parseDateErr", parseDateErr)
2375
-						if parseDateErr != nil {
2376
-							utils.ErrorLog(errs.Error())
2377
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockOutFail)
2378
-							return
2379
-						}
2380
-
2381
-						c.ServeSuccessJSON(map[string]interface{}{
2382
-							"msg":        "2",
2383
-							"drug_name":  "",
2384
-							"dose":       "",
2385
-							"dose_unit":  "",
2386
-							"min_number": "",
2387
-							"min_unit":   "",
2388
-							"max_unit":   "",
2389
-						})
2390
-						minNumber = cha_number % medical.MinNumber
2391
-						if minNumber < 0 {
2392
-							minNumber = 0
2393
-						}
2394
-						parseDateErr = service.UpdateWarehouseInfoFour(minNumber, item.DrugId, item.OrgId)
2395
-
2396
-						if parseDateErr != nil {
2397
-							utils.ErrorLog(errs.Error())
2398
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockOutFail)
2399
-							return
2400
-						}
2401
-
2402
-						c.ServeSuccessJSON(map[string]interface{}{
2403
-							"msg":        "2",
2404
-							"drug_name":  "",
2405
-							"dose":       "",
2406
-							"dose_unit":  "",
2407
-							"min_number": "",
2408
-							"min_unit":   "",
2409
-							"max_unit":   "",
2410
-						})
2411
-					}
2412
-					if item.CountUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
2413
-						parseDateErr := service.UpdateWarehouseInfoFour(cha_number, item.DrugId, item.OrgId)
2414 2370
 
2415
-						if parseDateErr != nil {
2416
-							utils.ErrorLog(errs.Error())
2417
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockOutFail)
2418
-							return
2419
-						}
2420
-
2421
-						c.ServeSuccessJSON(map[string]interface{}{
2422
-							"msg":        "2",
2423
-							"drug_name":  "",
2424
-							"dose":       "",
2425
-							"dose_unit":  "",
2426
-							"min_number": "",
2427
-							"min_unit":   "",
2428
-							"max_unit":   "",
2429
-						})
2430
-					}
2371
+					service.UpdateWarehouseInfoTwentyFive(cha_number, item.DrugId, item.OrgId, storehouse_id, &medical)
2372
+
2373
+					//if item.CountUnit == medical.MaxUnit {
2374
+					//	maxNumber = cha_number / medical.MinNumber
2375
+					//
2376
+					//  service.UpdateWarehouseInfoTwentyFive(maxNumber,item.DrugId,item.OrgId,storehouse_id)
2377
+					//
2378
+					//  ////如果库存大于差
2379
+					//  //if(warehouse.StockMaxNumber > maxNumber){
2380
+					//  // service.UpdateWarehouseInfoTwenty(maxNumber,warehouse.ID)
2381
+					//  //}
2382
+					//  ////如果库存小于差
2383
+					//  //if(warehouse.StockMaxNumber < maxNumber){
2384
+					//  //
2385
+					//  //   //先出库完上一个批次的
2386
+					//  //  service.UpdateWarehouseInfoTwentyOne(warehouse.ID)
2387
+					//  //}
2388
+					//
2389
+					//	parseDateErr := service.UpdateWarehouseInfoTwo(maxNumber, item.DrugId, item.OrgId)
2390
+					//	fmt.Println("parseDateErr", parseDateErr)
2391
+					//	if parseDateErr != nil {
2392
+					//		utils.ErrorLog(errs.Error())
2393
+					//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockOutFail)
2394
+					//		return
2395
+					//	}
2396
+					//
2397
+					//	c.ServeSuccessJSON(map[string]interface{}{
2398
+					//		"msg":        "2",
2399
+					//		"drug_name":  "",
2400
+					//		"dose":       "",
2401
+					//		"dose_unit":  "",
2402
+					//		"min_number": "",
2403
+					//		"min_unit":   "",
2404
+					//		"max_unit":   "",
2405
+					//	})
2406
+					//	minNumber = cha_number % medical.MinNumber
2407
+					//	if minNumber < 0 {
2408
+					//		minNumber = 0
2409
+					//	}
2410
+					//	parseDateErr = service.UpdateWarehouseInfoFour(minNumber, item.DrugId, item.OrgId)
2411
+					//
2412
+					//	if parseDateErr != nil {
2413
+					//		utils.ErrorLog(errs.Error())
2414
+					//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockOutFail)
2415
+					//		return
2416
+					//	}
2417
+					//
2418
+					//	c.ServeSuccessJSON(map[string]interface{}{
2419
+					//		"msg":        "2",
2420
+					//		"drug_name":  "",
2421
+					//		"dose":       "",
2422
+					//		"dose_unit":  "",
2423
+					//		"min_number": "",
2424
+					//		"min_unit":   "",
2425
+					//		"max_unit":   "",
2426
+					//	})
2427
+					//}
2428
+					//if item.CountUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
2429
+					//	parseDateErr := service.UpdateWarehouseInfoFour(cha_number, item.DrugId, item.OrgId)
2430
+					//
2431
+					//	if parseDateErr != nil {
2432
+					//		utils.ErrorLog(errs.Error())
2433
+					//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockOutFail)
2434
+					//		return
2435
+					//	}
2436
+					//
2437
+					//	c.ServeSuccessJSON(map[string]interface{}{
2438
+					//		"msg":        "2",
2439
+					//		"drug_name":  "",
2440
+					//		"dose":       "",
2441
+					//		"dose_unit":  "",
2442
+					//		"min_number": "",
2443
+					//		"min_unit":   "",
2444
+					//		"max_unit":   "",
2445
+					//	})
2446
+					//}
2431 2447
 				}
2432 2448
 
2433 2449
 				if all_number == cha_number {

+ 6 - 4
controllers/gobal_config_api_controller.go View File

@@ -2239,11 +2239,13 @@ func (c *GobalConfigApiController) GetDrugOutOrderPrint() {
2239 2239
 
2240 2240
 	warehousing, _ := service.GetExportOutOrderDrugListOne(ids)
2241 2241
 
2242
-	//drug_warhouse_out, _ := service.GetDrugWarehouseOut(ids)
2242
+	drug_warhouse_out, _ := service.GetDrugWarehouseOutTenty(ids)
2243
+
2243 2244
 	c.ServeSuccessJSON(map[string]interface{}{
2244
-		"info":             info,
2245
-		"warehousing":      warehousing,
2246
-		"manufacturerList": manufacturerList,
2245
+		"info":              info,
2246
+		"warehousing":       warehousing,
2247
+		"manufacturerList":  manufacturerList,
2248
+		"drug_warhouse_out": drug_warhouse_out,
2247 2249
 	})
2248 2250
 }
2249 2251
 

+ 78 - 34
controllers/his_api_controller.go View File

@@ -832,46 +832,90 @@ func (c *HisApiController) GetHisPrescriptionConfig() {
832 832
 	advices, _ := service.FindAllHisAdviceTemplate(adminInfo.CurrentOrgId)
833 833
 
834 834
 	houseConfig, _ := service.GetAllStoreHouseConfig(adminInfo.CurrentOrgId)
835
-	//获取所有基础药
836
-	drugs, _ := service.GetAllDrugLibListSix(adminInfo.CurrentOrgId, houseConfig.DrugStorehouseOut)
837
-
838
-	_, config := service.FindHisStockPriceRecordByOrgId(adminInfo.CurrentOrgId)
839
-	if config.ID > 0 && config.IsOpen == 1 {
840
-		for _, item := range drugs {
841
-			var index = 0
842
-			for _, subItem := range item.OtherDrugWarehouseInfo {
843
-				if index == 0 {
844
-					index = index + 1
845
-					if subItem.RetailPrice > 0 {
846
-						item.MinPrice = subItem.RetailPrice
835
+	if adminInfo.CurrentOrgId == 9675 || adminInfo.CurrentOrgId == 9671 || adminInfo.CurrentOrgId == 10215 {
836
+		//获取所有基础药
837
+		drugs, _ := service.GetAllDrugLibListSeven(adminInfo.CurrentOrgId, houseConfig.DrugStorehouseOut)
838
+		_, config := service.FindHisStockPriceRecordByOrgId(adminInfo.CurrentOrgId)
839
+		if config.ID > 0 && config.IsOpen == 1 {
840
+			for _, item := range drugs {
841
+				var index = 0
842
+				for _, subItem := range item.OtherDrugWarehouseInfo {
843
+					if index == 0 {
844
+						index = index + 1
845
+						if subItem.RetailPrice > 0 {
846
+							item.MinPrice = subItem.RetailPrice
847
+						}
847 848
 					}
848 849
 				}
849 850
 			}
850 851
 		}
852
+
853
+		manufacturers, _ := service.GetAllManufacturerList(adminInfo.CurrentOrgId)
854
+		drugways, _, _ := service.GetDrugWayDics(adminInfo.CurrentOrgId)
855
+		efs, _, _ := service.GetExecutionFrequencyDics(adminInfo.CurrentOrgId)
856
+		doctors, _ := service.GetHisAdminUserDoctors(adminInfo.CurrentOrgId)
857
+		//获取所有科室信息
858
+		department, _ := service.GetAllDepartMent(adminInfo.CurrentOrgId)
859
+		//获取诊断信息
860
+		sick, _ := service.FindAllSick(adminInfo.CurrentOrgId)
861
+		diagnose, _ := service.FindAllDiagnose(adminInfo.CurrentOrgId)
862
+		additions, _ := service.FindAllAddition(adminInfo.CurrentOrgId)
863
+
864
+		c.ServeSuccessJSON(map[string]interface{}{
865
+			"drugs":            drugs,
866
+			"advices_template": advices,
867
+			"drugways":         drugways,
868
+			"efs":              efs,
869
+			"doctors":          doctors,
870
+			"department":       department,
871
+			"sick":             sick,
872
+			"additions":        additions,
873
+			"diagnose":         diagnose,
874
+			"manufacturers":    manufacturers,
875
+		})
851 876
 	}
852
-	manufacturers, _ := service.GetAllManufacturerList(adminInfo.CurrentOrgId)
853
-	drugways, _, _ := service.GetDrugWayDics(adminInfo.CurrentOrgId)
854
-	efs, _, _ := service.GetExecutionFrequencyDics(adminInfo.CurrentOrgId)
855
-	doctors, _ := service.GetHisAdminUserDoctors(adminInfo.CurrentOrgId)
856
-	//获取所有科室信息
857
-	department, _ := service.GetAllDepartMent(adminInfo.CurrentOrgId)
858
-	//获取诊断信息
859
-	sick, _ := service.FindAllSick(adminInfo.CurrentOrgId)
860
-	diagnose, _ := service.FindAllDiagnose(adminInfo.CurrentOrgId)
861
-	additions, _ := service.FindAllAddition(adminInfo.CurrentOrgId)
877
+	if adminInfo.CurrentOrgId != 9675 && adminInfo.CurrentOrgId != 9671 && adminInfo.CurrentOrgId != 10215 {
878
+		//获取所有基础药
879
+		drugs, _ := service.GetAllDrugLibListSix(adminInfo.CurrentOrgId, houseConfig.DrugStorehouseOut)
880
+		_, config := service.FindHisStockPriceRecordByOrgId(adminInfo.CurrentOrgId)
881
+		if config.ID > 0 && config.IsOpen == 1 {
882
+			for _, item := range drugs {
883
+				var index = 0
884
+				for _, subItem := range item.OtherDrugWarehouseInfo {
885
+					if index == 0 {
886
+						index = index + 1
887
+						if subItem.RetailPrice > 0 {
888
+							item.MinPrice = subItem.RetailPrice
889
+						}
890
+					}
891
+				}
892
+			}
893
+		}
862 894
 
863
-	c.ServeSuccessJSON(map[string]interface{}{
864
-		"drugs":            drugs,
865
-		"advices_template": advices,
866
-		"drugways":         drugways,
867
-		"efs":              efs,
868
-		"doctors":          doctors,
869
-		"department":       department,
870
-		"sick":             sick,
871
-		"additions":        additions,
872
-		"diagnose":         diagnose,
873
-		"manufacturers":    manufacturers,
874
-	})
895
+		manufacturers, _ := service.GetAllManufacturerList(adminInfo.CurrentOrgId)
896
+		drugways, _, _ := service.GetDrugWayDics(adminInfo.CurrentOrgId)
897
+		efs, _, _ := service.GetExecutionFrequencyDics(adminInfo.CurrentOrgId)
898
+		doctors, _ := service.GetHisAdminUserDoctors(adminInfo.CurrentOrgId)
899
+		//获取所有科室信息
900
+		department, _ := service.GetAllDepartMent(adminInfo.CurrentOrgId)
901
+		//获取诊断信息
902
+		sick, _ := service.FindAllSick(adminInfo.CurrentOrgId)
903
+		diagnose, _ := service.FindAllDiagnose(adminInfo.CurrentOrgId)
904
+		additions, _ := service.FindAllAddition(adminInfo.CurrentOrgId)
905
+
906
+		c.ServeSuccessJSON(map[string]interface{}{
907
+			"drugs":            drugs,
908
+			"advices_template": advices,
909
+			"drugways":         drugways,
910
+			"efs":              efs,
911
+			"doctors":          doctors,
912
+			"department":       department,
913
+			"sick":             sick,
914
+			"additions":        additions,
915
+			"diagnose":         diagnose,
916
+			"manufacturers":    manufacturers,
917
+		})
918
+	}
875 919
 }
876 920
 
877 921
 func (c *HisApiController) CreateHisPrescription() {

+ 43 - 16
controllers/his_project_api_controller.go View File

@@ -827,28 +827,55 @@ func (this *HisProjectApiController) DeleteProject() {
827 827
 func (this *HisProjectApiController) GetHisProject() {
828 828
 	adminUserInfo := this.GetAdminUserInfo()
829 829
 	orgId := adminUserInfo.CurrentOrgId
830
-	project, err := service.GetHisProject(orgId)
830
+
831 831
 	houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
832
-	good_info, err := service.GetGoodInfoMationSix(orgId, houseConfig.StorehouseOutInfo)
833
-	_, config := service.FindHisStockPriceRecordByOrgId(orgId)
834
-	if config.ID > 0 && config.IsOpen == 1 {
835
-		//处理耗材不同批号价格问题
836
-		for _, item := range good_info {
837
-			if len(item.GoodSotckInfo) > 0 {
838
-				if item.GoodSotckInfo[0].Price > 0 {
839
-					item.PackingPrice = item.GoodSotckInfo[0].Price
832
+	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10215 {
833
+		project, err := service.GetHisProject(orgId)
834
+		good_info, err := service.GetGoodInfoMationSeven(orgId, houseConfig.StorehouseOutInfo)
835
+		_, config := service.FindHisStockPriceRecordByOrgId(orgId)
836
+		if config.ID > 0 && config.IsOpen == 1 {
837
+			//处理耗材不同批号价格问题
838
+			for _, item := range good_info {
839
+				if len(item.GoodSotckInfo) > 0 {
840
+					if item.GoodSotckInfo[0].Price > 0 {
841
+						item.PackingPrice = item.GoodSotckInfo[0].Price
842
+					}
840 843
 				}
841 844
 			}
842 845
 		}
846
+		if err != nil {
847
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
848
+			return
849
+		}
850
+		this.ServeSuccessJSON(map[string]interface{}{
851
+			"project":   project,
852
+			"good_info": good_info,
853
+		})
843 854
 	}
844
-	if err != nil {
845
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
846
-		return
855
+
856
+	if adminUserInfo.CurrentOrgId != 9671 && adminUserInfo.CurrentOrgId != 9675 && adminUserInfo.CurrentOrgId != 10215 {
857
+		project, err := service.GetHisProject(orgId)
858
+		good_info, err := service.GetGoodInfoMationSix(orgId, houseConfig.StorehouseOutInfo)
859
+		_, config := service.FindHisStockPriceRecordByOrgId(orgId)
860
+		if config.ID > 0 && config.IsOpen == 1 {
861
+			//处理耗材不同批号价格问题
862
+			for _, item := range good_info {
863
+				if len(item.GoodSotckInfo) > 0 {
864
+					if item.GoodSotckInfo[0].Price > 0 {
865
+						item.PackingPrice = item.GoodSotckInfo[0].Price
866
+					}
867
+				}
868
+			}
869
+		}
870
+		if err != nil {
871
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
872
+			return
873
+		}
874
+		this.ServeSuccessJSON(map[string]interface{}{
875
+			"project":   project,
876
+			"good_info": good_info,
877
+		})
847 878
 	}
848
-	this.ServeSuccessJSON(map[string]interface{}{
849
-		"project":   project,
850
-		"good_info": good_info,
851
-	})
852 879
 }
853 880
 
854 881
 func (this *HisProjectApiController) GetProjectTeam() {

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

@@ -738,6 +738,7 @@ func (c *DialysisAPIController) PostDoubleCheck() {
738 738
 	vascular_access_desc := c.GetString("vascular_access_desc")
739 739
 	pipeline_connection_desc := c.GetString("pipeline_connection_desc")
740 740
 	collator, _ := c.GetInt64("collator", 0)
741
+	employee_number := c.GetString("employee_number")
741 742
 
742 743
 	if id <= 0 {
743 744
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -751,6 +752,15 @@ func (c *DialysisAPIController) PostDoubleCheck() {
751 752
 		return
752 753
 	}
753 754
 
755
+	if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10340 {
756
+
757
+		list, _ := service.GetRoleList(adminUserInfo.Org.Id, modifier)
758
+		if employee_number != list.JobNumber {
759
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorEmployeeNumber)
760
+			return
761
+		}
762
+	}
763
+
754 764
 	if len(recordDateStr) == 0 {
755 765
 		recordDateStr = time.Now().Format("2006-01-02")
756 766
 	}
@@ -800,6 +810,7 @@ func (c *DialysisAPIController) PostDoubleCheck() {
800 810
 		CreatedTime:                time.Now().Unix(),
801 811
 		CheckDate:                  recordDate.Unix(),
802 812
 		UpdatedTime:                time.Now().Unix(),
813
+		EmployeeNumber:             employee_number,
803 814
 	}
804 815
 
805 816
 	_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -829,9 +840,9 @@ func (c *DialysisAPIController) PostDoubleCheck() {
829 840
 		doubleCheck.Modifier = modifier
830 841
 		doubleCheck.CreatedTime = check.CreatedTime
831 842
 		doubleCheck.ID = check.ID
843
+		doubleCheck.EmployeeNumber = employee_number
832 844
 		err := service.UpdateDoubleCheck(&doubleCheck)
833 845
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
834
-		fmt.Println("key233232232323232323", key)
835 846
 		redis := service.RedisClient()
836 847
 		defer redis.Close()
837 848
 		//清空key 值
@@ -1646,7 +1657,10 @@ func (c *DialysisAPIController) Finish() {
1646 1657
 	recordDateStr := c.GetString("record_date")
1647 1658
 	nurseID, _ := c.GetInt64("nurse")
1648 1659
 	end_time := c.GetString("end_time")
1649
-
1660
+	puncture_point_haematoma, _ := c.GetInt64("puncture_point_haematoma")
1661
+	internal_fistula := c.GetString("blood_access_internal_fistula")
1662
+	catheter := c.GetString("catheter")
1663
+	cruor := c.GetString("cruor")
1650 1664
 	if id <= 0 || nurseID <= 0 {
1651 1665
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1652 1666
 		return
@@ -1766,7 +1780,7 @@ func (c *DialysisAPIController) Finish() {
1766 1780
 
1767 1781
 	}
1768 1782
 
1769
-	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 {
1783
+	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 {
1770 1784
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
1771 1785
 		if evaluation.SystolicBloodPressure == 0 {
1772 1786
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
@@ -1784,6 +1798,7 @@ func (c *DialysisAPIController) Finish() {
1784 1798
 			defer redis.Close()
1785 1799
 			fmt.Println(getNurseErr)
1786 1800
 		}
1801
+
1787 1802
 		if evaluation.DiastolicBloodPressure == 0 {
1788 1803
 			evaluation.DiastolicBloodPressure = fmonitorRecords.DiastolicBloodPressure
1789 1804
 			pres := models.PredialysisEvaluation{
@@ -1815,6 +1830,22 @@ func (c *DialysisAPIController) Finish() {
1815 1830
 			defer redis.Close()
1816 1831
 			fmt.Println(getNurseErr)
1817 1832
 		}
1833
+
1834
+		if evaluation.Temperature == 0 {
1835
+			evaluation.Temperature = fmonitorRecords.Temperature
1836
+			press := models.PredialysisEvaluation{
1837
+				Temperature: evaluation.Temperature,
1838
+			}
1839
+			getNurseErr := service.UpdatePredialysisEvaluationFour(&press, evaluation.ID)
1840
+			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1841
+
1842
+			redis := service.RedisClient()
1843
+			redis.Set(key, "", time.Second)
1844
+			keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1845
+			redis.Set(keyOne, "", time.Second)
1846
+			defer redis.Close()
1847
+			fmt.Println(getNurseErr)
1848
+		}
1818 1849
 	}
1819 1850
 
1820 1851
 	if adminUserInfo.Org.Id == 9583 {
@@ -1933,7 +1964,7 @@ func (c *DialysisAPIController) Finish() {
1933 1964
 		return
1934 1965
 	}
1935 1966
 	if dialysisOrder.Stage == 1 {
1936
-		err := service.ModifyDialysisRecord(dialysisOrder.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id)
1967
+		err := service.ModifyDialysisRecord(dialysisOrder.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor)
1937 1968
 
1938 1969
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_order"
1939 1970
 		redis := service.RedisClient()
@@ -3153,6 +3184,10 @@ func (c *DialysisAPIController) ModifyFinishDialysisOrder() {
3153 3184
 	nurseID, _ := c.GetInt64("nurse")
3154 3185
 	end_time := c.GetString("end_time")
3155 3186
 
3187
+	puncture_point_haematoma, _ := c.GetInt64("puncture_point_haematoma")
3188
+	blood_access_internal_fistula := c.GetString("blood_access_internal_fistula")
3189
+	catheter := c.GetString("catheter")
3190
+	cruor := c.GetString("cruor")
3156 3191
 	if record_id <= 0 || nurseID <= 0 {
3157 3192
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3158 3193
 		return
@@ -3190,11 +3225,15 @@ func (c *DialysisAPIController) ModifyFinishDialysisOrder() {
3190 3225
 	//}
3191 3226
 
3192 3227
 	dialysisRecord := &models.DialysisOrder{
3193
-		ID:             record_id,
3194
-		UserOrgId:      adminUserInfo.Org.Id,
3195
-		EndTime:        endDate.Unix(),
3196
-		FinishNurse:    nurseID,
3197
-		FinishModifier: adminUserInfo.AdminUser.Id,
3228
+		ID:                         record_id,
3229
+		UserOrgId:                  adminUserInfo.Org.Id,
3230
+		EndTime:                    endDate.Unix(),
3231
+		FinishNurse:                nurseID,
3232
+		FinishModifier:             adminUserInfo.AdminUser.Id,
3233
+		PuncturePointHaematoma:     puncture_point_haematoma,
3234
+		BloodAccessInternalFistula: blood_access_internal_fistula,
3235
+		Catheter:                   catheter,
3236
+		Cruor:                      cruor,
3198 3237
 	}
3199 3238
 
3200 3239
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)
@@ -5672,3 +5711,15 @@ func RemoveRepeatedCheckRecod(arr []*models.HisPrescriptionProject) (newArr []*m
5672 5711
 	}
5673 5712
 	return
5674 5713
 }
5714
+
5715
+func (this *DialysisAPIController) GetRoleList() {
5716
+
5717
+	admin_user_id, _ := this.GetInt64("admin_user_id")
5718
+	orgid := this.GetMobileAdminUserInfo().Org.Id
5719
+	list, err := service.GetRoleList(orgid, admin_user_id)
5720
+	fmt.Println(err)
5721
+	this.ServeSuccessJSON(map[string]interface{}{
5722
+		"list": list,
5723
+	})
5724
+	return
5725
+}

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

@@ -165,4 +165,6 @@ func MobileAPIControllersRegisterRouters() {
165 165
 
166 166
 	beego.Router("/m/api/getmobileschedulelist", &DialysisAPIController{}, "Get:GetMobileScheduleList")
167 167
 
168
+	beego.Router("/m/api/getrolelist", &DialysisAPIController{}, "Get:GetRoleList")
169
+
168 170
 }

+ 4 - 1
enums/error_code.go View File

@@ -247,6 +247,8 @@ const ( // ErrorCode
247 247
 	ErrorCodeRecordFailedException = 300011
248 248
 
249 249
 	ErrorPsnNoEmpty = 310000
250
+
251
+	ErrorEmployeeNumber = 320000
250 252
 )
251 253
 
252 254
 var ErrCodeMsgs = map[int]string{
@@ -483,7 +485,8 @@ var ErrCodeMsgs = map[int]string{
483 485
 
484 486
 	ErrorCodeStockExced: "请先出库,执行失败",
485 487
 
486
-	ErrorPsnNoEmpty: "人员编码不能为空",
488
+	ErrorPsnNoEmpty:     "人员编码不能为空",
489
+	ErrorEmployeeNumber: "请输入正确的工号",
487 490
 }
488 491
 
489 492
 type SGJError struct {

+ 34 - 28
models/dialysis.go View File

@@ -538,6 +538,7 @@ type DoubleCheck struct {
538 538
 	Modifier                   int64  `gorm:"column:modifier" json:"modifier"`
539 539
 	CheckTime                  int64  `gorm:"column:check_time" json:"check_time"`
540 540
 	FirstCheckTime             int64  `gorm:"column:first_check_time" json:"first_check_time"`
541
+	EmployeeNumber             string `gorm:"column:employee_number" json:"employee_number" form:"employee_number"`
541 542
 }
542 543
 
543 544
 func (DoubleCheck) TableName() string {
@@ -794,34 +795,38 @@ func (VmDialysisOrder) TableName() string {
794 795
 }
795 796
 
796 797
 type DialysisOrder struct {
797
-	ID                     int64         `gorm:"column:id" json:"id"`
798
-	DialysisDate           int64         `gorm:"column:dialysis_date" json:"dialysis_date"`
799
-	UserOrgId              int64         `gorm:"column:user_org_id" json:"user_org_id"`
800
-	PatientId              int64         `gorm:"column:patient_id" json:"patient_id"`
801
-	PrescriptionId         int64         `gorm:"column:prescription_id" json:"prescription_id"`
802
-	Stage                  int64         `gorm:"column:stage" json:"stage"`
803
-	Remark                 string        `gorm:"column:remark" json:"remark"`
804
-	BedID                  int64         `gorm:"column:bed_id" json:"bed_id"`
805
-	StartNurse             int64         `gorm:"column:start_nurse" json:"start_nurse"`
806
-	FinishNurse            int64         `gorm:"column:finish_nurse" json:"finish_nurse"`
807
-	Status                 int64         `gorm:"column:status" json:"status"`
808
-	CreatedTime            int64         `gorm:"column:created_time" json:"created_time"`
809
-	UpdatedTime            int64         `gorm:"column:updated_time" json:"updated_time"`
810
-	DeviceNumber           DeviceNumber  `gorm:"ForeignKey:BedID"`
811
-	StartTime              int64         `gorm:"column:start_time" json:"start_time"`
812
-	EndTime                int64         `gorm:"column:end_time" json:"end_time"`
813
-	PunctureNurse          int64         `gorm:"column:puncture_nurse" json:"puncture_nurse"`
814
-	Creator                int64         `gorm:"column:creator" json:"creator"`
815
-	Modifier               int64         `gorm:"column:modifier" json:"modifier"`
816
-	FinishCreator          int64         `gorm:"column:finish_creator" json:"finish_creator"`
817
-	FinishModifier         int64         `gorm:"column:finish_modifier" json:"finish_modifier"`
818
-	SchedualType           int64         `gorm:"column:schedual_type" json:"schedual_type"`
819
-	UserAdminRole          UserAdminRole `json:"role" gorm:"foreignkey:AdminUserId;AssociationForeignKey:StartNurse;"`
820
-	WashpipeNurse          int64         `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
821
-	ChangeNurse            int64         `gorm:"column:change_nurse" json:"change_nurse" form:"change_nurse"`
822
-	DifficultPunctureNurse int64         `gorm:"column:difficult_puncture_nurse" json:"difficult_puncture_nurse" form:"difficult_puncture_nurse"`
823
-	NewFistulaNurse        int64         `gorm:"column:new_fistula_nurse" json:"new_fistula_nurse" form:"new_fistula_nurse"`
824
-	ZoneId                 int64         `gorm:"column:zone_id" json:"zone_id" form:"zone_id"`
798
+	ID                         int64         `gorm:"column:id" json:"id"`
799
+	DialysisDate               int64         `gorm:"column:dialysis_date" json:"dialysis_date"`
800
+	UserOrgId                  int64         `gorm:"column:user_org_id" json:"user_org_id"`
801
+	PatientId                  int64         `gorm:"column:patient_id" json:"patient_id"`
802
+	PrescriptionId             int64         `gorm:"column:prescription_id" json:"prescription_id"`
803
+	Stage                      int64         `gorm:"column:stage" json:"stage"`
804
+	Remark                     string        `gorm:"column:remark" json:"remark"`
805
+	BedID                      int64         `gorm:"column:bed_id" json:"bed_id"`
806
+	StartNurse                 int64         `gorm:"column:start_nurse" json:"start_nurse"`
807
+	FinishNurse                int64         `gorm:"column:finish_nurse" json:"finish_nurse"`
808
+	Status                     int64         `gorm:"column:status" json:"status"`
809
+	CreatedTime                int64         `gorm:"column:created_time" json:"created_time"`
810
+	UpdatedTime                int64         `gorm:"column:updated_time" json:"updated_time"`
811
+	DeviceNumber               DeviceNumber  `gorm:"ForeignKey:BedID"`
812
+	StartTime                  int64         `gorm:"column:start_time" json:"start_time"`
813
+	EndTime                    int64         `gorm:"column:end_time" json:"end_time"`
814
+	PunctureNurse              int64         `gorm:"column:puncture_nurse" json:"puncture_nurse"`
815
+	Creator                    int64         `gorm:"column:creator" json:"creator"`
816
+	Modifier                   int64         `gorm:"column:modifier" json:"modifier"`
817
+	FinishCreator              int64         `gorm:"column:finish_creator" json:"finish_creator"`
818
+	FinishModifier             int64         `gorm:"column:finish_modifier" json:"finish_modifier"`
819
+	SchedualType               int64         `gorm:"column:schedual_type" json:"schedual_type"`
820
+	UserAdminRole              UserAdminRole `json:"role" gorm:"foreignkey:AdminUserId;AssociationForeignKey:StartNurse;"`
821
+	WashpipeNurse              int64         `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
822
+	ChangeNurse                int64         `gorm:"column:change_nurse" json:"change_nurse" form:"change_nurse"`
823
+	DifficultPunctureNurse     int64         `gorm:"column:difficult_puncture_nurse" json:"difficult_puncture_nurse" form:"difficult_puncture_nurse"`
824
+	NewFistulaNurse            int64         `gorm:"column:new_fistula_nurse" json:"new_fistula_nurse" form:"new_fistula_nurse"`
825
+	ZoneId                     int64         `gorm:"column:zone_id" json:"zone_id" form:"zone_id"`
826
+	PuncturePointHaematoma     int64         `gorm:"column:puncture_point_haematoma" json:"puncture_point_haematoma" form:"puncture_point_haematoma"`
827
+	BloodAccessInternalFistula string        `gorm:"column:blood_access_internal_fistula" json:"blood_access_internal_fistula" form:"blood_access_internal_fistula"`
828
+	Catheter                   string        `gorm:"column:catheter" json:"catheter" form:"catheter"`
829
+	Cruor                      string        `gorm:"column:cruor" json:"cruor" form:"cruor"`
825 830
 }
826 831
 
827 832
 func (DialysisOrder) TableName() string {
@@ -982,6 +987,7 @@ type SgjUserAdminRole struct {
982 987
 	OrgName       string `gorm:"column:org_name" json:"org_name" form:"org_name"`
983 988
 	OrgLogo       string `gorm:"column:org_logo" json:"org_logo" form:"org_logo"`
984 989
 	Creator       int64  `gorm:"column:creator" json:"creator" form:"creator"`
990
+	JobNumber     string `gorm:"column:job_number" json:"job_number" form:"job_number"`
985 991
 }
986 992
 
987 993
 func (SgjUserAdminRole) TableName() string {

+ 46 - 0
models/drug_stock.go View File

@@ -421,3 +421,49 @@ type DrugFlow struct {
421 421
 func (DrugFlow) TableName() string {
422 422
 	return "xt_drug_flow"
423 423
 }
424
+
425
+type DrugWarehouseOutInfoTenty struct {
426
+	ID                      int64       `gorm:"column:id" json:"id" form:"id"`
427
+	WarehouseOutId          int64       `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
428
+	DrugId                  int64       `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
429
+	WarehousingOutTarget    int64       `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
430
+	Count                   int64       `gorm:"column:count" json:"count" form:"count"`
431
+	CountUnit               string      `gorm:"column:count_unit" json:"count_unit" form:"count_unit"`
432
+	Price                   float64     `gorm:"column:price" json:"price" form:"price"`
433
+	TotalPrice              float64     `gorm:"column:total_price" json:"total_price" form:"total_price"`
434
+	ProductDate             int64       `gorm:"column:product_date" json:"product_date" form:"product_date"`
435
+	ExpiryDate              int64       `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
436
+	Mtime                   int64       `gorm:"column:mtime" json:"mtime" form:"mtime"`
437
+	Ctime                   int64       `gorm:"column:ctime" json:"ctime" form:"ctime"`
438
+	Status                  int64       `gorm:"column:status" json:"status" form:"status"`
439
+	OrgId                   int64       `gorm:"column:org_id" json:"org_id" form:"org_id"`
440
+	Remark                  string      `gorm:"column:remark" json:"remark" form:"remark"`
441
+	IsCancel                int64       `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
442
+	WarehouseOutOrderNumber string      `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
443
+	Type                    int64       `gorm:"column:type" json:"type" form:"type"`
444
+	Dealer                  int64       `gorm:"column:dealer" json:"dealer" form:"dealer"`
445
+	Manufacturer            int64       `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
446
+	IsSys                   int64       `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
447
+	SysRecordTime           int64       `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
448
+	RetailPrice             float64     `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
449
+	RetailTotalPrice        float64     `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
450
+	Number                  string      `gorm:"column:number" json:"number" form:"number"`
451
+	BatchNumber             string      `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
452
+	PatientId               int64       `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
453
+	WarehouseInfoId         int64       `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
454
+	AdviceId                int64       `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
455
+	SupplyCancelOutId       int64       `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
456
+	SupplyWarehouseId       int64       `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
457
+	IsSource                int64       `gorm:"column:is_source" json:"is_source" form:"is_source"`
458
+	StorehouseId            int64       `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
459
+	SecondWarehouseInfoId   int64       `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
460
+	AdminUserId             int64       `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
461
+	LastPrice               float64     `gorm:"column:last_price" json:"last_price" form:"last_price"`
462
+	StockCount              string      `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
463
+	PharmacyId              int64       `gorm:"column:pharmacy_id" json:"pharmacy_id" form:"pharmacy_id"`
464
+	BaseDrugLib             BaseDrugLib `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId"json:"drug" `
465
+}
466
+
467
+func (DrugWarehouseOutInfoTenty) TableName() string {
468
+	return "xt_drug_warehouse_out_info"
469
+}

+ 1 - 0
models/stock_models.go View File

@@ -1007,6 +1007,7 @@ type VmStockAdjustPrice struct {
1007 1007
 	UserName          string  `gorm:"column:user_name" json:"user_name" form:"user_name"`
1008 1008
 	Number            string  `gorm:"column:number" json:"number" form:"number"`
1009 1009
 	Total             int64   `gorm:"column:total" json:"total" form:"total"`
1010
+	StorehouseId      int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
1010 1011
 }
1011 1012
 
1012 1013
 type XtStockReportPrice struct {

+ 1 - 1
service/device_service.go View File

@@ -254,7 +254,7 @@ func GetDeviceCountForDeviceNumberID(orgID int64, deviceNumberID int64) (int, er
254 254
 
255 255
 func GetAllValidDeviceZones(orgID int64) ([]*models.DeviceZone, error) {
256 256
 	var zones []*models.DeviceZone
257
-	err := readDb.Model(&models.DeviceZone{}).Where("org_id = ? AND status = 1", orgID).Find(&zones).Error
257
+	err := readDb.Model(&models.DeviceZone{}).Where("org_id = ?", orgID).Find(&zones).Error
258 258
 	if err != nil {
259 259
 		return nil, err
260 260
 	}

+ 29 - 10
service/dialysis_service.go View File

@@ -264,7 +264,7 @@ func AddSigleAssessmentBeforeDislysisRecord(assessmentBeforeDislysis *models.Pre
264 264
 
265 265
 func AddSigleDoubleCheck(check *models.DoubleCheck) (err error) {
266 266
 	tx := writeDb.Begin()
267
-	errors := tx.Model(&models.PredialysisEvaluation{}).Create(&check).Error
267
+	errors := tx.Model(&models.DoubleCheck{}).Create(&check).Error
268 268
 	if err != nil {
269 269
 		tx.Rollback()
270 270
 	}
@@ -324,6 +324,12 @@ func UpdatePredialysisEvaluationThree(predialysisevaluation *models.PredialysisE
324 324
 	return err
325 325
 }
326 326
 
327
+func UpdatePredialysisEvaluationFour(predialysisevaluation *models.PredialysisEvaluation, id int64) error {
328
+
329
+	err := writeDb.Model(&predialysisevaluation).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"temperature": predialysisevaluation.Temperature}).Error
330
+	return err
331
+}
332
+
327 333
 //修改
328 334
 func UpdateSummeRecord(treatmentSummary *models.TreatmentSummary) error {
329 335
 	err := writeDb.Save(&treatmentSummary).Error
@@ -525,12 +531,18 @@ func CreateDialysisRecord(id int64, orgId int64, record *models.DialysisOrder) e
525 531
 	return nil
526 532
 }
527 533
 
528
-func ModifyDialysisRecord(id int64, finishNurse int64, end_time int64, admin_user_id int64) error {
529
-	err := writeDb.Model(&models.DialysisOrder{}).Where("id = ? AND status = 1 ", id).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "stage": 2, "finish_nurse": finishNurse, "end_time": end_time, "finish_creator": admin_user_id, "finish_modifier": admin_user_id}).Error
534
+func ModifyDialysisRecord(id int64, finishNurse int64, end_time int64, admin_user_id int64, puncture_point_haematoma int64, internal_fistula string, catheter string, cruor string) error {
535
+	err := writeDb.Model(&models.DialysisOrder{}).Where("id = ? AND status = 1 ", id).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "stage": 2, "finish_nurse": finishNurse, "end_time": end_time, "finish_creator": admin_user_id, "finish_modifier": admin_user_id, "puncture_point_haematoma": puncture_point_haematoma, "blood_access_internal_fistula": internal_fistula, "catheter": catheter, "cruor": cruor}).Error
530 536
 	return err
531 537
 
532 538
 }
533 539
 
540
+//func ModifyDialysisRecord(id int64, finishNurse int64, end_time int64, admin_user_id int64) error {
541
+//  err := writeDb.Model(&models.DialysisOrder{}).Where("id = ? AND status = 1 ", id).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "stage": 2, "finish_nurse": finishNurse, "end_time": end_time, "finish_creator": admin_user_id, "finish_modifier": admin_user_id}).Error
542
+//  return err
543
+//
544
+//}
545
+
534 546
 func UpdateSolutionByPatientId(id int64) error {
535 547
 	err := writeDb.Model(&models.Patients{}).Where("id = ? AND status = 1 ", id).UpdateColumn("total_dialysis", gorm.Expr("total_dialysis + ?", 1)).Error
536 548
 	return err
@@ -673,8 +685,8 @@ func GetDialysisSchedualsOne(orgID int64, scheduleDate int64) ([]*MDialysisSched
673 685
 	var vms []*MDialysisScheduleVM
674 686
 	db := readDb.
675 687
 		Table("xt_schedule").
676
-		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
677
-		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
688
+		Preload("DeviceNumber", "org_id = ?", orgID).
689
+		Preload("DeviceNumber.Zone", "org_id = ?", orgID).
678 690
 		//Preload("DialysisOrder", "status = 1 AND user_org_id = ? AND dialysis_date = ?", orgID, scheduleDate).
679 691
 		//Preload("AssessmentBeforeDislysis", "status = 1 AND user_org_id = ? AND  assessment_date = ?", orgID, scheduleDate).
680 692
 		//Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
@@ -699,7 +711,7 @@ func GetLastAcceptsAssessment(patient int64, orgId int64) (error, models.Receive
699 711
 func GetDialysisWatch(orgID int64, schedulDate int64, schedulType int64, partitionType int64, page int64, limit int64, start int64, end int64) (schedule []*models.DialysisSchedule, err error, total int64) {
700 712
 	db := readDb.Model(&models.MonitorDialysisSchedule{})
701 713
 	if start > 0 && end > 0 {
702
-		db = db.Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
714
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
703 715
 			Preload("TreatmentMode", "status = 1").
704 716
 			Preload("Prescription", "status = 1 AND user_org_id = ? and record_date>=? and record_date <=?", orgID, start, end).
705 717
 			Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ? and assessment_date >=? and assessment_date <=?", orgID, start, end).
@@ -712,7 +724,7 @@ func GetDialysisWatch(orgID int64, schedulDate int64, schedulType int64, partiti
712 724
 		db = db.Where("xt_schedule.status = 1 AND user_org_id = ?", orgID)
713 725
 	}
714 726
 	if schedulDate > 0 {
715
-		db = db.Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
727
+		db = db.Preload("DeviceNumber", "org_id = ?", orgID).
716 728
 			Preload("TreatmentMode", "status = 1").
717 729
 			Preload("Prescription", "status = 1 AND user_org_id = ? and record_date>=? and record_date <=?", orgID, schedulDate, schedulDate).
718 730
 			Preload("AssessmentBeforeDislysis", "status = 1 AND  user_org_id = ? and assessment_date >=? and assessment_date <=?", orgID, schedulDate, schedulDate).
@@ -735,7 +747,7 @@ func GetDialysisWatch(orgID int64, schedulDate int64, schedulType int64, partiti
735 747
 		db = db.Where("schedule_date <= ?", end)
736 748
 	}
737 749
 	if partitionType > 0 {
738
-		db = db.Joins("inner join xt_device_number on xt_device_number.id = xt_schedule.bed_id and xt_device_number.zone_id = ? and xt_device_number.status = 1", partitionType)
750
+		db = db.Joins("inner join xt_device_number on xt_device_number.id = xt_schedule.bed_id and xt_device_number.zone_id = ?", partitionType)
739 751
 		// db = db.Where("partition_id = ?", partitionType)
740 752
 	}
741 753
 	offset := (page - 1) * limit
@@ -803,7 +815,7 @@ func GetDialysisWatchByKeyword(orgID int64, keyword string, schedulType int64, p
803 815
 		db = db.Where("schedule_date<=?", end)
804 816
 	}
805 817
 	if partitionType > 0 {
806
-		db = db.Joins("inner join xt_device_number as d_n on d_n.id = xt_schedule.bed_id and d_n.zone_id = ? and d_n.status = 1", partitionType)
818
+		db = db.Joins("inner join xt_device_number as d_n on d_n.id = xt_schedule.bed_id and d_n.zone_id = ?", partitionType)
807 819
 		// db = db.Where("partition_id = ?", partitionType)
808 820
 	}
809 821
 	var schedules []*models.DialysisSchedule
@@ -1385,7 +1397,14 @@ func GetGoodInfoMation(orgid int64) (goodinfo []*models.GoodInfo, err error) {
1385 1397
 func GetGoodInfoMationSix(orgid int64, storehouse_id int64) (goodinfo []*models.GoodInfo, err error) {
1386 1398
 
1387 1399
 	err = XTReadDB().Model(&goodinfo).Where("org_id = ? and status = 1 AND  find_in_set('停用',good_status) = 0", orgid).Preload("GoodSotckInfo", "stock_count > 0 and status = 1 and storehouse_id = ?", storehouse_id).Find(&goodinfo).Error
1388
-	//err = XTReadDB().Model(&goodinfo).Where("org_id = ? and status = 1 AND  find_in_set('停用',good_status) = 0", orgid).Find(&goodinfo).Error
1400
+
1401
+	return goodinfo, err
1402
+}
1403
+
1404
+func GetGoodInfoMationSeven(orgid int64, storehouse_id int64) (goodinfo []*models.GoodInfo, err error) {
1405
+
1406
+	err = XTReadDB().Model(&goodinfo).Where("org_id = ? and status = 1 AND  find_in_set('停用',good_status) = 0", orgid).Preload("GoodSotckInfo", "status = 1 and storehouse_id = ?", storehouse_id).Find(&goodinfo).Error
1407
+
1389 1408
 	return goodinfo, err
1390 1409
 }
1391 1410
 

+ 34 - 0
service/drug_pharmacy_management_service.go View File

@@ -1597,3 +1597,37 @@ func GetLastHisPharmary(orgid int64, advice_id int64, record_date int64) (models
1597 1597
 
1598 1598
 	return pharmacy, err
1599 1599
 }
1600
+
1601
+func GetConfigSettingIsExsit(orgid int64) (*models.PharmacyConfig, error) {
1602
+
1603
+	var pharmacy models.PharmacyConfig
1604
+	var err error
1605
+	err = readDb.Model(&models.PharmacyConfig{}).Where("user_org_id=? and status = 1", orgid).First(&pharmacy).Error
1606
+	if err == gorm.ErrRecordNotFound {
1607
+		return nil, nil
1608
+	}
1609
+	if err != nil {
1610
+		return nil, err
1611
+	}
1612
+	return &pharmacy, nil
1613
+}
1614
+
1615
+func CreatePharmacyConfig(config *models.PharmacyConfig) error {
1616
+
1617
+	err := XTWriteDB().Create(&config).Error
1618
+	return err
1619
+}
1620
+
1621
+func UpdatePharmacyConfig(orgid int64, config *models.PharmacyConfig) error {
1622
+
1623
+	err := XTWriteDB().Model(&models.PharmacyConfig{}).Where("user_org_id = ? and status = 1", orgid).Update(map[string]interface{}{"is_open": config.IsOpen}).Error
1624
+	return err
1625
+}
1626
+
1627
+func GetPharmacyConfig(orgid int64) (models.PharmacyConfig, error) {
1628
+
1629
+	config := models.PharmacyConfig{}
1630
+	err := XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&config).Error
1631
+
1632
+	return config, err
1633
+}

+ 8 - 1
service/his_service.go View File

@@ -802,7 +802,14 @@ func GetAllDrugLibListSix(org_id int64, storehouse_id int64) (list []*BaseDrugLi
802 802
 		return db.Where("(status = 1 and stock_max_number > 0 and  storehouse_id = ? )  or  (status = 1  AND stock_min_number >0 and  storehouse_id = ?)", storehouse_id, storehouse_id)
803 803
 	}).Find(&list).Error
804 804
 
805
-	//err = readDb.Model(&BaseDrugLib{}).Where("org_id = ?  AND status = 1 AND  find_in_set('停用',drug_status) = 0", org_id).Find(&list).Error
805
+	return
806
+}
807
+
808
+func GetAllDrugLibListSeven(org_id int64, storehouse_id int64) (list []*BaseDrugLib, err error) {
809
+	err = readDb.Model(&BaseDrugLib{}).Where("org_id = ?  AND status = 1 AND  find_in_set('停用',drug_status) = 0", org_id).Preload("OtherDrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {
810
+		return db.Where("(status = 1  and  storehouse_id = ? )  or  (status = 1 and  storehouse_id = ?)", storehouse_id, storehouse_id)
811
+	}).Find(&list).Error
812
+
806 813
 	return
807 814
 }
808 815
 

+ 7 - 1
service/mobile_dialysis_service.go View File

@@ -2018,7 +2018,7 @@ func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2018 2018
 func ModifyFinishDialysisOrder(order *models.DialysisOrder) error {
2019 2019
 	tx := writeDb.Begin()
2020 2020
 	updateTime := time.Now().Unix()
2021
-	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"finish_nurse": order.FinishNurse, "updated_time": updateTime, "end_time": order.EndTime, "finish_modifier": order.FinishModifier}).Error
2021
+	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"finish_nurse": order.FinishNurse, "updated_time": updateTime, "end_time": order.EndTime, "finish_modifier": order.FinishModifier, "puncture_point_haematoma": order.PuncturePointHaematoma, "blood_access_internal_fistula": order.BloodAccessInternalFistula, "catheter": order.Catheter, "cruor": order.Cruor}).Error
2022 2022
 	if err != nil {
2023 2023
 		tx.Rollback()
2024 2024
 		return err
@@ -3619,3 +3619,9 @@ func GetMobileAutoReduce(orgID int64, scheduleDate int64) (auto []*models.Automa
3619 3619
 	err = readDb.Where("org_id = ? and status = 1 and record_time = ?", orgID, scheduleDate).Find(&auto).Error
3620 3620
 	return auto, err
3621 3621
 }
3622
+
3623
+func GetRoleList(orgid int64, admin_user_id int64) (models.SgjUserAdminRole, error) {
3624
+	role := models.SgjUserAdminRole{}
3625
+	err = readUserDb.Where("org_id = ? and admin_user_id = ? and status =1 ", orgid, admin_user_id).Find(&role).Error
3626
+	return role, err
3627
+}

+ 0 - 1
service/self_drug_service.go View File

@@ -1116,7 +1116,6 @@ func GetDrugInventoryDetailList(keyword string, page int64, limit int64, orgid i
1116 1116
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
1117 1117
 	}
1118 1118
 	err = db.Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.number,x.batch_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.drug_origin_place,x.expiry_date,x.product_date,x.min_count,x.storehouse_id,t.dose,t.dose_unit,t.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.last_stock_max_number,x.last_stock_min_number,x.inventory_type").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
1119
-	err = db.Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.number,x.batch_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.drug_origin_place,x.expiry_date,x.product_date,x.min_count,t.dose,t.dose_unit,t.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.last_stock_max_number,x.last_stock_min_number,x.inventory_type").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Order("x.ctime desc").Offset(offset).Limit(limit).Scan(&list).Error
1120 1119
 	return list, total, err
1121 1120
 }
1122 1121
 

+ 169 - 5
service/stock_service.go View File

@@ -2,6 +2,7 @@ package service
2 2
 
3 3
 import (
4 4
 	"XT_New/models"
5
+	"errors"
5 6
 	"fmt"
6 7
 	"github.com/jinzhu/gorm"
7 8
 	"strconv"
@@ -4687,6 +4688,12 @@ func GetDrugWarehouseOut(warehouse_out_id []string) (out []*models.StDrugWarehou
4687 4688
 	return out, err
4688 4689
 }
4689 4690
 
4691
+func GetDrugWarehouseOutTenty(warehouse_out_id []string) (out []*models.DrugWarehouseOutInfoTenty, err error) {
4692
+
4693
+	err = XTReadDB().Where("warehouse_out_id in(?)", warehouse_out_id).Preload("BaseDrugLib", "status = 1").Find(&out).Error
4694
+	return out, err
4695
+}
4696
+
4690 4697
 func GetLastGoodInformationByGoodId(goodid int64, warehouse_info_id int64, orgid_id int64) (models.WarehouseOutInfo, error) {
4691 4698
 
4692 4699
 	info := models.WarehouseOutInfo{}
@@ -5213,9 +5220,9 @@ func UpdatedDrugInfoOne(id int64, count int64) (err error) {
5213 5220
 	return err
5214 5221
 }
5215 5222
 
5216
-func UpdateWarehouseInfo(count int64, drugid int64, orgid int64) error {
5223
+func UpdateWarehouseInfo(count int64, drugid int64, orgid int64, warehouse_info_id int64) error {
5217 5224
 
5218
-	err := writeDb.Model(&models.XtDrugWarehouseInfo{}).Where("drug_id = ?  and org_id = ? and status = 1", drugid, orgid).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number + ?", count)).Error
5225
+	err := writeDb.Model(&models.XtDrugWarehouseInfo{}).Where("drug_id = ?  and org_id = ? and status = 1 and id = ?", drugid, orgid, warehouse_info_id).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number + ?", count)).Error
5219 5226
 
5220 5227
 	return err
5221 5228
 }
@@ -5227,9 +5234,9 @@ func UpdateWarehouseInfoTwo(count int64, drugid int64, orgid int64) error {
5227 5234
 	return err
5228 5235
 }
5229 5236
 
5230
-func UpdateWarehouseInfoOne(count int64, drugid int64, orgid int64) error {
5237
+func UpdateWarehouseInfoOne(count int64, drugid int64, orgid int64, warehouse_info_id int64) error {
5231 5238
 
5232
-	err := writeDb.Model(&models.XtDrugWarehouseInfo{}).Where("drug_id = ?  and org_id = ? and status = 1", drugid, orgid).UpdateColumn("stock_min_number", gorm.Expr("stock_min_number + ?", count)).Error
5239
+	err := writeDb.Model(&models.XtDrugWarehouseInfo{}).Where("drug_id = ?  and org_id = ? and status = 1 and id = ?", drugid, orgid, warehouse_info_id).UpdateColumn("stock_min_number", gorm.Expr("stock_min_number + ?", count)).Error
5233 5240
 	return err
5234 5241
 }
5235 5242
 
@@ -5712,7 +5719,6 @@ func GetInventoryDetailList(keyword string, limit int64, page int64, orgid int64
5712 5719
 		db = db.Where("x.storehouse_id = ?", storehouse_id)
5713 5720
 	}
5714 5721
 	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.number,x.expire_date,x.product_date,t.packing_unit,x.last_stock_count,x.type,x.inventory_type,x.stock_count,x.storehouse_id").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
5715
-	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.number,x.expire_date,x.product_date,t.packing_unit,x.last_stock_count,x.type,x.inventory_type,x.stock_count,x.ctime").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Order("x.ctime desc").Offset(offset).Limit(limit).Scan(&list).Error
5716 5722
 	return list, total, err
5717 5723
 }
5718 5724
 
@@ -6630,3 +6636,161 @@ func FindPrescriptionConfigById(orgid int64) (models.XtPrescriptionConfig, error
6630 6636
 
6631 6637
 	return config, err
6632 6638
 }
6639
+
6640
+func UpdateWarehouseInfoTwentyFive(maxNumber int64, drugid int64, orgID int64, storehouse_id int64, drup *models.XtBaseDrug) (err error) {
6641
+
6642
+	var deliver_number int64 = 0
6643
+	var stock_number int64 = 0
6644
+
6645
+	deliver_number = maxNumber
6646
+	// 根据先进先出原则,查询最先入库的批次,进行出库
6647
+	// 如果没有对应的库存,则报错
6648
+	//开启事物
6649
+
6650
+	warehouse, err := FindLastDrugWarehousingInfoByID(drugid, storehouse_id)
6651
+
6652
+	if err != nil {
6653
+		return err
6654
+	}
6655
+
6656
+	// 将该批次的剩余库存数量转换为拆零数量
6657
+	stock_number = warehouse.StockMaxNumber*drup.MinNumber + warehouse.StockMinNumber
6658
+
6659
+	// 当库存数量大于或等于出库数量的话,则正常出库该批次
6660
+	if stock_number >= deliver_number {
6661
+
6662
+		var maxNumber int64 = 0
6663
+		var minNumber int64 = 0
6664
+		var stock_max_number int64 = 0
6665
+		stock_max_number = warehouse.StockMaxNumber
6666
+
6667
+		maxNumber = deliver_number / drup.MinNumber
6668
+		minNumber = deliver_number % drup.MinNumber
6669
+
6670
+		if warehouse.StockMaxNumber == 0 && drup.MaxUnit == drup.MinUnit {
6671
+			minNumber = maxNumber
6672
+		}
6673
+
6674
+		if drup.MaxUnit != drup.MinUnit {
6675
+			if warehouse.StockMaxNumber < maxNumber && warehouse.StockMinNumber < minNumber {
6676
+				return errors.New("库存数量不足")
6677
+			}
6678
+		}
6679
+
6680
+		warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
6681
+
6682
+		if warehouse.StockMaxNumber < 0 {
6683
+			warehouse.StockMaxNumber = 0
6684
+		}
6685
+		if warehouse.StockMinNumber < 0 {
6686
+			warehouse.StockMinNumber = 0
6687
+		}
6688
+
6689
+		warehouse.Mtime = time.Now().Unix()
6690
+
6691
+		if warehouse.StockMinNumber < minNumber {
6692
+
6693
+			warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
6694
+			warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
6695
+		} else {
6696
+			if minNumber > 0 {
6697
+				if minNumber == 1 && maxNumber == 1 && drup.MaxUnit != drup.MinUnit {
6698
+					warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
6699
+				} else {
6700
+					warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
6701
+				}
6702
+			}
6703
+
6704
+			if minNumber == 0 && maxNumber != 1 {
6705
+				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
6706
+			}
6707
+
6708
+		}
6709
+
6710
+		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
6711
+			warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
6712
+			if warehouse.StockMinNumber == 0 {
6713
+				warehouse.StockMaxNumber = stock_max_number
6714
+			}
6715
+		}
6716
+
6717
+		if drup.MaxUnit != drup.MinUnit {
6718
+			if warehouse.StockMaxNumber < 0 && warehouse.StockMinNumber < 0 {
6719
+				return errors.New("库存数量不足")
6720
+			}
6721
+		}
6722
+		if warehouse.StockMinNumber <= 0 {
6723
+			warehouse.StockMinNumber = 0
6724
+		}
6725
+
6726
+		errThree := UpDateDrugWarehouseInfoByStock(&warehouse)
6727
+		fmt.Println(errThree)
6728
+
6729
+		//查询默认仓库
6730
+		houseConfig, _ := GetAllStoreHouseConfig(orgID)
6731
+		//查询默认仓库剩余多少库存
6732
+		list, _ := GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, orgID, warehouse.DrugId)
6733
+		var sum_count int64
6734
+		var sum_in_count int64
6735
+		for _, it := range list {
6736
+			baseDrug, _ := GetBaseDrugMedical(it.DrugId)
6737
+			if it.MaxUnit == baseDrug.MaxUnit {
6738
+				it.StockMaxNumber = it.StockMaxNumber * baseDrug.MinNumber
6739
+				it.WarehousingCount = it.WarehousingCount * baseDrug.MinNumber
6740
+				sum_count += it.StockMaxNumber + it.StockMinNumber
6741
+				sum_in_count += it.WarehousingCount
6742
+			}
6743
+		}
6744
+		UpdateMedicalSumCount(warehouse.DrugId, sum_count, sum_in_count, orgID)
6745
+
6746
+		return nil
6747
+
6748
+	} else {
6749
+
6750
+		warehouse.StockMaxNumber = 0
6751
+		warehouse.StockMinNumber = 0
6752
+		warehouse.Mtime = time.Now().Unix()
6753
+
6754
+		errThree := UpDateDrugWarehouseInfoByStock(&warehouse)
6755
+		fmt.Println(errThree)
6756
+
6757
+		//查询默认仓库
6758
+		houseConfig, _ := GetAllStoreHouseConfig(orgID)
6759
+		//查询默认仓库剩余多少库存
6760
+		list, _ := GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, orgID, warehouse.DrugId)
6761
+		var sum_count int64
6762
+		var sum_in_count int64
6763
+		for _, it := range list {
6764
+			baseDrug, _ := GetBaseDrugMedical(it.DrugId)
6765
+			if it.MaxUnit == baseDrug.MaxUnit {
6766
+				it.StockMaxNumber = it.StockMaxNumber * baseDrug.MinNumber
6767
+				it.WarehousingCount = it.WarehousingCount * baseDrug.MinNumber
6768
+				sum_count += it.StockMaxNumber + it.StockMinNumber
6769
+				sum_in_count += it.WarehousingCount
6770
+			}
6771
+		}
6772
+		UpdateMedicalSumCount(warehouse.DrugId, sum_count, sum_in_count, orgID)
6773
+		if errThree != nil {
6774
+			return errThree
6775
+		}
6776
+		// 清零完该库存后,还有剩余出库未出完,进行对应的递归操作
6777
+		prescribingNumber_two_temp := deliver_number - stock_number
6778
+
6779
+		UpdateWarehouseInfoTwentyFive(prescribingNumber_two_temp, drugid, orgID, storehouse_id, drup)
6780
+	}
6781
+	return
6782
+}
6783
+
6784
+func UpdateWarehouseInfoTentyFour(count int64, id int64) error {
6785
+
6786
+	err := writeDb.Model(&models.XtDrugWarehouseInfo{}).Where("id = ? status = 1", id).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number - ?", count)).Error
6787
+
6788
+	return err
6789
+}
6790
+
6791
+func UpdateWarehouseInfoTentyThree(count int64, id int64) error {
6792
+
6793
+	err := writeDb.Model(&models.XtDrugWarehouseInfo{}).Where("id = ? status = 1", id).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number - ?", count)).Error
6794
+
6795
+	return err
6796
+}