28169 1 settimana fa
parent
commit
5c66eac9e2

BIN
XT_New.exe Vedi File


+ 182 - 0
controllers/dialysis_api_controller.go Vedi File

@@ -711,6 +711,41 @@ func (c *DialysisApiController) PostPrescription() {
711 711
 
712 712
 		err := service.AddSigleRecord(&prescription)
713 713
 
714
+		if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 {
715
+
716
+			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
717
+
718
+			if len(monitorList) > 0 {
719
+				var ultrafiltration_rate float64
720
+				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
721
+
722
+				ultrafiltration_rate = (math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)) / 1000
723
+				var replacement_rate float64
724
+
725
+				//乘10 除10是为了保留一位小数
726
+				replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
727
+
728
+				var firstOpeateTime = monitorList[0].OperateTime
729
+				for _, item := range monitorList {
730
+					//超滤率
731
+					service.ModifyDialysisPatientMonitor(item.ID, ultrafiltration_rate)
732
+
733
+					//置换率
734
+					service.ModifyDialysisPatientReplascementRate(item.ID, replacement_rate)
735
+
736
+					//超滤量
737
+					ultrafiltration_volume := math.Floor(float64(item.OperateTime-firstOpeateTime)/3600) * ultrafiltration_rate
738
+					service.ModifyPatientUltrafiltrationVolume(item.ID, ultrafiltration_volume)
739
+
740
+					//置换量
741
+					displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
742
+
743
+					service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
744
+
745
+				}
746
+			}
747
+
748
+		}
714 749
 		//记录日志
715 750
 		byterequest, _ := json.Marshal(prescription)
716 751
 		dialysisPrescriptionLog := models.XtDialysisPrescriptionLog{
@@ -849,6 +884,42 @@ func (c *DialysisApiController) PostPrescription() {
849 884
 
850 885
 		updateErr := service.UpDateDialysisPrescription(&prescription)
851 886
 
887
+		if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 {
888
+
889
+			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
890
+
891
+			if len(monitorList) > 0 {
892
+				var ultrafiltration_rate float64
893
+				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
894
+
895
+				ultrafiltration_rate = (math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)) / 1000
896
+				var replacement_rate float64
897
+
898
+				//乘10 除10是为了保留一位小数
899
+				replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
900
+
901
+				var firstOpeateTime = monitorList[0].OperateTime
902
+				for _, item := range monitorList {
903
+					//超滤率
904
+					service.ModifyDialysisPatientMonitor(item.ID, ultrafiltration_rate)
905
+
906
+					//置换率
907
+					service.ModifyDialysisPatientReplascementRate(item.ID, replacement_rate)
908
+
909
+					//超滤量
910
+					ultrafiltration_volume := math.Floor(float64(item.OperateTime-firstOpeateTime)/3600) * ultrafiltration_rate
911
+					service.ModifyPatientUltrafiltrationVolume(item.ID, ultrafiltration_volume)
912
+
913
+					//置换量
914
+					displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
915
+
916
+					service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
917
+
918
+				}
919
+			}
920
+
921
+		}
922
+
852 923
 		//记录日志
853 924
 		byterequest, _ := json.Marshal(prescription)
854 925
 		dialysisPrescriptionLog := models.XtDialysisPrescriptionLog{
@@ -1497,6 +1568,41 @@ func (c *DialysisApiController) PostSoulution() {
1497 1568
 
1498 1569
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
1499 1570
 
1571
+	if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 {
1572
+
1573
+		monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
1574
+
1575
+		if len(monitorList) > 0 {
1576
+			var ultrafiltration_rate float64
1577
+			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
1578
+
1579
+			ultrafiltration_rate = (math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)) / 1000
1580
+			var replacement_rate float64
1581
+
1582
+			//乘10 除10是为了保留一位小数
1583
+			replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
1584
+
1585
+			var firstOpeateTime = monitorList[0].OperateTime
1586
+			for _, item := range monitorList {
1587
+				//超滤率
1588
+				service.ModifyDialysisPatientMonitor(item.ID, ultrafiltration_rate)
1589
+
1590
+				//置换率
1591
+				service.ModifyDialysisPatientReplascementRate(item.ID, replacement_rate)
1592
+
1593
+				//超滤量
1594
+				ultrafiltration_volume := math.Floor(float64(item.OperateTime-firstOpeateTime)/3600) * ultrafiltration_rate
1595
+				service.ModifyPatientUltrafiltrationVolume(item.ID, ultrafiltration_volume)
1596
+
1597
+				//置换量
1598
+				displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
1599
+
1600
+				service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
1601
+
1602
+			}
1603
+		}
1604
+
1605
+	}
1500 1606
 	//记录日志
1501 1607
 	byterequest, _ := json.Marshal(prescription)
1502 1608
 	dialysisPrescriptionLog := models.XtDialysisPrescriptionLog{
@@ -2973,6 +3079,44 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2973 3079
 				}
2974 3080
 			}
2975 3081
 
3082
+			if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 {
3083
+
3084
+				prescription, _ := service.GetTodayPrescription(patient, adminUserInfo.CurrentOrgId, recordDate.Unix())
3085
+
3086
+				monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
3087
+
3088
+				if len(monitorList) > 0 {
3089
+					var ultrafiltration_rate float64
3090
+					totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
3091
+
3092
+					ultrafiltration_rate = (math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)) / 1000
3093
+					var replacement_rate float64
3094
+
3095
+					//乘10 除10是为了保留一位小数
3096
+					replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
3097
+
3098
+					var firstOpeateTime = monitorList[0].OperateTime
3099
+					for _, item := range monitorList {
3100
+						//超滤率
3101
+						service.ModifyDialysisPatientMonitor(item.ID, ultrafiltration_rate)
3102
+
3103
+						//置换率
3104
+						service.ModifyDialysisPatientReplascementRate(item.ID, replacement_rate)
3105
+
3106
+						//超滤量
3107
+						ultrafiltration_volume := math.Floor(float64(item.OperateTime-firstOpeateTime)/3600) * ultrafiltration_rate
3108
+						service.ModifyPatientUltrafiltrationVolume(item.ID, ultrafiltration_volume)
3109
+
3110
+						//置换量
3111
+						displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
3112
+
3113
+						service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
3114
+
3115
+					}
3116
+				}
3117
+
3118
+			}
3119
+
2976 3120
 		}
