xiaoming_global 5 лет назад
Родитель
Сommit
2d3367aaba

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

@@ -11,6 +11,7 @@ import (
11 11
 	"SCRM/utils"
12 12
 	"encoding/json"
13 13
 	"strconv"
14
+	"github.com/jinzhu/gorm"
14 15
 )
15 16
 
16 17
 func ArticleRouters() {
@@ -19,6 +20,7 @@ func ArticleRouters() {
19 20
 	beego.Router("/api/acticle/getArticleType",&ArticleManage{},"Get:GetArticleType")
20 21
 	beego.Router("/api/acticle/getAllArticles",&ArticleManage{},"Get:GetAllArticles")
21 22
 	beego.Router("/api/article/addCategory",&ArticleManage{},"Post:AddCategory")
23
+	beego.Router("/api/article/getAritcleCount",&ArticleManage{},"Post:GetArticleCount")
22 24
 	beego.Router("/api/acticle/getCategorys",&ArticleManage{},"Get:GetCategorys")
23 25
 	beego.Router("/api/acticle/edit",&ArticleManage{},"Post:EditCategorys")
24 26
 	beego.Router("/api/acticle/delete",&ArticleManage{},"Delete:DeleteCategorys")
@@ -51,6 +53,7 @@ func ArticleRouters() {
51 53
     beego.Router("/api/acticle/savevidodraft",&ArticleManage{},"Post:SaveVidoDraft")
52 54
 	beego.Router("/api/article/openDeleteReply",&ArticleManage{},"Delete:DeleteAllReply")
53 55
 	beego.Router("/api/article/deleteAllArticles",&ArticleManage{},"Delete:DeleteAllArticles")
56
+
54 57
 }
55 58
 
56 59
 type ArticleManage struct {
@@ -234,7 +237,6 @@ func (this *ArticleManage) AddCategory(){
234 237
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
235 238
 		return
236 239
 	}
237
-
238 240
 	name:= dataBody["name"].(string)
239 241
 	fmt.Println("name是谁?",name)
240 242
 	if len(name) == 0 {
@@ -271,16 +273,45 @@ func (this *ArticleManage) AddCategory(){
271 273
 		Ctime: timenow,
272 274
 	}
273 275
    fmt.Println(category)
274
-	err = article_service.AddCategory(category)
275
-	fmt.Println(err)
276
-	if err !=nil{
277
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加分类失败")
276
+	articleCategory, errcod := article_service.AddCategory(name)
277
+	fmt.Println(articleCategory);
278
+	fmt.Println("errecod是什么",errcod)
279
+    if errcod == gorm.ErrRecordNotFound{
280
+		fmt.Println("aaaaa");
281
+		err := article_service.SaveCategory(category)
282
+		fmt.Println("报错",err)
283
+		this.ServeSuccessJSON(map[string]interface{}{
284
+			"category":category,
285
+		})
286
+		fmt.Println(err)
287
+	}else if errcod == nil {
288
+		fmt.Println("bbbbbbb")
289
+		this.ServeFailJsonSend(enums.ErrorCodeDBCreate, "添加标签失败:(已经存在同名的标签)")
278 290
 		return
291
+	}else {
292
+		this.ServeSuccessJSON(map[string]interface{}{
293
+			"category":category,
294
+		})
279 295
 	}
280 296
 
281
-	this.ServeSuccessJSON(map[string]interface{}{
282
-		"category":category,
283
-	})
297
+	return
298
+}
299
+
300
+func  (this *ArticleManage) GetArticleCount()  {
301
+	dataBody := make(map[string]interface{}, 0)
302
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
303
+	fmt.Println("err是什么呢",err)
304
+	if err != nil {
305
+		utils.ErrorLog(err.Error())
306
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
307
+		return
308
+	}
309
+	name:= dataBody["name"].(string)
310
+	fmt.Println("name是什么?",name)
311
+	if len(name) == 0 {
312
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "姓名不能为空")
313
+		return
314
+	}
284 315
 }
285 316
 
286 317
 func  (this *ArticleManage) GetCategorys()  {

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

@@ -25,6 +25,27 @@ func siteRouters() {
25 25
 	beego.Router("/api/site/getdoctorinfo",&Microwebsite{},"Get:GetDoctorInfo")
26 26
 	beego.Router("/api/site/keenvironment",&Microwebsite{},"Post:AddKeEnvironment")
27 27
 	beego.Router("/api/site/getOffEnvironment",&Microwebsite{},"Get:GetOffEnvironment")
28
+	beego.Router("/api/site/addrotationupload",&Microwebsite{},"Post:AddRotationUpload")
29
+	beego.Router("/api/site/addworktime",&Microwebsite{},"Post:AddWorkTime")
30
+	beego.Router("/api/site/addrideway",&Microwebsite{},"Post:AddRideway")
31
+	beego.Router("/api/site/addconnection",&Microwebsite{},"Post:AddConnection")
32
+	beego.Router("/api/site/queryconnetion",&Microwebsite{},"Get:GetQueryConnection")
33
+	beego.Router("/api/site/delete",&Microwebsite{},"Get:DeleteConnecWay")
34
+	beego.Router("/api/site/editconnecway",&Microwebsite{},"Get:EditConnecWay")
35
+	beego.Router("/api/site/saveconnection",&Microwebsite{},"Post:SaveConnection")
36
+	beego.Router("/api/site/addcontract",&Microwebsite{},"Post:AddContract")
37
+	beego.Router("/api/site/getuserdmodel",&Microwebsite{},"Post:GetUserdModel")
38
+	beego.Router("/api/site/eidtmodel",&Microwebsite{},"Get:GetEditModel")
39
+	beego.Router("/api/site/editrideway",&Microwebsite{},"Get:EditRideWay")
40
+	beego.Router("/api/site/saveworktime",&Microwebsite{},"Post:SaveWorktTime")
41
+	beego.Router("/api/site/saverideway",&Microwebsite{},"Post:Saverideway")
42
+	beego.Router("/api/site/getquerynewmodel",&Microwebsite{},"Post:GetQueryNewModel")
43
+	beego.Router("/api/site/getquerydocinfo",&Microwebsite{},"Post:GetQueryDocInfo")
44
+	beego.Router("/api/site/change",&Microwebsite{},"Get:Change")
45
+	beego.Router("/api/site/getquerydochead",&Microwebsite{},"Post:GetQueryDocHead")
46
+	beego.Router("/api/site/editdoctor",&Microwebsite{},"Get:Editdoctor")
47
+	beego.Router("/api/site/savedocinfo",&Microwebsite{},"Post:SaveDocInfo")
48
+	beego.Router("/api/site/deletedoctor",&Microwebsite{},"Get:DeleteDoctor")
28 49
 }
29 50
 
30 51
 type Microwebsite struct {
@@ -44,7 +65,6 @@ func (this *Microwebsite) AddRotaionChart()  {
44 65
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
45 66
 		return
46 67
 	}
47
-
48 68
 	title := dataBody["title"].(string)
49 69
 	if len(title) == 0 {
50 70
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
@@ -64,15 +84,30 @@ func (this *Microwebsite) AddRotaionChart()  {
64 84
 	fmt.Println("姓名:",rotationImages)
65 85
 	fmt.Println("字符串",replace)
66 86
 
67
-	rotation := models.SgjPatientRotation{
87
+
88
+
89
+	model := models.SgjPatientModel{
68 90
 		Title:     title,
69 91
 		Sort:      sortt,
70
-		RotationImages:replace,
71 92
 		UserOrgId: userOrgID,
72
-		Status:1,
93
+		Status:    1,
73 94
 		Ctime:     time.Now().Unix(),
74 95
 	}
75
-   err = site_service.AddRotationChart(rotation)
96
+	//fmt.Println(model)
97
+     site_service.AddPatientModel(&model)
98
+     fmt.Println("rotation是什么",model)
99
+	patientModel, err := site_service.QueryModel(userOrgID)
100
+	fmt.Println("patientModel是什麽",patientModel)
101
+	rotation := models.SgjPatientRotation{
102
+		Title:          title,
103
+		Sort:           sortt,
104
+		RotationImages: replace,
105
+		UserOrgId:      userOrgID,
106
+		Status:         1,
107
+		Ctime:          time.Now().Unix(),
108
+		ModelId:patientModel.ID,
109
+	}
110
+	site_service.AddRotation(rotation)
76 111
 	if err !=nil{
77 112
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
78 113
 		return
@@ -82,9 +117,6 @@ func (this *Microwebsite) AddRotaionChart()  {
82 117
 	})
83 118
 }
84 119
 
85
-
86
-
87
-
88 120
 //医院介绍
89 121
 func (this *Microwebsite) SaveHispital()  {
90 122
 	adminUserInfo := this.GetAdminUserInfo()
@@ -119,15 +151,28 @@ func (this *Microwebsite) SaveHispital()  {
119 151
 	}
120 152
 	fmt.Println("姓名是什么?",title,"排序是什么",sortt,"医院介绍不能为空",introduction)
121 153
 
154
+	model := models.SgjPatientModel{
155
+		Title:     title,
156
+		Sort:      sortt,
157
+		UserOrgId: userOrgID,
158
+		Ctime:     time.Now().Unix(),
159
+		Status:    1,
160
+	}
161
+
162
+	site_service.AddPatientModel(&model)
163
+
164
+	patientModel, err := site_service.QueryModel(userOrgID)
165
+
122 166
 	hospital := models.SgjPatientHospital{
123
-		Title:        title,
124
-		Sort:         sortt,
167
+		Title:                title,
168
+		Sort:                 sortt,
125 169
 		Introduction: introduction,
126
-		UserOrgId:userOrgID,
127
-		Ctime:time.Now().Unix(),
128
-		Status:1,
129
-
170
+		UserOrgId:            userOrgID,
171
+		Ctime:                time.Now().Unix(),
172
+		Status:               1,
173
+		Modleid: patientModel.ID,
130 174
 	}
175
+
131 176
 	err = site_service.AddHispital(hospital)
132 177
 	if err !=nil{
133 178
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
@@ -171,13 +216,27 @@ func  (this *Microwebsite) AddOffices()  {
171 216
 		return
172 217
 	}
173 218
 	fmt.Println("姓名是什么?",title,"排序是什么",sortt,"医院介绍不能为空",introduction)
219
+
220
+	model := models.SgjPatientModel{
221
+		Title:     title,
222
+		Sort:      sortt,
223
+		UserOrgId: userOrgID,
224
+		Ctime:     time.Now().Unix(),
225
+		Status:    1,
226
+	}
227
+
228
+	site_service.AddPatientModel(&model)
229
+
230
+	patientModel, err := site_service.QueryModel(userOrgID)
231
+
174 232
 	offices := models.SgjPatientOffices{
175
-		Title:        title,
176
-		Sort:         sortt,
233
+		Title:              title,
234
+		Sort:               sortt,
177 235
 		Introduction: introduction,
178
-		UserOrgId:    userOrgID,
179
-		Ctime:        time.Now().Unix(),
180
-		Status: 1,
236
+		UserOrgId:          userOrgID,
237
+		Ctime:              time.Now().Unix(),
238
+		Status:             1,
239
+		Modleid:patientModel.ID,
181 240
 	}
182 241
 	err = site_service.AddOffices(offices)
183 242
 	if err !=nil{
@@ -202,7 +261,6 @@ func (this *Microwebsite) AddDoctor()  {
202 261
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
203 262
 		return
204 263
 	}
205
-
206 264
 	title := dataBody["title"].(string)
207 265
 	if len(title) == 0 {
208 266
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
@@ -216,20 +274,33 @@ func (this *Microwebsite) AddDoctor()  {
216 274
 	}
217 275
 	sortt, err := strconv.ParseInt(sort, 10, 64)
218 276
 	fmt.Println("排序:",sortt)
219
-	image := dataBody["image"].(string)
220
-	if len(image) == 0 {
221
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
222
-		return
277
+
278
+	images := dataBody["docimages"]
279
+	replace := strings.Replace(strings.Trim(fmt.Sprint(images), "[]"), " ", ",", -1)
280
+	//if len(image) == 0 {
281
+	//	this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
282
+	//	return
283
+	//}
284
+	fmt.Println("姓名是什么?",title,"排序是什么",sortt,"图片",replace)
285
+	model := models.SgjPatientModel{
286
+		Title:     title,
287
+		Sort:      sortt,
288
+		UserOrgId: userOrgID,
289
+		Ctime:     time.Now().Unix(),
290
+		Status:    1,
223 291
 	}
224
-	fmt.Println("姓名是什么?",title,"排序是什么",sortt,"医院介绍不能为空",image)
225 292
 
293
+	site_service.AddPatientModel(&model)
294
+
295
+	patientModel, err := site_service.QueryModel(userOrgID)
226 296
 	doctor := models.SgjPatientDoctor{
227 297
 		Title:  title,
228 298
 		Sort:   sortt,
229
-		Images: image,
299
+		Images: replace,
230 300
 		UserOrgId:userOrgID,
231 301
 		Ctime:time.Now().Unix(),
232 302
 		Status:1,
303
+		Modelid:patientModel.ID,
233 304
 	}
234 305
 
235 306
 	err = site_service.AddDoctor(doctor)
@@ -256,39 +327,48 @@ func (this *Microwebsite) AddDoctorInfo()  {
256 327
 		return
257 328
 	}
258 329
 
259
-	docname := dataBody["docname"].(string)
330
+	docname := dataBody["name"].(string)
260 331
 	if len(docname) == 0 {
261 332
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生姓名不能为空")
262 333
 		return
263 334
 	}
264 335
 	fmt.Println("医生姓名:",docname)
265
-	docHead := dataBody["docHead"].(string)
336
+	docHead := dataBody["dochead"].(string)
266 337
 	if len(docHead) == 0 {
267 338
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生头像不能为空")
268 339
 		return
269 340
 	}
270 341
 	fmt.Println("医生头像:",docHead)
271
-	docpositional := dataBody["docpositional"].(string)
272
-	if len(docpositional) == 0 {
342
+	sort := dataBody["sort"].(string)
343
+	if len(sort) == 0 {
344
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
345
+		return
346
+	}
347
+	sortt, err := strconv.ParseInt(sort, 10, 64)
348
+	fmt.Println("排序:",sortt)
349
+	docpositional := int64(dataBody["user_title"].(float64))
350
+	if docpositional <= 0 {
273 351
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生职位不能为空")
274 352
 		return
275 353
 	}
276 354
 	fmt.Println("医生职位",docpositional)
277
-	docintroduction := dataBody["docintroduction"].(string)
355
+	docintroduction := dataBody["content"].(string)
278 356
 	fmt.Println("医生简介",docintroduction)
279 357
 	if len(docintroduction) == 0 {
280 358
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生简介不能为空")
281 359
 		return
282 360
 	}
283 361
 	fmt.Println("医生姓名",docname,"医生职位",docpositional,"医生头像",docHead,"医生简介",docintroduction)
362
+
284 363
 	doctor := models.SgjPatientDoctor{
285
-		Dochead:         docHead,
286 364
 		Docname:         docname,
365
+		Dochead:         docHead,
366
+		DocPosition:     docpositional,
287 367
 		Docintroduction: docintroduction,
288
-		Docpositional:   docpositional,
289
-		UserOrgId:userOrgID,
290
-		Ctime:time.Now().Unix(),
291
-		Status:1,
368
+		Ctime:           time.Now().Unix(),
369
+		UserOrgId:       userOrgID,
370
+		DocSort:sortt,
371
+		Status:          1,
292 372
 	}
293 373
 	err = site_service.AddDoctorInfo(doctor)
294 374
 	if err !=nil{
@@ -332,21 +412,43 @@ func (this *Microwebsite) AddKeEnvironment()  {
332 412
 	replace := strings.Replace(strings.Trim(fmt.Sprint(keImages), "[]"), " ", ",", -1)
333 413
 	fmt.Println("图片:",keImages)
334 414
 	fmt.Println("字符串",replace)
335
-	offenvironment := models.SgjPatientOffenvironment{
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
+	model := models.SgjPatientModel{
336 425
 		Title:     title,
337 426
 		Sort:      sortt,
338
-		Keimages:  replace,
339
-		Mtime:     time.Now().Unix(),
340 427
 		UserOrgId: userOrgID,
428
+		Ctime:     time.Now().Unix(),
341 429
 		Status:    1,
342 430
 	}
343
-	err = site_service.AddOffEnvironment(offenvironment)
431
+
432
+	site_service.AddPatientModel(&model)
433
+	patientModel, err := site_service.QueryModel(userOrgID)
434
+
435
+	officenviroment := models.SgjPatientOffenvironment{
436
+		Title:        title,
437
+		Sort:         sortt,
438
+		Keimages: replace,
439
+		Mtime:        time.Now().Unix(),
440
+		UserOrgId:    userOrgID,
441
+		Status:       1,
442
+		Modelid:patientModel.ID,
443
+	}
444
+
445
+	err = site_service.AddOffEnvironment(officenviroment)
344 446
 	if err !=nil{
345 447
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加科室环境失败")
346 448
 		return
347 449
 	}
348 450
 	this.ServeSuccessJSON(map[string]interface{}{
349
-		"offenvironment":offenvironment,
451
+		"offenvironment":officenviroment,
350 452
 	})
351 453
 }
352 454
 
@@ -413,6 +515,32 @@ func (this * Microwebsite) GetDoctorInfo()  {
413 515
 	})
414 516
 }
415 517
 
518
+func (this * Microwebsite) GetQueryDocInfo(){
519
+	adminUserInfo := this.GetAdminUserInfo()
520
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
521
+	doc, err := site_service.GetQueryDocInfo(userOrgID)
522
+	if err !=nil{
523
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
524
+		return
525
+	}
526
+	this.ServeSuccessJSON(map[string]interface{}{
527
+		"doctor":doc,
528
+	})
529
+}
530
+
531
+func (this * Microwebsite) GetQueryDocHead()  {
532
+	adminUserInfo := this.GetAdminUserInfo()
533
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
534
+	docHead, err := site_service.GetQueryDocHead(userOrgID)
535
+	if err !=nil{
536
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
537
+		return
538
+	}
539
+	this.ServeSuccessJSON(map[string]interface{}{
540
+		"docHead":docHead,
541
+	})
542
+}
543
+
416 544
 //获取科室环境
417 545
 func (this * Microwebsite) GetOffEnvironment()  {
418 546
 	adminUserInfo := this.GetAdminUserInfo()
@@ -425,4 +553,583 @@ func (this * Microwebsite) GetOffEnvironment()  {
425 553
 	this.ServeSuccessJSON(map[string]interface{}{
426 554
 		"offenvironment":offenvironment,
427 555
 	})
556
+}
557
+
558
+//添加联系我们的轮播图
559
+func  (this * Microwebsite) AddRotationUpload()  {
560
+	adminUserInfo := this.GetAdminUserInfo()
561
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
562
+	dataBody := make(map[string]interface{}, 0)
563
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
564
+	fmt.Println("错误是什么呢",err)
565
+	fmt.Println("机构ID",userOrgID)
566
+	if err != nil {
567
+		utils.ErrorLog(err.Error())
568
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
569
+		return
570
+	}
571
+
572
+	title := dataBody["title"].(string)
573
+	if len(title) == 0 {
574
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
575
+		return
576
+	}
577
+	fmt.Println("姓名:",title)
578
+	sort := dataBody["sort"].(string)
579
+	if len(sort) == 0 {
580
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
581
+		return
582
+	}
583
+	sortt, err := strconv.ParseInt(sort, 10, 64)
584
+	fmt.Println("排序:",sortt)
585
+	rotationImages := dataBody["rotationImages"]
586
+	//图片数组转为字符串保存到数据库
587
+	replace := strings.Replace(strings.Trim(fmt.Sprint(rotationImages), "[]"), " ", ",", -1)
588
+	fmt.Println("姓名:",rotationImages)
589
+	fmt.Println("字符串",replace)
590
+
591
+	connecmodel := models.SgjPatientConnecmodel{
592
+		Title:          title,
593
+		Sort:           sortt,
594
+		RotationImages: replace,
595
+		UserOrgId:      userOrgID,
596
+		Status:         1,
597
+		ModeType:        1,
598
+		Ctime:          time.Now().Unix(),
599
+	}
600
+
601
+	err = site_service.AddRotationUpload(&connecmodel)
602
+	if err !=nil{
603
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
604
+		return
605
+	}
606
+	this.ServeSuccessJSON(map[string]interface{}{
607
+		"connecmodel":connecmodel,
608
+	})
609
+}
610
+//添加工作时间
611
+func  (this * Microwebsite) AddWorkTime()  {
612
+	adminUserInfo := this.GetAdminUserInfo()
613
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
614
+	dataBody := make(map[string]interface{}, 0)
615
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
616
+	fmt.Println("错误是什么呢", err)
617
+	fmt.Println("机构ID", userOrgID)
618
+	if err != nil {
619
+		utils.ErrorLog(err.Error())
620
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
621
+		return
622
+	}
623
+	title := dataBody["title"].(string)
624
+	if len(title) == 0 {
625
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
626
+		return
627
+	}
628
+	sort := dataBody["sort"].(string)
629
+	if len(sort) == 0 {
630
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
631
+		return
632
+	}
633
+	sortt, err := strconv.ParseInt(sort, 10, 64)
634
+	fmt.Println("排序:", sortt)
635
+
636
+	worktime := dataBody["worktime"].(string)
637
+	if len(worktime) == 0 {
638
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "工作时间不能为空")
639
+		return
640
+	}
641
+
642
+	sgjworktime := models.SgjPatientConnecmodel{
643
+		Title:     title,
644
+		Sort:      sortt,
645
+		Status:    1,
646
+		UserOrgId: userOrgID,
647
+		Worktime:  worktime,
648
+		ModeType: 4,
649
+		Ctime:     time.Now().Unix(),
650
+	}
651
+
652
+	//添加模块
653
+	err = site_service.AddWorkTime(sgjworktime);
654
+	if err !=nil{
655
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
656
+		return
657
+	}
658
+	this.ServeSuccessJSON(map[string]interface{}{
659
+		"sgjworktime":sgjworktime,
660
+	})
661
+}
662
+
663
+//添加乘车方式
664
+func  (this * Microwebsite) AddRideway() {
665
+	adminUserInfo := this.GetAdminUserInfo()
666
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
667
+	dataBody := make(map[string]interface{}, 0)
668
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
669
+	fmt.Println("错误是什么呢", err)
670
+	fmt.Println("机构ID", userOrgID)
671
+	if err != nil {
672
+		utils.ErrorLog(err.Error())
673
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
674
+		return
675
+	}
676
+
677
+	title := dataBody["title"].(string)
678
+	if len(title) == 0 {
679
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
680
+		return
681
+	}
682
+	fmt.Println("姓名:", title)
683
+	sort := dataBody["sort"].(string)
684
+	if len(sort) == 0 {
685
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
686
+		return
687
+	}
688
+	sortt, err := strconv.ParseInt(sort, 10, 64)
689
+	fmt.Println("排序:", sortt)
690
+	content := dataBody["content"].(string)
691
+	if len(content) == 0 {
692
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "乘车方式不能为空")
693
+		return
694
+	}
695
+
696
+	rideway := models.SgjPatientConnecmodel{
697
+		Title:         title,
698
+		Sort:          sortt,
699
+		UserOrgId:     userOrgID,
700
+		Rideway:content,
701
+		Status:        1,
702
+		ModeType:   5,
703
+		Ctime:         time.Now().Unix(),
704
+	}
705
+
706
+	err = site_service.AddRideWay(rideway)
707
+	if err !=nil{
708
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
709
+		return
710
+	}
711
+	this.ServeSuccessJSON(map[string]interface{}{
712
+		"rideway":rideway,
713
+	})
714
+
715
+}
716
+
717
+//添加联系方式
718
+func (this * Microwebsite) AddConnection()  {
719
+	adminUserInfo := this.GetAdminUserInfo()
720
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
721
+	dataBody := make(map[string]interface{}, 0)
722
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
723
+	fmt.Println("错误是什么呢", err)
724
+	if err != nil {
725
+		utils.ErrorLog(err.Error())
726
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
727
+		return
728
+	}
729
+	title := dataBody["title"].(string)
730
+	if len(title) == 0 {
731
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
732
+		return
733
+	}
734
+	fmt.Println("姓名:", title)
735
+	connecway :=int64( dataBody["connecway"].(float64))
736
+	if connecway < 0{
737
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "联系方式不能为空")
738
+		return
739
+	}
740
+	fmt.Println("联系方式",connecway)
741
+	content := dataBody["content"].(string)
742
+	if len(content) == 0 {
743
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
744
+		return
745
+	}
746
+	fmt.Println("内容",content)
747
+
748
+	connection := models.SgjPatientConnection{
749
+		Title:     title,
750
+		Connecway: connecway,
751
+		Content:   content,
752
+		Status:    1,
753
+		Ctime:     time.Now().Unix(),
754
+		UserOrgId:userOrgID,
755
+	}
756
+	err = site_service.AddConnetion(connection);
757
+	if err !=nil{
758
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加联系方式失败")
759
+		return
760
+	}
761
+	this.ServeSuccessJSON(map[string]interface{}{
762
+		"connection":connection,
763
+	})
764
+
765
+}
766
+
767
+//获取联系方式
768
+func (this * Microwebsite)  GetQueryConnection()  {
769
+	adminUserInfo := this.GetAdminUserInfo()
770
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
771
+	conection, err := site_service.GetQueryConnection(userOrgID)
772
+	fmt.Println("conections是啥",conection)
773
+	if err !=nil{
774
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
775
+		return
776
+	}
777
+	this.ServeSuccessJSON(map[string]interface{}{
778
+		"conection":conection,
779
+	})
780
+}
781
+
782
+//删除联系人
783
+func (this * Microwebsite) DeleteConnecWay()  {
784
+	adminUserInfo := this.GetAdminUserInfo()
785
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
786
+	id, _ := this.GetInt64("id")
787
+	fmt.Println("id是啥?",id)
788
+	err := site_service.DeleteConnecWay(userOrgID, id)
789
+	if err !=nil{
790
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
791
+		return
792
+	}
793
+
794
+	returnData := make(map[string]interface{}, 0)
795
+	returnData["msg"] = "ok"
796
+	this.ServeSuccessJSON(returnData)
797
+	return
798
+}
799
+
800
+//编辑联系人
801
+func (this *Microwebsite) EditConnecWay()  {
802
+	adminUserInfo := this.GetAdminUserInfo()
803
+	id, _ := this.GetInt64("id")
804
+	fmt.Println("id是啥?",id)
805
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
806
+	connection, err := site_service.EditConnecWay(userOrgID, id)
807
+	if err !=nil{
808
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
809
+		return
810
+	}
811
+	this.ServeSuccessJSON(map[string]interface{}{
812
+		"connection":connection,
813
+	})
814
+}
815
+
816
+func (this *Microwebsite) SaveConnection()  {
817
+	adminUserInfo := this.GetAdminUserInfo()
818
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
819
+	fmt.Println("机构ID",userOrgID)
820
+	id, _ := this.GetInt64("id")
821
+	fmt.Println("id是啥?",id)
822
+	dataBody := make(map[string]interface{}, 0)
823
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
824
+	if err != nil {
825
+		utils.ErrorLog(err.Error())
826
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
827
+		return
828
+	}
829
+	title := dataBody["title"].(string)
830
+	fmt.Println("title",title)
831
+	if len(title) == 0 {
832
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
833
+		return
834
+	}
835
+	connecway := int64(dataBody["connecway"].(float64))
836
+	fmt.Println("connecway",connecway)
837
+
838
+	content := dataBody["content"].(string)
839
+	fmt.Println("content",content)
840
+	if len(content) == 0 {
841
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong,"联系方式不能为空")
842
+		return
843
+	}
844
+	connection := models.SgjPatientConnection{
845
+		Title:     title,
846
+		Connecway: connecway,
847
+		Content:   content,
848
+	}
849
+
850
+	site_service.UpadateConnec(&connection,userOrgID,id)
851
+
852
+	this.ServeSuccessJSON(map[string]interface{}{
853
+		"connection":connection,
854
+	})
855
+
856
+}
857
+
858
+//新增联系方式
859
+func (this *Microwebsite) AddContract()  {
860
+
861
+}
862
+
863
+func (this *Microwebsite) GetUserdModel()  {
864
+	adminUserInfo := this.GetAdminUserInfo()
865
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
866
+	model, err := site_service.GetUserModel(userOrgID)
867
+	if err !=nil{
868
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
869
+		return
870
+	}
871
+	fmt.Println("err")
872
+	fmt.Println("模型是什么",model)
873
+	this.ServeSuccessJSON(map[string]interface{}{
874
+		"model":model,
875
+	})
876
+}
877
+
878
+func (this *Microwebsite) GetQueryNewModel()  {
879
+	adminUserInfo := this.GetAdminUserInfo()
880
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
881
+	model, err := site_service.GetQueryNewModel(userOrgID)
882
+	fmt.Println("查询新增模块数据是什么?",model)
883
+	if err !=nil{
884
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
885
+		return
886
+	}
887
+	fmt.Println("err")
888
+	fmt.Println("返回新增模块模型是什么",model)
889
+	this.ServeSuccessJSON(map[string]interface{}{
890
+		"model":model,
891
+	})
892
+}
893
+
894
+func (this *Microwebsite) GetEditModel()  {
895
+	adminUserInfo := this.GetAdminUserInfo()
896
+	id, _ := this.GetInt64("id")
897
+	fmt.Println("模块id是啥?",id)
898
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
899
+	connecmodel, err := site_service.GetEditModel(userOrgID, id)
900
+	if err !=nil{
901
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
902
+		return
903
+	}
904
+	this.ServeSuccessJSON(map[string]interface{}{
905
+		"connecmodel":connecmodel,
906
+	})
907
+}
908
+
909
+func (this *Microwebsite) EditRideWay()  {
910
+	adminUserInfo := this.GetAdminUserInfo()
911
+	id, _ := this.GetInt64("id")
912
+	fmt.Println("模块id是啥?",id)
913
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
914
+	connecmodel, err := site_service.GetEditModel(userOrgID, id)
915
+	if err !=nil{
916
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
917
+		return
918
+	}
919
+	this.ServeSuccessJSON(map[string]interface{}{
920
+		"connecmodel":connecmodel,
921
+	})
922
+}
923
+
924
+//保存编辑后的工作时间
925
+func (this *Microwebsite) SaveWorktTime() {
926
+	adminUserInfo := this.GetAdminUserInfo()
927
+	id, _ := this.GetInt64("id")
928
+	fmt.Println("模块id是啥?",id)
929
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
930
+
931
+	dataBody := make(map[string]interface{}, 0)
932
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
933
+	if err != nil {
934
+		utils.ErrorLog(err.Error())
935
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
936
+		return
937
+	}
938
+
939
+	title := dataBody["title"].(string)
940
+	if len(title) == 0 {
941
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
942
+		return
943
+	}
944
+	fmt.Println("姓名:", title)
945
+	sort := int64(dataBody["sort"].(float64))
946
+	if sort <= 0 {
947
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
948
+		return
949
+	}
950
+	//sortt, err := strconv.ParseInt(sort, 10, 64)
951
+	fmt.Println("排序:", sort)
952
+	worktime := dataBody["worktime"].(string)
953
+	fmt.Println("工作时间",worktime)
954
+	if len(worktime) == 0 {
955
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
956
+		return
957
+	}
958
+
959
+	connecmodel := models.SgjPatientConnecmodel{
960
+		Title:    title,
961
+		Sort:     sort,
962
+		Worktime: worktime,
963
+	}
964
+	site_service.UpdateWorkTime(id,userOrgID,connecmodel);
965
+	if err !=nil{
966
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
967
+		return
968
+	}
969
+	this.ServeSuccessJSON(map[string]interface{}{
970
+		"connecmodel":connecmodel,
971
+	})
972
+}
973
+
974
+//保存编辑后的乘车方式
975
+func (this *Microwebsite)  Saverideway()  {
976
+	adminUserInfo := this.GetAdminUserInfo()
977
+	id, _ := this.GetInt64("id")
978
+	fmt.Println("模块id是啥?",id)
979
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
980
+	dataBody := make(map[string]interface{}, 0)
981
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
982
+	if err != nil {
983
+		utils.ErrorLog(err.Error())
984
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
985
+		return
986
+	}
987
+
988
+	title := dataBody["title"].(string)
989
+	if len(title) == 0 {
990
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
991
+		return
992
+	}
993
+	fmt.Println("标题:", title)
994
+	sort := int64(dataBody["sort"].(float64))
995
+	if sort <= 0 {
996
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
997
+		return
998
+	}
999
+	//sortt, err := strconv.ParseInt(sort, 10, 64)
1000
+	fmt.Println("排序:", sort)
1001
+	rideway := dataBody["rideway"].(string)
1002
+	fmt.Println("工作时间",rideway)
1003
+	if len(rideway) == 0 {
1004
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
1005
+		return
1006
+	}
1007
+	ridewaymodel := models.SgjPatientConnecmodel{
1008
+		Title:   title,
1009
+		Sort:    sort,
1010
+		Rideway: rideway,
1011
+	}
1012
+
1013
+	err = site_service.UpdateRideWay(id, userOrgID, ridewaymodel)
1014
+	fmt.Println("错误是什么?",err)
1015
+	if err !=nil{
1016
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1017
+		return
1018
+	}
1019
+	this.ServeSuccessJSON(map[string]interface{}{
1020
+		"ridewaymodel":ridewaymodel,
1021
+	})
1022
+}
1023
+
1024
+//编辑医生信息
1025
+func (this *Microwebsite) Editdoctor()  {
1026
+	adminUserInfo := this.GetAdminUserInfo()
1027
+	id, _ := this.GetInt64("id")
1028
+	fmt.Println("医生id是啥?",id)
1029
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1030
+	fmt.Println("机构id",userOrgID)
1031
+	docinfo, err := site_service.EditDoctorInfo(id, userOrgID)
1032
+	fmt.Println("错误是什么",err)
1033
+	fmt.Println("docinfo",docinfo)
1034
+	if err !=nil{
1035
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1036
+		return
1037
+	}
1038
+	this.ServeSuccessJSON(map[string]interface{}{
1039
+		"docinfo":docinfo,
1040
+	})
1041
+}
1042
+
1043
+func (this *Microwebsite) Change() {
1044
+	adminUserInfo := this.GetAdminUserInfo()
1045
+	id, _ := this.GetInt64("id")
1046
+	fmt.Println("医生id是啥?",id)
1047
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1048
+	fmt.Println("机构id",userOrgID)
1049
+	docinfo, err := site_service.QueryDocById(userOrgID, id)
1050
+	if err !=nil{
1051
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1052
+		return
1053
+	}
1054
+	this.ServeSuccessJSON(map[string]interface{}{
1055
+		"docinfo":docinfo,
1056
+	})
1057
+}
1058
+
1059
+func (this *Microwebsite) SaveDocInfo()  {
1060
+	adminUserInfo := this.GetAdminUserInfo()
1061
+	id, _ := this.GetInt64("id")
1062
+	fmt.Println("保存id是啥?",id)
1063
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1064
+	fmt.Println("机构id",userOrgID)
1065
+	dataBody := make(map[string]interface{}, 0)
1066
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1067
+	if err != nil {
1068
+		utils.ErrorLog(err.Error())
1069
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
1070
+		return
1071
+	}
1072
+	docname := dataBody["docname"].(string)
1073
+	if len(docname) == 0 {
1074
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "姓名不能为空")
1075
+		return
1076
+	}
1077
+	fmt.Println("姓名:",docname)
1078
+
1079
+	docpostion := int64(dataBody["doc_position"].(float64))
1080
+	if docpostion < 0 {
1081
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "职称不能为空")
1082
+		return
1083
+	}
1084
+
1085
+    fmt.Println("职位",docpostion)
1086
+	dochead := dataBody["dochead"].(string)
1087
+	if len(dochead) == 0 {
1088
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "头像不能为空")
1089
+		return
1090
+	}
1091
+    fmt.Println("头像",dochead)
1092
+	docsort := int64(dataBody["doc_sort"].(float64))
1093
+	if docsort <= 0 {
1094
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序不能为空")
1095
+		return
1096
+	}
1097
+    fmt.Println("排序",docsort)
1098
+	docintroduction := dataBody["docintroduction"].(string)
1099
+	if len(docintroduction) == 0 {
1100
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "头像不能为空")
1101
+		return
1102
+	}
1103
+   fmt.Println("简介",docintroduction)
1104
+	doctor := models.SgjPatientDoctor{
1105
+		Docname:         docname,
1106
+		DocPosition:     docpostion,
1107
+		Dochead:         dochead,
1108
+		DocSort:         docsort,
1109
+		Docintroduction: docintroduction,
1110
+	}
1111
+	err = site_service.UpdateDocInfo(id, userOrgID, doctor)
1112
+	if err !=nil{
1113
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1114
+		return
1115
+	}
1116
+	this.ServeSuccessJSON(map[string]interface{}{
1117
+		"doctor":doctor,
1118
+	})
1119
+}
1120
+
1121
+func (this *Microwebsite) DeleteDoctor()  {
1122
+	adminUserInfo := this.GetAdminUserInfo()
1123
+	id, _ := this.GetInt64("id")
1124
+	fmt.Println("保存id是啥?",id)
1125
+	userOrgID := int64(adminUserInfo.CurrentOrgId)
1126
+	err := site_service.DeleteDoctor(id, userOrgID)
1127
+	if err !=nil{
1128
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
1129
+		return
1130
+	}
1131
+	returnData := make(map[string]interface{}, 0)
1132
+	returnData["msg"] = "ok"
1133
+	this.ServeSuccessJSON(returnData)
1134
+	return
428 1135
 }

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

@@ -10,12 +10,27 @@ type SgjPatientRotation struct {
10 10
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
11 11
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
12 12
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
13
+	ModelId int64 `gorm:"column:model_id" json:"model_id" form:"model_id"`
13 14
 }
14 15
 
15 16
 func (SgjPatientRotation) TableName() string {
16 17
 	return "sgj_patient_rotation"
17 18
 }
18 19
 
20
+type SgjPatientModel struct {
21
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
22
+	Title string `gorm:"column:title" json:"title" form:"title"`
23
+	Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
24
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
25
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
26
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
27
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
28
+}
29
+
30
+func (SgjPatientModel) TableName() string{
31
+	return "sgj_patient_model"
32
+}
33
+
19 34
 //医院介绍
20 35
 type SgjPatientHospital struct {
21 36
 	ID int64 `gorm:"column:id" json:"id" form:"id"`
@@ -26,6 +41,7 @@ type SgjPatientHospital struct {
26 41
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
27 42
 	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
28 43
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
44
+	Modleid int64 `gorm:"column:modleid" json:"modleid" form:"modleid"`
29 45
 }
30 46
 
31 47
 func (SgjPatientHospital) TableName() string {
@@ -42,6 +58,7 @@ type SgjPatientOffices struct {
42 58
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
43 59
 	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
44 60
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
61
+	Modleid int64 `gorm:"column:modleid" json:"modleid" form:"modleid"`
45 62
 }
46 63
 
47 64
 func (SgjPatientOffices)TableName() string  {
@@ -59,9 +76,11 @@ type SgjPatientDoctor struct {
59 76
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
60 77
 	Docname string `gorm:"column:docname" json:"docname" form:"docname"`
61 78
 	Dochead string `gorm:"column:dochead" json:"dochead" form:"dochead"`
62
-	Docpositional string `gorm:"column:docpositional" json:"docpositional" form:"docpositional"`
79
+	DocPosition int64 `gorm:"column:doc_position" json:"doc_position" form:"doc_position"`
63 80
 	Docintroduction string `gorm:"column:docintroduction" json:"docintroduction" form:"docintroduction"`
64 81
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
82
+	DocSort int64 `gorm:"column:doc_sort" json:"doc_sort" form:"doc_sort"`
83
+	Modelid int64 `gorm:"column:modelid" json:"modelid" form:"modelid"`
65 84
 }
66 85
 
67 86
 func (SgjPatientDoctor) TableName() string {
@@ -78,8 +97,70 @@ type SgjPatientOffenvironment struct {
78 97
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
79 98
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
80 99
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
100
+	Modelid int64 `gorm:"column:modelid" json:"modelid" form:"modelid"`
81 101
 }
82
-
83 102
 func (SgjPatientOffenvironment) TableName() string {
84 103
 	return "sgj_patient_offenvironment"
85 104
 }
105
+
106
+type SgjPatientConnection struct {
107
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
108
+	Title string `gorm:"column:title" json:"title" form:"title"`
109
+	Connecway int64 `gorm:"column:connecway" json:"connecway" form:"connecway"`
110
+	Content string `gorm:"column:content" json:"content" form:"content"`
111
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
112
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
113
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
114
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
115
+}
116
+
117
+func (SgjPatientConnection) TableName() string{
118
+
119
+	return "sgj_patient_connection"
120
+}
121
+
122
+type SgjPatientConnecmodel struct {
123
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
124
+	Title string `gorm:"column:title" json:"title" form:"title"`
125
+	Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
126
+	RotationImages string `gorm:"column:rotation_images" json:"rotation_images" form:"rotation_images"`
127
+	HospitalAddress string `gorm:"column:hospital_address" json:"hospital_address" form:"hospital_address"`
128
+	HospitalMap string `gorm:"column:hospital_map" json:"hospital_map" form:"hospital_map"`
129
+	ConnectionWay string `gorm:"column:connection_way" json:"connection_way" form:"connection_way"`
130
+	Worktime string `gorm:"column:worktime" json:"worktime" form:"worktime"`
131
+	Rideway string `gorm:"column:rideway" json:"rideway" form:"rideway"`
132
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
133
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
134
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
135
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
136
+	ModeType int64 `gorm:"column:mode_type" json:"mode_type" form:"mode_type"`
137
+}
138
+func (SgjPatientConnecmodel) TableName() string  {
139
+
140
+	return "sgj_patient_connecmodel"
141
+}
142
+
143
+type SgjPatientNewmodel struct {
144
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
145
+	Title string `gorm:"column:title" json:"title" form:"title"`
146
+	Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
147
+	RotationImages string `gorm:"column:rotation_images" json:"rotation_images" form:"rotation_images"`
148
+	HospitalIntroduction string `gorm:"column:hospital_introduction" json:"hospital_introduction" form:"hospital_introduction"`
149
+	OfficeIntroduction string `gorm:"column:office_introduction" json:"office_introduction" form:"office_introduction"`
150
+	DoctorImages string `gorm:"column:doctor_images" json:"doctor_images" form:"doctor_images"`
151
+	OfficeImages string `gorm:"column:office_images" json:"office_images" form:"office_images"`
152
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
153
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
154
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
155
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
156
+	Docname string `gorm:"column:docname" json:"docname" form:"docname"`
157
+	Dochead string `gorm:"column:dochead" json:"dochead" form:"dochead"`
158
+	DocPositional string `gorm:"column:doc_positional" json:"doc_positional" form:"doc_positional"`
159
+	DocIntroduction string `gorm:"column:doc_introduction" json:"doc_introduction" form:"doc_introduction"`
160
+}
161
+
162
+func (SgjPatientNewmodel) TableName() string {
163
+
164
+	return "sgj_patient_newmodel"
165
+
166
+}

+ 17 - 2
service/article_service/article_category_service.go Просмотреть файл

@@ -53,9 +53,24 @@ func FindAllArticle(orgID int64, page int64,limit int64, searchKey string,classI
53 53
 		return
54 54
 }
55 55
 
56
-func AddCategory(category models.ArticleCategory) error {
56
+func AddCategory(name string)(*models.ArticleCategory,error ){
57
+     var art 	models.ArticleCategory
58
+     var err error
59
+	err = service.PatientReadDB().Model(&models.ArticleCategory{}).Where("name = ? AND status = ?", name, 1).Find(&art).Error
60
+	fmt.Println("错误",err)
61
+	if err == gorm.ErrRecordNotFound{
62
+		return nil,err
63
+	}
64
+	if err != nil {
65
+		return nil,err
66
+	}
67
+
68
+	return &art,err
69
+}
70
+
71
+func SaveCategory(category models.ArticleCategory) error {
57 72
 	err := service.PatientWriteDB().Create(&category).Error
58
-	return err
73
+	return  err
59 74
 }
60 75
 
61 76
 func GetCategorys(page int64,limit int64,orgID int64) ( categorys []*models.ArticleCategory,total int64,err error) {

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

@@ -4,15 +4,35 @@ import (
4 4
 	"SCRM/models"
5 5
 	"SCRM/service"
6 6
 	"fmt"
7
+	"time"
7 8
 )
8 9
 
9
-func AddRotationChart(rotation models.SgjPatientRotation) error {
10
+func AddPatientModel(model *models.SgjPatientModel)error{
11
+	err := service.PatientWriteDB().Create(&model).Error
12
+	fmt.Println("插入错误",err)
13
+	return  err
14
+}
15
+
16
+func QueryModel(orgID int64)( models.SgjPatientModel,error)  {
17
+	model := models.SgjPatientModel{}
18
+	err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Last(&model).Error
19
+	return model,err
20
+}
21
+
22
+func AddRotation(rotation models.SgjPatientRotation) error {
10 23
 	err := service.PatientWriteDB().Create(&rotation).Error
24
+	fmt.Println("插入数据",err)
25
+	return  err
26
+}
27
+
28
+func AddRotationUpload(connecmodel *models.SgjPatientConnecmodel) error  {
29
+	err := service.PatientWriteDB().Create(&connecmodel).Error
30
+	fmt.Println("错误是什么,err",err)
11 31
 	return  err
12 32
 }
13 33
 
14
-func AddHispital(hospital models.SgjPatientHospital) error {
15
-	err := service.PatientWriteDB().Create(&hospital).Error
34
+func AddHispital(newmodel models.SgjPatientHospital) error {
35
+	err := service.PatientWriteDB().Create(&newmodel).Error
16 36
 	return  err
17 37
 }
18 38
 
@@ -31,8 +51,8 @@ func AddDoctorInfo(doctor models.SgjPatientDoctor) error{
31 51
 	return  err
32 52
 }
33 53
 
34
-func AddOffEnvironment(offenvironment models.SgjPatientOffenvironment) error {
35
-	err := service.PatientWriteDB().Create(&offenvironment).Error
54
+func AddOffEnvironment(officenviroment models.SgjPatientOffenvironment) error {
55
+	err := service.PatientWriteDB().Create(&officenviroment).Error
36 56
 	return  err
37 57
 }
38 58
 
@@ -63,9 +83,105 @@ func GetDoctorInfo(orgID int64)(doc []*models.SgjPatientDoctor,err  error)  {
63 83
 	return
64 84
 }
65 85
 
86
+func GetQueryDocInfo(orgID int64)(doc []*models.SgjUserStaffInfo,err error)  {
87
+	err = service.UserReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Find(&doc).Error
88
+	fmt.Println("错误是什么",err)
89
+	return
90
+}
91
+
92
+func GetQueryDocHead(orgID int64) (doc []*models.SgjPatientDoctor,err error) {
93
+	err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Order("doc_sort").Find(&doc).Error
94
+	return
95
+}
96
+
66 97
 func GetOffEnvironment(orgID int64)(models.SgjPatientOffenvironment,error) {
67 98
 	offenvironment := models.SgjPatientOffenvironment{}
68 99
 	err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Last(&offenvironment).Error
69 100
 	fmt.Println("错误是什么",err)
70 101
 	return  offenvironment,err
71
-}
102
+}
103
+
104
+func AddWorkTime(connecmodel models.SgjPatientConnecmodel) error  {
105
+	err := service.PatientWriteDB().Create(&connecmodel).Error
106
+	return err
107
+}
108
+
109
+func AddRideWay(connecmodel models.SgjPatientConnecmodel) error {
110
+	err := service.PatientWriteDB().Create(&connecmodel).Error
111
+	return  err
112
+}
113
+
114
+func AddConnetion(connection models.SgjPatientConnection) error {
115
+	err := service.PatientWriteDB().Create(&connection).Error
116
+	return  err
117
+}
118
+
119
+func GetQueryConnection( orgID int64)(conection []*models.SgjPatientConnection,err error) {
120
+	err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Find(&conection).Error
121
+	return
122
+}
123
+
124
+func DeleteConnecWay(orgid int64,id int64)(error){
125
+	err := service.PatientWriteDB().Model(&models.SgjPatientConnection{}).Where("user_org_id =? AND id = ?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
126
+	return  err
127
+}
128
+
129
+func EditConnecWay(orgid int64,id int64)(models.SgjPatientConnection,error){
130
+    sgj  := models.SgjPatientConnection{}
131
+	err := service.PatientReadDB().Model(&sgj).Where("user_org_id = ? AND id =?", orgid, id).Find(&sgj).Error
132
+	return  sgj,err;
133
+}
134
+
135
+func UpadateConnec(connection *models.SgjPatientConnection,orgID int64,id int64)  {
136
+	service.PatientWriteDB().Model(connection).Where("user_org_id = ? AND id = ? AND status = ?",orgID,id,1).Update(map[string]interface{}{"title":connection.Title,"connecway":connection.Connecway,"content":connection.Content,})
137
+}
138
+
139
+func GetUserModel(orgid int64)(model []*models.SgjPatientConnecmodel,err error){
140
+	err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&model).Error
141
+	return
142
+}
143
+
144
+func GetQueryNewModel(orgid int64)(model []*models.SgjPatientModel,err error)  {
145
+	err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&model).Error
146
+	fmt.Println("错误是什么",err)
147
+	return
148
+}
149
+
150
+func GetEditModel(orgid int64,id int64)(models.SgjPatientConnecmodel,error){
151
+	connecmodel := models.SgjPatientConnecmodel{}
152
+	err := service.PatientReadDB().Model(&connecmodel).Where("user_org_id = ? AND id = ?", orgid, id).Find(&connecmodel).Error
153
+	return connecmodel,err;
154
+}
155
+
156
+func UpdateWorkTime(id int64,orgID int64,connecmodel models.SgjPatientConnecmodel)  {
157
+	service.PatientWriteDB().Model(connecmodel).Where("id = ? AND user_org_id = ? AND status = ?",id,orgID,1).Update(map[string]interface{}{"title":connecmodel.Title,"sort":connecmodel.Sort,"worktime":connecmodel.Worktime,"mtime":time.Now().Unix()})
158
+}
159
+
160
+func UpdateRideWay(id int64,orgID int64,connecmodel models.SgjPatientConnecmodel) error {
161
+	err := service.PatientWriteDB().Model(connecmodel).Where("id = ? AND user_org_id = ? AND status =?", id, orgID, 1).Update(map[string]interface{}{"title": connecmodel.Title, "sort": connecmodel.Sort, "rideway": connecmodel.Rideway, "mtime": time.Now().Unix()}).Error
162
+	return  err
163
+}
164
+
165
+func QueryDocById(orgID int64,id int64)(models.SgjUserStaffInfo,error)  {
166
+	info := models.SgjUserStaffInfo{}
167
+	err := service.UserWriteDB().Model(&info).Where("user_org_id = ? AND id = ?",orgID ,id ).Find(&info).Error
168
+	return  info,err
169
+}
170
+
171
+func  EditDoctorInfo(id int64,orgID int64)(models.SgjPatientDoctor,error)  {
172
+	doctor := models.SgjPatientDoctor{}
173
+	err := service.PatientReadDB().Model(&doctor).Where("id = ? AND user_org_id = ?", id, orgID).Find(&doctor).Error
174
+	return doctor,err
175
+}
176
+
177
+func UpdateDocInfo(id int64,orgID int64,doctor models.SgjPatientDoctor) error {
178
+	err := service.PatientWriteDB().Model(doctor).Where("id = ? AND user_org_id = ? AND status = ?", id, orgID, 1).Update(map[string]interface{}{"docname": doctor.Docname, "doc_position": doctor.DocPosition, "dochead": doctor.Dochead, "doc_sort": doctor.DocSort, "docintroduction": doctor.Docintroduction, "mtime": time.Now().Unix()}).Error
179
+	return  err
180
+}
181
+
182
+func DeleteDoctor(id int64,orgID int64)(error) {
183
+	err := service.PatientWriteDB().Model(&models.SgjPatientDoctor{}).Where("id = ? AND user_org_id = ?", id, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
184
+	return err
185
+}
186
+
187
+