Kaynağa Gözat

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

XMLWAN 4 yıl önce
ebeveyn
işleme
297d8ec5b5

+ 112 - 0
controllers/dialysis_api_controller.go Dosyayı Görüntüle

@@ -54,6 +54,8 @@ func DialysisApiRegistRouters() {
54 54
 
55 55
 	beego.Router("/api/dryweight/commit", &DialysisApiController{}, "Post:UploadDryWeight")
56 56
 
57
+	beego.Router("/api/func_per/get", &DialysisApiController{}, "Get:GetFuncPurview")
58
+
57 59
 }
58 60
 
59 61
 func (c *DialysisApiController) PostPrescription() {
@@ -4932,3 +4934,113 @@ func (c *DialysisApiController) UploadDryWeight() {
4932 4934
 	}
4933 4935
 
4934 4936
 }
4937
+
4938
+func (this *DialysisApiController) GetFuncPurview() {
4939
+	adminUserInfo := this.GetAdminUserInfo()
4940
+	user_id := adminUserInfo.AdminUser.Id
4941
+	app_id := adminUserInfo.CurrentAppId
4942
+	org_id := adminUserInfo.CurrentOrgId
4943
+	create_url := this.GetString("create_url")
4944
+	modify_url := this.GetString("modify_url")
4945
+	modify_other_url := this.GetString("modify_other_url")
4946
+	del_url := this.GetString("del_url")
4947
+	del_other_url := this.GetString("del_other_url")
4948
+	exce_url := this.GetString("exce_url")
4949
+	check_url := this.GetString("check_url")
4950
+	modify_exce_url := this.GetString("modify_exce_url")
4951
+	module, _ := this.GetInt64("module", 0)
4952
+
4953
+	app_role, _ := service.GetAppRole(org_id, app_id, user_id)
4954
+	var is_has_create bool
4955
+	var is_has_modify bool
4956
+	var is_has_modify_other bool
4957
+	var is_has_del bool
4958
+	var is_has_del_other bool
4959
+	var is_has_exce bool
4960
+	var is_has_check bool
4961
+	var is_has_modify_exce bool
4962
+
4963
+	org, _ := service.GetOrgById(adminUserInfo.CurrentOrgId)
4964
+
4965
+	if adminUserInfo.AdminUser.Id != org.Creator {
4966
+
4967
+		if app_role != nil {
4968
+			if len(app_role.RoleIds) > 0 {
4969
+				roles := strings.Split(app_role.RoleIds, ",")
4970
+				var userRolePurviews string
4971
+				for _, item := range roles {
4972
+					role_id, _ := strconv.ParseInt(item, 10, 64)
4973
+					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
4974
+					if len(userRolePurviews) == 0 {
4975
+						userRolePurviews = purviews
4976
+					} else {
4977
+						userRolePurviews = userRolePurviews + "," + purviews
4978
+					}
4979
+				}
4980
+				userRolePurviewsArr := RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
4981
+				funcPurviews, _ := service.FindAllFuncPurview(userRolePurviewsArr)
4982
+				for _, item := range funcPurviews {
4983
+					//for _, url := range strings.Split(item.Urlfor,","){
4984
+					if strings.Split(item.Urlfor, ",")[0] == create_url {
4985
+						is_has_create = true
4986
+					}
4987
+					if strings.Split(item.Urlfor, ",")[0] == modify_url {
4988
+						is_has_modify = true
4989
+					}
4990
+					if strings.Split(item.Urlfor, ",")[0] == modify_other_url {
4991
+						is_has_modify_other = true
4992
+					}
4993
+					if strings.Split(item.Urlfor, ",")[0] == del_url {
4994
+						is_has_del = true
4995
+					}
4996
+					if strings.Split(item.Urlfor, ",")[0] == del_other_url {
4997
+						is_has_del_other = true
4998
+					}
4999
+					if strings.Split(item.Urlfor, ",")[0] == exce_url {
5000
+						is_has_exce = true
5001
+					}
5002
+					if strings.Split(item.Urlfor, ",")[0] == check_url {
5003
+						is_has_check = true
5004
+					}
5005
+					if strings.Split(item.Urlfor, ",")[0] == modify_exce_url {
5006
+						is_has_modify_exce = true
5007
+					}
5008
+
5009
+				}
5010
+			} else {
5011
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRole)
5012
+				return
5013
+			}
5014
+			this.ServeSuccessJSON(map[string]interface{}{
5015
+				"is_has_create":       is_has_create,
5016
+				"is_has_modify":       is_has_modify,
5017
+				"is_has_modify_other": is_has_modify_other,
5018
+				"is_has_del":          is_has_del,
5019
+				"is_has_del_other":    is_has_del_other,
5020
+				"is_has_exce":         is_has_exce,
5021
+				"is_has_check":        is_has_check,
5022
+				"is_has_modify_exce":  is_has_modify_exce,
5023
+				"module":              module,
5024
+			})
5025
+		} else {
5026
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdminUserIsExit)
5027
+			return
5028
+
5029
+		}
5030
+
5031
+	} else {
5032
+		this.ServeSuccessJSON(map[string]interface{}{
5033
+			"is_has_create":       true,
5034
+			"is_has_modify":       true,
5035
+			"is_has_modify_other": true,
5036
+			"is_has_del":          true,
5037
+			"is_has_del_other":    true,
5038
+			"is_has_exce":         true,
5039
+			"is_has_check":        true,
5040
+			"is_has_modify_exce":  true,
5041
+			"module":              true,
5042
+		})
5043
+
5044
+	}
5045
+
5046
+}

