123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- package micro
-
- import (
- "SCRM/service/micro_service"
- "fmt"
- "github.com/astaxie/beego"
- "SCRM/enums"
- )
-
- func microRouters(){
- beego.Router("/api/site/getdatabyorgid",&Micro{},"Get:GetDataByOrgId")
- beego.Router("/api/site/getdatatwo",&Micro{},"Get:GetDatatwo")
- beego.Router("/api/site/getdatathree",&Micro{},"Get:GetOfficeDetail")
- beego.Router("/api/site/getdatafour",&Micro{},"Get:GetDoctorDetail")
- beego.Router("/api/site/getdatafive",&Micro{},"Get:GetOfficEnviromentDetail")
- beego.Router("/api/site/getarticlelist",&Micro{},"Get:GetArticlelist")
- beego.Router("/api/site/getactivities",&Micro{},"Get:GetActivities")
- beego.Router("/api/site/getdatasix",&Micro{},"Get:GetArticlistDetail")
- beego.Router("/api/site/getdataseven",&Micro{},"Get:GetActivitesDetail")
- beego.Router("/api/site/getdefalutnavigationdata",&Micro{},"Get:GetDefalutNavigationData")
- beego.Router("/api/site/getdataeight",&Micro{},"Get:GetOrderData")
- beego.Router("/api/site/getdatanight",&Micro{},"Get:GetContactWay")
- beego.Router("/api/site/singleactivitinfo",&Micro{},"Get:GetActivitDetail")
- beego.Router("/api/site/singlearticleinfo",&Micro{},"Get:GetArticlesDetail")
- beego.Router("/api/site/singledoctorinfo",&Micro{},"Get:GetDoctorInfo")
- beego.Router("/api/site/getdata",&Micro{},"Get:GetData")
- beego.Router("/api/site/getenviromentimages",&Micro{},"Get:GetEnviromentImages")
- beego.Router("/api/site/getalldoctors",&Micro{},"Get:GetAllDoctors")
- }
-
- type Micro struct {
- beego.Controller
- //controllers.BaseAPIController
- }
- func (this *Micro) ServeFailJsonSend(code int, msg string) {
- this.Data["json"] = enums.MakeFailResponseJSON(msg, code)
- this.ServeJSON()
- }
-
- func (this *Micro) ServeSuccessJSON(data map[string]interface{}) {
- this.Data["json"] = enums.MakeSuccessResponseJSON(data)
- this.ServeJSON()
- }
-
-
- func (this *Micro) GetDataByOrgId(){
- fmt.Println("我的 ")
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("小明id",orgid)
- model, err := micro_service.GetData(orgid)
- fmt.Println("model是什么",model)
- fmt.Println("err",err)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patientModels":model,
- })
- }
-
- func (this *Micro) GetData(){
- // fmt.Println("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")
- fmt.Println("我的 ")
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("小明id",orgid)
- model, err := micro_service.GetData(orgid)
- fmt.Println("model是什么",model)
- fmt.Println("err",err)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patientModels":model,
- })
- }
-
- func (this *Micro) GetDatatwo() {
- fmt.Println("获取医院详情")
- id, err := this.GetInt64("id")
- fmt.Println(err)
- fmt.Println("id是什么",id)
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("机构id",orgid)
- hospital, err := micro_service.QueryHispitalDetail(orgid, id)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "hospital":hospital,
- })
- }
-
- func (this *Micro) GetOfficeDetail() {
- id, err := this.GetInt64("id")
- fmt.Println(err)
- fmt.Println("id是什么",id)
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("机构id",orgid)
- offices, err := micro_service.GetOfficeDetail(orgid, id)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "offices":offices,
- })
-
- }
-
- func (this *Micro) GetDoctorDetail() {
- id, err := this.GetInt64("id")
- fmt.Println(err)
- fmt.Println("id是什么",id)
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("机构id",orgid)
- editdoctor, err := micro_service.GetDoctorDetail(orgid, id)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "editdoctor":editdoctor,
- })
-
- }
-
- func (this *Micro) GetOfficEnviromentDetail() {
- id, err := this.GetInt64("id")
- fmt.Println(err)
- fmt.Println("id是什么",id)
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("机构id",orgid)
- offenvironment, err := micro_service.GetOfficEnviromentDetail(orgid, id)
- fmt.Println("错误",err)
- fmt.Println("offenvironment",offenvironment)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "offenvironment":offenvironment,
- })
- }
-
- func (this *Micro) GetArticlelist() {
- //adminUserInfo := this.GetAdminUserInfo()
- //userOrgID := int64(adminUserInfo.CurrentOrgId)
- //fmt.Println("机构id",userOrgID)
- orgid, _ := this.GetInt64("orgid")
- //micro_service.GetArticlelistlimit(orgid)
- articlelist, err := micro_service.GetlastLimit(orgid)
- articlelists, err := micro_service.GetAllArticeList(orgid,articlelist.Number)
- fmt.Println("文章列表",articlelists)
- fmt.Println("错误",err)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "articlelists":articlelists,
- })
- }
-
- func (this *Micro) GetActivities() {
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("活动id",orgid)
- //addactivity, err := micro_service.GetActivitiesById(orgid)
- addactivity, err := micro_service.GetLastActivitiesLast(orgid)
- activity, err := micro_service.GetAllActivities(orgid,addactivity.Number)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "activity":activity,
- })
- }
-
- func (this *Micro) GetArticlistDetail() {
- id, _ := this.GetInt64("id")
- fmt.Println("id是设么",id)
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("文章id",orgid)
- articlelist, err := micro_service.GetArticlelistById(id, orgid)
- fmt.Println(articlelist,err)
- //fmt.Println(err)
- //articlelists, err := micro_service.GetAllArticles(orgid, articlelist.Number)
- articleslist, err := micro_service.GetAllPushArticles(orgid)
- fmt.Println("报错了么",err)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "articlelists":articleslist,
- })
- }
-
- func (this *Micro) GetActivitesDetail() {
- id, _ := this.GetInt64("id")
- fmt.Println("id是设么",id)
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("活动id",orgid)
- //addactivity, err := micro_service.GetAllActivitiById(id, orgid)
- // fmt.Println("err",err)
- //addactivity, err := micro_service.GetLastActivitiesLast(orgid)
- // //activity, err := micro_service.GetAllActivities(orgid,addactivity.Number)
- activity, err := micro_service.GetAllActivitiestwo(orgid)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "activity":activity,
- })
- }
-
-
- func (this *Micro) GetDefalutNavigationData() {
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("活动id",orgid)
- navigation, err := micro_service.GetDefalutNavigationData(orgid)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "navigation":navigation,
- })
- }
-
-
- func (this *Micro) GetOrderData(){
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("活动id",orgid)
- ordmodel, err := micro_service.GetOrederModel(orgid)
- fmt.Println("ordemodel是社没什么",ordmodel)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "ordmodel":ordmodel,
- })
- }
-
- func (this *Micro) GetContactWay(){
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("联系方式id",orgid)
- connect, err := micro_service.GetAllConnecway(orgid)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "connect":connect,
- })
- }
-
- func (this *Micro) GetActivitDetail() {
- id, _ := this.GetInt64("id")
- fmt.Println("活动id",id)
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("机构id",orgid)
- activity, err := micro_service.GetActivitDetail(id, orgid)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "activity":activity,
- })
- }
-
- func (this *Micro) GetArticlesDetail() {
- id, _ := this.GetInt64("id")
- fmt.Println("文章id",id)
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("机构id",orgid)
- articles, err := micro_service.GetArticlesDetail(id, orgid)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "articles":articles,
- })
- }
-
- func (this *Micro) GetDoctorInfo() {
- id, _ := this.GetInt64("id")
- fmt.Println("医生id",id)
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("机构id",orgid)
- editdoctor, err := micro_service.GetDoctorInfo(id, orgid)
- fmt.Println("错误",err)
- fmt.Println("editdoctor",editdoctor)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "editdoctor":editdoctor,
- })
- }
-
- func (this *Micro) GetRotationLinkAddress() {
- linkid, _ := this.GetInt64("linkid")
- fmt.Println("linkid",linkid)
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("机构id",orgid)
- linkaddress, err := micro_service.GetRotationLinkAddress(orgid, linkid)
- fmt.Println("错误是什么",err)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "linkaddress":linkaddress,
- })
- }
-
- func (this *Micro) GetEnviromentImages() {
- id, _ := this.GetInt64("id")
- fmt.Println("id是设么",id)
- orgid, _ := this.GetInt64("orgid")
- enviro, err := micro_service.GetEnviromentImages(id, orgid)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "enviro":enviro,
- })
- }
-
- func (this *Micro) GetAllDoctors() {
- orgid, _ := this.GetInt64("orgid")
- fmt.Println("orgid失身东西",orgid)
- info, err := micro_service.GetAllDoctors(orgid)
- fmt.Println("info是什么",info)
- fmt.Println("err是什么",err)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "info":info,
- })
- }
|