2977 3121
 
2978 3122
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
@@ -3332,6 +3476,44 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3332 3476
 
3333 3477
 		}
3334 3478
 
3479
+		if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 {
3480
+
3481
+			prescription, _ := service.GetTodayPrescription(patient, adminUserInfo.CurrentOrgId, recordDate.Unix())
3482
+
3483
+			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
3484
+
3485
+			if len(monitorList) > 0 {
3486
+				var ultrafiltration_rate float64
3487
+				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
3488
+
3489
+				ultrafiltration_rate = (math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)) / 1000
3490
+				var replacement_rate float64
3491
+
3492
+				//乘10 除10是为了保留一位小数
3493
+				replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
3494
+
3495
+				var firstOpeateTime = monitorList[0].OperateTime
3496
+				for _, item := range monitorList {
3497
+					//超滤率
3498
+					service.ModifyDialysisPatientMonitor(item.ID, ultrafiltration_rate)
3499
+
3500
+					//置换率
3501
+					service.ModifyDialysisPatientReplascementRate(item.ID, replacement_rate)
3502
+
3503
+					//超滤量
3504
+					ultrafiltration_volume := math.Floor(float64(item.OperateTime-firstOpeateTime)/3600) * ultrafiltration_rate
3505
+					service.ModifyPatientUltrafiltrationVolume(item.ID, ultrafiltration_volume)
3506
+
3507
+					//置换量
3508
+					displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
3509
+
3510
+					service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
3511
+
3512
+				}
3513
+			}
3514
+
3515
+		}
3516
+
3335 3517
 		err := service.UpadatePredialysisEvaluation(&assessmentBeforeDislysis)
3336 3518
 
3337 3519
 		//创建步骤表

+ 113 - 3
controllers/mobile_api_controllers/dialysis_api_controller.go Vedi File

@@ -2352,6 +2352,42 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
2352 2352
 		}
2353 2353
 		err := service.AddSigleRecord(&prescription)
2354 2354
 
