Browse Source

耗材参数

XMLWAN 3 years ago
parent
commit
e9cfaa8325

+ 1 - 1
conf/app.conf View File

1
 appname = 血透
1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3
 runmode = dev
3
 runmode = dev
4
 
4
 
5
 #
5
 #

+ 5 - 12
controllers/data_api_controller.go View File

892
 func (c *DataApiController) CreateAdviceTemplate() {
892
 func (c *DataApiController) CreateAdviceTemplate() {
893
 	templateName := c.GetString("template_name")
893
 	templateName := c.GetString("template_name")
894
 	advice_type, _ := c.GetInt64("advice_type")
894
 	advice_type, _ := c.GetInt64("advice_type")
895
-
896
-	fmt.Println(templateName)
895
+	sort, _ := c.GetInt64("sort")
897
 
896
 
898
 	if templateName == "" {
897
 	if templateName == "" {
899
 		utils.ErrorLog("模版名称不能为空")
898
 		utils.ErrorLog("模版名称不能为空")
921
 		}
920
 		}
922
 	}
921
 	}
923
 
922
 
924
-	//total := service.FindTemplateRecordByName(adminUserInfo.CurrentOrgId, templateName);
925
-	//if total > 0 {
926
-	//	utils.ErrorLog("模版名称已经存在")
927
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNameWrong)
928
-	//	return
929
-	//}
930
-
931
 	template := &models.DoctorAdviceParentTemplate{
923
 	template := &models.DoctorAdviceParentTemplate{
932
 		Name:        templateName,
924
 		Name:        templateName,
933
 		OrgId:       adminUserInfo.CurrentOrgId,
925
 		OrgId:       adminUserInfo.CurrentOrgId,
935
 		CreatedTime: time.Now().Unix(),
927
 		CreatedTime: time.Now().Unix(),
936
 		UpdatedTime: time.Now().Unix(),
928
 		UpdatedTime: time.Now().Unix(),
937
 		AdviceType:  advice_type,
929
 		AdviceType:  advice_type,
930
+		Sort:        sort,
938
 	}
931
 	}
939
 
932
 
940
 	createErr := service.CreateTemplate(template)
933
 	createErr := service.CreateTemplate(template)