+ 156 - 1
controllers/integration_config_api_controller.go Dosyayı Görüntüle

@@ -22,6 +22,162 @@ func IntegrationConfigRegistRouters() {
22 22
 	beego.Router("/api/adminhis/edit", &IntegrationConfigApiController{}, "post:EditAdminHis")
23 23
 	beego.Router("/api/adminhis/create", &IntegrationConfigApiController{}, "post:CreateAdminHis")
24 24
 
25
+	beego.Router("/api/patienthis/getinterface", &IntegrationConfigApiController{}, "post:GetInterface")
26
+	beego.Router("/api/patienthis/saveinterface", &IntegrationConfigApiController{}, "post:SaveInterface")
27
+	beego.Router("/api/integration/synclist", &IntegrationConfigApiController{}, "get:GetSyncList")
28
+	beego.Router("/api/integration/sysinspectionlist", &IntegrationConfigApiController{}, "get:GetSysInspectionList")
29
+	beego.Router("/api/patienthis/saveinspectionsysitemid", &IntegrationConfigApiController{}, "post:SaveInspectionSysItemId")
30
+}
31
+
32
+func (c *IntegrationConfigApiController) SaveInspectionSysItemId() {
33
+	adminUserInfo := c.GetAdminUserInfo()
34
+	org_id,_ := c.GetInt64("org_id",0)
35
+	sys_item_id,_ := c.GetInt64("sys_item_id",0)
36
+	id,_ := c.GetInt64("id",0)
37
+	if org_id != adminUserInfo.CurrentOrgId || sys_item_id<= 0 || id <= 0 {
38
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
39
+	}
40
+
41
+	inspection_reference := &models.InspectionReference{
42
+		ID : id,
43
+		SysItemId : sys_item_id,
44
+		UpdatedTime : time.Now().Unix(),
45
+	}
46
+	err := service.UpdateSysItemIdByID(inspection_reference)
47
+	if err != nil {
48
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
49
+	}
50
+	c.ServeSuccessJSON(map[string]interface{}{
51
+		"inspection_reference":  inspection_reference,
52
+	})
53
+	return
54
+}
55
+
56
+func (c *IntegrationConfigApiController) GetSysInspectionList() {
57
+	adminUserInfo := c.GetAdminUserInfo()
58
+	sysInspection,ownerInspection,err := service.GetSysInspectionList(adminUserInfo.CurrentOrgId)
59
+	if err != nil {
60
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
61
+	}
62
+
63
+	type InspectionStruce struct {
64
+		ProjectName string  `gorm:"-" json:"project_name" form:"project_name"`
65
+		ProjectId int64 `gorm:"-" json:"project_id" form:"project_id"`
66
+		InspectionReference []*models.InspectionReference  `gorm:"-" json:"inspection_reference" form:"inspection_reference"`
67
+	}
68
+
69
+	sysInspec := make(map[int64]*InspectionStruce, 0)
70
+	ownerInspec := make(map[int64]*InspectionStruce, 0)
71
+
72
+	
73
+
74
+	for _, item := range sysInspection {
75
+		result := sysInspec[item.ProjectId]
76
+		if result == nil {
77
+			result = new(InspectionStruce)
78
+			result.ProjectName = item.ProjectName
79
+			result.ProjectId = item.ProjectId
80
+		}
81
+		result.InspectionReference = append(result.InspectionReference, item)
82
+		sysInspec[item.ProjectId] = result
83
+	}
84
+
85
+	for _, oitem := range ownerInspection {
86
+		oresult := ownerInspec[oitem.ProjectId]
87
+		if oresult == nil {
88
+			oresult = new(InspectionStruce)
89
+			oresult.ProjectName = oitem.ProjectName
90
+			oresult.ProjectId = oitem.ProjectId
91
+		}
92
+		oresult.InspectionReference = append(oresult.InspectionReference, oitem)
93
+		ownerInspec[oitem.ProjectId] = oresult
94
+	}
95
+
96
+	c.ServeSuccessJSON(map[string]interface{}{
97
+		"sysInspec":  sysInspec,
98
+		"ownerInspec": ownerInspec,
99
+	})
100
+	return
101
+}
102
+
103
+func (c *IntegrationConfigApiController) GetSyncList() {
104
+	page, _ := c.GetInt64("page", 1)
105
+	limit, _ := c.GetInt64("limit", 10)
106
+
107
+	if page <= 0 {
108
+		page = 1
109
+	}
110
+	if limit <= 0 {
111
+		limit = 10
112
+	}
113
+
114
+	adminUserInfo := c.GetAdminUserInfo()
115
+	patients, total, _ := service.GetSyncList(adminUserInfo.CurrentOrgId, page, limit)
116
+
117
+	c.ServeSuccessJSON(map[string]interface{}{
118
+		"list":  patients,
119
+		"total": total,
120
+	})
121
+	return
122
+}
123
+
124
+func (c *IntegrationConfigApiController) SaveInterface() {
125
+	adminUserInfo := c.GetAdminUserInfo()
126
+	ID,_ := c.GetInt64("id",0)
127
+	OrgId := adminUserInfo.CurrentOrgId
128
+	Creater := adminUserInfo.AdminUser.Id 
129
+	Pattern,_ := c.GetInt("pattern",0)		
130
+	Dbhost := c.GetString("dbhost") 
131
+	Dbuser := c.GetString("dbuser")
132
+	Dbpassword := c.GetString("dbpassword") 
133
+	Dbname := c.GetString("dbname")
134
+	InterfaceUrl := c.GetString("interface_url") 
135
+	InterFaceToken := c.GetString("interface_token")
136
+	AllowIp := c.GetString("allow_ip")
137
+	AllowToken := c.GetString("allow_token")		
138
+	SyncFrequency,_ := c.GetInt("sync_frequency")
139
+	Status := 1
140
+	UpdatedTime :=  time.Now().Unix()
141
+	interfaceinfo := &models.MiddleInterface{
142
+		ID  		: ID,
143
+	OrgId   		: OrgId	,
144
+	Creater   		: Creater	,
145
+	Pattern 		: Pattern	,
146
+	Dbhost 			: Dbhost	,
147
+	Dbuser 			: Dbuser	,
148
+	Dbpassword 		: Dbpassword	,
149
+	Dbname 			: Dbname	,
150
+	InterfaceUrl 	: InterfaceUrl	,
151
+	InterFaceToken 	: InterFaceToken	,
152
+	AllowIp 		: AllowIp	,
153
+	AllowToken 		: AllowToken	,
154
+	SyncFrequency 	: SyncFrequency	,
155
+	Status			: Status	,
156
+	UpdatedTime     : UpdatedTime	,
157
+	}
158
+	if ID <= 0 {
159
+		interfaceinfo.CreatedTime =  time.Now().Unix()
160
+	}
161
+	err:= service.SaveInterface(interfaceinfo)
162
+
163
+	if err == nil {
164
+		c.ServeSuccessJSON(map[string]interface{}{
165
+			"interfaceinfo":  interfaceinfo,
166
+		})
167
+	} else {
168
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
169
+	}
170
+	return
171
+}
172
+
173
+func (c *IntegrationConfigApiController) GetInterface() {
174
+	adminUserInfo := c.GetAdminUserInfo()
175
+	interfaceinfo, _ := service.GetInterface(adminUserInfo.CurrentOrgId)
176
+	c.ServeSuccessJSON(map[string]interface{}{
177
+		"interfaceinfo":  interfaceinfo,
178
+	})
179
+	return
180
+
25 181
 }
