Browse Source

bug修改

xiaoming_global 5 years ago
parent
commit
12ac584a15

+ 219 - 5
controllers/site/site_controller.go View File

152
 	beego.Router("/api/site/updatelinkaddress",&Microwebsite{},"Post:UpdateLinkAddress")
152
 	beego.Router("/api/site/updatelinkaddress",&Microwebsite{},"Post:UpdateLinkAddress")
153
 	beego.Router("/api/site/addmaclinkaddress",&Microwebsite{},"Post:AddMacLinkAddress")
153
 	beego.Router("/api/site/addmaclinkaddress",&Microwebsite{},"Post:AddMacLinkAddress")
154
 	beego.Router("/api/site/getlinkaddress",&Microwebsite{},"Get:GetLinkAddress")
154
 	beego.Router("/api/site/getlinkaddress",&Microwebsite{},"Get:GetLinkAddress")
155
+	beego.Router("/api/site/getcountimages",&Microwebsite{},"Get:GetCountImages")
156
+    beego.Router("/api/site/addNavigationlinkform",&Microwebsite{},"Post:AddNavigationLinkform")
157
+	beego.Router("api/site/getnavigationlinkaddress",&Microwebsite{},"Get:GetNavigationlinkaddress")
158
+    beego.Router("/api/site/updateditnavigationlinkform",&Microwebsite{},"Post:UpdateditnavigationLink")
155
 }
159
 }
156
 
160
 
157
 type Microwebsite struct {
161
 type Microwebsite struct {
568
 		id := int64(idsInter.(float64))
572
 		id := int64(idsInter.(float64))
569
 		ids = append(ids, id)
573
 		ids = append(ids, id)
570
 	}
574
 	}
575
+	fmt.Println("ids是什么",ids)
571
 	model := models.SgjPatientModel{
576
 	model := models.SgjPatientModel{
572
 		Title:     title,
577
 		Title:     title,
573
 		Sort:      sort,
578
 		Sort:      sort,
1398
 	err := site_service.DeletemodleById(id, userOrgID)
1403
 	err := site_service.DeletemodleById(id, userOrgID)
1399
 	modelid := site_service.DeleteHospitalByModelid(id, userOrgID)
1404
 	modelid := site_service.DeleteHospitalByModelid(id, userOrgID)
1400
 	byModelid := site_service.DeleteOfficeByModelid(id, userOrgID)
1405
 	byModelid := site_service.DeleteOfficeByModelid(id, userOrgID)
1406
+	linkByModelid := site_service.DeleteEditPicLinkByModelid(id, userOrgID)
1407
+	enviroments := site_service.DeleteEnviroments(id, userOrgID)
1408
+	conrotation := site_service.DeleteConrotation(id, userOrgID)
1409
+	fmt.Println("linkByModelid",linkByModelid)
1410
+	fmt.Println("enviroments",enviroments)
1411
+	fmt.Println("enviroments",conrotation)
1401
 	fmt.Println(modelid,byModelid)
1412
 	fmt.Println(modelid,byModelid)
1402
 	if err !=nil{
1413
 	if err !=nil{
1403
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
1414
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
1767
 		UserOrgId:    userOrgID,
1778
 		UserOrgId:    userOrgID,
1768
 		Ctime:        time.Now().Unix(),
1779
 		Ctime:        time.Now().Unix(),
1769
 		Status:       1,
1780
 		Status:       1,
1781
+		Imgshow:1,
1782
+
1770
 	}
1783
 	}
1771
 	err = site_service.AddImages(&patientEnviroimages)
1784
 	err = site_service.AddImages(&patientEnviroimages)
1772
 	if err !=nil{
1785
 	if err !=nil{
1941
 	adminUserInfo := this.GetAdminUserInfo()
1954
 	adminUserInfo := this.GetAdminUserInfo()
1942
 	userOrgID := int64(adminUserInfo.CurrentOrgId)
1955
 	userOrgID := int64(adminUserInfo.CurrentOrgId)
1943
 	fmt.Println("机构ID",userOrgID)
1956
 	fmt.Println("机构ID",userOrgID)
1957
+	linkid, _ := this.GetInt64("id")
1958
+	fmt.Println("linkid",linkid)
1944
 	dataBody := make(map[string]interface{}, 0)
1959
 	dataBody := make(map[string]interface{}, 0)
1945
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1960
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1946
 	if err != nil {
1961
 	if err != nil {
1979
 		UserOrgId:userOrgID,
1994
 		UserOrgId:userOrgID,
1980
 		Status: 1,
1995
 		Status: 1,
1981
 		Ctime:time.Now().Unix(),
1996
 		Ctime:time.Now().Unix(),
1997
+		Linkid:linkid,
1982
 	}
1998
 	}
1983
 	err = site_service.AddNavigation(&navigation)
1999
 	err = site_service.AddNavigation(&navigation)
1984
 	if err !=nil{
2000
 	if err !=nil{
2097
 	errtw := site_service.DeleteModleByModeID(userOrgID, id)
2113
 	errtw := site_service.DeleteModleByModeID(userOrgID, id)
2098
 	way := site_service.DeleteRideWay(userOrgID, id)
2114
 	way := site_service.DeleteRideWay(userOrgID, id)
2099
 	workTime := site_service.DeleteWorkTime(userOrgID, id)
2115
 	workTime := site_service.DeleteWorkTime(userOrgID, id)
2116
+	conrotation := site_service.DeleteConrotation(id, userOrgID)
2100
 	fmt.Println("错误是什么",errtw,way,workTime)
2117
 	fmt.Println("错误是什么",errtw,way,workTime)
2118
+	fmt.Println(conrotation)
2101
 	if err !=nil{
2119
 	if err !=nil{
2102
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
2120
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
2103
 		return
2121
 		return
2171
 	patientConrotation, err := site_service.GetPatientConrotationLast(userOrgID)
2189
 	patientConrotation, err := site_service.GetPatientConrotationLast(userOrgID)
2172
 	fmt.Println("patientConrotation是设么",patientConrotation.ID)
2190
 	fmt.Println("patientConrotation是设么",patientConrotation.ID)
2173
 	fmt.Println("err是什么",err)
2191
 	fmt.Println("err是什么",err)
2192
+	conrotations, total, err := site_service.GetTotalCount(userOrgID)
2193
+	fmt.Println("conrotations",conrotations)
2174
 	conlinkaddress := models.SgjPatientConlinkaddress{
2194
 	conlinkaddress := models.SgjPatientConlinkaddress{
2175
 		ConId:patientConrotation.ID,
2195
 		ConId:patientConrotation.ID,
2176
 	}
2196
 	}
2181
 		return
2201
 		return
2182
 	}
2202
 	}
2183
 	this.ServeSuccessJSON(map[string]interface{}{
2203
 	this.ServeSuccessJSON(map[string]interface{}{
2204
+		"total":total,
2184
 		"conrotation":conrotation,
2205
 		"conrotation":conrotation,
2185
 	})
2206
 	})
2186
 }
2207
 }
2329
 	}
2350
 	}
2330
 
2351
 
2331
 	err = site_service.AddImageslink(&editpiclink)
2352
 	err = site_service.AddImageslink(&editpiclink)
2353
+	edipiclink, total, err := site_service.GetCountImages(userOrgID)
2354
+	fmt.Println(edipiclink)
2332
 	if err !=nil{
2355
 	if err !=nil{
2333
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2356
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2334
 		return
2357
 		return
2335
 	}
2358
 	}
2336
 	this.ServeSuccessJSON(map[string]interface{}{
2359
 	this.ServeSuccessJSON(map[string]interface{}{
2337
 		"editpiclink":editpiclink,
2360
 		"editpiclink":editpiclink,
2361
+		"total":total,
2338
 	})
2362
 	})
2339
 }
2363
 }
