Browse Source

耗材参数

XMLWAN 3 years ago
parent
commit
e9cfaa8325

+ 1 - 1
conf/app.conf View File

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

+ 5 - 12
controllers/data_api_controller.go View File

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

+ 24 - 1
controllers/dialysis_api_controller.go View File

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

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

@@ -1100,6 +1100,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1100 1100
 	single_water := c.GetString("single_water")
1101 1101
 	replacement_flow := c.GetString("replacement_flow")
1102 1102
 	plasma_separator := c.GetString("plasma_separator")
1103
+	bilirubin_adsorption_column := c.GetString("bilirubin_adsorption_column")
1103 1104
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1104 1105
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1105 1106
 	//
@@ -1193,6 +1194,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1193 1194
 		SingleWater:                single_water,
1194 1195
 		ReplacementFlow:            replacement_flow,
1195 1196
 		PlasmaSeparator:            plasma_separator,
1197
+		BilirubinAdsorptionColumn:  bilirubin_adsorption_column,
1196 1198
 	}
1197 1199
 
1198 1200
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -1992,6 +1994,7 @@ func (c *DialysisAPIController) PostSolution() {
1992 1994
 	single_water := c.GetString("single_water")
1993 1995
 	replacement_flow := c.GetString("replacement_flow")
1994 1996
 	plasma_separator := c.GetString("plasma_separator")
1997
+	bilirubin_adsorption_column := c.GetString("bilirubin_adsorption_column")
1995 1998
 	if mode_id > 0 {
1996 1999
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1997 2000
 	}
@@ -2086,6 +2089,7 @@ func (c *DialysisAPIController) PostSolution() {
2086 2089
 		SingleTime:                single_time,
2087 2090
 		ReplacementFlow:           replacement_flow,
2088 2091
 		PlasmaSeparator:           plasma_separator,
2092
+		BilirubinAdsorptionColumn: bilirubin_adsorption_column,
2089 2093
 	}
2090 2094
 
2091 2095
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -2347,7 +2351,10 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
2347 2351
 		}
2348 2352
 	}
2349 2353
 	// record.UltrafiltrationRate = ultrafiltration_rate
2350
-	record.UltrafiltrationVolume = 0
2354
+	if adminInfo.Org.Id != 9538 {
2355
+		record.UltrafiltrationVolume = 0
2356
+	}
2357
+
2351 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 2359
 		if ultrafiltration_rate > 0 {
2353 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,6 +2418,11 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2418 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 2426
 	return
2422 2427
 }
2423 2428
 

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

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

+ 6 - 0
controllers/patient_api_controller.go View File

@@ -857,6 +857,7 @@ func (c *PatientApiController) UpdateDialysisSolution() {
857 857
 		DialysisIrrigation:         solution.DialysisIrrigation,
858 858
 		DialysisDialyszers:         solution.DialysisDialyszers,
859 859
 		PlasmaSeparator:            solution.PlasmaSeparator,
860
+		BilirubinAdsorptionColumn:  solution.BilirubinAdsorptionColumn,
860 861
 	}
861 862
 	service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
862 863
 	if err != nil {
@@ -3416,6 +3417,11 @@ func defaultSolutionFormData(solution *models.DialysisSolution, data []byte, met
3416 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 3425
 	return
3420 3426
 }
3421 3427
 

+ 1 - 0
models/dialysis.go View File

@@ -285,6 +285,7 @@ type PredialysisEvaluation struct {
285 285
 	PreDialysisDrugs               string  `gorm:"column:pre_dialysis_drugs" json:"pre_dialysis_drugs" form:"pre_dialysis_drugs"`
286 286
 	Period                         int64   `gorm:"column:period" json:"period" form:"period"`
287 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 291
 func (PredialysisEvaluation) TableName() string {

+ 1 - 0
models/doctor_advice_models.go View File

@@ -91,6 +91,7 @@ type DoctorAdviceParentTemplate struct {
91 91
 	UpdatedTime          int64                   `gorm:"column:updated_time" json:"updated_time"`
92 92
 	DoctorAdviceTemplate []*DoctorAdviceTemplate `gorm:"ForeignKey:TemplateId;AssociationForeignKey:ID"`
93 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 97
 func (DoctorAdviceParentTemplate) TableName() string {

+ 2 - 0
models/patient_models.go View File

@@ -236,6 +236,7 @@ type DialysisPrescription struct {
236 236
 	SingleWater                string        `gorm:"column:single_water" json:"single_water" form:"single_water"`
237 237
 	ReplacementFlow            string        `gorm:"column:replacement_flow" json:"replacement_flow" form:"replacement_flow"`
238 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 242
 func (DialysisPrescription) TableName() string {
@@ -340,6 +341,7 @@ type DialysisSolution struct {
340 341
 	Illness                    int64   `gorm:"column:illness" json:"illness" form:"illness"`
341 342
 	Amylaceum                  string  `gorm:"column:amylaceum" json:"amylaceum" form:"amylaceum"`
342 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 347
 func (DialysisSolution) TableName() string {

+ 73 - 31
service/mobile_dialysis_service.go View File

@@ -852,13 +852,14 @@ func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType
852 852
 		}
853 853
 
854 854
 	} else if adviceType == 2 && len(deliverWay) <= 0 {
855
+
855 856
 		if patientType == 0 {
856 857
 			adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 2 AND record_date = ?"
857 858
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
858 859
 
859 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 863
 		} else if patientType == 2 {
863 864
 			adviceWhere = "status = 1 AND user_org_id = ? AND record_date = ? AND advice_type = 2  AND execution_staff = 0"
864 865
 			adviceCondition = append(adviceCondition, adviceWhere, orgID, scheduleDate)
@@ -886,41 +887,82 @@ func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType
886 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 892
 	var vms []*HisMScheduleDoctorAdviceVM
892 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 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 968
 	return vms, err

+ 1 - 1
service/patient_service.go View File

@@ -1491,7 +1491,7 @@ func GetDialysisCount(orgid int64, partitionid int64) (order []*models.BloodDial
1491 1491
 
1492 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 1495
 	return err
1496 1496
 }
1497 1497
 

+ 2 - 2
service/patientmanage_service.go View File

@@ -949,14 +949,14 @@ func GetNewPatient(id int64) (models.XtPatientsNew, error) {
949 949
 
950 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 954
 	return err
955 955
 }
956 956
 
957 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 961
 	return err
962 962
 }