26 182
 
27 183
 func (c *IntegrationConfigApiController) GetPatientsList() {
@@ -43,7 +199,6 @@ func (c *IntegrationConfigApiController) GetPatientsList() {
43 199
 		"total": total,
44 200
 	})
45 201
 	return
46
-
47 202
 }
48 203
 
49 204
 func (c *IntegrationConfigApiController) EditPatientHis() {

+ 6 - 8
controllers/mobile_api_controllers/dialysis_api_controller.go Dosyayı Görüntüle

@@ -1013,7 +1013,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1013 1013
 	safe_package, _ := c.GetInt64("package", 0)
1014 1014
 	a_liquid, _ := c.GetInt64("a_liquid", 0)
1015 1015
 
1016
-	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1016
+	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1017 1017
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1018 1018
 	//
1019 1019
 	//if template.TemplateId == 2 || template.TemplateId == 6 {
@@ -1030,11 +1030,11 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1030 1030
 	//}
1031 1031
 
1032 1032
 	//TODO 需要根据角色去判断
1033
-	//if appRole.UserType == 2 || appRole.UserType == 1 {
1034
-	//	prescription_doctor = appRole.AdminUserId
1035
-	//} else {
1036
-	//	prescription_doctor = 0
1037
-	//}
1033
+	if appRole.UserType == 2 || appRole.UserType == 1 {
1034
+		prescription_doctor = appRole.AdminUserId
1035
+	} else {
1036
+		prescription_doctor = 0
1037
+	}
1038 1038
 
1039 1039
 	prescription := models.DialysisPrescription{
1040 1040
 
@@ -2248,9 +2248,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
2248 2248
 
2249 2249
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
2250 2250
 		prescription.Modifier = adminUserInfo.AdminUser.Id
2251
-		prescription.Creater = adminUserInfo.AdminUser.Id
2252 2251
 		prescription.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2253
-
2254 2252
 		prescription.ID = dialysisPrescription.ID
2255 2253
 		err := service.UpDateDialysisPrescription(&prescription)
2256 2254
 		if err == nil {

+ 18 - 17
controllers/new_mobile_api_controllers/mobile_regist_controller.go Dosyayı Görüntüle

@@ -160,14 +160,14 @@ func (this *MobileRegistController) CreateOrg() {
160 160
 		return
161 161
 	}
162 162
 	orgPhone := this.GetString("telephone")
163
-
164
-	if len(orgPhone) > 0 {
165
-		if utils.PhoneRegexp().MatchString(orgPhone) == false {
166
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodePhone)
167
-			this.ServeJSON()
168
-			return
169
-		}
170
-	}
163
+	//
164
+	//if len(orgPhone) > 0 {
165
+	//	if utils.PhoneRegexp().MatchString(orgPhone) == false {
166
+	//		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodePhone)
167
+	//		this.ServeJSON()
168
+	//		return
169
+	//	}
170
+	//}
171 171
 
172 172
 	provinceID := 0
173 173
 	cityID := 0
@@ -221,7 +221,9 @@ func (this *MobileRegistController) CreateOrg() {
221 221
 		ModifyTime:   time.Now().Unix(),
222 222
 	}
223 223
 
224
-	createErr := service.CreateOrg(org, adminUser.Mobile, openXT, openCDM, openSCRM, openMall) // 创建机构以及所有类型的 app,如果有新类型的平台,则需要在这个方法里面把创建这一新类型的 app 的代码加上
224
+	adminUsers, _ := service.GetAdminUserByUserID(adminUser.Id)
225
+
226
+	createErr := service.CreateOrg(org, adminUsers.Name, openXT, openCDM, openSCRM, openMall) // 创建机构以及所有类型的 app,如果有新类型的平台,则需要在这个方法里面把创建这一新类型的 app 的代码加上
225 227
 
226 228
 	if createErr != nil {
227 229
 		utils.ErrorLog("mobile=%v的超级管理员创建机构失败:%v", adminUser.Mobile, createErr)
@@ -240,6 +242,7 @@ func (this *MobileRegistController) CreateOrg() {
240 242
 		//初始化设备管理org
241 243
 		InitEquitMentInformation(org)
242 244
 		//初始化显示配置
245
+		//InitShowConfig(org)
243 246
 
244 247
 		//创建完机构后进行登录验证操作
245 248
 		ip := utils.GetIP(this.Ctx.Request)
@@ -515,7 +518,7 @@ func InitPatientAndSchedule(org *models.Org) {
515 518
 
516 519
 	//创建两个血透的虚拟病人到新表
517 520
 	fmt.Print("patients", patients)
518
-	for index, it := range patients {
521
+	for _, it := range patients {
519 522
 		patientsNew := models.XtPatientsNew{
520 523
 			UserOrgId:               org.Id,
521 524
 			CreatedTime:             time.Now().Unix(),
@@ -555,13 +558,7 @@ func InitPatientAndSchedule(org *models.Org) {
555 558
 			TellPhone:               it.TellPhone,
556 559
 			FirstTreatmentDate:      it.FirstTreatmentDate,
557 560
 			ContactName:             it.ContactName,
558
-		}
559
-		if index == 1 {
560
-			patientsNew.IsInfectious = 1
561
-
562
-		} else {
563
-			patientsNew.IsInfectious = 2
564
-
561
+			IsInfectious:            it.IsInfectious,
565 562
 		}
566 563
 
567 564
 		service.CreateVMOrgNewPatient(&patientsNew)
@@ -1176,3 +1173,7 @@ func InitEquitMentInformation(org *models.Org) {
1176 1173
 	}
1177 1174
 	service.CreatedTreateMode(&treatmentmodefive)
1178 1175
 }
1176
+
1177
+func InitShowConfig(org *models.Org) {
1178
+	service.BatchInsertFiledSystemConfig(org.Id)
1179
+}

+ 4 - 4
controllers/new_mobile_api_controllers/patient.json Dosyayı Görüntüle

@@ -45,7 +45,7 @@
45 45
       "hospital_first_dialysis_date": 1511366400,
46 46
       "induction_period": 0,
47 47
       "initial_dialysis": 0,
48
-      "total_dialysis": 14,
48
+      "total_dialysis": 0,
49 49
       "attending_doctor_id": 0,
50 50
       "head_nurse_id": 0,
51 51
       "evaluate": "",
@@ -78,7 +78,7 @@
78 78
       "tell_phone": "21212",
79 79
       "first_treatment_date": 1582560000,
80 80
       "contact_name": "21221",
81
-      " is_infectious":1
81
+      "is_infectious":1
82 82
     },
83 83
     {
84 84
       "avatar": "https://images.shengws.com/201809182128111.png",
@@ -125,7 +125,7 @@
125 125
       "hospital_first_dialysis_date": 1511366400,
126 126
       "induction_period": 0,
127 127
       "initial_dialysis": 0,
128
-      "total_dialysis": 14,
128
+      "total_dialysis": 0,
129 129
       "attending_doctor_id": 0,
130 130
       "head_nurse_id": 0,
131 131
       "evaluate": "",
@@ -158,7 +158,7 @@
158 158
       "tell_phone": "21212",
159 159
       "first_treatment_date": 1582560000,
160 160
       "contact_name": "21221",
161
-      " is_infectious":2
161
+      "is_infectious":2
162 162
 
163 163
     }
164 164
   ]

+ 2 - 2
controllers/new_mobile_api_controllers/role.json Dosyayı Görüntüle

@@ -18,7 +18,7 @@
18 18
       "is_system": 2,
19 19
       "number": 9998,
20 20
       "purview_ids": "49,71,72,70,74,75,73,127,128,48,52,110,93,121,122,124,125,120,101,100,102,156,157,158,159,15571,72,70,74,75,73,127,128,48,52,110,93,121,122,124,125,120,101,100,102,156,157,158,159,155",
21
-      "func_ids": "20001,20002,20004,20005,20007,20008,20010,20011,20012,20034,20035,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028"
21
+      "func_ids": "20001,20002,20004,20005,20007,20008,20010,20011,20012,20034,20035,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20030"
22 22
 
23 23
 
24 24
     },
@@ -30,7 +30,7 @@
30 30
       "is_system": 3,
31 31
       "number": 9997,
32 32
       "purview_ids": "49,74,75,73,48,52,110,93,121,122,124,125,120",
33
-      "func_ids": "20007,20008,20010,20011,20012,20055,20056,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028"
33
+      "func_ids": "20007,20008,20010,20011,20012,20055,20056,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20051,20052,20053"
34 34
     },
35 35
     {
36 36
       "role_name": "库存",

+ 2 - 2
controllers/role.json Dosyayı Görüntüle

@@ -18,7 +18,7 @@
18 18
       "is_system": 2,
19 19
       "number": 9998,
20 20
       "purview_ids": "49,71,72,70,74,75,73,127,128,48,52,110,93,121,122,124,125,120,101,100,102,156,157,158,159,15571,72,70,74,75,73,127,128,48,52,110,93,121,122,124,125,120,101,100,102,156,157,158,159,155",
21
-      "func_ids": "20001,20002,20004,20005,20007,20008,20010,20011,20012,20034,20035,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028"
21
+      "func_ids": "20001,20002,20004,20005,20007,20008,20010,20011,20012,20034,20035,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20030"
22 22
 
23 23
 
24 24
     },
@@ -30,7 +30,7 @@
30 30
       "is_system": 3,
31 31
       "number": 9997,
32 32
       "purview_ids": "49,74,75,73,48,52,110,93,121,122,124,125,120",
33
-      "func_ids": "20007,20008,20010,20011,20012,20055,20056,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028"
33
+      "func_ids": "20007,20008,20010,20011,20012,20055,20056,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20051,20052,20053"
34 34
     }
35 35
   ]
36 36
 }