2340
 
2364
 
2520
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除图片失败")
2544
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除图片失败")
2521
 		return
2545
 		return
2522
 	}
2546
 	}
2547
+	edipiclink, total, err := site_service.GetCountImages(userOrgID)
2548
+	fmt.Println("edipiclink",edipiclink)
2549
+	if err !=nil{
2550
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2551
+		return
2552
+	}
2553
+	this.ServeSuccessJSON(map[string]interface{}{
2554
+		"total":total,
2555
+	})
2523
 	returnData := make(map[string]interface{}, 0)
2556
 	returnData := make(map[string]interface{}, 0)
2524
 	returnData["msg"] = "ok"
2557
 	returnData["msg"] = "ok"
2525
 	this.ServeSuccessJSON(returnData)
2558
 	this.ServeSuccessJSON(returnData)
2738
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2771
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2739
 		return
2772
 		return
2740
 	}
2773
 	}
2774
+	conrotation, total, err := site_service.GetTotalCount(userOrgID)
2775
+	fmt.Println("conrotation",conrotation)
2776
+	if err !=nil{
2777
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
2778
+		return
2779
+	}
2780
+	this.ServeSuccessJSON(map[string]interface{}{
2781
+		"total":total,
2782
+	})
2741
 	returnData := make(map[string]interface{}, 0)
2783
 	returnData := make(map[string]interface{}, 0)
2742
 	returnData["msg"] = "ok"
2784
 	returnData["msg"] = "ok"
2743
 	this.ServeSuccessJSON(returnData)
2785
 	this.ServeSuccessJSON(returnData)
2755
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2797
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2756
 		return
2798
 		return
2757
 	}
2799
 	}
2800
+	edipiclink, total, err := site_service.GetCountImages(userOrgID)
2801
+	fmt.Println(edipiclink)
2802
+	if err !=nil{
2803
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
2804
+		return
2805
+	}
2806
+	this.ServeSuccessJSON(map[string]interface{}{
2807
+		"total":total,
2808
+	})
2758
 	returnData := make(map[string]interface{}, 0)
2809
 	returnData := make(map[string]interface{}, 0)
2759
 	returnData["msg"] = "ok"
2810
 	returnData["msg"] = "ok"
2760
 	this.ServeSuccessJSON(returnData)
2811
 	this.ServeSuccessJSON(returnData)
2962
 	fmt.Println("图片链接",piclink)
3013
 	fmt.Println("图片链接",piclink)
2963
 	linkaddress := dataBody["linkaddress"].(string)
3014
 	linkaddress := dataBody["linkaddress"].(string)
2964
 	fmt.Println("链接地址",linkaddress)
3015
 	fmt.Println("链接地址",linkaddress)
3016
+	modeid := int64(dataBody["modeid"].(float64))
3017
+	fmt.Println("天梦中",modeid)
2965
 	conrotation := models.SgjPatientConrotation{
3018
 	conrotation := models.SgjPatientConrotation{
2966
 		Images:      images,
3019
 		Images:      images,
2967
 		Sort:        sort,
3020
 		Sort:        sort,
2974
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3027
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
2975
 		return
3028
 		return
2976
 	}
3029
 	}
3030
+	conrotations, err := site_service.QueryConRotation(modeid, userOrgID)
3031
+	fmt.Println("错误小小马",err)
3032
+	fmt.Println(conrotations)
2977
 	this.ServeSuccessJSON(map[string]interface{}{
3033
 	this.ServeSuccessJSON(map[string]interface{}{
2978
 		"conrotation":conrotation,
3034
 		"conrotation":conrotation,
3035
+		"conrotations":conrotations,
2979
 	})
3036
 	})
2980
 }
3037
 }
2981
 
3038
 
3003
 	linkaddress := dataBody["linkaddress"].(string)
3060
 	linkaddress := dataBody["linkaddress"].(string)
3004
 	fmt.Println("链接地址",linkaddress)
