package svc import ( "applet/app/admin/md" "applet/app/db" "applet/app/enum" ) func NursingHomeInfo(enterpriseId int) (err error, resp md.NursingHomeInfoResp) { //1、查询`enterprise` enterpriseDb := db.EnterpriseDb{} enterpriseDb.Set() enterprise, err := enterpriseDb.GetEnterprise(enterpriseId) if err != nil { return } resp.Name = enterprise.Name resp.Memo = enterprise.Memo resp.Kind = enum.EnterpriseKind(enterprise.Kind).String() resp.State = enum.EnterpriseState(enterprise.State).String() //2、查询`nursing_home_with_spec` nursingHomeForSchoolWithSpec := db.NursingHomeWithSpec{} nursingHomeForSchoolWithSpec.Set(enterpriseId) spec, err := nursingHomeForSchoolWithSpec.GetNursingHomeWithSpec() if err != nil { return } if spec != nil { resp.IsOpenBreakfast = spec.IsOpenBreakfast resp.IsOpenLunch = spec.IsOpenLunch resp.IsOpenDinner = spec.IsOpenDinner } //3、查询`nursing_home_set` nursingHomeSetDb := db.NursingHomeSetDb{} nursingHomeSetDb.Set(enterpriseId) set, err := nursingHomeSetDb.GetNursingHomeSet() if err != nil { return } if set != nil { resp.IsOpenReportMealForDay = set.IsOpenReportMealForDay resp.IsOpenReportMealForMonth = set.IsOpenReportMealForMonth resp.IsOpenReportMealForYear = set.IsOpenReportMealForYear } //4、统计 用户 数量 userIdentityDb := db.UserIdentityDb{} userIdentityDb.Set(0) resp.UserIdentityNums, err = userIdentityDb.CountUserIdentityForEnterprise(enterpriseId, enum.UserIdentityForNursingHome) if err != nil { return } return }