28169 1 month ago
parent
commit
9b86360b75

+ 4 - 4
controllers/base_api_controller.go View File

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10217 //机构id
86
+		subscibe.OrgId = 10766 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10217 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10766 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 18723 //4
97
 		adminUserInfo.CurrentAppId = 18723 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10217 //机构id小英9675或4
332
+		subscibe.OrgId = 10766 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10217 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10766 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 18723 //4
343
 		adminUserInfo.CurrentAppId = 18723 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 38 - 12
controllers/dialysis_api_controller.go View File

243
 }
243
 }
244
 
244
 
245
 func (c *DialysisApiController) PostPrescription() {
245
 func (c *DialysisApiController) PostPrescription() {
246
+
246
 	patient, _ := c.GetInt64("patient_id", 0)
247
 	patient, _ := c.GetInt64("patient_id", 0)
248
+	fmt.Println("patient=================", patient)
247
 	recordDateStr := c.GetString("record_date")
249
 	recordDateStr := c.GetString("record_date")
248
 
250
 
249
 	if patient <= 0 {
251
 	if patient <= 0 {
541
 		}
543
 		}
542
 	}
544
 	}
543
 
545
 
546
+	if adminUserInfo.CurrentOrgId == 10766 {
547
+		if prescription.ModeId == 2 || prescription.ModeId == 13 {
548
+			if prescription.ReplacementTotal == 0 {
549
+				prescription.ReplacementTotal = 15
550
+			}
551
+
552
+		}
553
+	}
554
+
544
 	//长沙南雅医院,自动生成抗凝剂的临时处方
555
 	//长沙南雅医院,自动生成抗凝剂的临时处方
545
 	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
556
 	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