3061
 	fmt.Println("链接地址",linkaddress)
3005
 	id, _ := this.GetInt64("id")
3062
 	id, _ := this.GetInt64("id")
3063
+	fmt.Println("下孟子id",id)
3006
 	oldrotation, err := site_service.QueryOldrotion(id, userOrgID)
3064
 	oldrotation, err := site_service.QueryOldrotion(id, userOrgID)
3065
+	fmt.Println("oldrotation",oldrotation)
3007
 	conrotation := models.SgjPatientConrotation{
3066
 	conrotation := models.SgjPatientConrotation{
3008
 		Images:      images,
3067
 		Images:      images,
3009
 		Sort:        sort,
3068
 		Sort:        sort,
3010
 		Piclink:     piclink,
3069
 		Piclink:     piclink,
3011
 		Linkaddress: linkaddress,
3070
 		Linkaddress: linkaddress,
3012
 		Status:      1,
3071
 		Status:      1,
3013
-		Modeid:      oldrotation.ModeId,
3072
+		Modeid:      id,
3014
 		UserOrgId:   userOrgID,
3073
 		UserOrgId:   userOrgID,
3015
 		Ctime:time.Now().Unix(),
3074
 		Ctime:time.Now().Unix(),
3016
 		ImgShow:1,
3075
 		ImgShow:1,
3020
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3079
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3021
 		return
3080
 		return
3022
 	}
3081
 	}
3082
+	conrotations, erros := site_service.QueryConRotation(id, userOrgID)
3083
+	fmt.Println("门前错误",erros)
3084
+	fmt.Println("conrotations是什么",conrotations)
3023
 	this.ServeSuccessJSON(map[string]interface{}{
3085
 	this.ServeSuccessJSON(map[string]interface{}{
3024
 		"conrotation":conrotation,
3086
 		"conrotation":conrotation,
3087
+		"conrotations":conrotations,
3025
 	})
3088
 	})
3026
 }
3089
 }
3027
 
3090
 
3053
 	}
3116
 	}
3054
 	err = site_service.UpdateConrotaionById(id, userOrgID,oldrotation)
3117
 	err = site_service.UpdateConrotaionById(id, userOrgID,oldrotation)
3055
 	fmt.Println(err)
3118
 	fmt.Println(err)
3056
-	patientOldrotation, err:= site_service.QueryOldrotion(id, userOrgID)
3119
+	fmt.Println("马文强错错误是什么",err)
3057
 	ordmodel := models.SgjPatientOrdmodel{
3120
 	ordmodel := models.SgjPatientOrdmodel{
3058
 		Title: title,
3121
 		Title: title,
3059
 		Sort:  sort,
3122
 		Sort:  sort,
3060
 	}
3123
 	}
3061
-	err = site_service.UpdateOrdeModel(patientOldrotation.ModeId, userOrgID, ordmodel)
3062
-	if err !=nil{
3124
+	err = site_service.UpdateOrdeModel(id, userOrgID, ordmodel)
3125
+
3126
+		if err !=nil{
3063
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3127
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3064
 		return
3128
 		return
3065
 	}
3129
 	}
3081
 	editpiclink, err := site_service.QueryEditpiclink(id, userOrgID)
3145
 	editpiclink, err := site_service.QueryEditpiclink(id, userOrgID)
3082
 	fmt.Println("错误是多少",err)
3146
 	fmt.Println("错误是多少",err)
3083
 	fmt.Println("返回数据",editpiclink)
3147
 	fmt.Println("返回数据",editpiclink)
3148
+	editpiclinks, total, err := site_service.QueryEditpiclinkCount(id, userOrgID)
3149
+	fmt.Println(editpiclinks)
3084
 	if err !=nil{
3150
 	if err !=nil{
3085
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3151
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3086
 		return
3152
 		return
3087
 	}
3153
 	}
3154
+
3088
 	this.ServeSuccessJSON(map[string]interface{}{
3155
 	this.ServeSuccessJSON(map[string]interface{}{
3089
 		"patientEditpiclink":patientEditpiclink,
3156
 		"patientEditpiclink":patientEditpiclink,
3090
 		"editpiclink":editpiclink,
3157
 		"editpiclink":editpiclink,
3158
+		"total":total,
3091
 	})
3159
 	})
3092
 
3160
 
3093
 }
3161
 }
3136
 	fmt.Println("图片链接",piclink)
3204
 	fmt.Println("图片链接",piclink)
3137
     linkaddress := dataBody["linkaddress"].(string)
3205
     linkaddress := dataBody["linkaddress"].(string)
3138
     fmt.Println("链接地址",linkaddress)
3206
     fmt.Println("链接地址",linkaddress)
3207
+	modelid := int64(dataBody["modeid"].(float64))
3208
+
3139
 	editpiclink := models.SgjPatientEditpiclink{
3209
 	editpiclink := models.SgjPatientEditpiclink{
3140
 		Images:      images,
3210
 		Images:      images,
3141
 		Sort:        sort,
3211
 		Sort:        sort,
3144
 	}
3214
 	}
3145
 	err = site_service.UpdateEditPatPicLink(id, userOrgID, editpiclink)
3215
 	err = site_service.UpdateEditPatPicLink(id, userOrgID, editpiclink)
3146
 	fmt.Println("第一个错误是设么",err)
3216
 	fmt.Println("第一个错误是设么",err)
3147
-	patientEditpiclink, err := site_service.GetQueryEditpiclink(id, userOrgID)
3217
+	patientEditpiclink, err := site_service.GetQueryEditpiclink(modelid, userOrgID)
3148
 	fmt.Println("错误是多",err)
3218
 	fmt.Println("错误是多",err)
3149
     fmt.Println("pateientEditpiclink是多少",patientEditpiclink)
3219
     fmt.Println("pateientEditpiclink是多少",patientEditpiclink)
