Browse Source

Merge branch 'master' of http://git.shengws.com/csx/XT_New

csx 4 years ago
parent
commit
2460a3f992

+ 278 - 6
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

@@ -187,13 +187,20 @@ func (this *NewDialysisApiController) SavePatient() {
187 187
 		ids = append(ids, id)
188 188
 	}
189 189
 	fmt.Print("传染病2", contagions)
190
+	is_infectious := int64(dataBody["is_infectious"].(float64))
191
+	fmt.Print("传染病", is_infectious)
190 192
 	adminssionNumber := dataBody["admissionNumber"].(string)
191 193
 	fmt.Print("住院号", adminssionNumber)
194
+
192 195
 	fistdate := dataBody["fistDate"].(string)
193 196
 	fmt.Print("首次透析日期", fistdate)
194
-	times, err := utils.ParseTimeStringToTime(timeLayout, fistdate+"00:00:00")
197
+	timeLayouts := "2006-01-02"
198
+	loc, _ := time.LoadLocation("Local")
199
+	times, err := time.ParseInLocation(timeLayouts+" 15:04:05", fistdate+" 00:00:00", loc)
200
+	//times, err := utils.ParseTimeStringToTime(timeLayout, fistdate+"00:00:00")
195 201
 	fisttime := times.Unix()
196 202
 	fmt.Print(fisttime)
203
+
197 204
 	diagonse := dataBody["diagnose"].(string)
198 205
 	fmt.Print("诊断", diagonse)
199 206
 	avatar := dataBody["avatar"].(string)
@@ -225,9 +232,10 @@ func (this *NewDialysisApiController) SavePatient() {
225 232
 	//会员
226 233
 	memberFistDate := dataBody["memberFistDate"].(string)
227 234
 	fmt.Print("首次透析日期", memberFistDate)
228
-	membertimes, err := utils.ParseTimeStringToTime(timeLayout, memberFistDate+"00:00:00")
235
+	//membertimes, err := utils.ParseTimeStringToTime(timeLayout, memberFistDate+"00:00:00")
236
+	membertimes, _ := time.ParseInLocation(timeLayouts+" 15:04:05", memberFistDate+" 00:00:00", loc)
229 237
 	memtime := membertimes.Unix()
230
-	fmt.Print(memtime)
238
+	fmt.Print("会员透析日期", memtime)
231 239
 	patient_type := int64(dataBody["patientType"].(float64))
232 240
 	fmt.Print("病种", patient_type)
233 241
 	treatmentmethod := int64(dataBody["treatmentMethod"].(float64))
@@ -254,6 +262,7 @@ func (this *NewDialysisApiController) SavePatient() {
254 262
 				CreatedTime:       time.Now().Unix(),
255 263
 				Avatar:            avatar,
256 264
 				IdCardNo:          idCard,
265
+				IsInfectious:      is_infectious,
257 266
 			}
258 267
 			err := service.CreateOldPatient(&patients)
259 268
 			fmt.Print("报错", err)
@@ -282,6 +291,8 @@ func (this *NewDialysisApiController) SavePatient() {
282 291
 				BloodPatients:     bloodPatient,
283 292
 				SlowPatients:      slowpatient,
284 293
 				BloodId:           patient.ID,
294
+				IsInfectious:      is_infectious,
295
+				IdCardNo:          idCard,
285 296
 			}
286 297
 			err = service.CreateNewPatient(&patientsNew)
287 298
 			fmt.Print("报错", err)
@@ -300,7 +311,7 @@ func (this *NewDialysisApiController) SavePatient() {
300 311
 		}
301 312
 	}
302 313
 
303
-	fmt.Print("slowpatient----------------", slowpatient)
314
+	fmt.Print("slowpatient", slowpatient)
304 315
 	//如果是慢病病人
