sso

vm_service.go 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package service
  2. import (
  3. "SSO/models"
  4. )
  5. func CreateVMOrgPatient(patients *models.VMOrgPatients) {
  6. writeXTDb.Model(&models.VMOrgPatients{}).Create(&patients)
  7. }
  8. func CreateVMOrgNewPatient(patientsNew *models.XtPatientsNew) {
  9. writeXTDb.Model(&models.XtPatientsNew{}).Create(&patientsNew)
  10. }
  11. func CreateVMZone(zone *models.VMDeviceZone) {
  12. writeXTDb.Model(&models.VMDeviceZone{}).Create(&zone)
  13. }
  14. func CreateVMGroup(group *models.VMDeviceGroup) {
  15. writeXTDb.Model(&models.VMDeviceGroup{}).Create(&group)
  16. }
  17. func CreateVMDeviceNumber(number *models.VMDeviceNumber) {
  18. writeXTDb.Model(&models.VMDeviceNumber{}).Create(&number)
  19. }
  20. func CreateVMSch(sch *models.VMSchedule) {
  21. writeXTDb.Model(&models.VMSchedule{}).Create(&sch)
  22. }
  23. func CreateVMSchMode(schMode *models.VMPatientScheduleTemplateMode) {
  24. writeXTDb.Model(&models.VMPatientScheduleTemplateMode{}).Create(&schMode)
  25. }
  26. func CreateVMSchTemplateId(schTemplateId *models.VMPatientScheduleTemplateId) {
  27. writeXTDb.Model(&models.VMPatientScheduleTemplateId{}).Create(&schTemplateId)
  28. }
  29. func CreateVMSchTemplate(schTemplate *models.VMPatientScheduleTemplateItem) {
  30. writeXTDb.Model(&models.VMPatientScheduleTemplateItem{}).Create(&schTemplate)
  31. }
  32. func CreateVMPrescription(sys *models.SystemPrescription) {
  33. writeXTDb.Model(&models.SystemPrescription{}).Create(&sys)
  34. }
  35. func CreatedDeviceMode(mode *models.VMDeviceMode) {
  36. writeUserDb.Model(&models.VMDeviceMode{}).Create(&mode)
  37. }
  38. func GetFirstDeviceMode(orgid int64) (models.VMDeviceMode, error) {
  39. mode := models.VMDeviceMode{}
  40. err = readUserDb.Where("user_org_id = ? and status =1", orgid).First(&mode).Error
  41. return mode, err
  42. }
  43. func GetFirstBedNumber(orgid int64) (models.VMDeviceNumber, error) {
  44. number := models.VMDeviceNumber{}
  45. err := readXTDb.Where("org_id = ? and status =1", orgid).First(&number).Error
  46. return number, err
  47. }
  48. func CreateDeviceAddMacher(addmacher *models.VmDeviceAddmacher) {
  49. writeUserDb.Model(&models.VmDeviceAddmacher{}).Create(&addmacher)
  50. }
  51. func GetLastMacher(orgid int64) (models.VmDeviceAddmacher, error) {
  52. addmacher := models.VmDeviceAddmacher{}
  53. err := readUserDb.Where("user_org_id = ? and status =1", orgid).First(&addmacher).Error
  54. return addmacher, err
  55. }
  56. func CreatedTreateMode(treatmentmode *models.VmDeviceTreatmentmode) {
  57. writeXTDb.Model(&models.VmDeviceTreatmentmode{}).Create(&treatmentmode)
  58. }
  59. func CreateOrgRole(role *models.Role) (err error) {
  60. err = writeUserDb.Create(&role).Error
  61. return
  62. }
  63. func GetRolePurview(roleID int64) (models.RolePurview, error) {
  64. var rolePurviews models.RolePurview
  65. var err error
  66. err = readUserDb.Where("role_id = ?", roleID).First(&rolePurviews).Error
  67. return rolePurviews, err
  68. }
  69. func GetFuncRolePurview(roleID int64) (models.SgjUserRoleFuncPurview, error) {
  70. var rolePurviews models.SgjUserRoleFuncPurview
  71. var err error
  72. err = readUserDb.Where("role_id = ?", roleID).First(&rolePurviews).Error
  73. return rolePurviews, err
  74. }
  75. func CreateRolePurview(purview *models.RolePurview) (err error) {
  76. err = writeUserDb.Create(&purview).Error
  77. return
  78. }
  79. func CreateFuncRolePurview(purview *models.SgjUserRoleFuncPurview) (err error) {
  80. err = writeUserDb.Create(&purview).Error
  81. return
  82. }
  83. func BatchInsertFiledSystemConfig(org_id int64) (err error) {
  84. 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
  85. return
  86. }
  87. func CreateVMPrintTemplate(template *models.VMGobalTemplate) (err error) {
  88. err = writeDb.Model(&models.VMGobalTemplate{}).Create(template).Error
  89. return
  90. }