3150
 	if err !=nil{
3220
 	if err !=nil{
3194
 		ImgShow:1,
3264
 		ImgShow:1,
3195
 	}
3265
 	}
3196
 	err = site_service.AddImageslink(&editpiclink)
3266
 	err = site_service.AddImageslink(&editpiclink)
3267
+	edipiclink, total, err := site_service.GetCountPicImages(userOrgID, patientRotation.ModelId)
3268
+	fmt.Println(edipiclink)
3197
 	if err !=nil{
3269
 	if err !=nil{
3198
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3270
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3199
 		return
3271
 		return
3200
 	}
3272
 	}
3201
 	this.ServeSuccessJSON(map[string]interface{}{
3273
 	this.ServeSuccessJSON(map[string]interface{}{
3202
 		"editpiclink":editpiclink,
3274
 		"editpiclink":editpiclink,
3275
+		"total":total,
3203
 	})
3276
 	})
3204
 }
3277
 }
3205
 
3278
 
3644
 	}
3717
 	}
3645
 	sort:= int64(dataBody["sort"].(float64))
3718
 	sort:= int64(dataBody["sort"].(float64))
3646
 	fmt.Println("排序",sort)
3719
 	fmt.Println("排序",sort)
3720
+	modelid := int64(dataBody["modelid"].(float64))
3721
+	fmt.Println("小泽",modelid)
3647
 	enviroimages := models.SgjPatientEnviroimages{
3722
 	enviroimages := models.SgjPatientEnviroimages{
3648
 		Enviroimages: officeImages,
3723
 		Enviroimages: officeImages,
3649
 		Sort:         sort,
3724
 		Sort:         sort,
3650
 	}
3725
 	}
3651
 	err = site_service.UpdateOfficeTwo(userOrgID, id, enviroimages)
3726
 	err = site_service.UpdateOfficeTwo(userOrgID, id, enviroimages)
3727
+	patientEnviroimages, err := site_service.GetQueryEnviroimage(userOrgID, modelid)
3652
 	fmt.Println("错误是什么",err)
3728
 	fmt.Println("错误是什么",err)
3653
 	if err !=nil{
3729
 	if err !=nil{
3654
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3730
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3656
 	}
3732
 	}
3657
 	this.ServeSuccessJSON(map[string]interface{}{
3733
 	this.ServeSuccessJSON(map[string]interface{}{
3658
 		"enviroimages":enviroimages,
3734
 		"enviroimages":enviroimages,
3735
+		"patientEnviroimages":patientEnviroimages,
3659
 	})
3736
 	})
3660
 }
3737
 }
3661
 
3738
 
4527
 		"linkaddress":linkaddress,
4604
 		"linkaddress":linkaddress,
4528
 	})
4605
 	})
4529
 }
4606
 }