1326
 func (this *DataApiController) ModifyTemplateName() {
1319
 func (this *DataApiController) ModifyTemplateName() {
1327
 	template_name := this.GetString("template_name")
1320
 	template_name := this.GetString("template_name")
1328
 	template_id, _ := this.GetInt64("template_id", 0)
1321
 	template_id, _ := this.GetInt64("template_id", 0)
1329
-
1322
+	sort, _ := this.GetInt64("sort")
1330
 	if len(template_name) <= 0 {
1323
 	if len(template_name) <= 0 {
1331
 		utils.ErrorLog("模版名字不能为空")
1324
 		utils.ErrorLog("模版名字不能为空")
1332
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamEmptyWrong)
1325
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamEmptyWrong)
1344
 	template, _ := service.FindParentTemplateRecordById(adminUserInfo.CurrentOrgId, template_id)
1337
 	template, _ := service.FindParentTemplateRecordById(adminUserInfo.CurrentOrgId, template_id)
1345
 	var err error
1338
 	var err error
1346
 	if template.Name == template_name {
1339
 	if template.Name == template_name {
1347
-		err = service.ModifyTemplateName(template_id, template_name)
1340
+		err = service.ModifyTemplateNameOne(template_id, template_name, sort)
1348
 		if err != nil {
1341
 		if err != nil {
1349
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
1342
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
1350
 			return
1343
 			return
1356
 		//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNameWrong)
1349
 		//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNameWrong)
1357
 		//	return
1350
 		//	return
1358
 		//}
1351
 		//}
1359
-		err = service.ModifyTemplateName(template_id, template_name)
1352
+		err = service.ModifyTemplateNameOne(template_id, template_name, sort)
1360
 
1353
 
1361
 		if err != nil {
1354
 		if err != nil {
1362
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
1355
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)

+ 24 - 1
controllers/dialysis_api_controller.go View File

255
 	single_water := c.GetString("single_water")
255
 	single_water := c.GetString("single_water")
256
 	replacement_flow := c.GetString("replacement_flow")
256
 	replacement_flow := c.GetString("replacement_flow")
257
 	plasma_separator := c.GetString("plasma_separator")
257
 	plasma_separator := c.GetString("plasma_separator")
258
+	bilirubin_adsorption_column := c.GetString("bilirubin_adsorption_column")
259
+
258
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
260
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
259
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
261
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
260
 
262
 
344
 		SingleWater:                single_water,
346
 		SingleWater:                single_water,
345
 		ReplacementFlow:            replacement_flow,
347
 		ReplacementFlow:            replacement_flow,
346
 		PlasmaSeparator:            plasma_separator,
348
 		PlasmaSeparator:            plasma_separator,
349
+		BilirubinAdsorptionColumn:  bilirubin_adsorption_column,
347
 	}
350
 	}
348
 
351
 
349
 	//查询最近透析准备表里是否存在 透析器 灌流器
352
 	//查询最近透析准备表里是否存在 透析器 灌流器
585
 	single_water := c.GetString("single_water")
588
 	single_water := c.GetString("single_water")
586
 	replacement_flow := c.GetString("replacement_flow")
589
 	replacement_flow := c.GetString("replacement_flow")
587
 	plasma_separator := c.GetString("plasma_separator")
590
 	plasma_separator := c.GetString("plasma_separator")
591
+	bilirubin_adsorption_column := c.GetString("bilirubin_adsorption_column")
588
 	var prescription_doctor int64
592
 	var prescription_doctor int64
589
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
593
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
590
 
594
 
685
 		SingleWater:               single_water,
689
 		SingleWater:               single_water,
686
 		ReplacementFlow:           replacement_flow,
690
 		ReplacementFlow:           replacement_flow,
687
 		PlasmaSeparator:           plasma_separator,
691
 		PlasmaSeparator:           plasma_separator,
692
+		BilirubinAdsorptionColumn: bilirubin_adsorption_column,
688
 	}
693
 	}
689
 
694
 
690
 	//查询最近透析准备表里是否存在 透析器 灌流器
695
 	//查询最近透析准备表里是否存在 透析器 灌流器
1332
 	pre_dialysis_drugs := c.GetString("pre_dialysis_drugs")
1337
 	pre_dialysis_drugs := c.GetString("pre_dialysis_drugs")
1333
 	period, _ := c.GetInt64("period")
1338
 	period, _ := c.GetInt64("period")
1334
 	estimated_food_intake := c.GetString("estimated_food_intake")
1339
 	estimated_food_intake := c.GetString("estimated_food_intake")
1340
+	blood_pressure_during_dialysis := c.GetString("blood_pressure_during_dialysis")
1335
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1341
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1336
 		DialysisCount:                  dialysis_count,
1342
 		DialysisCount:                  dialysis_count,
1337
 		EmergencyTreatment:             emergency_treatment,
1343
 		EmergencyTreatment:             emergency_treatment,
1397
 		PreDialysisDrugs:               pre_dialysis_drugs,
1403
 		PreDialysisDrugs:               pre_dialysis_drugs,
1398
 		Period:                         period,
1404
 		Period:                         period,
1399
 		EstimatedFoodIntake:            estimated_food_intake,
1405
 		EstimatedFoodIntake:            estimated_food_intake,
1406
+		BloodPressureDuringDialysis:    blood_pressure_during_dialysis,
1400
 	}
1407
 	}
1401
 
1408
 
1402
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1409
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
3087
 
3094
 
3088
 	var ultrafiltration_rate float64
3095
 	var ultrafiltration_rate float64
3089
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, theAssessmentDateTime, adminInfo.CurrentOrgId)
3096
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, theAssessmentDateTime, adminInfo.CurrentOrgId)
3097
+	//针对福建医师汇 获取透前评估预增脱水量
3098
+
3099
+	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, theAssessmentDateTime, adminInfo.CurrentOrgId)
3100
+	fmt.Println("透前评估数据", evaluation)
3101
+
3090
 	if prescription.ID > 0 {
3102
 	if prescription.ID > 0 {
3091
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
3103
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
3092
 
3104
 
3095
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3107
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3096
 				record.UltrafiltrationRate = ultrafiltration_rate
3108
 				record.UltrafiltrationRate = ultrafiltration_rate
3097
 			}
3109
 			}
