123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923 |
- package site_service
-
- import (
- "SCRM/models"
- "SCRM/service"
- "fmt"
- "time"
- "github.com/jinzhu/gorm"
- "github.com/robfig/cron"
- "SCRM/utils"
- "strconv"
- )
-
- // cron表达式 https://www.cnblogs.com/zuxingyu/p/6023919.html
- var createDefalutDataCronJob *cron.Cron
-
- func BeginAutoCreateDefalutData() {
- //createDefalutDataCronJob.Start()
- }
-
- func init() {
- utils.InfoLog("开启自动排班定时任务")
- createDefalutDataCronJob = cron.New()
- spec := "*/5 * * * * ?" // 每隔5秒执行一次
- createDefalutDataCronJob.AddFunc(spec, func() {
- AutoCreateDefalutSchedules()
- })
- }
-
- func AutoCreateDefalutSchedules() {
- utils.TraceLog("自动添加数据任务开始执行")
- //获取是10分前的时间
- var orginfo []*models.OrgInfo
- nowtime := time.Now().Unix()
- fmt.Println("当前时间",nowtime)
- timebefor := time.Now().Add(-time.Minute * 10).Unix()
- fmt.Println("10分钟之前时间",timebefor)
- //1570653733 //1570654333
- err := service.PatientReadDB().Raw("select * from sgj_users.sgj_user_org as u where u.ctime>=? AND u.ctime<= ?", timebefor, nowtime).Scan(&orginfo).Error
- fmt.Println("err",err)
- fmt.Println("orginfo",orginfo)
- for i:=0;i< len(orginfo);i++ {
- userOrgID := orginfo[i].ID
- fmt.Println("ID是设么",userOrgID)
- navigation, err := GetPatientNavigation(userOrgID)
- fmt.Println("err",err)
- if(len(navigation) == 0){
- patientNavigation := models.SgjPatientNavigation{
- Navtitle: "首页",
- Navimages: "https://images.shengws.com/2089_o_1571990714383.png",
- Status: 1,
- UserOrgId: userOrgID,
- Nonavimages: "https://images.shengws.com/2105_o_1571990730785.png",
- Linktype: 1,
- Ctime: time.Now().Unix(),
- }
- err := AddNavgation(&patientNavigation)
- fmt.Println("err",err)
-
-
- patientnavigationthree := models.SgjPatientNavigation{
- Navtitle: "客服",
- Navimages: "https://images.shengws.com/2101_o_1571990903053.png",
- Status: 1,
- UserOrgId: userOrgID,
- Nonavimages: "https://images.shengws.com/2113_o_1571990915581.png",
- Linktype:2,
- Ctime: time.Now().Unix(),
- }
- err = AddNavgation(&patientnavigationthree)
-
- patientnavigationtwo := models.SgjPatientNavigation{
- Navtitle: "电话",
- Navimages: "https://images.shengws.com/2092_o_1571990776921.png",
- Status: 1,
- UserOrgId: userOrgID,
- Linktype:3,
- Nonavimages: "https://images.shengws.com/2100_o_1571990784845.png",
- Ctime: time.Now().Unix(),
- }
- err = AddNavgation(&patientnavigationtwo)
-
- sgjPatientNavigation := models.SgjPatientNavigation{
- Navtitle: "联系我们",
- Navimages: "https://images.shengws.com/2124_o_1571990749565.png",
- Status: 1,
- UserOrgId: userOrgID,
- Nonavimages: "https://images.shengws.com/2079_o_1571990763549.png",
- Linktype:4,
- Ctime: time.Now().Unix(),
- }
- err = AddNavgation(&sgjPatientNavigation)
- fmt.Println("err",err)
- }
-
- model, err := GetData(userOrgID)
- if(len(model) == 0){
- patientModel := models.SgjPatientModel{
- Title: "轮播图",
- Sort: 1,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 1,
- }
- err := AddPatientModelTwo(&patientModel)
- fmt.Println("err",err)
- sgjPatientModel, err := GetQueryModelByLastData(userOrgID)
- editpiclink := models.SgjPatientEditpiclink{
- Images: "https://images.shengws.com/2124_o_1570607834870.png",
- Sort: 1,
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- Modeid:sgjPatientModel.ID,
- }
- err = AddPatientEdit(&editpiclink)
- fmt.Println("err",err)
-
- patientmodefour := models.SgjPatientModel{
- Title: "魔方导航",
- Sort: 2,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 8,
- }
- err = AddPatientModelTwo(&patientmodefour)
- sgjpatietnmodelfour, err := GetQueryModelByLastData(userOrgID)
- ID :=int64(sgjpatietnmodelfour.ID + 1)
- fmt.Println("ID是多少",ID)
- modeid := strconv.FormatInt(ID, 10)
- magiclink := models.SgjPatientMagiclink{
- UserOrgId: userOrgID,
- Linktype: 2,
- Instationlink: ID,
- Ctime: time.Now().Unix(),
- Status: 1,
- }
- AddMacLinkAddress(&magiclink)
- patientMagiclink, err := GetMacLinkAddressByLastData(userOrgID)
-
- orgid := strconv.FormatInt(userOrgID, 10)
- KeID :=int64(sgjpatietnmodelfour.ID + 3)
- OfficeID := strconv.FormatInt(KeID, 10)
- magiclinktwo := models.SgjPatientMagiclink{
- UserOrgId: userOrgID,
- Linktype: 2,
- Instationlink: KeID,
- Ctime: time.Now().Unix(),
- Status: 1,
- }
- AddMacLinkAddress(&magiclinktwo)
- patientMagiclinktwo, err := GetMacLinkAddressByLastData(userOrgID)
- ActiID :=int64(sgjpatietnmodelfour.ID + 5)
- magiclinkthree := models.SgjPatientMagiclink{
- UserOrgId: userOrgID,
- Linktype: 2,
- Instationlink: ActiID,
- Ctime: time.Now().Unix(),
- Status: 1,
- }
- AddMacLinkAddress(&magiclinkthree)
- patientMagiclinkthree, err := GetMacLinkAddressByLastData(userOrgID)
- ActisID := strconv.FormatInt(ActiID, 10)
- ActivID :=int64(sgjpatietnmodelfour.ID + 6)
- magiclinkfour := models.SgjPatientMagiclink{
- UserOrgId: userOrgID,
- Linktype: 2,
- Instationlink: ActivID,
- Ctime: time.Now().Unix(),
- Status: 1,
- }
- AddMacLinkAddress(&magiclinkfour)
- patientMagiclinkfour, err := GetMacLinkAddressByLastData(userOrgID)
- ActivsID := strconv.FormatInt(ActivID, 10)
- EnviID := int64(sgjpatietnmodelfour.ID + 4)
- magiclinkfive := models.SgjPatientMagiclink{
- UserOrgId: userOrgID,
- Linktype: 2,
- Instationlink: EnviID,
- Ctime: time.Now().Unix(),
- Status: 1,
- }
- AddMacLinkAddress(&magiclinkfive)
- patientMagiclinkfive, err := GetMacLinkAddressByLastData(userOrgID)
- EniviIDs := strconv.FormatInt(EnviID, 10)
- editmargin := models.SgjPatientEditmargin{
- Margtitle: "医院介绍",
- Margimage: "https://images.shengws.com/2162_o_1571992616722.png",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- Modeid: sgjpatietnmodelfour.ID,
- Jumpset:1,
- Marginaddress:"http://jk.test.sgjyun.com/#/hospitalIntroduction?id="+modeid+"&orgid="+orgid ,
- Linkid:patientMagiclink.ID,
- //Marginaddress:"http://microweb.kuyicloud.com/#/hospitalIntroduction?id="+modeid+"&orgid="+orgid ,
- }
- err = AddEditMargin(&editmargin)
- patientEditmargin := models.SgjPatientEditmargin{
- Margtitle: "医护团队",
- Margimage: "https://images.shengws.com/2121_o_1571992634289.png",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- Modeid: sgjpatietnmodelfour.ID,
- Jumpset:1,
- Marginaddress:"http://jk.test.sgjyun.com/#/medicalTeam?id="+OfficeID+"&orgid="+orgid,
- //Marginaddress:"http://microweb.kuyicloud.com/#/medicalTeam?id="+OfficeID+"&orgid="+orgid,
- Linkid:patientMagiclinktwo.ID,
- }
- err = AddEditMargin(&patientEditmargin)
- sgjPatientEditmargin := models.SgjPatientEditmargin{
- Margtitle: "医院动态",
- Margimage: "https://images.shengws.com/2163_o_1571992676180.png",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- Modeid: sgjpatietnmodelfour.ID,
- Jumpset:1,
- Marginaddress:"http://jk.test.sgjyun.com/#/news?id="+ActisID+"&orgid="+orgid,
- //Marginaddress:"http://microweb.kuyicloud.com/#/news?id="+ActisID+"&orgid="+orgid,
- Linkid:patientMagiclinkthree.ID,
- }
- AddEditMargin(&sgjPatientEditmargin)
- patienteditmarginfour := models.SgjPatientEditmargin{
- Margtitle: "医院活动",
- Margimage: "https://images.shengws.com/2117_o_1571992689392.png",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- Modeid: sgjpatietnmodelfour.ID,
- Jumpset:1,
- Marginaddress:"http://jk.test.sgjyun.com/#/activity?id="+ActivsID+"&orgid="+orgid,
- //Marginaddress:"http://microweb.kuyicloud.com/#/activity?id="+ActivsID+"&orgid="+orgid,
- Linkid:patientMagiclinkfour.ID,
- }
- AddEditMargin(&patienteditmarginfour)
- patienteditmarginfive := models.SgjPatientEditmargin{
- Margtitle: "医院环境",
- Margimage: "https://images.shengws.com/2130_o_1571992702226.png",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- Modeid: sgjpatietnmodelfour.ID,
- Jumpset:1,
- Marginaddress:"http://jk.test.sgjyun.com/#/departmentEnvironment?id="+EniviIDs+"&orgid="+orgid,
- //Marginaddress:"http://microweb.kuyicloud.com/#/departmentEnvironment?id="+EniviIDs+"&orgid="+orgid,
- Linkid:patientMagiclinkfive.ID,
- }
- AddEditMargin(&patienteditmarginfive)
- patienteditmarginsix := models.SgjPatientEditmargin{
- Margtitle: "咨询客服",
- Margimage: "https://images.shengws.com/2149_o_1571992721076.png",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- Modeid: sgjpatietnmodelfour.ID,
- Jumpset:1,
- }
- AddEditMargin(&patienteditmarginsix)
-
- patienteditmarginserven := models.SgjPatientEditmargin{
- Margtitle: "加入会员",
- Margimage: "https://images.shengws.com/2165_o_1571992737567.png",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- Modeid: sgjpatietnmodelfour.ID,
- Jumpset:1,
- }
- AddEditMargin(&patienteditmarginserven)
-
- patienteditmargineghit := models.SgjPatientEditmargin{
- Margtitle: "联系我们",
- Margimage: "https://images.shengws.com/2122_o_1571992753168.png",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- Modeid: sgjpatietnmodelfour.ID,
- }
- AddEditMargin(&patienteditmargineghit)
-
- patientModelTwo := models.SgjPatientModel{
- Title: "医院介绍",
- Sort: 4,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 2,
- }
- AddPatientModelTwo(&patientModelTwo)
-
- sgjPatientModelTwo, err := GetQueryModelByLastData(userOrgID)
- hospital := models.SgjPatientHospital{
- Title: "医院介绍",
- Sort: 4,
- Introduction: "",
- UserOrgId: userOrgID,
- Modleid: sgjPatientModelTwo.ID,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- AddHospital(&hospital)
-
- Sgjpatientmodelthree := models.SgjPatientModel{
- Title: "科室介绍",
- Sort: 8,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 3,
-
- }
- AddPatientModelTwo(&Sgjpatientmodelthree)
- datathree, err := GetQueryModelByLastData(userOrgID)
- offices := models.SgjPatientOffices{
- Title: "科室介绍",
- Sort: 8,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- Modleid: datathree.ID,
- Introduction:"",
- }
- AddPatientOffices(&offices)
- patientModelFive := models.SgjPatientModel{
- Title: "医护团队",
- Sort: 5,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 4,
- }
- AddPatientModelTwo(&patientModelFive)
- data, err := GetQueryModelByLastData(userOrgID)
- editdoctor := models.SgjPatientEditdoctor{
- Dochead: "https://images.shengws.com/2062_o_1570608303729.png",
- DocSort: 1,
- Docintroduction: "",
- UserOrgId: userOrgID,
- Modleid: data.ID,
- Status:1,
- Ctime:time.Now().Unix(),
- DocPostion:1,
- }
- AddEditDoctor(&editdoctor)
-
- modelserven := models.SgjPatientModel{
- Title: "医院环境",
- Sort: 6,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 5,
- }
- AddPatientModelTwo(&modelserven)
- lastData, err := GetQueryModelByLastData(userOrgID)
- enviroimages := models.SgjPatientEnviroimages{
- Enviroimages: "https://images.shengws.com/2076_o_1572602899145.jpg",
- Sort: 1,
- UserOrgId: userOrgID,
- Status: 1,
- Modeid: lastData.ID,
- Ctime: time.Now().Unix(),
- }
- AddImages(&enviroimages)
-
- modelArticles := models.SgjPatientModel{
- Title: "医院动态",
- Sort: 3,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 6,
- }
- AddPatientModelTwo(&modelArticles)
- articleslist, err := GetQueryModelByLastData(userOrgID)
- fmt.Println("articleslist",articleslist)
- fmt.Println("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")
- articlelist := models.SgjPatientArticlelist{
- Title: "医院动态",
- Sort:3,
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- Number: 1,
- Modeid: articleslist.ID,
- }
- AddActiclelist(&articlelist)
- fmt.Println("我爱你中国法阿发法阿凡达阿凡达阿道夫阿道夫阿道夫阿发阿凡达暗室逢灯阿斯蒂芬暗室逢灯")
- articles, err := GetAritclesData(userOrgID)
- if(len(articles) == 0){
- articles := models.Articles{
- Title: "",
- Content: "",
- Imgs: "https://images.shengws.com/2062_o_1570608303729.png",
- Status: 1,
- Ctime: time.Now().Unix(),
- UserOrgId: userOrgID,
- ArticleStatus:1,
- }
- AddActicles(&articles)
- }
-
- modelActivitis := models.SgjPatientModel{
- Title: "医院活动",
- Sort: 7,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- ModeType: 7,
- }
- AddPatientModelTwo(&modelActivitis)
- activtiys, err := GetQueryModelByLastData(userOrgID)
- addactivity := models.SgjPatientAddactivity{
- Title: "医院活动",
- Sort: 7,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status: 1,
- Modeid: activtiys.ID,
- Number:1,
- }
- AddActivity(&addactivity)
-
- activity, err := GetArititys(userOrgID)
- if(len(activity) == 0){
- activity := models.Activity{
- Title: "医院活动",
- PosterPhoto: "https://images.shengws.com/2062_o_1570608303729.png",
- UserOrgId: userOrgID,
- CreateTime: time.Now().Unix(),
- Status: 1,
- }
- AddActivitys(&activity)
- }
-
- }
-
- oldmodels, err := GetContactUsModel(userOrgID)
- fmt.Println("orgmodels是设么",oldmodels)
- if(len(oldmodels) == 0){
- ordmodel := models.PatientOrdmodel{
- Title: "轮播图",
- UserOrgId: userOrgID,
- Sort: 1,
- ModeType: 1,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- err := AddPatientOrdModel(ºodel)
- fmt.Println("错误是设么",err)
- patientOrdmodel, err := GetPatientOrdModelByLastData(userOrgID)
- conrotation := models.SgjPatientConrotation{
- Images: "https://images.shengws.com/2124_o_1570607834870.png",
- Sort: 1,
- Modeid: patientOrdmodel.ID,
- UserOrgId: userOrgID,
- Ctime: time.Now().Unix(),
- Status:1,
- Piclink:1,
- }
- AddConRotation(&conrotation)
-
- ordmodelOne := models.PatientOrdmodel{
- Title: "医院地址",
- UserOrgId: userOrgID,
- Sort: 2,
- ModeType: 2,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- AddPatientOrdModel(ºodelOne)
- patientOrdmodelOne, err := GetPatientOrdModelByLastData(userOrgID)
- hosaddress := models.SgjPatientHosaddress{
- Title: "医院地址",
- UserOrgId: userOrgID,
- Address: "暂无数据",
- Ctime: time.Now().Unix(),
- Status: 1,
- Modeid: patientOrdmodelOne.ID,
- }
- AddHosAddress(&hosaddress)
-
- ordmodeltwo := models.PatientOrdmodel{
- Title: "联系方式",
- UserOrgId: userOrgID,
- Sort: 3,
- ModeType: 3,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- AddPatientOrdModel(ºodeltwo)
- patientOrdmodelTwo, err := GetPatientOrdModelByLastData(userOrgID)
- connectway := models.SgjPatientConnectway{
- Title: "联系方式",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- ModeId:patientOrdmodelTwo.ID,
- }
- AddConnecWay(&connectway)
- connection := models.SgjPatientConnection{
- Title: "电话",
- Connecway: 1,
- Content: "暂无数据",
- Status: 1,
- UserOrgId: userOrgID,
- }
- AddConnetion(connection)
-
- ordmodelthree:= models.PatientOrdmodel{
- Title: "工作时间",
- UserOrgId: userOrgID,
- Sort: 4,
- ModeType: 4,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- AddPatientOrdModel(ºodelthree)
- patientOrdmodelThree, err := GetPatientOrdModelByLastData(userOrgID)
- worktime := models.SgjPatientWorktime{
- Title: "工作时间",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- ModeId: patientOrdmodelThree.ID,
- Worktime:"暂无数据",
- }
- AddWorkTime(&worktime)
- ordmodelfour:= models.PatientOrdmodel{
- Title: "乘车方式",
- UserOrgId: userOrgID,
- Sort: 5,
- ModeType: 5,
- Status: 1,
- Ctime: time.Now().Unix(),
- }
- AddPatientOrdModel(ºodelfour)
- patientOrdmodelfour, err := GetPatientOrdModelByLastData(userOrgID)
- rideway := models.SgjPatientRideway{
- Title: "乘车方式",
- UserOrgId: userOrgID,
- Status: 1,
- Ctime: time.Now().Unix(),
- ModeId: patientOrdmodelfour.ID,
- RideWay: "暂无数据",
- }
- AddRideWay(rideway)
- }
- }
-
-
- }
-
-
-
- func AddPatientModel(model *models.SgjPatientModel)error{
- err := service.PatientWriteDB().Create(&model).Error
- fmt.Println("插入错误",err)
- return err
- }
-
- func QueryModel(orgID int64)( models.SgjPatientModel,error) {
- model := models.SgjPatientModel{}
- err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Last(&model).Error
- return model,err
- }
-
- func UpdateEditpicLink(orgID int64,ids[] int64,editpiclink models.SgjPatientEditpiclink)(err error) {
- if(len(ids)==1){
- err = service.PatientWriteDB().Model(&models.SgjPatientEditpiclink{}).Where("id = ? AND user_org_id = ? ", ids[0], orgID).Update(map[string]interface{}{"modeid": editpiclink.Modeid, "status": 1,"img_show":0, "mtime": time.Now().Unix()}).Error
- }else {
- err = service.PatientWriteDB().Model(&models.SgjPatientEditpiclink{}).Where("id IN(?) and user_org_id = ? ", ids, orgID).Update(map[string]interface{}{"modeid": editpiclink.Modeid, "status": 1,"img_show":0, "mtime": time.Now().Unix()}).Error
- }
- return
- }
-
- func AddRotation(rotation models.SgjPatientRotation) error {
- err := service.PatientWriteDB().Create(&rotation).Error
- fmt.Println("插入数据",err)
- return err
- }
-
- func GetRotationByLastData(orgid int64)(models.SgjPatientRotation,error) {
- rotation := models.SgjPatientRotation{}
- err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&rotation).Error
- return rotation,err
- }
-
- func AddRotationUpload(connecmodel *models.SgjPatientConnecmodel) error {
- err := service.PatientWriteDB().Create(&connecmodel).Error
- fmt.Println("错误是什么,err",err)
- return err
- }
-
- func AddHispital(newmodel models.SgjPatientHospital) error {
- err := service.PatientWriteDB().Create(&newmodel).Error
- return err
- }
-
- func AddOffices(offices models.SgjPatientOffices) error {
- err := service.PatientWriteDB().Create(&offices).Error
- return err
- }
-
- func AddDoctor(doctor models.SgjPatientDocinfo) error {
- err := service.PatientWriteDB().Create(&doctor).Error
- return err
- }
-
- func AddDoctorInfo(doctor models.SgjPatientEditdoctor) error{
- err := service.PatientWriteDB().Create(&doctor).Error
- return err
- }
-
- func AddImages(enviroimages *models.SgjPatientEnviroimages) error {
- err := service.PatientWriteDB().Create(&enviroimages).Error
- return err
- }
-
- func AddOffEnvironment(officenviroment models.SgjPatientOffenvironment) error {
- err := service.PatientWriteDB().Create(&officenviroment).Error
- return err
- }
-
- func GetRationImages(orgID int64)(rot []*models.SgjPatientRotation, err error){
- err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Order("sort").Find(&rot).Error
- fmt.Println("错误是什么",err)
- return
- }
-
- func GetHospitalInfo(orgID int64)(models.SgjPatientHospital,error) {
- hospital := models.SgjPatientHospital{}
- err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Last(&hospital).Error
- fmt.Println("错误是什么",err)
- return hospital,err
- }
-
- func GetOfficeInfo(orgID int64)(models.SgjPatientOffices,error) {
- offices := models.SgjPatientOffices{}
- err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Last(&offices).Error
- fmt.Println("错误是什么",err)
- return offices,err
- }
-
- func GetQueryDocInfo(orgID int64)(doc []*models.SgjUserStaffInfo,err error) {
- err = service.UserReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Find(&doc).Error
- fmt.Println("错误是什么",err)
- return
- }
-
- func GetQueryDocHead(orgID int64) (doc []*models.SgjPatientEditdoctor,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND status = ? AND img_show = ?", orgID, 1,1).Order("doc_sort").Find(&doc).Error
- return
- }
-
- func GetOffEnvironment(orgID int64)(models.SgjPatientOffenvironment,error) {
- offenvironment := models.SgjPatientOffenvironment{}
- err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Last(&offenvironment).Error
- fmt.Println("错误是什么",err)
- return offenvironment,err
- }
-
- func AddWorkTime(connecmodel *models.SgjPatientWorktime) error {
- err := service.PatientWriteDB().Create(&connecmodel).Error
- return err
- }
-
- func AddRideWay(connecmodel models.SgjPatientRideway) error {
- err := service.PatientWriteDB().Create(&connecmodel).Error
- return err
- }
-
- func AddConnetion(connection models.SgjPatientConnection) error {
- err := service.PatientWriteDB().Create(&connection).Error
- return err
- }
-
- func GetQueryConnection( orgID int64)(conection []*models.SgjPatientConnection,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Find(&conection).Error
- return
- }
-
- func DeleteRideWay(orgid int64,id int64)(error){
- err := service.PatientWriteDB().Model(&models.SgjPatientRideway{}).Where("user_org_id =? AND mode_id = ?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func DeleteConnecWay(orgid int64,id int64)(error) {
- err := service.PatientWriteDB().Model(&models.SgjPatientConnection{}).Where("user_org_id = ? AND id =?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func DeleteWorkTime(orgid int64,id int64)(error) {
- err := service.PatientWriteDB().Model(models.SgjPatientWorktime{}).Where("user_org_id = ? AND mode_id = ?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func EditConnecWay(orgid int64,id int64)(models.SgjPatientConnection,error){
- sgj := models.SgjPatientConnection{}
- err := service.PatientReadDB().Model(&sgj).Where("user_org_id = ? AND id =?", orgid, id).Find(&sgj).Error
- return sgj,err;
- }
-
- func UpadateConnec(connection *models.SgjPatientConnection,orgID int64,id int64) {
- service.PatientWriteDB().Model(connection).Where("user_org_id = ? AND id = ? AND status = ?",orgID,id,1).Update(map[string]interface{}{"title":connection.Title,"connecway":connection.Connecway,"content":connection.Content,})
- }
-
- func GetUserModel(orgid int64)(model []*models.SgjPatientOrdmodel,err error){
- err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&model).Error
- return
- }
-
- func GetQueryNewModel(orgid int64)(model []*models.SgjPatientModel,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&model).Error
- fmt.Println("错误是什么",err)
- return
- }
-
- func GetEditModel(orgid int64,id int64)(models.SgjPatientWorktime,error){
- worktime := models.SgjPatientWorktime{}
- err := service.PatientReadDB().Model(&worktime).Where("user_org_id = ? AND mode_id = ?", orgid, id).Find(&worktime).Error
- return worktime,err;
- }
-
- func GetEditRideWay(orgid int64,id int64)(models.SgjPatientRideway,error) {
- rideway := models.SgjPatientRideway{}
- err := service.PatientReadDB().Model(&rideway).Where("user_org_id = ? AND mode_id = ?", orgid, id).Find(&rideway).Error
- return rideway,err;
- }
-
- func UpdateWorkTime(mid int64,orgID int64,worktime models.SgjPatientWorktime) error {
- err := service.PatientWriteDB().Model(worktime).Where("id = ? AND user_org_id = ? AND status = ?", mid, orgID, 1).Update(map[string]interface{}{"title": worktime.Title, "sort": worktime.Sort, "worktime": worktime.Worktime, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func UpdateOrdeModel(id int64,orgID int64,ordmodel models.SgjPatientOrdmodel) error {
- err := service.PatientWriteDB().Model(ordmodel).Where("id = ? AND user_org_id = ? AND status = ?", id, orgID, 1).Update(map[string]interface{}{"title": ordmodel.Title, "sort": ordmodel.Sort, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func UpdateRideWay(id int64,orgID int64,rideway models.SgjPatientRideway) error {
- err := service.PatientWriteDB().Model(rideway).Where("id = ? AND user_org_id = ? AND status =?", id, orgID, 1).Update(map[string]interface{}{"title": rideway.Title, "sort": rideway.Sort, "ride_way": rideway.RideWay, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func QueryDocById(orgID int64,id int64)(models.SgjUserStaffInfo,error) {
- info := models.SgjUserStaffInfo{}
- err := service.UserWriteDB().Model(&info).Where("user_org_id = ? AND id = ?",orgID ,id ).Find(&info).Error
- return info,err
- }
-
- func DeleteDoctor(id int64,orgID int64)(error) {
- err := service.PatientWriteDB().Model(&models.SgjPatientEditdoctor{}).Where("id = ? AND user_org_id = ?", id, orgID).Update(map[string]interface{}{"status": 0,"img_show":0,"modleid":0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func EditHospital(mid int64,orgID int64)(models.SgjPatientHospital,error) {
- hospital := models.SgjPatientHospital{}
- err := service.PatientReadDB().Model(&hospital).Where("modleid = ? AND user_org_id = ? AND status = ?", mid, orgID, 1).Find(&hospital).Error
- return hospital,err
- }
-
- func UpdateHospital(id int64,OrgId int64,hospital models.SgjPatientHospital) error {
- err := service.PatientWriteDB().Model(hospital).Where("id = ? AND user_org_id = ? AND status = ?", id, OrgId, 1).Update(map[string]interface{}{"title": hospital.Title, "sort": hospital.Sort, "introduction": hospital.Introduction, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func UpdateModel(modelid int64,orgId int64 ,model models.SgjPatientModel) error {
- err := service.PatientWriteDB().Model(model).Where("id = ? AND user_org_id = ? AND status = ?", modelid, orgId, 1).Update(map[string]interface{}{"title": model.Title, "sort": model.Sort, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func EditOffice(mid int64,orgID int64)(models.SgjPatientOffices,error) {
- offices := models.SgjPatientOffices{}
- err := service.PatientReadDB().Model(&offices).Where("modleid = ? AND user_org_id = ? AND status = ?", mid, orgID, 1).Find(&offices).Error
- return offices,err
- }
-
- func DeletemodleById(id int64,orgID int64)(error) {
- err:= service.PatientWriteDB().Model(models.SgjPatientModel{}).Where("id = ? AND user_org_id = ?", id, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func DeleteHospitalByModelid(mid int64,orgID int64)(error) {
- err := service.PatientWriteDB().Model(models.SgjPatientHospital{}).Where("modleid = ? AND user_org_id = ?", mid, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func DeleteOfficeByModelid(mid int64,orgID int64)(error) {
- err := service.PatientWriteDB().Model(models.SgjPatientOffices{}).Where("modleid = ? AND user_org_id = ?", mid, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func DeleteEditPicLinkByModelid(mid int64,orgID int64)(error) {
- 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
- return err
- }
-
- func DeleteEnviroments(mid int64,orgID int64)(error) {
- 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
- return err
- }
-
- func DeleteConrotation(mid int64,orgID int64)(error) {
- 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
- return err
- }
-
- func DeletePatentEditMargin(mid int64,orgID int64)(error) {
- err := service.PatientWriteDB().Model(models.SgjPatientEditmargin{}).Where("modeid = ? AND user_org_id = ?", mid, orgID).Update(map[string]interface{}{"status": 0, "img_show": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
-
- func UpdateOffices(id int64,orgID int64,offices models.SgjPatientOffices) error {
- 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
- return err
- }
- func GetHospital(Orgid int64)(hostital []*models.SgjPatientHospital,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", Orgid, 1).Order("sort").Find(&hostital).Error
- return
- }
-
- func GetData(orgid int64)(model []*models.SgjPatientModel,err error) {
- db := service.PatientReadDB().Table("sgj_patient_model as m").Where(" m.status = ?", 1)
- dbs := service.PatientReadDB().Table("sgj_patient_editpiclink as s")
- fmt.Println("db是什么?",db)
- if(orgid > 0){
- db = db.Where("user_org_id = ? ", orgid)
- }
- err = db.Preload("Hospitals").Preload("Offices").Preload("OfficeEnviroment").
- Preload("Editdoctor").Preload("Editmargin").Preload("Enviroimages").Preload("PatientEditpiclink", func(db *gorm.DB) *gorm.DB{
- return dbs.Select("s.id,s.images,s.sort,s.piclink,s.linkaddress,s.user_org_id,s.status,s.ctime,s.mtime,s.modeid,s.img_show,s.linkid").Order("sort")
- }).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
- fmt.Println("err二二err二二err二二err二二err二二err",err)
-
- return
- }
-
- func GetPatientNavigation(orgid int64)(navigation []*models.SgjPatientNavigation,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid,1).Find(&navigation).Error
- return navigation,err
- }
-
- func AddNavgation(navigation *models.SgjPatientNavigation) error {
- err := service.PatientReadDB().Create(&navigation).Error
- return err
- }
-
-
- func UpdateDoctorsInfo(orgID int64,ids[] int64,editdoctor models.SgjPatientEditdoctor)(err error) {
- if(len(ids)==1){
- err = service.PatientWriteDB().Model(&models.SgjPatientEditdoctor{}).Where("id = ? and user_org_id = ?", ids[0], orgID).Update(map[string]interface{}{ "modleid": editdoctor.Modleid, "status": 1,"img_show": 0, "mtime": time.Now().Unix()}).Error
- }else {
- err = service.PatientWriteDB().Model(&models.SgjPatientEditdoctor{}).Where("id IN(?) and user_org_id = ?", ids, orgID).Update(map[string]interface{}{"modleid": editdoctor.Modleid, "status": 1,"img_show": 0, "mtime": time.Now().Unix()}).Error
- }
- return
- }
-
- func QueryEditDoc(mid int64,orgid int64)(models.SgjPatientDocinfo, error) {
- editdotor := models.SgjPatientDocinfo{}
- err := service.PatientReadDB().Model(&editdotor).Where("modelid = ? AND user_org_id = ? AND status = ?", mid, orgid, 1).Find(&editdotor).Error
- return editdotor,err
- }
-
- func QueryModelByid(id int64,orgid int64)(models.SgjPatientModel,error) {
- model := models.SgjPatientModel{}
- err := service.PatientReadDB().Model(&model).Where("id = ? AND user_org_id = ? AND status =?", id, orgid, 1).Find(&model).Error
- return model,err
- }
-
- func QuerEditDocByModleid(mid int64,orgid int64)(editdoctor []models.SgjPatientEditdoctor,err error) {
- err = service.PatientReadDB().Model(&editdoctor).Where("modleid = ? AND user_org_id = ? AND status = ?", mid, orgid, 1).Find(&editdoctor).Error
- return editdoctor,err
- }
-
- func QuerEditDocByid(mid int64,orgid int64)(editdoctor []*models.SgjPatientEditdoctor,err error) {
- err = service.PatientReadDB().Model(&editdoctor).Where("modleid = ? AND user_org_id = ? AND status = ?", mid, orgid, 1).Order("doc_sort").Find(&editdoctor).Error
- return
- }
-
- func QueryEditImages(orgid int64,id int64)(models.SgjPatientEditdoctor,error) {
- editdoctor := models.SgjPatientEditdoctor{}
- err := service.PatientReadDB().Model(&editdoctor).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&editdoctor).Error
- return editdoctor,err
- }
-
- func QueryEditDoctor(id int64,orgid int64)(models.SgjPatientEditdoctor,error) {
- docinfo := models.SgjPatientEditdoctor{}
- err := service.PatientReadDB().Model(&docinfo).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&docinfo).Error
- return docinfo,err
- }
-
- func UpDateEditdoctor(id int64,orgid int64,editdoctor models.SgjPatientEditdoctor) error {
- err := service.PatientWriteDB().Model(editdoctor).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"doc_name":editdoctor.DocName,"doc_postion": editdoctor.DocPostion, "dochead": editdoctor.Dochead, "doc_sort": editdoctor.DocSort, "docintroduction": editdoctor.Docintroduction, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func Upadatedocdata(orgid int64,id int64,docinfo models.SgjPatientDocinfo) error {
- err := service.PatientWriteDB().Model(docinfo).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Update(map[string]interface{}{"title": docinfo.Title, "sort": docinfo.Sort, "docimages": docinfo.Docimages, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetQueryModel(id,orgid int64)(models.SgjPatientModel,error) {
- model := models.SgjPatientModel{}
- err := service.PatientReadDB().Model(&model).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&model).Error
- return model,err
- }
-
- func QuerOfficeEnviroment(id int64,orgid int64)(models.SgjPatientOffenvironment,error) {
- offenvironment := models.SgjPatientOffenvironment{}
- err := service.PatientReadDB().Model(&offenvironment).Where("modelid = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&offenvironment).Error
- return offenvironment,err
- }
-
-
-
- func QueryOfficeformById(modeid int64,orgid int64)(patientenviroimages []*models.SgjPatientEnviroimages,err error) {
- err = service.PatientReadDB().Model(&patientenviroimages).Where("modeid = ? AND user_org_id = ? AND status = ?", modeid, orgid, 1).Find(&patientenviroimages).Error
- return
- }
-
- func UpdateOfficeEnvironment(id int64,orgid int64)(models.SgjPatientOffenvironment,error) {
- offenvironment := models.SgjPatientOffenvironment{}
- err := service.PatientReadDB().Model(&offenvironment).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&offenvironment).Error
- return offenvironment , err
- }
-
- func UpdatePatientOffenvironment(id int64,orgid int64,offenvironment models.SgjPatientOffenvironment)(error) {
- err := service.PatientWriteDB().Model(offenvironment).Where("id= ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": offenvironment.Title, "sort": offenvironment.Sort, "keimages": offenvironment.Keimages, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func QueryHispitalDetail(orgid int64,id int64)(models.SgjPatientHospital,error) {
- hospital := models.SgjPatientHospital{}
- err := service.PatientReadDB().Model(&hospital).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Find(&hospital).Error
- return hospital,err
- }
-
- func GetOfficeDetail(orgid int64,id int64)(models.SgjPatientOffices,error) {
- offices := models.SgjPatientOffices{}
- err := service.PatientReadDB().Model(&offices).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Find(&offices).Error
- return offices,err
- }
-
- func GetDoctorDetail(orgid int64,id int64)(editdoctor []*models.SgjPatientEditdoctor,err error) {
- err = service.PatientReadDB().Model(&editdoctor).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Order("doc_sort").Find(&editdoctor).Error
- return
- }
- func GetOfficEnviromentDetail(orgid int64,id int64)(offenvironment []models.SgjPatientEnviroimages,err error) {
- err = service.PatientReadDB().Model(&offenvironment).Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, id, 1).Order("sort").Find(&offenvironment).Error
- return offenvironment,err
- }
-
- func AddNavigation(navigation *models.SgjPatientNavigation)error {
- err := service.PatientWriteDB().Create(&navigation).Error
- return err
- }
-
- func GetNavigationList(orgid int64)(navigation []*models.SgjPatientNavigation,err error) {
- err = service.PatientReadDB().Model(&navigation).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&navigation).Error
- return
- }
-
- func AddShareInfo(share *models.SgjPatientShare) error {
- err := service.PatientWriteDB().Create(&share).Error
-
- return err
- }
-
- func GetShareInfo(orgid int64)(models.SgjPatientShare,error) {
- share := models.SgjPatientShare{}
- err := service.PatientReadDB().Model(&share).Where("user_org_id = ? AND status = ?", orgid, 1).Last(&share).Error
- return share,err
- }
-
- func DeleteNavitionById(orgID int64,id int64)(error) {
- err := service.PatientWriteDB().Model(models.SgjPatientNavigation{}).Where("user_org_id = ? AND id = ?", orgID, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func AddConnecWay(connectway *models.SgjPatientConnectway) error {
- err := service.PatientWriteDB().Create(&connectway).Error
- return err
- }
-
- func AddOrdModel(ordmodel *models.SgjPatientOrdmodel)error {
- err := service.PatientWriteDB().Create(ºodel).Error
- return err
- }
- func AddPatientOrdModel(ordmodel *models.PatientOrdmodel) error {
- err := service.PatientWriteDB().Create(ºodel).Error
- return err
- }
-
- func AddHosAddress(hosaddress *models.SgjPatientHosaddress) error {
-
- err := service.PatientWriteDB().Create(&hosaddress).Error
- return err
- }
-
- func QueryOrdeModelByID(orgid int64)(models.SgjPatientOrdmodel,error) {
- ordmodel := models.SgjPatientOrdmodel{}
- err := service.PatientReadDB().Where("user_org_id = ? AND status = ? ", orgid, 1).Last(ºodel).Error
- return ordmodel,err
- }
-
- func UpdateConrotaions(orgid int64,ids[] int64,conrotation models.SgjPatientConrotation)(err error) {
- if(len(ids)==1){
- err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id = ? and user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "mtime": time.Now().Unix()}).Error
- }else {
- err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id IN(?) and user_org_id = ?", ids, orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "mtime": time.Now().Unix()}).Error
- }
- return
- }
-
-
- func DeleteModle(orgid int64,id int64)(error) {
- err := service.PatientWriteDB().Model(models.SgjPatientOrdmodel{}).Where("user_org_id = ? AND id = ?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func DeleteModleByModeID(orgid int64,mid int64)(error) {
- err := service.PatientWriteDB().Model(models.SgjPatientConnectway{}).Where("user_org_id = ? AND mode_id = ?", orgid, mid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetOrederModel(orgid int64)(model []*models.SgjPatientOrdmodel,err error) {
- db := service.PatientReadDB().Table("sgj_patient_ordmodel as o").Where("o.status = ?", 1)
- con := service.PatientReadDB().Table("sgj_patient_conrotation as s")
- if(orgid > 0){
- db = db.Where("user_org_id = ?", orgid)
- }
- err = db.Preload("Hosaddress").Preload("Connectway").Preload("Worktime").Preload("Rideway").Preload("Oldration").Preload("Conrotation", func(db *gorm.DB) *gorm.DB{
- return con.Select("s.id,s.images,s.sort,s.piclink,s.linkaddress,s.user_org_id,s.status,s.ctime,s.mtime,s.modeid,s.img_show,s.linkid").Order("sort")
- }).Select("o.id,o.title,o.sort,o.ctime,o.mtime,o.mode_type").Order("sort").Find(&model).Error
- fmt.Println("sql错误是什么",err)
- return
-
- }
-
- func AddRotationpic(conrotation models.SgjPatientConrotation) error {
- err := service.PatientWriteDB().Create(&conrotation).Error
- return err
- }
-
- func GetRotationImages(orgid int64)(conrotation []models.SgjPatientConrotation,err error) {
- err = service.PatientReadDB().Model(&conrotation).Where("user_org_id = ? AND status = ? AND img_show = ?", orgid, 1,1).Order("sort").Find(&conrotation).Error
- return conrotation,err
- }
-
- func AddrotationImage(oldrotation *models.SgjPatientOldrotation) error {
- err := service.PatientWriteDB().Create(&oldrotation).Error
- return err
- }
-
- func UpdateConrotation(orgid int64,ids[] int64,conrotation models.SgjPatientConrotation)(err error) {
- if(len(ids)==1){
- err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id = ? AND user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "img_show": 0, "mtime": time.Now().Unix()}).Error
- }else {
- err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id IN(?) and user_org_id = ?", ids, orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "img_show": 0, "mtime": time.Now().Unix()}).Error
- }
- return
- }
-
-
-
- func AddImageslink(editpiclink *models.SgjPatientEditpiclink) error {
- err := service.PatientWriteDB().Create(&editpiclink).Error
- return err
- }
- func GetEnImages(orgid int64)(enviroimages []models.SgjPatientEnviroimages,err error) {
- err = service.PatientReadDB().Model(&enviroimages).Where("user_org_id = ? AND status = ? AND imgshow = ? ", orgid,1,1).Order("sort").Find(&enviroimages).Error
- return enviroimages,err
- }
-
- func UpdateImages(orgid int64,ids [] int64,enviroimages models.SgjPatientEnviroimages)(err error) {
- if(len(ids)==1){
- 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
- }else {
- 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
- }
- return
- }
-
- func GetEditEnvirimagesById(orgid int64,id int64)(models.SgjPatientEnviroimages,error) {
- enviroimages := models.SgjPatientEnviroimages{}
- err := service.PatientReadDB().Model(&enviroimages).Where("user_org_id = ? AND id =? AND status = ?", orgid, id, 1).Find(&enviroimages).Error
- return enviroimages,err
- }
-
- func UpdateEnviroimages(id int64,orgid int64,enviroimages models.SgjPatientEnviroimages)( err error) {
- err = service.PatientReadDB().Model(&enviroimages).Where("id = ? AND user_org_id = ? AND status =?", id, orgid, 1).Update(map[string]interface{}{"enviroimages": enviroimages.Enviroimages, "sort": enviroimages.Sort, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetEditImages(orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error) {
- err = service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND status = ? AND img_show = ?",orgid,1,1).Order("sort").Find(&editpiclink).Error
- return editpiclink,err
- }
-
- func AddMagicNavi(editmargin *models.SgjPatientEditmargin) error {
- err := service.PatientWriteDB().Create(&editmargin).Error
- return err
- }
-
- func GetMagicImages(orgid int64)( editmargin []models.SgjPatientEditmargin,err error) {
- err = service.PatientReadDB().Model(&editmargin).Where("user_org_id = ? AND status = ? AND img_show = ?", orgid, 1,1).Find(&editmargin).Error
- return editmargin,err
- }
-
- func AddMarginChart(macnavigation *models.SgjPatientMacnavigation) error {
-
- err := service.PatientWriteDB().Create(&macnavigation).Error
- return err
- }
-
- func DeleteRotations(id int64, orgid int64)(error) {
- 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
- return err
- }
-
- func UpdateRotationImages(orgid int64,id int64)(models.SgjPatientEditpiclink,error){
- editpiclink := models.SgjPatientEditpiclink{}
- err := service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&editpiclink).Error
- return editpiclink,err
- }
-
- func SaveRotationImages(id int64,orgid int64,editpiclink models.SgjPatientEditpiclink)error {
- err := service.PatientWriteDB().Model(editpiclink).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"images": editpiclink.Images, "sort": editpiclink.Sort, "piclink": editpiclink.Piclink, "linkaddress": editpiclink.Linkaddress, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func EditNavigation(orgid int64,id int64)(models.SgjPatientNavigation,error){
- navigation := models.SgjPatientNavigation{}
- err := service.PatientReadDB().Model(&navigation).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&navigation).Error
- return navigation,err
- }
-
- func UpdateNavtion(id int64,orgid int64,navigation models.SgjPatientNavigation) error {
- err := service.PatientWriteDB().Model(navigation).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"navtitle": navigation.Navtitle, "navimages": navigation.Navimages,"nonavimages":navigation.Nonavimages, "jumpset": navigation.Jumpset, "navaddress": navigation.Navaddress,"linkid":navigation.Linkid,"linktype":navigation.Linktype, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func DeleteImages(id int64,orgid int64)(error) {
- 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
- return err
- }
- func DeleteSingleImages(id int64,orgid int64) (error) {
- 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
- return err
- }
-
- func AddActivity(addactivity *models.SgjPatientAddactivity) error {
-
- err := service.PatientWriteDB().Create(&addactivity).Error
- return err
- }
-
- func QueryActivity(id int64,orgid int64)(models.SgjPatientAddactivity,error) {
- addactivity := models.SgjPatientAddactivity{}
- err := service.PatientReadDB().Model(addactivity).Where("modeid = ? AND user_org_id = ?", id, orgid).Find(&addactivity).Error
- return addactivity,err
- }
-
- func UpdateActivit(id int64,orgid int64,addactivity models.SgjPatientAddactivity) error {
-
- err := service.PatientWriteDB().Model(addactivity).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": addactivity.Title, "sort": addactivity.Sort, "number": addactivity.Number, "mtime":time.Now().Unix()}).Error
- return err
- }
-
- func DeleteMargin(id int64,orgid int64)(error) {
- err := service.PatientWriteDB().Model(models.SgjPatientEditmargin{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetEditRotationImages(id int64,orgid int64)(models.SgjPatientOrdmodel,error) {
- oldrotation := models.SgjPatientOrdmodel{}
- err := service.PatientReadDB().Model(oldrotation).Where("id = ? AND user_org_id = ?", id, orgid).Find(&oldrotation).Error
- return oldrotation,err
- }
-
- func GetEditConrotion(id int64,orgid int64)(conrotation []models.SgjPatientConrotation, err error) {
- err = service.PatientReadDB().Model(conrotation).Where("modeid = ? AND user_org_id = ?", id, orgid).Order("sort").Find(&conrotation).Error
- return conrotation,err
- }
-
- func EditVisibleById(id int64,orgid int64)(models.SgjPatientConrotation,error) {
- conrotation := models.SgjPatientConrotation{}
- err := service.PatientReadDB().Model(conrotation).Where("id = ? AND user_org_id = ?", id, orgid).Find(&conrotation).Error
- return conrotation,err
- }
-
- func UpdatedConAddress(id int64,orgid int64)(models.SgjPatientConlinkaddress,error) {
- conlinkaddress := models.SgjPatientConlinkaddress{}
- err := service.PatientWriteDB().Model(&conlinkaddress).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"defineaddress": ""}).Error
- return conlinkaddress,err
- }
-
- func UpdateEditpic(id int64,orgid int64,conrotation models.SgjPatientConrotation) error {
- err := service.PatientWriteDB().Model(conrotation).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"images": conrotation.Images, "sort": conrotation.Sort, "piclink": conrotation.Piclink, "linkaddress": conrotation.Linkaddress,"linkid":conrotation.Linkid}).Error
- return err
- }
-
- func GetPatientConrotationLast(orgid int64)( models.SgjPatientConrotation,error){
- conrotation := models.SgjPatientConrotation{}
- err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&conrotation).Error
- return conrotation,err
- }
- func UpdateConLinkAddress(orgid int64,conid int64,conlinkaddress models.SgjPatientConlinkaddress) error {
- err := service.PatientWriteDB().Model(&conlinkaddress).Where("user_org_id = ? and status = ? and con_id = ?", orgid, 1, conid).Update(map[string]interface{}{"mtime": time.Now().Unix()}).Error
- return err
- }
-
- func AddEditpic(conrotation *models.SgjPatientConrotation)(error) {
-
- err := service.PatientWriteDB().Create(&conrotation).Error
- return err
- }
-
- func QueryOldrotion(id int64,orgid int64)(models.SgjPatientOldrotation,error) {
- conrotation := models.SgjPatientOldrotation{}
- err := service.PatientReadDB().Model(conrotation).Where("id = ? AND user_org_id = ? ", id, orgid).Order("sort").Find(&conrotation).Error
- return conrotation,err
- }
-
- func QueryConRotation(mid int64,orgid int64)(conrotation []models.SgjPatientConrotation,err error) {
- err = service.PatientReadDB().Model(conrotation).Where("modeid = ? AND user_org_id = ? AND status = ?", mid, orgid, 1).Order("sort").Find(&conrotation).Error
- return conrotation,err
- }
-
-
-
- func UpdateConrotaionById(id int64,orgid int64,oldrotation models.SgjPatientOldrotation)(error) {
-
- 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
- return err
- }
-
- func GetPatientRotaion(id int64,orgid int64)(models.SgjPatientRotation,error) {
- rotation := models.SgjPatientRotation{}
- err := service.PatientReadDB().Model(&rotation).Where("model_id = ? AND user_org_id = ?", id, orgid).Order("sort").Find(&rotation).Error
- return rotation,err
- }
-
- func GetPatientModel(id int64,orgid int64)(models.SgjPatientModel,error) {
- model := models.SgjPatientModel{}
- err := service.PatientReadDB().Model(&model).Where("id = ? AND user_org_id = ?", id, orgid).Order("sort").Find(&model).Error
- return model,err
- }
-
- func GetPatientRotationById(id int64,orgid int64)(models.SgjPatientRotation,error) {
- rotation := models.SgjPatientRotation{}
- err := service.PatientReadDB().Model(&rotation).Where("id = ? AND user_org_id =?", id, orgid).Find(&rotation).Error
- return rotation,err
- }
-
- func QueryEditpiclink(id int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error) {
- err = service.PatientReadDB().Model(editpiclink).Where("modeid = ? AND user_org_id = ? AND status = ?", id, orgid,1).Order("sort").Find(&editpiclink).Error
- return editpiclink,err
- }
-
-
-
- func GetEditSingleVisible(id int64,orgid int64)(models.SgjPatientEditpiclink,error) {
- editpiclink := models.SgjPatientEditpiclink{}
- err := service.PatientReadDB().Model(&editpiclink).Where("id = ? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
- return editpiclink,err
- }
-
- func GetQueryEditpiclink(modeid int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error) {
- err = service.PatientReadDB().Model(&editpiclink).Where("modeid=? AND user_org_id = ? AND status = ?", modeid, orgid,1).Order("sort").Find(&editpiclink).Error
- return editpiclink,err
-
- }
-
- func UpdatedPatientLinkAddress(id int64,orgid int64)(models.SgjPatientLinkaddress,error) {
- linkaddress := models.SgjPatientLinkaddress{}
- err := service.PatientReadDB().Model(&linkaddress).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"defineaddress":"","status": 0}).Error
- return linkaddress,err
- }
-
- func UpdateEditPatPicLink(id int64,orgid int64,editpiclink models.SgjPatientEditpiclink)(error) {
-
- err := service.PatientWriteDB().Model(editpiclink).Where("id = ? AND user_org_id =? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"images": editpiclink.Images, "sort": editpiclink.Sort, "piclink": editpiclink.Piclink, "linkaddress": editpiclink.Linkaddress,"linkid":editpiclink.Linkid, "mtime": time.Now().Unix()}).Error
- return err
- }
-
-
- func UpdateEditPicLinkTwo(moid int64,orgid int64,)(error) {
- err := service.PatientWriteDB().Model(models.SgjPatientEditpiclink{}).Where("modeid = ? AND user_org_id = ? AND status = ?", moid, orgid, 1).Update(map[string]interface{}{"img_show": 0}).Error
- return err
- }
-
- func GetPatientRotations(id int64,orgid int64)(models.SgjPatientRotation,error) {
- rotation := models.SgjPatientRotation{}
- err := service.PatientReadDB().Model(&rotation).Where("id = ? AND user_org_id = ?", id, orgid).Find(&rotation).Error
- return rotation,err
- }
-
- func UpdateRotationByid(id int64,orgid int64,rotation models.SgjPatientRotation)(error) {
- err := service.PatientWriteDB().Model(rotation).Where("id=? AND user_org_id = ? AND status =?", id, orgid, 1).Update(map[string]interface{}{"title": rotation.Title, "sort": rotation.Sort, "rotation_images": rotation.RotationImages, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func UpdateModelById(id int64,orgid int64,model models.SgjPatientModel) error {
- err := service.PatientWriteDB().Model(model).Where("id=? AND user_org_id =? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": model.Title, "sort": model.Sort, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func QuerEditMarginById(id int64,orgid int64)(models.SgjPatientEditmargin,error) {
- editmargin := models.SgjPatientEditmargin{}
- err := service.PatientReadDB().Model(editmargin).Where("id = ? AND user_org_id =? AND status = ?", id, orgid, 1).Find(&editmargin).Error
- return editmargin,err
- }
-
- func UpdateMarginById(id int64,orgid int64,editmargin models.SgjPatientEditmargin) error {
-
- err := service.PatientWriteDB().Model(editmargin).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"margintitle": editmargin.Margtitle, "margimage": editmargin.Margimage, "marginaddress": editmargin.Marginaddress}).Error
-
- return err
- }
-
- func GetActivitiesById(orgid int64)(models.SgjPatientAddactivity,error) {
- addactivity := models.SgjPatientAddactivity{}
- err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&addactivity).Error
- fmt.Println("查询活动列表错误",err)
- return addactivity,err
- }
-
- func GetAllActivities(orgid int64,limit int64)(activity []models.Activity,err error) {
- err = service.PatientReadDB().Model(activity).Where("user_org_id = ? AND status = ?", orgid, 1).Limit(limit).Find(&activity).Error
- return
- }
-
- func GetArticleType(orgid int64)(category []models.ArticleCategory,err error) {
- err = service.PatientReadDB().Model(category).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&category).Error
- return category,err
- }
-
- func AddActiclelist(articlelist *models.SgjPatientArticlelist)(error) {
-
- err := service.PatientWriteDB().Model(articlelist).Create(&articlelist).Error
- return err
- }
-
- func GetArticlelist(orgid int64)(models.SgjPatientArticlelist,error) {
- articlelist := models.SgjPatientArticlelist{}
- err := service.PatientReadDB().Where("user_org_id = ? AND Status = ?", orgid, 1).Last(&articlelist).Error
- fmt.Println("错误",err)
- return articlelist,err
- }
-
- func GetAllArticles(orgid int64,limit int64)(articlelist []models.Articles,err error) {
- err = service.PatientReadDB().Model(articlelist).Where("user_org_id = ? AND Status = ? AND article_status = ?", orgid, 1,1).Order("ctime desc").Limit(limit).Find(&articlelist).Error
- return
- }
-
-
-
- func GetArticlelistById(modeid int64,orgID int64)(models.SgjPatientArticlelist,error) {
- articlelist := models.SgjPatientArticlelist{}
- err := service.PatientReadDB().Model(articlelist).Where("modeid = ? AND user_org_id = ? AND Status = ?", modeid, orgID, 1).Find(&articlelist).Error
- return articlelist,err
- }
-
- func GetAllActivitiById(modeid int64,orgID int64)(models.SgjPatientAddactivity,error) {
- addactivity := models.SgjPatientAddactivity{}
- err := service.PatientReadDB().Model(addactivity).Where("modeid = ? AND user_org_id = ? AND Status = ?", modeid, orgID, 1).Find(&addactivity).Error
- return addactivity,err
- }
-
- func UpdateArticeDetail(id int64,orgid int64,articlelist models.SgjPatientArticlelist)error {
-
- err := service.PatientWriteDB().Model(articlelist).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": articlelist.Title, "sort": articlelist.Sort, "number": articlelist.Number, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetMacImagesByModeid(modeid int64,orgid int64)(macnavigation []models.SgjPatientEditmargin,err error) {
-
- err = service.PatientReadDB().Model(macnavigation).Where("modeid = ? AND user_org_id = ? AND status = ?", modeid, orgid, 1).Find(&macnavigation).Error
- return macnavigation,err
- }
-
- func GetModelById(id int64 ,orgid int64)(models.SgjPatientModel,error) {
- model := models.SgjPatientModel{}
- err := service.PatientReadDB().Model(model).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&model).Error
- return model,err
- }
-
- func GetOffENvironmentById(id int64,orgid int64)(models.SgjPatientOffenvironment,error) {
- offenvironment := models.SgjPatientOffenvironment{}
- err := service.PatientReadDB().Model(offenvironment).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&offenvironment).Error
- return offenvironment,err
- }
-
- func AddOfficeThree(enviroimages *models.SgjPatientEnviroimages)(error) {
- err := service.PatientWriteDB().Model(&enviroimages).Create(&enviroimages).Error
- return err
- }
-
- func GetQueryImages(mid int64,orgid int64)(enviroimages []models.SgjPatientEnviroimages,err error) {
-
- err = service.PatientReadDB().Model(enviroimages).Where("modeid = ? AND user_org_id = ? AND status = ?", mid, orgid, 1).Order("sort").Find(&enviroimages).Error
- return enviroimages,err
- }
-
- func GetOfficeTwoVisible(orgid int64,id int64)(models.SgjPatientEnviroimages,error) {
- enviroimages := models.SgjPatientEnviroimages{}
- err := service.PatientReadDB().Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&enviroimages).Error
- return enviroimages,err
- }
-
- func UpdateOfficeTwo(orgid int64,id int64,enviroimages models.SgjPatientEnviroimages) error {
- err := service.PatientWriteDB().Model(&enviroimages).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Update(map[string]interface{}{"enviroimages": enviroimages.Enviroimages, "sort": enviroimages.Sort, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetQueryEnviroimage(orgid int64,mid int64)(enviroimages []models.SgjPatientEnviroimages,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, mid,1).Find(&enviroimages).Error
- return enviroimages,err
- }
-
- func DeleteOfficeById(id int64,orgid int64)(error) {
- 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
- return err
- }
-
- func GetArticleById(classid int64,orgid int64)(articlelist []models.Articles,err error) {
-
- err = service.PatientReadDB().Model(models.Articles{}).Where("class_id = ? AND user_org_id = ? AND status = ?", classid, orgid,1).Find(&articlelist).Error
- return
- }
-
- func GetAllActivity(orgid int64)(activtity []models.Activity,err error) {
-
- err = service.PatientReadDB().Model(models.Activity{}).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&activtity).Error
- return
- }
-
- //func AddLinkAddress(linkaddress *models.SgjPatientLinkaddress) error {
- // err := service.PatientWriteDB().Create(&linkaddress).Error
- // return err
- //}
-
- func AddLinkAddress(linkaddress *models.SgjPatientLinkaddress) error {
- err := service.PatientWriteDB().Create(&linkaddress).Error
- return err
- }
-
- func GetLinkAddress(orgid int64,id int64)(models.SgjPatientLinkaddress,error) {
-
- linkaddress := models.SgjPatientLinkaddress{}
- err := service.PatientReadDB().Model(&linkaddress).Where("user_org_id = ? AND id = ? AND status = ? ", orgid,id, 1).Find(&linkaddress).Error
- return linkaddress,err
- }
-
- func QuerylinkAddress(id int64,orgid int64)(models.SgjPatientLinkaddress,error) {
- linkaddress := models.SgjPatientLinkaddress{}
- err := service.PatientReadDB().Model(&linkaddress).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&linkaddress).Error
- return linkaddress,err
- }
-
- func GetAllConnecway(orgid int64)(connect []models.SgjPatientConnection,err error) {
- err = service.PatientReadDB().Model(&connect).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&connect).Error
- return
- }
-
- func GetConnecway(orgid int64,id int64)(models.SgjPatientOrdmodel,error) {
- ordmodel := models.SgjPatientOrdmodel{}
- err := service.PatientReadDB().Model(ºodel).Where("user_org_id = ? AND status = ? AND id = ?", orgid, 1,id).Find(ºodel).Error
- return ordmodel,err
- }
-
- func GetConnecwayById(orgid int64,id int64)(models.SgjPatientConnection,error) {
- connection := models.SgjPatientConnection{}
- err := service.PatientReadDB().Model(&connection).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&connection).Error
- return connection,err
- }
-
- func UpdateConnectway(id int64,orgid int64,connection models.SgjPatientConnection) error {
- err := service.PatientWriteDB().Model(&connection).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": connection.Title, "connecway": connection.Connecway, "content": connection.Content,"mtime":time.Now().Unix()}).Error
- return err
- }
-
- func AddConnectways(connection *models.SgjPatientConnection) error {
- err := service.PatientWriteDB().Create(&connection).Error
- return err
- }
-
- func UpdateConnectways(id int64,orgid int64,connectway models.SgjPatientConnectway) error {
- err := service.PatientWriteDB().Model(&connectway).Where("mode_id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": connectway.Title, "sort": connectway.Sort, "ctime": time.Now().Unix()}).Error
- return err
- }
-
- func GetHostpitalIntroduction(orgid int64,id int64)(models.SgjPatientOrdmodel,error) {
- ordmodel := models.SgjPatientOrdmodel{}
- err := service.PatientReadDB().Model(ºodel).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(ºodel).Error
- return ordmodel,err
- }
-
- func GetHostpitaAddress(orgid int64,moid int64)(models.SgjPatientHosaddress,error) {
- hosaddress := models.SgjPatientHosaddress{}
- err := service.PatientReadDB().Model(&hosaddress).Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, moid, 1).Find(&hosaddress).Error
- return hosaddress,err
- }
-
- func UpdateHosAddress(id int64,orgid int64,hosaddress models.SgjPatientHosaddress)error {
- err := service.PatientWriteDB().Model(&hosaddress).Where("modeid = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": hosaddress.Title, "sort": hosaddress.Sort, "address": hosaddress.Address, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func AddConlinkaddress (conlinkaddress *models.SgjPatientConlinkaddress) error {
- err := service.PatientWriteDB().Create(&conlinkaddress).Error
- return err
- }
-
- func GetConLinkAddressById(orgid int64)(models.SgjPatientConlinkaddress,error) {
- conlinkaddress := models.SgjPatientConlinkaddress{}
- err := service.PatientReadDB().Model(&conlinkaddress).Where("user_org_id = ? AND status = ?", orgid, 1).Last(&conlinkaddress).Error
- return conlinkaddress,err
- }
-
- func GetLinkAddressDetail(orgid int64,id int64)(models.SgjPatientConlinkaddress,error) {
- conlinkaddress := models.SgjPatientConlinkaddress{}
- err := service.PatientReadDB().Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&conlinkaddress).Error
- return conlinkaddress,err
- }
-
- //func UpdatePicFformThree(orgid int64,id int64,conlinkaddress models.SgjPatientConlinkaddress) error {
- //
- // err := service.PatientReadDB().Model(&conlinkaddress).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Update(map[string]interface{}{"linktype": conlinkaddress.Linktype, "linktypetwo": conlinkaddress.Linktypetwo, "linktypethree": conlinkaddress.Linktypethree, "linktypefour": conlinkaddress.Linktypefour,"linkaddress":conlinkaddress.Linkaddress,"defineaddress":conlinkaddress.Defineaddress}).Error
- // return err
- //}
-
- func GetEnImagesTwo(orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error) {
- err = service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&editpiclink).Error
- return editpiclink,err
- }
-
- func GetEnImagesThree(orgid int64)(conrotation []models.SgjPatientConrotation,err error) {
- err = service.PatientReadDB().Model(&conrotation).Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&conrotation).Error
- return conrotation,err
- }
-
- func AddMagiclinkData(magiclink *models.SgjPatientMagiclink)error {
-
- err := service.PatientWriteDB().Create(&magiclink).Error
- return err
- }
-
- func GetPatienModelByModelId(id int64,orgid int64)(models.PatientModel,error) {
- model := models.PatientModel{}
- err := service.PatientReadDB().Model(&model).Where("id=? AND user_org_id = ?", id, orgid).Find(&model).Error
- return model,err
- }
-
- func GetMacLinkAddressTwo (orgid int64)(patientMagiclink []models.SgjPatientMagiclink,err error) {
- err = service.PatientReadDB().Model(&patientMagiclink).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&patientMagiclink).Error
- return patientMagiclink,err
- }
-
- func UpdateEditMagin(orgid int64,ids[] int64,editmargin models.SgjPatientEditmargin)(err error) {
- if(len(ids) == 1){
- err = service.PatientWriteDB().Model(&models.SgjPatientEditmargin{}).Where("id= ? AND user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": editmargin.Modeid, "status": 1, "img_show": 0, "mtime": time.Now().Unix()}).Error
- }else {
- err = service.PatientWriteDB().Model(&models.SgjPatientEditmargin{}).Where("id IN(?) and user_org_id = ? ", ids, orgid).Update(map[string]interface{}{"modeid": editmargin.Modeid, "status": 1,"img_show":0, "mtime": time.Now().Unix()}).Error
- }
- return
- }
-
- func AddMacgicform(editmargin *models.SgjPatientEditmargin)error {
- err := service.PatientWriteDB().Create(&editmargin).Error
- return err
- }
-
- func GetMacImagesDetail(orgid int64,modeid int64)(editmargin []models.SgjPatientEditmargin,err error) {
- err = service.PatientReadDB().Model(&editmargin).Where("user_org_id = ? AND status = ? AND modeid = ?", orgid, 1, modeid).Find(&editmargin).Error
- return editmargin,err
- }
-
- func DeletMacImagesDetail(id int64,orgid int64)(error) {
- err := service.PatientWriteDB().Model(models.SgjPatientEditmargin{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0,"modeid":0, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetEditMacImageDetailById(orgid int64,id int64)(models.SgjPatientEditmargin,error) {
- editmargin := models.SgjPatientEditmargin{}
- err := service.PatientReadDB().Where("user_org_id = ? AND id = ?", orgid, id).Find(&editmargin).Error
- return editmargin,err
- }
-
- func UpdateEditMacFormById(id int64,orgid int64,editmargin models.SgjPatientEditmargin)(err error) {
- err = service.PatientWriteDB().Model(&models.SgjPatientEditmargin{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"margtitle": editmargin.Margtitle, "margimage": editmargin.Margimage, "jumpset": editmargin.Jumpset, "marginaddress": editmargin.Marginaddress, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetLikeMacAddressById(orgid int64,id int64)(models.SgjPatientMagiclink,error) {
- magiclink := models.SgjPatientMagiclink{}
- err := service.PatientReadDB().Where("user_org_id = ? AND id = ?", orgid, id).Find(&magiclink).Error
- return magiclink,err
- }
-
- func GetAllArticeList(orgid int64)(articles []models.Articles,err error) {
- err = service.PatientReadDB().Model(&articles).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&articles).Error
- return articles,err
- }
-
- func AddActicles(articles *models.Articles)error {
- err:= service.PatientWriteDB().Create(&articles).Error
- return err
- }
-
- func UpdateLinkAddress(id int64,orgid int64,magiclink models.SgjPatientMagiclink)error {
-
- err := service.PatientWriteDB().Model(&models.SgjPatientMagiclink{}).Where("id = ? AND user_org_id = ? ", id, orgid).Update(map[string]interface{}{"linktype": magiclink.Linktype, "instationlink": magiclink.Instationlink, "phone": magiclink.Phone, "outstationlink": magiclink.Outstationlink, "linkaddress": magiclink.Linkaddress, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetUpdateLinkAddress(id int64,orgid int64)(models.SgjPatientMagiclink,error) {
- editpiclink := models.SgjPatientMagiclink{}
- err := service.PatientReadDB().Model(&editpiclink).Where("id = ? AND user_org_id = ?",id,orgid).Find(&editpiclink).Error
- return editpiclink,err
- }
-
- func GetMacLinkAddress(orgid int64)(magiclink []models.SgjPatientMagiclink,err error) {
- err = service.PatientReadDB().Model(&magiclink).Where("user_org_id = ? AND status =?", orgid, 1).Find(&magiclink).Error
- return magiclink,err
- }
-
- func AddMacLinkAddress(magiclink *models.SgjPatientMagiclink)error {
- err := service.PatientWriteDB().Create(&magiclink).Error
- return err
- }
-
- func GetMacLinkAddressByLastData(orgid int64)(models.SgjPatientMagiclink,error) {
- magiclink := models.SgjPatientMagiclink{}
- err := service.PatientReadDB().Model(&magiclink).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&magiclink).Error
- return magiclink,err
- }
-
- func AddNavitaionLinkAddress(navgationlink *models.PatientNavgationlink)error {
- err := service.PatientWriteDB().Create(&navgationlink).Error
- return err
- }
-
- func GetPatientLinkAddress(id int64,orgid int64)(models.SgjPatientLinkaddress,error) {
- linkaddress := models.SgjPatientLinkaddress{}
- err := service.PatientReadDB().Where(" id = ? AND user_org_id = ?", id, orgid).Find(&linkaddress).Error
- return linkaddress,err
- }
-
- func GetCountImages(orgid int64)(edipiclink []models.SgjPatientEditpiclink,total int64,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND img_show = ? AND status = ?", orgid,1,1).Find(&edipiclink).Count(&total).Error
- return edipiclink,total,err
- }
-
- func GetDeleteImages(orgid int64,modeid int64)(edipiclink []models.SgjPatientEditpiclink,total int64,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, modeid, 1).Find(&edipiclink).Count(&total).Error
- return edipiclink,total,err
- }
-
- func GetTotalCount(orgid int64)(conrotation []models.SgjPatientConrotation,total int64,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND img_show = ? AND status = ?", orgid, 1, 1).Find(&conrotation).Count(&total).Error
- return conrotation,total,err
- }
-
- func GetCountPicImages(orgid int64,modeid int64)(edipiclink []models.SgjPatientEditpiclink,total int64,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, modeid, 1).Find(&edipiclink).Count(&total).Error
- return edipiclink,total,err
- }
-
- func GetPicImages(orgid int64,modeid int64)(editpiclink []models.SgjPatientEditpiclink,err error) {
- err = service.PatientReadDB().Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, modeid, 1).Order("sort").Find(&editpiclink).Error
- return editpiclink,err
- }
-
- func QueryEditpiclinkCount(mid int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,total int64,err error) {
- err= service.PatientWriteDB().Where("modeid = ? AND user_org_id =? AND status = ?", mid, orgid, 1).Find(&editpiclink).Count(&total).Error
- return editpiclink,total,err
- }
-
- func AddNavgationlink(navgationlink *models.PatientNavgationlink)error {
- err := service.PatientWriteDB().Create(&navgationlink).Error
- return err
- }
-
- func GetNavgationlinkLastData(orgid int64)(models.PatientNavgationlink,error) {
- navgationlink := models.PatientNavgationlink{}
- err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&navgationlink).Error
- return navgationlink,err
- }
-
- func GetNavgationlinkAddressBylinkId(orgid int64,linkid int64)(models.PatientNavgationlink,error) {
- navgationlink := models.PatientNavgationlink{}
- err := service.PatientReadDB().Where("user_org_id = ? AND id = ?", orgid, linkid).Find(&navgationlink).Error
- return navgationlink,err
- }
-
- func GetNavgationLinkById(id int64,orgid int64)(*models.PatientNavgationlink,error) {
- var pat models.PatientNavgationlink
- var err error
- err = service.PatientReadDB().Model(&models.PatientNavgationlink{}).Where(" id = ? AND user_org_id = ?", id, orgid).Find(&pat).Error
-
- if err == gorm.ErrRecordNotFound{
- return nil,err
-
- }
- if err != nil {
- return nil, err
- }
- return &pat,nil
-
- }
-
- func AddNavigationlink(navgationlink *models.PatientNavgationlink) error {
-
- err := service.PatientWriteDB().Create(&navgationlink).Error
- return err
- }
-
- func UpdateditnavigationLink(id int64,orgid int64,navgationlink models.PatientNavgationlink) error {
-
- err := service.PatientWriteDB().Model(&navgationlink).Where("id = ? AND user_org_id =?", id, orgid).Update(map[string]interface{}{"linktype": navgationlink.Linktype, "navitionlinktype": navgationlink.Navitionlinktype, "phone": navgationlink.Phone, "outstationlink":
- navgationlink.Outstationlink, "linkaddress": navgationlink.Linkaddress, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func AddEditDoctor(editdoctor *models.SgjPatientEditdoctor) error {
-
- err := service.PatientWriteDB().Create(&editdoctor).Error
- return err
- }
-
- func QuerEditDoctorInfo(mid int64,orgid int64)(editdoctor []models.SgjPatientEditdoctor,err error) {
- err = service.PatientWriteDB().Model(&editdoctor).Where("modleid = ? AND user_org_id = ? AND status = ?", mid, orgid, 1).Find(&editdoctor).Error
-
- return editdoctor,err
- }
-
- func GetModel(orgid int64)(*models.SgjPatientModel,error) {
- var model models.SgjPatientModel
- var err error
- err = service.PatientReadDB().Model(&models.SgjPatientModel{}).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&model).Error
- if err == gorm.ErrRecordNotFound{
- return nil,err
- }
- if err != nil {
- return nil, err
- }
- return &model, nil
- }
-
- func AddPatientModelTwo(model *models.SgjPatientModel)error {
- err := service.PatientWriteDB().Create(&model).Error
- return err
- }
-
- func GetQueryModelByLastData(orgid int64)(models.SgjPatientModel,error){
- model := models.SgjPatientModel{}
- err := service.PatientReadDB().Model(&model).Where("user_org_id = ? AND status = ?", orgid, 1).Last(&model).Error
- return model,err
- }
-
- func AddPatientEdit(editpiclink *models.SgjPatientEditpiclink)error {
- err := service.PatientWriteDB().Create(&editpiclink).Error
- return err
- }
-
- func AddHospital(hospital *models.SgjPatientHospital) error {
- err := service.PatientWriteDB().Create(&hospital).Error
- return err
- }
-
- func AddEditMargin(editmargin *models.SgjPatientEditmargin) error {
- err := service.PatientWriteDB().Create(&editmargin).Error
- return err
- }
-
- func AddPatientOffices(offices *models.SgjPatientOffices)error {
- err := service.PatientWriteDB().Create(&offices).Error
- return err
- }
-
- func GetDefaultNavigation(orgid int64)(navigation []models.SgjPatientNavigation,err error) {
-
- err = service.PatientReadDB().Model(navigation).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&navigation).Error
-
- return navigation,err
- }
-
- func AddDefaultData(navigation *models.SgjPatientNavigation) error {
- err := service.PatientWriteDB().Create(&navigation).Error
- return err
- }
-
- func GetAllModelTitle(orgid int64)(models []models.SgjPatientModel,err error) {
-
- err = service.PatientReadDB().Model(models).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&models).Error
- return models,err
-
- }
-
- func GetDoctorDetailInfo(id int64,orgid int64)(models.SgjPatientEditdoctor,error) {
- editdoctor := models.SgjPatientEditdoctor{}
- err := service.PatientReadDB().Model(&editdoctor).Where("id=? AND user_org_id = ?", id, orgid).Find(&editdoctor).Error
- return editdoctor,err
- }
-
- func GetArticleListDetail(id int64,orgid int64)(models.Articles,error) {
- articles := models.Articles{}
- err := service.PatientReadDB().Model(&articles).Where("id=? AND user_org_id =?", id, orgid).Find(&articles).Error
- return articles,err
- }
-
- func GetActivitiesListDetail(id int64,orgid int64)(models.Activity,error) {
- activity := models.Activity{}
- err := service.PatientReadDB().Model(&activity).Where("id=? AND user_org_id = ?", id, orgid).Find(&activity).Error
- return activity,err
- }
-
- func GetLinkAddressByLinkId(orgid int64,linkid int64)(models.SgjPatientLinkaddress,error) {
- linkaddress := models.SgjPatientLinkaddress{}
- err := service.PatientReadDB().Model(&linkaddress).Where("user_org_id = ? AND id = ? AND status = ?", orgid, linkid, 1).Find(&linkaddress).Error
- return linkaddress,err
- }
-
- func GetMagicLinkAddressById(orgid int64,linkid int64)(models.SgjPatientMagiclink,error) {
- magiclink := models.SgjPatientMagiclink{}
- err := service.PatientReadDB().Model(&magiclink).Where("user_org_id = ? AND id = ? AND status = ?", orgid, linkid, 1).Find(&magiclink).Error
- return magiclink,err
- }
-
- func GetMagicClickByLinkID(orgid int64,linkid int64)(models.SgjPatientMagiclink,error) {
- magiclink := models.SgjPatientMagiclink{}
- err := service.PatientReadDB().Model(&magiclink).Where("user_org_id = ? AND id = ? AND status = ?", orgid, linkid, 1).Find(&magiclink).Error
- return magiclink,err
- }
-
- func GetEditRotationEmages(id int64,orgid int64)(models.SgjPatientConrotation,error) {
- conrotation := models.SgjPatientConrotation{}
- err := service.PatientReadDB().Where("id = ? AND user_org_id = ?", id, orgid).Find(&conrotation).Error
- return conrotation,err
- }
-
- func GetOutRotationLink(orgid int64,linkid int64)(models.SgjPatientConlinkaddress,error) {
- conlinkaddress := models.SgjPatientConlinkaddress{}
- err := service.PatientReadDB().Where("user_org_id = ? AND id = ?", orgid, linkid).Find(&conlinkaddress).Error
- return conlinkaddress,err
- }
-
- func UpdatedConlinkAddress(id int64,orgid int64,conlinkaddress models.SgjPatientConlinkaddress) error {
-
- err := service.PatientReadDB().Model(&conlinkaddress).Where("id=? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"defineaddress": conlinkaddress.Defineaddress, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func AddConlinkAddress(conlinkaddress *models.SgjPatientConlinkaddress) error {
-
- err := service.PatientWriteDB().Create(&conlinkaddress).Error
- return err
- }
-
- func UpdatedConrotation(id int64,orgid int64,conrotation models.SgjPatientConrotation) error {
- err := service.PatientReadDB().Model(&conrotation).Where("id=? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"images": conrotation.Images, "sort": conrotation.Sort, "piclink": conrotation.Piclink, "linkaddress": conrotation.Linkaddress, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetRotationVisibleByLinkId(id int64,orgid int64)(models.SgjPatientLinkaddress,error) {
- conlinkaddress := models.SgjPatientLinkaddress{}
- err := service.PatientReadDB().Where("id = ? AND user_org_id = ?", id, orgid).Find(&conlinkaddress).Error
- return conlinkaddress,err
- }
-
- func UpdatedRotationVisble(id int64,orgid int64,linkaddress models.SgjPatientLinkaddress)error {
-
- err := service.PatientReadDB().Model(&linkaddress).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"defineaddress": linkaddress.Defineaddress, "mtime": time.Now().Unix()}).Error
- return err
- }
-
- func GetAritclesData(orgid int64)(articles []models.Articles,err error) {
-
- err = service.PatientReadDB().Model(&articles).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&articles).Error
-
- return articles,err
-
- }
-
- func GetArititys(orgid int64)(activity []models.Activity,err error) {
-
- err = service.PatientReadDB().Model(&activity).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&activity).Error
-
- return activity,err
- }
-
- func AddActivitys(activity *models.Activity) error {
-
- err := service.PatientReadDB().Create(&activity).Error
- return err
- }
-
- func GetContactUsModel(orgid int64)(oldmodels []models.PatientOrdmodel,err error) {
-
- err = service.PatientReadDB().Model(&oldmodels).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&oldmodels).Error
- return oldmodels,err
- }
-
- func GetPatientOrdModelByLastData(orgid int64)(models.PatientOrdmodel,error) {
-
- ordmodel := models.PatientOrdmodel{}
- err := service.PatientReadDB().Model(ºodel).Where("user_org_id = ? AND status = ?", orgid, 1).Last(ºodel).Error
- return ordmodel,err
- }
-
- func AddConRotation(conrotation *models.SgjPatientConrotation) error {
-
- err := service.PatientWriteDB().Create(&conrotation).Error
- return err
- }
|