4607
+
4608
+func (this*Microwebsite) GetCountImages()  {
4609
+	adminUserInfo := this.GetAdminUserInfo()
4610
+	userOrgID := adminUserInfo.CurrentOrgId
4611
+	fmt.Println("机构id", userOrgID)
4612
+	edipiclink, total, err := site_service.GetCountImages(userOrgID)
4613
+	fmt.Println(edipiclink)
4614
+	fmt.Println("total是什么",total)
4615
+	fmt.Println("err是什么",err)
4616
+}
4617
+
4618
+func (this*Microwebsite) AddNavigationLinkform()  {
4619
+	adminUserInfo := this.GetAdminUserInfo()
4620
+	userOrgID := adminUserInfo.CurrentOrgId
4621
+	fmt.Println("机构id", userOrgID)
4622
+	dataBody := make(map[string]interface{}, 0)
4623
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
4624
+	if err != nil {
4625
+		utils.ErrorLog(err.Error())
4626
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
4627
+		return
4628
+	}
4629
+	linktype := int64(dataBody["linktype"].(float64))
4630
+	fmt.Println("链接类型",linktype)
4631
+	linktypetwo := int64(dataBody["linktypetwo"].(float64))
4632
+	fmt.Println("链接类型2",linktypetwo)
4633
+	articetype := int64(dataBody["articetype"].(float64))
4634
+	fmt.Println("文章分类",articetype)
4635
+	title := int64(dataBody["title"].(float64))
4636
+	fmt.Println("文章标题",title)
4637
+	phone := dataBody["phone"].(string)
4638
+	fmt.Println("电话号码",phone)
4639
+	outstation := dataBody["outstation"].(string)
4640
+	fmt.Println("站外链接",outstation)
4641
+	linkaddress := dataBody["linkaddress"].(string)
4642
+	fmt.Println("链接地址",linkaddress)
4643
+	if(phone != ""){
4644
+      linkaddress = phone
4645
+	}
4646
+	if(outstation != ""){
4647
+		linkaddress = outstation
4648
+	}
4649
+	navgationlink := models.SgjPatientNavgationlink{
4650
+		Linktype:    linktype,
4651
+		Linktypetwo: linktypetwo,
4652
+		Articetype:  articetype,
4653
+		Title:       title,
4654
+		Phone:       phone,
4655
+		Outstation:  outstation,
4656
+		Status:      1,
4657
+		Ctime:       time.Now().Unix(),
4658
+		UserOrgId:   userOrgID,
4659
+		Linkaddress:linkaddress,
4660
+	}
4661
+	addNavgationlink := site_service.AddNavgationlink(&navgationlink)
4662
+	patientNavgationlink, err:= site_service.GetNavgationlinkLastData(userOrgID)
4663
+	fmt.Println("错误",err)
4664
+	fmt.Println("patientNavgationlink",patientNavgationlink)
4665
+	if err !=nil{
4666
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4667
+		return
4668
+	}
4669
+	this.ServeSuccessJSON(map[string]interface{}{
4670
+		"addNavgationlink":addNavgationlink,
4671
+		"patientNavgationlink":patientNavgationlink,
4672
+	})
4673
+}
4674
+
4675
+func (this*Microwebsite) GetNavigationlinkaddress()  {
4676
+	adminUserInfo := this.GetAdminUserInfo()
4677
+	userOrgID := adminUserInfo.CurrentOrgId
4678
+	fmt.Println("机构id", userOrgID)
4679
+	id,_ := this.GetInt64("id")
4680
+	fmt.Println("id是什么",id)
4681
+	navgationlink, err := site_service.GetNavgationlinkAddressBylinkId(userOrgID, id)
4682
+	fmt.Println("大错误",err)
4683
+	fmt.Println(navgationlink)
4684
+	if err !=nil{
4685
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4686
+		return
4687
+	}
4688
+	this.ServeSuccessJSON(map[string]interface{}{
4689
+		"navgationlink":navgationlink,
4690
+	})
4691
+}
4692
+
4693
+func (this*Microwebsite) UpdateditnavigationLink() {
4694
+	adminUserInfo := this.GetAdminUserInfo()
4695
+	userOrgID := adminUserInfo.CurrentOrgId
4696
+	fmt.Println("机构id", userOrgID)
4697
+	id,_ := this.GetInt64("id")
4698
+	fmt.Println("这个id",id)
4699
+	dataBody := make(map[string]interface{}, 0)
4700
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
4701
+	if err != nil {
4702
+		utils.ErrorLog(err.Error())
4703
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
4704
+		return
4705
+	}
4706
+	linktype := int64(dataBody["linktype"].(float64))
4707
+	fmt.Println("链接类型",linktype)
4708
+	linktypetwo := int64(dataBody["linktypetwo"].(float64))
4709
+	fmt.Println("链接类型二",linktypetwo)
4710
+	articetype := int64(dataBody["articetype"].(float64))
4711
+	fmt.Println("文章分类",articetype)
4712
+	title := int64(dataBody["title"].(float64))
4713
+	fmt.Println("文章标题",title)
4714
+	phone := dataBody["phone"].(string)
4715
+	fmt.Println("电话号码",phone)
4716
+	outstation := dataBody["outstation"].(string)
4717
+	fmt.Println("站外链接",outstation)
4718
+	linkaddress := dataBody["linkaddress"].(string)
4719
+	fmt.Println("链接地址",linkaddress)
4720
+	if(phone!=""){
4721
+		linkaddress = phone;
4722
+	}
4723
+	if(outstation != ""){
4724
+		linkaddress = outstation;
4725
+	}
4726
+	navgationlink := models.SgjPatientNavgationlink{
4727
+		Linktype:    linktype,
4728
+		Linktypetwo: linktype,
4729
+		Articetype:  articetype,
4730
+		Title:       title,
4731
+		Phone:       phone,
4732
+		Outstation:outstation,
4733
+		Linkaddress: linkaddress,
4734
+	}
4735
+	err = site_service.UpdateditnavigationLink(userOrgID, id, navgationlink)
4736
+	if err !=nil{
4737
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
4738
+		return
4739
+	}
4740
+	this.ServeSuccessJSON(map[string]interface{}{
4741
+		"navgationlink":navgationlink,
4742
+	})
4743
+}

+ 26 - 1
models/site_models.go View File

36
 	Addactivity  SgjPatientAddactivity `gorm:"ForeignKey:Modeid"`
36
 	Addactivity  SgjPatientAddactivity `gorm:"ForeignKey:Modeid"`
37
 	Articlelist  SgjPatientArticlelist `gorm:"ForeignKey:Modeid"`
37
 	Articlelist  SgjPatientArticlelist `gorm:"ForeignKey:Modeid"`
38
 	Editmargin  []SgjPatientEditmargin `gorm:"ForeignKey:Modeid"`
38
 	Editmargin  []SgjPatientEditmargin `gorm:"ForeignKey:Modeid"`
39
+	Enviroimages  []SgjPatientEnviroimages `gorm:"ForeignKey:Modeid"`
40
+	PatientEditpiclink  []SgjPatientEditpiclink `gorm:"ForeignKey:Modeid"`
41
+
39
 
42
 
40
 
43
 
41
 
44
 
71
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
74
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
72
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
75
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
73
 	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
76
 	Modeid int64 `gorm:"column:modeid" json:"modeid" form:"modeid"`
77
+	Imgshow int64 `gorm:"column:imgshow" json:"imgshow" form:"imgshow"`
74
 }
78
 }
75
 
79
 
76
 func (SgjPatientEnviroimages) TableName() string  {
80
 func (SgjPatientEnviroimages) TableName() string  {
222
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
226
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
223
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
227
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
224
 	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
228
 	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
229
+	Linkid int64 `gorm:"column:linkid" json:"linkid" form:"linkid"`
225
 }
230
 }
226
 
231
 
227
 func (SgjPatientNavigation) TableName() string  {
232
 func (SgjPatientNavigation) TableName() string  {
259
 	Worktime     SgjPatientWorktime `gorm:"ForeignKey:ModeId"`
264
 	Worktime     SgjPatientWorktime `gorm:"ForeignKey:ModeId"`
260
 	Rideway  SgjPatientRideway `gorm:"ForeignKey:ModeId"`
265
 	Rideway  SgjPatientRideway `gorm:"ForeignKey:ModeId"`
261
 	Oldration  SgjPatientOldrotation `gorm:"ForeignKey:ModeId"`
266
 	Oldration  SgjPatientOldrotation `gorm:"ForeignKey:ModeId"`
262
-
267
+	Conrotation  []SgjPatientConrotation `gorm:"ForeignKey:Modeid"`
263
 }
268
 }
264
 
269
 