3110
+			if template.TemplateId == 6 && adminInfo.CurrentOrgId == 9671 {
3111
+
3112
+				dehydration, _ := strconv.ParseFloat(evaluation.Dehydration, 64)
3113
+				ultrafiltration_rate = math.Floor((prescription.TargetUltrafiltration + dehydration) / float64(totalMin) * 60 * 1000)
3114
+
3115
+				record.UltrafiltrationRate = ultrafiltration_rate
3116
+			}
3098
 
3117
 
3099
 			if template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 { //adminInfo.CurrentOrgId == 9538
3118
 			if template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 { //adminInfo.CurrentOrgId == 9538
3100
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
3119
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
3110
 		}
3129
 		}
3111
 	}
3130
 	}
3112
 	// record.UltrafiltrationRate = ultrafiltration_rate
3131
 	// record.UltrafiltrationRate = ultrafiltration_rate
3113
-	record.UltrafiltrationVolume = 0
3132
+	if adminInfo.CurrentOrgId != 9538 {
3133
+		record.UltrafiltrationVolume = 0
3134
+	}
3135
+
3114
 	if template.TemplateId == 1 && adminInfo.CurrentOrgId != 9849 {
3136
 	if template.TemplateId == 1 && adminInfo.CurrentOrgId != 9849 {
3115
 		if ultrafiltration_rate > 0 {
3137
 		if ultrafiltration_rate > 0 {
3116
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
3138
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
3123
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
3145
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
3124
 			record.UltrafiltrationVolume = ultrafiltration_volume
3146
 			record.UltrafiltrationVolume = ultrafiltration_volume
3125
 		}
3147
 		}
3148
+
3126
 	}
3149
 	}
3127
 
3150
 
3128
 	this.ServeSuccessJSON(map[string]interface{}{
3151
 	this.ServeSuccessJSON(map[string]interface{}{

+ 8 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go View File

1100
 	single_water := c.GetString("single_water")
1100
 	single_water := c.GetString("single_water")
1101
 	replacement_flow := c.GetString("replacement_flow")
1101
 	replacement_flow := c.GetString("replacement_flow")
1102
 	plasma_separator := c.GetString("plasma_separator")
1102
 	plasma_separator := c.GetString("plasma_separator")
1103
+	bilirubin_adsorption_column := c.GetString("bilirubin_adsorption_column")
1103
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1104
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1104
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1105
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1105
 	//
1106
 	//
1193
 		SingleWater:                single_water,
1194
 		SingleWater:                single_water,
1194
 		ReplacementFlow:            replacement_flow,
1195
 		ReplacementFlow:            replacement_flow,
1195
 		PlasmaSeparator:            plasma_separator,
1196
 		PlasmaSeparator:            plasma_separator,
1197
+		BilirubinAdsorptionColumn:  bilirubin_adsorption_column,
1196
 	}
1198
 	}
1197
 
1199
 
1198
 	//查询最近透析准备表里是否存在 透析器 灌流器
1200
 	//查询最近透析准备表里是否存在 透析器 灌流器
1992
 	single_water := c.GetString("single_water")
1994
 	single_water := c.GetString("single_water")
1993
 	replacement_flow := c.GetString("replacement_flow")
1995
 	replacement_flow := c.GetString("replacement_flow")
1994
 	plasma_separator := c.GetString("plasma_separator")
1996
 	plasma_separator := c.GetString("plasma_separator")
1997
+	bilirubin_adsorption_column := c.GetString("bilirubin_adsorption_column")
1995
 	if mode_id > 0 {
1998
 	if mode_id > 0 {
1996
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1999
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1997
 	}
2000
 	}
2086
 		SingleTime:                single_time,
2089
 		SingleTime:                single_time,
2087
 		ReplacementFlow:           replacement_flow,
2090
 		ReplacementFlow:           replacement_flow,
2088
 		PlasmaSeparator:           plasma_separator,
2091
 		PlasmaSeparator:           plasma_separator,
2092
+		BilirubinAdsorptionColumn: bilirubin_adsorption_column,
2089
 	}
2093
 	}