2355
+		//溪康 更改目标超滤量 同步监测里面的超滤量 超滤率 置换量 置换率
2356
+		if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 {
2357
+
2358
+			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
2359
+
2360
+			if len(monitorList) > 0 {
2361
+				var ultrafiltration_rate float64
2362
+				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2363
+
2364
+				ultrafiltration_rate = (math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)) / 1000
2365
+				var replacement_rate float64
2366
+
2367
+				//乘10 除10是为了保留一位小数
2368
+				replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
2369
+
2370
+				var firstOpeateTime = monitorList[0].OperateTime
2371
+				for _, item := range monitorList {
2372
+					//超滤率
2373
+					service.ModifyDialysisPatientMonitor(item.ID, ultrafiltration_rate)
2374
+
2375
+					//置换率
2376
+					service.ModifyDialysisPatientReplascementRate(item.ID, replacement_rate)
2377
+
2378
+					//超滤量
2379
+					ultrafiltration_volume := math.Floor(float64(item.OperateTime-firstOpeateTime)/3600) * ultrafiltration_rate
2380
+					service.ModifyPatientUltrafiltrationVolume(item.ID, ultrafiltration_volume)
2381
+
2382
+					//置换量
2383
+					displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
2384
+
2385
+					service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
2386
+
2387
+				}
2388
+			}
2389
+
2390
+		}
2355 2391
 		//记录日志
2356 2392
 		byterequest, _ := json.Marshal(prescription)
2357 2393
 		prescriptionLog := models.XtDialysisPrescriptionLog{
@@ -2605,6 +2641,43 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
2605 2641
 
2606 2642
 		service.UpDateDialysisPrescription(&prescription)
2607 2643
 
2644
+		//溪康 更改目标超滤量 同步监测里面的超滤量 超滤率 置换量 置换率
2645
+		if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 {
2646
+
2647
+			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
2648
+
2649
+			if len(monitorList) > 0 {
2650
+				var ultrafiltration_rate float64
2651
+				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2652
+
2653
+				ultrafiltration_rate = (math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)) / 1000
2654
+				var replacement_rate float64
2655
+
2656
+				//乘10 除10是为了保留一位小数
2657
+				replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
2658
+
2659
+				var firstOpeateTime = monitorList[0].OperateTime
2660
+				for _, item := range monitorList {
2661
+					//超滤率
2662
+					service.ModifyDialysisPatientMonitor(item.ID, ultrafiltration_rate)
2663
+
2664
+					//置换率
2665
+					service.ModifyDialysisPatientReplascementRate(item.ID, replacement_rate)
2666
+
2667
+					//超滤量
2668
+					ultrafiltration_volume := math.Floor(float64(item.OperateTime-firstOpeateTime)/3600) * ultrafiltration_rate
2669
+					service.ModifyPatientUltrafiltrationVolume(item.ID, ultrafiltration_volume)
2670
+
2671
+					//置换量
2672
+					displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
2673
+
2674
+					service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
2675
+
2676
+				}
2677
+			}
2678
+
2679
+		}
2680
+
2608 2681
 		//记录日志
2609 2682
 		byterequest, _ := json.Marshal(prescription)
2610 2683
 		prescriptionLog := models.XtDialysisPrescriptionLog{
@@ -4562,6 +4635,43 @@ func (c *DialysisAPIController) PostSolution() {
4562 4635
 	}
4563 4636
 
4564 4637
 	service.SavePrescriptionAndCreateSolution(&solution, &prescription)
4638
+
4639
+	if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 {
4640
+
4641
+		monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
4642
+
4643
+		if len(monitorList) > 0 {
4644
+			var ultrafiltration_rate float64
4645
+			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4646
+
4647
+			ultrafiltration_rate = (math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)) / 1000
4648
+			var replacement_rate float64
4649
+
4650
+			//乘10 除10是为了保留一位小数
4651
+			replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
4652
+
4653
+			var firstOpeateTime = monitorList[0].OperateTime
4654
+			for _, item := range monitorList {
4655
+				//超滤率
4656
+				service.ModifyDialysisPatientMonitor(item.ID, ultrafiltration_rate)
4657
+
4658
+				//置换率
4659
+				service.ModifyDialysisPatientReplascementRate(item.ID, replacement_rate)
4660
+
4661
+				//超滤量
4662
+				ultrafiltration_volume := math.Floor(float64(item.OperateTime-firstOpeateTime)/3600) * ultrafiltration_rate
4663
+				service.ModifyPatientUltrafiltrationVolume(item.ID, ultrafiltration_volume)
4664
+
4665
+				//置换量
4666
+				displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
4667
+				fmt.Println("displacement_quantity----------------------", displacement_quantity)
4668
+				service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
4669
+
4670
+			}
4671
+		}
4672
+
4673
+	}
4674
+
4565 4675
 	//记录日志
