See999 5 anos atrás
pai
commit
1915a27be5
35 arquivos alterados com 1008 adições e 537 exclusões
  1. 0 5
      .gitignore
  2. 3 0
      conf/app.conf
  3. 0 1
      controllers/base_api_controller.go
  4. 36 35
      controllers/dialysis_api_controller.go
  5. 11 12
      controllers/gobal_config_api_controller.go
  6. 1 1
      controllers/inspection_api_controller.go
  7. 4 3
      controllers/mobile_api_controllers/admin_user_api_controller.go
  8. 38 35
      controllers/mobile_api_controllers/dialysis_api_controller.go
  9. 20 10
      controllers/mobile_api_controllers/mobile_api_base_controller.go
  10. 253 186
      controllers/mobile_api_controllers/patient_api_controller.go
  11. 22 11
      controllers/new_mobile_api_controllers/home_api_controller.go
  12. 10 4
      controllers/new_mobile_api_controllers/mobile_regist_controller.go
  13. 164 15
      controllers/new_mobile_api_controllers/new_dialysis_api_controller.go
  14. 5 0
      controllers/new_mobile_api_controllers/new_mobile_api_router_register.go
  15. 2 2
      controllers/new_mobile_api_controllers/patient.json
  16. 6 17
      controllers/new_mobile_api_controllers/role.json
  17. 99 94
      controllers/patient_api_controller.go
  18. 63 60
      controllers/public_api_controller.go
  19. 40 5
      controllers/role.json
  20. 27 1
      controllers/verify_login_controller.go
  21. 3 0
      models/device_models.go
  22. 20 16
      models/dialysis.go
  23. 46 0
      models/patient_models.go
  24. 13 0
      models/vm_models.go
  25. 24 15
      service/app_version.go
  26. 1 1
      service/data.go
  27. 1 1
      service/gobal_config_service.go
  28. 7 1
      service/inspection_service.go
  29. 36 0
      service/manage_service.go
  30. 5 0
      service/mobile_dialysis_service.go
  31. 1 0
      service/patient_service.go
  32. 31 6
      service/patientmanage_service.go
  33. 6 0
      service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go
  34. 5 0
      service/role_service.go
  35. 5 0
      service/vm_service.go

+ 0 - 5
.gitignore Ver arquivo