2090
 
2094
 
2091
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
2095
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
2347
 		}
2351
 		}
2348
 	}
2352
 	}
2349
 	// record.UltrafiltrationRate = ultrafiltration_rate
2353
 	// record.UltrafiltrationRate = ultrafiltration_rate
2350
-	record.UltrafiltrationVolume = 0
2354
+	if adminInfo.Org.Id != 9538 {
2355
+		record.UltrafiltrationVolume = 0
2356
+	}
2357
+
2351
 	if template.TemplateId == 1 && adminInfo.Org.Id != 9849 { //adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535
2358
 	if template.TemplateId == 1 && adminInfo.Org.Id != 9849 { //adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535adminInfo.Org.Id == 3907 || adminInfo.Org.Id == 4 || adminInfo.Org.Id == 12 || adminInfo.Org.Id == 13 || adminInfo.Org.Id == 9535
2352
 		if ultrafiltration_rate > 0 {
2359
 		if ultrafiltration_rate > 0 {
2353
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)
2360
 			value, _ := strconv.ParseFloat(fmt.Sprintf("%.3f", float64(record.OperateTime+3600-fristrecord.OperateTime)/3600*ultrafiltration_rate), 6)

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

2418
 		evaluation.EstimatedFoodIntake = estimated_food_intake
2418
 		evaluation.EstimatedFoodIntake = estimated_food_intake
2419
 	}
2419
 	}
2420
 
2420
 
2421
+	if dataBody["blood_pressure_during_dialysis"] != nil && reflect.TypeOf(dataBody["blood_pressure_during_dialysis"]).String() == "string" {
2422
+		blood_pressure_during_dialysis := dataBody["blood_pressure_during_dialysis"].(string)
2423
+		evaluation.BloodPressureDuringDialysis = blood_pressure_during_dialysis
2424
+	}
2425
+
2421
 	return
2426
 	return
2422
 }
2427
 }
2423
 
2428
 

+ 10 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

172
 	birth := theTime.Unix()
172
 	birth := theTime.Unix()
173
 	fmt.Print(birth)
173
 	fmt.Print(birth)
174
 	phone := dataBody["phone"].(string)
174
 	phone := dataBody["phone"].(string)
175
+	relative_phone := dataBody["relative_phone"].(string)
175
 	fmt.Print("电话号码", phone)
176
 	fmt.Print("电话号码", phone)
176
 	patientType := dataBody["result"].([]interface{})
177
 	patientType := dataBody["result"].([]interface{})
177
 	fmt.Print("患者标签", patientType)
178
 	fmt.Print("患者标签", patientType)
290
 			IdCardNo:          idCard,
291
 			IdCardNo:          idCard,
291
 			IsInfectious:      is_infectious,
292
 			IsInfectious:      is_infectious,
292
 			RegistrarsId:      adminInfo.AdminUser.Id,
293
 			RegistrarsId:      adminInfo.AdminUser.Id,
294
+			RelativePhone:     relative_phone,
293
 		}
295
 		}
294
 		err = service.CreateOldPatient(&patients)
296
 		err = service.CreateOldPatient(&patients)
295
 		fmt.Print("报错", err)
297
 		fmt.Print("报错", err)
331
 			IsInfectious:      is_infectious,
333
 			IsInfectious:      is_infectious,
332
 			IdCardNo:          idCard,
334
 			IdCardNo:          idCard,
333
 			RegistrarsId:      adminInfo.AdminUser.Id,
335
 			RegistrarsId:      adminInfo.AdminUser.Id,
336
+			RelativePhone:     relative_phone,
334
 		}
337
 		}
335
 		err = service.CreateNewPatient(&patientsNew)
338
 		err = service.CreateNewPatient(&patientsNew)
336
 		fmt.Print("报错", err)
