智慧食堂
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

svc_nursing_home.go 1.5 KiB

1 년 전
1 년 전
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package svc
  2. import (
  3. "applet/app/admin/md"
  4. "applet/app/db"
  5. "applet/app/enum"
  6. )
  7. func NursingHomeInfo(enterpriseId int) (err error, resp md.NursingHomeInfoResp) {
  8. //1、查询`enterprise`
  9. enterpriseDb := db.EnterpriseDb{}
  10. enterpriseDb.Set()
  11. enterprise, err := enterpriseDb.GetEnterprise(enterpriseId)
  12. if err != nil {
  13. return
  14. }
  15. resp.Name = enterprise.Name
  16. resp.Memo = enterprise.Memo
  17. resp.Kind = enum.EnterpriseKind(enterprise.Kind).String()
  18. resp.State = enum.EnterpriseState(enterprise.State).String()
  19. //2、查询`nursing_home_with_spec`
  20. nursingHomeForSchoolWithSpec := db.NursingHomeWithSpec{}
  21. nursingHomeForSchoolWithSpec.Set(enterpriseId)
  22. spec, err := nursingHomeForSchoolWithSpec.GetNursingHomeWithSpec()
  23. if err != nil {
  24. return
  25. }
  26. if spec != nil {
  27. resp.IsOpenBreakfast = spec.IsOpenBreakfast
  28. resp.IsOpenLunch = spec.IsOpenLunch
  29. resp.IsOpenDinner = spec.IsOpenDinner
  30. }
  31. //3、查询`nursing_home_set`
  32. nursingHomeSetDb := db.NursingHomeSetDb{}
  33. nursingHomeSetDb.Set(enterpriseId)
  34. set, err := nursingHomeSetDb.GetNursingHomeSet()
  35. if err != nil {
  36. return
  37. }
  38. if set != nil {
  39. resp.IsOpenReportMealForDay = set.IsOpenReportMealForDay
  40. resp.IsOpenReportMealForMonth = set.IsOpenReportMealForMonth
  41. resp.IsOpenReportMealForYear = set.IsOpenReportMealForYear
  42. }
  43. //4、统计 用户 数量
  44. userIdentityDb := db.UserIdentityDb{}
  45. userIdentityDb.Set(0)
  46. resp.UserIdentityNums, err = userIdentityDb.CountUserIdentityForEnterprise(enterpriseId, enum.UserIdentityForNursingHome)
  47. if err != nil {
  48. return
  49. }
  50. return
  51. }