Browse Source

魔方导航

xiaoming_global 4 years ago
parent
commit
956d6cf5a2

+ 77 - 16
controllers/article/article_controller.go View File

@@ -36,7 +36,7 @@ func ArticleRouters() {
36 36
 	beego.Router("/api/acticle/saveArticleDraft",&ArticleManage{},"Post:SaveArticleDraft")
37 37
 	beego.Router("/api/acticle/updateVidoInfo",&ArticleManage{},"Post:UpdateVidoInfo")
38 38
 	beego.Router("/api/acticle/previewEditArticle",&ArticleManage{},"Post:PreviewEditArticle")
39
-	beego.Router("/api/acticle/getPreviewInfo",&ArticleManage{},"Post:GetPreviewInfo")
39
+	beego.Router("/api/acticle/getPreviewInfo",&ArticleManage{},"Get:GetPreviewInfoTwo")
40 40
 	beego.Router("/api/acticle/getAllComment",&ArticleManage{},"Get:GetAllComment")
41 41
 	beego.Router("/api/acticle/getArticleCommentDetail",&ArticleManage{},"Get:GetArticleCommentDetail")
42 42
 	beego.Router("/api/article/deleteArticle",&ArticleManage{},"Get:DeleteArticles")
@@ -54,6 +54,10 @@ func ArticleRouters() {
54 54
 	beego.Router("/api/article/openDeleteReply",&ArticleManage{},"Delete:DeleteAllReply")
55 55
 	beego.Router("/api/article/deleteAllArticles",&ArticleManage{},"Delete:DeleteAllArticles")
56 56
 	beego.Router("api/aritcle/getallcategory",&ArticleManage{},"Get:GetAllCategory")
57
+	beego.Router("/api/article/getarticledetail",&ArticleManage{},"Get:GetArticleDetail")
58
+	beego.Router("/api/article/getvidodetail",&ArticleManage{},"Get:GetVidoDetail")
59
+	beego.Router("/api/article/geteditarticlecontent",&ArticleManage{},"Get:GetEditArticleContent")
60
+
57 61
 }
58 62
 
59 63
 type ArticleManage struct {
@@ -75,24 +79,26 @@ func (this *ArticleManage) CreateArticle(){
75 79
 	}
76 80
 
77 81
 	actname := dataBody["act_name"].(string)
82
+	fmt.Println("文章标题",actname)
78 83
 	if len(actname) == 0 {
79 84
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "文章标题不能为空")
80 85
 		return
81 86
 	}
82 87
 
83 88
 	actcontent := dataBody["act_content"].(string)
89
+	fmt.Println("文章内容",actcontent)
84 90
 	if len(actcontent) == 0 {
85 91
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "文章内容不能为空")
86 92
 		return
87 93
 	}
88
-
89 94
 	orglogo := dataBody["org_logo"].(string)
90
-	if len(orglogo) == 0 {
91
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "封面图片不能为空")
92
-		return
93
-	}
94
-
95
+	fmt.Println("封面图片",orglogo)
96
+	//if len(orglogo) == 0 {
97
+	//	this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "封面图片不能为空")
98
+	//	return
99
+	//}
95 100
 	acttype := int64(dataBody["act_type"].(float64))
101
+	fmt.Println("文章分类",acttype)
96 102
 	if  acttype <= 0 {
97 103
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "分类号不能为空")
98 104
 		return
@@ -113,6 +119,7 @@ func (this *ArticleManage) CreateArticle(){
113 119
 
114 120
 		}
115 121
 		err = article_service.AddAritcle(articles)
122
+		fmt.Println("错误是什么",err)
116 123
 		if err !=nil{
117 124
 			this.ServeFailJsonSend(enums.ErrorCodeDataException, "插入文章失败")
118 125
 			return
@@ -963,8 +970,9 @@ func (this * ArticleManage) UpdateVidoInfo()  {
963 970
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "文章标题不能为空")
964 971
 		return
965 972
 	}
966
-
967
-	vidpic := dataBody["vid_pic"].(string)
973
+	vioupload := dataBody["vio_upload"].(string)
974
+	fmt.Println("视频上传路径",vioupload)
975
+	vidpic := dataBody["vid_pic"].(string)+"?vframe/jpg/offset/1/w/300/h/200"
968 976
 	fmt.Println("视频封面",vidpic)
969 977
 	if len(vidpic) == 0 {
970 978
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "文章标题不能为空")
@@ -980,6 +988,7 @@ func (this * ArticleManage) UpdateVidoInfo()  {
980 988
 	articles := models.Articles{
981 989
 		Title:   vidname,
982 990
 		Imgs:    vidpic,
991
+		VideoUrl:vioupload,
983 992
 		ClassId: vidtype,
984 993
 		Status:  1,
985 994
 		Mtime:   time.Now().Unix(),
@@ -1037,7 +1046,7 @@ func (this * ArticleManage) PreviewEditArticle()  {
1037 1046
 		ClassId: classid,
1038 1047
 		Status:  1,
1039 1048
 		Mtime:   time.Now().Unix(),
1040
-		ArticleStatus:3,
1049
+		ArticleStatus:1,
1041 1050
 	}
1042 1051
 
1043 1052
 	article_service.PreviewEditArticle(articles,userOrgID,id)
@@ -1046,15 +1055,18 @@ func (this * ArticleManage) PreviewEditArticle()  {
1046 1055
 	})
1047 1056
 }
1048 1057
 