339
 		fmt.Print("报错", err)
455
 								MemberFistdate:    memtime,
458
 								MemberFistdate:    memtime,
456
 								MemberPatienttype: patient_type,
459
 								MemberPatienttype: patient_type,
457
 								MemberTreatement:  treatmentmethod,
460
 								MemberTreatement:  treatmentmethod,
461
+								RelativePhone:     relative_phone,
458
 							}
462
 							}
459
 							err = service.CreateNewPatient(&patientsNew)
463
 							err = service.CreateNewPatient(&patientsNew)
460
 							fmt.Print("报错", err)
464
 							fmt.Print("报错", err)
541
 					MemberFistdate:    memtime,
545
 					MemberFistdate:    memtime,
542
 					MemberPatienttype: patient_type,
546
 					MemberPatienttype: patient_type,
543
 					MemberTreatement:  treatmentmethod,
547
 					MemberTreatement:  treatmentmethod,
548
+					RelativePhone:     relative_phone,
544
 				}
549
 				}
545
 				err = service.CreateNewPatient(&patientsNew)
550
 				err = service.CreateNewPatient(&patientsNew)
546
 				fmt.Print("报错", err)
551
 				fmt.Print("报错", err)
1254
 	fmt.Print(birth)
1259
 	fmt.Print(birth)
1255
 	phone := dataBody["phone"].(string)
1260
 	phone := dataBody["phone"].(string)
1256
 	fmt.Print("电话号码", phone)
1261
 	fmt.Print("电话号码", phone)
1262
+	relative_phone := dataBody["relative_phone"].(string)
1257
 	patientType := dataBody["result"].([]interface{})
1263
 	patientType := dataBody["result"].([]interface{})
1258
 	fmt.Print("患者标签", patientType)
1264
 	fmt.Print("患者标签", patientType)
1259
 	dialysis := dataBody["dialysis"].(string)
1265
 	dialysis := dataBody["dialysis"].(string)
1387
 			Lapseto:           lapseto,
1393
 			Lapseto:           lapseto,
1388
 			DeathTime:         death_time,
1394
 			DeathTime:         death_time,
1389
 			OutReason:         out_reason,
1395
 			OutReason:         out_reason,
1396
+			RelativePhone:     relative_phone,
1390
 		}
1397
 		}
1391
 		err = service.UpdatedPatient(patients, patient.BloodId)
1398
 		err = service.UpdatedPatient(patients, patient.BloodId)
1392
 		//patientLapseto := models.PatientLapseto{
1399
 		//patientLapseto := models.PatientLapseto{
1417
 			Lapseto:           lapseto,
1424
 			Lapseto:           lapseto,
1418
 			OutReason:         out_reason,
1425
 			OutReason:         out_reason,
1419
 			DeathTime:         death_time,
1426
 			DeathTime:         death_time,
1427
+			RelativePhone:     relative_phone,
1420
 		}
1428
 		}
1421
 		err = service.UpdateXtPatientNew(patientsNew, id)
1429
 		err = service.UpdateXtPatientNew(patientsNew, id)
1422
 		if err != nil {
1430
 		if err != nil {
1474
 			EquitmentId:       requipmentId,
1482
 			EquitmentId:       requipmentId,
1475
 			OutReason:         out_reason,
1483
 			OutReason:         out_reason,
1476
 			DeathTime:         death_time,
1484
 			DeathTime:         death_time,
1485
+			RelativePhone:     relative_phone,
1477
 		}
1486
 		}
1478
 		err = service.UpdateXtPatientNew(xtPatientsNew, id)
1487
 		err = service.UpdateXtPatientNew(xtPatientsNew, id)
1479
 		fmt.Print("更新失败", err)
1488
 		fmt.Print("更新失败", err)
1530
 			MemberTreatement:  treatmentmethod,
1539
 			MemberTreatement:  treatmentmethod,
1531
 			OutReason:         out_reason,
1540
 			OutReason:         out_reason,
1532
 			DeathTime:         death_time,
1541
 			DeathTime:         death_time,
1542
+			RelativePhone:     relative_phone,
1533
 		}