1
-.svn
2
-.git
3
-XT.ext
4
-/*.exe
5
-/*.exe~

+ 3 - 0
conf/app.conf Ver arquivo

122
 
122
 
123
 
123
 
124
 
124
 
125
+
125
 niprocart =  63
126
 niprocart =  63
126
 jms = 58
127
 jms = 58
127
 fistula_needle_set = 65
128
 fistula_needle_set = 65
162
 readuserpass = 1Q2W3e4r!@#$
163
 readuserpass = 1Q2W3e4r!@#$
163
 readusername = sgj_users
164
 readusername = sgj_users
164
 
165
 
166
+
165
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
167
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
166
 writeuserport = 3306
168
 writeuserport = 3306
167
 writeuseruser = root
169
 writeuseruser = root
169
 writeusername = sgj_users
171
 writeusername = sgj_users
170
 
172
 
171
 
173
 
174
+
172
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
175
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
173
 readmiddleport = 3306
176
 readmiddleport = 3306
174
 readmiddleuser = root
177
 readmiddleuser = root

+ 0 - 1
controllers/base_api_controller.go Ver arquivo

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/enums"
4
 	"XT_New/enums"
5
-	//"XT_New/models"
6
 	"XT_New/service"
5
 	"XT_New/service"
7
 	"fmt"
6
 	"fmt"
8
 	"strconv"
7
 	"strconv"

+ 36 - 35
controllers/dialysis_api_controller.go Ver arquivo

1369
 			}
1369
 			}
1370
 		}
1370
 		}
1371
 
1371
 
1372
-		prescription.Creater = adminUserInfo.AdminUser.Id
1372
+		if appRole.UserType == 2 || appRole.UserType == 1 {
1373
+			prescription_doctor := adminUserInfo.AdminUser.Id
1374
+			prescription.PrescriptionDoctor = prescription_doctor
1375
+		}
1376
+		if dialysisPrescription.Creater == 0 { //体重称
1377
+			prescription.Creater = adminUserInfo.AdminUser.Id
1378
+
1379
+		} else {
1380
+			prescription.Creater = dialysisPrescription.Creater
1381
+		}
1382
+
1373
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
1383
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
1374
 		prescription.UpdatedTime = time.Now().Unix()
1384
 		prescription.UpdatedTime = time.Now().Unix()
1375
 		prescription.Modifier = adminUserInfo.AdminUser.Id
1385
 		prescription.Modifier = adminUserInfo.AdminUser.Id
3055
 	assessment.DialysisIntakesUnit = data.DialysisIntakesUnit
3065
 	assessment.DialysisIntakesUnit = data.DialysisIntakesUnit
3056
 	assessment.Dialyzer = data.Dialyzer
3066
 	assessment.Dialyzer = data.Dialyzer
3057
 	assessment.IsEat = data.IsEat
3067
 	assessment.IsEat = data.IsEat
3068
+	assessment.CvcA = data.CvcA
3069
+	assessment.CvcB = data.CvcB
3070
+	assessment.Channel = data.Channel
3071
+
3058
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
3072
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
3059
 
3073
 
3060
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
3074
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
3070
 	}
3084
 	}
3071
 
3085
 
3072
 	if assessment.ID > 0 {
3086
 	if assessment.ID > 0 {
3073
-		//if appRole.UserType == 3 {
3074
-		//	if assessment.Creater != adminUserInfo.AdminUser.Id && assessment.Creater != 0 {
3075
-		//		headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
3076
-		//		if getPermissionErr != nil {
3077
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3078
-		//			return
3079
-		//		} else if headNursePermission == nil {
3080
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
3081
-		//			return
3082
-		//		}
3083
-		//	}
3084
-		//}
3087
+
3085
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3088
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3086
 			assessment.AssessmentDoctor = adminUserInfo.AdminUser.Id
3089
 			assessment.AssessmentDoctor = adminUserInfo.AdminUser.Id
3087
 			assessment.AssessmentTime = time.Now().Unix()
3090
 			assessment.AssessmentTime = time.Now().Unix()
3088
-
3089
-		}
3090
-		if assessment.Creater == 0 {
3091
-			assessment.Modifier = adminUserInfo.AdminUser.Id
3092
-			assessment.Creater = adminUserInfo.AdminUser.Id
3093
-
3094
 		} else {
3091
 		} else {
3095
-			assessment.Modifier = adminUserInfo.AdminUser.Id
3096
-			assessment.Creater = assessment.Creater
3097
-
3092
+			if assessment.Creater == 0 {
3093
+				assessment.Modifier = adminUserInfo.AdminUser.Id
3094
+				assessment.Creater = adminUserInfo.AdminUser.Id
3095
+			} else {
3096
+				assessment.Modifier = adminUserInfo.AdminUser.Id
3097
+			}
3098
 		}
3098
 		}
3099
 
3099
 
3100
 		assessment.UpdatedTime = time.Now().Unix()
3100
 		assessment.UpdatedTime = time.Now().Unix()
3103
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3103
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3104
 			assessment.AssessmentDoctor = adminUserInfo.AdminUser.Id
3104
 			assessment.AssessmentDoctor = adminUserInfo.AdminUser.Id
3105
 			assessment.AssessmentTime = time.Now().Unix()
3105
 			assessment.AssessmentTime = time.Now().Unix()
3106
-
3106
+		} else {
3107
+			assessment.Creater = adminUserInfo.AdminUser.Id
3107
 		}
3108
 		}
3108
-		assessment.Creater = adminUserInfo.AdminUser.Id
3109
 		assessment.CreatedTime = time.Now().Unix()
3109
 		assessment.CreatedTime = time.Now().Unix()
3110
 		assessment.UpdatedTime = time.Now().Unix()
3110
 		assessment.UpdatedTime = time.Now().Unix()
3111
 		assessment.UserOrgId = adminUserInfo.CurrentOrgId
3111
 		assessment.UserOrgId = adminUserInfo.CurrentOrgId
3253
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3253
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3254
 			assessmentBeforeDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
3254
 			assessmentBeforeDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
3255
 			assessmentBeforeDislysis.AssessmentTime = time.Now().Unix()
3255
 			assessmentBeforeDislysis.AssessmentTime = time.Now().Unix()
3256
-		}
3256
+		} else {
3257
+			assessmentBeforeDislysis.Creater = adminUserInfo.AdminUser.Id
3257
 
3258
 
3258
-		assessmentBeforeDislysis.Creater = adminUserInfo.AdminUser.Id
3259
+		}
3259
 
3260
 
3260
 		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
3261
 		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
3261
 		if err == nil {
3262
 		if err == nil {
3284
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3285
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3285
 			assessmentBeforeDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
3286
 			assessmentBeforeDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
3286
 			assessmentBeforeDislysis.AssessmentTime = time.Now().Unix()
3287
 			assessmentBeforeDislysis.AssessmentTime = time.Now().Unix()
3287
-		}
3288
-
3289
-		if evaluation.Creater == 0 {
3290
-			assessmentBeforeDislysis.Modifier = adminUserInfo.AdminUser.Id
3291
-			assessmentBeforeDislysis.Creater = adminUserInfo.AdminUser.Id
3292
 		} else {
3288
 		} else {
3293
-			assessmentBeforeDislysis.Modifier = adminUserInfo.AdminUser.Id
3294
-			assessmentBeforeDislysis.Creater = evaluation.Creater
3289
+			if evaluation.Creater == 0 {
3290
+				assessmentBeforeDislysis.Modifier = adminUserInfo.AdminUser.Id
3291
+				assessmentBeforeDislysis.Creater = adminUserInfo.AdminUser.Id
3292
+			} else {
3293
+				assessmentBeforeDislysis.Modifier = adminUserInfo.AdminUser.Id
3294
+			}
3295
 		}
3295
 		}
3296
 
3296
 
3297
 		assessmentBeforeDislysis.UpdatedTime = time.Now().Unix()
3297
 		assessmentBeforeDislysis.UpdatedTime = time.Now().Unix()
4322
 	//获取医嘱内容
4322
 	//获取医嘱内容
4323
 	doctor, err := service.FindDoctor(doctorAdvice.AdviceDoctor, adminUserInfo.CurrentAppId, adminUserInfo.CurrentOrgId)
4323
 	doctor, err := service.FindDoctor(doctorAdvice.AdviceDoctor, adminUserInfo.CurrentAppId, adminUserInfo.CurrentOrgId)
4324
 	DoctorName, err := service.FindDoctorName(doctorAdvice.AdviceDoctor, adminUserInfo.CurrentAppId, adminUserInfo.CurrentOrgId)
4324
 	DoctorName, err := service.FindDoctorName(doctorAdvice.AdviceDoctor, adminUserInfo.CurrentAppId, adminUserInfo.CurrentOrgId)
4325
-	//fmt.Print("err---------------------------------",err)
4325
+	fmt.Print("err-----------------------------------------------------------------", err)
4326
 	DoctorAdvice, _ := service.FindDoctorAdviceOrderById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4326
 	DoctorAdvice, _ := service.FindDoctorAdviceOrderById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4327
 	doctorAdevieInfo, err := service.FindDoctorAdviceByInfo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4327
 	doctorAdevieInfo, err := service.FindDoctorAdviceByInfo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4328
 	//获取上次的透后体重
4328
 	//获取上次的透后体重
4329
-	assessmentAfterDislysis, _ := service.MobileGetLastTimeAssessmentAfterDislysis(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4329
+	//	assessmentAfterDislysis, _ := service.MobileGetLastTimeAssessmentAfterDislysis(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4330
+	assessmentAfterDislysis, _ := service.MobileGetLast(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4330
 	//获取透析次数
4331
 	//获取透析次数
4331
 	_, total, err := service.GetTotalDialysisCout(adminUserInfo.CurrentOrgId, patientInfo.ID)
4332
 	_, total, err := service.GetTotalDialysisCout(adminUserInfo.CurrentOrgId, patientInfo.ID)
4332
 
4333
 

+ 11 - 12
controllers/gobal_config_api_controller.go Ver arquivo

1072
 					curAppUrlfors = append(curAppUrlfors, "")
1072
 					curAppUrlfors = append(curAppUrlfors, "")
1073
 
1073
 
1074
 				}
1074
 				}
1075
-			}
1076
-		}
1077
-
1078
-		for _, item := range pruviews {
1079
-			if item.Module == 6 {
1080
-				didRegistedForSCRM = true
1081
-			}
1082
-			if item.Module == 4 {
1083
-				didRegistedForCDM = true
1084
-			}
1085
-			if item.Module == 7 {
1086
-				didRegistedForMall = true
1075
+				for _, item := range pruviews {
1076
+					if item.Module == 6 {
1077
+						didRegistedForSCRM = true
1078
+					}
1079
+					if item.Module == 4 {
1080
+						didRegistedForCDM = true
1081
+					}
1082
+					if item.Module == 7 {
1083
+						didRegistedForMall = true
1084
+					}
1085
+				}
1087
 			}
1086
 			}
1088
 		}
1087
 		}
1089
 
1088
 

+ 1 - 1
controllers/inspection_api_controller.go Ver arquivo

432
 
432
 
433
 	date := ""
433
 	date := ""
434
 	if len(inspections) > 0 {
434
 	if len(inspections) > 0 {
435
-		date = time.Unix(dateTime, 0).Format("2006-01-02")
435
+		date = time.Unix(dateTime, 0).Format("2006-01-02 15:04")
436
 	}
436
 	}
437
 
437
 
438
 	c.ServeSuccessJSON(map[string]interface{}{
438
 	c.ServeSuccessJSON(map[string]interface{}{

+ 4 - 3
controllers/mobile_api_controllers/admin_user_api_controller.go Ver arquivo

18
 func (c *AdminUserApiController) GetAdminUserElectronicSignature() {
18
 func (c *AdminUserApiController) GetAdminUserElectronicSignature() {
19
 
19
 
20
 	adminUserInfo := c.GetMobileAdminUserInfo()
20
 	adminUserInfo := c.GetMobileAdminUserInfo()
21
-
22
-	es, _ := service.GetAdminUserElectronicSignature(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id)
23
-
21
+	//orgId, _ := service.GetCreatByOrgId(adminUserInfo.Org.Id)
22
+	id := adminUserInfo.AdminUser.Id
23
+	es, _ := service.GetAdminUserElectronicSignature(adminUserInfo.Org.Id, adminUserInfo.App.Id, id)
24
 	if es != nil {
24
 	if es != nil {
25
 		c.ServeSuccessJSON(map[string]interface{}{
25
 		c.ServeSuccessJSON(map[string]interface{}{
26
 			"state":                1,
26
 			"state":                1,
35
 }
35
 }
36
 
36
 
37
 func (c *AdminUserApiController) SaveAdminUserElectronicSignature() {
37
 func (c *AdminUserApiController) SaveAdminUserElectronicSignature() {
38
+
38
 	adminUserInfo := c.GetMobileAdminUserInfo()
39
 	adminUserInfo := c.GetMobileAdminUserInfo()
39
 
40
 
40
 	es, _ := service.GetAdminUserElectronicSignature(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id)
41
 	es, _ := service.GetAdminUserElectronicSignature(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id)

+ 38 - 35
controllers/mobile_api_controllers/dialysis_api_controller.go Ver arquivo

783
 	in_advance_reason_other := c.GetString("in_advance_reason_other")
783
 	in_advance_reason_other := c.GetString("in_advance_reason_other")
784
 	is_eat, _ := c.GetInt64("is_eat", 0)
784
 	is_eat, _ := c.GetInt64("is_eat", 0)
785
 
785
 
786
+	cvc_a, _ := c.GetFloat("cvc_a", 0)
787
+	cvc_b, _ := c.GetFloat("cvc_b", 0)
788
+	channels, _ := c.GetInt64("channel", 0)
789
+
786
 	if id <= 0 {
790
 	if id <= 0 {
787
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
791
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
788
 		return
792
 		return
870
 		Dialyzer:                     dialyzer,
874
 		Dialyzer:                     dialyzer,
871
 		InAdvanceReasonOther:         in_advance_reason_other,
875
 		InAdvanceReasonOther:         in_advance_reason_other,
872
 		IsEat:                        is_eat,
876
 		IsEat:                        is_eat,
877
+		CvcA:                         cvc_a,
878
+		CvcB:                         cvc_b,
879
+		Channel:                      channels,
873
 	}
880
 	}
874
 
881
 
875
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
882
+	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
876
 
883
 
877
 	_, assessmentAfter := service.FindAssessmentAfterDislysisByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
884
 	_, assessmentAfter := service.FindAssessmentAfterDislysisByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
878
 	if assessmentAfter.ID == 0 { //新增
885
 	if assessmentAfter.ID == 0 { //新增
879
-		//if appRole.UserType == 2 || appRole.UserType == 1 {
880
-		assessmentAfterDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
881
-		assessmentAfterDislysis.AssessmentTime = time.Now().Unix()
886
+		if appRole.UserType == 2 || appRole.UserType == 1 {
887
+			assessmentAfterDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
888
+			assessmentAfterDislysis.AssessmentTime = time.Now().Unix()
882
 
889
 
883
-		//} else {
884
-		assessmentAfterDislysis.Creater = adminUserInfo.AdminUser.Id
890
+		} else {
891
+			assessmentAfterDislysis.Creater = adminUserInfo.AdminUser.Id
885
 
892
 
886
-		//}
893
+		}
887
 
894
 
888
 		err := service.AddSigleAssessmentAfterDislysisRecord(&assessmentAfterDislysis)
895
 		err := service.AddSigleAssessmentAfterDislysisRecord(&assessmentAfterDislysis)
889
 		if err == nil {
896
 		if err == nil {
892
 			})
899
 			})
893
 		}
900
 		}
894
 	} else { //修改
901
 	} else { //修改
895
-		//if appRole.UserType == 3 {
896
-		//	if assessmentAfter.Creater != adminUserInfo.AdminUser.Id && assessmentAfter.Creater != 0 {
897
-		//		headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
898
-		//		if getPermissionErr != nil {
899
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
900
-		//			return
901
-		//		} else if headNursePermission == nil {
902
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
903
-		//			return
904
-		//		}
905
-		//	}
906
-		//}
907
 
902
 
908
-		//TODO 根据角色判断
909
-		//if appRole.UserType == 2 || appRole.UserType == 1 {
910
-		assessmentAfterDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
911
-		assessmentAfterDislysis.AssessmentTime = time.Now().Unix()
912
-		//} else {
913
-		assessmentAfterDislysis.Modifier = adminUserInfo.AdminUser.Id
914
-		if assessmentAfterDislysis.Creater == 0 {
915
-			assessmentAfterDislysis.Creater = adminUserInfo.AdminUser.Id
903
+		if appRole.UserType == 2 || appRole.UserType == 1 {
904
+			assessmentAfterDislysis.AssessmentDoctor = adminUserInfo.AdminUser.Id
905
+			assessmentAfterDislysis.AssessmentTime = time.Now().Unix()
906
+		} else {
907
+			assessmentAfterDislysis.Modifier = adminUserInfo.AdminUser.Id
908
+			if assessmentAfterDislysis.Creater == 0 {
909
+				assessmentAfterDislysis.Creater = adminUserInfo.AdminUser.Id
910
+			}
916
 		}
911
 		}
917
-		//}
918
 
912
 
919
 		assessmentAfterDislysis.CreatedTime = assessmentAfter.CreatedTime
913
 		assessmentAfterDislysis.CreatedTime = assessmentAfter.CreatedTime
920
 		assessmentAfterDislysis.ID = assessmentAfter.ID
914
 		assessmentAfterDislysis.ID = assessmentAfter.ID
1030
 	//}
1024
 	//}
1031
 
1025
 
1032
 	//TODO 需要根据角色去判断
1026
 	//TODO 需要根据角色去判断
1033
-	if appRole.UserType == 2 || appRole.UserType == 1 {
1034
-		prescription_doctor = appRole.AdminUserId
1035
-	} else {
1036
-		prescription_doctor = 0
1037
-	}
1038
 
1027
 
1039
 	prescription := models.DialysisPrescription{
1028
 	prescription := models.DialysisPrescription{
1040
 
1029
 
1104
 		//if mode_id > 0 {
1093
 		//if mode_id > 0 {
1105
 		//	//service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1094
 		//	//service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1106
 		//}
1095
 		//}
1096
+		if appRole.UserType == 2 || appRole.UserType == 1 {
1097
+			prescription_doctor = adminUserInfo.AdminUser.Id
1098
+		} else {
1099
+			prescription_doctor = 0
1100
+		}
1101
+
1107
 		prescription.Creater = adminUserInfo.AdminUser.Id
1102
 		prescription.Creater = adminUserInfo.AdminUser.Id
1108
 		err := service.AddSigleRecord(&prescription)
1103
 		err := service.AddSigleRecord(&prescription)
1109
 
1104
 
2248
 
2243
 
2249
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
2244
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
2250
 		prescription.Modifier = adminUserInfo.AdminUser.Id
2245
 		prescription.Modifier = adminUserInfo.AdminUser.Id
2251
-		prescription.Creater = dialysisPrescription.Creater
2246
+		if appRole.UserType == 2 || appRole.UserType == 1 {
2247
+			prescription_doctor := adminUserInfo.AdminUser.Id
2248
+			prescription.PrescriptionDoctor = prescription_doctor
2249
+		}
2250
+		if dialysisPrescription.Creater == 0 { //体重称
2251
+			prescription.Creater = adminUserInfo.AdminUser.Id
2252
+
2253
+		} else {
2254
+			prescription.Creater = dialysisPrescription.Creater
2255
+		}
2252
 
2256
 
2253
-		prescription.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2254
 		prescription.ID = dialysisPrescription.ID
2257
 		prescription.ID = dialysisPrescription.ID
2255
 		err := service.UpDateDialysisPrescription(&prescription)
2258
 		err := service.UpDateDialysisPrescription(&prescription)
2256
 		if err == nil {
2259
 		if err == nil {

+ 20 - 10
controllers/mobile_api_controllers/mobile_api_base_controller.go Ver arquivo

23
 	// beego.Trace("============================================================")
23
 	// beego.Trace("============================================================")
24
 }
24
 }
25
 
25
 
26
+//
27
+
26
 func (this *MobileBaseAPIController) GetMobileAdminUserInfo() *MobileAdminUserInfo {
28
 func (this *MobileBaseAPIController) GetMobileAdminUserInfo() *MobileAdminUserInfo {
27
 	userInfo := this.GetSession("mobile_admin_user_info")
29
 	userInfo := this.GetSession("mobile_admin_user_info")
28
 	if userInfo == nil {
30
 	if userInfo == nil {
47
 
49
 
48
 func (this *MobileBaseAPIAuthController) Prepare() {
50
 func (this *MobileBaseAPIAuthController) Prepare() {
49
 	token := this.Ctx.GetCookie("token_cookie")
51
 	token := this.Ctx.GetCookie("token_cookie")
50
-	//logout_cookie := this.Ctx.GetCookie("logout_cookie")
52
+	logout_cookie := this.Ctx.GetCookie("logout_cookie")
51
 
53
 
52
 	//if len(token) == 0{
54
 	//if len(token) == 0{
53
 	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
55
 	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
56
 	this.MobileBaseAPIController.Prepare()
58
 	this.MobileBaseAPIController.Prepare()
57
 	adminUserInfo := this.GetMobileAdminUserInfo()
59
 	adminUserInfo := this.GetMobileAdminUserInfo()
58
 
60
 
59
-	if adminUserInfo == nil {
60
-		this.DelSession("mobile_admin_user_info")
61
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
62
-		this.StopRun()
63
-	}
64
-
61
+	fmt.Println(token)
65
 	if len(token) == 0 {
62
 	if len(token) == 0 {
66
-
67
 		this.DelSession("mobile_admin_user_info")
63
 		this.DelSession("mobile_admin_user_info")
68
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLoginTimeout)
69
-		this.StopRun()
64
+		fmt.Println(logout_cookie)
65
+		if len(logout_cookie) == 1 {
66
+			this.Ctx.SetCookie("logout_cookie", "2")
67
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLogOut)
68
+			this.StopRun()
69
+		} else {
70
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLoginTimeout)
71
+			this.StopRun()
72
+		}
73
+
74
+	} else {
75
+		if adminUserInfo == nil {
76
+			this.DelSession("mobile_admin_user_info")
77
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
78
+			this.StopRun()
79
+		}
70
 	}
80
 	}
71
 
81
 
72
 	//if this.Ctx.Request.Method != "GET" {
82
 	//if this.Ctx.Request.Method != "GET" {

+ 253 - 186
controllers/mobile_api_controllers/patient_api_controller.go Ver arquivo

609
 	advice.ExecutionStaff = execution_staff
609
 	advice.ExecutionStaff = execution_staff
610
 	advice.ExecutionTime = theTime.Unix()
610
 	advice.ExecutionTime = theTime.Unix()
611
 	advice.ExecutionState = 1
611
 	advice.ExecutionState = 1
612
+	advice.Modifier = adminUserInfo.AdminUser.Id
612
 
613
 
613
 	c.ServeSuccessJSON(map[string]interface{}{
614
 	c.ServeSuccessJSON(map[string]interface{}{
614
 		"msg":    "ok",
615
 		"msg":    "ok",
843
 		return
844
 		return
844
 	}
845
 	}
845
 	//templateInfo,_ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
846
 	//templateInfo,_ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
846
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
847
+	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
847
 	var evaluation models.PredialysisEvaluation
848
 	var evaluation models.PredialysisEvaluation
848
 	if theEvaluation != nil {
849
 	if theEvaluation != nil {
849
-		//if appRole.UserType == 2 || appRole.UserType == 1 {
850
-
851
 		evaluation = *theEvaluation
850
 		evaluation = *theEvaluation
852
-
853
-		//} else {
854
-		//	if theEvaluation.Creater != adminUserInfo.AdminUser.Id && theEvaluation.Creater != 0 {
855
-		//		headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
856
-		//		if getPermissionErr != nil {
857
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
858
-		//			return
859
-		//		} else if headNursePermission == nil {
860
-		//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
861
-		//			return
862
-		//		}
863
-		//	} else {
864
-		//		evaluation = *theEvaluation
865
-		//	}
866
-		//}
867
 	}
851
 	}
868
 
852
 
869
 	code := predialysisEvaluationFormData(&evaluation, c.Ctx.Input.RequestBody)
853
 	code := predialysisEvaluationFormData(&evaluation, c.Ctx.Input.RequestBody)
879
 		evaluation.AssessmentDate = theAssessmentDateTime
863
 		evaluation.AssessmentDate = theAssessmentDateTime
880
 		evaluation.PatientId = id
864
 		evaluation.PatientId = id
881
 		evaluation.UserOrgId = adminUserInfo.Org.Id
865
 		evaluation.UserOrgId = adminUserInfo.Org.Id
882
-		//if appRole.UserType == 2 || appRole.UserType == 1 {
883
-		//	evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
884
-		//	evaluation.AssessmentTime = time.Now().Unix()
885
-		//} else {
886
-		evaluation.Creater = adminUserInfo.AdminUser.Id
887
-		//}
866
+		if appRole.UserType == 2 || appRole.UserType == 1 {
867
+			evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
868
+			evaluation.AssessmentTime = time.Now().Unix()
869
+		} else {
870
+			evaluation.Creater = adminUserInfo.AdminUser.Id
871
+		}
888
 	} else {
872
 	} else {
889
 		evaluation.UpdatedTime = time.Now().Unix()
873
 		evaluation.UpdatedTime = time.Now().Unix()
890
 		evaluation.Evaluator = adminUserInfo.AdminUser.Id
874
 		evaluation.Evaluator = adminUserInfo.AdminUser.Id
891
-		//if appRole.UserType == 2 || appRole.UserType == 1 {
892
-		//	evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
893
-		//	evaluation.AssessmentTime = time.Now().Unix()
894
-		//} else {
895
-		evaluation.Modifier = adminUserInfo.AdminUser.Id
896
-		if evaluation.Creater == 0 {
897
-			evaluation.Creater = adminUserInfo.AdminUser.Id
875
+		if appRole.UserType == 2 || appRole.UserType == 1 {
876
+			evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
877
+			evaluation.AssessmentTime = time.Now().Unix()
878
+		} else {
879
+			evaluation.Modifier = adminUserInfo.AdminUser.Id
880
+			if evaluation.Creater == 0 {
881
+				evaluation.Creater = adminUserInfo.AdminUser.Id
882
+			}
898
 		}
883
 		}
899
-		//}
900
 	}
884
 	}
901
 
885
 
902
 	//新增逻辑
886
 	//新增逻辑
2190
 }
2174
 }
2191
 
2175
 
2192
 func (c *PatientApiController) CreateGroupAdvice() {
2176
 func (c *PatientApiController) CreateGroupAdvice() {
2193
-	patient, _ := c.GetInt64("id", 0)
2194
-	if patient <= 0 {
2195
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2196
-		return
2197
-	}
2198
-	adminUserInfo := c.GetMobileAdminUserInfo()
2177
+	is_child, _ := c.GetInt64("is_child", 0)
2199
 
2178
 
2200
-	patientInfo, _ := service.FindPatientById(adminUserInfo.Org.Id, patient)
2201
-	if patientInfo.ID == 0 {
2202
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
2203
-		return
2204
-	}
2205
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2179
+	if is_child == 1 {
2180
+		patient, _ := c.GetInt64("id", 0)
2181
+		if patient <= 0 {
2182
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2183
+			return
2184
+		}
2185
+		adminUserInfo := c.GetMobileAdminUserInfo()
2206
 
2186
 
2207
-	//if appRole.UserType == 3{
2208
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdvicePermissionDeniedModify)
2209
-	//	return
2210
-	//}
2211
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2187
+		patientInfo, _ := service.FindPatientById(adminUserInfo.Org.Id, patient)
2188
+		if patientInfo.ID == 0 {
2189
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
2190
+			return
2191
+		}
2212
 
2192
 
2213
-	//if appRole.UserType == 3 {
2214
-	//	headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
2215
-	//	if getPermissionErr != nil {
2216
-	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2217
-	//		return
2218
-	//	} else if headNursePermission == nil {
2219
-	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
2220
-	//		return
2221
-	//	}
2222
-	//}
2223
-	//TODO根据路由做权限
2193
+		group_no, _ := c.GetInt64("group_no")
2194
+		if group_no <= 0 {
2195
+			group_no = 0
2196
+		}
2224
 
2197
 
2225
-	group_no, _ := c.GetInt64("group_no")
2226
-	if group_no <= 0 {
2227
-		group_no = 0
2228
-	}
2198
+		dataBody := make(map[string]interface{}, 0)
2199
+		err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
2200
+		if err != nil {
2201
+			utils.ErrorLog(err.Error())
2202
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2203
+			return
2204
+		}
2229
 
2205
 
2230
-	dataBody := make(map[string]interface{}, 0)
2231
-	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
2232
-	if err != nil {
2233
-		utils.ErrorLog(err.Error())
2234
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2235
-		return
2236
-	}
2206
+		timeLayout := "2006-01-02"
2207
+		loc, _ := time.LoadLocation("Local")
2237
 
2208
 
2238
-	timeLayout := "2006-01-02"
2239
-	loc, _ := time.LoadLocation("Local")
2209
+		if dataBody["advice_type"] == nil || reflect.TypeOf(dataBody["advice_type"]).String() != "float64" {
2210
+			utils.ErrorLog("advice_type")
2211
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2212
+			return
2213
+		}
2214
+		adviceType := int64(dataBody["advice_type"].(float64))
2215
+		if adviceType != 1 && adviceType != 2 {
2216
+			utils.ErrorLog("advice_type != 1&&2")
2217
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2218
+			return
2219
+		}
2240
 
2220
 
2241
-	if dataBody["advice_type"] == nil || reflect.TypeOf(dataBody["advice_type"]).String() != "float64" {
2242
-		utils.ErrorLog("advice_type")
2243
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2244
-		return
2245
-	}
2246
-	adviceType := int64(dataBody["advice_type"].(float64))
2247
-	if adviceType != 1 && adviceType != 2 {
2248
-		utils.ErrorLog("advice_type != 1&&2")
2249
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2250
-		return
2251
-	}
2221
+		if dataBody["start_time"] == nil || reflect.TypeOf(dataBody["start_time"]).String() != "string" {
2222
+			utils.ErrorLog("start_time")
2223
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2224
+			return
2225
+		}
2252
 
2226
 
2253
-	if dataBody["advice_date"] == nil || reflect.TypeOf(dataBody["advice_date"]).String() != "string" {
2254
-		utils.ErrorLog("advice_date")
2255
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2256
-		return
2257
-	}
2258
-	adviceDate, _ := dataBody["advice_date"].(string)
2259
-	if len(adviceDate) == 0 {
2260
-		utils.ErrorLog("len(adviceDate) == 0")
2261
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2262
-		return
2263
-	}
2264
-	theTime, err := time.ParseInLocation(timeLayout, adviceDate, loc)
2265
-	if err != nil {
2266
-		utils.ErrorLog(err.Error())
2267
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2268
-		return
2269
-	}
2270
-	AdviceDate := theTime.Unix()
2271
-	RecordDate := theTime.Unix()
2227
+		startTime2, _ := dataBody["start_time"].(string)
2228
+		time_arr := strings.Split(startTime2, " ")
2229
+		if len(time_arr) > 0 {
2230
+			startTime2 = time_arr[0]
2231
+		}
2232
+		if dataBody["advice_date"] == nil || reflect.TypeOf(dataBody["advice_date"]).String() != "string" {
2233
+			utils.ErrorLog("advice_date")
2234
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2235
+			return
2236
+		}
2237
+		adviceDate := startTime2
2238
+		if len(adviceDate) == 0 {
2239
+			utils.ErrorLog("len(adviceDate) == 0")
2240
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2241
+			return
2242
+		}
2243
+		theTime, err := time.ParseInLocation(timeLayout, adviceDate, loc)
2244
+		if err != nil {
2245
+			utils.ErrorLog(err.Error())
2246
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2247
+			return
2248
+		}
2249
+		AdviceDate := theTime.Unix()
2250
+		RecordDate := theTime.Unix()
2272
 
2251
 
2273
-	if dataBody["start_time"] == nil || reflect.TypeOf(dataBody["start_time"]).String() != "string" {
2274
-		utils.ErrorLog("start_time")
2275
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2276
-		return
2277
-	}
2278
-	startTime, _ := dataBody["start_time"].(string)
2279
-	if len(startTime) == 0 {
2280
-		utils.ErrorLog("len(start_time) == 0")
2281
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2282
-		return
2283
-	}
2284
-	theTime, err = time.ParseInLocation(timeLayout+" 15:04:05", startTime, loc)
2285
-	if err != nil {
2286
-		utils.ErrorLog(err.Error())
2287
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2288
-		return
2289
-	}
2290
-	StartTime := theTime.Unix()
2252
+		if dataBody["start_time"] == nil || reflect.TypeOf(dataBody["start_time"]).String() != "string" {
2253
+			utils.ErrorLog("start_time")
2254
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2255
+			return
2256
+		}
2257
+		startTime, _ := dataBody["start_time"].(string)
2258
+		if len(startTime) == 0 {
2259
+			utils.ErrorLog("len(start_time) == 0")
2260
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2261
+			return
2262
+		}
2263
+		theTime, err = time.ParseInLocation(timeLayout+" 15:04:05", startTime, loc)
2264
+		if err != nil {
2265
+			utils.ErrorLog(err.Error())
2266
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2267
+			return
2268
+		}
2269
+		StartTime := theTime.Unix()
2291
 
2270
 
2292
-	Remark := ""
2293
-	if dataBody["remark"] != nil && reflect.TypeOf(dataBody["remark"]).String() == "string" {
2294
-		remark, _ := dataBody["remark"].(string)
2295
-		Remark = remark
2296
-	}
2271
+		Remark := ""
2272
+		if dataBody["remark"] != nil && reflect.TypeOf(dataBody["remark"]).String() == "string" {
2273
+			remark, _ := dataBody["remark"].(string)
2274
+			Remark = remark
2275
+		}
2297
 
2276
 
2298
-	var advices []*models.GroupAdvice
2299
-	// utils.TraceLog("%+v", dataBody["adviceNames"])
2300
-	if dataBody["adviceNames"] == nil || reflect.TypeOf(dataBody["adviceNames"]).String() != "[]interface {}" {
2301
-		utils.ErrorLog("adviceNames")
2302
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2277
+		var advices []*models.GroupAdvice
2278
+		// utils.TraceLog("%+v", dataBody["adviceNames"])
2279
+		if dataBody["adviceNames"] == nil || reflect.TypeOf(dataBody["adviceNames"]).String() != "[]interface {}" {
2280
+			utils.ErrorLog("adviceNames")
2281
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2282
+			return
2283
+		}
2284
+		adviceNames := dataBody["adviceNames"].([]interface{})
2285
+		for _, adviceNameMap := range adviceNames {
2286
+			adviceNameM := adviceNameMap.(map[string]interface{})
2287
+			var advice models.GroupAdvice
2288
+			advice.Remark = Remark
2289
+			advice.AdviceType = adviceType
2290
+			advice.StartTime = StartTime
2291
+			advice.AdviceDate = AdviceDate
2292
+			advice.RecordDate = RecordDate
2293
+			advice.Status = 1
2294
+			advice.CreatedTime = time.Now().Unix()
2295
+			advice.UpdatedTime = time.Now().Unix()
2296
+			advice.StopState = 2
2297
+			advice.ExecutionState = 2
2298
+			advice.UserOrgId = adminUserInfo.Org.Id
2299
+			advice.PatientId = patientInfo.ID
2300
+			advice.AdviceDoctor = adminUserInfo.AdminUser.Id
2301
+
2302
+			errcode := c.setAdviceWithJSON(&advice, adviceNameM)
2303
+			if errcode > 0 {
2304
+				c.ServeFailJSONWithSGJErrorCode(errcode)
2305
+				return
2306
+			}
2307
+
2308
+			if adviceNameM["subdrugs"] != nil && reflect.TypeOf(adviceNameM["subdrugs"]).String() == "[]interface {}" {
2309
+				subdrugs := adviceNameM["subdrugs"].([]interface{})
2310
+				if len(subdrugs) > 0 {
2311
+					for _, subdrug := range subdrugs {
2312
+						var s models.GroupAdvice
2313
+						s.Remark = Remark
2314
+						s.AdviceType = adviceType
2315
+						s.StartTime = StartTime
2316
+						s.AdviceDate = AdviceDate
2317
+						s.RecordDate = RecordDate
2318
+						s.Status = 1
2319
+						s.CreatedTime = time.Now().Unix()
2320
+						s.UpdatedTime = time.Now().Unix()
2321
+						s.StopState = 2
2322
+						s.ExecutionState = 2
2323
+						s.UserOrgId = adminUserInfo.Org.Id
2324
+						s.PatientId = patientInfo.ID
2325
+						s.AdviceDoctor = adminUserInfo.AdminUser.Id
2326
+
2327
+						errcode := c.setAdviceWithJSON(&s, subdrug.(map[string]interface{}))
2328
+						if errcode > 0 {
2329
+							c.ServeFailJSONWithSGJErrorCode(errcode)
2330
+							return
2331
+						}
2332
+
2333
+						advice.Children = append(advice.Children, &s)
2334
+					}
2335
+				}
2336
+			}
2337
+
2338
+			advices = append(advices, &advice)
2339
+		}
2340
+
2341
+		newAdvices, createErr := service.CreateMGroupAdvice(adminUserInfo.Org.Id, advices, group_no)
2342
+		if createErr != nil {
2343
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
2344
+			return
2345
+		}
2346
+
2347
+		c.ServeSuccessJSON(map[string]interface{}{
2348
+			"msg":     "ok",
2349
+			"advices": newAdvices,
2350
+		})
2303
 		return
2351
 		return
2304
-	}
2305
-	adviceNames := dataBody["adviceNames"].([]interface{})
2306
-	for _, adviceNameMap := range adviceNames {
2307
-		adviceNameM := adviceNameMap.(map[string]interface{})
2308
-		var advice models.GroupAdvice
2309
-		advice.Remark = Remark
2310
-		advice.AdviceType = adviceType
2311
-		advice.StartTime = StartTime
2312
-		advice.AdviceDate = AdviceDate
2313
-		advice.RecordDate = RecordDate
2352
+
2353
+	} else if is_child == 2 {
2354
+
2355
+		patient, _ := c.GetInt64("id", 0)
2356
+		if patient <= 0 {
2357
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2358
+			return
2359
+		}
2360
+
2361
+		adminUserInfo := c.GetMobileAdminUserInfo()
2362
+		patientInfo, _ := service.FindPatientById(adminUserInfo.Org.Id, patient)
2363
+		if patientInfo.ID == 0 {
2364
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
2365
+			return
2366
+		}
2367
+		//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2368
+
2369
+		//if appRole.UserType == 3{
2370
+		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdvicePermissionDeniedModify)
2371
+		//	return
2372
+		//}
2373
+
2374
+		//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
2375
+		//
2376
+		//if appRole.UserType == 3 {
2377
+		//	headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
2378
+		//	if getPermissionErr != nil {
2379
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2380
+		//		return
2381
+		//	} else if headNursePermission == nil {
2382
+		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
2383
+		//		return
2384
+		//	}
2385
+		//}
2386
+
2387
+		var advice models.DoctorAdvice
2388
+		code := adviceFormData(&advice, c.Ctx.Input.RequestBody, "create")
2389
+		if code > 0 {
2390
+			c.ServeFailJSONWithSGJErrorCode(code)
2391
+			return
2392
+		}
2393
+
2394
+		if advice.ParentId > 0 {
2395
+			old, _ := service.FindDoctorAdvice(adminUserInfo.Org.Id, advice.ParentId)
2396
+			if old.ID == 0 || old.PatientId != patient {
2397
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParentAdviceNotExist)
2398
+				return
2399
+			}
2400
+
2401
+			if old.StopState == 1 || old.ExecutionState == 1 {
2402
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceStoped)
2403
+				return
2404
+			}
2405
+
2406
+			if old.ParentId > 0 {
2407
+				advice.ParentId = old.ParentId
2408
+			}
2409
+			advice.StartTime = old.StartTime
2410
+			advice.AdviceDoctor = old.AdviceDoctor
2411
+			advice.DeliveryWay = old.DeliveryWay
2412
+			advice.ExecutionFrequency = old.ExecutionFrequency
2413
+			advice.GroupNo = old.GroupNo
2414
+
2415
+		}
2416
+
2314
 		advice.Status = 1
2417
 		advice.Status = 1
2315
 		advice.CreatedTime = time.Now().Unix()
2418
 		advice.CreatedTime = time.Now().Unix()
2316
 		advice.UpdatedTime = time.Now().Unix()
2419
 		advice.UpdatedTime = time.Now().Unix()
2317
 		advice.StopState = 2
2420
 		advice.StopState = 2
2318
 		advice.ExecutionState = 2
2421
 		advice.ExecutionState = 2
2319
 		advice.UserOrgId = adminUserInfo.Org.Id
2422
 		advice.UserOrgId = adminUserInfo.Org.Id
2320
-		advice.PatientId = patientInfo.ID
2423
+		advice.PatientId = patient
2321
 		advice.AdviceDoctor = adminUserInfo.AdminUser.Id
2424
 		advice.AdviceDoctor = adminUserInfo.AdminUser.Id
2322
 
2425
 
2323
-		errcode := c.setAdviceWithJSON(&advice, adviceNameM)
2324
-		if errcode > 0 {
2325
-			c.ServeFailJSONWithSGJErrorCode(errcode)
2426
+		err := service.CreateDoctorAdvice(&advice)
2427
+		if err != nil {
2428
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
2326
 			return
2429
 			return
2327
 		}
2430
 		}
2328
 
2431
 
2329
-		if adviceNameM["subdrugs"] != nil && reflect.TypeOf(adviceNameM["subdrugs"]).String() == "[]interface {}" {
2330
-			subdrugs := adviceNameM["subdrugs"].([]interface{})
2331
-			if len(subdrugs) > 0 {
2332
-				for _, subdrug := range subdrugs {
2333
-					var s models.GroupAdvice
2334
-					s.Remark = Remark
2335
-					s.AdviceType = adviceType
2336
-					s.StartTime = StartTime
2337
-					s.AdviceDate = AdviceDate
2338
-					s.RecordDate = RecordDate
2339
-					s.Status = 1
2340
-					s.CreatedTime = time.Now().Unix()
2341
-					s.UpdatedTime = time.Now().Unix()
2342
-					s.StopState = 2
2343
-					s.ExecutionState = 2
2344
-					s.UserOrgId = adminUserInfo.Org.Id
2345
-					s.PatientId = patientInfo.ID
2346
-					s.AdviceDoctor = adminUserInfo.AdminUser.Id
2347
-
2348
-					errcode := c.setAdviceWithJSON(&s, subdrug.(map[string]interface{}))
2349
-					if errcode > 0 {
2350
-						c.ServeFailJSONWithSGJErrorCode(errcode)
2351
-						return
2352
-					}
2353
-
2354
-					advice.Children = append(advice.Children, &s)
2355
-				}
2356
-			}
2357
-		}
2358
-
2359
-		advices = append(advices, &advice)
2360
-	}
2361
-
2362
-	newAdvices, createErr := service.CreateMGroupAdvice(adminUserInfo.Org.Id, advices, group_no)
2363
-	if createErr != nil {
2364
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
2432
+		c.ServeSuccessJSON(map[string]interface{}{
2433
+			"msg":    "ok",
2434
+			"advice": advice,
2435
+		})
2365
 		return
2436
 		return
2437
+
2366
 	}
2438
 	}
2367
 
2439
 
2368
-	c.ServeSuccessJSON(map[string]interface{}{
2369
-		"msg":     "ok",
2370
-		"advices": newAdvices,
2371
-	})
2372
-	return
2373
 }
2440
 }
2374
 
2441
 
2375
 func (c *PatientApiController) setAdviceWithJSON(advice *models.GroupAdvice, json map[string]interface{}) int {
2442
 func (c *PatientApiController) setAdviceWithJSON(advice *models.GroupAdvice, json map[string]interface{}) int {

+ 22 - 11
controllers/new_mobile_api_controllers/home_api_controller.go Ver arquivo

21
 }
21
 }
22
 
22
 
23
 func (this *HomeController) GetHomeData() {
23
 func (this *HomeController) GetHomeData() {
24
+
24
 	adminUserInfo := this.GetMobileAdminUserInfo()
25
 	adminUserInfo := this.GetMobileAdminUserInfo()
25
 	if adminUserInfo.Org != nil && adminUserInfo.Org.Id != 0 {
26
 	if adminUserInfo.Org != nil && adminUserInfo.Org.Id != 0 {
26
 		//获取该管理员所有机构列表
27
 		//获取该管理员所有机构列表
72
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
73
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
73
 			return
74
 			return
74
 		}
75
 		}
75
-
76
+		cretor := adminUserInfo.AdminUser.Id
76
 		this.ServeSuccessJSON(map[string]interface{}{
77
 		this.ServeSuccessJSON(map[string]interface{}{
77
 			"orgs":            orgs,
78
 			"orgs":            orgs,
78
 			"apps":            apps,
79
 			"apps":            apps,
79
 			"banners":         banners,
80
 			"banners":         banners,
80
 			"isCreateOrg":     true,
81
 			"isCreateOrg":     true,
81
 			"isSubSuperAdmin": isSubSuperAdmin,
82
 			"isSubSuperAdmin": isSubSuperAdmin,
83
+			"cretor":          cretor,
82
 		})
84
 		})
83
 	} else {
85
 	} else {
84
 		apps, err := service.GetAllApp(0)
86
 		apps, err := service.GetAllApp(0)
283
 	}
285
 	}
284
 	orgPhone := this.GetString("telephone")
286
 	orgPhone := this.GetString("telephone")
285
 
287
 
286
-	if len(orgPhone) > 0 {
287
-		if utils.PhoneRegexp().MatchString(orgPhone) == false {
288
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
289
-			this.ServeJSON()
290
-			return
291
-		}
292
-	}
293
-
294
 	provinceID := 0
288
 	provinceID := 0
295
 	cityID := 0
289
 	cityID := 0
296
 	districtID := 0
290
 	districtID := 0
377
 		InitRoleAndPurviews(org)
371
 		InitRoleAndPurviews(org)
378
 		//初始化设备管理
372
 		//初始化设备管理
379
 		InitEquitMentInformation(org)
373
 		InitEquitMentInformation(org)
380
-
381
-		//初始化显示配置
374
+		//初始化显示配置和打印模版
375
+		InitShowConfig(org)
382
 
376
 
383
 		if len(orgs) == 0 {
377
 		if len(orgs) == 0 {
384
 			ip := utils.GetIP(this.Ctx.Request)
378
 			ip := utils.GetIP(this.Ctx.Request)
721
 	}
715
 	}
722
 	return
716
 	return
723
 }
717
 }
718
+
719
+func RemoveRepeatedOrgElementTwo(orgs []*models.SgjUserOrg) (newOrgs []*models.SgjUserOrg) {
720
+	newOrgs = make([]*models.SgjUserOrg, 0)
721
+	for i := 0; i < len(orgs); i++ {
722
+		repeat := false
723
+		for j := i + 1; j < len(orgs); j++ {
724
+			if orgs[i].ID == orgs[j].ID {
725
+				repeat = true
726
+				break
727
+			}
728
+		}
729
+		if !repeat {
730
+			newOrgs = append(newOrgs, orgs[i])
731
+		}
732
+	}
733
+	return
734
+}

+ 10 - 4
controllers/new_mobile_api_controllers/mobile_regist_controller.go Ver arquivo

235
 		InitPatientAndSchedule(org)
235
 		InitPatientAndSchedule(org)
236
 		//初始化透析方案
236
 		//初始化透析方案
237
 		InitSystemPrescrption(org)
237
 		InitSystemPrescrption(org)
238
-		//初始化医嘱模版
239
-		//InitAdviceTemplate(org)
240
 		//初始化角色和权限
238
 		//初始化角色和权限
241
 		InitRoleAndPurviews(org)
239
 		InitRoleAndPurviews(org)
242
 		//初始化设备管理org
240
 		//初始化设备管理org
243
 		InitEquitMentInformation(org)
241
 		InitEquitMentInformation(org)
244
-		//初始化显示配置
245
-		//InitShowConfig(org)
242
+		//初始化显示配置和打印模版
243
+		InitShowConfig(org)
246
 
244
 
247
 		//创建完机构后进行登录验证操作
245
 		//创建完机构后进行登录验证操作
248
 		ip := utils.GetIP(this.Ctx.Request)
246
 		ip := utils.GetIP(this.Ctx.Request)
1176
 
1174
 
1177
 func InitShowConfig(org *models.Org) {
1175
 func InitShowConfig(org *models.Org) {
1178
 	service.BatchInsertFiledSystemConfig(org.Id)
1176
 	service.BatchInsertFiledSystemConfig(org.Id)
1177
+	template := &models.VMGobalTemplate{
1178
+		Status:     1,
1179
+		Ctime:      time.Now().Unix(),
1180
+		Mtime:      time.Now().Unix(),
1181
+		OrgId:      org.Id,
1182
+		TemplateId: 2,
1183
+	}
1184
+	service.CreateVMPrintTemplate(template)
1179
 }
1185
 }

+ 164 - 15
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Ver arquivo

1496
 	})
1496
 	})
1497
 }
1497
 }
1498
 
1498
 
1499
+func (this *NewDialysisApiController) GetAllProjectName() {
1500
+	id := this.GetString("date")
1501
+	fmt.Println("id是", id)
1502
+	ids, _ := strconv.ParseInt(id, 10, 64)
1503
+	patientid := this.GetString("patientid")
1504
+	fmt.Println("patient", patientid)
1505
+	paientids, _ := strconv.ParseInt(patientid, 10, 64)
1506
+	patient, _ := service.GetNewPatient(paientids)
1507
+	orgid := this.GetMobileAdminUserInfo().Org.Id
1508
+	projectName, err := service.GetAllProjectName(ids, orgid, patient.BloodId)
1509
+	fmt.Println("projectname----------------------------------", err)
1510
+	if err != nil {
1511
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1512
+		return
1513
+	}
1514
+	this.ServeSuccessJSON(map[string]interface{}{
1515
+		"projectName": projectName,
1516
+	})
1517
+}
1518
+
1499
 func (this *NewDialysisApiController) GetAllInspection() {
1519
 func (this *NewDialysisApiController) GetAllInspection() {
1500
 
1520
 
1501
 	//查询该机构是否存在检验检测项目
1521
 	//查询该机构是否存在检验检测项目
1701
 	fmt.Println("id", id)
1721
 	fmt.Println("id", id)
1702
 	message := this.GetString("message")
1722
 	message := this.GetString("message")
1703
 	fmt.Println("message", message)
1723
 	fmt.Println("message", message)
1724
+	orgid, _ := this.GetInt64("orgid")
1704
 	role := models.SgjUserAdminRole{
1725
 	role := models.SgjUserAdminRole{
1705
 		Message: message,
1726
 		Message: message,
1706
 	}
1727
 	}
1707
-	err := service.SaveMessage(id, &role)
1728
+	err := service.SaveMessage(id, orgid, &role)
1708
 	if err != nil {
1729
 	if err != nil {
1709
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1730
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1710
 		return
1731
 		return
1719
 	fmt.Println("sex", sex)
1740
 	fmt.Println("sex", sex)
1720
 	id, _ := this.GetInt64("id")
1741
 	id, _ := this.GetInt64("id")
1721
 	fmt.Println("id", id)
1742
 	fmt.Println("id", id)
1743
+	orgid, _ := this.GetInt64("orgid")
1722
 	role := models.SgjUserAdminRole{
1744
 	role := models.SgjUserAdminRole{
1723
-		Sex: sex,
1745
+		Sex:   sex,
1746
+		OrgId: orgid,
1724
 	}
1747
 	}
1725
 	err := service.SaveSex(id, &role)
1748
 	err := service.SaveSex(id, &role)
1726
 	if err != nil {
1749
 	if err != nil {
1743
 	timeLayout := "2006-01-02 15:04:05"
1766
 	timeLayout := "2006-01-02 15:04:05"
1744
 	theTime, err := utils.ParseTimeStringToTime(timeLayout, birthday+" 00:00:00")
1767
 	theTime, err := utils.ParseTimeStringToTime(timeLayout, birthday+" 00:00:00")
1745
 	birth := theTime.Unix()
1768
 	birth := theTime.Unix()
1769
+	orgid := dataBody["orgid"].(string)
1770
+	orgids, err := strconv.ParseInt(orgid, 10, 64)
1746
 	role := models.SgjUserAdminRole{
1771
 	role := models.SgjUserAdminRole{
1747
 		Birthday: birth,
1772
 		Birthday: birth,
1773
+		OrgId:    orgids,
1748
 	}
1774
 	}
1749
 	err = service.SaveBirthday(ids, &role)
1775
 	err = service.SaveBirthday(ids, &role)
1750
 	if err != nil {
1776
 	if err != nil {
1772
 func (this *NewDialysisApiController) GetRoleName() {
1798
 func (this *NewDialysisApiController) GetRoleName() {
1773
 	id, _ := this.GetInt64("id")
1799
 	id, _ := this.GetInt64("id")
1774
 	fmt.Println("id", id)
1800
 	fmt.Println("id", id)
1775
-	orgid := this.GetMobileAdminUserInfo().Org.Id
1801
+	orgid, _ := this.GetInt64("orgid")
1776
 	fmt.Println("orgid", orgid)
1802
 	fmt.Println("orgid", orgid)
1777
-	appid := this.GetMobileAdminUserInfo().App.Id
1778
-	fmt.Println("appid", appid)
1779
-	name, err := service.GetRoleName(id, orgid, appid)
1803
+	//跟剧机构ID获取APPID
1804
+	app, _ := service.GetAppId(orgid)
1805
+	name, err := service.GetRoleName(id, orgid, app.Id)
1780
 	//获取管理员
1806
 	//获取管理员
1781
 	admin, err := service.GetAdmin(id)
1807
 	admin, err := service.GetAdmin(id)
1782
-	positionName, err := service.GetPositionName(id, orgid, appid)
1808
+	positionName, err := service.GetPositionName(id, orgid, app.Id)
1809
+	role_ids := strings.Split(positionName.RoleIds, ",")
1810
+	var names = ""
1811
+	for _, item := range role_ids {
1812
+		id, _ := strconv.ParseInt(item, 10, 64)
1813
+		role, _ := service.GetRole(id)
1814
+		if len(role.RoleName) != 0 {
1815
+			names = role.RoleName + "," + names
1816
+		}
1817
+	}
1818
+	fmt.Println("role_ids--------------", role_ids)
1783
 	if err != nil {
1819
 	if err != nil {
1784
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1820
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1785
 		return
1821
 		return
1788
 		"name":         name,
1824
 		"name":         name,
1789
 		"positionName": positionName,
1825
 		"positionName": positionName,
1790
 		"admin":        admin,
1826
 		"admin":        admin,
1827
+		"names":        names,
1791
 	})
1828
 	})
1792
 }
1829
 }
1793
 
1830
 
1986
 }
2023
 }
1987
 
2024
 
1988
 func (this *NewDialysisApiController) LoginOut() {
2025
 func (this *NewDialysisApiController) LoginOut() {
1989
-
1990
-	this.DelSession("mobile_admin_user_info")
1991
 	this.Ctx.SetCookie("logout_cookie", "1")
2026
 	this.Ctx.SetCookie("logout_cookie", "1")
1992
 	this.Ctx.SetCookie("token_cookie", "")
2027
 	this.Ctx.SetCookie("token_cookie", "")
1993
 	id, _ := this.GetInt64("id")
2028
 	id, _ := this.GetInt64("id")
2196
 
2231
 
2197
 func (this *NewDialysisApiController) GetMyInforName() {
2232
 func (this *NewDialysisApiController) GetMyInforName() {
2198
 	id, _ := this.GetInt64("id")
2233
 	id, _ := this.GetInt64("id")
2199
-	Username, err := service.GetAdminName(id)
2234
+	orgid, _ := this.GetInt64("orgid")
2235
+	Username, err := service.GetAdminName(id, orgid)
2200
 	if err != nil {
2236
 	if err != nil {
2201
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2237
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2202
 		return
2238
 		return
2208
 
2244
 
2209
 func (this *NewDialysisApiController) GetMyInformationFour() {
2245
 func (this *NewDialysisApiController) GetMyInformationFour() {
2210
 	adminUserInfo := this.GetMobileAdminUserInfo()
2246
 	adminUserInfo := this.GetMobileAdminUserInfo()
2211
-	creatId := adminUserInfo.AdminUser.Id
2212
-	fmt.Println("创建者ID", creatId)
2247
+	//creatId := adminUserInfo.AdminUser.Id
2248
+	//fmt.Println("创建者ID", creatId)
2213
 	orgid := adminUserInfo.Org.Id
2249
 	orgid := adminUserInfo.Org.Id
2250
+	//跟剧机构ID获取创建者ID
2214
 	fmt.Println("orgid", orgid)
2251
 	fmt.Println("orgid", orgid)
2252
+	//OrgId, _ := service.GetCreatByOrgId(orgid)
2253
+	//fmt.Println("创建者ID", OrgId.Creator)
2254
+	creatId := adminUserInfo.AdminUser.Id
2255
+	fmt.Println("creatid", creatId)
2256
+	fmt.Println("当前机构ID信息", orgid)
2215
 	Username, err := service.GetMyOrgInformationFour(creatId, orgid)
2257
 	Username, err := service.GetMyOrgInformationFour(creatId, orgid)
2216
 	if err != nil {
2258
 	if err != nil {
2217
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2259
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2327
 	fmt.Println("cretor", creator)
2369
 	fmt.Println("cretor", creator)
2328
 	adminInfo := this.GetMobileAdminUserInfo()
2370
 	adminInfo := this.GetMobileAdminUserInfo()
2329
 	appId := adminInfo.App.Id
2371
 	appId := adminInfo.App.Id
2330
-	//fmt.Println("appid------------------------------------",appId)
2331
 	information, err := service.GetMyOrgInformation(creator, appId)
2372
 	information, err := service.GetMyOrgInformation(creator, appId)
2332
 	if err != nil {
2373
 	if err != nil {
2333
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2374
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2341
 func (this *NewDialysisApiController) SaveNameTwo() {
2382
 func (this *NewDialysisApiController) SaveNameTwo() {
2342
 	id, _ := this.GetInt64("id")
2383
 	id, _ := this.GetInt64("id")
2343
 	name := this.GetString("name")
2384
 	name := this.GetString("name")
2344
-	fmt.Println("name------------------", name)
2385
+	orgid, _ := this.GetInt64("orgid")
2345
 	role := models.SgjUserAdminRole{
2386
 	role := models.SgjUserAdminRole{
2346
 		UserName: name,
2387
 		UserName: name,
2347
 	}
2388
 	}
2348
-	err := service.SaveNameTwo(id, &role)
2389
+	err := service.SaveNameTwo(id, orgid, &role)
2390
+	fmt.Println("err", err)
2349
 	if err != nil {
2391
 	if err != nil {
2350
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2392
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2351
 		return
2393
 		return
2382
 		"signToken": signToken,
2424
 		"signToken": signToken,
2383
 	})
2425
 	})
2384
 }
2426
 }
2427
+
2428
+func (this *NewDialysisApiController) GetMyMobile() {
2429
+	id, _ := this.GetInt64("id")
2430
+	mobile, err := service.GetMyMobile(id)
2431
+	if err != nil {
2432
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2433
+		return
2434
+	}
2435
+	this.ServeSuccessJSON(map[string]interface{}{
2436
+		"mobile": mobile,
2437
+	})
2438
+}
2439
+
2440
+func (this *NewDialysisApiController) SumitForm() {
2441
+
2442
+	name := this.GetString("name")
2443
+	fmt.Println("姓名", name)
2444
+	mobile := this.GetString("mobile")
2445
+	fmt.Println("mobile", mobile)
2446
+	address := this.GetString("address")
2447
+	fmt.Println("address", address)
2448
+	positon, _ := this.GetInt64("position")
2449
+	fmt.Println("职位", positon)
2450
+	hospitalName := this.GetString("hospitalName")
2451
+	fmt.Println("医院名称", hospitalName)
2452
+	systemName := this.GetString("systemName")
2453
+	fmt.Println("系统名称", systemName)
2454
+	isUser, _ := this.GetInt64("isUser")
2455
+	fmt.Println("是否使用", isUser)
2456
+	isThink, _ := this.GetInt64("isThink")
2457
+	fmt.Println("是否考虑", isThink)
2458
+	result := this.GetString("result")
2459
+	fmt.Println("result", result)
2460
+	otherRemark := this.GetString("otherRemark")
2461
+	fmt.Println("result", otherRemark)
2462
+	otherMessage := this.GetString("otherMessage")
2463
+	fmt.Println("otherMessage", otherMessage)
2464
+	gift, _ := this.GetInt64("gift")
2465
+	fmt.Println("gift", gift)
2466
+	admininfo := this.GetMobileAdminUserInfo()
2467
+	creator := admininfo.AdminUser.Id
2468
+	fmt.Println("创建者", creator)
2469
+	_, errcode := service.GetActivtyCreator(creator)
2470
+	if errcode == gorm.ErrRecordNotFound {
2471
+		table := models.KyActivityTable{
2472
+			Name:         name,
2473
+			Phone:        mobile,
2474
+			Address:      address,
2475
+			Position:     positon,
2476
+			HospitalName: hospitalName,
2477
+			SystemName:   systemName,
2478
+			IsUser:       isUser,
2479
+			IsThink:      isThink,
2480
+			OtherMode:    result,
2481
+			OtherRemark:  otherRemark,
2482
+			OtherMessage: otherMessage,
2483
+			Gift:         gift,
2484
+			AdminUserId:  creator,
2485
+			Status:       1,
2486
+			Ctime:        time.Now().Unix(),
2487
+		}
2488
+		err := service.CreateTable(&table)
2489
+		if err != nil {
2490
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2491
+			return
2492
+		}
2493
+		this.ServeSuccessJSON(map[string]interface{}{
2494
+			"table": table,
2495
+		})
2496
+	} else if errcode == nil {
2497
+		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2498
+		this.ServeJSON()
2499
+		return
2500
+	} else {
2501
+		return
2502
+	}
2503
+}
2504
+
2505
+func (this *NewDialysisApiController) GetMobile() {
2506
+	fmt.Println("--------------触发了没有")
2507
+	adminInfo := this.GetMobileAdminUserInfo()
2508
+	id := adminInfo.AdminUser.Id
2509
+
2510
+	mobile, err := service.GetMobile(id)
2511
+	if err != nil {
2512
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2513
+		return
2514
+	}
2515
+	this.ServeSuccessJSON(map[string]interface{}{
2516
+		"mobile": mobile,
2517
+	})
2518
+}
2519
+
2520
+func (this *NewDialysisApiController) GetRolePosition() {
2521
+
2522
+	adminInfo := this.GetMobileAdminUserInfo()
2523
+	cretor := adminInfo.AdminUser.Id
2524
+	cretorPosition, err := service.GetRolePosition(cretor)
2525
+	fmt.Println("cretorPosition", cretorPosition.RoleName)
2526
+	if err != nil {
2527
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2528
+		return
2529
+	}
2530
+	this.ServeSuccessJSON(map[string]interface{}{
2531
+		"cretorPosition": cretorPosition,
2532
+	})
2533
+}

+ 5 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Ver arquivo

101
 	beego.Router("/m/api/patient/deletemanagement", &NewDialysisApiController{}, "Delete:DeleteManagement")
101
 	beego.Router("/m/api/patient/deletemanagement", &NewDialysisApiController{}, "Delete:DeleteManagement")
102
 	beego.Router("/m/api/patient/updatedpatient", &NewDialysisApiController{}, "Post:UpdatedPatient")
102
 	beego.Router("/m/api/patient/updatedpatient", &NewDialysisApiController{}, "Post:UpdatedPatient")
103
 	beego.Router("/m/api/patient/getalldoctor", &NewDialysisApiController{}, "Get:GetAllDoctor")
103
 	beego.Router("/m/api/patient/getalldoctor", &NewDialysisApiController{}, "Get:GetAllDoctor")
104
+	beego.Router("/m/api/patient/getallprojectname", &NewDialysisApiController{}, "Get:GetAllProjectName")
104
 	beego.Router("/m/api/patient/getallinspection", &NewDialysisApiController{}, "Get:GetAllInspection")
105
 	beego.Router("/m/api/patient/getallinspection", &NewDialysisApiController{}, "Get:GetAllInspection")
105
 	beego.Router("/m/api/patient/getinspection", &NewDialysisApiController{}, "Get:GetInspection")
106
 	beego.Router("/m/api/patient/getinspection", &NewDialysisApiController{}, "Get:GetInspection")
106
 	beego.Router("/m/api/patient/getmyinformation", &NewDialysisApiController{}, "Get:GetMyInformation")
107
 	beego.Router("/m/api/patient/getmyinformation", &NewDialysisApiController{}, "Get:GetMyInformation")
148
 	beego.Router("/m/api/patient/savenametwo", &NewDialysisApiController{}, "Get:SaveNameTwo")
149
 	beego.Router("/m/api/patient/savenametwo", &NewDialysisApiController{}, "Get:SaveNameTwo")
149
 	beego.Router("/m/api/patient/getcurrentorg", &NewDialysisApiController{}, "Get:GetCurrentOrg")
150
 	beego.Router("/m/api/patient/getcurrentorg", &NewDialysisApiController{}, "Get:GetCurrentOrg")
150
 	beego.Router("/m/api/patient/getmyinformationfour", &NewDialysisApiController{}, "Get:GetMyInformationFour")
151
 	beego.Router("/m/api/patient/getmyinformationfour", &NewDialysisApiController{}, "Get:GetMyInformationFour")
152
+	beego.Router("/m/api/org/getMyMobile", &NewDialysisApiController{}, "Get:GetMyMobile")
153
+	beego.Router("/m/api/patient/sumitform", &NewDialysisApiController{}, "Get:SumitForm")
154
+	beego.Router("/m/api/patient/getroleposition", &NewDialysisApiController{}, "Get:GetRolePosition")
155
+	beego.Router("/m/api/patient/getmobile", &NewDialysisApiController{}, "Get:GetMobile")
151
 }
156
 }

+ 2 - 2
controllers/new_mobile_api_controllers/patient.json Ver arquivo

15
       "nation": "汉",
15
       "nation": "汉",
16
       "native_place": "广东深圳",
16
       "native_place": "广东深圳",
17
       "marital_status": 1,
17
       "marital_status": 1,
18
-      "id_card_no": "431230199808081111",
18
+      "id_card_no": "999999190001019999",
19
       "birthday": -312537600,
19
       "birthday": -312537600,
20
       "reimbursement_way_id": 7,
20
       "reimbursement_way_id": 7,
21
       "health_care_type": 0,
21
       "health_care_type": 0,
95
       "nation": "汉",
95
       "nation": "汉",
96
       "native_place": "广东深圳",
96
       "native_place": "广东深圳",
97
       "marital_status": 1,
97
       "marital_status": 1,
98
-      "id_card_no": "4312301999090952222",
98
+      "id_card_no": "999999190001018888",
99
       "birthday": -312537600,
99
       "birthday": -312537600,
100
       "reimbursement_way_id": 7,
100
       "reimbursement_way_id": 7,
101
       "health_care_type": 0,
101
       "health_care_type": 0,

+ 6 - 17
controllers/new_mobile_api_controllers/role.json Ver arquivo

7
       "status": 1,
7
       "status": 1,
8
       "is_system": 1,
8
       "is_system": 1,
9
       "number": 9999,
9
       "number": 9999,
10
-      "purview_ids": "71,72,70,74,75,73,48,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102",
10
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102,83,94",
11
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
11
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
12
     },
12
     },
13
     {
13
     {
19
       "number": 9998,
19
       "number": 9998,
20
       "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
20
       "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
21
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
21
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
22
-
23
-
24
     },
22
     },
25
     {
23
     {
26
       "role_name": "护士",
24
       "role_name": "护士",
29
       "status": 1,
27
       "status": 1,
30
       "is_system": 3,
28
       "is_system": 3,
31
       "number": 9997,
29
       "number": 9997,
32
-      "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76",
33
-      "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029"
34
-    },
35
-    {
30
+      "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76,83,94",
31
+      "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029,20055,20056,20052,20012"
32
+    },{
36
       "role_name": "库存",
33
       "role_name": "库存",
37
       "role_introduction": "库存角色负责透析耗材的日常管理,对耗材的入库、出库、退库的登记操作",
34
       "role_introduction": "库存角色负责透析耗材的日常管理,对耗材的入库、出库、退库的登记操作",
38
       "is_super_admin": false,
35
       "is_super_admin": false,
39
       "status": 1,
36
       "status": 1,
40
       "is_system": 0,
37
       "is_system": 0,
41
       "number": 9996,
38
       "number": 9996,
42
-      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84",
39
+      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84,83,94",
43
       "func_ids": ""
40
       "func_ids": ""
44
-
45
-
46
-
47
     },{
41
     },{
48
       "role_name": "运营",
42
       "role_name": "运营",
49
       "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
43
       "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
53
       "number": 9995,
47
       "number": 9995,
54
       "purview_ids": "48,110,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
48
       "purview_ids": "48,110,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
55
       "func_ids": ""
49
       "func_ids": ""
56
-
57
-
58
-
59
     },{
50
     },{
60
       "role_name": "技师",
51
       "role_name": "技师",
61
       "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
52
       "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
65
       "number": 9994,
56
       "number": 9994,
66
       "purview_ids": "77,78,79,80,197,76",
57
       "purview_ids": "77,78,79,80,197,76",
67
       "func_ids": ""
58
       "func_ids": ""
68
-
69
-
70
     },
59
     },
71
     {
60
     {
72
       "role_name": "院长",
61
       "role_name": "院长",
75
       "status": 1,
64
       "status": 1,
76
       "is_system": 0,
65
       "is_system": 0,
77
       "number": 9993,
66
       "number": 9993,
78
-      "purview_ids": "71,72,70,74,75,73,48,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
67
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201,83,94",
79
       "func_ids": ""
68
       "func_ids": ""
80
 
69
 
81
 
70
 

+ 99 - 94
controllers/patient_api_controller.go Ver arquivo

243
 	//获取老表的最后一条数据
243
 	//获取老表的最后一条数据
244
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
244
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
245
 	patientsNew := models.XtPatientsNew{
245
 	patientsNew := models.XtPatientsNew{
246
-		UserOrgId:                    adminUserInfo.CurrentOrgId,
247
-		UserId:                       0,
248
-		Avatar:                       patients.Avatar,
249
-		PatientType:                  patients.PatientType,
250
-		DialysisNo:                   patients.DialysisNo,
251
-		AdmissionNumber:              patients.AdmissionNumber,
252
-		Source:                       patients.Source,
253
-		Lapseto:                      patients.Lapseto,
254
-		PartitionId:                  patients.PartitionId,
255
-		BedId:                        patients.BedId,
256
-		Name:                         patients.Name,
257
-		Alias:                        patients.Alias,
258
-		Gender:                       patients.Gender,
259
-		MaritalStatus:                patients.MaritalStatus,
260
-		IdCardNo:                     patients.IdCardNo,
261
-		Birthday:                     patients.Birthday,
262
-		ReimbursementWayId:           patients.ReimbursementWayId,
263
-		HealthCareType:               patients.HealthCareType,
264
-		HealthCareNo:                 patients.HealthCareNo,
265
-		HealthCareDueDate:            patients.HealthCareDueDate,
266
-		Height:                       patients.Height,
267
-		BloodType:                    patients.BloodType,
268
-		Rh:                           patients.Rh,
246
+		UserOrgId:          adminUserInfo.CurrentOrgId,
247
+		UserId:             0,
248
+		Avatar:             patients.Avatar,
249
+		PatientType:        patients.PatientType,
250
+		DialysisNo:         patients.DialysisNo,
251
+		AdmissionNumber:    patients.AdmissionNumber,
252
+		Source:             patients.Source,
253
+		Lapseto:            patients.Lapseto,
254
+		PartitionId:        patients.PartitionId,
255
+		BedId:              patients.BedId,
256
+		Name:               patients.Name,
257
+		Alias:              patients.Alias,
258
+		Gender:             patients.Gender,
259
+		MaritalStatus:      patients.MaritalStatus,
260
+		IdCardNo:           patients.IdCardNo,
261
+		Birthday:           patients.Birthday,
262
+		ReimbursementWayId: patients.ReimbursementWayId,
263
+		HealthCareType:     patients.HealthCareType,
264
+		HealthCareNo:       patients.HealthCareNo,
265
+		HealthCareDueDate:  patients.HealthCareDueDate,
266
+		Height:             patients.Height,
267
+		BloodType:          patients.BloodType,
268
+		Rh:                 patients.Rh,
269
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
269
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
270
 		EducationLevel:               patients.EducationLevel,
270
 		EducationLevel:               patients.EducationLevel,
271
 		Profession:                   patients.Profession,
271
 		Profession:                   patients.Profession,
311
 		Nation:                       patients.Nation,
311
 		Nation:                       patients.Nation,
312
 		NativePlace:                  patients.NativePlace,
312
 		NativePlace:                  patients.NativePlace,
313
 		Age:                          patients.Age,
313
 		Age:                          patients.Age,
314
-		InfectiousNextRecordTime:     patients.InfectiousNextRecordTime,
315
-		IsInfectious:                 patients.IsInfectious,
316
-		RemindCycle:                  patients.RemindCycle,
317
-		ResponseResult:               patients.ResponseResult,
318
-		IsOpenRemind:                 patients.IsOpenRemind,
319
-		FirstTreatmentDate:           patients.FirstTreatmentDate,
320
-		DialysisAge:                  patients.DialysisAge,
321
-		ExpenseKind:                  patients.ExpenseKind,
322
-		TellPhone:                    patients.TellPhone,
323
-		ContactName:                  patients.ContactName,
324
-		BloodPatients:                1,
325
-		SlowPatients:                 0,
326
-		MemberPatients:               0,
327
-		EcommerPatients:              "",
328
-		BloodId:                      patients.ID,
329
-		SlowId:                       0,
330
-		MemberId:                     0,
331
-		MemberFistdate:               0,
332
-		MemberPatienttype:            0,
333
-		MemberTreatement:             0,
334
-		EquitmentId:                  "",
314
+		InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
315
+		IsInfectious:             patients.IsInfectious,
316
+		RemindCycle:              patients.RemindCycle,
317
+		ResponseResult:           patients.ResponseResult,
318
+		IsOpenRemind:             patients.IsOpenRemind,
319
+		FirstTreatmentDate:       patients.FirstTreatmentDate,
320
+		DialysisAge:              patients.DialysisAge,
321
+		ExpenseKind:              patients.ExpenseKind,
322
+		TellPhone:                patients.TellPhone,
323
+		ContactName:              patients.ContactName,
324
+		BloodPatients:            1,
325
+		SlowPatients:             0,
326
+		MemberPatients:           0,
327
+		EcommerPatients:          "",
328
+		BloodId:                  patients.ID,
329
+		SlowId:                   0,
330
+		MemberId:                 0,
331
+		MemberFistdate:           0,
332
+		MemberPatienttype:        0,
333
+		MemberTreatement:         0,
334
+		EquitmentId:              "",
335
 	}
335
 	}
336
 
336
 
337
 	err = service.CreatePatientsNew(&patientsNew)
337
 	err = service.CreatePatientsNew(&patientsNew)
459
 	}
459
 	}
460
 	fmt.Println("病人--------------------------------------------------------------", patient.Name, patient.Age)
460
 	fmt.Println("病人--------------------------------------------------------------", patient.Name, patient.Age)
461
 	patientsNew := models.XtPatientsNew{
461
 	patientsNew := models.XtPatientsNew{
462
-		UserOrgId:                 patient.UserOrgId,
463
-		UserId:                    patient.UserId,
464
-		Avatar:                    patient.Avatar,
465
-		PatientType:               patient.PatientType,
466
-		DialysisNo:                patient.DialysisNo,
467
-		AdmissionNumber:           patient.AdmissionNumber,
468
-		Source:                    patient.Source,
469
-		Lapseto:                   patient.Lapseto,
470
-		PartitionId:               patient.PartitionId,
471
-		BedId:                     patient.BedId,
472
-		Name:                      patient.Name,
473
-		Alias:                     patient.Alias,
474
-		Gender:                    patient.Gender,
475
-		MaritalStatus:             patient.MaritalStatus,
476
-		IdCardNo:                  patient.IdCardNo,
477
-		Birthday:                  patient.Birthday,
478
-		ReimbursementWayId:        patient.ReimbursementWayId,
479
-		HealthCareType:            patient.HealthCareType,
480
-		HealthCareNo:              patient.HealthCareNo,
481
-		HealthCareDueDate:         patient.HealthCareDueDate,
482
-		Height:                    patient.Height,
483
-		BloodType:                 patient.BloodType,
484
-		Rh:                        patient.Rh,
462
+		UserOrgId:          patient.UserOrgId,
463
+		UserId:             patient.UserId,
464
+		Avatar:             patient.Avatar,
465
+		PatientType:        patient.PatientType,
466
+		DialysisNo:         patient.DialysisNo,
467
+		AdmissionNumber:    patient.AdmissionNumber,
468
+		Source:             patient.Source,
469
+		Lapseto:            patient.Lapseto,
470
+		PartitionId:        patient.PartitionId,
471
+		BedId:              patient.BedId,
472
+		Name:               patient.Name,
473
+		Alias:              patient.Alias,
474
+		Gender:             patient.Gender,
475
+		MaritalStatus:      patient.MaritalStatus,
476
+		IdCardNo:           patient.IdCardNo,
477
+		Birthday:           patient.Birthday,
478
+		ReimbursementWayId: patient.ReimbursementWayId,
479
+		HealthCareType:     patient.HealthCareType,
480
+		HealthCareNo:       patient.HealthCareNo,
481
+		HealthCareDueDate:  patient.HealthCareDueDate,
482
+		Height:             patient.Height,
483
+		BloodType:          patient.BloodType,
484
+		Rh:                 patient.Rh,
485
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
485
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
486
 		EducationLevel:            patient.EducationLevel,
486
 		EducationLevel:            patient.EducationLevel,
487
 		Profession:                patient.Profession,
487
 		Profession:                patient.Profession,
523
 		Nation:                    patient.Nation,
523
 		Nation:                    patient.Nation,
524
 		NativePlace:               patient.NativePlace,
524
 		NativePlace:               patient.NativePlace,
525
 		Age:                       patient.Age,
525
 		Age:                       patient.Age,
526
-		InfectiousNextRecordTime:  patient.InfectiousNextRecordTime,
527
-		IsInfectious:              patient.IsInfectious,
528
-		RemindCycle:               patient.RemindCycle,
529
-		ResponseResult:            patient.ResponseResult,
530
-		IsOpenRemind:              patient.IsOpenRemind,
531
-		FirstTreatmentDate:        patient.FirstTreatmentDate,
532
-		DialysisAge:               patient.DialysisAge,
533
-		ExpenseKind:               patient.ExpenseKind,
534
-		TellPhone:                 patient.TellPhone,
535
-		ContactName:               patient.ContactName,
536
-		UpdatedTime:               time.Now().Unix(),
526
+		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
527
+		IsInfectious:             patient.IsInfectious,
528
+		RemindCycle:              patient.RemindCycle,
529
+		ResponseResult:           patient.ResponseResult,
530
+		IsOpenRemind:             patient.IsOpenRemind,
531
+		FirstTreatmentDate:       patient.FirstTreatmentDate,
532
+		DialysisAge:              patient.DialysisAge,
533
+		ExpenseKind:              patient.ExpenseKind,
534
+		TellPhone:                patient.TellPhone,
535
+		ContactName:              patient.ContactName,
536
+		UpdatedTime:              time.Now().Unix(),
537
 	}
537
 	}
538
 	//	//更新病人ID获取新表病人ID
538
 	//	//更新病人ID获取新表病人ID
539
 	err = service.UpdatepatientTwo(&patientsNew, id)
539
 	err = service.UpdatepatientTwo(&patientsNew, id)
1060
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1060
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1061
 		return
1061
 		return
1062
 	}
1062
 	}
1063
-	adviceDate, _ := dataBody["advice_date"].(string)
1063
+
1064
+	if dataBody["start_time"] == nil || reflect.TypeOf(dataBody["start_time"]).String() != "string" {
1065
+		utils.ErrorLog("start_time")
1066
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1067
+		return
1068
+	}
1069
+
1070
+	startTime2, _ := dataBody["start_time"].(string)
1071
+
1072
+	time_arr := strings.Split(startTime2, " ")
1073
+
1074
+	if len(time_arr) > 0 {
1075
+		startTime2 = time_arr[0]
1076
+	}
1077
+
1078
+	if dataBody["advice_date"] == nil || reflect.TypeOf(dataBody["advice_date"]).String() != "string" {
1079
+		utils.ErrorLog("advice_date")
1080
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1081
+		return
1082
+	}
1083
+	adviceDate := startTime2
1064
 	if len(adviceDate) == 0 {
1084
 	if len(adviceDate) == 0 {
1065
 		utils.ErrorLog("len(adviceDate) == 0")
1085
 		utils.ErrorLog("len(adviceDate) == 0")
1066
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1086
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1547
 		return
1567
 		return
1548
 	}
1568
 	}
1549
 
1569
 
1550
-	if advice.ExecutionStaff == 0 {
1551
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceCheckBeforeExce)
1552
-		return
1553
-	}
1554
-
1555
 	if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
1570
 	if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
1556
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
1571
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
1557
 		return
1572
 		return
1561
 
1576
 
1562
 	theTime := time.Now()
1577
 	theTime := time.Now()
1563
 
1578
 
1564
-	//if advice.ExecutionTime > theTime.Unix() {
1565
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
1566
-	//	return
1567
-	//}
1568
-
1569
 	exceAdvice := models.DoctorAdvice{
1579
 	exceAdvice := models.DoctorAdvice{
1570
 		Checker:     checker,
1580
 		Checker:     checker,
1571
 		CheckTime:   theTime.Unix(),
1581
 		CheckTime:   theTime.Unix(),
1614
 		return
1624
 		return
1615
 	}
1625
 	}
1616
 
1626
 
1617
-	if advice.ExecutionStaff == 0 {
1618
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceCheckBeforeExce)
1619
-		return
1620
-	}
1621
-
1622
 	if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
1627
 	if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
1623
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
1628
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
1624
 		return
1629
 		return

+ 63 - 60
controllers/public_api_controller.go Ver arquivo

165
 func (c *PublicApiController) HandleData() {
165
 func (c *PublicApiController) HandleData() {
166
 	//org_app, _ := service.GetAllAppOrg()
166
 	//org_app, _ := service.GetAllAppOrg()
167
 	//org_role, _ := service.GetAllRole()
167
 	//org_role, _ := service.GetAllRole()
168
-
168
+	//
169
 	//var org_ids []int64
169
 	//var org_ids []int64
170
 
170
 
171
 	//for _, apps := range org_app {
171
 	//for _, apps := range org_app {
468
 	//			continue
468
 	//			continue
469
 	//		}
469
 	//		}
470
 	//
470
 	//
471
-	//
472
 	//		app.OrgId = apps.OrgId
471
 	//		app.OrgId = apps.OrgId
473
 	//		app.Creator = int(org.Creator)
472
 	//		app.Creator = int(org.Creator)
474
 	//		app.Pid = xt_temp_org_app.Id
473
 	//		app.Pid = xt_temp_org_app.Id
490
 	//InitRoleAndPurviews(org_ids)
489
 	//InitRoleAndPurviews(org_ids)
491
 
490
 
492
 	//var org_id int = 0
491
 	//var org_id int = 0
493
-	////管理员
492
+	//管理员
494
 	//app_roles  := service.GetAllUserRoleByUserTypeOne(org_id)
493
 	//app_roles  := service.GetAllUserRoleByUserTypeOne(org_id)
495
 	//for _, item := range app_roles{
494
 	//for _, item := range app_roles{
496
 	//	var ids string
495
 	//	var ids string
501
 	//	}
500
 	//	}
502
 	//	service.UpdateRoleIds(item.Id, ids)
501
 	//	service.UpdateRoleIds(item.Id, ids)
503
 	//}
502
 	//}
504
-	////护士医生
503
+	//护士医生
505
 	//app_roles2  := service.GetAllUserRoleByUserTypeOther()
504
 	//app_roles2  := service.GetAllUserRoleByUserTypeOther()
506
-	//	//for _, item := range app_roles2{
507
-	//	//	var ids string
508
-	//	//	if len(item.RoleIds) == 0{
509
-	//	//		ids = strconv.FormatInt( item.RoleId,10)
510
-	//	//	}else{
511
-	//	//		ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
512
-	//	//	}
513
-	//	//	if item.UserType == 2{
514
-	//	//		role := service.FindRoleByUserTypeOne(item.OrgId)
515
-	//	//		ids = ids +"," + strconv.FormatInt(role.Id,10)
516
-	//	//
517
-	//	//	} else if item.UserType == 3{
518
-	//	//		role := service.FindRoleByUserTypeTwo(item.OrgId)
519
-	//	//		ids = ids +"," + strconv.FormatInt(role.Id,10)
520
-	//	//	}
521
-	//	//	service.UpdateRoleIds(item.Id, ids)
522
-	//	//}
523
-	c.ServeSuccessJSON(map[string]interface{}{
524
-		"msg": "ok",
525
-	})
505
+	//	for _, item := range app_roles2{
506
+	//		var ids string
507
+	//		if len(item.RoleIds) == 0{
508
+	//			ids = strconv.FormatInt( item.RoleId,10)
509
+	//		}else{
510
+	//			ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
511
+	//		}
512
+	//		if item.UserType == 2{
513
+	//			role := service.FindRoleByUserTypeOne(item.OrgId)
514
+	//			ids = ids +"," + strconv.FormatInt(role.Id,10)
515
+	//
516
+	//		} else if item.UserType == 3{
517
+	//			role := service.FindRoleByUserTypeTwo(item.OrgId)
518
+	//			ids = ids +"," + strconv.FormatInt(role.Id,10)
519
+	//		}
520
+	//		service.UpdateRoleIds(item.Id, ids)
521
+	//	}
522
+	//c.ServeSuccessJSON(map[string]interface{}{
523
+	//	"msg": "ok",
524
+	//})
526
 
525
 
527
 }
526
 }
528
 
527
 
530
 	roles := LoadRoleConfig("./role.json").Roles
529
 	roles := LoadRoleConfig("./role.json").Roles
531
 	for _, org_id := range org_ids {
530
 	for _, org_id := range org_ids {
532
 		app, _ := service.GetOrgAppB(org_id, 3)
531
 		app, _ := service.GetOrgAppB(org_id, 3)
532
+		role, _ := service.GetSystemRole(org_id)
533
+
533
 		if app == nil || app.Id == 0 {
534
 		if app == nil || app.Id == 0 {
534
 			continue
535
 			continue
535
 		}
536
 		}
536
-		for _, item := range roles {
537
-			role := &models.Role{
538
-				RoleName:     item.RoleName,
539
-				RoleIntro:    item.RoleIntroduction,
540
-				Creator:      0,
541
-				OrgId:        org_id,
542
-				AppId:        app.Id,
543
-				IsSuperAdmin: false,
544
-				Status:       1,
545
-				CreateTime:   time.Now().Unix(),
546
-				ModifyTime:   time.Now().Unix(),
547
-				Number:       item.Number,
548
-				IsSystem:     item.IsSystem,
549
-			}
550
-			err := service.CreateOrgRoleB(role)
551
-			if err == nil {
552
-				purview := &models.RolePurview{
553
-					RoleId:     role.Id,
554
-					OrgId:      org_id,
555
-					AppId:      role.AppId,
556
-					PurviewIds: item.PurviewIds,
557
-					Status:     1,
558
-					CreateTime: time.Now().Unix(),
559
-					ModifyTime: time.Now().Unix(),
537
+		if len(role) == 0 {
538
+			for _, item := range roles {
539
+				role := &models.Role{
540
+					RoleName:     item.RoleName,
541
+					RoleIntro:    item.RoleIntroduction,
542
+					Creator:      0,
543
+					OrgId:        org_id,
544
+					AppId:        app.Id,
545
+					IsSuperAdmin: false,
546
+					Status:       1,
547
+					CreateTime:   time.Now().Unix(),
548
+					ModifyTime:   time.Now().Unix(),
549
+					Number:       item.Number,
550
+					IsSystem:     item.IsSystem,
560
 				}
551
 				}
561
-				func_purview := &models.SgjUserRoleFuncPurview{
562
-					RoleId:     role.Id,
563
-					OrgId:      org_id,
564
-					AppId:      role.AppId,
565
-					PurviewIds: item.FuncIds,
566
-					Status:     1,
567
-					Ctime:      time.Now().Unix(),
568
-					Mtime:      time.Now().Unix(),
552
+				err := service.CreateOrgRoleB(role)
553
+				if err == nil {
554
+					purview := &models.RolePurview{
555
+						RoleId:     role.Id,
556
+						OrgId:      org_id,
557
+						AppId:      role.AppId,
558
+						PurviewIds: item.PurviewIds,
559
+						Status:     1,
560
+						CreateTime: time.Now().Unix(),
561
+						ModifyTime: time.Now().Unix(),
562
+					}
563
+					func_purview := &models.SgjUserRoleFuncPurview{
564
+						RoleId:     role.Id,
565
+						OrgId:      org_id,
566
+						AppId:      role.AppId,
567
+						PurviewIds: item.FuncIds,
568
+						Status:     1,
569
+						Ctime:      time.Now().Unix(),
570
+						Mtime:      time.Now().Unix(),
571
+					}
572
+
573
+					service.CreateRolePurviewB(purview)
574
+					service.CreateFuncRolePurviewB(func_purview)
569
 				}
575
 				}
570
-
571
-				service.CreateRolePurviewB(purview)
572
-				service.CreateFuncRolePurviewB(func_purview)
573
 			}
576
 			}
574
-		}
575
 
577
 
578
+		}
576
 	}
579
 	}
577
 
580
 
578
 }
581
 }

+ 40 - 5
controllers/role.json Ver arquivo

7
       "status": 1,
7
       "status": 1,
8
       "is_system": 1,
8
       "is_system": 1,
9
       "number": 9999,
9
       "number": 9999,
10
-      "purview_ids": "71,72,70,74,75,73,48,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102",
10
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102,83,94",
11
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
11
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
12
     },
12
     },
13
     {
13
     {
19
       "number": 9998,
19
       "number": 9998,
20
       "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
20
       "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
21
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
21
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
22
-
23
-
24
     },
22
     },
25
     {
23
     {
26
       "role_name": "护士",
24
       "role_name": "护士",
29
       "status": 1,
27
       "status": 1,
30
       "is_system": 3,
28
       "is_system": 3,
31
       "number": 9997,
29
       "number": 9997,
32
-      "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76",
33
-      "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029"
30
+      "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76,83,94",
31
+      "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029,20055,20056,20052,20012"
32
+    },{
33
+      "role_name": "库存",
34
+      "role_introduction": "库存角色负责透析耗材的日常管理,对耗材的入库、出库、退库的登记操作",
35
+      "is_super_admin": false,
36
+      "status": 1,
37
+      "is_system": 0,
38
+      "number": 9996,
39
+      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84,94",
40
+      "func_ids": ""
41
+    },{
42
+      "role_name": "运营",
43
+      "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
44
+      "is_super_admin": false,
45
+      "status": 1,
46
+      "is_system": 0,
47
+      "number": 9995,
48
+      "purview_ids": "48,110,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
49
+      "func_ids": ""
50
+    },{
51
+      "role_name": "技师",
52
+      "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
53
+      "is_super_admin": false,
54
+      "status": 1,
55
+      "is_system": 0,
56
+      "number": 9994,
57
+      "purview_ids": "77,78,79,80,197,76",
58
+      "func_ids": ""
59
+    },
60
+    {
61
+      "role_name": "院长",
62
+      "role_introduction": "院长角色了解血透患者血液透析质量和相关的大数据,以及掌握透析中心整体运营情况",
63
+      "is_super_admin": false,
64
+      "status": 1,
65
+      "is_system": 0,
66
+      "number": 9993,
67
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201,94",
68
+      "func_ids": ""
34
     }
69
     }
35
   ]
70
   ]
36
 }
71
 }

+ 27 - 1
controllers/verify_login_controller.go Ver arquivo

8
 	"fmt"
8
 	"fmt"
9
 	"github.com/astaxie/beego"
9
 	"github.com/astaxie/beego"
10
 	"net/url"
10
 	"net/url"
11
+	"regexp"
11
 	"strconv"
12
 	"strconv"
12
 	"strings"
13
 	"strings"
13
 )
14
 )
186
 						var ids string
187
 						var ids string
187
 						for _, role_id := range role_arr {
188
 						for _, role_id := range role_arr {
188
 							id, _ := strconv.ParseInt(role_id, 10, 64)
189
 							id, _ := strconv.ParseInt(role_id, 10, 64)
190
+							role, _ := service.GetRoleByRoleID(id)
191
+							var system_ids = ""
192
+							if role.RoleName == "子管理员" && role.IsSystem > 0 {
193
+								purviews, _ := service.GetSystemPurview()
194
+								for _, purview := range purviews {
195
+									if len(system_ids) == 0 {
196
+										system_ids = strconv.FormatInt(purview.Id, 10)
197
+									} else {
198
+										system_ids = system_ids + "," + strconv.FormatInt(purview.Id, 10)
199
+									}
200
+								}
201
+							}
189
 							purview_ids, _ := service.GetRolePurviewIds(id)
202
 							purview_ids, _ := service.GetRolePurviewIds(id)
190
 							if len(ids) == 0 {
203
 							if len(ids) == 0 {
191
 								ids = purview_ids
204
 								ids = purview_ids
192
 							} else {
205
 							} else {
193
 								ids = ids + "," + purview_ids
206
 								ids = ids + "," + purview_ids
194
 							}
207
 							}
208
+
209
+							if len(system_ids) > 0 {
210
+								ids = ids + "," + system_ids
211
+							}
195
 						}
212
 						}
196
 						if len(ids) != 0 {
213
 						if len(ids) != 0 {
197
-							pruviews, _ = service.GetPurviewById(ids)
214
+							pruviews, _ = service.GetPurviewById(CompressStr(ids))
198
 							for _, item := range pruviews {
215
 							for _, item := range pruviews {
199
 								if item.Module == 3 && item.Parentid > 0 {
216
 								if item.Module == 3 && item.Parentid > 0 {
200
 									fmt.Println(item.Urlfor)
217
 									fmt.Println(item.Urlfor)
361
 		"msg": "密码已修改",
378
 		"msg": "密码已修改",
362
 	})
379
 	})
363
 }
380
 }
381
+
382
+func CompressStr(str string) string {
383
+	if str == "" {
384
+		return ""
385
+	}
386
+	//匹配一个或多个空白符的正则表达式
387
+	reg := regexp.MustCompile("\\s+")
388
+	return reg.ReplaceAllString(str, "")
389
+}

+ 3 - 0
models/device_models.go Ver arquivo

832
 	AssessmentTime                  int64   `gorm:"column:assessment_time" json:"assessment_time" form:"assessment_time"`
832
 	AssessmentTime                  int64   `gorm:"column:assessment_time" json:"assessment_time" form:"assessment_time"`
833
 	IsEat                           int64   `gorm:"column:is_eat" json:"is_eat" form:"is_eat"`
833
 	IsEat                           int64   `gorm:"column:is_eat" json:"is_eat" form:"is_eat"`
834
 	DialysisIntakesUnit             int64   `gorm:"column:dialysis_intakes_unit" json:"dialysis_intakes_unit" form:"dialysis_intakes_unit"`
834
 	DialysisIntakesUnit             int64   `gorm:"column:dialysis_intakes_unit" json:"dialysis_intakes_unit" form:"dialysis_intakes_unit"`
835
+	CvcA                            float64 `gorm:"column:cvc_a" json:"cvc_a" form:"cvc_a"`
836
+	CvcB                            float64 `gorm:"column:cvc_b" json:"cvc_b" form:"cvc_b"`
837
+	Channel                         int64   `gorm:"column:channel" json:"channel" form:"channel"`
835
 }
838
 }
836
 
839
 
837
 func (XtAssessmentAfterDislysis) TableName() string {
840
 func (XtAssessmentAfterDislysis) TableName() string {

+ 20 - 16
models/dialysis.go Ver arquivo

545
 	AssessmentDoctor                int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
545
 	AssessmentDoctor                int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
546
 	IsEat                           int64   `gorm:"column:is_eat" json:"is_eat"`
546
 	IsEat                           int64   `gorm:"column:is_eat" json:"is_eat"`
547
 	DialysisIntakesUnit             int64   `gorm:"column:dialysis_intakes_unit" json:"dialysis_intakes_unit"`
547
 	DialysisIntakesUnit             int64   `gorm:"column:dialysis_intakes_unit" json:"dialysis_intakes_unit"`
548
+	CvcA                            float64 `gorm:"column:cvc_a" json:"cvc_a" form:"cvc_a"`
549
+	CvcB                            float64 `gorm:"column:cvc_b" json:"cvc_b" form:"cvc_b"`
550
+	Channel                         int64   `gorm:"column:channel" json:"channel" form:"channel"`
548
 }
551
 }
549
 
552
 
550
 func (AssessmentAfterDislysis) TableName() string {
553
 func (AssessmentAfterDislysis) TableName() string {
804
 }
807
 }
805
 
808
 
806
 type SgjUserAdminRole struct {
809
 type SgjUserAdminRole struct {
807
-	ID          int64  `gorm:"column:id" json:"id" form:"id"`
808
-	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
809
-	OrgId       int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
810
-	AppId       int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
811
-	RoleId      int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
812
-	UserName    string `gorm:"column:user_name" json:"user_name" form:"user_name"`
813
-	Avatar      string `gorm:"column:avatar" json:"avatar" form:"avatar"`
814
-	UserType    int64  `gorm:"column:user_type" json:"user_type" form:"user_type"`
815
-	UserTitle   int64  `gorm:"column:user_title" json:"user_title" form:"user_title"`
816
-	Intro       string `gorm:"column:intro" json:"intro" form:"intro"`
817
-	Status      int64  `gorm:"column:status" json:"status" form:"status"`
818
-	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
819
-	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
820
-	Message     string `gorm:"column:message" json:"message" form:"message"`
821
-	Sex         int64  `gorm:"column:sex" json:"sex" form:"sex"`
822
-	Birthday    int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
810
+	ID            int64  `gorm:"column:id" json:"id" form:"id"`
811
+	AdminUserId   int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
812
+	OrgId         int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
813
+	AppId         int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
814
+	RoleId        int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
815
+	UserName      string `gorm:"column:user_name" json:"user_name" form:"user_name"`
816
+	Avatar        string `gorm:"column:avatar" json:"avatar" form:"avatar"`
817
+	UserType      int64  `gorm:"column:user_type" json:"user_type" form:"user_type"`
818
+	UserTitle     int64  `gorm:"column:user_title" json:"user_title" form:"user_title"`
819
+	Intro         string `gorm:"column:intro" json:"intro" form:"intro"`
820
+	Status        int64  `gorm:"column:status" json:"status" form:"status"`
821
+	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
822
+	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
823
+	Message       string `gorm:"column:message" json:"message" form:"message"`
824
+	Sex           int64  `gorm:"column:sex" json:"sex" form:"sex"`
825
+	Birthday      int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
826
+	UserTitleName string `gorm:"column:user_title_name" json:"user_title_name" form:"user_title_name"`
823
 }
827
 }
824
 
828
 
825
 func (SgjUserAdminRole) TableName() string {
829
 func (SgjUserAdminRole) TableName() string {

+ 46 - 0
models/patient_models.go Ver arquivo

813
 
813
 
814
 	return "sgj_user_admin_login_log"
814
 	return "sgj_user_admin_login_log"
815
 }
815
 }
816
+
817
+type KyActivityTable struct {
818
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
819
+	Name         string `gorm:"column:name" json:"name" form:"name"`
820
+	Phone        string `gorm:"column:phone" json:"phone" form:"phone"`
821
+	Address      string `gorm:"column:address" json:"address" form:"address"`
822
+	Position     int64  `gorm:"column:position" json:"position" form:"position"`
823
+	HospitalName string `gorm:"column:hospital_name" json:"hospital_name" form:"hospital_name"`
824
+	IsUser       int64  `gorm:"column:is_user" json:"is_user" form:"is_user"`
825
+	IsThink      int64  `gorm:"column:is_think" json:"is_think" form:"is_think"`
826
+	OtherMode    string `gorm:"column:other_mode" json:"other_mode" form:"other_mode"`
827
+	OtherRemark  string `gorm:"column:other_remark" json:"other_remark" form:"other_remark"`
828
+	Gift         int64  `gorm:"column:gift" json:"gift" form:"gift"`
829
+	OtherMessage string `gorm:"column:other_message" json:"other_message" form:"other_message"`
830
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
831
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
832
+	Ctime        int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
833
+	Mtime        int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
834
+	SystemName   string `gorm:"column:system_name" json:"system_name" form:"system_name"`
835
+	AdminUserId  int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
836
+}
837
+
838
+func (KyActivityTable) TableName() string {
839
+
840
+	return "ky_activity_table"
841
+}
842
+
843
+type SgjUserRole struct {
844
+	ID               int64  `gorm:"column:id" json:"id" form:"id"`
845
+	RoleName         string `gorm:"column:role_name" json:"role_name" form:"role_name"`
846
+	RoleIntroduction string `gorm:"column:role_introduction" json:"role_introduction" form:"role_introduction"`
847
+	Creator          int64  `gorm:"column:creator" json:"creator" form:"creator"`
848
+	OrgId            int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
849
+	AppId            int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
850
+	IsSuperAdmin     int64  `gorm:"column:is_super_admin" json:"is_super_admin" form:"is_super_admin"`
851
+	Status           int64  `gorm:"column:status" json:"status" form:"status"`
852
+	Ctime            int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
853
+	Mtime            int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
854
+	Number           int64  `gorm:"column:number" json:"number" form:"number"`
855
+	IsSystem         int64  `gorm:"column:is_system" json:"is_system" form:"is_system"`
856
+}
857
+
858
+func (SgjUserRole) TableName() string {
859
+
860
+	return "sgj_user_role"
861
+}

+ 13 - 0
models/vm_models.go Ver arquivo

317
 func (VMUserRoleAndPurview) TableName() string {
317
 func (VMUserRoleAndPurview) TableName() string {
318
 	return "sgj_user_role"
318
 	return "sgj_user_role"
319
 }
319
 }
320
+
321
+type VMGobalTemplate struct {
322
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
323
+	OrgId      int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
324
+	TemplateId int64 `gorm:"column:template_id" json:"template_id" form:"template_id"`
325
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
326
+	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
327
+	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
328
+}
329
+
330
+func (VMGobalTemplate) TableName() string {
331
+	return "xt_gobal_template"
332
+}

+ 24 - 15
service/app_version.go Ver arquivo

21
 
21
 
22
 func GetAllAppOrg() ([]*models.OrgApp, error) {
22
 func GetAllAppOrg() ([]*models.OrgApp, error) {
23
 	var app []*models.OrgApp
23
 	var app []*models.OrgApp
24
-	err := readUserDbT.Model(&models.OrgApp{}).Where("status = 1 AND org_id > 0").Group("org_id").Find(&app).Error
24
+	err := readUserDb.Model(&models.OrgApp{}).Where("status = 1 AND org_id > 0").Group("org_id").Find(&app).Error
25
 	if err == gorm.ErrRecordNotFound {
25
 	if err == gorm.ErrRecordNotFound {
26
 		return nil, nil
26
 		return nil, nil
27
 	}
27
 	}
60
 
60
 
61
 func GetAppByType(orgID int64, app_type int) (*models.OrgApp, error) {
61
 func GetAppByType(orgID int64, app_type int) (*models.OrgApp, error) {
62
 	var apps models.OrgApp
62
 	var apps models.OrgApp
63
-	err := readUserDbT.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
63
+	err := readUserDb.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
64
 	if err != nil {
64
 	if err != nil {
65
 		return nil, err
65
 		return nil, err
66
 	}
66
 	}
68
 }
68
 }
69
 
69
 
70
 func CreateOrgApp(app *models.OrgApp) {
70
 func CreateOrgApp(app *models.OrgApp) {
71
-	writeUserDbT.Create(&app)
71
+	writeUserDb.Create(&app)
72
 
72
 
73
 }
73
 }
74
 
74
 
84
 }
84
 }
85
 
85
 
86
 func GetAllUserRoleByUserTypeOne(org_id int) (appRole []*models.App_Role) {
86
 func GetAllUserRoleByUserTypeOne(org_id int) (appRole []*models.App_Role) {
87
-	readUserDbT.Model(&models.App_Role{}).Where("status = 1 AND user_type = 1").Find(&appRole)
87
+	readUserDb.Model(&models.App_Role{}).Where("status = 1 AND user_type = 1").Find(&appRole)
88
 	return
88
 	return
89
 }
89
 }
90
 
90
 
92
 	//app, _ := GetOrgApp(int64(org_id), 3)
92
 	//app, _ := GetOrgApp(int64(org_id), 3)
93
 
93
 
94
 	//if org_id == 0 {
94
 	//if org_id == 0 {
95
-	readUserDbT.Model(&models.App_Role{}).Where("status = 1 AND user_type > 1").Find(&appRole)
95
+	readUserDb.Model(&models.App_Role{}).Where("status = 1 AND user_type > 1").Find(&appRole)
96
 	//
96
 	//
97
 	//} else {
97
 	//} else {
98
 	//	readUserDb.Model(&models.App_Role{}).Where("status = 1 AND org_id = ?  AND user_type > 1 AND app_id = ? ", org_id, app.Id).Find(&appRole)
98
 	//	readUserDb.Model(&models.App_Role{}).Where("status = 1 AND org_id = ?  AND user_type > 1 AND app_id = ? ", org_id, app.Id).Find(&appRole)
102
 }
102
 }
103
 
103
 
104
 func FindRoleByUserTypeOne(org_id int64) (role models.Role) {
104
 func FindRoleByUserTypeOne(org_id int64) (role models.Role) {
105
-	readUserDbT.Model(&models.Role{}).Where("status = 1 AND org_id = ? AND is_system = 2 AND role_name = '医生'", org_id).First(&role)
105
+	readUserDb.Model(&models.Role{}).Where("status = 1 AND org_id = ? AND is_system = 2 AND role_name = '医生'", org_id).First(&role)
106
 	return
106
 	return
107
 }
107
 }
108
 
108
 
109
 func FindRoleByUserTypeTwo(org_id int64) (role models.Role) {
109
 func FindRoleByUserTypeTwo(org_id int64) (role models.Role) {
110
-	readUserDbT.Model(&models.Role{}).Where("status = 1 AND org_id = ? AND is_system = 3 AND role_name = '护士'", org_id).First(&role)
110
+	readUserDb.Model(&models.Role{}).Where("status = 1 AND org_id = ? AND is_system = 3 AND role_name = '护士'", org_id).First(&role)
111
 	return
111
 	return
112
 }
112
 }
113
 
113
 
114
 func GetAllRole() ([]*models.Role, error) {
114
 func GetAllRole() ([]*models.Role, error) {
115
 	var app []*models.Role
115
 	var app []*models.Role
116
-	err := readUserDbT.Model(&models.Role{}).Where("status = 1 AND org_id > 0").Group("org_id").Find(&app).Error
116
+	err := readUserDb.Model(&models.Role{}).Where("status = 1 AND org_id > 0").Group("org_id").Find(&app).Error
117
 	if err == gorm.ErrRecordNotFound {
117
 	if err == gorm.ErrRecordNotFound {
118
 		return nil, nil
118
 		return nil, nil
119
 	}
119
 	}
124
 }
124
 }
125
 
125
 
126
 func UpdateRoleIds(id int64, ids string) {
126
 func UpdateRoleIds(id int64, ids string) {
127
-	writeUserDbT.Model(&models.App_Role{}).Where("status = 1 AND id = ?", id).Updates(map[string]interface{}{"role_ids": ids, "mtime": time.Now().Unix()})
127
+	writeUserDb.Model(&models.App_Role{}).Where("status = 1 AND id = ?", id).Updates(map[string]interface{}{"role_ids": ids, "mtime": time.Now().Unix()})
128
 
128
 
129
 }
129
 }
130
 
130
 
131
 func GetOrgAppA(orgID int64, app_type int) (*models.OrgApp, error) {
131
 func GetOrgAppA(orgID int64, app_type int) (*models.OrgApp, error) {
132
 	var apps models.OrgApp
132
 	var apps models.OrgApp
133
-	err := readUserDbT.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
133
+	err := readUserDb.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
134
 	if err != nil {
134
 	if err != nil {
135
 		return nil, err
135
 		return nil, err
136
 	}
136
 	}
139
 
139
 
140
 func GetOrgByIdB(orgID int64) (*models.Org, error) {
140
 func GetOrgByIdB(orgID int64) (*models.Org, error) {
141
 	var org models.Org
141
 	var org models.Org
142
-	err := readUserDbT.Model(&models.Org{}).Where("id = ?", orgID).First(&org).Error
142
+	err := readUserDb.Model(&models.Org{}).Where("id = ?", orgID).First(&org).Error
143
 	if err != nil {
143
 	if err != nil {
144
 		if err == gorm.ErrRecordNotFound {
144
 		if err == gorm.ErrRecordNotFound {
145
 			return nil, nil
145
 			return nil, nil
152
 
152
 
153
 func GetOrgAppB(orgID int64, app_type int) (*models.OrgApp, error) {
153
 func GetOrgAppB(orgID int64, app_type int) (*models.OrgApp, error) {
154
 	var apps models.OrgApp
154
 	var apps models.OrgApp
155
-	err := readUserDbT.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
155
+	err := readUserDb.Where("app_type = ? AND org_id = ? AND status = 1", app_type, orgID).First(&apps).Error
156
 	if err != nil {
156
 	if err != nil {
157
 		return nil, err
157
 		return nil, err
158
 	}
158
 	}
160
 }
160
 }
161
 
161
 
162
 func CreateOrgRoleB(role *models.Role) (err error) {
162
 func CreateOrgRoleB(role *models.Role) (err error) {
163
-	err = writeUserDbT.Create(&role).Error
163
+	err = writeUserDb.Create(&role).Error
164
 	return
164
 	return
165
 }
165
 }
166
 
166
 
167
 func CreateRolePurviewB(purview *models.RolePurview) (err error) {
167
 func CreateRolePurviewB(purview *models.RolePurview) (err error) {
168
-	err = writeUserDbT.Create(&purview).Error
168
+	err = writeUserDb.Create(&purview).Error
169
 	return
169
 	return
170
 }
170
 }
171
 
171
 
172
 func CreateFuncRolePurviewB(purview *models.SgjUserRoleFuncPurview) (err error) {
172
 func CreateFuncRolePurviewB(purview *models.SgjUserRoleFuncPurview) (err error) {
173
-	err = writeUserDbT.Create(&purview).Error
173
+	err = writeUserDb.Create(&purview).Error
174
 	return
174
 	return
175
 }
175
 }
176
+
177
+func GetSystemRole(orgID int64) ([]*models.Role, error) {
178
+	var roles []*models.Role
179
+	err := readUserDb.Where(" org_id = ? AND status = 1 AND is_system > 1", orgID).First(&roles).Error
180
+	if err != nil {
181
+		return nil, err
182
+	}
183
+	return roles, nil
184
+}

+ 1 - 1
service/data.go Ver arquivo

187
 }
187
 }
188
 
188
 
189
 func BatchInsertFiledSystemConfig(org_id int64) (err error) {
189
 func BatchInsertFiledSystemConfig(org_id int64) (err error) {
190
-	err = readDb.Exec("INSERT  INTO sgj_xt.xt_filed_config  ( org_id,  module,  filed_name,  filed_name_cn,  is_show ) SELECT ?,  module,  filed_name,  filed_name_cn,  is_show FROM sgj_xt.xt_filed_config  WHERE org_id = 9442  AND sys_module = 2", org_id).Error
190
+	err = readDb.Exec("INSERT  INTO sgj_xt.xt_filed_config  ( org_id,  module,  filed_name,  filed_name_cn,  is_show ) SELECT ?,  module,  filed_name,  filed_name_cn,  is_show FROM sgj_xt.xt_filed_config  WHERE org_id = 9442", org_id).Error
191
 	return
191
 	return
192
 }
192
 }

+ 1 - 1
service/gobal_config_service.go Ver arquivo

81
 }
81
 }
82
 
82
 
83
 func FindAllHideFiledConfig(template_id int64) (err error, config []*models.FiledConfig) {
83
 func FindAllHideFiledConfig(template_id int64) (err error, config []*models.FiledConfig) {
84
-	err = readDb.Model(&models.FiledConfig{}).Where("sys_module = 0  AND is_show = 2", template_id).Find(&config).Error
84
+	err = readDb.Model(&models.FiledConfig{}).Where("sys_module = ?  AND is_show = 2", template_id).Find(&config).Error
85
 	return
85
 	return
86
 }
86
 }
87
 
87
 

+ 7 - 1
service/inspection_service.go Ver arquivo

8
 )
8
 )
9
 
9
 
10
 func GetInspectionReference(orgId int64) (reference []*models.InspectionReference, err error) {
10
 func GetInspectionReference(orgId int64) (reference []*models.InspectionReference, err error) {
11
-	err = readDb.Model(&models.InspectionReference{}).Where("(org_id=0 OR org_id=?) and status=1", orgId).Order("project_id").Find(&reference).Error
11
+	var count int
12
+	err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1", orgId).Count(&count).Error
13
+	if count > 0 {
14
+		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1", orgId).Order("project_id").Find(&reference).Error
15
+	} else {
16
+		err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1").Order("project_id").Find(&reference).Error
17
+	}
12
 	return
18
 	return
13
 }
19
 }
14
 
20
 

+ 36 - 0
service/manage_service.go Ver arquivo

416
 	return org, err
416
 	return org, err
417
 }
417
 }
418
 
418
 
419
+func GetMyMobile(id int64) (models.SgjUserAdmin, error) {
420
+	admin := models.SgjUserAdmin{}
421
+	err := UserReadDB().Model(&admin).Where("id=? and status = 1", id).Find(&admin).Error
422
+	return admin, err
423
+}
424
+
419
 func CreateCulture(culture *models.DeviceCulture) error {
425
 func CreateCulture(culture *models.DeviceCulture) error {
420
 
426
 
421
 	err := writeUserDb.Create(&culture).Error
427
 	err := writeUserDb.Create(&culture).Error
1062
 	err := UserWriteDB().Model(&repair).Where("id=?", id).Update(map[string]interface{}{"images": "", "image_name": ""}).Error
1068
 	err := UserWriteDB().Model(&repair).Where("id=?", id).Update(map[string]interface{}{"images": "", "image_name": ""}).Error
1063
 	return err
1069
 	return err
1064
 }
1070
 }
1071
+
1072
+func GetActivtyCreator(creator int64) (*models.KyActivityTable, error) {
1073
+	table := models.KyActivityTable{}
1074
+	err := UserReadDB().Model(&table).Where("admin_user_id = ? and status =1", creator).Find(&table).Error
1075
+	if err == gorm.ErrRecordNotFound {
1076
+		return nil, err
1077
+	}
1078
+	if err != nil {
1079
+		return nil, err
1080
+	}
1081
+	return &table, nil
1082
+}
1083
+
1084
+func CreateTable(table *models.KyActivityTable) error {
1085
+
1086
+	err := UserWriteDB().Model(&table).Create(&table).Error
1087
+	return err
1088
+}
1089
+
1090
+func GetRolePosition(id int64) (models.SgjUserRole, error) {
1091
+	role := models.SgjUserRole{}
1092
+	err := UserReadDB().Where("id = ? And status =1", id).Find(&role).Error
1093
+	return role, err
1094
+}
1095
+
1096
+func GetMobile(id int64) (models.SgjUserAdmin, error) {
1097
+	admin := models.SgjUserAdmin{}
1098
+	err := UserReadDB().Where("id=? and status = 1", id).Find(&admin).Error
1099
+	return admin, err
1100
+}

+ 5 - 0
service/mobile_dialysis_service.go Ver arquivo

557
 	}
557
 	}
558
 	return &record, nil
558
 	return &record, nil
559
 }
559
 }
560
+func MobileGetLast(orgID int64, patientID int64, maxDate int64) (models.AssessmentAfterDislysis, error) {
561
+	dislysis := models.AssessmentAfterDislysis{}
562
+	err := readDb.Model(&models.AssessmentAfterDislysis{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date < ?", patientID, orgID, maxDate).Order("assessment_date desc").First(&dislysis).Error
563
+	return dislysis, err
564
+}
560
 
565
 
561
 // 治疗小结
566
 // 治疗小结
562
 func MobileGetTreatmentSummary(orgID int64, patientID int64, recordDate int64) (*models.TreatmentSummary, error) {
567
 func MobileGetTreatmentSummary(orgID int64, patientID int64, recordDate int64) (*models.TreatmentSummary, error) {

+ 1 - 0
service/patient_service.go Ver arquivo

972
 	err := writeDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? AND status = 1 AND execution_state <> 1 AND check_state <> 1 AND groupno = ? AND admin_user_id = ?", orgID, groupNO, admin_user_id).Updates(map[string]interface{}{
972
 	err := writeDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? AND status = 1 AND execution_state <> 1 AND check_state <> 1 AND groupno = ? AND admin_user_id = ?", orgID, groupNO, admin_user_id).Updates(map[string]interface{}{
973
 		"start_time":   startTime,
973
 		"start_time":   startTime,
974
 		"updated_time": now,
974
 		"updated_time": now,
975
+		"modifier":     admin_user_id,
975
 	}).Error
976
 	}).Error
976
 	return err
977
 	return err
977
 }
978
 }

+ 31 - 6
service/patientmanage_service.go Ver arquivo

983
 
983
 
984
 }
984
 }
985
 
985
 
986
+func GetAllProjectName(date int64, orgid int64, patientid int64) (inspection []*models.XtInspection, err error) {
987
+
988
+	err = XTReadDB().Model(&inspection).Where("inspect_date = ? and org_id = ? and patient_id = ? and status = 1", date, orgid, patientid).Order("inspect_date desc").Group("project_name").Find(&inspection).Error
989
+
990
+	return inspection, err
991
+}
992
+
986
 func GetAllInspection(orgid int64) (inspection []*models.XtInspectionReference, err error) {
993
 func GetAllInspection(orgid int64) (inspection []*models.XtInspectionReference, err error) {
987
 
994
 
988
 	err = XTReadDB().Model(&inspection).Where("org_id = ? and status = 1", orgid).Group("project_name").Find(&inspection).Error
995
 	err = XTReadDB().Model(&inspection).Where("org_id = ? and status = 1", orgid).Group("project_name").Find(&inspection).Error
1053
 	return err
1060
 	return err
1054
 }
1061
 }
1055
 
1062
 
1056
-func SaveMessage(id int64, role *models.SgjUserAdminRole) error {
1063
+func SaveMessage(id int64, orgid int64, role *models.SgjUserAdminRole) error {
1057
 
1064
 
1058
-	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("admin_user_id = ?", id).Update(map[string]interface{}{"message": role.Message, "mtime": time.Now().Unix()}).Error
1065
+	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("admin_user_id = ? and org_id = ?", id, orgid).Update(map[string]interface{}{"message": role.Message, "mtime": time.Now().Unix()}).Error
1059
 	return err
1066
 	return err
1060
 }
1067
 }
1061
 
1068
 
1250
 	return role, err
1257
 	return role, err
1251
 }
1258
 }
1252
 
1259
 
1253
-func GetAdminName(id int64) (models.AdminUsers, error) {
1260
+func GetAdminName(id int64, orgid int64) (models.AdminUsers, error) {
1254
 	user := models.AdminUsers{}
1261
 	user := models.AdminUsers{}
1255
 	//err := UserReadDB().Model(&user).Where("id=? and status =1", id).Find(&user).Error
1262
 	//err := UserReadDB().Model(&user).Where("id=? and status =1", id).Find(&user).Error
1256
 	//return user, err
1263
 	//return user, err
1257
 	db := UserReadDB().Table("sgj_user_admin as x").Where("x.status = 1")
1264
 	db := UserReadDB().Table("sgj_user_admin as x").Where("x.status = 1")
1258
 	table := UserReadDB().Table("sgj_user_admin_role as r")
1265
 	table := UserReadDB().Table("sgj_user_admin_role as r")
1259
 	fmt.Println("table", table)
1266
 	fmt.Println("table", table)
1260
-	err := db.Group("x.id").Select("x.id,x.mobile,x.password,x.is_super_admin,x.source,x.name,r.admin_user_id,r.org_id,r.app_id,r.role_id,r.user_name,r.avatar,r.message,r.sex,r.birthday").Where("x.id = ?", id).Joins("left join sgj_user_admin_role as r on r.admin_user_id = x.id").Scan(&user).Error
1267
+	err := db.Group("x.id").Select("x.id,x.mobile,x.password,x.is_super_admin,x.source,x.name,r.admin_user_id,r.org_id,r.app_id,r.role_id,r.user_name,r.avatar,r.message,r.sex,r.birthday").Where("x.id = ?", id).Joins("left join sgj_user_admin_role as r on r.admin_user_id = x.id and r.org_id = ?", orgid).Scan(&user).Error
1261
 	return user, err
1268
 	return user, err
1262
 }
1269
 }
1263
 
1270
 
1271
+func GetCreatByOrgId(orgid int64) (models.SgjUserOrg, error) {
1272
+	org := models.SgjUserOrg{}
1273
+	err := UserReadDB().Model(&org).Where("id=? and status = 1", orgid).Find(&org).Error
1274
+	return org, err
1275
+}
1276
+
1264
 func GetMyOrgInformationFour(creator int64, orgid int64) (models.SgjUserAdminRole, error) {
1277
 func GetMyOrgInformationFour(creator int64, orgid int64) (models.SgjUserAdminRole, error) {
1265
 	role := models.SgjUserAdminRole{}
1278
 	role := models.SgjUserAdminRole{}
1266
 	err := UserReadDB().Model(&role).Where("admin_user_id = ? and org_id = ? and status = 1", creator, orgid).Find(&role).Error
1279
 	err := UserReadDB().Model(&role).Where("admin_user_id = ? and org_id = ? and status = 1", creator, orgid).Find(&role).Error
1310
 	return err
1323
 	return err
1311
 }
1324
 }
1312
 
1325
 
1326
+func GetAppId(orgid int64) (models.OrgApp, error) {
1327
+	app := models.OrgApp{}
1328
+	err := UserReadDB().Model(&app).Where("org_id = ? and status = 1 and app_type = 3", orgid).Find(&app).Error
1329
+	return app, err
1330
+}
1331
+
1313
 func GetRoleName(adminid int64, orgid int64, appid int64) (models.Roles, error) {
1332
 func GetRoleName(adminid int64, orgid int64, appid int64) (models.Roles, error) {
1314
 
1333
 
1315
 	role := models.Roles{}
1334
 	role := models.Roles{}
1317
 	return role, err
1336
 	return role, err
1318
 }
1337
 }
1319
 
1338
 
1339
+func GetRole(id int64) (models.Role, error) {
1340
+	role := models.Role{}
1341
+	err := UserReadDB().Model(&role).Where("id = ? and status =1", id).Find(&role).Error
1342
+	return role, err
1343
+}
1344
+
1320
 func GetPositionName(adminid int64, orgid int64, appid int64) (models.App_Role, error) {
1345
 func GetPositionName(adminid int64, orgid int64, appid int64) (models.App_Role, error) {
1321
 
1346
 
1322
 	role := models.App_Role{}
1347
 	role := models.App_Role{}
1349
 	return admin, err
1374
 	return admin, err
1350
 }
1375
 }
1351
 
1376
 
1352
-func SaveNameTwo(id int64, role *models.SgjUserAdminRole) error {
1377
+func SaveNameTwo(id int64, orgid int64, role *models.SgjUserAdminRole) error {
1353
 
1378
 
1354
-	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("admin_user_id =?", id).Update(map[string]interface{}{"user_name": role.UserName, "mtime": time.Now().Unix()}).Error
1379
+	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("admin_user_id =? and org_id = ?", id, orgid).Update(map[string]interface{}{"user_name": role.UserName, "mtime": time.Now().Unix()}).Error
1355
 	return err
1380
 	return err
1356
 }
1381
 }

+ 6 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Ver arquivo

318
 	AssessmentDoctor                int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
318
 	AssessmentDoctor                int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
319
 	IsEat                           int64   `gorm:"column:is_eat" json:"is_eat"`
319
 	IsEat                           int64   `gorm:"column:is_eat" json:"is_eat"`
320
 	DialysisIntakesUnit             int64   `gorm:"column:dialysis_intakes_unit" json:"dialysis_intakes_unit"`
320
 	DialysisIntakesUnit             int64   `gorm:"column:dialysis_intakes_unit" json:"dialysis_intakes_unit"`
321
+	CvcA                            float64 `gorm:"column:cvc_a" json:"cvc_a" form:"cvc_a"`
322
+	CvcB                            float64 `gorm:"column:cvc_b" json:"cvc_b" form:"cvc_b"`
323
+	Channel                         int64   `gorm:"column:channel" json:"channel" form:"channel"`
321
 }
324
 }
322
 
325
 
323
 func (AssessmentAfterDislysisVM) TableName() string {
326
 func (AssessmentAfterDislysisVM) TableName() string {
381
 	AssessmentDoctor                int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
384
 	AssessmentDoctor                int64   `gorm:"column:assessment_doctor" json:"assessment_doctor"`
382
 	IsEat                           int64   `gorm:"column:is_eat" json:"is_eat"`
385
 	IsEat                           int64   `gorm:"column:is_eat" json:"is_eat"`
383
 	DialysisIntakesUnit             int64   `gorm:"column:dialysis_intakes_unit" json:"dialysis_intakes_unit"`
386
 	DialysisIntakesUnit             int64   `gorm:"column:dialysis_intakes_unit" json:"dialysis_intakes_unit"`
387
+	CvcA                            float64 `gorm:"column:cvc_a" json:"cvc_a" form:"cvc_a"`
388
+	CvcB                            float64 `gorm:"column:cvc_b" json:"cvc_b" form:"cvc_b"`
389
+	Channel                         int64   `gorm:"column:channel" json:"channel" form:"channel"`
384
 }
390
 }
385
 
391
 
386
 func (XtAssessmentAfterDislysisVM) TableName() string {
392
 func (XtAssessmentAfterDislysisVM) TableName() string {

+ 5 - 0
service/role_service.go Ver arquivo

754
 	return
754
 	return
755
 
755
 
756
 }
756
 }
757
+
758
+func GetSystemPurview() (purview []*models.Purview, err error) {
759
+	err = readUserDb.Model(&models.Purview{}).Where("status = 1 AND module = 3 AND super_admin_exclusive = 1").Find(&purview).Error
760
+	return
761
+}

+ 5 - 0
service/vm_service.go Ver arquivo

76
 	XTWriteDB().Model(&models.VmDeviceTreatmentmode{}).Create(&treatmentmode)
76
 	XTWriteDB().Model(&models.VmDeviceTreatmentmode{}).Create(&treatmentmode)
77
 
77
 
78
 }
78
 }
79
+
80
+func CreateVMPrintTemplate(template *models.VMGobalTemplate) (err error) {
81
+	err = writeDb.Model(&models.VMGobalTemplate{}).Create(template).Error
82
+	return
83
+}