265
 func (SgjPatientOrdmodel) TableName() string  {
270
 func (SgjPatientOrdmodel) TableName() string  {
521
 func (SgjPatientMagiclink)TableName() string  {
526
 func (SgjPatientMagiclink)TableName() string  {
522
 
527
 
523
 	return "sgj_patient_magiclink"
528
 	return "sgj_patient_magiclink"
529
+}
530
+
531
+type SgjPatientNavgationlink struct {
532
+	ID int64 `gorm:"column:id" json:"id" form:"id"`
533
+	Linktype int64 `gorm:"column:linktype" json:"linktype" form:"linktype"`
534
+	Linktypetwo int64 `gorm:"column:linktypetwo" json:"linktypetwo" form:"linktypetwo"`
535
+	Articetype int64 `gorm:"column:articetype" json:"articetype" form:"articetype"`
536
+	Title int64 `gorm:"column:title" json:"title" form:"title"`
537
+	Phone string `gorm:"column:phone" json:"phone" form:"phone"`
538
+	Outstation string `gorm:"column:outstation" json:"outstation" form:"outstation"`
539
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
540
+	Status int64 `gorm:"column:status" json:"status" form:"status"`
541
+	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
542
+	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
543
+	Linkaddress string `gorm:"column:linkaddress" json:"linkaddress" form:"linkaddress"`
544
+}
545
+
546
+func (SgjPatientNavgationlink) TableName() string {
547
+
548
+	return "sgj_patient_navgationlink"
524
 }
549
 }

+ 94 - 21
service/site_service/site_microwebsite_service.go View File

245
 	return  err
245
 	return  err
246
 }
246
 }
247
 
247
 
248
+func DeleteEditPicLinkByModelid(mid int64,orgID int64)(error)  {
249
+	err := service.PatientWriteDB().Model(models.SgjPatientEditpiclink{}).Where("modeid = ? AND user_org_id = ?", mid, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
250
+	return  err
251
+}
252
+
253
+func DeleteEnviroments(mid int64,orgID int64)(error)  {
254
+	err := service.PatientWriteDB().Model(models.SgjPatientEnviroimages{}).Where("modeid = ? AND user_org_id = ?", mid, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
255
+	return  err
256
+}
257
+
258
+func DeleteConrotation(mid int64,orgID int64)(error)  {
259
+	err := service.PatientWriteDB().Model(models.SgjPatientConrotation{}).Where("modeid = ? AND user_org_id = ?", mid, orgID).Update(map[string]interface{}{"status": 0,"img_show":0, "mtime": time.Now().Unix()}).Error
260
+	return err
261
+}
262
+
263
+
248
 func UpdateOffices(id int64,orgID int64,offices models.SgjPatientOffices) error {
264
 func UpdateOffices(id int64,orgID int64,offices models.SgjPatientOffices) error {
249
 	err := service.PatientWriteDB().Model(offices).Where("id = ? AND user_org_id = ? AND status = ?", id, orgID, 1).Update(map[string]interface{}{"title": offices.Title, "sort": offices.Sort, "introduction": offices.Introduction, "mtime": time.Now().Unix()}).Error
265
 	err := service.PatientWriteDB().Model(offices).Where("id = ? AND user_org_id = ? AND status = ?", id, orgID, 1).Update(map[string]interface{}{"title": offices.Title, "sort": offices.Sort, "introduction": offices.Introduction, "mtime": time.Now().Unix()}).Error
250
 	return  err
266
 	return  err
261
 		db = db.Where("user_org_id = ? ", orgid)
277
 		db = db.Where("user_org_id = ? ", orgid)
262
 	}
278
 	}
263
 	err = db.Preload("Hospitals").Preload("Offices").Preload("Doctors").Preload("OfficeEnviroment").
279
 	err = db.Preload("Hospitals").Preload("Offices").Preload("Doctors").Preload("OfficeEnviroment").
264
-		Preload("Editdoctor").Preload("Rotation").Preload("Macnavigation").Preload("Editmargin").
280
+		Preload("Editdoctor").Preload("Rotation").Preload("Macnavigation").Preload("Editmargin").Preload("Enviroimages").Preload("PatientEditpiclink").
265
 		Select("m.id,m.title,m.sort,m.ctime,m.mtime,m.user_org_id,m.status,m.mode_type").Order("sort").Find(&model).Error
281
 		Select("m.id,m.title,m.sort,m.ctime,m.mtime,m.user_org_id,m.status,m.mode_type").Order("sort").Find(&model).Error
266
 	return
282
 	return
267
 }
283
 }
346
 	err = service.PatientReadDB().Model(&editdoctor).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Order("doc_sort").Find(&editdoctor).Error
362
 	err = service.PatientReadDB().Model(&editdoctor).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Order("doc_sort").Find(&editdoctor).Error
347
 	return
363
 	return
348
 }
364
 }
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
365
+func GetOfficEnviromentDetail(orgid int64,id int64)(offenvironment []models.SgjPatientEnviroimages,err error)  {
366
+	err = service.PatientReadDB().Model(&offenvironment).Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, id, 1).Order("sort").Find(&offenvironment).Error
352
 	return offenvironment,err
367
 	return offenvironment,err
353
 }
368
 }
354
 
369
 
426
 	if(orgid > 0){
441
 	if(orgid > 0){
427
 		db = db.Where("user_org_id = ?", orgid)
442
 		db = db.Where("user_org_id = ?", orgid)
428
 	}
443
 	}
429
-	err = db.Preload("Hosaddress").Preload("Connectway").Preload("Worktime").Preload("Rideway").Preload("Oldration").
444
+	err = db.Preload("Hosaddress").Preload("Connectway").Preload("Worktime").Preload("Rideway").Preload("Oldration").Preload("Conrotation").
430
 		Select("o.id,o.title,o.sort,o.ctime,o.mtime,o.mode_type").Order("sort").Find(&model).Error
445
 		Select("o.id,o.title,o.sort,o.ctime,o.mtime,o.mode_type").Order("sort").Find(&model).Error
431
     fmt.Println("sql错误是什么",err)