546
 		if prescribing_number == 0 {
557
 		if prescribing_number == 0 {
683
 		prescription.Creater = adminUserInfo.AdminUser.Id
694
 		prescription.Creater = adminUserInfo.AdminUser.Id
684
 
695
 
685
 		//针对河间咸得
696
 		//针对河间咸得
686
-		if adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10090 || adminUserInfo.CurrentOrgId == 3877 {
697
+		if adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10090 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10766 {
687
 
698
 
688
-			if prescription.ModeId != 2 && prescription.ModeId != 5 && prescription.ModeId != 12 {
699
+			if prescription.ModeId != 2 && prescription.ModeId != 5 && prescription.ModeId != 12 && prescription.ModeId != 13 {
689
 
700
 
690
 				prescription.DisplaceLiquiPart = 0
701
 				prescription.DisplaceLiquiPart = 0
691
 				prescription.DisplaceLiquiValue = 0
702
 				prescription.DisplaceLiquiValue = 0
722
 
733
 
723
 		err := service.AddSigleRecord(&prescription)
734
 		err := service.AddSigleRecord(&prescription)
724
 
735
 
725
-		if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 9478 {
736
+		if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 9478 || adminUserInfo.CurrentOrgId == 10766 {
726
 
737
 
727
 			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
738
 			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
728
 
739
 
743
 					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
754
 					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
744
 				}
755
 				}
745
 
756
 
757
+				if adminUserInfo.CurrentOrgId == 10766 {
758
+					//乘10 除10是为了保留一位小数
759
+					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
760
+				}
761
+
746
 				var firstOpeateTime = monitorList[0].OperateTime
762
 				var firstOpeateTime = monitorList[0].OperateTime
747
 				for _, item := range monitorList {
763
 				for _, item := range monitorList {
748
 					//超滤率
764
 					//超滤率
911
 
927
 
912
 		updateErr := service.UpDateDialysisPrescription(&prescription)
928
 		updateErr := service.UpDateDialysisPrescription(&prescription)
913
 
929
 
914
-		if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 {
930
+		if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10766 || adminUserInfo.CurrentOrgId == 9478 {
915
 
931
 
916
 			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
932
 			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
917
 
933
 
932
 					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
948
 					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
933
 				}
949
 				}
934
 
950
 
951
+				if adminUserInfo.CurrentOrgId == 10766 {
952
+					//乘10 除10是为了保留一位小数
953
+					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
954
+				}
955
+
935
 				var firstOpeateTime = monitorList[0].OperateTime
956
 				var firstOpeateTime = monitorList[0].OperateTime
936
 				for _, item := range monitorList {
957
 				for _, item := range monitorList {
937
 					//超滤率
958
 					//超滤率
1599
 		}
1620
 		}
1600
 	}
1621
 	}
1601
 
1622
 
1602
-	if adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10090 || adminUserInfo.CurrentOrgId == 3877 {
1623
+	if adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10090 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10766 {
1603
 
1624
 
1604
-		if solution.ModeId != 2 && solution.ModeId != 5 && solution.ModeId != 12 {
1625
+		if solution.ModeId != 2 && solution.ModeId != 5 && solution.ModeId != 12 && solution.ModeId != 13 {
1605
 
1626
 
1606
 			solution.DisplaceLiquiPart = 0
1627
 			solution.DisplaceLiquiPart = 0
1607
 			solution.DisplaceLiquiValue = 0
1628
 			solution.DisplaceLiquiValue = 0
1623
 
1644
 
1624
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
1645
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
1625
 
1646
 
1626
-	if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 9478 {
1647
+	if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 9478 || adminUserInfo.CurrentOrgId == 10766 {
1627
 
1648
 
1628
 		monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
1649
 		monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
1629
 
1650
 
1644
 				replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
1665
 				replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
1645
 			}
1666
 			}
1646
 
1667
 
1668
+			if adminUserInfo.CurrentOrgId == 10766 {
1669
+				//乘10 除10是为了保留一位小数
1670
+				replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
1671
+			}
1672
+
1647
 			var firstOpeateTime = monitorList[0].OperateTime
1673
 			var firstOpeateTime = monitorList[0].OperateTime
1648
 			for _, item := range monitorList {
1674
 			for _, item := range monitorList {
1649
 				//超滤率
1675
 				//超滤率
2900
 			service.CreateDialysisFinish(finish)
2926
 			service.CreateDialysisFinish(finish)
2901
 		}
2927
 		}
2902
 
2928
 
2903
-		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 || adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10726 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10751 || adminUserInfo.CurrentOrgId == 10752 || adminUserInfo.CurrentOrgId == 10480 || adminUserInfo.CurrentOrgId == 10293 || adminUserInfo.CurrentOrgId == 9478 {
2929
+		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 || adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10726 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10751 || adminUserInfo.CurrentOrgId == 10752 || adminUserInfo.CurrentOrgId == 10480 || adminUserInfo.CurrentOrgId == 10293 || adminUserInfo.CurrentOrgId == 9478 || adminUserInfo.CurrentOrgId == 10766 {
2904
 			var dewater_amount float64
2930
 			var dewater_amount float64
2905
 			dewater_amount = 0
2931
 			dewater_amount = 0
2906
 			if dry_weight > 0 {
2932
 			if dry_weight > 0 {
2907
 				dewater_amount = weight_before - dry_weight - additional_weight
2933
 				dewater_amount = weight_before - dry_weight - additional_weight
2908
 
2934
 
2909
-				if adminUserInfo.CurrentOrgId != 10551 && adminUserInfo.CurrentOrgId != 10579 && adminUserInfo.CurrentOrgId != 10580 && adminUserInfo.CurrentOrgId != 10585 && adminUserInfo.CurrentOrgId != 10344 && adminUserInfo.CurrentOrgId != 10622 && adminUserInfo.CurrentOrgId != 10702 && adminUserInfo.CurrentOrgId != 10635 && adminUserInfo.CurrentOrgId != 10723 && adminUserInfo.CurrentOrgId != 10480 && adminUserInfo.CurrentOrgId != 10293 && adminUserInfo.CurrentOrgId != 9478 {
2935
+				if adminUserInfo.CurrentOrgId != 10551 && adminUserInfo.CurrentOrgId != 10579 && adminUserInfo.CurrentOrgId != 10580 && adminUserInfo.CurrentOrgId != 10585 && adminUserInfo.CurrentOrgId != 10344 && adminUserInfo.CurrentOrgId != 10622 && adminUserInfo.CurrentOrgId != 10702 && adminUserInfo.CurrentOrgId != 10635 && adminUserInfo.CurrentOrgId != 10723 && adminUserInfo.CurrentOrgId != 10480 && adminUserInfo.CurrentOrgId != 10293 && adminUserInfo.CurrentOrgId != 9478 && adminUserInfo.CurrentOrgId != 10744 && adminUserInfo.CurrentOrgId != 10766 {
2910
 					dewater_amount = dewater_amount * 1000
2936
 					dewater_amount = dewater_amount * 1000
2911
 				}
2937
 				}
2912
 
2938
 
3547
 		}
3573
 		}
3548
 
3574
 
3549
 		//针对孝昌康桥超滤率计算问题
3575
 		//针对孝昌康桥超滤率计算问题
3550
-		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10726 || adminUserInfo.CurrentOrgId == 10742 || adminUserInfo.CurrentOrgId == 10751 || adminUserInfo.CurrentOrgId == 10752 || adminUserInfo.CurrentOrgId == 10697 || adminUserInfo.CurrentOrgId == 9478 {
3576
+		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10726 || adminUserInfo.CurrentOrgId == 10742 || adminUserInfo.CurrentOrgId == 10751 || adminUserInfo.CurrentOrgId == 10752 || adminUserInfo.CurrentOrgId == 10697 || adminUserInfo.CurrentOrgId == 9478 || adminUserInfo.CurrentOrgId == 10766 {
3551
 			if assessmentBeforeDislysis.ID == 0 {
3577
 			if assessmentBeforeDislysis.ID == 0 {
3552
 				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3578
 				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3553
 				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
3579
 				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
3574
 
3600
 
3575
 		}
3601
 		}
3576
 
3602
 
3577
-		if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 {
3603
+		if adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10766 || adminUserInfo.CurrentOrgId == 9478 {
3578
 
3604
 
3579
 			prescription, _ := service.GetTodayPrescription(patient, adminUserInfo.CurrentOrgId, recordDate.Unix())
3605
 			prescription, _ := service.GetTodayPrescription(patient, adminUserInfo.CurrentOrgId, recordDate.Unix())
3580
 
3606
 
4866
 	//获取上次的透后体重
4892
 	//获取上次的透后体重
4867
 	//	assessmentAfterDislysis, _ := service.MobileGetLastTimeAssessmentAfterDislysis(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4893
 	//	assessmentAfterDislysis, _ := service.MobileGetLastTimeAssessmentAfterDislysis(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4868
 	assessmentAfterDislysis, _ := service.MobileGetLast(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4894
 	assessmentAfterDislysis, _ := service.MobileGetLast(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4869
-	fmt.Println("assessmentAfterDislysis--------------------------", assessmentAfterDislysis)
4895
+
4870
 	//获取透析次数
4896
 	//获取透析次数
4871
 	_, total, err := service.GetTotalDialysisCout(adminUserInfo.CurrentOrgId, patientInfo.ID)
4897
 	_, total, err := service.GetTotalDialysisCout(adminUserInfo.CurrentOrgId, patientInfo.ID)
4872
 
4898
 

+ 7 - 6
controllers/his_config_api_controller.go View File

1
 package controllers
1
 package controllers
2
 
2
 
3
 import (
3
 import (
4
+	"encoding/json"
5
+	"fmt"
6
+	"reflect"
7
+	"strconv"
8
+	"strings"
9
+	"time"
10
+
4
 	"XT_New/enums"
11
 	"XT_New/enums"
5
 	"XT_New/models"
12
 	"XT_New/models"
6
 	"XT_New/service"
13
 	"XT_New/service"
7
 	"XT_New/utils"
14
 	"XT_New/utils"
8
-	"encoding/json"
9
-	"fmt"
10
 	"github.com/astaxie/beego"
15
 	"github.com/astaxie/beego"
11
 	"github.com/astaxie/beego/config"
16
 	"github.com/astaxie/beego/config"
12
 	"golang.org/x/sync/errgroup"
17
 	"golang.org/x/sync/errgroup"
13
-	"reflect"
14
-	"strconv"
15
-	"strings"
16
-	"time"
17
 )
18
 )
18
 
19
 
19
 type HisConfigApiController struct {
20
 type HisConfigApiController struct {

+ 3 - 3
controllers/mobile_api_controllers/check_weight_api_controller.go View File

319
 
319
 
320
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
320
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
321
 
321
 
322
-	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 || adminUserInfo.Org.Id == 10537 || adminUserInfo.Org.Id == 10667 || adminUserInfo.Org.Id == 10723 || adminUserInfo.Org.Id == 10731 {
323
-		if adminUserInfo.Org.Id != 10447 {
322
+	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 || adminUserInfo.Org.Id == 10537 || adminUserInfo.Org.Id == 10667 || adminUserInfo.Org.Id == 10723 || adminUserInfo.Org.Id == 10731 || adminUserInfo.Org.Id == 10766 {
323
+		if adminUserInfo.Org.Id != 10447 && adminUserInfo.Org.Id != 10766 {
324
 			dewater_amount = dewater_amount * 1000
324
 			dewater_amount = dewater_amount * 1000
325
 		}
325
 		}
326
 
326
 
985
 		}
985
 		}
986
 
986
 
987
 		//针对患者称重两次没有数据的问题
987
 		//针对患者称重两次没有数据的问题
988
-		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10723 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10740 || adminUserInfo.Org.Id == 10745 || adminUserInfo.Org.Id == 10697 {
988
+		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10723 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10740 || adminUserInfo.Org.Id == 10745 || adminUserInfo.Org.Id == 10697 || adminUserInfo.Org.Id == 10766 {
989
 
989
 
990
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
990
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
991
 			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
991
 			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)

+ 310 - 18
controllers/mobile_api_controllers/dialysis_api_controller.go View File

2402
 		err := service.AddSigleRecord(&prescription)
2402
 		err := service.AddSigleRecord(&prescription)
2403
 
2403
 
2404
 		//溪康 更改目标超滤量 同步监测里面的超滤量 超滤率 置换量 置换率
2404
 		//溪康 更改目标超滤量 同步监测里面的超滤量 超滤率 置换量 置换率
2405
-		if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 9478 {
2405
+		if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 9478 || adminUserInfo.Org.Id == 10766 {
2406
 
2406
 
2407
 			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
2407
 			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
2408
 
2408
 
2423
 					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
2423
 					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
2424
 				}
2424
 				}
2425
 
2425
 
2426
+				if adminUserInfo.Org.Id == 10766 {
2427
+					//乘10 除10是为了保留一位小数
2428
+					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
2429
+				}
2430
+
2426
 				var firstOpeateTime = monitorList[0].OperateTime
2431
 				var firstOpeateTime = monitorList[0].OperateTime
2427
 				for _, item := range monitorList {
2432
 				for _, item := range monitorList {
2428
 					//超滤率
2433
 					//超滤率
2707
 		service.UpDateDialysisPrescription(&prescription)
2712
 		service.UpDateDialysisPrescription(&prescription)
2708
 
2713
 
2709
 		//溪康 更改目标超滤量 同步监测里面的超滤量 超滤率 置换量 置换率
2714
 		//溪康 更改目标超滤量 同步监测里面的超滤量 超滤率 置换量 置换率
2710
-		if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 {
2715
+		if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 9478 || adminUserInfo.Org.Id == 10766 {
2711
 
2716
 
2712
 			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
2717
 			monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
2713
 
2718
 
2723
 					replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
2728
 					replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*10) / 10
2724
 				}
2729
 				}
2725
 
2730
 
2726
-				if adminUserInfo.Org.Id == 9478 {
2731
+				if adminUserInfo.Org.Id == 9478 || adminUserInfo.Org.Id == 10766 {
2727
 					//乘10 除10是为了保留一位小数
2732
 					//乘10 除10是为了保留一位小数
2728
 					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
2733
 					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
2729
 				}
2734
 				}
3000
 			tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
3005
 			tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
3001
 		}
3006
 		}
3002
 
3007
 
3008
+		if adminUserInfo.Org.Id == 10766 {
3009
+			tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
3010
+			tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
3011
+		}
3012
+
3003
 		if adminUserInfo.Org.Id != 10445 {
3013
 		if adminUserInfo.Org.Id != 10445 {
3004
 			tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
3014
 			tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
3005
 		}
3015
 		}
3069
 
3079
 
3070
 	}
3080
 	}
3071
 
3081
 
3072
-	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 || adminUserInfo.Org.Id == 10735 || adminUserInfo.Org.Id == 10742 {
3082
+	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 || adminUserInfo.Org.Id == 10735 || adminUserInfo.Org.Id == 10742 || adminUserInfo.Org.Id == 10766 {
3073
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3083
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3074
 
3084
 
3075
 		if adminUserInfo.Org.Id != 10702 {
3085
 		if adminUserInfo.Org.Id != 10702 {
3191
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
3201
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
3192
 	}
3202
 	}
3193
 
3203
 
3204
+	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10766 {
3205
+		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
3206
+	}
3207
+
3194
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10617 {
3208
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10617 {
3195
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
3209
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
3196
 	}
3210
 	}
3218
 		tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
3232
 		tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
3219
 	}
3233
 	}
3220
 
3234
 
3235
+	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10766 {
3236
+		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
3237
+		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
3238
+		tempassessmentAfterDislysis.Temperature = endmonitorRecords.Temperature
3239
+		tempassessmentAfterDislysis.BreathingRate = endmonitorRecords.BreathingRate
3240
+	}
3241
+
3221
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10598 {
3242
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10598 {
3222
 		tempassessmentAfterDislysis.SystolicBloodPressure = 0
3243
 		tempassessmentAfterDislysis.SystolicBloodPressure = 0
3223
 		tempassessmentAfterDislysis.DiastolicBloodPressure = 0
3244
 		tempassessmentAfterDislysis.DiastolicBloodPressure = 0
4293
 				ultrafiltration_rate = ultrafiltration_rate / 1000
4314
 				ultrafiltration_rate = ultrafiltration_rate / 1000
4294
 			}
4315
 			}
4295
 
4316
 
4317
+			if adminUserInfo.Org.Id == 10766 {
4318
+				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
4319
+				ultrafiltration_rate = ultrafiltration_rate / 1000
4320
+			}
4321
+
4296
 			if adminUserInfo.Org.Id == 10757 {
4322
 			if adminUserInfo.Org.Id == 10757 {
4297
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
4323
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
4298
 				ultrafiltration_rate = ultrafiltration_rate / 1000
4324
 				ultrafiltration_rate = ultrafiltration_rate / 1000
4313
 				}
4339
 				}
4314
 			}
4340
 			}
4315
 
4341
 
4342
+			if adminUserInfo.Org.Id == 10766 {
4343
+				if prescription.ModeId == 2 || prescription.ModeId == 13 {
4344
+					totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4345
+					if totalMin == 0 {
4346
+						totalMin = 240
4347
+					}
4348
+					if prescription.DisplaceLiquiValue == 0 {
4349
+						prescription.DisplaceLiquiValue = 15
4350
+					}
4351
+
4352
+					//乘10 除10是为了保留一位小数
4353
+					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
4354
+				}
4355
+			}
4356
+
4316
 			if adminUserInfo.Org.Id == 10752 {
4357
 			if adminUserInfo.Org.Id == 10752 {
4317
 
4358
 
4318
 				if prescription.ModeId == 2 {
4359
 				if prescription.ModeId == 2 {
4386
 	}
4427
 	}
4387
 
4428
 
4388
 	//只针对广慈医院
4429
 	//只针对广慈医院
4389
-	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 || adminUserInfo.Org.Id == 9918 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10517 || adminUserInfo.Org.Id == 10679 || adminUserInfo.Org.Id == 10742 || adminUserInfo.Org.Id == 10757 {
4430
+	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 || adminUserInfo.Org.Id == 9918 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10517 || adminUserInfo.Org.Id == 10679 || adminUserInfo.Org.Id == 10742 || adminUserInfo.Org.Id == 10757 || adminUserInfo.Org.Id == 9478 || adminUserInfo.Org.Id == 10766 {
4390
 		// 查询病人是否有透前评估数据
4431
 		// 查询病人是否有透前评估数据
4391
 		befor, errcode := service.GetAssessmentBefor(adminUserInfo.Org.Id, patientID, recordDate.Unix())
4432
 		befor, errcode := service.GetAssessmentBefor(adminUserInfo.Org.Id, patientID, recordDate.Unix())
4392
 
4433
 
4486
 		}
4527
 		}
4487
 
4528
 
4488
 		//胶州少海医院
4529
 		//胶州少海医院
4489
-		if adminUserInfo.Org.Id == 10735 {
4530
+		if adminUserInfo.Org.Id == 10735 || adminUserInfo.Org.Id == 9478 {
4490
 			befor, _ := service.GetAssessmentBeforThrity(adminUserInfo.Org.Id, patientID, recordDate.Unix())
4531
 			befor, _ := service.GetAssessmentBeforThrity(adminUserInfo.Org.Id, patientID, recordDate.Unix())
4491
 			dialysisPrescription, _ := service.GetDialysisPrescription(patientID, adminUserInfo.Org.Id, recordDate.Unix())
4532
 			dialysisPrescription, _ := service.GetDialysisPrescription(patientID, adminUserInfo.Org.Id, recordDate.Unix())
4492
 			record.BreathingRate = befor.BreathingRate
4533
 			record.BreathingRate = befor.BreathingRate
4934
 		}
4975
 		}
4935
 	}
4976
 	}
4936
 
4977
 
4978
+	if adminUserInfo.Org.Id == 10766 || adminUserInfo.Org.Id == 9478 {
4979
+		if prescription.ModeId == 2 || prescription.ModeId == 13 {
4980
+			if prescription.ReplacementTotal == 0 {
4981
+				prescription.ReplacementTotal = 15
4982
+			}
4983
+
4984
+		}
4985
+	}
4986
+
4937
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
4987
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
4938
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
4988
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
4939
 
4989
 
5111
 
5161
 
5112
 	service.SavePrescriptionAndCreateSolution(&solution, &prescription)
5162
 	service.SavePrescriptionAndCreateSolution(&solution, &prescription)
5113
 
5163
 
5114
-	if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 9478 {
5164
+	if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 9478 || adminUserInfo.Org.Id == 10766 {
5115
 
5165
 
5116
 		monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
5166
 		monitorList, _ := service.GetMobilePatientMonitor(prescription.PatientId, prescription.RecordDate, prescription.UserOrgId)
5117
 
5167
 
5132
 				replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
5182
 				replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
5133
 			}
5183
 			}
5134
 
5184
 
5185
+			if adminUserInfo.Org.Id == 10766 {
5186
+				//乘10 除10是为了保留一位小数
5187
+				replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
5188
+			}
5189
+
5135
 			var firstOpeateTime = monitorList[0].OperateTime
5190
 			var firstOpeateTime = monitorList[0].OperateTime
5136
 			for _, item := range monitorList {
5191
 			for _, item := range monitorList {
5137
 				//超滤率
5192
 				//超滤率
5146
 
5201
 
5147
 				//置换量
5202
 				//置换量
5148
 				displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
5203
 				displacement_quantity := (math.Floor(float64(item.OperateTime+3600-firstOpeateTime)/3600) * replacement_rate) * 60 / 1000
5149
-				fmt.Println("displacement_quantity----------------------", displacement_quantity)
5204
+
5150
 				service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
5205
 				service.ModifyPatientDisplacementQuantity(item.ID, displacement_quantity)
5151
 
5206
 
5152
 			}
5207
 			}
5485
 			//重庆塘坝卫生院
5540
 			//重庆塘坝卫生院
5486
 			if adminInfo.Org.Id == 10742 || adminInfo.Org.Id == 10740 || adminInfo.Org.Id == 10745 || adminInfo.Org.Id == 9478 {
5541
 			if adminInfo.Org.Id == 10742 || adminInfo.Org.Id == 10740 || adminInfo.Org.Id == 10745 || adminInfo.Org.Id == 9478 {
5487
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater / float64(totalMin) * 60 * 1000)
5542
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater / float64(totalMin) * 60 * 1000)
5488
-				fmt.Println("ultrafiltration_rate--------------------", ultrafiltration_rate)
5489
 				record.UltrafiltrationRate = ultrafiltration_rate
5543
 				record.UltrafiltrationRate = ultrafiltration_rate
5490
 			}
5544
 			}
5491
 
5545
 
5585
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5639
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5586
 			}
5640
 			}
5587
 
5641
 
5642
+			if adminInfo.Org.Id == 10766 {
5643
+				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
5644
+				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5645
+			}
5646
+
5588
 			if adminInfo.Org.Id == 10757 {
5647
 			if adminInfo.Org.Id == 10757 {
5589
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
5648
 				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
5590
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5649
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5675
 	}
5734
 	}
5676
 
5735
 
5677
 	//长沙南雅
5736
 	//长沙南雅
5678
-	if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 || adminInfo.Org.Id == 10469 || adminInfo.Org.Id == 10375 || adminInfo.Org.Id == 10610 || adminInfo.Org.Id == 10537 || adminInfo.Org.Id == 10667 || adminInfo.Org.Id == 9478 {
5737
+	if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 || adminInfo.Org.Id == 10469 || adminInfo.Org.Id == 10375 || adminInfo.Org.Id == 10610 || adminInfo.Org.Id == 10537 || adminInfo.Org.Id == 10667 || adminInfo.Org.Id == 9478 || adminInfo.Org.Id == 10766 {
5679
 
5738
 
5680
 		if ultrafiltration_rate > 0 {
5739
 		if ultrafiltration_rate > 0 {
5681
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5740
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5724
 		record.UltrafiltrationVolume = 0
5783
 		record.UltrafiltrationVolume = 0
5725
 	}
5784
 	}
5726
 
5785
 
5727
-	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10164 || adminInfo.Org.Id == 10731 || adminInfo.Org.Id == 10752 || adminInfo.Org.Id == 10757 {
5786
+	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10164 || adminInfo.Org.Id == 10731 || adminInfo.Org.Id == 10752 || adminInfo.Org.Id == 10757 || adminInfo.Org.Id == 10766 {
5728
 		if ultrafiltration_rate > 0 {
5787
 		if ultrafiltration_rate > 0 {
5729
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5788
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5730
 			record.UltrafiltrationVolume = ultrafiltration_volume / 1000
5789
 			record.UltrafiltrationVolume = ultrafiltration_volume / 1000
5756
 		}
5815
 		}
5757
 	}
5816
 	}
5758
 
5817
 
5759
-	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10757 || adminInfo.Org.Id == 9478 || adminInfo.Org.Id == 10290 {
5818
+	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10757 || adminInfo.Org.Id == 10290 {
5760
 		var replacement_rate float64
5819
 		var replacement_rate float64
5761
 		var displacement_quantity float64
5820
 		var displacement_quantity float64
5762
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5821
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5768
 
5827
 
5769
 	}
5828
 	}
5770
 
5829
 
5771
-	if adminInfo.Org.Id == 10752 {
5830
+	if adminInfo.Org.Id == 10766 {
5772
 		var replacement_rate float64
5831
 		var replacement_rate float64
5773
 		var displacement_quantity float64
5832
 		var displacement_quantity float64
5774
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5833
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5775
 		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5834
 		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5776
 		record.ReplacementRate = replacement_rate
5835
 		record.ReplacementRate = replacement_rate
5777
-
5778
 		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5836
 		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5779
 		record.DisplacementQuantity = displacement_quantity
5837
 		record.DisplacementQuantity = displacement_quantity
5780
 
5838
 
5781
 	}
5839
 	}
5782
 
5840
 
5783
-	if adminInfo.Org.Id == 10740 || adminInfo.Org.Id == 10742 || adminInfo.Org.Id == 10745 || adminInfo.Org.Id == 9478 {
5841
+	if adminInfo.Org.Id == 9478 {
5842
+		var replacement_rate float64
5843
+		var displacement_quantity float64
5844
+		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5845
+		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5846
+		record.ReplacementRate = replacement_rate
5847
+		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5848
+		record.DisplacementQuantity = displacement_quantity
5849
+
5850
+	}
5784
 
5851
 
5852
+	if adminInfo.Org.Id == 10752 {
5785
 		var replacement_rate float64
5853
 		var replacement_rate float64
5786
 		var displacement_quantity float64
5854
 		var displacement_quantity float64
5787
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5855
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5788
 		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5856
 		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5789
 
5857
 
5790
 		record.ReplacementRate = replacement_rate
5858
 		record.ReplacementRate = replacement_rate
5859
+		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5860
+		record.DisplacementQuantity = displacement_quantity
5791
 
5861
 
5792
-		fmt.Println(math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600))
5862
+	}
5863
+
5864
+	if adminInfo.Org.Id == 10740 || adminInfo.Org.Id == 10742 || adminInfo.Org.Id == 10745 || adminInfo.Org.Id == 9478 || adminInfo.Org.Id == 10766 {
5865
+
5866
+		var replacement_rate float64
5867
+		var displacement_quantity float64
5868
+		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5869
+		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5870
+		record.ReplacementRate = replacement_rate
5793
 		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5871
 		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5794
 		record.DisplacementQuantity = displacement_quantity
5872
 		record.DisplacementQuantity = displacement_quantity
5795
 	}
5873
 	}
5827
 
5905
 
5828
 	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
5906
 	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
5829
 
5907
 
5908
+	fisrtMonitorRecordList, _ := service.GetFisrtMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
5909
+
5830
 	this.ServeSuccessJSON(map[string]interface{}{
5910
 	this.ServeSuccessJSON(map[string]interface{}{
5831
-		"monitor":               record,
5832
-		"lastMonitorRecordList": lastMonitorRecordList,
5911
+		"monitor":                record,
5912
+		"lastMonitorRecordList":  lastMonitorRecordList,
5913
+		"fisrtMonitorRecordList": fisrtMonitorRecordList,
5833
 	})
5914
 	})
5834
 
5915
 
5835
 }
5916
 }
6030
 		DialysisStrainer:       dialysis_strainer,
6111
 		DialysisStrainer:       dialysis_strainer,
6031
 	}
6112
 	}
6032
 
6113
 
6114
+	_, prescription := service.FindDialysisPrescriptionByReordDate(patient_id, record_date, adminUserInfo.Org.Id)
6115
+
6116
+	if prescription.ID > 0 {
6117
+		var endTime int64
6118
+		endTime = dialysisRecord.StartTime + prescription.DialysisDurationHour*3600 + prescription.DialysisDurationMinute*60
6119
+		dialysisRecord.EndTime = endTime
6120
+	}
6121
+
6033
 	//修改床位号需要重新消毒
6122
 	//修改床位号需要重新消毒
6034
 	if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 3877 {
6123
 	if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 3877 {
6035
 		service.UpdateDeviceInformation(tempDialysisRecord.PatientId, tempDialysisRecord.DialysisDate)
6124
 		service.UpdateDeviceInformation(tempDialysisRecord.PatientId, tempDialysisRecord.DialysisDate)
13012
 		"advice": advice,
13101
 		"advice": advice,
13013
 	})
13102
 	})
13014
 }
13103
 }
13104
+
13105
+func (c *DialysisAPIController) BatchAdviceCheckList() {
13106
+
13107
+	dataBody := make(map[string]interface{}, 0)
13108
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
13109
+	if err != nil {
13110
+		utils.ErrorLog(err.Error())
13111
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
13112
+		return
13113
+	}
13114
+	orgId := c.GetMobileAdminUserInfo().Org.Id
13115
+	patient_id := int64(dataBody["patient_id"].(float64))
13116
+	record_date := int64(dataBody["record_date"].(float64))
13117
+
13118
+	checker := int64(dataBody["checker"].(float64))
13119
+
13120
+	check_time := dataBody["check_time"].(string)
13121
+
13122
+	checkTime, parseStartDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", check_time)
13123
+	if parseStartDateErr != nil {
13124
+		c.ErrorLog("时间解析失败:%v", parseStartDateErr)
13125
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
13126
+		return
13127
+	}
13128
+	var advice_id []int64
13129
+	var his_advice_id []int64
13130
+	var project_id []int64
13131
+	var team_list []int64
13132
+	if dataBody["new_advice_list"] != nil && reflect.TypeOf(dataBody["new_advice_list"]).String() == "[]interface {}" {
13133
+		newAdviceList, _ := dataBody["new_advice_list"].([]interface{})
13134
+		if len(newAdviceList) > 0 {
13135
+			for _, item := range newAdviceList {
13136
+				items := item.(map[string]interface{})
13137
+				if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
13138
+					utils.ErrorLog("id")
13139
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
13140
+					return
13141
+				}
13142
+				id := int64(items["id"].(float64))
13143
+
13144
+				if items["origin"] == nil || reflect.TypeOf(items["origin"]).String() != "float64" {
13145
+					utils.ErrorLog("origin")
13146
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
13147
+					return
13148
+				}
13149
+				origin := int64(items["origin"].(float64))
13150
+
13151
+				if items["team_id"] == nil || reflect.TypeOf(items["team_id"]).String() != "float64" {
13152
+					utils.ErrorLog("team_id")
13153
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
13154
+					return
13155
+				}
13156
+				team_id := int64(items["team_id"].(float64))
13157
+
13158
+				if team_id == 0 {
13159
+
13160
+					//临时医嘱
13161
+					if origin == 1 {
13162
+						service.BatchAdviceDoctorList(patient_id, record_date, id, orgId, checker, checkTime.Unix())
13163
+						advice_id = append(advice_id, id)
13164
+					}
13165
+
13166
+					//his医嘱
13167
+					if origin == 2 {
13168
+						service.BatchHisAdviceDoctorList(patient_id, record_date, id, orgId, checker, checkTime.Unix())
13169
+						his_advice_id = append(his_advice_id, id)
13170
+					}
13171
+
13172
+					//his医嘱
13173
+					if origin == 3 {
13174
+						service.BatchHisPrescriptionProject(patient_id, record_date, id, orgId, checker, checkTime.Unix())
13175
+						project_id = append(project_id, id)
13176
+					}
13177
+				}
13178
+
13179
+				if team_id > 0 {
13180
+
13181
+					service.BatchCheckPrescriptionProject(patient_id, record_date, team_id, orgId, checker, checkTime.Unix())
13182
+					team_list = append(team_list, team_id)
13183
+				}
13184
+
13185
+			}
13186
+		}
13187
+	}
13188
+
13189
+	advice, _ := service.GetBatchAdviceList(advice_id)
13190
+
13191
+	hisadvice, _ := service.GetBatchHisAdviceList(his_advice_id)
13192
+
13193
+	hisproject, _ := service.GetBatchPrescriptionList(project_id)
13194
+
13195
+	teamlist, _ := service.GetBatchTeamList(team_list, patient_id, record_date, orgId)
13196
+
13197
+	c.ServeSuccessJSON(map[string]interface{}{
13198
+		"advice":     advice,
13199
+		"hisadvice":  hisadvice,
13200
+		"hisproject": hisproject,
13201
+		"teamlist":   teamlist,
13202
+	})
13203
+
13204
+	return
13205
+
13206
+}
13207
+
13208
+func (c *DialysisAPIController) BatchAdviceExeCutionList() {
13209
+
13210
+	dataBody := make(map[string]interface{}, 0)
13211
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
13212
+	if err != nil {
13213
+		utils.ErrorLog(err.Error())
13214
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
13215
+		return
13216
+	}
13217
+	orgId := c.GetMobileAdminUserInfo().Org.Id
13218
+	patient_id := int64(dataBody["patient_id"].(float64))
13219
+	record_date := int64(dataBody["record_date"].(float64))
13220
+
13221
+	execution_staff := int64(dataBody["execution_staff"].(float64))
13222
+
13223
+	execution_time := dataBody["execution_time"].(string)
13224
+
13225
+	executionTime, parseStartDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", execution_time)
13226
+	if parseStartDateErr != nil {
13227
+		c.ErrorLog("时间解析失败:%v", parseStartDateErr)
13228
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
13229
+		return
13230
+	}
13231
+	var advice_id []int64
13232
+	var his_advice_id []int64
13233
+	var project_id []int64
13234
+	var team_list []int64
13235
+	if dataBody["new_advice_list"] != nil && reflect.TypeOf(dataBody["new_advice_list"]).String() == "[]interface {}" {
13236
+		newAdviceList, _ := dataBody["new_advice_list"].([]interface{})
13237
+		if len(newAdviceList) > 0 {
13238
+			for _, item := range newAdviceList {
13239
+				items := item.(map[string]interface{})
13240
+				if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
13241
+					utils.ErrorLog("id")
13242
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
13243
+					return
13244
+				}
13245
+				id := int64(items["id"].(float64))
13246
+
13247
+				if items["origin"] == nil || reflect.TypeOf(items["origin"]).String() != "float64" {
13248
+					utils.ErrorLog("origin")
13249
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
13250
+					return
13251
+				}
13252
+				origin := int64(items["origin"].(float64))
13253
+
13254
+				if items["team_id"] == nil || reflect.TypeOf(items["team_id"]).String() != "float64" {
13255
+					utils.ErrorLog("team_id")
13256
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
13257
+					return
13258
+				}
13259
+				team_id := int64(items["team_id"].(float64))
13260
+
13261
+				if team_id == 0 {
13262
+					//临时医嘱
13263
+					if origin == 1 {
13264
+						service.BatchExecutionAdviceDoctorList(patient_id, record_date, id, orgId, execution_staff, executionTime.Unix())
13265
+						advice_id = append(advice_id, id)
13266
+					}
13267
+
13268
+					//his医嘱
13269
+					if origin == 2 {
13270
+						service.BatchExecutionHisAdviceDoctorList(patient_id, record_date, id, orgId, execution_staff, executionTime.Unix())
13271
+						his_advice_id = append(his_advice_id, id)
13272
+					}
13273
+
13274
+					//his医嘱
13275
+					if origin == 3 {
13276
+						service.BatchExecutionHisPrescriptionProject(patient_id, record_date, id, orgId, execution_staff, executionTime.Unix())
13277
+						project_id = append(project_id, id)
13278
+					}
13279
+
13280
+				}
13281
+
13282
+				if team_id > 0 {
13283
+					service.BatchExecutionPrescriptionProject(patient_id, record_date, team_id, orgId, execution_staff, executionTime.Unix())
13284
+					team_list = append(team_list, team_id)
13285
+				}
13286
+
13287
+			}
13288
+		}
13289
+	}
13290
+
13291
+	advice, _ := service.GetBatchAdviceList(advice_id)
13292
+
13293
+	hisadvice, _ := service.GetBatchHisAdviceList(his_advice_id)
13294
+
13295
+	hisproject, _ := service.GetBatchPrescriptionList(project_id)
13296
+
13297
+	teamlist, _ := service.GetBatchTeamList(team_list, patient_id, record_date, orgId)
13298
+
13299
+	c.ServeSuccessJSON(map[string]interface{}{
13300
+		"advice":     advice,
13301
+		"hisadvice":  hisadvice,
13302
+		"hisproject": hisproject,
13303
+		"teamlist":   teamlist,
13304
+	})
13305
+	return
13306
+}

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

233
 	beego.Router("/m/api/savelongadvicetemplate", &DialysisAPIController{}, "Post:SaveLongAdviceTemplate")
233
 	beego.Router("/m/api/savelongadvicetemplate", &DialysisAPIController{}, "Post:SaveLongAdviceTemplate")
234
 
234
 
235
 	beego.Router("/m/api/stoplongadvice", &DialysisAPIController{}, "Get:StopLongAdvice")
235
 	beego.Router("/m/api/stoplongadvice", &DialysisAPIController{}, "Get:StopLongAdvice")
236
+
237
+	beego.Router("/m/api/batchadvicechecklist", &DialysisAPIController{}, "Post:BatchAdviceCheckList")
238
+
239
+	beego.Router("/m/api/batchadviceexecutionlist", &DialysisAPIController{}, "Post:BatchAdviceExeCutionList")
236
 }
240
 }

+ 3 - 3
controllers/mobile_api_controllers/patient_api_controller.go View File

3878
 	if evaluation.DryWeight > 0 {
3878
 	if evaluation.DryWeight > 0 {
3879
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3879
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3880
 
3880
 
3881
-		if template.TemplateId == 17 || template.TemplateId == 22 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 34 || template.TemplateId == 32 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10551 || adminUserInfo.Org.Id == 10579 || adminUserInfo.Org.Id == 10580 || adminUserInfo.Org.Id == 10585 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10751 || adminUserInfo.Org.Id == 10752 || adminUserInfo.Org.Id == 10757 || adminUserInfo.Org.Id == 9478 {
3881
+		if template.TemplateId == 17 || template.TemplateId == 22 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 34 || template.TemplateId == 32 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10551 || adminUserInfo.Org.Id == 10579 || adminUserInfo.Org.Id == 10580 || adminUserInfo.Org.Id == 10585 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10751 || adminUserInfo.Org.Id == 10752 || adminUserInfo.Org.Id == 10757 || adminUserInfo.Org.Id == 9478 || adminUserInfo.Org.Id == 10766 {
3882
 
3882
 
3883
-			if adminUserInfo.Org.Id != 10551 && adminUserInfo.Org.Id != 10579 && adminUserInfo.Org.Id != 10580 && adminUserInfo.Org.Id != 10585 && adminUserInfo.Org.Id != 10752 && adminUserInfo.Org.Id != 9478 {
3883
+			if adminUserInfo.Org.Id != 10551 && adminUserInfo.Org.Id != 10579 && adminUserInfo.Org.Id != 10580 && adminUserInfo.Org.Id != 10585 && adminUserInfo.Org.Id != 10752 && adminUserInfo.Org.Id != 9478 && adminUserInfo.Org.Id != 10766 {
3884
 				dewater_amount = dewater_amount * 1000
3884
 				dewater_amount = dewater_amount * 1000
3885
 			}
3885
 			}
3886
 
3886
 
4603
 	}
4603
 	}
4604
 
4604
 
4605
 	//针对孝昌康桥超滤率计算问题
4605
 	//针对孝昌康桥超滤率计算问题
4606
-	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10726 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 10751 || adminUserInfo.Org.Id == 10752 || adminUserInfo.Org.Id == 10757 || adminUserInfo.Org.Id == 9478 {
4606
+	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10726 || adminUserInfo.Org.Id == 10164 || adminUserInfo.Org.Id == 10751 || adminUserInfo.Org.Id == 10752 || adminUserInfo.Org.Id == 10757 || adminUserInfo.Org.Id == 9478 || adminUserInfo.Org.Id == 10766 {
4607
 		if evaluation.ID == 0 {
4607
 		if evaluation.ID == 0 {
4608
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4608
 			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4609
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4609
 			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {

+ 1 - 1
controllers/schedule_api_controller.go View File

4859
 	}
4859
 	}
4860
 
4860
 
4861
 	//查询排班里面的空透析器
4861
 	//查询排班里面的空透析器
4862
-	if adminInfo.CurrentOrgId == 10375 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 9538 || adminInfo.CurrentOrgId == 10742 || adminInfo.CurrentOrgId == 10387 || adminInfo.CurrentOrgId == 10740 {
4862
+	if adminInfo.CurrentOrgId == 10375 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 9538 || adminInfo.CurrentOrgId == 10742 || adminInfo.CurrentOrgId == 10387 || adminInfo.CurrentOrgId == 10740 || adminInfo.CurrentOrgId == 10766 || adminInfo.CurrentOrgId == 9478 {
4863
 
4863
 
4864
 		schedulesFive, _ := service.GetWeekScheduleFive(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4864
 		schedulesFive, _ := service.GetWeekScheduleFive(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4865
 
4865
 

+ 100 - 0
service/dialysis_service.go View File

2804
 
2804
 
2805
 	return advice, err
2805
 	return advice, err
2806
 }
2806
 }
2807
+
2808
+func BatchAdviceDoctorList(patient_id int64, advice_date int64, id int64, user_org_id int64, checker int64, check_time int64) (models.DoctorAdvice, error) {
2809
+
2810
+	advice := models.DoctorAdvice{}
2811
+
2812
+	err := XTWriteDB().Model(&advice).Where("id = ? and patient_id = ? and advice_date =? and user_org_id = ? and check_state=0", id, patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"checker": checker, "check_state": 1, "check_time": check_time}).Error
2813
+
2814
+	return advice, err
2815
+}
2816
+
2817
+func BatchHisAdviceDoctorList(patient_id int64, advice_date int64, id int64, user_org_id int64, checker int64, check_time int64) (models.HisDoctorAdvice, error) {
2818
+
2819
+	advice := models.HisDoctorAdvice{}
2820
+
2821
+	err := XTWriteDB().Model(&advice).Where("id = ? and patient_id = ? and advice_date =? and user_org_id = ? and check_state=0", id, patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"checker": checker, "check_state": 1, "check_time": check_time}).Error
2822
+
2823
+	return advice, err
2824
+}
2825
+
2826
+func BatchHisPrescriptionProject(patient_id int64, record_date int64, id int64, user_org_id int64, checker int64, check_time int64) (models.HisPrescriptionProject, error) {
2827
+
2828
+	project := models.HisPrescriptionProject{}
2829
+
2830
+	err := XTWriteDB().Model(&project).Where("id = ? and patient_id = ? and record_date =? and user_org_id = ? and check_state=0", id, patient_id, record_date, user_org_id).Updates(map[string]interface{}{"checker": checker, "check_state": 1, "check_time": check_time}).Error
2831
+
2832
+	return project, err
2833
+
2834
+}
2835
+
2836
+func BatchExecutionAdviceDoctorList(patient_id int64, advice_date int64, id int64, user_org_id int64, execution_staff int64, execution_time int64) (models.DoctorAdvice, error) {
2837
+
2838
+	advice := models.DoctorAdvice{}
2839
+
2840
+	err := XTWriteDB().Model(&advice).Where("id = ? and patient_id = ? and advice_date =? and user_org_id = ? and (execution_state=2 or execution_state=0)", id, patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"execution_staff": execution_staff, "execution_state": 1, "execution_time": execution_time}).Error
2841
+
2842
+	return advice, err
2843
+}
2844
+
2845
+func BatchExecutionHisAdviceDoctorList(patient_id int64, advice_date int64, id int64, user_org_id int64, execution_staff int64, execution_time int64) (models.HisDoctorAdviceInfo, error) {
2846
+
2847
+	advice := models.HisDoctorAdviceInfo{}
2848
+
2849
+	err := XTWriteDB().Model(&advice).Where("id = ? and patient_id = ? and advice_date =? and user_org_id = ? and (execution_state=2 or execution_state=0)", id, patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"execution_staff": execution_staff, "execution_state": 1, "execution_time": execution_time}).Error
2850
+
2851
+	return advice, err
2852
+}
2853
+
2854
+func BatchExecutionHisPrescriptionProject(patient_id int64, advice_date int64, id int64, user_org_id int64, execution_staff int64, execution_time int64) (models.HisPrescriptionProject, error) {
2855
+
2856
+	project := models.HisPrescriptionProject{}
2857
+	err := XTWriteDB().Model(&project).Where("id = ? and patient_id = ? and record_date =? and user_org_id = ? and (execution_state=2 or execution_state=0)", id, patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"execution_staff": execution_staff, "execution_state": 1, "execution_time": execution_time}).Error
2858
+
2859
+	return project, err
2860
+}
2861
+
2862
+func BatchExecutionPrescriptionProject(patient_id int64, advice_date int64, team_id int64, user_org_id int64, execution_staff int64, execution_time int64) (models.HisPrescriptionProject, error) {
2863
+
2864
+	project := models.HisPrescriptionProject{}
2865
+
2866
+	err := XTWriteDB().Model(&project).Where("team_id = ? and patient_id = ? and record_date =? and user_org_id = ? and (execution_state=2 or execution_state=0)", team_id, patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"execution_staff": execution_staff, "execution_state": 1, "execution_time": execution_time}).Error
2867
+
2868
+	return project, err
2869
+}
2870
+
2871
+func GetBatchAdviceList(id []int64) (advice []*models.DoctorAdvice, err error) {
2872
+
2873
+	err = XTReadDB().Where("id in(?) and status=1", id).Find(&advice).Error
2874
+
2875
+	return advice, err
2876
+}
2877
+
2878
+func GetBatchHisAdviceList(id []int64) (hisadvice []*models.HisDoctorAdvice, err error) {
2879
+
2880
+	err = XTReadDB().Where("id in(?) and status=1", id).Find(&hisadvice).Error
2881
+
2882
+	return hisadvice, err
2883
+}
2884
+
2885
+func GetBatchPrescriptionList(id []int64) (project []*models.HisPrescriptionProject, err error) {
2886
+
2887
+	err = XTReadDB().Where("id in(?) and status=1", id).Find(&project).Error
2888
+
2889
+	return project, err
2890
+}
2891
+
2892
+func GetBatchTeamList(team_id []int64, patient_id int64, record_date int64, orgId int64) (list []*models.HisPrescriptionProject, err error) {
2893
+
2894
+	err = XTReadDB().Where("team_id in(?) and status=1 and patient_id = ? and record_date = ? and user_org_id =?", team_id, patient_id, record_date, orgId).Find(&list).Error
2895
+
2896
+	return list, err
2897
+}
2898
+
2899
+func BatchCheckPrescriptionProject(patient_id int64, advice_date int64, team_id int64, user_org_id int64, checker int64, check_time int64) (models.HisPrescriptionProject, error) {
2900
+
2901
+	project := models.HisPrescriptionProject{}
2902
+
2903
+	err := XTWriteDB().Model(&project).Where("team_id = ? and patient_id = ? and record_date =? and user_org_id = ? and (check_state=2 or check_state=0)", team_id, patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"checker": checker, "check_state": 1, "check_time": check_time}).Error
2904
+
2905
+	return project, err
2906
+}

+ 9 - 0
service/gobal_config_service.go View File

1201
 
1201
 
1202
 }