305 316
 	if slowpatient == 1 {
306 317
 		_, errcodetwo := service.GetSlowPatientData(phone, orgid)
@@ -349,6 +360,9 @@ func (this *NewDialysisApiController) SavePatient() {
349 360
 					BloodPatients:     bloodPatient,
350 361
 					SlowPatients:      slowpatient,
351 362
 					SlowId:            slowPatient.ID,
363
+					IsInfectious:      is_infectious,
364
+					IdCardNo:          idCard,
365
+					EquitmentId:       requipmentId,
352 366
 				}
353 367
 				err = service.CreateNewPatient(&patientsNew)
354 368
 				if err != nil {
@@ -404,6 +418,11 @@ func (this *NewDialysisApiController) SavePatient() {
404 418
 								BloodPatients:     bloodPatient,
405 419
 								SlowPatients:      slowpatient,
406 420
 								MemberId:          memberPatient.ID,
421
+								IsInfectious:      is_infectious,
422
+								IdCardNo:          idCard,
423
+								MemberFistdate:    memtime,
424
+								MemberPatienttype: patient_type,
425
+								MemberTreatement:  treatmentmethod,
407 426
 							}
408 427
 							err = service.CreateNewPatient(&patientsNew)
409 428
 							fmt.Print("报错-----------------------", err)
@@ -485,6 +504,11 @@ func (this *NewDialysisApiController) SavePatient() {
485 504
 					BloodPatients:     bloodPatient,
486 505
 					SlowPatients:      slowpatient,
487 506
 					MemberId:          memberPatient.ID,
507
+					IsInfectious:      is_infectious,
508
+					IdCardNo:          idCard,
509
+					MemberFistdate:    memtime,
510
+					MemberPatienttype: patient_type,
511
+					MemberTreatement:  treatmentmethod,
488 512
 				}
489 513
 				err = service.CreateNewPatient(&patientsNew)
490 514
 				fmt.Print("报错-----------------------", err)
@@ -517,14 +541,20 @@ func (this *NewDialysisApiController) GetPatientDetail() {
517 541
 	detail, err := service.GetPatientDetailTwo(id)
518 542
 	//获取传染病详情
519 543
 	diseases := service.GetPatientDiseasesTwo(detail.BloodId)
544
+	//获取慢病传染病
545
+	slowDiseases, err := service.GetSlowPatientDiseases(detail.SlowId)
546
+	//获取慢病慢性病
547
+	cronicDiseases, err := service.GetCronicDiseases(detail.SlowId)
520 548
 	//获取血透医嘱管理
521 549
 	if err != nil {
522 550
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
523 551
 		return
524 552
 	}
525 553
 	this.ServeSuccessJSON(map[string]interface{}{
526
-		"patientDetail": detail,
527
-		"diseases":      diseases,
554
+		"patientDetail":  detail,
555
+		"diseases":       diseases,
556
+		"slowDiseases":   slowDiseases,
557
+		"cronicDiseases": cronicDiseases,
528 558
 	})
529 559
 }
530 560
 
@@ -534,6 +564,7 @@ func (this *NewDialysisApiController) GetDoctorAdvices() {
534 564
 	adminInfo := this.GetMobileAdminUserInfo()
535 565
 	orgid := adminInfo.Org.Id
536 566
 	id, _ := this.GetInt64("id")
567
+	appid := adminInfo.App.Id
537 568
 	fmt.Print("id", id)
538 569
 	//跟据新表id获取老表id
539 570
 	newPatientInfo, _ := service.GetPatientDetailTwo(id)
@@ -557,9 +588,11 @@ func (this *NewDialysisApiController) GetDoctorAdvices() {
557 588
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
558 589
 		return
559 590
 	}
591
+	doctor, err := service.GetAllDoctorTwo(orgid, appid)
560 592
 	this.ServeSuccessJSON(map[string]interface{}{
561 593
 		"advice": advice,
562 594
 		"total":  total,
595
+		"doctor": doctor,
563 596
 	})
564 597
 }
565 598
 
@@ -864,3 +897,242 @@ func (this *NewDialysisApiController) GetEducation() {
864 897
 		"total":     total,
865 898
 	})
866 899
 }
