xiaoming_global 5 лет назад
Родитель
Сommit
4d7d79200a

+ 1 - 1
controllers/article/article_controller.go Просмотреть файл

@@ -382,7 +382,6 @@ func (this *ArticleManage) EditCategorys()  {
382 382
 	}
383 383
 
384 384
 	sors :=int64(dataBody["order"].(float64))
385
-	//sors, _ := strconv.ParseInt(sort, 10, 64)
386 385
 	fmt.Println("sort0",sors)
387 386
 	if sors  <= 0 {
388 387
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序不能为空")
@@ -401,6 +400,7 @@ func (this *ArticleManage) EditCategorys()  {
401 400
 	}
402 401
 	fmt.Println("category是?",category)
403 402
 	article_service.EditCategory(&category,userOrgID,id)
403
+
404 404
 	this.ServeSuccessJSON(map[string]interface{}{
405 405
 		"category":category,
406 406
 	})

+ 28 - 26
controllers/base_api_controller.go Просмотреть файл

@@ -2,6 +2,8 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"SCRM/enums"
5
+	"SCRM/service/admin_service"
6
+	"SCRM/models"
5 7
 )
6 8
 
7 9
 type BaseAPIController struct {
@@ -51,33 +53,33 @@ type BaseAuthAPIController struct {
51 53
 func (this *BaseAuthAPIController) Prepare() {
52 54
 	this.BaseAPIController.Prepare()
53 55
 	if this.GetAdminUserInfo() == nil {
54
-		// var userAdmin models.AdminUser
55
-		// userAdmin.Id = 380
56
-		// userAdmin.Mobile = "13532250447"
57
-		// userAdmin.IsSuperAdmin = true
58
-		// userAdmin.Status = 1
59
-		// userAdmin.CreateTime = 1530786071
60
-		// userAdmin.ModifyTime = 1530786071
61
-		// var subscibe models.ServeSubscibe
62
-		// subscibe.ID = 1
63
-		// subscibe.OrgId = 4
64
-		// subscibe.PeriodStart = 1538035409
65
-		// subscibe.PeriodEnd = 1569571409
66
-		// subscibe.State = 1
67
-		// subscibe.Status = 1
68
-		// subscibe.CreatedTime = 1538035409
69
-		// subscibe.UpdatedTime = 1538035409
70
-		// subscibes := make(map[int64]*models.ServeSubscibe, 0)
71
-		// subscibes[4] = &subscibe
72
-		// var adminUserInfo admin_service.AdminUserInfo
73
-		// adminUserInfo.CurrentOrgId = 4
74
-		// adminUserInfo.CurrentAppId = 5
75
-		// adminUserInfo.AdminUser = &userAdmin
76
-		// adminUserInfo.Subscibes = subscibes
77
-		// this.SetSession("admin_user_info", &adminUserInfo)
56
+		var userAdmin models.AdminUser
57
+		userAdmin.Id = 380
58
+		userAdmin.Mobile = "13532250447"
59
+		userAdmin.IsSuperAdmin = true
60
+		userAdmin.Status = 1
61
+		userAdmin.CreateTime = 1530786071
62
+		userAdmin.ModifyTime = 1530786071
63
+		var subscibe models.ServeSubscibe
64
+		subscibe.ID = 1
65
+		subscibe.OrgId = 4
66
+		subscibe.PeriodStart = 1538035409
67
+		subscibe.PeriodEnd = 1569571409
68
+		subscibe.State = 1
69
+		subscibe.Status = 1
70
+		subscibe.CreatedTime = 1538035409
71
+		subscibe.UpdatedTime = 1538035409
72
+		subscibes := make(map[int64]*models.ServeSubscibe, 0)
73
+		subscibes[4] = &subscibe
74
+		var adminUserInfo admin_service.AdminUserInfo
75
+		adminUserInfo.CurrentOrgId = 4
76
+		adminUserInfo.CurrentAppId = 5
77
+		adminUserInfo.AdminUser = &userAdmin
78
+		adminUserInfo.Subscibes = subscibes
79
+		this.SetSession("admin_user_info", &adminUserInfo)
78 80
 
79
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
80
-		this.StopRun()
81
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
82
+		//this.StopRun()
81 83
 	}
82 84
 }
83 85
 

+ 229 - 11
controllers/site/site_controller.go Просмотреть файл

@@ -13,6 +13,9 @@ import (
13 13
 	"time"
14 14
 	"strings"
15 15
 )
16
+
17
+
18
+
16 19
 func siteRouters() {
17 20
 	beego.Router("/api/site/addrotationchart",&Microwebsite{},"Post:AddRotaionChart")
18 21
 	beego.Router("/api/site/savehispital",&Microwebsite{},"Post:SaveHispital")
@@ -46,6 +49,13 @@ func siteRouters() {
46 49
 	beego.Router("/api/site/editdoctor",&Microwebsite{},"Get:Editdoctor")
47 50
 	beego.Router("/api/site/savedocinfo",&Microwebsite{},"Post:SaveDocInfo")
48 51
 	beego.Router("/api/site/deletedoctor",&Microwebsite{},"Get:DeleteDoctor")
52
+	beego.Router("/api/site/edithospital",&Microwebsite{},"Get:EditHospital")
53
+	beego.Router("/api/site/savehostpital",&Microwebsite{},"Post:SaveHospital")
54
+	beego.Router("api/site/editoffice",&Microwebsite{},"Get:EditOffice")
55
+	beego.Router("/api/site/deletemodlebyid",&Microwebsite{},"Get:Deletemodlebyid")
56
+	beego.Router("/api/site/saveoffice",&Microwebsite{},"Post:SaveOffice")
57
+	beego.Router("/api/site/gethospital",&Microwebsite{},"Post:GetHospital")
58
+	beego.Router("/api/site/getdata",&Microwebsite{},"Post:GetData")
49 59
 }
50 60
 
51 61
 type Microwebsite struct {
@@ -92,6 +102,7 @@ func (this *Microwebsite) AddRotaionChart()  {
92 102
 		UserOrgId: userOrgID,
93 103
 		Status:    1,
94 104
 		Ctime:     time.Now().Unix(),
105
+		ModeType:  1,
95 106
 	}
96 107
 	//fmt.Println(model)
97 108
      site_service.AddPatientModel(&model)
@@ -157,6 +168,7 @@ func (this *Microwebsite) SaveHispital()  {
157 168
 		UserOrgId: userOrgID,
158 169
 		Ctime:     time.Now().Unix(),
159 170
 		Status:    1,
171
+		ModeType: 2,
160 172
 	}
161 173
 
162 174
 	site_service.AddPatientModel(&model)
@@ -223,6 +235,7 @@ func  (this *Microwebsite) AddOffices()  {
223 235
 		UserOrgId: userOrgID,
224 236
 		Ctime:     time.Now().Unix(),
225 237
 		Status:    1,
238
+		ModeType:   3,
226 239
 	}
227 240
 
228 241
 	site_service.AddPatientModel(&model)
@@ -288,6 +301,7 @@ func (this *Microwebsite) AddDoctor()  {
288 301
 		UserOrgId: userOrgID,
289 302
 		Ctime:     time.Now().Unix(),
290 303
 		Status:    1,
304
+		ModeType:  4,
291 305
 	}
292 306
 
293 307
 	site_service.AddPatientModel(&model)
@@ -301,6 +315,7 @@ func (this *Microwebsite) AddDoctor()  {
301 315
 		Ctime:time.Now().Unix(),
302 316
 		Status:1,
303 317
 		Modelid:patientModel.ID,
318
+
304 319
 	}
305 320
 
306 321
 	err = site_service.AddDoctor(doctor)
@@ -412,21 +427,13 @@ func (this *Microwebsite) AddKeEnvironment()  {
412 427
 	replace := strings.Replace(strings.Trim(fmt.Sprint(keImages), "[]"), " ", ",", -1)
413 428
 	fmt.Println("图片:",keImages)
414 429
 	fmt.Println("字符串",replace)
415
-	//offenvironment := models.SgjPatientOffenvironment{
416
-	//	Title:     title,
417
-	//	Sort:      sortt,
418
-	//	Keimages:  replace,
419
-	//	Mtime:     time.Now().Unix(),
420
-	//	UserOrgId: userOrgID,
421
-	//	Status:    1,
422
-	//}
423
-
424 430
 	model := models.SgjPatientModel{
425 431
 		Title:     title,
426 432
 		Sort:      sortt,
427 433
 		UserOrgId: userOrgID,
428 434
 		Ctime:     time.Now().Unix(),
429 435
 		Status:    1,
436
+		ModeType:   5,
430 437
 	}
431 438
 
432 439
 	site_service.AddPatientModel(&model)
@@ -505,7 +512,6 @@ func (this * Microwebsite) GetDoctorInfo()  {
505 512
 	adminUserInfo := this.GetAdminUserInfo()
506 513
 	userOrgID := int64(adminUserInfo.CurrentOrgId)
507 514
 	doc, err := site_service.GetDoctorInfo(userOrgID)
508
-	fmt.Println("doc是什么",doc)
509 515
 	if err !=nil{
510 516
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
511 517
 		return
@@ -546,6 +552,8 @@ func (this * Microwebsite) GetOffEnvironment()  {
546 552
 	adminUserInfo := this.GetAdminUserInfo()
547 553
 	userOrgID := int64(adminUserInfo.CurrentOrgId)
548 554
 	offenvironment, err := site_service.GetOffEnvironment(userOrgID)
555
+	fmt.Println("错误是什么",err)
556
+	fmt.Println("科室环境数据",offenvironment)
549 557
 	if err !=nil{
550 558
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
551 559
 		return
@@ -1132,4 +1140,214 @@ func (this *Microwebsite) DeleteDoctor()  {
1132 1140
 	returnData["msg"] = "ok"
1133 1141
 	this.ServeSuccessJSON(returnData)
1134 1142
 	return
1135
-}
1143
+}
1144
+
1145
+func (this *Microwebsite) EditHospital()  {
1146
+	adminUserInfo := this.GetAdminUserInfo()
1147
+	id, _ := this.GetInt64("id")
1148
+	fmt.Println("保存id是啥?",id)
1149
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1150
+	hospital, err := site_service.EditHospital(id, userOrgID)
1151
+	fmt.Println("参训是什么",hospital)
1152
+	fmt.Println(err)
1153
+	if err !=nil{
1154
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1155
+		return
1156
+	}
1157
+	this.ServeSuccessJSON(map[string]interface{}{
1158
+		"hospital":hospital,
1159
+	})
1160
+}
1161
+
1162
+func (this *Microwebsite) SaveHospital()  {
1163
+	adminUserInfo := this.GetAdminUserInfo()
1164
+	id, _ := this.GetInt64("id")
1165
+	fmt.Println("保存id是啥?",id)
1166
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1167
+	fmt.Println(userOrgID)
1168
+	dataBody := make(map[string]interface{}, 0)
1169
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1170
+	if err != nil {
1171
+		utils.ErrorLog(err.Error())
1172
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
1173
+		return
1174
+	}
1175
+
1176
+	title := dataBody["title"].(string)
1177
+	if len(title) == 0 {
1178
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
1179
+		return
1180
+	}
1181
+	fmt.Println("标题:", title)
1182
+
1183
+	sort := int64(dataBody["sort"].(float64))
1184
+	fmt.Println("sort是神",sort)
1185
+	if  sort <= 0 {
1186
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
1187
+		return
1188
+	}
1189
+	fmt.Println("排序:", sort)
1190
+	introduction := dataBody["introduction"].(string)
1191
+	if len(introduction) == 0 {
1192
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
1193
+		return
1194
+	}
1195
+
1196
+	 modleid := int64(dataBody["modleid"].(float64))
1197
+	if  modleid <= 0 {
1198
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
1199
+		return
1200
+	}
1201
+	fmt.Println("模块id",modleid)
1202
+	hospital := models.SgjPatientHospital{
1203
+		Title:        title,
1204
+		Sort:         sort,
1205
+		Introduction: introduction,
1206
+	}
1207
+	err = site_service.UpdateHospital(id, userOrgID, hospital)
1208
+
1209
+	model := models.SgjPatientModel{
1210
+		Title:  title,
1211
+		Sort:   sort,
1212
+	}
1213
+	fmt.Println(hospital)
1214
+	Modelerr := site_service.UpdateModel(modleid, userOrgID, model)
1215
+	fmt.Println("错误是什么",Modelerr)
1216
+	fmt.Println("错误是什么",err)
1217
+	if err !=nil{
1218
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1219
+		return
1220
+	}
1221
+	this.ServeSuccessJSON(map[string]interface{}{
1222
+		"hospital":hospital,
1223
+		"model":model,
1224
+	})
1225
+}
1226
+
1227
+func (this *Microwebsite) EditOffice()  {
1228
+	adminUserInfo := this.GetAdminUserInfo()
1229
+	id, _ := this.GetInt64("id")
1230
+	fmt.Println("保存id是啥?",id)
1231
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1232
+	offices, err := site_service.EditOffice(id, userOrgID)
1233
+	if err !=nil{
1234
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1235
+		return
1236
+	}
1237
+	this.ServeSuccessJSON(map[string]interface{}{
1238
+		"offices":offices,
1239
+	})
1240
+}
1241
+
1242
+func (this *Microwebsite) Deletemodlebyid()  {
1243
+	adminUserInfo := this.GetAdminUserInfo()
1244
+	id, _ := this.GetInt64("id")
1245
+	fmt.Println("保存id是啥?",id)
1246
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1247
+	err := site_service.DeletemodleById(id, userOrgID)
1248
+	modelid := site_service.DeleteHospitalByModelid(id, userOrgID)
1249
+	byModelid := site_service.DeleteOfficeByModelid(id, userOrgID)
1250
+	fmt.Println(modelid,byModelid)
1251
+	if err !=nil{
1252
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
1253
+		return
1254
+	}
1255
+	returnData := make(map[string]interface{}, 0)
1256
+	returnData["msg"] = "ok"
1257
+	this.ServeSuccessJSON(returnData)
1258
+	return
1259
+}
1260
+
1261
+func (this *Microwebsite) SaveOffice()  {
1262
+	adminUserInfo := this.GetAdminUserInfo()
1263
+	id, _ := this.GetInt64("id")
1264
+	fmt.Println("科室介绍id是啥?",id)
1265
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1266
+	fmt.Println(userOrgID)
1267
+	dataBody := make(map[string]interface{}, 0)
1268
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1269
+	if err != nil {
1270
+		utils.ErrorLog(err.Error())
1271
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
1272
+		return
1273
+	}
1274
+
1275
+	title := dataBody["title"].(string)
1276
+	if len(title) == 0 {
1277
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
1278
+		return
1279
+	}
1280
+	fmt.Println("标题:", title)
1281
+
1282
+	sort := int64(dataBody["sort"].(float64))
1283
+	fmt.Println("sort是神",sort)
1284
+	if  sort <= 0 {
1285
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
1286
+		return
1287
+	}
1288
+	fmt.Println("排序:", sort)
1289
+	introduction := dataBody["introduction"].(string)
1290
+	if len(introduction) == 0 {
1291
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
1292
+		return
1293
+	}
1294
+
1295
+	modleid := int64(dataBody["modleid"].(float64))
1296
+	if  modleid <= 0 {
1297
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
1298
+		return
1299
+	}
1300
+	fmt.Println("模块ID",modleid)
1301
+
1302
+	offices := models.SgjPatientOffices{
1303
+		Title:        title,
1304
+		Sort:         sort,
1305
+		Introduction: introduction,
1306
+	}
1307
+	updateOffices := site_service.UpdateOffices(id, userOrgID, offices)
1308
+
1309
+	model := models.SgjPatientModel{
1310
+		Title: title,
1311
+		Sort:  sort,
1312
+	}
1313
+	updateModel := site_service.UpdateModel(modleid, userOrgID, model)
1314
+	fmt.Println(updateModel)
1315
+	if updateOffices !=nil{
1316
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1317
+		return
1318
+	}
1319
+	this.ServeSuccessJSON(map[string]interface{}{
1320
+		"offices":offices,
1321
+		"model":model,
1322
+	})
1323
+}
1324
+
1325
+func (this *Microwebsite) GetHospital()  {
1326
+	adminUserInfo := this.GetAdminUserInfo()
1327
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1328
+
1329
+	hostital, err := site_service.GetHospital(userOrgID)
1330
+
1331
+	if err !=nil{
1332
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1333
+		return
1334
+	}
1335
+	this.ServeSuccessJSON(map[string]interface{}{
1336
+		"hostital":hostital,
1337
+	})
1338
+}
1339
+
1340
+func (this *Microwebsite) GetData()  {
1341
+	adminUserInfo := this.GetAdminUserInfo()
1342
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1343
+	fmt.Println("机构ID" ,userOrgID)
1344
+	model, err := site_service.GetData(userOrgID)
1345
+	fmt.Println("错误是什么",err)
1346
+	if err !=nil{
1347
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1348
+		return
1349
+	}
1350
+	this.ServeSuccessJSON(map[string]interface{}{
1351
+		"patientModels":model,
1352
+	})
1353
+}

+ 3 - 1
models/site_models.go Просмотреть файл

@@ -25,8 +25,10 @@ type SgjPatientModel struct {
25 25
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
26 26
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
27 27
 	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
28
+	ModeType int64 `gorm:"column:mode_type" json:"mode_type" form:"mode_type"`
29
+	Hospitals     SgjPatientHospital `gorm:"ForeignKey:Modleid"`
30
+	Offices     SgjPatientOffices `gorm:"ForeignKey:Modleid"`
28 31
 }
29
-
30 32
 func (SgjPatientModel) TableName() string{
31 33
 	return "sgj_patient_model"
32 34
 }

+ 58 - 4
service/site_service/site_microwebsite_service.go Просмотреть файл

@@ -56,11 +56,10 @@ func AddOffEnvironment(officenviroment models.SgjPatientOffenvironment) error {
56 56
 	return  err
57 57
 }
58 58
 
59
-func GetRationImages(orgID int64)( models.SgjPatientRotation,error){
60
-	rotation := models.SgjPatientRotation{}
61
-	err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Last(&rotation).Error
59
+func GetRationImages(orgID int64)(rot []*models.SgjPatientRotation, err error){
60
+	err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Order("sort").Find(&rot).Error
62 61
 	fmt.Println("错误是什么",err)
63
-	return rotation,err
62
+	return
64 63
 }
65 64
 
66 65
 func GetHospitalInfo(orgID int64)(models.SgjPatientHospital,error)  {
@@ -184,4 +183,59 @@ func DeleteDoctor(id int64,orgID int64)(error) {
184 183
 	return err
185 184
 }
186 185
 
186
+func EditHospital(mid int64,orgID int64)(models.SgjPatientHospital,error)  {
187
+	hospital := models.SgjPatientHospital{}
188
+	err := service.PatientReadDB().Model(&hospital).Where("modleid = ? AND user_org_id = ? AND status = ?", mid, orgID, 1).Find(&hospital).Error
189
+	return hospital,err
190
+}
191
+
192
+func UpdateHospital(id int64,OrgId int64,hospital models.SgjPatientHospital) error  {
193
+	err := service.PatientWriteDB().Model(hospital).Where("id = ? AND user_org_id = ? AND status = ?", id, OrgId, 1).Update(map[string]interface{}{"title": hospital.Title, "sort": hospital.Sort, "introduction": hospital.Introduction, "mtime": time.Now().Unix()}).Error
194
+	return  err
195
+}
196
+
197
+func UpdateModel(modelid int64,orgId int64 ,model models.SgjPatientModel) error  {
198
+	err := service.PatientWriteDB().Model(model).Where("id = ? AND user_org_id = ? AND status = ?", modelid, orgId, 1).Update(map[string]interface{}{"title": model.Title, "sort": model.Sort, "mtime": time.Now().Unix()}).Error
199
+	return  err
200
+}
201
+
202
+func EditOffice(mid int64,orgID int64)(models.SgjPatientOffices,error)  {
203
+	offices := models.SgjPatientOffices{}
204
+	err := service.PatientReadDB().Model(&offices).Where("modleid = ? AND user_org_id = ? AND status = ?", mid, orgID, 1).Find(&offices).Error
205
+	return offices,err
206
+}
207
+
208
+func DeletemodleById(id int64,orgID int64)(error)  {
209
+	err:= service.PatientWriteDB().Model(models.SgjPatientModel{}).Where("id = ? AND user_org_id = ?", id, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
210
+	return  err
211
+	}
212
+
213
+func DeleteHospitalByModelid(mid int64,orgID int64)(error)  {
214
+	err := service.PatientWriteDB().Model(models.SgjPatientHospital{}).Where("modleid = ? AND user_org_id = ?", mid, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
215
+	return err
216
+}
217
+
218
+func DeleteOfficeByModelid(mid int64,orgID int64)(error)  {
219
+	err := service.PatientWriteDB().Model(models.SgjPatientOffices{}).Where("modleid = ? AND user_org_id = ?", mid, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
220
+	return  err
221
+}
222
+
223
+func UpdateOffices(id int64,orgID int64,offices models.SgjPatientOffices) error {
224
+	err := service.PatientWriteDB().Model(offices).Where("id = ? AND user_org_id = ? AND status = ?", id, orgID, 1).Update(map[string]interface{}{"title": offices.Title, "sort": offices.Sort, "introduction": offices.Introduction, "mtime": time.Now().Unix()}).Error
225
+	return  err
226
+}
227
+func GetHospital(Orgid int64)(hostital []*models.SgjPatientHospital,err error)  {
228
+	err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", Orgid, 1).Order("sort").Find(&hostital).Error
229
+	return
230
+}
231
+
232
+func GetData(orgid int64)(model []*models.SgjPatientModel,err error)  {
233
+	db := service.PatientReadDB().Table("sgj_patient_model as m").Where(" m.status = ?", 1)
234
+	if(orgid > 0){
235
+		db = db.Where("user_org_id = ? ", orgid)
236
+	}
237
+	err = db.Preload("Hospitals").Preload("Offices").Select("m.id,m.title,m.sort,m.ctime,m.mtime,m.user_org_id,m.status,m.mode_type").Order("sort").Find(&model).Error
238
+	return
239
+}
240
+
187 241