package service import ( "SSO/models" ) func CreateVMOrgPatient(patients *models.VMOrgPatients) { writeXTDb.Model(&models.VMOrgPatients{}).Create(&patients) } func CreateVMOrgNewPatient(patientsNew *models.XtPatientsNew) { writeXTDb.Model(&models.XtPatientsNew{}).Create(&patientsNew) } func CreateVMZone(zone *models.VMDeviceZone) { writeXTDb.Model(&models.VMDeviceZone{}).Create(&zone) } func CreateVMGroup(group *models.VMDeviceGroup) { writeXTDb.Model(&models.VMDeviceGroup{}).Create(&group) } func CreateVMDeviceNumber(number *models.VMDeviceNumber) { writeXTDb.Model(&models.VMDeviceNumber{}).Create(&number) } func CreateVMSch(sch *models.VMSchedule) { writeXTDb.Model(&models.VMSchedule{}).Create(&sch) } func CreateVMSchMode(schMode *models.VMPatientScheduleTemplateMode) { writeXTDb.Model(&models.VMPatientScheduleTemplateMode{}).Create(&schMode) } func CreateVMSchTemplateId(schTemplateId *models.VMPatientScheduleTemplateId) { writeXTDb.Model(&models.VMPatientScheduleTemplateId{}).Create(&schTemplateId) } func CreateVMSchTemplate(schTemplate *models.VMPatientScheduleTemplateItem) { writeXTDb.Model(&models.VMPatientScheduleTemplateItem{}).Create(&schTemplate) } func CreateVMPrescription(sys *models.SystemPrescription) { writeXTDb.Model(&models.SystemPrescription{}).Create(&sys) } func CreatedDeviceMode(mode *models.VMDeviceMode) { writeUserDb.Model(&models.VMDeviceMode{}).Create(&mode) } func GetFirstDeviceMode(orgid int64) (models.VMDeviceMode, error) { mode := models.VMDeviceMode{} err = readUserDb.Where("user_org_id = ? and status =1", orgid).First(&mode).Error return mode, err } func GetFirstBedNumber(orgid int64) (models.VMDeviceNumber, error) { number := models.VMDeviceNumber{} err := readXTDb.Where("org_id = ? and status =1", orgid).First(&number).Error return number, err } func CreateDeviceAddMacher(addmacher *models.VmDeviceAddmacher) { writeUserDb.Model(&models.VmDeviceAddmacher{}).Create(&addmacher) } func GetLastMacher(orgid int64) (models.VmDeviceAddmacher, error) { addmacher := models.VmDeviceAddmacher{} err := readUserDb.Where("user_org_id = ? and status =1", orgid).First(&addmacher).Error return addmacher, err } func CreatedTreateMode(treatmentmode *models.VmDeviceTreatmentmode) { writeXTDb.Model(&models.VmDeviceTreatmentmode{}).Create(&treatmentmode) } func CreateOrgRole(role *models.Role) (err error) { err = writeUserDb.Create(&role).Error return } func GetRolePurview(roleID int64) (models.RolePurview, error) { var rolePurviews models.RolePurview var err error err = readUserDb.Where("role_id = ?", roleID).First(&rolePurviews).Error return rolePurviews, err } func GetFuncRolePurview(roleID int64) (models.SgjUserRoleFuncPurview, error) { var rolePurviews models.SgjUserRoleFuncPurview var err error err = readUserDb.Where("role_id = ?", roleID).First(&rolePurviews).Error return rolePurviews, err } func CreateRolePurview(purview *models.RolePurview) (err error) { err = writeUserDb.Create(&purview).Error return } func CreateFuncRolePurview(purview *models.SgjUserRoleFuncPurview) (err error) { err = writeUserDb.Create(&purview).Error return } func BatchInsertFiledSystemConfig(org_id int64) (err error) { err = readDb.Exec("INSERT INTO sgj_xt.xt_filed_config ( org_id, module, filed_name, filed_name_cn, is_show ) SELECT ?, module, filed_name, filed_name_cn, is_show FROM sgj_xt.xt_filed_config WHERE org_id = 9442 AND sys_module = 2", org_id).Error return } func CreateVMPrintTemplate(template *models.VMGobalTemplate) (err error) { err = writeDb.Model(&models.VMGobalTemplate{}).Create(template).Error return }