900
+
901
+func (this *NewDialysisApiController) GetSchedulingDetail() {
902
+	id, _ := this.GetInt64("id")
903
+	detail, err := service.GetSchedulingDetail(id)
904
+	patient, err := service.GetSchedulingTwo(id)
905
+	fmt.Print("errr", err)
906
+	if err != nil {
907
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
908
+		return
909
+	}
910
+	this.ServeSuccessJSON(map[string]interface{}{
911
+		"schedulingDetail": detail,
912
+		"patient":          patient,
913
+	})
914
+}
915
+
916
+func (this *NewDialysisApiController) DeleteScheduling() {
917
+	id, _ := this.GetInt64("id")
918
+	fmt.Print("id", id)
919
+	err := service.DeleteScheduling(id)
920
+	fmt.Println("错误是什么", err)
921
+	returnData := make(map[string]interface{}, 0)
922
+	returnData["msg"] = "ok"
923
+	this.ServeSuccessJSON(returnData)
924
+	return
925
+}
926
+
927
+func (this *NewDialysisApiController) GetEducationDetail() {
928
+	id, _ := this.GetInt64("id")
929
+	fmt.Print("id----------", id)
930
+	education, err := service.GetEducationDetailOne(id)
931
+	if err != nil {
932
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
933
+		return
934
+	}
935
+	this.ServeSuccessJSON(map[string]interface{}{
936
+		"education": education,
937
+	})
938
+}
939
+
940
+func (this *NewDialysisApiController) DeleteEducation() {
941
+	id, _ := this.GetInt64("id")
942
+	fmt.Print("id", id)
943
+	err := service.DeleteEducation(id)
944
+	fmt.Println("错误是什么", err)
945
+	returnData := make(map[string]interface{}, 0)
946
+	returnData["msg"] = "ok"
947
+	this.ServeSuccessJSON(returnData)
948
+	return
949
+}
950
+
951
+func (this *NewDialysisApiController) GetRescueRecordDetail() {
952
+	id, _ := this.GetInt64("id")
953
+	fmt.Print("id========", id)
954
+	recordDetail, err := service.GetRescueRecordDetail(id)
955
+	if err != nil {
956
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
957
+		return
958
+	}
959
+	this.ServeSuccessJSON(map[string]interface{}{
960
+		"recordDetail": recordDetail,
961
+	})
962
+}
963
+
964
+func (this *NewDialysisApiController) DeleteRescueRecord() {
965
+	id, _ := this.GetInt64("id")
966
+	err := service.DeleteRescueRecord(id)
967
+	fmt.Println("错误是什么", err)
968
+	returnData := make(map[string]interface{}, 0)
969
+	returnData["msg"] = "ok"
970
+	this.ServeSuccessJSON(returnData)
971
+	return
972
+}
973
+
974
+func (this *NewDialysisApiController) ToSearchePatient() {
975
+	keyword := this.GetString("keyword")
976
+	fmt.Print("关键字", keyword)
977
+	adminUserinfo := this.GetMobileAdminUserInfo()
978
+	orgid := adminUserinfo.Org.Id
979
+	patient, err := service.ToSearchePatient(keyword, orgid)
980
+	if err != nil {
981
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
982
+		return
983
+	}
984
+	this.ServeSuccessJSON(map[string]interface{}{
985
+		"patient": patient,
986
+	})
987
+}
988
+
989
+func (this *NewDialysisApiController) SearchallPatient() {
990
+	keyword := this.GetString("keyword")
991
+	fmt.Print("关键字", keyword)
992
+	adminUser := this.GetMobileAdminUserInfo()
993
+	orgid := adminUser.Org.Id
994
+	patient, err := service.SearchallPatient(keyword, orgid)
995
+	if err != nil {
996
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
997
+		return
998
+	}
999
+	this.ServeSuccessJSON(map[string]interface{}{
1000
+		"patient": patient,
1001
+	})
1002
+}
1003
+
1004
+func (this *NewDialysisApiController) GetSearchallBlood() {
1005
+	keyword := this.GetString("keyword")
1006
+	fmt.Print("关键字", keyword)
1007
+	adminUser := this.GetMobileAdminUserInfo()
1008
+	orgid := adminUser.Org.Id
1009
+	bloodPatient, err := service.GetSearchallBlood(keyword, orgid)
1010
+	if err != nil {
1011
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1012
+		return
1013
+	}
1014
+	this.ServeSuccessJSON(map[string]interface{}{
1015
+		"bloodPatient": bloodPatient,
1016
+	})
1017
+}
1018
+
1019
+func (this *NewDialysisApiController) GetSlowSearchePatient() {
1020
+	keyword := this.GetString("keyword")
1021
+	fmt.Print("关键字", keyword)
1022
+	adminUser := this.GetMobileAdminUserInfo()
1023
+	orgid := adminUser.Org.Id
1024
+	slowPatient, err := service.GetSlowSearchePatient(keyword, orgid)
1025
+	if err != nil {
1026
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1027
+		return
1028
+	}
1029
+	this.ServeSuccessJSON(map[string]interface{}{
1030
+		"slowPatient": slowPatient,
1031
+	})
1032
+}
1033
+
1034
+func (this *NewDialysisApiController) GetMemberSearchPatent() {
1035
+	keyword := this.GetString("keyword")
1036
+	fmt.Print("关键字", keyword)
1037
+	adminUser := this.GetMobileAdminUserInfo()
1038
+	orgid := adminUser.Org.Id
1039
+	memberPatient, err := service.GetMemberSearchPatient(keyword, orgid)
1040
+	if err != nil {
1041
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1042
+		return
1043
+	}
1044
+	this.ServeSuccessJSON(map[string]interface{}{
1045
+		"memberPatient": memberPatient,
1046
+	})
1047
+}
1048
+
1049
+func (this *NewDialysisApiController) GetLongDialysisDetail() {
1050
+	id, err := this.GetInt64("id")
1051
+	longDialysisDetail, err := service.GetLongDialysisDetail(id)
1052
+	patient, err := service.GetPatientName(longDialysisDetail.PatientId)
1053
+	if err != nil {
1054
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1055
+		return
1056
+	}
1057
+	this.ServeSuccessJSON(map[string]interface{}{
1058
+		"longDialysisDetail": longDialysisDetail,
1059
+		"patient":            patient,
1060
+	})
1061
+}
1062
+
1063
+func (this *NewDialysisApiController) DeleteLongDialysis() {
1064
+	id, _ := this.GetInt64("id")
1065
+	fmt.Print("id", id)
1066
+	err := service.DeleteLongDialysis(id)
1067
+	fmt.Println("错误是什么", err)
1068
+	returnData := make(map[string]interface{}, 0)
1069
+	returnData["msg"] = "ok"
1070
+	this.ServeSuccessJSON(returnData)
1071
+	return
1072
+}
1073
+
1074
+func (this *NewDialysisApiController) GetDialysisrecord() {
1075
+	timeLayout := "2006-01-02"
1076
+	loc, _ := time.LoadLocation("Local")
1077
+	id, _ := this.GetInt64("id")
1078
+	fmt.Print("id", id)
1079
+	patient, _ := service.GetPatientDetailTwo(id)
1080
+	start := this.GetString("startime")
1081
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start+" 00:00:00", loc)
1082
+	startime := startTimes.Unix()
1083
+	fmt.Print("startime", startime)
1084
+	end := this.GetString("endtime")
1085
+	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
1086
+	endtime := endTimes.Unix()
1087
+	fmt.Print("endtime", endtime)
1088
+	limit, _ := this.GetInt64("limit")
1089
+	fmt.Print("limit", limit)
1090
+	page, _ := this.GetInt64("page")
1091
+	fmt.Print("page", page)
1092
+	adminInfo := this.GetMobileAdminUserInfo()
1093
+	orgid := adminInfo.Org.Id
1094
+	appid := adminInfo.App.Id
1095
+	dislystype, _ := this.GetInt64("dislysType")
1096
+	fmt.Print("透析模式", dislystype)
1097
+	dialysisrecord, total, err := service.GetDialysisrecord(patient.BloodId, startime, endtime, limit, page, orgid, dislystype)
1098
+	doctor, err := service.GetAllDoctorTwo(orgid, appid)
1099
+	if err != nil {
1100
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1101
+		return
1102
+	}
1103
+	this.ServeSuccessJSON(map[string]interface{}{
1104
+		"dialysisrecord": dialysisrecord,
1105
+		"total":          total,
1106
+		"doctor":         doctor,
1107
+	})
1108
+}
1109
+
1110
+func (this *NewDialysisApiController) GetDoctorAdviceDetail() {
1111
+	adminUser := this.GetMobileAdminUserInfo()
1112
+	orgid := adminUser.Org.Id
1113
+	appid := adminUser.App.Id
1114
+	id, _ := this.GetInt64("id")
1115
+	doctorAdvicedetail, err := service.GetDoctorAdviceDetail(id, orgid)
1116
+	doctor, err := service.GetAllDoctorTwo(orgid, appid)
1117
+	if err != nil {
1118
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1119
+		return
1120
+	}
1121
+	this.ServeSuccessJSON(map[string]interface{}{
1122
+		"doctorAdvicedetail": doctorAdvicedetail,
1123
+		"doctor":             doctor,
1124
+	})
1125
+}
1126
+
1127
+func (this *NewDialysisApiController) DeleteManagement() {
1128
+	groupno, _ := this.GetInt64("id")
1129
+	fmt.Print("id是什么", groupno)
1130
+	orgId := this.GetMobileAdminUserInfo().Org.Id
1131
+	fmt.Print("机构ID", orgId)
1132
+	err := service.DeleteManagement(groupno, orgId)
1133
+	fmt.Println("错误是什么", err)
1134
+	returnData := make(map[string]interface{}, 0)
1135
+	returnData["msg"] = "ok"
1136
+	this.ServeSuccessJSON(returnData)
1137
+	return
1138
+}