1202
 }
1203
 
1203
 
1204
+func GetFisrtMonitorRecordList(patient_id int64, schedule_date int64, user_org_id int64) (models.MonitoringRecord, error) {
1205
+
1206
+	record := models.MonitoringRecord{}
1207
+	var err error
1208
+	err = XTReadDB().Where("patient_id =? and monitoring_date = ? and user_org_id = ? and status = 1", patient_id, schedule_date, user_org_id).Order("operate_time asc").First(&record).Error
1209
+
1210
+	return record, err
1211
+}
1212
+
1204
 func GetLastAfter(patient_id int64, schedule_date int64, user_org_id int64) (models.XtAssessmentAfterDislysis, error) {
1213
 func GetLastAfter(patient_id int64, schedule_date int64, user_org_id int64) (models.XtAssessmentAfterDislysis, error) {
1205
 
1214
 
1206
 	dislysis := models.XtAssessmentAfterDislysis{}
1215
 	dislysis := models.XtAssessmentAfterDislysis{}

+ 6 - 5
service/his_config_service.go View File

1
 package service
1
 package service
2
 
2
 
3
 import (
3
 import (
4
+	"fmt"
5
+	"reflect"
6
+	"strconv"
7
+	"time"
8
+
4
 	"XT_New/enums"
9
 	"XT_New/enums"
5
 	"XT_New/models"
10
 	"XT_New/models"
6
 	"XT_New/utils"
11
 	"XT_New/utils"
7
-	"fmt"
8
 	"github.com/astaxie/beego/config"
12
 	"github.com/astaxie/beego/config"
9
 	"golang.org/x/sync/errgroup"
13
 	"golang.org/x/sync/errgroup"
10
-
11
-	"reflect"
12
-	"strconv"
13
-	"time"
14
 )
14
 )
15
 
15
 
16
 func GetHisPrescriptionTemplatesList(patient_id int64, org_id int64, page int64, limit int64) (templates []*models.HisPrescriptionTemplate, total int64, err error) {
16
 func GetHisPrescriptionTemplatesList(patient_id int64, org_id int64, page int64, limit int64) (templates []*models.HisPrescriptionTemplate, total int64, err error) {
689
 		}
689
 		}
690
 	}()
690
 	}()