446
     fmt.Println("sql错误是什么",err)
432
 	return
447
 	return
464
 	return  err
479
 	return  err
465
 }
480
 }
466
 func GetEnImages(orgid int64)(enviroimages []models.SgjPatientEnviroimages,err error)  {
481
 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
482
+	err = service.PatientReadDB().Model(&enviroimages).Where("user_org_id = ? AND status = ? AND imgshow = ? ", orgid,1,1).Order("sort").Find(&enviroimages).Error
468
 	return enviroimages,err
483
 	return enviroimages,err
469
 }
484
 }
470
 
485
 
471
 func UpdateImages(orgid int64,ids [] int64,enviroimages models.SgjPatientEnviroimages)(err error) {
486
 func UpdateImages(orgid int64,ids [] int64,enviroimages models.SgjPatientEnviroimages)(err error) {
472
 	if(len(ids)==1){
487
 	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
488
+		err = service.PatientWriteDB().Model(&models.SgjPatientEnviroimages{}).Where("id = ? AND user_org_id = ? ", ids[0], orgid).Update(map[string]interface{}{"modeid": enviroimages.Modeid, "status": 1,"imgshow":0, "mtime": time.Now().Unix()}).Error
474
 	}else {
489
 	}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
490
+		err = service.PatientWriteDB().Model(&models.SgjPatientEnviroimages{}).Where("id IN(?) and user_org_id = ? ", ids, orgid).Update(map[string]interface{}{"modeid": enviroimages.Modeid, "status": 1,"imgshow":0, "mtime": time.Now().Unix()}).Error
476
 	}
491
 	}
477
 	return
492
 	return
478
 }
493
 }
510
 }
525
 }
511
 
526
 
512
 func DeleteRotations(id int64, orgid int64)(error)  {
527
 func DeleteRotations(id int64, orgid int64)(error)  {
513
-	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
528
+	err := service.PatientWriteDB().Model(models.SgjPatientEditpiclink{}).Where("id = ? AND user_org_id = ? ", id, orgid).Update(map[string]interface{}{"status": 0,"img_show":0, "mtime": time.Now().Unix()}).Error
514
 	return  err
529
 	return  err
515
 }
530
 }
516
 
531
 
537
 }
552
 }
538
 
553
 
539
 func DeleteImages(id int64,orgid int64)(error)  {
554
 func DeleteImages(id int64,orgid int64)(error)  {
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
555
+	err := service.PatientWriteDB().Model(models.SgjPatientConrotation{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0,"modeid":0,"img_show":0,"mtime": time.Now().Unix()}).Error
541
 	return err
556
 	return err
542
 }
557
 }
543
 func DeleteSingleImages(id int64,orgid int64) (error) {
558
 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
559
+	err := service.PatientWriteDB().Model(models.SgjPatientEditpiclink{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0,"modeid":0,"img_show":0, "mtime": time.Now().Unix()}).Error
545
 	return err
560
 	return err
546
 }
561
 }
547
 
562
 
568
 	return  err
583
 	return  err
569
 }
584
 }
570
 
585
 
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
586
+func GetEditRotationImages(id int64,orgid int64)(models.SgjPatientOrdmodel,error)  {
587
+	oldrotation := models.SgjPatientOrdmodel{}
588
+	err := service.PatientReadDB().Model(oldrotation).Where("id = ? AND user_org_id = ?", id, orgid).Find(&oldrotation).Error
574
 	return oldrotation,err
589
 	return oldrotation,err
575
 }
590
 }
576
 
591
 
610
 	conrotation := models.SgjPatientOldrotation{}
625
 	conrotation := models.SgjPatientOldrotation{}
611
 	err := service.PatientReadDB().Model(conrotation).Where("id = ? AND user_org_id = ? ", id, orgid).Find(&conrotation).Error
626
 	err := service.PatientReadDB().Model(conrotation).Where("id = ? AND user_org_id = ? ", id, orgid).Find(&conrotation).Error
612
 	return conrotation,err
627
 	return conrotation,err
628
+}
613
 
629
 
630
+func QueryConRotation(mid int64,orgid int64)(conrotation []models.SgjPatientConrotation,err error)  {
631
+	err = service.PatientReadDB().Model(conrotation).Where("modeid = ? AND user_org_id = ? AND status = ?", mid, orgid, 1).Order("sort").Find(&conrotation).Error
632
+	return conrotation,err
614
 }
633
 }
615
 
634
 
635
+
636
+
616
 func UpdateConrotaionById(id int64,orgid int64,oldrotation models.SgjPatientOldrotation)(error)  {
637
 func UpdateConrotaionById(id int64,orgid int64,oldrotation models.SgjPatientOldrotation)(error)  {
617
 
638
 
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
639
 	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
621
 
642
 
622
 func GetPatientRotaion(id int64,orgid int64)(models.SgjPatientRotation,error)  {
643
 func GetPatientRotaion(id int64,orgid int64)(models.SgjPatientRotation,error)  {
623
 	rotation := models.SgjPatientRotation{}
644
 	rotation := models.SgjPatientRotation{}
624
-	err := service.PatientReadDB().Model(&rotation).Where("model_id = ? AND user_org_id = ?", id, orgid).Find(&rotation).Error
645
+	err := service.PatientReadDB().Model(&rotation).Where("model_id = ? AND user_org_id = ?", id, orgid).Order("sort").Find(&rotation).Error
625
 	return rotation,err
646
 	return rotation,err
626
 }
647
 }
627
 
648
 
632
 }
653
 }
633
 
654
 
634
 func QueryEditpiclink(id int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error)  {
655
 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
656
+	err = service.PatientReadDB().Model(editpiclink).Where("modeid = ? AND user_org_id = ? AND status = ?", id, orgid,1).Order("sort").Find(&editpiclink).Error
636
 	return editpiclink,err
657
 	return editpiclink,err
637
 }
658
 }