+ 17 - 3
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go View File

@@ -1,8 +1,6 @@
1 1
 package new_mobile_api_controllers
2 2
 
3
-import (
4
-	"github.com/astaxie/beego"
5
-)
3
+import "github.com/astaxie/beego"
6 4
 
7 5
 // 平板端路由,以 /m/api 为前缀
8 6
 func NewMobileAPIControllersRegisterRouters() {
@@ -56,5 +54,21 @@ func NewMobileAPIControllersRegisterRouters() {
56 54
 	beego.Router("/m/api/patient/getrescuerecord", &NewDialysisApiController{}, "Get:GetRescuerecord")
57 55
 	beego.Router("/m/api/patient/getscheduling", &NewDialysisApiController{}, "Get:GetScheduling")
58 56
 	beego.Router("/m/api/patient/geteducation", &NewDialysisApiController{}, "Get:GetEducation")
57
+	beego.Router("/m/api/patient/getschedulingdetail", &NewDialysisApiController{}, "Get:GetSchedulingDetail")
58
+	beego.Router("/m/api/patient/deletescheduling", &NewDialysisApiController{}, "Delete:DeleteScheduling")
59
+	beego.Router("/m/api/patient/geteducationdetail", &NewDialysisApiController{}, "Get:GetEducationDetail")
60
+	beego.Router("/m/api/patient/deleteeductionone", &NewDialysisApiController{}, "Delete:DeleteEducation")
61
+	beego.Router("/m/api/patient/getrescuerecorddetail", &NewDialysisApiController{}, "GET:GetRescueRecordDetail")
62
+	beego.Router("/m/api/patient/deleterescuerecord", &NewDialysisApiController{}, "Delete:DeleteRescueRecord")
63
+	beego.Router("/m/api/patient/tosearchepatient", &NewDialysisApiController{}, "Get:ToSearchePatient")
64
+	beego.Router("/m/api/patient/searchallpatient", &NewDialysisApiController{}, "Get:SearchallPatient")
65
+	beego.Router("/m/api/patient/searchallblood", &NewDialysisApiController{}, "Get:GetSearchallBlood")
66
+	beego.Router("/m/api/patient/getslowsearchepatient", &NewDialysisApiController{}, "Get:GetSlowSearchePatient")
67
+	beego.Router("/m/api/patient/getmembersearchpatient", &NewDialysisApiController{}, "Get:GetMemberSearchPatent")
68
+	beego.Router("/m/api/patient/getlongdialysisdetail", &NewDialysisApiController{}, "Get:GetLongDialysisDetail")
69
+	beego.Router("/m/api/patient/deletelongdialysis", &NewDialysisApiController{}, "Delete:DeleteLongDialysis")
70
+	beego.Router("/m/api/patient/getdialysisrecord", &NewDialysisApiController{}, "Get:GetDialysisrecord")
71
+	beego.Router("/m/api/patient/getdoctoradvicedetail", &NewDialysisApiController{}, "Get:GetDoctorAdviceDetail")
72
+	beego.Router("/m/api/patient/deletemanagement", &NewDialysisApiController{}, "Delete:DeleteManagement")
59 73
 
60 74
 }

+ 1 - 0
models/dialysis.go View File

@@ -336,6 +336,7 @@ type DoctorAdvices struct {
336 336
 	ChildDoctorAdvice     []*DoctorAdvice `gorm:"ForeignKey:ParentId;AssociationForeignKey:ID" json:"child"`
337 337
 	TemplateId            string          `gorm:"column:template_id" json:"template_id"`
338 338
 	UserName              string          `gorm:"column:user_name" json:"user_name" form:"user_name"`
339
+	Name                  string          `gorm:"column:name" json:"name" form:"name"`
339 340
 }
340 341
 
341 342
 type DoctorAdvice struct {

+ 34 - 0
models/patient_models.go View File

@@ -479,6 +479,10 @@ type XtPatientsNew struct {
479 479
 	BloodId                      int64   `gorm:"column:blood_id" json:"blood_id" form:"blood_id"`
480 480
 	SlowId                       int64   `gorm:"column:slow_id" json:"slow_id" form:"slow_id"`
481 481
 	MemberId                     int64   `gorm:"column:member_id" json:"member_id" form:"member_id"`
482
+	MemberFistdate               int64   `gorm:"column:member_fistdate" json:"member_fistdate" form:"member_fistdate"`
483
+	MemberPatienttype            int64   `gorm:"column:member_patienttype" json:"member_patienttype" form:"member_patienttype"`
484
+	MemberTreatement             int64   `gorm:"column:member_treatement" json:"member_treatement" form:"member_treatement"`
485
+	EquitmentId                  string  `gorm:"column:equitment_id" json:"equitment_id" form:"equitment_id"`
482 486
 }
483 487
 
484 488
 func (XtPatientsNew) TableName() string {
@@ -535,6 +539,36 @@ func (CdmPatients) TableName() string {
535 539
 	return "xt_patients"
536 540
 }
537 541
 
542
+type CdmPatientsInfectiousDiseases struct {
543
+	ID          int64 `gorm:"column:id" json:"id" form:"id"`
544
+	PatientId   int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
545
+	DiseaseId   int64 `gorm:"column:disease_id" json:"disease_id" form:"disease_id"`
546
+	Status      int64 `gorm:"column:status" json:"status" form:"status"`
547
+	CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
548
+	UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
549
+	UserOrgId   int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
550
+}
551
+
552
+func (CdmPatientsInfectiousDiseases) TableName() string {
553
+
554
+	return "xt_patients_infectious_diseases"
555
+}
556
+
557
+type CdmPatientsChronicDiseases struct {
558
+	ID          int64 `gorm:"column:id" json:"id" form:"id"`
559
+	PatientId   int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
560
+	DiseaseId   int64 `gorm:"column:disease_id" json:"disease_id" form:"disease_id"`
561
+	Status      int64 `gorm:"column:status" json:"status" form:"status"`
562
+	CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
563
+	UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
564
+	UserOrgId   int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
565
+}
566
+
567
+func (CdmPatientsChronicDiseases) TableName() string {
568
+
569
+	return "xt_patients_chronic_diseases"
570
+}
571
+
538 572
 type SgjUserCustomer struct {
539 573
 	ID              int64  `gorm:"column:id" json:"id" form:"id"`
540 574
 	UserOrgId       int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 45 - 1
models/user_models.go View File

@@ -335,7 +335,7 @@ type XtDialysisSolution struct {
335 335
 
336 336
 func (XtDialysisSolution) TableName() string {
337 337
 
338
-	return "xt_dialysis_prescription"
338
+	return "xt_dialysis_solution"
339 339
 }
340 340
 
341 341
 type XtPatientRescueRecords struct {
@@ -349,6 +349,7 @@ type XtPatientRescueRecords struct {
349 349
 	Ctime      int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
350 350
 	Mtime      int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
351 351
 	UserName   string `gorm:"column:user_name" json:"user_name" form:"user_name"`
352
+	Name       string `gorm:"column:name" json:"name" form:"name"`
352 353
 }
353 354
 
354 355
 type XtPatientRescueRecord struct {
@@ -368,6 +369,23 @@ func (XtPatientRescueRecord) TableName() string {
368 369
 	return "xt_patient_rescue_record"
369 370
 }
370 371
 
372
+type XtScheduless struct {
373
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
374
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
375
+	PartitionId  int64  `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
376
+	BedId        int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
377
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
378
+	ScheduleDate int64  `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
379
+	ScheduleType int64  `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
380
+	ScheduleWeek int64  `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
381
+	ModeId       int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
382
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
383
+	CreatedTime  int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
384
+	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
385
+	Number       string `gorm:"column:number" json:"number"`
386
+	Name         string `gorm:"column:name" json:"name"`
387
+}
388
+
371 389
 type XtSchedules struct {
372 390
 	ID           int64  `gorm:"column:id" json:"id" form:"id"`
373 391
 	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -390,6 +408,32 @@ func (XtSchedules) TableName() string {
390 408
 	return "xt_schedule"
391 409
 }
392 410
 
411
+type XtTreatmentSummarys struct {
412
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
413
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
414
+	PatientId         int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
415
+	AssessmentDate    int64  `gorm:"column:assessment_date" json:"assessment_date" form:"assessment_date"`
416
+	DialysisOrderId   int64  `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
417
+	Mission           string `gorm:"column:mission" json:"mission" form:"mission"`
418
+	DialysisSummary   string `gorm:"column:dialysis_summary" json:"dialysis_summary" form:"dialysis_summary"`
419
+	Change            int64  `gorm:"column:change" json:"change" form:"change"`
420
+	SjNurse           int64  `gorm:"column:sj_nurse" json:"sj_nurse" form:"sj_nurse"`
421
+	ZlNurse           int64  `gorm:"column:zl_nurse" json:"zl_nurse" form:"zl_nurse"`
422
+	HdNurse           int64  `gorm:"column:hd_nurse" json:"hd_nurse" form:"hd_nurse"`
423
+	XjNurse           int64  `gorm:"column:xj_nurse" json:"xj_nurse" form:"xj_nurse"`
424
+	ZlDoctor          int64  `gorm:"column:zl_doctor" json:"zl_doctor" form:"zl_doctor"`
425
+	ChannelImage      string `gorm:"column:channel_image" json:"channel_image" form:"channel_image"`
426
+	Puncture          string `gorm:"column:puncture" json:"puncture" form:"puncture"`
427
+	PunctureNeedle    string `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
428
+	PunctureDirection string `gorm:"column:puncture_direction" json:"puncture_direction" form:"puncture_direction"`
429
+	Status            int64  `gorm:"column:status" json:"status" form:"status"`
430
+	CreatedTime       int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
431
+	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
432
+	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
433
+	Modifier          int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
434
+	Name              string `gorm:"column:name" json:"name"`
435
+}
436
+
393 437
 type XtTreatmentSummary struct {
394 438
 	ID                int64  `gorm:"column:id" json:"id" form:"id"`
395 439
 	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 225 - 15
service/patientmanage_service.go View File

@@ -249,6 +249,37 @@ func GetPatientDiseasesTwo(id int64) []int64 {
249 249
 	return ids
250 250
 }
251 251
 
252
+func GetSlowPatientDiseases(id int64) (infeciousdisease []*models.CdmPatientsInfectiousDiseases, err error) {
253
+	//var dis  []models.CdmPatientsInfectiousDiseases
254
+	//diseases := models.CdmPatientsChronicDiseases{}
255
+	//ids := make([]int64, 0)
256
+	//err := PatientReadDB().Model(&diseases).Where("patient_id = ? and status =1", id).Find(&ids).Error
257
+	//if err != nil || len(dis) == 0 {
258
+	//  return ids
259
+	//}
260
+	//for _, item := range dis {
261
+	//  ids = append(ids, item.DiseaseId)
262
+	//}
263
+	//return ids
264
+	err = PatientReadDB().Model(&infeciousdisease).Where("patient_id = ? and status =1", id).Find(&infeciousdisease).Error
265
+	return infeciousdisease, err
266
+}
267
+
268
+func GetCronicDiseases(id int64) (chronic []*models.CdmPatientsChronicDiseases, err error) {
269
+	//var dis  []models.CdmPatientsChronicDiseases
270
+	//ids := make([]int64, 0)
271
+	//err := PatientReadDB().Model(&models.CdmPatientsChronicDiseases{}).Where("patient_id = ? and status =1", id).Find(&ids).Error
272
+	//if err != nil || len(dis) == 0 {
273
+	//  return ids
274
+	//}
275
+	//for _, item := range dis {
276
+	//  ids = append(ids, item.DiseaseId)
277
+	//}
278
+	//return ids
279
+	err = PatientReadDB().Model(&chronic).Where("patient_id = ? and status =1", id).Find(&chronic).Error
280
+	return chronic, err
281
+}
282
+
252 283
 func CreatePatientTwo(patient *models.Patients, contagions []int64, diseases []int64) (err error) {
253 284
 
254 285
 	user, _ := GetSgjUserByMobild(patient.Phone)
@@ -424,28 +455,32 @@ func GetLastNewSlowPatient(phone string, orgid int64) (*models.XtPatientsNew, er
424 455
 	return &patientnew, nil
425 456
 }
426 457
 
427
-func GetNewDoctorAdvice(patientid int64, doctype int64, startime int64, endtime int64, limit int64, page int64, orgId int64) (doctoradvice []*models.DoctorAdvices, total int64, err error) {
428
-	db := XTReadDB().Table("xt_doctor_advice as x").Where("x.status = 1")
429
-	if orgId > 0 {
430
-		db = db.Where("x.user_org_id = ?", orgId)
458
+func GetNewDoctorAdvice(patientID int64, advice_type int64, start int64, end int64, limit int64, page int64, orgID int64) (doctoradvice []*models.DoctorAdvices, total int64, err error) {
459
+	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
460
+	table := UserReadDB().Table("sgj_user_admin_role as r")
461
+	fmt.Print("table", table)
462
+	if orgID > 0 {
463
+		db = db.Where("x.user_org_id=?", orgID)
431 464
 	}
432
-
433
-	if patientid > 0 {
434
-		db = db.Where("x.patient_id = ?", patientid)
465
+	if patientID > 0 {
466
+		db = db.Where("x.patient_id = ?", patientID)
435 467
 	}
436
-	if startime != 0 {
437
-		db = db.Where("x.record_date>= ?", startime)
468
+	if advice_type > 0 {
469
+		db = db.Where("x.advice_type = ?", advice_type)
470
+	} else if advice_type == 0 {
471
+		db = db.Where("x.advice_type in (?)", []int{1, 3})
438 472
 	}
439
-	if endtime != 0 {
440
-		db = db.Where("x.record_date<=?", endtime)
473
+	if start != 0 {
474
+		db = db.Where("x.start_time>=?", start)
441 475
 	}
442
-
443
-	if doctype > 0 {
444
-		db = db.Where("x.advice_type = ?", doctype)
476
+	if end != 0 {
477
+		db = db.Where("start_time<=?", end)
445 478
 	}
446 479
 	offset := (page - 1) * limit
447
-	err = db.Count(&total).Order("x.record_date desc").Offset(offset).Limit(limit).Group("x.id").Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,r.user_name").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Scan(&doctoradvice).Error
480
+	err = db.Group("x.id").Count(&total).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Offset(offset).Limit(limit).Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&doctoradvice).Error
481
+	fmt.Print("err", err)
448 482
 	return
483
+
449 484
 }
450 485
 
451 486
 func GetDryWeight(patientid int64, startime int64, endtime int64, limit int64, page int64, orgId int64) (dryWeight []*models.XtPatientDryweight, total int64, err error) {
@@ -603,3 +638,178 @@ func GetEducation(patientid int64, startime int64, endtime int64, limit int64, p
603 638
 		Select("x.id,x.user_org_id,x.patient_id,x.assessment_date,x.dialysis_order_id,x.mission,x.dialysis_summary,x.change,x.sj_nurse,x.zl_nurse,x.hd_nurse,x.xj_nurse,x.zl_doctor,x.channel_image,x.puncture,x.puncture_needle,x.puncture_direction,x.status,x.created_time,x.updated_time,x.creater,x.modifier").Scan(&treatment).Error
604 639
 	return
605 640
 }
641
+
642
+func GetSchedulingDetail(id int64) (models.XtScheduless, error) {
643
+	schedules := models.XtScheduless{}
644
+	db := XTReadDB().Table("xt_schedule as x")
645
+	err := db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,n.number,z.name").Joins("left join xt_device_number as n on n.id = x.bed_id").Joins("left join xt_device_zone as z on z.id = x.partition_id").Where("x.id =?", id).Scan(&schedules).Error
646
+	return schedules, err
647
+}
648
+
649
+func GetSchedulingTwo(id int64) (models.XtScheduless, error) {
650
+	schedules := models.XtScheduless{}
651
+	db := XTReadDB().Table("xt_schedule as x")
652
+	err := db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,z.name").Joins("left join xt_patients as z on z.id = x.patient_id").Where("x.id =?", id).Scan(&schedules).Error
653
+	return schedules, err
654
+}
655
+
656
+func DeleteScheduling(id int64) error {
657
+	err := XTWriteDB().Model(models.XtSchedules{}).Where("id=?", id).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
658
+	return err
659
+}
660
+
661
+func GetEducationDetailOne(id int64) (models.XtTreatmentSummarys, error) {
662
+	summarys := models.XtTreatmentSummarys{}
663
+	db := XTReadDB().Table("xt_treatment_summary as x")
664
+	err := db.Select("x.id,x.user_org_id,x.patient_id,x.assessment_date,x.dialysis_order_id,x.mission,x.dialysis_summary,x.change,x.sj_nurse,x.zl_nurse,x.hd_nurse,x.xj_nurse,x.zl_doctor,x.channel_image,x.puncture,x.puncture_needle,x.puncture_direction,x.status,x.created_time,x.creater,x.modifier,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("x.id = ?", id).Scan(&summarys).Error
665
+	return summarys, err
666
+}
667
+
668
+func DeleteEducation(id int64) error {
669
+	err := XTWriteDB().Model(models.XtTreatmentSummary{}).Where("id=?", id).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
670
+	return err
671
+}
672
+
673
+func GetRescueRecordDetail(id int64) (models.XtPatientRescueRecords, error) {
674
+	records := models.XtPatientRescueRecords{}
675
+	db := XTReadDB().Table("xt_patient_rescue_record as x")
676
+	err := db.Select("x.id,x.org_id,x.patient_id,x.recorder,x.record_time,x.content,x.status,r.user_name,s.name").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.recorder").Joins("left join xt_patients as s on s.id = x.patient_id").Where("x.id=?", id).Scan(&records).Error
677
+	return records, err
678
+}
679
+
680
+func DeleteRescueRecord(id int64) error {
681
+	err := XTWriteDB().Model(models.XtPatientRescueRecord{}).Where("id=?", id).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
682
+	return err
683
+}
684
+
685
+func ToSearchePatient(keyword string, orgId int64) (paitents []*models.XtPatientsNew, err error) {
686
+	likeKey := "%" + keyword + "%"
687
+	err = XTReadDB().Where("name like ? or dialysis_no like ? and user_org_id = ?", likeKey, likeKey, orgId).Find(&paitents).Error
688
+	return paitents, err
689
+}
690
+
691
+func SearchallPatient(keyword string, orgid int64) (patients []*models.XtPatientsNew, err error) {
692
+	likeKey := "%" + keyword + "%"
693
+	err = XTReadDB().Where("name like ? or dialysis_no = ? and user_org_id = ?", likeKey, keyword, orgid).Find(&patients).Error
694
+	return patients, err
695
+}
696
+
697
+func GetSearchallBlood(keyword string, orgid int64) (patients []*models.XtPatientsNew, err error) {
698
+	likeKey := "%" + keyword + "%"
699
+	err = XTReadDB().Where("name like ? or dialysis_no = ? and user_org_id = ? and blood_patients = 1", likeKey, keyword, orgid).Find(&patients).Error
700
+	return patients, err
701
+}
702
+
703
+func GetSlowSearchePatient(keyword string, orgid int64) (patients []*models.XtPatientsNew, err error) {
704
+	likeKey := "%" + keyword + "%"
705
+	err = XTReadDB().Where("name like ? or dialysis_no = ? and user_org_id = ? and slow_patients = 1", likeKey, keyword, orgid).Find(&patients).Error
706
+	return patients, err
707
+}
708
+
709
+func GetMemberSearchPatient(keyword string, orgid int64) (patients []*models.XtPatientsNew, err error) {
710
+	likeKey := "%" + keyword + "%"
711
+	err = XTReadDB().Where("name like ? or dialysis_no = ? and user_org_id = ? and member_patients = 1", likeKey, keyword, orgid).Find(&patients).Error
712
+	return patients, err
713
+}
714
+
715
+func GetLongDialysisDetail(id int64) (models.XtDialysisSolution, error) {
716
+	solution := models.XtDialysisSolution{}
717
+	err := XTReadDB().Model(&solution).Where("id=? and status =1", id).Find(&solution).Error
718
+	return solution, err
719
+}
720
+
721
+func GetPatientName(id int64) (models.Patients, error) {
722
+	patientsNew := models.Patients{}
723
+	err := XTReadDB().Model(&patientsNew).Where("id=? and status = 1", id).Find(&patientsNew).Error
724
+	return patientsNew, err
725
+}
726
+
727
+func DeleteLongDialysis(id int64) error {
728
+	err := XTWriteDB().Model(models.XtDialysisSolution{}).Where("id=?", id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
729
+	return err
730
+}
731
+
732
+func GetDialysisrecord(patientID int64, start int64, end int64, limit int64, page int64, orgID int64, mode_id int64) ([]*models.PatientDialysisRecord, int64, error) {
733
+	offset := (page - 1) * limit
734
+	var total int64
735
+	var err error
736
+	var orders []*models.PatientDialysisRecord
737
+
738
+	db := readDb.Table("xt_dialysis_order as do").
739
+		Preload("DialysisPrescription", "patient_id=? and user_org_id=? and status=1", patientID, orgID).
740
+		Preload("PredialysisEvaluation", "patient_id=? and user_org_id=? and status=1", patientID, orgID).
741
+		Preload("DialysisPrescription", func(db *gorm.DB) *gorm.DB {
742
+			return readDb.Where("patient_id=? and user_org_id=? and status=1", patientID, orgID).Preload("UserAdminRole", func(db *gorm.DB) *gorm.DB {
743
+				return readUserDb.Where("status = 1")
744
+			})
745
+		}).
746
+		Preload("AssessmentAfterDislysis", "patient_id=? and user_org_id=? and status=1", patientID, orgID).
747
+		Preload("TreatmentSummary", "patient_id=? and user_org_id=? and status=1", patientID, orgID).
748
+		Preload("Device", "org_id=? and status=1", orgID).
749
+		Preload("UserAdminRole", func(db *gorm.DB) *gorm.DB {
750
+			return readUserDb.Where("org_id=? and status = 1", orgID)
751
+		}).
752
+		Joins("JOIN xt_schedule as s ON s.patient_id=? and FROM_UNIXTIME(s.schedule_date, '%Y-%m-%d')=FROM_UNIXTIME(do.dialysis_date, '%Y-%m-%d')", patientID).
753
+		Joins("JOIN xt_device_zone as dz ON dz.org_id = ? and dz.id=s.partition_id", orgID).
754
+		Where("do.patient_id=? and do.user_org_id=? and do.stage = 2 and do.status=1", patientID, orgID).Group("s.schedule_date")
755
+
756
+	if start != 0 {
757
+		db = db.Where("do.dialysis_date>=?", start)
758
+	}
759
+	if end != 0 {
760
+		db = db.Where("do.dialysis_date<=?", end)
761
+	}
762
+	if mode_id > 0 {
763
+		db = db.Joins("JOIN xt_dialysis_prescription as dp ON dp.record_id=do.id")
764
+		db = db.Where("dp.mode_id=?", mode_id)
765
+	}
766
+
767
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("do.dialysis_date desc").Select("do.bed_id, do.id, do.dialysis_date, do.user_org_id, do.patient_id, do.prescription_id, do.stage, do.remark, do.status, do.created_time, do.updated_time,do.start_nurse,do.finish_nurse ,s.schedule_type, s.partition_id, dz.name as partition_name").Find(&orders).Error
768
+
769
+	if len(orders) > 0 {
770
+		ids := make([]int64, 0)
771
+		for _, order := range orders {
772
+			dialyzer := order.DialysisPrescription.Dialyzer
773
+			ids = append(ids, dialyzer)
774
+		}
775
+		if len(ids) > 0 {
776
+			var dialyzers []*models.DeviceNumber
777
+			err = readDb.Model(&models.DeviceNumber{}).Where("id IN (?) and org_id=? and status=1", ids, orgID).Find(&dialyzers).Error
778
+			if err != nil {
779
+				return nil, 0, err
780
+			}
781
+
782
+			dialyzerMap := make(map[int64]models.DeviceNumber, 0)
783
+			for _, item := range dialyzers {
784
+				dialyzerMap[item.ID] = *item
785
+			}
786
+			for orderIndex, order := range orders {
787
+				if _, exist := dialyzerMap[order.DialysisPrescription.Dialyzer]; exist {
788
+					orders[orderIndex].DeviceNumber = dialyzerMap[order.DialysisPrescription.Dialyzer].Number
789
+				}
790
+			}
791
+		}
792
+	}
793
+
794
+	return orders, total, err
795
+}
796
+
797
+func GetAllDoctorTwo(orgid int64, appid int64) (appRole []*models.App_Role, err error) {
798
+
799
+	err = UserReadDB().Where("org_id = ? AND app_id = ? AND status = ? ", orgid, appid, 1).Find(&appRole).Error
800
+	return appRole, err
801
+}
802
+
803
+func GetDoctorAdviceDetail(id int64, orgid int64) (advices []*models.DoctorAdvices, err error) {
804
+
805
+	db := XTReadDB().Table("xt_doctor_advice as x")
806
+	err = db.Select("x.id,x.user_org_id,x.patient_id,x.advice_type,x.advice_date,x.start_time,x.advice_name,x.advice_desc,x.reminder_date,x.single_dose,x.single_dose_unit,x.prescribing_number,x.prescribing_number_unit,x.delivery_way,x.execution_frequency,x.advice_doctor,x.status,x.created_time,x.updated_time,x.advice_affirm,x.remark,x.stop_time,x.stop_reason,x.stop_doctor,x.stop_state,x.parent_id,x.execution_time,x.execution_staff,x.execution_state,x.checker,x.record_date,x.dialysis_order_id,x.check_time,x.check_state,x.drug_spec,x.drug_spec_unit,x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.template_id,x.modifier,s.name").Joins("left join xt_patients as s on s.id=x.patient_id").Where("x.groupno = ? and x.status = 1 and x.user_org_id = ?", id, orgid).Scan(&advices).Error
807
+
808
+	return advices, err
809
+}
810
+
811
+func DeleteManagement(groupid int64, orgid int64) error {
812
+
813
+	err := XTWriteDB().Model(models.DoctorAdvice{}).Where("groupno=? and user_org_id = ?", groupid, orgid).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
814
+	return err
815
+}

+ 0 - 1
service/user_service.go View File

@@ -93,7 +93,6 @@ func GetDryWeightByPatientId(patientid int64, orgid int64) (pre []*models.SgjPat
93 93
 func GetAllDoctor(orgid int64, appid int64) (appRole []*models.App_Role, err error) {
94 94
 
95 95
 	err = UserReadDB().Where("org_id = ? AND app_id = ? AND status = ? AND  (user_type = ? OR user_type = ?) ", orgid, appid, 1, 2, 1).Find(&appRole).Error
96
-	fmt.Println("errrrrrrrrrrerrrrrrrrrrrrrrrrrrr", err)
97 96
 	return appRole, err
98 97
 }
99 98