691
 	var g errgroup.Group
691
 	var g errgroup.Group
692
+
692
 	var tmp []*models.DialysisPatient
693
 	var tmp []*models.DialysisPatient
693
 	err = tx.Raw("select his_prescription_advice_template.id from his_prescription_advice_template,("+
694
 	err = tx.Raw("select his_prescription_advice_template.id from his_prescription_advice_template,("+
694
 		"select his_prescription_info_template.id from his_prescription_info_template,("+
695
 		"select his_prescription_info_template.id from his_prescription_info_template,("+

+ 1 - 1
service/mobile_dialysis_service.go View File

2275
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2275
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2276
 	tx := writeDb.Begin()
2276
 	tx := writeDb.Begin()
2277
 	updateTime := time.Now().Unix()
2277
 	updateTime := time.Now().Unix()
2278
-	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse, "quality_nurse_id": order.QualityNurseId, "puncture_needle": order.PunctureNeedle, "puncture_way": order.PunctureWay, "dialysis_dialyszers": order.DialysisDialyszers, "dialysis_irrigation": order.DialysisIrrigation, "blood_access_id": order.BloodAccessId, "nuclein_date": order.NucleinDate, "schedule_remark": order.ScheduleRemark, "order_remark": order.OrderRemark, "catheter_operation": order.CatheterOperation, "blood_flow_volume": order.BloodFlowVolume, "blood_drawing": order.BloodDrawing, "dialysis_strainer": order.DialysisStrainer}).Error
2278
+	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse, "quality_nurse_id": order.QualityNurseId, "puncture_needle": order.PunctureNeedle, "puncture_way": order.PunctureWay, "dialysis_dialyszers": order.DialysisDialyszers, "dialysis_irrigation": order.DialysisIrrigation, "blood_access_id": order.BloodAccessId, "nuclein_date": order.NucleinDate, "schedule_remark": order.ScheduleRemark, "order_remark": order.OrderRemark, "catheter_operation": order.CatheterOperation, "blood_flow_volume": order.BloodFlowVolume, "blood_drawing": order.BloodDrawing, "dialysis_strainer": order.DialysisStrainer, "end_time": order.EndTime}).Error
2279
 	if err != nil {
2279
 	if err != nil {
2280
 		tx.Rollback()
2280
 		tx.Rollback()
2281
 		return err
2281
 		return err