1543
 		}
1534
 		err = service.UpdateXtPatientNewOne(patientsNew, id)
1544
 		err = service.UpdateXtPatientNewOne(patientsNew, id)
1535
 		if err != nil {
1545
 		if err != nil {

+ 6 - 0
controllers/patient_api_controller.go View File

857
 		DialysisIrrigation:         solution.DialysisIrrigation,
857
 		DialysisIrrigation:         solution.DialysisIrrigation,
858
 		DialysisDialyszers:         solution.DialysisDialyszers,
858
 		DialysisDialyszers:         solution.DialysisDialyszers,
859
 		PlasmaSeparator:            solution.PlasmaSeparator,
859
 		PlasmaSeparator:            solution.PlasmaSeparator,
860
+		BilirubinAdsorptionColumn:  solution.BilirubinAdsorptionColumn,
860
 	}
861
 	}
861
 	service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
862
 	service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
862
 	if err != nil {
863
 	if err != nil {
3416
 		solution.PlasmaSeparator = plasmaSeparator
3417
 		solution.PlasmaSeparator = plasmaSeparator
3417
 	}
3418
 	}
3418
 
3419
 
3420
+	if dataBody["bilirubin_adsorption_column"] != nil && reflect.TypeOf(dataBody["bilirubin_adsorption_column"]).String() == "string" {
3421
+		bilirubinAdsorptionColumn := dataBody["bilirubin_adsorption_column"].(string)
3422
+		solution.BilirubinAdsorptionColumn = bilirubinAdsorptionColumn
3423
+	}
3424
+
3419
 	return
3425
 	return
3420
 }
3426
 }
3421
 
3427
 

+ 1 - 0
models/dialysis.go View File

285
 	PreDialysisDrugs               string  `gorm:"column:pre_dialysis_drugs" json:"pre_dialysis_drugs" form:"pre_dialysis_drugs"`
285
 	PreDialysisDrugs               string  `gorm:"column:pre_dialysis_drugs" json:"pre_dialysis_drugs" form:"pre_dialysis_drugs"`
286
 	Period                         int64   `gorm:"column:period" json:"period" form:"period"`
286
 	Period                         int64   `gorm:"column:period" json:"period" form:"period"`
287
 	EstimatedFoodIntake            string  `gorm:"column:estimated_food_intake" json:"estimated_food_intake" form:"estimated_food_intake"`
287
 	EstimatedFoodIntake            string  `gorm:"column:estimated_food_intake" json:"estimated_food_intake" form:"estimated_food_intake"`
288
+	BloodPressureDuringDialysis    string  `gorm:"column:blood_pressure_during_dialysis" json:"blood_pressure_during_dialysis" form:"blood_pressure_during_dialysis"`
288
 }
289
 }
289
 
290
 
290
 func (PredialysisEvaluation) TableName() string {
291
 func (PredialysisEvaluation) TableName() string {

+ 1 - 0
models/doctor_advice_models.go View File

91
 	UpdatedTime          int64                   `gorm:"column:updated_time" json:"updated_time"`
91
 	UpdatedTime          int64                   `gorm:"column:updated_time" json:"updated_time"`
92
 	DoctorAdviceTemplate []*DoctorAdviceTemplate `gorm:"ForeignKey:TemplateId;AssociationForeignKey:ID"`
92
 	DoctorAdviceTemplate []*DoctorAdviceTemplate `gorm:"ForeignKey:TemplateId;AssociationForeignKey:ID"`
93
 	AdviceType           int64                   `gorm:"column:advice_type" json:"advice_type"`
93
 	AdviceType           int64                   `gorm:"column:advice_type" json:"advice_type"`
94
+	Sort                 int64                   `gorm:"column:sort" json:"sort" form:"sort"`
94
 }
95
 }
95
 
96
 
