123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912 |
- package site_service
-
- import (
- "SCRM/models"
- "SCRM/service"
- "fmt"
- "time"
- )
-
- 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 = ?", orgID, 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, "rideway": 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, "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 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)
- fmt.Println("db是什么?",db)
- if(orgid > 0){
- db = db.Where("user_org_id = ? ", orgid)
- }
- err = db.Preload("Hospitals").Preload("Offices").Preload("Doctors").Preload("OfficeEnviroment").
- Preload("Editdoctor").Preload("Rotation").Preload("Macnavigation").
- 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
- return
- }
-
- 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, "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, "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 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 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)(models.SgjPatientOffenvironment,error) {
- offenvironment := models.SgjPatientOffenvironment{}
- err := service.PatientReadDB().Model(&offenvironment).Where("user_org_id = ? AND modelid = ? 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 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)
- if(orgid > 0){
- db = db.Where("user_org_id = ?", orgid)
- }
- err = db.Preload("Hosaddress").Preload("Connectway").Preload("Worktime").Preload("Rideway").Preload("Oldration").
- 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).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 = ?", orgid, 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, "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, "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).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, "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, "jumpset": navigation.Jumpset, "navaddress": navigation.Navaddress, "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, "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, "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.SgjPatientOldrotation,error) {
- oldrotation := models.SgjPatientOldrotation{}
- err := service.PatientReadDB().Model(oldrotation).Where("mode_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).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 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}).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{}{"con_id": conlinkaddress.ConId, "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).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).Find(&rotation).Error
- return rotation,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 = ?", id, orgid).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(id int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error) {
- err = service.PatientReadDB().Model(&editpiclink).Where("id=? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
- return editpiclink,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, "mtime": time.Now().Unix()}).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 = ?", orgid, 1).Limit(limit).Find(&articlelist).Error
- return
- }
-
- //func GetAllArticlesDetail(id int64) {
- //
- //}
-
- 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)(models.SgjPatientMacnavigation,error) {
- macnavigation := models.SgjPatientMacnavigation{}
- 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 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 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, "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 GetLinkAddress(orgid int64)(models.SgjPatientLinkaddress,error) {
-
- linkaddress := models.SgjPatientLinkaddress{}
- err := service.PatientReadDB().Model(&linkaddress).Where("user_org_id = ? AND status = ? ", orgid, 1).Last(&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 AddPicLinkAddress(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,conid int64)(models.SgjPatientConlinkaddress,error) {
- conlinkaddress := models.SgjPatientConlinkaddress{}
- err := service.PatientReadDB().Where("user_org_id = ? AND con_id = ? AND status = ?", orgid, conid, 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).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).Find(&conrotation).Error
- return conrotation,err
- }
-
- func AddMagiclinkData(magiclink *models.SgjPatientMagiclink)error {
-
- err := service.PatientWriteDB().Create(&magiclink).Error
- return err
- }
-
- func GetMacLinkAddress(orgid int64)(models.SgjPatientMagiclink,error) {
- patientMagiclink := models.SgjPatientMagiclink{}
- err := service.PatientReadDB().Model(&patientMagiclink).Where("user_org_id = ? AND status = ?", orgid, 1).Last(&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
- }
|