28169 4 hafta önce
ebeveyn
işleme
d1488ad0b6

+ 10 - 10
controllers/base_api_controller.go Dosyayı Görüntüle

@@ -72,10 +72,10 @@ func (this *BaseAuthAPIController) Prepare() {
72 72
 	this.BaseAPIController.Prepare()
73 73
 	if this.GetAdminUserInfo() == nil {
74 74
 		var userAdmin models.AdminUser
75
-		userAdmin.Id = 5386
75
+		userAdmin.Id = 2301
76 76
 		userAdmin.Mobile = "13318599895"
77 77
 
78
-		userAdmin.Id = 5386 //4,809
78
+		userAdmin.Id = 2301 //4,809
79 79
 		userAdmin.Mobile = "12222222222"
80 80
 		userAdmin.IsSuperAdmin = true
81 81
 		userAdmin.Status = 1
@@ -83,7 +83,7 @@ func (this *BaseAuthAPIController) Prepare() {
83 83
 		userAdmin.ModifyTime = 1530786071
84 84
 		var subscibe models.ServeSubscibe
85 85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10727 //机构id
86
+		subscibe.OrgId = 10402 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,8 +93,8 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94 94
 		subscibes[4] = &subscibe
95 95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10727 //机构id小英9675或4
97
-		adminUserInfo.CurrentAppId = 18470 //4
96
+		adminUserInfo.CurrentOrgId = 10402 //机构id小英9675或4
97
+		adminUserInfo.CurrentAppId = 12123 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
100 100
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -318,10 +318,10 @@ func (this *BaseServeAPIController) Prepare() {
318 318
 	this.BaseAPIController.Prepare()
319 319
 	if this.GetAdminUserInfo() == nil {
320 320
 		var userAdmin models.AdminUser
321
-		userAdmin.Id = 5386
321
+		userAdmin.Id = 2301
322 322
 		userAdmin.Mobile = "13318599895"
323 323
 
324
-		userAdmin.Id = 5386 //4,809
324
+		userAdmin.Id = 2301 //4,809
325 325
 		userAdmin.Mobile = "12222222222"
326 326
 		userAdmin.IsSuperAdmin = false
327 327
 		userAdmin.Status = 1
@@ -329,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
329 329
 		userAdmin.ModifyTime = 1530786071
330 330
 		var subscibe models.ServeSubscibe
331 331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10727 //机构id小英9675或4
332
+		subscibe.OrgId = 10402 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,8 +339,8 @@ func (this *BaseServeAPIController) Prepare() {
339 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340 340
 		subscibes[4] = &subscibe
341 341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10727 //机构id小英9675或4
343
-		adminUserInfo.CurrentAppId = 18470 //4
342
+		adminUserInfo.CurrentOrgId = 10402 //机构id小英9675或4
343
+		adminUserInfo.CurrentAppId = 12123 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes
346 346
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 43 - 1
controllers/his_api_controller.go Dosyayı Görüntüle

@@ -3386,7 +3386,7 @@ func (c *HisApiController) CreateHisPrescription() {
3386 3386
 	var adviceList []models.HisDoctorAdviceInfo
3387 3387
 	var projectList []models.HisPrescriptionProject
3388 3388
 
3389
-	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 || adminInfo.CurrentOrgId == 10726 || adminInfo.CurrentOrgId == 10731 || adminInfo.CurrentOrgId == 10571 || adminInfo.CurrentOrgId == 10724 {
3389
+	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 || adminInfo.CurrentOrgId == 10726 || adminInfo.CurrentOrgId == 10731 || adminInfo.CurrentOrgId == 10571 || adminInfo.CurrentOrgId == 10724 || adminInfo.CurrentOrgId == 9671 {
3390 3390
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3391 3391
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3392 3392
 
@@ -3888,6 +3888,26 @@ func (c *HisApiController) CreateHisPrescription() {
3888 3888
 
3889 3889
 										drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
3890 3890
 
3891
+										if drugMedical.SumCount == 0 {
3892
+											tx.Rollback()
3893
+											c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
3894
+											return
3895
+
3896
+										}
3897
+									}
3898
+									if s.ID > 0 {
3899
+										//查询改药品是否已经停用
3900
+										base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
3901
+
3902
+										if base.ID > 0 {
3903
+											tx.Rollback()
3904
+											c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
3905
+											return
3906
+
3907
+										}
3908
+
3909
+										drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
3910
+
3891 3911
 										if drugMedical.SumCount == 0 {
3892 3912
 											tx.Rollback()
3893 3913
 											c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
@@ -4020,6 +4040,28 @@ func (c *HisApiController) CreateHisPrescription() {
4020 4040
 											}
4021 4041
 										}
4022 4042
 
4043
+										if p.ID > 0 {
4044
+											//查询该耗材是否停用
4045
+											goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
4046
+											//表示该耗材已经停用,不能保存
4047
+											if goodInfoSeven.ID == 0 {
4048
+												tx.Rollback()
4049
+												goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
4050
+												c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
4051
+
4052
+												return
4053
+
4054
+											}
4055
+
4056
+											goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
4057
+											if goodInfoOne.SumCount == 0 {
4058
+												tx.Rollback()
4059
+												c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
4060
+
4061
+												return
4062
+											}
4063
+										}
4064
+
4023 4065
 									}
4024 4066
 								}
4025 4067
 

+ 10 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Dosyayı Görüntüle

@@ -930,6 +930,10 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
930 930
 				evaluation.DialysisCount = lastPredialysisEvaluation.DialysisCount             //呼吸频次
931 931
 				evaluation.Phinholing = lastPredialysisEvaluation.Phinholing                   //针眼
932 932
 
933
+				if adminUserInfo.Org.Id == 10702 {
934
+					evaluation.PreDialysisDrugs = "无"
935
+				}
936
+
933 937
 				evaluation.Remark = lastPredialysisEvaluation.Remark
934 938
 				if adminUserInfo.Org.Id == 10318 || adminUserInfo.Org.Id == 10490 || adminUserInfo.Org.Id == 10016 {
935 939
 					evaluation.Remark = ""
@@ -988,6 +992,12 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
988 992
 			service.UpdateMobileGetDialysisPrescribeOne(lastDialysisPrescription.ID, dewater_amount)
989 993
 		}
990 994
 
995
+		if adminUserInfo.Org.Id == 10206 {
996
+			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
997
+			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
998
+			service.UpdateMobileGetDialysisPrescribeOne(lastDialysisPrescription.ID, dewater_amount)
999
+		}
1000
+
991 1001
 		err := service.UpadatePredialysisEvaluation(&evaluation)
992 1002
 
993 1003
 		//记录日志

+ 80 - 53
controllers/mobile_api_controllers/dialysis_api_controller.go Dosyayı Görüntüle

@@ -3013,70 +3013,78 @@ func (c *DialysisAPIController) Finish() {
3013 3013
 
3014 3014
 	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10693 || adminUserInfo.Org.Id == 10702 {
3015 3015
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3016
-		if evaluation.SystolicBloodPressure == 0 {
3017
-			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
3018 3016
 
3019
-			if adminUserInfo.Org.Id == 10693 {
3020
-				SystolicBloodPressureOne, _ := strconv.ParseFloat(fmonitorRecords.MonitorSystolicBloodPressureOne, 64)
3021
-				evaluation.SystolicBloodPressure = SystolicBloodPressureOne
3022
-			}
3017
+		if adminUserInfo.Org.Id != 10702 {
3018
+			if evaluation.SystolicBloodPressure == 0 {
3019
+				evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
3023 3020
 
3024
-			pre := models.PredialysisEvaluation{
3025
-				SystolicBloodPressure: evaluation.SystolicBloodPressure,
3026
-			}
3027
-			fmt.Println("prew", pre)
3028
-			getNurseErr := service.UpdatePredialysisEvaluation(&pre, evaluation.ID)
3029
-			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
3030
-			keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
3021
+				if adminUserInfo.Org.Id == 10693 {
3022
+					SystolicBloodPressureOne, _ := strconv.ParseFloat(fmonitorRecords.MonitorSystolicBloodPressureOne, 64)
3023
+					evaluation.SystolicBloodPressure = SystolicBloodPressureOne
3024
+				}
3031 3025
 
3032
-			redis := service.RedisClient()
3033
-			redis.Set(key, "", time.Second)
3034
-			redis.Set(keyOne, "", time.Second)
3035
-			defer redis.Close()
3036
-			fmt.Println(getNurseErr)
3026
+				pre := models.PredialysisEvaluation{
3027
+					SystolicBloodPressure: evaluation.SystolicBloodPressure,
3028
+				}
3029
+				fmt.Println("prew", pre)
3030
+				getNurseErr := service.UpdatePredialysisEvaluation(&pre, evaluation.ID)
3031
+				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
3032
+				keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
3033
+
3034
+				redis := service.RedisClient()
3035
+				redis.Set(key, "", time.Second)
3036
+				redis.Set(keyOne, "", time.Second)
3037
+				defer redis.Close()
3038
+				fmt.Println(getNurseErr)
3039
+			}
3037 3040
 		}
3038 3041
 
3039
-		if evaluation.DiastolicBloodPressure == 0 {
3040
-			evaluation.DiastolicBloodPressure = fmonitorRecords.DiastolicBloodPressure
3042
+		if adminUserInfo.Org.Id != 10702 {
3043
+			if evaluation.DiastolicBloodPressure == 0 {
3044
+				evaluation.DiastolicBloodPressure = fmonitorRecords.DiastolicBloodPressure
3041 3045
 
3042
-			if adminUserInfo.Org.Id == 10693 {
3043
-				DiastolicBloodPressureOne, _ := strconv.ParseFloat(fmonitorRecords.MonitorDiastolicBloodPressureOne, 64)
3044
-				evaluation.DiastolicBloodPressure = DiastolicBloodPressureOne
3045
-			}
3046
-			pres := models.PredialysisEvaluation{
3047
-				DiastolicBloodPressure: evaluation.DiastolicBloodPressure,
3048
-			}
3046
+				if adminUserInfo.Org.Id == 10693 {
3047
+					DiastolicBloodPressureOne, _ := strconv.ParseFloat(fmonitorRecords.MonitorDiastolicBloodPressureOne, 64)
3048
+					evaluation.DiastolicBloodPressure = DiastolicBloodPressureOne
3049
+				}
3050
+				pres := models.PredialysisEvaluation{
3051
+					DiastolicBloodPressure: evaluation.DiastolicBloodPressure,
3052
+				}
3049 3053
 
3050
-			getNurseErr := service.UpdatePredialysisEvaluationTwo(&pres, evaluation.ID)
3051
-			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
3054
+				getNurseErr := service.UpdatePredialysisEvaluationTwo(&pres, evaluation.ID)
3055
+				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
3052 3056
 
3053
-			redis := service.RedisClient()
3054
-			redis.Set(key, "", time.Second)
3057
+				redis := service.RedisClient()
3058
+				redis.Set(key, "", time.Second)
3055 3059
 
3056
-			keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
3057
-			redis.Set(keyOne, "", time.Second)
3058
-			defer redis.Close()
3059
-			fmt.Println(getNurseErr)
3060
+				keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
3061
+				redis.Set(keyOne, "", time.Second)
3062
+				defer redis.Close()
3063
+				fmt.Println(getNurseErr)
3064
+			}
3060 3065
 		}
3061
-		if evaluation.PulseFrequency == 0 {
3062
-			evaluation.PulseFrequency = fmonitorRecords.PulseFrequency
3063 3066
 
3064
-			if adminUserInfo.Org.Id == 10693 {
3065
-				pulseFrequency, _ := strconv.ParseFloat(endmonitorRecords.MonitorPulseFrequencyOne, 64)
3066
-				evaluation.PulseFrequency = pulseFrequency
3067
-			}
3068
-			press := models.PredialysisEvaluation{
3069
-				PulseFrequency: evaluation.PulseFrequency,
3070
-			}
3071
-			getNurseErr := service.UpdatePredialysisEvaluationThree(&press, evaluation.ID)
3072
-			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
3067
+		if adminUserInfo.Org.Id != 10702 {
3068
+			if evaluation.PulseFrequency == 0 {
3069
+				evaluation.PulseFrequency = fmonitorRecords.PulseFrequency
3073 3070
 
3074
-			redis := service.RedisClient()
3075
-			redis.Set(key, "", time.Second)
3076
-			keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
3077
-			redis.Set(keyOne, "", time.Second)
3078
-			defer redis.Close()
3079
-			fmt.Println(getNurseErr)
3071
+				if adminUserInfo.Org.Id == 10693 {
3072
+					pulseFrequency, _ := strconv.ParseFloat(endmonitorRecords.MonitorPulseFrequencyOne, 64)
3073
+					evaluation.PulseFrequency = pulseFrequency
3074
+				}
3075
+				press := models.PredialysisEvaluation{
3076
+					PulseFrequency: evaluation.PulseFrequency,
3077
+				}
3078
+				getNurseErr := service.UpdatePredialysisEvaluationThree(&press, evaluation.ID)
3079
+				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
3080
+
3081
+				redis := service.RedisClient()
3082
+				redis.Set(key, "", time.Second)
3083
+				keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
3084
+				redis.Set(keyOne, "", time.Second)
3085
+				defer redis.Close()
3086
+				fmt.Println(getNurseErr)
3087
+			}
3080 3088
 		}
3081 3089
 
3082 3090
 		if evaluation.Temperature == 0 {
@@ -3945,6 +3953,13 @@ func (this *DialysisAPIController) StartDialysis() {
3945 3953
 
3946 3954
 			}
3947 3955
 
3956
+			if adminUserInfo.Org.Id == 10206 {
3957
+				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60)
3958
+				ultrafiltration_rate = ultrafiltration_rate
3959
+
3960
+				ultrafiltration_rate_one = strconv.FormatFloat(ultrafiltration_rate, 'f', -1, 64)
3961
+			}
3962
+
3948 3963
 			if adminUserInfo.Org.Id == 10694 || adminUserInfo.Org.Id == 10697 {
3949 3964
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3950 3965
 				ultrafiltration_rate = ultrafiltration_rate
@@ -5181,7 +5196,12 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5181 5196
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
5182 5197
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5183 5198
 
5184
-				fmt.Println("record.UltrafiltrationRate ------------------------", record.UltrafiltrationRate)
5199
+			}
5200
+
5201
+			if adminInfo.Org.Id == 10206 {
5202
+				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
5203
+				fmt.Println("ultrafiltration_rate------------------", ultrafiltration_rate)
5204
+				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5185 5205
 			}
5186 5206
 			//if template.TemplateId == 47 {
5187 5207
 			//	ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
@@ -5273,6 +5293,13 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5273 5293
 
5274 5294
 	}
5275 5295
 
5296
+	if adminInfo.Org.Id == 10206 {
5297
+		if ultrafiltration_rate > 0 {
5298
+			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5299
+			record.UltrafiltrationVolume = ultrafiltration_volume / 1000
5300
+		}
5301
+	}
5302
+
5276 5303
 	if adminInfo.Org.Id == 10721 {
5277 5304
 		var replacement_rate float64
5278 5305
 		var displacement_quantity float64

+ 1 - 1
controllers/mobile_api_controllers/patient_api_controller.go Dosyayı Görüntüle

@@ -4231,7 +4231,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
4231 4231
 	}
4232 4232
 
4233 4233
 	//古镇乐生
4234
-	if adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10731 {
4234
+	if adminUserInfo.Org.Id == 10731 {
4235 4235
 		if evaluation.ID == 0 {
4236 4236
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4237 4237
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {

+ 6 - 6
controllers/patient_api_controller.go Dosyayı Görüntüle

@@ -4062,12 +4062,12 @@ func (c *PatientApiController) UpdateDoctorAdvice() {
4062 4062
 	//	return
4063 4063
 	//}
4064 4064
 
4065
-	if adminUserInfo.CurrentOrgId != 10612 && adminUserInfo.CurrentOrgId != 10460 {
4066
-		if advice.StopState == 1 || advice.ExecutionState == 1 {
4067
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceStoped)
4068
-			return
4069
-		}
4070
-	}
4065
+	//if adminUserInfo.CurrentOrgId != 10612 && adminUserInfo.CurrentOrgId != 10460 {
4066
+	//	if advice.StopState == 1 || advice.ExecutionState == 1 {
4067
+	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceStoped)
4068
+	//		return
4069
+	//	}
4070
+	//}
4071 4071
 
4072 4072
 	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
4073 4073
 

+ 18 - 45
controllers/stock_in_api_controller.go Dosyayı Görüntüle

@@ -1258,6 +1258,20 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1258 1258
 		return
1259 1259
 	}
1260 1260
 
1261
+	if warehouseOut_id == 0 {
1262
+		//查询是否生成出库单
1263
+		warehouseOutObj, _ := service.FindStockOutByIsSys(adminUserInfo.CurrentOrgId, 0, operation_time)
1264
+
1265
+		if warehouseOutObj.ID == 0 {
1266
+			service.AddSigleWarehouseOut(&warehouseOut)
1267
+		}
1268
+
1269
+	}
1270
+
1271
+	if warehouseOut_id > 0 {
1272
+		service.UpdateSingleWarehoseOut(warehouseOut_id, storehouse_id)
1273
+	}
1274
+
1261 1275
 	var warehousingOutInfo []*models.WarehouseOutInfo
1262 1276
 
1263 1277
 	if dataBody["stockOut"] != nil && reflect.TypeOf(dataBody["stockOut"]).String() == "[]interface {}" {
@@ -1392,17 +1406,6 @@ func (c *StockManagerApiController) CreateWarehouseOut() {
1392 1406
 			}
1393 1407
 		}
1394 1408
 	}
1395
-	if warehouseOut_id == 0 {
1396
-		//查询是否生成出库单
1397
-		_, errcodes := service.FindStockOutByIsSys(adminUserInfo.CurrentOrgId, 0, operation_time)
1398
-		if errcodes == gorm.ErrRecordNotFound {
1399
-			service.AddSigleWarehouseOut(&warehouseOut)
1400
-		}
1401
-	}
1402
-
1403
-	if warehouseOut_id > 0 {
1404
-		service.UpdateSingleWarehoseOut(warehouseOut_id, storehouse_id)
1405
-	}
1406 1409
 
1407 1410
 	goodWarehouseOut, _ := service.GetLastGoodWarehouseOutTwenty(adminUserInfo.CurrentOrgId)
1408 1411
 
@@ -7237,41 +7240,11 @@ func (this *StockManagerApiController) CheckWarehouseOut() {
7237 7240
 	id, _ := this.GetInt64("id")
7238 7241
 	orgId := this.GetAdminUserInfo().CurrentOrgId
7239 7242
 	creater := this.GetAdminUserInfo().AdminUser.Id
7240
-	warehouseOut, errcode := service.GetWarehouseById(id)
7241
-	if errcode != nil {
7242
-		goodErrcode := models.XtGoodErrcode{
7243
-			UserOrgId:      orgId,
7244
-			Errcode:        "查询审核出库单报错",
7245
-			GoodId:         0,
7246
-			Status:         0,
7247
-			Ctime:          0,
7248
-			Mtime:          0,
7249
-			Count:          0,
7250
-			StockCount:     0,
7251
-			Creater:        creater,
7252
-			BatchNumberId:  0,
7253
-			WarehouseOutId: 0,
7254
-		}
7255
-		service.CreateGoodErrcode(goodErrcode)
7256
-	}
7243
+	warehouseOut, _ := service.GetWarehouseById(id)
7244
+
7257 7245
 	//查询已保存的单据
7258
-	warehousingOutInfo, erroce := service.GetWarehouseOutById(id, orgId)
7259
-	if erroce != nil {
7260
-		goodErrcode := models.XtGoodErrcode{
7261
-			UserOrgId:      orgId,
7262
-			Errcode:        "查询已审核出库详情单报错",
7263
-			GoodId:         0,
7264
-			Status:         0,
7265
-			Ctime:          0,
7266
-			Mtime:          0,
7267
-			Count:          0,
7268
-			StockCount:     0,
7269
-			Creater:        creater,
7270
-			BatchNumberId:  0,
7271
-			WarehouseOutId: 0,
7272
-		}
7273
-		service.CreateGoodErrcode(goodErrcode)
7274
-	}
7246
+	warehousingOutInfo, _ := service.GetWarehouseOutById(id, orgId)
7247
+
7275 7248
 	////出库逻辑
7276 7249
 	for _, item := range warehousingOutInfo {
7277 7250
 		// 查询该耗材是否有库存

+ 2 - 2
service/his_service.go Dosyayı Görüntüle

@@ -155,7 +155,7 @@ func GetScheduleHisPatientList(org_id int64, keywords string, record_date int64,
155 155
 
156 156
 	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
157 157
 	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date)
158
-	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date).Group("xt_patients.id").Order("sch_type").Find(&patients).Error
158
+	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date).Group("xt_patients.id").Find(&patients).Error
159 159
 	return
160 160
 }
161 161
 
@@ -164,7 +164,7 @@ func GetScheduleHisPatientListTwo(org_id int64, record_date int64) (patients []*
164 164
 
165 165
 	db = db.Preload("HisPatient", "user_org_id = ? AND status = 1 AND record_date = ?", org_id, record_date)
166 166
 	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date)
167
-	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date).Group("xt_patients.id").Order("sch_type").Find(&patients).Error
167
+	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date).Group("xt_patients.id").Find(&patients).Error
168 168
 	return
169 169
 }
170 170
 

+ 19 - 7
service/self_drug_service.go Dosyayı Görüntüle

@@ -1258,14 +1258,26 @@ func GetDamageByDrugId(drugid int64, warhousingorder string, drugtype int64) (dr
1258 1258
 
1259 1259
 func GetInventoryModeList(orgid int64) (info []*models.PatientDrugWarehouseInfo, err error) {
1260 1260
 
1261
-	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1 and (x.warehousing_count>0)")
1262
-	table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
1263
-	fmt.Println(table)
1264
-	if orgid > 0 {
1265
-		db = db.Where("x.org_id = ?", orgid)
1261
+	if orgid == 10653 {
1262
+		db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1 and (x.warehousing_count>0) and (x.stock_max_number>0 or x.stock_min_number>0)")
1263
+		table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
1264
+		fmt.Println(table)
1265
+		if orgid > 0 {
1266
+			db = db.Where("x.org_id = ?", orgid)
1267
+		}
1268
+		err = db.Select("x.drug_id,x.number,x.product_date,x.expiry_date,x.stock_max_number,x.stock_min_number,x.batch_number,t.drug_name,t.max_unit,t.min_unit,t.min_number,t.dose,t.dose_unit,x.manufacturer,x.dealer,t.sum_count").Joins("left join xt_base_drug as t on t.id = x.drug_id").Group("x.drug_id,x.batch_number").Scan(&info).Error
1269
+		return info, err
1270
+	} else {
1271
+		db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1 and (x.warehousing_count>0)")
1272
+		table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
1273
+		fmt.Println(table)
1274
+		if orgid > 0 {
1275
+			db = db.Where("x.org_id = ?", orgid)
1276
+		}
1277
+		err = db.Select("x.drug_id,x.number,x.product_date,x.expiry_date,x.stock_max_number,x.stock_min_number,x.batch_number,t.drug_name,t.max_unit,t.min_unit,t.min_number,t.dose,t.dose_unit,x.manufacturer,x.dealer,t.sum_count").Joins("left join xt_base_drug as t on t.id = x.drug_id").Group("x.drug_id,x.batch_number").Scan(&info).Error
1278
+		return info, err
1266 1279
 	}
1267
-	err = db.Select("x.drug_id,x.number,x.product_date,x.expiry_date,x.stock_max_number,x.stock_min_number,x.batch_number,t.drug_name,t.max_unit,t.min_unit,t.min_number,t.dose,t.dose_unit,x.manufacturer,x.dealer,t.sum_count").Joins("left join xt_base_drug as t on t.id = x.drug_id").Group("x.drug_id,x.batch_number").Scan(&info).Error
1268
-	return info, err
1280
+
1269 1281
 }
1270 1282
 
1271 1283
 func GetManufacturerListByKeyword(orgid int64, keyword string) (list []*models.BloodManufacturer, err error) {

+ 19 - 7
service/stock_service.go Dosyayı Görüntüle

@@ -6945,14 +6945,26 @@ func UpdatedGoodInfo(info models.GoodInfo, goodid int64) error {
6945 6945
 
6946 6946
 func GetInventoryExportList(orgid int64) (info []*models.PatientWarehouseInfo, err error) {
6947 6947
 
6948
-	db := XTReadDB().Table("xt_warehouse_info as x").Where("x.status = 1 and x.warehousing_count>0")
6949
-	table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
6950
-	fmt.Println(table)
6951
-	if orgid > 0 {
6952
-		db = db.Where("x.org_id = ?", orgid)
6948
+	if orgid == 10653 {
6949
+		db := XTReadDB().Table("xt_warehouse_info as x").Where("x.status = 1 and x.warehousing_count>0 and x.stock_count>0")
6950
+		table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
6951
+		fmt.Println(table)
6952
+		if orgid > 0 {
6953
+			db = db.Where("x.org_id = ?", orgid)
6954
+		}
6955
+		err = db.Select("x.id,x.good_id,x.number,x.number,x.product_date,x.expiry_date,x.warehousing_unit,x.dealer,x.manufacturer,t.good_name,t.specification_name,t.packing_unit,t.remark").Joins("left join xt_good_information as t on t.id = x.good_id").Group("x.good_id,x.number").Scan(&info).Error
6956
+		return info, err
6957
+	} else {
6958
+		db := XTReadDB().Table("xt_warehouse_info as x").Where("x.status = 1 and x.warehousing_count>0")
6959
+		table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
6960
+		fmt.Println(table)
6961
+		if orgid > 0 {
6962
+			db = db.Where("x.org_id = ?", orgid)
6963
+		}
6964
+		err = db.Select("x.id,x.good_id,x.number,x.number,x.product_date,x.expiry_date,x.warehousing_unit,x.dealer,x.manufacturer,t.good_name,t.specification_name,t.packing_unit,t.remark").Joins("left join xt_good_information as t on t.id = x.good_id").Group("x.good_id,x.number").Scan(&info).Error
6965
+		return info, err
6953 6966
 	}
6954
-	err = db.Select("x.id,x.good_id,x.number,x.number,x.product_date,x.expiry_date,x.warehousing_unit,x.dealer,x.manufacturer,t.good_name,t.specification_name,t.packing_unit,t.remark").Joins("left join xt_good_information as t on t.id = x.good_id").Group("x.good_id,x.number").Scan(&info).Error
6955
-	return info, err
6967
+
6956 6968
 }
6957 6969
 
6958 6970
 func UpdateDrugWarehouseingInfoSix(id int64, info models.XtDrugWarehouseInfo) error {

+ 0 - 1
service/warhouse_service.go Dosyayı Görüntüle

@@ -8860,7 +8860,6 @@ func ConsumableNewHisPrescriptionDelivery(orgID int64, patient_id int64, record_
8860 8860
 		ProjectId:    goods.ProjectId,
8861 8861
 	}
8862 8862
 	CreatedDialysisPrepare(autoMatic, tx)
8863
-
8864 8863
 	goods.Count = deliver_number - stock_number
8865 8864
 	ConsumableNewHisPrescriptionDelivery(orgID, patient_id, record_time, dialyPrepareOne, warehouseOut, creator, tx)
8866 8865