xiaoming_global 5 gadus atpakaļ
vecāks
revīzija
12ac584a15

+ 219 - 5
controllers/site/site_controller.go Parādīt failu

@@ -152,6 +152,10 @@ func siteRouters() {
152 152
 	beego.Router("/api/site/updatelinkaddress",&Microwebsite{},"Post:UpdateLinkAddress")
153 153
 	beego.Router("/api/site/addmaclinkaddress",&Microwebsite{},"Post:AddMacLinkAddress")
154 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 161
 type Microwebsite struct {
@@ -568,6 +572,7 @@ func (this *Microwebsite) AddKeEnvironment()  {
568 572
 		id := int64(idsInter.(float64))
569 573
 		ids = append(ids, id)
570 574
 	}
575
+	fmt.Println("ids是什么",ids)
571 576
 	model := models.SgjPatientModel{
572 577
 		Title:     title,
573 578
 		Sort:      sort,
@@ -1398,6 +1403,12 @@ func (this *Microwebsite) Deletemodlebyid()  {
1398 1403
 	err := site_service.DeletemodleById(id, userOrgID)
1399 1404
 	modelid := site_service.DeleteHospitalByModelid(id, userOrgID)
1400 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 1412
 	fmt.Println(modelid,byModelid)
1402 1413
 	if err !=nil{
1403 1414
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
@@ -1767,6 +1778,8 @@ func (this *Microwebsite) AddImages()  {
1767 1778
 		UserOrgId:    userOrgID,
1768 1779
 		Ctime:        time.Now().Unix(),
1769 1780
 		Status:       1,
1781
+		Imgshow:1,
1782
+
1770 1783
 	}
1771 1784
 	err = site_service.AddImages(&patientEnviroimages)
1772 1785
 	if err !=nil{
@@ -1941,6 +1954,8 @@ func (this *Microwebsite) AddNavigation()  {
1941 1954
 	adminUserInfo := this.GetAdminUserInfo()
1942 1955
 	userOrgID := int64(adminUserInfo.CurrentOrgId)
1943 1956
 	fmt.Println("机构ID",userOrgID)
1957
+	linkid, _ := this.GetInt64("id")
1958
+	fmt.Println("linkid",linkid)
1944 1959
 	dataBody := make(map[string]interface{}, 0)
1945 1960
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1946 1961
 	if err != nil {
@@ -1979,6 +1994,7 @@ func (this *Microwebsite) AddNavigation()  {
1979 1994
 		UserOrgId:userOrgID,
1980 1995
 		Status: 1,
1981 1996
 		Ctime:time.Now().Unix(),
1997
+		Linkid:linkid,
1982 1998
 	}
1983 1999
 	err = site_service.AddNavigation(&navigation)
1984 2000
 	if err !=nil{
@@ -2097,7 +2113,9 @@ func (this *Microwebsite) DeleteModle()  {
2097 2113
 	errtw := site_service.DeleteModleByModeID(userOrgID, id)
2098 2114
 	way := site_service.DeleteRideWay(userOrgID, id)
2099 2115
 	workTime := site_service.DeleteWorkTime(userOrgID, id)
2116
+	conrotation := site_service.DeleteConrotation(id, userOrgID)
2100 2117
 	fmt.Println("错误是什么",errtw,way,workTime)
2118
+	fmt.Println(conrotation)
2101 2119
 	if err !=nil{
2102 2120
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
2103 2121
 		return
@@ -2171,6 +2189,8 @@ func  (this *Microwebsite) AddRotationpic()  {
2171 2189
 	patientConrotation, err := site_service.GetPatientConrotationLast(userOrgID)
2172 2190
 	fmt.Println("patientConrotation是设么",patientConrotation.ID)
2173 2191
 	fmt.Println("err是什么",err)
2192
+	conrotations, total, err := site_service.GetTotalCount(userOrgID)
2193
+	fmt.Println("conrotations",conrotations)
2174 2194
 	conlinkaddress := models.SgjPatientConlinkaddress{
2175 2195
 		ConId:patientConrotation.ID,
2176 2196
 	}
@@ -2181,6 +2201,7 @@ func  (this *Microwebsite) AddRotationpic()  {
2181 2201
 		return
2182 2202
 	}
2183 2203
 	this.ServeSuccessJSON(map[string]interface{}{
2204
+		"total":total,
2184 2205
 		"conrotation":conrotation,
2185 2206
 	})
2186 2207
 }
@@ -2329,12 +2350,15 @@ func (this *Microwebsite)  AddImageslink()  {
2329 2350
 	}
2330 2351
 
2331 2352
 	err = site_service.AddImageslink(&editpiclink)
2353
+	edipiclink, total, err := site_service.GetCountImages(userOrgID)
2354
+	fmt.Println(edipiclink)
2332 2355
 	if err !=nil{
2333 2356
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2334 2357
 		return
2335 2358
 	}
2336 2359
 	this.ServeSuccessJSON(map[string]interface{}{
2337 2360
 		"editpiclink":editpiclink,
2361
+		"total":total,
2338 2362
 	})
2339 2363
 }
2340 2364
 
@@ -2520,6 +2544,15 @@ func (this *Microwebsite) DeleteRotations(){
2520 2544
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除图片失败")
2521 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 2556
 	returnData := make(map[string]interface{}, 0)
2524 2557
 	returnData["msg"] = "ok"
2525 2558
 	this.ServeSuccessJSON(returnData)
@@ -2738,6 +2771,15 @@ func (this *Microwebsite) DeleteImages()  {
2738 2771
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2739 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 2783
 	returnData := make(map[string]interface{}, 0)
2742 2784
 	returnData["msg"] = "ok"
2743 2785
 	this.ServeSuccessJSON(returnData)
@@ -2755,6 +2797,15 @@ func (this *Microwebsite) DeleteSingleImages()  {
2755 2797
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
2756 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 2809
 	returnData := make(map[string]interface{}, 0)
2759 2810
 	returnData["msg"] = "ok"
2760 2811
 	this.ServeSuccessJSON(returnData)
@@ -2962,6 +3013,8 @@ func (this *Microwebsite) SaveEditpic()  {
2962 3013
 	fmt.Println("图片链接",piclink)
2963 3014
 	linkaddress := dataBody["linkaddress"].(string)
2964 3015
 	fmt.Println("链接地址",linkaddress)
3016
+	modeid := int64(dataBody["modeid"].(float64))
3017
+	fmt.Println("天梦中",modeid)
2965 3018
 	conrotation := models.SgjPatientConrotation{
2966 3019
 		Images:      images,
2967 3020
 		Sort:        sort,
@@ -2974,8 +3027,12 @@ func (this *Microwebsite) SaveEditpic()  {
2974 3027
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
2975 3028
 		return
2976 3029
 	}
3030
+	conrotations, err := site_service.QueryConRotation(modeid, userOrgID)
3031
+	fmt.Println("错误小小马",err)
3032
+	fmt.Println(conrotations)
2977 3033
 	this.ServeSuccessJSON(map[string]interface{}{
2978 3034
 		"conrotation":conrotation,
3035
+		"conrotations":conrotations,
2979 3036
 	})
2980 3037
 }
2981 3038
 
@@ -3003,14 +3060,16 @@ func (this *Microwebsite) AddEditpic()  {
3003 3060
 	linkaddress := dataBody["linkaddress"].(string)
3004 3061
 	fmt.Println("链接地址",linkaddress)
3005 3062
 	id, _ := this.GetInt64("id")
3063
+	fmt.Println("下孟子id",id)
3006 3064
 	oldrotation, err := site_service.QueryOldrotion(id, userOrgID)
3065
+	fmt.Println("oldrotation",oldrotation)
3007 3066
 	conrotation := models.SgjPatientConrotation{
3008 3067
 		Images:      images,
3009 3068
 		Sort:        sort,
3010 3069
 		Piclink:     piclink,
3011 3070
 		Linkaddress: linkaddress,
3012 3071
 		Status:      1,
3013
-		Modeid:      oldrotation.ModeId,
3072
+		Modeid:      id,
3014 3073
 		UserOrgId:   userOrgID,
3015 3074
 		Ctime:time.Now().Unix(),
3016 3075
 		ImgShow:1,
@@ -3020,8 +3079,12 @@ func (this *Microwebsite) AddEditpic()  {
3020 3079
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3021 3080
 		return
3022 3081
 	}
3082
+	conrotations, erros := site_service.QueryConRotation(id, userOrgID)
3083
+	fmt.Println("门前错误",erros)
3084
+	fmt.Println("conrotations是什么",conrotations)
3023 3085
 	this.ServeSuccessJSON(map[string]interface{}{
3024 3086
 		"conrotation":conrotation,
3087
+		"conrotations":conrotations,
3025 3088
 	})
3026 3089
 }
3027 3090
 
@@ -3053,13 +3116,14 @@ func (this *Microwebsite) AddEdialogVisible()  {
3053 3116
 	}
3054 3117
 	err = site_service.UpdateConrotaionById(id, userOrgID,oldrotation)
3055 3118
 	fmt.Println(err)
3056
-	patientOldrotation, err:= site_service.QueryOldrotion(id, userOrgID)
3119
+	fmt.Println("马文强错错误是什么",err)
3057 3120
 	ordmodel := models.SgjPatientOrdmodel{
3058 3121
 		Title: title,
3059 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 3127
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3064 3128
 		return
3065 3129
 	}
@@ -3081,13 +3145,17 @@ func (this *Microwebsite) GetEditRotationimages()  {
3081 3145
 	editpiclink, err := site_service.QueryEditpiclink(id, userOrgID)
3082 3146
 	fmt.Println("错误是多少",err)
3083 3147
 	fmt.Println("返回数据",editpiclink)
3148
+	editpiclinks, total, err := site_service.QueryEditpiclinkCount(id, userOrgID)
3149
+	fmt.Println(editpiclinks)
3084 3150
 	if err !=nil{
3085 3151
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3086 3152
 		return
3087 3153
 	}
3154
+
3088 3155
 	this.ServeSuccessJSON(map[string]interface{}{
3089 3156
 		"patientEditpiclink":patientEditpiclink,
3090 3157
 		"editpiclink":editpiclink,
3158
+		"total":total,
3091 3159
 	})
3092 3160
 
3093 3161
 }
@@ -3136,6 +3204,8 @@ func (this *Microwebsite) UpdateSingleForm()  {
3136 3204
 	fmt.Println("图片链接",piclink)
3137 3205
     linkaddress := dataBody["linkaddress"].(string)
3138 3206
     fmt.Println("链接地址",linkaddress)
3207
+	modelid := int64(dataBody["modeid"].(float64))
3208
+
3139 3209
 	editpiclink := models.SgjPatientEditpiclink{
3140 3210
 		Images:      images,
3141 3211
 		Sort:        sort,
@@ -3144,7 +3214,7 @@ func (this *Microwebsite) UpdateSingleForm()  {
3144 3214
 	}
3145 3215
 	err = site_service.UpdateEditPatPicLink(id, userOrgID, editpiclink)
3146 3216
 	fmt.Println("第一个错误是设么",err)
3147
-	patientEditpiclink, err := site_service.GetQueryEditpiclink(id, userOrgID)
3217
+	patientEditpiclink, err := site_service.GetQueryEditpiclink(modelid, userOrgID)
3148 3218
 	fmt.Println("错误是多",err)
3149 3219
     fmt.Println("pateientEditpiclink是多少",patientEditpiclink)
3150 3220
 	if err !=nil{
@@ -3194,12 +3264,15 @@ func (this *Microwebsite) AddEditPicForm()  {
3194 3264
 		ImgShow:1,
3195 3265
 	}
3196 3266
 	err = site_service.AddImageslink(&editpiclink)
3267
+	edipiclink, total, err := site_service.GetCountPicImages(userOrgID, patientRotation.ModelId)
3268
+	fmt.Println(edipiclink)
3197 3269
 	if err !=nil{
3198 3270
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
3199 3271
 		return
3200 3272
 	}
3201 3273
 	this.ServeSuccessJSON(map[string]interface{}{
3202 3274
 		"editpiclink":editpiclink,
3275
+		"total":total,
3203 3276
 	})
3204 3277
 }
3205 3278
 
@@ -3644,11 +3717,14 @@ func  (this *Microwebsite) AddOfficeTwo()  {
3644 3717
 	}
3645 3718
 	sort:= int64(dataBody["sort"].(float64))
3646 3719
 	fmt.Println("排序",sort)
3720
+	modelid := int64(dataBody["modelid"].(float64))
3721
+	fmt.Println("小泽",modelid)
3647 3722
 	enviroimages := models.SgjPatientEnviroimages{
3648 3723
 		Enviroimages: officeImages,
3649 3724
 		Sort:         sort,
3650 3725
 	}
3651 3726
 	err = site_service.UpdateOfficeTwo(userOrgID, id, enviroimages)
3727
+	patientEnviroimages, err := site_service.GetQueryEnviroimage(userOrgID, modelid)
3652 3728
 	fmt.Println("错误是什么",err)
3653 3729
 	if err !=nil{
3654 3730
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
@@ -3656,6 +3732,7 @@ func  (this *Microwebsite) AddOfficeTwo()  {
3656 3732
 	}
3657 3733
 	this.ServeSuccessJSON(map[string]interface{}{
3658 3734
 		"enviroimages":enviroimages,
3735
+		"patientEnviroimages":patientEnviroimages,
3659 3736
 	})
3660 3737
 }
3661 3738
 
@@ -4527,3 +4604,140 @@ func  (this*Microwebsite) GetLinkAddress()  {
4527 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 Parādīt failu

@@ -36,6 +36,9 @@ type SgjPatientModel struct {
36 36
 	Addactivity  SgjPatientAddactivity `gorm:"ForeignKey:Modeid"`
37 37
 	Articlelist  SgjPatientArticlelist `gorm:"ForeignKey:Modeid"`
38 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,6 +74,7 @@ type SgjPatientEnviroimages struct {
71 74
 	Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
72 75
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
73 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 80
 func (SgjPatientEnviroimages) TableName() string  {
@@ -222,6 +226,7 @@ type SgjPatientNavigation struct {
222 226
 	Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
223 227
 	Status int64 `gorm:"column:status" json:"status" form:"status"`
224 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 232
 func (SgjPatientNavigation) TableName() string  {
@@ -259,7 +264,7 @@ type SgjPatientOrdmodel struct {
259 264
 	Worktime     SgjPatientWorktime `gorm:"ForeignKey:ModeId"`
260 265
 	Rideway  SgjPatientRideway `gorm:"ForeignKey:ModeId"`
261 266
 	Oldration  SgjPatientOldrotation `gorm:"ForeignKey:ModeId"`
262
-
267
+	Conrotation  []SgjPatientConrotation `gorm:"ForeignKey:Modeid"`
263 268
 }
264 269
 
265 270
 func (SgjPatientOrdmodel) TableName() string  {
@@ -521,4 +526,24 @@ type SgjPatientMagiclink struct {
521 526
 func (SgjPatientMagiclink)TableName() string  {
522 527
 
523 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 Parādīt failu

@@ -245,6 +245,22 @@ func DeleteOfficeByModelid(mid int64,orgID int64)(error)  {
245 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 264
 func UpdateOffices(id int64,orgID int64,offices models.SgjPatientOffices) error {
249 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 266
 	return  err
@@ -261,7 +277,7 @@ func GetData(orgid int64)(model []*models.SgjPatientModel,err error)  {
261 277
 		db = db.Where("user_org_id = ? ", orgid)
262 278
 	}
263 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 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 282
 	return
267 283
 }
@@ -346,9 +362,8 @@ func GetDoctorDetail(orgid int64,id int64)(editdoctor []*models.SgjPatientEditdo
346 362
 	err = service.PatientReadDB().Model(&editdoctor).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Order("doc_sort").Find(&editdoctor).Error
347 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 367
 	return offenvironment,err
353 368
 }
354 369
 
@@ -426,7 +441,7 @@ func GetOrederModel(orgid int64)(model []*models.SgjPatientOrdmodel,err error)
426 441
 	if(orgid > 0){
427 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 445
 		Select("o.id,o.title,o.sort,o.ctime,o.mtime,o.mode_type").Order("sort").Find(&model).Error
431 446
     fmt.Println("sql错误是什么",err)
432 447
 	return
@@ -464,15 +479,15 @@ func AddImageslink(editpiclink *models.SgjPatientEditpiclink) error  {
464 479
 	return  err
465 480
 }
466 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 483
 	return enviroimages,err
469 484
 }
470 485
 
471 486
 func UpdateImages(orgid int64,ids [] int64,enviroimages models.SgjPatientEnviroimages)(err error) {
472 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 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 492
 	return
478 493
 }
@@ -510,7 +525,7 @@ func AddMarginChart(macnavigation *models.SgjPatientMacnavigation) error  {
510 525
 }
511 526
 
512 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 529
 	return  err
515 530
 }
516 531
 
@@ -537,11 +552,11 @@ func UpdateNavtion(id int64,orgid int64,navigation models.SgjPatientNavigation)
537 552
 }
538 553
 
539 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 556
 	return err
542 557
 }
543 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 560
 	return err
546 561
 }
547 562
 
@@ -568,9 +583,9 @@ func DeleteMargin(id int64,orgid int64)(error)  {
568 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 589
 	return oldrotation,err
575 590
 }
576 591
 
@@ -610,9 +625,15 @@ func QueryOldrotion(id int64,orgid int64)(models.SgjPatientOldrotation,error) {
610 625
 	conrotation := models.SgjPatientOldrotation{}
611 626
 	err := service.PatientReadDB().Model(conrotation).Where("id = ? AND user_org_id = ? ", id, orgid).Find(&conrotation).Error
612 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 637
 func UpdateConrotaionById(id int64,orgid int64,oldrotation models.SgjPatientOldrotation)(error)  {
617 638
 
618 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,7 +642,7 @@ func UpdateConrotaionById(id int64,orgid int64,oldrotation models.SgjPatientOldr
621 642
 
622 643
 func GetPatientRotaion(id int64,orgid int64)(models.SgjPatientRotation,error)  {
623 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 646
 	return rotation,err
626 647
 }
627 648
 
@@ -632,18 +653,20 @@ func GetPatientRotationById(id int64,orgid int64)(models.SgjPatientRotation,erro
632 653
 }
633 654
 
634 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 657
 	return editpiclink,err
637 658
 }
638 659
 
660
+
661
+
639 662
 func GetEditSingleVisible(id int64,orgid int64)(models.SgjPatientEditpiclink,error)  {
640 663
 	editpiclink := models.SgjPatientEditpiclink{}
641 664
 	err := service.PatientReadDB().Model(&editpiclink).Where("id = ? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
642 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 670
 	return editpiclink,err
648 671
 
649 672
 }
@@ -773,8 +796,13 @@ func UpdateOfficeTwo(orgid int64,id int64,enviroimages models.SgjPatientEnviroim
773 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 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 806
 	return  err
779 807
 }
780 808
 
@@ -881,12 +909,12 @@ func UpdatePicFformThree(orgid int64,id int64,conlinkaddress models.SgjPatientCo
881 909
 }
882 910
 
883 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 913
 	return editpiclink,err
886 914
 }
887 915
 
888 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 918
 	return conrotation,err
891 919
 }
892 920
 
@@ -964,4 +992,49 @@ func GetPatientLinkAddress(id int64,orgid int64)(models.SgjPatientLinkaddress,er
964 992
 	linkaddress := models.SgjPatientLinkaddress{}
965 993
 	err := service.PatientReadDB().Where(" id = ? AND user_org_id = ?", id, orgid).Find(&linkaddress).Error
966 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
 }