Browse Source

2024/6/17

28169 1 week ago
parent
commit
80bfbb85b0

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

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

+ 6 - 2
controllers/dialysis_api_controller.go View File

@@ -6353,8 +6353,11 @@ func (c *DialysisApiController) GetInitPrintData() {
6353 6353
 
6354 6354
 	patient_id, _ := c.GetInt64("patient_id")
6355 6355
 	record_date, _ := c.GetInt64("record_date")
6356
+
6356 6357
 	orgId := c.GetAdminUserInfo().CurrentOrgId
6357
-	list, err := service.GetInitPrintData(patient_id, record_date, orgId)
6358
+	schedule, _ := service.GetPatientBySchedule(patient_id, record_date, orgId)
6359
+	list, err := service.GetInitPrintData(patient_id, record_date, orgId, schedule.ModeId)
6360
+
6358 6361
 	assessmentAfterDislysis, _ := service.GetLastWeightAfter(patient_id, record_date, orgId)
6359 6362
 	if err == nil {
6360 6363
 		c.ServeSuccessJSON(map[string]interface{}{
@@ -6384,7 +6387,8 @@ func (c *DialysisApiController) GetInitPrintDataOne() {
6384 6387
 		theStartTime = theTime.Unix()
6385 6388
 	}
6386 6389
 	orgId := c.GetAdminUserInfo().CurrentOrgId
6387
-	list, err := service.GetInitPrintData(patient_id, theStartTime, orgId)
6390
+	schedule, _ := service.GetPatientBySchedule(patient_id, theStartTime, orgId)
6391
+	list, err := service.GetInitPrintData(patient_id, theStartTime, orgId, schedule.ModeId)
6388 6392
 	assessmentAfterDislysis, _ := service.GetLastWeightAfter(patient_id, theStartTime, orgId)
6389 6393
 	if err == nil {
6390 6394
 		c.ServeSuccessJSON(map[string]interface{}{

+ 2 - 0
controllers/his_api_controller.go View File

@@ -3217,6 +3217,8 @@ func (c *HisApiController) CreateHisPrescription() {
3217 3217
 											//查询该患者耗材的历史数据
3218 3218
 											ordProject, _ := service.GetHisProjectPrescriptionByPatientIdOne(id)
3219 3219
 
3220
+											fmt.Println("ordProject-----------------------", ordProject.ProjectId)
3221
+
3220 3222
 											count, _ := strconv.ParseInt(ordProject.Count, 10, 64)
3221 3223
 
3222 3224
 											//数量发生改变

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

@@ -3045,6 +3045,10 @@ func (c *DialysisAPIController) Finish() {
3045 3045
 			lastWeightAfter.LastAfterWeight = floatAfeter
3046 3046
 		}
3047 3047
 
3048
+		if adminUserInfo.Org.Id == 10624 {
3049
+			tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume / 1000
3050
+		}
3051
+
3048 3052
 	}
3049 3053
 
3050 3054
 	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 {

+ 10 - 0
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -4312,6 +4312,16 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
4312 4312
 		}
4313 4313
 	}
4314 4314
 
4315
+	if adminUserInfo.Org.Id == 10597 {
4316
+		if evaluation.ID > 0 {
4317
+			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4318
+			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4319
+				dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
4320
+				service.UpdateMobileGetDialysisPrescribe(dialysisPrescribeOne.ID, dewater_amount)
4321
+			}
4322
+		}
4323
+	}
4324
+
4315 4325
 	err = service.UpadatePredialysisEvaluation(&evaluation)
4316 4326
 
4317 4327
 	//记录日志

+ 77 - 13
controllers/patient_api_controller.go View File

@@ -8543,7 +8543,6 @@ func (this *PatientApiController) GetAutoPatientContent() {
8543 8543
 	end_time := this.GetString("end_time")
8544 8544
 	patient_id, _ := this.GetInt64("patient_id")
8545 8545
 
8546
-	fmt.Println("patinet_id ===========================", patient_id)
8547 8546
 	orgId := this.GetAdminUserInfo().CurrentOrgId
8548 8547
 	var startTime int64
8549 8548
 	if len(start_time) > 0 {
@@ -8568,16 +8567,42 @@ func (this *PatientApiController) GetAutoPatientContent() {
8568 8567
 	//获取透析处方
8569 8568
 	prescription, _ := service.GetAutoDialysisPrescription(patient_id, startTime, endTime, orgId)
8570 8569
 
8571
-	maxPrescription, _ := service.GetAutoMaxDialysisPrescription(patient_id, startTime, endTime, orgId)
8570
+	groupPrescriptionList, _ := service.GetDialysisPrescriptionGroup(patient_id, startTime, endTime, orgId)
8572 8571
 
8573
-	minPrescription, _ := service.GetAutoMinDialysisPrescription(patient_id, startTime, endTime, orgId)
8572
+	if len(groupPrescriptionList) > 0 {
8573
+
8574
+		for _, item := range groupPrescriptionList {
8575
+
8576
+			maxDialysisPrescription, _ := service.GetAutoMaxDialysisPrescription(patient_id, startTime, endTime, orgId)
8577
+
8578
+			item.MaxZongLiang = maxDialysisPrescription.AnticoagulantZongliang
8579
+
8580
+			minDialysisPrescription, _ := service.GetAutoMinDialysisPrescription(patient_id, startTime, endTime, orgId)
8581
+
8582
+			item.MinZongLiang = minDialysisPrescription.AnticoagulantZongliang
8583
+
8584
+		}
8585
+	}
8574 8586
 
8575 8587
 	berfor, _ := service.GetAutoAssessmentBefor(patient_id, startTime, endTime, orgId)
8576 8588
 
8589
+	if len(berfor) > 0 {
8590
+		for _, item := range berfor {
8591
+			afterDislysis, _ := service.GetLastAfterWeight(item.PatientId, item.AssessmentDate, item.UserOrgId)
8592
+			item.WeightAfter = afterDislysis.WeightAfter
8593
+		}
8594
+	}
8595
+
8577 8596
 	monitorList, _ := service.GetAutoMonitorList(patient_id, startTime, endTime, orgId)
8578 8597
 
8598
+	//获取最大血流量
8599
+
8600
+	monitor, _ := service.MaxMonitorByBloodFlow(patient_id, startTime, endTime, orgId)
8601
+
8579 8602
 	dryweightList, _ := service.GetAutoPatientDryWeight(patient_id, startTime, endTime, orgId)
8580 8603
 
8604
+	lastDryWeight, _ := service.GetPatientLastDryWeightObj(patient_id, startTime, endTime, orgId)
8605
+
8581 8606
 	inpectionList, _ := service.GetAutoInspectionList(patient_id, startTime, endTime, orgId)
8582 8607
 
8583 8608
 	dialysisOrder, _ := service.GetAutoDialysisOrder(patient_id, startTime, endTime, orgId)
@@ -8586,17 +8611,56 @@ func (this *PatientApiController) GetAutoPatientContent() {
8586 8611
 
8587 8612
 	longAdvice, _ := service.GetLongDoctorAdvice(orgId, patient_id, startTime, endTime)
8588 8613
 
8614
+	after, _ := service.GetAutoAfterWeight(patient_id, startTime, endTime, orgId)
8615
+
8616
+	maxBeforSystolicBloodPressure, _ := service.GetMaxAssessmentBforSystolicBloodPressure(patient_id, startTime, endTime, orgId)
8617
+
8618
+	minBeforSystolicBloodPressure, _ := service.GetMminAssessmentBforSystolicBloodPressure(patient_id, startTime, endTime, orgId)
8619
+
8620
+	maxBeforDiastolicBloodPressure, _ := service.GetMaxAssessmentBforDiastolicBloodPressure(patient_id, startTime, endTime, orgId)
8621
+	minBeforDiastolicBloodPressure, _ := service.GetMinAssessmentBforDiastolicBloodPressure(patient_id, startTime, endTime, orgId)
8622
+
8623
+	maxAfterSystolicBloodPressure, _ := service.GetMaxAssessmentAfterSystolicBloodPressure(patient_id, startTime, endTime, orgId)
8624
+
8625
+	minAfterSystolicBloodPressure, _ := service.GetMinAssessmentAfterSystolicBloodPressure(patient_id, startTime, endTime, orgId)
8626
+
8627
+	maxAfterDiastolicBloodPressure, _ := service.GetMaxAssessmentAfterDiastolicBloodPressureList(patient_id, startTime, endTime, orgId)
8628
+
8629
+	minAfterDiastolicBloodPressure, _ := service.GetMinAssessmentAfterDiastolicBloodPressureList(patient_id, startTime, endTime, orgId)
8630
+
8631
+	maxMonitorSystolicBloodPressure, _ := service.GetMaxMonitorSystolicBloodPressure(patient_id, startTime, endTime, orgId)
8632
+
8633
+	minMonitorSystolicBloodPressure, _ := service.GetMinMonitorSystolicBloodPressure(patient_id, startTime, endTime, orgId)
8634
+
8635
+	maxMonitorDiastolicBloodPressure, _ := service.GetMaxMonitorDiastolicBloodPressure(patient_id, startTime, endTime, orgId)
8636
+
8637
+	minMonitorDiastolicBloodPressure, _ := service.GetMinMonitorDiastolicBloodPressure(patient_id, startTime, endTime, orgId)
8638
+
8589 8639
 	this.ServeSuccessJSON(map[string]interface{}{
8590
-		"prescription":    prescription,
8591
-		"berfor":          berfor,
8592
-		"monitorList":     monitorList,
8593
-		"dryweightList":   dryweightList,
8594
-		"inpectionList":   inpectionList,
8595
-		"dialysisOrder":   dialysisOrder,
8596
-		"patient":         patient,
8597
-		"longAdvice":      longAdvice,
8598
-		"maxPrescription": maxPrescription,
8599
-		"minPrescription": minPrescription,
8640
+		"prescription":                         prescription,
8641
+		"berfor":                               berfor,
8642
+		"monitorList":                          monitorList,
8643
+		"dryweightList":                        dryweightList,
8644
+		"inpectionList":                        inpectionList,
8645
+		"dialysisOrder":                        dialysisOrder,
8646
+		"patient":                              patient,
8647
+		"longAdvice":                           longAdvice,
8648
+		"groupPrescriptionList":                groupPrescriptionList,
8649
+		"after":                                after,
8650
+		"max_blood_flow_volume":                monitor.BloodFlowVolume,
8651
+		"max_befor_systolic_blood_pressure":    maxBeforSystolicBloodPressure.SystolicBloodPressure,
8652
+		"min_befor_systolic_blood_pressure":    minBeforSystolicBloodPressure.SystolicBloodPressure,
8653
+		"max_befor_diastolic_blood_pressure":   maxBeforDiastolicBloodPressure.DiastolicBloodPressure,
8654
+		"min_befor_diastolic_blood_pressure":   minBeforDiastolicBloodPressure.DiastolicBloodPressure,
8655
+		"max_after_systolic_blood_pressure":    maxAfterSystolicBloodPressure.SystolicBloodPressure,
8656
+		"min_after_systolic_blood_pressure":    minAfterSystolicBloodPressure.SystolicBloodPressure,
8657
+		"max_after_diastolic_blood_pressure":   maxAfterDiastolicBloodPressure.DiastolicBloodPressure,
8658
+		"min_after_diastolic_blood_pressure":   minAfterDiastolicBloodPressure.DiastolicBloodPressure,
8659
+		"max_monitor_systolic_blood_pressure":  maxMonitorSystolicBloodPressure.SystolicBloodPressure,
8660
+		"min_monitor_systolic_blood_pressure":  minMonitorSystolicBloodPressure.SystolicBloodPressure,
8661
+		"max_monitor_diastolic_blood_pressure": maxMonitorDiastolicBloodPressure.DiastolicBloodPressure,
8662
+		"min_monitor_diastolic_blood_pressure": minMonitorDiastolicBloodPressure.DiastolicBloodPressure,
8663
+		"lastDryWeight":                        lastDryWeight,
8600 8664
 	})
8601 8665
 
8602 8666
 }

+ 65 - 0
models/patient_models.go View File

@@ -3015,3 +3015,68 @@ func (XtAutoDialysisPrescription) TableName() string {
3015 3015
 
3016 3016
 	return "xt_dialysis_prescription"
3017 3017
 }
3018
+
3019
+type XtDialysisPrescriptionList struct {
3020
+	ID                     int64                         `gorm:"column:id" json:"id" form:"id"`
3021
+	UserOrgId              int64                         `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
3022
+	PatientId              int64                         `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
3023
+	Anticoagulant          int64                         `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
3024
+	AnticoagulantZongliang float64                       `gorm:"column:anticoagulant_zongliang" json:"anticoagulant_zongliang" form:"anticoagulant_zongliang"`
3025
+	Status                 int64                         `gorm:"column:status" json:"status" form:"status"`
3026
+	CreatedTime            int64                         `gorm:"column:created_time" json:"created_time" form:"created_time"`
3027
+	UpdatedTime            int64                         `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
3028
+	RecordDate             int64                         `gorm:"column:record_date" json:"record_date" form:"record_date"`
3029
+	MinAnticoagulant       XtDialysisPrescriptionListOne `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,RecordDate" json:"prescription"`
3030
+	MaxAnticoagulant       XtDialysisPrescriptionListOne `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,RecordDate" json:"prescription"`
3031
+	MaxZongLiang           float64
3032
+	MinZongLiang           float64
3033
+}
3034
+
3035
+func (XtDialysisPrescriptionList) TableName() string {
3036
+
3037
+	return "xt_dialysis_prescription"
3038
+}
3039
+
3040
+type XtDialysisPrescriptionListOne struct {
3041
+	ID                     int64   `gorm:"column:id" json:"id" form:"id"`
3042
+	UserOrgId              int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
3043
+	PatientId              int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
3044
+	Anticoagulant          int64   `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
3045
+	AnticoagulantZongliang float64 `gorm:"column:anticoagulant_zongliang" json:"anticoagulant_zongliang" form:"anticoagulant_zongliang"`
3046
+	Status                 int64   `gorm:"column:status" json:"status" form:"status"`
3047
+	RecordDate             int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
3048
+}
3049
+
3050
+func (XtDialysisPrescriptionListOne) TableName() string {
3051
+
3052
+	return "xt_dialysis_prescription"
3053
+}
3054
+
3055
+type BtAssessmentBeforeDislysis struct {
3056
+	ID                     int64   `gorm:"column:id" json:"id" form:"id"`
3057
+	UserOrgId              int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
3058
+	PatientId              int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
3059
+	AssessmentDate         int64   `gorm:"column:assessment_date" json:"assessment_date" form:"assessment_date"`
3060
+	DialysisOrderId        int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
3061
+	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure" form:"systolic_blood_pressure"`
3062
+	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure" form:"diastolic_blood_pressure"`
3063
+	DryWeight              float64 `gorm:"column:dry_weight" json:"dry_weight" form:"dry_weight"`
3064
+	WeighingWay            string  `gorm:"column:weighing_way" json:"weighing_way" form:"weighing_way"`
3065
+	WeighingBefore         float64 `gorm:"column:weighing_before" json:"weighing_before" form:"weighing_before"`
3066
+	AdditionalWeight       float64 `gorm:"column:additional_weight" json:"additional_weight" form:"additional_weight"`
3067
+	WeightBefore           float64 `gorm:"column:weight_before" json:"weight_before" form:"weight_before"`
3068
+	Status                 int64   `gorm:"column:status" json:"status" form:"status"`
3069
+	CreatedTime            int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
3070
+	UpdatedTime            int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
3071
+	Modifier               int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
3072
+	BloodAccessPartId      string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
3073
+	BloodAccessPartOperaId int64   `gorm:"column:blood_access_part_opera_id" json:"blood_access_part_opera_id" form:"blood_access_part_opera_id"`
3074
+	AssessmentDoctor       int64   `gorm:"column:assessment_doctor" json:"assessment_doctor" form:"assessment_doctor"`
3075
+	AssessmentTime         int64   `gorm:"column:assessment_time" json:"assessment_time" form:"assessment_time"`
3076
+	WeightAfter            float64
3077
+}
3078
+
3079
+func (BtAssessmentBeforeDislysis) TableName() string {
3080
+
3081
+	return "xt_assessment_before_dislysis"
3082
+}

+ 148 - 7
service/patient_service.go View File

@@ -4560,20 +4560,31 @@ func GetAutoDialysisPrescription(patient_id int64, start_time int64, end_time in
4560 4560
 	return prescription, err
4561 4561
 }
4562 4562
 
4563
-func GetAutoMaxDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (models.DialysisPrescription, error) {
4563
+func GetDialysisPrescriptionGroup(patient_id int64, start_time int64, end_time int64, org_id int64) (list []*models.XtDialysisPrescriptionList, err error) {
4564 4564
 
4565
-	prescription := models.DialysisPrescription{}
4566
-	err := XTReadDB().Raw("select MAX(anticoagulant_zongliang) from xt_dialysis_prescripiton where patient_id = ? and record_date>=? and record_date<=? and org_id = ?", patient_id, start_time, end_time, org_id).Scan(&prescription).Error
4565
+	err = XTReadDB().Where("patient_id = ? and record_date >=? and record_date <=? and user_org_id = ? and status=1", patient_id, start_time, end_time, org_id).Group("anticoagulant").Find(&list).Error
4566
+
4567
+	return list, err
4568
+}
4569
+
4570
+func GetDialysisPrescriptionMaxAnticoagulant() {
4571
+
4572
+}
4573
+
4574
+func GetAutoMaxDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtDialysisPrescriptionListOne, error) {
4575
+
4576
+	prescription := models.XtDialysisPrescriptionListOne{}
4577
+	err := XTReadDB().Raw("select MAX(anticoagulant_zongliang) as anticoagulant_zongliang from xt_dialysis_prescription where patient_id = ? and record_date>=? and record_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&prescription).Error
4567 4578
 	return prescription, err
4568 4579
 }
4569 4580
 
4570
-func GetAutoMinDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (models.DialysisPrescription, error) {
4571
-	prescription := models.DialysisPrescription{}
4572
-	err := XTReadDB().Raw("select Min(anticoagulant_zongliang) from xt_dialysis_prescripiton where patient_id = ? and record_date>=? and record_date<=? and org_id = ?", patient_id, start_time, end_time, org_id).Scan(&prescription).Error
4581
+func GetAutoMinDialysisPrescription(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtDialysisPrescriptionListOne, error) {
4582
+	prescription := models.XtDialysisPrescriptionListOne{}
4583
+	err := XTReadDB().Raw("select Min(anticoagulant_zongliang) as anticoagulant_zongliang from xt_dialysis_prescription where patient_id = ? and record_date>=? and record_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&prescription).Error
4573 4584
 	return prescription, err
4574 4585
 }
4575 4586
 
4576
-func GetAutoAssessmentBefor(patient_id int64, start_time int64, end_time int64, org_id int64) (berfor []*models.XtAssessmentBeforeDislysis, err error) {
4587
+func GetAutoAssessmentBefor(patient_id int64, start_time int64, end_time int64, org_id int64) (berfor []*models.BtAssessmentBeforeDislysis, err error) {
4577 4588
 
4578 4589
 	db := XTReadDB().Model(&berfor).Where("status=1")
4579 4590
 
@@ -4595,6 +4606,37 @@ func GetAutoAssessmentBefor(patient_id int64, start_time int64, end_time int64,
4595 4606
 	return berfor, err
4596 4607
 }
4597 4608
 
4609
+func GetAutoAfterWeight(patient_id int64, start_time int64, end_time int64, org_id int64) (after []*models.XtAssessmentAfterDislysis, err error) {
4610
+
4611
+	db := XTReadDB().Model(&after).Where("status=1")
4612
+
4613
+	if patient_id > 0 {
4614
+		db = db.Where("patient_id = ?", patient_id)
4615
+	}
4616
+
4617
+	if start_time > 0 {
4618
+		db = db.Where("assessment_date>=?", start_time)
4619
+	}
4620
+
4621
+	if end_time > 0 {
4622
+		db = db.Where("assessment_date<=?", end_time)
4623
+	}
4624
+	if org_id > 0 {
4625
+		db = db.Where("user_org_id = ?", org_id)
4626
+	}
4627
+	err = db.Find(&after).Error
4628
+	return after, err
4629
+}
4630
+
4631
+func GetLastAfterWeight(patient_id int64, assessment_date int64, user_org_id int64) (models.XtAssessmentAfterDislysis, error) {
4632
+
4633
+	afterDislysis := models.XtAssessmentAfterDislysis{}
4634
+
4635
+	err := XTReadDB().Where("patient_id = ? and assessment_date <? and user_org_id =? and status=1", patient_id, assessment_date, user_org_id).Order("assessment_date asc").Last(&afterDislysis).Error
4636
+
4637
+	return afterDislysis, err
4638
+}
4639
+
4598 4640
 func GetAutoMonitorList(patient_id int64, start_time int64, end_time int64, org_id int64) (monitor []*models.XTMonitoringRecord, err error) {
4599 4641
 
4600 4642
 	db := XTReadDB().Model(&monitor).Where("status=1")
@@ -4617,6 +4659,13 @@ func GetAutoMonitorList(patient_id int64, start_time int64, end_time int64, org_
4617 4659
 	return monitor, err
4618 4660
 }
4619 4661
 
4662
+func MaxMonitorByBloodFlow(patient_id int64, start_time int64, end_time int64, org_id int64) (models.MonitoringRecord, error) {
4663
+
4664
+	monitoringRecord := models.MonitoringRecord{}
4665
+	err := XTReadDB().Raw("select MAX(blood_flow_volume) as blood_flow_volume from xt_monitoring_record where patient_id = ? and monitoring_date>=? and monitoring_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&monitoringRecord).Error
4666
+	return monitoringRecord, err
4667
+}
4668
+
4620 4669
 func GetAutoPatientDryWeight(patient_id int64, start_time int64, end_time int64, org_id int64) (dryweight []*models.SgjPatientDryweight, err error) {
4621 4670
 
4622 4671
 	db := XTReadDB().Model(&dryweight).Where("status=1")
@@ -4632,6 +4681,13 @@ func GetAutoPatientDryWeight(patient_id int64, start_time int64, end_time int64,
4632 4681
 	return dryweight, err
4633 4682
 }
4634 4683
 
4684
+func GetPatientLastDryWeightObj(patient_id int64, start_time int64, end_time int64, org_id int64) (models.SgjPatientDryweight, error) {
4685
+
4686
+	dryweight := models.SgjPatientDryweight{}
4687
+	err := XTReadDB().Where("patient_id =? and user_org_id = ? and status=1", patient_id, org_id).Order("id asc").Last(&dryweight).Error
4688
+	return dryweight, err
4689
+}
4690
+
4635 4691
 func GetAutoInspectionList(patient_id int64, start_time int64, end_time int64, org_id int64) (inpection []*models.XtInspection, err error) {
4636 4692
 
4637 4693
 	db := XTReadDB().Model(&inpection).Where("status=1")
@@ -4701,3 +4757,88 @@ func GetAutoDialysisOrder(patient_id int64, start_time int64, end_time int64, us
4701 4757
 
4702 4758
 	return order, err
4703 4759
 }
4760
+
4761
+func GetMaxAssessmentBforSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentBeforeDislysis, error) {
4762
+
4763
+	befor := models.XtAssessmentBeforeDislysis{}
4764
+	err := XTReadDB().Raw("select MAX(systolic_blood_pressure) as systolic_blood_pressure from xt_assessment_before_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
4765
+	return befor, err
4766
+}
4767
+
4768
+func GetMminAssessmentBforSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentBeforeDislysis, error) {
4769
+
4770
+	befor := models.XtAssessmentBeforeDislysis{}
4771
+	err := XTReadDB().Raw("select Min(systolic_blood_pressure) as systolic_blood_pressure from xt_assessment_before_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
4772
+	return befor, err
4773
+}
4774
+
4775
+func GetMaxAssessmentBforDiastolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentBeforeDislysis, error) {
4776
+
4777
+	befor := models.XtAssessmentBeforeDislysis{}
4778
+	err := XTReadDB().Raw("select MAX(diastolic_blood_pressure) as diastolic_blood_pressure from xt_assessment_before_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
4779
+	return befor, err
4780
+}
4781
+
4782
+func GetMinAssessmentBforDiastolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentBeforeDislysis, error) {
4783
+
4784
+	befor := models.XtAssessmentBeforeDislysis{}
4785
+	err := XTReadDB().Raw("select Min(diastolic_blood_pressure) as diastolic_blood_pressure from xt_assessment_before_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
4786
+	return befor, err
4787
+}
4788
+
4789
+func GetMaxAssessmentAfterSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentAfterDislysis, error) {
4790
+
4791
+	befor := models.XtAssessmentAfterDislysis{}
4792
+	err := XTReadDB().Raw("select MAX(systolic_blood_pressure) as systolic_blood_pressure from xt_assessment_after_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
4793
+	return befor, err
4794
+}
4795
+
4796
+func GetMinAssessmentAfterSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentAfterDislysis, error) {
4797
+
4798
+	befor := models.XtAssessmentAfterDislysis{}
4799
+	err := XTReadDB().Raw("select Min(systolic_blood_pressure) as systolic_blood_pressure from xt_assessment_after_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
4800
+	return befor, err
4801
+}
4802
+
4803
+func GetMaxAssessmentAfterDiastolicBloodPressureList(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentAfterDislysis, error) {
4804
+
4805
+	befor := models.XtAssessmentAfterDislysis{}
4806
+	err := XTReadDB().Raw("select Max(diastolic_blood_pressure) as diastolic_blood_pressure from xt_assessment_after_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
4807
+	return befor, err
4808
+}
4809
+
4810
+func GetMinAssessmentAfterDiastolicBloodPressureList(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XtAssessmentAfterDislysis, error) {
4811
+
4812
+	befor := models.XtAssessmentAfterDislysis{}
4813
+	err := XTReadDB().Raw("select Min(diastolic_blood_pressure) as diastolic_blood_pressure from xt_assessment_after_dislysis where patient_id = ? and assessment_date>=? and assessment_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&befor).Error
4814
+	return befor, err
4815
+}
4816
+
4817
+func GetMaxMonitorSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XTMonitoringRecord, error) {
4818
+
4819
+	monitor := models.XTMonitoringRecord{}
4820
+	err := XTReadDB().Raw("select Min(diastolic_blood_pressure) as diastolic_blood_pressure from xt_monitoring_record where patient_id = ? and monitoring_date>=? and monitoring_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&monitor).Error
4821
+	return monitor, err
4822
+}
4823
+
4824
+func GetMinMonitorSystolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XTMonitoringRecord, error) {
4825
+
4826
+	monitor := models.XTMonitoringRecord{}
4827
+	err := XTReadDB().Raw("select Min(systolic_blood_pressure) as systolic_blood_pressure from xt_monitoring_record where patient_id = ? and monitoring_date>=? and monitoring_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&monitor).Error
4828
+	return monitor, err
4829
+
4830
+}
4831
+
4832
+func GetMaxMonitorDiastolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XTMonitoringRecord, error) {
4833
+
4834
+	monitor := models.XTMonitoringRecord{}
4835
+	err := XTReadDB().Raw("select Max(diastolic_blood_pressure) as diastolic_blood_pressure from xt_monitoring_record where patient_id = ? and monitoring_date>=? and monitoring_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&monitor).Error
4836
+	return monitor, err
4837
+}
4838
+
4839
+func GetMinMonitorDiastolicBloodPressure(patient_id int64, start_time int64, end_time int64, org_id int64) (models.XTMonitoringRecord, error) {
4840
+
4841
+	monitor := models.XTMonitoringRecord{}
4842
+	err := XTReadDB().Raw("select Min(diastolic_blood_pressure) as diastolic_blood_pressure from xt_monitoring_record where patient_id = ? and monitoring_date>=? and monitoring_date<=? and user_org_id = ?", patient_id, start_time, end_time, org_id).Scan(&monitor).Error
4843
+	return monitor, err
4844
+}

+ 11 - 2
service/schedule_service.go View File

@@ -1435,7 +1435,16 @@ func GetDeathPatient(orgid int64) (patient []*models.XtPatients, err error) {
1435 1435
 	return patient, err
1436 1436
 }
1437 1437
 
1438
-func GetInitPrintData(patient_id int64, scheduleDate int64, orgid int64) (list []*models.VmSchedulesRemind, err error) {
1438
+func GetPatientBySchedule(patient_id int64, schedule_date int64, user_org_id int64) (models.XtSchedule, error) {
1439
+
1440
+	schedule := models.XtSchedule{}
1441
+
1442
+	err := XTReadDB().Where("patient_id = ? and schedule_date = ? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).Find(&schedule).Error
1443
+
1444
+	return schedule, err
1445
+}
1446
+
1447
+func GetInitPrintData(patient_id int64, scheduleDate int64, orgid int64, mode_id int64) (list []*models.VmSchedulesRemind, err error) {
1439 1448
 
1440 1449
 	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
1441 1450
 	if orgid > 0 {
@@ -1448,7 +1457,7 @@ func GetInitPrintData(patient_id int64, scheduleDate int64, orgid int64) (list [
1448 1457
 		db = db.Where("x.schedule_date >=? and x.schedule_date<=?", scheduleDate, scheduleDate)
1449 1458
 	}
1450 1459
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("XtAssessmentBeforeDislysis", "status = 1 and assessment_date =? and patient_id = ?", scheduleDate, patient_id).Preload("DialysisPrescription", "status = 1 and record_date = ? and patient_id = ?", scheduleDate, patient_id).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
1451
-		return db.Where("status =1 and patient_id = ?", patient_id).Order("id asc")
1460
+		return db.Where("status =1 and patient_id = ? and solution_status = 1 and mode_id = ?", patient_id, mode_id).Order("id asc")
1452 1461
 	}).Find(&list).Error
1453 1462
 
1454 1463
 	return list, err