4566 4676
 	byterequest, _ := json.Marshal(prescription)
4567 4677
 	prescriptionLog := models.XtDialysisPrescriptionLog{
@@ -5055,7 +5165,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5055 5165
 		record.UltrafiltrationVolume = 0
5056 5166
 	}
5057 5167
 
5058
-	if adminInfo.Org.Id == 10721 {
5168
+	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10164 {
5059 5169
 		if ultrafiltration_rate > 0 {
5060 5170
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5061 5171
 			record.UltrafiltrationVolume = ultrafiltration_volume / 1000
@@ -5068,12 +5178,12 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5068 5178
 		var displacement_quantity float64
5069 5179
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5070 5180
 		replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*60) / 1000
5071
-		fmt.Println("replacement_rate-----------------", replacement_rate)
5181
+
5182
+		fmt.Println("replacement_rate--------------------------", replacement_rate)
5072 5183
 		record.ReplacementRate = replacement_rate
5073 5184
 
5074 5185
 		fmt.Println(math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600))
5075 5186
 		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5076
-		fmt.Println("displacement_quantity-----------------", displacement_quantity)
5077 5187
 		record.DisplacementQuantity = displacement_quantity
5078 5188
 
5079 5189
 	}

+ 43 - 1
controllers/mobile_api_controllers/patient_api_controller.go Vedi File

@@ -4207,7 +4207,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
4207 4207
 	}
4208 4208
 
4209 4209
 	//针对孝昌康桥超滤率计算问题
