1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354 |
- package site
-
- import (
- "github.com/astaxie/beego"
- "SCRM/controllers"
- "fmt"
- "encoding/json"
- "SCRM/utils"
- "SCRM/enums"
- "strconv"
- "SCRM/service/site_service"
- "SCRM/models"
- "time"
- "strings"
- )
-
-
-
- func siteRouters() {
- beego.Router("/api/site/addrotationchart",&Microwebsite{},"Post:AddRotaionChart")
- beego.Router("/api/site/savehispital",&Microwebsite{},"Post:SaveHispital")
- beego.Router("/api/site/addoffices",&Microwebsite{},"Post:AddOffices")
- beego.Router("/api/site/adddoctor",&Microwebsite{},"Post:AddDoctor")
- beego.Router("/api/site/adddoctorinfo",&Microwebsite{},"Post:AddDoctorInfo")
- beego.Router("/api/site/getrationimages",&Microwebsite{},"Get:GetRationImages")
- beego.Router("/api/site/gethospitalinfo",&Microwebsite{},"Get:GetHospitalinfo")
- beego.Router("/api/site/getofficeinfo",&Microwebsite{},"Get:GetOfficeInfo")
- beego.Router("/api/site/getdoctorinfo",&Microwebsite{},"Get:GetDoctorInfo")
- beego.Router("/api/site/keenvironment",&Microwebsite{},"Post:AddKeEnvironment")
- beego.Router("/api/site/getOffEnvironment",&Microwebsite{},"Get:GetOffEnvironment")
- beego.Router("/api/site/addrotationupload",&Microwebsite{},"Post:AddRotationUpload")
- beego.Router("/api/site/addworktime",&Microwebsite{},"Post:AddWorkTime")
- beego.Router("/api/site/addrideway",&Microwebsite{},"Post:AddRideway")
- beego.Router("/api/site/addconnection",&Microwebsite{},"Post:AddConnection")
- beego.Router("/api/site/queryconnetion",&Microwebsite{},"Get:GetQueryConnection")
- beego.Router("/api/site/delete",&Microwebsite{},"Get:DeleteConnecWay")
- beego.Router("/api/site/editconnecway",&Microwebsite{},"Get:EditConnecWay")
- beego.Router("/api/site/saveconnection",&Microwebsite{},"Post:SaveConnection")
- beego.Router("/api/site/addcontract",&Microwebsite{},"Post:AddContract")
- beego.Router("/api/site/getuserdmodel",&Microwebsite{},"Post:GetUserdModel")
- beego.Router("/api/site/eidtmodel",&Microwebsite{},"Get:GetEditModel")
- beego.Router("/api/site/editrideway",&Microwebsite{},"Get:EditRideWay")
- beego.Router("/api/site/saveworktime",&Microwebsite{},"Post:SaveWorktTime")
- beego.Router("/api/site/saverideway",&Microwebsite{},"Post:Saverideway")
- beego.Router("/api/site/getquerynewmodel",&Microwebsite{},"Post:GetQueryNewModel")
- beego.Router("/api/site/getquerydocinfo",&Microwebsite{},"Post:GetQueryDocInfo")
- beego.Router("/api/site/change",&Microwebsite{},"Get:Change")
- beego.Router("/api/site/getquerydochead",&Microwebsite{},"Post:GetQueryDocHead")
- beego.Router("/api/site/editdoctor",&Microwebsite{},"Get:Editdoctor")
- beego.Router("/api/site/savedocinfo",&Microwebsite{},"Post:SaveDocInfo")
- beego.Router("/api/site/deletedoctor",&Microwebsite{},"Get:DeleteDoctor")
- beego.Router("/api/site/edithospital",&Microwebsite{},"Get:EditHospital")
- beego.Router("/api/site/savehostpital",&Microwebsite{},"Post:SaveHospital")
- beego.Router("api/site/editoffice",&Microwebsite{},"Get:EditOffice")
- beego.Router("/api/site/deletemodlebyid",&Microwebsite{},"Get:Deletemodlebyid")
- beego.Router("/api/site/saveoffice",&Microwebsite{},"Post:SaveOffice")
- beego.Router("/api/site/gethospital",&Microwebsite{},"Post:GetHospital")
- beego.Router("/api/site/getdata",&Microwebsite{},"Post:GetData")
- }
-
- type Microwebsite struct {
- controllers.BaseAuthAPIController
- }
-
- //轮播图
- func (this *Microwebsite) AddRotaionChart() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("错误是什么呢",err)
- fmt.Println("机构ID",userOrgID)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("姓名:",title)
- sort := dataBody["sort"].(string)
- if len(sort) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:",sortt)
- rotationImages := dataBody["rotationImages"]
- //图片数组转为字符串保存到数据库
- replace := strings.Replace(strings.Trim(fmt.Sprint(rotationImages), "[]"), " ", ",", -1)
- fmt.Println("姓名:",rotationImages)
- fmt.Println("字符串",replace)
-
-
-
- model := models.SgjPatientModel{
- Title: title,
- Sort: sortt,
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- ModeType: 1,
- }
- //fmt.Println(model)
- site_service.AddPatientModel(&model)
- fmt.Println("rotation是什么",model)
- patientModel, err := site_service.QueryModel(userOrgID)
- fmt.Println("patientModel是什麽",patientModel)
- rotation := models.SgjPatientRotation{
- Title: title,
- Sort: sortt,
- RotationImages: replace,
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- ModelId:patientModel.ID,
- }
- site_service.AddRotation(rotation)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "rotation":rotation,
- })
- }
-
- //医院介绍
- func (this *Microwebsite) SaveHispital() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("错误是什么呢",err)
- fmt.Println("机构ID",userOrgID)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
-
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("姓名:",title)
- sort := dataBody["sort"].(string)
- if len(sort) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:",sortt)
- introduction := dataBody["introduction"].(string)
- if len(introduction) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
- return
- }
- fmt.Println("姓名是什么?",title,"排序是什么",sortt,"医院介绍不能为空",introduction)
-
- model := models.SgjPatientModel{
- Title: title,
- Sort: sortt,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 2,
- }
-
- site_service.AddPatientModel(&model)
-
- patientModel, err := site_service.QueryModel(userOrgID)
-
- hospital := models.SgjPatientHospital{
- Title: title,
- Sort: sortt,
- Introduction: introduction,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- Modleid: patientModel.ID,
- }
-
- err = site_service.AddHispital(hospital)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "hospital":hospital,
- })
- }
-
- //添加科室
- func (this *Microwebsite) AddOffices() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("错误是什么呢",err)
- fmt.Println("机构ID",userOrgID)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
-
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("姓名:",title)
- sort := dataBody["sort"].(string)
- if len(sort) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:",sortt)
- introduction := dataBody["introduction"].(string)
- if len(introduction) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
- return
- }
- fmt.Println("姓名是什么?",title,"排序是什么",sortt,"医院介绍不能为空",introduction)
-
- model := models.SgjPatientModel{
- Title: title,
- Sort: sortt,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 3,
- }
-
- site_service.AddPatientModel(&model)
-
- patientModel, err := site_service.QueryModel(userOrgID)
-
- offices := models.SgjPatientOffices{
- Title: title,
- Sort: sortt,
- Introduction: introduction,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- Modleid:patientModel.ID,
- }
- err = site_service.AddOffices(offices)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "offices":offices,
- })
- }
-
- //添加名医
- func (this *Microwebsite) AddDoctor() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("错误是什么呢",err)
- fmt.Println("机构ID",userOrgID)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("姓名:",title)
- sort := dataBody["sort"].(string)
- if len(sort) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:",sortt)
-
- images := dataBody["docimages"]
- replace := strings.Replace(strings.Trim(fmt.Sprint(images), "[]"), " ", ",", -1)
- //if len(image) == 0 {
- // this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
- // return
- //}
- fmt.Println("姓名是什么?",title,"排序是什么",sortt,"图片",replace)
- model := models.SgjPatientModel{
- Title: title,
- Sort: sortt,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 4,
- }
-
- site_service.AddPatientModel(&model)
-
- patientModel, err := site_service.QueryModel(userOrgID)
- doctor := models.SgjPatientDoctor{
- Title: title,
- Sort: sortt,
- Images: replace,
- UserOrgId:userOrgID,
- Ctime:time.Now().Unix(),
- Status:1,
- Modelid:patientModel.ID,
-
- }
-
- err = site_service.AddDoctor(doctor)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "doctor":doctor,
- })
- }
-
- //添加名医介绍
- func (this *Microwebsite) AddDoctorInfo() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("错误是什么呢",err)
- fmt.Println("机构ID",userOrgID)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
-
- docname := dataBody["name"].(string)
- if len(docname) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生姓名不能为空")
- return
- }
- fmt.Println("医生姓名:",docname)
- docHead := dataBody["dochead"].(string)
- if len(docHead) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生头像不能为空")
- return
- }
- fmt.Println("医生头像:",docHead)
- sort := dataBody["sort"].(string)
- if len(sort) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:",sortt)
- docpositional := int64(dataBody["user_title"].(float64))
- if docpositional <= 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生职位不能为空")
- return
- }
- fmt.Println("医生职位",docpositional)
- docintroduction := dataBody["content"].(string)
- fmt.Println("医生简介",docintroduction)
- if len(docintroduction) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生简介不能为空")
- return
- }
- fmt.Println("医生姓名",docname,"医生职位",docpositional,"医生头像",docHead,"医生简介",docintroduction)
-
- doctor := models.SgjPatientDoctor{
- Docname: docname,
- Dochead: docHead,
- DocPosition: docpositional,
- Docintroduction: docintroduction,
- Ctime: time.Now().Unix(),
- UserOrgId: userOrgID,
- DocSort:sortt,
- Status: 1,
- }
- err = site_service.AddDoctorInfo(doctor)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医生失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "doctor":doctor,
- })
- }
-
- //新增科室环境
- func (this *Microwebsite) AddKeEnvironment() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("错误是什么呢",err)
- fmt.Println("机构ID",userOrgID)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
-
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("标题:",title)
- sort := dataBody["sort"].(string)
- if len(sort) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:",sortt)
- keImages := dataBody["keImages"]
- //图片数组转为字符串保存到数据库
- replace := strings.Replace(strings.Trim(fmt.Sprint(keImages), "[]"), " ", ",", -1)
- fmt.Println("图片:",keImages)
- fmt.Println("字符串",replace)
- model := models.SgjPatientModel{
- Title: title,
- Sort: sortt,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 5,
- }
-
- site_service.AddPatientModel(&model)
- patientModel, err := site_service.QueryModel(userOrgID)
-
- officenviroment := models.SgjPatientOffenvironment{
- Title: title,
- Sort: sortt,
- Keimages: replace,
- Mtime: time.Now().Unix(),
- UserOrgId: userOrgID,
- Status: 1,
- Modelid:patientModel.ID,
- }
-
- err = site_service.AddOffEnvironment(officenviroment)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加科室环境失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "offenvironment":officenviroment,
- })
- }
-
- //获取轮播图
- func (this *Microwebsite) GetRationImages() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- rotation, err := site_service.GetRationImages(userOrgID)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取轮播图失败")
- return
- }
- fmt.Println("错误是什么",err)
- fmt.Println("获取的数据",rotation)
- this.ServeSuccessJSON(map[string]interface{}{
- "rotationImages":rotation,
- })
- }
-
-
- //获取医院信息
- func (this * Microwebsite) GetHospitalinfo() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- hospital, err := site_service.GetHospitalInfo(userOrgID)
- fmt.Println("数据是什么",hospital)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取轮播图失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "hospital":hospital,
- })
- }
-
-
- //获取科室信息
- func (this * Microwebsite) GetOfficeInfo() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- offices, err := site_service.GetOfficeInfo(userOrgID)
- fmt.Println("科室介绍数据是什么",offices)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取轮播图失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "offices":offices,
- })
- }
-
- //获取名医介绍
- func (this * Microwebsite) GetDoctorInfo() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- doc, err := site_service.GetDoctorInfo(userOrgID)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "doctor":doc,
- })
- }
-
- func (this * Microwebsite) GetQueryDocInfo(){
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- doc, err := site_service.GetQueryDocInfo(userOrgID)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "doctor":doc,
- })
- }
-
- func (this * Microwebsite) GetQueryDocHead() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- docHead, err := site_service.GetQueryDocHead(userOrgID)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "docHead":docHead,
- })
- }
-
- //获取科室环境
- func (this * Microwebsite) GetOffEnvironment() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- offenvironment, err := site_service.GetOffEnvironment(userOrgID)
- fmt.Println("错误是什么",err)
- fmt.Println("科室环境数据",offenvironment)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "offenvironment":offenvironment,
- })
- }
-
- //添加联系我们的轮播图
- func (this * Microwebsite) AddRotationUpload() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("错误是什么呢",err)
- fmt.Println("机构ID",userOrgID)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
-
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("姓名:",title)
- sort := dataBody["sort"].(string)
- if len(sort) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:",sortt)
- rotationImages := dataBody["rotationImages"]
- //图片数组转为字符串保存到数据库
- replace := strings.Replace(strings.Trim(fmt.Sprint(rotationImages), "[]"), " ", ",", -1)
- fmt.Println("姓名:",rotationImages)
- fmt.Println("字符串",replace)
-
- connecmodel := models.SgjPatientConnecmodel{
- Title: title,
- Sort: sortt,
- RotationImages: replace,
- UserOrgId: userOrgID,
- Status: 1,
- ModeType: 1,
- Ctime: time.Now().Unix(),
- }
-
- err = site_service.AddRotationUpload(&connecmodel)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "connecmodel":connecmodel,
- })
- }
- //添加工作时间
- func (this * Microwebsite) AddWorkTime() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("错误是什么呢", err)
- fmt.Println("机构ID", userOrgID)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- sort := dataBody["sort"].(string)
- if len(sort) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:", sortt)
-
- worktime := dataBody["worktime"].(string)
- if len(worktime) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "工作时间不能为空")
- return
- }
-
- sgjworktime := models.SgjPatientConnecmodel{
- Title: title,
- Sort: sortt,
- Status: 1,
- UserOrgId: userOrgID,
- Worktime: worktime,
- ModeType: 4,
- Ctime: time.Now().Unix(),
- }
-
- //添加模块
- err = site_service.AddWorkTime(sgjworktime);
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "sgjworktime":sgjworktime,
- })
- }
-
- //添加乘车方式
- func (this * Microwebsite) AddRideway() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("错误是什么呢", err)
- fmt.Println("机构ID", userOrgID)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
-
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("姓名:", title)
- sort := dataBody["sort"].(string)
- if len(sort) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:", sortt)
- content := dataBody["content"].(string)
- if len(content) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "乘车方式不能为空")
- return
- }
-
- rideway := models.SgjPatientConnecmodel{
- Title: title,
- Sort: sortt,
- UserOrgId: userOrgID,
- Rideway:content,
- Status: 1,
- ModeType: 5,
- Ctime: time.Now().Unix(),
- }
-
- err = site_service.AddRideWay(rideway)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "rideway":rideway,
- })
-
- }
-
- //添加联系方式
- func (this * Microwebsite) AddConnection() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("错误是什么呢", err)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("姓名:", title)
- connecway :=int64( dataBody["connecway"].(float64))
- if connecway < 0{
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "联系方式不能为空")
- return
- }
- fmt.Println("联系方式",connecway)
- content := dataBody["content"].(string)
- if len(content) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("内容",content)
-
- connection := models.SgjPatientConnection{
- Title: title,
- Connecway: connecway,
- Content: content,
- Status: 1,
- Ctime: time.Now().Unix(),
- UserOrgId:userOrgID,
- }
- err = site_service.AddConnetion(connection);
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加联系方式失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "connection":connection,
- })
-
- }
-
- //获取联系方式
- func (this * Microwebsite) GetQueryConnection() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- conection, err := site_service.GetQueryConnection(userOrgID)
- fmt.Println("conections是啥",conection)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "conection":conection,
- })
- }
-
- //删除联系人
- func (this * Microwebsite) DeleteConnecWay() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- id, _ := this.GetInt64("id")
- fmt.Println("id是啥?",id)
- err := site_service.DeleteConnecWay(userOrgID, id)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
-
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- //编辑联系人
- func (this *Microwebsite) EditConnecWay() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- connection, err := site_service.EditConnecWay(userOrgID, id)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "connection":connection,
- })
- }
-
- func (this *Microwebsite) SaveConnection() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- fmt.Println("机构ID",userOrgID)
- id, _ := this.GetInt64("id")
- fmt.Println("id是啥?",id)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
- title := dataBody["title"].(string)
- fmt.Println("title",title)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- connecway := int64(dataBody["connecway"].(float64))
- fmt.Println("connecway",connecway)
-
- content := dataBody["content"].(string)
- fmt.Println("content",content)
- if len(content) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong,"联系方式不能为空")
- return
- }
- connection := models.SgjPatientConnection{
- Title: title,
- Connecway: connecway,
- Content: content,
- }
-
- site_service.UpadateConnec(&connection,userOrgID,id)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "connection":connection,
- })
-
- }
-
- //新增联系方式
- func (this *Microwebsite) AddContract() {
-
- }
-
- func (this *Microwebsite) GetUserdModel() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- model, err := site_service.GetUserModel(userOrgID)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- fmt.Println("err")
- fmt.Println("模型是什么",model)
- this.ServeSuccessJSON(map[string]interface{}{
- "model":model,
- })
- }
-
- func (this *Microwebsite) GetQueryNewModel() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- model, err := site_service.GetQueryNewModel(userOrgID)
- fmt.Println("查询新增模块数据是什么?",model)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- fmt.Println("err")
- fmt.Println("返回新增模块模型是什么",model)
- this.ServeSuccessJSON(map[string]interface{}{
- "model":model,
- })
- }
-
- func (this *Microwebsite) GetEditModel() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("模块id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- connecmodel, err := site_service.GetEditModel(userOrgID, id)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "connecmodel":connecmodel,
- })
- }
-
- func (this *Microwebsite) EditRideWay() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("模块id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- connecmodel, err := site_service.GetEditModel(userOrgID, id)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "connecmodel":connecmodel,
- })
- }
-
- //保存编辑后的工作时间
- func (this *Microwebsite) SaveWorktTime() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("模块id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
-
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
-
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("姓名:", title)
- sort := int64(dataBody["sort"].(float64))
- if sort <= 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- //sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:", sort)
- worktime := dataBody["worktime"].(string)
- fmt.Println("工作时间",worktime)
- if len(worktime) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
-
- connecmodel := models.SgjPatientConnecmodel{
- Title: title,
- Sort: sort,
- Worktime: worktime,
- }
- site_service.UpdateWorkTime(id,userOrgID,connecmodel);
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "connecmodel":connecmodel,
- })
- }
-
- //保存编辑后的乘车方式
- func (this *Microwebsite) Saverideway() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("模块id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
-
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("标题:", title)
- sort := int64(dataBody["sort"].(float64))
- if sort <= 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- //sortt, err := strconv.ParseInt(sort, 10, 64)
- fmt.Println("排序:", sort)
- rideway := dataBody["rideway"].(string)
- fmt.Println("工作时间",rideway)
- if len(rideway) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- ridewaymodel := models.SgjPatientConnecmodel{
- Title: title,
- Sort: sort,
- Rideway: rideway,
- }
-
- err = site_service.UpdateRideWay(id, userOrgID, ridewaymodel)
- fmt.Println("错误是什么?",err)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "ridewaymodel":ridewaymodel,
- })
- }
-
- //编辑医生信息
- func (this *Microwebsite) Editdoctor() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("医生id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- fmt.Println("机构id",userOrgID)
- docinfo, err := site_service.EditDoctorInfo(id, userOrgID)
- fmt.Println("错误是什么",err)
- fmt.Println("docinfo",docinfo)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "docinfo":docinfo,
- })
- }
-
- func (this *Microwebsite) Change() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("医生id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- fmt.Println("机构id",userOrgID)
- docinfo, err := site_service.QueryDocById(userOrgID, id)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "docinfo":docinfo,
- })
- }
-
- func (this *Microwebsite) SaveDocInfo() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("保存id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- fmt.Println("机构id",userOrgID)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
- docname := dataBody["docname"].(string)
- if len(docname) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "姓名不能为空")
- return
- }
- fmt.Println("姓名:",docname)
-
- docpostion := int64(dataBody["doc_position"].(float64))
- if docpostion < 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "职称不能为空")
- return
- }
-
- fmt.Println("职位",docpostion)
- dochead := dataBody["dochead"].(string)
- if len(dochead) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "头像不能为空")
- return
- }
- fmt.Println("头像",dochead)
- docsort := int64(dataBody["doc_sort"].(float64))
- if docsort <= 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序不能为空")
- return
- }
- fmt.Println("排序",docsort)
- docintroduction := dataBody["docintroduction"].(string)
- if len(docintroduction) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "头像不能为空")
- return
- }
- fmt.Println("简介",docintroduction)
- doctor := models.SgjPatientDoctor{
- Docname: docname,
- DocPosition: docpostion,
- Dochead: dochead,
- DocSort: docsort,
- Docintroduction: docintroduction,
- }
- err = site_service.UpdateDocInfo(id, userOrgID, doctor)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "doctor":doctor,
- })
- }
-
- func (this *Microwebsite) DeleteDoctor() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("保存id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- err := site_service.DeleteDoctor(id, userOrgID)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
- return
- }
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *Microwebsite) EditHospital() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("保存id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- hospital, err := site_service.EditHospital(id, userOrgID)
- fmt.Println("参训是什么",hospital)
- fmt.Println(err)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "hospital":hospital,
- })
- }
-
- func (this *Microwebsite) SaveHospital() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("保存id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- fmt.Println(userOrgID)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
-
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("标题:", title)
-
- sort := int64(dataBody["sort"].(float64))
- fmt.Println("sort是神",sort)
- if sort <= 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- fmt.Println("排序:", sort)
- introduction := dataBody["introduction"].(string)
- if len(introduction) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
-
- modleid := int64(dataBody["modleid"].(float64))
- if modleid <= 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
- return
- }
- fmt.Println("模块id",modleid)
- hospital := models.SgjPatientHospital{
- Title: title,
- Sort: sort,
- Introduction: introduction,
- }
- err = site_service.UpdateHospital(id, userOrgID, hospital)
-
- model := models.SgjPatientModel{
- Title: title,
- Sort: sort,
- }
- fmt.Println(hospital)
- Modelerr := site_service.UpdateModel(modleid, userOrgID, model)
- fmt.Println("错误是什么",Modelerr)
- fmt.Println("错误是什么",err)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "hospital":hospital,
- "model":model,
- })
- }
-
- func (this *Microwebsite) EditOffice() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("保存id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- offices, err := site_service.EditOffice(id, userOrgID)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "offices":offices,
- })
- }
-
- func (this *Microwebsite) Deletemodlebyid() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("保存id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- err := site_service.DeletemodleById(id, userOrgID)
- modelid := site_service.DeleteHospitalByModelid(id, userOrgID)
- byModelid := site_service.DeleteOfficeByModelid(id, userOrgID)
- fmt.Println(modelid,byModelid)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
- return
- }
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *Microwebsite) SaveOffice() {
- adminUserInfo := this.GetAdminUserInfo()
- id, _ := this.GetInt64("id")
- fmt.Println("科室介绍id是啥?",id)
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- fmt.Println(userOrgID)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
- return
- }
-
- title := dataBody["title"].(string)
- if len(title) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
- fmt.Println("标题:", title)
-
- sort := int64(dataBody["sort"].(float64))
- fmt.Println("sort是神",sort)
- if sort <= 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
- return
- }
- fmt.Println("排序:", sort)
- introduction := dataBody["introduction"].(string)
- if len(introduction) == 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
- return
- }
-
- modleid := int64(dataBody["modleid"].(float64))
- if modleid <= 0 {
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
- return
- }
- fmt.Println("模块ID",modleid)
-
- offices := models.SgjPatientOffices{
- Title: title,
- Sort: sort,
- Introduction: introduction,
- }
- updateOffices := site_service.UpdateOffices(id, userOrgID, offices)
-
- model := models.SgjPatientModel{
- Title: title,
- Sort: sort,
- }
- updateModel := site_service.UpdateModel(modleid, userOrgID, model)
- fmt.Println(updateModel)
- if updateOffices !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "offices":offices,
- "model":model,
- })
- }
-
- func (this *Microwebsite) GetHospital() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
-
- hostital, err := site_service.GetHospital(userOrgID)
-
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "hostital":hostital,
- })
- }
-
- func (this *Microwebsite) GetData() {
- adminUserInfo := this.GetAdminUserInfo()
- userOrgID := int64(adminUserInfo.CurrentOrgId)
- fmt.Println("机构ID" ,userOrgID)
- model, err := site_service.GetData(userOrgID)
- fmt.Println("错误是什么",err)
- if err !=nil{
- this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patientModels":model,
- })
- }
|