1049
-func (this * ArticleManage) GetPreviewInfo()  {
1058
+func (this * ArticleManage) GetPreviewInfoTwo()  {
1050 1059
 	adminUserInfo := this.GetAdminUserInfo()
1051 1060
 	userOrgID := adminUserInfo.CurrentOrgId
1052
-	articles, err := article_service.GetPreviewInfo(userOrgID)
1061
+	fmt.Println("机构id",userOrgID)
1062
+	id, _:= this.GetInt64("id")
1063
+	articles, err := article_service.GetPreviewInfoById(id, userOrgID)
1053 1064
 	if err !=nil{
1054 1065
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取预览失败")
1055 1066
 		return
1056 1067
 	}
1057
-	fmt.Println("文章内容",articles)
1068
+	fmt.Println("错误",err)
1069
+	fmt.Println("预览文章内容",articles)
1058 1070
 	this.ServeSuccessJSON(map[string]interface{}{
1059 1071
 		"articles":articles,
1060 1072
 	})
@@ -1324,7 +1336,7 @@ func (this * ArticleManage) SaveVidoDraft()  {
1324 1336
 		return
1325 1337
 	}
1326 1338
 
1327
-	vidpic := dataBody["vid_pic"].(string)
1339
+	vidpic := dataBody["vid_pic"].(string)+"?vframe/jpg/offset/1/w/300/h/200"
1328 1340
 	fmt.Println("视频封面",vidpic)
1329 1341
 	if len(vidpic) == 0 {
1330 1342
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "文章标题不能为空")
@@ -1332,7 +1344,7 @@ func (this * ArticleManage) SaveVidoDraft()  {
1332 1344
 	}
1333 1345
 
1334 1346
 	vidtype := int64( dataBody["vid_type"].(float64))
1335
-	fmt.Println("视频封面",vidtype)
1347
+	fmt.Println("视频类型",vidtype)
1336 1348
 	if vidtype <= 0 {
1337 1349
 		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "文章标题不能为空")
1338 1350
 		return
@@ -1429,4 +1441,53 @@ func (this *ArticleManage) GetAllCategory()  {
1429 1441
 	this.ServeSuccessJSON(map[string]interface{}{
1430 1442
 		"categorys":categorys,
1431 1443
 	})
1432
-}
1444
+}
1445
+
1446
+func (this *ArticleManage) GetArticleDetail()  {
1447
+	adminUserInfo := this.GetAdminUserInfo()
1448
+	userOrgID := adminUserInfo.CurrentOrgId
1449
+	id, _:= this.GetInt64("id")
1450
+	fmt.Println("机构id",userOrgID)
1451
+	fmt.Println("id",id)
1452
+	articles, err := article_service.GetArticleDetailById(id, userOrgID)
1453
+	if err !=nil{
1454
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询回复内容失败")
1455
+		return
1456
+	}
1457
+	this.ServeSuccessJSON(map[string]interface{}{
1458
+		"articles":articles,
1459
+	})
1460
+}
1461
+
1462
+func (this *ArticleManage) GetVidoDetail()  {
1463
+	adminUserInfo := this.GetAdminUserInfo()
1464
+	userOrgID := adminUserInfo.CurrentOrgId
1465
+	id, _:= this.GetInt64("id")
1466
+	fmt.Println("机构id",userOrgID)
1467
+	fmt.Println("id",id)
1468
+	articles, err := article_service.GetArticleDetailById(id, userOrgID)
1469
+	if err !=nil{
1470
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询回复内容失败")
1471
+		return
1472
+	}
1473
+	this.ServeSuccessJSON(map[string]interface{}{
1474
+		"articles":articles,
1475
+	})
1476
+}
1477
+
1478
+func  (this *ArticleManage) GetEditArticleContent()  {
1479
+	adminUserInfo := this.GetAdminUserInfo()
1480
+	userOrgID := adminUserInfo.CurrentOrgId
1481
+	id, _:= this.GetInt64("id")
1482
+	fmt.Println("机构id",userOrgID)
1483
+	fmt.Println("预览返回id",id)
1484
+	articles, err := article_service.GetArticleDetailById(id, userOrgID)
1485
+	if err !=nil{
1486
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询回复内容失败")
1487
+		return
1488
+	}
1489
+	this.ServeSuccessJSON(map[string]interface{}{
1490
+		"articles":articles,
1491
+	})
1492
+}
1493
+

File diff suppressed because it is too large
+ 1758 - 41
controllers/site/site_controller.go


+ 9 - 0
controllers/sms/sms_controller.go View File

@@ -85,6 +85,7 @@ func (this *SMSController) SendInitData() {
85 85
 // @param tags:string tag_id 以逗号隔开 (1,2,4)
86 86
 func (this *SMSController) TagFilterCustomerCount() {
87 87
 	tagIDsStr := this.GetString("tags")
88
+	fmt.Println("tagIDsStr是什么",tagIDsStr)
88 89
 	if len(tagIDsStr) == 0 {
89 90
 		this.ServeSuccessJSON(map[string]interface{}{
90 91
 			"count": 0,
@@ -92,7 +93,10 @@ func (this *SMSController) TagFilterCustomerCount() {
92 93
 		return
93 94
 	}
94 95
 	tagIDs := strings.Split(tagIDsStr, ",")
96
+	fmt.Println("tagIDs是什么",tagIDs)
95 97
 	count, getCountErr := member_service.GetTagUsersCountWithMobileByTagIDs(tagIDs)
98
+	fmt.Println("count是什么",count)
99
+	fmt.Println("getCountErr是什么",getCountErr)
96 100
 	if getCountErr != nil {
97 101
 		this.ErrorLog("获取标签人数失败:%v", getCountErr)
98 102
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -147,15 +151,20 @@ func (this *SMSController) Send2AllCustomers() {
147 151
 // @param tags:string 标签id以逗号隔开 (1,2,43)
148 152
 func (this *SMSController) Send2TagCustomers() {
149 153
 	content := this.GetString("content")
154
+	fmt.Println("内容",content)
150 155
 	tagIDsStr := this.GetString("tags")
156
+	fmt.Println("tagIDsStr是什么",tagIDsStr)
151 157
 	if len(content) == 0 || strings.Contains(content, "【") || strings.Contains(content, "】") || len(tagIDsStr) == 0 {
152 158
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
153 159
 		return
154 160
 	}
155 161
 
156 162
 	tagIDs := strings.Split(tagIDsStr, ",")
163
+	fmt.Println("tagIDS是什么",tagIDs)
157 164
 	adminUserInfo := this.GetAdminUserInfo()
158 165
 	customers, getCustomerErr := member_service.GetTagCustomersWithMobileByTagIDs(adminUserInfo.CurrentOrgId, tagIDs)
166
+	fmt.Println("customers是什么",customers)
167
+	fmt.Println("错误是什么",getCustomerErr)
159 168
 	if getCustomerErr != nil {
160 169
 		this.ErrorLog("获取标签指定客户失败:%v", getCustomerErr)
161 170
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 1 - 0
jobcron/activity_short_url_job.go View File

@@ -96,6 +96,7 @@ func CreateMoreActivityShortURL(lastShortURLID int) {
96 96
 		for index, url := range urlJSONs {
97 97
 			urlJSON := url.(map[string]interface{})
98 98
 			shortURL := urlJSON["url_short"].(string)
99
+			fmt.Println("shortURL是什么")
99 100
 			id := lastShortURLID + i*maxUrlCountPerRequest + (index + 1)
100 101
 			// CreateActivityWxShareWithShortURL(id, shortURL)
101 102
 

+ 123 - 2
models/site_models.go View File

@@ -33,6 +33,10 @@ type SgjPatientModel struct {
33 33
 	Editdoctor   []SgjPatientEditdoctor  `gorm:"ForeignKey:Modleid"`
34 34
 	Rotation     SgjPatientRotation  `gorm:"ForeignKey:ModelId"`
35 35
 	Macnavigation  SgjPatientMacnavigation `gorm:"ForeignKey:Modeid"`
36
+	Addactivity  SgjPatientAddactivity `gorm:"ForeignKey:Modeid"`
37
+	Articlelist  SgjPatientArticlelist `gorm:"ForeignKey:Modeid"`
38
+
39
+
36 40
 
37 41
 }
38 42
 func (SgjPatientModel) TableName() string{
@@ -57,6 +61,22 @@ func (SgjPatientHospital) TableName() string {
57 61
 	return "sgj_patient_hospital"
58 62
 }
59 63
 
64
+type SgjPatientEnviroimages struct {
65
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
66
+	Enviroimages string `gorm:"column:enviroimages" json:"enviroimages" form:"enviroimages"`
67
+	Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
68
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
69
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
70
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
71
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
72
+	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
73
+}
74
+
75
+func (SgjPatientEnviroimages) TableName() string  {
76
+
77
+	return "sgj_patient_enviroimages"
78
+}
79
+
60 80
 //科室介绍
61 81
 type SgjPatientOffices struct {
62 82
 	ID int64 `gorm:"column:id" json:"id" form:"id"`
@@ -70,6 +90,7 @@ type SgjPatientOffices struct {
70 90
 	Modleid int64 `gorm:"column:modleid" json:"modelid" form:"modelid"`
71 91
 }
72 92
 
93
+
73 94
 func (SgjPatientOffices)TableName() string  {
74 95
 	return "sgj_patient_offices"
75 96
 }
@@ -233,7 +254,7 @@ type SgjPatientOrdmodel struct {
233 254
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
234 255
 	ModeType int64 `gorm:"column:mode_type" json:"mode_type" form:"mode_type"`
235 256
 	Hosaddress     SgjPatientHosaddress `gorm:"ForeignKey:Modeid"`
236
-	Connectway     []SgjPatientConnectway `gorm:"ForeignKey:ModeId"`
257
+	Connectway     SgjPatientConnectway `gorm:"ForeignKey:ModeId"`
237 258
 	Worktime     SgjPatientWorktime `gorm:"ForeignKey:ModeId"`
238 259
 	Rideway  SgjPatientRideway `gorm:"ForeignKey:ModeId"`
239 260
 	Oldration  SgjPatientOldrotation `gorm:"ForeignKey:ModeId"`
@@ -248,7 +269,6 @@ func (SgjPatientOrdmodel) TableName() string  {
248 269
 type SgjPatientConnectway struct {
249 270
 	ID int64 `gorm:"column:id" json:"id" form:"id"`
250 271
 	Title string `gorm:"column:title" json:"title" form:"title"`
251
-	ConnectWayId string `gorm:"column:connect_way_id" json:"connect_way_id" form:"connect_way_id"`
252 272
 	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
253 273
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
254 274
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
@@ -306,6 +326,8 @@ type SgjPatientConrotation struct {
306 326
 	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
307 327
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
308 328
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
329
+	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
330
+	ImgShow int64 `gorm:"column:img_show" json:"img_show" form:"img_show"`
309 331
 }
310 332
 
311 333
 func (SgjPatientConrotation) TableName() string  {
@@ -323,6 +345,7 @@ type SgjPatientOldrotation struct {
323 345
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
324 346
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
325 347
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
348
+
326 349
 }
327 350
 
328 351
 func (SgjPatientOldrotation) TableName() string {
@@ -340,6 +363,8 @@ type SgjPatientEditpiclink struct {
340 363
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
341 364
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
342 365
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
366
+	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
367
+	ImgShow int64 `gorm:"column:img_show" json:"img_show" form:"img_show"`
343 368
 }
344 369
 
345 370
 func (SgjPatientEditpiclink) TableName() string  {
@@ -357,6 +382,8 @@ type SgjPatientEditmargin struct {
357 382
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
358 383
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
359 384
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
385
+	ImgShow int64 `gorm:"column:img_show" json:"img_show" form:"img_show"`
386
+	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
360 387
 }
361 388
 
362 389
 func (SgjPatientEditmargin) TableName() string {
@@ -374,6 +401,7 @@ type SgjPatientMacnavigation struct {
374 401
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
375 402
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
376 403
 	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
404
+	MacTitles string `gorm:"column:mac_titles" json:"mac_titles" form:"mac_titles"`
377 405
 }
378 406
 
379 407
 func (SgjPatientMacnavigation) TableName() string {
@@ -398,3 +426,96 @@ func (SgjPatientHosaddress) TableName() string  {
398 426
 	return "sgj_patient_hosaddress"
399 427
 }
400 428
 
429
+type SgjPatientAddactivity struct {
430
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
431
+	Title string `gorm:"column:title" json:"title" form:"title"`
432
+	Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
433
+	Number int64 `gorm:"column:number" json:"number" form:"number"`
434
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
435
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
436
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
437
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
438
+	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
439
+}
440
+
441
+func (SgjPatientAddactivity) TableName() string  {
442
+
443
+	return "sgj_patient_addactivity"
444
+}
445
+
446
+type SgjPatientArticlelist struct {
447
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
448
+	Title string `gorm:"column:title" json:"title" form:"title"`
449
+	Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
450
+	Category int64 `gorm:"column:category" json:"category" form:"category"`
451
+	Categoryone int64 `gorm:"column:categoryone" json:"categoryone" form:"categoryone"`
452
+	Number int64 `gorm:"column:number" json:"number" form:"number"`
453
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
454
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
455
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
456
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
457
+	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
458
+}
459
+
460
+func (SgjPatientArticlelist)TableName() string {
461
+
462
+	return "sgj_patient_articlelist"
463
+}
464
+
465
+type SgjPatientLinkaddress struct {
466
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
467
+	Addtype int64 `gorm:"column:addtype" json:"addtype" form:"addtype"`
468
+	Connecttype int64 `gorm:"column:connecttype" json:"connecttype" form:"connecttype"`
469
+	Linktype int64 `gorm:"column:linktype" json:"linktype" form:"linktype"`
470
+	Linkaddress string `gorm:"column:linkaddress" json:"linkaddress" form:"linkaddress"`
471
+	Defineaddress string `gorm:"column:defineaddress" json:"defineaddress" form:"defineaddress"`
472
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
473
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
474
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
475
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
476
+	Contenttype int64 `gorm:"column:contenttype" json:"contenttype" form:"contenttype"`
477
+}
478
+
479
+func (SgjPatientLinkaddress)TableName() string {
480
+
481
+	return "sgj_patient_linkaddress"
482
+}
483
+
484
+type SgjPatientConlinkaddress struct {
485
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
486
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
487
+	Linktype int64 `gorm:"column:linktype" json:"linktype" form:"linktype"`
488
+	Linktypetwo int64 `gorm:"column:linktypetwo" json:"linktypetwo" form:"linktypetwo"`
489
+	Linktypethree int64 `gorm:"column:linktypethree" json:"linktypethree" form:"linktypethree"`
490
+	Linktypefour int64 `gorm:"column:linktypefour" json:"linktypefour" form:"linktypefour"`
491
+	Linkaddress string `gorm:"column:linkaddress" json:"linkaddress" form:"linkaddress"`
492
+	Defineaddress string `gorm:"column:defineaddress" json:"defineaddress" form:"defineaddress"`
493
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
494
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
495
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
496
+	ConId int64 `gorm:"column:con_id" json:"con_id" form:"con_id"`
497
+}
498
+
499
+func (SgjPatientConlinkaddress)TableName() string  {
500
+
501
+	return "sgj_patient_conlinkaddress"
502
+}
503
+
504
+type SgjPatientMagiclink struct {
505
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
506
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
507
+	Linktype int64 `gorm:"column:linktype" json:"linktype" form:"linktype"`
508
+	Instationlink int64 `gorm:"column:instationlink" json:"instationlink" form:"instationlink"`
509
+	Articetype int64 `gorm:"column:articetype" json:"articetype" form:"articetype"`
510
+	Phone string `gorm:"column:phone" json:"phone" form:"phone"`
511
+	Outstationlink string `gorm:"column:outstationlink" json:"outstationlink" form:"outstationlink"`
512
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
513
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
514
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
515
+	Linkaddress string `gorm:"column:linkaddress" json:"linkaddress" form:"linkaddress"`
516
+}
517
+
518
+func (SgjPatientMagiclink)TableName() string  {
519
+
520
+	return "sgj_patient_magiclink"
521
+}

+ 19 - 5
service/article_service/article_category_service.go View File

@@ -240,7 +240,7 @@ func GetMenus(OrgID int64)(categorys []*models.ArticleCategory,err error)  {
240 240
 }
241 241
 
242 242
 func UpdataArticleInfo(art *models.Articles,orgID int64,id int64){
243
-	service.PatientWriteDB().Model(art).Where("user_org_id = ? AND id = ? AND status = ?",orgID,id,1).Update(map[string]interface{}{"title":art.Title,"content":art.Content,"imgs":art.Imgs,"class_id":art.ClassId,"mtime":art.Mtime,"article_status":art.ArticleStatus})
243
+	service.PatientWriteDB().Model(art).Where("user_org_id = ? AND id = ? AND status = ?",orgID,id,1).Update(map[string]interface{}{"title":art.Title,"content":art.Content,"imgs":art.Imgs,"video_url":art.VideoUrl,"class_id":art.ClassId,"mtime":art.Mtime,"article_status":art.ArticleStatus})
244 244
 
245 245
 }
246 246
 
@@ -252,10 +252,16 @@ func PreviewEditArticle(art models.Articles,orgID int64,id int64)  {
252 252
 	service.PatientWriteDB().Model(art).Where("user_org_id = ? AND id = ? AND status = ?",orgID,id,1).Update(map[string]interface{}{"title":art.Title,"content":art.Content,"imgs":art.Imgs,"class_id":art.ClassId,"mtime":art.Mtime,"article_status":art.ArticleStatus})
253 253
 }
254 254
 
255
-func GetPreviewInfo(orgID int64)(models.Articles,error)  {
256
-	article := models.Articles{}
257
-	err := service.PatientReadDB().Where("user_org_id = ? AND article_status = ? AND type = ?", orgID, 3, 1).Last(&article).Error
258
-	return article, err
255
+//func GetPreviewInfo(orgID int64)(models.Articles,error)  {
256
+//	article := models.Articles{}
257
+//	err := service.PatientReadDB().Where("user_org_id = ? AND article_status = ? AND type = ?", orgID, 3, 1).Last(&article).Error
258
+//	return article, err
259
+//}
260
+
261
+func GetPreviewInfoById(id int64,orgid int64)(models.Articles,error){
262
+	articles := models.Articles{}
263
+	err := service.PatientReadDB().Model(articles).Where("id = ? AND user_org_id = ?",id,orgid).Find(&articles).Error
264
+	return articles,err
259 265
 }
260 266
 
261 267
 func GetAllComment(page int64,limit int64,orgID int64)(articles []*models.Articles,total int64, err error) {
@@ -357,4 +363,12 @@ func DeleteAllArticles(ids[] int64)(err error)  {
357 363
 	return
358 364
 }
359 365
 
366
+func GetArticleDetailById(id int64,orgid int64)(models.Articles,error)  {
367
+	articles := models.Articles{}
368
+	err := service.PatientReadDB().Model(articles).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&articles).Error
369
+	return articles,err
370
+}
371
+
372
+
373
+
360 374
 

+ 1 - 1
service/member_service/member_service.go View File

@@ -163,7 +163,7 @@ func GetTagCustomersWithMobileByTagIDs(orgID int64, tagIDs []string) ([]*models.
163 163
 	var customer []*models.UserCustomer
164 164
 	err := service.UserReadDB().Table("sgj_user_customer AS uc").
165 165
 		Joins("JOIN sgj_user_tag_links AS tl on uc.id = tl.user_link_id").
166
-		Where("tl.tag_id IN (?) and tl.status = 1 and uc.user_org_id = ? and uc.status=1 and uc.mobile <>'' ", orgID, tagIDs).
166
+		Where("tl.tag_id IN (?) and tl.status = 1 and uc.user_org_id = ? and uc.status=1 and uc.mobile <>'' ", tagIDs, orgID).
167 167
 		Group("uc.id").
168 168
 		Select("uc.id, uc.name, uc.mobile").
169 169
 		Scan(&customer).

+ 453 - 5
service/site_service/site_microwebsite_service.go View File

@@ -19,12 +19,27 @@ func QueryModel(orgID int64)( models.SgjPatientModel,error)  {
19 19
 	return model,err
20 20
 }
21 21
 
22
+func UpdateEditpicLink(orgID int64,ids[] int64,editpiclink models.SgjPatientEditpiclink)(err error)  {
23
+    if(len(ids)==1){
24
+		err = service.PatientWriteDB().Model(&models.SgjPatientEditpiclink{}).Where("id = ? AND user_org_id = ? ", ids[0], orgID).Update(map[string]interface{}{"modeid": editpiclink.Modeid, "status": 1,"img_show":0, "mtime": time.Now().Unix()}).Error
25
+	}else {
26
+		err = service.PatientWriteDB().Model(&models.SgjPatientEditpiclink{}).Where("id IN(?) and user_org_id = ? ", ids, orgID).Update(map[string]interface{}{"modeid": editpiclink.Modeid, "status": 1,"img_show":0, "mtime": time.Now().Unix()}).Error
27
+	}
28
+	return
29
+}
30
+
22 31
 func AddRotation(rotation models.SgjPatientRotation) error {
23 32
 	err := service.PatientWriteDB().Create(&rotation).Error
24 33
 	fmt.Println("插入数据",err)
25 34
 	return  err
26 35
 }
27 36
 
37
+func GetRotationByLastData(orgid int64)(models.SgjPatientRotation,error)  {
38
+	rotation := models.SgjPatientRotation{}
39
+	err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&rotation).Error
40
+	return  rotation,err
41
+}
42
+
28 43
 func AddRotationUpload(connecmodel *models.SgjPatientConnecmodel) error  {
29 44
 	err := service.PatientWriteDB().Create(&connecmodel).Error
30 45
 	fmt.Println("错误是什么,err",err)
@@ -51,6 +66,11 @@ func AddDoctorInfo(doctor models.SgjPatientEditdoctor) error{
51 66
 	return  err
52 67
 }
53 68
 
69
+func AddImages(enviroimages *models.SgjPatientEnviroimages) error {
70
+	err := service.PatientWriteDB().Create(&enviroimages).Error
71
+	return err
72
+}
73
+
54 74
 func AddOffEnvironment(officenviroment models.SgjPatientOffenvironment) error {
55 75
 	err := service.PatientWriteDB().Create(&officenviroment).Error
56 76
 	return  err
@@ -236,6 +256,7 @@ func GetHospital(Orgid int64)(hostital []*models.SgjPatientHospital,err error)
236 256
 
237 257
 func GetData(orgid int64)(model []*models.SgjPatientModel,err error)  {
238 258
 	db := service.PatientReadDB().Table("sgj_patient_model as m").Where(" m.status = ?", 1)
259
+	fmt.Println("db是什么?",db)
239 260
 	if(orgid > 0){
240 261
 		db = db.Where("user_org_id = ? ", orgid)
241 262
 	}
@@ -293,9 +314,20 @@ func QuerOfficeEnviroment(id int64,orgid int64)(models.SgjPatientOffenvironment,
293 314
 	return offenvironment,err
294 315
 }
295 316
 
296
-func UpdateOfficeEnvironment(id int64,orgid int64,offenvironment models.SgjPatientOffenvironment) error {
317
+func QueryOfficeformById(modeid int64,orgid int64)(patientenviroimages []*models.SgjPatientEnviroimages,err error)  {
318
+	err = service.PatientReadDB().Model(&patientenviroimages).Where("modeid = ? AND user_org_id = ? AND status = ?", modeid, orgid, 1).Find(&patientenviroimages).Error
319
+	return
320
+}
321
+
322
+func UpdateOfficeEnvironment(id int64,orgid int64)(models.SgjPatientOffenvironment,error) {
323
+	offenvironment := models.SgjPatientOffenvironment{}
297 324
 	err := service.PatientReadDB().Model(&offenvironment).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&offenvironment).Error
298
-	return err
325
+	return offenvironment , err
326
+}
327
+
328
+func UpdatePatientOffenvironment(id int64,orgid int64,offenvironment models.SgjPatientOffenvironment)(error)  {
329
+	err := service.PatientWriteDB().Model(offenvironment).Where("id= ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": offenvironment.Title, "sort": offenvironment.Sort, "keimages": offenvironment.Keimages, "mtime": time.Now().Unix()}).Error
330
+	return  err
299 331
 }
300 332
 
301 333
 func QueryHispitalDetail(orgid int64,id int64)(models.SgjPatientHospital,error)  {
@@ -314,6 +346,11 @@ func GetDoctorDetail(orgid int64,id int64)(editdoctor []*models.SgjPatientEditdo
314 346
 	err = service.PatientReadDB().Model(&editdoctor).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Order("doc_sort").Find(&editdoctor).Error
315 347
 	return
316 348
 }
349
+func GetOfficEnviromentDetail(orgid int64,id int64)(models.SgjPatientOffenvironment,error)  {
350
+	offenvironment := models.SgjPatientOffenvironment{}
351
+	err := service.PatientReadDB().Model(&offenvironment).Where("user_org_id = ? AND modelid = ? AND status = ?", orgid, id, 1).Order("sort").Find(&offenvironment).Error
352
+	return offenvironment,err
353
+}
317 354
 
318 355
 func AddNavigation(navigation *models.SgjPatientNavigation)error  {
319 356
 	err := service.PatientWriteDB().Create(&navigation).Error
@@ -364,6 +401,16 @@ func QueryOrdeModelByID(orgid int64)(models.SgjPatientOrdmodel,error)  {
364 401
 	return ordmodel,err
365 402
 }
366 403
 
404
+func UpdateConrotaions(orgid int64,ids[] int64,conrotation models.SgjPatientConrotation)(err error)  {
405
+	if(len(ids)==1){
406
+		err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id = ? and user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "mtime": time.Now().Unix()}).Error
407
+	}else {
408
+		err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id IN(?) and user_org_id = ?", ids, orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "mtime": time.Now().Unix()}).Error
409
+	}
410
+	return
411
+}
412
+
413
+
367 414
 func DeleteModle(orgid int64,id int64)(error) {
368 415
 	err := service.PatientWriteDB().Model(models.SgjPatientOrdmodel{}).Where("user_org_id = ? AND id = ?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
369 416
 	return  err
@@ -392,7 +439,7 @@ func AddRotationpic(conrotation models.SgjPatientConrotation) error  {
392 439
 }
393 440
 
394 441
 func GetRotationImages(orgid int64)(conrotation []models.SgjPatientConrotation,err error)  {
395
-	err = service.PatientReadDB().Model(&conrotation).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&conrotation).Error
442
+	err = service.PatientReadDB().Model(&conrotation).Where("user_org_id = ? AND status = ? AND img_show = ?", orgid, 1,1).Find(&conrotation).Error
396 443
 	return conrotation,err
397 444
 }
398 445
 
@@ -401,13 +448,48 @@ func AddrotationImage(oldrotation *models.SgjPatientOldrotation) error {
401 448
 	return  err
402 449
 }
403 450
 
451
+func UpdateConrotation(orgid int64,ids[] int64,conrotation models.SgjPatientConrotation)(err error)  {
452
+	if(len(ids)==1){
453
+		err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id = ? AND user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "img_show": 0, "mtime": time.Now().Unix()}).Error
454
+	}else {
455
+		err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id IN(?) and user_org_id = ?", ids, orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "img_show": 0, "mtime": time.Now().Unix()}).Error
456
+	}
457
+	return
458
+}
459
+
460
+
461
+
404 462
 func AddImageslink(editpiclink *models.SgjPatientEditpiclink) error  {
405 463
 	err := service.PatientWriteDB().Create(&editpiclink).Error
406 464
 	return  err
407 465
 }
466
+func GetEnImages(orgid int64)(enviroimages []models.SgjPatientEnviroimages,err error)  {
467
+	err = service.PatientReadDB().Model(&enviroimages).Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&enviroimages).Error
468
+	return enviroimages,err
469
+}
470
+
471
+func UpdateImages(orgid int64,ids [] int64,enviroimages models.SgjPatientEnviroimages)(err error) {
472
+	if(len(ids)==1){
473
+		err = service.PatientWriteDB().Model(&models.SgjPatientEnviroimages{}).Where("id = ? AND user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": enviroimages.Modeid, "status": 1, "mtime": time.Now().Unix()}).Error
474
+	}else {
475
+		err = service.PatientWriteDB().Model(&models.SgjPatientEnviroimages{}).Where("id IN(?) and user_org_id = ?", ids, orgid).Update(map[string]interface{}{"modeid": enviroimages.Modeid, "status": 1, "mtime": time.Now().Unix()}).Error
476
+	}
477
+	return
478
+}
479
+
480
+func GetEditEnvirimagesById(orgid int64,id int64)(models.SgjPatientEnviroimages,error)  {
481
+	enviroimages := models.SgjPatientEnviroimages{}
482
+	err := service.PatientReadDB().Model(&enviroimages).Where("user_org_id = ? AND id =? AND status = ?", orgid, id, 1).Find(&enviroimages).Error
483
+	return enviroimages,err
484
+}
485
+
486
+func UpdateEnviroimages(id int64,orgid int64,enviroimages models.SgjPatientEnviroimages)( err error)  {
487
+	err = service.PatientReadDB().Model(&enviroimages).Where("id = ? AND user_org_id = ? AND status =?", id, orgid, 1).Update(map[string]interface{}{"enviroimages": enviroimages.Enviroimages, "sort": enviroimages.Sort, "mtime": time.Now().Unix()}).Error
488
+	return err
489
+}
408 490
 
409 491
 func GetEditImages(orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error)  {
410
-	err = service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND status = ?",orgid,1).Find(&editpiclink).Error
492
+	err = service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND status = ? AND img_show = ?",orgid,1,1).Find(&editpiclink).Error
411 493
 	return editpiclink,err
412 494
 }
413 495
 
@@ -417,7 +499,7 @@ func AddMagicNavi(editmargin *models.SgjPatientEditmargin) error {
417 499
 }
418 500
 
419 501
 func GetMagicImages(orgid int64)( editmargin []models.SgjPatientEditmargin,err error)  {
420
-	err = service.PatientReadDB().Model(&editmargin).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&editmargin).Error
502
+	err = service.PatientReadDB().Model(&editmargin).Where("user_org_id = ? AND status = ? AND img_show = ?", orgid, 1,1).Find(&editmargin).Error
421 503
 	return editmargin,err
422 504
 }
423 505
 
@@ -458,7 +540,373 @@ func DeleteImages(id int64,orgid int64)(error)  {
458 540
 	err := service.PatientWriteDB().Model(models.SgjPatientConrotation{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
459 541
 	return err
460 542
 }
543
+func DeleteSingleImages(id int64,orgid int64) (error) {
544
+	err := service.PatientWriteDB().Model(models.SgjPatientEditpiclink{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
545
+	return err
546
+}
461 547
 
548
+func AddActivity(addactivity *models.SgjPatientAddactivity) error  {
549
+
550
+	err := service.PatientWriteDB().Create(&addactivity).Error
551
+	return err
552
+}
553
+
554
+func QueryActivity(id int64,orgid int64)(models.SgjPatientAddactivity,error)  {
555
+	addactivity := models.SgjPatientAddactivity{}
556
+	err := service.PatientReadDB().Model(addactivity).Where("modeid = ? AND user_org_id = ?", id, orgid).Find(&addactivity).Error
557
+	return  addactivity,err
558
+}
559
+
560
+func UpdateActivit(id int64,orgid int64,addactivity models.SgjPatientAddactivity) error {
561
+
562
+	err := service.PatientWriteDB().Model(addactivity).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": addactivity.Title, "sort": addactivity.Sort, "number": addactivity.Number, "mtime":time.Now().Unix()}).Error
563
+	return  err
564
+}
462 565
 
566
+func DeleteMargin(id int64,orgid int64)(error)  {
567
+	err := service.PatientWriteDB().Model(models.SgjPatientEditmargin{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
568
+	return  err
569
+}
570
+
571
+func GetEditRotationImages(id int64,orgid int64)(models.SgjPatientOldrotation,error)  {
572
+	oldrotation := models.SgjPatientOldrotation{}
573
+	err := service.PatientReadDB().Model(oldrotation).Where("mode_id = ? AND user_org_id = ?", id, orgid).Find(&oldrotation).Error
574
+	return oldrotation,err
575
+}
576
+
577
+func GetEditConrotion(id int64,orgid int64)(conrotation []models.SgjPatientConrotation, err error)  {
578
+	err = service.PatientReadDB().Model(conrotation).Where("modeid = ? AND user_org_id = ?", id, orgid).Find(&conrotation).Error
579
+	return conrotation,err
580
+}
581
+
582
+func EditVisibleById(id int64,orgid int64)(models.SgjPatientConrotation,error)  {
583
+	conrotation := models.SgjPatientConrotation{}
584
+	err := service.PatientReadDB().Model(conrotation).Where("id = ? AND user_org_id = ?", id, orgid).Find(&conrotation).Error
585
+	return conrotation,err
586
+}
587
+
588
+func UpdateEditpic(id int64,orgid int64,conrotation models.SgjPatientConrotation) error  {
589
+	err := service.PatientWriteDB().Model(conrotation).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"images": conrotation.Images, "sort": conrotation.Sort, "piclink": conrotation.Piclink, "linkaddress": conrotation.Linkaddress}).Error
590
+	return  err
591
+}
592
+
593
+func GetPatientConrotationLast(orgid int64)( models.SgjPatientConrotation,error){
594
+	conrotation := models.SgjPatientConrotation{}
595
+	err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&conrotation).Error
596
+	return conrotation,err
597
+}
598
+func UpdateConLinkAddress(orgid int64,conid int64,conlinkaddress models.SgjPatientConlinkaddress) error {
599
+	err := service.PatientWriteDB().Model(&conlinkaddress).Where("user_org_id = ? and status = ? and con_id = ?", orgid, 1, conid).Update(map[string]interface{}{"con_id": conlinkaddress.ConId, "mtime": time.Now().Unix()}).Error
600
+	return err
601
+}
602
+
603
+func AddEditpic(conrotation *models.SgjPatientConrotation)(error)  {
604
+
605
+	err := service.PatientWriteDB().Create(&conrotation).Error
606
+	return  err
607
+}
608
+
609
+func QueryOldrotion(id int64,orgid int64)(models.SgjPatientOldrotation,error) {
610
+	conrotation := models.SgjPatientOldrotation{}
611
+	err := service.PatientReadDB().Model(conrotation).Where("id = ? AND user_org_id = ? ", id, orgid).Find(&conrotation).Error
612
+	return conrotation,err
613
+
614
+}
615
+
616
+func UpdateConrotaionById(id int64,orgid int64,oldrotation models.SgjPatientOldrotation)(error)  {
617
+
618
+	err := service.PatientWriteDB().Model(oldrotation).Where("id = ? AND user_org_id =? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": oldrotation.Title, "sort": oldrotation.Sort, "rotation_images": oldrotation.RotationImages, "mtime": time.Now().Unix()}).Error
619
+	return  err
620
+}
621
+
622
+func GetPatientRotaion(id int64,orgid int64)(models.SgjPatientRotation,error)  {
623
+	rotation := models.SgjPatientRotation{}
624
+	err := service.PatientReadDB().Model(&rotation).Where("model_id = ? AND user_org_id = ?", id, orgid).Find(&rotation).Error
625
+	return rotation,err
626
+}
627
+
628
+func GetPatientRotationById(id int64,orgid int64)(models.SgjPatientRotation,error)  {
629
+	rotation := models.SgjPatientRotation{}
630
+	err := service.PatientReadDB().Model(&rotation).Where("id = ? AND user_org_id =?", id, orgid).Find(&rotation).Error
631
+	return rotation,err
632
+}
633
+
634
+func QueryEditpiclink(id int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error)  {
635
+	err = service.PatientReadDB().Model(editpiclink).Where("modeid = ? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
636
+	return editpiclink,err
637
+}
638
+
639
+func GetEditSingleVisible(id int64,orgid int64)(models.SgjPatientEditpiclink,error)  {
640
+	editpiclink := models.SgjPatientEditpiclink{}
641
+	err := service.PatientReadDB().Model(&editpiclink).Where("id = ? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
642
+	return editpiclink,err
643
+}
644
+
645
+func GetQueryEditpiclink(id int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error)  {
646
+	err = service.PatientReadDB().Model(&editpiclink).Where("id=? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
647
+	return editpiclink,err
648
+
649
+}
650
+
651
+func UpdateEditPatPicLink(id int64,orgid int64,editpiclink models.SgjPatientEditpiclink)(error)  {
652
+
653
+	err := service.PatientWriteDB().Model(editpiclink).Where("id = ? AND user_org_id =? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"images": editpiclink.Images, "sort": editpiclink.Sort, "piclink": editpiclink.Piclink, "linkaddress": editpiclink.Linkaddress, "mtime": time.Now().Unix()}).Error
654
+	return  err
655
+}
656
+
657
+func GetPatientRotations(id int64,orgid int64)(models.SgjPatientRotation,error)  {
658
+	rotation := models.SgjPatientRotation{}
659
+	err := service.PatientReadDB().Model(&rotation).Where("id = ? AND user_org_id = ?", id, orgid).Find(&rotation).Error
660
+	return rotation,err
661
+}
662
+
663
+func UpdateRotationByid(id int64,orgid int64,rotation models.SgjPatientRotation)(error)  {
664
+	err := service.PatientWriteDB().Model(rotation).Where("id=? AND user_org_id = ? AND status =?", id, orgid, 1).Update(map[string]interface{}{"title": rotation.Title, "sort": rotation.Sort, "rotation_images": rotation.RotationImages, "mtime": time.Now().Unix()}).Error
665
+	return err
666
+}
667
+
668
+func UpdateModelById(id int64,orgid int64,model models.SgjPatientModel) error {
669
+	err := service.PatientWriteDB().Model(model).Where("id=? AND user_org_id =? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": model.Title, "sort": model.Sort, "mtime": time.Now().Unix()}).Error
670
+	return  err
671
+}
672
+
673
+func QuerEditMarginById(id int64,orgid int64)(models.SgjPatientEditmargin,error)  {
674
+	editmargin := models.SgjPatientEditmargin{}
675
+	err := service.PatientReadDB().Model(editmargin).Where("id = ? AND user_org_id =? AND status = ?", id, orgid, 1).Find(&editmargin).Error
676
+	return  editmargin,err
677
+}
463 678
 
679
+func UpdateMarginById(id int64,orgid int64,editmargin models.SgjPatientEditmargin) error {
464 680
 
681
+	err := service.PatientWriteDB().Model(editmargin).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"margintitle": editmargin.Margtitle, "margimage": editmargin.Margimage, "marginaddress": editmargin.Marginaddress}).Error
682
+
683
+	return  err
684
+}
685
+
686
+func GetActivitiesById(orgid int64)(models.SgjPatientAddactivity,error)  {
687
+	addactivity := models.SgjPatientAddactivity{}
688
+	err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&addactivity).Error
689
+	fmt.Println("查询活动列表错误",err)
690
+	return addactivity,err
691
+}
692
+
693
+func GetAllActivities(orgid int64,limit int64)(activity []models.Activity,err error)  {
694
+	err = service.PatientReadDB().Model(activity).Where("user_org_id = ? AND status = ?", orgid, 1).Limit(limit).Find(&activity).Error
695
+	return
696
+}
697
+
698
+func GetArticleType(orgid int64)(category []models.ArticleCategory,err error)  {
699
+	err = service.PatientReadDB().Model(category).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&category).Error
700
+	return  category,err
701
+}
702
+
703
+func AddActiclelist(articlelist *models.SgjPatientArticlelist)(error)  {
704
+
705
+	err := service.PatientWriteDB().Model(articlelist).Create(&articlelist).Error
706
+	return err
707
+}
708
+
709
+func GetArticlelist(orgid int64)(models.SgjPatientArticlelist,error)  {
710
+	articlelist := models.SgjPatientArticlelist{}
711
+	err := service.PatientReadDB().Where("user_org_id = ? AND Status = ?", orgid, 1).Last(&articlelist).Error
712
+	fmt.Println("错误",err)
713
+	return articlelist,err
714
+}
715
+
716
+func GetAllArticles(orgid int64,limit int64)(articlelist []models.Articles,err error)  {
717
+	err = service.PatientReadDB().Model(articlelist).Where("user_org_id = ? AND Status = ?", orgid, 1).Limit(limit).Find(&articlelist).Error
718
+	return
719
+}
720
+
721
+//func GetAllArticlesDetail(id int64)  {
722
+//
723
+//}
724
+
725
+func GetArticlelistById(modeid int64,orgID int64)(models.SgjPatientArticlelist,error)  {
726
+	articlelist := models.SgjPatientArticlelist{}
727
+	err := service.PatientReadDB().Model(articlelist).Where("modeid = ? AND user_org_id = ? AND Status = ?", modeid, orgID, 1).Find(&articlelist).Error
728
+	return articlelist,err
729
+}
730
+
731
+func GetAllActivitiById(modeid int64,orgID int64)(models.SgjPatientAddactivity,error)  {
732
+	addactivity := models.SgjPatientAddactivity{}
733
+	err := service.PatientReadDB().Model(addactivity).Where("modeid = ? AND user_org_id = ? AND Status = ?", modeid, orgID, 1).Find(&addactivity).Error
734
+	return addactivity,err
735
+}
736
+
737
+func UpdateArticeDetail(id int64,orgid int64,articlelist models.SgjPatientArticlelist)error {
738
+
739
+	err := service.PatientWriteDB().Model(articlelist).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": articlelist.Title, "sort": articlelist.Sort, "number": articlelist.Number, "mtime": time.Now().Unix()}).Error
740
+	return  err
741
+}
742
+
743
+func GetMacImagesByModeid(modeid int64,orgid int64)(models.SgjPatientMacnavigation,error)  {
744
+	macnavigation := models.SgjPatientMacnavigation{}
745
+	err := service.PatientReadDB().Model(macnavigation).Where("modeid = ? AND user_org_id = ? AND status = ?", modeid, orgid, 1).Find(&macnavigation).Error
746
+	return macnavigation,err
747
+}
748
+
749
+func GetModelById(id int64 ,orgid int64)(models.SgjPatientModel,error)  {
750
+	model := models.SgjPatientModel{}
751
+	err := service.PatientReadDB().Model(model).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&model).Error
752
+	return model,err
753
+}
754
+
755
+func GetOffENvironmentById(id int64,orgid int64)(models.SgjPatientOffenvironment,error)  {
756
+	offenvironment := models.SgjPatientOffenvironment{}
757
+	err := service.PatientReadDB().Model(offenvironment).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&offenvironment).Error
758
+	return offenvironment,err
759
+}
760
+
761
+func AddOfficeThree(enviroimages *models.SgjPatientEnviroimages)(error)  {
762
+	err := service.PatientWriteDB().Model(&enviroimages).Create(&enviroimages).Error
763
+	return err
764
+}
765
+func GetOfficeTwoVisible(orgid int64,id int64)(models.SgjPatientEnviroimages,error)  {
766
+	enviroimages := models.SgjPatientEnviroimages{}
767
+	err := service.PatientReadDB().Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&enviroimages).Error
768
+	return enviroimages,err
769
+}
770
+
771
+func UpdateOfficeTwo(orgid int64,id int64,enviroimages models.SgjPatientEnviroimages) error {
772
+	err := service.PatientWriteDB().Model(&enviroimages).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Update(map[string]interface{}{"enviroimages": enviroimages.Enviroimages, "sort": enviroimages.Sort, "mtime": time.Now().Unix()}).Error
773
+	return err
774
+}
775
+
776
+func DeleteOfficeById(id int64,orgid int64)(error)  {
777
+	err := service.PatientWriteDB().Model(models.SgjPatientEnviroimages{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
778
+	return  err
779
+}
780
+
781
+func GetArticleById(classid int64,orgid int64)(articlelist []models.Articles,err error) {
782
+
783
+	err = service.PatientReadDB().Model(models.Articles{}).Where("class_id = ? AND user_org_id = ? AND status = ?", classid, orgid,1).Find(&articlelist).Error
784
+	return
785
+}
786
+
787
+func GetAllActivity(orgid int64)(activtity []models.Activity,err error)  {
788
+
789
+	err = service.PatientReadDB().Model(models.Activity{}).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&activtity).Error
790
+	return
791
+}
792
+
793
+func AddLinkAddress(linkaddress *models.SgjPatientLinkaddress) error {
794
+	err := service.PatientWriteDB().Create(&linkaddress).Error
795
+	return err
796
+}
797
+
798
+func GetLinkAddress(orgid int64)(models.SgjPatientLinkaddress,error)  {
799
+
800
+	linkaddress := models.SgjPatientLinkaddress{}
801
+	err := service.PatientReadDB().Model(&linkaddress).Where("user_org_id = ? AND status = ? ", orgid, 1).Last(&linkaddress).Error
802
+	return linkaddress,err
803
+}
804
+
805
+func QuerylinkAddress(id int64,orgid int64)(models.SgjPatientLinkaddress,error)  {
806
+	linkaddress := models.SgjPatientLinkaddress{}
807
+	err := service.PatientReadDB().Model(&linkaddress).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&linkaddress).Error
808
+	return linkaddress,err
809
+}
810
+
811
+func GetAllConnecway(orgid int64)(connect []models.SgjPatientConnection,err error)  {
812
+	err = service.PatientReadDB().Model(&connect).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&connect).Error
813
+	return
814
+}
815
+
816
+func GetConnecway(orgid int64,id int64)(models.SgjPatientOrdmodel,error) {
817
+	ordmodel := models.SgjPatientOrdmodel{}
818
+	err := service.PatientReadDB().Model(&ordmodel).Where("user_org_id = ? AND status = ? AND id = ?", orgid, 1,id).Find(&ordmodel).Error
819
+	return ordmodel,err
820
+}
821
+
822
+func GetConnecwayById(orgid int64,id int64)(models.SgjPatientConnection,error)  {
823
+	connection := models.SgjPatientConnection{}
824
+	err := service.PatientReadDB().Model(&connection).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&connection).Error
825
+	return connection,err
826
+}
827
+
828
+func UpdateConnectway(id int64,orgid int64,connection models.SgjPatientConnection) error {
829
+	err := service.PatientWriteDB().Model(&connection).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": connection.Title, "connecway": connection.Connecway, "content": connection.Content,"mtime":time.Now().Unix()}).Error
830
+	return err
831
+}
832
+
833
+func AddConnectways(connection *models.SgjPatientConnection) error {
834
+	err := service.PatientWriteDB().Create(&connection).Error
835
+	return  err
836
+}
837
+
838
+func UpdateConnectways(id int64,orgid int64,connectway models.SgjPatientConnectway) error {
839
+	err := service.PatientWriteDB().Model(&connectway).Where("mode_id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": connectway.Title, "sort": connectway.Sort, "ctime": time.Now().Unix()}).Error
840
+	return  err
841
+}
842
+
843
+func GetHostpitalIntroduction(orgid int64,id int64)(models.SgjPatientOrdmodel,error)  {
844
+	ordmodel := models.SgjPatientOrdmodel{}
845
+	err := service.PatientReadDB().Model(&ordmodel).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&ordmodel).Error
846
+	return ordmodel,err
847
+}
848
+
849
+func GetHostpitaAddress(orgid int64,moid int64)(models.SgjPatientHosaddress,error)  {
850
+	hosaddress := models.SgjPatientHosaddress{}
851
+	err := service.PatientReadDB().Model(&hosaddress).Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, moid, 1).Find(&hosaddress).Error
852
+	return hosaddress,err
853
+}
854
+
855
+func UpdateHosAddress(id int64,orgid int64,hosaddress models.SgjPatientHosaddress)error  {
856
+	err := service.PatientWriteDB().Model(&hosaddress).Where("modeid = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": hosaddress.Title, "sort": hosaddress.Sort, "address": hosaddress.Address, "mtime": time.Now().Unix()}).Error
857
+	return err
858
+}
859
+
860
+func AddPicLinkAddress(conlinkaddress *models.SgjPatientConlinkaddress) error {
861
+	err := service.PatientWriteDB().Create(&conlinkaddress).Error
862
+	return  err
863
+}
864
+
865
+func GetConLinkAddressById(orgid int64)(models.SgjPatientConlinkaddress,error)  {
866
+	conlinkaddress := models.SgjPatientConlinkaddress{}
867
+	err := service.PatientReadDB().Model(&conlinkaddress).Where("user_org_id = ? AND status = ?", orgid, 1).Last(&conlinkaddress).Error
868
+	return conlinkaddress,err
869
+}
870
+
871
+func GetLinkAddressDetail(orgid int64,conid int64)(models.SgjPatientConlinkaddress,error)  {
872
+	conlinkaddress := models.SgjPatientConlinkaddress{}
873
+	err := service.PatientReadDB().Where("user_org_id = ? AND con_id = ? AND status = ?", orgid, conid, 1).Find(&conlinkaddress).Error
874
+	return conlinkaddress,err
875
+}
876
+
877
+func UpdatePicFformThree(orgid int64,id int64,conlinkaddress models.SgjPatientConlinkaddress) error {
878
+
879
+	err := service.PatientReadDB().Model(&conlinkaddress).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Update(map[string]interface{}{"linktype": conlinkaddress.Linktype, "linktypetwo": conlinkaddress.Linktypetwo, "linktypethree": conlinkaddress.Linktypethree, "linktypefour": conlinkaddress.Linktypefour,"linkaddress":conlinkaddress.Linkaddress,"defineaddress":conlinkaddress.Defineaddress}).Error
880
+	return err
881
+}
882
+
883
+func GetEnImagesTwo(orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error)  {
884
+	err = service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&editpiclink).Error
885
+	return editpiclink,err
886
+}
887
+
888
+func GetEnImagesThree(orgid int64)(conrotation []models.SgjPatientConrotation,err error)  {
889
+	err = service.PatientReadDB().Model(&conrotation).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&conrotation).Error
890
+	return conrotation,err
891
+}
892
+
893
+func AddMagiclinkData(magiclink *models.SgjPatientMagiclink)error  {
894
+
895
+	err := service.PatientWriteDB().Create(&magiclink).Error
896
+	return err
897
+}
898
+
899
+func GetMacLinkAddress(orgid int64)(models.SgjPatientMagiclink,error) {
900
+	patientMagiclink := models.SgjPatientMagiclink{}
901
+	err := service.PatientReadDB().Model(&patientMagiclink).Where("user_org_id = ? AND status = ?", orgid, 1).Last(&patientMagiclink).Error
902
+	return patientMagiclink,err
903
+}
904
+
905
+func UpdateEditMagin(orgid int64,ids[] int64,editmargin models.SgjPatientEditmargin)(err error)  {
906
+	if(len(ids) == 1){
907
+		err = service.PatientWriteDB().Model(&models.SgjPatientEditmargin{}).Where("id= ? AND user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": editmargin.Modeid, "status": 1, "img_show": 0, "mtime": time.Now().Unix()}).Error
908
+	}else {
909
+		err = service.PatientWriteDB().Model(&models.SgjPatientEditmargin{}).Where("id IN(?) and user_org_id = ? ", ids, orgid).Update(map[string]interface{}{"modeid": editmargin.Modeid, "status": 1,"img_show":0, "mtime": time.Now().Unix()}).Error
910
+	}
911
+	return
912
+}

+ 1 - 1
service/sms_service/sms_db_service.go View File

@@ -21,7 +21,7 @@ func GetBatchSendRecords(orgID int64, page int, count int) ([]*SMSBatchListViewM
21 21
 		return nil, 0, getTotalErr
22 22
 	}
23 23
 
24
-	rows, err := readDB.Raw("SELECT b.full_content, b.status, (SELECT COUNT(id) AS c FROM sgj_patient_sms_send_status WHERE batch_id = b.id) AS total_count, (SELECT COUNT(id) AS c FROM sgj_patient_sms_send_status WHERE batch_id = b.id AND STATUS = '1') AS success_count FROM sgj_patient_sms_batch AS b WHERE b.org_id = ? ORDER BY b.id LIMIT ? OFFSET ?;", orgID, count, (page-1)*count).Rows()
24
+	rows, err := readDB.Raw("SELECT b.full_content, b.status, (SELECT COUNT(id) AS c FROM sgj_patient_sms_send_status WHERE batch_id = b.id) AS total_count, (SELECT COUNT(id) AS c FROM sgj_patient_sms_send_status WHERE batch_id = b.id AND STATUS = '1') AS success_count FROM sgj_patient_sms_batch AS b WHERE b.org_id = ? ORDER BY  b.id DESC LIMIT ? OFFSET ?;", orgID, count, (page-1)*count).Rows()
25 25
 	defer rows.Close()
26 26
 	if err != nil {
27 27
 		return nil, 0, err