vm_service.go 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package service
  2. import (
  3. "XT_New/models"
  4. )
  5. func CreateVMOrgPatient(patients *models.VMOrgPatients) {
  6. writeDb.Model(&models.VMOrgPatients{}).Create(&patients)
  7. }
  8. func CreateVMOrgNewPatient(patientsNew *models.XtPatientsNew) {
  9. writeDb.Model(&models.XtPatientsNew{}).Create(&patientsNew)
  10. }
  11. func CreateVMZone(zone *models.VMDeviceZone) {
  12. writeDb.Model(&models.VMDeviceZone{}).Create(&zone)
  13. }
  14. func CreateVMGroup(group *models.VMDeviceGroup) {
  15. writeDb.Model(&models.VMDeviceGroup{}).Create(&group)
  16. }
  17. func CreateVMDeviceNumber(number *models.VMDeviceNumber) {
  18. writeDb.Model(&models.VMDeviceNumber{}).Create(&number)
  19. }
  20. func CreateVMSch(sch *models.VMSchedule) {
  21. writeDb.Model(&models.VMSchedule{}).Create(&sch)
  22. }
  23. func CreateVMSchMode(schMode *models.VMPatientScheduleTemplateMode) {
  24. writeDb.Model(&models.VMPatientScheduleTemplateMode{}).Create(&schMode)
  25. }
  26. func CreateVMSchTemplateId(schTemplateId *models.VMPatientScheduleTemplateId) {
  27. writeDb.Model(&models.VMPatientScheduleTemplateId{}).Create(&schTemplateId)
  28. }
  29. func CreateVMSchTemplate(schTemplate *models.VMPatientScheduleTemplateItem) {
  30. writeDb.Model(&models.VMPatientScheduleTemplateItem{}).Create(&schTemplate)
  31. }
  32. func CreateVMPrescription(sys *models.SystemPrescription) {
  33. writeDb.Model(&models.SystemPrescription{}).Create(&sys)
  34. }
  35. func CreatedDeviceMode(mode *models.VMDeviceMode) {
  36. UserWriteDB().Model(&models.VMDeviceMode{}).Create(&mode)
  37. }
  38. func GetFirstDeviceMode(orgid int64) (models.VMDeviceMode, error) {
  39. mode := models.VMDeviceMode{}
  40. err = UserReadDB().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 := XTReadDB().Where("org_id = ? and status =1", orgid).First(&number).Error
  46. return number, err
  47. }
  48. func CreateDeviceAddMacher(addmacher *models.VmDeviceAddmacher) {
  49. UserWriteDB().Model(&models.VmDeviceAddmacher{}).Create(&addmacher)
  50. }
  51. func GetLastMacher(orgid int64) (models.VmDeviceAddmacher, error) {
  52. addmacher := models.VmDeviceAddmacher{}
  53. err := UserReadDB().Where("user_org_id = ? and status =1", orgid).First(&addmacher).Error
  54. return addmacher, err
  55. }
  56. func CreatedTreateMode(treatmentmode *models.VmDeviceTreatmentmode) {
  57. XTWriteDB().Model(&models.VmDeviceTreatmentmode{}).Create(&treatmentmode)
  58. }