638
 
659
 
660
+
661
+
639
 func GetEditSingleVisible(id int64,orgid int64)(models.SgjPatientEditpiclink,error)  {
662
 func GetEditSingleVisible(id int64,orgid int64)(models.SgjPatientEditpiclink,error)  {
640
 	editpiclink := models.SgjPatientEditpiclink{}
663
 	editpiclink := models.SgjPatientEditpiclink{}
641
 	err := service.PatientReadDB().Model(&editpiclink).Where("id = ? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
664
 	err := service.PatientReadDB().Model(&editpiclink).Where("id = ? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
642
 	return editpiclink,err
665
 	return editpiclink,err
643
 }
666
 }
644
 
667
 
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
668
+func GetQueryEditpiclink(modeid int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error)  {
669
+	err = service.PatientReadDB().Model(&editpiclink).Where("modeid=? AND user_org_id = ? AND status = ?", modeid, orgid,1).Order("sort").Find(&editpiclink).Error
647
 	return editpiclink,err
670
 	return editpiclink,err
648
 
671
 
649
 }
672
 }
773
 	return err
796
 	return err
774
 }
797
 }
775
 
798
 
799
+func GetQueryEnviroimage(orgid int64,mid int64)(enviroimages []models.SgjPatientEnviroimages,err error)  {
800
+	err = service.PatientReadDB().Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, mid,1).Find(&enviroimages).Error
801
+	return enviroimages,err
802
+}
803
+
776
 func DeleteOfficeById(id int64,orgid int64)(error)  {
804
 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
805
+	err := service.PatientWriteDB().Model(models.SgjPatientEnviroimages{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0,"modeid":0, "mtime": time.Now().Unix()}).Error
778
 	return  err
806
 	return  err
779
 }
807
 }
780
 
808
 
881
 }
909
 }
882
 
910
 
883
 func GetEnImagesTwo(orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error)  {
911
 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
912
+	err = service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&editpiclink).Error
885
 	return editpiclink,err
913
 	return editpiclink,err
886
 }
914
 }
887
 
915
 
888
 func GetEnImagesThree(orgid int64)(conrotation []models.SgjPatientConrotation,err error)  {
916
 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
917
+	err = service.PatientReadDB().Model(&conrotation).Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&conrotation).Error
890
 	return conrotation,err
918
 	return conrotation,err
891
 }
919
 }
892
 
920
 
964
 	linkaddress := models.SgjPatientLinkaddress{}
992
 	linkaddress := models.SgjPatientLinkaddress{}
965
 	err := service.PatientReadDB().Where(" id = ? AND user_org_id = ?", id, orgid).Find(&linkaddress).Error
993
 	err := service.PatientReadDB().Where(" id = ? AND user_org_id = ?", id, orgid).Find(&linkaddress).Error
966
 	return  linkaddress,err
994
 	return  linkaddress,err
995
+}
996
+
997
+func GetCountImages(orgid int64)(edipiclink []models.SgjPatientEditpiclink,total int64,err error)  {
998
+	err = service.PatientReadDB().Where("user_org_id = ? AND img_show = ? AND status = ?", orgid,1,1).Find(&edipiclink).Count(&total).Error
999
+	return edipiclink,total,err
1000
+
1001
+}
1002
+
1003
+func GetTotalCount(orgid int64)(conrotation []models.SgjPatientConrotation,total int64,err error)  {
1004
+	err = service.PatientReadDB().Where("user_org_id = ? AND img_show = ? AND status = ?", orgid, 1, 1).Find(&conrotation).Count(&total).Error
1005
+	return conrotation,total,err
1006
+}
1007
+
1008
+func GetCountPicImages(orgid int64,modeid int64)(edipiclink []models.SgjPatientEditpiclink,total int64,err error)  {
1009
+	err = service.PatientReadDB().Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, modeid, 1).Find(&edipiclink).Count(&total).Error
1010
+	return edipiclink,total,err
1011
+}
1012
+
1013
+func QueryEditpiclinkCount(mid int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,total int64,err error)  {
1014
+	err= service.PatientWriteDB().Where("modeid = ? AND user_org_id =? AND status = ?", mid, orgid, 1).Find(&editpiclink).Count(&total).Error
1015
+	return editpiclink,total,err
1016
+}
1017
+
1018
+func AddNavgationlink(navgationlink *models.SgjPatientNavgationlink)error  {
1019
+	err := service.PatientWriteDB().Create(&navgationlink).Error
1020
+	return err
1021
+}
1022
+
1023
+func GetNavgationlinkLastData(orgid int64)(models.SgjPatientNavgationlink,error)  {
1024
+	navgationlink := models.SgjPatientNavgationlink{}
1025
+	err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&navgationlink).Error
1026
+	return navgationlink,err
1027
+}
1028
+
1029
+func GetNavgationlinkAddressBylinkId(orgid int64,linkid int64)(models.SgjPatientNavgationlink,error)  {
1030
+	navgationlink := models.SgjPatientNavgationlink{}
1031
+	err := service.PatientReadDB().Where("user_org_id = ? AND id = ?", orgid, linkid).Find(&navgationlink).Error
1032
+	return navgationlink,err
1033
+}
1034
+
1035
+func UpdateditnavigationLink(orgid int64,id int64,navgationlink models.SgjPatientNavgationlink) error {
1036
+
1037
+	err := service.PatientWriteDB().Model(&navgationlink).Where("user_org_id = ? AND id =?", orgid, id).Update(map[string]interface{}{"linktype": navgationlink.Linktype, "linktypetwo": navgationlink.Linktypetwo, "articetype": navgationlink.Articetype, "title": navgationlink.Title, "phone": navgationlink.Phone, "outstation":
1038
+	navgationlink.Outstation, "linkaddress": navgationlink.Linkaddress, "mtime": time.Now().Unix()}).Error
1039
+	return err
967
 }
1040
 }