+ 8 - 4
controllers/verify_login_controller.go Dosyayı Görüntüle

@@ -141,6 +141,10 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
141 141
 				"address":        curOrg.Address,
142 142
 			}
143 143
 
144
+			var didRegistedForSCRM bool = false
145
+			var didRegistedForCDM bool = false
146
+			var didRegistedForMall bool = false
147
+
144 148
 			tempInfo, _ := service.GetOrgInfoTemplate(curOrg.Id)
145 149
 			fmt.Println("teimpInfo", tempInfo)
146 150
 			template_info := map[string]interface{}{
@@ -166,6 +170,10 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
166 170
 			if len(curAppUrlfors) == 0 {
167 171
 				if adminUser.Id == curOrg.Creator { //超级管理员
168 172
 					urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(3)
173
+					didRegistedForSCRM = true
174
+					didRegistedForCDM = true
175
+					didRegistedForMall = true
176
+
169 177
 					//urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(4)
170 178
 					//urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(5)
171 179
 					//urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(6)
@@ -204,10 +212,6 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
204 212
 				}
205 213
 			}
206 214
 
207
-			var didRegistedForSCRM bool = false
208
-			var didRegistedForCDM bool = false
209
-			var didRegistedForMall bool = false
210
-
211 215
 			for _, item := range pruviews {
212 216
 				if item.Module == 6 {
213 217
 					didRegistedForSCRM = true

+ 18 - 16
models/inspection_models.go Dosyayı Görüntüle

@@ -43,23 +43,25 @@ type Inspections struct {
43 43
 }
44 44
 
45 45
 type InspectionReference struct {
46
-	ID               int64  `gorm:"column:id" json:"id" form:"id"`
47
-	OrgId            int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
48
-	ProjectName      string `gorm:"column:project_name" json:"project_name" form:"project_name"`
49
-	Project          string `gorm:"column:project" json:"project" form:"project"`
50
-	ProjectId        int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
51
-	ItemName         string `gorm:"column:item_name" json:"item_name" form:"item_name"`
46
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
47
+	OrgId int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
48
+	ProjectName string `gorm:"column:project_name" json:"project_name" form:"project_name"`
49
+	Project string `gorm:"column:project" json:"project" form:"project"`
50
+	ProjectId int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
51
+	ItemName string `gorm:"column:item_name" json:"item_name" form:"item_name"`
52
+	ItemId string `gorm:"column:item_id" json:"item_id" form:"item_id"`
53
+	SysItemId int64 `gorm:"column:sys_item_id" json:"sys_item_id" form:"sys_item_id"`
52 54
 	ItemNameAddition string `gorm:"column:item_name_addition" json:"item_name_addition" form:"item_name_addition"`
53
-	Item             string `gorm:"column:item" json:"item" form:"item"`
54
-	RangeType        int64  `gorm:"column:range_type" json:"range_type" form:"range_type"`
55
-	RangeMin         string `gorm:"column:range_min" json:"range_min" form:"range_min"`
56
-	RangeMax         string `gorm:"column:range_max" json:"range_max" form:"range_max"`
57
-	RangeValue       string `gorm:"column:range_value" json:"range_value" form:"range_value"`
58
-	RangeOptions     string `gorm:"column:range_options" json:"range_options" form:"range_options"`
59
-	Unit             string `gorm:"column:unit" json:"unit" form:"unit"`
60
-	Status           int64  `gorm:"column:status" json:"status" form:"status"`
61
-	CreatedTime      int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
62
-	UpdatedTime      int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
55
+	Item string `gorm:"column:item" json:"item" form:"item"`
56
+	RangeType int64 `gorm:"column:range_type" json:"range_type" form:"range_type"`
57
+	RangeMin string `gorm:"column:range_min" json:"range_min" form:"range_min"`
58
+	RangeMax string `gorm:"column:range_max" json:"range_max" form:"range_max"`
59
+	RangeValue string `gorm:"column:range_value" json:"range_value" form:"range_value"`
60
+	RangeOptions string `gorm:"column:range_options" json:"range_options" form:"range_options"`
61
+	Unit string `gorm:"column:unit" json:"unit" form:"unit"`
62
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
63
+	CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
64
+	UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
63 65
 }
64 66
 
65 67
 func (InspectionReference) TableName() string {

+ 40 - 2
models/intergration_models.go Dosyayı Görüntüle

@@ -1,5 +1,45 @@
1 1
 package models
2 2
 
3
+type MiddleSyncInfo struct {
4
+	ID             	int64 `gorm:"column:id" json:"id" form:"id"`
5
+	OrgId       	int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
6
+	SyncTime       int64 `gorm:"column:sync_time" json:"sync_time" form:"sync_time"`
7
+	SyncResultType  int	  `gorm:"column:sync_result_type" json:"sync_result_type" form:"sync_result_type"`
8
+	SyncRsultRemark string `gorm:"column:sync_result_remark" json:"sync_result_remark" form:"sync_result_remark"`
9
+	SyncTotalNum    int64 `gorm:"column:sync_total_num" json:"sync_total_num" form:"sync_total_num"`
10
+	SyncSuccessNum  int64 `gorm:"column:sync_success_num" json:"sync_success_num" form:"sync_success_num"`
11
+	SyncInfo      	string `gorm:"column:sync_info" json:"sync_info" form:"sync_info"`
12
+	CreateTime      int64 `gorm:"column:create_time" json:"create_time" form:"create_time"`
13
+	UpdateTime    	int64 `gorm:"column:update_time" json:"update_time" form:"update_time"`
14
+}
15
+
16
+func (MiddleSyncInfo) TableName() string {
17
+	return "xt_middle_sync_info"
18
+}
19
+
20
+type MiddleInterface struct {
21
+	ID          	int64  `gorm:"column:id" json:"id" form:"id"`
22
+	OrgId   		int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
23
+	Creater   		int64 `gorm:"column:creater" json:"creater" form:"creater"`
24
+	Pattern 		int  `gorm:"column:pattern" json:"pattern" form:"pattern"`
25
+	Dbhost 			string  `gorm:"column:dbhost" json:"dbhost" form:"dbhost"`
26
+	Dbuser 			string  `gorm:"column:dbuser" json:"dbuser" form:"dbuser"`
27
+	Dbpassword 		string  `gorm:"column:dbpassword" json:"dbpassword" form:"dbpassword"`
28
+	Dbname 			string  `gorm:"column:dbname" json:"dbname" form:"dbname"`
29
+	InterfaceUrl 	string  `gorm:"column:interface_url" json:"interface_url" form:"interface_url"`
30
+	InterFaceToken 	string  `gorm:"column:interface_token" json:"interface_token" form:"interface_token"`
31
+	AllowIp 		string  `gorm:"column:allow_ip" json:"allow_ip" form:"allow_ip"`
32
+	AllowToken 		string  `gorm:"column:allow_token" json:"allow_token" form:"allow_token"`
33
+	SyncFrequency 	int  `gorm:"column:sync_frequency" json:"sync_frequency" form:"sync_frequency"`
34
+	Status			int  `gorm:"column:status" json:"status" form:"status"`
35
+	CreatedTime     int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
36
+	UpdatedTime     int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
37
+}
38
+
39
+func (MiddleInterface) TableName() string {
40
+	return "xt_middle_interface"
41
+}
42
+
3 43
 type VMPatients struct {
4 44
 	ID                           int64                `gorm:"column:id" json:"id" form:"id"`
5 45
 	UserOrgId                    int64                `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -265,8 +305,6 @@ type VMUserRole struct {
265 305
 	Status           int64  `gorm:"column:status" json:"status" form:"status"`
266 306
 	Ctime            int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
267 307
 	Mtime            int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
268
-	Number           int64  `gorm:"column:number" json:"number" form:"number"`
269
-	IsSystem         int64  `gorm:"column:is_system" json:"is_system" form:"is_system"`
270 308
 }
271 309
 
272 310
 func (VMUserRole) TableName() string {

+ 5 - 0
service/data.go Dosyayı Görüntüle

@@ -185,3 +185,8 @@ func FindSysDialysisFiledByOrgId() (filedConfig []*models.FiledConfig, err error
185 185
 	err = readDb.Model(&models.FiledConfig{}).Where("org_id =? AND id in (11250,11251,11252,11253,11254,11255,11256,11257,11258,11259,11260,11261,11262)", 0).Find(&filedConfig).Error
186 186
 	return
187 187
 }
188
+
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
191
+	return
192
+}

+ 38 - 0
service/integration_service.go Dosyayı Görüntüle

@@ -6,6 +6,44 @@ import (
6 6
 	"time"
7 7
 )
8 8
 
9
+func UpdateSysItemIdByID(sysInspection *models.InspectionReference) error {
10
+	db := XTWriteDB()
11
+	err := db.Model(&models.InspectionReference{}).Update(&sysInspection).Error
12
+	return err
13
+}
14
+
15
+func GetSysInspectionList(orgID int64) (sysInspection []*models.InspectionReference,ownerInspection []*models.InspectionReference, err error) {
16
+	db := XTReadDB()
17
+	err = db.Model(&models.InspectionReference{}).Where("org_id= 0 and status=1").Find(&sysInspection).Error
18
+	err = db.Model(&models.InspectionReference{}).Where("org_id= ? and status=1", orgID).Find(&ownerInspection).Error
19
+	return
20
+}
21
+
22
+func GetSyncList(orgID int64, page, limit int64) (patients []*models.MiddleSyncInfo, total int64, err error) {
23
+	//db := MiddleReadDB()
24
+	db := MiddleReadDB()
25
+	offset := (page - 1) * limit
26
+	err = db.Model(&models.MiddleSyncInfo{}).Where("org_id=? ", orgID).Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
27
+	return
28
+}
29
+
30
+func SaveInterface(interfaceinfo *models.MiddleInterface) error {
31
+	db := MiddleWriteDB()
32
+	if (interfaceinfo.ID > 0 ) {
33
+		err := db.Save(&interfaceinfo).Error
34
+		return err
35
+	} else {
36
+		err := db.Create(&interfaceinfo).Error
37
+		return err
38
+	}
39
+}
40
+
41
+func GetInterface(orgID int64) (interfaceinfo models.MiddleInterface, err error){
42
+	db := MiddleReadDB()
43
+	err = db.Model(&models.MiddleInterface{}).Where("org_id=? and status=1", orgID).First(&interfaceinfo).Error
44
+	return
45
+}
46
+
9 47
 func GetIntegrationPatientList(orgID int64, page, limit int64) (patients []*models.VMPatients, total int64, err error) {
10 48
 	//db := MiddleReadDB()
11 49
 	db := readDb.Model(&models.VMPatients{}).Where("status=1")