Bläddra i källkod

Merge branch '20200710_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20200710_xt_api_new_branch

csx 4 år sedan
förälder
incheckning
7f966d521c

+ 1 - 1
controllers/device_api_controller.go Visa fil

@@ -1145,7 +1145,7 @@ func (this *DeviceAPIController) GetAllMachineInfo() {
1145 1145
 	adminUserInfo := this.GetAdminUserInfo()
1146 1146
 	orgid := adminUserInfo.CurrentOrgId
1147 1147
 	addmahcer, total, err := service.GetAllMachineInfo(page, limit, searchKey, zoneid, equipmentid, statusid, orgid)
1148
-	//fmt.Println("err------------------------------------------------------", err)
1148
+
1149 1149
 	if err != nil {
1150 1150
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询设备失败")
1151 1151
 		return

+ 19 - 3
controllers/dialysis_api_controller.go Visa fil

@@ -137,7 +137,8 @@ func (c *DialysisApiController) PostPrescription() {
137 137
 	tubing_hemodialysis, _ := c.GetInt64("tubing_hemodialysis", 0)
138 138
 	safe_package, _ := c.GetInt64("package", 0)
139 139
 	a_liquid, _ := c.GetInt64("a_liquid", 0)
140
-
140
+	preImpules, _ := c.GetFloat("pre_impulse", 0)
141
+	fmt.Println("========================================================", preImpules)
141 142
 	// var prescription_doctor int64
142 143
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
143 144
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
@@ -214,6 +215,7 @@ func (c *DialysisApiController) PostPrescription() {
214 215
 		TubingHemodialysis:         tubing_hemodialysis,
215 216
 		Package:                    safe_package,
216 217
 		ALiquid:                    a_liquid,
218
+		PreImpulse:                 preImpules,
217 219
 	}
218 220
 
219 221
 	if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -3018,7 +3020,6 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
3018 3020
 	}
3019 3021
 
3020 3022
 	assessment, _ := service.FindAssessmentAfterDislysisById(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3021
-
3022 3023
 	assessment.DialysisOrderId = data.DialysisOrderId
3023 3024
 	assessment.Evaluator = adminUserInfo.AdminUser.Id
3024 3025
 	assessment.Status = 1
@@ -3073,7 +3074,12 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
3073 3074
 	assessment.BloodFlow = data.BloodFlow
3074 3075
 	assessment.SealingFluidDispose = data.SealingFluidDispose
3075 3076
 	assessment.SealingFluidSpecial = data.SealingFluidSpecial
3076
-
3077
+	assessment.DosageOfAnticoagulants = data.DosageOfAnticoagulants
3078
+	assessment.SupineSystolicBloodPressure = data.SupineSystolicBloodPressure
3079
+	assessment.SettingPressure = data.SettingPressure
3080
+	assessment.SupineDiastolicBloodPressure = data.SupineDiastolicBloodPressure
3081
+	assessment.DiastolicPressure = data.DiastolicPressure
3082
+	assessment.AdditionalWeight = data.AdditionalWeight
3077 3083
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
3078 3084
 
3079 3085
 	if assessment.ID > 0 {
@@ -3190,6 +3196,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3190 3196
 	machine_type := c.GetString("machine_type")
3191 3197
 	puncture_needle := c.GetString("puncture_needle")
3192 3198
 	humor_excessive_symptom, _ := c.GetInt64("humor_excessive_symptom", 0)
3199
+	phinholing := c.GetString("pinholing")
3193 3200
 
3194 3201
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
3195 3202
 		DialysisCount:                  dialysis_count,
@@ -3241,6 +3248,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3241 3248
 		MachineType:                    machine_type,
3242 3249
 		PunctureNeedle:                 puncture_needle,
3243 3250
 		HumorExcessiveSymptom:          humor_excessive_symptom,
3251
+		Phinholing:                     phinholing,
3244 3252
 	}
3245 3253
 
3246 3254
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -4282,6 +4290,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
4282 4290
 	timeLayout := "2006-01-02"
4283 4291
 	loc, _ := time.LoadLocation("Local")
4284 4292
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", xtdate+" 00:00:00", loc)
4293
+
4285 4294
 	if err != nil {
4286 4295
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4287 4296
 		return
@@ -4382,6 +4391,12 @@ func (c *DialysisApiController) GetDialysisOrder() {
4382 4391
 	//operators, _ := service.GetAdminUserES(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, operatorIDs)
4383 4392
 	operators, err := service.GetAdminUserEsOne(adminUserInfo.CurrentOrgId)
4384 4393
 	templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
4394
+
4395
+	//获取当前日期月份的第一天
4396
+	firstmonth := service.GetFirstDateOfMonth(theTime)
4397
+	firstMonthDate := firstmonth.Unix()
4398
+	//获取当前月份的病人透析次数
4399
+	dialysiscount, err := service.GetDialysisCountByPatientId(firstMonthDate, xttime, patientInfo.ID, adminUserInfo.CurrentOrgId)
4385 4400
 	c.ServeSuccessJSON(map[string]interface{}{
4386 4401
 		"xtdate":                    xtdate,
4387 4402
 		"users":                     adminUser,
@@ -4411,6 +4426,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
4411 4426
 		"predialysName":             predialysName,
4412 4427
 		"FinishNuse":                FinishNuse,
4413 4428
 		"lastPredialysisEvaluation": lastPredialysisEvaluation,
4429
+		"dialysiscount":             dialysiscount,
4414 4430
 	})
4415 4431
 
4416 4432
 }

+ 13 - 7
controllers/dialysis_record_api_controller.go Visa fil

@@ -396,6 +396,8 @@ type EditMonitorParamObject struct {
396 396
 	BloodOxygenSaturation     string  `gorm:"column:blood_oxygen_saturation" json:"blood_oxygen_saturation" form:"blood_oxygen_saturation"`
397 397
 	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
398 398
 	DialysateFlow             float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
399
+	Urr                       string  `gorm:"column:urr" json:"urr" form:"urr"`
400
+	BloodSugar                float64 `gorm:"column:blood_sugar" json:"blood_sugar" form:"blood_sugar"`
399 401
 }
400 402
 
401 403
 // /api/dislysis/monitor/edit [post]
@@ -497,13 +499,15 @@ func (this *DialysisRecordAPIController) EditMonitor() {
497 499
 			MonitoringNurse:           adminUserInfo.AdminUser.Id,
498 500
 			Conductivity:              monitorParam.Conductivity,
499 501
 			DisplacementFlowQuantity:  monitorParam.DisplacementFlowQuantity,
500
-			Status:                1,
501
-			CreatedTime:           time.Now().Unix(),
502
-			UpdatedTime:           time.Now().Unix(),
503
-			BloodOxygenSaturation: monitorParam.BloodOxygenSaturation,
504
-			Creator:               adminUserInfo.AdminUser.Id,
505
-			Heparin:               monitorParam.Heparin,
506
-			DialysateFlow:         monitorParam.DialysateFlow,
502
+			Status:                    1,
503
+			CreatedTime:               time.Now().Unix(),
504
+			UpdatedTime:               time.Now().Unix(),
505
+			BloodOxygenSaturation:     monitorParam.BloodOxygenSaturation,
506
+			Creator:                   adminUserInfo.AdminUser.Id,
507
+			Heparin:                   monitorParam.Heparin,
508
+			DialysateFlow:             monitorParam.DialysateFlow,
509
+			Urr:                       monitorParam.Urr,
510
+			BloodSugar:                monitorParam.BloodSugar,
507 511
 		}
508 512
 		createErr := service.CreateMonitor(&monitor)
509 513
 		if createErr != nil {
@@ -568,6 +572,8 @@ func (this *DialysisRecordAPIController) EditMonitor() {
568 572
 		monitor.BloodOxygenSaturation = monitorParam.BloodOxygenSaturation
569 573
 		monitor.Heparin = monitorParam.Heparin
570 574
 		monitor.DialysateFlow = monitorParam.DialysateFlow
575
+		monitor.Urr = monitorParam.Urr
576
+		monitor.BloodSugar = monitorParam.BloodSugar
571 577
 		updateErr := service.UpdateMonitor(monitor)
572 578
 		if updateErr != nil {
573 579
 			this.ErrorLog("修改透析监测记录失败:%v", updateErr)

+ 24 - 10
controllers/manage_api_controller.go Visa fil

@@ -94,6 +94,7 @@ func ManageRouters() {
94 94
 	beego.Router("/api/manage/deleteimages", &MachineApiController{}, "delete:DeleteImages")
95 95
 	beego.Router("/api/manage/getusermachtotalcount", &MachineApiController{}, "Get:GetUserMachTotalCount")
96 96
 	beego.Router("/api/manage/getusertotalcount", &MachineApiController{}, "Get:GetUserTotalCount")
97
+	beego.Router("/api/manage/deletemanagement", &MachineApiController{}, "Get:DeleteManagement")
97 98
 
98 99
 }
99 100
 
@@ -210,7 +211,7 @@ func (this *MachineApiController) SaveManageInfo() {
210 211
 		DeviceName:          device_name,
211 212
 		ManufactureFactory:  manufacture_factory,
212 213
 		ServiceManufacturer: service_manufacturer,
213
-		UnitType:            unit_type,
214
+		UnitType:            unittype,
214 215
 		UseSection:          use_section,
215 216
 		SectionNumber:       section_number,
216 217
 		BuyDate:             buydate,
@@ -294,8 +295,8 @@ func (this *MachineApiController) UpdateMachineInfo() {
294 295
 	//fmt.Println("生产厂家", manufacture_factory)
295 296
 	service_manufacturer := dataBody["service_manufacturer"].(string)
296 297
 	//fmt.Println("维修厂家", service_manufacturer)
297
-	unittype := int64(dataBody["unit_type"].(float64))
298
-	unit_type := strconv.FormatInt(unittype, 10)
298
+	unit_type := int64(dataBody["unit_type"].(float64))
299
+	//unit_type := strconv.FormatInt(unittype, 10)
299 300
 	fmt.Println("设备型号", unit_type)
300 301
 
301 302
 	use_section := dataBody["use_section"].(string)
@@ -435,8 +436,8 @@ func (this *MachineApiController) UpdateMachinetwo() {
435 436
 	//fmt.Println("生产厂家", manufacture_factory)
436 437
 	service_manufacturer := dataBody["service_manufacturer"].(string)
437 438
 	//fmt.Println("维修厂家", service_manufacturer)
438
-	unittype := int64(dataBody["unit_type"].(float64))
439
-	unit_type := strconv.FormatInt(unittype, 10)
439
+	unit_type := int64(dataBody["unit_type"].(float64))
440
+	//unit_type := strconv.FormatInt(unittype, 10)
440 441
 	//fmt.Println("设备型号", unit_type)
441 442
 	use_section := dataBody["use_section"].(string)
442 443
 	//fmt.Println("使用科室", use_section)
@@ -568,7 +569,7 @@ func (this *MachineApiController) Updatemacheinetwo() {
568 569
 	service_manufacturer := dataBody["service_manufacturer"].(string)
569 570
 	//fmt.Println("维修厂家", service_manufacturer)
570 571
 	unittype := int64(dataBody["unit_type"].(float64))
571
-	unit_type := strconv.FormatInt(unittype, 10)
572
+	//unit_type := strconv.FormatInt(unittype, 10)
572 573
 	//fmt.Println("设备型号", unit_type)
573 574
 	use_section := dataBody["use_section"].(string)
574 575
 	//fmt.Println("使用科室", use_section)
@@ -635,7 +636,7 @@ func (this *MachineApiController) Updatemacheinetwo() {
635 636
 		DeviceName:          device_name,
636 637
 		ManufactureFactory:  manufacture_factory,
637 638
 		ServiceManufacturer: service_manufacturer,
638
-		UnitType:            unit_type,
639
+		UnitType:            unittype,
639 640
 		UseSection:          use_section,
640 641
 		SectionNumber:       section_number,
641 642
 		BuyDate:             buydate,
@@ -2651,9 +2652,9 @@ func (this *MachineApiController) SaveManageinfoTwo() {
2651 2652
 	fmt.Println("生产厂家", manufacture_factory)
2652 2653
 	service_manufacturer := dataBody["service_manufacturer"].(string)
2653 2654
 	fmt.Println("维修厂家", service_manufacturer)
2654
-	unittype := int64(dataBody["unit_type"].(float64))
2655
-	unit_type := strconv.FormatInt(unittype, 10)
2656
-	fmt.Println("设备型号", unit_type)
2655
+	unit_type := int64(dataBody["unit_type"].(float64))
2656
+	//unit_type := strconv.FormatInt(unittype, 10)
2657
+	//fmt.Println("设备型号", unit_type)
2657 2658
 	use_section := dataBody["use_section"].(string)
2658 2659
 	fmt.Println("使用科室", use_section)
2659 2660
 	section_number := dataBody["section_number"].(string)
@@ -3116,3 +3117,16 @@ func (this *MachineApiController) GetUserTotalCount() {
3116 3117
 		"addmacher": addmacher,
3117 3118
 	})
3118 3119
 }
3120
+
3121
+func (this *MachineApiController) DeleteManagement() {
3122
+	id, _ := this.GetInt64("id")
3123
+	_, err := service.DeleteEquit(id)
3124
+	if err != nil {
3125
+		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
3126
+		return
3127
+	}
3128
+	returnData := make(map[string]interface{}, 0)
3129
+	returnData["msg"] = "ok"
3130
+	this.ServeSuccessJSON(returnData)
3131
+	return
3132
+}

+ 13 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Visa fil

@@ -806,7 +806,11 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
806 806
 	blood_flow, _ := c.GetInt64("blood_flow", 0)
807 807
 	sealing_fluid_dispose, _ := c.GetInt64("sealing_fluid_dispose", 0)
808 808
 	sealing_fluid_special := c.GetString("sealing_fluid_special")
809
-
809
+	dosage_of_anticoagulants, _ := c.GetFloat("dosage_of_anticoagulants")
810
+	supine_systolic_blood_pressure := c.GetString("supine_systolic_blood_pressure")
811
+	setting_pressure := c.GetString("setting_pressure")
812
+	supine_diastolic_blood_pressure := c.GetString("supine_diastolic_blood_pressure")
813
+	diastolic_pressure := c.GetString("diastolic_pressure")
810 814
 	if id <= 0 {
811 815
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
812 816
 		return
@@ -893,6 +897,11 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
893 897
 		BloodFlow:                    blood_flow,
894 898
 		SealingFluidDispose:          sealing_fluid_dispose,
895 899
 		SealingFluidSpecial:          sealing_fluid_special,
900
+		DosageOfAnticoagulants:       dosage_of_anticoagulants,
901
+		SupineDiastolicBloodPressure: supine_diastolic_blood_pressure,
902
+		SupineSystolicBloodPressure:  supine_systolic_blood_pressure,
903
+		SettingPressure:              setting_pressure,
904
+		DiastolicPressure:            diastolic_pressure,
896 905
 	}
897 906
 
898 907
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
@@ -1022,7 +1031,8 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1022 1031
 	tubing_hemodialysis, _ := c.GetInt64("tubing_hemodialysis", 0)
1023 1032
 	safe_package, _ := c.GetInt64("package", 0)
1024 1033
 	a_liquid, _ := c.GetInt64("a_liquid", 0)
1025
-
1034
+	pre_impulse, parseDateErr := c.GetFloat("pre_impulse", 0)
1035
+	fmt.Println("预冲量====", pre_impulse)
1026 1036
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1027 1037
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1028 1038
 	//
@@ -1102,6 +1112,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1102 1112
 		Package:                    safe_package,
1103 1113
 		ALiquid:                    a_liquid,
1104 1114
 		TargetKtv:                  target_ktv,
1115
+		PreImpulse:                 pre_impulse,
1105 1116
 	}
1106 1117
 
1107 1118
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)

+ 15 - 10
controllers/mobile_api_controllers/dialysis_api_controller_extend.go Visa fil

@@ -67,11 +67,11 @@ func (this *DialysisAPIController) AddMonitorRecord() {
67 67
 	BPType, _ := this.GetInt("bp_type")
68 68
 	bloodFlowVolume, _ := this.GetFloat("blood_flow_volume")
69 69
 	venousPressure, _ := this.GetFloat("venous_pressure")
70
-	venousPressureType,_ := this.GetInt64("venous_pressure_type",1)
70
+	venousPressureType, _ := this.GetInt64("venous_pressure_type", 1)
71 71
 	arterialPressure, _ := this.GetFloat("arterial_pressure")
72
-	arterialPressureType, _ := this.GetInt64("arterial_pressure_type",1)
73
-	transmembranePressure, _ := this.GetFloat("transmembrane_pressure",0)
74
-	transmembranePressureType,_ := this.GetInt64("transmembrane_pressure_type",1)
72
+	arterialPressureType, _ := this.GetInt64("arterial_pressure_type", 1)
73
+	transmembranePressure, _ := this.GetFloat("transmembrane_pressure", 0)
74
+	transmembranePressureType, _ := this.GetInt64("transmembrane_pressure_type", 1)
75 75
 	ultrafiltrationRate, _ := this.GetFloat("ultrafiltration_rate")
76 76
 	ultrafiltrationVolume, _ := this.GetFloat("ultrafiltration_volume")
77 77
 	sodiumConcentration, _ := this.GetFloat("sodium_concentration")
@@ -89,7 +89,8 @@ func (this *DialysisAPIController) AddMonitorRecord() {
89 89
 	monitoringNurse, _ := this.GetInt64("monitoring_nurse")
90 90
 	heparin, _ := this.GetFloat("heparin")
91 91
 	dialysate_flow, _ := this.GetFloat("dialysate_flow")
92
-
92
+	urr := this.GetString("urr")
93
+	blood_sugar, _ := this.GetFloat("blood_sugar")
93 94
 	adminInfo := this.GetMobileAdminUserInfo()
94 95
 	patient, getPatientErr := service.MobileGetPatientById(adminInfo.Org.Id, patientID)
95 96
 	if getPatientErr != nil {
@@ -142,6 +143,8 @@ func (this *DialysisAPIController) AddMonitorRecord() {
142 143
 		Modify:                    0,
143 144
 		Heparin:                   heparin,
144 145
 		DialysateFlow:             dialysate_flow,
146
+		Urr:                       urr,
147
+		BloodSugar:                blood_sugar,
145 148
 	}
146 149
 
147 150
 	err := service.CreateMonitor(&record)
@@ -211,11 +214,11 @@ func (this *DialysisAPIController) EditMonitorRecord() {
211 214
 	BPType, _ := this.GetInt("bp_type")
212 215
 	bloodFlowVolume, _ := this.GetFloat("blood_flow_volume")
213 216
 	venousPressure, _ := this.GetFloat("venous_pressure")
214
-	venousPressureType,_ := this.GetInt64("venous_pressure_type",1)
217
+	venousPressureType, _ := this.GetInt64("venous_pressure_type", 1)
215 218
 	arterialPressure, _ := this.GetFloat("arterial_pressure")
216
-	arterialPressureType, _ := this.GetInt64("arterial_pressure",1)
219
+	arterialPressureType, _ := this.GetInt64("arterial_pressure", 1)
217 220
 	transmembranePressure, _ := this.GetFloat("transmembrane_pressure")
218
-	transmembranePressureType,_ := this.GetInt64("transmembrane_pressure_type",1)
221
+	transmembranePressureType, _ := this.GetInt64("transmembrane_pressure_type", 1)
219 222
 	ultrafiltrationRate, _ := this.GetFloat("ultrafiltration_rate")
220 223
 	ultrafiltrationVolume, _ := this.GetFloat("ultrafiltration_volume")
221 224
 	sodiumConcentration, _ := this.GetFloat("sodium_concentration")
@@ -233,7 +236,8 @@ func (this *DialysisAPIController) EditMonitorRecord() {
233 236
 	displacement_flow_quantity, _ := this.GetFloat("displacement_flow_quantity")
234 237
 	heparin, _ := this.GetFloat("heparin")
235 238
 	dialysate_flow, _ := this.GetFloat("dialysate_flow")
236
-
239
+	urr := this.GetString("urr")
240
+	blood_sugar, _ := this.GetFloat("blood_sugar")
237 241
 	adminInfo := this.GetMobileAdminUserInfo()
238 242
 
239 243
 	monitor, err := service.GetMonitor(adminInfo.Org.Id, patientID, id)
@@ -281,7 +285,8 @@ func (this *DialysisAPIController) EditMonitorRecord() {
281 285
 	monitor.Modify = adminInfo.AdminUser.Id
282 286
 	monitor.Heparin = heparin
283 287
 	monitor.DialysateFlow = dialysate_flow
284
-
288
+	monitor.Urr = urr
289
+	monitor.BloodSugar = blood_sugar
285 290
 	err = service.UpdateMonitor(monitor)
286 291
 	if err != nil {
287 292
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorUpdate)

+ 10 - 1
controllers/mobile_api_controllers/patient_api_controller.go Visa fil

@@ -1660,6 +1660,10 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
1660 1660
 		evaluation.HumorExcessiveSymptom = humor_excessive_symptom
1661 1661
 	}
1662 1662
 
1663
+	if dataBody["pinholing"] != nil && reflect.TypeOf(dataBody["pinholing"]).String() == "string" {
1664
+		pinholing := dataBody["pinholing"].(string)
1665
+		evaluation.Phinholing = pinholing
1666
+	}
1663 1667
 	return
1664 1668
 }
1665 1669
 
@@ -2098,7 +2102,9 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
2098 2102
 		return
2099 2103
 	}
2100 2104
 	xttime := theTime.Unix()
2101
-
2105
+	//获取当前日期月份的第一天
2106
+	firstmonth := service.GetFirstDateOfMonth(theTime)
2107
+	firstMonthDate := firstmonth.Unix()
2102 2108
 	operatorIDs := make([]int64, 0)
2103 2109
 
2104 2110
 	adminUserInfo := c.GetMobileAdminUserInfo()
@@ -2165,6 +2171,8 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
2165 2171
 	operators, err := service.GetAllStarfEs(adminUserInfo.Org.Id)
2166 2172
 	templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
2167 2173
 	check, _ := service.FindDoubleCheckById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
2174
+
2175
+	dialysiscount, err := service.GetDialysisCountByPatientId(firstMonthDate, xttime, patientInfo.ID, adminUserInfo.Org.Id)
2168 2176
 	c.ServeSuccessJSON(map[string]interface{}{
2169 2177
 		"users":                   adminUser,
2170 2178
 		"patientInfo":             patientInfo,
@@ -2179,6 +2187,7 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
2179 2187
 		"operators":               operators,
2180 2188
 		"org_template_info":       templateInfo,
2181 2189
 		"check":                   check,
2190
+		"dialysiscount":           dialysiscount,
2182 2191
 	})
2183 2192
 
2184 2193
 }

+ 1 - 0
controllers/new_mobile_api_controllers/common_api_controller.go Visa fil

@@ -153,6 +153,7 @@ func (this *CommonApiController) SaveConfiguration() {
153 153
 				RangeType:       checktype,
154 154
 				RangeValue:      rangvalue,
155 155
 				CreatedTime:     time.Now().Unix(),
156
+				IsStatus:        1,
156 157
 			}
157 158
 			fmt.Println(standard)
158 159
 			err = service.SaveInspection(&standard)

+ 5 - 2
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Visa fil

@@ -578,6 +578,7 @@ func (this *NewDialysisApiController) GetPatientDetail() {
578 578
 	id, _ := this.GetInt64("id")
579 579
 	//获取病人详情信息
580 580
 	detail, err := service.GetPatientDetailTwo(id)
581
+
581 582
 	//获取传染病详情
582 583
 	diseases := service.GetPatientDiseasesTwo(detail.BloodId)
583 584
 	//获取慢病传染病
@@ -1257,8 +1258,8 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1257 1258
 	fmt.Print("透析号", dialysis)
1258 1259
 	patientsoure := int64(dataBody["patientsoure"].(float64))
1259 1260
 	fmt.Print("患者来源", patientsoure)
1260
-	//lapseto := int64(dataBody["lapseto"].(float64))
1261
-	//fmt.Print("留置状态", lapseto)
1261
+	lapseto := int64(dataBody["lapseto"].(float64))
1262
+	fmt.Print("留置状态", lapseto)
1262 1263
 	contagions := dataBody["resultTwo"].([]interface{})
1263 1264
 	fmt.Print("传染病", contagions)
1264 1265
 	ids := make([]int64, 0)
@@ -1372,6 +1373,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1372 1373
 			Avatar:            avatar,
1373 1374
 			IdCardNo:          idCard,
1374 1375
 			IsInfectious:      is_infectious,
1376
+			Lapseto:           lapseto,
1375 1377
 		}
1376 1378
 		err = service.UpdatedPatient(patients, patient.BloodId)
1377 1379
 		//patientLapseto := models.PatientLapseto{
@@ -1399,6 +1401,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1399 1401
 			Avatar:            avatar,
1400 1402
 			IdCardNo:          idCard,
1401 1403
 			IsInfectious:      is_infectious,
1404
+			Lapseto:           lapseto,
1402 1405
 		}
1403 1406
 		err = service.UpdateXtPatientNew(patientsNew, id)
1404 1407
 		if err != nil {

+ 65 - 24
controllers/new_mobile_api_controllers/new_manage_api_controller.go Visa fil

@@ -37,29 +37,61 @@ func (this *NewManageApiController) GetDisInfectionTime() {
37 37
 	scheduletype, _ := this.GetInt64("schedule_type")
38 38
 	scheduleweek, _ := this.GetInt64("schedule_week")
39 39
 	fmt.Println(scheduleweek)
40
-	//查询改设备是否有消毒计划
41
-	plan, err := service.GetDisInfectionTime(orgid, bedid, scheduletype, scheduleweek)
40
+	scheduledate, _ := this.GetInt64("schedule_date")
41
+
42
+	//根据床位号获取设备型号
43
+	unitType, _ := service.GetUnitType(bedid, orgid)
44
+	//查询使用登记最后一条消毒记录
45
+	infomation, err := service.GetLaseDeviceInfomation(orgid, bedid, scheduledate, scheduletype)
46
+	fmt.Println("infomation========", infomation)
47
+	fmt.Println("err-------", err)
42 48
 	if err == gorm.ErrRecordNotFound {
43
-		//去查询使用登记最后一条数据
44
-		infomation, err := service.GetLaseDeviceInfomation(orgid, bedid)
45
-		if err != nil {
46
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
47
-			return
49
+		//查询改设备是否有消毒计划
50
+		plan, errcode := service.GetDisInfectionTime(orgid, unitType.UnitType, scheduletype, scheduleweek)
51
+		//如果没有消毒计划,去查询该设备的上次消毒时间
52
+		if errcode == gorm.ErrRecordNotFound {
53
+			infor, errco := service.GetLaseDeviceInfomationTwo(orgid, bedid, scheduletype)
54
+			if errco != nil {
55
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
56
+				return
57
+			}
58
+			this.ServeSuccessJSON(map[string]interface{}{
59
+				"plan": infor.LongTime,
60
+			})
61
+		} else if errcode == nil {
62
+			this.ServeSuccessJSON(map[string]interface{}{
63
+				"plan": plan.DisinfecTime,
64
+			})
48 65
 		}
49
-		this.ServeSuccessJSON(map[string]interface{}{
50
-			"plan": infomation.LongTime,
51
-		})
52 66
 	} else if err == nil {
53
-		if err != nil {
54
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
55
-			return
56
-		}
57 67
 		this.ServeSuccessJSON(map[string]interface{}{
58
-			"plan": plan.DisinfecTime,
68
+			"plan":       infomation.LongTime,
69
+			"infomation": infomation,
59 70
 		})
60
-	} else {
61
-
62 71
 	}
72
+	//查询改设备是否有消毒计划
73
+	//plan, err := service.GetDisInfectionTime(orgid, bedid, scheduletype, scheduleweek)
74
+	//if err == gorm.ErrRecordNotFound {
75
+	//	//去查询使用登记最后一条数据
76
+	//	infomation, err := service.GetLaseDeviceInfomation(orgid, bedid)
77
+	//	if err != nil {
78
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
79
+	//		return
80
+	//	}
81
+	//	this.ServeSuccessJSON(map[string]interface{}{
82
+	//		"plan": infomation.LongTime,
83
+	//	})
84
+	//} else if err == nil {
85
+	//	if err != nil {
86
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
87
+	//		return
88
+	//	}
89
+	//	this.ServeSuccessJSON(map[string]interface{}{
90
+	//		"plan": plan.DisinfecTime,
91
+	//	})
92
+	//} else {
93
+	//
94
+	//}
63 95
 
64 96
 }
65 97
 
@@ -99,9 +131,9 @@ func (this *NewManageApiController) SaveDisInfectionInfo() {
99 131
 	fmt.Println("透析减少", dislysis.WeightLoss)
100 132
 	//			//根据床位号获取设备id
101 133
 	addmacher, _ := service.GetEquimentIDTwo(bedid, orgid)
102
-	unitype, _ := strconv.ParseInt(addmacher.UnitType, 10, 64)
103
-	fmt.Println(unitype)
104
-	plan, errplan := service.GetDisinfectionTwo(unitype, scheduletype, orgid)
134
+	//unitype, _ := strconv.ParseInt(addmacher.UnitType, 10, 64)
135
+	//fmt.Println(unitype)
136
+	plan, errplan := service.GetDisinfectionTwo(addmacher.UnitType, scheduletype, orgid)
105 137
 	//counts, errplan := service.GetUserTotalCount(orgid, bedid)
106 138
 	//var usertoal  int64
107 139
 	//fmt.Println(usertoal)
@@ -164,11 +196,20 @@ func (this *NewManageApiController) SaveDisInfectionInfo() {
164 196
 				"information": information,
165 197
 			})
166 198
 		} else if errcode == nil {
199
+			information := models.DeviceInformation{
200
+				DisinfecStartime: startdateunix,
201
+				DisinfecEndtime:  enddateunix,
202
+				LongTime:         strconv.FormatInt(disinfectime, 10),
203
+			}
167 204
 
168
-			returnData := make(map[string]interface{}, 0)
169
-			returnData["msstatus"] = "1"
170
-			this.ServeSuccessJSON(returnData)
171
-			return
205
+			errcode := service.UpdateInformation(&information, scheduledate, bedid, scheduletype)
206
+			if errcode != nil {
207
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
208
+				return
209
+			}
210
+			this.ServeSuccessJSON(map[string]interface{}{
211
+				"information": information,
212
+			})
172 213
 		} else {
173 214
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
174 215
 			return

+ 79 - 79
controllers/patient_api_controller.go Visa fil

@@ -252,29 +252,29 @@ func (c *PatientApiController) CreatePatient() {
252 252
 	//获取老表的最后一条数据
253 253
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
254 254
 	patientsNew := models.XtPatientsNew{
255
-		UserOrgId:          adminUserInfo.CurrentOrgId,
256
-		UserId:             0,
257
-		Avatar:             patients.Avatar,
258
-		PatientType:        patients.PatientType,
259
-		DialysisNo:         patients.DialysisNo,
260
-		AdmissionNumber:    patients.AdmissionNumber,
261
-		Source:             patients.Source,
262
-		Lapseto:            patients.Lapseto,
263
-		PartitionId:        patients.PartitionId,
264
-		BedId:              patients.BedId,
265
-		Name:               patients.Name,
266
-		Alias:              patients.Alias,
267
-		Gender:             patients.Gender,
268
-		MaritalStatus:      patients.MaritalStatus,
269
-		IdCardNo:           patients.IdCardNo,
270
-		Birthday:           patients.Birthday,
271
-		ReimbursementWayId: patients.ReimbursementWayId,
272
-		HealthCareType:     patients.HealthCareType,
273
-		HealthCareNo:       patients.HealthCareNo,
274
-		HealthCareDueDate:  patients.HealthCareDueDate,
275
-		Height:             patients.Height,
276
-		BloodType:          patients.BloodType,
277
-		Rh:                 patients.Rh,
255
+		UserOrgId:                    adminUserInfo.CurrentOrgId,
256
+		UserId:                       0,
257
+		Avatar:                       patients.Avatar,
258
+		PatientType:                  patients.PatientType,
259
+		DialysisNo:                   patients.DialysisNo,
260
+		AdmissionNumber:              patients.AdmissionNumber,
261
+		Source:                       patients.Source,
262
+		Lapseto:                      patients.Lapseto,
263
+		PartitionId:                  patients.PartitionId,
264
+		BedId:                        patients.BedId,
265
+		Name:                         patients.Name,
266
+		Alias:                        patients.Alias,
267
+		Gender:                       patients.Gender,
268
+		MaritalStatus:                patients.MaritalStatus,
269
+		IdCardNo:                     patients.IdCardNo,
270
+		Birthday:                     patients.Birthday,
271
+		ReimbursementWayId:           patients.ReimbursementWayId,
272
+		HealthCareType:               patients.HealthCareType,
273
+		HealthCareNo:                 patients.HealthCareNo,
274
+		HealthCareDueDate:            patients.HealthCareDueDate,
275
+		Height:                       patients.Height,
276
+		BloodType:                    patients.BloodType,
277
+		Rh:                           patients.Rh,
278 278
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
279 279
 		EducationLevel:               patients.EducationLevel,
280 280
 		Profession:                   patients.Profession,
@@ -320,28 +320,28 @@ func (c *PatientApiController) CreatePatient() {
320 320
 		Nation:                       patients.Nation,
321 321
 		NativePlace:                  patients.NativePlace,
322 322
 		Age:                          patients.Age,
323
-		InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
324
-		IsInfectious:             patients.IsInfectious,
325
-		RemindCycle:              patients.RemindCycle,
326
-		ResponseResult:           patients.ResponseResult,
327
-		IsOpenRemind:             patients.IsOpenRemind,
328
-		FirstTreatmentDate:       patients.FirstTreatmentDate,
329
-		DialysisAge:              patients.DialysisAge,
330
-		ExpenseKind:              patients.ExpenseKind,
331
-		TellPhone:                patients.TellPhone,
332
-		ContactName:              patients.ContactName,
333
-		BloodPatients:            1,
334
-		SlowPatients:             0,
335
-		MemberPatients:           0,
336
-		EcommerPatients:          "",
337
-		BloodId:                  patients.ID,
338
-		SlowId:                   0,
339
-		MemberId:                 0,
340
-		MemberFistdate:           0,
341
-		MemberPatienttype:        0,
342
-		MemberTreatement:         0,
343
-		EquitmentId:              "",
344
-		UserSysBeforeCount:       patient.UserSysBeforeCount,
323
+		InfectiousNextRecordTime:     patients.InfectiousNextRecordTime,
324
+		IsInfectious:                 patients.IsInfectious,
325
+		RemindCycle:                  patients.RemindCycle,
326
+		ResponseResult:               patients.ResponseResult,
327
+		IsOpenRemind:                 patients.IsOpenRemind,
328
+		FirstTreatmentDate:           patients.FirstTreatmentDate,
329
+		DialysisAge:                  patients.DialysisAge,
330
+		ExpenseKind:                  patients.ExpenseKind,
331
+		TellPhone:                    patients.TellPhone,
332
+		ContactName:                  patients.ContactName,
333
+		BloodPatients:                1,
334
+		SlowPatients:                 0,
335
+		MemberPatients:               0,
336
+		EcommerPatients:              "",
337
+		BloodId:                      patients.ID,
338
+		SlowId:                       0,
339
+		MemberId:                     0,
340
+		MemberFistdate:               0,
341
+		MemberPatienttype:            0,
342
+		MemberTreatement:             0,
343
+		EquitmentId:                  "",
344
+		UserSysBeforeCount:           patient.UserSysBeforeCount,
345 345
 	}
346 346
 
347 347
 	err = service.CreatePatientsNew(&patientsNew)
@@ -461,7 +461,6 @@ func (c *PatientApiController) EditPatient() {
461 461
 	patient.UpdatedTime = time.Now().Unix()
462 462
 	patient.IsInfectious = is_infectious
463 463
 	patient.RemindCycle = remind_cycle
464
-
465 464
 	err := service.UpdatePatient(&patient, contagions, diseases)
466 465
 	if err != nil {
467 466
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdatePatient)
@@ -480,28 +479,28 @@ func (c *PatientApiController) EditPatient() {
480 479
 		return
481 480
 	}
482 481
 	patientsNew := models.XtPatientsNew{
483
-		UserOrgId:          patient.UserOrgId,
484
-		UserId:             patient.UserId,
485
-		Avatar:             patient.Avatar,
486
-		PatientType:        patient.PatientType,
487
-		DialysisNo:         patient.DialysisNo,
488
-		AdmissionNumber:    patient.AdmissionNumber,
489
-		Source:             patient.Source,
490
-		PartitionId:        patient.PartitionId,
491
-		BedId:              patient.BedId,
492
-		Name:               patient.Name,
493
-		Alias:              patient.Alias,
494
-		Gender:             patient.Gender,
495
-		MaritalStatus:      patient.MaritalStatus,
496
-		IdCardNo:           patient.IdCardNo,
497
-		Birthday:           patient.Birthday,
498
-		ReimbursementWayId: patient.ReimbursementWayId,
499
-		HealthCareType:     patient.HealthCareType,
500
-		HealthCareNo:       patient.HealthCareNo,
501
-		HealthCareDueDate:  patient.HealthCareDueDate,
502
-		Height:             patient.Height,
503
-		BloodType:          patient.BloodType,
504
-		Rh:                 patient.Rh,
482
+		UserOrgId:                 patient.UserOrgId,
483
+		UserId:                    patient.UserId,
484
+		Avatar:                    patient.Avatar,
485
+		PatientType:               patient.PatientType,
486
+		DialysisNo:                patient.DialysisNo,
487
+		AdmissionNumber:           patient.AdmissionNumber,
488
+		Source:                    patient.Source,
489
+		PartitionId:               patient.PartitionId,
490
+		BedId:                     patient.BedId,
491
+		Name:                      patient.Name,
492
+		Alias:                     patient.Alias,
493
+		Gender:                    patient.Gender,
494
+		MaritalStatus:             patient.MaritalStatus,
495
+		IdCardNo:                  patient.IdCardNo,
496
+		Birthday:                  patient.Birthday,
497
+		ReimbursementWayId:        patient.ReimbursementWayId,
498
+		HealthCareType:            patient.HealthCareType,
499
+		HealthCareNo:              patient.HealthCareNo,
500
+		HealthCareDueDate:         patient.HealthCareDueDate,
501
+		Height:                    patient.Height,
502
+		BloodType:                 patient.BloodType,
503
+		Rh:                        patient.Rh,
505 504
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
506 505
 		EducationLevel:            patient.EducationLevel,
507 506
 		Profession:                patient.Profession,
@@ -543,17 +542,18 @@ func (c *PatientApiController) EditPatient() {
543 542
 		Nation:                    patient.Nation,
544 543
 		NativePlace:               patient.NativePlace,
545 544
 		Age:                       patient.Age,
546
-		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
547
-		IsInfectious:             patient.IsInfectious,
548
-		RemindCycle:              patient.RemindCycle,
549
-		ResponseResult:           patient.ResponseResult,
550
-		IsOpenRemind:             patient.IsOpenRemind,
551
-		FirstTreatmentDate:       patient.FirstTreatmentDate,
552
-		DialysisAge:              patient.DialysisAge,
553
-		ExpenseKind:              patient.ExpenseKind,
554
-		TellPhone:                patient.TellPhone,
555
-		ContactName:              patient.ContactName,
556
-		UpdatedTime:              time.Now().Unix(),
545
+		InfectiousNextRecordTime:  patient.InfectiousNextRecordTime,
546
+		IsInfectious:              patient.IsInfectious,
547
+		RemindCycle:               patient.RemindCycle,
548
+		ResponseResult:            patient.ResponseResult,
549
+		IsOpenRemind:              patient.IsOpenRemind,
550
+		FirstTreatmentDate:        patient.FirstTreatmentDate,
551
+		DialysisAge:               patient.DialysisAge,
552
+		ExpenseKind:               patient.ExpenseKind,
553
+		TellPhone:                 patient.TellPhone,
554
+		ContactName:               patient.ContactName,
555
+		UpdatedTime:               time.Now().Unix(),
556
+		BloodPatients:             1,
557 557
 	}
558 558
 	//	//更新病人ID获取新表病人ID
559 559
 	err = service.UpdatepatientTwo(&patientsNew, id)

+ 2 - 1
models/device_models.go Visa fil

@@ -205,6 +205,7 @@ type DeviceAddmachers struct {
205 205
 	BedId               int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
206 206
 	DeviceMode          string `gorm:"column:device_mode" json:"device_mode" form:"device_mode"`
207 207
 	Number              string `gorm:"column:number" json:"number" form:"number"`
208
+	EquimentId          int64  `gorm:"column:equiment_id" json:"equiment_id" form:"equiment_id"`
208 209
 }
209 210
 
210 211
 type DeviceAddmacher struct {
@@ -215,7 +216,7 @@ type DeviceAddmacher struct {
215 216
 	DeviceName          string `gorm:"column:device_name" json:"device_name" form:"device_name"`
216 217
 	ManufactureFactory  string `gorm:"column:manufacture_factory" json:"manufacture_factory" form:"manufacture_factory"`
217 218
 	ServiceManufacturer string `gorm:"column:service_manufacturer" json:"service_manufacturer" form:"service_manufacturer"`
218
-	UnitType            string `gorm:"column:unit_type" json:"unit_type" form:"unit_type"`
219
+	UnitType            int64  `gorm:"column:unit_type" json:"unit_type" form:"unit_type"`
219 220
 	UseSection          string `gorm:"column:use_section" json:"use_section" form:"use_section"`
220 221
 	SectionNumber       string `gorm:"column:section_number" json:"section_number" form:"section_number"`
221 222
 	BuyDate             int64  `gorm:"column:buy_date" json:"buy_date" form:"buy_date"`

+ 8 - 0
models/dialysis.go Visa fil

@@ -267,6 +267,7 @@ type PredialysisEvaluation struct {
267 267
 	SymptomBeforeDialysisOther     string  `gorm:"column:symptom_before_dialysis_other" json:"symptom_before_dialysis_other"`
268 268
 	DialysisInterphaseOther        string  `gorm:"column:dialysis_interphase_other" json:"dialysis_interphase_other"`
269 269
 	HumorExcessiveSymptom          int64   `gorm:"column:humor_excessive_symptom" json:"humor_excessive_symptom"`
270
+	Phinholing                     string  `gorm:"column:pinholing" json:"pinholing" form:"pinholing"`
270 271
 }
271 272
 
272 273
 func (PredialysisEvaluation) TableName() string {
@@ -555,6 +556,11 @@ type AssessmentAfterDislysis struct {
555 556
 	BloodFlow                       int64   `gorm:"column:blood_flow" json:"blood_flow" form:"blood_flow"`
556 557
 	SealingFluidDispose             int64   `gorm:"column:sealing_fluid_dispose" json:"sealing_fluid_dispose" form:"sealing_fluid_dispose"`
557 558
 	SealingFluidSpecial             string  `gorm:"column:sealing_fluid_special" json:"sealing_fluid_special" form:"sealing_fluid_special"`
559
+	DosageOfAnticoagulants          float64 `gorm:"column:dosage_of_anticoagulants" json:"dosage_of_anticoagulants" form:"dosage_of_anticoagulants"`
560
+	SupineSystolicBloodPressure     string  `gorm:"column:supine_systolic_blood_pressure" json:"supine_systolic_blood_pressure" form:"supine_systolic_blood_pressure"`
561
+	SettingPressure                 string  `gorm:"column:setting_pressure" json:"setting_pressure" form:"setting_pressure"`
562
+	SupineDiastolicBloodPressure    string  `gorm:"column:supine_diastolic_blood_pressure" json:"supine_diastolic_blood_pressure" form:"supine_diastolic_blood_pressure"`
563
+	DiastolicPressure               string  `gorm:"column:diastolic_pressure" json:"diastolic_pressure" form:"diastolic_pressure"`
558 564
 }
559 565
 
560 566
 func (AssessmentAfterDislysis) TableName() string {
@@ -653,6 +659,8 @@ type MonitoringRecord struct {
653 659
 	Modify                    int64   `gorm:"column:modify" json:"modify" form:"modify"`
654 660
 	Heparin                   float64 `gorm:"column:heparin" json:"heparin" form:"heparin"`
655 661
 	DialysateFlow             float64 `gorm:"column:dialysate_flow" json:"dialysate_flow" form:"dialysate_flow"`
662
+	Urr                       string  `gorm:"column:urr" json:"urr"`
663
+	BloodSugar                float64 `gorm:"column:blood_sugar" json:"blood_sugar" form:"blood_sugar"`
656 664
 }
657 665
 
658 666
 func (MonitoringRecord) TableName() string {

+ 1 - 0
models/patient_models.go Visa fil

@@ -220,6 +220,7 @@ type DialysisPrescription struct {
220 220
 	Package                    int64         `gorm:"column:package" json:"package"`
221 221
 	ALiquid                    int64         `gorm:"column:a_liquid" json:"a_liquid"`
222 222
 	UserAdminRole              UserAdminRole `json:"role" gorm:"foreignkey:AdminUserId;AssociationForeignKey:Creater;"`
223
+	PreImpulse                 float64       `gorm:"column:pre_impulse" json:"pre_impulse" form:"pre_impulse"`
223 224
 }
224 225
 
225 226
 func (DialysisPrescription) TableName() string {

+ 4 - 4
service/auto_create_week_disinfection.go Visa fil

@@ -82,14 +82,14 @@ func AutoCreateWeekDisinfectionJob() {
82 82
 				fmt.Print("透析时长", dislysis.ActualTreatmentHour+'h'+dislysis.ActualTreatmentMinute+'m'+'i'+'n')
83 83
 				//			//根据床位号获取设备id
84 84
 				addmacher, _ := GetEquimentID(schedules.BedId, it.UserOrgId)
85
-				unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
85
+				//unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
86 86
 				fmt.Println(" 设备id", addmacher.ID)
87 87
 				//根据设备id获取设备类型
88 88
 				//equimentname, _ := GetAddmacher(addmacher.ID, it.UserOrgId)
89 89
 
90 90
 				fmt.Println("班次", it.SchedualType)
91 91
 				//查看该设备是否有消毒计划,无怎返回,有则添加
92
-				plan, errplan := GetDisinfection(unitype, it.SchedualType, it.UserOrgId)
92
+				plan, errplan := GetDisinfection(addmacher.UnitType, it.SchedualType, it.UserOrgId)
93 93
 				fmt.Print("plan", plan)
94 94
 				fmt.Println("错误是什么", errplan)
95 95
 				if errplan == gorm.ErrRecordNotFound {
@@ -211,10 +211,10 @@ func GetInfor(patientid int64, timenow int64, orgid int64, class int64) (*models
211 211
 	return &pre, nil
212 212
 }
213 213
 
214
-func GetDisinfection(equitType int64, enquitType int64, orgID int64) (*models.DevicePlan, error) {
214
+func GetDisinfection(equitType int64, scheduleType int64, orgID int64) (*models.DevicePlan, error) {
215 215
 	var plan models.DevicePlan
216 216
 	var err error
217
-	err = readUserDb.Model(&plan).Where("device_type = ? AND classtime = ? AND user_org_id = ? AND status = 1", equitType, enquitType, orgID).Find(&plan).Error
217
+	err = readUserDb.Model(&plan).Where("device_type = ? AND classtime = ? AND user_org_id = ? AND status = 1", equitType, scheduleType, orgID).Find(&plan).Error
218 218
 	if err == gorm.ErrRecordNotFound {
219 219
 		return nil, err
220 220
 	}

+ 2 - 2
service/auto_create_week_plan.go Visa fil

@@ -77,14 +77,14 @@ func AutoCreateWeekPlanJob() {
77 77
 				fmt.Println("透后", err)
78 78
 				//			//根据床位号获取设备id
79 79
 				addmacher, _ := GetEquimentID(schedules.BedId, it.UserOrgId)
80
-				unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
80
+				//unitype, err := strconv.ParseInt(addmacher.UnitType, 10, 64)
81 81
 				fmt.Println(" 设备id", addmacher.ID)
82 82
 				//根据设备id获取设备类型
83 83
 				//equimentname, _ := GetAddmacher(addmacher.ID, it.UserOrgId)
84 84
 
85 85
 				fmt.Println("班次", it.SchedualType)
86 86
 				//查看该设备是否有消毒计划,无怎返回,有则添加
87
-				plan, errplan := GetDisinfection(unitype, it.SchedualType, it.UserOrgId)
87
+				plan, errplan := GetDisinfection(addmacher.UnitType, it.SchedualType, it.UserOrgId)
88 88
 				fmt.Print("plan", plan)
89 89
 				fmt.Println("错误", errplan)
90 90
 				if errplan == gorm.ErrRecordNotFound {

+ 4 - 3
service/device_service.go Visa fil

@@ -623,9 +623,10 @@ func GetAllMachineInfo(page int64, limit int64, keyword string, zoneid int64, eq
623 623
 	table := XTReadDB().Table("xt_device_zone as x")
624 624
 	d := readUserDb.Table("xt_device_mode as m")
625 625
 	d2 := XTReadDB().Table("xt_device_number as n")
626
+	d3 := XTReadDB().Table("xt_device_information as i")
626 627
 	fmt.Print("d", d)
627 628
 	fmt.Println("table", table)
628
-	fmt.Print("d2", d2)
629
+	fmt.Print("d2", d2, d3)
629 630
 	if orgid > 0 {
630 631
 		db = db.Where("a.user_org_id = ?", orgid)
631 632
 	}
@@ -646,8 +647,8 @@ func GetAllMachineInfo(page int64, limit int64, keyword string, zoneid int64, eq
646 647
 
647 648
 	offset := (page - 1) * limit
648 649
 
649
-	err = db.Order("a.ctime asc").Select("a.id,a.serial_number,a.device_type,a.bed_number,a.device_name,a.manufacture_factory,a.service_manufacturer,a.unit_type,a.use_section,a.section_number,a.buy_date,a.install_date,a.start_date,a.maintenace_engineer,a.telephone,a.guarantee_date,a.machine_status,a.user_total,a.disinfection_mode,a.remarks,a.rubbish_date,a.rubbish_reason,a.user_year,a.work_time,a.revers_mode,a.user_org_id,a.status,a.ctime,a.mtime,a.bed_id,x.name,m.device_mode,n.number").Count(&total).
650
-		Joins("Left JOIN xt_device_mode as m on m.id = a.unit_type ").Joins("left join sgj_xt.xt_device_number as n on n.id = a.bed_id").Joins("Left JOIN sgj_xt.xt_device_zone as x On x.id = n.zone_id").Offset(offset).Limit(limit).Scan(&addmahcer).Error
650
+	err = db.Group("a.id").Order("a.ctime asc").Select("a.id,a.serial_number,a.device_type,a.bed_number,a.device_name,a.manufacture_factory,a.service_manufacturer,a.unit_type,a.use_section,a.section_number,a.buy_date,a.install_date,a.start_date,a.maintenace_engineer,a.telephone,a.guarantee_date,a.machine_status,a.user_total,a.disinfection_mode,a.remarks,a.rubbish_date,a.rubbish_reason,a.user_year,a.work_time,a.revers_mode,a.user_org_id,a.status,a.ctime,a.mtime,a.bed_id,x.name,m.device_mode,n.number,i.equiment_id").Count(&total).
651
+		Joins("Left JOIN xt_device_mode as m on m.id = a.unit_type ").Joins("left join sgj_xt.xt_device_number as n on n.id = a.bed_id").Joins("Left JOIN sgj_xt.xt_device_zone as x On x.id = n.zone_id").Joins("left join xt_device_information as i on i.bed_number = a.bed_id").Offset(offset).Limit(limit).Scan(&addmahcer).Error
651 652
 
652 653
 	if err != nil {
653 654
 

+ 35 - 4
service/manage_service.go Visa fil

@@ -1138,9 +1138,9 @@ func GetUserTotal(orgid int64, id int64) (models.DeviceAddmacher, error) {
1138 1138
 	return addmacher, err
1139 1139
 }
1140 1140
 
1141
-func GetDisInfectionTime(orgid int64, bedid int64, scheduletype int64, scheduleweek int64) (*models.DevicePlan, error) {
1141
+func GetDisInfectionTime(orgid int64, unitype int64, scheduletype int64, scheduleweek int64) (*models.DevicePlan, error) {
1142 1142
 	plan := models.DevicePlan{}
1143
-	err = UserReadDB().Model(&plan).Where("user_org_id = ? and bed_id = ? and classtime = ? and time = ? and status = 1", orgid, bedid, scheduletype, scheduleweek).Find(&plan).Error
1143
+	err = UserReadDB().Model(&plan).Where("user_org_id = ? and device_type = ? and classtime = ? and time = ? and status = 1", orgid, unitype, scheduletype, scheduleweek).Find(&plan).Error
1144 1144
 	if err == gorm.ErrRecordNotFound {
1145 1145
 		return nil, err
1146 1146
 	}
@@ -1150,10 +1150,29 @@ func GetDisInfectionTime(orgid int64, bedid int64, scheduletype int64, schedulew
1150 1150
 	return &plan, nil
1151 1151
 }
1152 1152
 
1153
-func GetLaseDeviceInfomation(orgid int64, bedid int64) (models.DeviceInformation, error) {
1153
+func GetUnitType(bedid int64, orgid int64) (models.DeviceAddmacher, error) {
1154
+
1155
+	addmacher := models.DeviceAddmacher{}
1156
+	err := UserReadDB().Model(&addmacher).Where("bed_id = ? and user_org_id = ? and status = 1", bedid, orgid).Find(&addmacher).Error
1157
+	return addmacher, err
1158
+}
1159
+
1160
+func GetLaseDeviceInfomation(orgid int64, bedid int64, date int64, scheduletype int64) (*models.DeviceInformation, error) {
1154 1161
 
1155 1162
 	information := models.DeviceInformation{}
1156
-	err := UserReadDB().Model(&information).Where("bed_number = ? and user_org_id =? and status = 1", bedid, orgid).Last(&information).Error
1163
+	err := UserReadDB().Model(&information).Where("bed_number = ? and user_org_id =? and status = 1 and date = ? and class = ? ", bedid, orgid, date, scheduletype).Find(&information).Error
1164
+	if err == gorm.ErrRecordNotFound {
1165
+		return nil, err
1166
+	}
1167
+	if err != nil {
1168
+		return nil, err
1169
+	}
1170
+	return &information, nil
1171
+}
1172
+
1173
+func GetLaseDeviceInfomationTwo(orgid int64, bedid int64, scheduletype int64) (models.DeviceInformation, error) {
1174
+	information := models.DeviceInformation{}
1175
+	err = UserReadDB().Model(&information).Where("bed_number= ? and user_org_id = ? and status = 1 and class = ?", bedid, orgid, scheduletype).Last(&information).Error
1157 1176
 	return information, err
1158 1177
 }
1159 1178
 
@@ -1205,3 +1224,15 @@ func CreateInformationTwo(information *models.DeviceInformation) error {
1205 1224
 	err := UserWriteDB().Create(&information).Error
1206 1225
 	return err
1207 1226
 }
1227
+
1228
+func UpdateInformation(information *models.DeviceInformation, scheduledate int64, bedid int64, scheduletype int64) error {
1229
+
1230
+	err := UserWriteDB().Model(&information).Where("date = ? and bed_number = ? and class = ?", scheduledate, bedid, scheduletype).Updates(map[string]interface{}{"long_time": information.LongTime, "disinfec_startime": information.DisinfecStartime, "disinfec_endtime": information.DisinfecEndtime}).Error
1231
+	return err
1232
+}
1233
+
1234
+func DeleteEquit(id int64) (models.DeviceAddmacher, error) {
1235
+	addmacher := models.DeviceAddmacher{}
1236
+	err := UserWriteDB().Model(&addmacher).Where("id=?", id).Updates(map[string]interface{}{"status": 0}).Error
1237
+	return addmacher, err
1238
+}

+ 15 - 0
service/mobile_dialysis_service.go Visa fil

@@ -1265,3 +1265,18 @@ func GetDialysisOrderCount(orgID int64, patient_id int64, recordDate int64) (cou
1265 1265
 	err = readDb.Model(&models.DialysisOrder{}).Where("dialysis_date <= ? AND status = 1 AND stage = 2 AND user_org_id = ? AND patient_id = ?", recordDate, orgID, patient_id).Count(&count).Error
1266 1266
 	return
1267 1267
 }
1268
+
1269
+func GetFirstDateOfMonth(d time.Time) time.Time {
1270
+	d = d.AddDate(0, 0, -d.Day()+1)
1271
+	return GetZeroTime(d)
1272
+}
1273
+
1274
+func GetZeroTime(d time.Time) time.Time {
1275
+	return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, d.Location())
1276
+}
1277
+
1278
+func GetDialysisCountByPatientId(startime int64, endtime int64, patientid int64, orgid int64) (order []*models.BloodDialysisOrderCount, err error) {
1279
+	db := XTReadDB().Table("xt_dialysis_order as o")
1280
+	err = db.Raw("select count(o.id) as count,o.patient_id from xt_dialysis_order as o left join xt_schedule AS x ON x.patient_id = o.patient_id   where o.status = 1 and o.dialysis_date>=? and o.dialysis_date<=? and o.user_org_id = ? and x.schedule_date = o.dialysis_date and x.status = 1 and o.patient_id = ?", startime, endtime, orgid, patientid).Scan(&order).Group("o.patient_id").Error
1281
+	return order, err
1282
+}

+ 21 - 2
数据变更脚本.sql Visa fil

@@ -93,7 +93,26 @@ ALTER TABLE `test_xt`.`xt_monitoring_record`     ADD COLUMN `arterial_pressure_t
93 93
 ALTER TABLE `sgj_xt`.`xt_monitoring_record`     CHANGE `transmembrane_pressure_unit` `transmembrane_pressure_type` SMALLINT(2) DEFAULT '1' NOT NULL COMMENT '跨膜压类型 1:mmHg 2:kpa';
94 94
 
95 95
 
96
-
97
-
96
+--2020-08-15 author 马文强 --
97
+--数据字典表里添加针眼--
98
+INSERT INTO `sgj_xt`.`xt_data_config`(`parent_id`,`module`,`org_id`,`name`,`field_name`,`value`,`create_time`,`update_time`,`create_user_id`,`status`,`remark`,`delete_id_system`,`title`,`content`,`orders`) VALUES ( '0','hemodialysis','0','针眼','pinholing','0','2020-08-15 16:56:00','2020-08-15 16:56:00','0','1',NULL,'0',NULL,NULL,'0');
99
+--显示配置中添加针眼字段 --
100
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','3','pinholing','针眼','1',NULL,NULL,'0');
101
+--显示配置中添加预冲量字段 --
102
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','1','pre_impulse','预冲量','1',NULL,NULL,'0');
103
+--显示配置中添加实际抗凝用量 --
104
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','5','dosage_of_ anticoagulants','实际抗凝剂用量','1',NULL,NULL,'0');
105
+--显示配置中添加卧位收缩压 --
106
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','5','supine_systolic_blood_pressure','卧位收缩压','1',NULL,NULL,'0');
107
+--显示配置中添加坐位收缩压 --
108
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','5','setting_pressure','坐位收缩压','1',NULL,NULL,'0');
109
+--显示配置中添加卧位舒张压 --
110
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','5','supine_diastolic_blood_pressure','卧位舒张压','1',NULL,NULL,'0');
111
+--显示配置中添加坐位舒张压 --
112
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','5','diastolic_pressure','坐位舒张压','1',NULL,NULL,'0');
113
+--显示配置中添加urr--
114
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','4','URR','URR','1',NULL,NULL,'0');
115
+--显示配置中添加血糖 --
116
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9886','4','blood_sugar','血糖','1',NULL,NULL,'0');
98 117
 
99 118