96
 func (DoctorAdviceParentTemplate) TableName() string {
97
 func (DoctorAdviceParentTemplate) TableName() string {

+ 2 - 0
models/patient_models.go View File

236
 	SingleWater                string        `gorm:"column:single_water" json:"single_water" form:"single_water"`
236
 	SingleWater                string        `gorm:"column:single_water" json:"single_water" form:"single_water"`
237
 	ReplacementFlow            string        `gorm:"column:replacement_flow" json:"replacement_flow" form:"replacement_flow"`
237
 	ReplacementFlow            string        `gorm:"column:replacement_flow" json:"replacement_flow" form:"replacement_flow"`
238
 	PlasmaSeparator            string        `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
238
 	PlasmaSeparator            string        `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
239
+	BilirubinAdsorptionColumn  string        `gorm:"column:bilirubin_adsorption_column" json:"bilirubin_adsorption_column" form:"bilirubin_adsorption_column"`
239
 }
240
 }
240
 
241
 
241
 func (DialysisPrescription) TableName() string {
242
 func (DialysisPrescription) TableName() string {
340
 	Illness                    int64   `gorm:"column:illness" json:"illness" form:"illness"`
341
 	Illness                    int64   `gorm:"column:illness" json:"illness" form:"illness"`
341
 	Amylaceum                  string  `gorm:"column:amylaceum" json:"amylaceum" form:"amylaceum"`
342
 	Amylaceum                  string  `gorm:"column:amylaceum" json:"amylaceum" form:"amylaceum"`
342
 	PlasmaSeparator            string  `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
343
 	PlasmaSeparator            string  `gorm:"column:plasma_separator" json:"plasma_separator" form:"plasma_separator"`
344
+	BilirubinAdsorptionColumn  string  `gorm:"column:bilirubin_adsorption_column" json:"bilirubin_adsorption_column" form:"bilirubin_adsorption_column"`
343
 }
345
 }
344
 
346
 
345
 func (DialysisSolution) TableName() string {
347
 func (DialysisSolution) TableName() string {

+ 73 - 31
service/mobile_dialysis_service.go View File

852
 		}
852
 		}
853
 
853
 
854
 	} else if adviceType == 2 && len(deliverWay) <= 0 {
854
 	} else if adviceType == 2 && len(deliverWay) <= 0 {
855
+
855
 		if patientType == 0 {
856
 		if patientType == 0 {
856
 			adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 2 AND record_date = ?"
857
 			adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 2 AND record_date = ?"
857
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
858
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
858
 
859
 
859
 		} else if patientType == 1 {
860
 		} else if patientType == 1 {
860
-			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 AND advice_doctor = ?"
861
-			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, adminUserId)
861
+			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2 AND (advice_doctor = ? or execution_staff = ?)"
862
+			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate, adminUserId, adminUserId)
862
 		} else if patientType == 2 {
863
 		} else if patientType == 2 {
863
 			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2  AND execution_staff = 0"
864
 			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2  AND execution_staff = 0"
864
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
865
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
886
 	return vms, err
887
 	return vms, err
887
 }
888
 }
888
 
889
 
889
-func GetHisDoctorAdvices(orgID int64, scheduleDate int64, deliverWay string) ([]*HisMScheduleDoctorAdviceVM, error) {
890
+func GetHisDoctorAdvices(orgID int64, scheduleDate int64, deliverWay string, patientType int, adminUserId int64) ([]*HisMScheduleDoctorAdviceVM, error) {
890
 
891
 
891
 	var vms []*HisMScheduleDoctorAdviceVM
892
 	var vms []*HisMScheduleDoctorAdviceVM
892
 	if len(deliverWay) > 0 {
893
 	if len(deliverWay) > 0 {
893
-		db := readDb.
894
-			Table("xt_schedule").
895
-			Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
896
-			Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
897
-				return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
898
-			}).
899
-			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
900
-			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
901
-			Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
902
-			Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ?", orgID, scheduleDate, deliverWay).
903
-			Where("status = 1 AND user_org_id = ?", orgID)
904
-		if scheduleDate != 0 {
905
-			db = db.Where("schedule_date = ?", scheduleDate)
894
+		if patientType == 0 {
895
+			db := readDb.
896
+				Table("xt_schedule").
897
+				Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
898
+				Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
899
+					return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
900
+				}).
901
+				Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
902
+				Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
903
+				Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
904
+				Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ?", orgID, scheduleDate, deliverWay).
905
+				Where("status = 1 AND user_org_id = ?", orgID)
906
+			if scheduleDate != 0 {
907
+				db = db.Where("schedule_date = ?", scheduleDate)
908
+			}
909
+			err = db.Find(&vms).Error
906
 		}
910
 		}
907
-		err = db.Find(&vms).Error
911
+		if patientType > 0 {
912
+			db := readDb.
913
+				Table("xt_schedule").
914
+				Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
915
+				Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
916
+					return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
917
+				}).
918
+				Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
919
+				Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
920
+				Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
921
+				Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and delivery_way = ? and  (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, deliverWay, adminUserId, adminUserId).
922
+				Where("status = 1 AND user_org_id = ?", orgID)
923
+			if scheduleDate != 0 {
924
+				db = db.Where("schedule_date = ?", scheduleDate)
925
+			}
926
+			err = db.Find(&vms).Error
927
+		}
928
+
908
 	} else {
929
 	} else {
909
-		db := readDb.
910
-			Table("xt_schedule").
911
-			Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
912
-			Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
913
-				return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
914
-			}).
915
-			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
916
-			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
917
-			Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
918
-			Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ?", orgID, scheduleDate).
919
-			Where("status = 1 AND user_org_id = ?", orgID)
920
-		if scheduleDate != 0 {
921
-			db = db.Where("schedule_date = ?", scheduleDate)
930
+		if patientType == 0 {
931
+			db := readDb.
932
+				Table("xt_schedule").
933
+				Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
934
+				Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
935
+					return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
936
+				}).
937
+				Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
938
+				Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
939
+				Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
940
+				Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? ", orgID, scheduleDate).
941
+				Where("status = 1 AND user_org_id = ?", orgID)
942
+			if scheduleDate != 0 {
943
+				db = db.Where("schedule_date = ?", scheduleDate)
944
+			}
945
+			err = db.Find(&vms).Error
922
 		}
946
 		}
923
-		err = db.Find(&vms).Error
947
+		fmt.Println("patin34te2222222222222222222", patientType)
948
+		if patientType > 0 {
949
+			db := readDb.
950
+				Table("xt_schedule").
951
+				Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
952
+				Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
953
+					return db.Where("status = 1 AND user_org_id = ?", orgID).Preload("DeviceNumber", "status = 1 AND org_id= ?", orgID)
954
+				}).
955
+				Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
956
+				Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
957
+				Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
958
+				Preload("HisDoctorAdviceInfo", "status = 1 AND user_org_id = ? AND advice_date = ? and  (advice_doctor = ? or execution_staff = ?) ", orgID, scheduleDate, adminUserId, adminUserId).
959
+				Where("status = 1 AND user_org_id = ?", orgID)
960
+			if scheduleDate != 0 {
961
+				db = db.Where("schedule_date = ?", scheduleDate)
962
+			}
963
+			err = db.Find(&vms).Error
964
+		}
965
+
924
 	}
966
 	}
925
 
967
 
926
 	return vms, err
968
 	return vms, err

+ 1 - 1
service/patient_service.go View File

1491
 
1491
 
1492
 func UpdatePatientDialysisSolutionOne(patientid int64, orgid int64, prescription *models.DialysisPrescription, timenow int64) error {
1492
 func UpdatePatientDialysisSolutionOne(patientid int64, orgid int64, prescription *models.DialysisPrescription, timenow int64) error {
1493
 
1493
 
1494
-	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature, "dialysis_dialyszers": prescription.DialysisDialyszers, "dialysis_irrigation": prescription.DialysisIrrigation, "plasma_separator": prescription.PlasmaSeparator}).Error
1494
+	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature, "dialysis_dialyszers": prescription.DialysisDialyszers, "dialysis_irrigation": prescription.DialysisIrrigation, "plasma_separator": prescription.PlasmaSeparator, "bilirubin_adsorption_column": prescription.BilirubinAdsorptionColumn}).Error
1495
 	return err
1495
 	return err
1496
 }
1496
 }
1497
 
1497
 

+ 2 - 2
service/patientmanage_service.go View File

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