4210
-	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10726 {
4210
+	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10726 || adminUserInfo.Org.Id == 10164 {
4211 4211
 		if evaluation.ID == 0 {
4212 4212
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4213 4213
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
@@ -4226,6 +4226,48 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
4226 4226
 
4227 4227
 	}
4228 4228
 
4229
+	if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 {
4230
+
4231
+		prescription, _ := service.GetTodayPrescription(id, adminUserInfo.Org.Id, theAssessmentDateTime)
4232
+
4233
+		if prescription.ID > 0 {
4234
+
4235
+			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
4236
+
4237
+			if len(monitorList) > 0 {
4238
+				var ultrafiltration_rate float64
4239
+				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4240
+
4241
+				ultrafiltration_rate = (math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)) / 1000
4242
+				var replacement_rate float64
4243
+
4244
+				//乘10 除10是为了保留一位小数
4245
+				replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
4246
+
4247
+				var firstOpeateTime = monitorList[0].OperateTime
4248
+				for _, item := range monitorList {
4249
+					//超滤率
4250
+					service.ModifyDialysisPatientMonitor(item.ID, ultrafiltration_rate)
4251
+
4252
+					//置换率
4253
+					service.ModifyDialysisPatientReplascementRate(item.ID, replacement_rate)
4254
+
4255
+					//超滤量
4256
+					ultrafiltration_volume := math.Floor(float64(item.OperateTime-firstOpeateTime)/3600) * ultrafiltration_rate
4257
+					service.ModifyPatientUltrafiltrationVolume(item.ID, ultrafiltration_volume)
4258
+
4259
+					//置换量
4260
+					displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
4261
+
4262
+					service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
4263
+
4264
+				}
4265
+			}
4266
+
4267
+		}
4268
+
4269
+	}
4270
+
4229 4271
 	err = service.UpadatePredialysisEvaluation(&evaluation)
4230 4272
 
4231 4273
 	//记录日志

+ 59 - 1
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Vedi File

@@ -246,6 +246,10 @@ func (this *NewDialysisApiController) SavePatient() {
246 246
 	remark := dataBody["remark"].(string)
247 247
 
248 248
 	treatment_plan := dataBody["treatment_plan"].(string)
249
+
250
+	patient_type_one := int64(dataBody["patient_type"].(float64))
251
+
252
+	fmt.Println("patient_type_one444444444444444444444444", patient_type_one)
249 253
 	//查询身份证号码是否存在
250 254
 	thisPatientOne, _ := service.FindPatientByIdCardNoFive(orgid, idCard)
251 255
 	if thisPatientOne.ID > 0 {
@@ -263,6 +267,16 @@ func (this *NewDialysisApiController) SavePatient() {
263 267
 		this.ServeSuccessJSON(returnData)
264 268
 		return
265 269
 	}
270
+	if patient_type_one == 1 || patient_type_one == 4 || patient_type_one == 5 || patient_type_one == 6 || patient_type_one == 0 {
271
+		bloodPatient = 1
272
+	}
273
+	if patient_type_one == 2 {
274
+		slowpatient = 1
275
+	}
276
+	if patient_type_one == 3 {
277
+		memberpatient = 1
278
+	}
279
+
266 280
 	//如果是血透病人
267 281
 	if bloodPatient == 1 {
268 282
 		//查询透析号是否存在
@@ -315,6 +329,10 @@ func (this *NewDialysisApiController) SavePatient() {
315 329
 			Remark:            "",
316 330
 			SchRemark:         remark,
317 331
 			TreatmentPlan:     treatment_plan,
332
+			PatientType:       patient_type_one,
333
+		}
334
+		if patient_type == 0 {
335
+			patients.PatientType = 1
318 336
 		}
319 337
 		patients.FirstLetter = firstLetter
320 338
 		err = service.CreateOldPatient(&patients)
@@ -333,6 +351,26 @@ func (this *NewDialysisApiController) SavePatient() {
333 351
 		err = service.AddContagions(patient.ID, patient.CreatedTime, patient.UpdatedTime, ids)
334 352
 		fmt.Println("添加传染病失败", err)
335 353
 
354
+		record := models.XtPatientLaspseRecord{
355
+			PatientId:     patients.ID,
356
+			RecordDate:    time.Now().Unix(),
357
+			LapseDate:     time.Now().Unix(),
358
+			LapseType:     1,
359
+			LapseClass:    0,
360
+			LapseReason:   "",
361
+			AdminUserId:   adminInfo.AdminUser.Id,
362
+			Remark:        "",
363
+			UserOrgId:     orgid,
364
+			Ctime:         time.Now().Unix(),
365
+			Mtime:         time.Now().Unix(),
366
+			Status:        1,
367
+			LapseTypeName: "转入",
368
+			HisType:       0,
369
+			HisZone:       "",
370
+			HisBed:        "",
371
+		}
372
+		service.CreatePatientRecord(record)
373
+
336 374
 		patientsNew := models.XtPatientsNew{
337 375
 			Name:              name,
338 376
 			Gender:            sex,
@@ -360,6 +398,10 @@ func (this *NewDialysisApiController) SavePatient() {
360 398
 			Remark:            "",
361 399
 			SchRemark:         remark,
362 400
 			TreatmentPlan:     treatment_plan,
401
+			PatientType:       patient_type_one,
402
+		}
403
+		if patient_type == 0 {
404
+			patientsNew.PatientType = 1
363 405
 		}
364 406
 		patientsNew.FirstLetter = firstLetter
365 407
 		err = service.CreateNewPatient(&patientsNew)
@@ -1233,7 +1275,7 @@ func (this *NewDialysisApiController) DeleteManagement() {
1233 1275
 func (this *NewDialysisApiController) DeleteManageMentTwo() {
1234 1276
 	groupno, _ := this.GetInt64("id")
1235 1277
 	patientid, _ := this.GetInt64("patientid")
1236
-	fmt.Println("patientid------------------------------------", patientid)
1278
+
1237 1279
 	orgId := this.GetMobileAdminUserInfo().Org.Id
1238 1280
 	err := service.DeleteManagement(groupno, orgId, patientid)
1239 1281
 	fmt.Println("错误是什么", err)
@@ -1365,7 +1407,19 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1365 1407
 	remark := dataBody["remark"].(string)
1366 1408
 
1367 1409
 	treatment_plan := dataBody["treatment_plan"].(string)
1410
+
1411
+	patient_type_one := int64(dataBody["patient_type"].(float64))
1368 1412
 	fmt.Print(fisttime)
1413
+
1414
+	if patient_type_one == 1 || patient_type_one == 4 || patient_type_one == 5 || patient_type_one == 6 || patient_type_one == 0 {
1415
+		bloodPatient = 1
1416
+	}
1417
+	if patient_type_one == 2 {
1418
+		slowpatient = 1
1419
+	}
1420
+	if patient_type_one == 3 {
1421
+		memberpatient = 1
1422
+	}
1369 1423
 	//如果是血透病人
1370 1424
 	if bloodPatient == 1 {
1371 1425
 		//根据新表ID获取老表病人ID
@@ -1421,6 +1475,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1421 1475
 			RelativePhone:     relative_phone,
1422 1476
 			SchRemark:         remark,
1423 1477
 			TreatmentPlan:     treatment_plan,
1478
+			PatientType:       patient_type_one,
1424 1479
 		}
1425 1480
 		err = service.UpdatedPatient(patients, patient.BloodId)
1426 1481
 		key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patient.BloodId, 10) + ":patient_info"
@@ -1453,6 +1508,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1453 1508
 			RelativePhone:     relative_phone,
1454 1509
 			SchRemark:         remark,
1455 1510
 			TreatmentPlan:     treatment_plan,
1511
+			PatientType:       patient_type_one,
1456 1512
 		}
1457 1513
 		err = service.UpdateXtPatientNew(patientsNew, id)
1458 1514
 		if err != nil {
@@ -1514,6 +1570,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1514 1570
 			Remark:            "",
1515 1571
 			SchRemark:         remark,
1516 1572
 			TreatmentPlan:     treatment_plan,
1573
+			PatientType:       patient_type_one,
1517 1574
 		}
1518 1575
 		err = service.UpdateXtPatientNew(xtPatientsNew, id)
1519 1576
 		fmt.Print("更新失败", err)
@@ -1574,6 +1631,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1574 1631
 			Remark:            "",
1575 1632
 			SchRemark:         remark,
1576 1633
 			TreatmentPlan:     treatment_plan,
1634
+			PatientType:       patient_type,
1577 1635
 		}
1578 1636
 		err = service.UpdateXtPatientNewOne(patientsNew, id)
1579 1637
 		if err != nil {

+ 1 - 1
controllers/patient_api_controller.go Vedi File

@@ -421,7 +421,7 @@ func (c *PatientApiController) CreatePatient() {
421 421
 		LapseReason:   "",
422 422
 		AdminUserId:   creater,
423 423
 		Remark:        "",
424
-		UserOrgId:     0,
424
+		UserOrgId:     adminUserInfo.CurrentOrgId,
425 425
 		Ctime:         time.Now().Unix(),
426 426
 		Mtime:         time.Now().Unix(),
427 427
 		Status:        1,

+ 43 - 0
service/dialysis_service.go Vedi File

@@ -2683,3 +2683,46 @@ func CreateMobileMGroupAdvice(orgId int64, advices []*models.GroupAdvice, groupN
2683 2683
 	tx.Commit()
2684 2684
 	return
2685 2685
 }
2686
+
2687
+func GetTodayPrescription(patient_id int64, user_org_id int64, record_date int64) (models.DialysisPrescription, error) {
2688
+
2689
+	prescription := models.DialysisPrescription{}
2690
+
2691
+	err := XTReadDB().Where("patient_id = ? and user_org_id = ? and record_date =? and status=1", patient_id, user_org_id, record_date).Find(&prescription).Error
2692
+
2693
+	return prescription, err
2694
+}
2695
+
2696
+func GetMobilePatientMonitor(patient_id int64, record_date int64, user_org_id int64) (monitor []*models.MonitoringRecord, err error) {
2697
+
2698
+	err = XTReadDB().Where("patient_id = ? and monitoring_date = ? and user_org_id =? and status=1", patient_id, record_date, user_org_id).Order("operate_time asc").Find(&monitor).Error
2699
+
2700
+	return monitor, err
2701
+}
2702
+
2703
+func ModifyDialysisPatientMonitor(id int64, ultrafiltration_rate float64) error {
2704
+
2705
+	err := XTWriteDB().Model(&models.MonitoringRecord{}).Where("id =? and status=1", id).Updates(map[string]interface{}{"ultrafiltration_rate": ultrafiltration_rate}).Error
2706
+
2707
+	return err
2708
+}
2709
+
2710
+func ModifyDialysisPatientReplascementRate(id int64, replacement_rate float64) error {
2711
+
2712
+	err := XTWriteDB().Model(&models.MonitoringRecord{}).Where("id =? and status=1", id).Updates(map[string]interface{}{"replacement_rate": replacement_rate}).Error
2713
+
2714
+	return err
2715
+}
2716
+
2717
+func ModifyPatientUltrafiltrationVolume(id int64, ultrafiltration_volume float64) error {
2718
+
2719
+	err := XTWriteDB().Model(&models.MonitoringRecord{}).Where("id =? and status=1", id).Updates(map[string]interface{}{"ultrafiltration_volume": ultrafiltration_volume}).Error
2720
+
2721
+	return err
2722
+}
2723
+
2724
+func ModifyPatientDisplacementQuantity(id int64, displacement_quantity float64) error {
2725
+
2726
+	err := XTWriteDB().Model(&models.MonitoringRecord{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"displacement_quantity": displacement_quantity}).Error
2727
+	return err
2728
+}

+ 2 - 2
service/patientmanage_service.go Vedi File

@@ -951,14 +951,14 @@ func GetNewPatient(id int64) (models.XtPatientsNew, error) {
951 951
 
952 952
 func UpdatedPatient(patients models.Patients, id int64) error {
953 953
 
954
-	err := XTWriteDB().Model(&patients).Where("id=?", id).Update(map[string]interface{}{"name": patients.Name, "gender": patients.Gender, "birthday": patients.Birthday, "age": patients.Age, "phone": patients.Phone, "lapseto": patients.Lapseto, "admission_number": patients.AdmissionNumber, "first_dialysis_date": patients.FirstDialysisDate, "diagnose": patients.Diagnose, "source": patients.Source, "dialysis_no": patients.DialysisNo, "avatar": patients.Avatar, "id_card_no": patients.IdCardNo, "is_infectious": patients.IsInfectious, "out_reason": patients.OutReason, "death_time": patients.DeathTime, "relative_phone": patients.RelativePhone, "sch_remark": patients.SchRemark, "treatment_plan": patients.TreatmentPlan}).Error
954
+	err := XTWriteDB().Model(&patients).Where("id=?", id).Update(map[string]interface{}{"name": patients.Name, "gender": patients.Gender, "birthday": patients.Birthday, "age": patients.Age, "phone": patients.Phone, "lapseto": patients.Lapseto, "admission_number": patients.AdmissionNumber, "first_dialysis_date": patients.FirstDialysisDate, "diagnose": patients.Diagnose, "source": patients.Source, "dialysis_no": patients.DialysisNo, "avatar": patients.Avatar, "id_card_no": patients.IdCardNo, "is_infectious": patients.IsInfectious, "out_reason": patients.OutReason, "death_time": patients.DeathTime, "relative_phone": patients.RelativePhone, "sch_remark": patients.SchRemark, "treatment_plan": patients.TreatmentPlan, "patient_type": patients.PatientType}).Error
955 955
 
956 956
 	return err
957 957
 }
958 958
 
959 959
 func UpdateXtPatientNew(patients models.XtPatientsNew, id int64) error {
960 960
 
961
-	err := XTWriteDB().Model(&patients).Where("id=?", id).Update(map[string]interface{}{"name": patients.Name, "gender": patients.Gender, "birthday": patients.Birthday, "age": patients.Age, "phone": patients.Phone, "lapseto": patients.Lapseto, "admission_number": patients.AdmissionNumber, "first_dialysis_date": patients.FirstDialysisDate, "diagnose": patients.Diagnose, "source": patients.Source, "dialysis_no": patients.DialysisNo, "avatar": patients.Avatar, "id_card_no": patients.IdCardNo, "is_infectious": patients.IsInfectious, "out_reason": patients.OutReason, "death_time": patients.DeathTime, "relative_phone": patients.RelativePhone, "sch_remark": patients.SchRemark, "treatment_plan": patients.TreatmentPlan}).Error
961
+	err := XTWriteDB().Model(&patients).Where("id=?", id).Update(map[string]interface{}{"name": patients.Name, "gender": patients.Gender, "birthday": patients.Birthday, "age": patients.Age, "phone": patients.Phone, "lapseto": patients.Lapseto, "admission_number": patients.AdmissionNumber, "first_dialysis_date": patients.FirstDialysisDate, "diagnose": patients.Diagnose, "source": patients.Source, "dialysis_no": patients.DialysisNo, "avatar": patients.Avatar, "id_card_no": patients.IdCardNo, "is_infectious": patients.IsInfectious, "out_reason": patients.OutReason, "death_time": patients.DeathTime, "relative_phone": patients.RelativePhone, "sch_remark": patients.SchRemark, "treatment_plan": patients.TreatmentPlan, "patient_type": patients.PatientType}).Error
962 962
 
963 963
 	return err
964 964
 }