1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package service
-
- import (
- "Xcx_New/models"
- "github.com/jinzhu/gorm"
- )
-
- func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
- role := models.XcxAdminUserRole{}
-
- err := UserReadDB().Model(&role).Where("mobile = ? and status = 1", mobile).Find(&role).Error
- if err == gorm.ErrRecordNotFound {
- return nil, err
- }
-
- if err != nil {
- return nil, err
- }
- return &role, nil
- }
-
- func CreateXcxAdminUser(role models.XcxAdminUserRole) error {
-
- err := UserReadDB().Create(&role).Error
- return err
- }
-
- func GetLoginInfor(mobile string) (models.XcxAdminUserRole, error) {
- role := models.XcxAdminUserRole{}
- err := UserReadDB().Model(&role).Where("mobile = ? and status = 1", mobile).Find(&role).Error
- return role, err
- }
-
- func GetMobilePatientInfo(mobile string) (models.XcxPatients, error) {
-
- patients := models.XcxPatients{}
- err := XTReadDB().Model(&patients).Where("(phone = ? or home_telephone = ? ) and status = 1", mobile, mobile).Find(&patients).Error
- //if err == gorm.ErrRecordNotFound {
- // return nil, err
- //}
- //
- //if err != nil {
- // return nil, err
- //}
- return patients, err
- }
|